effect 4.0.0-beta.101 → 4.0.0-beta.102
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.map +1 -1
- package/dist/Array.js +81 -5
- package/dist/Array.js.map +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +27 -9
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +6 -5
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.js +7 -7
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +2 -1
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +61 -100
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +66 -39
- package/dist/Effect.js.map +1 -1
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +3 -2
- package/dist/FiberHandle.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +2 -1
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +4 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +9 -11
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +3 -2
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +9 -0
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +3 -0
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +4 -3
- package/dist/Metric.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -4
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +2 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Record.d.ts +93 -1
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +57 -19
- package/dist/Record.js.map +1 -1
- package/dist/References.d.ts +0 -45
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +0 -45
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +9 -6
- package/dist/Request.js.map +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +2 -1
- package/dist/Result.js.map +1 -1
- package/dist/Schema.d.ts +1268 -495
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2308 -614
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +189 -130
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.js +1 -1
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +13 -11
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +34 -24
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.js +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +1 -12
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +403 -1504
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +294 -2852
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.js +3 -3
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +5 -3
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +15 -9
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +46 -16
- package/dist/Stream.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +5 -4
- package/dist/Struct.js.map +1 -1
- package/dist/Types.d.ts +1 -3
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +2 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +64 -21
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/record.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/references.js +0 -4
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/schema/annotations.js +12 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +743 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +252 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- package/dist/internal/schema/schema.js +28 -40
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +466 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +369 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/testing/TestClock.js +4 -1
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +26 -26
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +5 -4
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +21 -6
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +86 -316
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -1
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +19 -17
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +197 -197
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +13 -13
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +4 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +116 -49
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +32 -10
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +193 -377
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +19 -19
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +14 -14
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +4 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +11 -3
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +9 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -10
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +15 -12
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +316 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- package/dist/unstable/cli/CliError.d.ts +40 -2
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +45 -6
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.js +14 -5
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Param.js +3 -3
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +3 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +11 -4
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.js +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +2 -1
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/Reply.js +1 -1
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +125 -24
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +10 -2
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +55 -24
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +109 -62
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +19 -7
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.js +1 -1
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +15 -11
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +8 -3
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +24 -22
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.js +8 -8
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +14 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +5 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +17 -15
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +17 -14
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +5 -5
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +37 -24
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +72 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +69 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +7 -3
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +5 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +2 -2
- package/dist/unstable/persistence/RateLimiter.js +2 -2
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +3 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +4 -3
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +83 -0
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +31 -0
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +2 -1
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +13 -10
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.js +1 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +2 -2
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +7 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +86 -25
- package/src/Channel.ts +32 -14
- package/src/Config.ts +6 -5
- package/src/ConfigProvider.ts +7 -7
- package/src/Data.ts +3 -2
- package/src/Effect.ts +70 -116
- package/src/FiberHandle.ts +3 -2
- package/src/Iterable.ts +2 -1
- package/src/JsonPatch.ts +4 -3
- package/src/JsonSchema.ts +9 -11
- package/src/Logger.ts +3 -2
- package/src/ManagedRuntime.ts +13 -0
- package/src/Metric.ts +4 -3
- package/src/Optic.ts +5 -4
- package/src/Option.ts +2 -1
- package/src/PartitionedSemaphore.ts +1 -4
- package/src/Record.ts +119 -22
- package/src/References.ts +0 -46
- package/src/Request.ts +5 -7
- package/src/Result.ts +2 -1
- package/src/Schema.ts +2537 -986
- package/src/SchemaAST.ts +228 -149
- package/src/SchemaError.ts +1 -1
- package/src/SchemaGetter.ts +36 -29
- package/src/SchemaIssue.ts +1 -1
- package/src/SchemaParser.ts +1 -25
- package/src/SchemaRepresentation.ts +697 -3398
- package/src/SchemaTransformation.ts +3 -3
- package/src/Semaphore.ts +5 -3
- package/src/Stream.ts +63 -19
- package/src/Struct.ts +5 -4
- package/src/Types.ts +1 -3
- package/src/index.ts +0 -5
- package/src/internal/core.ts +3 -2
- package/src/internal/effect.ts +67 -31
- package/src/internal/matcher.ts +1 -1
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +0 -5
- package/src/internal/schema/annotations.ts +44 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +957 -0
- package/src/internal/schema/fromRepresentation.ts +345 -0
- package/src/internal/schema/schema.ts +45 -46
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +475 -0
- package/src/internal/schema/toRepresentation.ts +401 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/testing/TestClock.ts +1 -1
- package/src/unstable/ai/AiError.ts +5 -4
- package/src/unstable/ai/AnthropicStructuredOutput.ts +102 -333
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +30 -28
- package/src/unstable/ai/McpSchema.ts +15 -15
- package/src/unstable/ai/McpServer.ts +172 -56
- package/src/unstable/ai/OpenAiStructuredOutput.ts +230 -395
- package/src/unstable/ai/Response.ts +24 -24
- package/src/unstable/ai/Tool.ts +22 -4
- package/src/unstable/ai/Toolkit.ts +19 -7
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- package/src/unstable/ai/internal/structured-output.ts +458 -0
- package/src/unstable/cli/CliError.ts +51 -5
- package/src/unstable/cli/Command.ts +4 -4
- package/src/unstable/cli/Param.ts +3 -3
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/internal/command.ts +13 -5
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +3 -3
- package/src/unstable/cluster/Entity.ts +1 -1
- package/src/unstable/cluster/Envelope.ts +2 -1
- package/src/unstable/cluster/Reply.ts +1 -1
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +161 -34
- package/src/unstable/cluster/ShardingConfig.ts +5 -1
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +83 -35
- package/src/unstable/cluster/SqlRunnerStorage.ts +186 -116
- package/src/unstable/cluster/internal/entityManager.ts +31 -10
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/eventlog/EventJournal.ts +1 -1
- package/src/unstable/eventlog/EventLog.ts +21 -11
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +10 -3
- package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +29 -24
- package/src/unstable/http/Headers.ts +8 -8
- package/src/unstable/http/HttpClientRequest.ts +57 -0
- package/src/unstable/http/HttpServerRequest.ts +5 -4
- package/src/unstable/http/Multipart.ts +16 -13
- package/src/unstable/http/Template.ts +1 -1
- package/src/unstable/http/UrlParams.ts +17 -14
- package/src/unstable/httpapi/HttpApi.ts +3 -3
- package/src/unstable/httpapi/HttpApiClient.ts +5 -5
- package/src/unstable/httpapi/HttpApiGroup.ts +1 -1
- package/src/unstable/httpapi/OpenApi.ts +52 -28
- package/src/unstable/observability/OtlpExporter.ts +109 -5
- package/src/unstable/observability/OtlpLogger.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +8 -4
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +3 -2
- package/src/unstable/persistence/RateLimiter.ts +2 -2
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcessSpawner.ts +1 -1
- package/src/unstable/reactivity/AsyncResult.ts +4 -3
- package/src/unstable/reactivity/Atom.ts +92 -0
- package/src/unstable/reactivity/AtomRegistry.ts +1 -1
- package/src/unstable/rpc/RpcClient.ts +2 -1
- package/src/unstable/schema/VariantSchema.ts +14 -24
- package/src/unstable/socket/Socket.ts +1 -1
- package/src/unstable/sql/SqlError.ts +2 -2
- package/src/unstable/sql/Statement.ts +7 -6
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- package/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
|
@@ -195,7 +195,7 @@ export class Transformation<in out T, in out E, RD = never, RE = never> {
|
|
|
195
195
|
* @since 4.0.0
|
|
196
196
|
*/
|
|
197
197
|
export function isTransformation(u: unknown): u is Transformation<any, any, unknown, unknown> {
|
|
198
|
-
return Predicate.hasProperty(u, TypeId)
|
|
198
|
+
return Predicate.hasProperty(u, TypeId) && u[TypeId] === TypeId
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/**
|
|
@@ -852,8 +852,8 @@ export const bigintFromString = new Transformation(
|
|
|
852
852
|
*
|
|
853
853
|
* **When to use**
|
|
854
854
|
*
|
|
855
|
-
* Use when you need a schema transformation to parse
|
|
856
|
-
*
|
|
855
|
+
* Use when you need a schema transformation to parse date strings from APIs or
|
|
856
|
+
* user input.
|
|
857
857
|
*
|
|
858
858
|
* **Details**
|
|
859
859
|
*
|
package/src/Semaphore.ts
CHANGED
|
@@ -118,9 +118,11 @@ export interface Semaphore {
|
|
|
118
118
|
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* Acquires the specified number of permits and returns the
|
|
122
|
-
*
|
|
123
|
-
*
|
|
121
|
+
* Acquires the specified number of permits and returns the acquired permit
|
|
122
|
+
* count, suspending the task if they are not yet available. Pending `take`
|
|
123
|
+
* calls are scanned in registration order, but a request is served only when
|
|
124
|
+
* enough permits are available, so a smaller later request may overtake a
|
|
125
|
+
* larger earlier request.
|
|
124
126
|
*
|
|
125
127
|
* **When to use**
|
|
126
128
|
*
|
package/src/Stream.ts
CHANGED
|
@@ -9311,7 +9311,8 @@ export const catchReasons: {
|
|
|
9311
9311
|
}[keyof Cases]
|
|
9312
9312
|
>
|
|
9313
9313
|
} = dual((args) => isStream(args[0]), (self, errorTag, cases, orElse) => {
|
|
9314
|
-
const handlers: Record<string, (reason: any, error: any) => Channel.Channel<any, any, any, any, any, any, any>> =
|
|
9314
|
+
const handlers: Record<string, (reason: any, error: any) => Channel.Channel<any, any, any, any, any, any, any>> =
|
|
9315
|
+
Object.create(null)
|
|
9315
9316
|
for (const key of Object.keys(cases)) {
|
|
9316
9317
|
const handler = (cases as any)[key]
|
|
9317
9318
|
handlers[key] = (reason, error) => handler(reason, error).channel
|
|
@@ -17133,7 +17134,7 @@ export const interruptWhen: {
|
|
|
17133
17134
|
)
|
|
17134
17135
|
|
|
17135
17136
|
/**
|
|
17136
|
-
* Stops a stream after the current
|
|
17137
|
+
* Stops a stream after the current pull when an effect completes.
|
|
17137
17138
|
*
|
|
17138
17139
|
* **When to use**
|
|
17139
17140
|
*
|
|
@@ -17146,8 +17147,10 @@ export const interruptWhen: {
|
|
|
17146
17147
|
*
|
|
17147
17148
|
* **Gotchas**
|
|
17148
17149
|
*
|
|
17149
|
-
* This does not interrupt an in-progress pull.
|
|
17150
|
-
*
|
|
17150
|
+
* This does not interrupt or truncate an in-progress pull. A pull may emit
|
|
17151
|
+
* multiple elements in a single chunk, in which case the entire chunk is
|
|
17152
|
+
* emitted. Use {@link interruptWhen} when the stream should be interrupted
|
|
17153
|
+
* immediately.
|
|
17151
17154
|
*
|
|
17152
17155
|
* **Example** (Halting a stream after an effect completes)
|
|
17153
17156
|
*
|
|
@@ -17174,7 +17177,7 @@ export const interruptWhen: {
|
|
|
17174
17177
|
*/
|
|
17175
17178
|
export const haltWhen: {
|
|
17176
17179
|
/**
|
|
17177
|
-
* Stops a stream after the current
|
|
17180
|
+
* Stops a stream after the current pull when an effect completes.
|
|
17178
17181
|
*
|
|
17179
17182
|
* **When to use**
|
|
17180
17183
|
*
|
|
@@ -17187,8 +17190,10 @@ export const haltWhen: {
|
|
|
17187
17190
|
*
|
|
17188
17191
|
* **Gotchas**
|
|
17189
17192
|
*
|
|
17190
|
-
* This does not interrupt an in-progress pull.
|
|
17191
|
-
*
|
|
17193
|
+
* This does not interrupt or truncate an in-progress pull. A pull may emit
|
|
17194
|
+
* multiple elements in a single chunk, in which case the entire chunk is
|
|
17195
|
+
* emitted. Use {@link interruptWhen} when the stream should be interrupted
|
|
17196
|
+
* immediately.
|
|
17192
17197
|
*
|
|
17193
17198
|
* **Example** (Halting a stream after an effect completes)
|
|
17194
17199
|
*
|
|
@@ -17215,7 +17220,7 @@ export const haltWhen: {
|
|
|
17215
17220
|
*/
|
|
17216
17221
|
<X, E2, R2>(effect: Effect.Effect<X, E2, R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E2 | E, R2 | R>
|
|
17217
17222
|
/**
|
|
17218
|
-
* Stops a stream after the current
|
|
17223
|
+
* Stops a stream after the current pull when an effect completes.
|
|
17219
17224
|
*
|
|
17220
17225
|
* **When to use**
|
|
17221
17226
|
*
|
|
@@ -17228,8 +17233,10 @@ export const haltWhen: {
|
|
|
17228
17233
|
*
|
|
17229
17234
|
* **Gotchas**
|
|
17230
17235
|
*
|
|
17231
|
-
* This does not interrupt an in-progress pull.
|
|
17232
|
-
*
|
|
17236
|
+
* This does not interrupt or truncate an in-progress pull. A pull may emit
|
|
17237
|
+
* multiple elements in a single chunk, in which case the entire chunk is
|
|
17238
|
+
* emitted. Use {@link interruptWhen} when the stream should be interrupted
|
|
17239
|
+
* immediately.
|
|
17233
17240
|
*
|
|
17234
17241
|
* **Example** (Halting a stream after an effect completes)
|
|
17235
17242
|
*
|
|
@@ -20193,32 +20200,69 @@ export const toAsyncIterableWith: {
|
|
|
20193
20200
|
): AsyncIterable<A> => ({
|
|
20194
20201
|
[Symbol.asyncIterator]() {
|
|
20195
20202
|
const runPromise = Effect.runPromiseWith(context)
|
|
20196
|
-
const
|
|
20203
|
+
const runFork = Effect.runForkWith(context)
|
|
20197
20204
|
const scope = Scope.makeUnsafe()
|
|
20198
20205
|
let pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> | undefined
|
|
20199
20206
|
let currentIter: Iterator<A> | undefined
|
|
20207
|
+
let currentFiber: Fiber.Fiber<Arr.NonEmptyReadonlyArray<A>, E | Cause.Done<void>> | undefined
|
|
20208
|
+
let closePromise: Promise<IteratorResult<A>> | undefined
|
|
20209
|
+
const close = (exit: Exit.Exit<unknown, unknown>): Promise<IteratorResult<A>> => {
|
|
20210
|
+
if (closePromise) return closePromise
|
|
20211
|
+
const fiber = currentFiber
|
|
20212
|
+
closePromise = runPromise(Effect.as(
|
|
20213
|
+
Effect.andThen(
|
|
20214
|
+
fiber ? Fiber.interrupt(fiber) : Effect.void,
|
|
20215
|
+
Scope.close(scope, exit)
|
|
20216
|
+
),
|
|
20217
|
+
{ done: true, value: undefined }
|
|
20218
|
+
))
|
|
20219
|
+
return closePromise
|
|
20220
|
+
}
|
|
20221
|
+
const closeAndReportError = async (exit: Exit.Exit<unknown, unknown>): Promise<void> => {
|
|
20222
|
+
try {
|
|
20223
|
+
await close(exit)
|
|
20224
|
+
} catch (error) {
|
|
20225
|
+
await runPromise(Effect.logError("Suppressed error while closing Stream async iterator", error))
|
|
20226
|
+
}
|
|
20227
|
+
}
|
|
20200
20228
|
return {
|
|
20201
20229
|
async next(): Promise<IteratorResult<A>> {
|
|
20230
|
+
if (closePromise) return closePromise
|
|
20202
20231
|
if (currentIter) {
|
|
20203
20232
|
const next = currentIter.next()
|
|
20204
20233
|
if (!next.done) return next
|
|
20205
20234
|
currentIter = undefined
|
|
20206
20235
|
}
|
|
20207
|
-
|
|
20208
|
-
|
|
20236
|
+
const fiber = runFork(
|
|
20237
|
+
pull ??
|
|
20238
|
+
Effect.flatMap(Channel.toPullScoped(self.channel, scope), (nextPull) => {
|
|
20239
|
+
pull = nextPull
|
|
20240
|
+
return nextPull
|
|
20241
|
+
})
|
|
20242
|
+
)
|
|
20243
|
+
currentFiber = fiber
|
|
20244
|
+
const exit = await runPromise(Fiber.await(fiber))
|
|
20245
|
+
if (currentFiber === fiber) {
|
|
20246
|
+
currentFiber = undefined
|
|
20247
|
+
}
|
|
20209
20248
|
if (Exit.isSuccess(exit)) {
|
|
20210
20249
|
currentIter = exit.value[Symbol.iterator]()
|
|
20211
20250
|
return currentIter.next()
|
|
20212
20251
|
} else if (Pull.isDoneCause(exit.cause)) {
|
|
20213
|
-
return
|
|
20252
|
+
return close(Exit.void)
|
|
20214
20253
|
}
|
|
20254
|
+
if (closePromise && Cause.hasInterruptsOnly(exit.cause)) {
|
|
20255
|
+
return closePromise
|
|
20256
|
+
}
|
|
20257
|
+
await closeAndReportError(exit)
|
|
20215
20258
|
throw Cause.squash(exit.cause)
|
|
20216
20259
|
},
|
|
20217
|
-
return(
|
|
20218
|
-
return
|
|
20219
|
-
|
|
20220
|
-
|
|
20221
|
-
))
|
|
20260
|
+
return() {
|
|
20261
|
+
return close(Exit.void)
|
|
20262
|
+
},
|
|
20263
|
+
async throw(error) {
|
|
20264
|
+
await closeAndReportError(Exit.die(error))
|
|
20265
|
+
throw error
|
|
20222
20266
|
}
|
|
20223
20267
|
}
|
|
20224
20268
|
}
|
package/src/Struct.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import * as Combiner from "./Combiner.ts"
|
|
15
15
|
import * as Equivalence from "./Equivalence.ts"
|
|
16
16
|
import { dual } from "./Function.ts"
|
|
17
|
+
import * as InternalRecord from "./internal/record.ts"
|
|
17
18
|
import * as order from "./Order.ts"
|
|
18
19
|
import * as Reducer from "./Reducer.ts"
|
|
19
20
|
|
|
@@ -1464,7 +1465,7 @@ function buildStruct<
|
|
|
1464
1465
|
const res = f(k, source[k])
|
|
1465
1466
|
if (res) {
|
|
1466
1467
|
const [nk, nv] = res
|
|
1467
|
-
out
|
|
1468
|
+
InternalRecord.assignProperty(out, nk, nv)
|
|
1468
1469
|
}
|
|
1469
1470
|
}
|
|
1470
1471
|
return out
|
|
@@ -1516,7 +1517,7 @@ export function makeCombiner<A>(
|
|
|
1516
1517
|
for (const key of keys) {
|
|
1517
1518
|
const merge = combiners[key].combine(self[key], that[key])
|
|
1518
1519
|
if (omitKeyWhen(merge)) continue
|
|
1519
|
-
out
|
|
1520
|
+
InternalRecord.assignProperty(out as object, key, merge)
|
|
1520
1521
|
}
|
|
1521
1522
|
return out
|
|
1522
1523
|
})
|
|
@@ -1571,7 +1572,7 @@ export function makeReducer<A>(
|
|
|
1571
1572
|
for (const key of Reflect.ownKeys(reducers) as Array<keyof A>) {
|
|
1572
1573
|
const iv = reducers[key].initialValue
|
|
1573
1574
|
if (options?.omitKeyWhen?.(iv)) continue
|
|
1574
|
-
initialValue
|
|
1575
|
+
InternalRecord.assignProperty(initialValue as object, key, iv)
|
|
1575
1576
|
}
|
|
1576
1577
|
return Reducer.make(combine, initialValue)
|
|
1577
1578
|
}
|
|
@@ -1601,7 +1602,7 @@ export function Record<const Keys extends ReadonlyArray<string | symbol>, Value>
|
|
|
1601
1602
|
): Record<Keys[number], Value> {
|
|
1602
1603
|
const out: any = {}
|
|
1603
1604
|
for (const key of keys) {
|
|
1604
|
-
out
|
|
1605
|
+
InternalRecord.assignProperty(out, key, value)
|
|
1605
1606
|
}
|
|
1606
1607
|
return out
|
|
1607
1608
|
}
|
package/src/Types.ts
CHANGED
|
@@ -421,7 +421,6 @@ export type MergeRight<Target, Source> = Simplify<
|
|
|
421
421
|
*
|
|
422
422
|
* - `number` — run at most N effects concurrently.
|
|
423
423
|
* - `"unbounded"` — run all effects concurrently with no limit.
|
|
424
|
-
* - `"inherit"` — inherit the concurrency from the surrounding context.
|
|
425
424
|
*
|
|
426
425
|
* **Example** (Setting concurrency values)
|
|
427
426
|
*
|
|
@@ -431,13 +430,12 @@ export type MergeRight<Target, Source> = Simplify<
|
|
|
431
430
|
* const sequential: Types.Concurrency = 1
|
|
432
431
|
* const limited: Types.Concurrency = 5
|
|
433
432
|
* const unbounded: Types.Concurrency = "unbounded"
|
|
434
|
-
* const inherit: Types.Concurrency = "inherit"
|
|
435
433
|
* ```
|
|
436
434
|
*
|
|
437
435
|
* @category models
|
|
438
436
|
* @since 2.0.0
|
|
439
437
|
*/
|
|
440
|
-
export type Concurrency = number | "unbounded"
|
|
438
|
+
export type Concurrency = number | "unbounded"
|
|
441
439
|
|
|
442
440
|
/**
|
|
443
441
|
* Removes `readonly` from all properties of `T`. Supports arrays, tuples,
|
package/src/index.ts
CHANGED
|
@@ -556,11 +556,6 @@ export * as SchemaRepresentation from "./SchemaRepresentation.ts"
|
|
|
556
556
|
*/
|
|
557
557
|
export * as SchemaTransformation from "./SchemaTransformation.ts"
|
|
558
558
|
|
|
559
|
-
/**
|
|
560
|
-
* @since 4.0.0
|
|
561
|
-
*/
|
|
562
|
-
export * as SchemaUtils from "./SchemaUtils.ts"
|
|
563
|
-
|
|
564
559
|
/**
|
|
565
560
|
* @since 2.0.0
|
|
566
561
|
*/
|
package/src/internal/core.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { StackFrame } from "../References.ts"
|
|
|
13
13
|
import type * as Types from "../Types.ts"
|
|
14
14
|
import { SingleShotGen } from "../Utils.ts"
|
|
15
15
|
import type { FiberImpl } from "./effect.ts"
|
|
16
|
+
import * as InternalRecord from "./record.ts"
|
|
16
17
|
|
|
17
18
|
/** @internal */
|
|
18
19
|
export const EffectTypeId = `~effect/Effect` as const
|
|
@@ -587,10 +588,10 @@ export const Error: new<A extends Record<string, any> = {}>(
|
|
|
587
588
|
) => Cause.YieldableError & Readonly<A> = (function() {
|
|
588
589
|
const plainArgsSymbol = Symbol.for("effect/Data/Error/plainArgs")
|
|
589
590
|
return class Base extends YieldableError {
|
|
590
|
-
constructor(args: any) {
|
|
591
|
+
constructor(args: Record<string, any> | undefined) {
|
|
591
592
|
super(args?.message, args?.cause ? { cause: args.cause } : undefined)
|
|
592
593
|
if (args) {
|
|
593
|
-
|
|
594
|
+
InternalRecord.assignProperties(this, args)
|
|
594
595
|
// @effect-diagnostics-next-line floatingEffect:off
|
|
595
596
|
Object.defineProperty(this, plainArgsSymbol, {
|
|
596
597
|
value: args,
|
package/src/internal/effect.ts
CHANGED
|
@@ -83,8 +83,8 @@ import {
|
|
|
83
83
|
} from "./core.ts"
|
|
84
84
|
import * as doNotation from "./doNotation.ts"
|
|
85
85
|
import * as InternalMetric from "./metric.ts"
|
|
86
|
+
import * as InternalRecord from "./record.ts"
|
|
86
87
|
import {
|
|
87
|
-
CurrentConcurrency,
|
|
88
88
|
CurrentErrorReporters,
|
|
89
89
|
CurrentLogAnnotations,
|
|
90
90
|
CurrentLogLevel,
|
|
@@ -2111,6 +2111,32 @@ export const updateService: {
|
|
|
2111
2111
|
})
|
|
2112
2112
|
)
|
|
2113
2113
|
|
|
2114
|
+
/** @internal */
|
|
2115
|
+
export const updateServiceScoped = <I, A>(
|
|
2116
|
+
service: Context.Key<I, A>,
|
|
2117
|
+
update: (value: A) => A,
|
|
2118
|
+
options?: {
|
|
2119
|
+
readonly reset?: ((original: A, updated: A, current: A) => A) | undefined
|
|
2120
|
+
} | undefined
|
|
2121
|
+
): Effect.Effect<void, never, I | Scope.Scope> =>
|
|
2122
|
+
uninterruptible(withFiber((fiber) => {
|
|
2123
|
+
const original = Context.getUnsafe(fiber.context, service)
|
|
2124
|
+
const updated = update(original)
|
|
2125
|
+
fiber.setContext(Context.add(fiber.context, service, updated))
|
|
2126
|
+
return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), (_) => {
|
|
2127
|
+
const current = Context.getUnsafe(fiber.context, service)
|
|
2128
|
+
let next: A
|
|
2129
|
+
if (options?.reset === undefined) {
|
|
2130
|
+
if (current !== updated) return void_
|
|
2131
|
+
next = original
|
|
2132
|
+
} else {
|
|
2133
|
+
next = options.reset(original, updated, current)
|
|
2134
|
+
}
|
|
2135
|
+
fiber.setContext(Context.add(fiber.context, service, next))
|
|
2136
|
+
return void_
|
|
2137
|
+
})
|
|
2138
|
+
}))
|
|
2139
|
+
|
|
2114
2140
|
/** @internal */
|
|
2115
2141
|
export const context = <R = never>(): Effect.Effect<Context.Context<R>> => getContext as any
|
|
2116
2142
|
const getContext = withFiber((fiber) => succeed(fiber.context))
|
|
@@ -2222,17 +2248,6 @@ export const provideServiceEffect: {
|
|
|
2222
2248
|
flatMap(acquire, (implementation) => provideService(self, service, implementation))
|
|
2223
2249
|
)
|
|
2224
2250
|
|
|
2225
|
-
/** @internal */
|
|
2226
|
-
export const withConcurrency: {
|
|
2227
|
-
(
|
|
2228
|
-
concurrency: "unbounded" | number
|
|
2229
|
-
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
2230
|
-
<A, E, R>(
|
|
2231
|
-
self: Effect.Effect<A, E, R>,
|
|
2232
|
-
concurrency: "unbounded" | number
|
|
2233
|
-
): Effect.Effect<A, E, R>
|
|
2234
|
-
} = provideService(CurrentConcurrency)
|
|
2235
|
-
|
|
2236
2251
|
// ----------------------------------------------------------------------------
|
|
2237
2252
|
// zipping
|
|
2238
2253
|
// ----------------------------------------------------------------------------
|
|
@@ -4353,7 +4368,7 @@ export const all = <
|
|
|
4353
4368
|
Object.entries(arg),
|
|
4354
4369
|
([key, effect]) =>
|
|
4355
4370
|
map(options?.mode === "result" ? result(effect) : effect, (value) => {
|
|
4356
|
-
out
|
|
4371
|
+
InternalRecord.assignProperty(out, key, value)
|
|
4357
4372
|
}),
|
|
4358
4373
|
{
|
|
4359
4374
|
discard: true,
|
|
@@ -4615,10 +4630,8 @@ export const forEach: {
|
|
|
4615
4630
|
readonly discard?: boolean | undefined
|
|
4616
4631
|
}
|
|
4617
4632
|
): Effect.Effect<any, E, R> =>
|
|
4618
|
-
|
|
4619
|
-
const concurrencyOption = options?.concurrency
|
|
4620
|
-
? parent.getRef(CurrentConcurrency)
|
|
4621
|
-
: (options?.concurrency ?? 1)
|
|
4633
|
+
suspend(() => {
|
|
4634
|
+
const concurrencyOption = options?.concurrency ?? 1
|
|
4622
4635
|
const concurrency = concurrencyOption === "unbounded"
|
|
4623
4636
|
? Number.POSITIVE_INFINITY
|
|
4624
4637
|
: Math.max(1, concurrencyOption)
|
|
@@ -5489,7 +5502,7 @@ const succeedFalse = succeed(false)
|
|
|
5489
5502
|
|
|
5490
5503
|
class Latch implements _Latch.Latch {
|
|
5491
5504
|
waiters: Array<(_: Effect.Effect<void>) => void> = []
|
|
5492
|
-
scheduled =
|
|
5505
|
+
scheduled: Array<(_: Effect.Effect<void>) => void> | undefined = undefined
|
|
5493
5506
|
private _isOpen: boolean
|
|
5494
5507
|
|
|
5495
5508
|
constructor(isOpen: boolean) {
|
|
@@ -5497,17 +5510,35 @@ class Latch implements _Latch.Latch {
|
|
|
5497
5510
|
}
|
|
5498
5511
|
|
|
5499
5512
|
private scheduleUnsafe(fiber: Fiber.Fiber<unknown, unknown>) {
|
|
5500
|
-
if (this.
|
|
5513
|
+
if (this.waiters.length === 0) {
|
|
5501
5514
|
return succeedTrue
|
|
5502
5515
|
}
|
|
5503
|
-
this.scheduled
|
|
5504
|
-
|
|
5516
|
+
if (this.scheduled === undefined) {
|
|
5517
|
+
this.scheduled = this.waiters
|
|
5518
|
+
fiber.currentDispatcher.scheduleTask(this.flushScheduled, 0)
|
|
5519
|
+
} else {
|
|
5520
|
+
for (let i = 0; i < this.waiters.length; i++) {
|
|
5521
|
+
this.scheduled.push(this.waiters[i])
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
this.waiters = []
|
|
5505
5525
|
return succeedTrue
|
|
5506
5526
|
}
|
|
5507
|
-
private
|
|
5508
|
-
this.scheduled
|
|
5527
|
+
private flushScheduled = () => {
|
|
5528
|
+
if (this.scheduled === undefined) return
|
|
5529
|
+
const waiters = this.scheduled
|
|
5530
|
+
this.scheduled = undefined
|
|
5531
|
+
for (let i = 0; i < waiters.length; i++) {
|
|
5532
|
+
waiters[i](exitVoid)
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
private flushWaiters() {
|
|
5536
|
+
// swap both arrays out before any resume runs: a resumed waiter can
|
|
5537
|
+
// reentrantly close the latch and register new waiters, which must not
|
|
5538
|
+
// be drained by this flush
|
|
5509
5539
|
const waiters = this.waiters
|
|
5510
5540
|
this.waiters = []
|
|
5541
|
+
this.flushScheduled()
|
|
5511
5542
|
for (let i = 0; i < waiters.length; i++) {
|
|
5512
5543
|
waiters[i](exitVoid)
|
|
5513
5544
|
}
|
|
@@ -5531,9 +5562,14 @@ class Latch implements _Latch.Latch {
|
|
|
5531
5562
|
}
|
|
5532
5563
|
this.waiters.push(resume)
|
|
5533
5564
|
return sync(() => {
|
|
5534
|
-
|
|
5565
|
+
let index = this.waiters.indexOf(resume)
|
|
5535
5566
|
if (index !== -1) {
|
|
5536
5567
|
this.waiters.splice(index, 1)
|
|
5568
|
+
} else if (this.scheduled !== undefined) {
|
|
5569
|
+
index = this.scheduled.indexOf(resume)
|
|
5570
|
+
if (index !== -1) {
|
|
5571
|
+
this.scheduled.splice(index, 1)
|
|
5572
|
+
}
|
|
5537
5573
|
}
|
|
5538
5574
|
})
|
|
5539
5575
|
})
|
|
@@ -5885,11 +5921,11 @@ export const annotateSpans: {
|
|
|
5885
5921
|
...args: [Record<string, unknown>] | [key: string, value: unknown]
|
|
5886
5922
|
): Effect.Effect<A, E, R> =>
|
|
5887
5923
|
updateService(effect, TracerSpanAnnotations, (annotations) => {
|
|
5888
|
-
const newAnnotations = { ...annotations }
|
|
5924
|
+
const newAnnotations = args.length === 1 ? { ...annotations, ...args[0] } : { ...annotations }
|
|
5889
5925
|
if (args.length === 1) {
|
|
5890
|
-
|
|
5926
|
+
return newAnnotations
|
|
5891
5927
|
} else {
|
|
5892
|
-
newAnnotations
|
|
5928
|
+
InternalRecord.assignProperty(newAnnotations, args[0], args[1])
|
|
5893
5929
|
}
|
|
5894
5930
|
return newAnnotations
|
|
5895
5931
|
})
|
|
@@ -6160,7 +6196,7 @@ export const annotateLogsScoped: {
|
|
|
6160
6196
|
const next = { ...prev }
|
|
6161
6197
|
for (let i = 0; i < entries.length; i++) {
|
|
6162
6198
|
const [key, value] = entries[i]
|
|
6163
|
-
next
|
|
6199
|
+
InternalRecord.assignProperty(next, key, value)
|
|
6164
6200
|
}
|
|
6165
6201
|
fiber.setContext(Context.add(fiber.context, CurrentLogAnnotations, next))
|
|
6166
6202
|
return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), (_) => {
|
|
@@ -6169,8 +6205,8 @@ export const annotateLogsScoped: {
|
|
|
6169
6205
|
for (let i = 0; i < entries.length; i++) {
|
|
6170
6206
|
const [key, value] = entries[i]
|
|
6171
6207
|
if (current[key] !== value) continue
|
|
6172
|
-
if (key
|
|
6173
|
-
next
|
|
6208
|
+
if (Object.hasOwn(prev, key)) {
|
|
6209
|
+
InternalRecord.assignProperty(next, key, prev[key])
|
|
6174
6210
|
} else {
|
|
6175
6211
|
delete next[key]
|
|
6176
6212
|
}
|
|
@@ -6514,7 +6550,7 @@ export const tracerLogger = loggerMake<unknown, void>(({ cause, fiber, logLevel,
|
|
|
6514
6550
|
if (span === undefined || span._tag === "ExternalSpan") return
|
|
6515
6551
|
const attributes: Record<string, unknown> = {}
|
|
6516
6552
|
for (const [key, value] of Object.entries(annotations)) {
|
|
6517
|
-
attributes
|
|
6553
|
+
InternalRecord.assignProperty(attributes, key, value)
|
|
6518
6554
|
}
|
|
6519
6555
|
attributes["effect.fiberId"] = fiber.id
|
|
6520
6556
|
attributes["effect.logLevel"] = logLevel.toUpperCase()
|
package/src/internal/matcher.ts
CHANGED
|
@@ -396,7 +396,7 @@ export const discriminators = <D extends string>(field: D) =>
|
|
|
396
396
|
fields: P
|
|
397
397
|
) => {
|
|
398
398
|
const predicate = makeWhen(
|
|
399
|
-
(arg: any) => arg != null && arg[field]
|
|
399
|
+
(arg: any) => arg != null && Object.hasOwn(fields, arg[field]),
|
|
400
400
|
(data: any) => (fields as any)[data[field]](data)
|
|
401
401
|
)
|
|
402
402
|
|
package/src/internal/record.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 4.0.0
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
/** @internal */
|
|
6
|
-
export function
|
|
2
|
+
export function assignProperty(self: object, key: PropertyKey, value: unknown): void {
|
|
7
3
|
if (key === "__proto__") {
|
|
8
4
|
Object.defineProperty(self, key, {
|
|
9
5
|
value,
|
|
@@ -12,7 +8,15 @@ export function set<K extends PropertyKey, A>(self: Record<K, A>, key: K, value:
|
|
|
12
8
|
configurable: true
|
|
13
9
|
})
|
|
14
10
|
} else {
|
|
15
|
-
self[key] = value
|
|
11
|
+
;(self as any)[key] = value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export function assignProperties(self: object, source: object): void {
|
|
17
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
18
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) {
|
|
19
|
+
assignProperty(self, key, (source as any)[key])
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
|
-
return self
|
|
18
22
|
}
|
|
@@ -6,11 +6,6 @@ import type { ReadonlyRecord } from "../Record.ts"
|
|
|
6
6
|
import type { StackFrame } from "../References.ts"
|
|
7
7
|
import type { SpanLink } from "../Tracer.ts"
|
|
8
8
|
|
|
9
|
-
/** @internal */
|
|
10
|
-
export const CurrentConcurrency = Context.Reference<"unbounded" | number>("effect/References/CurrentConcurrency", {
|
|
11
|
-
defaultValue: () => "unbounded"
|
|
12
|
-
})
|
|
13
|
-
|
|
14
9
|
/** @internal */
|
|
15
10
|
export const CurrentErrorReporters = Context.Reference<ReadonlySet<ErrorReporter>>(
|
|
16
11
|
"effect/ErrorReporter/CurrentErrorReporters",
|
|
@@ -12,9 +12,35 @@ export function resolveAt<A>(key: string) {
|
|
|
12
12
|
return (ast: SchemaAST.AST): A | undefined => resolve(ast)?.[key] as A | undefined
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const STRUCTURAL_ANNOTATION_KEY = "~structural"
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const IDENTIFIER_FALLBACK_KEY = "~identifier"
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const SENTINELS_ANNOTATION_KEY = "~sentinels"
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const jsonSchemaAnnotationKeys = [
|
|
26
|
+
"title",
|
|
27
|
+
"description",
|
|
28
|
+
"default",
|
|
29
|
+
"examples",
|
|
30
|
+
"readOnly",
|
|
31
|
+
"writeOnly",
|
|
32
|
+
"format",
|
|
33
|
+
"contentEncoding",
|
|
34
|
+
"contentMediaType",
|
|
35
|
+
"contentSchema"
|
|
36
|
+
] as const
|
|
37
|
+
|
|
15
38
|
/** @internal */
|
|
16
39
|
export const resolveIdentifier = resolveAt<string>("identifier")
|
|
17
40
|
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const resolveIdentifierFallback = resolveAt<string>(IDENTIFIER_FALLBACK_KEY)
|
|
43
|
+
|
|
18
44
|
/** @internal */
|
|
19
45
|
export const resolveTitle = resolveAt<string>("title")
|
|
20
46
|
|
|
@@ -35,3 +61,21 @@ export const getExpected = memoize((ast: SchemaAST.AST): string => {
|
|
|
35
61
|
export function collectBrands(annotations: Schema.Annotations.Annotations | undefined): ReadonlyArray<string> {
|
|
36
62
|
return annotations !== undefined && Array.isArray(annotations.brands) ? annotations.brands : []
|
|
37
63
|
}
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const annotationExcludedKeys = new Set([
|
|
67
|
+
SENTINELS_ANNOTATION_KEY,
|
|
68
|
+
STRUCTURAL_ANNOTATION_KEY,
|
|
69
|
+
"representation",
|
|
70
|
+
"arbitrary",
|
|
71
|
+
"brands",
|
|
72
|
+
"toJsonSchema",
|
|
73
|
+
"toCode",
|
|
74
|
+
"toArbitrary",
|
|
75
|
+
"toEquivalence",
|
|
76
|
+
"toFormatter",
|
|
77
|
+
"toCodec",
|
|
78
|
+
"toCodecJson",
|
|
79
|
+
"toCodecStringTree",
|
|
80
|
+
"toCodecIso"
|
|
81
|
+
])
|