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
package/src/Equal.ts
CHANGED
|
@@ -269,7 +269,7 @@ function compareRecords(
|
|
|
269
269
|
|
|
270
270
|
/** @internal */
|
|
271
271
|
export function makeCompareMap<K, V>(keyEquivalence: Equivalence<K>, valueEquivalence: Equivalence<V>) {
|
|
272
|
-
return function compareMaps(self:
|
|
272
|
+
return function compareMaps(self: Iterable<[K, V]>, that: Iterable<[K, V]>): boolean {
|
|
273
273
|
for (const [selfKey, selfValue] of self) {
|
|
274
274
|
let found = false
|
|
275
275
|
for (const [thatKey, thatValue] of that) {
|
|
@@ -291,7 +291,7 @@ const compareMaps = makeCompareMap(compareBoth, compareBoth)
|
|
|
291
291
|
|
|
292
292
|
/** @internal */
|
|
293
293
|
export function makeCompareSet<A>(equivalence: Equivalence<A>) {
|
|
294
|
-
return function compareSets(self:
|
|
294
|
+
return function compareSets(self: Iterable<A>, that: Iterable<A>): boolean {
|
|
295
295
|
for (const selfValue of self) {
|
|
296
296
|
let found = false
|
|
297
297
|
for (const thatValue of that) {
|
package/src/FileSystem.ts
CHANGED
|
@@ -733,8 +733,7 @@ export const make = (
|
|
|
733
733
|
Effect.as(true),
|
|
734
734
|
Effect.catchTag(
|
|
735
735
|
"PlatformError",
|
|
736
|
-
(e) =>
|
|
737
|
-
e.reason._tag === "SystemError" && e.reason.kind === "NotFound" ? Effect.succeed(false) : Effect.fail(e)
|
|
736
|
+
(e) => e.reason._tag === "NotFound" ? Effect.succeed(false) : Effect.fail(e)
|
|
738
737
|
)
|
|
739
738
|
),
|
|
740
739
|
readFileString: (path, encoding) =>
|
|
@@ -757,16 +756,16 @@ export const make = (
|
|
|
757
756
|
const bytesToRead = options?.bytesToRead !== undefined ? Size(options.bytesToRead) : undefined
|
|
758
757
|
let totalBytesRead = BigInt(0)
|
|
759
758
|
const chunkSize = Size(options?.chunkSize ?? 64 * 1024)
|
|
759
|
+
const readChunk = file.readAlloc(chunkSize)
|
|
760
760
|
return Stream.fromPull(Effect.succeed(
|
|
761
761
|
Effect.flatMap(
|
|
762
762
|
Effect.suspend((): Pull.Pull<Uint8Array | undefined, PlatformError> => {
|
|
763
763
|
if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
|
|
764
764
|
return Cause.done()
|
|
765
765
|
}
|
|
766
|
-
|
|
767
|
-
? bytesToRead - totalBytesRead
|
|
768
|
-
:
|
|
769
|
-
return file.readAlloc(toRead)
|
|
766
|
+
return bytesToRead !== undefined && (bytesToRead - totalBytesRead) < chunkSize
|
|
767
|
+
? file.readAlloc(bytesToRead - totalBytesRead)
|
|
768
|
+
: readChunk
|
|
770
769
|
}),
|
|
771
770
|
(buf) => {
|
|
772
771
|
if (!buf) return Cause.done()
|
|
@@ -802,7 +801,7 @@ const notFound = (method: string, path: string) =>
|
|
|
802
801
|
systemError({
|
|
803
802
|
module: "FileSystem",
|
|
804
803
|
method,
|
|
805
|
-
|
|
804
|
+
_tag: "NotFound",
|
|
806
805
|
description: "No such file or directory",
|
|
807
806
|
pathOrDescriptor: path
|
|
808
807
|
})
|
|
@@ -829,9 +828,9 @@ const notFound = (method: string, path: string) =>
|
|
|
829
828
|
* }
|
|
830
829
|
* return Effect.fail(
|
|
831
830
|
* PlatformError.systemError({
|
|
831
|
+
* _tag: "NotFound",
|
|
832
832
|
* module: "FileSystem",
|
|
833
833
|
* method: "readFileString",
|
|
834
|
-
* kind: "NotFound",
|
|
835
834
|
* description: "File not found",
|
|
836
835
|
* pathOrDescriptor: path
|
|
837
836
|
* })
|
package/src/Filter.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { dual } from "./Function.ts"
|
|
|
7
7
|
import * as Option from "./Option.ts"
|
|
8
8
|
import * as Predicate from "./Predicate.ts"
|
|
9
9
|
import * as Result from "./Result.ts"
|
|
10
|
-
import type { EqualsWith, ExcludeTag, ExtractTag, Tags } from "./Types.ts"
|
|
10
|
+
import type { EqualsWith, ExcludeTag, ExtractReason, ExtractTag, ReasonTags, Tags } from "./Types.ts"
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents a filter function that can transform inputs to outputs or filter them out.
|
|
@@ -456,6 +456,53 @@ const taggedImpl =
|
|
|
456
456
|
<Input>(input: Input): Result.Result<ExtractTag<Input, Tag>, ExcludeTag<Input, Tag>> =>
|
|
457
457
|
Predicate.isTagged(input, tag) ? Result.succeed(input as any) : Result.fail(input as ExcludeTag<Input, Tag>)
|
|
458
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Creates a filter that extracts a reason from a tagged error.
|
|
461
|
+
*
|
|
462
|
+
* @since 4.0.0
|
|
463
|
+
* @category Constructors
|
|
464
|
+
*/
|
|
465
|
+
export const reason: {
|
|
466
|
+
/**
|
|
467
|
+
* Creates a filter that extracts a reason from a tagged error.
|
|
468
|
+
*
|
|
469
|
+
* @since 4.0.0
|
|
470
|
+
* @category Constructors
|
|
471
|
+
*/
|
|
472
|
+
<Input>(): <const Tag extends Tags<Input>, const ReasonTag extends ReasonTags<ExtractTag<Input, Tag>>>(
|
|
473
|
+
tag: Tag,
|
|
474
|
+
reasonTag: ReasonTag
|
|
475
|
+
) => Filter<Input, ExtractReason<ExtractTag<Input, Tag>, ReasonTag>, Input>
|
|
476
|
+
/**
|
|
477
|
+
* Creates a filter that extracts a reason from a tagged error.
|
|
478
|
+
*
|
|
479
|
+
* @since 4.0.0
|
|
480
|
+
* @category Constructors
|
|
481
|
+
*/
|
|
482
|
+
<Input, const Tag extends Tags<Input>, const ReasonTag extends ReasonTags<ExtractTag<Input, Tag>>>(tag: Tag, reasonTag: ReasonTag): Filter<Input, ExtractReason<ExtractTag<Input, Tag>, ReasonTag>, Input>
|
|
483
|
+
/**
|
|
484
|
+
* Creates a filter that extracts a reason from a tagged error.
|
|
485
|
+
*
|
|
486
|
+
* @since 4.0.0
|
|
487
|
+
* @category Constructors
|
|
488
|
+
*/
|
|
489
|
+
<const Tag extends string, const ReasonTag extends string>(tag: Tag, reasonTag: ReasonTag): <Input>(input: Input) => Result.Result<ExtractReason<ExtractTag<Input, Tag>, ReasonTag>, Input>
|
|
490
|
+
} = function() {
|
|
491
|
+
return arguments.length === 0 ? reasonImpl : reasonImpl(arguments[0] as any, arguments[1] as any)
|
|
492
|
+
} as any
|
|
493
|
+
|
|
494
|
+
const reasonImpl =
|
|
495
|
+
<const Tag extends string, const ReasonTag extends string>(tag: Tag, reasonTag: ReasonTag) =>
|
|
496
|
+
<Input>(input: Input): Result.Result<ExtractTag<Input, Tag>, ExcludeTag<Input, Tag>> => {
|
|
497
|
+
if (
|
|
498
|
+
Predicate.isTagged(input, tag) && Predicate.hasProperty(input, "reason") &&
|
|
499
|
+
Predicate.isTagged(input.reason, reasonTag)
|
|
500
|
+
) {
|
|
501
|
+
return Result.succeed(input.reason as any)
|
|
502
|
+
}
|
|
503
|
+
return Result.fail(input as any)
|
|
504
|
+
}
|
|
505
|
+
|
|
459
506
|
/**
|
|
460
507
|
* Creates a filter that only passes values equal to the specified value using structural equality.
|
|
461
508
|
*
|
package/src/Formatter.ts
CHANGED
|
@@ -101,7 +101,7 @@ export function format(input: unknown, options?: {
|
|
|
101
101
|
|
|
102
102
|
if (typeof v === "bigint") return String(v) + "n"
|
|
103
103
|
|
|
104
|
-
if (
|
|
104
|
+
if (typeof v === "object" || typeof v === "function") {
|
|
105
105
|
if (seen.has(v)) return CIRCULAR
|
|
106
106
|
seen.add(v)
|
|
107
107
|
|
package/src/Graph.ts
CHANGED
|
@@ -1200,11 +1200,14 @@ export const reverse = <N, E, T extends Kind = "directed">(
|
|
|
1200
1200
|
): void => {
|
|
1201
1201
|
// Reverse all edges by swapping source and target
|
|
1202
1202
|
for (const [index, edgeData] of mutable.edges) {
|
|
1203
|
-
mutable.edges.set(
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1203
|
+
mutable.edges.set(
|
|
1204
|
+
index,
|
|
1205
|
+
new Edge({
|
|
1206
|
+
source: edgeData.target,
|
|
1207
|
+
target: edgeData.source,
|
|
1208
|
+
data: edgeData.data
|
|
1209
|
+
})
|
|
1210
|
+
)
|
|
1208
1211
|
}
|
|
1209
1212
|
|
|
1210
1213
|
// Clear and rebuild adjacency lists with reversed directions
|
package/src/Latch.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 3.8.0
|
|
3
|
+
*/
|
|
4
|
+
import type * as Effect from "./Effect.ts"
|
|
5
|
+
import * as internal from "./internal/effect.ts"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @category models
|
|
9
|
+
* @since 3.8.0
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Effect, Latch } from "effect"
|
|
13
|
+
*
|
|
14
|
+
* // Create and use a latch for coordination between fibers
|
|
15
|
+
* const program = Effect.gen(function*() {
|
|
16
|
+
* const latch = yield* Latch.make()
|
|
17
|
+
*
|
|
18
|
+
* // Wait for the latch to be opened
|
|
19
|
+
* yield* latch.await
|
|
20
|
+
*
|
|
21
|
+
* return "Latch was opened!"
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface Latch {
|
|
26
|
+
/** open the latch, releasing all fibers waiting on it */
|
|
27
|
+
readonly open: Effect.Effect<boolean>
|
|
28
|
+
/** open the latch, releasing all fibers waiting on it */
|
|
29
|
+
readonly openUnsafe: () => boolean
|
|
30
|
+
/** release all fibers waiting on the latch, without opening it */
|
|
31
|
+
readonly release: Effect.Effect<boolean>
|
|
32
|
+
/** wait for the latch to be opened */
|
|
33
|
+
readonly await: Effect.Effect<void>
|
|
34
|
+
/** close the latch */
|
|
35
|
+
readonly close: Effect.Effect<boolean>
|
|
36
|
+
/** close the latch */
|
|
37
|
+
readonly closeUnsafe: () => boolean
|
|
38
|
+
/** only run the given effect when the latch is open */
|
|
39
|
+
readonly whenOpen: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new Latch unsafely.
|
|
44
|
+
*
|
|
45
|
+
* **Previously Known As**
|
|
46
|
+
*
|
|
47
|
+
* This API replaces the following from Effect 3.x:
|
|
48
|
+
*
|
|
49
|
+
* - `Effect.makeLatchUnsafe`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { Effect, Latch } from "effect"
|
|
54
|
+
*
|
|
55
|
+
* const latch = Latch.makeUnsafe(false)
|
|
56
|
+
*
|
|
57
|
+
* const waiter = Effect.gen(function*() {
|
|
58
|
+
* yield* Effect.log("Waiting for latch to open...")
|
|
59
|
+
* yield* latch.await
|
|
60
|
+
* yield* Effect.log("Latch opened! Continuing...")
|
|
61
|
+
* })
|
|
62
|
+
*
|
|
63
|
+
* const opener = Effect.gen(function*() {
|
|
64
|
+
* yield* Effect.sleep("2 seconds")
|
|
65
|
+
* yield* Effect.log("Opening latch...")
|
|
66
|
+
* yield* latch.open
|
|
67
|
+
* })
|
|
68
|
+
*
|
|
69
|
+
* const program = Effect.all([waiter, opener])
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category constructors
|
|
73
|
+
* @since 3.8.0
|
|
74
|
+
*/
|
|
75
|
+
export const makeUnsafe: (open?: boolean | undefined) => Latch = internal.makeLatchUnsafe
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new Latch.
|
|
79
|
+
*
|
|
80
|
+
* **Previously Known As**
|
|
81
|
+
*
|
|
82
|
+
* This API replaces the following from Effect 3.x:
|
|
83
|
+
*
|
|
84
|
+
* - `Effect.makeLatch`
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { Effect, Latch } from "effect"
|
|
89
|
+
*
|
|
90
|
+
* const program = Effect.gen(function*() {
|
|
91
|
+
* const latch = yield* Latch.make(false)
|
|
92
|
+
*
|
|
93
|
+
* const waiter = Effect.gen(function*() {
|
|
94
|
+
* yield* Effect.log("Waiting for latch to open...")
|
|
95
|
+
* yield* latch.await
|
|
96
|
+
* yield* Effect.log("Latch opened! Continuing...")
|
|
97
|
+
* })
|
|
98
|
+
*
|
|
99
|
+
* const opener = Effect.gen(function*() {
|
|
100
|
+
* yield* Effect.sleep("2 seconds")
|
|
101
|
+
* yield* Effect.log("Opening latch...")
|
|
102
|
+
* yield* latch.open
|
|
103
|
+
* })
|
|
104
|
+
*
|
|
105
|
+
* yield* Effect.all([waiter, opener])
|
|
106
|
+
* })
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @category constructors
|
|
110
|
+
* @since 3.8.0
|
|
111
|
+
*/
|
|
112
|
+
export const make: (open?: boolean | undefined) => Effect.Effect<Latch> = internal.makeLatch
|
package/src/Pipeable.ts
CHANGED
|
@@ -554,8 +554,39 @@ export const pipeArguments = <A>(self: A, args: IArguments): unknown => {
|
|
|
554
554
|
/**
|
|
555
555
|
* @since 4.0.0
|
|
556
556
|
*/
|
|
557
|
-
export const
|
|
557
|
+
export const Prototype: Pipeable = {
|
|
558
558
|
pipe() {
|
|
559
559
|
return pipeArguments(this, arguments)
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @since 4.0.0
|
|
565
|
+
* @category constructors
|
|
566
|
+
*/
|
|
567
|
+
export const Class: new() => Pipeable = (function() {
|
|
568
|
+
function PipeableBase() {}
|
|
569
|
+
PipeableBase.prototype = Prototype
|
|
570
|
+
return PipeableBase as any
|
|
571
|
+
})()
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* @since 4.0.0
|
|
575
|
+
* @category models
|
|
576
|
+
*/
|
|
577
|
+
export interface PipeableConstructor {
|
|
578
|
+
new(...args: ReadonlyArray<any>): Pipeable
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @since 4.0.0
|
|
583
|
+
* @category constructors
|
|
584
|
+
*/
|
|
585
|
+
export const Mixin = <TBase extends new(...args: ReadonlyArray<any>) => any>(
|
|
586
|
+
klass: TBase
|
|
587
|
+
): TBase & PipeableConstructor =>
|
|
588
|
+
(class extends klass {
|
|
589
|
+
pipe() {
|
|
590
|
+
return pipeArguments(this, arguments)
|
|
591
|
+
}
|
|
592
|
+
})
|
package/src/PlatformError.ts
CHANGED
|
@@ -27,7 +27,7 @@ export class BadArgument extends Data.TaggedError("BadArgument")<{
|
|
|
27
27
|
* @since 4.0.0
|
|
28
28
|
* @category Model
|
|
29
29
|
*/
|
|
30
|
-
export type
|
|
30
|
+
export type SystemErrorTag =
|
|
31
31
|
| "AlreadyExists"
|
|
32
32
|
| "BadResource"
|
|
33
33
|
| "Busy"
|
|
@@ -44,8 +44,8 @@ export type SystemErrorKind =
|
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
* @category models
|
|
46
46
|
*/
|
|
47
|
-
export class SystemError extends Data.
|
|
48
|
-
|
|
47
|
+
export class SystemError extends Data.Error<{
|
|
48
|
+
_tag: SystemErrorTag
|
|
49
49
|
module: string
|
|
50
50
|
method: string
|
|
51
51
|
description?: string | undefined
|
|
@@ -57,7 +57,7 @@ export class SystemError extends Data.TaggedError("SystemError")<{
|
|
|
57
57
|
* @since 4.0.0
|
|
58
58
|
*/
|
|
59
59
|
override get message(): string {
|
|
60
|
-
return `${this.
|
|
60
|
+
return `${this._tag}: ${this.module}.${this.method}${
|
|
61
61
|
this.pathOrDescriptor !== undefined ? ` (${this.pathOrDescriptor})` : ""
|
|
62
62
|
}${this.description ? `: ${this.description}` : ""}`
|
|
63
63
|
}
|
|
@@ -93,7 +93,7 @@ export class PlatformError extends Data.TaggedError("PlatformError")<{
|
|
|
93
93
|
* @category constructors
|
|
94
94
|
*/
|
|
95
95
|
export const systemError = (options: {
|
|
96
|
-
readonly
|
|
96
|
+
readonly _tag: SystemErrorTag
|
|
97
97
|
readonly module: string
|
|
98
98
|
readonly method: string
|
|
99
99
|
readonly description?: string | undefined
|
package/src/Pool.ts
CHANGED
|
@@ -9,11 +9,13 @@ import type * as Exit from "./Exit.ts"
|
|
|
9
9
|
import * as Fiber from "./Fiber.ts"
|
|
10
10
|
import { dual, identity } from "./Function.ts"
|
|
11
11
|
import * as Iterable from "./Iterable.ts"
|
|
12
|
+
import * as Latch from "./Latch.ts"
|
|
12
13
|
import { type Pipeable, pipeArguments } from "./Pipeable.ts"
|
|
13
14
|
import { hasProperty } from "./Predicate.ts"
|
|
14
15
|
import * as Queue from "./Queue.ts"
|
|
15
16
|
import { UnhandledLogLevel } from "./References.ts"
|
|
16
17
|
import * as Scope from "./Scope.ts"
|
|
18
|
+
import * as Semaphore from "./Semaphore.ts"
|
|
17
19
|
import * as ServiceMap from "./ServiceMap.ts"
|
|
18
20
|
|
|
19
21
|
const TypeId = "~effect/Pool"
|
|
@@ -52,11 +54,11 @@ export interface Config<A, E> {
|
|
|
52
54
|
export interface State<A, E> {
|
|
53
55
|
readonly scope: Scope.Scope
|
|
54
56
|
isShuttingDown: boolean
|
|
55
|
-
readonly semaphore:
|
|
56
|
-
readonly resizeSemaphore:
|
|
57
|
+
readonly semaphore: Semaphore.Semaphore
|
|
58
|
+
readonly resizeSemaphore: Semaphore.Semaphore
|
|
57
59
|
readonly items: Set<PoolItem<A, E>>
|
|
58
60
|
readonly available: Set<PoolItem<A, E>>
|
|
59
|
-
readonly availableLatch:
|
|
61
|
+
readonly availableLatch: Latch.Latch
|
|
60
62
|
readonly invalidated: Set<PoolItem<A, E>>
|
|
61
63
|
waiters: number
|
|
62
64
|
}
|
|
@@ -212,11 +214,11 @@ export const makeWithStrategy = <A, E, R>(options: {
|
|
|
212
214
|
const state: State<A, E> = {
|
|
213
215
|
scope,
|
|
214
216
|
isShuttingDown: false,
|
|
215
|
-
semaphore:
|
|
216
|
-
resizeSemaphore:
|
|
217
|
+
semaphore: Semaphore.makeUnsafe(concurrency * options.max),
|
|
218
|
+
resizeSemaphore: Semaphore.makeUnsafe(1),
|
|
217
219
|
items: new Set(),
|
|
218
220
|
available: new Set(),
|
|
219
|
-
availableLatch:
|
|
221
|
+
availableLatch: Latch.makeUnsafe(false),
|
|
220
222
|
invalidated: new Set(),
|
|
221
223
|
waiters: 0
|
|
222
224
|
}
|
|
@@ -244,7 +246,7 @@ const shutdown = Effect.fnUntraced(function*<A, E>(self: Pool<A, E>) {
|
|
|
244
246
|
if (self.state.isShuttingDown) return
|
|
245
247
|
self.state.isShuttingDown = true
|
|
246
248
|
const size = self.state.items.size
|
|
247
|
-
const semaphore =
|
|
249
|
+
const semaphore = Semaphore.makeUnsafe(size)
|
|
248
250
|
for (const item of self.state.items) {
|
|
249
251
|
if (item.refCount > 0) {
|
|
250
252
|
item.finalizer = Effect.tap(item.finalizer, semaphore.release(1))
|
package/src/PubSub.ts
CHANGED
|
@@ -34,6 +34,7 @@ import * as Effect from "./Effect.ts"
|
|
|
34
34
|
import * as Exit from "./Exit.ts"
|
|
35
35
|
import type { LazyArg } from "./Function.ts"
|
|
36
36
|
import { dual, identity } from "./Function.ts"
|
|
37
|
+
import * as Latch from "./Latch.ts"
|
|
37
38
|
import * as MutableList from "./MutableList.ts"
|
|
38
39
|
import * as MutableRef from "./MutableRef.ts"
|
|
39
40
|
import { nextPow2 } from "./Number.ts"
|
|
@@ -81,7 +82,7 @@ export interface PubSub<in out A> extends Pipeable {
|
|
|
81
82
|
readonly pubsub: PubSub.Atomic<A>
|
|
82
83
|
readonly subscribers: PubSub.Subscribers<A>
|
|
83
84
|
readonly scope: Scope.Closeable
|
|
84
|
-
readonly shutdownHook:
|
|
85
|
+
readonly shutdownHook: Latch.Latch
|
|
85
86
|
readonly shutdownFlag: MutableRef.MutableRef<boolean>
|
|
86
87
|
readonly strategy: PubSub.Strategy<A>
|
|
87
88
|
}
|
|
@@ -242,7 +243,7 @@ export interface Subscription<out A> extends Pipeable {
|
|
|
242
243
|
readonly subscribers: PubSub.Subscribers<any>
|
|
243
244
|
readonly subscription: PubSub.BackingSubscription<A>
|
|
244
245
|
readonly pollers: MutableList.MutableList<Deferred.Deferred<any>>
|
|
245
|
-
readonly shutdownHook:
|
|
246
|
+
readonly shutdownHook: Latch.Latch
|
|
246
247
|
readonly shutdownFlag: MutableRef.MutableRef<boolean>
|
|
247
248
|
readonly strategy: PubSub.Strategy<any>
|
|
248
249
|
readonly replayWindow: PubSub.ReplayWindow<A>
|
|
@@ -282,7 +283,7 @@ export const make = <A>(
|
|
|
282
283
|
options.atomicPubSub(),
|
|
283
284
|
new Map(),
|
|
284
285
|
Scope.makeUnsafe(),
|
|
285
|
-
|
|
286
|
+
Latch.makeUnsafe(false),
|
|
286
287
|
MutableRef.make(false),
|
|
287
288
|
options.strategy()
|
|
288
289
|
)
|
|
@@ -1701,7 +1702,7 @@ const makeSubscriptionUnsafe = <A>(
|
|
|
1701
1702
|
subscribers,
|
|
1702
1703
|
pubsub.subscribe(),
|
|
1703
1704
|
MutableList.make<Deferred.Deferred<A>>(),
|
|
1704
|
-
|
|
1705
|
+
Latch.makeUnsafe(false),
|
|
1705
1706
|
MutableRef.make(false),
|
|
1706
1707
|
strategy,
|
|
1707
1708
|
pubsub.replayWindow()
|
|
@@ -2446,7 +2447,7 @@ class SubscriptionImpl<in out A> implements Subscription<A> {
|
|
|
2446
2447
|
readonly subscribers: PubSub.Subscribers<A>
|
|
2447
2448
|
readonly subscription: PubSub.BackingSubscription<A>
|
|
2448
2449
|
readonly pollers: MutableList.MutableList<Deferred.Deferred<A>>
|
|
2449
|
-
readonly shutdownHook:
|
|
2450
|
+
readonly shutdownHook: Latch.Latch
|
|
2450
2451
|
readonly shutdownFlag: MutableRef.MutableRef<boolean>
|
|
2451
2452
|
readonly strategy: PubSub.Strategy<A>
|
|
2452
2453
|
readonly replayWindow: PubSub.ReplayWindow<A>
|
|
@@ -2456,7 +2457,7 @@ class SubscriptionImpl<in out A> implements Subscription<A> {
|
|
|
2456
2457
|
subscribers: PubSub.Subscribers<A>,
|
|
2457
2458
|
subscription: PubSub.BackingSubscription<A>,
|
|
2458
2459
|
pollers: MutableList.MutableList<Deferred.Deferred<A>>,
|
|
2459
|
-
shutdownHook:
|
|
2460
|
+
shutdownHook: Latch.Latch,
|
|
2460
2461
|
shutdownFlag: MutableRef.MutableRef<boolean>,
|
|
2461
2462
|
strategy: PubSub.Strategy<A>,
|
|
2462
2463
|
replayWindow: PubSub.ReplayWindow<A>
|
|
@@ -2484,7 +2485,7 @@ class PubSubImpl<in out A> implements PubSub<A> {
|
|
|
2484
2485
|
readonly pubsub: PubSub.Atomic<A>
|
|
2485
2486
|
readonly subscribers: PubSub.Subscribers<A>
|
|
2486
2487
|
readonly scope: Scope.Closeable
|
|
2487
|
-
readonly shutdownHook:
|
|
2488
|
+
readonly shutdownHook: Latch.Latch
|
|
2488
2489
|
readonly shutdownFlag: MutableRef.MutableRef<boolean>
|
|
2489
2490
|
readonly strategy: PubSub.Strategy<A>
|
|
2490
2491
|
|
|
@@ -2492,7 +2493,7 @@ class PubSubImpl<in out A> implements PubSub<A> {
|
|
|
2492
2493
|
pubsub: PubSub.Atomic<A>,
|
|
2493
2494
|
subscribers: PubSub.Subscribers<A>,
|
|
2494
2495
|
scope: Scope.Closeable,
|
|
2495
|
-
shutdownHook:
|
|
2496
|
+
shutdownHook: Latch.Latch,
|
|
2496
2497
|
shutdownFlag: MutableRef.MutableRef<boolean>,
|
|
2497
2498
|
strategy: PubSub.Strategy<A>
|
|
2498
2499
|
) {
|
|
@@ -2513,7 +2514,7 @@ const makePubSubUnsafe = <A>(
|
|
|
2513
2514
|
pubsub: PubSub.Atomic<A>,
|
|
2514
2515
|
subscribers: PubSub.Subscribers<A>,
|
|
2515
2516
|
scope: Scope.Closeable,
|
|
2516
|
-
shutdownHook:
|
|
2517
|
+
shutdownHook: Latch.Latch,
|
|
2517
2518
|
shutdownFlag: MutableRef.MutableRef<boolean>,
|
|
2518
2519
|
strategy: PubSub.Strategy<A>
|
|
2519
2520
|
): PubSub<A> => new PubSubImpl(pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy)
|
package/src/Request.ts
CHANGED
|
@@ -88,7 +88,7 @@ export interface Variance<out A, out E, out R> {
|
|
|
88
88
|
* @category models
|
|
89
89
|
*/
|
|
90
90
|
export interface Constructor<R extends Request<any, any, any>, T extends keyof R = never> {
|
|
91
|
-
(args: Omit<R, T | keyof (Variance<any, any, any>)
|
|
91
|
+
(args: Types.VoidIfEmpty<Types.Simplify<Omit<R, T | keyof (Variance<any, any, any>)>>>): R
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -285,7 +285,8 @@ export const tagged = <R extends Request<any, any, any> & { _tag: string }>(
|
|
|
285
285
|
tag: R["_tag"]
|
|
286
286
|
): Constructor<R, "_tag"> =>
|
|
287
287
|
(args) => {
|
|
288
|
-
const request = Object.
|
|
288
|
+
const request = Object.create(RequestPrototype)
|
|
289
|
+
if (args) Object.assign(request, args)
|
|
289
290
|
request._tag = tag
|
|
290
291
|
return request
|
|
291
292
|
}
|
package/src/RequestResolver.ts
CHANGED
|
@@ -841,26 +841,6 @@ export const around: {
|
|
|
841
841
|
/**
|
|
842
842
|
* A request resolver that never executes requests.
|
|
843
843
|
*
|
|
844
|
-
* @example
|
|
845
|
-
* ```ts
|
|
846
|
-
* import { Effect, Request, RequestResolver } from "effect"
|
|
847
|
-
*
|
|
848
|
-
* // A resolver that will never complete
|
|
849
|
-
* const neverResolver = RequestResolver.never
|
|
850
|
-
*
|
|
851
|
-
* // For testing timeout behavior with any request type
|
|
852
|
-
* interface TestRequest extends Request.Request<string> {
|
|
853
|
-
* readonly _tag: "TestRequest"
|
|
854
|
-
* }
|
|
855
|
-
* const TestRequest = Request.tagged<TestRequest>("TestRequest")
|
|
856
|
-
*
|
|
857
|
-
* // This will never resolve
|
|
858
|
-
* const neverEffect = Effect.request(TestRequest({}), Effect.succeed(neverResolver) as any)
|
|
859
|
-
*
|
|
860
|
-
* // Useful for testing timeout behavior
|
|
861
|
-
* const timeoutTest = Effect.timeout(neverEffect, "1 second")
|
|
862
|
-
* ```
|
|
863
|
-
*
|
|
864
844
|
* @since 2.0.0
|
|
865
845
|
* @category constructors
|
|
866
846
|
*/
|