effect 4.0.0-beta.100 → 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/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +4 -0
- package/dist/MutableList.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 +1269 -496
- 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 +3 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +119 -53
- 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 +26 -26
- 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/HttpRouter.d.ts +2 -2
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.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/MutableList.ts +4 -0
- 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 +2538 -987
- 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 +4 -3
- package/src/internal/effect.ts +132 -70
- 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/HttpRouter.ts +6 -3
- 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
|
@@ -16,6 +16,7 @@ import { dual } from "../../Function.ts"
|
|
|
16
16
|
import * as Hash from "../../Hash.ts"
|
|
17
17
|
import type { Inspectable } from "../../Inspectable.ts"
|
|
18
18
|
import { PipeInspectableProto } from "../../internal/core.ts"
|
|
19
|
+
import * as InternalRecord from "../../internal/record.ts"
|
|
19
20
|
import * as Option from "../../Option.ts"
|
|
20
21
|
import type { Pipeable } from "../../Pipeable.ts"
|
|
21
22
|
import { hasProperty } from "../../Predicate.ts"
|
|
@@ -236,15 +237,15 @@ export interface UrlParamsSchema extends Schema.declare<UrlParams, ReadonlyArray
|
|
|
236
237
|
export const UrlParamsSchema: UrlParamsSchema = Schema.declare(
|
|
237
238
|
isUrlParams,
|
|
238
239
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
generation: {
|
|
243
|
-
runtime: `UrlParams.UrlParamsSchema`,
|
|
244
|
-
Type: `UrlParams.UrlParams`,
|
|
245
|
-
Encoded: `typeof UrlParams.UrlParamsSchema["Encoded"]`,
|
|
246
|
-
importDeclaration: `import * as UrlParams from "effect/unstable/http/UrlParams"`
|
|
240
|
+
representation: {
|
|
241
|
+
id: "effect/http/UrlParams",
|
|
242
|
+
payload: null
|
|
247
243
|
},
|
|
244
|
+
toCode: () => ({
|
|
245
|
+
runtime: "UrlParams.UrlParamsSchema",
|
|
246
|
+
Type: "UrlParams.UrlParams",
|
|
247
|
+
importDeclarations: [`import * as UrlParams from "effect/unstable/http/UrlParams"`]
|
|
248
|
+
}),
|
|
248
249
|
expected: "UrlParams",
|
|
249
250
|
toEquivalence: () => Equivalence,
|
|
250
251
|
toCodec: () =>
|
|
@@ -675,13 +676,15 @@ export const toString = (input: Input): string => new URLSearchParams(fromInput(
|
|
|
675
676
|
export const toRecord = (self: UrlParams): Record<string, string | Arr.NonEmptyArray<string>> => {
|
|
676
677
|
const out: Record<string, string | Arr.NonEmptyArray<string>> = {}
|
|
677
678
|
for (const [k, value] of self.params) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
out[k] = value
|
|
681
|
-
} else if (typeof curr === "string") {
|
|
682
|
-
out[k] = [curr, value]
|
|
679
|
+
if (!Object.hasOwn(out, k)) {
|
|
680
|
+
InternalRecord.assignProperty(out, k, value)
|
|
683
681
|
} else {
|
|
684
|
-
|
|
682
|
+
const current = out[k]
|
|
683
|
+
if (typeof current === "string") {
|
|
684
|
+
InternalRecord.assignProperty(out, k, [current, value])
|
|
685
|
+
} else {
|
|
686
|
+
current.push(value)
|
|
687
|
+
}
|
|
685
688
|
}
|
|
686
689
|
}
|
|
687
690
|
return out
|
|
@@ -145,7 +145,7 @@ const Proto = {
|
|
|
145
145
|
) {
|
|
146
146
|
const groups = { ...this.groups }
|
|
147
147
|
for (const group of toAdd) {
|
|
148
|
-
InternalRecord.
|
|
148
|
+
InternalRecord.assignProperty(groups, group.identifier, group)
|
|
149
149
|
}
|
|
150
150
|
return makeProto({
|
|
151
151
|
...optionsFromApi(this),
|
|
@@ -157,9 +157,9 @@ const Proto = {
|
|
|
157
157
|
api: Top
|
|
158
158
|
) {
|
|
159
159
|
const newGroups = { ...this.groups }
|
|
160
|
-
for (const key
|
|
160
|
+
for (const key of Object.keys(api.groups)) {
|
|
161
161
|
const group = api.groups[key]
|
|
162
|
-
InternalRecord.
|
|
162
|
+
InternalRecord.assignProperty(
|
|
163
163
|
newGroups,
|
|
164
164
|
key,
|
|
165
165
|
group.annotateMerge(Context.merge(api.annotations, group.annotations))
|
|
@@ -520,10 +520,10 @@ export const makeWith = <ApiId extends string, Groups extends HttpApiGroup.Const
|
|
|
520
520
|
...options,
|
|
521
521
|
onGroup({ group }) {
|
|
522
522
|
if (group.topLevel) return
|
|
523
|
-
InternalRecord.
|
|
523
|
+
InternalRecord.assignProperty(client, group.identifier, {})
|
|
524
524
|
},
|
|
525
525
|
onEndpoint({ endpoint, endpointFn, group }) {
|
|
526
|
-
InternalRecord.
|
|
526
|
+
InternalRecord.assignProperty(
|
|
527
527
|
group.topLevel ? client : client[group.identifier],
|
|
528
528
|
endpoint.identifier,
|
|
529
529
|
endpointFn
|
|
@@ -565,7 +565,7 @@ export const group = <
|
|
|
565
565
|
...options,
|
|
566
566
|
predicate: ({ group }) => group.identifier === options.group,
|
|
567
567
|
onEndpoint({ endpoint, endpointFn }) {
|
|
568
|
-
InternalRecord.
|
|
568
|
+
InternalRecord.assignProperty(client, endpoint.identifier, endpointFn)
|
|
569
569
|
}
|
|
570
570
|
}).pipe(Effect.map(() => client)) as any
|
|
571
571
|
}
|
|
@@ -662,7 +662,7 @@ export const urlBuilder = <Api extends HttpApi.Constraint>(api: Api, options?: {
|
|
|
662
662
|
HttpApi.reflect(api as unknown as HttpApi.Top, {
|
|
663
663
|
onGroup({ group }) {
|
|
664
664
|
if (group.topLevel) return
|
|
665
|
-
InternalRecord.
|
|
665
|
+
InternalRecord.assignProperty(builder, group.identifier, {})
|
|
666
666
|
},
|
|
667
667
|
onEndpoint({ group, endpoint }) {
|
|
668
668
|
const makeUrl = compilePath(endpoint.path)
|
|
@@ -688,7 +688,7 @@ export const urlBuilder = <Api extends HttpApi.Constraint>(api: Api, options?: {
|
|
|
688
688
|
const url = query === "" ? path : `${path}?${query}`
|
|
689
689
|
return options?.baseUrl === undefined ? url : new URL(url, options.baseUrl.toString()).toString()
|
|
690
690
|
}
|
|
691
|
-
InternalRecord.
|
|
691
|
+
InternalRecord.assignProperty(
|
|
692
692
|
group.topLevel ? builder : builder[group.identifier],
|
|
693
693
|
endpoint.identifier,
|
|
694
694
|
endpointBuilder
|
|
@@ -308,7 +308,7 @@ const Proto = {
|
|
|
308
308
|
add(this: Top, ...toAdd: NonEmptyReadonlyArray<HttpApiEndpoint.Top>) {
|
|
309
309
|
const endpoints = { ...this.endpoints }
|
|
310
310
|
for (const endpoint of toAdd) {
|
|
311
|
-
InternalRecord.
|
|
311
|
+
InternalRecord.assignProperty(endpoints, endpoint.identifier, endpoint)
|
|
312
312
|
}
|
|
313
313
|
return makeProto({
|
|
314
314
|
...optionsFromGroup(this),
|
|
@@ -14,13 +14,14 @@ import * as Context from "../../Context.ts"
|
|
|
14
14
|
import * as Equal from "../../Equal.ts"
|
|
15
15
|
import { constFalse } from "../../Function.ts"
|
|
16
16
|
import * as InternalRecord from "../../internal/record.ts"
|
|
17
|
+
import * as InternalToJsonSchemaDocument from "../../internal/schema/toJsonSchemaDocument.ts"
|
|
18
|
+
import * as InternalToRepresentation from "../../internal/schema/toRepresentation.ts"
|
|
17
19
|
import * as JsonPatch from "../../JsonPatch.ts"
|
|
18
20
|
import { escapeToken } from "../../JsonPointer.ts"
|
|
19
21
|
import * as JsonSchema from "../../JsonSchema.ts"
|
|
20
22
|
import * as Option from "../../Option.ts"
|
|
21
23
|
import * as Schema from "../../Schema.ts"
|
|
22
24
|
import * as SchemaAST from "../../SchemaAST.ts"
|
|
23
|
-
import * as SchemaRepresentation from "../../SchemaRepresentation.ts"
|
|
24
25
|
import * as HttpMethod from "../http/HttpMethod.ts"
|
|
25
26
|
import * as HttpApi from "./HttpApi.ts"
|
|
26
27
|
import * as HttpApiEndpoint from "./HttpApiEndpoint.ts"
|
|
@@ -212,6 +213,17 @@ export const annotations: (
|
|
|
212
213
|
|
|
213
214
|
const apiCache = new WeakMap<HttpApi.Constraint, OpenAPISpec>()
|
|
214
215
|
|
|
216
|
+
type CompileSchemas = (
|
|
217
|
+
asts: readonly [SchemaAST.AST, ...Array<SchemaAST.AST>]
|
|
218
|
+
) => JsonSchema.MultiDocument<"openapi-3.1">
|
|
219
|
+
|
|
220
|
+
const compileSchemas: CompileSchemas = (asts) =>
|
|
221
|
+
JsonSchema.toMultiDocumentOpenApi3_1(
|
|
222
|
+
InternalToJsonSchemaDocument.toJsonSchemaMultiDocument(
|
|
223
|
+
InternalToRepresentation.toRepresentations(Arr.map(asts, Schema.toCodecJsonAST))
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
|
|
215
227
|
/**
|
|
216
228
|
* This function checks if a given tag exists within the provided context. If
|
|
217
229
|
* the tag is present, it retrieves the associated value and applies the given
|
|
@@ -251,7 +263,15 @@ function processAnnotation<Services, S, I>(
|
|
|
251
263
|
export function fromApi<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
252
264
|
api: HttpApi.HttpApi<Id, Groups>
|
|
253
265
|
): OpenAPISpec {
|
|
254
|
-
|
|
266
|
+
return fromApiWith(api, apiCache, compileSchemas)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function fromApiWith<Id extends string, Groups extends HttpApiGroup.Constraint>(
|
|
270
|
+
api: HttpApi.HttpApi<Id, Groups>,
|
|
271
|
+
cache: WeakMap<HttpApi.Constraint, OpenAPISpec>,
|
|
272
|
+
compileSchemas: CompileSchemas
|
|
273
|
+
): OpenAPISpec {
|
|
274
|
+
const cached = cache.get(api)
|
|
255
275
|
if (cached !== undefined) {
|
|
256
276
|
return cached
|
|
257
277
|
}
|
|
@@ -318,7 +338,10 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
318
338
|
tag.externalDocs = externalDocs
|
|
319
339
|
})
|
|
320
340
|
processAnnotation(group.annotations, Override, (override) => {
|
|
321
|
-
|
|
341
|
+
// OpenAPI documents are JSON, so symbol keys are intentionally ignored.
|
|
342
|
+
for (const [key, value] of Object.entries(override)) {
|
|
343
|
+
InternalRecord.assignProperty(tag as any, key, value)
|
|
344
|
+
}
|
|
322
345
|
})
|
|
323
346
|
processAnnotation(group.annotations, Transform, (transformFn) => {
|
|
324
347
|
tag = transformFn(tag) as OpenAPISpecTag
|
|
@@ -348,9 +371,9 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
348
371
|
function processResponseBodies(bodies: ResponseBodies, defaultDescription: () => string) {
|
|
349
372
|
for (const [status, { content, descriptions, streamContent }] of bodies) {
|
|
350
373
|
const description = descriptions.size > 0 ? Array.from(descriptions).join(" | ") : defaultDescription()
|
|
351
|
-
op.responses
|
|
374
|
+
InternalRecord.assignProperty(op.responses, status, {
|
|
352
375
|
description
|
|
353
|
-
}
|
|
376
|
+
})
|
|
354
377
|
if (content !== undefined) {
|
|
355
378
|
content.forEach((map, encoding) => {
|
|
356
379
|
map.forEach((schemas, contentType) => {
|
|
@@ -363,9 +386,9 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
363
386
|
path: ["paths", path, method, "responses", String(status), "content", contentType, "schema"]
|
|
364
387
|
})
|
|
365
388
|
op.responses[status].content ??= {}
|
|
366
|
-
op.responses[status].content
|
|
389
|
+
InternalRecord.assignProperty(op.responses[status].content, contentType, {
|
|
367
390
|
schema: {}
|
|
368
|
-
}
|
|
391
|
+
})
|
|
369
392
|
})
|
|
370
393
|
})
|
|
371
394
|
}
|
|
@@ -408,7 +431,7 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
408
431
|
"errorSchema"
|
|
409
432
|
]
|
|
410
433
|
})
|
|
411
|
-
op.responses[status].content
|
|
434
|
+
InternalRecord.assignProperty(op.responses[status].content, contentType, {
|
|
412
435
|
schema: {},
|
|
413
436
|
"x-effect-stream": {
|
|
414
437
|
encoding: "sse",
|
|
@@ -416,9 +439,9 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
416
439
|
errorSchema: {},
|
|
417
440
|
failureEvent: reservedStreamFailureEvent
|
|
418
441
|
}
|
|
419
|
-
}
|
|
442
|
+
})
|
|
420
443
|
} else {
|
|
421
|
-
op.responses[status].content
|
|
444
|
+
InternalRecord.assignProperty(op.responses[status].content, contentType, {
|
|
422
445
|
schema: {
|
|
423
446
|
type: "string",
|
|
424
447
|
format: "binary"
|
|
@@ -426,7 +449,7 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
426
449
|
"x-effect-stream": {
|
|
427
450
|
encoding: "uint8array"
|
|
428
451
|
}
|
|
429
|
-
}
|
|
452
|
+
})
|
|
430
453
|
}
|
|
431
454
|
})
|
|
432
455
|
}
|
|
@@ -483,7 +506,7 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
483
506
|
) {
|
|
484
507
|
const scheme = makeSecurityScheme(security)
|
|
485
508
|
if (!Object.hasOwn(spec.components.securitySchemes, name)) {
|
|
486
|
-
InternalRecord.
|
|
509
|
+
InternalRecord.assignProperty(spec.components.securitySchemes, name, scheme)
|
|
487
510
|
return
|
|
488
511
|
}
|
|
489
512
|
if (
|
|
@@ -522,9 +545,9 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
522
545
|
ast: toEncodingAST(ast, encoding._tag),
|
|
523
546
|
path: ["paths", path, method, "requestBody", "content", contentType, "schema"]
|
|
524
547
|
})
|
|
525
|
-
content
|
|
548
|
+
InternalRecord.assignProperty(content, contentType, {
|
|
526
549
|
schema: {}
|
|
527
|
-
}
|
|
550
|
+
})
|
|
528
551
|
}
|
|
529
552
|
op.requestBody = { content, required: true }
|
|
530
553
|
}
|
|
@@ -552,7 +575,10 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
552
575
|
)
|
|
553
576
|
|
|
554
577
|
processAnnotation(endpoint.annotations, Override, (override) => {
|
|
555
|
-
|
|
578
|
+
// OpenAPI documents are JSON, so symbol keys are intentionally ignored.
|
|
579
|
+
for (const [key, value] of Object.entries(override)) {
|
|
580
|
+
InternalRecord.assignProperty(op as any, key, value)
|
|
581
|
+
}
|
|
556
582
|
})
|
|
557
583
|
processAnnotation(endpoint.annotations, Transform, (transformFn) => {
|
|
558
584
|
op = transformFn(op) as OpenAPISpecOperation
|
|
@@ -570,8 +596,8 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
570
596
|
operationIds.add(operationId)
|
|
571
597
|
}
|
|
572
598
|
pathOperations.add(pathOperation)
|
|
573
|
-
if (!spec.paths
|
|
574
|
-
spec.paths
|
|
599
|
+
if (!Object.hasOwn(spec.paths, path)) {
|
|
600
|
+
InternalRecord.assignProperty(spec.paths, path, {})
|
|
575
601
|
}
|
|
576
602
|
spec.paths[path][method] = op
|
|
577
603
|
}
|
|
@@ -581,10 +607,10 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
581
607
|
componentSchemas.forEach((componentSchema) => {
|
|
582
608
|
const identifier = SchemaAST.resolveIdentifier(componentSchema.ast)
|
|
583
609
|
if (identifier !== undefined) {
|
|
584
|
-
if (
|
|
610
|
+
if (Object.hasOwn(spec.components.schemas, identifier)) {
|
|
585
611
|
throw new globalThis.Error(`Duplicate component schema identifier: ${identifier}`)
|
|
586
612
|
}
|
|
587
|
-
spec.components.schemas
|
|
613
|
+
InternalRecord.assignProperty(spec.components.schemas, identifier, {})
|
|
588
614
|
pathOps.push({
|
|
589
615
|
_tag: "schema",
|
|
590
616
|
ast: componentSchema.ast,
|
|
@@ -599,12 +625,7 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
599
625
|
}
|
|
600
626
|
|
|
601
627
|
if (Arr.isArrayNonEmpty(pathOps)) {
|
|
602
|
-
const
|
|
603
|
-
Arr.map(pathOps, (op) => op.ast)
|
|
604
|
-
)
|
|
605
|
-
const jsonSchemaMultiDocument = JsonSchema.toMultiDocumentOpenApi3_1(
|
|
606
|
-
SchemaRepresentation.toJsonSchemaMultiDocument(multiDocument)
|
|
607
|
-
)
|
|
628
|
+
const jsonSchemaMultiDocument = compileSchemas(Arr.map(pathOps, (op) => op.ast))
|
|
608
629
|
const patchOps: Array<JsonPatch.JsonPatchOperation> = pathOps.map((op, i) => {
|
|
609
630
|
const oppath = escapePath(op.path)
|
|
610
631
|
const value = jsonSchemaMultiDocument.schemas[i]
|
|
@@ -633,13 +654,16 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Constrain
|
|
|
633
654
|
})
|
|
634
655
|
|
|
635
656
|
processAnnotation(api.annotations, Override, (override) => {
|
|
636
|
-
|
|
657
|
+
// OpenAPI documents are JSON, so symbol keys are intentionally ignored.
|
|
658
|
+
for (const [key, value] of Object.entries(override)) {
|
|
659
|
+
InternalRecord.assignProperty(spec as any, key, value)
|
|
660
|
+
}
|
|
637
661
|
})
|
|
638
662
|
processAnnotation(api.annotations, Transform, (transformFn) => {
|
|
639
663
|
spec = transformFn(spec) as OpenAPISpec
|
|
640
664
|
})
|
|
641
665
|
|
|
642
|
-
|
|
666
|
+
cache.set(api, spec)
|
|
643
667
|
|
|
644
668
|
return spec
|
|
645
669
|
}
|
|
@@ -793,7 +817,7 @@ function toEncodingAST(ast: SchemaAST.AST, _tag: HttpApiSchema.Encoding["_tag"])
|
|
|
793
817
|
function persistedFileToBinaryEncoding(ast: SchemaAST.AST): SchemaAST.AST {
|
|
794
818
|
if (
|
|
795
819
|
SchemaAST.isDeclaration(ast) &&
|
|
796
|
-
((ast.annotations as (Schema.Annotations.Declaration<unknown, readonly []> | undefined))?.
|
|
820
|
+
((ast.annotations as (Schema.Annotations.Declaration<unknown, readonly []> | undefined))?.representation?.id ===
|
|
797
821
|
"effect/http/PersistedFile")
|
|
798
822
|
) {
|
|
799
823
|
return Uint8ArrayEncoding.ast
|
|
@@ -13,6 +13,9 @@ import * as Context from "../../Context.ts"
|
|
|
13
13
|
import * as Duration from "../../Duration.ts"
|
|
14
14
|
import * as Effect from "../../Effect.ts"
|
|
15
15
|
import * as Fiber from "../../Fiber.ts"
|
|
16
|
+
import * as FiberSet from "../../FiberSet.ts"
|
|
17
|
+
import { identity } from "../../Function.ts"
|
|
18
|
+
import * as Layer from "../../Layer.ts"
|
|
16
19
|
import * as Num from "../../Number.ts"
|
|
17
20
|
import * as Option from "../../Option.ts"
|
|
18
21
|
import * as Schedule from "../../Schedule.ts"
|
|
@@ -41,6 +44,97 @@ const policy = Schedule.forever.pipe(
|
|
|
41
44
|
})
|
|
42
45
|
)
|
|
43
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Registry of exporter flush operations, used to manually drain buffered
|
|
49
|
+
* telemetry before the surrounding scope closes.
|
|
50
|
+
*
|
|
51
|
+
* **Details**
|
|
52
|
+
*
|
|
53
|
+
* Every exporter created by `make` registers its export operation here, so a
|
|
54
|
+
* single `flush` drains all signals sharing the registry. `flush` returns only
|
|
55
|
+
* after the exports it initiated have settled, cannot fail, and respects each
|
|
56
|
+
* exporter's temporary-disable window. Wrap it with `Effect.timeoutOption` to
|
|
57
|
+
* bound its duration at the call site.
|
|
58
|
+
*
|
|
59
|
+
* @category flushing
|
|
60
|
+
* @since 4.0.0
|
|
61
|
+
*/
|
|
62
|
+
export class Flusher extends Context.Service<Flusher, {
|
|
63
|
+
/**
|
|
64
|
+
* Drains all registered exporters concurrently and cannot fail.
|
|
65
|
+
*
|
|
66
|
+
* **Details**
|
|
67
|
+
*
|
|
68
|
+
* There is no built-in timeout; use `Effect.timeoutOption` to bound the
|
|
69
|
+
* operation. Exporters in their 60-second `disabledUntil` window are skipped.
|
|
70
|
+
*
|
|
71
|
+
* **Example** (Flushing from a Cloudflare Worker)
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { Effect, ManagedRuntime } from "effect"
|
|
75
|
+
* import { OtlpExporter, OtlpTracer } from "effect/unstable/observability"
|
|
76
|
+
*
|
|
77
|
+
* const layer = OtlpTracer.layerFromConfig()
|
|
78
|
+
* const runtime = ManagedRuntime.make(layer)
|
|
79
|
+
*
|
|
80
|
+
* // In the request handler:
|
|
81
|
+
* ctx.waitUntil(
|
|
82
|
+
* runtime.runPromise(
|
|
83
|
+
* Effect.flatMap(OtlpExporter.Flusher, (flusher) => flusher.flush)
|
|
84
|
+
* )
|
|
85
|
+
* )
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
readonly flush: Effect.Effect<void>
|
|
89
|
+
readonly register: (run: Effect.Effect<void>) => Effect.Effect<void, never, Scope.Scope>
|
|
90
|
+
}>()(
|
|
91
|
+
"effect/observability/OtlpExporter/Flusher"
|
|
92
|
+
) {}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Provides a `Flusher` backed by a fresh registry.
|
|
96
|
+
*
|
|
97
|
+
* **Details**
|
|
98
|
+
*
|
|
99
|
+
* This is intentionally a single module-level constant rather than a factory:
|
|
100
|
+
* layer memoization is keyed by layer instance, so every signal layer
|
|
101
|
+
* referencing this same constant shares one registry per layer build, and one
|
|
102
|
+
* `flush` drains traces, logs and metrics together. A factory returning a new
|
|
103
|
+
* layer per call would silently create one registry per signal.
|
|
104
|
+
*
|
|
105
|
+
* Registration is scoped — an exporter is removed from the registry when its
|
|
106
|
+
* own scope closes. Flushing with an empty registry is a no-op.
|
|
107
|
+
*
|
|
108
|
+
* Note that `flush` cannot await an export that was already in flight when it
|
|
109
|
+
* was called (for example one started by the export interval); it only waits
|
|
110
|
+
* for the exports it initiates.
|
|
111
|
+
*
|
|
112
|
+
* @category flushing
|
|
113
|
+
* @since 4.0.0
|
|
114
|
+
*/
|
|
115
|
+
export const layerFlusher: Layer.Layer<Flusher> = Layer.sync(Flusher, () => {
|
|
116
|
+
const registry = new Set<Effect.Effect<void>>()
|
|
117
|
+
return {
|
|
118
|
+
flush: Effect.suspend(() => {
|
|
119
|
+
if (registry.size === 0) {
|
|
120
|
+
return Effect.void
|
|
121
|
+
}
|
|
122
|
+
return Effect.forEach(registry, identity, {
|
|
123
|
+
concurrency: "unbounded",
|
|
124
|
+
discard: true
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
register: (run) =>
|
|
128
|
+
Effect.flatMap(Scope.Scope, (scope) => {
|
|
129
|
+
registry.add(run)
|
|
130
|
+
return Scope.addFinalizer(
|
|
131
|
+
scope,
|
|
132
|
+
Effect.sync(() => registry.delete(run))
|
|
133
|
+
)
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
|
|
44
138
|
/**
|
|
45
139
|
* Creates a scoped OTLP batch exporter.
|
|
46
140
|
*
|
|
@@ -67,12 +161,11 @@ export const make: (
|
|
|
67
161
|
) => Effect.Effect<
|
|
68
162
|
{ readonly push: (data: unknown) => void },
|
|
69
163
|
never,
|
|
70
|
-
HttpClient.HttpClient | Scope.Scope
|
|
164
|
+
Flusher | HttpClient.HttpClient | Scope.Scope
|
|
71
165
|
> = Effect.fnUntraced(function*(options) {
|
|
72
166
|
const services = yield* Effect.context<Scope.Scope | HttpClient.HttpClient>()
|
|
73
167
|
const clock = Context.get(services, Clock)
|
|
74
168
|
const scope = Context.get(services, Scope.Scope)
|
|
75
|
-
const runFork = Effect.runForkWith(services)
|
|
76
169
|
const exportInterval = Duration.max(Duration.fromInputUnsafe(options.exportInterval), Duration.zero)
|
|
77
170
|
let disabledUntil: number | undefined = undefined
|
|
78
171
|
|
|
@@ -122,9 +215,19 @@ export const make: (
|
|
|
122
215
|
})
|
|
123
216
|
)
|
|
124
217
|
|
|
218
|
+
const exportFibers = yield* FiberSet.make<void, never>()
|
|
219
|
+
const runExportFork = yield* FiberSet.runtime(exportFibers)<never>()
|
|
220
|
+
|
|
221
|
+
const flusher = yield* Flusher
|
|
222
|
+
yield* flusher.register(runExport)
|
|
223
|
+
|
|
125
224
|
yield* Scope.addFinalizer(
|
|
126
225
|
scope,
|
|
127
|
-
|
|
226
|
+
Effect.suspend(() => {
|
|
227
|
+
if (disabledUntil !== undefined) return Effect.void
|
|
228
|
+
runExportFork(runExport)
|
|
229
|
+
return FiberSet.awaitEmpty(exportFibers)
|
|
230
|
+
}).pipe(
|
|
128
231
|
Effect.ignore,
|
|
129
232
|
Effect.interruptible,
|
|
130
233
|
Effect.timeoutOption(options.shutdownTimeout)
|
|
@@ -132,7 +235,8 @@ export const make: (
|
|
|
132
235
|
)
|
|
133
236
|
|
|
134
237
|
yield* Effect.sleep(exportInterval).pipe(
|
|
135
|
-
Effect.andThen(runExport),
|
|
238
|
+
Effect.andThen(FiberSet.run(exportFibers, runExport)),
|
|
239
|
+
Effect.flatMap(Fiber.await),
|
|
136
240
|
Effect.forever,
|
|
137
241
|
Effect.forkIn(scope)
|
|
138
242
|
)
|
|
@@ -142,7 +246,7 @@ export const make: (
|
|
|
142
246
|
if (disabledUntil !== undefined) return
|
|
143
247
|
buffer.push(data)
|
|
144
248
|
if (options.maxBatchSize !== "disabled" && buffer.length >= options.maxBatchSize) {
|
|
145
|
-
|
|
249
|
+
runExportFork(runExport)
|
|
146
250
|
}
|
|
147
251
|
}
|
|
148
252
|
}
|
|
@@ -57,7 +57,7 @@ export const make: (
|
|
|
57
57
|
) => Effect.Effect<
|
|
58
58
|
Logger.Logger<unknown, void>,
|
|
59
59
|
never,
|
|
60
|
-
OtlpSerialization | HttpClient.HttpClient | Scope.Scope
|
|
60
|
+
Exporter.Flusher | OtlpSerialization | HttpClient.HttpClient | Scope.Scope
|
|
61
61
|
> = Effect.fnUntraced(function*(options) {
|
|
62
62
|
const serialization = yield* OtlpSerialization
|
|
63
63
|
const otelResource = yield* OtlpResource.fromConfig(options.resource)
|
|
@@ -116,10 +116,10 @@ export const layer = (options: {
|
|
|
116
116
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
117
117
|
readonly excludeLogSpans?: boolean | undefined
|
|
118
118
|
readonly mergeWithExisting?: boolean | undefined
|
|
119
|
-
}): Layer.Layer<
|
|
119
|
+
}): Layer.Layer<Exporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization> =>
|
|
120
120
|
Logger.layer([make(options)], {
|
|
121
121
|
mergeWithExisting: options.mergeWithExisting ?? true
|
|
122
|
-
})
|
|
122
|
+
}).pipe(Layer.provideMerge(Exporter.layerFlusher))
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Creates an OTLP logs layer from OpenTelemetry configuration.
|
|
@@ -136,7 +136,7 @@ export const layerFromConfig = (options?: {
|
|
|
136
136
|
readonly headers?: Headers.Input | undefined
|
|
137
137
|
readonly excludeLogSpans?: boolean | undefined
|
|
138
138
|
readonly mergeWithExisting?: boolean | undefined
|
|
139
|
-
}): Layer.Layer<
|
|
139
|
+
}): Layer.Layer<Exporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization> =>
|
|
140
140
|
Effect.gen(function*() {
|
|
141
141
|
const { disabled, endpoint, exporters } = yield* Config.all({
|
|
142
142
|
disabled: Config.boolean("OTEL_SDK_DISABLED").pipe(Config.withDefault(false)),
|
|
@@ -145,7 +145,7 @@ export const layerFromConfig = (options?: {
|
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
if (disabled || !endpoint || !exporters.includes("otlp")) {
|
|
148
|
-
return
|
|
148
|
+
return Exporter.layerFlusher
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
const { baseTimeout, logsTimeout, exportTimeout, scheduleDelay, maxBatchSize } = yield* Config.all({
|
|
@@ -67,6 +67,9 @@ export type AggregationTemporality = "cumulative" | "delta"
|
|
|
67
67
|
* **Details**
|
|
68
68
|
*
|
|
69
69
|
* The exporter snapshots registered Effect metrics on the configured interval, serializes them with the selected aggregation temporality, and flushes during scope finalization up to `shutdownTimeout`.
|
|
70
|
+
* Manual flushing also triggers a snapshot. With delta temporality, each
|
|
71
|
+
* snapshot advances the previous-export state, so frequent flushes narrow the
|
|
72
|
+
* delta aggregation windows.
|
|
70
73
|
*
|
|
71
74
|
* @category constructors
|
|
72
75
|
* @since 4.0.0
|
|
@@ -85,7 +88,7 @@ export const make: (options: {
|
|
|
85
88
|
}) => Effect.Effect<
|
|
86
89
|
void,
|
|
87
90
|
never,
|
|
88
|
-
HttpClient.HttpClient | OtlpSerialization | Scope.Scope
|
|
91
|
+
Exporter.Flusher | HttpClient.HttpClient | OtlpSerialization | Scope.Scope
|
|
89
92
|
> = Effect.fnUntraced(function*(options) {
|
|
90
93
|
const clock = yield* Clock
|
|
91
94
|
const serialization = yield* OtlpSerialization
|
|
@@ -464,7 +467,8 @@ export const layer = (options: {
|
|
|
464
467
|
readonly exportInterval?: Duration.Input | undefined
|
|
465
468
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
466
469
|
readonly temporality?: AggregationTemporality | undefined
|
|
467
|
-
}): Layer.Layer<
|
|
470
|
+
}): Layer.Layer<Exporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization> =>
|
|
471
|
+
Layer.effectDiscard(make(options)).pipe(Layer.provideMerge(Exporter.layerFlusher))
|
|
468
472
|
|
|
469
473
|
/**
|
|
470
474
|
* Creates an OTLP metrics layer from OpenTelemetry configuration.
|
|
@@ -479,7 +483,7 @@ export const layerFromConfig = (options?: {
|
|
|
479
483
|
readonly attributes?: Record<string, unknown>
|
|
480
484
|
} | undefined
|
|
481
485
|
readonly headers?: Headers.Input | undefined
|
|
482
|
-
}): Layer.Layer<
|
|
486
|
+
}): Layer.Layer<Exporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization> =>
|
|
483
487
|
Effect.gen(function*() {
|
|
484
488
|
const { disabled, endpoint, exporters } = yield* Config.all({
|
|
485
489
|
disabled: Config.boolean("OTEL_SDK_DISABLED").pipe(Config.withDefault(false)),
|
|
@@ -487,7 +491,7 @@ export const layerFromConfig = (options?: {
|
|
|
487
491
|
exporters: OtlpEnv.exporters("METRICS")
|
|
488
492
|
})
|
|
489
493
|
if (disabled || !endpoint || !exporters.includes("otlp")) {
|
|
490
|
-
return
|
|
494
|
+
return Exporter.layerFlusher
|
|
491
495
|
}
|
|
492
496
|
|
|
493
497
|
const { baseTimeout, metricsTimeout, exportTimeout, exportInterval, temporalityPreference } = yield* Config.all({
|
|
@@ -59,7 +59,7 @@ export const make: (
|
|
|
59
59
|
) => Effect.Effect<
|
|
60
60
|
Tracer.Tracer,
|
|
61
61
|
never,
|
|
62
|
-
OtlpSerialization | HttpClient.HttpClient | Scope.Scope
|
|
62
|
+
Exporter.Flusher | OtlpSerialization | HttpClient.HttpClient | Scope.Scope
|
|
63
63
|
> = Effect.fnUntraced(function*(options) {
|
|
64
64
|
const otelResource = yield* OtlpResource.fromConfig(options.resource)
|
|
65
65
|
const serialization = yield* OtlpSerialization
|
|
@@ -134,7 +134,11 @@ export const layer: (options: {
|
|
|
134
134
|
readonly maxBatchSize?: number | undefined
|
|
135
135
|
readonly context?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
136
136
|
readonly shutdownTimeout?: Duration.Input | undefined
|
|
137
|
-
}) => Layer.Layer<
|
|
137
|
+
}) => Layer.Layer<Exporter.Flusher, never, OtlpSerialization | HttpClient.HttpClient> = flow(
|
|
138
|
+
make,
|
|
139
|
+
Layer.effect(Tracer.Tracer),
|
|
140
|
+
Layer.provideMerge(Exporter.layerFlusher)
|
|
141
|
+
)
|
|
138
142
|
|
|
139
143
|
/**
|
|
140
144
|
* Creates an OTLP traces layer from OpenTelemetry configuration.
|
|
@@ -150,7 +154,7 @@ export const layerFromConfig = (options?: {
|
|
|
150
154
|
} | undefined
|
|
151
155
|
readonly headers?: Headers.Input | undefined
|
|
152
156
|
readonly context?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
153
|
-
}): Layer.Layer<
|
|
157
|
+
}): Layer.Layer<Exporter.Flusher, never, HttpClient.HttpClient | OtlpSerialization> =>
|
|
154
158
|
Effect.gen(function*() {
|
|
155
159
|
const { disabled, endpoint, exporters } = yield* Config.all({
|
|
156
160
|
disabled: Config.boolean("OTEL_SDK_DISABLED").pipe(Config.withDefault(false)),
|
|
@@ -159,7 +163,7 @@ export const layerFromConfig = (options?: {
|
|
|
159
163
|
})
|
|
160
164
|
|
|
161
165
|
if (disabled || !endpoint || !exporters.includes("otlp")) {
|
|
162
|
-
return
|
|
166
|
+
return Exporter.layerFlusher
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
const { baseTimeout, tracesTimeout, exportTimeout, scheduleDelay, maxBatchSize } = yield* Config.all({
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import type * as Duration from "../../Duration.ts"
|
|
11
11
|
import type * as Effect from "../../Effect.ts"
|
|
12
12
|
import type * as Exit from "../../Exit.ts"
|
|
13
|
+
import * as InternalRecord from "../../internal/record.ts"
|
|
13
14
|
import * as PrimaryKey from "../../PrimaryKey.ts"
|
|
14
15
|
import * as Request from "../../Request.ts"
|
|
15
16
|
import * as Schema from "../../Schema.ts"
|
|
@@ -179,10 +180,10 @@ export const Class = <
|
|
|
179
180
|
| ("requires" extends keyof Config ? Config["requires"] : never)
|
|
180
181
|
> =>
|
|
181
182
|
{
|
|
182
|
-
function Persistable(this: any, props:
|
|
183
|
+
function Persistable(this: any, props: object | undefined) {
|
|
183
184
|
this._tag = tag
|
|
184
185
|
if (props) {
|
|
185
|
-
|
|
186
|
+
InternalRecord.assignProperties(this, props)
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
Persistable.prototype = {
|
|
@@ -362,8 +362,8 @@ export class RateLimitExceeded extends Schema.ErrorClass<RateLimitExceeded>(
|
|
|
362
362
|
_tag: Schema.tag("RateLimitExceeded"),
|
|
363
363
|
retryAfter: Schema.DurationFromMillis,
|
|
364
364
|
key: Schema.String,
|
|
365
|
-
limit: Schema.
|
|
366
|
-
remaining: Schema.
|
|
365
|
+
limit: Schema.Finite,
|
|
366
|
+
remaining: Schema.Finite
|
|
367
367
|
}) {
|
|
368
368
|
/**
|
|
369
369
|
* Public message used when the rate limiter rejects a request.
|
|
@@ -186,8 +186,8 @@ export const script = <Params extends ReadonlyArray<any>>(
|
|
|
186
186
|
params: Params
|
|
187
187
|
result: void
|
|
188
188
|
}> =>
|
|
189
|
-
Object.
|
|
189
|
+
Object.setPrototypeOf({
|
|
190
190
|
...options,
|
|
191
191
|
params: f,
|
|
192
192
|
numberOfKeys: typeof options.numberOfKeys === "number" ? constant(options.numberOfKeys) : options.numberOfKeys
|
|
193
|
-
})
|
|
193
|
+
}, ScriptProto)
|