@smthrs/flow 0.0.0-stage → 1.0.0-rc.4
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 +160 -0
- package/LICENSE +21 -0
- package/README.md +210 -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 +373 -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 +105 -0
- package/dist/cjs/Deadline.d.ts.map +1 -0
- package/dist/cjs/Deadline.js +104 -0
- package/dist/cjs/Deadline.js.map +7 -0
- package/dist/cjs/DurableClock.d.ts +61 -0
- package/dist/cjs/DurableClock.d.ts.map +1 -0
- package/dist/cjs/DurableClock.js +90 -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 +338 -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 +160 -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 +134 -0
- package/dist/cjs/Flow/make.d.ts.map +1 -0
- package/dist/cjs/Flow/make.js +104 -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 +198 -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 +175 -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 +1021 -0
- package/dist/cjs/Graph.js.map +7 -0
- package/dist/cjs/HumanTask.d.ts +440 -0
- package/dist/cjs/HumanTask.d.ts.map +1 -0
- package/dist/cjs/HumanTask.js +413 -0
- package/dist/cjs/HumanTask.js.map +7 -0
- package/dist/cjs/Interpreter.d.ts +222 -0
- package/dist/cjs/Interpreter.d.ts.map +1 -0
- package/dist/cjs/Interpreter.js +888 -0
- package/dist/cjs/Interpreter.js.map +7 -0
- package/dist/cjs/Poll.d.ts +238 -0
- package/dist/cjs/Poll.d.ts.map +1 -0
- package/dist/cjs/Poll.js +150 -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 +133 -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 +405 -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 +105 -0
- package/dist/esm/Deadline.d.ts.map +1 -0
- package/dist/esm/Deadline.js +152 -0
- package/dist/esm/Deadline.js.map +1 -0
- package/dist/esm/DurableClock.d.ts +61 -0
- package/dist/esm/DurableClock.d.ts.map +1 -0
- package/dist/esm/DurableClock.js +75 -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 +231 -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 +134 -0
- package/dist/esm/Flow/make.d.ts.map +1 -0
- package/dist/esm/Flow/make.js +106 -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 +198 -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 +175 -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 +1483 -0
- package/dist/esm/Graph.js.map +1 -0
- package/dist/esm/HumanTask.d.ts +440 -0
- package/dist/esm/HumanTask.d.ts.map +1 -0
- package/dist/esm/HumanTask.js +794 -0
- package/dist/esm/HumanTask.js.map +1 -0
- package/dist/esm/Interpreter.d.ts +222 -0
- package/dist/esm/Interpreter.d.ts.map +1 -0
- package/dist/esm/Interpreter.js +1269 -0
- package/dist/esm/Interpreter.js.map +1 -0
- package/dist/esm/Poll.d.ts +238 -0
- package/dist/esm/Poll.d.ts.map +1 -0
- package/dist/esm/Poll.js +282 -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 +230 -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 +150 -0
- package/docs/api.md +436 -0
- package/docs/concepts/bodies-and-plans.md +157 -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 +161 -0
- package/docs/guides/cancel-and-roll-back.md +112 -0
- package/docs/guides/implement-an-action.md +147 -0
- package/docs/guides/inspect-the-plan.md +154 -0
- package/docs/guides/poll-until-ready.md +167 -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 +122 -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 +82 -0
- package/docs/quickstart.md +155 -0
- package/docs/reference/flow.md +1831 -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 +657 -0
- package/src/Action/raceAll.ts +48 -0
- package/src/Action/retry.ts +92 -0
- package/src/Deadline.ts +185 -0
- package/src/DurableClock.ts +133 -0
- package/src/DurableDeferred.ts +753 -0
- package/src/DurableQueue.ts +519 -0
- package/src/ExternalJob.ts +432 -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 +309 -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 +279 -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 +333 -0
- package/src/FlowRuntime/NodeRecord.ts +183 -0
- package/src/FlowRuntime/WaitingAnnotation.ts +85 -0
- package/src/FlowRuntime/index.ts +17 -0
- package/src/Graph.ts +1862 -0
- package/src/HumanTask.ts +1003 -0
- package/src/Interpreter.ts +1593 -0
- package/src/Poll.ts +414 -0
- package/src/RetryPolicy.ts +550 -0
- package/src/Sleep.ts +267 -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
package/src/Poll.ts
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polling as a durable lineage: one attempt per round, a durable wait between
|
|
3
|
+
* attempts, and a bound the lineage settles on.
|
|
4
|
+
*
|
|
5
|
+
* Smithers 0.x had a `Poller` component — a check, an interval, a backoff, an
|
|
6
|
+
* attempt bound, and what to do at that bound. The pieces it was built from
|
|
7
|
+
* already exist here: {@link module:Sleep.action} is the durable wait, and
|
|
8
|
+
* `Flow.to` opens the next round. What was missing is the shape that puts them
|
|
9
|
+
* together, and that is this module.
|
|
10
|
+
*
|
|
11
|
+
* A poll is a flow whose body is ONE attempt. It runs the check, and branches:
|
|
12
|
+
* a satisfied check settles the lineage with the check's own output, an
|
|
13
|
+
* unsatisfied one sleeps for this attempt's delay and hands off to the next
|
|
14
|
+
* round with the attempt counter raised. The last attempt has no sleep and no
|
|
15
|
+
* handoff — it either answers with the output it just read (`return-last`) or
|
|
16
|
+
* fails {@link PollExhausted} (`fail`).
|
|
17
|
+
*
|
|
18
|
+
* Everything durable about it is durable for the ordinary reason. Each attempt
|
|
19
|
+
* is a round with its own keyed plan nodes, so a check that already ran replays
|
|
20
|
+
* from its recorded outcome instead of running again; the wait between attempts
|
|
21
|
+
* is a durable timer, so a process that dies during it resumes on the round it
|
|
22
|
+
* left rather than starting the poll over; and the attempt counter travels in
|
|
23
|
+
* the payload, so nothing about "which attempt is this" lives in memory.
|
|
24
|
+
*
|
|
25
|
+
* The bound is stated twice on purpose. The body ends the lineage on the last
|
|
26
|
+
* attempt, and `maxAttempts` is also the flow's `maxRounds` budget, so a
|
|
27
|
+
* lineage that somehow opened another round is refused by the engine rather
|
|
28
|
+
* than polling forever.
|
|
29
|
+
*
|
|
30
|
+
* @since 0.1.0
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import * as Node from "@smthrs/plan/Node"
|
|
34
|
+
import type * as Repetition from "@smthrs/plan/Repetition"
|
|
35
|
+
import type * as Crypto from "effect/Crypto"
|
|
36
|
+
import * as Effect from "effect/Effect"
|
|
37
|
+
import type * as Layer from "effect/Layer"
|
|
38
|
+
import * as Schema from "effect/Schema"
|
|
39
|
+
import * as Action from "./Action/index.ts"
|
|
40
|
+
import * as Flow from "./Flow/index.ts"
|
|
41
|
+
import type { FlowRuntime } from "./FlowRuntime/FlowRuntime.ts"
|
|
42
|
+
import * as Sleep from "./Sleep.ts"
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* How the wait between attempts grows.
|
|
46
|
+
*
|
|
47
|
+
* `fixed` waits the interval every time, `linear` waits the interval times the
|
|
48
|
+
* attempt, and `exponential` doubles the interval on every attempt.
|
|
49
|
+
*
|
|
50
|
+
* @category models
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
*/
|
|
53
|
+
export type Backoff = "fixed" | "linear" | "exponential"
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* What a check reports: whether the poll is over, and the value this attempt
|
|
57
|
+
* read.
|
|
58
|
+
*
|
|
59
|
+
* The output travels on every attempt, satisfied or not, because it is also
|
|
60
|
+
* the answer a `return-last` poll settles with when it runs out of attempts.
|
|
61
|
+
*
|
|
62
|
+
* @category models
|
|
63
|
+
* @since 0.1.0
|
|
64
|
+
*/
|
|
65
|
+
export interface Check<out Result> {
|
|
66
|
+
readonly satisfied: boolean
|
|
67
|
+
readonly output: Result
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The success schema a check action declares.
|
|
72
|
+
*
|
|
73
|
+
* @category schemas
|
|
74
|
+
* @since 0.1.0
|
|
75
|
+
*/
|
|
76
|
+
export const CheckResult = <Result extends Schema.Top>(
|
|
77
|
+
result: Result
|
|
78
|
+
): Schema.Struct<{
|
|
79
|
+
readonly satisfied: typeof Schema.Boolean
|
|
80
|
+
readonly output: Result
|
|
81
|
+
}> => Schema.Struct({ satisfied: Schema.Boolean, output: result })
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A poll that used its last attempt without a satisfied check.
|
|
85
|
+
*
|
|
86
|
+
* It is a typed failure rather than a defect: running out of attempts is an
|
|
87
|
+
* expected outcome of polling something that may never become ready, so a
|
|
88
|
+
* caller recovers from it through `Node.catch` like any other declared failure.
|
|
89
|
+
*
|
|
90
|
+
* @category errors
|
|
91
|
+
* @since 0.1.0
|
|
92
|
+
*/
|
|
93
|
+
export class PollExhausted extends Schema.TaggedError<PollExhausted>()(
|
|
94
|
+
"@smthrs/flow/PollExhausted",
|
|
95
|
+
{
|
|
96
|
+
// This wire shape freezes at 1.0.0-rc.0.
|
|
97
|
+
code: Schema.Literal("poll_exhausted").pipe(
|
|
98
|
+
Schema.withConstructorDefault(Effect.succeed("poll_exhausted"))
|
|
99
|
+
),
|
|
100
|
+
poll: Schema.String,
|
|
101
|
+
attempts: Schema.Number,
|
|
102
|
+
message: Schema.String
|
|
103
|
+
}
|
|
104
|
+
) {}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The tag the exhaustion step is catalogued and resolved under.
|
|
108
|
+
*
|
|
109
|
+
* @category constructors
|
|
110
|
+
* @since 0.1.0
|
|
111
|
+
*/
|
|
112
|
+
export const exhaustedTag = "system/poll-exhausted"
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The declared step a poll takes when its last attempt was not satisfied.
|
|
116
|
+
*
|
|
117
|
+
* Running out of attempts is a step rather than a bare `Effect.fail` so the
|
|
118
|
+
* exhaustion is in the plan and in the journal: the round that gave up shows
|
|
119
|
+
* which poll gave up and after how many attempts, exactly like every other node
|
|
120
|
+
* a body drove.
|
|
121
|
+
*
|
|
122
|
+
* @category constructors
|
|
123
|
+
* @since 0.1.0
|
|
124
|
+
*/
|
|
125
|
+
export const exhausted: Action.Declared<
|
|
126
|
+
typeof exhaustedTag,
|
|
127
|
+
Schema.Struct<{
|
|
128
|
+
readonly poll: typeof Schema.String
|
|
129
|
+
readonly attempts: typeof Schema.Number
|
|
130
|
+
}>,
|
|
131
|
+
typeof Schema.Never,
|
|
132
|
+
typeof PollExhausted,
|
|
133
|
+
never
|
|
134
|
+
> = Action.makeSystem(exhaustedTag, {
|
|
135
|
+
payload: { poll: Schema.String, attempts: Schema.Number },
|
|
136
|
+
success: Schema.Never,
|
|
137
|
+
error: PollExhausted,
|
|
138
|
+
tier: "sealed"
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The wait before the attempt after this one, in milliseconds.
|
|
143
|
+
*
|
|
144
|
+
* @category combinators
|
|
145
|
+
* @since 0.1.0
|
|
146
|
+
*/
|
|
147
|
+
export const delayMillis = (options: {
|
|
148
|
+
readonly intervalMs: number
|
|
149
|
+
readonly backoff: Backoff
|
|
150
|
+
readonly attempt: number
|
|
151
|
+
}): number =>
|
|
152
|
+
options.intervalMs *
|
|
153
|
+
(options.backoff === "fixed" ? 1 : options.backoff === "linear" ? options.attempt : 2 ** (options.attempt - 1))
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* What a poll round can fail with.
|
|
157
|
+
*
|
|
158
|
+
* {@link PollExhausted} is the poll's own failure. `SleepRequestInvalid` is the
|
|
159
|
+
* wait node's, declared because the wait between attempts is an ordinary
|
|
160
|
+
* {@link module:Sleep.action} node and its typed refusal is part of the
|
|
161
|
+
* topology a poll carries. Its codes cover a payload that names no deadline,
|
|
162
|
+
* names two deadlines, or names a value that is not a deadline. {@link make}
|
|
163
|
+
* refuses invalid author schedules at construction. A caller-visible round
|
|
164
|
+
* payload can still carry an invalid attempt that produces an invalid derived
|
|
165
|
+
* wait, so `Sleep` refuses that wait before the round parks.
|
|
166
|
+
*
|
|
167
|
+
* @category schemas
|
|
168
|
+
* @since 0.1.0
|
|
169
|
+
*/
|
|
170
|
+
export const Failure: Schema.Union<
|
|
171
|
+
readonly [typeof PollExhausted, typeof Sleep.SleepRequestInvalid]
|
|
172
|
+
> = Schema.Union([PollExhausted, Sleep.SleepRequestInvalid])
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The payload schema {@link make} derives from an author's input fields: the
|
|
176
|
+
* author's own fields, plus the attempt this round is.
|
|
177
|
+
*
|
|
178
|
+
* `attempt` is optional so a caller starts a poll with its own fields alone;
|
|
179
|
+
* the first round reads it as one.
|
|
180
|
+
*
|
|
181
|
+
* @category models
|
|
182
|
+
* @since 0.1.0
|
|
183
|
+
*/
|
|
184
|
+
export type PayloadSchema<Input extends Schema.Struct.Fields> = Schema.Struct<
|
|
185
|
+
Input & { readonly attempt: Schema.optional<typeof Schema.Number> }
|
|
186
|
+
>
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The payload schema one round is opened with: the author's fields, plus the
|
|
190
|
+
* attempt counter the lineage carries between them.
|
|
191
|
+
*
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
const payloadSchema = <Input extends Schema.Struct.Fields>(
|
|
195
|
+
input: Input,
|
|
196
|
+
maxAttempts: number
|
|
197
|
+
): PayloadSchema<Input> =>
|
|
198
|
+
Schema.Struct({
|
|
199
|
+
...input,
|
|
200
|
+
attempt: Schema.optional(
|
|
201
|
+
Schema.Int.check(
|
|
202
|
+
Schema.isGreaterThanOrEqualTo(1),
|
|
203
|
+
Schema.isLessThanOrEqualTo(maxAttempts)
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The attempt a round payload carries, defaulting to the first.
|
|
210
|
+
*
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
const attemptOf = (payload: object): number => {
|
|
214
|
+
const attempt = (payload as { readonly attempt?: unknown }).attempt
|
|
215
|
+
return typeof attempt === "number" ? attempt : 1
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Rebuilds a round payload with an explicit attempt.
|
|
220
|
+
*
|
|
221
|
+
* The two views of one round payload — what the check reads, and what the next
|
|
222
|
+
* round is opened with — are the same fields with `attempt` resolved. TypeScript
|
|
223
|
+
* cannot reduce a mapped type over an unresolved generic field set, so the
|
|
224
|
+
* shape is stated once here instead of at each use.
|
|
225
|
+
*
|
|
226
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
const withAttempt = <Payload>(payload: object, attempt: number): Payload =>
|
|
229
|
+
({ ...payload, attempt }) as unknown as Payload
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Declares a durable poller.
|
|
233
|
+
*
|
|
234
|
+
* **When to use**
|
|
235
|
+
*
|
|
236
|
+
* Use it wherever a run has to keep asking until something is ready — a build
|
|
237
|
+
* that finishes, a deployment that goes live, a review that lands — and the
|
|
238
|
+
* waiting has to survive a restart. `check` is the one thing an author writes:
|
|
239
|
+
* a body fragment that reads whatever it polls and reports a {@link Check}.
|
|
240
|
+
* Everything else is schedule. Under stable callback admission (the default of
|
|
241
|
+
* `Interpreter.layerWithImplementations`), wrap `check` in `Node.capture` with
|
|
242
|
+
* every semantic capture, including a version for imported behavior. An
|
|
243
|
+
* uncaptured check keeps the poll process-local. The helper captures its own
|
|
244
|
+
* callbacks using the schedule and the check's identity.
|
|
245
|
+
*
|
|
246
|
+
* ```ts
|
|
247
|
+
* const Deployment = Poll.make("deploy/wait", {
|
|
248
|
+
* input: { id: Schema.String },
|
|
249
|
+
* result: Schema.String,
|
|
250
|
+
* intervalMs: 5_000,
|
|
251
|
+
* backoff: "exponential",
|
|
252
|
+
* maxAttempts: 8,
|
|
253
|
+
* onTimeout: "fail",
|
|
254
|
+
* check: Node.capture(
|
|
255
|
+
* { action: Status.name, implementationVersion: "deploy/status-check/v1" },
|
|
256
|
+
* ({ attempt, id }) => Status.call({ attempt, id })
|
|
257
|
+
* )
|
|
258
|
+
* })
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* The check may not fail. A check that can fail states what a failure means for
|
|
262
|
+
* the poll — give up, or treat it as "not ready yet" — with `Node.catch` inside
|
|
263
|
+
* the fragment, rather than leaving the poll to guess.
|
|
264
|
+
*
|
|
265
|
+
* A per-attempt time limit on the check itself is NOT a poll option. A plan
|
|
266
|
+
* node's duration is not something the body around it can bound; that bound
|
|
267
|
+
* belongs in the check's own implementation, where `DurableDeferred.raceAll`
|
|
268
|
+
* races the work against a durable clock and stays replayable.
|
|
269
|
+
*
|
|
270
|
+
* A schedule no clock can be armed with is refused here, with a `RangeError`
|
|
271
|
+
* naming the option that is wrong. `intervalMs` becomes the `millis` of a
|
|
272
|
+
* {@link module:Sleep.action} node, and a wait of `Infinity`, `NaN`, or a
|
|
273
|
+
* negative length arms a timer that never fires — a poll that hangs forever
|
|
274
|
+
* with a plan that looks correct. The check is on the schedule, not only on the
|
|
275
|
+
* interval: `{ intervalMs: 1000, maxAttempts: 2000, backoff: "exponential" }`
|
|
276
|
+
* states three finite options and asks for an infinite wait, so the LAST wait
|
|
277
|
+
* the poll can arm has to be a length too. `maxAttempts` is the lineage's round
|
|
278
|
+
* budget, and a budget below one attempt reaches `Flow.make` as a `maxRounds`
|
|
279
|
+
* complaint about an option the author never wrote.
|
|
280
|
+
*
|
|
281
|
+
* @throws A `RangeError` when `intervalMs` is not a duration a clock accepts,
|
|
282
|
+
* when `maxAttempts` is not a whole number of attempts of at least one, or when
|
|
283
|
+
* the interval under the declared backoff reaches a wait no clock can be armed
|
|
284
|
+
* with before the budget is spent.
|
|
285
|
+
* @category constructors
|
|
286
|
+
* @since 0.1.0
|
|
287
|
+
*/
|
|
288
|
+
export const make = <
|
|
289
|
+
const Tag extends string,
|
|
290
|
+
Input extends Schema.Struct.Fields,
|
|
291
|
+
Result extends Schema.Top,
|
|
292
|
+
R = never
|
|
293
|
+
>(
|
|
294
|
+
tag: Tag,
|
|
295
|
+
options: {
|
|
296
|
+
readonly input: Input
|
|
297
|
+
readonly result: Result
|
|
298
|
+
readonly check: (
|
|
299
|
+
payload: Schema.Struct.Type<Input> & { readonly attempt: number }
|
|
300
|
+
) => Node.Node<Check<Result["Type"]>, never, R>
|
|
301
|
+
readonly intervalMs: number
|
|
302
|
+
readonly maxAttempts: number
|
|
303
|
+
readonly backoff?: Backoff | undefined
|
|
304
|
+
readonly onTimeout?: Repetition.AtCeiling | undefined
|
|
305
|
+
}
|
|
306
|
+
): Flow.Flow<Tag, PayloadSchema<Input>, Result, typeof Failure, R> => {
|
|
307
|
+
type Round = Flow.Flow<Tag, PayloadSchema<Input>, Result, typeof Failure, R>
|
|
308
|
+
type RoundPayload = PayloadSchema<Input>["Type"]
|
|
309
|
+
if (Object.prototype.hasOwnProperty.call(options.input, "attempt")) {
|
|
310
|
+
throw new TypeError(
|
|
311
|
+
`Poll.make: "${tag}" input cannot declare the reserved "attempt" field. ` +
|
|
312
|
+
"Poll owns that counter across durable rounds."
|
|
313
|
+
)
|
|
314
|
+
}
|
|
315
|
+
const input = Object.freeze({ ...options.input }) as Input
|
|
316
|
+
const result = options.result
|
|
317
|
+
const check = options.check
|
|
318
|
+
const intervalMs = options.intervalMs
|
|
319
|
+
const maxAttempts = options.maxAttempts
|
|
320
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 0) {
|
|
321
|
+
throw new RangeError(
|
|
322
|
+
`Poll.make: "${tag}" intervalMs must be a finite number of milliseconds that is not negative, ` +
|
|
323
|
+
`and was ${intervalMs}. The interval is the length of a durable wait, and a wait of ` +
|
|
324
|
+
"that length never ends."
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
if (!Number.isSafeInteger(maxAttempts) || maxAttempts < 1) {
|
|
328
|
+
throw new RangeError(
|
|
329
|
+
`Poll.make: "${tag}" maxAttempts must be a whole number of attempts of at least one, and was ` +
|
|
330
|
+
`${maxAttempts}. A poll checks at least once.`
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
const backoff = options.backoff ?? "fixed"
|
|
334
|
+
// The wait a poll arms is not `intervalMs`. {@link delayMillis} multiplies it
|
|
335
|
+
// by the backoff, so a schedule whose options are each finite can still ask
|
|
336
|
+
// for a wait that is not a length — and that wait arms the same timer that
|
|
337
|
+
// never fires the interval guard above exists to refuse. The last wait is the
|
|
338
|
+
// one before the final attempt, because the attempt at the budget gives up
|
|
339
|
+
// rather than sleeps, and the schedule never shrinks, so the last wait is
|
|
340
|
+
// also the longest: checking it checks all of them.
|
|
341
|
+
const longestWaitMs = maxAttempts > 1
|
|
342
|
+
? delayMillis({ intervalMs, backoff, attempt: maxAttempts - 1 })
|
|
343
|
+
: 0
|
|
344
|
+
if (!Number.isFinite(longestWaitMs)) {
|
|
345
|
+
throw new RangeError(
|
|
346
|
+
`Poll.make: "${tag}" asks for a wait of ${longestWaitMs} ms before its last attempt. An ` +
|
|
347
|
+
`intervalMs of ${intervalMs} under the "${backoff}" backoff reaches a length no clock ` +
|
|
348
|
+
`can be armed with by attempt ${maxAttempts - 1} of ${maxAttempts}. Lower ` +
|
|
349
|
+
"maxAttempts, shorten the interval, or slow the backoff."
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
const onTimeout = options.onTimeout ?? "fail"
|
|
353
|
+
const captures = { tag, intervalMs, backoff, maxAttempts, onTimeout, check: Node.functionIdentity(check) }
|
|
354
|
+
const body = (
|
|
355
|
+
payload: RoundPayload
|
|
356
|
+
): Node.Node<Flow.BodySuccess<Result["Type"]>, typeof Failure.Type, R> => {
|
|
357
|
+
const attempt = attemptOf(payload)
|
|
358
|
+
const last = attempt >= maxAttempts
|
|
359
|
+
return check(withAttempt(payload, attempt)).pipe(
|
|
360
|
+
Node.branch({
|
|
361
|
+
if: Node.capture(captures, (checked) => checked.satisfied),
|
|
362
|
+
then: (checked) => Flow.done(checked.output),
|
|
363
|
+
else: (checked): Node.Node<Flow.BodySuccess<Result["Type"]>, typeof Failure.Type> =>
|
|
364
|
+
last
|
|
365
|
+
? onTimeout === "return-last"
|
|
366
|
+
? Flow.done(checked.output)
|
|
367
|
+
: exhausted.call({ poll: tag, attempts: attempt })
|
|
368
|
+
: Sleep.action.call({
|
|
369
|
+
millis: delayMillis({ intervalMs, backoff, attempt })
|
|
370
|
+
}).pipe(
|
|
371
|
+
Node.andThen(
|
|
372
|
+
self.to(withAttempt<Parameters<Round["to"]>[0]>(payload, attempt + 1))
|
|
373
|
+
)
|
|
374
|
+
)
|
|
375
|
+
})
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
// The body names the flow it is the body of, which is what makes one round
|
|
379
|
+
// open the next. It is read when a round is planned, long after `Flow.make`
|
|
380
|
+
// has returned, so the binding is initialized by then.
|
|
381
|
+
const self: Round = Flow.make(tag, {
|
|
382
|
+
payload: payloadSchema(input, maxAttempts),
|
|
383
|
+
success: result,
|
|
384
|
+
error: Failure,
|
|
385
|
+
maxRounds: maxAttempts,
|
|
386
|
+
// A captured wrapper must not admit a process-local check as stable.
|
|
387
|
+
body: captures.check.algorithm === "sha256-source-ephemeral/v4" ? body : Node.capture(captures, body)
|
|
388
|
+
})
|
|
389
|
+
return self
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* The exhaustion implementation, provided beside the other action layers a
|
|
394
|
+
* poll's rounds call.
|
|
395
|
+
*
|
|
396
|
+
* ```ts
|
|
397
|
+
* Layer.mergeAll(Poll.layer, Sleep.layer, Interpreter.layer(Deployment)).pipe(
|
|
398
|
+
* Layer.provideMerge(Action.layerImplementations)
|
|
399
|
+
* )
|
|
400
|
+
* ```
|
|
401
|
+
*
|
|
402
|
+
* @category layers
|
|
403
|
+
* @since 0.1.0
|
|
404
|
+
*/
|
|
405
|
+
export const layer: Layer.Layer<never, never, Crypto.Crypto | FlowRuntime> = exhausted.toLayer(
|
|
406
|
+
({ attempts, poll }) =>
|
|
407
|
+
Effect.fail(
|
|
408
|
+
new PollExhausted({
|
|
409
|
+
poll,
|
|
410
|
+
attempts,
|
|
411
|
+
message: `Poll "${poll}" used all ${attempts} attempts without a satisfied check.`
|
|
412
|
+
})
|
|
413
|
+
)
|
|
414
|
+
)
|