effect 4.0.0-beta.30 → 4.0.0-beta.32
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/dist/Array.d.ts +87 -86
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +47 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +46 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +35 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Channel.d.ts +2 -2
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +58 -57
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +20 -21
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +4 -1
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts +3 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +11 -18
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +49 -92
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +9 -9
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +55 -25
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +100 -70
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +3 -4
- package/dist/Effect.js.map +1 -1
- package/dist/Fiber.d.ts +2 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +17 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +10 -7
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts +64 -64
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +53 -53
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +11 -5
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +3 -1
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +11 -11
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +12 -12
- package/dist/Iterable.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +181 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +35 -2
- package/dist/Layer.js.map +1 -1
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Option.d.ts +2 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +6 -5
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +3 -3
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +2 -2
- package/dist/Queue.js.map +1 -1
- package/dist/Record.d.ts +40 -40
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +16 -15
- package/dist/Record.js.map +1 -1
- package/dist/Scheduler.d.ts +25 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +20 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2346 -114
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1359 -68
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.js +2 -2
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +32 -27
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +149 -53
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +137 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/ServiceMap.d.ts +26 -0
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +36 -21
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +81 -115
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +26 -14
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +8 -4
- package/dist/Trie.js.map +1 -1
- package/dist/TxHashMap.d.ts +77 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +25 -19
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +16 -2
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/index.d.ts +88 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/dateTime.js +66 -59
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -90
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/trie.js +3 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +30 -16
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +10 -87
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +14 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +13 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +4 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +3 -2
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +4 -4
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +14 -12
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +71 -67
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +8 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +3 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +7 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -3
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +3 -2
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +12 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -6
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +19 -13
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +9 -10
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +1 -4
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +5 -4
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +3 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +3 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +2 -1
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -6
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +2 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +16 -15
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +2 -1
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +14 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +4 -3
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +5 -4
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +5 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +81 -3
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -2
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -5
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +4 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +4 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +4 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +2 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +6 -6
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +2 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +19 -14
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +112 -105
- package/src/BigDecimal.ts +63 -66
- package/src/BigInt.ts +49 -41
- package/src/Channel.ts +3 -3
- package/src/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +13 -18
- package/src/DateTime.ts +51 -92
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +112 -56
- package/src/Effect.ts +3 -4
- package/src/Fiber.ts +2 -1
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +25 -22
- package/src/Graph.ts +105 -105
- package/src/HashMap.ts +11 -5
- package/src/Iterable.ts +13 -13
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +244 -19
- package/src/Number.ts +85 -26
- package/src/Option.ts +2 -0
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/PubSub.ts +7 -6
- package/src/Queue.ts +5 -5
- package/src/Record.ts +52 -47
- package/src/Scheduler.ts +37 -126
- package/src/Schema.ts +2366 -116
- package/src/SchemaAST.ts +2 -2
- package/src/SchemaGetter.ts +4 -4
- package/src/SchemaRepresentation.ts +2 -2
- package/src/SchemaTransformation.ts +27 -27
- package/src/Semaphore.ts +271 -183
- package/src/ServiceMap.ts +83 -31
- package/src/Stream.ts +1 -1
- package/src/String.ts +122 -69
- package/src/SubscriptionRef.ts +96 -117
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +26 -14
- package/src/TxHashMap.ts +78 -60
- package/src/TxSemaphore.ts +186 -11
- package/src/index.ts +89 -33
- package/src/internal/dateTime.ts +74 -65
- package/src/internal/effect.ts +30 -122
- package/src/internal/hashMap.ts +4 -3
- package/src/internal/option.ts +7 -0
- package/src/internal/trie.ts +6 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +17 -15
- package/src/unstable/ai/LanguageModel.ts +148 -97
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliOutput.ts +7 -5
- package/src/unstable/cli/Command.ts +5 -5
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/GlobalFlag.ts +4 -5
- package/src/unstable/cli/HelpDoc.ts +14 -12
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +81 -83
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
- package/src/unstable/cli/internal/parser.ts +7 -4
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +13 -12
- package/src/unstable/cluster/Message.ts +6 -5
- package/src/unstable/cluster/MessageStorage.ts +26 -25
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +8 -7
- package/src/unstable/cluster/Sharding.ts +24 -17
- package/src/unstable/cluster/ShardingConfig.ts +6 -6
- package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
- package/src/unstable/cluster/internal/entityManager.ts +27 -21
- package/src/unstable/devtools/DevToolsSchema.ts +3 -2
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/http/Cookies.ts +7 -8
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +6 -5
- package/src/unstable/http/HttpClient.ts +2 -1
- package/src/unstable/http/HttpClientRequest.ts +11 -9
- package/src/unstable/http/HttpClientResponse.ts +5 -4
- package/src/unstable/http/HttpIncomingMessage.ts +3 -2
- package/src/unstable/http/HttpMiddleware.ts +16 -15
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +3 -2
- package/src/unstable/http/HttpServerRequest.ts +29 -25
- package/src/unstable/http/HttpServerResponse.ts +7 -6
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +13 -7
- package/src/unstable/httpapi/HttpApiError.ts +67 -12
- package/src/unstable/observability/OtlpExporter.ts +5 -2
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +1 -4
- package/src/unstable/reactivity/AtomRegistry.ts +5 -3
- package/src/unstable/rpc/Rpc.ts +4 -3
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcGroup.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +6 -5
- package/src/unstable/rpc/RpcSerialization.ts +4 -1
- package/src/unstable/rpc/RpcServer.ts +3 -3
- package/src/unstable/socket/Socket.ts +2 -1
- package/src/unstable/sql/SqlClient.ts +5 -3
- package/src/unstable/workflow/DurableDeferred.ts +6 -6
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +29 -20
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/src/ServiceMap.ts
CHANGED
|
@@ -446,6 +446,7 @@ export interface ServiceMap<in Services> extends Equal.Equal, Pipeable, Inspecta
|
|
|
446
446
|
readonly _Services: Types.Contravariant<Services>
|
|
447
447
|
}
|
|
448
448
|
readonly mapUnsafe: ReadonlyMap<string, any>
|
|
449
|
+
mutable: boolean
|
|
449
450
|
}
|
|
450
451
|
|
|
451
452
|
/**
|
|
@@ -467,10 +468,11 @@ export interface ServiceMap<in Services> extends Equal.Equal, Pipeable, Inspecta
|
|
|
467
468
|
export const makeUnsafe = <Services = never>(mapUnsafe: ReadonlyMap<string, any>): ServiceMap<Services> => {
|
|
468
469
|
const self = Object.create(Proto)
|
|
469
470
|
self.mapUnsafe = mapUnsafe
|
|
471
|
+
self.mutable = false
|
|
470
472
|
return self
|
|
471
473
|
}
|
|
472
474
|
|
|
473
|
-
const Proto: Omit<ServiceMap<never>, "mapUnsafe"> = {
|
|
475
|
+
const Proto: Omit<ServiceMap<never>, "mapUnsafe" | "mutable"> = {
|
|
474
476
|
...PipeInspectableProto,
|
|
475
477
|
[TypeId]: {
|
|
476
478
|
_Services: (_: never) => _
|
|
@@ -676,11 +678,10 @@ export const add: {
|
|
|
676
678
|
self: ServiceMap<Services>,
|
|
677
679
|
key: Key<I, S>,
|
|
678
680
|
service: Types.NoInfer<S>
|
|
679
|
-
): ServiceMap<Services | I> =>
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
})
|
|
681
|
+
): ServiceMap<Services | I> =>
|
|
682
|
+
withMapUnsafe(self, (map) => {
|
|
683
|
+
map.set(key.key, service)
|
|
684
|
+
}))
|
|
684
685
|
|
|
685
686
|
/**
|
|
686
687
|
* @since 4.0.0
|
|
@@ -705,15 +706,14 @@ export const addOrOmit: {
|
|
|
705
706
|
self: ServiceMap<Services>,
|
|
706
707
|
key: Key<I, S>,
|
|
707
708
|
service: Option.Option<Types.NoInfer<S>>
|
|
708
|
-
): ServiceMap<Services | I> =>
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
})
|
|
709
|
+
): ServiceMap<Services | I> =>
|
|
710
|
+
withMapUnsafe(self, (map) => {
|
|
711
|
+
if (service._tag === "None") {
|
|
712
|
+
map.delete(key.key)
|
|
713
|
+
} else {
|
|
714
|
+
map.set(key.key, service.value)
|
|
715
|
+
}
|
|
716
|
+
}))
|
|
717
717
|
|
|
718
718
|
/**
|
|
719
719
|
* Get a service from the context that corresponds to the given key, or
|
|
@@ -1253,9 +1253,9 @@ export const merge: {
|
|
|
1253
1253
|
} = dual(2, <Services, R1>(self: ServiceMap<Services>, that: ServiceMap<R1>): ServiceMap<Services | R1> => {
|
|
1254
1254
|
if (self.mapUnsafe.size === 0) return that as any
|
|
1255
1255
|
if (that.mapUnsafe.size === 0) return self as any
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1256
|
+
return withMapUnsafe(self, (map) => {
|
|
1257
|
+
that.mapUnsafe.forEach((value, key) => map.set(key, value))
|
|
1258
|
+
})
|
|
1259
1259
|
})
|
|
1260
1260
|
|
|
1261
1261
|
/**
|
|
@@ -1333,16 +1333,14 @@ export const mergeAll = <T extends Array<unknown>>(
|
|
|
1333
1333
|
export const pick = <S extends ReadonlyArray<Key<any, any>>>(
|
|
1334
1334
|
...services: S
|
|
1335
1335
|
) =>
|
|
1336
|
-
<Services>(self: ServiceMap<Services>): ServiceMap<Services & Service.Identifier<S[number]>> =>
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
map.
|
|
1342
|
-
}
|
|
1336
|
+
<Services>(self: ServiceMap<Services>): ServiceMap<Services & Service.Identifier<S[number]>> =>
|
|
1337
|
+
withMapUnsafe(self, (map) => {
|
|
1338
|
+
const keySet = new Set(services.map((key) => key.key))
|
|
1339
|
+
map.forEach((_, key) => {
|
|
1340
|
+
if (keySet.has(key)) return
|
|
1341
|
+
map.delete(key)
|
|
1342
|
+
})
|
|
1343
1343
|
})
|
|
1344
|
-
return makeUnsafe(map)
|
|
1345
|
-
}
|
|
1346
1344
|
|
|
1347
1345
|
/**
|
|
1348
1346
|
* @example
|
|
@@ -1373,11 +1371,65 @@ export const pick = <S extends ReadonlyArray<Key<any, any>>>(
|
|
|
1373
1371
|
export const omit = <S extends ReadonlyArray<Key<any, any>>>(
|
|
1374
1372
|
...keys: S
|
|
1375
1373
|
) =>
|
|
1376
|
-
<Services>(self: ServiceMap<Services>): ServiceMap<Exclude<Services, Service.Identifier<S[number]>>> =>
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1374
|
+
<Services>(self: ServiceMap<Services>): ServiceMap<Exclude<Services, Service.Identifier<S[number]>>> =>
|
|
1375
|
+
withMapUnsafe(self, (map) => {
|
|
1376
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1377
|
+
map.delete(keys[i].key)
|
|
1378
|
+
}
|
|
1379
|
+
})
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
|
|
1383
|
+
* of the underlying map when multiple mutations are needed.
|
|
1384
|
+
*
|
|
1385
|
+
* @since 4.0.0
|
|
1386
|
+
* @category Utils
|
|
1387
|
+
*/
|
|
1388
|
+
export const mutate: {
|
|
1389
|
+
/**
|
|
1390
|
+
* Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
|
|
1391
|
+
* of the underlying map when multiple mutations are needed.
|
|
1392
|
+
*
|
|
1393
|
+
* @since 4.0.0
|
|
1394
|
+
* @category Utils
|
|
1395
|
+
*/
|
|
1396
|
+
<Services, B>(f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>): <Services>(self: ServiceMap<Services>) => ServiceMap<B>
|
|
1397
|
+
/**
|
|
1398
|
+
* Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
|
|
1399
|
+
* of the underlying map when multiple mutations are needed.
|
|
1400
|
+
*
|
|
1401
|
+
* @since 4.0.0
|
|
1402
|
+
* @category Utils
|
|
1403
|
+
*/
|
|
1404
|
+
<Services, B>(
|
|
1405
|
+
self: ServiceMap<Services>,
|
|
1406
|
+
f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>
|
|
1407
|
+
): ServiceMap<B>
|
|
1408
|
+
} = dual(
|
|
1409
|
+
2,
|
|
1410
|
+
<Services, B>(self: ServiceMap<Services>, f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>): ServiceMap<B> => {
|
|
1411
|
+
const next = makeUnsafe</**
|
|
1412
|
+
* Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
|
|
1413
|
+
* of the underlying map when multiple mutations are needed.
|
|
1414
|
+
*
|
|
1415
|
+
* @since 4.0.0
|
|
1416
|
+
* @category Utils
|
|
1417
|
+
*/
|
|
1418
|
+
Services>(new Map(self.mapUnsafe))
|
|
1419
|
+
next.mutable = true
|
|
1420
|
+
const result = f(next)
|
|
1421
|
+
result.mutable = false
|
|
1422
|
+
return result
|
|
1380
1423
|
}
|
|
1424
|
+
)
|
|
1425
|
+
|
|
1426
|
+
const withMapUnsafe = <Services, B>(self: ServiceMap<Services>, f: (map: Map<string, any>) => void): ServiceMap<B> => {
|
|
1427
|
+
if (self.mutable) {
|
|
1428
|
+
f(self.mapUnsafe as any)
|
|
1429
|
+
return self as any
|
|
1430
|
+
}
|
|
1431
|
+
const map = new Map(self.mapUnsafe)
|
|
1432
|
+
f(map)
|
|
1381
1433
|
return makeUnsafe(map)
|
|
1382
1434
|
}
|
|
1383
1435
|
|
package/src/Stream.ts
CHANGED
|
@@ -3817,7 +3817,7 @@ export const merge: {
|
|
|
3817
3817
|
} | undefined
|
|
3818
3818
|
): Stream<A | A2, E | E2, R | R2>
|
|
3819
3819
|
} = dual(
|
|
3820
|
-
|
|
3820
|
+
(args) => isStream(args[0]) && isStream(args[1]),
|
|
3821
3821
|
<A, E, R, A2, E2, R2>(
|
|
3822
3822
|
self: Stream<A, E, R>,
|
|
3823
3823
|
that: Stream<A2, E2, R2>,
|
package/src/String.ts
CHANGED
|
@@ -10,6 +10,7 @@ import * as Equ from "./Equivalence.ts"
|
|
|
10
10
|
import { dual } from "./Function.ts"
|
|
11
11
|
import * as readonlyArray from "./internal/array.ts"
|
|
12
12
|
import * as number from "./Number.ts"
|
|
13
|
+
import * as Option from "./Option.ts"
|
|
13
14
|
import * as order from "./Order.ts"
|
|
14
15
|
import type * as Ordering from "./Ordering.ts"
|
|
15
16
|
import type { Refinement } from "./Predicate.ts"
|
|
@@ -534,15 +535,15 @@ export const endsWith = (searchString: string, position?: number) => (self: stri
|
|
|
534
535
|
self.endsWith(searchString, position)
|
|
535
536
|
|
|
536
537
|
/**
|
|
537
|
-
* Returns the character code at the specified index, or `
|
|
538
|
+
* Returns the character code at the specified index, or `None` if the index is out of bounds.
|
|
538
539
|
*
|
|
539
540
|
* **Example**
|
|
540
541
|
*
|
|
541
542
|
* ```ts
|
|
542
543
|
* import { String } from "effect"
|
|
543
544
|
*
|
|
544
|
-
* String.charCodeAt("abc", 1) // 98
|
|
545
|
-
* String.charCodeAt("abc", 4) //
|
|
545
|
+
* String.charCodeAt("abc", 1) // Option.some(98)
|
|
546
|
+
* String.charCodeAt("abc", 4) // Option.none()
|
|
546
547
|
* ```
|
|
547
548
|
*
|
|
548
549
|
* @category elements
|
|
@@ -550,43 +551,41 @@ export const endsWith = (searchString: string, position?: number) => (self: stri
|
|
|
550
551
|
*/
|
|
551
552
|
export const charCodeAt: {
|
|
552
553
|
/**
|
|
553
|
-
* Returns the character code at the specified index, or `
|
|
554
|
+
* Returns the character code at the specified index, or `None` if the index is out of bounds.
|
|
554
555
|
*
|
|
555
556
|
* **Example**
|
|
556
557
|
*
|
|
557
558
|
* ```ts
|
|
558
559
|
* import { String } from "effect"
|
|
559
560
|
*
|
|
560
|
-
* String.charCodeAt("abc", 1) // 98
|
|
561
|
-
* String.charCodeAt("abc", 4) //
|
|
561
|
+
* String.charCodeAt("abc", 1) // Option.some(98)
|
|
562
|
+
* String.charCodeAt("abc", 4) // Option.none()
|
|
562
563
|
* ```
|
|
563
564
|
*
|
|
564
565
|
* @category elements
|
|
565
566
|
* @since 2.0.0
|
|
566
567
|
*/
|
|
567
|
-
(index: number): (self: string) => number
|
|
568
|
+
(index: number): (self: string) => Option.Option<number>
|
|
568
569
|
/**
|
|
569
|
-
* Returns the character code at the specified index, or `
|
|
570
|
+
* Returns the character code at the specified index, or `None` if the index is out of bounds.
|
|
570
571
|
*
|
|
571
572
|
* **Example**
|
|
572
573
|
*
|
|
573
574
|
* ```ts
|
|
574
575
|
* import { String } from "effect"
|
|
575
576
|
*
|
|
576
|
-
* String.charCodeAt("abc", 1) // 98
|
|
577
|
-
* String.charCodeAt("abc", 4) //
|
|
577
|
+
* String.charCodeAt("abc", 1) // Option.some(98)
|
|
578
|
+
* String.charCodeAt("abc", 4) // Option.none()
|
|
578
579
|
* ```
|
|
579
580
|
*
|
|
580
581
|
* @category elements
|
|
581
582
|
* @since 2.0.0
|
|
582
583
|
*/
|
|
583
|
-
(self: string, index: number): number
|
|
584
|
+
(self: string, index: number): Option.Option<number>
|
|
584
585
|
} = dual(
|
|
585
586
|
2,
|
|
586
|
-
(self: string, index: number): number
|
|
587
|
-
|
|
588
|
-
return isNaN(out) ? undefined : out
|
|
589
|
-
}
|
|
587
|
+
(self: string, index: number): Option.Option<number> =>
|
|
588
|
+
Option.filter(Option.some(self.charCodeAt(index)), (charCode) => !isNaN(charCode))
|
|
590
589
|
)
|
|
591
590
|
|
|
592
591
|
/**
|
|
@@ -607,23 +606,54 @@ export const charCodeAt: {
|
|
|
607
606
|
export const substring = (start: number, end?: number) => (self: string): string => self.substring(start, end)
|
|
608
607
|
|
|
609
608
|
/**
|
|
610
|
-
*
|
|
609
|
+
* Returns the character at the specified index, or `None` if the index is out of bounds.
|
|
611
610
|
*
|
|
612
611
|
* **Example**
|
|
613
612
|
*
|
|
614
613
|
* ```ts
|
|
615
614
|
* import { pipe, String } from "effect"
|
|
616
615
|
*
|
|
617
|
-
* pipe("abc", String.at(1)) // "b"
|
|
618
|
-
* pipe("abc", String.at(4)) //
|
|
616
|
+
* pipe("abc", String.at(1)) // Option.some("b")
|
|
617
|
+
* pipe("abc", String.at(4)) // Option.none()
|
|
619
618
|
* ```
|
|
620
619
|
*
|
|
621
620
|
* @category elements
|
|
622
621
|
* @since 2.0.0
|
|
623
622
|
*/
|
|
624
|
-
export const at
|
|
625
|
-
|
|
626
|
-
|
|
623
|
+
export const at: {
|
|
624
|
+
/**
|
|
625
|
+
* Returns the character at the specified index, or `None` if the index is out of bounds.
|
|
626
|
+
*
|
|
627
|
+
* **Example**
|
|
628
|
+
*
|
|
629
|
+
* ```ts
|
|
630
|
+
* import { pipe, String } from "effect"
|
|
631
|
+
*
|
|
632
|
+
* pipe("abc", String.at(1)) // Option.some("b")
|
|
633
|
+
* pipe("abc", String.at(4)) // Option.none()
|
|
634
|
+
* ```
|
|
635
|
+
*
|
|
636
|
+
* @category elements
|
|
637
|
+
* @since 2.0.0
|
|
638
|
+
*/
|
|
639
|
+
(index: number): (self: string) => Option.Option<string>
|
|
640
|
+
/**
|
|
641
|
+
* Returns the character at the specified index, or `None` if the index is out of bounds.
|
|
642
|
+
*
|
|
643
|
+
* **Example**
|
|
644
|
+
*
|
|
645
|
+
* ```ts
|
|
646
|
+
* import { pipe, String } from "effect"
|
|
647
|
+
*
|
|
648
|
+
* pipe("abc", String.at(1)) // Option.some("b")
|
|
649
|
+
* pipe("abc", String.at(4)) // Option.none()
|
|
650
|
+
* ```
|
|
651
|
+
*
|
|
652
|
+
* @category elements
|
|
653
|
+
* @since 2.0.0
|
|
654
|
+
*/
|
|
655
|
+
(self: string, index: number): Option.Option<string>
|
|
656
|
+
} = dual(2, (self: string, index: number): Option.Option<string> => Option.fromUndefinedOr(self.at(index)))
|
|
627
657
|
|
|
628
658
|
/**
|
|
629
659
|
* Returns the character at the specified index, or `None` if the index is out of bounds.
|
|
@@ -633,8 +663,8 @@ export const at = (index: number) => (self: string): string | undefined => {
|
|
|
633
663
|
* ```ts
|
|
634
664
|
* import { pipe, String } from "effect"
|
|
635
665
|
*
|
|
636
|
-
* pipe("abc", String.charAt(1)) // "b"
|
|
637
|
-
* pipe("abc", String.charAt(4)) //
|
|
666
|
+
* pipe("abc", String.charAt(1)) // Option.some("b")
|
|
667
|
+
* pipe("abc", String.charAt(4)) // Option.none()
|
|
638
668
|
* ```
|
|
639
669
|
*
|
|
640
670
|
* @category elements
|
|
@@ -649,14 +679,14 @@ export const charAt: {
|
|
|
649
679
|
* ```ts
|
|
650
680
|
* import { pipe, String } from "effect"
|
|
651
681
|
*
|
|
652
|
-
* pipe("abc", String.charAt(1)) // "b"
|
|
653
|
-
* pipe("abc", String.charAt(4)) //
|
|
682
|
+
* pipe("abc", String.charAt(1)) // Option.some("b")
|
|
683
|
+
* pipe("abc", String.charAt(4)) // Option.none()
|
|
654
684
|
* ```
|
|
655
685
|
*
|
|
656
686
|
* @category elements
|
|
657
687
|
* @since 2.0.0
|
|
658
688
|
*/
|
|
659
|
-
(index: number): (self: string) => string
|
|
689
|
+
(index: number): (self: string) => Option.Option<string>
|
|
660
690
|
/**
|
|
661
691
|
* Returns the character at the specified index, or `None` if the index is out of bounds.
|
|
662
692
|
*
|
|
@@ -665,40 +695,68 @@ export const charAt: {
|
|
|
665
695
|
* ```ts
|
|
666
696
|
* import { pipe, String } from "effect"
|
|
667
697
|
*
|
|
668
|
-
* pipe("abc", String.charAt(1)) // "b"
|
|
669
|
-
* pipe("abc", String.charAt(4)) //
|
|
698
|
+
* pipe("abc", String.charAt(1)) // Option.some("b")
|
|
699
|
+
* pipe("abc", String.charAt(4)) // Option.none()
|
|
670
700
|
* ```
|
|
671
701
|
*
|
|
672
702
|
* @category elements
|
|
673
703
|
* @since 2.0.0
|
|
674
704
|
*/
|
|
675
|
-
(self: string, index: number): string
|
|
705
|
+
(self: string, index: number): Option.Option<string>
|
|
676
706
|
} = dual(
|
|
677
707
|
2,
|
|
678
|
-
(self: string, index: number): string
|
|
679
|
-
const out = self.charAt(index)
|
|
680
|
-
return isNonEmpty(out) ? out : undefined
|
|
681
|
-
}
|
|
708
|
+
(self: string, index: number): Option.Option<string> => Option.filter(Option.some(self.charAt(index)), isNonEmpty)
|
|
682
709
|
)
|
|
683
710
|
|
|
684
711
|
/**
|
|
685
|
-
*
|
|
712
|
+
* Returns the Unicode code point at the specified index, or `None` if the index is out of bounds.
|
|
686
713
|
*
|
|
687
714
|
* **Example**
|
|
688
715
|
*
|
|
689
716
|
* ```ts
|
|
690
717
|
* import { pipe, String } from "effect"
|
|
691
718
|
*
|
|
692
|
-
* pipe("abc", String.codePointAt(1)) // 98
|
|
693
|
-
* pipe("abc", String.codePointAt(10)) //
|
|
719
|
+
* pipe("abc", String.codePointAt(1)) // Option.some(98)
|
|
720
|
+
* pipe("abc", String.codePointAt(10)) // Option.none()
|
|
694
721
|
* ```
|
|
695
722
|
*
|
|
696
723
|
* @category elements
|
|
697
724
|
* @since 2.0.0
|
|
698
725
|
*/
|
|
699
|
-
export const codePointAt
|
|
700
|
-
|
|
701
|
-
|
|
726
|
+
export const codePointAt: {
|
|
727
|
+
/**
|
|
728
|
+
* Returns the Unicode code point at the specified index, or `None` if the index is out of bounds.
|
|
729
|
+
*
|
|
730
|
+
* **Example**
|
|
731
|
+
*
|
|
732
|
+
* ```ts
|
|
733
|
+
* import { pipe, String } from "effect"
|
|
734
|
+
*
|
|
735
|
+
* pipe("abc", String.codePointAt(1)) // Option.some(98)
|
|
736
|
+
* pipe("abc", String.codePointAt(10)) // Option.none()
|
|
737
|
+
* ```
|
|
738
|
+
*
|
|
739
|
+
* @category elements
|
|
740
|
+
* @since 2.0.0
|
|
741
|
+
*/
|
|
742
|
+
(index: number): (self: string) => Option.Option<number>
|
|
743
|
+
/**
|
|
744
|
+
* Returns the Unicode code point at the specified index, or `None` if the index is out of bounds.
|
|
745
|
+
*
|
|
746
|
+
* **Example**
|
|
747
|
+
*
|
|
748
|
+
* ```ts
|
|
749
|
+
* import { pipe, String } from "effect"
|
|
750
|
+
*
|
|
751
|
+
* pipe("abc", String.codePointAt(1)) // Option.some(98)
|
|
752
|
+
* pipe("abc", String.codePointAt(10)) // Option.none()
|
|
753
|
+
* ```
|
|
754
|
+
*
|
|
755
|
+
* @category elements
|
|
756
|
+
* @since 2.0.0
|
|
757
|
+
*/
|
|
758
|
+
(self: string, index: number): Option.Option<number>
|
|
759
|
+
} = dual(2, (self: string, index: number): Option.Option<number> => Option.fromUndefinedOr(self.codePointAt(index)))
|
|
702
760
|
|
|
703
761
|
/**
|
|
704
762
|
* Returns the index of the first occurrence of a substring, or `None` if not found.
|
|
@@ -708,17 +766,15 @@ export const codePointAt = (index: number) => (self: string): number | undefined
|
|
|
708
766
|
* ```ts
|
|
709
767
|
* import { pipe, String } from "effect"
|
|
710
768
|
*
|
|
711
|
-
* pipe("abbbc", String.indexOf("b")) // 1
|
|
712
|
-
* pipe("abbbc", String.indexOf("z")) //
|
|
769
|
+
* pipe("abbbc", String.indexOf("b")) // Option.some(1)
|
|
770
|
+
* pipe("abbbc", String.indexOf("z")) // Option.none()
|
|
713
771
|
* ```
|
|
714
772
|
*
|
|
715
773
|
* @category searching
|
|
716
774
|
* @since 2.0.0
|
|
717
775
|
*/
|
|
718
|
-
export const indexOf = (searchString: string) => (self: string): number
|
|
719
|
-
|
|
720
|
-
return out >= 0 ? out : undefined
|
|
721
|
-
}
|
|
776
|
+
export const indexOf = (searchString: string) => (self: string): Option.Option<number> =>
|
|
777
|
+
Option.filter(Option.some(self.indexOf(searchString)), number.isGreaterThanOrEqualTo(0))
|
|
722
778
|
|
|
723
779
|
/**
|
|
724
780
|
* Returns the index of the last occurrence of a substring, or `None` if not found.
|
|
@@ -728,17 +784,15 @@ export const indexOf = (searchString: string) => (self: string): number | undefi
|
|
|
728
784
|
* ```ts
|
|
729
785
|
* import { pipe, String } from "effect"
|
|
730
786
|
*
|
|
731
|
-
* pipe("abbbc", String.lastIndexOf("b")) // 3
|
|
732
|
-
* pipe("abbbc", String.lastIndexOf("d")) //
|
|
787
|
+
* pipe("abbbc", String.lastIndexOf("b")) // Option.some(3)
|
|
788
|
+
* pipe("abbbc", String.lastIndexOf("d")) // Option.none()
|
|
733
789
|
* ```
|
|
734
790
|
*
|
|
735
791
|
* @category searching
|
|
736
792
|
* @since 2.0.0
|
|
737
793
|
*/
|
|
738
|
-
export const lastIndexOf = (searchString: string) => (self: string): number
|
|
739
|
-
|
|
740
|
-
return out >= 0 ? out : undefined
|
|
741
|
-
}
|
|
794
|
+
export const lastIndexOf = (searchString: string) => (self: string): Option.Option<number> =>
|
|
795
|
+
Option.filter(Option.some(self.lastIndexOf(searchString)), number.isGreaterThanOrEqualTo(0))
|
|
742
796
|
|
|
743
797
|
/**
|
|
744
798
|
* Compares two strings according to the current locale.
|
|
@@ -768,14 +822,15 @@ export const localeCompare =
|
|
|
768
822
|
* ```ts
|
|
769
823
|
* import { pipe, String } from "effect"
|
|
770
824
|
*
|
|
771
|
-
* pipe("hello", String.match(/l+/)) // ["ll"]
|
|
772
|
-
* pipe("hello", String.match(/x/)) //
|
|
825
|
+
* pipe("hello", String.match(/l+/)) // Option.some(["ll"])
|
|
826
|
+
* pipe("hello", String.match(/x/)) // Option.none()
|
|
773
827
|
* ```
|
|
774
828
|
*
|
|
775
829
|
* @category searching
|
|
776
830
|
* @since 2.0.0
|
|
777
831
|
*/
|
|
778
|
-
export const match = (regExp: RegExp | string) => (self: string): RegExpMatchArray
|
|
832
|
+
export const match = (regExp: RegExp | string) => (self: string): Option.Option<RegExpMatchArray> =>
|
|
833
|
+
Option.fromNullOr(self.match(regExp))
|
|
779
834
|
|
|
780
835
|
/**
|
|
781
836
|
* It is the `pipe`-able version of the native `matchAll` method.
|
|
@@ -896,9 +951,9 @@ export const replaceAll = (searchValue: string | RegExp, replaceValue: string) =
|
|
|
896
951
|
* ```ts
|
|
897
952
|
* import { String } from "effect"
|
|
898
953
|
*
|
|
899
|
-
* String.search("ababb", "b") // 1
|
|
900
|
-
* String.search("ababb",
|
|
901
|
-
* String.search("ababb", "d") //
|
|
954
|
+
* String.search("ababb", "b") // Option.some(1)
|
|
955
|
+
* String.search("ababb", /abb/) // Option.some(2)
|
|
956
|
+
* String.search("ababb", "d") // Option.none()
|
|
902
957
|
* ```
|
|
903
958
|
*
|
|
904
959
|
* @category searching
|
|
@@ -913,15 +968,15 @@ export const search: {
|
|
|
913
968
|
* ```ts
|
|
914
969
|
* import { String } from "effect"
|
|
915
970
|
*
|
|
916
|
-
* String.search("ababb", "b") // 1
|
|
917
|
-
* String.search("ababb",
|
|
918
|
-
* String.search("ababb", "d") //
|
|
971
|
+
* String.search("ababb", "b") // Option.some(1)
|
|
972
|
+
* String.search("ababb", /abb/) // Option.some(2)
|
|
973
|
+
* String.search("ababb", "d") // Option.none()
|
|
919
974
|
* ```
|
|
920
975
|
*
|
|
921
976
|
* @category searching
|
|
922
977
|
* @since 2.0.0
|
|
923
978
|
*/
|
|
924
|
-
(regExp: RegExp | string): (self: string) => number
|
|
979
|
+
(regExp: RegExp | string): (self: string) => Option.Option<number>
|
|
925
980
|
/**
|
|
926
981
|
* Searches for a match between a regular expression and the string.
|
|
927
982
|
*
|
|
@@ -930,21 +985,19 @@ export const search: {
|
|
|
930
985
|
* ```ts
|
|
931
986
|
* import { String } from "effect"
|
|
932
987
|
*
|
|
933
|
-
* String.search("ababb", "b") // 1
|
|
934
|
-
* String.search("ababb",
|
|
935
|
-
* String.search("ababb", "d") //
|
|
988
|
+
* String.search("ababb", "b") // Option.some(1)
|
|
989
|
+
* String.search("ababb", /abb/) // Option.some(2)
|
|
990
|
+
* String.search("ababb", "d") // Option.none()
|
|
936
991
|
* ```
|
|
937
992
|
*
|
|
938
993
|
* @category searching
|
|
939
994
|
* @since 2.0.0
|
|
940
995
|
*/
|
|
941
|
-
(self: string, regExp: RegExp | string): number
|
|
996
|
+
(self: string, regExp: RegExp | string): Option.Option<number>
|
|
942
997
|
} = dual(
|
|
943
998
|
2,
|
|
944
|
-
(self: string, regExp: RegExp | string): number
|
|
945
|
-
|
|
946
|
-
return out >= 0 ? out : undefined
|
|
947
|
-
}
|
|
999
|
+
(self: string, regExp: RegExp | string): Option.Option<number> =>
|
|
1000
|
+
Option.filter(Option.some(self.search(regExp)), number.isGreaterThanOrEqualTo(0))
|
|
948
1001
|
)
|
|
949
1002
|
|
|
950
1003
|
/**
|