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
|
@@ -56,7 +56,9 @@ export interface EntityManager {
|
|
|
56
56
|
}) => boolean
|
|
57
57
|
readonly clearProcessed: () => void
|
|
58
58
|
|
|
59
|
-
readonly interruptShard: (shardId: ShardId
|
|
59
|
+
readonly interruptShard: (shardId: ShardId, options?: {
|
|
60
|
+
readonly force?: boolean
|
|
61
|
+
}) => Effect.Effect<void>
|
|
60
62
|
|
|
61
63
|
readonly activeEntityCount: Effect.Effect<number>
|
|
62
64
|
}
|
|
@@ -117,7 +119,10 @@ export const make = Effect.fnUntraced(function*<
|
|
|
117
119
|
entityRpcs.set(KeepAliveRpc._tag, KeepAliveRpc as any)
|
|
118
120
|
|
|
119
121
|
const activeServers = new Map<EntityId, EntityState>()
|
|
120
|
-
const serverCloseLatches = new Map<EntityAddress,
|
|
122
|
+
const serverCloseLatches = new Map<EntityAddress, {
|
|
123
|
+
readonly closed: Latch.Latch
|
|
124
|
+
readonly force: Latch.Latch
|
|
125
|
+
}>()
|
|
121
126
|
const processedRequestIds = new Set<Snowflake.Snowflake>()
|
|
122
127
|
|
|
123
128
|
const entities: ResourceMap<
|
|
@@ -132,12 +137,16 @@ export const make = Effect.fnUntraced(function*<
|
|
|
132
137
|
const scope = yield* Effect.scope
|
|
133
138
|
const endLatch = Latch.makeUnsafe()
|
|
134
139
|
const keepAliveLatch = Latch.makeUnsafe()
|
|
140
|
+
const closeLatches = {
|
|
141
|
+
closed: Latch.makeUnsafe(),
|
|
142
|
+
force: Latch.makeUnsafe()
|
|
143
|
+
}
|
|
135
144
|
|
|
136
145
|
// on shutdown, reset the storage for the entity
|
|
137
146
|
yield* Scope.addFinalizerExit(
|
|
138
147
|
scope,
|
|
139
148
|
() => {
|
|
140
|
-
serverCloseLatches.get(address)?.openUnsafe()
|
|
149
|
+
serverCloseLatches.get(address)?.closed.openUnsafe()
|
|
141
150
|
serverCloseLatches.delete(address)
|
|
142
151
|
return Effect.void
|
|
143
152
|
}
|
|
@@ -373,14 +382,19 @@ export const make = Effect.fnUntraced(function*<
|
|
|
373
382
|
scope,
|
|
374
383
|
Effect.withFiber((fiber) => {
|
|
375
384
|
activeServers.delete(address.entityId)
|
|
376
|
-
serverCloseLatches.set(address, Latch.makeUnsafe())
|
|
377
385
|
internalInterruptors.add(fiber.id)
|
|
378
|
-
return
|
|
379
|
-
|
|
380
|
-
|
|
386
|
+
return Effect.raceFirst(
|
|
387
|
+
state.write(0, { _tag: "Eof" }).pipe(
|
|
388
|
+
Effect.andThen(endLatch.await),
|
|
389
|
+
Effect.timeoutOption(config.entityTerminationTimeout),
|
|
390
|
+
Effect.interruptible
|
|
391
|
+
),
|
|
392
|
+
Effect.interruptible(closeLatches.force.await)
|
|
381
393
|
)
|
|
382
394
|
})
|
|
383
395
|
)
|
|
396
|
+
// Do not make shard interruption wait for an entity that is still building.
|
|
397
|
+
serverCloseLatches.set(address, closeLatches)
|
|
384
398
|
activeServers.set(address.entityId, state)
|
|
385
399
|
|
|
386
400
|
return state
|
|
@@ -537,17 +551,24 @@ export const make = Effect.fnUntraced(function*<
|
|
|
537
551
|
const runFork = Effect.runForkWith(context)
|
|
538
552
|
|
|
539
553
|
return identity<EntityManager>({
|
|
540
|
-
interruptShard: (shardId: ShardId) =>
|
|
554
|
+
interruptShard: (shardId: ShardId, options) =>
|
|
541
555
|
Effect.suspend(function loop(): Effect.Effect<void> {
|
|
542
556
|
const fibers = Arr.empty<Fiber.Fiber<void>>()
|
|
557
|
+
if (options?.force === true) {
|
|
558
|
+
serverCloseLatches.forEach((latches, address) => {
|
|
559
|
+
if (shardId[Equal.symbol](address.shardId)) {
|
|
560
|
+
latches.force.openUnsafe()
|
|
561
|
+
}
|
|
562
|
+
})
|
|
563
|
+
}
|
|
543
564
|
activeServers.forEach((state) => {
|
|
544
565
|
if (shardId[Equal.symbol](state.address.shardId)) {
|
|
545
566
|
fibers.push(runFork(entities.removeIgnore(state.address)))
|
|
546
567
|
}
|
|
547
568
|
})
|
|
548
|
-
serverCloseLatches.forEach((
|
|
569
|
+
serverCloseLatches.forEach((latches, address) => {
|
|
549
570
|
if (shardId[Equal.symbol](address.shardId)) {
|
|
550
|
-
fibers.push(runFork(
|
|
571
|
+
fibers.push(runFork(latches.closed.await))
|
|
551
572
|
}
|
|
552
573
|
})
|
|
553
574
|
if (fibers.length === 0) return Effect.void
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Duration from "../../../Duration.ts"
|
|
2
|
+
import type { ShardingConfig } from "../ShardingConfig.ts"
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export const effectiveInterval = (config: ShardingConfig["Service"]): Duration.Duration =>
|
|
6
|
+
Duration.min(
|
|
7
|
+
Duration.fromInputUnsafe(config.shardLockRefreshInterval),
|
|
8
|
+
Duration.divideUnsafe(Duration.fromInputUnsafe(config.shardLockExpiration), 3)
|
|
9
|
+
)
|
|
@@ -311,7 +311,7 @@ export type Counter = Schema.Schema.Type<typeof Counter>
|
|
|
311
311
|
export const Frequency = metric(
|
|
312
312
|
"Frequency",
|
|
313
313
|
Schema.Struct({
|
|
314
|
-
occurrences: Schema.ReadonlyMap(Schema.String, Schema.
|
|
314
|
+
occurrences: Schema.ReadonlyMap(Schema.String, Schema.Natural)
|
|
315
315
|
})
|
|
316
316
|
)
|
|
317
317
|
|
|
@@ -370,8 +370,8 @@ export type Gauge = Schema.Schema.Type<typeof Gauge>
|
|
|
370
370
|
export const Histogram = metric(
|
|
371
371
|
"Histogram",
|
|
372
372
|
Schema.Struct({
|
|
373
|
-
buckets: Schema.Array(Schema.Tuple([Schema.Number, Schema.
|
|
374
|
-
count: Schema.
|
|
373
|
+
buckets: Schema.Array(Schema.Tuple([Schema.Number, Schema.Natural])),
|
|
374
|
+
count: Schema.Natural,
|
|
375
375
|
min: Schema.Number,
|
|
376
376
|
max: Schema.Number,
|
|
377
377
|
sum: Schema.Number
|
|
@@ -405,8 +405,13 @@ export type Histogram = Schema.Schema.Type<typeof Histogram>
|
|
|
405
405
|
export const Summary = metric(
|
|
406
406
|
"Summary",
|
|
407
407
|
Schema.Struct({
|
|
408
|
-
quantiles: Schema.Array(
|
|
409
|
-
|
|
408
|
+
quantiles: Schema.Array(
|
|
409
|
+
Schema.Tuple([
|
|
410
|
+
Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 1 })),
|
|
411
|
+
Schema.UndefinedOr(Schema.Number)
|
|
412
|
+
])
|
|
413
|
+
),
|
|
414
|
+
count: Schema.Natural,
|
|
410
415
|
min: Schema.Number,
|
|
411
416
|
max: Schema.Number,
|
|
412
417
|
sum: Schema.Number
|
|
@@ -345,7 +345,7 @@ export class Entry extends Schema.Class<Entry>("effect/eventlog/EventJournal/Ent
|
|
|
345
345
|
* @since 4.0.0
|
|
346
346
|
*/
|
|
347
347
|
export class RemoteEntry extends Schema.Class<RemoteEntry>("effect/eventlog/EventJournal/RemoteEntry")({
|
|
348
|
-
remoteSequence: Schema.
|
|
348
|
+
remoteSequence: Schema.Natural,
|
|
349
349
|
entry: Entry
|
|
350
350
|
}) {}
|
|
351
351
|
|
|
@@ -13,6 +13,7 @@ import * as Context from "../../Context.ts"
|
|
|
13
13
|
import * as Effect from "../../Effect.ts"
|
|
14
14
|
import * as FiberMap from "../../FiberMap.ts"
|
|
15
15
|
import { constant, identity } from "../../Function.ts"
|
|
16
|
+
import * as InternalRecord from "../../internal/record.ts"
|
|
16
17
|
import * as Layer from "../../Layer.ts"
|
|
17
18
|
import type { Pipeable } from "../../Pipeable.ts"
|
|
18
19
|
import { pipeArguments } from "../../Pipeable.ts"
|
|
@@ -159,7 +160,9 @@ export const layerRegistry = Layer.effect(
|
|
|
159
160
|
},
|
|
160
161
|
registerReactivity: (keys) =>
|
|
161
162
|
Effect.sync(() => {
|
|
162
|
-
Object.
|
|
163
|
+
for (const [key, value] of Object.entries(keys)) {
|
|
164
|
+
InternalRecord.assignProperty(reactivityKeys, key, value)
|
|
165
|
+
}
|
|
163
166
|
}),
|
|
164
167
|
reactivityKeys
|
|
165
168
|
})
|
|
@@ -498,7 +501,7 @@ const handlersProto = {
|
|
|
498
501
|
handlers: {
|
|
499
502
|
...this.handlers,
|
|
500
503
|
[tag]: {
|
|
501
|
-
event: this.group.events[tag]
|
|
504
|
+
event: Object.hasOwn(this.group.events, tag) ? this.group.events[tag] : undefined!,
|
|
502
505
|
context: this.context,
|
|
503
506
|
handler
|
|
504
507
|
}
|
|
@@ -547,7 +550,7 @@ export const group = <Events extends Event.Any, Return>(
|
|
|
547
550
|
const handlers = Effect.isEffect(result)
|
|
548
551
|
? (yield* (result as unknown as Effect.Effect<Handlers<any>>))
|
|
549
552
|
: (result as unknown as Handlers<any>)
|
|
550
|
-
for (const tag
|
|
553
|
+
for (const tag of Object.keys(handlers.handlers)) {
|
|
551
554
|
registry.registerHandlerUnsafe({ event: tag, handler: handlers.handlers[tag] })
|
|
552
555
|
}
|
|
553
556
|
})
|
|
@@ -584,7 +587,7 @@ export const groupCompaction = <Events extends Event.Any, R>(
|
|
|
584
587
|
yield* registry.registerCompaction({
|
|
585
588
|
events: Object.keys(group.events),
|
|
586
589
|
effect: Effect.fnUntraced(function*({ entries, write }): Effect.fn.Return<void> {
|
|
587
|
-
const isEventTag = (tag: string): tag is Event.Tag<Events> =>
|
|
590
|
+
const isEventTag = (tag: string): tag is Event.Tag<Events> => Object.hasOwn(group.events, tag)
|
|
588
591
|
const decodePayload = <Tag extends Event.Tag<Events>>(tag: Tag, payload: Uint8Array) =>
|
|
589
592
|
Schema.decodeUnknownEffect(group.events[tag].payloadMsgPack)(payload).pipe(
|
|
590
593
|
Effect.updateContext((input) => Context.merge(services, input)),
|
|
@@ -595,7 +598,7 @@ export const groupCompaction = <Events extends Event.Any, R>(
|
|
|
595
598
|
tag: Tag,
|
|
596
599
|
payload: Event.PayloadWithTag<Events, Tag>
|
|
597
600
|
): Effect.fn.Return<void, never, Event.PayloadSchemaWithTag<Events, Tag>["EncodingServices"]> {
|
|
598
|
-
const event = group.events[tag]
|
|
601
|
+
const event = Object.hasOwn(group.events, tag) ? group.events[tag] : undefined!
|
|
599
602
|
const entry = new Entry({
|
|
600
603
|
id: makeEntryIdUnsafe({ msecs: timestamp }),
|
|
601
604
|
event: tag,
|
|
@@ -674,8 +677,8 @@ export const groupReactivity = <Events extends Event.Any>(
|
|
|
674
677
|
yield* registry.registerReactivity(keys as Record.ReadonlyRecord<string, ReadonlyArray<string>>)
|
|
675
678
|
return
|
|
676
679
|
}
|
|
677
|
-
const obj: Record<string, ReadonlyArray<string>> =
|
|
678
|
-
for (const tag
|
|
680
|
+
const obj: Record<string, ReadonlyArray<string>> = Object.create(null)
|
|
681
|
+
for (const tag of Object.keys(group.events)) {
|
|
679
682
|
obj[tag] = keys
|
|
680
683
|
}
|
|
681
684
|
yield* registry.registerReactivity(obj)
|
|
@@ -741,7 +744,9 @@ export const makeReplayFromRemote = (options: {
|
|
|
741
744
|
Effect.asVoid
|
|
742
745
|
) as any
|
|
743
746
|
|
|
744
|
-
const keys = options.reactivityKeys
|
|
747
|
+
const keys = Object.hasOwn(options.reactivityKeys, entry.event)
|
|
748
|
+
? options.reactivityKeys[entry.event]
|
|
749
|
+
: undefined
|
|
745
750
|
if (keys) {
|
|
746
751
|
for (const key of keys) {
|
|
747
752
|
options.reactivity.invalidateUnsafe({
|
|
@@ -780,7 +785,9 @@ const make = Effect.gen(function*() {
|
|
|
780
785
|
const invalidateReactivityEntries = (entries: ReadonlyArray<Entry>) =>
|
|
781
786
|
Effect.sync(() => {
|
|
782
787
|
for (const entry of entries) {
|
|
783
|
-
const keys = registry.reactivityKeys
|
|
788
|
+
const keys = Object.hasOwn(registry.reactivityKeys, entry.event)
|
|
789
|
+
? registry.reactivityKeys[entry.event]
|
|
790
|
+
: undefined
|
|
784
791
|
if (!keys) {
|
|
785
792
|
continue
|
|
786
793
|
}
|
|
@@ -903,8 +910,11 @@ const make = Effect.gen(function*() {
|
|
|
903
910
|
Effect.updateContext((input) => Context.merge(handler.context, input)),
|
|
904
911
|
Effect.provideService(Identity, identity),
|
|
905
912
|
Effect.tap(() => {
|
|
906
|
-
|
|
907
|
-
|
|
913
|
+
const keys = Object.hasOwn(registry.reactivityKeys, entry.event)
|
|
914
|
+
? registry.reactivityKeys[entry.event]
|
|
915
|
+
: undefined
|
|
916
|
+
if (keys) {
|
|
917
|
+
for (const key of keys) {
|
|
908
918
|
reactivity.invalidateUnsafe({
|
|
909
919
|
[key]: [entry.primaryKey]
|
|
910
920
|
})
|
|
@@ -46,7 +46,7 @@ export interface EncryptedRemoteEntry extends Schema.Schema.Type<typeof Encrypte
|
|
|
46
46
|
* @since 4.0.0
|
|
47
47
|
*/
|
|
48
48
|
export const EncryptedRemoteEntry = Schema.Struct({
|
|
49
|
-
sequence: Schema.
|
|
49
|
+
sequence: Schema.Natural,
|
|
50
50
|
iv: Transferable.Uint8Array,
|
|
51
51
|
entryId: EntryId,
|
|
52
52
|
encryptedEntry: Transferable.Uint8Array
|
|
@@ -163,8 +163,12 @@ export class SingleMessage
|
|
|
163
163
|
*/
|
|
164
164
|
export class ChunkedMessage
|
|
165
165
|
extends Schema.TaggedClass<ChunkedMessage>("effect/eventlog/EventLogRemote/ChunkedMessage")("Chunked", {
|
|
166
|
-
id: Schema.
|
|
167
|
-
part: Schema.Tuple([Schema.
|
|
166
|
+
id: Schema.Int,
|
|
167
|
+
part: Schema.Tuple([Schema.Natural, Schema.Natural]).check(
|
|
168
|
+
Schema.makeFilter(([index, total]) => index < total, {
|
|
169
|
+
expected: "a chunk part with an index less than its total"
|
|
170
|
+
})
|
|
171
|
+
),
|
|
168
172
|
data: Transferable.Uint8Array
|
|
169
173
|
})
|
|
170
174
|
{
|
|
@@ -221,6 +225,9 @@ export class ChunkedMessage
|
|
|
221
225
|
}
|
|
222
226
|
map.set(part.id, entry)
|
|
223
227
|
}
|
|
228
|
+
if (entry.parts[index] !== undefined) {
|
|
229
|
+
return
|
|
230
|
+
}
|
|
224
231
|
entry.parts[index] = part.data
|
|
225
232
|
entry.count++
|
|
226
233
|
entry.bytes += part.data.byteLength
|
|
@@ -324,7 +331,7 @@ export class ChangesRpc extends Rpc.make("EventLog.Changes", {
|
|
|
324
331
|
payload: {
|
|
325
332
|
publicKey: Schema.String,
|
|
326
333
|
storeId: StoreId,
|
|
327
|
-
startSequence: Schema.
|
|
334
|
+
startSequence: Schema.Natural
|
|
328
335
|
},
|
|
329
336
|
success: Schema.Union([SingleMessage, ChunkedMessage]),
|
|
330
337
|
error: EventLogProtocolError,
|
|
@@ -319,7 +319,7 @@ const EntryRow = Schema.Struct({
|
|
|
319
319
|
event: Schema.String,
|
|
320
320
|
primary_key: Schema.String,
|
|
321
321
|
payload: Schema.Uint8Array,
|
|
322
|
-
timestamp: Schema.
|
|
322
|
+
timestamp: Schema.Int
|
|
323
323
|
})
|
|
324
324
|
|
|
325
325
|
const EntryRowArray = Schema.Array(EntryRow)
|
|
@@ -345,7 +345,7 @@ const toEntryRow = (entry: EventJournal.Entry): EntryRow => ({
|
|
|
345
345
|
const RemoteRow = Schema.Struct({
|
|
346
346
|
remote_id: EventJournal.RemoteId,
|
|
347
347
|
entry_id: EventJournal.EntryId,
|
|
348
|
-
sequence: Schema.
|
|
348
|
+
sequence: Schema.Natural
|
|
349
349
|
})
|
|
350
350
|
|
|
351
351
|
const RemoteRowArray = Schema.Array(RemoteRow)
|
|
@@ -269,7 +269,7 @@ export const makeStorage = (options?: {
|
|
|
269
269
|
}).pipe(withTracerDisabled)
|
|
270
270
|
|
|
271
271
|
const EncryptedRemoteEntrySql = Schema.Struct({
|
|
272
|
-
sequence: Schema.
|
|
272
|
+
sequence: Schema.Natural,
|
|
273
273
|
iv: Schema.Uint8Array,
|
|
274
274
|
entry_id: EntryId,
|
|
275
275
|
encrypted_entry: Schema.Uint8Array
|
|
@@ -461,17 +461,20 @@ const EntrySql = Schema.Struct({
|
|
|
461
461
|
|
|
462
462
|
type EntrySql = Schema.Schema.Type<typeof EntrySql>
|
|
463
463
|
|
|
464
|
-
const
|
|
464
|
+
const SqlNatural = Schema.Union([
|
|
465
|
+
Schema.Natural,
|
|
466
|
+
Schema.FiniteFromString.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))
|
|
467
|
+
])
|
|
465
468
|
|
|
466
469
|
const RemoteEntrySql = Schema.Struct({
|
|
467
470
|
...EntrySql.fields,
|
|
468
|
-
sequence:
|
|
471
|
+
sequence: SqlNatural
|
|
469
472
|
})
|
|
470
473
|
|
|
471
474
|
type RemoteEntrySql = Schema.Schema.Type<typeof RemoteEntrySql>
|
|
472
475
|
|
|
473
476
|
const StoreSequenceSql = Schema.Struct({
|
|
474
|
-
next_sequence:
|
|
477
|
+
next_sequence: SqlNatural
|
|
475
478
|
})
|
|
476
479
|
|
|
477
480
|
const SessionAuthBindingSql = Schema.Struct({
|
|
@@ -13,6 +13,7 @@ import * as Data from "../../Data.ts"
|
|
|
13
13
|
import * as Duration from "../../Duration.ts"
|
|
14
14
|
import { dual } from "../../Function.ts"
|
|
15
15
|
import * as Inspectable from "../../Inspectable.ts"
|
|
16
|
+
import * as InternalRecord from "../../internal/record.ts"
|
|
16
17
|
import * as Option from "../../Option.ts"
|
|
17
18
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
18
19
|
import * as Predicate from "../../Predicate.ts"
|
|
@@ -65,15 +66,15 @@ export interface CookiesSchema extends Schema.declare<Cookies, Record.ReadonlyRe
|
|
|
65
66
|
export const CookiesSchema: CookiesSchema = Schema.declare(
|
|
66
67
|
isCookies,
|
|
67
68
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
generation: {
|
|
72
|
-
runtime: `Cookies.CookiesSchema`,
|
|
73
|
-
Type: `Cookies.Cookies`,
|
|
74
|
-
Encoded: `typeof Cookies.CookiesSchema["Encoded"]`,
|
|
75
|
-
importDeclaration: `import * as Cookies from "effect/unstable/http/Cookies"`
|
|
69
|
+
representation: {
|
|
70
|
+
id: "effect/http/Cookies",
|
|
71
|
+
payload: null
|
|
76
72
|
},
|
|
73
|
+
toCode: () => ({
|
|
74
|
+
runtime: "Cookies.CookiesSchema",
|
|
75
|
+
Type: "Cookies.Cookies",
|
|
76
|
+
importDeclarations: [`import * as Cookies from "effect/unstable/http/Cookies"`]
|
|
77
|
+
}),
|
|
77
78
|
expected: "Cookies",
|
|
78
79
|
toCodecJson: () =>
|
|
79
80
|
Schema.link<Cookies>()(
|
|
@@ -146,14 +147,15 @@ export interface CookieSchema extends Schema.declare<Cookie> {}
|
|
|
146
147
|
export const CookieSchema: CookieSchema = Schema.declare(
|
|
147
148
|
isCookie,
|
|
148
149
|
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
generation: {
|
|
153
|
-
runtime: `Cookies.CookieSchema`,
|
|
154
|
-
Type: `Cookies.Cookie`,
|
|
155
|
-
importDeclaration: `import * as Cookie from "effect/unstable/http/Cookies"`
|
|
150
|
+
representation: {
|
|
151
|
+
id: "effect/http/Cookie",
|
|
152
|
+
payload: null
|
|
156
153
|
},
|
|
154
|
+
toCode: () => ({
|
|
155
|
+
runtime: "Cookies.CookieSchema",
|
|
156
|
+
Type: "Cookies.Cookie",
|
|
157
|
+
importDeclarations: [`import * as Cookies from "effect/unstable/http/Cookies"`]
|
|
158
|
+
}),
|
|
157
159
|
expected: "Cookie"
|
|
158
160
|
}
|
|
159
161
|
)
|
|
@@ -251,7 +253,7 @@ export const fromReadonlyRecord = (cookies: Record.ReadonlyRecord<string, Cookie
|
|
|
251
253
|
export const fromIterable = (cookies: Iterable<Cookie>): Cookies => {
|
|
252
254
|
const record: Record<string, Cookie> = {}
|
|
253
255
|
for (const cookie of cookies) {
|
|
254
|
-
record
|
|
256
|
+
InternalRecord.assignProperty(record, cookie.name, cookie)
|
|
255
257
|
}
|
|
256
258
|
return fromReadonlyRecord(record)
|
|
257
259
|
}
|
|
@@ -550,7 +552,7 @@ export const setAllCookie: {
|
|
|
550
552
|
} = dual(2, (self: Cookies, cookies: Iterable<Cookie>) => {
|
|
551
553
|
const record = { ...self.cookies }
|
|
552
554
|
for (const cookie of cookies) {
|
|
553
|
-
record
|
|
555
|
+
InternalRecord.assignProperty(record, cookie.name, cookie)
|
|
554
556
|
}
|
|
555
557
|
return fromReadonlyRecord(record)
|
|
556
558
|
})
|
|
@@ -628,7 +630,8 @@ export const get: {
|
|
|
628
630
|
(self: Cookies, name: string): Option.Option<Cookie>
|
|
629
631
|
} = dual(
|
|
630
632
|
(args) => isCookies(args[0]),
|
|
631
|
-
(self: Cookies, name: string): Option.Option<Cookie> =>
|
|
633
|
+
(self: Cookies, name: string): Option.Option<Cookie> =>
|
|
634
|
+
Option.fromUndefinedOr(Object.hasOwn(self.cookies, name) ? self.cookies[name] : undefined)
|
|
632
635
|
)
|
|
633
636
|
|
|
634
637
|
/**
|
|
@@ -888,7 +891,7 @@ export const setAll: {
|
|
|
888
891
|
if (Result.isFailure(result)) {
|
|
889
892
|
return result as Result.Failure<never, CookiesError>
|
|
890
893
|
}
|
|
891
|
-
record
|
|
894
|
+
InternalRecord.assignProperty(record, name, result.success)
|
|
892
895
|
}
|
|
893
896
|
return Result.succeed(fromReadonlyRecord(record))
|
|
894
897
|
}
|
|
@@ -1028,7 +1031,7 @@ export const toRecord = (self: Cookies): Record<string, string> => {
|
|
|
1028
1031
|
const cookies = Object.values(self.cookies)
|
|
1029
1032
|
for (let index = 0; index < cookies.length; index++) {
|
|
1030
1033
|
const cookie = cookies[index]
|
|
1031
|
-
record
|
|
1034
|
+
InternalRecord.assignProperty(record, cookie.name, cookie.value)
|
|
1032
1035
|
}
|
|
1033
1036
|
return record
|
|
1034
1037
|
}
|
|
@@ -1089,14 +1092,16 @@ export function parseHeader(header: string): Record<string, string> {
|
|
|
1089
1092
|
}
|
|
1090
1093
|
|
|
1091
1094
|
const key = header.substring(pos, eqIdx++).trim()
|
|
1092
|
-
if (result
|
|
1095
|
+
if (!Object.hasOwn(result, key)) {
|
|
1093
1096
|
const val = header.charCodeAt(eqIdx) === 0x22
|
|
1094
1097
|
? header.substring(eqIdx + 1, terminatorPos - 1).trim()
|
|
1095
1098
|
: header.substring(eqIdx, terminatorPos).trim()
|
|
1096
1099
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
+
InternalRecord.assignProperty(
|
|
1101
|
+
result,
|
|
1102
|
+
key,
|
|
1103
|
+
!(val.indexOf("%") === -1) ? tryDecodeURIComponent(val) : val
|
|
1104
|
+
)
|
|
1100
1105
|
}
|
|
1101
1106
|
|
|
1102
1107
|
pos = terminatorPos + 1
|
|
@@ -130,15 +130,15 @@ export interface HeadersSchema extends Schema.declare<Headers, { readonly [x: st
|
|
|
130
130
|
export const HeadersSchema: HeadersSchema = Schema.declare(
|
|
131
131
|
isHeaders,
|
|
132
132
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
generation: {
|
|
137
|
-
runtime: `Headers.HeadersSchema`,
|
|
138
|
-
Type: `Headers.Headers`,
|
|
139
|
-
Encoded: `typeof Headers.HeadersSchema["Encoded"]`,
|
|
140
|
-
importDeclaration: `import * as Headers from "effect/unstable/http/Headers"`
|
|
133
|
+
representation: {
|
|
134
|
+
id: "effect/http/Headers",
|
|
135
|
+
payload: null
|
|
141
136
|
},
|
|
137
|
+
toCode: () => ({
|
|
138
|
+
runtime: "Headers.HeadersSchema",
|
|
139
|
+
Type: "Headers.Headers",
|
|
140
|
+
importDeclarations: [`import * as Headers from "effect/unstable/http/Headers"`]
|
|
141
|
+
}),
|
|
142
142
|
expected: "Headers",
|
|
143
143
|
toEquivalence: () => Equivalence,
|
|
144
144
|
toCodec: () =>
|
|
@@ -375,6 +375,63 @@ export const setHeaders: {
|
|
|
375
375
|
self.body
|
|
376
376
|
))
|
|
377
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Transforms the request headers with the provided function, returning a new request.
|
|
380
|
+
*
|
|
381
|
+
* @category combinators
|
|
382
|
+
* @since 4.0.0
|
|
383
|
+
*/
|
|
384
|
+
export const updateHeaders: {
|
|
385
|
+
/**
|
|
386
|
+
* Transforms the request headers with the provided function, returning a new request.
|
|
387
|
+
*
|
|
388
|
+
* @category combinators
|
|
389
|
+
* @since 4.0.0
|
|
390
|
+
*/
|
|
391
|
+
(f: (headers: Headers.Headers) => Headers.Headers): (self: HttpClientRequest) => HttpClientRequest
|
|
392
|
+
/**
|
|
393
|
+
* Transforms the request headers with the provided function, returning a new request.
|
|
394
|
+
*
|
|
395
|
+
* @category combinators
|
|
396
|
+
* @since 4.0.0
|
|
397
|
+
*/
|
|
398
|
+
(self: HttpClientRequest, f: (headers: Headers.Headers) => Headers.Headers): HttpClientRequest
|
|
399
|
+
} = dual(2, (self: HttpClientRequest, f: (headers: Headers.Headers) => Headers.Headers): HttpClientRequest =>
|
|
400
|
+
makeWith(
|
|
401
|
+
self.method,
|
|
402
|
+
self.url,
|
|
403
|
+
self.urlParams,
|
|
404
|
+
self.hash,
|
|
405
|
+
f(self.headers),
|
|
406
|
+
self.body
|
|
407
|
+
))
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Removes a single request header by name, returning a new request.
|
|
411
|
+
*
|
|
412
|
+
* @category combinators
|
|
413
|
+
* @since 4.0.0
|
|
414
|
+
*/
|
|
415
|
+
export const removeHeader: {
|
|
416
|
+
/**
|
|
417
|
+
* Removes a single request header by name, returning a new request.
|
|
418
|
+
*
|
|
419
|
+
* @category combinators
|
|
420
|
+
* @since 4.0.0
|
|
421
|
+
*/
|
|
422
|
+
(key: string): (self: HttpClientRequest) => HttpClientRequest
|
|
423
|
+
/**
|
|
424
|
+
* Removes a single request header by name, returning a new request.
|
|
425
|
+
*
|
|
426
|
+
* @category combinators
|
|
427
|
+
* @since 4.0.0
|
|
428
|
+
*/
|
|
429
|
+
(self: HttpClientRequest, key: string): HttpClientRequest
|
|
430
|
+
} = dual(
|
|
431
|
+
2,
|
|
432
|
+
(self: HttpClientRequest, key: string): HttpClientRequest => updateHeaders(self, Headers.remove(key))
|
|
433
|
+
)
|
|
434
|
+
|
|
378
435
|
/**
|
|
379
436
|
* Sets the `Authorization` header using HTTP Basic authentication credentials.
|
|
380
437
|
*
|
|
@@ -16,6 +16,7 @@ import * as Context from "../../Context.ts"
|
|
|
16
16
|
import * as Effect from "../../Effect.ts"
|
|
17
17
|
import type * as FileSystem from "../../FileSystem.ts"
|
|
18
18
|
import * as Inspectable from "../../Inspectable.ts"
|
|
19
|
+
import * as InternalRecord from "../../internal/record.ts"
|
|
19
20
|
import * as Option from "../../Option.ts"
|
|
20
21
|
import type * as Path from "../../Path.ts"
|
|
21
22
|
import type { ReadonlyRecord } from "../../Record.ts"
|
|
@@ -145,15 +146,15 @@ export class ParsedSearchParams extends Context.Service<
|
|
|
145
146
|
export const searchParamsFromURL = (url: URL): ReadonlyRecord<string, string | Array<string>> => {
|
|
146
147
|
const out: Record<string, string | Array<string>> = {}
|
|
147
148
|
for (const [key, value] of url.searchParams.entries()) {
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
if (Object.hasOwn(out, key)) {
|
|
150
|
+
const entry = out[key]
|
|
150
151
|
if (Array.isArray(entry)) {
|
|
151
152
|
entry.push(value)
|
|
152
153
|
} else {
|
|
153
|
-
out
|
|
154
|
+
InternalRecord.assignProperty(out, key, [entry, value])
|
|
154
155
|
}
|
|
155
156
|
} else {
|
|
156
|
-
out
|
|
157
|
+
InternalRecord.assignProperty(out, key, value)
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
return out
|
|
@@ -276,6 +276,13 @@ export class MultipartError extends Data.TaggedError("MultipartError")<{
|
|
|
276
276
|
*/
|
|
277
277
|
export interface PersistedFileSchema extends Schema.declare<PersistedFile> {}
|
|
278
278
|
|
|
279
|
+
const PersistedFileEncoded = Schema.Struct({
|
|
280
|
+
key: Schema.String,
|
|
281
|
+
name: Schema.String,
|
|
282
|
+
contentType: Schema.String.annotate({ contentEncoding: "binary" }),
|
|
283
|
+
path: Schema.String
|
|
284
|
+
})
|
|
285
|
+
|
|
279
286
|
/**
|
|
280
287
|
* Schema for persisted multipart files.
|
|
281
288
|
*
|
|
@@ -290,23 +297,19 @@ export interface PersistedFileSchema extends Schema.declare<PersistedFile> {}
|
|
|
290
297
|
export const PersistedFileSchema: PersistedFileSchema = Schema.declare(
|
|
291
298
|
isPersistedFile,
|
|
292
299
|
{
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
generation: {
|
|
297
|
-
runtime: `Multipart.PersistedFileSchema`,
|
|
298
|
-
Type: `Multipart.PersistedFile`,
|
|
299
|
-
importDeclaration: `import * as Multipart from "effect/unstable/http/Multipart"`
|
|
300
|
+
representation: {
|
|
301
|
+
id: "effect/http/PersistedFile",
|
|
302
|
+
payload: null
|
|
300
303
|
},
|
|
304
|
+
toCode: () => ({
|
|
305
|
+
runtime: "Multipart.PersistedFileSchema",
|
|
306
|
+
Type: "Multipart.PersistedFile",
|
|
307
|
+
importDeclarations: [`import * as Multipart from "effect/unstable/http/Multipart"`]
|
|
308
|
+
}),
|
|
301
309
|
expected: "PersistedFile",
|
|
302
310
|
toCodecJson: () =>
|
|
303
311
|
Schema.link<PersistedFile>()(
|
|
304
|
-
|
|
305
|
-
key: Schema.String,
|
|
306
|
-
name: Schema.String,
|
|
307
|
-
contentType: Schema.String.annotate({ contentEncoding: "binary" }),
|
|
308
|
-
path: Schema.String
|
|
309
|
-
}),
|
|
312
|
+
PersistedFileEncoded,
|
|
310
313
|
SchemaTransformation.transform({
|
|
311
314
|
decode: ({ contentType, key, name, path }) => new PersistedFileImpl(key, name, contentType, path),
|
|
312
315
|
encode: (file) => ({
|