effect 4.1.4 → 4.1.6
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/THIRD_PARTY_NOTICES.md +88 -0
- package/ai-docs/package.json +2 -2
- package/dist/Arbitrary.d.ts +44 -2
- package/dist/Arbitrary.d.ts.map +1 -1
- package/dist/Arbitrary.js +9 -1
- package/dist/Arbitrary.js.map +1 -1
- package/dist/BigInt.d.ts +200 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +105 -9
- package/dist/BigInt.js.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +4 -2
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +3 -3
- package/dist/Cause.js +1 -1
- package/dist/Channel.d.ts +104 -7
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +73 -4
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +5 -0
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +7 -2
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +5 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +2 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Codegen.d.ts +300 -0
- package/dist/Codegen.d.ts.map +1 -0
- package/dist/Codegen.js +526 -0
- package/dist/Codegen.js.map +1 -0
- package/dist/Config.d.ts +31 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +12 -1
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +11 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +17 -6
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Effect.d.ts +1008 -127
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +410 -49
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +4 -4
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +78 -65
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +11 -9
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +15 -12
- package/dist/Equivalence.js.map +1 -1
- package/dist/Fiber.d.ts +58 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +28 -4
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +81 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +40 -8
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +80 -10
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +37 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -8
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +46 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/Formatter.d.ts +2 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +2 -0
- package/dist/Formatter.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +24 -17
- package/dist/Hash.js.map +1 -1
- package/dist/LayerMap.d.ts +12 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +12 -2
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +3 -3
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +3 -3
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +37 -13
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +39 -10
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +35 -23
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +16 -0
- package/dist/Match.js.map +1 -1
- package/dist/Metric.js +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Option.d.ts +4 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +6 -2
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +7 -5
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +8 -3
- package/dist/Order.js.map +1 -1
- package/dist/Pool.d.ts +4 -3
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +21 -18
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +4 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +5 -1
- package/dist/Predicate.js.map +1 -1
- package/dist/Queue.d.ts +69 -22
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +40 -18
- package/dist/Queue.js.map +1 -1
- package/dist/Rational.d.ts +179 -0
- package/dist/Rational.d.ts.map +1 -1
- package/dist/Rational.js +63 -0
- package/dist/Rational.js.map +1 -1
- package/dist/Request.d.ts +20 -0
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +20 -0
- package/dist/Request.js.map +1 -1
- package/dist/Result.d.ts +3 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +5 -2
- package/dist/Result.js.map +1 -1
- package/dist/Schema.d.ts +90 -19
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +92 -414
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +11 -7
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +5 -6
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +14 -10
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +19 -64
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1 -28
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +11 -10
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +12 -11
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +12 -6
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -6
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +8 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -4
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +128 -5
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +179 -43
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +57 -3
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +63 -5
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +135 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +64 -5
- package/dist/Struct.js.map +1 -1
- package/dist/TextDiff.d.ts +105 -0
- package/dist/TextDiff.d.ts.map +1 -1
- package/dist/TextDiff.js +137 -24
- package/dist/TextDiff.js.map +1 -1
- package/dist/Tracer.d.ts +10 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -0
- package/dist/Tracer.js.map +1 -1
- package/dist/TxPriorityQueue.js +2 -2
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +1 -1
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +199 -4
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +143 -18
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +3 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +17 -3
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Skill.d.ts +172 -0
- package/dist/ai/Skill.d.ts.map +1 -0
- package/dist/ai/Skill.js +209 -0
- package/dist/ai/Skill.js.map +1 -0
- package/dist/ai/Tool.d.ts +3 -2
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +3 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +5 -1
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/chat/Chat.d.ts +90 -0
- package/dist/chat/Chat.d.ts.map +1 -0
- package/dist/chat/Chat.js +127 -0
- package/dist/chat/Chat.js.map +1 -0
- package/dist/chat/ChatAdapter.d.ts +386 -0
- package/dist/chat/ChatAdapter.d.ts.map +1 -0
- package/dist/chat/ChatAdapter.js +110 -0
- package/dist/chat/ChatAdapter.js.map +1 -0
- package/dist/chat/ChatError.d.ts +500 -0
- package/dist/chat/ChatError.d.ts.map +1 -0
- package/dist/chat/ChatError.js +521 -0
- package/dist/chat/ChatError.js.map +1 -0
- package/dist/chat/ChatEvent.d.ts +321 -0
- package/dist/chat/ChatEvent.d.ts.map +1 -0
- package/dist/chat/ChatEvent.js +163 -0
- package/dist/chat/ChatEvent.js.map +1 -0
- package/dist/chat/ChatHandler.d.ts +81 -0
- package/dist/chat/ChatHandler.d.ts.map +1 -0
- package/dist/chat/ChatHandler.js +85 -0
- package/dist/chat/ChatHandler.js.map +1 -0
- package/dist/chat/ChatInteraction.d.ts +1519 -0
- package/dist/chat/ChatInteraction.d.ts.map +1 -0
- package/dist/chat/ChatInteraction.js +1052 -0
- package/dist/chat/ChatInteraction.js.map +1 -0
- package/dist/chat/ChatMarkdown.d.ts +280 -0
- package/dist/chat/ChatMarkdown.d.ts.map +1 -0
- package/dist/chat/ChatMarkdown.js +1172 -0
- package/dist/chat/ChatMarkdown.js.map +1 -0
- package/dist/chat/ChatMessage.d.ts +224 -0
- package/dist/chat/ChatMessage.d.ts.map +1 -0
- package/dist/chat/ChatMessage.js +172 -0
- package/dist/chat/ChatMessage.js.map +1 -0
- package/dist/chat/ChatTest.d.ts +407 -0
- package/dist/chat/ChatTest.d.ts.map +1 -0
- package/dist/chat/ChatTest.js +2145 -0
- package/dist/chat/ChatTest.js.map +1 -0
- package/dist/chat/ChatThread.d.ts +92 -0
- package/dist/chat/ChatThread.d.ts.map +1 -0
- package/dist/chat/ChatThread.js +116 -0
- package/dist/chat/ChatThread.js.map +1 -0
- package/dist/chat/ChatUi.d.ts +362 -0
- package/dist/chat/ChatUi.d.ts.map +1 -0
- package/dist/chat/ChatUi.js +209 -0
- package/dist/chat/ChatUi.js.map +1 -0
- package/dist/chat/index.d.ts +60 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +61 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/internal/retries.d.ts +2 -0
- package/dist/chat/internal/retries.d.ts.map +1 -0
- package/dist/chat/internal/retries.js +7 -0
- package/dist/chat/internal/retries.js.map +1 -0
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +6 -7
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +20 -2
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +4 -0
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Prompt.d.ts +5 -6
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +9 -4
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/internal/command.d.ts +1 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/config.d.ts +1 -1
- package/dist/cli/internal/config.d.ts.map +1 -1
- package/dist/cli/internal/config.js +3 -3
- package/dist/cli/internal/config.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +21 -1
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +24 -6
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +183 -103
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +56 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +18 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +15 -3
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +6 -0
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +58 -37
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +18 -8
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityActivation.js +2 -0
- package/dist/cluster/internal/entityActivation.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +20 -13
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/cluster/internal/entityReaper.js +1 -1
- package/dist/cluster/internal/entityReaper.js.map +1 -1
- package/dist/crypto/Kdf.d.ts +2 -1
- package/dist/crypto/Kdf.d.ts.map +1 -1
- package/dist/crypto/Kdf.js +2 -1
- package/dist/crypto/Kdf.js.map +1 -1
- package/dist/crypto/Password.d.ts +162 -0
- package/dist/crypto/Password.d.ts.map +1 -0
- package/dist/crypto/Password.js +217 -0
- package/dist/crypto/Password.js.map +1 -0
- package/dist/crypto/index.d.ts +5 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +5 -0
- package/dist/crypto/index.js.map +1 -1
- package/dist/encoding/Base64.d.ts +63 -0
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +82 -1
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +1 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +7 -1
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts.map +1 -1
- package/dist/encoding/Csv.js +44 -16
- package/dist/encoding/Csv.js.map +1 -1
- package/dist/encoding/Hex.d.ts +5 -0
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +5 -0
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +13 -124
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Sse.d.ts +1 -0
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +7 -5
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/encoding/Xml.d.ts +153 -18
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +379 -57
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +3 -8
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +6 -8
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +2 -1
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +14 -10
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +163 -116
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/FindMyWay.d.ts +99 -0
- package/dist/http/FindMyWay.d.ts.map +1 -1
- package/dist/http/FindMyWay.js +39 -0
- package/dist/http/FindMyWay.js.map +1 -1
- package/dist/http/Headers.d.ts +201 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +205 -3
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +12 -8
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +1 -0
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +32 -9
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +46 -0
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +15 -0
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts +132 -0
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +83 -0
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +16 -9
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts +49 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +70 -20
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts +118 -0
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +67 -58
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/Mime.d.ts.map +1 -1
- package/dist/http/Mime.js +3 -2
- package/dist/http/Mime.js.map +1 -1
- package/dist/http/Multipart.d.ts.map +1 -1
- package/dist/http/Multipart.js +0 -5
- package/dist/http/Multipart.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts +6 -0
- package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +1 -1
- package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
- package/dist/http/internal/clientPath.d.ts +2 -0
- package/dist/http/internal/clientPath.d.ts.map +1 -0
- package/dist/http/internal/clientPath.js +24 -0
- package/dist/http/internal/clientPath.js.map +1 -0
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -2
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/mediaType.d.ts.map +1 -0
- package/dist/{http-api → http}/internal/mediaType.js +4 -0
- package/dist/{http-api → http}/internal/mediaType.js.map +1 -1
- package/dist/http/internal/redactedPath.d.ts +2 -0
- package/dist/http/internal/redactedPath.d.ts.map +1 -0
- package/dist/http/internal/redactedPath.js +140 -0
- package/dist/http/internal/redactedPath.js.map +1 -0
- package/dist/http/internal/requestState.js +1 -0
- package/dist/http/internal/requestState.js.map +1 -1
- package/dist/http/internal/tracing.js +5 -3
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +13 -2
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +43 -6
- package/dist/http-api/HttpApi.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +7 -3
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +29 -12
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +1 -1
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiScalar.d.ts +4 -0
- package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
- package/dist/http-api/HttpApiScalar.js +10 -1
- package/dist/http-api/HttpApiScalar.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +1 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/http-api/OpenApi.d.ts +2 -0
- package/dist/http-api/OpenApi.d.ts.map +1 -1
- package/dist/http-api/internal/httpApiScalar.js +5 -2
- package/dist/http-api/internal/httpApiScalar.js.map +1 -1
- package/dist/http-api/internal/redactedKeys.d.ts +2 -0
- package/dist/http-api/internal/redactedKeys.d.ts.map +1 -0
- package/dist/http-api/internal/redactedKeys.js +37 -0
- package/dist/http-api/internal/redactedKeys.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.js +0 -5
- package/dist/internal/arbitrary/model.js.map +1 -1
- package/dist/internal/arbitrary/regexp.js +2 -1
- package/dist/internal/arbitrary/regexp.js.map +1 -1
- package/dist/internal/arbitrary/runner.d.ts.map +1 -1
- package/dist/internal/arbitrary/runner.js +21 -16
- package/dist/internal/arbitrary/runner.js.map +1 -1
- package/dist/internal/arbitrary/schema.js +140 -23
- package/dist/internal/arbitrary/schema.js.map +1 -1
- package/dist/internal/base64.js +34 -2
- package/dist/internal/base64.js.map +1 -1
- package/dist/internal/codegen.d.ts +2 -0
- package/dist/internal/codegen.d.ts.map +1 -0
- package/dist/internal/codegen.js +59 -0
- package/dist/internal/codegen.js.map +1 -0
- package/dist/internal/core.js +3 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +61 -29
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +30 -8
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +14 -13
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/hash.js +4 -1
- package/dist/internal/hash.js.map +1 -1
- package/dist/internal/hashMap.js +7 -7
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +19 -18
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/record.js +18 -4
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/result.js +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/codeExpression.d.ts +4 -0
- package/dist/internal/schema/codeExpression.d.ts.map +1 -0
- package/dist/internal/schema/codeExpression.js +179 -0
- package/dist/internal/schema/codeExpression.js.map +1 -0
- package/dist/internal/schema/codeImports.d.ts +8 -0
- package/dist/internal/schema/codeImports.d.ts.map +1 -0
- package/dist/internal/schema/codeImports.js +135 -0
- package/dist/internal/schema/codeImports.js.map +1 -0
- package/dist/internal/schema/codeTokens.d.ts +8 -0
- package/dist/internal/schema/codeTokens.d.ts.map +1 -0
- package/dist/internal/schema/codeTokens.js +17 -0
- package/dist/internal/schema/codeTokens.js.map +1 -0
- package/dist/internal/schema/passthrough.d.ts +2 -0
- package/dist/internal/schema/passthrough.d.ts.map +1 -0
- package/dist/internal/schema/passthrough.js +8 -0
- package/dist/internal/schema/passthrough.js.map +1 -0
- package/dist/internal/schema/schemaCodegen.d.ts +2 -0
- package/dist/internal/schema/schemaCodegen.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegen.js +378 -0
- package/dist/internal/schema/schemaCodegen.js.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts +2 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js +425 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +3 -4
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +11 -4
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/trie.js +51 -64
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/utf8.d.ts +2 -0
- package/dist/internal/utf8.d.ts.map +1 -0
- package/dist/internal/utf8.js +151 -0
- package/dist/internal/utf8.js.map +1 -0
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +51 -1
- package/dist/jose/JoseError.d.ts.map +1 -1
- package/dist/jose/JoseError.js +25 -18
- package/dist/jose/JoseError.js.map +1 -1
- package/dist/jose/Jwks.d.ts +13 -0
- package/dist/jose/Jwks.d.ts.map +1 -1
- package/dist/jose/Jwks.js +10 -2
- package/dist/jose/Jwks.js.map +1 -1
- package/dist/jose/internal/compact.js +10 -5
- package/dist/jose/internal/compact.js.map +1 -1
- package/dist/observability/Otlp.d.ts +19 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +49 -13
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +133 -50
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +14 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +15 -5
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +2 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +14 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +10 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.d.ts +4 -2
- package/dist/observability/internal/otlpProtobuf.d.ts.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +238 -156
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +6 -4
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +20 -3
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/protobuf/ProtobufDescriptor.d.ts +377 -0
- package/dist/protobuf/ProtobufDescriptor.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptor.js +135 -0
- package/dist/protobuf/ProtobufDescriptor.js.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts +2083 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.js +2674 -0
- package/dist/protobuf/ProtobufDescriptorProto.js.map +1 -0
- package/dist/protobuf/ProtobufMessage.d.ts +183 -0
- package/dist/protobuf/ProtobufMessage.d.ts.map +1 -0
- package/dist/protobuf/ProtobufMessage.js +232 -0
- package/dist/protobuf/ProtobufMessage.js.map +1 -0
- package/dist/protobuf/ProtobufReader.d.ts +350 -0
- package/dist/protobuf/ProtobufReader.d.ts.map +1 -0
- package/dist/protobuf/ProtobufReader.js +698 -0
- package/dist/protobuf/ProtobufReader.js.map +1 -0
- package/dist/protobuf/ProtobufWriter.d.ts +224 -0
- package/dist/protobuf/ProtobufWriter.d.ts.map +1 -0
- package/dist/protobuf/ProtobufWriter.js +483 -0
- package/dist/protobuf/ProtobufWriter.js.map +1 -0
- package/dist/protobuf/index.d.ts +30 -0
- package/dist/protobuf/index.d.ts.map +1 -0
- package/dist/protobuf/index.js +31 -0
- package/dist/protobuf/index.js.map +1 -0
- package/dist/protobuf/internal/binary.d.ts +2 -0
- package/dist/protobuf/internal/binary.d.ts.map +1 -0
- package/dist/protobuf/internal/binary.js +966 -0
- package/dist/protobuf/internal/binary.js.map +1 -0
- package/dist/protobuf/internal/resolve.d.ts +2 -0
- package/dist/protobuf/internal/resolve.d.ts.map +1 -0
- package/dist/protobuf/internal/resolve.js +463 -0
- package/dist/protobuf/internal/resolve.js.map +1 -0
- package/dist/protobuf/internal/wireType.d.ts +2 -0
- package/dist/protobuf/internal/wireType.d.ts.map +1 -0
- package/dist/protobuf/internal/wireType.js +10 -0
- package/dist/protobuf/internal/wireType.js.map +1 -0
- package/dist/reactivity/AsyncResult.d.ts +3 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +4 -1
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/Atom.d.ts +10 -4
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +48 -22
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomHttpApi.d.ts +5 -0
- package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/reactivity/AtomHttpApi.js +5 -1
- package/dist/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js +13 -0
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +5 -0
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js +6 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +25 -0
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js +18 -0
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +70 -22
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +6 -1
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/rpc/RpcGroup.js +4 -0
- package/dist/rpc/RpcGroup.js.map +1 -1
- package/dist/rpc/RpcMiddleware.d.ts +9 -0
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts +7 -1
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +22 -5
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +33 -18
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +2 -1
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/schema/VariantSchema.d.ts +10 -2
- package/dist/schema/VariantSchema.d.ts.map +1 -1
- package/dist/schema/VariantSchema.js +7 -1
- package/dist/schema/VariantSchema.js.map +1 -1
- package/dist/socket/Socket.d.ts +24 -10
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js +52 -17
- package/dist/socket/Socket.js.map +1 -1
- package/dist/sql/Migrator.d.ts +3 -0
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +12 -6
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +5 -1
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/SqlModel.d.ts.map +1 -1
- package/dist/sql/SqlModel.js +1 -0
- package/dist/sql/SqlModel.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +96 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +78 -6
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +5 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +7 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/workers/SharedMemory.d.ts +115 -0
- package/dist/workers/SharedMemory.d.ts.map +1 -0
- package/dist/workers/SharedMemory.js +149 -0
- package/dist/workers/SharedMemory.js.map +1 -0
- package/dist/workers/Transferable.d.ts.map +1 -1
- package/dist/workers/Transferable.js +1 -4
- package/dist/workers/Transferable.js.map +1 -1
- package/dist/workers/index.d.ts +5 -0
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +5 -0
- package/dist/workers/index.js.map +1 -1
- package/dist/workflow/Activity.d.ts +18 -0
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/Activity.js +13 -4
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +10 -9
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +33 -22
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +28 -12
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/dist/workflow/internal/retry.d.ts +2 -0
- package/dist/workflow/internal/retry.d.ts.map +1 -0
- package/dist/workflow/internal/retry.js +11 -0
- package/dist/workflow/internal/retry.js.map +1 -0
- package/dist/workflow/internal/scope.d.ts +2 -0
- package/dist/workflow/internal/scope.d.ts.map +1 -0
- package/dist/workflow/internal/scope.js +26 -0
- package/dist/workflow/internal/scope.js.map +1 -0
- package/package.json +8 -5
- package/src/Arbitrary.ts +60 -3
- package/src/BigInt.ts +247 -9
- package/src/Cache.ts +4 -2
- package/src/Cause.ts +3 -3
- package/src/Channel.ts +105 -8
- package/src/Chunk.ts +7 -3
- package/src/Clock.ts +5 -2
- package/src/Codegen.ts +746 -0
- package/src/Config.ts +35 -4
- package/src/ConfigProvider.ts +24 -7
- package/src/Effect.ts +1095 -157
- package/src/Equal.ts +85 -79
- package/src/Equivalence.ts +16 -13
- package/src/Fiber.ts +58 -8
- package/src/FiberHandle.ts +86 -12
- package/src/FiberMap.ts +83 -10
- package/src/FiberSet.ts +96 -8
- package/src/Formatter.ts +2 -0
- package/src/Hash.ts +30 -22
- package/src/LayerMap.ts +14 -4
- package/src/LayerRef.ts +8 -6
- package/src/Logger.ts +68 -25
- package/src/Match.ts +94 -50
- package/src/Metric.ts +1 -1
- package/src/Option.ts +9 -5
- package/src/Order.ts +10 -5
- package/src/Pool.ts +22 -17
- package/src/Predicate.ts +7 -3
- package/src/Queue.ts +84 -31
- package/src/Rational.ts +198 -0
- package/src/Request.ts +20 -0
- package/src/Result.ts +9 -6
- package/src/Schema.ts +145 -325
- package/src/SchemaAST.ts +15 -5
- package/src/SchemaGetter.ts +17 -10
- package/src/SchemaRepresentation.ts +19 -74
- package/src/SchemaTransformation.ts +12 -11
- package/src/Scope.ts +12 -6
- package/src/ScopedCache.ts +8 -5
- package/src/Semaphore.ts +18 -4
- package/src/Stream.ts +233 -53
- package/src/String.ts +84 -7
- package/src/Struct.ts +138 -5
- package/src/TextDiff.ts +186 -30
- package/src/Tracer.ts +10 -0
- package/src/TxPriorityQueue.ts +2 -2
- package/src/ai/LanguageModel.ts +2 -1
- package/src/ai/McpServer.ts +306 -26
- package/src/ai/Prompt.ts +20 -3
- package/src/ai/Skill.ts +236 -0
- package/src/ai/Tool.ts +3 -2
- package/src/ai/Toolkit.ts +3 -1
- package/src/ai/index.ts +6 -0
- package/src/chat/Chat.ts +164 -0
- package/src/chat/ChatAdapter.ts +444 -0
- package/src/chat/ChatError.ts +684 -0
- package/src/chat/ChatEvent.ts +221 -0
- package/src/chat/ChatHandler.ts +102 -0
- package/src/chat/ChatInteraction.ts +1979 -0
- package/src/chat/ChatMarkdown.ts +1406 -0
- package/src/chat/ChatMessage.ts +213 -0
- package/src/chat/ChatTest.ts +2606 -0
- package/src/chat/ChatThread.ts +132 -0
- package/src/chat/ChatUi.ts +320 -0
- package/src/chat/index.ts +72 -0
- package/src/chat/internal/retries.ts +7 -0
- package/src/cli/CliOutput.ts +4 -5
- package/src/cli/Command.ts +20 -2
- package/src/cli/Prompt.ts +15 -9
- package/src/cli/internal/config.ts +8 -8
- package/src/cluster/ClusterCron.ts +33 -10
- package/src/cluster/ClusterWorkflowEngine.ts +214 -119
- package/src/cluster/MessageStorage.ts +51 -2
- package/src/cluster/Sharding.ts +17 -3
- package/src/cluster/ShardingConfig.ts +3 -0
- package/src/cluster/SqlMessageStorage.ts +97 -54
- package/src/cluster/SqlRunnerStorage.ts +21 -8
- package/src/cluster/internal/entityActivation.ts +6 -0
- package/src/cluster/internal/entityManager.ts +27 -14
- package/src/cluster/internal/entityReaper.ts +1 -1
- package/src/crypto/Kdf.ts +2 -1
- package/src/crypto/Password.ts +258 -0
- package/src/crypto/index.ts +6 -0
- package/src/encoding/Base64.ts +84 -1
- package/src/encoding/Base64Url.ts +7 -1
- package/src/encoding/Csv.ts +47 -20
- package/src/encoding/Hex.ts +5 -0
- package/src/encoding/SchemaBinary.ts +13 -79
- package/src/encoding/Sse.ts +7 -5
- package/src/encoding/Xml.ts +485 -68
- package/src/eventlog/EventJournal.ts +3 -8
- package/src/eventlog/SqlEventLogServerEncrypted.ts +9 -9
- package/src/http/FetchHttpClient.ts +8 -5
- package/src/http/FindMyWay/internal/router.ts +181 -129
- package/src/http/FindMyWay.ts +106 -0
- package/src/http/Headers.ts +309 -3
- package/src/http/HttpClient.ts +21 -8
- package/src/http/HttpClientError.ts +42 -9
- package/src/http/HttpClientRequest.ts +51 -0
- package/src/http/HttpClientResponse.ts +156 -0
- package/src/http/HttpMiddleware.ts +23 -10
- package/src/http/HttpRouter.ts +84 -20
- package/src/http/HttpServerResponse.ts +159 -61
- package/src/http/Mime.ts +3 -2
- package/src/http/Multipart.ts +0 -5
- package/src/http/MultipartParser/internal/contentType.ts +1 -1
- package/src/http/internal/clientPath.ts +39 -0
- package/src/http/internal/compression.ts +2 -2
- package/src/{http-api → http}/internal/mediaType.ts +4 -0
- package/src/http/internal/redactedPath.ts +148 -0
- package/src/http/internal/requestState.ts +2 -0
- package/src/http/internal/tracing.ts +6 -3
- package/src/http-api/HttpApi.ts +50 -6
- package/src/http-api/HttpApiBuilder.ts +11 -3
- package/src/http-api/HttpApiClient.ts +40 -13
- package/src/http-api/HttpApiEndpoint.ts +1 -1
- package/src/http-api/HttpApiScalar.ts +9 -1
- package/src/http-api/HttpApiSchema.ts +1 -1
- package/src/http-api/OpenApi.ts +2 -0
- package/src/http-api/internal/httpApiScalar.ts +5 -1
- package/src/http-api/internal/redactedKeys.ts +40 -0
- package/src/index.ts +6 -0
- package/src/internal/arbitrary/model.ts +3 -9
- package/src/internal/arbitrary/regexp.ts +3 -1
- package/src/internal/arbitrary/runner.ts +28 -14
- package/src/internal/arbitrary/schema.ts +140 -35
- package/src/internal/base64.ts +57 -2
- package/src/internal/codegen.ts +53 -0
- package/src/internal/core.ts +3 -3
- package/src/internal/dateTime.ts +73 -37
- package/src/internal/effect.ts +56 -111
- package/src/internal/equal.ts +37 -17
- package/src/internal/hash.ts +5 -1
- package/src/internal/hashMap.ts +8 -7
- package/src/internal/matcher.ts +36 -114
- package/src/internal/record.ts +19 -4
- package/src/internal/result.ts +1 -1
- package/src/internal/schema/codeExpression.ts +179 -0
- package/src/internal/schema/codeImports.ts +142 -0
- package/src/internal/schema/codeTokens.ts +39 -0
- package/src/internal/schema/passthrough.ts +8 -0
- package/src/internal/schema/schemaCodegen.ts +544 -0
- package/src/internal/schema/schemaCodegenBuiltIns.ts +343 -0
- package/src/internal/schema/toEquivalence.ts +3 -5
- package/src/internal/schema/toJsonSchemaDocument.ts +13 -4
- package/src/internal/trie.ts +46 -60
- package/src/internal/utf8.ts +106 -0
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +34 -0
- package/src/jose/Jwks.ts +23 -4
- package/src/jose/internal/compact.ts +14 -5
- package/src/observability/Otlp.ts +29 -0
- package/src/observability/OtlpExporter.ts +209 -76
- package/src/observability/OtlpLogger.ts +29 -5
- package/src/observability/OtlpMetrics.ts +2 -0
- package/src/observability/OtlpTracer.ts +24 -3
- package/src/observability/internal/otlpProtobuf.ts +386 -457
- package/src/persistence/KeyValueStore.ts +17 -14
- package/src/persistence/PersistedQueue.ts +21 -4
- package/src/protobuf/ProtobufDescriptor.ts +503 -0
- package/src/protobuf/ProtobufDescriptorProto.ts +3611 -0
- package/src/protobuf/ProtobufMessage.ts +277 -0
- package/src/protobuf/ProtobufReader.ts +756 -0
- package/src/protobuf/ProtobufWriter.ts +530 -0
- package/src/protobuf/index.ts +36 -0
- package/src/protobuf/internal/binary.ts +1215 -0
- package/src/protobuf/internal/resolve.ts +533 -0
- package/src/protobuf/internal/wireType.ts +9 -0
- package/src/reactivity/AsyncResult.ts +6 -1
- package/src/reactivity/Atom.ts +67 -34
- package/src/reactivity/AtomHttpApi.ts +10 -1
- package/src/reactivity/AtomRegistry.ts +16 -0
- package/src/reactivity/AtomRpc.ts +11 -1
- package/src/rpc/Rpc.ts +31 -0
- package/src/rpc/RpcClient.ts +56 -22
- package/src/rpc/RpcGroup.ts +9 -1
- package/src/rpc/RpcMiddleware.ts +9 -0
- package/src/rpc/RpcSerialization.ts +26 -6
- package/src/rpc/RpcServer.ts +33 -20
- package/src/schema/SchemaCompiler/runtime.ts +2 -3
- package/src/schema/VariantSchema.ts +12 -4
- package/src/socket/Socket.ts +67 -20
- package/src/sql/Migrator.ts +10 -12
- package/src/sql/SqlClient.ts +14 -8
- package/src/sql/SqlModel.ts +4 -0
- package/src/testing/TestConsole.ts +119 -9
- package/src/testing/TestSchema.ts +8 -3
- package/src/workers/SharedMemory.ts +227 -0
- package/src/workers/Transferable.ts +1 -5
- package/src/workers/index.ts +6 -0
- package/src/workflow/Activity.ts +28 -4
- package/src/workflow/Workflow.ts +68 -44
- package/src/workflow/WorkflowEngine.ts +41 -16
- package/src/workflow/internal/retry.ts +12 -0
- package/src/workflow/internal/scope.ts +36 -0
- package/dist/http-api/internal/mediaType.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.d.ts +0 -2
- package/dist/internal/schema/toCodeDocument.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.js +0 -447
- package/dist/internal/schema/toCodeDocument.js.map +0 -1
- package/dist/observability/internal/protobuf.d.ts +0 -2
- package/dist/observability/internal/protobuf.d.ts.map +0 -1
- package/dist/observability/internal/protobuf.js +0 -169
- package/dist/observability/internal/protobuf.js.map +0 -1
- package/src/internal/schema/toCodeDocument.ts +0 -578
- package/src/observability/internal/protobuf.ts +0 -225
- /package/dist/{http-api → http}/internal/mediaType.d.ts +0 -0
package/src/reactivity/Atom.ts
CHANGED
|
@@ -20,7 +20,7 @@ import * as Effect from "../Effect.ts"
|
|
|
20
20
|
import * as Exit from "../Exit.ts"
|
|
21
21
|
import * as Fiber from "../Fiber.ts"
|
|
22
22
|
import type { LazyArg } from "../Function.ts"
|
|
23
|
-
import { constant, constTrue, constVoid, dual
|
|
23
|
+
import { constant, constTrue, constVoid, dual } from "../Function.ts"
|
|
24
24
|
import type * as Inspectable from "../Inspectable.ts"
|
|
25
25
|
import { PipeInspectableProto } from "../internal/core.ts"
|
|
26
26
|
import { getStackTraceLimit } from "../internal/stackTraceLimit.ts"
|
|
@@ -282,6 +282,9 @@ const RuntimeProto = {
|
|
|
282
282
|
return readable((get) => {
|
|
283
283
|
const previous = get.self<AsyncResult.AsyncResult<any, any>>()
|
|
284
284
|
const runtimeResult = get(this)
|
|
285
|
+
if (runtimeResult._tag === "Initial" && runtimeResult.waiting) {
|
|
286
|
+
return AsyncResult.waitingFrom(previous)
|
|
287
|
+
}
|
|
285
288
|
if (runtimeResult._tag !== "Success") {
|
|
286
289
|
return AsyncResult.replacePrevious(runtimeResult, previous)
|
|
287
290
|
}
|
|
@@ -1013,12 +1016,14 @@ function makeStream<A, E>(
|
|
|
1013
1016
|
}
|
|
1014
1017
|
services = Context.add(services, AtomRegistry, ctx.registry)
|
|
1015
1018
|
|
|
1019
|
+
let emitted = false
|
|
1016
1020
|
const run = Effect.scopedWith((scope) =>
|
|
1017
1021
|
Effect.flatMap(Channel.toPullScoped(stream.channel, scope), (pull) =>
|
|
1018
1022
|
Effect.whileLoop({
|
|
1019
1023
|
while: constTrue,
|
|
1020
1024
|
body: () => pull,
|
|
1021
1025
|
step(arr) {
|
|
1026
|
+
emitted = true
|
|
1022
1027
|
ctx.setSelf(AsyncResult.success(Arr.lastNonEmpty(arr), {
|
|
1023
1028
|
waiting: true
|
|
1024
1029
|
}))
|
|
@@ -1026,24 +1031,16 @@ function makeStream<A, E>(
|
|
|
1026
1031
|
}))
|
|
1027
1032
|
).pipe(
|
|
1028
1033
|
Effect.catchCause((cause) => {
|
|
1034
|
+
const current = ctx.self<AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>>()
|
|
1029
1035
|
if (Pull.isDoneCause(cause)) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
Option.
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
ctx.setSelf(
|
|
1036
|
-
AsyncResult.failWithPrevious(new Cause.NoSuchElementError(), {
|
|
1037
|
-
previous: ctx.self<AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>>()
|
|
1038
|
-
})
|
|
1039
|
-
),
|
|
1040
|
-
onSome: (a) => ctx.setSelf(AsyncResult.success(a))
|
|
1041
|
-
})
|
|
1036
|
+
const value = emitted ? Option.flatMap(current, AsyncResult.value) : Option.none()
|
|
1037
|
+
ctx.setSelf(
|
|
1038
|
+
Option.isSome(value)
|
|
1039
|
+
? AsyncResult.success(value.value)
|
|
1040
|
+
: AsyncResult.failWithPrevious(new Cause.NoSuchElementError(), { previous: current })
|
|
1042
1041
|
)
|
|
1043
1042
|
} else {
|
|
1044
|
-
ctx.setSelf(AsyncResult.failureWithPrevious(cause as Cause.Cause<E>, {
|
|
1045
|
-
previous: ctx.self<AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>>()
|
|
1046
|
-
}))
|
|
1043
|
+
ctx.setSelf(AsyncResult.failureWithPrevious(cause as Cause.Cause<E>, { previous: current }))
|
|
1047
1044
|
}
|
|
1048
1045
|
return Effect.void
|
|
1049
1046
|
})
|
|
@@ -1165,9 +1162,9 @@ const makeSubRef = (
|
|
|
1165
1162
|
function write(ctx: WriteContext<SubscriptionRef.SubscriptionRef<any>>, value: any) {
|
|
1166
1163
|
const ref = ctx.get(refAtom)
|
|
1167
1164
|
if (SubscriptionRef.isSubscriptionRef(ref)) {
|
|
1168
|
-
Effect.
|
|
1165
|
+
Effect.runFork(SubscriptionRef.set(ref, value))
|
|
1169
1166
|
} else if (AsyncResult.isSuccess(ref)) {
|
|
1170
|
-
Effect.
|
|
1167
|
+
Effect.runFork(SubscriptionRef.set(ref.value, value))
|
|
1171
1168
|
}
|
|
1172
1169
|
}
|
|
1173
1170
|
return writable((get) => {
|
|
@@ -1990,7 +1987,7 @@ function makeLabel(name: string, error: Error | undefined): readonly [name: stri
|
|
|
1990
1987
|
* refreshed or one of its dependencies changes. The factory and any wrappers
|
|
1991
1988
|
* still build, so `get(...)` calls in the factory and `withReactivity` keys are
|
|
1992
1989
|
* tracked; only the first effect or stream run is skipped. Dependencies read
|
|
1993
|
-
* inside the effect are tracked from its first real run. An `Initial` seed
|
|
1990
|
+
* inside the effect are tracked from its first real run. An `Initial` or waiting seed
|
|
1994
1991
|
* never skips the effect.
|
|
1995
1992
|
*
|
|
1996
1993
|
* @stability unstable
|
|
@@ -2150,6 +2147,8 @@ export const transform: {
|
|
|
2150
2147
|
readonly initialValueTarget?: Atom<B> | undefined
|
|
2151
2148
|
}
|
|
2152
2149
|
): Atom<B> => {
|
|
2150
|
+
// Forward through the registry so a serializable source resolves to its shared node.
|
|
2151
|
+
const refresh = (refresh: (atom: Atom<any>) => void) => refresh(self)
|
|
2153
2152
|
const atom = removeTtl(
|
|
2154
2153
|
isWritable(self)
|
|
2155
2154
|
? writable(
|
|
@@ -2157,15 +2156,11 @@ export const transform: {
|
|
|
2157
2156
|
function(ctx, value) {
|
|
2158
2157
|
ctx.set(self, value)
|
|
2159
2158
|
},
|
|
2160
|
-
|
|
2161
|
-
refresh(self)
|
|
2162
|
-
}
|
|
2159
|
+
refresh
|
|
2163
2160
|
)
|
|
2164
2161
|
: readable(
|
|
2165
2162
|
(get) => f(get, self),
|
|
2166
|
-
|
|
2167
|
-
refresh(self)
|
|
2168
|
-
}
|
|
2163
|
+
refresh
|
|
2169
2164
|
)
|
|
2170
2165
|
)
|
|
2171
2166
|
if (options?.initialValueTarget) {
|
|
@@ -2405,7 +2400,9 @@ export const withRefresh: {
|
|
|
2405
2400
|
* Skips revalidation if the source becomes fresh or the atom is disposed.
|
|
2406
2401
|
* Manual refreshes still forward to the source. `revalidateOnMount` controls
|
|
2407
2402
|
* initial stale refreshes; `revalidateOnFocus` controls focus refreshes
|
|
2408
|
-
* (`true` respects `staleTime`, `"always"` forces refresh).
|
|
2403
|
+
* (`true` respects `staleTime`, `"always"` forces refresh). Apply `swr` after
|
|
2404
|
+
* serialization and idle TTL so the source is retained and dehydrated, and
|
|
2405
|
+
* the wrapper checks freshness when mounted again.
|
|
2409
2406
|
*
|
|
2410
2407
|
* @stability unstable
|
|
2411
2408
|
* @category combinators
|
|
@@ -2421,7 +2418,9 @@ export const swr: {
|
|
|
2421
2418
|
* Skips revalidation if the source becomes fresh or the atom is disposed.
|
|
2422
2419
|
* Manual refreshes still forward to the source. `revalidateOnMount` controls
|
|
2423
2420
|
* initial stale refreshes; `revalidateOnFocus` controls focus refreshes
|
|
2424
|
-
* (`true` respects `staleTime`, `"always"` forces refresh).
|
|
2421
|
+
* (`true` respects `staleTime`, `"always"` forces refresh). Apply `swr` after
|
|
2422
|
+
* serialization and idle TTL so the source is retained and dehydrated, and
|
|
2423
|
+
* the wrapper checks freshness when mounted again.
|
|
2425
2424
|
*
|
|
2426
2425
|
* @stability unstable
|
|
2427
2426
|
* @category combinators
|
|
@@ -2444,7 +2443,9 @@ export const swr: {
|
|
|
2444
2443
|
* Skips revalidation if the source becomes fresh or the atom is disposed.
|
|
2445
2444
|
* Manual refreshes still forward to the source. `revalidateOnMount` controls
|
|
2446
2445
|
* initial stale refreshes; `revalidateOnFocus` controls focus refreshes
|
|
2447
|
-
* (`true` respects `staleTime`, `"always"` forces refresh).
|
|
2446
|
+
* (`true` respects `staleTime`, `"always"` forces refresh). Apply `swr` after
|
|
2447
|
+
* serialization and idle TTL so the source is retained and dehydrated, and
|
|
2448
|
+
* the wrapper checks freshness when mounted again.
|
|
2448
2449
|
*
|
|
2449
2450
|
* @stability unstable
|
|
2450
2451
|
* @category combinators
|
|
@@ -2842,18 +2843,26 @@ export const kvs = <S extends Schema.ConstraintCodec<any, any>, const Mode exten
|
|
|
2842
2843
|
readonly mode?: Mode | undefined
|
|
2843
2844
|
}): Writable<"async" extends Mode ? AsyncResult.AsyncResult<S["Type"]> : S["Type"], S["Type"]> => {
|
|
2844
2845
|
const setAtom = options.runtime.fn(
|
|
2845
|
-
(value: S["Type"]) =>
|
|
2846
|
+
(value: S["Type"], get) =>
|
|
2846
2847
|
KeyValueStore.KeyValueStore.use((store) =>
|
|
2847
|
-
|
|
2848
|
+
Effect.map(
|
|
2849
|
+
KeyValueStore.toSchemaStore(store, options.schema).set(options.key, value),
|
|
2850
|
+
() => get.set(persistedAtom, value)
|
|
2851
|
+
)
|
|
2848
2852
|
)
|
|
2849
2853
|
)
|
|
2850
2854
|
const resultAtom = options.runtime.atom(
|
|
2851
2855
|
KeyValueStore.KeyValueStore.use((store) => KeyValueStore.toSchemaStore(store, options.schema).get(options.key))
|
|
2852
2856
|
)
|
|
2857
|
+
const persistedAtom = writable(
|
|
2858
|
+
(get) => get(resultAtom),
|
|
2859
|
+
(ctx, value: S["Type"]) => ctx.setSelf(AsyncResult.success(Option.some(value)))
|
|
2860
|
+
)
|
|
2853
2861
|
return writable(
|
|
2854
2862
|
options.mode === "async" ?
|
|
2855
2863
|
(get) => {
|
|
2856
2864
|
get.mount(setAtom)
|
|
2865
|
+
get.mount(persistedAtom)
|
|
2857
2866
|
const mapper = AsyncResult.map<Option.Option<S["Type"]>, S["Type"]>(
|
|
2858
2867
|
Option.getOrElse(() => {
|
|
2859
2868
|
const value = options.defaultValue()
|
|
@@ -2862,11 +2871,12 @@ export const kvs = <S extends Schema.ConstraintCodec<any, any>, const Mode exten
|
|
|
2862
2871
|
})
|
|
2863
2872
|
)
|
|
2864
2873
|
get.subscribe(resultAtom, (result) => get.setSelf(mapper(result)))
|
|
2865
|
-
return mapper(get.once(
|
|
2874
|
+
return mapper(get.once(persistedAtom))
|
|
2866
2875
|
} :
|
|
2867
2876
|
(get) => {
|
|
2868
2877
|
get.mount(setAtom)
|
|
2869
|
-
get.
|
|
2878
|
+
get.mount(persistedAtom)
|
|
2879
|
+
const update = (result: AsyncResult.AsyncResult<Option.Option<S["Type"]>, unknown>) => {
|
|
2870
2880
|
if (!AsyncResult.isSuccess(result)) return
|
|
2871
2881
|
if (Option.isSome(result.value)) {
|
|
2872
2882
|
get.setSelf(result.value.value)
|
|
@@ -2875,7 +2885,9 @@ export const kvs = <S extends Schema.ConstraintCodec<any, any>, const Mode exten
|
|
|
2875
2885
|
get.setSelf(value)
|
|
2876
2886
|
get.set(setAtom, value)
|
|
2877
2887
|
}
|
|
2878
|
-
}
|
|
2888
|
+
}
|
|
2889
|
+
get.subscribe(resultAtom, update)
|
|
2890
|
+
update(get.once(persistedAtom))
|
|
2879
2891
|
return Option.getOrElse(get.self<S["Type"]>(), options.defaultValue)
|
|
2880
2892
|
},
|
|
2881
2893
|
(ctx, value: S["Type"]) => {
|
|
@@ -2923,11 +2935,16 @@ export const searchParam = <S extends Schema.ConstraintCodec<any, string> = neve
|
|
|
2923
2935
|
get.setSelf(newValue)
|
|
2924
2936
|
}
|
|
2925
2937
|
}
|
|
2938
|
+
searchParamState.readers++
|
|
2939
|
+
// Registered ahead of every reader, so stale writes are discarded before observers run.
|
|
2940
|
+
window.addEventListener("popstate", cancelSearchParamUpdates)
|
|
2926
2941
|
window.addEventListener("popstate", handleUpdate)
|
|
2927
2942
|
window.addEventListener("pushstate", handleUpdate)
|
|
2928
2943
|
get.addFinalizer(() => {
|
|
2929
2944
|
window.removeEventListener("popstate", handleUpdate)
|
|
2930
2945
|
window.removeEventListener("pushstate", handleUpdate)
|
|
2946
|
+
searchParamState.readers--
|
|
2947
|
+
releaseSearchParamCancel()
|
|
2931
2948
|
})
|
|
2932
2949
|
const value = new URLSearchParams(window.location.search).get(name) || ""
|
|
2933
2950
|
return decode ? Exit.getSuccess(decode(value)) : value as any
|
|
@@ -2945,11 +2962,12 @@ export const searchParam = <S extends Schema.ConstraintCodec<any, string> = neve
|
|
|
2945
2962
|
} else {
|
|
2946
2963
|
searchParamState.updates.set(name, value)
|
|
2947
2964
|
}
|
|
2948
|
-
|
|
2965
|
+
window.addEventListener("popstate", cancelSearchParamUpdates)
|
|
2949
2966
|
if (searchParamState.timeout) {
|
|
2950
2967
|
clearTimeout(searchParamState.timeout)
|
|
2951
2968
|
}
|
|
2952
2969
|
searchParamState.timeout = setTimeout(updateSearchParams, 500) as any
|
|
2970
|
+
ctx.setSelf(value)
|
|
2953
2971
|
}
|
|
2954
2972
|
)
|
|
2955
2973
|
}
|
|
@@ -2957,11 +2975,26 @@ export const searchParam = <S extends Schema.ConstraintCodec<any, string> = neve
|
|
|
2957
2975
|
const searchParamState = {
|
|
2958
2976
|
timeout: undefined as number | undefined,
|
|
2959
2977
|
updates: new Map<string, string>(),
|
|
2978
|
+
readers: 0,
|
|
2960
2979
|
updating: false
|
|
2961
2980
|
}
|
|
2962
2981
|
|
|
2982
|
+
function cancelSearchParamUpdates() {
|
|
2983
|
+
clearTimeout(searchParamState.timeout)
|
|
2984
|
+
searchParamState.timeout = undefined
|
|
2985
|
+
searchParamState.updates.clear()
|
|
2986
|
+
releaseSearchParamCancel()
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
function releaseSearchParamCancel() {
|
|
2990
|
+
if (searchParamState.readers === 0 && searchParamState.timeout === undefined) {
|
|
2991
|
+
window.removeEventListener("popstate", cancelSearchParamUpdates)
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2963
2995
|
function updateSearchParams() {
|
|
2964
2996
|
searchParamState.timeout = undefined
|
|
2997
|
+
releaseSearchParamCancel()
|
|
2965
2998
|
searchParamState.updating = true
|
|
2966
2999
|
const searchParams = new URLSearchParams(window.location.search)
|
|
2967
3000
|
for (const [key, value] of searchParamState.updates.entries()) {
|
|
@@ -88,6 +88,10 @@ export interface AtomHttpApiClient<Self, Id extends string, Groups extends HttpA
|
|
|
88
88
|
>
|
|
89
89
|
: never
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Queries an HTTP endpoint. When set, `staleTime` reuses fresh results on mount
|
|
93
|
+
* and revalidates stale results in the background. Use `timeToLive` to retain results across mounts.
|
|
94
|
+
*/
|
|
91
95
|
readonly query: <
|
|
92
96
|
GroupIdentifier extends HttpApiGroup.Identifier<Groups>,
|
|
93
97
|
EndpointIdentifier extends HttpApiEndpoint.Identifier<HttpApiGroup.Endpoints<Group>>,
|
|
@@ -116,6 +120,7 @@ export interface AtomHttpApiClient<Self, Id extends string, Groups extends HttpA
|
|
|
116
120
|
>
|
|
117
121
|
] ? HttpApiEndpoint.ClientRequest<_Params, _Query, _Payload, _Headers, ResponseMode> & {
|
|
118
122
|
readonly reactivityKeys?: Reactivity.KeysInput | undefined
|
|
123
|
+
readonly staleTime?: Duration.Input | undefined
|
|
119
124
|
readonly timeToLive?: Duration.Input | undefined
|
|
120
125
|
readonly serializationKey?: string | undefined
|
|
121
126
|
}
|
|
@@ -272,6 +277,7 @@ export const Service =
|
|
|
272
277
|
if (opts.responseMode === "decoded-only" && opts.serializationKey) {
|
|
273
278
|
const endpoint = groups[opts.group].endpoints[opts.endpoint]
|
|
274
279
|
atom = Atom.serializable(atom, {
|
|
280
|
+
skipInitialRun: opts.staleTime !== undefined,
|
|
275
281
|
key: `AtomHttpApi:${opts.group}:${opts.endpoint}:${opts.serializationKey}`,
|
|
276
282
|
schema: AsyncResult.Schema({
|
|
277
283
|
success: Schema.Union(HttpApiEndpoint.getSuccessSchemas(endpoint)),
|
|
@@ -284,7 +290,7 @@ export const Service =
|
|
|
284
290
|
? Atom.setIdleTTL(atom, opts.timeToLive)
|
|
285
291
|
: Atom.keepAlive(atom)
|
|
286
292
|
}
|
|
287
|
-
return atom
|
|
293
|
+
return opts.staleTime !== undefined ? Atom.swr(atom, { staleTime: opts.staleTime }) : atom
|
|
288
294
|
})
|
|
289
295
|
|
|
290
296
|
self.query = ((
|
|
@@ -298,6 +304,7 @@ export const Service =
|
|
|
298
304
|
readonly responseMode?: HttpApiEndpoint.ClientResponseMode
|
|
299
305
|
readonly sseOptions?: Sse.DecodeOptions | undefined
|
|
300
306
|
readonly reactivityKeys?: Reactivity.KeysInput | undefined
|
|
307
|
+
readonly staleTime?: Duration.Input | undefined
|
|
301
308
|
readonly timeToLive?: Duration.Input | undefined
|
|
302
309
|
readonly serializationKey?: string | undefined
|
|
303
310
|
}
|
|
@@ -312,6 +319,7 @@ export const Service =
|
|
|
312
319
|
responseMode: request.responseMode ?? "decoded-only",
|
|
313
320
|
sseOptions: request.sseOptions,
|
|
314
321
|
reactivityKeys: request.reactivityKeys,
|
|
322
|
+
staleTime: request.staleTime !== undefined ? Duration.fromInputUnsafe(request.staleTime) : undefined,
|
|
315
323
|
timeToLive: request.timeToLive !== undefined
|
|
316
324
|
? Duration.fromInputUnsafe(request.timeToLive)
|
|
317
325
|
: undefined,
|
|
@@ -339,6 +347,7 @@ interface QueryKey {
|
|
|
339
347
|
responseMode: HttpApiEndpoint.ClientResponseMode
|
|
340
348
|
reactivityKeys: Reactivity.KeysInput | undefined
|
|
341
349
|
sseOptions: Sse.DecodeOptions | undefined
|
|
350
|
+
staleTime: Duration.Duration | undefined
|
|
342
351
|
timeToLive: Duration.Duration | undefined
|
|
343
352
|
serializationKey: string | undefined
|
|
344
353
|
}
|
|
@@ -542,6 +542,8 @@ class RegistryImpl implements AtomRegistry {
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
refresh = <A>(atom: Atom.Atom<A>): void => {
|
|
545
|
+
// Readers of a serialization key share the first node, including its refresh target.
|
|
546
|
+
if (SerializableTypeId in atom) atom = this.ensureNode(atom).atom
|
|
545
547
|
if (atom.refresh !== undefined) {
|
|
546
548
|
atom.refresh(this.refresh)
|
|
547
549
|
} else {
|
|
@@ -628,6 +630,7 @@ class RegistryImpl implements AtomRegistry {
|
|
|
628
630
|
|
|
629
631
|
invalidateAtom = <A>(atom: Atom.Atom<A>): void => {
|
|
630
632
|
const node = this.ensureNode(atom)
|
|
633
|
+
if (node.skipInitialRun) node.preserveInitialValueOnBuild = false
|
|
631
634
|
node.skipInitialRun = false
|
|
632
635
|
node.invalidate()
|
|
633
636
|
}
|
|
@@ -872,6 +875,14 @@ class NodeImpl<A> {
|
|
|
872
875
|
}
|
|
873
876
|
}
|
|
874
877
|
if (this.lifetime === lifetime && (this.state & NodeFlags.waitingForValue) !== 0) {
|
|
878
|
+
if (
|
|
879
|
+
this.skipInitialRun && Result.isAsyncResult(this._value) && this._value.waiting &&
|
|
880
|
+
Result.isAsyncResult(value) && Result.isFailure(value)
|
|
881
|
+
) {
|
|
882
|
+
// Runtime acquisition can fail before the effect consumes its seed.
|
|
883
|
+
this.preserveInitialValueOnBuild = false
|
|
884
|
+
this.skipInitialRun = false
|
|
885
|
+
}
|
|
875
886
|
if (this.preserveInitialValueOnBuild) {
|
|
876
887
|
this.preserveInitialValueOnBuild = false
|
|
877
888
|
if (this.skipInitialRun) {
|
|
@@ -1127,6 +1138,11 @@ export const consumeSkipInitialRun = (ctx: Atom.AtomContext): boolean => {
|
|
|
1127
1138
|
const keptParents = node.keptParents
|
|
1128
1139
|
node.skipInitialRun = false
|
|
1129
1140
|
node.keptParents = undefined
|
|
1141
|
+
if (node._value.waiting) {
|
|
1142
|
+
// No local request owns the seed; commit the replacement even if it completes synchronously.
|
|
1143
|
+
node.preserveInitialValueOnBuild = false
|
|
1144
|
+
return false
|
|
1145
|
+
}
|
|
1130
1146
|
return !lifetime.isFn && !Result.isInitial(node._value) &&
|
|
1131
1147
|
(keptParents === undefined || keptParents.every(([parent, lifetime]) => parent.lifetime === lifetime))
|
|
1132
1148
|
}
|
|
@@ -56,12 +56,17 @@ export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any> ex
|
|
|
56
56
|
|
|
57
57
|
readonly mutation: <Tag extends Rpc.Tag<Rpcs>>(arg: Tag) => Mutation<Rpc.ExtractTag<Rpcs, Tag>>
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Queries an RPC. For non-stream RPCs, `staleTime` reuses fresh results on mount
|
|
61
|
+
* and revalidates stale results in the background. Use `timeToLive` to retain results across mounts.
|
|
62
|
+
*/
|
|
59
63
|
readonly query: <Tag extends Rpc.Tag<Rpcs>>(
|
|
60
64
|
tag: Tag,
|
|
61
65
|
payload: Rpc.PayloadConstructor<Rpc.ExtractTag<Rpcs, Tag>>,
|
|
62
66
|
options?: {
|
|
63
67
|
readonly headers?: Headers.Input | undefined
|
|
64
68
|
readonly reactivityKeys?: Reactivity.KeysInput | undefined
|
|
69
|
+
readonly staleTime?: Duration.Input | undefined
|
|
65
70
|
readonly timeToLive?: Duration.Input | undefined
|
|
66
71
|
readonly serializationKey?: string | undefined
|
|
67
72
|
}
|
|
@@ -244,11 +249,13 @@ export const Service = <Self>() =>
|
|
|
244
249
|
: self.runtime.atom(
|
|
245
250
|
self.use((client) => client(tag, payload, { headers } as any)) as any
|
|
246
251
|
)
|
|
252
|
+
const staleTime = isStream ? undefined : key.staleTime
|
|
247
253
|
if (reactivityKeys) {
|
|
248
254
|
atom = self.runtime.factory.withReactivity(reactivityKeys)(atom)
|
|
249
255
|
}
|
|
250
256
|
if (!isStream && key.serializationKey) {
|
|
251
257
|
atom = Atom.serializable(atom, {
|
|
258
|
+
skipInitialRun: staleTime !== undefined,
|
|
252
259
|
key: `AtomRpc:${key.tag}:${key.serializationKey}`,
|
|
253
260
|
schema: AsyncResult.Schema({
|
|
254
261
|
success: rpc.successSchema,
|
|
@@ -261,7 +268,7 @@ export const Service = <Self>() =>
|
|
|
261
268
|
? Atom.setIdleTTL(atom, timeToLive)
|
|
262
269
|
: Atom.keepAlive(atom)
|
|
263
270
|
}
|
|
264
|
-
return atom
|
|
271
|
+
return staleTime !== undefined ? Atom.swr(atom, { staleTime }) : atom
|
|
265
272
|
}
|
|
266
273
|
)
|
|
267
274
|
|
|
@@ -271,6 +278,7 @@ export const Service = <Self>() =>
|
|
|
271
278
|
options?: {
|
|
272
279
|
readonly headers?: Headers.Input | undefined
|
|
273
280
|
readonly reactivityKeys?: Reactivity.KeysInput | undefined
|
|
281
|
+
readonly staleTime?: Duration.Input | undefined
|
|
274
282
|
readonly timeToLive?: Duration.Input | undefined
|
|
275
283
|
readonly serializationKey?: string | undefined
|
|
276
284
|
}
|
|
@@ -282,6 +290,7 @@ export const Service = <Self>() =>
|
|
|
282
290
|
? Headers.fromInput(options.headers)
|
|
283
291
|
: undefined,
|
|
284
292
|
reactivityKeys: options?.reactivityKeys,
|
|
293
|
+
staleTime: options?.staleTime !== undefined ? Duration.fromInputUnsafe(options.staleTime) : undefined,
|
|
285
294
|
timeToLive: options?.timeToLive !== undefined
|
|
286
295
|
? Duration.fromInputUnsafe(options.timeToLive)
|
|
287
296
|
: undefined,
|
|
@@ -298,6 +307,7 @@ interface QueryKey {
|
|
|
298
307
|
payload: any
|
|
299
308
|
headers: Headers.Headers | undefined
|
|
300
309
|
reactivityKeys: Reactivity.KeysInput | undefined
|
|
310
|
+
staleTime: Duration.Duration | undefined
|
|
301
311
|
timeToLive: Duration.Duration | undefined
|
|
302
312
|
serializationKey: string | undefined
|
|
303
313
|
}
|
package/src/rpc/Rpc.ts
CHANGED
|
@@ -26,6 +26,7 @@ import * as Schema from "../Schema.ts"
|
|
|
26
26
|
import * as SchemaAST from "../SchemaAST.ts"
|
|
27
27
|
import type { Stream } from "../Stream.ts"
|
|
28
28
|
import type * as Struct from "../Struct.ts"
|
|
29
|
+
import type * as Tracer from "../Tracer.ts"
|
|
29
30
|
import type { NoInfer } from "../Types.ts"
|
|
30
31
|
import type { RequestId } from "./RpcMessage.ts"
|
|
31
32
|
import type * as RpcMiddleware from "./RpcMiddleware.ts"
|
|
@@ -224,6 +225,10 @@ export interface Handler<Tag extends string> {
|
|
|
224
225
|
readonly handler: (request: any, options: {
|
|
225
226
|
readonly client: ServerClient
|
|
226
227
|
readonly requestId: RequestId
|
|
228
|
+
/**
|
|
229
|
+
* The span sent by the client, or `undefined` when no span was propagated.
|
|
230
|
+
*/
|
|
231
|
+
readonly remoteParentSpan: Tracer.ExternalSpan | undefined
|
|
227
232
|
readonly headers: Headers
|
|
228
233
|
readonly rpc: Any
|
|
229
234
|
}) => Effect<{} | Deferred<any, any>, any> | Stream<any, any>
|
|
@@ -666,6 +671,10 @@ export type ToHandlerFn<Current extends Any, R = any> = (
|
|
|
666
671
|
options: {
|
|
667
672
|
readonly client: ServerClient
|
|
668
673
|
readonly requestId: RequestId
|
|
674
|
+
/**
|
|
675
|
+
* The span sent by the client, or `undefined` when no span was propagated.
|
|
676
|
+
*/
|
|
677
|
+
readonly remoteParentSpan: Tracer.ExternalSpan | undefined
|
|
669
678
|
readonly headers: Headers
|
|
670
679
|
readonly rpc: Current
|
|
671
680
|
}
|
|
@@ -1249,6 +1258,28 @@ export const ParseOptions = Context.Reference<SchemaAST.ParseOptions>("effect/rp
|
|
|
1249
1258
|
defaultValue: () => SchemaAST.defaultParseOptions
|
|
1250
1259
|
})
|
|
1251
1260
|
|
|
1261
|
+
/**
|
|
1262
|
+
* Annotation that selects which sides create automatic spans for an RPC:
|
|
1263
|
+
* `"client"`, `"server"`, `"both"` (the default), or `"none"`.
|
|
1264
|
+
*
|
|
1265
|
+
* **Details**
|
|
1266
|
+
*
|
|
1267
|
+
* When the annotation disables the client span, the client can still propagate
|
|
1268
|
+
* its caller's span. A client's or server's `disableTracing: true` option
|
|
1269
|
+
* overrides this annotation on that side; a globally disabled client does not
|
|
1270
|
+
* propagate a span.
|
|
1271
|
+
*
|
|
1272
|
+
* @stability unstable
|
|
1273
|
+
* @category annotations
|
|
1274
|
+
* @since 4.1.5
|
|
1275
|
+
*/
|
|
1276
|
+
export const TracingEnabled = Context.Reference<"client" | "server" | "both" | "none">(
|
|
1277
|
+
"effect/rpc/Rpc/TracingEnabled",
|
|
1278
|
+
{
|
|
1279
|
+
defaultValue: () => "both"
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
|
|
1252
1283
|
const WrapperTypeId = "~effect/rpc/Rpc/Wrapper"
|
|
1253
1284
|
|
|
1254
1285
|
/**
|
package/src/rpc/RpcClient.ts
CHANGED
|
@@ -40,7 +40,7 @@ import * as Scope from "../Scope.ts"
|
|
|
40
40
|
import * as Socket from "../socket/Socket.ts"
|
|
41
41
|
import * as Stream from "../Stream.ts"
|
|
42
42
|
import type * as Struct from "../Struct.ts"
|
|
43
|
-
import
|
|
43
|
+
import * as Tracer from "../Tracer.ts"
|
|
44
44
|
import * as Transferable from "../workers/Transferable.ts"
|
|
45
45
|
import * as Worker from "../workers/Worker.ts"
|
|
46
46
|
import type { WorkerError } from "../workers/WorkerError.ts"
|
|
@@ -303,9 +303,18 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
303
303
|
}
|
|
304
304
|
}, Effect.uninterruptible)
|
|
305
305
|
|
|
306
|
+
const traceFields = (fiber: Fiber.Fiber<unknown, unknown>, clientSpan: Tracer.Span | undefined) => {
|
|
307
|
+
if (disableTracing || !fiber.cache.tracerEnabled || fiber.getRef(Tracer.DisablePropagation)) return undefined
|
|
308
|
+
const span = clientSpan ?? fiber.cache.span
|
|
309
|
+
if (!span || Context.get(span.annotations, Tracer.DisablePropagation)) return undefined
|
|
310
|
+
return { traceId: span.traceId, spanId: span.spanId, sampled: span.sampled }
|
|
311
|
+
}
|
|
312
|
+
|
|
306
313
|
const onRequest = (rpc: Rpc.AnyWithProps) => {
|
|
307
314
|
const isStream = RpcSchema.isStreamSchema(rpc.successSchema)
|
|
308
315
|
const middleware = getRpcClientMiddleware(rpc)
|
|
316
|
+
const tracing = Context.get(rpc.annotations, Rpc.TracingEnabled)
|
|
317
|
+
const createSpan = !disableTracing && (tracing === "both" || tracing === "client")
|
|
309
318
|
return (payload: any, opts?: {
|
|
310
319
|
readonly asQueue?: boolean | undefined
|
|
311
320
|
readonly streamBufferSize?: number | undefined
|
|
@@ -316,7 +325,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
316
325
|
const headers = opts?.headers ? Headers.fromInput(opts.headers) : Headers.empty
|
|
317
326
|
const context = opts?.context ?? Context.empty()
|
|
318
327
|
if (!isStream) {
|
|
319
|
-
const onRequest = (span: Span | undefined) =>
|
|
328
|
+
const onRequest = (span: Tracer.Span | undefined) =>
|
|
320
329
|
onEffectRequest(
|
|
321
330
|
rpc,
|
|
322
331
|
middleware,
|
|
@@ -326,7 +335,8 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
326
335
|
context,
|
|
327
336
|
opts?.discard ?? false
|
|
328
337
|
)
|
|
329
|
-
|
|
338
|
+
if (!createSpan) return onRequest(undefined)
|
|
339
|
+
return Effect.useSpan(
|
|
330
340
|
RpcTracing.spanName(spanPrefix, rpc._tag),
|
|
331
341
|
{ kind: "client", attributes: RpcTracing.spanAttributes(rpc._tag, options.spanAttributes) },
|
|
332
342
|
onRequest
|
|
@@ -334,6 +344,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
334
344
|
}
|
|
335
345
|
const queue = onStreamRequest(
|
|
336
346
|
rpc,
|
|
347
|
+
createSpan,
|
|
337
348
|
middleware,
|
|
338
349
|
rpc.payloadSchema.make(payload),
|
|
339
350
|
headers,
|
|
@@ -351,7 +362,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
351
362
|
send: (request: Request<Rpcs>) => Effect.Effect<any, E>,
|
|
352
363
|
request: Request<Rpcs>
|
|
353
364
|
) => Effect.Effect<any, E>,
|
|
354
|
-
span: Span | undefined,
|
|
365
|
+
span: Tracer.Span | undefined,
|
|
355
366
|
payload: any,
|
|
356
367
|
headers: Headers.Headers,
|
|
357
368
|
context: Context.Context<never>,
|
|
@@ -369,13 +380,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
369
380
|
id,
|
|
370
381
|
tag: rpc._tag as Rpc.Tag<Rpcs>,
|
|
371
382
|
payload,
|
|
372
|
-
...(span
|
|
373
|
-
{
|
|
374
|
-
traceId: span.traceId,
|
|
375
|
-
spanId: span.spanId,
|
|
376
|
-
sampled: span.sampled
|
|
377
|
-
} :
|
|
378
|
-
{}),
|
|
383
|
+
...traceFields(parentFiber, span),
|
|
379
384
|
headers: Headers.merge(parentFiber.getRef(CurrentHeaders), headers),
|
|
380
385
|
...(discard ? { discard: true as const } : {})
|
|
381
386
|
}
|
|
@@ -431,6 +436,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
431
436
|
|
|
432
437
|
const onStreamRequest = Effect.fnUntraced(function*(
|
|
433
438
|
rpc: Rpc.AnyWithProps,
|
|
439
|
+
createSpan: boolean,
|
|
434
440
|
middleware: (
|
|
435
441
|
send: (request: Request<Rpcs>) => Effect.Effect<any, E>,
|
|
436
442
|
request: Request<Rpcs>
|
|
@@ -444,7 +450,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
444
450
|
return yield* Effect.interrupt
|
|
445
451
|
}
|
|
446
452
|
|
|
447
|
-
const span =
|
|
453
|
+
const span = !createSpan ? undefined : yield* Effect.makeSpanScoped(
|
|
448
454
|
RpcTracing.spanName(spanPrefix, rpc._tag),
|
|
449
455
|
{ kind: "client", attributes: RpcTracing.spanAttributes(rpc._tag, options.spanAttributes) }
|
|
450
456
|
)
|
|
@@ -484,13 +490,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any, E, const Flatten extend
|
|
|
484
490
|
id,
|
|
485
491
|
tag: rpc._tag as Rpc.Tag<Rpcs>,
|
|
486
492
|
payload,
|
|
487
|
-
...(span
|
|
488
|
-
{
|
|
489
|
-
traceId: span.traceId,
|
|
490
|
-
spanId: span.spanId,
|
|
491
|
-
sampled: span.sampled
|
|
492
|
-
} :
|
|
493
|
-
{}),
|
|
493
|
+
...traceFields(fiber, span),
|
|
494
494
|
headers: Headers.merge(fiber.getRef(CurrentHeaders), headers)
|
|
495
495
|
}
|
|
496
496
|
).pipe(
|
|
@@ -656,6 +656,7 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
|
|
|
656
656
|
readonly flatten?: Flatten | undefined
|
|
657
657
|
} | undefined
|
|
658
658
|
) {
|
|
659
|
+
const scope = yield* Effect.scope
|
|
659
660
|
const clientId = clientIdCounter++
|
|
660
661
|
const { codecFor, run, send, supportsAck, supportsTransferables } = yield* Protocol
|
|
661
662
|
const rpcSchemas = makeRpcSchemas(codecFor)
|
|
@@ -750,7 +751,13 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
|
|
|
750
751
|
decodeChunk(message.values).pipe(
|
|
751
752
|
Effect.provideContext(entry.context),
|
|
752
753
|
Effect.orDie,
|
|
753
|
-
Effect.flatMap((chunk) =>
|
|
754
|
+
Effect.flatMap((chunk) => {
|
|
755
|
+
const deliver = write({ _tag: "Chunk", clientId: 0, requestId, values: chunk })
|
|
756
|
+
// The server waits for each chunk's Ack, so a chunk waiting for
|
|
757
|
+
// buffer space must not block other responses on this
|
|
758
|
+
// connection. Starting immediately keeps it ahead of the Exit.
|
|
759
|
+
return supportsAck ? Effect.forkIn(deliver, scope, { startImmediately: true }) : deliver
|
|
760
|
+
})
|
|
754
761
|
)
|
|
755
762
|
).pipe(
|
|
756
763
|
Effect.onError((cause) =>
|
|
@@ -1003,6 +1010,31 @@ const makeProtocolHttpUnbatched = (client: HttpClient.HttpClient) =>
|
|
|
1003
1010
|
}
|
|
1004
1011
|
}))
|
|
1005
1012
|
|
|
1013
|
+
const withBatchSpan = <A, E, R>(effect: Effect.Effect<A, E, R>, requests: ReadonlyArray<RequestEncoded>) => {
|
|
1014
|
+
const links: Array<Tracer.SpanLink> = []
|
|
1015
|
+
const seen = new Set<string>()
|
|
1016
|
+
let sampled = false
|
|
1017
|
+
for (const request of requests) {
|
|
1018
|
+
if (request.traceId === undefined || request.spanId === undefined || seen.has(request.spanId)) continue
|
|
1019
|
+
seen.add(request.spanId)
|
|
1020
|
+
const span = Tracer.externalSpan({ traceId: request.traceId, spanId: request.spanId, sampled: request.sampled })
|
|
1021
|
+
sampled ||= span.sampled
|
|
1022
|
+
links.push({ span, attributes: {} })
|
|
1023
|
+
}
|
|
1024
|
+
if (links.length === 0) return effect
|
|
1025
|
+
return Effect.withSpan(effect, "RpcClient.batch", {
|
|
1026
|
+
root: true,
|
|
1027
|
+
sampled,
|
|
1028
|
+
links,
|
|
1029
|
+
attributes: { batchSize: requests.length },
|
|
1030
|
+
captureStackTrace: false
|
|
1031
|
+
}).pipe(
|
|
1032
|
+
// Do not let the opener's tracing settings suppress tracing for other callers.
|
|
1033
|
+
Effect.provideService(Tracer.DisablePropagation, false),
|
|
1034
|
+
Effect.withTracerEnabled(true)
|
|
1035
|
+
)
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1006
1038
|
const makeProtocolHttpBatched = Effect.fnUntraced(function*(client: HttpClient.HttpClient, options: {
|
|
1007
1039
|
readonly window: Duration.Input
|
|
1008
1040
|
readonly maxSize?: number | undefined
|
|
@@ -1040,7 +1072,7 @@ const makeProtocolHttpBatched = Effect.fnUntraced(function*(client: HttpClient.H
|
|
|
1040
1072
|
Effect.raceFirst(Effect.sleep(window), batch.full.await).pipe(
|
|
1041
1073
|
Effect.andThen(Effect.suspend(() => {
|
|
1042
1074
|
closeBatch(clientId, batch)
|
|
1043
|
-
return exchange.send(clientId, batch.requests)
|
|
1075
|
+
return withBatchSpan(exchange.send(clientId, batch.requests), batch.requests)
|
|
1044
1076
|
})),
|
|
1045
1077
|
Effect.onExit((exit) => {
|
|
1046
1078
|
closeBatch(clientId, batch)
|
|
@@ -1403,7 +1435,9 @@ export const makeProtocolSocket = (options?: {
|
|
|
1403
1435
|
const write = (request: FromClientEncoded) =>
|
|
1404
1436
|
Effect.suspend(() => {
|
|
1405
1437
|
const encoded = parser.encode(request)
|
|
1406
|
-
return encoded === undefined
|
|
1438
|
+
return encoded === undefined
|
|
1439
|
+
? Effect.void
|
|
1440
|
+
: Effect.mapError(writer.write(encoded), (error) => new RpcClientError({ reason: error.reason }))
|
|
1407
1441
|
})
|
|
1408
1442
|
|
|
1409
1443
|
return {
|