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
|
@@ -17,18 +17,18 @@ const TypeId = "~effect/persistence/PersistedCache" as const
|
|
|
17
17
|
* @since 4.0.0
|
|
18
18
|
* @category Models
|
|
19
19
|
*/
|
|
20
|
-
export interface PersistedCache<K extends Persistable.Any> {
|
|
20
|
+
export interface PersistedCache<K extends Persistable.Any, out R = never> {
|
|
21
21
|
readonly [TypeId]: typeof TypeId
|
|
22
22
|
readonly inMemory: Cache.Cache<
|
|
23
23
|
K,
|
|
24
24
|
Persistable.Success<K>,
|
|
25
25
|
Persistable.Error<K> | Persistence.PersistenceError | Schema.SchemaError,
|
|
26
|
-
Persistable.Services<K>
|
|
26
|
+
Persistable.Services<K> | R
|
|
27
27
|
>
|
|
28
28
|
readonly get: (key: K) => Effect.Effect<
|
|
29
29
|
Persistable.Success<K>,
|
|
30
30
|
Persistable.Error<K> | Persistence.PersistenceError | Schema.SchemaError,
|
|
31
|
-
Persistable.Services<K>
|
|
31
|
+
Persistable.Services<K> | R
|
|
32
32
|
>
|
|
33
33
|
readonly invalidate: (key: K) => Effect.Effect<void, Persistence.PersistenceError>
|
|
34
34
|
}
|
|
@@ -37,22 +37,32 @@ export interface PersistedCache<K extends Persistable.Any> {
|
|
|
37
37
|
* @since 4.0.0
|
|
38
38
|
* @category Constructors
|
|
39
39
|
*/
|
|
40
|
-
export const make: <
|
|
40
|
+
export const make: <
|
|
41
|
+
K extends Persistable.Any,
|
|
42
|
+
R = never,
|
|
43
|
+
ServiceMode extends "lookup" | "construction" = never
|
|
44
|
+
>(options: {
|
|
41
45
|
readonly storeId: string
|
|
42
46
|
readonly lookup: (key: K) => Effect.Effect<Persistable.Success<K>, Persistable.Error<K>, R>
|
|
43
47
|
readonly timeToLive: Persistable.TimeToLiveFn<K>
|
|
44
48
|
readonly inMemoryCapacity?: number | undefined
|
|
45
49
|
readonly inMemoryTTL?: Persistable.TimeToLiveFn<K> | undefined
|
|
50
|
+
readonly requireServicesAt?: ServiceMode | undefined
|
|
46
51
|
}) => Effect.Effect<
|
|
47
|
-
PersistedCache<K>,
|
|
52
|
+
PersistedCache<K, "lookup" extends ServiceMode ? R : never>,
|
|
48
53
|
never,
|
|
49
|
-
R | Persistence.Persistence | Scope.Scope
|
|
50
|
-
> = Effect.fnUntraced(function*<
|
|
54
|
+
("lookup" extends ServiceMode ? never : R) | Persistence.Persistence | Scope.Scope
|
|
55
|
+
> = Effect.fnUntraced(function*<
|
|
56
|
+
K extends Persistable.Any,
|
|
57
|
+
R = never,
|
|
58
|
+
ServiceMode extends "lookup" | "construction" = never
|
|
59
|
+
>(options: {
|
|
51
60
|
readonly storeId: string
|
|
52
61
|
readonly lookup: (key: K) => Effect.Effect<Persistable.Success<K>, Persistable.Error<K>, R>
|
|
53
62
|
readonly timeToLive: Persistable.TimeToLiveFn<K>
|
|
54
63
|
readonly inMemoryCapacity?: number | undefined
|
|
55
64
|
readonly inMemoryTTL?: Persistable.TimeToLiveFn<K> | undefined
|
|
65
|
+
readonly requireServicesAt?: ServiceMode | undefined
|
|
56
66
|
}) {
|
|
57
67
|
const store = yield* (yield* Persistence.Persistence).make({
|
|
58
68
|
storeId: options.storeId,
|
|
@@ -69,9 +79,10 @@ export const make: <K extends Persistable.Any, R>(options: {
|
|
|
69
79
|
return yield* result
|
|
70
80
|
}),
|
|
71
81
|
timeToLive: options.inMemoryTTL ?? constant(Duration.seconds(10)),
|
|
72
|
-
capacity: options.inMemoryCapacity ?? 1024
|
|
82
|
+
capacity: options.inMemoryCapacity ?? 1024,
|
|
83
|
+
requireServicesAt: options.requireServicesAt
|
|
73
84
|
})
|
|
74
|
-
return identity<PersistedCache<K>>({
|
|
85
|
+
return identity<PersistedCache<K, "lookup" extends ServiceMode ? R : never>>({
|
|
75
86
|
[TypeId]: TypeId,
|
|
76
87
|
inMemory,
|
|
77
88
|
get: (key) => Cache.get(inMemory, key),
|
|
@@ -9,6 +9,7 @@ import * as Effect from "../../Effect.ts"
|
|
|
9
9
|
import * as Exit from "../../Exit.ts"
|
|
10
10
|
import { flow } from "../../Function.ts"
|
|
11
11
|
import * as Iterable from "../../Iterable.ts"
|
|
12
|
+
import * as Latch from "../../Latch.ts"
|
|
12
13
|
import * as Layer from "../../Layer.ts"
|
|
13
14
|
import * as MutableRef from "../../MutableRef.ts"
|
|
14
15
|
import * as Queue from "../../Queue.ts"
|
|
@@ -235,14 +236,14 @@ export const layerStoreMemory: Layer.Layer<
|
|
|
235
236
|
}
|
|
236
237
|
const ids = new Set<string>()
|
|
237
238
|
const queues = new Map<string, {
|
|
238
|
-
latch:
|
|
239
|
+
latch: Latch.Latch
|
|
239
240
|
items: Set<Entry>
|
|
240
241
|
}>()
|
|
241
242
|
const getOrCreateQueue = (name: string) => {
|
|
242
243
|
let queue = queues.get(name)
|
|
243
244
|
if (!queue) {
|
|
244
245
|
queue = {
|
|
245
|
-
latch:
|
|
246
|
+
latch: Latch.makeUnsafe(false),
|
|
246
247
|
items: new Set()
|
|
247
248
|
}
|
|
248
249
|
queues.set(name, queue)
|
|
@@ -345,8 +346,8 @@ export const makeStoreRedis = Effect.fnUntraced(function*(
|
|
|
345
346
|
const pendingKey = keyPending(name)
|
|
346
347
|
const queue = yield* Queue.make<Element>()
|
|
347
348
|
const takers = MutableRef.make(0)
|
|
348
|
-
const pollLatch =
|
|
349
|
-
const takenLatch =
|
|
349
|
+
const pollLatch = Latch.makeUnsafe()
|
|
350
|
+
const takenLatch = Latch.makeUnsafe()
|
|
350
351
|
|
|
351
352
|
yield* Effect.addFinalizer(() =>
|
|
352
353
|
Effect.orDie(
|
|
@@ -930,8 +931,8 @@ export const makeStoreSql: (
|
|
|
930
931
|
lookup: Effect.fnUntraced(function*({ maxAttempts, name }: QueueKey) {
|
|
931
932
|
const queue = yield* Queue.make<Element>()
|
|
932
933
|
const takers = MutableRef.make(0)
|
|
933
|
-
const pollLatch =
|
|
934
|
-
const takenLatch =
|
|
934
|
+
const pollLatch = Latch.makeUnsafe()
|
|
935
|
+
const takenLatch = Latch.makeUnsafe()
|
|
935
936
|
|
|
936
937
|
yield* Effect.addFinalizer(() =>
|
|
937
938
|
Effect.flatMap(Queue.clear(queue), (elements) => {
|
|
@@ -76,10 +76,16 @@ export interface ChildProcessHandle {
|
|
|
76
76
|
readonly stdin: Sink.Sink<void, Uint8Array, never, PlatformError.PlatformError>
|
|
77
77
|
/**
|
|
78
78
|
* The standard output stream for the child process.
|
|
79
|
+
*
|
|
80
|
+
* Note: Using alongside `all` may cause interleaving of output and unexpected
|
|
81
|
+
* results.
|
|
79
82
|
*/
|
|
80
83
|
readonly stdout: Stream.Stream<Uint8Array, PlatformError.PlatformError>
|
|
81
84
|
/**
|
|
82
85
|
* The standard error stream for the child process.
|
|
86
|
+
*
|
|
87
|
+
* Note: Using alongside `all` may cause interleaving of output and unexpected
|
|
88
|
+
* results.
|
|
83
89
|
*/
|
|
84
90
|
readonly stderr: Stream.Stream<Uint8Array, PlatformError.PlatformError>
|
|
85
91
|
/**
|
|
@@ -2291,16 +2291,18 @@ export const serializable: {
|
|
|
2291
2291
|
} = dual(2, <R extends Atom<any>, A, I>(self: R, options: {
|
|
2292
2292
|
readonly key: string
|
|
2293
2293
|
readonly schema: Schema.Codec<A, I>
|
|
2294
|
-
}): R & Serializable<any> =>
|
|
2295
|
-
|
|
2294
|
+
}): R & Serializable<any> => {
|
|
2295
|
+
const codecJson = Schema.toCodecJson(options.schema)
|
|
2296
|
+
return Object.assign(Object.create(Object.getPrototypeOf(self)), {
|
|
2296
2297
|
...self,
|
|
2297
2298
|
label: self.label ?? [options.key, new Error().stack?.split("\n")[5] ?? ""],
|
|
2298
2299
|
[SerializableTypeId]: {
|
|
2299
2300
|
key: options.key,
|
|
2300
|
-
encode: Schema.encodeSync(
|
|
2301
|
-
decode: Schema.decodeSync(
|
|
2301
|
+
encode: Schema.encodeSync(codecJson),
|
|
2302
|
+
decode: Schema.decodeSync(codecJson)
|
|
2302
2303
|
}
|
|
2303
|
-
})
|
|
2304
|
+
})
|
|
2305
|
+
})
|
|
2304
2306
|
|
|
2305
2307
|
/**
|
|
2306
2308
|
* @since 4.0.0
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as AsyncResult from "./AsyncResult.ts"
|
|
5
|
+
import * as Atom from "./Atom.ts"
|
|
6
|
+
import type * as AtomRegistry from "./AtomRegistry.ts"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @since 4.0.0
|
|
10
|
+
* @category models
|
|
11
|
+
*/
|
|
12
|
+
export interface DehydratedAtom {
|
|
13
|
+
readonly "~effect/reactivity/DehydratedAtom": true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 4.0.0
|
|
18
|
+
* @category models
|
|
19
|
+
*/
|
|
20
|
+
export interface DehydratedAtomValue extends DehydratedAtom {
|
|
21
|
+
readonly key: string
|
|
22
|
+
readonly value: unknown
|
|
23
|
+
readonly dehydratedAt: number
|
|
24
|
+
readonly resultPromise?: Promise<unknown> | undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @since 4.0.0
|
|
29
|
+
* @category dehydration
|
|
30
|
+
*/
|
|
31
|
+
export const dehydrate = (
|
|
32
|
+
registry: AtomRegistry.AtomRegistry,
|
|
33
|
+
options?: {
|
|
34
|
+
/**
|
|
35
|
+
* How to encode `AsyncResult.Initial` values. Default is "ignore".
|
|
36
|
+
*/
|
|
37
|
+
readonly encodeInitialAs?: "ignore" | "promise" | "value-only" | undefined
|
|
38
|
+
}
|
|
39
|
+
): Array<DehydratedAtom> => {
|
|
40
|
+
const encodeInitialResultMode = options?.encodeInitialAs ?? "ignore"
|
|
41
|
+
const arr: Array<DehydratedAtomValue> = []
|
|
42
|
+
const now = Date.now()
|
|
43
|
+
registry.getNodes().forEach((node, key) => {
|
|
44
|
+
if (!Atom.isSerializable(node.atom)) return
|
|
45
|
+
const atom = node.atom
|
|
46
|
+
const value = node.value()
|
|
47
|
+
const isInitial = AsyncResult.isAsyncResult(value) && AsyncResult.isInitial(value)
|
|
48
|
+
if (encodeInitialResultMode === "ignore" && isInitial) return
|
|
49
|
+
const encodedValue = atom[Atom.SerializableTypeId].encode(value)
|
|
50
|
+
|
|
51
|
+
// Create a promise that resolves when the atom moves out of Initial state
|
|
52
|
+
let resultPromise: Promise<unknown> | undefined
|
|
53
|
+
if (encodeInitialResultMode === "promise" && isInitial) {
|
|
54
|
+
resultPromise = new Promise((resolve) => {
|
|
55
|
+
const unsubscribe = registry.subscribe(atom, (newValue) => {
|
|
56
|
+
if (AsyncResult.isAsyncResult(newValue) && !AsyncResult.isInitial(newValue)) {
|
|
57
|
+
resolve(atom[Atom.SerializableTypeId].encode(newValue))
|
|
58
|
+
unsubscribe()
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
arr.push({
|
|
65
|
+
"~effect/reactivity/DehydratedAtom": true,
|
|
66
|
+
key: key as string,
|
|
67
|
+
value: encodedValue,
|
|
68
|
+
dehydratedAt: now,
|
|
69
|
+
resultPromise
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
return arr as any
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @since 4.0.0
|
|
77
|
+
* @category dehydration
|
|
78
|
+
*/
|
|
79
|
+
export const toValues = (state: ReadonlyArray<DehydratedAtom>): Array<DehydratedAtomValue> => state as any
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @since 4.0.0
|
|
83
|
+
* @category hydration
|
|
84
|
+
*/
|
|
85
|
+
export const hydrate = (
|
|
86
|
+
registry: AtomRegistry.AtomRegistry,
|
|
87
|
+
dehydratedState: Iterable<DehydratedAtom>
|
|
88
|
+
): void => {
|
|
89
|
+
for (const datom of (dehydratedState as Iterable<DehydratedAtomValue>)) {
|
|
90
|
+
registry.setSerializable(datom.key, datom.value)
|
|
91
|
+
|
|
92
|
+
// If there's a resultPromise, it means this was in Initial state when dehydrated
|
|
93
|
+
// and we should wait for it to resolve to a non-Initial state, then update the registry
|
|
94
|
+
if (!datom.resultPromise) continue
|
|
95
|
+
datom.resultPromise.then((resolvedValue) => {
|
|
96
|
+
// Try to update the existing node directly instead of using setSerializable
|
|
97
|
+
const nodes = registry.getNodes()
|
|
98
|
+
const node = nodes.get(datom.key)
|
|
99
|
+
if (node) {
|
|
100
|
+
// Decode the resolved value using the node's atom serializable decoder
|
|
101
|
+
const atom = node.atom as any
|
|
102
|
+
if (atom[Atom.SerializableTypeId]) {
|
|
103
|
+
const decoded = atom[Atom.SerializableTypeId].decode(resolvedValue)
|
|
104
|
+
;(node as any).setValue(decoded)
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
// Fallback to setSerializable if node doesn't exist yet
|
|
108
|
+
registry.setSerializable(datom.key, resolvedValue)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -8,6 +8,7 @@ import * as Effect from "../../Effect.ts"
|
|
|
8
8
|
import * as Exit from "../../Exit.ts"
|
|
9
9
|
import * as Fiber from "../../Fiber.ts"
|
|
10
10
|
import { constVoid, dual, flow, identity } from "../../Function.ts"
|
|
11
|
+
import * as Latch from "../../Latch.ts"
|
|
11
12
|
import * as Layer from "../../Layer.ts"
|
|
12
13
|
import * as Option from "../../Option.ts"
|
|
13
14
|
import * as Pool from "../../Pool.ts"
|
|
@@ -1070,7 +1071,7 @@ const defaultRetryPolicy = Schedule.exponential(500, 1.5).pipe(
|
|
|
1070
1071
|
|
|
1071
1072
|
const makePinger = Effect.fnUntraced(function*<A, E, R>(writePing: Effect.Effect<A, E, R>) {
|
|
1072
1073
|
let recievedPong = true
|
|
1073
|
-
const latch =
|
|
1074
|
+
const latch = Latch.makeUnsafe()
|
|
1074
1075
|
const reset = () => {
|
|
1075
1076
|
recievedPong = true
|
|
1076
1077
|
latch.closeUnsafe()
|
|
@@ -1133,7 +1134,7 @@ export const makeProtocolWorker = (
|
|
|
1133
1134
|
|
|
1134
1135
|
const entries = new Map<string, {
|
|
1135
1136
|
readonly worker: Worker.Worker<FromServerEncoded, FromClientEncoded | RpcWorker.InitialMessage.Encoded>
|
|
1136
|
-
readonly latch:
|
|
1137
|
+
readonly latch: Latch.Latch
|
|
1137
1138
|
}>()
|
|
1138
1139
|
|
|
1139
1140
|
const acquire = Effect.gen(function*() {
|
|
@@ -1219,7 +1220,7 @@ export const makeProtocolWorker = (
|
|
|
1219
1220
|
case "Request": {
|
|
1220
1221
|
return Pool.get(pool).pipe(
|
|
1221
1222
|
Effect.flatMap((worker) => {
|
|
1222
|
-
const latch =
|
|
1223
|
+
const latch = Latch.makeUnsafe(false)
|
|
1223
1224
|
entries.set(request.id, { worker, latch })
|
|
1224
1225
|
return Effect.flatMap(worker.send(request, transferables), () => latch.await)
|
|
1225
1226
|
}),
|
|
@@ -8,6 +8,7 @@ import * as Effect from "../../Effect.ts"
|
|
|
8
8
|
import * as Exit from "../../Exit.ts"
|
|
9
9
|
import * as Fiber from "../../Fiber.ts"
|
|
10
10
|
import { constant, constTrue, constVoid, identity } from "../../Function.ts"
|
|
11
|
+
import * as Latch from "../../Latch.ts"
|
|
11
12
|
import * as Layer from "../../Layer.ts"
|
|
12
13
|
import type * as Option from "../../Option.ts"
|
|
13
14
|
import * as Predicate from "../../Predicate.ts"
|
|
@@ -17,6 +18,7 @@ import * as Result from "../../Result.ts"
|
|
|
17
18
|
import * as Schedule from "../../Schedule.ts"
|
|
18
19
|
import * as Schema from "../../Schema.ts"
|
|
19
20
|
import * as Scope from "../../Scope.ts"
|
|
21
|
+
import * as Semaphore from "../../Semaphore.ts"
|
|
20
22
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
21
23
|
import { Stdio } from "../../Stdio.ts"
|
|
22
24
|
import * as Stream from "../../Stream.ts"
|
|
@@ -101,18 +103,18 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any>(
|
|
|
101
103
|
const trackFiber = Fiber.runIn(Scope.forkUnsafe(scope, "parallel"))
|
|
102
104
|
const concurrencySemaphore = concurrency === "unbounded"
|
|
103
105
|
? undefined
|
|
104
|
-
: yield*
|
|
106
|
+
: yield* Semaphore.make(concurrency)
|
|
105
107
|
|
|
106
108
|
type Client = {
|
|
107
109
|
readonly id: number
|
|
108
|
-
readonly latches: Map<RequestId,
|
|
110
|
+
readonly latches: Map<RequestId, Latch.Latch>
|
|
109
111
|
readonly fibers: Map<RequestId, Fiber.Fiber<unknown, any>>
|
|
110
112
|
ended: boolean
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
const clients = new Map<number, Client>()
|
|
114
116
|
let isShutdown = false
|
|
115
|
-
const shutdownLatch =
|
|
117
|
+
const shutdownLatch = Latch.makeUnsafe(false)
|
|
116
118
|
yield* Scope.addFinalizer(
|
|
117
119
|
scope,
|
|
118
120
|
Effect.withFiber((parent) => {
|
|
@@ -342,7 +344,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any>(
|
|
|
342
344
|
) => {
|
|
343
345
|
let latch = client.latches.get(request.id)
|
|
344
346
|
if (supportsAck && !latch) {
|
|
345
|
-
latch =
|
|
347
|
+
latch = Latch.makeUnsafe(false)
|
|
346
348
|
client.latches.set(request.id, latch)
|
|
347
349
|
}
|
|
348
350
|
if (Effect.isEffect(stream)) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
import * as Effect from "../../Effect.ts"
|
|
5
|
+
import * as Semaphore from "../../Semaphore.ts"
|
|
5
6
|
import type * as ServiceMap from "../../ServiceMap.ts"
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -14,7 +15,7 @@ export const withRun = <
|
|
|
14
15
|
>() =>
|
|
15
16
|
<EX, RX>(f: (write: Parameters<A["run"]>[0]) => Effect.Effect<Omit<A, "run">, EX, RX>): Effect.Effect<A, EX, RX> =>
|
|
16
17
|
Effect.suspend(() => {
|
|
17
|
-
const semaphore =
|
|
18
|
+
const semaphore = Semaphore.makeUnsafe(1)
|
|
18
19
|
let buffer: Array<[Array<any>, ServiceMap.ServiceMap<never>]> = []
|
|
19
20
|
let write = (...args: Array<any>): Effect.Effect<void> =>
|
|
20
21
|
Effect.servicesWith((context) => {
|
|
@@ -10,6 +10,7 @@ import * as Effect from "../../Effect.ts"
|
|
|
10
10
|
import * as Exit from "../../Exit.ts"
|
|
11
11
|
import * as FiberSet from "../../FiberSet.ts"
|
|
12
12
|
import { constVoid, dual, flow } from "../../Function.ts"
|
|
13
|
+
import * 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 Pull from "../../Pull.ts"
|
|
@@ -448,7 +449,7 @@ export const fromWebSocket = <RO>(
|
|
|
448
449
|
): Effect.Effect<Socket, never, Exclude<RO, Scope.Scope>> =>
|
|
449
450
|
Effect.withFiber((fiber) => {
|
|
450
451
|
let currentWS: globalThis.WebSocket | undefined
|
|
451
|
-
const latch =
|
|
452
|
+
const latch = Latch.makeUnsafe(false)
|
|
452
453
|
const acquireContext = fiber.services as ServiceMap.ServiceMap<RO>
|
|
453
454
|
const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError
|
|
454
455
|
|
|
@@ -648,7 +649,7 @@ export const fromTransformStream = <R>(acquire: Effect.Effect<InputTransformStre
|
|
|
648
649
|
readonly closeCodeIsError?: (code: number) => boolean
|
|
649
650
|
}): Effect.Effect<Socket, never, Exclude<R, Scope.Scope>> =>
|
|
650
651
|
Effect.withFiber((fiber) => {
|
|
651
|
-
const latch =
|
|
652
|
+
const latch = Latch.makeUnsafe(false)
|
|
652
653
|
let currentStream: {
|
|
653
654
|
readonly stream: InputTransformStream
|
|
654
655
|
readonly fiberSet: FiberSet.FiberSet<any, any>
|
|
@@ -1124,7 +1124,6 @@ const makeUnsafe = <A = Row>(
|
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
1126
|
// TODO: figure out why these diagnostics are emitted
|
|
1127
|
-
// @effect-diagnostics-next-line missingEffectContext:off missingEffectError:off
|
|
1128
1127
|
const StatementProto: Omit<
|
|
1129
1128
|
StatementImpl<any>,
|
|
1130
1129
|
"segments" | "acquirer" | "compiler" | "spanAttributes" | "transformRows"
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type * as Deferred from "../../Deferred.ts"
|
|
5
5
|
import * as Effect from "../../Effect.ts"
|
|
6
6
|
import * as FiberSet from "../../FiberSet.ts"
|
|
7
|
+
import * as Latch from "../../Latch.ts"
|
|
7
8
|
import * as Layer from "../../Layer.ts"
|
|
8
9
|
import * as Scope from "../../Scope.ts"
|
|
9
10
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
@@ -149,7 +150,7 @@ export const makePlatform = <W>() =>
|
|
|
149
150
|
WorkerError | E
|
|
150
151
|
>().pipe(Scope.provide(scope))
|
|
151
152
|
const run = yield* FiberSet.runtime(fiberSet)<R>()
|
|
152
|
-
const ready =
|
|
153
|
+
const ready = Latch.makeUnsafe()
|
|
153
154
|
yield* options.listen({
|
|
154
155
|
port,
|
|
155
156
|
scope,
|
|
@@ -5,7 +5,7 @@ import type { NonEmptyReadonlyArray } from "../../Array.ts"
|
|
|
5
5
|
import type * as Brand from "../../Brand.ts"
|
|
6
6
|
import type * as Cause from "../../Cause.ts"
|
|
7
7
|
import * as Effect from "../../Effect.ts"
|
|
8
|
-
import * as
|
|
8
|
+
import * as Encoding from "../../Encoding.ts"
|
|
9
9
|
import * as Exit from "../../Exit.ts"
|
|
10
10
|
import { dual } from "../../Function.ts"
|
|
11
11
|
import * as Predicate from "../../Predicate.ts"
|
|
@@ -285,7 +285,7 @@ export class TokenParsed extends Schema.Class<TokenParsed>(
|
|
|
285
285
|
* @since 4.0.0
|
|
286
286
|
*/
|
|
287
287
|
get asToken(): Token {
|
|
288
|
-
return
|
|
288
|
+
return Encoding.encodeBase64Url(
|
|
289
289
|
JSON.stringify([this.workflowName, this.executionId, this.deferredName])
|
|
290
290
|
) as Token
|
|
291
291
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type * as Cause from "../../Cause.ts"
|
|
5
5
|
import * as Effect from "../../Effect.ts"
|
|
6
6
|
import * as Exit from "../../Exit.ts"
|
|
7
|
+
import * as Latch from "../../Latch.ts"
|
|
7
8
|
import * as Option from "../../Option.ts"
|
|
8
9
|
import * as Schedule from "../../Schedule.ts"
|
|
9
10
|
import * as Schema from "../../Schema.ts"
|
|
@@ -224,7 +225,7 @@ export class WorkflowInstance extends ServiceMap.Service<
|
|
|
224
225
|
|
|
225
226
|
readonly activityState: {
|
|
226
227
|
count: number
|
|
227
|
-
readonly latch:
|
|
228
|
+
readonly latch: Latch.Latch
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
>()("effect/workflow/WorkflowEngine/WorkflowInstance") {
|
|
@@ -241,7 +242,7 @@ export class WorkflowInstance extends ServiceMap.Service<
|
|
|
241
242
|
cause: undefined,
|
|
242
243
|
activityState: {
|
|
243
244
|
count: 0,
|
|
244
|
-
latch:
|
|
245
|
+
latch: Latch.makeUnsafe()
|
|
245
246
|
}
|
|
246
247
|
})
|
|
247
248
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 3.19.4
|
|
3
|
-
* @experimental
|
|
4
|
-
*/
|
|
5
|
-
import * as Effect from "./Effect.ts";
|
|
6
|
-
/**
|
|
7
|
-
* @since 3.19.4
|
|
8
|
-
* @category models
|
|
9
|
-
* @experimental
|
|
10
|
-
*/
|
|
11
|
-
export declare const TypeId: TypeId;
|
|
12
|
-
/**
|
|
13
|
-
* @since 3.19.4
|
|
14
|
-
* @category models
|
|
15
|
-
* @experimental
|
|
16
|
-
*/
|
|
17
|
-
export type TypeId = "~effect/PartitionedSemaphore";
|
|
18
|
-
/**
|
|
19
|
-
* A `PartitionedSemaphore` controls access to a shared permit pool while
|
|
20
|
-
* tracking waiters by partition key.
|
|
21
|
-
*
|
|
22
|
-
* Waiting permits are distributed across partitions in round-robin order.
|
|
23
|
-
*
|
|
24
|
-
* @since 3.19.4
|
|
25
|
-
* @category models
|
|
26
|
-
* @experimental
|
|
27
|
-
*/
|
|
28
|
-
export interface PartitionedSemaphore<in K> {
|
|
29
|
-
readonly [TypeId]: TypeId;
|
|
30
|
-
readonly withPermits: (key: K, permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates a `PartitionedSemaphore` unsafely.
|
|
34
|
-
*
|
|
35
|
-
* @since 3.19.4
|
|
36
|
-
* @category constructors
|
|
37
|
-
* @experimental
|
|
38
|
-
*/
|
|
39
|
-
export declare const makeUnsafe: <K = unknown>(options: {
|
|
40
|
-
readonly permits: number;
|
|
41
|
-
}) => PartitionedSemaphore<K>;
|
|
42
|
-
/**
|
|
43
|
-
* Creates a `PartitionedSemaphore`.
|
|
44
|
-
*
|
|
45
|
-
* @since 3.19.4
|
|
46
|
-
* @category constructors
|
|
47
|
-
* @experimental
|
|
48
|
-
*/
|
|
49
|
-
export declare const make: <K = unknown>(options: {
|
|
50
|
-
readonly permits: number;
|
|
51
|
-
}) => Effect.Effect<PartitionedSemaphore<K>>;
|
|
52
|
-
//# sourceMappingURL=PartitionedSemaphore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionedSemaphore.d.ts","sourceRoot":"","sources":["../src/PartitionedSemaphore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAIrC;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,MAAuC,CAAA;AAE5D;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,8BAA8B,CAAA;AAEnD;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,CACpB,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,MAAM,KACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,KAAG,oBAAoB,CAAC,CAAC,CAyHzB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,KAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAA8C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionedSemaphore.js","names":["Effect","MutableHashMap","Option","TypeId","makeUnsafe","options","maxPermits","Math","max","permits","Number","isFinite","withPermits","effect","totalPermits","waitingPermits","partitions","empty","take","key","callback","resume","never","void","needed","taken","waiters","getOrElse","get","set","Set","entry","cleanup","delete","size","remove","add","sync","releaseUnsafe","iterator","Symbol","state","next","done","waiter","value","values","undefined","takePermits","uninterruptibleMask","restore","flatMap","ensuring","make"],"sources":["../src/PartitionedSemaphore.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides encoding & decoding functionality for:
|
|
3
|
-
*
|
|
4
|
-
* - base64 (RFC4648)
|
|
5
|
-
* - base64 (URL)
|
|
6
|
-
* - hex
|
|
7
|
-
*
|
|
8
|
-
* @since 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
import * as Result from "../Result.ts";
|
|
11
|
-
import { EncodingError } from "./EncodingError.ts";
|
|
12
|
-
/**
|
|
13
|
-
* Encodes the given value into a base64 (RFC4648) `string`.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { Base64 } from "effect/encoding"
|
|
18
|
-
*
|
|
19
|
-
* // Encode a string
|
|
20
|
-
* console.log(Base64.encode("hello")) // "aGVsbG8="
|
|
21
|
-
*
|
|
22
|
-
* // Encode binary data
|
|
23
|
-
* const bytes = new Uint8Array([72, 101, 108, 108, 111])
|
|
24
|
-
* console.log(Base64.encode(bytes)) // "SGVsbG8="
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @category encoding
|
|
28
|
-
* @since 2.0.0
|
|
29
|
-
*/
|
|
30
|
-
export declare const encode: (input: Uint8Array | string) => string;
|
|
31
|
-
/**
|
|
32
|
-
* Decodes a base64 (RFC4648) encoded `string` into a `Uint8Array`.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { Result } from "effect"
|
|
37
|
-
* import { Base64 } from "effect/encoding"
|
|
38
|
-
*
|
|
39
|
-
* const result = Base64.decode("SGVsbG8=")
|
|
40
|
-
* if (Result.isSuccess(result)) {
|
|
41
|
-
* console.log(Array.from(result.success)) // [72, 101, 108, 108, 111]
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @category decoding
|
|
46
|
-
* @since 2.0.0
|
|
47
|
-
*/
|
|
48
|
-
export declare const decode: (str: string) => Result.Result<Uint8Array, EncodingError>;
|
|
49
|
-
/**
|
|
50
|
-
* Decodes a base64 (RFC4648) encoded `string` into a UTF-8 `string`.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* import { Result } from "effect"
|
|
55
|
-
* import { Base64 } from "effect/encoding"
|
|
56
|
-
*
|
|
57
|
-
* const result = Base64.decodeString("aGVsbG8=")
|
|
58
|
-
* if (Result.isSuccess(result)) {
|
|
59
|
-
* console.log(result.success) // "hello"
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @category decoding
|
|
64
|
-
* @since 2.0.0
|
|
65
|
-
*/
|
|
66
|
-
export declare const decodeString: (str: string) => Result.Result<string, EncodingError>;
|
|
67
|
-
//# sourceMappingURL=Base64.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Base64.d.ts","sourceRoot":"","sources":["../../src/encoding/Base64.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,KAAK,MAC0C,CAAA;AAiC/F;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAmD3E,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,yCAAsD,CAAA"}
|