@aws/durable-execution-sdk-js 0.0.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +365 -0
- package/dist/index.mjs +4628 -0
- package/dist/index.mjs.map +1 -0
- package/dist-cjs/index.js +4646 -0
- package/dist-cjs/index.js.map +1 -0
- package/dist-types/context/durable-context/durable-context.d.ts +70 -0
- package/dist-types/context/durable-context/durable-context.d.ts.map +1 -0
- package/dist-types/context/durable-context/durable-context.integration.test.d.ts +2 -0
- package/dist-types/context/durable-context/durable-context.integration.test.d.ts.map +1 -0
- package/dist-types/context/durable-context/durable-context.unit.test.d.ts +2 -0
- package/dist-types/context/durable-context/durable-context.unit.test.d.ts.map +1 -0
- package/dist-types/context/durable-context/logger-mode-aware.test.d.ts +2 -0
- package/dist-types/context/durable-context/logger-mode-aware.test.d.ts.map +1 -0
- package/dist-types/context/durable-context/logger-property.test.d.ts +2 -0
- package/dist-types/context/durable-context/logger-property.test.d.ts.map +1 -0
- package/dist-types/context/durable-context/mode-management/mode-management.d.ts +13 -0
- package/dist-types/context/durable-context/mode-management/mode-management.d.ts.map +1 -0
- package/dist-types/context/durable-context/mode-management/mode-management.test.d.ts +2 -0
- package/dist-types/context/durable-context/mode-management/mode-management.test.d.ts.map +1 -0
- package/dist-types/context/execution-context/execution-context.d.ts +9 -0
- package/dist-types/context/execution-context/execution-context.d.ts.map +1 -0
- package/dist-types/context/execution-context/execution-context.test.d.ts +2 -0
- package/dist-types/context/execution-context/execution-context.test.d.ts.map +1 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client-caching.test.d.ts +2 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client-caching.test.d.ts.map +1 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client.d.ts +29 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client.d.ts.map +1 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client.test.d.ts +2 -0
- package/dist-types/durable-execution-api-client/durable-execution-api-client.test.d.ts.map +1 -0
- package/dist-types/errors/callback-error/callback-error.test.d.ts +2 -0
- package/dist-types/errors/callback-error/callback-error.test.d.ts.map +1 -0
- package/dist-types/errors/checkpoint-errors/checkpoint-errors.d.ts +21 -0
- package/dist-types/errors/checkpoint-errors/checkpoint-errors.d.ts.map +1 -0
- package/dist-types/errors/checkpoint-errors/checkpoint-errors.test.d.ts +2 -0
- package/dist-types/errors/checkpoint-errors/checkpoint-errors.test.d.ts.map +1 -0
- package/dist-types/errors/durable-error/durable-error-coverage.test.d.ts +2 -0
- package/dist-types/errors/durable-error/durable-error-coverage.test.d.ts.map +1 -0
- package/dist-types/errors/durable-error/durable-error.d.ts +61 -0
- package/dist-types/errors/durable-error/durable-error.d.ts.map +1 -0
- package/dist-types/errors/durable-error/durable-error.test.d.ts +2 -0
- package/dist-types/errors/durable-error/durable-error.test.d.ts.map +1 -0
- package/dist-types/errors/durable-error/error-determinism.integration.test.d.ts +2 -0
- package/dist-types/errors/durable-error/error-determinism.integration.test.d.ts.map +1 -0
- package/dist-types/errors/non-deterministic-error/non-deterministic-error.d.ts +10 -0
- package/dist-types/errors/non-deterministic-error/non-deterministic-error.d.ts.map +1 -0
- package/dist-types/errors/serdes-errors/serdes-errors.d.ts +27 -0
- package/dist-types/errors/serdes-errors/serdes-errors.d.ts.map +1 -0
- package/dist-types/errors/serdes-errors/serdes-errors.test.d.ts +2 -0
- package/dist-types/errors/serdes-errors/serdes-errors.test.d.ts.map +1 -0
- package/dist-types/errors/step-errors/step-errors.d.ts +9 -0
- package/dist-types/errors/step-errors/step-errors.d.ts.map +1 -0
- package/dist-types/errors/unrecoverable-error/unrecoverable-error.d.ts +41 -0
- package/dist-types/errors/unrecoverable-error/unrecoverable-error.d.ts.map +1 -0
- package/dist-types/errors/unrecoverable-error/unrecoverable-error.test.d.ts +2 -0
- package/dist-types/errors/unrecoverable-error/unrecoverable-error.test.d.ts.map +1 -0
- package/dist-types/handlers/callback-handler/callback-promise.d.ts +5 -0
- package/dist-types/handlers/callback-handler/callback-promise.d.ts.map +1 -0
- package/dist-types/handlers/callback-handler/callback-promise.test.d.ts +2 -0
- package/dist-types/handlers/callback-handler/callback-promise.test.d.ts.map +1 -0
- package/dist-types/handlers/callback-handler/callback.d.ts +6 -0
- package/dist-types/handlers/callback-handler/callback.d.ts.map +1 -0
- package/dist-types/handlers/callback-handler/callback.test.d.ts +2 -0
- package/dist-types/handlers/callback-handler/callback.test.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/batch-result.d.ts +35 -0
- package/dist-types/handlers/concurrent-execution-handler/batch-result.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/batch-result.test.d.ts +2 -0
- package/dist-types/handlers/concurrent-execution-handler/batch-result.test.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts +13 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.integration.test.d.ts +2 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.integration.test.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.replay.test.d.ts +2 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.replay.test.d.ts.map +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.test.d.ts +2 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/invoke-handler/invoke-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/invoke-handler/invoke-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/invoke-handler/invoke-handler.d.ts +7 -0
- package/dist-types/handlers/invoke-handler/invoke-handler.d.ts.map +1 -0
- package/dist-types/handlers/invoke-handler/invoke-handler.test.d.ts +2 -0
- package/dist-types/handlers/invoke-handler/invoke-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/map-handler/map-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/map-handler/map-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/map-handler/map-handler.d.ts +3 -0
- package/dist-types/handlers/map-handler/map-handler.d.ts.map +1 -0
- package/dist-types/handlers/map-handler/map-handler.test.d.ts +2 -0
- package/dist-types/handlers/map-handler/map-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/parallel-handler/parallel-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/parallel-handler/parallel-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/parallel-handler/parallel-handler.d.ts +3 -0
- package/dist-types/handlers/parallel-handler/parallel-handler.d.ts.map +1 -0
- package/dist-types/handlers/parallel-handler/parallel-handler.test.d.ts +2 -0
- package/dist-types/handlers/parallel-handler/parallel-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/promise-handler/promise-handler.d.ts +8 -0
- package/dist-types/handlers/promise-handler/promise-handler.d.ts.map +1 -0
- package/dist-types/handlers/promise-handler/promise-handler.test.d.ts +2 -0
- package/dist-types/handlers/promise-handler/promise-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts +10 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts.map +1 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.test.d.ts +2 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-integration.test.d.ts +2 -0
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-integration.test.d.ts.map +1 -0
- package/dist-types/handlers/step-handler/step-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/step-handler/step-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/step-handler/step-handler.d.ts +6 -0
- package/dist-types/handlers/step-handler/step-handler.d.ts.map +1 -0
- package/dist-types/handlers/step-handler/step-handler.test.d.ts +2 -0
- package/dist-types/handlers/step-handler/step-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/step-handler/step-handler.timing.test.d.ts +2 -0
- package/dist-types/handlers/step-handler/step-handler.timing.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.d.ts +3 -0
- package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.test.d.ts +2 -0
- package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts +5 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.test.d.ts +2 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.timing.test.d.ts +2 -0
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.timing.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts +2 -0
- package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-handler/wait-handler-two-phase.test.d.ts +2 -0
- package/dist-types/handlers/wait-handler/wait-handler-two-phase.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-handler/wait-handler.d.ts +8 -0
- package/dist-types/handlers/wait-handler/wait-handler.d.ts.map +1 -0
- package/dist-types/handlers/wait-handler/wait-handler.test.d.ts +2 -0
- package/dist-types/handlers/wait-handler/wait-handler.test.d.ts.map +1 -0
- package/dist-types/index.d.ts +12 -0
- package/dist-types/index.d.ts.map +1 -0
- package/dist-types/run-durable.d.ts +2 -0
- package/dist-types/run-durable.d.ts.map +1 -0
- package/dist-types/termination-manager/termination-manager-checkpoint.test.d.ts +2 -0
- package/dist-types/termination-manager/termination-manager-checkpoint.test.d.ts.map +1 -0
- package/dist-types/termination-manager/termination-manager.d.ts +15 -0
- package/dist-types/termination-manager/termination-manager.d.ts.map +1 -0
- package/dist-types/termination-manager/termination-manager.test.d.ts +2 -0
- package/dist-types/termination-manager/termination-manager.test.d.ts.map +1 -0
- package/dist-types/termination-manager/types.d.ts +26 -0
- package/dist-types/termination-manager/types.d.ts.map +1 -0
- package/dist-types/testing/create-test-checkpoint-manager.d.ts +5 -0
- package/dist-types/testing/create-test-checkpoint-manager.d.ts.map +1 -0
- package/dist-types/testing/create-test-durable-context.d.ts +32 -0
- package/dist-types/testing/create-test-durable-context.d.ts.map +1 -0
- package/dist-types/testing/mock-batch-result.d.ts +26 -0
- package/dist-types/testing/mock-batch-result.d.ts.map +1 -0
- package/dist-types/testing/mock-checkpoint-manager.d.ts +20 -0
- package/dist-types/testing/mock-checkpoint-manager.d.ts.map +1 -0
- package/dist-types/testing/mock-checkpoint.d.ts +13 -0
- package/dist-types/testing/mock-checkpoint.d.ts.map +1 -0
- package/dist-types/testing/mock-context.d.ts +10 -0
- package/dist-types/testing/mock-context.d.ts.map +1 -0
- package/dist-types/testing/test-constants.d.ts +59 -0
- package/dist-types/testing/test-constants.d.ts.map +1 -0
- package/dist-types/types/batch.d.ts +185 -0
- package/dist-types/types/batch.d.ts.map +1 -0
- package/dist-types/types/callback.d.ts +48 -0
- package/dist-types/types/callback.d.ts.map +1 -0
- package/dist-types/types/child-context.d.ts +24 -0
- package/dist-types/types/child-context.d.ts.map +1 -0
- package/dist-types/types/core.d.ts +313 -0
- package/dist-types/types/core.d.ts.map +1 -0
- package/dist-types/types/durable-context.d.ts +669 -0
- package/dist-types/types/durable-context.d.ts.map +1 -0
- package/dist-types/types/durable-execution.d.ts +192 -0
- package/dist-types/types/durable-execution.d.ts.map +1 -0
- package/dist-types/types/durable-logger.d.ts +69 -0
- package/dist-types/types/durable-logger.d.ts.map +1 -0
- package/dist-types/types/durable-promise.d.ts +80 -0
- package/dist-types/types/durable-promise.d.ts.map +1 -0
- package/dist-types/types/index.d.ts +15 -0
- package/dist-types/types/index.d.ts.map +1 -0
- package/dist-types/types/invoke.d.ts +12 -0
- package/dist-types/types/invoke.d.ts.map +1 -0
- package/dist-types/types/logger.d.ts +63 -0
- package/dist-types/types/logger.d.ts.map +1 -0
- package/dist-types/types/operation-lifecycle-state.d.ts +27 -0
- package/dist-types/types/operation-lifecycle-state.d.ts.map +1 -0
- package/dist-types/types/operation-lifecycle.d.ts +27 -0
- package/dist-types/types/operation-lifecycle.d.ts.map +1 -0
- package/dist-types/types/step.d.ts +76 -0
- package/dist-types/types/step.d.ts.map +1 -0
- package/dist-types/types/wait-condition.d.ts +46 -0
- package/dist-types/types/wait-condition.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-error-classification.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-error-classification.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-helper.d.ts +47 -0
- package/dist-types/utils/checkpoint/checkpoint-helper.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-integration.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-integration.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-manager.d.ts +78 -0
- package/dist-types/utils/checkpoint/checkpoint-manager.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-queue-completion.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-queue-completion.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-stepdata-update.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-stepdata-update.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-termination.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-termination.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint.test.d.ts.map +1 -0
- package/dist-types/utils/constants/constants.d.ts +9 -0
- package/dist-types/utils/constants/constants.d.ts.map +1 -0
- package/dist-types/utils/context-tracker/context-tracker.d.ts +13 -0
- package/dist-types/utils/context-tracker/context-tracker.d.ts.map +1 -0
- package/dist-types/utils/context-tracker/context-tracker.test.d.ts +2 -0
- package/dist-types/utils/context-tracker/context-tracker.test.d.ts.map +1 -0
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts +22 -0
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts.map +1 -0
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts +2 -0
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts.map +1 -0
- package/dist-types/utils/duration/duration.d.ts +8 -0
- package/dist-types/utils/duration/duration.d.ts.map +1 -0
- package/dist-types/utils/duration/duration.test.d.ts +2 -0
- package/dist-types/utils/duration/duration.test.d.ts.map +1 -0
- package/dist-types/utils/error-object/error-object-coverage.test.d.ts +2 -0
- package/dist-types/utils/error-object/error-object-coverage.test.d.ts.map +1 -0
- package/dist-types/utils/error-object/error-object.d.ts +3 -0
- package/dist-types/utils/error-object/error-object.d.ts.map +1 -0
- package/dist-types/utils/error-object/error-object.test.d.ts +2 -0
- package/dist-types/utils/error-object/error-object.test.d.ts.map +1 -0
- package/dist-types/utils/logger/default-logger.d.ts +51 -0
- package/dist-types/utils/logger/default-logger.d.ts.map +1 -0
- package/dist-types/utils/logger/default-logger.test.d.ts +2 -0
- package/dist-types/utils/logger/default-logger.test.d.ts.map +1 -0
- package/dist-types/utils/logger/logger.d.ts +2 -0
- package/dist-types/utils/logger/logger.d.ts.map +1 -0
- package/dist-types/utils/logger/logger.test.d.ts +2 -0
- package/dist-types/utils/logger/logger.test.d.ts.map +1 -0
- package/dist-types/utils/logger/structured-logger-integration.test.d.ts +2 -0
- package/dist-types/utils/logger/structured-logger-integration.test.d.ts.map +1 -0
- package/dist-types/utils/replay-validation/replay-validation.d.ts +8 -0
- package/dist-types/utils/replay-validation/replay-validation.d.ts.map +1 -0
- package/dist-types/utils/replay-validation/replay-validation.test.d.ts +2 -0
- package/dist-types/utils/replay-validation/replay-validation.test.d.ts.map +1 -0
- package/dist-types/utils/retry/retry-config/index.d.ts +167 -0
- package/dist-types/utils/retry/retry-config/index.d.ts.map +1 -0
- package/dist-types/utils/retry/retry-config/index.test.d.ts +2 -0
- package/dist-types/utils/retry/retry-config/index.test.d.ts.map +1 -0
- package/dist-types/utils/retry/retry-presets/retry-presets.d.ts +35 -0
- package/dist-types/utils/retry/retry-presets/retry-presets.d.ts.map +1 -0
- package/dist-types/utils/safe-stringify/safe-stringify.d.ts +2 -0
- package/dist-types/utils/safe-stringify/safe-stringify.d.ts.map +1 -0
- package/dist-types/utils/safe-stringify/safe-stringify.test.d.ts +2 -0
- package/dist-types/utils/safe-stringify/safe-stringify.test.d.ts.map +1 -0
- package/dist-types/utils/serdes/serdes.d.ts +152 -0
- package/dist-types/utils/serdes/serdes.d.ts.map +1 -0
- package/dist-types/utils/serdes/serdes.test.d.ts +2 -0
- package/dist-types/utils/serdes/serdes.test.d.ts.map +1 -0
- package/dist-types/utils/step-id-utils/step-id-utils.d.ts +16 -0
- package/dist-types/utils/step-id-utils/step-id-utils.d.ts.map +1 -0
- package/dist-types/utils/step-id-utils/step-id-utils.test.d.ts +2 -0
- package/dist-types/utils/step-id-utils/step-id-utils.test.d.ts.map +1 -0
- package/dist-types/utils/summary-generators/summary-generators.d.ts +10 -0
- package/dist-types/utils/summary-generators/summary-generators.d.ts.map +1 -0
- package/dist-types/utils/summary-generators/summary-generators.test.d.ts +2 -0
- package/dist-types/utils/summary-generators/summary-generators.test.d.ts.map +1 -0
- package/dist-types/utils/termination-helper/termination-deferral.test.d.ts +2 -0
- package/dist-types/utils/termination-helper/termination-deferral.test.d.ts.map +1 -0
- package/dist-types/utils/termination-helper/termination-helper.d.ts +11 -0
- package/dist-types/utils/termination-helper/termination-helper.d.ts.map +1 -0
- package/dist-types/utils/termination-helper/termination-helper.test.d.ts +2 -0
- package/dist-types/utils/termination-helper/termination-helper.test.d.ts.map +1 -0
- package/dist-types/utils/wait-strategy/wait-strategy-config.d.ts +19 -0
- package/dist-types/utils/wait-strategy/wait-strategy-config.d.ts.map +1 -0
- package/dist-types/utils/wait-strategy/wait-strategy-config.test.d.ts +2 -0
- package/dist-types/utils/wait-strategy/wait-strategy-config.test.d.ts.map +1 -0
- package/dist-types/with-durable-execution-queue-completion.test.d.ts +2 -0
- package/dist-types/with-durable-execution-queue-completion.test.d.ts.map +1 -0
- package/dist-types/with-durable-execution.d.ts +75 -0
- package/dist-types/with-durable-execution.d.ts.map +1 -0
- package/dist-types/with-durable-execution.test.d.ts +2 -0
- package/dist-types/with-durable-execution.test.d.ts.map +1 -0
- package/package.json +69 -3
package/README.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# AWS Durable Execution SDK for JavaScript
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for building stateful, long-running AWS Lambda functions with automatic state persistence, retry logic, and workflow orchestration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Durable Execution**: Automatically persists state and resumes from checkpoints
|
|
8
|
+
- **Automatic Retries**: Configurable retry strategies with exponential backoff and jitter
|
|
9
|
+
- **Workflow Orchestration**: Compose complex workflows with steps, child contexts, and parallel execution
|
|
10
|
+
- **External Integration**: Wait for callbacks from external systems
|
|
11
|
+
- **Batch Operations**: Process arrays with concurrency control and completion policies
|
|
12
|
+
- **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @aws/durable-execution-sdk-js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {
|
|
24
|
+
withDurableExecution,
|
|
25
|
+
DurableContext,
|
|
26
|
+
} from "@aws/durable-execution-sdk-js";
|
|
27
|
+
|
|
28
|
+
const handler = async (event: any, context: DurableContext) => {
|
|
29
|
+
// Execute a durable step with automatic retry
|
|
30
|
+
const userData = await context.step("fetch-user", async () =>
|
|
31
|
+
fetchUserFromDB(event.userId),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Wait for 5 seconds
|
|
35
|
+
await context.wait({ seconds: 5 });
|
|
36
|
+
|
|
37
|
+
// Process data in another step
|
|
38
|
+
const result = await context.step("process-user", async () =>
|
|
39
|
+
processUser(userData),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const lambdaHandler = withDurableExecution(handler);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
This README provides a quick reference for the SDK's main features. For more detailed information:
|
|
51
|
+
|
|
52
|
+
- **[API Reference](../../docs/api-reference/durable-execution-sdk-js.md)** - Complete technical reference with detailed type definitions and operation specifications
|
|
53
|
+
- **[Concepts and Use Cases](src/documents/CONCEPTS.md)** - Learn about the replay model, best practices, and real-world examples including GenAI agents, human-in-the-loop workflows, and saga patterns
|
|
54
|
+
- **[Contributing](../../CONTRIBUTING.md)** - Learn about contributing to the AWS Durable Execution SDK for JavaScript
|
|
55
|
+
|
|
56
|
+
## Core Concepts
|
|
57
|
+
|
|
58
|
+
### DurableContext
|
|
59
|
+
|
|
60
|
+
The `DurableContext` is the main interface for building durable workflows. It provides methods for executing steps, waiting, invoking other functions, and coordinating parallel operations.
|
|
61
|
+
|
|
62
|
+
### Step Operations
|
|
63
|
+
|
|
64
|
+
Execute atomic operations with automatic retry and state persistence:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Named step with retry configuration
|
|
68
|
+
const result = await context.step(
|
|
69
|
+
"fetch-data",
|
|
70
|
+
async (ctx) => {
|
|
71
|
+
return await fetchFromAPI();
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
retryStrategy: (error, attempt) => ({
|
|
75
|
+
shouldRetry: attempt < 3,
|
|
76
|
+
delay: { seconds: Math.pow(2, attempt) },
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Anonymous step
|
|
82
|
+
const data = await context.step(async () => processData());
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Important**: `step()` is for single atomic operations only. To group multiple durable operations, use `runInChildContext()`.
|
|
86
|
+
|
|
87
|
+
### Child Contexts
|
|
88
|
+
|
|
89
|
+
Group multiple durable operations with isolated state tracking:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const orderResult = await context.runInChildContext(
|
|
93
|
+
"process-order",
|
|
94
|
+
async (childCtx) => {
|
|
95
|
+
// Child context has its own step counter and state
|
|
96
|
+
const validated = await childCtx.step("validate", async () =>
|
|
97
|
+
validateOrder(order),
|
|
98
|
+
);
|
|
99
|
+
await childCtx.wait({ seconds: 1 });
|
|
100
|
+
const charged = await childCtx.step("charge", async () =>
|
|
101
|
+
chargePayment(validated),
|
|
102
|
+
);
|
|
103
|
+
return charged;
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Invoking Other Functions
|
|
109
|
+
|
|
110
|
+
Call another AWS Lambda function and wait for it complete:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const result = await context.invoke(
|
|
114
|
+
"process-payment",
|
|
115
|
+
"arn:aws:lambda:us-east-1:123456789012:function:payment-processor",
|
|
116
|
+
{ amount: 100, currency: "USD" },
|
|
117
|
+
);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Wait Operations
|
|
121
|
+
|
|
122
|
+
Pause execution for a specified duration:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Wait 30 seconds
|
|
126
|
+
await context.wait({ seconds: 30 });
|
|
127
|
+
|
|
128
|
+
// Named wait for tracking
|
|
129
|
+
await context.wait("rate-limit-delay", { seconds: 5 });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Conditional Waiting
|
|
133
|
+
|
|
134
|
+
Wait until a condition is met by periodically checking state:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const finalState = await context.waitForCondition(
|
|
138
|
+
"wait-for-job",
|
|
139
|
+
async (currentState, ctx) => {
|
|
140
|
+
const status = await checkJobStatus(currentState.jobId);
|
|
141
|
+
return { ...currentState, status };
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
initialState: { jobId: "job-123", status: "pending" },
|
|
145
|
+
waitStrategy: (state, attempt) => {
|
|
146
|
+
if (state.status === "completed") {
|
|
147
|
+
return { shouldContinue: false };
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
shouldContinue: true,
|
|
151
|
+
delay: { seconds: Math.min(attempt * 2, 60) },
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### External Callbacks
|
|
159
|
+
|
|
160
|
+
Wait for external systems to complete operations:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// Create a callback and send ID to external system
|
|
164
|
+
const [callbackPromise, callbackId] = await context.createCallback(
|
|
165
|
+
"external-approval",
|
|
166
|
+
{ timeout: { minutes: 3 } },
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
await sendApprovalRequest(callbackId, requestData);
|
|
170
|
+
const approvalResult = await callbackPromise;
|
|
171
|
+
|
|
172
|
+
// Or use waitForCallback with submitter function
|
|
173
|
+
const result = await context.waitForCallback(
|
|
174
|
+
"wait-for-webhook",
|
|
175
|
+
async (callbackId, ctx) => {
|
|
176
|
+
await submitToExternalAPI(callbackId);
|
|
177
|
+
},
|
|
178
|
+
{ timeout: { minutes: 5 } },
|
|
179
|
+
);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Batch Operations
|
|
183
|
+
|
|
184
|
+
### Map
|
|
185
|
+
|
|
186
|
+
Process arrays of items, applying durable operations to each with concurrency control:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const results = await context.map(
|
|
190
|
+
"process-users",
|
|
191
|
+
users,
|
|
192
|
+
async (ctx, user, index) => {
|
|
193
|
+
return await ctx.step(`process-${user.id}`, async () => processUser(user));
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
maxConcurrency: 5,
|
|
197
|
+
completionConfig: {
|
|
198
|
+
minSuccessful: 8,
|
|
199
|
+
toleratedFailureCount: 2,
|
|
200
|
+
},
|
|
201
|
+
itemNamer: (user, index) => `User-${user.id}`,
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
// Check results
|
|
206
|
+
console.log(
|
|
207
|
+
`Succeeded: ${results.successCount}, Failed: ${results.failureCount}`,
|
|
208
|
+
);
|
|
209
|
+
results.throwIfError(); // Throws if any failures
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Note**: `map()` executes durable operations (steps, waits, etc.) within the same Lambda invocation using child contexts for isolation. It does not spawn separate Lambda functions.
|
|
213
|
+
|
|
214
|
+
### Parallel
|
|
215
|
+
|
|
216
|
+
Execute multiple branches with durable operations in parallel:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
const results = await context.parallel(
|
|
220
|
+
"parallel-tasks",
|
|
221
|
+
[
|
|
222
|
+
{ name: "task1", func: async (ctx) => ctx.step(async () => fetchData1()) },
|
|
223
|
+
{ name: "task2", func: async (ctx) => ctx.step(async () => fetchData2()) },
|
|
224
|
+
async (ctx) => ctx.step(async () => fetchData3()),
|
|
225
|
+
],
|
|
226
|
+
{
|
|
227
|
+
maxConcurrency: 2,
|
|
228
|
+
completionConfig: { minSuccessful: 2 },
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Note**: `parallel()` executes durable operations within the same Lambda invocation. Each branch runs in its own child context with isolated state tracking.
|
|
234
|
+
|
|
235
|
+
### Promise Combinators
|
|
236
|
+
|
|
237
|
+
For fast, in-memory operations (use `map()` or `parallel()` for durable operations):
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
// Wait for all promises
|
|
241
|
+
const [user, posts, comments] = await context.promise.all([
|
|
242
|
+
fetchUser(userId),
|
|
243
|
+
fetchPosts(userId),
|
|
244
|
+
fetchComments(userId),
|
|
245
|
+
]);
|
|
246
|
+
|
|
247
|
+
// Race promises
|
|
248
|
+
const fastest = await context.promise.race([
|
|
249
|
+
fetchFromPrimary(),
|
|
250
|
+
fetchFromSecondary(),
|
|
251
|
+
]);
|
|
252
|
+
|
|
253
|
+
// Wait for first success
|
|
254
|
+
const result = await context.promise.any([
|
|
255
|
+
fetchFromSource1(),
|
|
256
|
+
fetchFromSource2(),
|
|
257
|
+
fetchFromSource3(),
|
|
258
|
+
]);
|
|
259
|
+
|
|
260
|
+
// Wait for all to settle
|
|
261
|
+
const results = await context.promise.allSettled([operation1(), operation2()]);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Note**: Promise combinators accept already-executing promises and cannot provide concurrency control or durability. Use `map()` or `parallel()` for durable, controlled execution.
|
|
265
|
+
|
|
266
|
+
## Configuration
|
|
267
|
+
|
|
268
|
+
### Retry Strategies
|
|
269
|
+
|
|
270
|
+
Custom retry strategy:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
await context.step("custom-retry", async () => riskyOperation(), {
|
|
274
|
+
retryStrategy: (error, attempt) => ({
|
|
275
|
+
shouldRetry: attempt < 5 && error.message.includes("timeout"),
|
|
276
|
+
delay: { seconds: attempt * 2 },
|
|
277
|
+
}),
|
|
278
|
+
});
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Step Semantics
|
|
282
|
+
|
|
283
|
+
Control execution guarantees:
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
import { StepSemantics } from "@aws/durable-execution-sdk-js";
|
|
287
|
+
|
|
288
|
+
// At-most-once per retry (default)
|
|
289
|
+
await context.step("idempotent-operation", async () => updateDatabase(), {
|
|
290
|
+
semantics: StepSemantics.AtMostOncePerRetry,
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// At-least-once per retry
|
|
294
|
+
await context.step("retriable-operation", async () => sendNotification(), {
|
|
295
|
+
semantics: StepSemantics.AtLeastOncePerRetry,
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Jitter Strategies
|
|
300
|
+
|
|
301
|
+
Prevent thundering herd:
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
import {
|
|
305
|
+
JitterStrategy,
|
|
306
|
+
createRetryStrategy,
|
|
307
|
+
} from "@aws/durable-execution-sdk-js";
|
|
308
|
+
|
|
309
|
+
const retryStrategy = createRetryStrategy({
|
|
310
|
+
maxAttempts: 5,
|
|
311
|
+
initialDelay: { seconds: 1 },
|
|
312
|
+
maxDelay: { seconds: 60 },
|
|
313
|
+
exponentialDelayFactor: 2,
|
|
314
|
+
jitterStrategy: JitterStrategy.FULL,
|
|
315
|
+
});
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Logging
|
|
319
|
+
|
|
320
|
+
Access enriched logger:
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
const handler = async (event: any, context: DurableContext) => {
|
|
324
|
+
context.logger.info("Processing started", { userId: event.userId });
|
|
325
|
+
|
|
326
|
+
try {
|
|
327
|
+
const result = await context.step("process", async (ctx) => {
|
|
328
|
+
ctx.logger.debug("Step executing");
|
|
329
|
+
return processData();
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
context.logger.info("Processing completed", { result });
|
|
333
|
+
return result;
|
|
334
|
+
} catch (error) {
|
|
335
|
+
context.logger.error("Processing failed", error);
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Custom logger:
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
context.configureLogger({
|
|
345
|
+
customLogger: {
|
|
346
|
+
log: (level, message, data, error) =>
|
|
347
|
+
console.log(`[${level}] ${message}`, data),
|
|
348
|
+
error: (message, error, data) => console.error(message, error, data),
|
|
349
|
+
warn: (message, data) => console.warn(message, data),
|
|
350
|
+
info: (message, data) => console.info(message, data),
|
|
351
|
+
debug: (message, data) => console.debug(message, data),
|
|
352
|
+
},
|
|
353
|
+
modeAware: false, // Optional: show logs during replay (default: true)
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Tip for local development:** Set `modeAware: false` to see all logs during replay, which can be helpful for debugging:
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
context.configureLogger({ modeAware: false });
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## License
|
|
364
|
+
|
|
365
|
+
This project is licensed under the Apache-2.0 License.
|