effect 4.0.0-beta.4 → 4.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cause.d.ts +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +6 -4
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Data.d.ts +3 -2
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +9 -8
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +0 -226
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +0 -118
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.js.map +1 -1
- package/dist/FileSystem.d.ts +1 -1
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +5 -5
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +30 -1
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +15 -0
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.js +1 -1
- package/dist/Formatter.js.map +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +2 -2
- package/dist/Graph.js.map +1 -1
- package/dist/Latch.d.ts +109 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +72 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +8 -7
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +2 -2
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +5 -3
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +6 -4
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +3 -2
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +3 -2
- package/dist/PubSub.js.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +0 -20
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +0 -20
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Schedule.d.ts +2 -2
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +30 -16
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +192 -42
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +385 -71
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.d.ts +2 -2
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +12 -14
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +44 -43
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +5 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +37 -0
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +80 -0
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +211 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/{PartitionedSemaphore.js → Semaphore.js} +97 -13
- package/dist/Semaphore.js.map +1 -0
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +9 -8
- package/dist/Stream.js.map +1 -1
- package/dist/Struct.d.ts +16 -0
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +2 -1
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +2 -1
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Types.d.ts +14 -6
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/rcRef.js +2 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/testing/TestClock.d.ts +3 -2
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +5 -3
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +39 -39
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -1
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +51 -51
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Response.d.ts +25 -25
- package/dist/unstable/cli/CliError.d.ts +5 -5
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +2 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +2 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
- package/dist/unstable/cluster/Message.d.ts +5 -5
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +2 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +3 -3
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +4 -3
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +7 -5
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +4 -3
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +36 -36
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +2 -1
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +5 -5
- package/dist/unstable/http/Cookies.d.ts +1 -1
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +18 -26
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +2 -2
- package/dist/unstable/http/UrlParams.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +6 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +2 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +6 -5
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +6 -0
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +12 -9
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +39 -0
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
- package/dist/unstable/reactivity/Hydration.js +76 -0
- package/dist/unstable/reactivity/Hydration.js.map +1 -0
- package/dist/unstable/reactivity/index.d.ts +4 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +4 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +3 -2
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +5 -3
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +2 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +3 -2
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/Statement.js +0 -1
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +2 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +2 -2
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +2 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +2 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -2
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +6 -4
- package/src/Data.ts +10 -9
- package/src/Effect.ts +0 -246
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +2 -2
- package/src/FileSystem.ts +7 -8
- package/src/Filter.ts +48 -1
- package/src/Formatter.ts +1 -1
- package/src/Graph.ts +8 -5
- package/src/Latch.ts +112 -0
- package/src/Pipeable.ts +32 -1
- package/src/PlatformError.ts +5 -5
- package/src/Pool.ts +9 -7
- package/src/PubSub.ts +10 -9
- package/src/Request.ts +3 -2
- package/src/RequestResolver.ts +0 -20
- package/src/Schedule.ts +217 -115
- package/src/Schema.ts +567 -105
- package/src/SchemaGetter.ts +12 -14
- package/src/SchemaRepresentation.ts +5 -2
- package/src/SchemaTransformation.ts +104 -0
- package/src/Semaphore.ts +356 -0
- package/src/Stream.ts +9 -8
- package/src/Struct.ts +26 -0
- package/src/SubscriptionRef.ts +3 -2
- package/src/SynchronizedRef.ts +3 -2
- package/src/Types.ts +12 -2
- package/src/index.ts +17 -6
- package/src/internal/core.ts +10 -2
- package/src/internal/effect.ts +3 -2
- package/src/internal/rcRef.ts +2 -1
- package/src/testing/TestClock.ts +8 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +2 -1
- package/src/unstable/ai/Prompt.ts +20 -20
- package/src/unstable/ai/Response.ts +22 -22
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +3 -2
- package/src/unstable/cluster/Entity.ts +2 -1
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/MessageStorage.ts +2 -1
- package/src/unstable/cluster/Runners.ts +6 -5
- package/src/unstable/cluster/Sharding.ts +8 -6
- package/src/unstable/cluster/internal/entityManager.ts +6 -5
- package/src/unstable/cluster/internal/entityReaper.ts +2 -1
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/eventlog/EventLog.ts +2 -1
- package/src/unstable/http/HttpEffect.ts +17 -25
- package/src/unstable/http/Multipart.ts +2 -2
- package/src/unstable/http/UrlParams.ts +1 -1
- package/src/unstable/httpapi/HttpApiBuilder.ts +2 -2
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/persistence/KeyValueStore.ts +6 -6
- package/src/unstable/persistence/PersistedCache.ts +20 -9
- package/src/unstable/persistence/PersistedQueue.ts +7 -6
- package/src/unstable/process/ChildProcessSpawner.ts +6 -0
- package/src/unstable/reactivity/Atom.ts +7 -5
- package/src/unstable/reactivity/Hydration.ts +112 -0
- package/src/unstable/reactivity/index.ts +5 -0
- package/src/unstable/rpc/RpcClient.ts +4 -3
- package/src/unstable/rpc/RpcServer.ts +6 -4
- package/src/unstable/rpc/Utils.ts +2 -1
- package/src/unstable/socket/Socket.ts +3 -2
- package/src/unstable/sql/Statement.ts +0 -1
- package/src/unstable/workers/Worker.ts +2 -1
- package/src/unstable/workflow/DurableDeferred.ts +2 -2
- package/src/unstable/workflow/WorkflowEngine.ts +3 -2
- package/dist/PartitionedSemaphore.d.ts +0 -52
- package/dist/PartitionedSemaphore.d.ts.map +0 -1
- package/dist/PartitionedSemaphore.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/src/PartitionedSemaphore.ts +0 -182
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
|
@@ -453,7 +453,7 @@ export type ToolResultParts<Tools extends Record<string, Tool.Any>> = {
|
|
|
453
453
|
* @since 1.0.0
|
|
454
454
|
* @category schemas
|
|
455
455
|
*/
|
|
456
|
-
export const ProviderMetadata: Schema
|
|
456
|
+
export const ProviderMetadata: Schema.$Record<
|
|
457
457
|
Schema.String,
|
|
458
458
|
Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json>>
|
|
459
459
|
> = Schema.Record(Schema.String, Schema.NullOr(Schema.Json))
|
|
@@ -629,7 +629,7 @@ export const TextPart: Schema.Struct<{
|
|
|
629
629
|
readonly text: Schema.String
|
|
630
630
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
631
631
|
readonly metadata: Schema.withDecodingDefault<
|
|
632
|
-
Schema
|
|
632
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
633
633
|
>
|
|
634
634
|
}> = Schema.Struct({
|
|
635
635
|
...BasePart.fields,
|
|
@@ -689,7 +689,7 @@ export const TextStartPart: Schema.Struct<{
|
|
|
689
689
|
readonly id: Schema.String
|
|
690
690
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
691
691
|
readonly metadata: Schema.withDecodingDefault<
|
|
692
|
-
Schema
|
|
692
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
693
693
|
>
|
|
694
694
|
}> = Schema.Struct({
|
|
695
695
|
...BasePart.fields,
|
|
@@ -757,7 +757,7 @@ export const TextDeltaPart: Schema.Struct<{
|
|
|
757
757
|
readonly delta: Schema.String
|
|
758
758
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
759
759
|
readonly metadata: Schema.withDecodingDefault<
|
|
760
|
-
Schema
|
|
760
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
761
761
|
>
|
|
762
762
|
}> = Schema.Struct({
|
|
763
763
|
...BasePart.fields,
|
|
@@ -818,7 +818,7 @@ export const TextEndPart: Schema.Struct<{
|
|
|
818
818
|
readonly id: Schema.String
|
|
819
819
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
820
820
|
readonly metadata: Schema.withDecodingDefault<
|
|
821
|
-
Schema
|
|
821
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
822
822
|
>
|
|
823
823
|
}> = Schema.Struct({
|
|
824
824
|
...BasePart.fields,
|
|
@@ -889,7 +889,7 @@ export const ReasoningPart: Schema.Struct<{
|
|
|
889
889
|
readonly text: Schema.String
|
|
890
890
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
891
891
|
readonly metadata: Schema.withDecodingDefault<
|
|
892
|
-
Schema
|
|
892
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
893
893
|
>
|
|
894
894
|
}> = Schema.Struct({
|
|
895
895
|
...BasePart.fields,
|
|
@@ -949,7 +949,7 @@ export const ReasoningStartPart: Schema.Struct<{
|
|
|
949
949
|
readonly id: Schema.String
|
|
950
950
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
951
951
|
readonly metadata: Schema.withDecodingDefault<
|
|
952
|
-
Schema
|
|
952
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
953
953
|
>
|
|
954
954
|
}> = Schema.Struct({
|
|
955
955
|
...BasePart.fields,
|
|
@@ -1017,7 +1017,7 @@ export const ReasoningDeltaPart: Schema.Struct<{
|
|
|
1017
1017
|
readonly delta: Schema.String
|
|
1018
1018
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1019
1019
|
readonly metadata: Schema.withDecodingDefault<
|
|
1020
|
-
Schema
|
|
1020
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1021
1021
|
>
|
|
1022
1022
|
}> = Schema.Struct({
|
|
1023
1023
|
...BasePart.fields,
|
|
@@ -1078,7 +1078,7 @@ export const ReasoningEndPart: Schema.Struct<{
|
|
|
1078
1078
|
readonly id: Schema.String
|
|
1079
1079
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1080
1080
|
readonly metadata: Schema.withDecodingDefault<
|
|
1081
|
-
Schema
|
|
1081
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1082
1082
|
>
|
|
1083
1083
|
}> = Schema.Struct({
|
|
1084
1084
|
...BasePart.fields,
|
|
@@ -1159,7 +1159,7 @@ export const ToolParamsStartPart: Schema.Struct<{
|
|
|
1159
1159
|
readonly providerExecuted: Schema.withDecodingDefaultKey<Schema.Boolean>
|
|
1160
1160
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1161
1161
|
readonly metadata: Schema.withDecodingDefault<
|
|
1162
|
-
Schema
|
|
1162
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1163
1163
|
>
|
|
1164
1164
|
}> = Schema.Struct({
|
|
1165
1165
|
...BasePart.fields,
|
|
@@ -1234,7 +1234,7 @@ export const ToolParamsDeltaPart: Schema.Struct<{
|
|
|
1234
1234
|
readonly delta: Schema.String
|
|
1235
1235
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1236
1236
|
readonly metadata: Schema.withDecodingDefault<
|
|
1237
|
-
Schema
|
|
1237
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1238
1238
|
>
|
|
1239
1239
|
}> = Schema.Struct({
|
|
1240
1240
|
...BasePart.fields,
|
|
@@ -1299,7 +1299,7 @@ export const ToolParamsEndPart: Schema.Struct<{
|
|
|
1299
1299
|
readonly id: Schema.String
|
|
1300
1300
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1301
1301
|
readonly metadata: Schema.withDecodingDefault<
|
|
1302
|
-
Schema
|
|
1302
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1303
1303
|
>
|
|
1304
1304
|
}> = Schema.Struct({
|
|
1305
1305
|
...BasePart.fields,
|
|
@@ -1414,7 +1414,7 @@ export const ToolCallPart: <const Name extends string, Params extends Schema.Top
|
|
|
1414
1414
|
readonly providerExecuted: Schema.withDecodingDefaultKey<Schema.Boolean>
|
|
1415
1415
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1416
1416
|
readonly metadata: Schema.withDecodingDefault<
|
|
1417
|
-
Schema
|
|
1417
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1418
1418
|
>
|
|
1419
1419
|
}
|
|
1420
1420
|
> = <const Name extends string, Params extends Schema.Top>(
|
|
@@ -1618,7 +1618,7 @@ export const ToolResultPart: <const Name extends string, Success extends Schema.
|
|
|
1618
1618
|
readonly "~effect/ai/Content/Part": Schema.Literal<"~effect/ai/Content/Part">
|
|
1619
1619
|
readonly result: Schema.Union<readonly [Success, Failure]>
|
|
1620
1620
|
readonly providerExecuted: Schema.Boolean
|
|
1621
|
-
readonly metadata: Schema
|
|
1621
|
+
readonly metadata: Schema.$Record<
|
|
1622
1622
|
Schema.String,
|
|
1623
1623
|
Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>
|
|
1624
1624
|
>
|
|
@@ -1635,7 +1635,7 @@ export const ToolResultPart: <const Name extends string, Success extends Schema.
|
|
|
1635
1635
|
readonly result: Schema.toEncoded<Schema.Union<readonly [Success, Failure]>>
|
|
1636
1636
|
readonly providerExecuted: Schema.optional<Schema.Boolean>
|
|
1637
1637
|
readonly metadata: Schema.optional<
|
|
1638
|
-
Schema
|
|
1638
|
+
Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>
|
|
1639
1639
|
>
|
|
1640
1640
|
readonly preliminary: Schema.optional<Schema.Boolean>
|
|
1641
1641
|
readonly id: Schema.String
|
|
@@ -1795,7 +1795,7 @@ export const ToolApprovalRequestPart: Schema.Struct<{
|
|
|
1795
1795
|
readonly toolCallId: Schema.String
|
|
1796
1796
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1797
1797
|
readonly metadata: Schema.withDecodingDefault<
|
|
1798
|
-
Schema
|
|
1798
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1799
1799
|
>
|
|
1800
1800
|
}> = Schema.Struct({
|
|
1801
1801
|
...BasePart.fields,
|
|
@@ -1888,7 +1888,7 @@ export const FilePart: Schema.Struct<{
|
|
|
1888
1888
|
readonly data: Schema.Uint8ArrayFromBase64
|
|
1889
1889
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1890
1890
|
readonly metadata: Schema.withDecodingDefault<
|
|
1891
|
-
Schema
|
|
1891
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1892
1892
|
>
|
|
1893
1893
|
}> = Schema.Struct({
|
|
1894
1894
|
...BasePart.fields,
|
|
@@ -1985,7 +1985,7 @@ export const DocumentSourcePart: Schema.Struct<{
|
|
|
1985
1985
|
readonly fileName: Schema.optionalKey<Schema.String>
|
|
1986
1986
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
1987
1987
|
readonly metadata: Schema.withDecodingDefault<
|
|
1988
|
-
Schema
|
|
1988
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
1989
1989
|
>
|
|
1990
1990
|
}> = Schema.Struct({
|
|
1991
1991
|
...BasePart.fields,
|
|
@@ -2076,7 +2076,7 @@ export const UrlSourcePart: Schema.Struct<{
|
|
|
2076
2076
|
readonly title: Schema.String
|
|
2077
2077
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
2078
2078
|
readonly metadata: Schema.withDecodingDefault<
|
|
2079
|
-
Schema
|
|
2079
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
2080
2080
|
>
|
|
2081
2081
|
}> = Schema.Struct({
|
|
2082
2082
|
...BasePart.fields,
|
|
@@ -2257,7 +2257,7 @@ export const ResponseMetadataPart: Schema.Struct<{
|
|
|
2257
2257
|
readonly request: Schema.UndefinedOr<typeof HttpRequestDetails>
|
|
2258
2258
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
2259
2259
|
readonly metadata: Schema.withDecodingDefault<
|
|
2260
|
-
Schema
|
|
2260
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
2261
2261
|
>
|
|
2262
2262
|
}> = Schema.Struct({
|
|
2263
2263
|
...BasePart.fields,
|
|
@@ -2464,7 +2464,7 @@ export const FinishPart: Schema.Struct<{
|
|
|
2464
2464
|
readonly response: Schema.UndefinedOr<typeof HttpResponseDetails>
|
|
2465
2465
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
2466
2466
|
readonly metadata: Schema.withDecodingDefault<
|
|
2467
|
-
Schema
|
|
2467
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
2468
2468
|
>
|
|
2469
2469
|
}> = Schema.Struct({
|
|
2470
2470
|
...BasePart.fields,
|
|
@@ -2527,7 +2527,7 @@ export const ErrorPart: Schema.Struct<{
|
|
|
2527
2527
|
readonly error: Schema.Unknown
|
|
2528
2528
|
readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>
|
|
2529
2529
|
readonly metadata: Schema.withDecodingDefault<
|
|
2530
|
-
Schema
|
|
2530
|
+
Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json>>
|
|
2531
2531
|
>
|
|
2532
2532
|
}> = Schema.Struct({
|
|
2533
2533
|
...BasePart.fields,
|
|
@@ -6,6 +6,7 @@ import * as Duration from "../../Duration.ts"
|
|
|
6
6
|
import * as Effect from "../../Effect.ts"
|
|
7
7
|
import * as Exit from "../../Exit.ts"
|
|
8
8
|
import * as Fiber from "../../Fiber.ts"
|
|
9
|
+
import * as Latch from "../../Latch.ts"
|
|
9
10
|
import * as Layer from "../../Layer.ts"
|
|
10
11
|
import * as PrimaryKey from "../../PrimaryKey.ts"
|
|
11
12
|
import * as RcMap from "../../RcMap.ts"
|
|
@@ -106,7 +107,7 @@ export const make = Effect.gen(function*() {
|
|
|
106
107
|
readonly services: ServiceMap.ServiceMap<any>
|
|
107
108
|
}>()
|
|
108
109
|
const interruptedActivities = new Set<string>()
|
|
109
|
-
const activityLatches = new Map<string,
|
|
110
|
+
const activityLatches = new Map<string, Latch.Latch>()
|
|
110
111
|
const clients = yield* RcMap.make({
|
|
111
112
|
lookup: Effect.fnUntraced(function*(workflowName: string) {
|
|
112
113
|
const entity = entities.get(workflowName)
|
|
@@ -297,7 +298,7 @@ export const make = Effect.gen(function*() {
|
|
|
297
298
|
return Effect.gen(function*() {
|
|
298
299
|
let entry = activities.get(activityId)
|
|
299
300
|
while (!entry) {
|
|
300
|
-
const latch =
|
|
301
|
+
const latch = Latch.makeUnsafe()
|
|
301
302
|
activityLatches.set(activityId, latch)
|
|
302
303
|
yield* latch.await
|
|
303
304
|
entry = activities.get(activityId)
|
|
@@ -10,6 +10,7 @@ import * as Equal from "../../Equal.ts"
|
|
|
10
10
|
import * as Exit from "../../Exit.ts"
|
|
11
11
|
import { identity } from "../../Function.ts"
|
|
12
12
|
import * as Hash from "../../Hash.ts"
|
|
13
|
+
import type * as Latch from "../../Latch.ts"
|
|
13
14
|
import * as Layer from "../../Layer.ts"
|
|
14
15
|
import * as Predicate from "../../Predicate.ts"
|
|
15
16
|
import * as Queue from "../../Queue.ts"
|
|
@@ -642,6 +643,6 @@ export const KeepAliveRpc = Rpc.make("Cluster/Entity/keepAlive")
|
|
|
642
643
|
* @since 4.0.0
|
|
643
644
|
* @category Keep alive
|
|
644
645
|
*/
|
|
645
|
-
export class KeepAliveLatch extends ServiceMap.Service<KeepAliveLatch,
|
|
646
|
+
export class KeepAliveLatch extends ServiceMap.Service<KeepAliveLatch, Latch.Latch>()(
|
|
646
647
|
"effect/cluster/Entity/KeepAliveLatch"
|
|
647
648
|
) {}
|
|
@@ -218,7 +218,7 @@ export const PartialJson: Schema.Codec<
|
|
|
218
218
|
* @category schemas
|
|
219
219
|
*/
|
|
220
220
|
export const PartialArray: Schema.mutable<
|
|
221
|
-
Schema
|
|
221
|
+
Schema.$Array<Schema.Codec<AckChunk | Interrupt | PartialRequest, Encoded>>
|
|
222
222
|
> = Schema.mutable(Schema.Array(PartialJson))
|
|
223
223
|
|
|
224
224
|
/**
|
|
@@ -6,6 +6,7 @@ import { Clock } from "../../Clock.ts"
|
|
|
6
6
|
import * as Data from "../../Data.ts"
|
|
7
7
|
import * as Effect from "../../Effect.ts"
|
|
8
8
|
import * as Exit from "../../Exit.ts"
|
|
9
|
+
import * as Latch from "../../Latch.ts"
|
|
9
10
|
import * as Layer from "../../Layer.ts"
|
|
10
11
|
import type * as Option from "../../Option.ts"
|
|
11
12
|
import type { Predicate } from "../../Predicate.ts"
|
|
@@ -718,7 +719,7 @@ export class MemoryDriver extends ServiceMap.Service<MemoryDriver>()("effect/clu
|
|
|
718
719
|
return messages
|
|
719
720
|
}
|
|
720
721
|
|
|
721
|
-
const replyLatch = yield*
|
|
722
|
+
const replyLatch = yield* Latch.make()
|
|
722
723
|
|
|
723
724
|
function repliesFor(requestIds: Array<string>) {
|
|
724
725
|
const replies = Arr.empty<Reply.Encoded>()
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Effect from "../../Effect.ts"
|
|
5
5
|
import * as Exit from "../../Exit.ts"
|
|
6
|
+
import * as Latch from "../../Latch.ts"
|
|
6
7
|
import * as Layer from "../../Layer.ts"
|
|
7
8
|
import * as Queue from "../../Queue.ts"
|
|
8
9
|
import * as RcMap from "../../RcMap.ts"
|
|
@@ -192,8 +193,8 @@ export const make: (options: Omit<Runners["Service"], "sendLocal" | "notifyLocal
|
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
type StorageRequestEntry = {
|
|
195
|
-
readonly latch:
|
|
196
|
-
doneLatch:
|
|
196
|
+
readonly latch: Latch.Latch
|
|
197
|
+
doneLatch: Latch.Latch | undefined
|
|
197
198
|
readonly messages: Set<Message.OutgoingRequest<any>>
|
|
198
199
|
replies: Array<Reply.Reply<any>>
|
|
199
200
|
}
|
|
@@ -204,11 +205,11 @@ export const make: (options: Omit<Runners["Service"], "sendLocal" | "notifyLocal
|
|
|
204
205
|
let entry = storageRequests.get(message.envelope.requestId)
|
|
205
206
|
if (entry) {
|
|
206
207
|
entry.messages.add(message)
|
|
207
|
-
entry.doneLatch ??=
|
|
208
|
+
entry.doneLatch ??= Latch.makeUnsafe(false)
|
|
208
209
|
return yield* entry.doneLatch.await
|
|
209
210
|
} else {
|
|
210
211
|
entry = {
|
|
211
|
-
latch:
|
|
212
|
+
latch: Latch.makeUnsafe(false),
|
|
212
213
|
doneLatch: undefined,
|
|
213
214
|
replies: [],
|
|
214
215
|
messages: new Set([message])
|
|
@@ -260,7 +261,7 @@ export const make: (options: Omit<Runners["Service"], "sendLocal" | "notifyLocal
|
|
|
260
261
|
)
|
|
261
262
|
)
|
|
262
263
|
|
|
263
|
-
const storageLatch =
|
|
264
|
+
const storageLatch = Latch.makeUnsafe(false)
|
|
264
265
|
if (storage !== MessageStorage.noop) {
|
|
265
266
|
yield* Effect.gen(function*() {
|
|
266
267
|
const foundRequests = new Set<StorageRequestEntry>()
|
|
@@ -13,6 +13,7 @@ import * as Fiber from "../../Fiber.ts"
|
|
|
13
13
|
import * as FiberMap from "../../FiberMap.ts"
|
|
14
14
|
import { constant, flow } from "../../Function.ts"
|
|
15
15
|
import * as HashRing from "../../HashRing.ts"
|
|
16
|
+
import * as Latch from "../../Latch.ts"
|
|
16
17
|
import * as Layer from "../../Layer.ts"
|
|
17
18
|
import * as MutableHashMap from "../../MutableHashMap.ts"
|
|
18
19
|
import * as MutableHashSet from "../../MutableHashSet.ts"
|
|
@@ -23,6 +24,7 @@ import { CurrentLogAnnotations } from "../../References.ts"
|
|
|
23
24
|
import * as Result from "../../Result.ts"
|
|
24
25
|
import * as Schedule from "../../Schedule.ts"
|
|
25
26
|
import * as Scope from "../../Scope.ts"
|
|
27
|
+
import * as Semaphore from "../../Semaphore.ts"
|
|
26
28
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
27
29
|
import * as Stream from "../../Stream.ts"
|
|
28
30
|
import type * as Rpc from "../rpc/Rpc.ts"
|
|
@@ -221,7 +223,7 @@ const make = Effect.gen(function*() {
|
|
|
221
223
|
|
|
222
224
|
// the active shards are the ones that we have acquired the lock for
|
|
223
225
|
const acquiredShards = MutableHashSet.empty<ShardId>()
|
|
224
|
-
const activeShardsLatch = yield*
|
|
226
|
+
const activeShardsLatch = yield* Latch.make(false)
|
|
225
227
|
|
|
226
228
|
const events = yield* PubSub.unbounded<ShardingRegistrationEvent>()
|
|
227
229
|
const getRegistrationEvents: Stream.Stream<ShardingRegistrationEvent> = Stream.fromPubSub(events)
|
|
@@ -429,10 +431,10 @@ const make = Effect.gen(function*() {
|
|
|
429
431
|
// It should also be shutdown after the entity managers, to ensure interrupt
|
|
430
432
|
// & ack envelopes can still be processed.
|
|
431
433
|
|
|
432
|
-
const storageReadLatch = yield*
|
|
434
|
+
const storageReadLatch = yield* Latch.make(true)
|
|
433
435
|
const openStorageReadLatch = constant(Effect.asVoid(storageReadLatch.open))
|
|
434
436
|
|
|
435
|
-
const storageReadLock =
|
|
437
|
+
const storageReadLock = Semaphore.makeUnsafe(1)
|
|
436
438
|
const withStorageReadLock = storageReadLock.withPermits(1)
|
|
437
439
|
|
|
438
440
|
if (storageEnabled && config.runnerAddress) {
|
|
@@ -1182,7 +1184,7 @@ const make = Effect.gen(function*() {
|
|
|
1182
1184
|
|
|
1183
1185
|
const singletons = new Map<ShardId, MutableHashMap.MutableHashMap<SingletonAddress, Effect.Effect<void>>>()
|
|
1184
1186
|
const singletonFibers = yield* FiberMap.make<SingletonAddress>()
|
|
1185
|
-
const withSingletonLock =
|
|
1187
|
+
const withSingletonLock = Semaphore.makeUnsafe(1).withPermits(1)
|
|
1186
1188
|
|
|
1187
1189
|
const registerSingleton: Sharding["Service"]["registerSingleton"] = Effect.fnUntraced(
|
|
1188
1190
|
function*(name, run, options) {
|
|
@@ -1253,7 +1255,7 @@ const make = Effect.gen(function*() {
|
|
|
1253
1255
|
// --- Entities ---
|
|
1254
1256
|
|
|
1255
1257
|
const reaper = yield* EntityReaper
|
|
1256
|
-
const entityManagerLatches = new Map<string,
|
|
1258
|
+
const entityManagerLatches = new Map<string, Latch.Latch>()
|
|
1257
1259
|
|
|
1258
1260
|
const registerEntity: Sharding["Service"]["registerEntity"] = Effect.fnUntraced(
|
|
1259
1261
|
function*(entity, build, options) {
|
|
@@ -1310,7 +1312,7 @@ const make = Effect.gen(function*() {
|
|
|
1310
1312
|
const waitForEntityManager = (entityType: string) => {
|
|
1311
1313
|
let latch = entityManagerLatches.get(entityType)
|
|
1312
1314
|
if (!latch) {
|
|
1313
|
-
latch =
|
|
1315
|
+
latch = Latch.makeUnsafe()
|
|
1314
1316
|
entityManagerLatches.set(entityType, latch)
|
|
1315
1317
|
}
|
|
1316
1318
|
return latch.await
|
|
@@ -8,6 +8,7 @@ import * as Equal from "../../../Equal.ts"
|
|
|
8
8
|
import * as Exit from "../../../Exit.ts"
|
|
9
9
|
import * as Fiber from "../../../Fiber.ts"
|
|
10
10
|
import { identity } from "../../../Function.ts"
|
|
11
|
+
import * as Latch from "../../../Latch.ts"
|
|
11
12
|
import * as Metric from "../../../Metric.ts"
|
|
12
13
|
import * as Option from "../../../Option.ts"
|
|
13
14
|
import { CurrentLogAnnotations } from "../../../References.ts"
|
|
@@ -75,7 +76,7 @@ export type EntityState = {
|
|
|
75
76
|
}>
|
|
76
77
|
lastActiveCheck: number
|
|
77
78
|
write: RpcServer.RpcServer<any>["write"]
|
|
78
|
-
readonly keepAliveLatch:
|
|
79
|
+
readonly keepAliveLatch: Latch.Latch
|
|
79
80
|
keepAliveEnabled: boolean
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -116,7 +117,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
116
117
|
entityRpcs.set(KeepAliveRpc._tag, KeepAliveRpc as any)
|
|
117
118
|
|
|
118
119
|
const activeServers = new Map<EntityId, EntityState>()
|
|
119
|
-
const serverCloseLatches = new Map<EntityAddress,
|
|
120
|
+
const serverCloseLatches = new Map<EntityAddress, Latch.Latch>()
|
|
120
121
|
const processedRequestIds = new Set<Snowflake.Snowflake>()
|
|
121
122
|
|
|
122
123
|
const entities: ResourceMap<
|
|
@@ -129,8 +130,8 @@ export const make = Effect.fnUntraced(function*<
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
const scope = yield* Effect.scope
|
|
132
|
-
const endLatch =
|
|
133
|
-
const keepAliveLatch =
|
|
133
|
+
const endLatch = Latch.makeUnsafe()
|
|
134
|
+
const keepAliveLatch = Latch.makeUnsafe()
|
|
134
135
|
|
|
135
136
|
// on shutdown, reset the storage for the entity
|
|
136
137
|
yield* Scope.addFinalizerExit(
|
|
@@ -336,7 +337,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
336
337
|
scope,
|
|
337
338
|
Effect.withFiber((fiber) => {
|
|
338
339
|
activeServers.delete(address.entityId)
|
|
339
|
-
serverCloseLatches.set(address,
|
|
340
|
+
serverCloseLatches.set(address, Latch.makeUnsafe())
|
|
340
341
|
internalInterruptors.add(fiber.id)
|
|
341
342
|
return state.write(0, { _tag: "Eof" }).pipe(
|
|
342
343
|
Effect.andThen(Effect.interruptible(endLatch.await)),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Clock } from "../../../Clock.ts"
|
|
2
2
|
import * as Effect from "../../../Effect.ts"
|
|
3
|
+
import * as Latch from "../../../Latch.ts"
|
|
3
4
|
import * as Layer from "../../../Layer.ts"
|
|
4
5
|
import * as ServiceMap from "../../../ServiceMap.ts"
|
|
5
6
|
import type { EntityNotAssignedToRunner } from "../ClusterError.ts"
|
|
@@ -17,7 +18,7 @@ export class EntityReaper extends ServiceMap.Service<EntityReaper>()("effect/clu
|
|
|
17
18
|
readonly servers: Map<EntityId, EntityState>
|
|
18
19
|
readonly entities: ResourceMap<EntityAddress, EntityState, EntityNotAssignedToRunner>
|
|
19
20
|
}> = []
|
|
20
|
-
const latch = yield*
|
|
21
|
+
const latch = yield* Latch.make()
|
|
21
22
|
|
|
22
23
|
const register = (options: {
|
|
23
24
|
readonly maxIdleTime: number
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Effect from "../../../Effect.ts"
|
|
2
2
|
import * as Exit from "../../../Exit.ts"
|
|
3
|
+
import * as Latch from "../../../Latch.ts"
|
|
3
4
|
import * as MutableRef from "../../../MutableRef.ts"
|
|
4
5
|
import * as Option from "../../../Option.ts"
|
|
5
6
|
import * as Scope from "../../../Scope.ts"
|
|
@@ -53,7 +54,7 @@ export class ResourceRef<A, E = never> {
|
|
|
53
54
|
this.acquire = acquire
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
latch =
|
|
57
|
+
latch = Latch.makeUnsafe(true)
|
|
57
58
|
|
|
58
59
|
getUnsafe(): Option.Option<A> {
|
|
59
60
|
if (this.state.current._tag === "Acquired") {
|
|
@@ -14,6 +14,7 @@ import type * as Record from "../../Record.ts"
|
|
|
14
14
|
import * as Redacted from "../../Redacted.ts"
|
|
15
15
|
import * as Schema from "../../Schema.ts"
|
|
16
16
|
import type * as Scope from "../../Scope.ts"
|
|
17
|
+
import * as Semaphore from "../../Semaphore.ts"
|
|
17
18
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
18
19
|
import type { Covariant } from "../../Types.ts"
|
|
19
20
|
import { Reactivity } from "../reactivity/Reactivity.ts"
|
|
@@ -481,7 +482,7 @@ const make = Effect.gen(function*() {
|
|
|
481
482
|
readonly write: (entry: Entry) => Effect.Effect<void>
|
|
482
483
|
}) => Effect.Effect<void>
|
|
483
484
|
}>()
|
|
484
|
-
const journalSemaphore = yield*
|
|
485
|
+
const journalSemaphore = yield* Semaphore.make(1)
|
|
485
486
|
|
|
486
487
|
const reactivity = yield* Reactivity
|
|
487
488
|
const reactivityKeys: Record<string, ReadonlyArray<string>> = {}
|
|
@@ -6,7 +6,6 @@ import * as Effect from "../../Effect.ts"
|
|
|
6
6
|
import * as Exit from "../../Exit.ts"
|
|
7
7
|
import * as Fiber from "../../Fiber.ts"
|
|
8
8
|
import { dual } from "../../Function.ts"
|
|
9
|
-
import { effectIsExit } from "../../internal/effect.ts"
|
|
10
9
|
import * as Layer from "../../Layer.ts"
|
|
11
10
|
import * as Scope from "../../Scope.ts"
|
|
12
11
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
@@ -32,30 +31,6 @@ export const toHandled = <E, R, EH, RH>(
|
|
|
32
31
|
) => Effect.Effect<unknown, EH, RH>,
|
|
33
32
|
middleware?: HttpMiddleware | undefined
|
|
34
33
|
): Effect.Effect<void, never, Exclude<R | RH | HttpServerRequest, Scope.Scope>> => {
|
|
35
|
-
const responded = Effect.flatMap(self, (response) => {
|
|
36
|
-
const fiber = Fiber.getCurrent()!
|
|
37
|
-
const request = ServiceMap.getUnsafe(fiber.services, HttpServerRequest)
|
|
38
|
-
const handler = fiber.getRef(PreResponseHandlers)
|
|
39
|
-
if (handler === undefined) {
|
|
40
|
-
;(request as any)[handledSymbol] = true
|
|
41
|
-
const eff = handleResponse(request, response)
|
|
42
|
-
if (effectIsExit(eff)) {
|
|
43
|
-
return eff._tag === "Success" ? Effect.succeed(response) : handleCause(eff.cause)
|
|
44
|
-
}
|
|
45
|
-
return Effect.matchCauseEffect(eff, {
|
|
46
|
-
onFailure: handleCause,
|
|
47
|
-
onSuccess: () => Effect.succeed(response)
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
return Effect.flatMapEager(handler(request, response), (sentResponse) => {
|
|
51
|
-
;(request as any)[handledSymbol] = true
|
|
52
|
-
return Effect.matchCauseEffectEager(handleResponse(request, sentResponse), {
|
|
53
|
-
onSuccess: () => Effect.succeed(response),
|
|
54
|
-
onFailure: handleCause
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
34
|
const handleCause = (cause: Cause<E | EH | HttpServerError>) =>
|
|
60
35
|
Effect.flatMapEager(causeResponse(cause), ([response, cause]) => {
|
|
61
36
|
const fiber = Fiber.getCurrent()!
|
|
@@ -79,6 +54,23 @@ export const toHandled = <E, R, EH, RH>(
|
|
|
79
54
|
)
|
|
80
55
|
})
|
|
81
56
|
|
|
57
|
+
const responded = Effect.matchCauseEffect(self, {
|
|
58
|
+
onSuccess: (response) => {
|
|
59
|
+
const fiber = Fiber.getCurrent()!
|
|
60
|
+
const request = ServiceMap.getUnsafe(fiber.services, HttpServerRequest)
|
|
61
|
+
const handler = fiber.getRef(PreResponseHandlers)
|
|
62
|
+
if (handler === undefined) {
|
|
63
|
+
;(request as any)[handledSymbol] = true
|
|
64
|
+
return Effect.mapEager(handleResponse(request, response), () => response)
|
|
65
|
+
}
|
|
66
|
+
return Effect.flatMapEager(handler(request, response), (sentResponse) => {
|
|
67
|
+
;(request as any)[handledSymbol] = true
|
|
68
|
+
return Effect.mapEager(handleResponse(request, sentResponse), () => response)
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
onFailure: handleCause
|
|
72
|
+
})
|
|
73
|
+
|
|
82
74
|
const withMiddleware: Effect.Effect<
|
|
83
75
|
unknown,
|
|
84
76
|
E | EH | HttpServerError,
|
|
@@ -203,13 +203,13 @@ export const PersistedFileSchema: PersistedFileSchema = Schema.declare(
|
|
|
203
203
|
* @since 4.0.0
|
|
204
204
|
* @category Schemas
|
|
205
205
|
*/
|
|
206
|
-
export const FilesSchema: Schema
|
|
206
|
+
export const FilesSchema: Schema.$Array<PersistedFileSchema> = Schema.Array(PersistedFileSchema)
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* @since 4.0.0
|
|
210
210
|
* @category Schemas
|
|
211
211
|
*/
|
|
212
|
-
export const SingleFileSchema: Schema.decodeTo<PersistedFileSchema, Schema
|
|
212
|
+
export const SingleFileSchema: Schema.decodeTo<PersistedFileSchema, Schema.$Array<PersistedFileSchema>> = FilesSchema
|
|
213
213
|
.check(
|
|
214
214
|
Schema.isLengthBetween(1, 1)
|
|
215
215
|
).pipe(
|
|
@@ -539,7 +539,7 @@ export const schemaJsonField = (field: string): schemaJsonField =>
|
|
|
539
539
|
*/
|
|
540
540
|
export interface schemaRecord extends
|
|
541
541
|
Schema.decodeTo<
|
|
542
|
-
Schema
|
|
542
|
+
Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.NonEmptyArray<Schema.String>]>>,
|
|
543
543
|
UrlParamsSchema,
|
|
544
544
|
never,
|
|
545
545
|
never
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
import * as Effect from "../../Effect.ts"
|
|
5
|
-
import * as
|
|
5
|
+
import * as Encoding from "../../Encoding.ts"
|
|
6
6
|
import * as Fiber from "../../Fiber.ts"
|
|
7
7
|
import type { FileSystem } from "../../FileSystem.ts"
|
|
8
8
|
import { identity } from "../../Function.ts"
|
|
@@ -328,7 +328,7 @@ export const securityDecode = <Security extends HttpApiSecurity.HttpApiSecurity>
|
|
|
328
328
|
} as any
|
|
329
329
|
return HttpServerRequest.asEffect().pipe(
|
|
330
330
|
Effect.flatMap((request) =>
|
|
331
|
-
|
|
331
|
+
Encoding.decodeBase64String((request.headers.authorization ?? "").slice(basicLen)).asEffect()
|
|
332
332
|
),
|
|
333
333
|
Effect.match({
|
|
334
334
|
onFailure: () => empty,
|
|
@@ -98,6 +98,12 @@ export type ScalarConfig = {
|
|
|
98
98
|
* Default: `false`
|
|
99
99
|
*/
|
|
100
100
|
defaultOpenAllTags?: boolean
|
|
101
|
+
/**
|
|
102
|
+
* Whether to display the operation ID in the operation reference.
|
|
103
|
+
*
|
|
104
|
+
* Default: `false`
|
|
105
|
+
*/
|
|
106
|
+
showOperationId?: boolean
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
type ScalarSource =
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Data from "../../Data.ts"
|
|
5
5
|
import * as Effect from "../../Effect.ts"
|
|
6
|
-
import * as
|
|
6
|
+
import * as Encoding from "../../Encoding.ts"
|
|
7
7
|
import * as FileSystem from "../../FileSystem.ts"
|
|
8
8
|
import { dual, identity, type LazyArg } from "../../Function.ts"
|
|
9
9
|
import * as Layer from "../../Layer.ts"
|
|
@@ -225,7 +225,7 @@ export const makeStringOnly = (
|
|
|
225
225
|
getUint8Array: (key) =>
|
|
226
226
|
options.get(key).pipe(
|
|
227
227
|
Effect.map(UndefinedOr.map((value) =>
|
|
228
|
-
Result.match(
|
|
228
|
+
Result.match(Encoding.decodeBase64(value), {
|
|
229
229
|
onFailure: () => encoder.encode(value),
|
|
230
230
|
onSuccess: identity
|
|
231
231
|
})
|
|
@@ -234,7 +234,7 @@ export const makeStringOnly = (
|
|
|
234
234
|
set: (key, value) =>
|
|
235
235
|
typeof value === "string"
|
|
236
236
|
? options.set(key, value)
|
|
237
|
-
: Effect.suspend(() => options.set(key,
|
|
237
|
+
: Effect.suspend(() => options.set(key, Encoding.encodeBase64(value)))
|
|
238
238
|
})
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -276,7 +276,7 @@ export const layerMemory: Layer.Layer<KeyValueStore> = Layer.sync(KeyValueStore)
|
|
|
276
276
|
get: (key: string) =>
|
|
277
277
|
Effect.sync(() => {
|
|
278
278
|
const value = store.get(key)
|
|
279
|
-
return value === undefined ? undefined : typeof value === "string" ? value :
|
|
279
|
+
return value === undefined ? undefined : typeof value === "string" ? value : Encoding.encodeBase64(value)
|
|
280
280
|
}),
|
|
281
281
|
getUint8Array: (key: string) =>
|
|
282
282
|
Effect.sync(() => {
|
|
@@ -312,7 +312,7 @@ export const layerFileSystem = (
|
|
|
312
312
|
fs.readFileString(keyPath(key)),
|
|
313
313
|
"PlatformError",
|
|
314
314
|
(cause) =>
|
|
315
|
-
cause.reason._tag === "
|
|
315
|
+
cause.reason._tag === "NotFound" ? Effect.undefined : Effect.fail(
|
|
316
316
|
new KeyValueStoreError({
|
|
317
317
|
method: "get",
|
|
318
318
|
key,
|
|
@@ -326,7 +326,7 @@ export const layerFileSystem = (
|
|
|
326
326
|
fs.readFile(keyPath(key)),
|
|
327
327
|
"PlatformError",
|
|
328
328
|
(cause) =>
|
|
329
|
-
cause.reason._tag === "
|
|
329
|
+
cause.reason._tag === "NotFound" ? Effect.undefined : Effect.fail(
|
|
330
330
|
new KeyValueStoreError({
|
|
331
331
|
method: "getUint8Array",
|
|
332
332
|
key,
|