@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
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-task diagnostics over the shared inert JSON boundary.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
import * as BoundedJson from "@smthrs/canonical/BoundedJson";
|
|
6
|
+
/** Encoded JSON bytes, without allocating an encoded copy.
|
|
7
|
+
* @private
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export const encodedStringBytes = BoundedJson.encodedStringBytes;
|
|
11
|
+
/** Whether text is well-formed and fits its encoded byte budget.
|
|
12
|
+
* @private
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*/
|
|
15
|
+
export const textFits = (value, maximum) => encodedStringBytes(value, maximum) !== undefined;
|
|
16
|
+
/** Admits a detached snapshot and gives failures a bounded field path.
|
|
17
|
+
* @private
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*/
|
|
20
|
+
export const admit = (input, limits) => {
|
|
21
|
+
const result = BoundedJson.admit(input, limits);
|
|
22
|
+
if (result.ok)
|
|
23
|
+
return { ok: true, value: result.value };
|
|
24
|
+
const at = result.path.length === 0
|
|
25
|
+
? "the value"
|
|
26
|
+
: `"${result.path.map((segment) => scalarPrefix(segment, 64)).join(".")}"`;
|
|
27
|
+
const complaint = result.code === "string"
|
|
28
|
+
? `is not well-formed text within ${limits.maxStringBytes} encoded bytes`
|
|
29
|
+
: result.code === "nodes"
|
|
30
|
+
? `makes the value too large to check: it contains more than ${limits.maxNodes} JSON values`
|
|
31
|
+
: result.complaint;
|
|
32
|
+
return { ok: false, complaint: `${at} ${complaint}.` };
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Returns a Unicode-scalar-safe bounded prefix.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
*/
|
|
40
|
+
export function scalarPrefix(value, maximumCodeUnits) {
|
|
41
|
+
let output = "";
|
|
42
|
+
for (let index = 0; index < value.length;) {
|
|
43
|
+
const unit = value.charCodeAt(index);
|
|
44
|
+
let next;
|
|
45
|
+
let width = 1;
|
|
46
|
+
if (unit >= 0xd800 && unit <= 0xdbff) {
|
|
47
|
+
const low = value.charCodeAt(index + 1);
|
|
48
|
+
if (low >= 0xdc00 && low <= 0xdfff) {
|
|
49
|
+
next = value.slice(index, index + 2);
|
|
50
|
+
width = 2;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
next = "\ufffd";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (unit >= 0xdc00 && unit <= 0xdfff) {
|
|
57
|
+
next = "\ufffd";
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
next = value[index];
|
|
61
|
+
}
|
|
62
|
+
if (output.length + next.length > maximumCodeUnits)
|
|
63
|
+
break;
|
|
64
|
+
output += next;
|
|
65
|
+
index += width;
|
|
66
|
+
}
|
|
67
|
+
return output;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Renders an untrusted value without invoking its code or allocating from its full size.
|
|
71
|
+
*
|
|
72
|
+
* @private
|
|
73
|
+
* @since 1.0.0
|
|
74
|
+
*/
|
|
75
|
+
export const render = (value, maximumCodeUnits) => {
|
|
76
|
+
if (typeof value === "string") {
|
|
77
|
+
const prefix = scalarPrefix(value, Math.max(0, maximumCodeUnits - 2));
|
|
78
|
+
const quoted = JSON.stringify(prefix);
|
|
79
|
+
return prefix.length < value.length
|
|
80
|
+
? `${quoted} [${value.length - prefix.length} characters dropped]`
|
|
81
|
+
: quoted;
|
|
82
|
+
}
|
|
83
|
+
if (typeof value === "bigint")
|
|
84
|
+
return scalarPrefix(`${value}n`, maximumCodeUnits);
|
|
85
|
+
if (typeof value === "symbol")
|
|
86
|
+
return "[symbol]";
|
|
87
|
+
if (typeof value === "function")
|
|
88
|
+
return "[function]";
|
|
89
|
+
if (value === undefined)
|
|
90
|
+
return "[undefined]";
|
|
91
|
+
const admitted = admit(value, {
|
|
92
|
+
maxNodes: 64,
|
|
93
|
+
maxDepth: 6,
|
|
94
|
+
maxBytes: Math.max(64, maximumCodeUnits * 4),
|
|
95
|
+
maxStringBytes: Math.max(64, maximumCodeUnits * 4),
|
|
96
|
+
maxKeyBytes: Math.max(32, maximumCodeUnits * 2),
|
|
97
|
+
maxMembers: 32
|
|
98
|
+
});
|
|
99
|
+
if (!admitted.ok)
|
|
100
|
+
return scalarPrefix(`[${admitted.complaint}]`, maximumCodeUnits);
|
|
101
|
+
const rendered = JSON.stringify(admitted.value);
|
|
102
|
+
const prefix = scalarPrefix(rendered, maximumCodeUnits);
|
|
103
|
+
return prefix.length < rendered.length
|
|
104
|
+
? `${prefix} [${rendered.length - prefix.length} characters dropped]`
|
|
105
|
+
: prefix;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=BoundedJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundedJson.js","sourceRoot":"","sources":["../../../src/internal/BoundedJson.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAA;AAQ5D;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAA;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,OAAe,EAAW,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,SAAS,CAAA;AAErH;;;GAGG;AACH,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s/canonical/BoundedJson\"\n\n/** Resource limits for one human-task value.\n * @private\n * @since 1.0.0\n */\nexport type Limits = Required<Omit<BoundedJson.Limits, \"maxTotalMembers\">>\n\n/** Encoded JSON bytes, without allocating an encoded copy.\n * @private\n * @since 1.0.0\n */\nexport const encodedStringBytes = BoundedJson.encodedStringBytes\n\n/** Whether text is well-formed and fits its encoded byte budget.\n * @private\n * @since 1.0.0\n */\nexport const textFits = (value: string, maximum: number): boolean => encodedStringBytes(value, maximum) !== undefined\n\n/** Admits a detached snapshot and gives failures a bounded field path.\n * @private\n * @since 1.0.0\n */\nexport const admit = (input: unknown, limits: Limits) => {\n const result = BoundedJson.admit(input, limits)\n if (result.ok) return { ok: true as const, value: result.value }\n const at = result.path.length === 0\n ? \"the value\"\n : `\"${result.path.map((segment) => scalarPrefix(segment, 64)).join(\".\")}\"`\n const complaint = result.code === \"string\"\n ? `is not well-formed text within ${limits.maxStringBytes} encoded bytes`\n : result.code === \"nodes\"\n ? `makes the value too large to check: it contains more than ${limits.maxNodes} JSON values`\n : result.complaint\n return { ok: false as const, complaint: `${at} ${complaint}.` }\n}\n\n/**\n * Returns a Unicode-scalar-safe bounded prefix.\n *\n * @private\n * @since 1.0.0\n */\nexport function scalarPrefix(value: string, maximumCodeUnits: number): string {\n let output = \"\"\n for (let index = 0; index < value.length;) {\n const unit = value.charCodeAt(index)\n let next: string\n let width = 1\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const low = value.charCodeAt(index + 1)\n if (low >= 0xdc00 && low <= 0xdfff) {\n next = value.slice(index, index + 2)\n width = 2\n } else {\n next = \"\\ufffd\"\n }\n } else if (unit >= 0xdc00 && unit <= 0xdfff) {\n next = \"\\ufffd\"\n } else {\n next = value[index]!\n }\n if (output.length + next.length > maximumCodeUnits) break\n output += next\n index += width\n }\n return output\n}\n\n/**\n * Renders an untrusted value without invoking its code or allocating from its full size.\n *\n * @private\n * @since 1.0.0\n */\nexport const render = (value: unknown, maximumCodeUnits: number): string => {\n if (typeof value === \"string\") {\n const prefix = scalarPrefix(value, Math.max(0, maximumCodeUnits - 2))\n const quoted = JSON.stringify(prefix)\n return prefix.length < value.length\n ? `${quoted} [${value.length - prefix.length} characters dropped]`\n : quoted\n }\n if (typeof value === \"bigint\") return scalarPrefix(`${value}n`, maximumCodeUnits)\n if (typeof value === \"symbol\") return \"[symbol]\"\n if (typeof value === \"function\") return \"[function]\"\n if (value === undefined) return \"[undefined]\"\n\n const admitted = admit(value, {\n maxNodes: 64,\n maxDepth: 6,\n maxBytes: Math.max(64, maximumCodeUnits * 4),\n maxStringBytes: Math.max(64, maximumCodeUnits * 4),\n maxKeyBytes: Math.max(32, maximumCodeUnits * 2),\n maxMembers: 32\n })\n if (!admitted.ok) return scalarPrefix(`[${admitted.complaint}]`, maximumCodeUnits)\n const rendered = JSON.stringify(admitted.value)\n const prefix = scalarPrefix(rendered, maximumCodeUnits)\n return prefix.length < rendered.length\n ? `${prefix} [${rendered.length - prefix.length} characters dropped]`\n : prefix\n}\n"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a declaration was written: the author's file and the line it starts
|
|
3
|
+
* on.
|
|
4
|
+
*
|
|
5
|
+
* A digest says what a step IS; it cannot say where to read it. A monitor that
|
|
6
|
+
* offers to show the code behind a node needs the file and line the
|
|
7
|
+
* declaration was authored at, so the declaration carries it from the moment
|
|
8
|
+
* it is made — captured from an `Error` stack, which is the only place a
|
|
9
|
+
* JavaScript runtime keeps it.
|
|
10
|
+
*
|
|
11
|
+
* Two properties make this safe to carry. It is stored as a NON-ENUMERABLE
|
|
12
|
+
* own property, so canonical serialization — which walks enumerable keys —
|
|
13
|
+
* cannot see it, and a declaration's key material is byte-identical with and
|
|
14
|
+
* without it. And every parse is defensive: an engine whose stack format this
|
|
15
|
+
* module does not recognize yields `undefined`, never a throw and never a
|
|
16
|
+
* guessed location.
|
|
17
|
+
*
|
|
18
|
+
* Frames inside the framework are skipped, because the frame that matters is
|
|
19
|
+
* the AUTHOR's: `Action.make` is called from this package, and the interesting
|
|
20
|
+
* line is the one that called it.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The file and line a declaration was written at.
|
|
26
|
+
*
|
|
27
|
+
* `path` is the path the runtime reported, which is absolute in every engine
|
|
28
|
+
* this repository runs on. A journal writer makes it repo-relative before it
|
|
29
|
+
* records it, and omits it when it cannot: an absolute home directory is not
|
|
30
|
+
* a fact a durable record may carry.
|
|
31
|
+
*
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
* @category models
|
|
34
|
+
*/
|
|
35
|
+
export interface DeclaredAt {
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly line: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether a frame belongs to the framework or the runtime rather than to an
|
|
41
|
+
* author.
|
|
42
|
+
*
|
|
43
|
+
* Three shapes are not an author's. Anything under a `node_modules` directory,
|
|
44
|
+
* which is how a published `@smthrs/*` package is loaded. Anything under a
|
|
45
|
+
* `packages/smithers/**\/src` directory, which is how this repository loads the
|
|
46
|
+
* same code from source. And anything that does not name a file at all: a
|
|
47
|
+
* declaration made inside the framework is reached through the module loader,
|
|
48
|
+
* so the first frame under it is a runtime internal such as
|
|
49
|
+
* `node:internal/process/task_queues`, which is a real frame and a false
|
|
50
|
+
* author. A test, an example, and a workspace's own flow file are absolute
|
|
51
|
+
* paths under none of those, so they are what a capture reports.
|
|
52
|
+
*
|
|
53
|
+
* Windows spells those same two directories with backslashes, so separators
|
|
54
|
+
* are read as one before matching: a framework frame taken for an author's
|
|
55
|
+
* would name this package's own `make.js` as the site every node of that run
|
|
56
|
+
* was declared at.
|
|
57
|
+
*
|
|
58
|
+
* @since 1.0.0
|
|
59
|
+
* @category predicates
|
|
60
|
+
*/
|
|
61
|
+
export declare const isFrameworkPath: (path: string) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* States that a file this runtime is about to evaluate holds bytes read from
|
|
64
|
+
* another, so declarations inside it report the file an author can open.
|
|
65
|
+
*
|
|
66
|
+
* A host that verifies a flow's source has to evaluate THE BYTES IT MEASURED,
|
|
67
|
+
* and the only way to evaluate bytes in this runtime is to write them
|
|
68
|
+
* somewhere and import that path. `@smthrs/registry` `Executable` writes them
|
|
69
|
+
* as a scratch sibling of the entry and removes it as soon as the load is
|
|
70
|
+
* over, so without this every declaration in an agent-authored flow reports a
|
|
71
|
+
* path nothing holds — a Code tab that can never be opened (D-068).
|
|
72
|
+
*
|
|
73
|
+
* The loader states this BEFORE the import, because a declaration's site is
|
|
74
|
+
* captured while the module is evaluated and is never rewritten afterwards.
|
|
75
|
+
* One entry is kept per load: a scratch path is unique and gone, so no later
|
|
76
|
+
* file can take a stale entry's name.
|
|
77
|
+
*
|
|
78
|
+
* @since 1.0.0
|
|
79
|
+
* @category constructors
|
|
80
|
+
*/
|
|
81
|
+
export declare const evaluatedFrom: (evaluated: string, entry: string) => void;
|
|
82
|
+
/**
|
|
83
|
+
* The position one stack frame names, in the V8 and JavaScriptCore spellings.
|
|
84
|
+
*
|
|
85
|
+
* V8 writes ` at name (/path/file.ts:12:5)` and, for a top-level frame,
|
|
86
|
+
* ` at /path/file.ts:12:5`. JavaScriptCore — Bun and Safari — writes
|
|
87
|
+
* `name@/path/file.ts:12:5` and `@/path/file.ts:12:5`. Anything else is
|
|
88
|
+
* unparseable and reports nothing.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
* @category parsers
|
|
92
|
+
*/
|
|
93
|
+
export declare const parseFrame: (frame: string) => DeclaredAt | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* The first author frame of a captured stack.
|
|
96
|
+
*
|
|
97
|
+
* The header line every V8 stack starts with parses as nothing, so it needs no
|
|
98
|
+
* special case. A decoding failure inside a frame path — a malformed percent
|
|
99
|
+
* escape in a `file://` url — is an unparseable stack rather than a throw,
|
|
100
|
+
* which is the whole contract of this module: provenance is a nicety, and a
|
|
101
|
+
* nicety may never take a declaration down with it.
|
|
102
|
+
*
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
* @category parsers
|
|
105
|
+
*/
|
|
106
|
+
export declare const parseStack: (stack: string | undefined) => DeclaredAt | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Where the caller of the function calling this was written.
|
|
109
|
+
*
|
|
110
|
+
* @since 1.0.0
|
|
111
|
+
* @category constructors
|
|
112
|
+
*/
|
|
113
|
+
export declare const capture: () => DeclaredAt | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Carries a source position on a declaration without adding a field to it.
|
|
116
|
+
*
|
|
117
|
+
* The property is non-enumerable and non-writable, so it cannot reach a
|
|
118
|
+
* canonical serialization, a digest, or a structural clone, and a later caller
|
|
119
|
+
* cannot rewrite one declaration's provenance to another's.
|
|
120
|
+
*
|
|
121
|
+
* @since 1.0.0
|
|
122
|
+
* @category constructors
|
|
123
|
+
*/
|
|
124
|
+
export declare const annotate: <A extends object>(value: A, site: DeclaredAt | undefined) => A;
|
|
125
|
+
/**
|
|
126
|
+
* The source position a value carries, when it carries one.
|
|
127
|
+
*
|
|
128
|
+
* Read through an own data descriptor, so neither a prototype nor an accessor
|
|
129
|
+
* on a foreign value can answer for it.
|
|
130
|
+
*
|
|
131
|
+
* @since 1.0.0
|
|
132
|
+
* @category accessors
|
|
133
|
+
*/
|
|
134
|
+
export declare const declaredAt: (value: unknown) => DeclaredAt | undefined;
|
|
135
|
+
//# sourceMappingURL=DeclarationSite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeclarationSite.d.ts","sourceRoot":"","sources":["../../../src/internal/DeclarationSite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OAI9C,CAAA;AA4BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,OAAO,MAAM,KAAG,IAEhE,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,UAAU,GAAG,SAUvD,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,UAAU,GAAG,SAWnE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,OAAO,QAAO,UAAU,GAAG,SAA0C,CAAA;AAElF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,UAAU,GAAG,SAAS,KAAG,CAYnF,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,SAIxD,CAAA"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a declaration was written: the author's file and the line it starts
|
|
3
|
+
* on.
|
|
4
|
+
*
|
|
5
|
+
* A digest says what a step IS; it cannot say where to read it. A monitor that
|
|
6
|
+
* offers to show the code behind a node needs the file and line the
|
|
7
|
+
* declaration was authored at, so the declaration carries it from the moment
|
|
8
|
+
* it is made — captured from an `Error` stack, which is the only place a
|
|
9
|
+
* JavaScript runtime keeps it.
|
|
10
|
+
*
|
|
11
|
+
* Two properties make this safe to carry. It is stored as a NON-ENUMERABLE
|
|
12
|
+
* own property, so canonical serialization — which walks enumerable keys —
|
|
13
|
+
* cannot see it, and a declaration's key material is byte-identical with and
|
|
14
|
+
* without it. And every parse is defensive: an engine whose stack format this
|
|
15
|
+
* module does not recognize yields `undefined`, never a throw and never a
|
|
16
|
+
* guessed location.
|
|
17
|
+
*
|
|
18
|
+
* Frames inside the framework are skipped, because the frame that matters is
|
|
19
|
+
* the AUTHOR's: `Action.make` is called from this package, and the interesting
|
|
20
|
+
* line is the one that called it.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
*/
|
|
24
|
+
/** The own property a declaration carries its source position on. @private */
|
|
25
|
+
const TypeId = "~@smthrs/flow/DeclaredAt";
|
|
26
|
+
/**
|
|
27
|
+
* Whether a frame belongs to the framework or the runtime rather than to an
|
|
28
|
+
* author.
|
|
29
|
+
*
|
|
30
|
+
* Three shapes are not an author's. Anything under a `node_modules` directory,
|
|
31
|
+
* which is how a published `@smthrs/*` package is loaded. Anything under a
|
|
32
|
+
* `packages/smithers/**\/src` directory, which is how this repository loads the
|
|
33
|
+
* same code from source. And anything that does not name a file at all: a
|
|
34
|
+
* declaration made inside the framework is reached through the module loader,
|
|
35
|
+
* so the first frame under it is a runtime internal such as
|
|
36
|
+
* `node:internal/process/task_queues`, which is a real frame and a false
|
|
37
|
+
* author. A test, an example, and a workspace's own flow file are absolute
|
|
38
|
+
* paths under none of those, so they are what a capture reports.
|
|
39
|
+
*
|
|
40
|
+
* Windows spells those same two directories with backslashes, so separators
|
|
41
|
+
* are read as one before matching: a framework frame taken for an author's
|
|
42
|
+
* would name this package's own `make.js` as the site every node of that run
|
|
43
|
+
* was declared at.
|
|
44
|
+
*
|
|
45
|
+
* @since 1.0.0
|
|
46
|
+
* @category predicates
|
|
47
|
+
*/
|
|
48
|
+
export const isFrameworkPath = (path) => {
|
|
49
|
+
if (!isFilePath(path))
|
|
50
|
+
return true;
|
|
51
|
+
const separated = path.replaceAll("\\", "/");
|
|
52
|
+
return separated.includes("/node_modules/") || /\/packages\/smithers\/.*\/src\//.test(separated);
|
|
53
|
+
};
|
|
54
|
+
/** Whether a frame path names a file on disk rather than a runtime module. @private */
|
|
55
|
+
const isFilePath = (path) => path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path);
|
|
56
|
+
/** The `path:line:column` text of one stack frame, in either engine's spelling. @private */
|
|
57
|
+
const location = (frame) => {
|
|
58
|
+
const parenthesized = /\(([^()]*)\)\s*$/.exec(frame);
|
|
59
|
+
if (parenthesized !== null)
|
|
60
|
+
return parenthesized[1];
|
|
61
|
+
const trimmed = frame.trim();
|
|
62
|
+
const at = trimmed.lastIndexOf("@");
|
|
63
|
+
if (at >= 0)
|
|
64
|
+
return trimmed.slice(at + 1);
|
|
65
|
+
return trimmed.startsWith("at ") ? trimmed.slice(3) : undefined;
|
|
66
|
+
};
|
|
67
|
+
/** A `file://` url reported as a frame path, as an ordinary path. @private */
|
|
68
|
+
const normalize = (path) => path.startsWith("file://") ? decodeURIComponent(path.slice("file://".length)) : path;
|
|
69
|
+
/**
|
|
70
|
+
* Where bytes a host evaluated from one file were read from. @private
|
|
71
|
+
*
|
|
72
|
+
* Keyed by the file that was evaluated, which a loader makes unique per load.
|
|
73
|
+
*/
|
|
74
|
+
const sourcesKey = Symbol.for("@smthrs/flow/DeclaredAt/sources/v1");
|
|
75
|
+
const globals = globalThis;
|
|
76
|
+
const sources = globals[sourcesKey] ??= new Map();
|
|
77
|
+
/**
|
|
78
|
+
* States that a file this runtime is about to evaluate holds bytes read from
|
|
79
|
+
* another, so declarations inside it report the file an author can open.
|
|
80
|
+
*
|
|
81
|
+
* A host that verifies a flow's source has to evaluate THE BYTES IT MEASURED,
|
|
82
|
+
* and the only way to evaluate bytes in this runtime is to write them
|
|
83
|
+
* somewhere and import that path. `@smthrs/registry` `Executable` writes them
|
|
84
|
+
* as a scratch sibling of the entry and removes it as soon as the load is
|
|
85
|
+
* over, so without this every declaration in an agent-authored flow reports a
|
|
86
|
+
* path nothing holds — a Code tab that can never be opened (D-068).
|
|
87
|
+
*
|
|
88
|
+
* The loader states this BEFORE the import, because a declaration's site is
|
|
89
|
+
* captured while the module is evaluated and is never rewritten afterwards.
|
|
90
|
+
* One entry is kept per load: a scratch path is unique and gone, so no later
|
|
91
|
+
* file can take a stale entry's name.
|
|
92
|
+
*
|
|
93
|
+
* @since 1.0.0
|
|
94
|
+
* @category constructors
|
|
95
|
+
*/
|
|
96
|
+
export const evaluatedFrom = (evaluated, entry) => {
|
|
97
|
+
sources.set(normalize(evaluated), normalize(entry));
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* The position one stack frame names, in the V8 and JavaScriptCore spellings.
|
|
101
|
+
*
|
|
102
|
+
* V8 writes ` at name (/path/file.ts:12:5)` and, for a top-level frame,
|
|
103
|
+
* ` at /path/file.ts:12:5`. JavaScriptCore — Bun and Safari — writes
|
|
104
|
+
* `name@/path/file.ts:12:5` and `@/path/file.ts:12:5`. Anything else is
|
|
105
|
+
* unparseable and reports nothing.
|
|
106
|
+
*
|
|
107
|
+
* @since 1.0.0
|
|
108
|
+
* @category parsers
|
|
109
|
+
*/
|
|
110
|
+
export const parseFrame = (frame) => {
|
|
111
|
+
const text = location(frame);
|
|
112
|
+
if (text === undefined)
|
|
113
|
+
return undefined;
|
|
114
|
+
const position = /^(.*):(\d+):(\d+)$/.exec(text);
|
|
115
|
+
if (position === null)
|
|
116
|
+
return undefined;
|
|
117
|
+
const line = Number(position[2]);
|
|
118
|
+
// A frame naming a file a host evaluated measured bytes into reports the
|
|
119
|
+
// entry those bytes were read from; every other frame reports itself.
|
|
120
|
+
const path = normalize(position[1]);
|
|
121
|
+
return { path: sources.get(path) ?? path, line };
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The first author frame of a captured stack.
|
|
125
|
+
*
|
|
126
|
+
* The header line every V8 stack starts with parses as nothing, so it needs no
|
|
127
|
+
* special case. A decoding failure inside a frame path — a malformed percent
|
|
128
|
+
* escape in a `file://` url — is an unparseable stack rather than a throw,
|
|
129
|
+
* which is the whole contract of this module: provenance is a nicety, and a
|
|
130
|
+
* nicety may never take a declaration down with it.
|
|
131
|
+
*
|
|
132
|
+
* @since 1.0.0
|
|
133
|
+
* @category parsers
|
|
134
|
+
*/
|
|
135
|
+
export const parseStack = (stack) => {
|
|
136
|
+
if (stack === undefined)
|
|
137
|
+
return undefined;
|
|
138
|
+
try {
|
|
139
|
+
for (const frame of stack.split("\n")) {
|
|
140
|
+
const parsed = parseFrame(frame);
|
|
141
|
+
if (parsed !== undefined && !isFrameworkPath(parsed.path))
|
|
142
|
+
return parsed;
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Where the caller of the function calling this was written.
|
|
152
|
+
*
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
* @category constructors
|
|
155
|
+
*/
|
|
156
|
+
export const capture = () => parseStack(new Error().stack);
|
|
157
|
+
/**
|
|
158
|
+
* Carries a source position on a declaration without adding a field to it.
|
|
159
|
+
*
|
|
160
|
+
* The property is non-enumerable and non-writable, so it cannot reach a
|
|
161
|
+
* canonical serialization, a digest, or a structural clone, and a later caller
|
|
162
|
+
* cannot rewrite one declaration's provenance to another's.
|
|
163
|
+
*
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
* @category constructors
|
|
166
|
+
*/
|
|
167
|
+
export const annotate = (value, site) => {
|
|
168
|
+
// A declaration annotated twice keeps the FIRST site. The property is
|
|
169
|
+
// non-configurable, so a second `defineProperty` would throw rather than
|
|
170
|
+
// overwrite, and a copy that carries its own site has already recorded it.
|
|
171
|
+
if (site === undefined || Object.getOwnPropertyDescriptor(value, TypeId) !== undefined)
|
|
172
|
+
return value;
|
|
173
|
+
Object.defineProperty(value, TypeId, {
|
|
174
|
+
configurable: false,
|
|
175
|
+
enumerable: false,
|
|
176
|
+
value: site,
|
|
177
|
+
writable: false
|
|
178
|
+
});
|
|
179
|
+
return value;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* The source position a value carries, when it carries one.
|
|
183
|
+
*
|
|
184
|
+
* Read through an own data descriptor, so neither a prototype nor an accessor
|
|
185
|
+
* on a foreign value can answer for it.
|
|
186
|
+
*
|
|
187
|
+
* @since 1.0.0
|
|
188
|
+
* @category accessors
|
|
189
|
+
*/
|
|
190
|
+
export const declaredAt = (value) => {
|
|
191
|
+
if (Object(value) !== value)
|
|
192
|
+
return undefined;
|
|
193
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, TypeId);
|
|
194
|
+
return descriptor === undefined ? undefined : descriptor.value;
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=DeclarationSite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeclarationSite.js","sourceRoot":"","sources":["../../../src/internal/DeclarationSite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,GAAG,0BAA0B,CAAA;AAkBzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAW,EAAE;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC5C,OAAO,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,iCAAiC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAClG,CAAC,CAAA;AAED,uFAAuF;AACvF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAElG,4FAA4F;AAC5F,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAsB,EAAE;IACrD,MAAM,aAAa,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpD,IAAI,aAAa,KAAK,IAAI;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AK,SAAS,IAAI,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IACpG,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;QACnC,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAA0B,EAAE;IACnE,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK;QAAE,OAAO,SAAS,CAAA;IAC7C,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACjE,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAA+B,CAAA;AAC1F,CAAC,CAAA","sourcesContent":["/**\n * Where a declaration was written: the author's file and the line it starts\n * on.\n *\n * A digest says what a step IS; it cannot say where to read it. A monitor that\n * offers to show the code behind a node needs the file and line the\n * declaration was authored at, so the declaration carries it from the moment\n * it is made — captured from an `Error` stack, which is the only place a\n * JavaScript runtime keeps it.\n *\n * Two properties make this safe to carry. It is stored as a NON-ENUMERABLE\n * own property, so canonical serialization — which walks enumerable keys —\n * cannot see it, and a declaration's key material is byte-identical with and\n * without it. And every parse is defensive: an engine whose stack format this\n * module does not recognize yields `undefined`, never a throw and never a\n * guessed location.\n *\n * Frames inside the framework are skipped, because the frame that matters is\n * the AUTHOR's: `Action.make` is called from this package, and the interesting\n * line is the one that called it.\n *\n * @since 1.0.0\n */\n\n/** The own property a declaration carries its source position on. @private */\nconst TypeId = \"~@smthrs/flow/DeclaredAt\"\n\n/**\n * The file and line a declaration was written at.\n *\n * `path` is the path the runtime reported, which is absolute in every engine\n * this repository runs on. A journal writer makes it repo-relative before it\n * records it, and omits it when it cannot: an absolute home directory is not\n * a fact a durable record may carry.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface DeclaredAt {\n readonly path: string\n readonly line: number\n}\n\n/**\n * Whether a frame belongs to the framework or the runtime rather than to an\n * author.\n *\n * Three shapes are not an author's. Anything under a `node_modules` directory,\n * which is how a published `@smthrs/*` package is loaded. Anything under a\n * `packages/smithers/**\\/src` directory, which is how this repository loads the\n * same code from source. And anything that does not name a file at all: a\n * declaration made inside the framework is reached through the module loader,\n * so the first frame under it is a runtime internal such as\n * `node:internal/process/task_queues`, which is a real frame and a false\n * author. A test, an example, and a workspace's own flow file are absolute\n * paths under none of those, so they are what a capture reports.\n *\n * Windows spells those same two directories with backslashes, so separators\n * are read as one before matching: a framework frame taken for an author's\n * would name this package's own `make.js` as the site every node of that run\n * was declared at.\n *\n * @since 1.0.0\n * @category predicates\n */\nexport const isFrameworkPath = (path: string): boolean => {\n if (!isFilePath(path)) return true\n const separated = path.replaceAll(\"\\\\\", \"/\")\n return separated.includes(\"/node_modules/\") || /\\/packages\\/smithers\\/.*\\/src\\//.test(separated)\n}\n\n/** Whether a frame path names a file on disk rather than a runtime module. @private */\nconst isFilePath = (path: string): boolean => path.startsWith(\"/\") || /^[A-Za-z]:[\\\\/]/.test(path)\n\n/** The `path:line:column` text of one stack frame, in either engine's spelling. @private */\nconst location = (frame: string): string | undefined => {\n const parenthesized = /\\(([^()]*)\\)\\s*$/.exec(frame)\n if (parenthesized !== null) return parenthesized[1]\n const trimmed = frame.trim()\n const at = trimmed.lastIndexOf(\"@\")\n if (at >= 0) return trimmed.slice(at + 1)\n return trimmed.startsWith(\"at \") ? trimmed.slice(3) : undefined\n}\n\n/** A `file://` url reported as a frame path, as an ordinary path. @private */\nconst normalize = (path: string): string =>\n path.startsWith(\"file://\") ? decodeURIComponent(path.slice(\"file://\".length)) : path\n\n/**\n * Where bytes a host evaluated from one file were read from. @private\n *\n * Keyed by the file that was evaluated, which a loader makes unique per load.\n */\nconst sourcesKey = Symbol.for(\"@smthrs/flow/DeclaredAt/sources/v1\")\nconst globals = globalThis as typeof globalThis & { [sourcesKey]?: Map<string, string> }\nconst sources = globals[sourcesKey] ??= new Map<string, string>()\n\n/**\n * States that a file this runtime is about to evaluate holds bytes read from\n * another, so declarations inside it report the file an author can open.\n *\n * A host that verifies a flow's source has to evaluate THE BYTES IT MEASURED,\n * and the only way to evaluate bytes in this runtime is to write them\n * somewhere and import that path. `@smthrs/registry` `Executable` writes them\n * as a scratch sibling of the entry and removes it as soon as the load is\n * over, so without this every declaration in an agent-authored flow reports a\n * path nothing holds — a Code tab that can never be opened (D-068).\n *\n * The loader states this BEFORE the import, because a declaration's site is\n * captured while the module is evaluated and is never rewritten afterwards.\n * One entry is kept per load: a scratch path is unique and gone, so no later\n * file can take a stale entry's name.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const evaluatedFrom = (evaluated: string, entry: string): void => {\n sources.set(normalize(evaluated), normalize(entry))\n}\n\n/**\n * The position one stack frame names, in the V8 and JavaScriptCore spellings.\n *\n * V8 writes ` at name (/path/file.ts:12:5)` and, for a top-level frame,\n * ` at /path/file.ts:12:5`. JavaScriptCore — Bun and Safari — writes\n * `name@/path/file.ts:12:5` and `@/path/file.ts:12:5`. Anything else is\n * unparseable and reports nothing.\n *\n * @since 1.0.0\n * @category parsers\n */\nexport const parseFrame = (frame: string): DeclaredAt | undefined => {\n const text = location(frame)\n if (text === undefined) return undefined\n const position = /^(.*):(\\d+):(\\d+)$/.exec(text)\n if (position === null) return undefined\n const line = Number(position[2])\n // A frame naming a file a host evaluated measured bytes into reports the\n // entry those bytes were read from; every other frame reports itself.\n const path = normalize(position[1]!)\n return { path: sources.get(path) ?? path, line }\n}\n\n/**\n * The first author frame of a captured stack.\n *\n * The header line every V8 stack starts with parses as nothing, so it needs no\n * special case. A decoding failure inside a frame path — a malformed percent\n * escape in a `file://` url — is an unparseable stack rather than a throw,\n * which is the whole contract of this module: provenance is a nicety, and a\n * nicety may never take a declaration down with it.\n *\n * @since 1.0.0\n * @category parsers\n */\nexport const parseStack = (stack: string | undefined): DeclaredAt | undefined => {\n if (stack === undefined) return undefined\n try {\n for (const frame of stack.split(\"\\n\")) {\n const parsed = parseFrame(frame)\n if (parsed !== undefined && !isFrameworkPath(parsed.path)) return parsed\n }\n return undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Where the caller of the function calling this was written.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const capture = (): DeclaredAt | undefined => parseStack(new Error().stack)\n\n/**\n * Carries a source position on a declaration without adding a field to it.\n *\n * The property is non-enumerable and non-writable, so it cannot reach a\n * canonical serialization, a digest, or a structural clone, and a later caller\n * cannot rewrite one declaration's provenance to another's.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const annotate = <A extends object>(value: A, site: DeclaredAt | undefined): A => {\n // A declaration annotated twice keeps the FIRST site. The property is\n // non-configurable, so a second `defineProperty` would throw rather than\n // overwrite, and a copy that carries its own site has already recorded it.\n if (site === undefined || Object.getOwnPropertyDescriptor(value, TypeId) !== undefined) return value\n Object.defineProperty(value, TypeId, {\n configurable: false,\n enumerable: false,\n value: site,\n writable: false\n })\n return value\n}\n\n/**\n * The source position a value carries, when it carries one.\n *\n * Read through an own data descriptor, so neither a prototype nor an accessor\n * on a foreign value can answer for it.\n *\n * @since 1.0.0\n * @category accessors\n */\nexport const declaredAt = (value: unknown): DeclaredAt | undefined => {\n if (Object(value) !== value) return undefined\n const descriptor = Object.getOwnPropertyDescriptor(value, TypeId)\n return descriptor === undefined ? undefined : descriptor.value as DeclaredAt | undefined\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lowering every declaration in this package shares: literal
|
|
3
|
+
* `capabilities`, `effects` and `modelInvocable` become entries in the
|
|
4
|
+
* annotation bag readers already consult.
|
|
5
|
+
*
|
|
6
|
+
* Both literals exist so a CATALOG can project them from source text without
|
|
7
|
+
* importing the module, so this is the only place either spelling is turned
|
|
8
|
+
* into a value. A flow or an action that declares `capabilities` and one that
|
|
9
|
+
* annotates {@link module:Flow/Annotations.Capabilities} are the same
|
|
10
|
+
* declaration to {@link module:Graph.build}, and the same holds for `effects`
|
|
11
|
+
* and {@link module:Flow/Annotations.EffectEnvelope}.
|
|
12
|
+
*
|
|
13
|
+
* It lives here, below both constructors, because a flow and an action lower
|
|
14
|
+
* the same two literals and a second copy would let one gain a field the other
|
|
15
|
+
* kept ignoring.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
import * as Effects from "@smthrs/plan/Effects";
|
|
21
|
+
import * as Context from "effect/Context";
|
|
22
|
+
/**
|
|
23
|
+
* Lowers the literal declarations a constructor call carries into the
|
|
24
|
+
* annotation bag, leaving every annotation the caller already supplied.
|
|
25
|
+
*
|
|
26
|
+
* @since 0.1.0
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
export declare const lowerDeclarations: (options: {
|
|
30
|
+
readonly capabilities?: ReadonlyArray<string> | undefined;
|
|
31
|
+
readonly effects?: Effects.MakeOptions | undefined;
|
|
32
|
+
readonly modelInvocable?: boolean | undefined;
|
|
33
|
+
readonly annotations?: Context.Context<never> | undefined;
|
|
34
|
+
}) => Context.Context<never>;
|
|
35
|
+
//# sourceMappingURL=Declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declarations.d.ts","sourceRoot":"","sources":["../../../src/internal/Declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAGzC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,GAAG,SAAS,CAAA;IAClD,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;CAC1D,KAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAYxB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lowering every declaration in this package shares: literal
|
|
3
|
+
* `capabilities`, `effects` and `modelInvocable` become entries in the
|
|
4
|
+
* annotation bag readers already consult.
|
|
5
|
+
*
|
|
6
|
+
* Both literals exist so a CATALOG can project them from source text without
|
|
7
|
+
* importing the module, so this is the only place either spelling is turned
|
|
8
|
+
* into a value. A flow or an action that declares `capabilities` and one that
|
|
9
|
+
* annotates {@link module:Flow/Annotations.Capabilities} are the same
|
|
10
|
+
* declaration to {@link module:Graph.build}, and the same holds for `effects`
|
|
11
|
+
* and {@link module:Flow/Annotations.EffectEnvelope}.
|
|
12
|
+
*
|
|
13
|
+
* It lives here, below both constructors, because a flow and an action lower
|
|
14
|
+
* the same two literals and a second copy would let one gain a field the other
|
|
15
|
+
* kept ignoring.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
import * as Effects from "@smthrs/plan/Effects";
|
|
21
|
+
import * as Context from "effect/Context";
|
|
22
|
+
import { Capabilities, EffectEnvelope, ModelInvocable } from "../Flow/Annotations.js";
|
|
23
|
+
/**
|
|
24
|
+
* Lowers the literal declarations a constructor call carries into the
|
|
25
|
+
* annotation bag, leaving every annotation the caller already supplied.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
export const lowerDeclarations = (options) => {
|
|
31
|
+
let annotations = options.annotations ?? Context.empty();
|
|
32
|
+
if (options.capabilities !== undefined) {
|
|
33
|
+
annotations = Context.add(annotations, Capabilities, options.capabilities);
|
|
34
|
+
}
|
|
35
|
+
if (options.effects !== undefined) {
|
|
36
|
+
annotations = Context.add(annotations, EffectEnvelope, Effects.make(options.effects));
|
|
37
|
+
}
|
|
38
|
+
if (options.modelInvocable !== undefined) {
|
|
39
|
+
annotations = Context.add(annotations, ModelInvocable, options.modelInvocable);
|
|
40
|
+
}
|
|
41
|
+
return annotations;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=Declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declarations.js","sourceRoot":"","sources":["../../../src/internal/Declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAErF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAKjC,EAA0B,EAAE;IAC3B,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,EAAE,CAAA;IACxD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACvC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5E,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IACvF,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACzC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA","sourcesContent":["/**\n * The lowering every declaration in this package shares: literal\n * `capabilities`, `effects` and `modelInvocable` become entries in the\n * annotation bag readers already consult.\n *\n * Both literals exist so a CATALOG can project them from source text without\n * importing the module, so this is the only place either spelling is turned\n * into a value. A flow or an action that declares `capabilities` and one that\n * annotates {@link module:Flow/Annotations.Capabilities} are the same\n * declaration to {@link module:Graph.build}, and the same holds for `effects`\n * and {@link module:Flow/Annotations.EffectEnvelope}.\n *\n * It lives here, below both constructors, because a flow and an action lower\n * the same two literals and a second copy would let one gain a field the other\n * kept ignoring.\n *\n * @since 0.1.0\n * @private\n */\n\nimport * as Effects from \"@smthrs/plan/Effects\"\nimport * as Context from \"effect/Context\"\nimport { Capabilities, EffectEnvelope, ModelInvocable } from \"../Flow/Annotations.ts\"\n\n/**\n * Lowers the literal declarations a constructor call carries into the\n * annotation bag, leaving every annotation the caller already supplied.\n *\n * @since 0.1.0\n * @private\n */\nexport const lowerDeclarations = (options: {\n readonly capabilities?: ReadonlyArray<string> | undefined\n readonly effects?: Effects.MakeOptions | undefined\n readonly modelInvocable?: boolean | undefined\n readonly annotations?: Context.Context<never> | undefined\n}): Context.Context<never> => {\n let annotations = options.annotations ?? Context.empty()\n if (options.capabilities !== undefined) {\n annotations = Context.add(annotations, Capabilities, options.capabilities)\n }\n if (options.effects !== undefined) {\n annotations = Context.add(annotations, EffectEnvelope, Effects.make(options.effects))\n }\n if (options.modelInvocable !== undefined) {\n annotations = Context.add(annotations, ModelInvocable, options.modelInvocable)\n }\n return annotations\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal interpreter seam for authoring combinators that retain execution
|
|
3
|
+
* scope state around the ordinary body. No graph or runtime decision lives here.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import type * as Effect from "effect/Effect";
|
|
9
|
+
/** Internal execution wrapper.
|
|
10
|
+
* @private
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export interface ExecutionMiddleware {
|
|
14
|
+
readonly wrap: (payload: unknown, body: Effect.Effect<unknown, unknown, unknown>) => Effect.Effect<unknown, unknown, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/** Flow-owned wrapper retained across interpreter registrations.
|
|
17
|
+
* @private
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*/
|
|
20
|
+
export declare const ExecutionMiddleware: Context.Reference<ExecutionMiddleware | undefined>;
|
|
21
|
+
//# sourceMappingURL=ExecutionMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionMiddleware.d.ts","sourceRoot":"","sources":["../../../src/internal/ExecutionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,CACb,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,KAC3C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;CAC9C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,oDAG/B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal interpreter seam for authoring combinators that retain execution
|
|
3
|
+
* scope state around the ordinary body. No graph or runtime decision lives here.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
/** Flow-owned wrapper retained across interpreter registrations.
|
|
9
|
+
* @private
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
export const ExecutionMiddleware = Context.Reference("@smthrs/flow/internal/ExecutionMiddleware", { defaultValue: () => undefined });
|
|
13
|
+
//# sourceMappingURL=ExecutionMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionMiddleware.js","sourceRoot":"","sources":["../../../src/internal/ExecutionMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAczC;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAClD,2CAA2C,EAC3C,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAClC,CAAA","sourcesContent":["/**\n * Internal interpreter seam for authoring combinators that retain execution\n * scope state around the ordinary body. No graph or runtime decision lives here.\n *\n * @since 1.0.0\n */\n\nimport * as Context from \"effect/Context\"\nimport type * as Effect from \"effect/Effect\"\n\n/** Internal execution wrapper.\n * @private\n * @since 1.0.0\n */\nexport interface ExecutionMiddleware {\n readonly wrap: (\n payload: unknown,\n body: Effect.Effect<unknown, unknown, unknown>\n ) => Effect.Effect<unknown, unknown, unknown>\n}\n\n/** Flow-owned wrapper retained across interpreter registrations.\n * @private\n * @since 1.0.0\n */\nexport const ExecutionMiddleware = Context.Reference<ExecutionMiddleware | undefined>(\n \"@smthrs/flow/internal/ExecutionMiddleware\",\n { defaultValue: () => undefined }\n)\n"]}
|