@smthrs/flow 0.0.0-stage → 1.0.0-rc.13
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/CHANGELOG.md +161 -0
- package/LICENSE +21 -0
- package/README.md +212 -2
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/cjs/Action/Action.d.ts +250 -0
- package/dist/cjs/Action/Action.d.ts.map +1 -0
- package/dist/cjs/Action/Action.js +42 -0
- package/dist/cjs/Action/Action.js.map +7 -0
- package/dist/cjs/Action/AttemptTimedOut.d.ts +33 -0
- package/dist/cjs/Action/AttemptTimedOut.d.ts.map +1 -0
- package/dist/cjs/Action/AttemptTimedOut.js +51 -0
- package/dist/cjs/Action/AttemptTimedOut.js.map +7 -0
- package/dist/cjs/Action/BoundaryMode.d.ts +29 -0
- package/dist/cjs/Action/BoundaryMode.d.ts.map +1 -0
- package/dist/cjs/Action/BoundaryMode.js +36 -0
- package/dist/cjs/Action/BoundaryMode.js.map +7 -0
- package/dist/cjs/Action/CacheEnvironment.d.ts +158 -0
- package/dist/cjs/Action/CacheEnvironment.d.ts.map +1 -0
- package/dist/cjs/Action/CacheEnvironment.js +57 -0
- package/dist/cjs/Action/CacheEnvironment.js.map +7 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.d.ts +34 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.d.ts.map +1 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.js +46 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.js.map +7 -0
- package/dist/cjs/Action/Context.d.ts +131 -0
- package/dist/cjs/Action/Context.d.ts.map +1 -0
- package/dist/cjs/Action/Context.js +68 -0
- package/dist/cjs/Action/Context.js.map +7 -0
- package/dist/cjs/Action/DuplicateImplementation.d.ts +20 -0
- package/dist/cjs/Action/DuplicateImplementation.d.ts.map +1 -0
- package/dist/cjs/Action/DuplicateImplementation.js +46 -0
- package/dist/cjs/Action/DuplicateImplementation.js.map +7 -0
- package/dist/cjs/Action/FileBoundary.d.ts +59 -0
- package/dist/cjs/Action/FileBoundary.d.ts.map +1 -0
- package/dist/cjs/Action/FileBoundary.js +81 -0
- package/dist/cjs/Action/FileBoundary.js.map +7 -0
- package/dist/cjs/Action/FileInput.d.ts +28 -0
- package/dist/cjs/Action/FileInput.d.ts.map +1 -0
- package/dist/cjs/Action/FileInput.js +42 -0
- package/dist/cjs/Action/FileInput.js.map +7 -0
- package/dist/cjs/Action/Filegroup.d.ts +16 -0
- package/dist/cjs/Action/Filegroup.d.ts.map +1 -0
- package/dist/cjs/Action/Filegroup.js +27 -0
- package/dist/cjs/Action/Filegroup.js.map +7 -0
- package/dist/cjs/Action/Glob.d.ts +8 -0
- package/dist/cjs/Action/Glob.d.ts.map +1 -0
- package/dist/cjs/Action/Glob.js +28 -0
- package/dist/cjs/Action/Glob.js.map +7 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.d.ts +26 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.d.ts.map +1 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.js +45 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.js.map +7 -0
- package/dist/cjs/Action/Implementations.d.ts +114 -0
- package/dist/cjs/Action/Implementations.d.ts.map +1 -0
- package/dist/cjs/Action/Implementations.js +65 -0
- package/dist/cjs/Action/Implementations.js.map +7 -0
- package/dist/cjs/Action/InfraInterrupt.d.ts +26 -0
- package/dist/cjs/Action/InfraInterrupt.d.ts.map +1 -0
- package/dist/cjs/Action/InfraInterrupt.js +46 -0
- package/dist/cjs/Action/InfraInterrupt.js.map +7 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.d.ts +33 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.d.ts.map +1 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.js +54 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.js.map +7 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts +26 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.js +47 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.js.map +7 -0
- package/dist/cjs/Action/StepIdentity.d.ts +153 -0
- package/dist/cjs/Action/StepIdentity.d.ts.map +1 -0
- package/dist/cjs/Action/StepIdentity.js +75 -0
- package/dist/cjs/Action/StepIdentity.js.map +7 -0
- package/dist/cjs/Action/TreeArtifact.d.ts +8 -0
- package/dist/cjs/Action/TreeArtifact.d.ts.map +1 -0
- package/dist/cjs/Action/TreeArtifact.js +25 -0
- package/dist/cjs/Action/TreeArtifact.js.map +7 -0
- package/dist/cjs/Action/TypeId.d.ts +8 -0
- package/dist/cjs/Action/TypeId.d.ts.map +1 -0
- package/dist/cjs/Action/TypeId.js +25 -0
- package/dist/cjs/Action/TypeId.js.map +7 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.d.ts +32 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.js +51 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.js.map +7 -0
- package/dist/cjs/Action/idempotencyKey.d.ts +21 -0
- package/dist/cjs/Action/idempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/idempotencyKey.js +59 -0
- package/dist/cjs/Action/idempotencyKey.js.map +7 -0
- package/dist/cjs/Action/index.d.ts +29 -0
- package/dist/cjs/Action/index.d.ts.map +1 -0
- package/dist/cjs/Action/index.js +60 -0
- package/dist/cjs/Action/index.js.map +7 -0
- package/dist/cjs/Action/make.d.ts +128 -0
- package/dist/cjs/Action/make.d.ts.map +1 -0
- package/dist/cjs/Action/make.js +387 -0
- package/dist/cjs/Action/make.js.map +7 -0
- package/dist/cjs/Action/raceAll.d.ts +21 -0
- package/dist/cjs/Action/raceAll.d.ts.map +1 -0
- package/dist/cjs/Action/raceAll.js +46 -0
- package/dist/cjs/Action/raceAll.js.map +7 -0
- package/dist/cjs/Action/retry.d.ts +19 -0
- package/dist/cjs/Action/retry.d.ts.map +1 -0
- package/dist/cjs/Action/retry.js +75 -0
- package/dist/cjs/Action/retry.js.map +7 -0
- package/dist/cjs/Deadline.d.ts +110 -0
- package/dist/cjs/Deadline.d.ts.map +1 -0
- package/dist/cjs/Deadline.js +112 -0
- package/dist/cjs/Deadline.js.map +7 -0
- package/dist/cjs/DurableClock.d.ts +60 -0
- package/dist/cjs/DurableClock.d.ts.map +1 -0
- package/dist/cjs/DurableClock.js +107 -0
- package/dist/cjs/DurableClock.js.map +7 -0
- package/dist/cjs/DurableDeferred.d.ts +311 -0
- package/dist/cjs/DurableDeferred.d.ts.map +1 -0
- package/dist/cjs/DurableDeferred.js +322 -0
- package/dist/cjs/DurableDeferred.js.map +7 -0
- package/dist/cjs/DurableQueue.d.ts +160 -0
- package/dist/cjs/DurableQueue.d.ts.map +1 -0
- package/dist/cjs/DurableQueue.js +229 -0
- package/dist/cjs/DurableQueue.js.map +7 -0
- package/dist/cjs/ExternalJob.d.ts +179 -0
- package/dist/cjs/ExternalJob.d.ts.map +1 -0
- package/dist/cjs/ExternalJob.js +339 -0
- package/dist/cjs/ExternalJob.js.map +7 -0
- package/dist/cjs/Fault.d.ts +131 -0
- package/dist/cjs/Fault.d.ts.map +1 -0
- package/dist/cjs/Fault.js +157 -0
- package/dist/cjs/Fault.js.map +7 -0
- package/dist/cjs/Flow/Annotations.d.ts +245 -0
- package/dist/cjs/Flow/Annotations.d.ts.map +1 -0
- package/dist/cjs/Flow/Annotations.js +72 -0
- package/dist/cjs/Flow/Annotations.js.map +7 -0
- package/dist/cjs/Flow/CapabilityCeiling.d.ts +21 -0
- package/dist/cjs/Flow/CapabilityCeiling.d.ts.map +1 -0
- package/dist/cjs/Flow/CapabilityCeiling.js +49 -0
- package/dist/cjs/Flow/CapabilityCeiling.js.map +7 -0
- package/dist/cjs/Flow/DeadlineExceeded.d.ts +33 -0
- package/dist/cjs/Flow/DeadlineExceeded.d.ts.map +1 -0
- package/dist/cjs/Flow/DeadlineExceeded.js +52 -0
- package/dist/cjs/Flow/DeadlineExceeded.js.map +7 -0
- package/dist/cjs/Flow/ExecutionIdRequired.d.ts +25 -0
- package/dist/cjs/Flow/ExecutionIdRequired.d.ts.map +1 -0
- package/dist/cjs/Flow/ExecutionIdRequired.js +46 -0
- package/dist/cjs/Flow/ExecutionIdRequired.js.map +7 -0
- package/dist/cjs/Flow/ExecutionIds.d.ts +80 -0
- package/dist/cjs/Flow/ExecutionIds.d.ts.map +1 -0
- package/dist/cjs/Flow/ExecutionIds.js +66 -0
- package/dist/cjs/Flow/ExecutionIds.js.map +7 -0
- package/dist/cjs/Flow/Flow.d.ts +422 -0
- package/dist/cjs/Flow/Flow.d.ts.map +1 -0
- package/dist/cjs/Flow/Flow.js +17 -0
- package/dist/cjs/Flow/Flow.js.map +7 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.d.ts +35 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.d.ts.map +1 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.js +50 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.js.map +7 -0
- package/dist/cjs/Flow/Outcome.d.ts +162 -0
- package/dist/cjs/Flow/Outcome.d.ts.map +1 -0
- package/dist/cjs/Flow/Outcome.js +80 -0
- package/dist/cjs/Flow/Outcome.js.map +7 -0
- package/dist/cjs/Flow/Result.d.ts +186 -0
- package/dist/cjs/Flow/Result.d.ts.map +1 -0
- package/dist/cjs/Flow/Result.js +159 -0
- package/dist/cjs/Flow/Result.js.map +7 -0
- package/dist/cjs/Flow/Runtime.d.ts +98 -0
- package/dist/cjs/Flow/Runtime.d.ts.map +1 -0
- package/dist/cjs/Flow/Runtime.js +186 -0
- package/dist/cjs/Flow/Runtime.js.map +7 -0
- package/dist/cjs/Flow/TypeId.d.ts +8 -0
- package/dist/cjs/Flow/TypeId.d.ts.map +1 -0
- package/dist/cjs/Flow/TypeId.js +25 -0
- package/dist/cjs/Flow/TypeId.js.map +7 -0
- package/dist/cjs/Flow/index.d.ts +17 -0
- package/dist/cjs/Flow/index.d.ts.map +1 -0
- package/dist/cjs/Flow/index.js +29 -0
- package/dist/cjs/Flow/index.js.map +7 -0
- package/dist/cjs/Flow/internal.d.ts +34 -0
- package/dist/cjs/Flow/internal.d.ts.map +1 -0
- package/dist/cjs/Flow/internal.js +187 -0
- package/dist/cjs/Flow/internal.js.map +7 -0
- package/dist/cjs/Flow/make.d.ts +149 -0
- package/dist/cjs/Flow/make.d.ts.map +1 -0
- package/dist/cjs/Flow/make.js +107 -0
- package/dist/cjs/Flow/make.js.map +7 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.d.ts +55 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.js +51 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.js.map +7 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.d.ts +23 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.js +55 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.d.ts +28 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.js +49 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.d.ts +38 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.js +53 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowInstance.d.ts +115 -0
- package/dist/cjs/FlowRuntime/FlowInstance.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowInstance.js +37 -0
- package/dist/cjs/FlowRuntime/FlowInstance.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.d.ts +204 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.js +37 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.js.map +7 -0
- package/dist/cjs/FlowRuntime/NodeRecord.d.ts +177 -0
- package/dist/cjs/FlowRuntime/NodeRecord.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/NodeRecord.js +17 -0
- package/dist/cjs/FlowRuntime/NodeRecord.js.map +7 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.d.ts +69 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.js +53 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.js.map +7 -0
- package/dist/cjs/FlowRuntime/index.d.ts +14 -0
- package/dist/cjs/FlowRuntime/index.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/index.js +26 -0
- package/dist/cjs/FlowRuntime/index.js.map +7 -0
- package/dist/cjs/Graph.d.ts +325 -0
- package/dist/cjs/Graph.d.ts.map +1 -0
- package/dist/cjs/Graph.js +1020 -0
- package/dist/cjs/Graph.js.map +7 -0
- package/dist/cjs/HumanTask.d.ts +442 -0
- package/dist/cjs/HumanTask.d.ts.map +1 -0
- package/dist/cjs/HumanTask.js +422 -0
- package/dist/cjs/HumanTask.js.map +7 -0
- package/dist/cjs/Interpreter.d.ts +223 -0
- package/dist/cjs/Interpreter.d.ts.map +1 -0
- package/dist/cjs/Interpreter.js +919 -0
- package/dist/cjs/Interpreter.js.map +7 -0
- package/dist/cjs/Poll.d.ts +240 -0
- package/dist/cjs/Poll.d.ts.map +1 -0
- package/dist/cjs/Poll.js +154 -0
- package/dist/cjs/Poll.js.map +7 -0
- package/dist/cjs/RetryPolicy.d.ts +273 -0
- package/dist/cjs/RetryPolicy.d.ts.map +1 -0
- package/dist/cjs/RetryPolicy.js +251 -0
- package/dist/cjs/RetryPolicy.js.map +7 -0
- package/dist/cjs/Sleep.d.ts +98 -0
- package/dist/cjs/Sleep.d.ts.map +1 -0
- package/dist/cjs/Sleep.js +141 -0
- package/dist/cjs/Sleep.js.map +7 -0
- package/dist/cjs/Stall.d.ts +173 -0
- package/dist/cjs/Stall.d.ts.map +1 -0
- package/dist/cjs/Stall.js +92 -0
- package/dist/cjs/Stall.js.map +7 -0
- package/dist/cjs/WaitFor.d.ts +109 -0
- package/dist/cjs/WaitFor.d.ts.map +1 -0
- package/dist/cjs/WaitFor.js +117 -0
- package/dist/cjs/WaitFor.js.map +7 -0
- package/dist/cjs/index.d.ts +107 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +69 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/BoundedJson.d.ts +48 -0
- package/dist/cjs/internal/BoundedJson.d.ts.map +1 -0
- package/dist/cjs/internal/BoundedJson.js +96 -0
- package/dist/cjs/internal/BoundedJson.js.map +7 -0
- package/dist/cjs/internal/DeclarationSite.d.ts +135 -0
- package/dist/cjs/internal/DeclarationSite.d.ts.map +1 -0
- package/dist/cjs/internal/DeclarationSite.js +89 -0
- package/dist/cjs/internal/DeclarationSite.js.map +7 -0
- package/dist/cjs/internal/Declarations.d.ts +35 -0
- package/dist/cjs/internal/Declarations.d.ts.map +1 -0
- package/dist/cjs/internal/Declarations.js +50 -0
- package/dist/cjs/internal/Declarations.js.map +7 -0
- package/dist/cjs/internal/ExecutionMiddleware.d.ts +21 -0
- package/dist/cjs/internal/ExecutionMiddleware.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionMiddleware.js +39 -0
- package/dist/cjs/internal/ExecutionMiddleware.js.map +7 -0
- package/dist/cjs/internal/JsonSchemaSubset.d.ts +133 -0
- package/dist/cjs/internal/JsonSchemaSubset.d.ts.map +1 -0
- package/dist/cjs/internal/JsonSchemaSubset.js +229 -0
- package/dist/cjs/internal/JsonSchemaSubset.js.map +7 -0
- package/dist/cjs/internal/OutcomeMarker.d.ts +18 -0
- package/dist/cjs/internal/OutcomeMarker.d.ts.map +1 -0
- package/dist/cjs/internal/OutcomeMarker.js +27 -0
- package/dist/cjs/internal/OutcomeMarker.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/Action/Action.d.ts +250 -0
- package/dist/esm/Action/Action.d.ts.map +1 -0
- package/dist/esm/Action/Action.js +30 -0
- package/dist/esm/Action/Action.js.map +1 -0
- package/dist/esm/Action/AttemptTimedOut.d.ts +33 -0
- package/dist/esm/Action/AttemptTimedOut.d.ts.map +1 -0
- package/dist/esm/Action/AttemptTimedOut.js +32 -0
- package/dist/esm/Action/AttemptTimedOut.js.map +1 -0
- package/dist/esm/Action/BoundaryMode.d.ts +29 -0
- package/dist/esm/Action/BoundaryMode.d.ts.map +1 -0
- package/dist/esm/Action/BoundaryMode.js +23 -0
- package/dist/esm/Action/BoundaryMode.js.map +1 -0
- package/dist/esm/Action/CacheEnvironment.d.ts +158 -0
- package/dist/esm/Action/CacheEnvironment.d.ts.map +1 -0
- package/dist/esm/Action/CacheEnvironment.js +130 -0
- package/dist/esm/Action/CacheEnvironment.js.map +1 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.d.ts +34 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.d.ts.map +1 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.js +33 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.js.map +1 -0
- package/dist/esm/Action/Context.d.ts +131 -0
- package/dist/esm/Action/Context.d.ts.map +1 -0
- package/dist/esm/Action/Context.js +99 -0
- package/dist/esm/Action/Context.js.map +1 -0
- package/dist/esm/Action/DuplicateImplementation.d.ts +20 -0
- package/dist/esm/Action/DuplicateImplementation.d.ts.map +1 -0
- package/dist/esm/Action/DuplicateImplementation.js +20 -0
- package/dist/esm/Action/DuplicateImplementation.js.map +1 -0
- package/dist/esm/Action/FileBoundary.d.ts +59 -0
- package/dist/esm/Action/FileBoundary.d.ts.map +1 -0
- package/dist/esm/Action/FileBoundary.js +60 -0
- package/dist/esm/Action/FileBoundary.js.map +1 -0
- package/dist/esm/Action/FileInput.d.ts +28 -0
- package/dist/esm/Action/FileInput.d.ts.map +1 -0
- package/dist/esm/Action/FileInput.js +32 -0
- package/dist/esm/Action/FileInput.js.map +1 -0
- package/dist/esm/Action/Filegroup.d.ts +16 -0
- package/dist/esm/Action/Filegroup.d.ts.map +1 -0
- package/dist/esm/Action/Filegroup.js +15 -0
- package/dist/esm/Action/Filegroup.js.map +1 -0
- package/dist/esm/Action/Glob.d.ts +8 -0
- package/dist/esm/Action/Glob.d.ts.map +1 -0
- package/dist/esm/Action/Glob.js +7 -0
- package/dist/esm/Action/Glob.js.map +1 -0
- package/dist/esm/Action/ImplementationVersionMismatch.d.ts +26 -0
- package/dist/esm/Action/ImplementationVersionMismatch.d.ts.map +1 -0
- package/dist/esm/Action/ImplementationVersionMismatch.js +24 -0
- package/dist/esm/Action/ImplementationVersionMismatch.js.map +1 -0
- package/dist/esm/Action/Implementations.d.ts +114 -0
- package/dist/esm/Action/Implementations.d.ts.map +1 -0
- package/dist/esm/Action/Implementations.js +94 -0
- package/dist/esm/Action/Implementations.js.map +1 -0
- package/dist/esm/Action/InfraInterrupt.d.ts +26 -0
- package/dist/esm/Action/InfraInterrupt.d.ts.map +1 -0
- package/dist/esm/Action/InfraInterrupt.js +25 -0
- package/dist/esm/Action/InfraInterrupt.js.map +1 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.d.ts +33 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.d.ts.map +1 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.js +32 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.js.map +1 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts +26 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.js +25 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.js.map +1 -0
- package/dist/esm/Action/StepIdentity.d.ts +153 -0
- package/dist/esm/Action/StepIdentity.d.ts.map +1 -0
- package/dist/esm/Action/StepIdentity.js +139 -0
- package/dist/esm/Action/StepIdentity.js.map +1 -0
- package/dist/esm/Action/TreeArtifact.d.ts +8 -0
- package/dist/esm/Action/TreeArtifact.d.ts.map +1 -0
- package/dist/esm/Action/TreeArtifact.js +7 -0
- package/dist/esm/Action/TreeArtifact.js.map +1 -0
- package/dist/esm/Action/TypeId.d.ts +8 -0
- package/dist/esm/Action/TypeId.d.ts.map +1 -0
- package/dist/esm/Action/TypeId.js +9 -0
- package/dist/esm/Action/TypeId.js.map +1 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.d.ts +32 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.js +31 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.js.map +1 -0
- package/dist/esm/Action/idempotencyKey.d.ts +21 -0
- package/dist/esm/Action/idempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/idempotencyKey.js +50 -0
- package/dist/esm/Action/idempotencyKey.js.map +1 -0
- package/dist/esm/Action/index.d.ts +29 -0
- package/dist/esm/Action/index.d.ts.map +1 -0
- package/dist/esm/Action/index.js +30 -0
- package/dist/esm/Action/index.js.map +1 -0
- package/dist/esm/Action/make.d.ts +128 -0
- package/dist/esm/Action/make.d.ts.map +1 -0
- package/dist/esm/Action/make.js +413 -0
- package/dist/esm/Action/make.js.map +1 -0
- package/dist/esm/Action/raceAll.d.ts +21 -0
- package/dist/esm/Action/raceAll.d.ts.map +1 -0
- package/dist/esm/Action/raceAll.js +20 -0
- package/dist/esm/Action/raceAll.js.map +1 -0
- package/dist/esm/Action/retry.d.ts +19 -0
- package/dist/esm/Action/retry.d.ts.map +1 -0
- package/dist/esm/Action/retry.js +72 -0
- package/dist/esm/Action/retry.js.map +1 -0
- package/dist/esm/Deadline.d.ts +110 -0
- package/dist/esm/Deadline.d.ts.map +1 -0
- package/dist/esm/Deadline.js +164 -0
- package/dist/esm/Deadline.js.map +1 -0
- package/dist/esm/DurableClock.d.ts +60 -0
- package/dist/esm/DurableClock.d.ts.map +1 -0
- package/dist/esm/DurableClock.js +122 -0
- package/dist/esm/DurableClock.js.map +1 -0
- package/dist/esm/DurableDeferred.d.ts +311 -0
- package/dist/esm/DurableDeferred.d.ts.map +1 -0
- package/dist/esm/DurableDeferred.js +357 -0
- package/dist/esm/DurableDeferred.js.map +1 -0
- package/dist/esm/DurableQueue.d.ts +160 -0
- package/dist/esm/DurableQueue.d.ts.map +1 -0
- package/dist/esm/DurableQueue.js +303 -0
- package/dist/esm/DurableQueue.js.map +1 -0
- package/dist/esm/ExternalJob.d.ts +179 -0
- package/dist/esm/ExternalJob.d.ts.map +1 -0
- package/dist/esm/ExternalJob.js +296 -0
- package/dist/esm/ExternalJob.js.map +1 -0
- package/dist/esm/Fault.d.ts +131 -0
- package/dist/esm/Fault.d.ts.map +1 -0
- package/dist/esm/Fault.js +198 -0
- package/dist/esm/Fault.js.map +1 -0
- package/dist/esm/Flow/Annotations.d.ts +245 -0
- package/dist/esm/Flow/Annotations.d.ts.map +1 -0
- package/dist/esm/Flow/Annotations.js +110 -0
- package/dist/esm/Flow/Annotations.js.map +1 -0
- package/dist/esm/Flow/CapabilityCeiling.d.ts +21 -0
- package/dist/esm/Flow/CapabilityCeiling.d.ts.map +1 -0
- package/dist/esm/Flow/CapabilityCeiling.js +27 -0
- package/dist/esm/Flow/CapabilityCeiling.js.map +1 -0
- package/dist/esm/Flow/DeadlineExceeded.d.ts +33 -0
- package/dist/esm/Flow/DeadlineExceeded.d.ts.map +1 -0
- package/dist/esm/Flow/DeadlineExceeded.js +34 -0
- package/dist/esm/Flow/DeadlineExceeded.js.map +1 -0
- package/dist/esm/Flow/ExecutionIdRequired.d.ts +25 -0
- package/dist/esm/Flow/ExecutionIdRequired.d.ts.map +1 -0
- package/dist/esm/Flow/ExecutionIdRequired.js +30 -0
- package/dist/esm/Flow/ExecutionIdRequired.js.map +1 -0
- package/dist/esm/Flow/ExecutionIds.d.ts +80 -0
- package/dist/esm/Flow/ExecutionIds.d.ts.map +1 -0
- package/dist/esm/Flow/ExecutionIds.js +91 -0
- package/dist/esm/Flow/ExecutionIds.js.map +1 -0
- package/dist/esm/Flow/Flow.d.ts +422 -0
- package/dist/esm/Flow/Flow.d.ts.map +1 -0
- package/dist/esm/Flow/Flow.js +3 -0
- package/dist/esm/Flow/Flow.js.map +1 -0
- package/dist/esm/Flow/MaxRoundsExceeded.d.ts +35 -0
- package/dist/esm/Flow/MaxRoundsExceeded.d.ts.map +1 -0
- package/dist/esm/Flow/MaxRoundsExceeded.js +34 -0
- package/dist/esm/Flow/MaxRoundsExceeded.js.map +1 -0
- package/dist/esm/Flow/Outcome.d.ts +162 -0
- package/dist/esm/Flow/Outcome.d.ts.map +1 -0
- package/dist/esm/Flow/Outcome.js +115 -0
- package/dist/esm/Flow/Outcome.js.map +1 -0
- package/dist/esm/Flow/Result.d.ts +186 -0
- package/dist/esm/Flow/Result.d.ts.map +1 -0
- package/dist/esm/Flow/Result.js +171 -0
- package/dist/esm/Flow/Result.js.map +1 -0
- package/dist/esm/Flow/Runtime.d.ts +98 -0
- package/dist/esm/Flow/Runtime.d.ts.map +1 -0
- package/dist/esm/Flow/Runtime.js +252 -0
- package/dist/esm/Flow/Runtime.js.map +1 -0
- package/dist/esm/Flow/TypeId.d.ts +8 -0
- package/dist/esm/Flow/TypeId.d.ts.map +1 -0
- package/dist/esm/Flow/TypeId.js +9 -0
- package/dist/esm/Flow/TypeId.js.map +1 -0
- package/dist/esm/Flow/index.d.ts +17 -0
- package/dist/esm/Flow/index.d.ts.map +1 -0
- package/dist/esm/Flow/index.js +18 -0
- package/dist/esm/Flow/index.js.map +1 -0
- package/dist/esm/Flow/internal.d.ts +34 -0
- package/dist/esm/Flow/internal.d.ts.map +1 -0
- package/dist/esm/Flow/internal.js +149 -0
- package/dist/esm/Flow/internal.js.map +1 -0
- package/dist/esm/Flow/make.d.ts +149 -0
- package/dist/esm/Flow/make.d.ts.map +1 -0
- package/dist/esm/Flow/make.js +111 -0
- package/dist/esm/Flow/make.js.map +1 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.d.ts +55 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.js +53 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.js.map +1 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.d.ts +23 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.js +24 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.d.ts +28 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.js +35 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.d.ts +38 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.js +40 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowInstance.d.ts +115 -0
- package/dist/esm/FlowRuntime/FlowInstance.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowInstance.js +24 -0
- package/dist/esm/FlowRuntime/FlowInstance.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowRuntime.d.ts +204 -0
- package/dist/esm/FlowRuntime/FlowRuntime.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowRuntime.js +34 -0
- package/dist/esm/FlowRuntime/FlowRuntime.js.map +1 -0
- package/dist/esm/FlowRuntime/NodeRecord.d.ts +177 -0
- package/dist/esm/FlowRuntime/NodeRecord.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/NodeRecord.js +21 -0
- package/dist/esm/FlowRuntime/NodeRecord.js.map +1 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.d.ts +69 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.js +53 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.js.map +1 -0
- package/dist/esm/FlowRuntime/index.d.ts +14 -0
- package/dist/esm/FlowRuntime/index.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/index.js +15 -0
- package/dist/esm/FlowRuntime/index.js.map +1 -0
- package/dist/esm/Graph.d.ts +325 -0
- package/dist/esm/Graph.d.ts.map +1 -0
- package/dist/esm/Graph.js +1485 -0
- package/dist/esm/Graph.js.map +1 -0
- package/dist/esm/HumanTask.d.ts +442 -0
- package/dist/esm/HumanTask.d.ts.map +1 -0
- package/dist/esm/HumanTask.js +810 -0
- package/dist/esm/HumanTask.js.map +1 -0
- package/dist/esm/Interpreter.d.ts +223 -0
- package/dist/esm/Interpreter.d.ts.map +1 -0
- package/dist/esm/Interpreter.js +1301 -0
- package/dist/esm/Interpreter.js.map +1 -0
- package/dist/esm/Poll.d.ts +240 -0
- package/dist/esm/Poll.d.ts.map +1 -0
- package/dist/esm/Poll.js +289 -0
- package/dist/esm/Poll.js.map +1 -0
- package/dist/esm/RetryPolicy.d.ts +273 -0
- package/dist/esm/RetryPolicy.d.ts.map +1 -0
- package/dist/esm/RetryPolicy.js +429 -0
- package/dist/esm/RetryPolicy.js.map +1 -0
- package/dist/esm/Sleep.d.ts +98 -0
- package/dist/esm/Sleep.d.ts.map +1 -0
- package/dist/esm/Sleep.js +256 -0
- package/dist/esm/Sleep.js.map +1 -0
- package/dist/esm/Stall.d.ts +173 -0
- package/dist/esm/Stall.d.ts.map +1 -0
- package/dist/esm/Stall.js +138 -0
- package/dist/esm/Stall.js.map +1 -0
- package/dist/esm/WaitFor.d.ts +109 -0
- package/dist/esm/WaitFor.d.ts.map +1 -0
- package/dist/esm/WaitFor.js +184 -0
- package/dist/esm/WaitFor.js.map +1 -0
- package/dist/esm/index.d.ts +107 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +108 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/BoundedJson.d.ts +48 -0
- package/dist/esm/internal/BoundedJson.d.ts.map +1 -0
- package/dist/esm/internal/BoundedJson.js +107 -0
- package/dist/esm/internal/BoundedJson.js.map +1 -0
- package/dist/esm/internal/DeclarationSite.d.ts +135 -0
- package/dist/esm/internal/DeclarationSite.d.ts.map +1 -0
- package/dist/esm/internal/DeclarationSite.js +196 -0
- package/dist/esm/internal/DeclarationSite.js.map +1 -0
- package/dist/esm/internal/Declarations.d.ts +35 -0
- package/dist/esm/internal/Declarations.d.ts.map +1 -0
- package/dist/esm/internal/Declarations.js +43 -0
- package/dist/esm/internal/Declarations.js.map +1 -0
- package/dist/esm/internal/ExecutionMiddleware.d.ts +21 -0
- package/dist/esm/internal/ExecutionMiddleware.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionMiddleware.js +13 -0
- package/dist/esm/internal/ExecutionMiddleware.js.map +1 -0
- package/dist/esm/internal/JsonSchemaSubset.d.ts +133 -0
- package/dist/esm/internal/JsonSchemaSubset.d.ts.map +1 -0
- package/dist/esm/internal/JsonSchemaSubset.js +363 -0
- package/dist/esm/internal/JsonSchemaSubset.js.map +1 -0
- package/dist/esm/internal/OutcomeMarker.d.ts +18 -0
- package/dist/esm/internal/OutcomeMarker.d.ts.map +1 -0
- package/dist/esm/internal/OutcomeMarker.js +18 -0
- package/dist/esm/internal/OutcomeMarker.js.map +1 -0
- package/docs/README.md +152 -0
- package/docs/api.md +440 -0
- package/docs/concepts/bodies-and-plans.md +167 -0
- package/docs/concepts/execution-identity.md +142 -0
- package/docs/concepts/flows-and-actions.md +129 -0
- package/docs/concepts/suspension-and-replay.md +130 -0
- package/docs/concepts/the-runtime-port.md +110 -0
- package/docs/concepts/trampoline-rounds.md +151 -0
- package/docs/guides/ask-a-person.md +184 -0
- package/docs/guides/build-a-body.md +164 -0
- package/docs/guides/cancel-and-roll-back.md +112 -0
- package/docs/guides/implement-an-action.md +155 -0
- package/docs/guides/inspect-the-plan.md +235 -0
- package/docs/guides/poll-until-ready.md +169 -0
- package/docs/guides/queue-work-to-a-worker.md +122 -0
- package/docs/guides/retry-a-failing-action.md +243 -0
- package/docs/guides/reuse-a-recorded-result.md +129 -0
- package/docs/guides/run-a-child-flow.md +108 -0
- package/docs/guides/run-an-external-job.md +86 -0
- package/docs/guides/use-a-prompt.md +38 -0
- package/docs/guides/wait-for-a-deadline.md +141 -0
- package/docs/guides/wait-for-an-external-signal.md +151 -0
- package/docs/installation.md +87 -0
- package/docs/quickstart.md +164 -0
- package/docs/reference/flow.md +1835 -0
- package/docs/testing.md +157 -0
- package/docs/troubleshooting.md +286 -0
- package/package.json +327 -3
- package/src/Action/Action.ts +333 -0
- package/src/Action/AttemptTimedOut.ts +37 -0
- package/src/Action/BoundaryMode.ts +33 -0
- package/src/Action/CacheEnvironment.ts +170 -0
- package/src/Action/ConcurrentKeylessDispatch.ts +38 -0
- package/src/Action/Context.ts +156 -0
- package/src/Action/DuplicateImplementation.ts +24 -0
- package/src/Action/FileBoundary.ts +77 -0
- package/src/Action/FileInput.ts +42 -0
- package/src/Action/Filegroup.ts +16 -0
- package/src/Action/Glob.ts +8 -0
- package/src/Action/ImplementationVersionMismatch.ts +27 -0
- package/src/Action/Implementations.ts +149 -0
- package/src/Action/InfraInterrupt.ts +30 -0
- package/src/Action/InfraInterruptRetriesExhausted.ts +37 -0
- package/src/Action/IrreversibleRetryRequiresIdempotencyKey.ts +32 -0
- package/src/Action/StepIdentity.ts +219 -0
- package/src/Action/TreeArtifact.ts +8 -0
- package/src/Action/TypeId.ts +9 -0
- package/src/Action/UncanonicalIdempotencyKey.ts +36 -0
- package/src/Action/idempotencyKey.ts +67 -0
- package/src/Action/index.ts +31 -0
- package/src/Action/make.ts +671 -0
- package/src/Action/raceAll.ts +48 -0
- package/src/Action/retry.ts +92 -0
- package/src/Deadline.ts +201 -0
- package/src/DurableClock.ts +176 -0
- package/src/DurableDeferred.ts +753 -0
- package/src/DurableQueue.ts +519 -0
- package/src/ExternalJob.ts +437 -0
- package/src/Fault.ts +279 -0
- package/src/Flow/Annotations.ts +151 -0
- package/src/Flow/CapabilityCeiling.ts +37 -0
- package/src/Flow/DeadlineExceeded.ts +40 -0
- package/src/Flow/ExecutionIdRequired.ts +36 -0
- package/src/Flow/ExecutionIds.ts +133 -0
- package/src/Flow/Flow.ts +576 -0
- package/src/Flow/MaxRoundsExceeded.ts +39 -0
- package/src/Flow/Outcome.ts +179 -0
- package/src/Flow/Result.ts +284 -0
- package/src/Flow/Runtime.ts +339 -0
- package/src/Flow/TypeId.ts +9 -0
- package/src/Flow/index.ts +19 -0
- package/src/Flow/internal.ts +237 -0
- package/src/Flow/make.ts +299 -0
- package/src/FlowRuntime/CancelRequestFailed.ts +56 -0
- package/src/FlowRuntime/ExecutionIdentityConflict.ts +32 -0
- package/src/FlowRuntime/FlowCycleDetected.ts +41 -0
- package/src/FlowRuntime/FlowExecutionNotFound.ts +46 -0
- package/src/FlowRuntime/FlowInstance.ts +128 -0
- package/src/FlowRuntime/FlowRuntime.ts +339 -0
- package/src/FlowRuntime/NodeRecord.ts +185 -0
- package/src/FlowRuntime/WaitingAnnotation.ts +85 -0
- package/src/FlowRuntime/index.ts +17 -0
- package/src/Graph.ts +1865 -0
- package/src/HumanTask.ts +1021 -0
- package/src/Interpreter.ts +1635 -0
- package/src/Poll.ts +420 -0
- package/src/RetryPolicy.ts +550 -0
- package/src/Sleep.ts +296 -0
- package/src/Stall.ts +217 -0
- package/src/WaitFor.ts +228 -0
- package/src/index.ts +125 -0
- package/src/internal/BoundedJson.ts +109 -0
- package/src/internal/DeclarationSite.ts +214 -0
- package/src/internal/Declarations.ts +49 -0
- package/src/internal/ExecutionMiddleware.ts +29 -0
- package/src/internal/JsonSchemaSubset.ts +392 -0
- package/src/internal/OutcomeMarker.ts +19 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// Deep reviewed and polished by a human on 2026-08-10.
|
|
2
|
+
/**
|
|
3
|
+
* Defines named wait points for durable flow executions.
|
|
4
|
+
*
|
|
5
|
+
* A `DurableDeferred` has a stable name and schemas for the value that will be
|
|
6
|
+
* recorded later. Flows can await it, suspend when no result exists yet, and
|
|
7
|
+
* resume after its result is recorded. Tokens identify the flow name,
|
|
8
|
+
* execution id, and deferred name so external code can complete the correct
|
|
9
|
+
* wait point later.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
*/
|
|
13
|
+
import * as Arr from "effect/Array";
|
|
14
|
+
import * as Cause from "effect/Cause";
|
|
15
|
+
import * as Context from "effect/Context";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Base64Url from "effect/encoding/Base64Url";
|
|
18
|
+
import * as Exit from "effect/Exit";
|
|
19
|
+
import * as Filter from "effect/Filter";
|
|
20
|
+
import { dual } from "effect/Function";
|
|
21
|
+
import * as Option from "effect/Option";
|
|
22
|
+
import * as Schema from "effect/Schema";
|
|
23
|
+
import * as SchemaGetter from "effect/SchemaGetter";
|
|
24
|
+
import { CurrentAttempt } from "./Action/Context.js";
|
|
25
|
+
import * as Flow from "./Flow/index.js";
|
|
26
|
+
import { FlowInstance } from "./FlowRuntime/FlowInstance.js";
|
|
27
|
+
import { FlowRuntime } from "./FlowRuntime/FlowRuntime.js";
|
|
28
|
+
const TypeId = "@smthrs/flow/DurableDeferred";
|
|
29
|
+
// Queues, human tasks and clocks mint a deferred per item, attempt or sleep.
|
|
30
|
+
// Effect caches compiled parsers by AST identity, so the exit schema is shared
|
|
31
|
+
// per (success, error) pair rather than rebuilt for every deferred.
|
|
32
|
+
const exitSchemaCache = new WeakMap();
|
|
33
|
+
const exitSchemaFor = (success, error) => {
|
|
34
|
+
let byError = exitSchemaCache.get(success);
|
|
35
|
+
if (byError === undefined) {
|
|
36
|
+
byError = new WeakMap();
|
|
37
|
+
exitSchemaCache.set(success, byError);
|
|
38
|
+
}
|
|
39
|
+
let cached = byError.get(error);
|
|
40
|
+
if (cached === undefined) {
|
|
41
|
+
cached = Schema.Exit(Schema.toCodecJson(success), Schema.toCodecJson(error), Schema.toCodecJson(Schema.Defect()));
|
|
42
|
+
byError.set(error, cached);
|
|
43
|
+
}
|
|
44
|
+
return cached;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Creates a named durable deferred with optional success and error schemas for
|
|
48
|
+
* persisted completion.
|
|
49
|
+
*
|
|
50
|
+
* @category constructors
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
*/
|
|
53
|
+
export const make = (name, options) => {
|
|
54
|
+
const successSchema = options?.success ?? Schema.Void;
|
|
55
|
+
const errorSchema = options?.error ?? Schema.Never;
|
|
56
|
+
return {
|
|
57
|
+
[TypeId]: TypeId,
|
|
58
|
+
name,
|
|
59
|
+
successSchema,
|
|
60
|
+
errorSchema,
|
|
61
|
+
exitSchema: exitSchemaFor(successSchema, errorSchema),
|
|
62
|
+
withActionAttempt: Effect.gen(function* () {
|
|
63
|
+
const attempt = yield* CurrentAttempt;
|
|
64
|
+
return make(`${name}/${attempt}`, {
|
|
65
|
+
success: successSchema,
|
|
66
|
+
error: errorSchema
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const await_ =
|
|
72
|
+
// Untraced because deferred polling participates in the flow scheduler hot path.
|
|
73
|
+
Effect.fnUntraced(function* (self) {
|
|
74
|
+
const engine = yield* FlowRuntime;
|
|
75
|
+
const instance = yield* FlowInstance;
|
|
76
|
+
const exit = yield* Flow.wrapActionResult(engine.deferredResult(self), Option.isNone);
|
|
77
|
+
if (Option.isNone(exit)) {
|
|
78
|
+
return yield* Flow.suspend(instance);
|
|
79
|
+
}
|
|
80
|
+
const value = exit.value;
|
|
81
|
+
// A recorded interruption is a durable *outcome*, not a request to
|
|
82
|
+
// suspend: mark the instance interrupted before re-raising so
|
|
83
|
+
// `Flow.intoResult` classifies the interrupt-only cause as a `Complete`
|
|
84
|
+
// failure. Without this the driver mistakes the cause for an external
|
|
85
|
+
// suspension interrupt, aborts without a terminal transition, and the
|
|
86
|
+
// run spins in the suspended-retry loop forever.
|
|
87
|
+
if (Exit.isFailure(value) && Cause.hasInterruptsOnly(value.cause)) {
|
|
88
|
+
instance.interrupted = true;
|
|
89
|
+
}
|
|
90
|
+
return yield* value;
|
|
91
|
+
});
|
|
92
|
+
export {
|
|
93
|
+
/**
|
|
94
|
+
* Waits for the durable deferred, suspending the current flow when no
|
|
95
|
+
* persisted completion is available.
|
|
96
|
+
*
|
|
97
|
+
* @category combinators
|
|
98
|
+
* @since 0.1.0
|
|
99
|
+
*/
|
|
100
|
+
await_ as await };
|
|
101
|
+
/**
|
|
102
|
+
* Runs an effect and records its exit into the durable deferred, resuming
|
|
103
|
+
* flows that are waiting on that deferred.
|
|
104
|
+
*
|
|
105
|
+
* @category combinators
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
*/
|
|
108
|
+
export const into = dual(2, (effect, self) => Effect.contextWith((context) => {
|
|
109
|
+
const engine = Context.get(context, FlowRuntime);
|
|
110
|
+
const instance = Context.get(context, FlowInstance);
|
|
111
|
+
// Keep the original instance: action regions identify their ancestors
|
|
112
|
+
// by reference, and suspension metadata belongs to the enclosing flow.
|
|
113
|
+
return Effect.onExit(effect,
|
|
114
|
+
// Untraced because completion encoding is called for each deferred result.
|
|
115
|
+
Effect.fnUntraced(function* (exit) {
|
|
116
|
+
if (Exit.isFailure(exit)) {
|
|
117
|
+
const [interrupts, reasons] = Arr.partition(exit.cause.reasons, Filter.fromPredicate(Cause.isInterruptReason));
|
|
118
|
+
const hasInterruptsOnly = interrupts.length === exit.cause.reasons.length;
|
|
119
|
+
if (hasInterruptsOnly) {
|
|
120
|
+
// An interrupt-only exit is never a result: the effect was
|
|
121
|
+
// suspended, preempted, or interrupted, so record nothing.
|
|
122
|
+
// Recording here would durably persist the empty non-interrupt
|
|
123
|
+
// partition, and first-writer-wins would replay that empty
|
|
124
|
+
// cause forever instead of the real completion.
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
else if (interrupts.length > 0) {
|
|
128
|
+
exit = Exit.failCause(Cause.fromReasons(reasons));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
yield* engine.deferredDone(self, {
|
|
132
|
+
flowName: instance.flow._tag,
|
|
133
|
+
executionId: instance.executionId,
|
|
134
|
+
deferredName: self.name,
|
|
135
|
+
exit
|
|
136
|
+
});
|
|
137
|
+
}));
|
|
138
|
+
}));
|
|
139
|
+
/**
|
|
140
|
+
* Runs effects as a durable race, returning a previously persisted result when
|
|
141
|
+
* present or completing a named deferred with the first success. The race
|
|
142
|
+
* fails only when every effect fails.
|
|
143
|
+
*
|
|
144
|
+
* @category racing
|
|
145
|
+
* @since 0.1.0
|
|
146
|
+
*/
|
|
147
|
+
export const raceAll = (options) => {
|
|
148
|
+
const deferred = make(`raceAll/${options.name}`, {
|
|
149
|
+
success: options.success,
|
|
150
|
+
error: options.error
|
|
151
|
+
});
|
|
152
|
+
return Effect.gen(function* () {
|
|
153
|
+
const engine = yield* FlowRuntime;
|
|
154
|
+
const exit = yield* engine.deferredResult(deferred);
|
|
155
|
+
if (Option.isSome(exit)) {
|
|
156
|
+
return yield* exit.value;
|
|
157
|
+
}
|
|
158
|
+
return yield* into(Effect.raceAll(options.effects), deferred);
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Runtime brand identifier for durable deferred tokens.
|
|
163
|
+
*
|
|
164
|
+
* @category type IDs
|
|
165
|
+
* @since 0.1.0
|
|
166
|
+
*/
|
|
167
|
+
export const TokenTypeId = "@smthrs/flow/DurableDeferred/Token";
|
|
168
|
+
/**
|
|
169
|
+
* Schema for branded durable deferred tokens.
|
|
170
|
+
*
|
|
171
|
+
* @category token
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
*/
|
|
174
|
+
export const Token = Schema.String.pipe(Schema.brand(TokenTypeId));
|
|
175
|
+
/**
|
|
176
|
+
* A completion token could not be decoded into its durable address.
|
|
177
|
+
*
|
|
178
|
+
* @category errors
|
|
179
|
+
* @since 0.1.0
|
|
180
|
+
*/
|
|
181
|
+
export class TokenInvalid extends Schema.TaggedError()("@smthrs/flow/DurableDeferred/TokenInvalid", {
|
|
182
|
+
code: Schema.Literals(["malformed_token", "deferred_mismatch"]).pipe(Schema.withConstructorDefault(Effect.succeed("malformed_token"))),
|
|
183
|
+
message: Schema.String
|
|
184
|
+
}) {
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Schema for a decoded durable deferred token containing the flow
|
|
188
|
+
* name, execution ID, and deferred name.
|
|
189
|
+
*
|
|
190
|
+
* @category token
|
|
191
|
+
* @since 0.1.0
|
|
192
|
+
*/
|
|
193
|
+
export class TokenParsed extends Schema.Class("@smthrs/flow/DurableDeferred/TokenParsed")({
|
|
194
|
+
flowName: Schema.String,
|
|
195
|
+
executionId: Schema.String,
|
|
196
|
+
deferredName: Schema.String
|
|
197
|
+
}) {
|
|
198
|
+
/**
|
|
199
|
+
* Encodes the parsed flow, execution, and deferred names back into a token.
|
|
200
|
+
*
|
|
201
|
+
* @since 0.1.0
|
|
202
|
+
*/
|
|
203
|
+
get asToken() {
|
|
204
|
+
return Base64Url.encode(JSON.stringify([this.flowName, this.executionId, this.deferredName]));
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Schema for decoding and encoding durable deferred tokens as strings.
|
|
208
|
+
*
|
|
209
|
+
* @since 0.1.0
|
|
210
|
+
*/
|
|
211
|
+
static FromString = Schema.String.pipe(Schema.decodeTo(Schema.fromJsonString(Schema.Tuple([Schema.String, Schema.String, Schema.String])), {
|
|
212
|
+
decode: SchemaGetter.decodeBase64UrlString(),
|
|
213
|
+
encode: SchemaGetter.encodeBase64Url()
|
|
214
|
+
}), Schema.decodeTo(TokenParsed, {
|
|
215
|
+
decode: SchemaGetter.transform(([flowName, executionId, deferredName]) => new TokenParsed({
|
|
216
|
+
flowName,
|
|
217
|
+
executionId,
|
|
218
|
+
deferredName
|
|
219
|
+
})),
|
|
220
|
+
encode: SchemaGetter.transform((parsed) => [
|
|
221
|
+
parsed.flowName,
|
|
222
|
+
parsed.executionId,
|
|
223
|
+
parsed.deferredName
|
|
224
|
+
])
|
|
225
|
+
}));
|
|
226
|
+
/**
|
|
227
|
+
* Decodes a durable deferred token string into its parsed components.
|
|
228
|
+
*
|
|
229
|
+
* @since 0.1.0
|
|
230
|
+
*/
|
|
231
|
+
static fromString = Schema.decodeSync(TokenParsed.FromString);
|
|
232
|
+
/**
|
|
233
|
+
* Encodes parsed durable deferred token components into a token string.
|
|
234
|
+
*
|
|
235
|
+
* @since 0.1.0
|
|
236
|
+
*/
|
|
237
|
+
static encode = Schema.encodeSync(TokenParsed.FromString);
|
|
238
|
+
/**
|
|
239
|
+
* Parses an untrusted token into its durable address with a typed,
|
|
240
|
+
* bounded diagnostic on failure.
|
|
241
|
+
*
|
|
242
|
+
* @category token
|
|
243
|
+
* @since 1.0.0
|
|
244
|
+
*/
|
|
245
|
+
static parse = (token) => Effect.mapError(Schema.decodeEffect(TokenParsed.FromString)(token), (issue) => new TokenInvalid({
|
|
246
|
+
message: `The supplied token "${tokenExcerpt(token)}" is not a durable deferred token: ${issue.message}`
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
const maxTokenExcerptChars = 64;
|
|
250
|
+
/** Renders a bounded excerpt of untrusted token content for a diagnostic. */
|
|
251
|
+
const tokenExcerpt = (token) => token.length <= maxTokenExcerptChars
|
|
252
|
+
? token
|
|
253
|
+
: `${token.slice(0, maxTokenExcerptChars)} [${token.length - maxTokenExcerptChars} characters dropped]`;
|
|
254
|
+
/**
|
|
255
|
+
* Creates a token for a durable deferred using the current flow instance's
|
|
256
|
+
* flow name and execution ID.
|
|
257
|
+
*
|
|
258
|
+
* @category token
|
|
259
|
+
* @since 0.1.0
|
|
260
|
+
*/
|
|
261
|
+
export const token =
|
|
262
|
+
// Untraced because token allocation is on the durable-deferred hot path.
|
|
263
|
+
Effect.fnUntraced(function* (self) {
|
|
264
|
+
const instance = yield* FlowInstance;
|
|
265
|
+
return tokenFromExecutionId(self, instance);
|
|
266
|
+
});
|
|
267
|
+
/**
|
|
268
|
+
* Creates a durable deferred token from an explicit flow, execution ID,
|
|
269
|
+
* and deferred name.
|
|
270
|
+
*
|
|
271
|
+
* @category token
|
|
272
|
+
* @since 0.1.0
|
|
273
|
+
*/
|
|
274
|
+
export const tokenFromExecutionId = dual(2, (self, options) => new TokenParsed({
|
|
275
|
+
flowName: options.flow._tag,
|
|
276
|
+
executionId: options.executionId,
|
|
277
|
+
deferredName: self.name
|
|
278
|
+
}).asToken);
|
|
279
|
+
/**
|
|
280
|
+
* Creates a durable deferred token by deriving the flow execution ID from
|
|
281
|
+
* the supplied flow payload.
|
|
282
|
+
*
|
|
283
|
+
* The payload identifies a previously started execution only when the flow
|
|
284
|
+
* declares `idempotencyKey` or the host installs the opt-in `derived`
|
|
285
|
+
* execution-id source. Otherwise the default `fresh` source mints a new
|
|
286
|
+
* execution ID on every call, so the token addresses no earlier run. To
|
|
287
|
+
* complete an existing execution without stable identity, keep its execution
|
|
288
|
+
* ID and use {@link tokenFromExecutionId}.
|
|
289
|
+
*
|
|
290
|
+
* @category token
|
|
291
|
+
* @since 0.1.0
|
|
292
|
+
*/
|
|
293
|
+
export const tokenFromPayload = dual(2, (self, options) => Effect.map(options.flow.executionId(options.payload), (executionId) => tokenFromExecutionId(self, {
|
|
294
|
+
flow: options.flow,
|
|
295
|
+
executionId
|
|
296
|
+
})));
|
|
297
|
+
/**
|
|
298
|
+
* Completes the durable deferred identified by a token with the supplied exit,
|
|
299
|
+
* encoding the result through the deferred schemas.
|
|
300
|
+
*
|
|
301
|
+
* The token is not a credential (see {@link Token}): authorize the caller
|
|
302
|
+
* before completing a wait on its behalf.
|
|
303
|
+
*
|
|
304
|
+
* @category combinators
|
|
305
|
+
* @since 0.1.0
|
|
306
|
+
*/
|
|
307
|
+
export const done = dual(2,
|
|
308
|
+
// Untraced because awaiting a deferred re-enters the scheduler recursively.
|
|
309
|
+
Effect.fnUntraced(function* (self, options) {
|
|
310
|
+
const token = yield* TokenParsed.parse(options.token);
|
|
311
|
+
if (token.deferredName !== self.name) {
|
|
312
|
+
return yield* Effect.fail(new TokenInvalid({
|
|
313
|
+
code: "deferred_mismatch",
|
|
314
|
+
message: `The token addresses deferred "${tokenExcerpt(token.deferredName)}", but it was submitted through ` +
|
|
315
|
+
`deferred "${self.name}".`
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
const engine = yield* FlowRuntime;
|
|
319
|
+
yield* engine.deferredDone(self, {
|
|
320
|
+
flowName: token.flowName,
|
|
321
|
+
executionId: token.executionId,
|
|
322
|
+
deferredName: token.deferredName,
|
|
323
|
+
exit: options.exit
|
|
324
|
+
});
|
|
325
|
+
}));
|
|
326
|
+
/**
|
|
327
|
+
* Completes the durable deferred identified by a token with a successful
|
|
328
|
+
* value.
|
|
329
|
+
*
|
|
330
|
+
* @category combinators
|
|
331
|
+
* @since 0.1.0
|
|
332
|
+
*/
|
|
333
|
+
export const succeed = dual(2, (self, options) => done(self, {
|
|
334
|
+
token: options.token,
|
|
335
|
+
exit: Exit.succeed(options.value)
|
|
336
|
+
}));
|
|
337
|
+
/**
|
|
338
|
+
* Completes the durable deferred identified by a token with a typed failure.
|
|
339
|
+
*
|
|
340
|
+
* @category combinators
|
|
341
|
+
* @since 0.1.0
|
|
342
|
+
*/
|
|
343
|
+
export const fail = dual(2, (self, options) => done(self, {
|
|
344
|
+
token: options.token,
|
|
345
|
+
exit: Exit.fail(options.error)
|
|
346
|
+
}));
|
|
347
|
+
/**
|
|
348
|
+
* Completes the durable deferred identified by a token with a failure cause.
|
|
349
|
+
*
|
|
350
|
+
* @category combinators
|
|
351
|
+
* @since 0.1.0
|
|
352
|
+
*/
|
|
353
|
+
export const failCause = dual(2, (self, options) => done(self, {
|
|
354
|
+
token: options.token,
|
|
355
|
+
exit: Exit.failCause(options.cause)
|
|
356
|
+
}));
|
|
357
|
+
//# sourceMappingURL=DurableDeferred.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurableDeferred.js","sourceRoot":"","sources":["../../src/DurableDeferred.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAGnC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BA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AAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAchB,IAAI,CACN,CAAC,EACD,CACE,IAAqC,EACrC,OAGC,EAC6E,EAAE,CAChF,IAAI,CAAC,IAAI,EAAE;IACT,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;CAClC,CAAC,CACL,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAcb,IAAI,CACN,CAAC,EACD,CACE,IAAqC,EACrC,OAGC,EAC2E,EAAE,CAC9E,IAAI,CAAC,IAAI,EAAE;IACT,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;CAC/B,CAAC,CACL,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAclB,IAAI,CACN,CAAC,EACD,CACE,IAAqC,EACrC,OAGC,EAC2E,EAAE,CAC9E,IAAI,CAAC,IAAI,EAAE;IACT,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;CACpC,CAAC,CACL,CAAA","sourcesContent":["// Deep reviewed and polished by a human on 2026-08-10.\n\n/**\n * Defines named wait points for durable flow executions.\n *\n * A `DurableDeferred` has a stable name and schemas for the value that will be\n * recorded later. Flows can await it, suspend when no result exists yet, and\n * resume after its result is recorded. Tokens identify the flow name,\n * execution id, and deferred name so external code can complete the correct\n * wait point later.\n *\n * @since 0.1.0\n */\n\nimport * as Arr from \"effect/Array\"\nimport type { NonEmptyReadonlyArray } from \"effect/Array\"\nimport type * as Brand from \"effect/Brand\"\nimport * as Cause from \"effect/Cause\"\nimport * as Context from \"effect/Context\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Base64Url from \"effect/encoding/Base64Url\"\nimport * as Exit from \"effect/Exit\"\nimport * as Filter from \"effect/Filter\"\nimport { dual } from \"effect/Function\"\nimport * as Option from \"effect/Option\"\nimport * as Schema from \"effect/Schema\"\nimport * as SchemaGetter from \"effect/SchemaGetter\"\nimport { CurrentAttempt } from \"./Action/Context.ts\"\nimport * as Flow from \"./Flow/index.ts\"\nimport { FlowInstance } from \"./FlowRuntime/FlowInstance.ts\"\nimport { FlowRuntime } from \"./FlowRuntime/FlowRuntime.ts\"\n\nconst TypeId = \"@smthrs/flow/DurableDeferred\"\n\n/**\n * Named durable deferred value whose completion is persisted by the flow\n * engine and encoded with success and error schemas.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface DurableDeferred<\n Success extends Schema.Constraint,\n Error extends Schema.Constraint = Schema.Never\n> {\n readonly [TypeId]: typeof TypeId\n readonly name: string\n readonly successSchema: Success\n readonly errorSchema: Error\n readonly exitSchema: Schema.Exit<Schema.Top, Schema.Top, Schema.Top>\n readonly withActionAttempt: Effect.Effect<DurableDeferred<Success, Error>>\n}\n\n/**\n * Type-erased durable deferred shape for APIs that only need the deferred\n * identity and name.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Any {\n readonly [TypeId]: typeof TypeId\n readonly name: string\n}\n\n/**\n * Type-erased durable deferred shape that also exposes success, error, and\n * exit schemas.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface AnyWithProps {\n readonly [TypeId]: typeof TypeId\n readonly name: string\n readonly successSchema: Schema.Top\n readonly errorSchema: Schema.Top\n readonly exitSchema: Schema.Exit<any, any, any>\n}\n\n// Queues, human tasks and clocks mint a deferred per item, attempt or sleep.\n// Effect caches compiled parsers by AST identity, so the exit schema is shared\n// per (success, error) pair rather than rebuilt for every deferred.\nconst exitSchemaCache = new WeakMap<object, WeakMap<object, Schema.Exit<any, any, any>>>()\n\nconst exitSchemaFor = (success: Schema.Constraint, error: Schema.Constraint): Schema.Exit<any, any, any> => {\n let byError = exitSchemaCache.get(success)\n if (byError === undefined) {\n byError = new WeakMap()\n exitSchemaCache.set(success, byError)\n }\n let cached = byError.get(error)\n if (cached === undefined) {\n cached = Schema.Exit(\n Schema.toCodecJson(success),\n Schema.toCodecJson(error),\n Schema.toCodecJson(Schema.Defect())\n )\n byError.set(error, cached)\n }\n return cached\n}\n\n/**\n * Creates a named durable deferred with optional success and error schemas for\n * persisted completion.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const make = <\n Success extends Schema.Constraint = Schema.Void,\n Error extends Schema.Constraint = Schema.Never\n>(\n name: string,\n options?: {\n readonly success?: Success | undefined\n readonly error?: Error | undefined\n }\n): DurableDeferred<Success, Error> => {\n const successSchema = options?.success ?? (Schema.Void as any as Success)\n const errorSchema = options?.error ?? (Schema.Never as any as Error)\n return {\n [TypeId]: TypeId as typeof TypeId,\n name,\n successSchema,\n errorSchema,\n exitSchema: exitSchemaFor(successSchema, errorSchema) as any,\n withActionAttempt: Effect.gen(function*() {\n const attempt = yield* CurrentAttempt\n return make(`${name}/${attempt}`, {\n success: successSchema,\n error: errorSchema\n })\n })\n }\n}\n\nconst await_: <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n) => Effect.Effect<\n Success[\"Type\"],\n Error[\"Type\"],\n | FlowRuntime\n | FlowInstance\n | Success[\"DecodingServices\"]\n | Error[\"DecodingServices\"]\n> =\n // Untraced because deferred polling participates in the flow scheduler hot path.\n Effect.fnUntraced(function*<\n Success extends Schema.Constraint,\n Error extends Schema.Constraint\n >(self: DurableDeferred<Success, Error>) {\n const engine = yield* FlowRuntime\n const instance = yield* FlowInstance\n const exit = yield* Flow.wrapActionResult(\n engine.deferredResult(self),\n Option.isNone\n )\n if (Option.isNone(exit)) {\n return yield* Flow.suspend(instance)\n }\n const value = exit.value as Exit.Exit<any, any>\n // A recorded interruption is a durable *outcome*, not a request to\n // suspend: mark the instance interrupted before re-raising so\n // `Flow.intoResult` classifies the interrupt-only cause as a `Complete`\n // failure. Without this the driver mistakes the cause for an external\n // suspension interrupt, aborts without a terminal transition, and the\n // run spins in the suspended-retry loop forever.\n if (Exit.isFailure(value) && Cause.hasInterruptsOnly(value.cause)) {\n instance.interrupted = true\n }\n return yield* value\n })\n\nexport {\n /**\n * Waits for the durable deferred, suspending the current flow when no\n * persisted completion is available.\n *\n * @category combinators\n * @since 0.1.0\n */\n await_ as await\n}\n\n/**\n * Runs an effect and records its exit into the durable deferred, resuming\n * flows that are waiting on that deferred.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const into: {\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n ): <R>(\n effect: Effect.Effect<Success[\"Type\"], Error[\"Type\"], R>\n ) => Effect.Effect<\n Success[\"Type\"],\n Error[\"Type\"],\n | R\n | FlowRuntime\n | FlowInstance\n | Success[\"DecodingServices\"]\n | Success[\"EncodingServices\"]\n | Error[\"DecodingServices\"]\n | Error[\"EncodingServices\"]\n >\n <Success extends Schema.Constraint, Error extends Schema.Constraint, R>(\n effect: Effect.Effect<Success[\"Type\"], Error[\"Type\"], R>,\n self: DurableDeferred<Success, Error>\n ): Effect.Effect<\n Success[\"Type\"],\n Error[\"Type\"],\n | R\n | FlowRuntime\n | FlowInstance\n | Success[\"DecodingServices\"]\n | Success[\"EncodingServices\"]\n | Error[\"DecodingServices\"]\n | Error[\"EncodingServices\"]\n >\n} = dual(\n 2,\n <Success extends Schema.Constraint, Error extends Schema.Constraint, R>(\n effect: Effect.Effect<Success[\"Type\"], Error[\"Type\"], R>,\n self: DurableDeferred<Success, Error>\n ): Effect.Effect<\n Success[\"Type\"],\n Error[\"Type\"],\n | R\n | FlowRuntime\n | FlowInstance\n | Success[\"DecodingServices\"]\n | Success[\"EncodingServices\"]\n | Error[\"DecodingServices\"]\n | Error[\"EncodingServices\"]\n > =>\n Effect.contextWith(\n (context: Context.Context<FlowRuntime | FlowInstance>) => {\n const engine = Context.get(context, FlowRuntime)\n const instance = Context.get(context, FlowInstance)\n // Keep the original instance: action regions identify their ancestors\n // by reference, and suspension metadata belongs to the enclosing flow.\n return Effect.onExit(\n effect,\n // Untraced because completion encoding is called for each deferred result.\n Effect.fnUntraced(function*(exit) {\n if (Exit.isFailure(exit)) {\n const [interrupts, reasons] = Arr.partition(\n exit.cause.reasons,\n Filter.fromPredicate(Cause.isInterruptReason)\n )\n const hasInterruptsOnly = interrupts.length === exit.cause.reasons.length\n if (hasInterruptsOnly) {\n // An interrupt-only exit is never a result: the effect was\n // suspended, preempted, or interrupted, so record nothing.\n // Recording here would durably persist the empty non-interrupt\n // partition, and first-writer-wins would replay that empty\n // cause forever instead of the real completion.\n return\n } else if (interrupts.length > 0) {\n exit = Exit.failCause(Cause.fromReasons(reasons))\n }\n }\n yield* engine.deferredDone(self, {\n flowName: instance.flow._tag,\n executionId: instance.executionId,\n deferredName: self.name,\n exit\n })\n })\n )\n }\n )\n)\n\n/**\n * Runs effects as a durable race, returning a previously persisted result when\n * present or completing a named deferred with the first success. The race\n * fails only when every effect fails.\n *\n * @category racing\n * @since 0.1.0\n */\nexport const raceAll = <\n const Effects extends NonEmptyReadonlyArray<Effect.Effect<any, any, any>>,\n Success extends Schema.Schema<Effect.Success<Effects[number]>>,\n Error extends Schema.Schema<Effect.Error<Effects[number]>>\n>(options: {\n name: string\n success: Success\n error: Error\n effects: Effects\n}): Effect.Effect<\n Effect.Success<Effects[number]>,\n Effect.Error<Effects[number]>,\n | Effect.Services<Effects[number]>\n | Success[\"DecodingServices\"]\n | Success[\"EncodingServices\"]\n | Error[\"DecodingServices\"]\n | Error[\"EncodingServices\"]\n | FlowRuntime\n | FlowInstance\n> => {\n const deferred = make<any, any>(`raceAll/${options.name}`, {\n success: options.success,\n error: options.error\n })\n return Effect.gen(function*() {\n const engine = yield* FlowRuntime\n const exit = yield* engine.deferredResult(deferred)\n if (Option.isSome(exit)) {\n return yield* exit.value\n }\n return yield* into(\n Effect.raceAll(options.effects),\n deferred\n )\n })\n}\n\n/**\n * Runtime brand identifier for durable deferred tokens.\n *\n * @category type IDs\n * @since 0.1.0\n */\nexport const TokenTypeId = \"@smthrs/flow/DurableDeferred/Token\"\n\n/**\n * Type-level brand identifier for `Token` values.\n *\n * @category type IDs\n * @since 0.1.0\n */\nexport type TokenTypeId = typeof TokenTypeId\n\n/**\n * Branded string token identifying a durable deferred for a flow\n * execution.\n *\n * A token is an address, not a credential. It is unsigned base64url JSON of\n * the flow name, execution id, and deferred name, and `tokenFromExecutionId`\n * and `tokenFromPayload` rebuild it from those values alone. Anyone who can\n * call `done`, `succeed`, `fail`, `failCause`, or `HumanTask.answer` against\n * the run's `FlowRuntime` can complete an open wait whose address they know or\n * derive. A host that exposes completion to other parties must authorize the\n * caller before it calls one of them.\n *\n * @category token\n * @since 0.1.0\n */\nexport type Token = Brand.Branded<string, TokenTypeId>\n\n/**\n * Schema for branded durable deferred tokens.\n *\n * @category token\n * @since 0.1.0\n */\nexport const Token: Schema.brand<Schema.String, TokenTypeId> = Schema.String.pipe(Schema.brand(TokenTypeId))\n\n/**\n * A completion token could not be decoded into its durable address.\n *\n * @category errors\n * @since 0.1.0\n */\nexport class TokenInvalid extends Schema.TaggedError<TokenInvalid>()(\"@smthrs/flow/DurableDeferred/TokenInvalid\", {\n code: Schema.Literals([\"malformed_token\", \"deferred_mismatch\"]).pipe(\n Schema.withConstructorDefault(Effect.succeed(\"malformed_token\"))\n ),\n message: Schema.String\n}) {}\n\n/**\n * Schema for a decoded durable deferred token containing the flow\n * name, execution ID, and deferred name.\n *\n * @category token\n * @since 0.1.0\n */\nexport class TokenParsed extends Schema.Class<TokenParsed>(\n \"@smthrs/flow/DurableDeferred/TokenParsed\"\n)({\n flowName: Schema.String,\n executionId: Schema.String,\n deferredName: Schema.String\n}) {\n /**\n * Encodes the parsed flow, execution, and deferred names back into a token.\n *\n * @since 0.1.0\n */\n get asToken(): Token {\n return Base64Url.encode(\n JSON.stringify([this.flowName, this.executionId, this.deferredName])\n ) as Token\n }\n\n /**\n * Schema for decoding and encoding durable deferred tokens as strings.\n *\n * @since 0.1.0\n */\n static readonly FromString = Schema.String.pipe(\n Schema.decodeTo(\n Schema.fromJsonString(\n Schema.Tuple([Schema.String, Schema.String, Schema.String])\n ),\n {\n decode: SchemaGetter.decodeBase64UrlString(),\n encode: SchemaGetter.encodeBase64Url()\n }\n ),\n Schema.decodeTo(TokenParsed, {\n decode: SchemaGetter.transform(\n ([flowName, executionId, deferredName]) =>\n new TokenParsed({\n flowName,\n executionId,\n deferredName\n })\n ),\n encode: SchemaGetter.transform(\n (parsed) =>\n [\n parsed.flowName,\n parsed.executionId,\n parsed.deferredName\n ] as const\n )\n })\n )\n\n /**\n * Decodes a durable deferred token string into its parsed components.\n *\n * @since 0.1.0\n */\n static readonly fromString = Schema.decodeSync(TokenParsed.FromString)\n\n /**\n * Encodes parsed durable deferred token components into a token string.\n *\n * @since 0.1.0\n */\n static readonly encode = Schema.encodeSync(TokenParsed.FromString)\n\n /**\n * Parses an untrusted token into its durable address with a typed,\n * bounded diagnostic on failure.\n *\n * @category token\n * @since 1.0.0\n */\n static readonly parse = (token: string): Effect.Effect<TokenParsed, TokenInvalid> =>\n Effect.mapError(\n Schema.decodeEffect(TokenParsed.FromString)(token),\n (issue) =>\n new TokenInvalid({\n message: `The supplied token \"${tokenExcerpt(token)}\" is not a durable deferred token: ${issue.message}`\n })\n )\n}\n\nconst maxTokenExcerptChars = 64\n\n/** Renders a bounded excerpt of untrusted token content for a diagnostic. */\nconst tokenExcerpt = (token: string): string =>\n token.length <= maxTokenExcerptChars\n ? token\n : `${token.slice(0, maxTokenExcerptChars)} [${token.length - maxTokenExcerptChars} characters dropped]`\n\n/**\n * Creates a token for a durable deferred using the current flow instance's\n * flow name and execution ID.\n *\n * @category token\n * @since 0.1.0\n */\nexport const token: <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n) => Effect.Effect<Token, never, FlowInstance> =\n // Untraced because token allocation is on the durable-deferred hot path.\n Effect.fnUntraced(\n function*<Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n ) {\n const instance = yield* FlowInstance\n return tokenFromExecutionId(self, instance)\n }\n )\n\n/**\n * Creates a durable deferred token from an explicit flow, execution ID,\n * and deferred name.\n *\n * @category token\n * @since 0.1.0\n */\nexport const tokenFromExecutionId: {\n (options: {\n readonly flow: Flow.Any\n readonly executionId: string\n }): <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n ) => Token\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: { readonly flow: Flow.Any; readonly executionId: string }\n ): Token\n} = dual(\n 2,\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly flow: Flow.Any\n readonly executionId: string\n }\n ): Token =>\n new TokenParsed({\n flowName: options.flow._tag,\n executionId: options.executionId,\n deferredName: self.name\n }).asToken\n)\n\n/**\n * Creates a durable deferred token by deriving the flow execution ID from\n * the supplied flow payload.\n *\n * The payload identifies a previously started execution only when the flow\n * declares `idempotencyKey` or the host installs the opt-in `derived`\n * execution-id source. Otherwise the default `fresh` source mints a new\n * execution ID on every call, so the token addresses no earlier run. To\n * complete an existing execution without stable identity, keep its execution\n * ID and use {@link tokenFromExecutionId}.\n *\n * @category token\n * @since 0.1.0\n */\nexport const tokenFromPayload: {\n <W extends Flow.Any>(options: {\n readonly flow: W\n readonly payload: Flow.PayloadSchema<W>[\"~type.make.in\"]\n }): <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>\n ) => Effect.Effect<Token, never, Crypto.Crypto | Flow.PayloadSchema<W>[\"EncodingServices\"]>\n <\n Success extends Schema.Constraint,\n Error extends Schema.Constraint,\n W extends Flow.Any\n >(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly flow: W\n readonly payload: Flow.PayloadSchema<W>[\"~type.make.in\"]\n }\n ): Effect.Effect<Token, never, Crypto.Crypto | Flow.PayloadSchema<W>[\"EncodingServices\"]>\n} = dual(\n 2,\n <\n Success extends Schema.Constraint,\n Error extends Schema.Constraint,\n W extends Flow.Any\n >(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly flow: W\n readonly payload: Flow.PayloadSchema<W>[\"~type.make.in\"]\n }\n ): Effect.Effect<Token, never, Crypto.Crypto | Flow.PayloadSchema<W>[\"EncodingServices\"]> =>\n Effect.map(options.flow.executionId(options.payload), (executionId) =>\n tokenFromExecutionId(self, {\n flow: options.flow,\n executionId\n }))\n)\n\n/**\n * Completes the durable deferred identified by a token with the supplied exit,\n * encoding the result through the deferred schemas.\n *\n * The token is not a credential (see {@link Token}): authorize the caller\n * before completing a wait on its behalf.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const done: {\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(options: {\n readonly token: Token\n readonly exit: Exit.Exit<Success[\"Type\"], Error[\"Type\"]>\n }): (\n self: DurableDeferred<Success, Error>\n ) => Effect.Effect<\n void,\n TokenInvalid,\n FlowRuntime | Success[\"EncodingServices\"] | Error[\"EncodingServices\"]\n >\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly exit: Exit.Exit<Success[\"Type\"], Error[\"Type\"]>\n }\n ): Effect.Effect<\n void,\n TokenInvalid,\n FlowRuntime | Success[\"EncodingServices\"] | Error[\"EncodingServices\"]\n >\n} = dual(\n 2,\n // Untraced because awaiting a deferred re-enters the scheduler recursively.\n Effect.fnUntraced(function*<\n Success extends Schema.Constraint,\n Error extends Schema.Constraint\n >(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly exit: Exit.Exit<Success[\"Type\"], Error[\"Type\"]>\n }\n ) {\n const token = yield* TokenParsed.parse(options.token)\n if (token.deferredName !== self.name) {\n return yield* Effect.fail(\n new TokenInvalid({\n code: \"deferred_mismatch\",\n message: `The token addresses deferred \"${tokenExcerpt(token.deferredName)}\", but it was submitted through ` +\n `deferred \"${self.name}\".`\n })\n )\n }\n const engine = yield* FlowRuntime\n yield* engine.deferredDone(self, {\n flowName: token.flowName,\n executionId: token.executionId,\n deferredName: token.deferredName,\n exit: options.exit\n })\n })\n)\n\n/**\n * Completes the durable deferred identified by a token with a successful\n * value.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const succeed: {\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(options: {\n readonly token: Token\n readonly value: Success[\"Type\"]\n }): (\n self: DurableDeferred<Success, Error>\n ) => Effect.Effect<void, TokenInvalid, FlowRuntime | Success[\"EncodingServices\"]>\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly value: Success[\"Type\"]\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Success[\"EncodingServices\"]>\n} = dual(\n 2,\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly value: Success[\"Type\"]\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Success[\"EncodingServices\"]> =>\n done(self, {\n token: options.token,\n exit: Exit.succeed(options.value)\n })\n)\n\n/**\n * Completes the durable deferred identified by a token with a typed failure.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const fail: {\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(options: {\n readonly token: Token\n readonly error: Error[\"Type\"]\n }): (\n self: DurableDeferred<Success, Error>\n ) => Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]>\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly error: Error[\"Type\"]\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]>\n} = dual(\n 2,\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly error: Error[\"Type\"]\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]> =>\n done(self, {\n token: options.token,\n exit: Exit.fail(options.error)\n })\n)\n\n/**\n * Completes the durable deferred identified by a token with a failure cause.\n *\n * @category combinators\n * @since 0.1.0\n */\nexport const failCause: {\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(options: {\n readonly token: Token\n readonly cause: Cause.Cause<Error[\"Type\"]>\n }): (\n self: DurableDeferred<Success, Error>\n ) => Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]>\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly cause: Cause.Cause<Error[\"Type\"]>\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]>\n} = dual(\n 2,\n <Success extends Schema.Constraint, Error extends Schema.Constraint>(\n self: DurableDeferred<Success, Error>,\n options: {\n readonly token: Token\n readonly cause: Cause.Cause<Error[\"Type\"]>\n }\n ): Effect.Effect<void, TokenInvalid, FlowRuntime | Error[\"EncodingServices\"]> =>\n done(self, {\n token: options.token,\n exit: Exit.failCause(options.cause)\n })\n)\n"]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type * as Crypto from "effect/Crypto";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as PersistedQueue from "effect/persistence/PersistedQueue";
|
|
5
|
+
import * as Schedule from "effect/Schedule";
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as DurableDeferred from "./DurableDeferred.ts";
|
|
8
|
+
import { type FlowInstance, type FlowRuntime } from "./FlowRuntime/index.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Type-level identifier used to recognize `DurableQueue` values.
|
|
11
|
+
*
|
|
12
|
+
* @category type IDs
|
|
13
|
+
* @since 0.1.0
|
|
14
|
+
*/
|
|
15
|
+
export type TypeId = "@smthrs/flow/DurableQueue";
|
|
16
|
+
/**
|
|
17
|
+
* Runtime identifier attached to `DurableQueue` values.
|
|
18
|
+
*
|
|
19
|
+
* @category type IDs
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
22
|
+
export declare const TypeId: TypeId;
|
|
23
|
+
/**
|
|
24
|
+
* Durable flow queue definition containing a payload schema, idempotency
|
|
25
|
+
* key, and deferred used to await worker results.
|
|
26
|
+
*
|
|
27
|
+
* @category models
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
*/
|
|
30
|
+
export interface DurableQueue<Payload extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never> {
|
|
31
|
+
readonly [TypeId]: TypeId;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly payloadSchema: Payload;
|
|
34
|
+
readonly idempotencyKey: (payload: Payload["Type"]) => string;
|
|
35
|
+
readonly deferred: DurableDeferred.DurableDeferred<Success, Error>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a `DurableQueue` that waits for persisted items to finish processing
|
|
39
|
+
* using a `DurableDeferred`.
|
|
40
|
+
*
|
|
41
|
+
* **Example** (Defining a durable queue with workers)
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { Action, DurableQueue, Flow, Interpreter } from "@smthrs/flow"
|
|
45
|
+
* import { Effect, Layer, Schema } from "effect"
|
|
46
|
+
*
|
|
47
|
+
* // Define a DurableQueue that can be used to derive workers and offer items for
|
|
48
|
+
* // processing.
|
|
49
|
+
* const ApiQueue = DurableQueue.make({
|
|
50
|
+
* name: "ApiQueue",
|
|
51
|
+
* payload: {
|
|
52
|
+
* id: Schema.String
|
|
53
|
+
* },
|
|
54
|
+
* success: Schema.Void,
|
|
55
|
+
* error: Schema.Never,
|
|
56
|
+
* idempotencyKey(payload) {
|
|
57
|
+
* return payload.id
|
|
58
|
+
* }
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
61
|
+
* // Offering an item is work, so it is a declared Action: the declaration is
|
|
62
|
+
* // pure data, and the implementation attaches separately.
|
|
63
|
+
* const Offer = Action.make("MyFlow/offer", {
|
|
64
|
+
* payload: {
|
|
65
|
+
* id: Schema.String
|
|
66
|
+
* }
|
|
67
|
+
* })
|
|
68
|
+
*
|
|
69
|
+
* const OfferLive = Offer.toLayer(
|
|
70
|
+
* Effect.fnUntraced(function*({ id }) {
|
|
71
|
+
* // Add an item to the DurableQueue defined above.
|
|
72
|
+
* //
|
|
73
|
+
* // When the worker has finished processing the item, the flow will
|
|
74
|
+
* // resume.
|
|
75
|
+
* //
|
|
76
|
+
* yield* DurableQueue.process(ApiQueue, { id })
|
|
77
|
+
*
|
|
78
|
+
* yield* Effect.log("Flow succeeded!")
|
|
79
|
+
* })
|
|
80
|
+
* )
|
|
81
|
+
*
|
|
82
|
+
* // The flow is the composite, and its body names the step it is made of.
|
|
83
|
+
* const MyFlow = Flow.make("MyFlow", {
|
|
84
|
+
* payload: {
|
|
85
|
+
* id: Schema.String
|
|
86
|
+
* },
|
|
87
|
+
* idempotencyKey: ({ id }) => id,
|
|
88
|
+
* body: (payload) => Offer.call(payload)
|
|
89
|
+
* })
|
|
90
|
+
*
|
|
91
|
+
* const MyFlowLayer = Layer.mergeAll(OfferLive, Interpreter.layer(MyFlow)).pipe(
|
|
92
|
+
* Layer.provideMerge(Action.layerImplementations)
|
|
93
|
+
* )
|
|
94
|
+
*
|
|
95
|
+
* // Define a worker layer that can process items from the DurableQueue.
|
|
96
|
+
* const ApiWorker = DurableQueue.worker(
|
|
97
|
+
* ApiQueue,
|
|
98
|
+
* Effect.fnUntraced(function*({ id }) {
|
|
99
|
+
* yield* Effect.log(`Worker processing API call with id: ${id}`)
|
|
100
|
+
* }),
|
|
101
|
+
* { concurrency: 5 } // Process up to 5 items concurrently
|
|
102
|
+
* )
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @category constructors
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
*/
|
|
108
|
+
export declare const make: <Payload extends Schema.Top | Schema.Struct.Fields, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(options: {
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly payload: Payload;
|
|
111
|
+
readonly idempotencyKey: (payload: Payload extends Schema.Struct.Fields ? Schema.Struct.Type<Payload> : Payload["Type"]) => string;
|
|
112
|
+
readonly success?: Success | undefined;
|
|
113
|
+
readonly error?: Error | undefined;
|
|
114
|
+
}) => DurableQueue<Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload, Success, Error>;
|
|
115
|
+
/**
|
|
116
|
+
* Adds an item to the queue and waits for a worker to process it.
|
|
117
|
+
*
|
|
118
|
+
* `retrySchedule` controls retries when the persisted offer fails. The default
|
|
119
|
+
* is unbounded, with exponential delays capped at one minute, so a transient
|
|
120
|
+
* store outage does not lose the item. A caller-supplied schedule may exhaust;
|
|
121
|
+
* its final offer failure becomes a defect to keep the public error channel
|
|
122
|
+
* reserved for the worker's declared error.
|
|
123
|
+
*
|
|
124
|
+
* Payload construction also becomes a defect when `fields` does not satisfy
|
|
125
|
+
* the queue's payload schema. The public error channel is the worker result,
|
|
126
|
+
* not malformed caller input.
|
|
127
|
+
*
|
|
128
|
+
* @category processing
|
|
129
|
+
* @since 0.1.0
|
|
130
|
+
*/
|
|
131
|
+
export declare const process: <Payload extends Schema.Top, Success extends Schema.Top, Error extends Schema.Top>(self: DurableQueue<Payload, Success, Error>, payload: Payload["~type.make.in"], options?: {
|
|
132
|
+
readonly retrySchedule?: Schedule.Schedule<any, PersistedQueue.PersistedQueueError> | undefined;
|
|
133
|
+
}) => Effect.Effect<Success["Type"], Error["Type"], FlowRuntime | FlowInstance | Crypto.Crypto | PersistedQueue.PersistedQueueFactory | Payload["EncodingServices"] | Payload["DecodingServices"] | Success["DecodingServices"] | Error["DecodingServices"]>;
|
|
134
|
+
/**
|
|
135
|
+
* Create a worker effect that processes items from the durable queue.
|
|
136
|
+
*
|
|
137
|
+
* `concurrency` defaults to one and must be a positive safe integer. It is
|
|
138
|
+
* checked before the persisted queue is opened. `maxAttempts` defaults to ten
|
|
139
|
+
* and is passed to the persisted queue. Completion-write failures can rerun the
|
|
140
|
+
* handler; side effects must be idempotent. Exhaustion leaves the flow waiting.
|
|
141
|
+
*
|
|
142
|
+
* @throws A `RangeError` when `concurrency` is not a positive safe integer.
|
|
143
|
+
* @category worker
|
|
144
|
+
* @since 0.1.0
|
|
145
|
+
*/
|
|
146
|
+
export declare const makeWorker: <Payload extends Schema.Top, Success extends Schema.Top, Error extends Schema.Top, R>(self: DurableQueue<Payload, Success, Error>, f: (payload: Payload["Type"]) => Effect.Effect<Success["Type"], Error["Type"], R>, options?: {
|
|
147
|
+
readonly concurrency?: number | undefined;
|
|
148
|
+
readonly maxAttempts?: number | undefined;
|
|
149
|
+
} | undefined) => Effect.Effect<never, never, FlowRuntime | PersistedQueue.PersistedQueueFactory | R | Payload["EncodingServices"] | Payload["DecodingServices"] | Success["EncodingServices"] | Error["EncodingServices"]>;
|
|
150
|
+
/**
|
|
151
|
+
* Create a layer that runs workers for the durable queue.
|
|
152
|
+
*
|
|
153
|
+
* @category worker
|
|
154
|
+
* @since 0.1.0
|
|
155
|
+
*/
|
|
156
|
+
export declare const worker: <Payload extends Schema.Top, Success extends Schema.Top, Error extends Schema.Top, R>(self: DurableQueue<Payload, Success, Error>, f: (payload: Payload["Type"]) => Effect.Effect<Success["Type"], Error["Type"], R>, options?: {
|
|
157
|
+
readonly concurrency?: number | undefined;
|
|
158
|
+
readonly maxAttempts?: number | undefined;
|
|
159
|
+
} | undefined) => Layer.Layer<never, never, FlowRuntime | PersistedQueue.PersistedQueueFactory | R | Payload["EncodingServices"] | Payload["DecodingServices"] | Success["EncodingServices"] | Error["EncodingServices"]>;
|
|
160
|
+
//# sourceMappingURL=DurableQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurableQueue.d.ts","sourceRoot":"","sources":["../../src/DurableQueue.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAE7F;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,2BAA2B,CAAA;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,MAAoC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAC3B,OAAO,SAAS,MAAM,CAAC,GAAG,EAC1B,OAAO,SAAS,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,EACxC,KAAK,SAAS,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK;IAEvC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,MAAM,CAAA;IAC7D,QAAQ,CAAC,QAAQ,EAAE,eA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