effect 4.0.3 → 4.0.5
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/AGENTS.md +24 -0
- package/CLAUDE.md +24 -0
- package/ai-docs/package.json +2 -2
- package/ai-docs/src/52_graphql/10_basics.ts +117 -0
- package/ai-docs/src/52_graphql/20_testing.ts +45 -0
- package/ai-docs/src/52_graphql/30_batching.ts +118 -0
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
- package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
- package/ai-docs/src/52_graphql/index.md +6 -0
- package/dist/Array.d.ts +90 -6
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +4 -2
- package/dist/Array.js.map +1 -1
- package/dist/Channel.d.ts +6 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +17 -3
- package/dist/Channel.js.map +1 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +33 -32
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +9 -0
- package/dist/Context.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +2 -5
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +61 -19
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +58 -39
- package/dist/Effect.js.map +1 -1
- package/dist/FileSystem.d.ts +23 -9
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js.map +1 -1
- package/dist/Match.d.ts +20 -6
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +2 -2
- package/dist/Match.js.map +1 -1
- package/dist/Path.d.ts +37 -5
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +36 -5
- package/dist/Path.js.map +1 -1
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +4 -10
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Scheduler.d.ts +9 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +9 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +15 -2
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +16 -2
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.d.ts +4 -0
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +52 -33
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +38 -17
- package/dist/Sink.js.map +1 -1
- package/dist/Stream.d.ts +11 -0
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +16 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +12 -0
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +17 -4
- package/dist/String.js.map +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +3 -2
- package/dist/TxRef.js.map +1 -1
- package/dist/Utils.js +8 -3
- package/dist/Utils.js.map +1 -1
- package/dist/ai/AiError.d.ts +10 -10
- package/dist/ai/AiError.d.ts.map +1 -1
- package/dist/ai/AiError.js +1 -1
- package/dist/ai/AiError.js.map +1 -1
- package/dist/ai/AnthropicStructuredOutput.js +0 -2
- package/dist/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/ai/Chat.d.ts +2 -2
- package/dist/ai/Chat.d.ts.map +1 -1
- package/dist/ai/Decision.d.ts +70 -19
- package/dist/ai/Decision.d.ts.map +1 -1
- package/dist/ai/Decision.js +37 -3
- package/dist/ai/Decision.js.map +1 -1
- package/dist/ai/DecisionModel.js +1 -1
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts +38 -7
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +70 -40
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +61 -52
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +134 -50
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +28 -5
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +5 -4
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js.map +1 -1
- package/dist/cli/Completions.d.ts +5 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +100 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +33 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/Param.d.ts +87 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +30 -0
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/command.js +2 -1
- package/dist/cli/internal/command.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +4 -3
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/completions/descriptor.js +8 -1
- package/dist/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/cli/internal/completions/fish.js +4 -4
- package/dist/cli/internal/completions/fish.js.map +1 -1
- package/dist/cli/internal/completions/powershell.js +3 -2
- package/dist/cli/internal/completions/powershell.js.map +1 -1
- package/dist/cli/internal/completions/zsh.js +7 -3
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cli/internal/parser.js +11 -3
- package/dist/cli/internal/parser.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +2 -1
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts +1 -0
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +113 -21
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +20 -12
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Runners.d.ts.map +1 -1
- package/dist/cluster/Runners.js +54 -34
- package/dist/cluster/Runners.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +6 -4
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +1 -1
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/encoding/Sse.d.ts +6 -0
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +63 -71
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/graphql/GraphQL.d.ts +349 -0
- package/dist/graphql/GraphQL.d.ts.map +1 -0
- package/dist/graphql/GraphQL.js +207 -0
- package/dist/graphql/GraphQL.js.map +1 -0
- package/dist/graphql/GraphQLClient.d.ts +562 -0
- package/dist/graphql/GraphQLClient.d.ts.map +1 -0
- package/dist/graphql/GraphQLClient.js +505 -0
- package/dist/graphql/GraphQLClient.js.map +1 -0
- package/dist/graphql/GraphQLClientError.d.ts +445 -0
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -0
- package/dist/graphql/GraphQLClientError.js +479 -0
- package/dist/graphql/GraphQLClientError.js.map +1 -0
- package/dist/graphql/GraphQLGroup.d.ts +118 -0
- package/dist/graphql/GraphQLGroup.d.ts.map +1 -0
- package/dist/graphql/GraphQLGroup.js +109 -0
- package/dist/graphql/GraphQLGroup.js.map +1 -0
- package/dist/graphql/GraphQLMiddleware.d.ts +249 -0
- package/dist/graphql/GraphQLMiddleware.d.ts.map +1 -0
- package/dist/graphql/GraphQLMiddleware.js +130 -0
- package/dist/graphql/GraphQLMiddleware.js.map +1 -0
- package/dist/graphql/GraphQLProtocol.d.ts +969 -0
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -0
- package/dist/graphql/GraphQLProtocol.js +809 -0
- package/dist/graphql/GraphQLProtocol.js.map +1 -0
- package/dist/graphql/GraphQLResolver.d.ts +453 -0
- package/dist/graphql/GraphQLResolver.d.ts.map +1 -0
- package/dist/graphql/GraphQLResolver.js +582 -0
- package/dist/graphql/GraphQLResolver.js.map +1 -0
- package/dist/graphql/index.d.ts +40 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/index.js +41 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/http/FetchHttpClient.d.ts +6 -3
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +6 -3
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +2 -1
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/Headers.d.ts +3 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +6 -5
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +27 -0
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +38 -11
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +8 -6
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +147 -4
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +47 -1
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +14 -7
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts +60 -0
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +93 -32
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts +35 -0
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +87 -13
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerError.d.ts.map +1 -1
- package/dist/http/HttpServerError.js +6 -4
- package/dist/http/HttpServerError.js.map +1 -1
- package/dist/http/HttpServerRequest.js +2 -2
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts +8 -6
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +27 -16
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/http/HttpStaticServer.js +4 -10
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/HttpTraceContext.js +1 -1
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/Multipart.d.ts.map +1 -1
- package/dist/http/Multipart.js +15 -1
- package/dist/http/Multipart.js.map +1 -1
- package/dist/http/Url.d.ts.map +1 -1
- package/dist/http/Url.js +2 -1
- package/dist/http/Url.js.map +1 -1
- package/dist/http/UrlParams.d.ts +112 -8
- package/dist/http/UrlParams.d.ts.map +1 -1
- package/dist/http/UrlParams.js +141 -14
- package/dist/http/UrlParams.js.map +1 -1
- package/dist/http/internal/compression.d.ts +1 -1
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -10
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/compressionBody.d.ts +2 -0
- package/dist/http/internal/compressionBody.d.ts.map +1 -0
- package/dist/http/internal/compressionBody.js +36 -0
- package/dist/http/internal/compressionBody.js.map +1 -0
- package/dist/http/internal/decompression.d.ts +2 -0
- package/dist/http/internal/decompression.d.ts.map +1 -0
- package/dist/http/internal/decompression.js +162 -0
- package/dist/http/internal/decompression.js.map +1 -0
- package/dist/http/internal/tracing.js +14 -4
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http/internal/urlParams.d.ts +2 -0
- package/dist/http/internal/urlParams.d.ts.map +1 -0
- package/dist/http/internal/urlParams.js +4 -0
- package/dist/http/internal/urlParams.js.map +1 -0
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +2 -1
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiScalar.d.ts +5 -0
- package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
- package/dist/http-api/HttpApiScalar.js.map +1 -1
- package/dist/internal/core.js +17 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +40 -35
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +13 -6
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graphql.d.ts +2 -0
- package/dist/internal/graphql.d.ts.map +1 -0
- package/dist/internal/graphql.js +205 -0
- package/dist/internal/graphql.js.map +1 -0
- package/dist/internal/graphqlHeaders.d.ts +4 -0
- package/dist/internal/graphqlHeaders.d.ts.map +1 -0
- package/dist/internal/graphqlHeaders.js +11 -0
- package/dist/internal/graphqlHeaders.js.map +1 -0
- package/dist/internal/request.js +20 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +4 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +29 -5
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/net/Host.d.ts +49 -0
- package/dist/net/Host.d.ts.map +1 -1
- package/dist/net/Host.js +55 -0
- package/dist/net/Host.js.map +1 -1
- package/dist/net/NetAddress.d.ts +8 -0
- package/dist/net/NetAddress.d.ts.map +1 -1
- package/dist/net/NetAddress.js +8 -0
- package/dist/net/NetAddress.js.map +1 -1
- package/dist/observability/Otlp.d.ts +15 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +3 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +8 -0
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +10 -1
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +17 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +14 -1
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts +17 -0
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +13 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +17 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +15 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/reactivity/AsyncResult.d.ts +6 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +27 -0
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js +3 -1
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +6 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +36 -9
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/socket/Socket.d.ts +6 -0
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +8 -7
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +8 -7
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/testing/TestClock.d.ts +16 -3
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +112 -22
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/workflow/Activity.js +1 -0
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/workflow/DurableDeferred.js +32 -3
- package/dist/workflow/DurableDeferred.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +22 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +15 -3
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts +44 -3
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +45 -22
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +6 -3
- package/src/Array.ts +95 -6
- package/src/Channel.ts +24 -3
- package/src/ConfigProvider.ts +40 -44
- package/src/Context.ts +9 -0
- package/src/Duration.ts +4 -5
- package/src/Effect.ts +140 -53
- package/src/FileSystem.ts +23 -9
- package/src/Match.ts +65 -12
- package/src/Path.ts +52 -7
- package/src/RequestResolver.ts +4 -10
- package/src/Scheduler.ts +9 -0
- package/src/Schema.ts +25 -4
- package/src/SchemaGetter.ts +47 -35
- package/src/Sink.ts +45 -18
- package/src/Stream.ts +33 -4
- package/src/String.ts +17 -4
- package/src/TxRef.ts +4 -2
- package/src/Utils.ts +8 -5
- package/src/ai/AiError.ts +3 -1
- package/src/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/ai/Chat.ts +2 -2
- package/src/ai/Decision.ts +70 -21
- package/src/ai/DecisionModel.ts +1 -1
- package/src/ai/LanguageModel.ts +141 -63
- package/src/ai/McpServer.ts +259 -145
- package/src/ai/Prompt.ts +24 -10
- package/src/ai/Response.ts +6 -3
- package/src/cli/Completions.ts +5 -0
- package/src/cli/Flag.ts +101 -0
- package/src/cli/Param.ts +96 -0
- package/src/cli/internal/command.ts +2 -1
- package/src/cli/internal/completions/bash.ts +4 -3
- package/src/cli/internal/completions/descriptor.ts +10 -1
- package/src/cli/internal/completions/fish.ts +4 -4
- package/src/cli/internal/completions/powershell.ts +5 -2
- package/src/cli/internal/completions/zsh.ts +7 -3
- package/src/cli/internal/parser.ts +12 -3
- package/src/cli/internal/wizard.ts +2 -1
- package/src/cluster/ClusterWorkflowEngine.ts +143 -36
- package/src/cluster/MessageStorage.ts +14 -3
- package/src/cluster/Runners.ts +88 -66
- package/src/cluster/Sharding.ts +12 -9
- package/src/cluster/internal/entityManager.ts +1 -1
- package/src/encoding/Sse.ts +70 -80
- package/src/graphql/GraphQL.ts +494 -0
- package/src/graphql/GraphQLClient.ts +924 -0
- package/src/graphql/GraphQLClientError.ts +542 -0
- package/src/graphql/GraphQLGroup.ts +167 -0
- package/src/graphql/GraphQLMiddleware.ts +253 -0
- package/src/graphql/GraphQLProtocol.ts +1540 -0
- package/src/graphql/GraphQLResolver.ts +1038 -0
- package/src/graphql/index.ts +48 -0
- package/src/http/FetchHttpClient.ts +6 -3
- package/src/http/FindMyWay/internal/router.ts +2 -1
- package/src/http/Headers.ts +6 -9
- package/src/http/HttpClient.ts +72 -11
- package/src/http/HttpClientError.ts +10 -6
- package/src/http/HttpClientRequest.ts +173 -7
- package/src/http/HttpEffect.ts +11 -5
- package/src/http/HttpMiddleware.ts +113 -34
- package/src/http/HttpRouter.ts +95 -13
- package/src/http/HttpServerError.ts +8 -4
- package/src/http/HttpServerRequest.ts +2 -2
- package/src/http/HttpServerResponse.ts +28 -16
- package/src/http/HttpStaticServer.ts +4 -10
- package/src/http/HttpTraceContext.ts +1 -1
- package/src/http/Multipart.ts +17 -1
- package/src/http/Url.ts +2 -1
- package/src/http/UrlParams.ts +225 -26
- package/src/http/internal/compression.ts +3 -17
- package/src/http/internal/compressionBody.ts +56 -0
- package/src/http/internal/decompression.ts +226 -0
- package/src/http/internal/tracing.ts +21 -4
- package/src/http/internal/urlParams.ts +5 -0
- package/src/http-api/HttpApiClient.ts +2 -1
- package/src/http-api/HttpApiScalar.ts +5 -0
- package/src/internal/core.ts +21 -1
- package/src/internal/dateTime.ts +13 -10
- package/src/internal/effect.ts +13 -7
- package/src/internal/graphql.ts +286 -0
- package/src/internal/graphqlHeaders.ts +11 -0
- package/src/internal/request.ts +31 -3
- package/src/internal/schema/toCodeDocument.ts +7 -1
- package/src/internal/schema/toJsonSchemaDocument.ts +34 -2
- package/src/internal/version.ts +1 -1
- package/src/net/Host.ts +72 -0
- package/src/net/NetAddress.ts +9 -0
- package/src/observability/Otlp.ts +18 -0
- package/src/observability/OtlpExporter.ts +14 -3
- package/src/observability/OtlpLogger.ts +31 -2
- package/src/observability/OtlpMetrics.ts +30 -1
- package/src/observability/OtlpTracer.ts +32 -3
- package/src/reactivity/AsyncResult.ts +31 -0
- package/src/reactivity/AtomRegistry.ts +3 -1
- package/src/rpc/RpcClient.ts +6 -1
- package/src/rpc/RpcServer.ts +55 -15
- package/src/socket/Socket.ts +6 -0
- package/src/sql/SqlClient.ts +9 -7
- package/src/testing/TestClock.ts +144 -29
- package/src/workflow/Activity.ts +1 -0
- package/src/workflow/DurableDeferred.ts +43 -5
- package/src/workflow/Workflow.ts +31 -5
- package/src/workflow/WorkflowEngine.ts +107 -25
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import * as ByteSize from "../../ByteSize.ts"
|
|
2
|
+
import * as Effect from "../../Effect.ts"
|
|
3
|
+
import * as Inspectable from "../../Inspectable.ts"
|
|
4
|
+
import type * as Option from "../../Option.ts"
|
|
5
|
+
import type { ReadonlyRecord } from "../../Record.ts"
|
|
6
|
+
import type * as Schema from "../../Schema.ts"
|
|
7
|
+
import type * as Socket from "../../socket/Socket.ts"
|
|
8
|
+
import * as Stream from "../../Stream.ts"
|
|
9
|
+
import * as Headers from "../Headers.ts"
|
|
10
|
+
import * as HttpIncomingMessage from "../HttpIncomingMessage.ts"
|
|
11
|
+
import type { HttpMethod } from "../HttpMethod.ts"
|
|
12
|
+
import { HttpServerError, RequestParseError } from "../HttpServerError.ts"
|
|
13
|
+
import * as HttpServerRequest from "../HttpServerRequest.ts"
|
|
14
|
+
import * as Multipart from "../Multipart.ts"
|
|
15
|
+
import * as UrlParams from "../UrlParams.ts"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type Coding = "gzip" | "deflate"
|
|
21
|
+
|
|
22
|
+
const defaultMaxDecompressedSize = ByteSize.mebibytes(10)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Parses a `Content-Encoding` header into the codings to undo, in the order
|
|
26
|
+
* they were applied. `identity` members are dropped. Returns `undefined` if
|
|
27
|
+
* any member is unsupported.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export const parseContentEncoding = (header: string): ReadonlyArray<Coding> | undefined => {
|
|
32
|
+
const codings: Array<Coding> = []
|
|
33
|
+
for (const member of header.split(",")) {
|
|
34
|
+
const coding = member.trim().toLowerCase()
|
|
35
|
+
if (coding === "" || coding === "identity") continue
|
|
36
|
+
if (coding !== "gzip" && coding !== "deflate") return undefined
|
|
37
|
+
codings.push(coding)
|
|
38
|
+
}
|
|
39
|
+
return codings
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Wraps a request so that its body accessors yield the decompressed body.
|
|
44
|
+
* Decompression happens lazily, when a body accessor is read.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export class DecompressedRequest extends Inspectable.Class implements HttpServerRequest.HttpServerRequest {
|
|
49
|
+
readonly [HttpServerRequest.TypeId]: typeof HttpServerRequest.TypeId
|
|
50
|
+
readonly [HttpIncomingMessage.TypeId]: typeof HttpIncomingMessage.TypeId
|
|
51
|
+
readonly inner: HttpServerRequest.HttpServerRequest
|
|
52
|
+
readonly codings: ReadonlyArray<Coding>
|
|
53
|
+
readonly maxDecompressedSize: ByteSize.ByteSize | undefined
|
|
54
|
+
readonly headers: Headers.Headers
|
|
55
|
+
|
|
56
|
+
constructor(
|
|
57
|
+
inner: HttpServerRequest.HttpServerRequest,
|
|
58
|
+
codings: ReadonlyArray<Coding>,
|
|
59
|
+
maxDecompressedSize: ByteSize.ByteSize | undefined
|
|
60
|
+
) {
|
|
61
|
+
super()
|
|
62
|
+
this[HttpServerRequest.TypeId] = HttpServerRequest.TypeId
|
|
63
|
+
this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId
|
|
64
|
+
this.inner = inner
|
|
65
|
+
this.codings = codings
|
|
66
|
+
this.maxDecompressedSize = maxDecompressedSize
|
|
67
|
+
this.headers = Headers.removeMany(inner.headers, ["content-encoding", "content-length"])
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
toJSON(): unknown {
|
|
71
|
+
return HttpIncomingMessage.inspect(this, {
|
|
72
|
+
_id: "HttpServerRequest",
|
|
73
|
+
method: this.method,
|
|
74
|
+
url: this.originalUrl
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
modify(
|
|
79
|
+
options: {
|
|
80
|
+
readonly url?: string
|
|
81
|
+
readonly headers?: Headers.Headers
|
|
82
|
+
readonly remoteAddress?: Option.Option<string>
|
|
83
|
+
}
|
|
84
|
+
): HttpServerRequest.HttpServerRequest {
|
|
85
|
+
return new DecompressedRequest(this.inner.modify(options), this.codings, this.maxDecompressedSize)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get source(): object {
|
|
89
|
+
return this.inner.source
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get url(): string {
|
|
93
|
+
return this.inner.url
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get originalUrl(): string {
|
|
97
|
+
return this.inner.originalUrl
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get method(): HttpMethod {
|
|
101
|
+
return this.inner.method
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get cookies(): ReadonlyRecord<string, string> {
|
|
105
|
+
return this.inner.cookies
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get remoteAddress(): Option.Option<string> {
|
|
109
|
+
return this.inner.remoteAddress
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get upgrade(): Effect.Effect<Socket.Socket, HttpServerError> {
|
|
113
|
+
return this.inner.upgrade
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Platform accessors such as `NodeHttpServerRequest.toServerResponse` read
|
|
117
|
+
// the response handle from the request.
|
|
118
|
+
get response(): unknown {
|
|
119
|
+
return (this.inner as any).response
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
get stream(): Stream.Stream<Uint8Array, HttpServerError> {
|
|
123
|
+
return Stream.unwrap(Effect.withFiber((fiber) => {
|
|
124
|
+
const limit = this.maxDecompressedSize ?? fiber.getRef(HttpIncomingMessage.MaxBodySize) ??
|
|
125
|
+
defaultMaxDecompressedSize
|
|
126
|
+
return Effect.succeed(Stream.fromReadableStream({
|
|
127
|
+
evaluate: () => {
|
|
128
|
+
let body = Stream.toReadableStreamWith(this.inner.stream, fiber.context)
|
|
129
|
+
for (let i = this.codings.length - 1; i >= 0; i--) {
|
|
130
|
+
body = body.pipeThrough(
|
|
131
|
+
new DecompressionStream(this.codings[i]) as unknown as ReadableWritablePair<Uint8Array, Uint8Array>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
let size = 0
|
|
135
|
+
return body.pipeThrough(
|
|
136
|
+
new TransformStream<Uint8Array, Uint8Array>({
|
|
137
|
+
transform: (chunk, controller) => {
|
|
138
|
+
size += chunk.byteLength
|
|
139
|
+
if (size > limit) {
|
|
140
|
+
controller.error(
|
|
141
|
+
this.parseError(undefined, `Decompressed request body exceeds ${limit} bytes`, "BodyTooLarge")
|
|
142
|
+
)
|
|
143
|
+
} else {
|
|
144
|
+
controller.enqueue(chunk)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
)
|
|
149
|
+
},
|
|
150
|
+
onError: (cause) => cause instanceof HttpServerError ? cause : this.parseError(cause)
|
|
151
|
+
}))
|
|
152
|
+
}))
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private bytesEffect: Effect.Effect<Uint8Array, HttpServerError> | undefined
|
|
156
|
+
private get bytes(): Effect.Effect<Uint8Array, HttpServerError> {
|
|
157
|
+
return this.bytesEffect ??= Effect.runSync(Effect.cached(Stream.mkUint8Array(this.stream)))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get text(): Effect.Effect<string, HttpServerError> {
|
|
161
|
+
return Effect.map(this.bytes, (bytes) => textDecoder.decode(bytes))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
get json(): Effect.Effect<Schema.Json, HttpServerError> {
|
|
165
|
+
return Effect.flatMap(this.text, (text) =>
|
|
166
|
+
Effect.try({
|
|
167
|
+
try: () => text === "" ? null : JSON.parse(text) as Schema.Json,
|
|
168
|
+
catch: (cause) => this.parseError(cause)
|
|
169
|
+
}))
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
get urlParamsBody(): Effect.Effect<UrlParams.UrlParams, HttpServerError> {
|
|
173
|
+
return Effect.flatMap(this.text, (text) =>
|
|
174
|
+
Effect.try({
|
|
175
|
+
try: () => UrlParams.fromInput(new URLSearchParams(text)),
|
|
176
|
+
catch: (cause) => this.parseError(cause)
|
|
177
|
+
}))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
get arrayBuffer(): Effect.Effect<ArrayBuffer, HttpServerError> {
|
|
181
|
+
return Effect.map(
|
|
182
|
+
this.bytes,
|
|
183
|
+
(bytes) => bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
get multipartStream(): Stream.Stream<Multipart.Part, Multipart.MultipartError> {
|
|
188
|
+
return Stream.pipeThroughChannel(
|
|
189
|
+
Stream.mapError(
|
|
190
|
+
this.stream,
|
|
191
|
+
(cause) => Multipart.MultipartError.fromReason(multipartReasons.get(cause) ?? "InternalError", cause)
|
|
192
|
+
),
|
|
193
|
+
Multipart.makeChannel(this.headers)
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private multipartEffect: HttpServerRequest.HttpServerRequest["multipart"] | undefined
|
|
198
|
+
get multipart(): HttpServerRequest.HttpServerRequest["multipart"] {
|
|
199
|
+
return this.multipartEffect ??= Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private parseError(
|
|
203
|
+
cause: unknown,
|
|
204
|
+
description?: string,
|
|
205
|
+
multipartReason: MultipartReason = "Parse"
|
|
206
|
+
): HttpServerError {
|
|
207
|
+
const error = new HttpServerError({
|
|
208
|
+
reason: new RequestParseError({
|
|
209
|
+
request: this,
|
|
210
|
+
...(description === undefined ? undefined : { description }),
|
|
211
|
+
...(cause === undefined ? undefined : { cause })
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
multipartReasons.set(error, multipartReason)
|
|
215
|
+
return error
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const textDecoder = new TextDecoder()
|
|
220
|
+
|
|
221
|
+
type MultipartReason = "Parse" | "BodyTooLarge"
|
|
222
|
+
|
|
223
|
+
// Failures caused by the client's data, keyed to the multipart reason they map
|
|
224
|
+
// to. Transport errors from the inner request are absent and map to
|
|
225
|
+
// `InternalError`.
|
|
226
|
+
const multipartReasons = new WeakMap<HttpServerError, MultipartReason>()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as Tracer from "../../Tracer.ts"
|
|
2
2
|
import * as Headers from "../Headers.ts"
|
|
3
|
+
import * as UrlParams from "../UrlParams.ts"
|
|
3
4
|
|
|
4
5
|
const defaultPorts: Record<string, number> = {
|
|
5
6
|
"http:": 80,
|
|
@@ -9,16 +10,17 @@ const defaultPorts: Record<string, number> = {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Records
|
|
13
|
+
* Records `url.*` and `server.*` attributes with URL redaction.
|
|
13
14
|
*
|
|
14
15
|
* @internal
|
|
15
16
|
*/
|
|
16
17
|
export const addUrlAttributes = (
|
|
17
18
|
span: Tracer.Span,
|
|
18
|
-
url: URL
|
|
19
|
+
url: URL,
|
|
20
|
+
redactedNames: ReadonlyArray<string | RegExp>
|
|
19
21
|
): void => {
|
|
20
|
-
const query = url.search.slice(1)
|
|
21
|
-
span.attribute("url.full", url.
|
|
22
|
+
const query = UrlParams.redactUrl(url.search, redactedNames).slice(1)
|
|
23
|
+
span.attribute("url.full", UrlParams.redactUrl(url.href, redactedNames))
|
|
22
24
|
span.attribute("url.path", url.pathname)
|
|
23
25
|
if (query !== "") {
|
|
24
26
|
span.attribute("url.query", query)
|
|
@@ -34,6 +36,21 @@ export const addUrlAttributes = (
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Adds the names of `Redacted` parameters to the redacted names.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export const redactedNames = (
|
|
45
|
+
urlParams: UrlParams.UrlParams,
|
|
46
|
+
redactedNames: ReadonlyArray<string | RegExp>
|
|
47
|
+
): ReadonlyArray<string | RegExp> => {
|
|
48
|
+
const keys = urlParams.params.filter(([, value]) => typeof value !== "string").map(([key]) => key)
|
|
49
|
+
return keys.length === 0
|
|
50
|
+
? redactedNames
|
|
51
|
+
: [...redactedNames, ...new URLSearchParams(keys.map((key) => [key, ""])).keys()]
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
/** @internal */
|
|
38
55
|
export const addHeaderAttributes = (
|
|
39
56
|
span: Tracer.Span,
|
|
@@ -23,6 +23,7 @@ import * as HttpClientError from "../http/HttpClientError.ts"
|
|
|
23
23
|
import * as HttpClientRequest from "../http/HttpClientRequest.ts"
|
|
24
24
|
import type * as HttpClientResponse from "../http/HttpClientResponse.ts"
|
|
25
25
|
import * as HttpMethod from "../http/HttpMethod.ts"
|
|
26
|
+
import * as internalUrlParams from "../http/internal/urlParams.ts"
|
|
26
27
|
import * as UrlParams from "../http/UrlParams.ts"
|
|
27
28
|
import * as InternalRecord from "../internal/record.ts"
|
|
28
29
|
import * as Predicate from "../Predicate.ts"
|
|
@@ -746,7 +747,7 @@ export const urlBuilder = <Api extends HttpApi.Constraint>(api: Api, options?: {
|
|
|
746
747
|
)
|
|
747
748
|
for (const [key, value] of urlParams.params) {
|
|
748
749
|
if (value !== undefined) {
|
|
749
|
-
url.searchParams.append(key, value)
|
|
750
|
+
url.searchParams.append(key, internalUrlParams.unwrap(value))
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
753
|
return url.toString()
|
|
@@ -60,6 +60,11 @@ export type ScalarConfig = {
|
|
|
60
60
|
layout?: "modern" | "classic"
|
|
61
61
|
/** URL to a request proxy for the API client */
|
|
62
62
|
proxyUrl?: string
|
|
63
|
+
/** Authentication preferences for the API client */
|
|
64
|
+
authentication?: {
|
|
65
|
+
/** OpenAPI security scheme names to select by default */
|
|
66
|
+
preferredSecurityScheme?: string | Array<string | Array<string>> | null
|
|
67
|
+
}
|
|
63
68
|
/** Browser JavaScript function expression used by Scalar for documents and test requests */
|
|
64
69
|
customFetch?: string
|
|
65
70
|
/** Whether to show the sidebar */
|
package/src/internal/core.ts
CHANGED
|
@@ -321,6 +321,26 @@ export const causeCombine: {
|
|
|
321
321
|
}
|
|
322
322
|
)
|
|
323
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Appends the interrupts from `interrupts` that `self` does not contain yet.
|
|
326
|
+
* Unlike `causeCombine`, it never calls hash or equality methods, which can be
|
|
327
|
+
* user-defined, random, or throwing.
|
|
328
|
+
*
|
|
329
|
+
* @internal
|
|
330
|
+
*/
|
|
331
|
+
export const causeAddInterrupts = <E>(self: Cause.Cause<E>, interrupts: Cause.Cause<never>): Cause.Cause<E> => {
|
|
332
|
+
const reasons: Array<Cause.Reason<E>> = self.reasons.slice()
|
|
333
|
+
for (const reason of interrupts.reasons) {
|
|
334
|
+
if (
|
|
335
|
+
isInterruptReason(reason) &&
|
|
336
|
+
!reasons.some((r) => isInterruptReason(r) && r.fiberId === reason.fiberId && r.annotations === reason.annotations)
|
|
337
|
+
) {
|
|
338
|
+
reasons.push(reason)
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return reasons.length === self.reasons.length ? self : new CauseImpl(reasons)
|
|
342
|
+
}
|
|
343
|
+
|
|
324
344
|
/** @internal */
|
|
325
345
|
export const causeEmpty: Cause.Cause<never> = new CauseImpl([])
|
|
326
346
|
|
|
@@ -600,7 +620,7 @@ export const exitFailCause: <E>(cause: Cause.Cause<E>) => Exit.Exit<never, E> =
|
|
|
600
620
|
if (skippedHandler) {
|
|
601
621
|
cause = causeFromReasons(cause.reasons.filter((reason) => reason._tag !== "Fail"))
|
|
602
622
|
}
|
|
603
|
-
cause =
|
|
623
|
+
cause = causeAddInterrupts(cause, interruptedCause)
|
|
604
624
|
annotated = true
|
|
605
625
|
}
|
|
606
626
|
return cont
|
package/src/internal/dateTime.ts
CHANGED
|
@@ -934,10 +934,6 @@ export const subtractDuration: {
|
|
|
934
934
|
mapEpochMillis(self, (millis) => millis - Duration.toMillis(Duration.fromInputUnsafe(duration)))
|
|
935
935
|
)
|
|
936
936
|
|
|
937
|
-
const addMillis = (date: Date, amount: number): void => {
|
|
938
|
-
date.setTime(date.getTime() + amount)
|
|
939
|
-
}
|
|
940
|
-
|
|
941
937
|
/** @internal */
|
|
942
938
|
export const add: {
|
|
943
939
|
(
|
|
@@ -949,20 +945,26 @@ export const add: {
|
|
|
949
945
|
): A
|
|
950
946
|
} = dual(
|
|
951
947
|
2,
|
|
952
|
-
(self: DateTime.DateTime, parts: Partial<DateTime.DateTime.PartsForMath>): DateTime.DateTime =>
|
|
953
|
-
|
|
948
|
+
(self: DateTime.DateTime, parts: Partial<DateTime.DateTime.PartsForMath>): DateTime.DateTime => {
|
|
949
|
+
// time units move the instant, calendar units move the wall clock
|
|
950
|
+
const shifted = mutateUtc(self, (date) => {
|
|
954
951
|
if (parts.milliseconds) {
|
|
955
|
-
|
|
952
|
+
date.setTime(date.getTime() + parts.milliseconds)
|
|
956
953
|
}
|
|
957
954
|
if (parts.seconds) {
|
|
958
|
-
|
|
955
|
+
date.setTime(date.getTime() + parts.seconds * 1000)
|
|
959
956
|
}
|
|
960
957
|
if (parts.minutes) {
|
|
961
|
-
|
|
958
|
+
date.setTime(date.getTime() + parts.minutes * 60 * 1000)
|
|
962
959
|
}
|
|
963
960
|
if (parts.hours) {
|
|
964
|
-
|
|
961
|
+
date.setTime(date.getTime() + parts.hours * 60 * 60 * 1000)
|
|
965
962
|
}
|
|
963
|
+
})
|
|
964
|
+
if (!parts.days && !parts.weeks && !parts.months && !parts.years) {
|
|
965
|
+
return shifted
|
|
966
|
+
}
|
|
967
|
+
return mutate(shifted, (date) => {
|
|
966
968
|
if (parts.days) {
|
|
967
969
|
date.setUTCDate(date.getUTCDate() + parts.days)
|
|
968
970
|
}
|
|
@@ -989,6 +991,7 @@ export const add: {
|
|
|
989
991
|
}
|
|
990
992
|
}
|
|
991
993
|
})
|
|
994
|
+
}
|
|
992
995
|
)
|
|
993
996
|
|
|
994
997
|
/** @internal */
|
package/src/internal/effect.ts
CHANGED
|
@@ -49,6 +49,7 @@ import { internalCall } from "../Utils.ts"
|
|
|
49
49
|
import type { Primitive } from "./core.ts"
|
|
50
50
|
import {
|
|
51
51
|
args,
|
|
52
|
+
causeAddInterrupts,
|
|
52
53
|
causeAnnotate,
|
|
53
54
|
causeCombine,
|
|
54
55
|
causeEmpty,
|
|
@@ -130,9 +131,9 @@ export class Interrupt extends ReasonBase<"Interrupt"> implements Cause.Interrup
|
|
|
130
131
|
)
|
|
131
132
|
}
|
|
132
133
|
[Hash.symbol](): number {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
)
|
|
134
|
+
// Equality compares annotations by reference, so leave them out instead of
|
|
135
|
+
// hashing them randomly.
|
|
136
|
+
return Hash.string(`${this._tag}:${this.fiberId}`)
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -566,7 +567,7 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
566
567
|
cause = causeAnnotate(cause, annotations)
|
|
567
568
|
}
|
|
568
569
|
this._interruptedCause = this._interruptedCause
|
|
569
|
-
?
|
|
570
|
+
? causeAddInterrupts(this._interruptedCause, cause)
|
|
570
571
|
: cause
|
|
571
572
|
if (this.interruptible) {
|
|
572
573
|
if (this._running) {
|
|
@@ -1507,14 +1508,19 @@ const succeedPayload = function(this: { readonly payload: any }, _value: unknown
|
|
|
1507
1508
|
// V8 includes the property name of a stored continuation in its stack trace.
|
|
1508
1509
|
// Other engines need an explicit frame for the stack cleaner to cut at.
|
|
1509
1510
|
const continuationMarksStack = (() => {
|
|
1510
|
-
|
|
1511
|
+
const limit = getStackTraceLimit()
|
|
1512
|
+
if (limit === 0) return false
|
|
1511
1513
|
const marker = "~effect/Effect/stackProbe"
|
|
1512
1514
|
const probe = {
|
|
1513
1515
|
[marker]: function stackProbe() {
|
|
1514
|
-
return new Error()
|
|
1516
|
+
return new Error()
|
|
1515
1517
|
}
|
|
1516
1518
|
}
|
|
1517
|
-
|
|
1519
|
+
// Only the probe frame is needed to detect the continuation property name.
|
|
1520
|
+
setStackTraceLimit(1)
|
|
1521
|
+
const error = probe[marker]()
|
|
1522
|
+
setStackTraceLimit(limit)
|
|
1523
|
+
return error.stack?.includes("[as " + marker + "]") === true
|
|
1518
1524
|
})()
|
|
1519
1525
|
const mapCont = function(this: { readonly payload: any }, value: any, fiber: FiberImpl) {
|
|
1520
1526
|
const f = this.payload
|