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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type * as Schema from "../../Schema.ts"
|
|
2
|
+
import * as SchemaAST from "../../SchemaAST.ts"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns the wire keys of a params, query or headers schema whose values hold
|
|
6
|
+
* a `Redacted`, or `undefined` when a `Redacted` is present but the wire keys
|
|
7
|
+
* are unknown, so the caller redacts everything.
|
|
8
|
+
*
|
|
9
|
+
* Keys are only known for a struct whose keys are encoded as is.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export const getRedactedKeys = (schema: Schema.Top | undefined): ReadonlyArray<string> | undefined => {
|
|
14
|
+
if (schema === undefined) return []
|
|
15
|
+
const ast = schema.ast
|
|
16
|
+
if (!SchemaAST.isObjects(ast) || ast.encoding !== undefined) return hasRedacted(ast, new Set()) ? undefined : []
|
|
17
|
+
if (ast.indexSignatures.some((is) => hasRedacted(is.type, new Set()))) return undefined
|
|
18
|
+
return ast.propertySignatures.filter((ps) => hasRedacted(ps.type, new Set())).map((ps) => String(ps.name))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const hasRedacted = (ast: SchemaAST.AST, seen: Set<SchemaAST.AST>): boolean => {
|
|
22
|
+
const go = (ast: SchemaAST.AST) => hasRedacted(ast, seen)
|
|
23
|
+
switch (ast._tag) {
|
|
24
|
+
case "Declaration":
|
|
25
|
+
return (ast.annotations as Schema.Annotations.Declaration<unknown, readonly []> | undefined)?.representation
|
|
26
|
+
?.id === "effect/schema/Redacted" || ast.typeParameters.some(go)
|
|
27
|
+
case "Objects":
|
|
28
|
+
return ast.propertySignatures.some((ps) => go(ps.type)) || ast.indexSignatures.some((is) => go(is.type))
|
|
29
|
+
case "Union":
|
|
30
|
+
return ast.types.some(go)
|
|
31
|
+
case "Arrays":
|
|
32
|
+
return ast.elements.some(go) || ast.rest.some(go)
|
|
33
|
+
case "Suspend":
|
|
34
|
+
if (seen.has(ast)) return false
|
|
35
|
+
seen.add(ast)
|
|
36
|
+
return go(ast.thunk())
|
|
37
|
+
default:
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -128,6 +128,12 @@ export * as Chunk from "./Chunk.ts"
|
|
|
128
128
|
*/
|
|
129
129
|
export * as Clock from "./Clock.ts"
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @stability experimental
|
|
133
|
+
* @since 4.1.5
|
|
134
|
+
*/
|
|
135
|
+
export * as Codegen from "./Codegen.ts"
|
|
136
|
+
|
|
131
137
|
/**
|
|
132
138
|
* @stability stable
|
|
133
139
|
* @since 4.0.0
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GenerationDiagnostic } from "../../Arbitrary.ts"
|
|
1
2
|
import * as Cause from "../../Cause.ts"
|
|
2
3
|
import * as Effect from "../../Effect.ts"
|
|
3
4
|
import * as Option from "../../Option.ts"
|
|
@@ -64,6 +65,8 @@ export interface GenerationState {
|
|
|
64
65
|
readonly biasFactor: number
|
|
65
66
|
readonly nullPrototype: boolean
|
|
66
67
|
readonly random: GenerationRandom
|
|
68
|
+
readonly diagnostics: Array<GenerationDiagnostic> | undefined
|
|
69
|
+
readonly diagnosticPath: ReadonlyArray<PropertyKey>
|
|
67
70
|
readonly budget: {
|
|
68
71
|
remaining: number
|
|
69
72
|
}
|
|
@@ -238,15 +241,6 @@ export function mapAttempt<A, B>(self: Attempt<A>, f: (sample: Sample<A>) => Sam
|
|
|
238
241
|
return self._tag === "Discarded" ? self : f(self)
|
|
239
242
|
}
|
|
240
243
|
|
|
241
|
-
/** @internal */
|
|
242
|
-
export function sampleFromShrink<A>(value: A, shrink: (value: A) => ReadonlyArray<A>): Sample<A> {
|
|
243
|
-
const values = shrink(value)
|
|
244
|
-
return makeSample(
|
|
245
|
-
value,
|
|
246
|
-
values.length === 0 ? undefined : Effect.map(pullFromArray(values), (value) => sampleFromShrink(value, shrink))
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
244
|
/** @internal */
|
|
251
245
|
export function sampleFromValidatedShrink<A>(
|
|
252
246
|
value: A,
|
|
@@ -48,6 +48,7 @@ export interface Compiled {
|
|
|
48
48
|
maximumLength: number
|
|
49
49
|
) => string | undefined
|
|
50
50
|
readonly shrink: (value: string, minimumLength: number) => ReadonlyArray<string>
|
|
51
|
+
readonly test: (value: string) => boolean
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const empty: Literal = { _tag: "Literal", value: "" }
|
|
@@ -850,6 +851,7 @@ export function compile(pattern: Pattern): Compiled | undefined {
|
|
|
850
851
|
const value = generateExact(node, candidates[offset], state, cache)
|
|
851
852
|
return value !== undefined && test(regExp, value) ? value : undefined
|
|
852
853
|
},
|
|
853
|
-
shrink: (value, minimumLength) => structuralShrinks(node, regExp, value, minimumLength, cache)
|
|
854
|
+
shrink: (value, minimumLength) => structuralShrinks(node, regExp, value, minimumLength, cache),
|
|
855
|
+
test: (value) => test(regExp, value)
|
|
854
856
|
}
|
|
855
857
|
}
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
CheckOptions,
|
|
5
5
|
CheckResult,
|
|
6
6
|
Exhausted,
|
|
7
|
+
GenerationDiagnostic,
|
|
7
8
|
GlobalOptions,
|
|
8
9
|
Passed,
|
|
9
10
|
PropertyError,
|
|
@@ -192,12 +193,15 @@ const generateAttemptRaw = <A>(
|
|
|
192
193
|
seed: SeedState,
|
|
193
194
|
attempt: number,
|
|
194
195
|
size: number,
|
|
195
|
-
shrinks: boolean
|
|
196
|
+
shrinks: boolean,
|
|
197
|
+
diagnostics?: Array<GenerationDiagnostic>
|
|
196
198
|
): Model.Generation<A> => {
|
|
197
199
|
const biasFactor = 2 + Math.floor(Math.log10(attempt + 1))
|
|
198
200
|
return generator.generate({
|
|
199
201
|
size,
|
|
200
202
|
shrinks,
|
|
203
|
+
diagnostics,
|
|
204
|
+
diagnosticPath: [],
|
|
201
205
|
// This is fast-check v4.9.0's run-dependent numeric bias schedule (MIT). It makes short checks edge-heavy while
|
|
202
206
|
// progressively dedicating more attempts to the complete domain, without becoming part of the public API.
|
|
203
207
|
// https://github.com/dubzzz/fast-check/blob/v4.9.0/packages/fast-check/src/check/property/IRawProperty.ts#L92-L95
|
|
@@ -213,9 +217,10 @@ const generateAttempt = <A>(
|
|
|
213
217
|
seed: SeedState,
|
|
214
218
|
attempt: number,
|
|
215
219
|
size: number,
|
|
216
|
-
shrinks: boolean
|
|
220
|
+
shrinks: boolean,
|
|
221
|
+
diagnostics?: Array<GenerationDiagnostic>
|
|
217
222
|
): Effect.Effect<Model.Attempt<A>> =>
|
|
218
|
-
Model.toEffectGeneration(generateAttemptRaw(generator, seed, attempt, size, shrinks))
|
|
223
|
+
Model.toEffectGeneration(generateAttemptRaw(generator, seed, attempt, size, shrinks, diagnostics))
|
|
219
224
|
|
|
220
225
|
const resolveMasterSeed = (seed: string | number | undefined): Effect.Effect<string | number> =>
|
|
221
226
|
seed === undefined ? Random.nextInt : Effect.succeed(seed)
|
|
@@ -331,11 +336,13 @@ export function array<A>(item: Arbitrary<A>, options?: ArrayOptions): Arbitrary<
|
|
|
331
336
|
|
|
332
337
|
/** @internal */
|
|
333
338
|
export function all(
|
|
334
|
-
input: Iterable<Arbitrary<any>> | Record<
|
|
339
|
+
input: Iterable<Arbitrary<any>> | Record<PropertyKey, Arbitrary<any>>
|
|
335
340
|
): Arbitrary<any> {
|
|
336
341
|
const iterable = Symbol.iterator in input
|
|
337
|
-
const keys = iterable ? undefined :
|
|
338
|
-
const members = iterable
|
|
342
|
+
const keys = iterable ? undefined : InternalRecord.ownEnumerableKeys(input)
|
|
343
|
+
const members = iterable
|
|
344
|
+
? Array.from(input as Iterable<Arbitrary<any>>)
|
|
345
|
+
: keys!.map((key) => (input as Record<PropertyKey, Arbitrary<any>>)[key])
|
|
339
346
|
const generators = members.map((member) => member.gen)
|
|
340
347
|
let minCost = 0
|
|
341
348
|
for (let index = 0; index < generators.length; index++) minCost += generators[index].minCost
|
|
@@ -368,10 +375,7 @@ function makeGenerationState(
|
|
|
368
375
|
remaining: number
|
|
369
376
|
): Model.GenerationState {
|
|
370
377
|
return {
|
|
371
|
-
|
|
372
|
-
shrinks: state.shrinks,
|
|
373
|
-
biasFactor: state.biasFactor,
|
|
374
|
-
nullPrototype: state.nullPrototype,
|
|
378
|
+
...state,
|
|
375
379
|
random,
|
|
376
380
|
budget: { remaining }
|
|
377
381
|
}
|
|
@@ -482,16 +486,23 @@ export const sampleEffect = Effect.fnUntraced(function*<A>(self: Arbitrary<A>, o
|
|
|
482
486
|
const seed = yield* resolveMasterSeed(seedOption)
|
|
483
487
|
const seedState = hashSeed(seed)
|
|
484
488
|
const values: Array<A> = []
|
|
489
|
+
const diagnostics: Array<GenerationDiagnostic> = []
|
|
485
490
|
let discards = 0
|
|
486
491
|
let attemptIndex = 0
|
|
487
492
|
let attemptsSinceYield = 0
|
|
488
493
|
while (values.length < count) {
|
|
489
|
-
const generated = generateAttemptRaw(self.gen, seedState, attemptIndex++, size, false)
|
|
494
|
+
const generated = generateAttemptRaw(self.gen, seedState, attemptIndex++, size, false, diagnostics)
|
|
490
495
|
const attempt = Model.isAttempt(generated) ? generated : yield* generated
|
|
491
496
|
if (attempt._tag === "Generated") {
|
|
492
497
|
values.push(attempt.value)
|
|
493
498
|
} else if (++discards > maxDiscards) {
|
|
494
|
-
const error: SampleError = {
|
|
499
|
+
const error: SampleError = {
|
|
500
|
+
_tag: "SampleError",
|
|
501
|
+
generated: values.length,
|
|
502
|
+
discards,
|
|
503
|
+
seed,
|
|
504
|
+
diagnostics: diagnostics.slice()
|
|
505
|
+
}
|
|
495
506
|
return yield* Effect.fail(error)
|
|
496
507
|
}
|
|
497
508
|
if (++attemptsSinceYield >= maxOpsBeforeYield) {
|
|
@@ -615,6 +626,7 @@ type SearchResult<A, E> = Passed | Exhausted | Found<A, E>
|
|
|
615
626
|
// This gives both search strategies the sequential seed and size schedule, independently of evaluation timing.
|
|
616
627
|
const makeSearch = <A>(self: Arbitrary<A>, options: SearchOptions) => {
|
|
617
628
|
const seed = hashSeed(options.seed)
|
|
629
|
+
const diagnostics: Array<GenerationDiagnostic> = []
|
|
618
630
|
let runs = 0
|
|
619
631
|
let discards = 0
|
|
620
632
|
let attemptIndex = 0
|
|
@@ -622,11 +634,13 @@ const makeSearch = <A>(self: Arbitrary<A>, options: SearchOptions) => {
|
|
|
622
634
|
const size = options.runs === 1 ? options.size : Math.round(runs * options.size / (options.runs - 1))
|
|
623
635
|
while (true) {
|
|
624
636
|
const index = attemptIndex++
|
|
625
|
-
const sample = yield* generateAttempt(self.gen, seed, index, size, true)
|
|
637
|
+
const sample = yield* generateAttempt(self.gen, seed, index, size, true, diagnostics)
|
|
626
638
|
if (sample._tag === "Generated") {
|
|
627
639
|
return { sample, attempt: index, size, runs: ++runs, discards }
|
|
628
640
|
}
|
|
629
|
-
if (++discards > options.maxDiscards)
|
|
641
|
+
if (++discards > options.maxDiscards) {
|
|
642
|
+
return { _tag: "Exhausted", runs, discards, seed: options.seed, diagnostics: diagnostics.slice() }
|
|
643
|
+
}
|
|
630
644
|
if (options.maxOpsBeforeYield <= 1 || discards % options.maxOpsBeforeYield === 0) yield* Effect.yieldNow
|
|
631
645
|
}
|
|
632
646
|
})
|
|
@@ -11,6 +11,7 @@ import * as SchemaAST from "../../SchemaAST.ts"
|
|
|
11
11
|
import * as SchemaGetter from "../../SchemaGetter.ts"
|
|
12
12
|
import * as SchemaParser from "../../SchemaParser.ts"
|
|
13
13
|
import * as InternalArray from "../array.ts"
|
|
14
|
+
import { done } from "../core.ts"
|
|
14
15
|
import { effectIsExit } from "../effect.ts"
|
|
15
16
|
import { errorWithPath } from "../errors.ts"
|
|
16
17
|
import * as InternalRecord from "../record.ts"
|
|
@@ -50,6 +51,20 @@ function arbitraryError(what: string, path: ReadonlyArray<PropertyKey>) {
|
|
|
50
51
|
return errorWithPath(`Unable to derive an arbitrary for ${what}`, path)
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
function recordUnsupportedPatterns(
|
|
55
|
+
{ diagnosticPath: path, diagnostics }: Model.GenerationState,
|
|
56
|
+
patterns: ReadonlyArray<Schema.Annotations.ToArbitrary.Pattern>
|
|
57
|
+
): void {
|
|
58
|
+
if (diagnostics === undefined) return
|
|
59
|
+
for (const { flags, source } of patterns) {
|
|
60
|
+
const seen = diagnostics.some((diagnostic) =>
|
|
61
|
+
diagnostic._tag === "UnsupportedPattern" && diagnostic.source === source && diagnostic.flags === flags &&
|
|
62
|
+
diagnostic.path.length === path.length && diagnostic.path.every((key, index) => key === path[index])
|
|
63
|
+
)
|
|
64
|
+
if (!seen) diagnostics.push({ _tag: "UnsupportedPattern", path, source, flags })
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
function sumCosts(costs: Iterable<number>): number {
|
|
54
69
|
let out = 0
|
|
55
70
|
for (const cost of costs) {
|
|
@@ -714,25 +729,79 @@ const generateRepeatedUniqueValues = (
|
|
|
714
729
|
return loop()
|
|
715
730
|
}
|
|
716
731
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
732
|
+
interface StringShrink {
|
|
733
|
+
readonly value: string
|
|
734
|
+
readonly start: number
|
|
735
|
+
readonly limit: number
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
function stringSample(
|
|
739
|
+
value: string,
|
|
740
|
+
options: {
|
|
741
|
+
readonly minimumLength: number
|
|
742
|
+
readonly minimumCodePoints: number | undefined
|
|
743
|
+
readonly pattern: Regexp.Compiled | undefined
|
|
744
|
+
}
|
|
745
|
+
): Model.Sample<string> {
|
|
746
|
+
const { minimumCodePoints, pattern } = options
|
|
747
|
+
const minimum = Math.max(options.minimumLength, pattern?.minimumLength ?? 0)
|
|
748
|
+
const codePoints = minimumCodePoints !== undefined
|
|
749
|
+
const minimumUnits = minimumCodePoints ?? minimum
|
|
750
|
+
const sample = ({ value, start, limit }: StringShrink): Model.Sample<string> =>
|
|
751
|
+
Model.makeSampleWithLazyShrinks(value, () => {
|
|
752
|
+
const candidates = shrinks(value, start, limit)
|
|
753
|
+
const seen = new Set([value])
|
|
754
|
+
return Effect.suspend(() => {
|
|
755
|
+
for (let next = candidates.next(); !next.done; next = candidates.next()) {
|
|
756
|
+
const candidate = next.value.value
|
|
757
|
+
// Reject pattern mismatches here so they do not consume the runner's shrink budget.
|
|
758
|
+
if (candidate.length < minimum || seen.has(candidate) || pattern?.test(candidate) === false) continue
|
|
759
|
+
seen.add(candidate)
|
|
760
|
+
return Effect.succeed(sample(next.value))
|
|
761
|
+
}
|
|
762
|
+
return done()
|
|
763
|
+
})
|
|
764
|
+
})
|
|
765
|
+
function* shrinks(value: string, start: number, limit: number): Generator<StringShrink> {
|
|
766
|
+
if (pattern !== undefined) {
|
|
767
|
+
for (const candidate of pattern.shrink(value, minimum)) {
|
|
768
|
+
yield { value: candidate, start: 0, limit: infinity }
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
const units = codePoints ? Array.from(value) : value.split("")
|
|
772
|
+
const length = units.length
|
|
773
|
+
// Each removed unit costs at least one UTF-16 code unit.
|
|
774
|
+
const removable = Math.min(length - minimumUnits, value.length - minimum)
|
|
775
|
+
const edit = (index: number, count: number, limit: number, insert = ""): StringShrink => {
|
|
776
|
+
const prefix = units.slice(0, index).join("")
|
|
777
|
+
const value = prefix + insert + units.slice(index + count).join("")
|
|
778
|
+
// Joining a trailing high surrogate to a low surrogate changes the preceding code point.
|
|
779
|
+
const start = codePoints && index > 0 && value.codePointAt(prefix.length - 1)! > 0xffff ? index - 1 : index
|
|
780
|
+
return { value, start, limit }
|
|
781
|
+
}
|
|
782
|
+
if (start === 0) {
|
|
783
|
+
for (let count = removable; count > 0; count = Math.floor(count / 2)) {
|
|
784
|
+
yield { value: units.slice(0, length - count).join(""), start: 0, limit }
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
// Follows the removal order of `array.ts` (fast-check v4.9.0's ArrayArbitrary, MIT).
|
|
788
|
+
// Resume at the changed unit, retaining the accepted deletion size there;
|
|
789
|
+
// suffix truncations must preserve that cap too.
|
|
790
|
+
for (let index = start, cap = limit; index < length; index++, cap = infinity) {
|
|
791
|
+
for (let count = Math.min(length - index, removable, cap); count > 0; count = Math.floor(count / 2)) {
|
|
792
|
+
yield edit(index, count, count)
|
|
793
|
+
}
|
|
794
|
+
// Structural pattern candidates already canonicalise characters.
|
|
795
|
+
if (pattern !== undefined) continue
|
|
796
|
+
// Unit simplification follows fast-check v4.9.0's string arbitrary (MIT), halving toward the null unit.
|
|
797
|
+
// https://github.com/dubzzz/fast-check/blob/v4.9.0/packages/fast-check/src/arbitrary/string.ts
|
|
798
|
+
const code = units[index].codePointAt(0)!
|
|
799
|
+
for (let gap = code; gap > 0; gap = Math.floor(gap / 2)) {
|
|
800
|
+
yield edit(index, 1, 0, globalThis.String.fromCodePoint(code - gap))
|
|
801
|
+
}
|
|
733
802
|
}
|
|
734
803
|
}
|
|
735
|
-
return
|
|
804
|
+
return sample({ value, start: 0, limit: infinity })
|
|
736
805
|
}
|
|
737
806
|
|
|
738
807
|
// Edge-case injection is inspired by fast-check v4.9.0's cached dangerous slices (MIT). The concrete corpus is
|
|
@@ -972,6 +1041,26 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
972
1041
|
const nodes: Array<Model.Compiled<any>> = []
|
|
973
1042
|
const suspendBodies = new Map<Model.Compiled<any>, Model.Compiled<any>>()
|
|
974
1043
|
const pending: Array<() => void> = []
|
|
1044
|
+
let hasUnsupportedPatterns = false
|
|
1045
|
+
const pathNodes: Array<readonly [Model.Compiled<any>, Model.Compiled<any>]> = []
|
|
1046
|
+
const atPath = (compiled: Model.Compiled<any>, key: PropertyKey): Model.Compiled<any> => {
|
|
1047
|
+
const node = Model.makeCompiled(
|
|
1048
|
+
[compiled],
|
|
1049
|
+
() => compiled.minCost,
|
|
1050
|
+
(state) =>
|
|
1051
|
+
compiled.generate(
|
|
1052
|
+
state.diagnostics === undefined ? state : {
|
|
1053
|
+
...state,
|
|
1054
|
+
diagnosticPath: [...state.diagnosticPath, key]
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
)
|
|
1058
|
+
// Scalar index-signature specializations can also be compiled during generation.
|
|
1059
|
+
node.minCost = compiled.minCost
|
|
1060
|
+
nodes.push(node)
|
|
1061
|
+
pathNodes.push([node, compiled])
|
|
1062
|
+
return node
|
|
1063
|
+
}
|
|
975
1064
|
const recur = (
|
|
976
1065
|
ast: SchemaAST.AST,
|
|
977
1066
|
path: ReadonlyArray<PropertyKey>,
|
|
@@ -1017,6 +1106,13 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1017
1106
|
return placeholder
|
|
1018
1107
|
}
|
|
1019
1108
|
|
|
1109
|
+
const recurAt = (
|
|
1110
|
+
ast: SchemaAST.AST,
|
|
1111
|
+
path: ReadonlyArray<PropertyKey>,
|
|
1112
|
+
key: PropertyKey,
|
|
1113
|
+
inherited?: FilterConstraint
|
|
1114
|
+
): Model.Compiled<any> => atPath(recur(ast, [...path, key], inherited), key)
|
|
1115
|
+
|
|
1020
1116
|
const compileBase = (
|
|
1021
1117
|
ast: SchemaAST.AST,
|
|
1022
1118
|
path: ReadonlyArray<PropertyKey>,
|
|
@@ -1048,10 +1144,13 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1048
1144
|
)
|
|
1049
1145
|
case "String": {
|
|
1050
1146
|
const patterns: Array<Regexp.Compiled> = []
|
|
1147
|
+
const unsupported: Array<Schema.Annotations.ToArbitrary.Pattern> = []
|
|
1051
1148
|
for (const candidate of constraint?.patterns ?? []) {
|
|
1052
1149
|
const pattern = Regexp.compile(candidate)
|
|
1053
1150
|
if (pattern !== undefined) patterns.push(pattern)
|
|
1151
|
+
else unsupported.push(candidate)
|
|
1054
1152
|
}
|
|
1153
|
+
if (unsupported.length > 0) hasUnsupportedPatterns = true
|
|
1055
1154
|
let [minimum, maximum = infinity] = lengthBounds(constraint, ["minLength", "maxLength"], path, "string")
|
|
1056
1155
|
const hasCodePoints = constraint?.minCodePoints !== undefined || constraint?.maxCodePoints !== undefined
|
|
1057
1156
|
let [minCodePoints, maxCodePoints = infinity] = lengthBounds(
|
|
@@ -1073,6 +1172,7 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1073
1172
|
[],
|
|
1074
1173
|
() => 0,
|
|
1075
1174
|
(state) => {
|
|
1175
|
+
recordUnsupportedPatterns(state, unsupported)
|
|
1076
1176
|
const pattern = patterns.length === 0
|
|
1077
1177
|
? undefined
|
|
1078
1178
|
: patterns.length === 1
|
|
@@ -1091,12 +1191,11 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1091
1191
|
: randomString(state, minimum, upper)
|
|
1092
1192
|
if (value === undefined) return Model.discarded
|
|
1093
1193
|
return state.shrinks
|
|
1094
|
-
?
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
)
|
|
1194
|
+
? stringSample(value, {
|
|
1195
|
+
minimumLength: minimum,
|
|
1196
|
+
minimumCodePoints: hasCodePoints ? minCodePoints : undefined,
|
|
1197
|
+
pattern
|
|
1198
|
+
})
|
|
1100
1199
|
: Model.makeSample(value)
|
|
1101
1200
|
}
|
|
1102
1201
|
)
|
|
@@ -1205,7 +1304,7 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1205
1304
|
)
|
|
1206
1305
|
}
|
|
1207
1306
|
case "TemplateLiteral": {
|
|
1208
|
-
const parts = ast.parts.map((part, index) =>
|
|
1307
|
+
const parts = ast.parts.map((part, index) => recurAt(part, path, index, finiteNumberConstraint))
|
|
1209
1308
|
return Model.makeCompiled(
|
|
1210
1309
|
parts,
|
|
1211
1310
|
() => sumCosts(parts.map((part) => part.minCost)),
|
|
@@ -1276,12 +1375,12 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1276
1375
|
const uniqueBy = constraint?.uniqueBy
|
|
1277
1376
|
const elements = ast.elements.map((element, index) => ({
|
|
1278
1377
|
optional: SchemaAST.isOptional(element),
|
|
1279
|
-
compiled:
|
|
1378
|
+
compiled: recurAt(element, path, index)
|
|
1280
1379
|
}))
|
|
1281
1380
|
const requiredCount = elements.findIndex((element) => element.optional)
|
|
1282
1381
|
const required = requiredCount === -1 ? elements.length : requiredCount
|
|
1283
1382
|
const optional = elements.length - required
|
|
1284
|
-
const rest = ast.rest.map((element, index) =>
|
|
1383
|
+
const rest = ast.rest.map((element, index) => recurAt(element, path, elements.length + index))
|
|
1285
1384
|
const head = rest[0]
|
|
1286
1385
|
const tail = rest.slice(1)
|
|
1287
1386
|
const [minimum, maximum] = lengthBounds(constraint, ["minLength", "maxLength"], path, "array")
|
|
@@ -1433,16 +1532,17 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1433
1532
|
const constraint = collectChecks(index.type.checks, undefined).constraint
|
|
1434
1533
|
return constraint === undefined ? [] : [{ index, position, constraint }]
|
|
1435
1534
|
})
|
|
1436
|
-
const compileIndexedValue = (type: SchemaAST.AST,
|
|
1437
|
-
const
|
|
1535
|
+
const compileIndexedValue = (type: SchemaAST.AST, schemaKey: PropertyKey) => {
|
|
1536
|
+
const valuePath = [...path, schemaKey]
|
|
1537
|
+
const compiled = recurAt(type, path, schemaKey)
|
|
1438
1538
|
// Scalar specializations have no recursive dependencies and keep the same minimum cost.
|
|
1439
1539
|
const candidates = type._tag === "String" || type._tag === "Number" || type._tag === "BigInt"
|
|
1440
1540
|
? constrainedIndexes.filter(({ index }) => index.type !== type && index.type._tag === type._tag)
|
|
1441
1541
|
: []
|
|
1442
1542
|
const specializations = new Map<string, Model.Compiled<any>>()
|
|
1443
|
-
const forKey = (
|
|
1543
|
+
const forKey = (propertyKey: PropertyKey): Model.Compiled<any> => {
|
|
1444
1544
|
if (candidates.length === 0) return compiled
|
|
1445
|
-
const input = { [
|
|
1545
|
+
const input = { [propertyKey]: undefined }
|
|
1446
1546
|
const matching = candidates.filter(({ index }) =>
|
|
1447
1547
|
SchemaAST.getIndexSignatureKeys(input, index.parameter).length > 0
|
|
1448
1548
|
)
|
|
@@ -1455,9 +1555,10 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1455
1555
|
let inherited: FilterConstraint | undefined
|
|
1456
1556
|
for (const match of matching) inherited = mergeConstraint(inherited, match.constraint)
|
|
1457
1557
|
const checks = collectChecks(type.checks, inherited)
|
|
1458
|
-
specialized = compileBase(type,
|
|
1558
|
+
specialized = compileBase(type, valuePath, checks.constraint)
|
|
1459
1559
|
specialized.minCost = 0
|
|
1460
1560
|
applyFilters(specialized, type, checks.filters)
|
|
1561
|
+
specialized = atPath(specialized, schemaKey)
|
|
1461
1562
|
} catch {
|
|
1462
1563
|
// Incompatible scalar constraints keep the original generator and indexed validation.
|
|
1463
1564
|
}
|
|
@@ -1472,7 +1573,7 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1472
1573
|
const properties = ast.propertySignatures.map((property) => ({
|
|
1473
1574
|
property,
|
|
1474
1575
|
optional: SchemaAST.isOptional(property.type),
|
|
1475
|
-
compiled: compileIndexedValue(property.type,
|
|
1576
|
+
compiled: compileIndexedValue(property.type, property.name).forKey(property.name)
|
|
1476
1577
|
}))
|
|
1477
1578
|
const propertyNames = new Set<PropertyKey>(
|
|
1478
1579
|
properties.map(({ property }) =>
|
|
@@ -1480,9 +1581,9 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1480
1581
|
)
|
|
1481
1582
|
)
|
|
1482
1583
|
const indexes = ast.indexSignatures.map((index, position) => {
|
|
1483
|
-
const value = compileIndexedValue(index.type,
|
|
1584
|
+
const value = compileIndexedValue(index.type, `index-${position}-value`)
|
|
1484
1585
|
return {
|
|
1485
|
-
parameter:
|
|
1586
|
+
parameter: recurAt(index.parameter, path, `index-${position}-key`),
|
|
1486
1587
|
value: value.compiled,
|
|
1487
1588
|
valueForKey: value.forKey
|
|
1488
1589
|
}
|
|
@@ -1617,7 +1718,7 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1617
1718
|
constraint: FilterConstraint | undefined
|
|
1618
1719
|
): Model.Compiled<any> => {
|
|
1619
1720
|
validateConstraint(constraint, path)
|
|
1620
|
-
const typeParameters = ast.typeParameters.map((parameter, index) =>
|
|
1721
|
+
const typeParameters = ast.typeParameters.map((parameter, index) => recurAt(parameter, path, index))
|
|
1621
1722
|
const parameters = ast.typeParameters.map((parameter) => Schema.make(SchemaAST.toType(parameter)))
|
|
1622
1723
|
const getArbitrary = ast.annotations?.toCodecArbitrary
|
|
1623
1724
|
const representation = (ast.annotations as Schema.Annotations.Declaration<any> | undefined)?.representation
|
|
@@ -1675,6 +1776,10 @@ export function compile<S extends Schema.Constraint>(schema: S): Model.Compiled<
|
|
|
1675
1776
|
|
|
1676
1777
|
const root = recur(rootAst, [])
|
|
1677
1778
|
for (let index = 0; index < pending.length; index++) pending[index]()
|
|
1779
|
+
// Schemas without unsupported patterns need no path tracking while generating values.
|
|
1780
|
+
if (!hasUnsupportedPatterns) {
|
|
1781
|
+
for (const [node, compiled] of pathNodes) node.generate = compiled.generate
|
|
1782
|
+
}
|
|
1678
1783
|
const dependents = analyzeDependencyGraph(nodes, suspendBodies)
|
|
1679
1784
|
const recursiveQueue = nodes.filter((node) => node.recursive)
|
|
1680
1785
|
for (let index = 0; index < recursiveQueue.length; index++) {
|
package/src/internal/base64.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface NativeDecodeOptions {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Decodes `str` with native `Uint8Array.fromBase64`.
|
|
7
|
+
* Decodes `str` with native `Uint8Array.fromBase64`, falling back to `Buffer`.
|
|
8
8
|
*
|
|
9
9
|
* Returns `undefined` when native decoding is unavailable or skipped for a
|
|
10
10
|
* short input, and `null` when native decoding rejected the input. In both
|
|
@@ -28,7 +28,17 @@ export const decodeNative = (
|
|
|
28
28
|
const NativeUint8Array = Uint8Array as {
|
|
29
29
|
readonly fromBase64?: (string: string, options?: NativeDecodeOptions) => Uint8Array
|
|
30
30
|
}
|
|
31
|
-
if (typeof NativeUint8Array.fromBase64 !== "function")
|
|
31
|
+
if (typeof NativeUint8Array.fromBase64 !== "function") {
|
|
32
|
+
const Buffer = getBuffer()
|
|
33
|
+
if (Buffer === undefined) return undefined
|
|
34
|
+
const encoding = options?.alphabet ?? "base64"
|
|
35
|
+
const bytes = new Uint8Array(decodedLength)
|
|
36
|
+
const buffer = Buffer.from(bytes.buffer)
|
|
37
|
+
// `Buffer` is permissive (skips invalid chars, mixes alphabets, truncates
|
|
38
|
+
// code units), so accept only input that round-trips identically.
|
|
39
|
+
const canonical = options !== undefined && str.endsWith("=") ? str.slice(0, str.indexOf("=")) : str
|
|
40
|
+
return buffer.write(str, encoding) === decodedLength && buffer.toString(encoding) === canonical ? bytes : null
|
|
41
|
+
}
|
|
32
42
|
try {
|
|
33
43
|
const bytes = NativeUint8Array.fromBase64(str, options)
|
|
34
44
|
return bytes.length === decodedLength ? bytes : null
|
|
@@ -37,6 +47,51 @@ export const decodeNative = (
|
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
|
|
50
|
+
interface BufferLike {
|
|
51
|
+
write(string: string, encoding: string): number
|
|
52
|
+
toString(encoding: string): string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface BufferConstructorLike {
|
|
56
|
+
from(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BufferLike
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype)
|
|
60
|
+
const typedArrayBuffer = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer")!.get as (
|
|
61
|
+
this: Uint8Array
|
|
62
|
+
) => ArrayBufferLike
|
|
63
|
+
const typedArrayByteOffset = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteOffset")!.get as (
|
|
64
|
+
this: Uint8Array
|
|
65
|
+
) => number
|
|
66
|
+
const typedArrayByteLength = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength")!.get as (
|
|
67
|
+
this: Uint8Array
|
|
68
|
+
) => number
|
|
69
|
+
|
|
70
|
+
// Gate on `process.versions.node` to avoid slow browser/RN `Buffer` polyfills;
|
|
71
|
+
// read at call time without importing `node:buffer`.
|
|
72
|
+
const getBuffer = (): BufferConstructorLike | undefined => {
|
|
73
|
+
const global = globalThis as {
|
|
74
|
+
readonly Buffer?: BufferConstructorLike
|
|
75
|
+
readonly process?: { readonly versions?: { readonly node?: unknown } }
|
|
76
|
+
}
|
|
77
|
+
return typeof global.process?.versions?.node === "string" && typeof global.Buffer === "function"
|
|
78
|
+
? global.Buffer
|
|
79
|
+
: undefined
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Encodes `bytes` with `Buffer` ("base64" padded, "base64url" unpadded), or returns `undefined` if unavailable.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export const encodeBuffer = (bytes: Uint8Array, encoding: "base64" | "base64url"): string | undefined => {
|
|
88
|
+
const Buffer = getBuffer()
|
|
89
|
+
if (Buffer === undefined) return undefined
|
|
90
|
+
const byteLength = typedArrayByteLength.call(bytes)
|
|
91
|
+
if (byteLength < 32) return undefined
|
|
92
|
+
return Buffer.from(typedArrayBuffer.call(bytes), typedArrayByteOffset.call(bytes), byteLength).toString(encoding)
|
|
93
|
+
}
|
|
94
|
+
|
|
40
95
|
/** @internal */
|
|
41
96
|
export const stripCrlf = (str: string): string =>
|
|
42
97
|
str.indexOf("\n") === -1 && str.indexOf("\r") === -1 ? str : str.replace(/[\n\r]/g, "")
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CodeHole, Fragment, Render } from "../Codegen.ts"
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export function cannotCoerce(): never {
|
|
5
|
+
throw new Error("Code fragments must be rendered by their module")
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function append(value: CodeHole, parts: Array<Fragment>): void {
|
|
9
|
+
if (value === undefined || value === null || value === false || value === "") return
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
for (const item of value) append(item, parts)
|
|
12
|
+
} else {
|
|
13
|
+
parts.push(typeof value === "number" ? String(value) : value as Fragment)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export function code(strings: TemplateStringsArray, ...values: ReadonlyArray<CodeHole>): Fragment {
|
|
19
|
+
const parts: Array<Fragment> = []
|
|
20
|
+
for (let i = 0; i < strings.length; i++) {
|
|
21
|
+
append(strings[i], parts)
|
|
22
|
+
append(values[i], parts)
|
|
23
|
+
}
|
|
24
|
+
return { _tag: "Parts", parts, toString: cannotCoerce }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export function join(values: ReadonlyArray<CodeHole>, separator: string): Fragment {
|
|
29
|
+
const parts: Array<Fragment> = []
|
|
30
|
+
for (let i = 0; i < values.length; i++) {
|
|
31
|
+
if (i > 0) parts.push(separator)
|
|
32
|
+
append(values[i], parts)
|
|
33
|
+
}
|
|
34
|
+
return { _tag: "Parts", parts, toString: cannotCoerce }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export function deferred(render: (render: Render) => string): Fragment {
|
|
39
|
+
return { _tag: "Deferred", render, toString: cannotCoerce }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export function literal(value: string | number | bigint | boolean | null | undefined): string {
|
|
44
|
+
if (typeof value === "string") return JSON.stringify(value)
|
|
45
|
+
if (typeof value === "bigint") return `${value}n`
|
|
46
|
+
if (typeof value === "number") {
|
|
47
|
+
if (Number.isNaN(value)) return "globalThis.NaN"
|
|
48
|
+
if (value === Infinity) return "globalThis.Infinity"
|
|
49
|
+
if (value === -Infinity) return "-globalThis.Infinity"
|
|
50
|
+
if (Object.is(value, -0)) return "-0"
|
|
51
|
+
}
|
|
52
|
+
return String(value)
|
|
53
|
+
}
|
package/src/internal/core.ts
CHANGED
|
@@ -81,11 +81,11 @@ export const PipeInspectableProto = {
|
|
|
81
81
|
/** @internal */
|
|
82
82
|
export const StructuralProto = {
|
|
83
83
|
[Hash.symbol](this: any): number {
|
|
84
|
-
return Hash.structureKeys(this,
|
|
84
|
+
return Hash.structureKeys(this, InternalRecord.ownEnumerableKeys(this))
|
|
85
85
|
},
|
|
86
86
|
[Equal.symbol](this: any, that: any): boolean {
|
|
87
|
-
const selfKeys =
|
|
88
|
-
if (selfKeys.length !==
|
|
87
|
+
const selfKeys = InternalRecord.ownEnumerableKeys(this)
|
|
88
|
+
if (selfKeys.length !== InternalRecord.ownEnumerableKeys(that).length) return false
|
|
89
89
|
for (const key of selfKeys) {
|
|
90
90
|
if (!Object.prototype.propertyIsEnumerable.call(that, key) || !Equal.equals(this[key], that[key])) {
|
|
91
91
|
return false
|