@livestore/utils 0.4.0 → 0.5.0-dev.1
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/.tsbuildinfo +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/NoopTracer.d.ts +7 -8
- package/dist/NoopTracer.d.ts.map +1 -1
- package/dist/NoopTracer.js +3 -18
- package/dist/NoopTracer.js.map +1 -1
- package/dist/NoopTracer.test.d.ts +2 -0
- package/dist/NoopTracer.test.d.ts.map +1 -0
- package/dist/NoopTracer.test.js +29 -0
- package/dist/NoopTracer.test.js.map +1 -0
- package/dist/base64.d.ts.map +1 -1
- package/dist/binary.d.ts.map +1 -1
- package/dist/browser/Opfs/Opfs.d.ts +179 -29
- package/dist/browser/Opfs/Opfs.d.ts.map +1 -1
- package/dist/browser/Opfs/Opfs.js +134 -309
- package/dist/browser/Opfs/Opfs.js.map +1 -1
- package/dist/browser/Opfs/debug-utils.d.ts.map +1 -1
- package/dist/browser/Opfs/debug-utils.js +6 -5
- package/dist/browser/Opfs/debug-utils.js.map +1 -1
- package/dist/browser/Opfs/mod.js +3 -3
- package/dist/browser/Opfs/utils.d.ts +8 -8
- package/dist/browser/Opfs/utils.d.ts.map +1 -1
- package/dist/browser/Opfs/utils.js +35 -26
- package/dist/browser/Opfs/utils.js.map +1 -1
- package/dist/browser/QuotaExceededError.d.ts +10 -9
- package/dist/browser/QuotaExceededError.d.ts.map +1 -1
- package/dist/browser/WebChannelBrowser.d.ts.map +1 -1
- package/dist/browser/WebChannelBrowser.js +25 -14
- package/dist/browser/WebChannelBrowser.js.map +1 -1
- package/dist/browser/WebError.d.ts +55 -87
- package/dist/browser/WebError.d.ts.map +1 -1
- package/dist/browser/WebError.js +92 -85
- package/dist/browser/WebError.js.map +1 -1
- package/dist/browser/WebError.test.js +7 -7
- package/dist/browser/WebError.test.js.map +1 -1
- package/dist/browser/WebLock.d.ts +1 -1
- package/dist/browser/WebLock.d.ts.map +1 -1
- package/dist/browser/WebLock.js +13 -13
- package/dist/browser/WebLock.js.map +1 -1
- package/dist/browser/mod.js +6 -6
- package/dist/cuid/cuid.browser.d.ts.map +1 -1
- package/dist/cuid/cuid.node.d.ts.map +1 -1
- package/dist/effect/Debug.d.ts +4 -7
- package/dist/effect/Debug.d.ts.map +1 -1
- package/dist/effect/Debug.js +34 -40
- package/dist/effect/Debug.js.map +1 -1
- package/dist/effect/Effect.d.ts +31 -22
- package/dist/effect/Effect.d.ts.map +1 -1
- package/dist/effect/Effect.js +54 -50
- package/dist/effect/Effect.js.map +1 -1
- package/dist/effect/Effect.test.d.ts +2 -0
- package/dist/effect/Effect.test.d.ts.map +1 -0
- package/dist/effect/Effect.test.js +72 -0
- package/dist/effect/Effect.test.js.map +1 -0
- package/dist/effect/Error.d.ts +4 -6
- package/dist/effect/Error.d.ts.map +1 -1
- package/dist/effect/Logger.d.ts +0 -6
- package/dist/effect/Logger.d.ts.map +1 -1
- package/dist/effect/Logger.js +0 -32
- package/dist/effect/Logger.js.map +1 -1
- package/dist/effect/OtelTracer.d.ts +1 -1
- package/dist/effect/OtelTracer.d.ts.map +1 -1
- package/dist/effect/OtelTracer.js +2 -3
- package/dist/effect/OtelTracer.js.map +1 -1
- package/dist/effect/RpcClient.d.ts +9 -9
- package/dist/effect/RpcClient.d.ts.map +1 -1
- package/dist/effect/RpcClient.js +113 -84
- package/dist/effect/RpcClient.js.map +1 -1
- package/dist/effect/Schedule.d.ts +1 -1
- package/dist/effect/Schedule.d.ts.map +1 -1
- package/dist/effect/Schedule.js +2 -2
- package/dist/effect/Schedule.js.map +1 -1
- package/dist/effect/Schema/debug-diff.d.ts +1 -1
- package/dist/effect/Schema/debug-diff.d.ts.map +1 -1
- package/dist/effect/Schema/debug-diff.js +5 -7
- package/dist/effect/Schema/debug-diff.js.map +1 -1
- package/dist/effect/Schema/debug-diff.test.js +8 -5
- package/dist/effect/Schema/debug-diff.test.js.map +1 -1
- package/dist/effect/Schema/index.d.ts +28 -20
- package/dist/effect/Schema/index.d.ts.map +1 -1
- package/dist/effect/Schema/index.js +56 -29
- package/dist/effect/Schema/index.js.map +1 -1
- package/dist/effect/Stream.d.ts +13 -5
- package/dist/effect/Stream.d.ts.map +1 -1
- package/dist/effect/Stream.js +19 -12
- package/dist/effect/Stream.js.map +1 -1
- package/dist/effect/Stream.test.js +10 -10
- package/dist/effect/Stream.test.js.map +1 -1
- package/dist/effect/Subscribable.d.ts +9 -3
- package/dist/effect/Subscribable.d.ts.map +1 -1
- package/dist/effect/Subscribable.js +20 -35
- package/dist/effect/Subscribable.js.map +1 -1
- package/dist/effect/SubscriptionRef.d.ts +5 -6
- package/dist/effect/SubscriptionRef.d.ts.map +1 -1
- package/dist/effect/SubscriptionRef.js +2 -3
- package/dist/effect/SubscriptionRef.js.map +1 -1
- package/dist/effect/TaskTracing.d.ts +1 -1
- package/dist/effect/TaskTracing.d.ts.map +1 -1
- package/dist/effect/TaskTracing.js +12 -16
- package/dist/effect/TaskTracing.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.d.ts +7 -7
- package/dist/effect/WebChannel/WebChannel.d.ts.map +1 -1
- package/dist/effect/WebChannel/WebChannel.js +69 -48
- package/dist/effect/WebChannel/WebChannel.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js +16 -16
- package/dist/effect/WebChannel/WebChannel.test.js.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.d.ts.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.js +18 -11
- package/dist/effect/WebChannel/broadcastChannelWithAck.js.map +1 -1
- package/dist/effect/WebChannel/common.d.ts +16 -17
- package/dist/effect/WebChannel/common.d.ts.map +1 -1
- package/dist/effect/WebChannel/common.js +6 -6
- package/dist/effect/WebChannel/common.js.map +1 -1
- package/dist/effect/WebChannel/mod.js +3 -3
- package/dist/effect/WebSocket.d.ts +4 -6
- package/dist/effect/WebSocket.d.ts.map +1 -1
- package/dist/effect/WebSocket.js +4 -4
- package/dist/effect/WebSocket.js.map +1 -1
- package/dist/effect/WebSocket.test.js +3 -3
- package/dist/effect/WebSocket.test.js.map +1 -1
- package/dist/effect/mod.browser-build.test.d.ts +2 -0
- package/dist/effect/mod.browser-build.test.d.ts.map +1 -0
- package/dist/effect/mod.browser-build.test.js +18 -0
- package/dist/effect/mod.browser-build.test.js.map +1 -0
- package/dist/effect/mod.d.ts +13 -15
- package/dist/effect/mod.d.ts.map +1 -1
- package/dist/effect/mod.js +28 -33
- package/dist/effect/mod.js.map +1 -1
- package/dist/effect/spanEvent.d.ts.map +1 -1
- package/dist/effect/spanEvent.js +2 -2
- package/dist/effect/spanEvent.js.map +1 -1
- package/dist/effect/spanEvent.test.js +11 -14
- package/dist/effect/spanEvent.test.js.map +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/fast-deep-equal.d.ts.map +1 -1
- package/dist/fast-deep-equal.js +1 -2
- package/dist/fast-deep-equal.js.map +1 -1
- package/dist/misc.d.ts.map +1 -1
- package/dist/misc.js +3 -3
- package/dist/misc.js.map +1 -1
- package/dist/mod.d.ts +1 -36
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +19 -27
- package/dist/mod.js.map +1 -1
- package/dist/node/mod.d.ts +11 -36
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +17 -42
- package/dist/node/mod.js.map +1 -1
- package/dist/object/index.d.ts +0 -9
- package/dist/object/index.d.ts.map +1 -1
- package/dist/object/index.js +1 -10
- package/dist/object/index.js.map +1 -1
- package/dist/object/stringify-object.d.ts.map +1 -1
- package/dist/object/stringify-object.test.js +1 -1
- package/dist/promise.d.ts.map +1 -1
- package/dist/qr.d.ts.map +1 -1
- package/dist/set.d.ts.map +1 -1
- package/dist/string.d.ts +0 -2
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +0 -2
- package/dist/string.js.map +1 -1
- package/package.json +38 -56
- package/src/NoopTracer.test.ts +36 -0
- package/src/NoopTracer.ts +18 -41
- package/src/browser/Opfs/Opfs.ts +304 -277
- package/src/browser/Opfs/debug-utils.ts +7 -6
- package/src/browser/Opfs/utils.ts +36 -26
- package/src/browser/QuotaExceededError.ts +13 -10
- package/src/browser/WebChannelBrowser.ts +25 -11
- package/src/browser/WebError.test.ts +6 -6
- package/src/browser/WebError.ts +107 -133
- package/src/browser/WebLock.ts +13 -14
- package/src/effect/Debug.ts +69 -78
- package/src/effect/Effect.test.ts +117 -0
- package/src/effect/Effect.ts +86 -73
- package/src/effect/Logger.ts +0 -48
- package/src/effect/OtelTracer.ts +2 -3
- package/src/effect/RpcClient.ts +126 -93
- package/src/effect/Schedule.ts +4 -5
- package/src/effect/Schema/debug-diff.test.ts +6 -6
- package/src/effect/Schema/debug-diff.ts +6 -8
- package/src/effect/Schema/index.ts +122 -61
- package/src/effect/Stream.test.ts +9 -9
- package/src/effect/Stream.ts +23 -16
- package/src/effect/Subscribable.ts +31 -42
- package/src/effect/SubscriptionRef.ts +8 -12
- package/src/effect/TaskTracing.ts +13 -16
- package/src/effect/WebChannel/WebChannel.test.ts +23 -23
- package/src/effect/WebChannel/WebChannel.ts +87 -56
- package/src/effect/WebChannel/broadcastChannelWithAck.ts +21 -11
- package/src/effect/WebChannel/common.ts +14 -15
- package/src/effect/WebSocket.test.ts +2 -2
- package/src/effect/WebSocket.ts +9 -6
- package/src/effect/mod.browser-build.test.ts +19 -0
- package/src/effect/mod.ts +37 -69
- package/src/effect/spanEvent.test.ts +10 -13
- package/src/effect/spanEvent.ts +5 -3
- package/src/fast-deep-equal.ts +4 -5
- package/src/misc.ts +3 -3
- package/src/mod.ts +5 -41
- package/src/node/mod.ts +20 -46
- package/src/object/index.ts +0 -24
- package/src/string.ts +0 -3
- package/dist/effect/BucketQueue.d.ts +0 -20
- package/dist/effect/BucketQueue.d.ts.map +0 -1
- package/dist/effect/BucketQueue.js +0 -34
- package/dist/effect/BucketQueue.js.map +0 -1
- package/dist/effect/Scheduler.d.ts +0 -4
- package/dist/effect/Scheduler.d.ts.map +0 -1
- package/dist/effect/Scheduler.js +0 -9
- package/dist/effect/Scheduler.js.map +0 -1
- package/dist/effect/ServiceContext.d.ts +0 -37
- package/dist/effect/ServiceContext.d.ts.map +0 -1
- package/dist/effect/ServiceContext.js +0 -55
- package/dist/effect/ServiceContext.js.map +0 -1
- package/dist/guards.d.ts +0 -20
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -20
- package/dist/guards.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts +0 -4
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js +0 -128
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts +0 -10
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js +0 -217
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts +0 -84
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js +0 -68
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts +0 -2
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js +0 -52
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts +0 -23
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js +0 -138
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js.map +0 -1
- package/dist/object/omit.d.ts +0 -3
- package/dist/object/omit.d.ts.map +0 -1
- package/dist/object/omit.js +0 -14
- package/dist/object/omit.js.map +0 -1
- package/dist/object/pick.d.ts +0 -14
- package/dist/object/pick.d.ts.map +0 -1
- package/dist/object/pick.js +0 -17
- package/dist/object/pick.js.map +0 -1
- package/dist/time.d.ts +0 -12
- package/dist/time.d.ts.map +0 -1
- package/dist/time.js +0 -22
- package/dist/time.js.map +0 -1
- package/src/effect/BucketQueue.ts +0 -49
- package/src/effect/Scheduler.ts +0 -13
- package/src/effect/ServiceContext.ts +0 -108
- package/src/guards.ts +0 -23
- package/src/node/ChildProcessRunner/ChildProcessRunner.ts +0 -148
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.ts +0 -311
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/schema.ts +0 -78
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.ts +0 -65
- package/src/node/ChildProcessRunner/ChildProcessWorker.ts +0 -169
- package/src/object/omit.ts +0 -17
- package/src/object/pick.ts +0 -27
- package/src/time.ts +0 -25
package/src/effect/mod.ts
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
import '../global.ts'
|
|
2
2
|
|
|
3
|
+
export { Otlp } from 'effect/observability'
|
|
4
|
+
export { Base64Url, SchemaBinary } from 'effect/encoding'
|
|
3
5
|
export {
|
|
4
|
-
AiError,
|
|
5
|
-
LanguageModel,
|
|
6
|
-
LanguageModel as AiLanguageModel,
|
|
7
|
-
McpSchema,
|
|
8
|
-
McpServer,
|
|
9
|
-
Model,
|
|
10
|
-
Model as AiModel,
|
|
11
|
-
Prompt,
|
|
12
|
-
Tool,
|
|
13
|
-
Tool as AiTool,
|
|
14
|
-
Toolkit,
|
|
15
|
-
Toolkit as AiToolkit,
|
|
16
|
-
} from '@effect/ai'
|
|
17
|
-
// export { DevTools as EffectDevtools } from '@effect/experimental'
|
|
18
|
-
export { Sse } from '@effect/experimental'
|
|
19
|
-
export * as Otlp from '@effect/opentelemetry/Otlp'
|
|
20
|
-
export {
|
|
21
|
-
Command,
|
|
22
|
-
CommandExecutor,
|
|
23
|
-
Error as PlatformError,
|
|
24
6
|
FetchHttpClient,
|
|
25
|
-
FileSystem,
|
|
26
7
|
Headers,
|
|
27
|
-
|
|
28
|
-
HttpApiClient,
|
|
29
|
-
HttpApiEndpoint,
|
|
30
|
-
HttpApiGroup,
|
|
31
|
-
HttpApp,
|
|
8
|
+
HttpEffect,
|
|
32
9
|
HttpClient,
|
|
33
10
|
HttpClientError,
|
|
34
11
|
HttpClientRequest,
|
|
@@ -38,19 +15,15 @@ export {
|
|
|
38
15
|
HttpServer,
|
|
39
16
|
HttpServerRequest,
|
|
40
17
|
HttpServerResponse,
|
|
41
|
-
KeyValueStore,
|
|
42
|
-
MsgPack,
|
|
43
|
-
Socket,
|
|
44
|
-
Terminal,
|
|
45
|
-
Transferable,
|
|
46
18
|
UrlParams,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} from '
|
|
19
|
+
} from 'effect/http'
|
|
20
|
+
export { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup } from 'effect/http-api'
|
|
21
|
+
export { KeyValueStore } from 'effect/persistence'
|
|
22
|
+
export { ChildProcess, ChildProcessSpawner } from 'effect/process'
|
|
23
|
+
export { Socket } from 'effect/socket'
|
|
24
|
+
export { Transferable, Worker, WorkerError, WorkerRunner } from 'effect/workers'
|
|
51
25
|
export {
|
|
52
26
|
Rpc,
|
|
53
|
-
// RpcClient, // TODO bring back "original" RpcClient from effect/rpc
|
|
54
27
|
RpcClientError,
|
|
55
28
|
RpcGroup,
|
|
56
29
|
RpcMessage,
|
|
@@ -60,7 +33,7 @@ export {
|
|
|
60
33
|
RpcServer,
|
|
61
34
|
RpcTest,
|
|
62
35
|
RpcWorker,
|
|
63
|
-
} from '
|
|
36
|
+
} from 'effect/rpc'
|
|
64
37
|
export * as StandardSchema from '@standard-schema/spec'
|
|
65
38
|
export {
|
|
66
39
|
Array as ReadonlyArray,
|
|
@@ -69,82 +42,79 @@ export {
|
|
|
69
42
|
Cause,
|
|
70
43
|
Channel,
|
|
71
44
|
Chunk,
|
|
45
|
+
Clock,
|
|
72
46
|
Config,
|
|
73
|
-
ConfigError,
|
|
74
47
|
ConfigProvider,
|
|
75
48
|
Console,
|
|
76
49
|
Context,
|
|
77
50
|
Data,
|
|
78
51
|
Deferred,
|
|
79
52
|
Duration,
|
|
80
|
-
|
|
53
|
+
Result,
|
|
81
54
|
Equal,
|
|
82
|
-
ExecutionStrategy,
|
|
83
55
|
Exit,
|
|
84
|
-
FastCheck,
|
|
85
56
|
Fiber,
|
|
57
|
+
Filter,
|
|
58
|
+
FileSystem,
|
|
59
|
+
Terminal,
|
|
86
60
|
FiberHandle,
|
|
87
|
-
FiberId,
|
|
88
61
|
FiberMap,
|
|
89
|
-
FiberRef,
|
|
90
|
-
FiberRefs,
|
|
91
|
-
FiberRefsPatch,
|
|
92
62
|
FiberSet,
|
|
93
|
-
|
|
63
|
+
Formatter,
|
|
64
|
+
Function,
|
|
94
65
|
Hash,
|
|
95
66
|
HashMap,
|
|
96
67
|
HashSet,
|
|
97
68
|
Inspectable,
|
|
98
69
|
identity,
|
|
70
|
+
Latch,
|
|
99
71
|
Layer,
|
|
100
|
-
List,
|
|
101
72
|
LogLevel,
|
|
102
|
-
LogSpan,
|
|
103
|
-
Mailbox,
|
|
104
73
|
ManagedRuntime,
|
|
105
74
|
Match,
|
|
106
75
|
Metric,
|
|
107
|
-
MetricState,
|
|
108
76
|
MutableHashMap,
|
|
109
77
|
MutableHashSet,
|
|
78
|
+
MutableList,
|
|
110
79
|
Option,
|
|
111
80
|
Order,
|
|
112
|
-
ParseResult,
|
|
113
81
|
Predicate,
|
|
114
|
-
Pretty,
|
|
115
82
|
PrimaryKey,
|
|
83
|
+
PlatformError,
|
|
116
84
|
PubSub,
|
|
117
|
-
// Subscribable,
|
|
118
85
|
pipe,
|
|
119
86
|
Queue,
|
|
87
|
+
Random,
|
|
120
88
|
RcMap,
|
|
121
89
|
RcRef,
|
|
122
90
|
Record as ReadonlyRecord,
|
|
91
|
+
References,
|
|
123
92
|
Redacted,
|
|
124
93
|
Ref,
|
|
125
94
|
Request,
|
|
126
95
|
Runtime,
|
|
127
|
-
RuntimeFlags,
|
|
128
96
|
Scope,
|
|
129
97
|
ScopedRef,
|
|
98
|
+
Scheduler,
|
|
99
|
+
SchemaIssue,
|
|
100
|
+
SchemaAST,
|
|
101
|
+
SchemaGetter,
|
|
102
|
+
SchemaParser,
|
|
103
|
+
SchemaRepresentation,
|
|
104
|
+
SchemaTransformation,
|
|
105
|
+
Semaphore,
|
|
130
106
|
Sink,
|
|
131
|
-
|
|
132
|
-
|
|
107
|
+
Struct,
|
|
108
|
+
Graph,
|
|
133
109
|
SynchronizedRef,
|
|
134
|
-
TestClock,
|
|
135
|
-
TestServices,
|
|
136
|
-
TQueue,
|
|
137
|
-
TRef,
|
|
138
110
|
Tracer,
|
|
111
|
+
TxQueue,
|
|
112
|
+
TxRef,
|
|
139
113
|
Types,
|
|
140
114
|
} from 'effect'
|
|
141
|
-
export
|
|
142
|
-
export
|
|
143
|
-
export * as
|
|
144
|
-
export { TreeFormatter } from 'effect/ParseResult'
|
|
145
|
-
export type { Serializable, SerializableWithResult } from 'effect/Schema'
|
|
146
|
-
export * as SchemaAST from 'effect/SchemaAST'
|
|
147
|
-
export * as BucketQueue from './BucketQueue.ts'
|
|
115
|
+
export * as Arbitrary from 'effect/Arbitrary'
|
|
116
|
+
export * as TestClock from 'effect/testing/TestClock'
|
|
117
|
+
export * as TestConsole from 'effect/testing/TestConsole'
|
|
148
118
|
export * as Debug from './Debug.ts'
|
|
149
119
|
export * as Effect from './Effect.ts'
|
|
150
120
|
export * from './Error.ts'
|
|
@@ -152,9 +122,7 @@ export * as Logger from './Logger.ts'
|
|
|
152
122
|
export * as OtelTracer from './OtelTracer.ts'
|
|
153
123
|
export * as RpcClient from './RpcClient.ts'
|
|
154
124
|
export * as Schedule from './Schedule.ts'
|
|
155
|
-
export * as Scheduler from './Scheduler.ts'
|
|
156
125
|
export * as Schema from './Schema/index.ts'
|
|
157
|
-
export * as ServiceContext from './ServiceContext.ts'
|
|
158
126
|
export * as Stream from './Stream.ts'
|
|
159
127
|
export * as Subscribable from './Subscribable.ts'
|
|
160
128
|
export * as SubscriptionRef from './SubscriptionRef.ts'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describe, expect, it } from '@effect/vitest'
|
|
2
2
|
import { Effect, Tracer } from 'effect'
|
|
3
3
|
|
|
4
4
|
import { spanEvent } from './spanEvent.ts'
|
|
@@ -14,22 +14,22 @@ const makeTestTracer = () => {
|
|
|
14
14
|
const spanEvents = new Map<string, Array<RecordedEvent>>()
|
|
15
15
|
|
|
16
16
|
const tracer = Tracer.make({
|
|
17
|
-
span(
|
|
17
|
+
span(options) {
|
|
18
18
|
const events: Array<RecordedEvent> = []
|
|
19
|
-
spanEvents.set(name, events)
|
|
19
|
+
spanEvents.set(options.name, events)
|
|
20
20
|
const attributes = new Map<string, unknown>()
|
|
21
21
|
return {
|
|
22
22
|
_tag: 'Span' as const,
|
|
23
|
-
name,
|
|
24
|
-
spanId: `test-${name}`,
|
|
23
|
+
name: options.name,
|
|
24
|
+
spanId: `test-${options.name}`,
|
|
25
25
|
traceId: 'test-trace',
|
|
26
|
-
parent,
|
|
27
|
-
|
|
28
|
-
status: { _tag: 'Started' as const, startTime },
|
|
26
|
+
parent: options.parent,
|
|
27
|
+
annotations: options.annotations,
|
|
28
|
+
status: { _tag: 'Started' as const, startTime: options.startTime },
|
|
29
29
|
attributes,
|
|
30
|
-
links:
|
|
30
|
+
links: options.links,
|
|
31
31
|
sampled: true,
|
|
32
|
-
kind,
|
|
32
|
+
kind: options.kind,
|
|
33
33
|
end() {},
|
|
34
34
|
attribute(key: string, value: unknown) {
|
|
35
35
|
attributes.set(key, value)
|
|
@@ -40,9 +40,6 @@ const makeTestTracer = () => {
|
|
|
40
40
|
addLinks() {},
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
context(f) {
|
|
44
|
-
return f()
|
|
45
|
-
},
|
|
46
43
|
})
|
|
47
44
|
|
|
48
45
|
return {
|
package/src/effect/spanEvent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import { Effect, Logger } from 'effect'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Emits a span event on the current Effect span via the tracer logger.
|
|
@@ -10,6 +10,8 @@ import { Effect, FiberRef, HashSet, Logger } from 'effect'
|
|
|
10
10
|
* is in context, the call is a no-op.
|
|
11
11
|
*/
|
|
12
12
|
export const spanEvent = (message: any, attributes?: Record<string, unknown>) =>
|
|
13
|
-
Effect.
|
|
14
|
-
|
|
13
|
+
Effect.provideService(
|
|
14
|
+
Effect.log(message).pipe(Effect.annotateLogs(attributes ?? {})),
|
|
15
|
+
Logger.CurrentLoggers,
|
|
16
|
+
new Set([Logger.tracerLogger]),
|
|
15
17
|
)
|
package/src/fast-deep-equal.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
14
14
|
length = a.length
|
|
15
15
|
// @ts-expect-error ...
|
|
16
16
|
if (length !== b.length) return false
|
|
17
|
-
for (i = length; i-- !== 0;
|
|
17
|
+
for (i = length; i-- !== 0;)
|
|
18
18
|
// @ts-expect-error ...
|
|
19
19
|
if (deepEqual(a[i], b[i]) === false) return false
|
|
20
20
|
return true
|
|
@@ -38,7 +38,7 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
38
38
|
length = a.length
|
|
39
39
|
// @ts-expect-error ...
|
|
40
40
|
if (length !== b.length) return false
|
|
41
|
-
for (i = length; i-- !== 0;
|
|
41
|
+
for (i = length; i-- !== 0;)
|
|
42
42
|
// @ts-expect-error ...
|
|
43
43
|
if (a[i] !== b[i]) return false
|
|
44
44
|
return true
|
|
@@ -53,9 +53,9 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
53
53
|
length = keys.length
|
|
54
54
|
if (length !== Object.keys(b).length) return false
|
|
55
55
|
|
|
56
|
-
for (i = length; i-- !== 0;
|
|
56
|
+
for (i = length; i-- !== 0;) if (Object.hasOwn(b, keys[i]) === false) return false
|
|
57
57
|
|
|
58
|
-
for (i = length; i-- !== 0;
|
|
58
|
+
for (i = length; i-- !== 0;) {
|
|
59
59
|
const key = keys[i]
|
|
60
60
|
|
|
61
61
|
// @ts-expect-error ...
|
|
@@ -66,6 +66,5 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// true if both NaN, false otherwise
|
|
69
|
-
// biome-ignore lint/suspicious/noSelfCompare: comparing to itself is fine here
|
|
70
69
|
return a !== a && b !== b
|
|
71
70
|
}
|
package/src/misc.ts
CHANGED
|
@@ -9,8 +9,8 @@ export const isDevEnv = () => {
|
|
|
9
9
|
return import.meta.env.DEV
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
if (
|
|
12
|
+
const globals = globalThis as typeof globalThis & { readonly __DEV__?: boolean | undefined }
|
|
13
|
+
if (globals.__DEV__ === true) {
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -57,7 +57,7 @@ export const envTruish = (env: string | undefined) =>
|
|
|
57
57
|
export const shouldNeverHappen = (msg?: string, ...args: ReadonlyArray<unknown>): never => {
|
|
58
58
|
console.error(msg, ...args)
|
|
59
59
|
if (isDevEnv() === true) {
|
|
60
|
-
// oxlint-disable-next-line
|
|
60
|
+
// oxlint-disable-next-line no-debugger -- intentional breakpoint during development
|
|
61
61
|
debugger
|
|
62
62
|
}
|
|
63
63
|
|
package/src/mod.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './binary.ts'
|
|
|
4
4
|
export * from './Deferred.ts'
|
|
5
5
|
export * from './env.ts'
|
|
6
6
|
export * from './fast-deep-equal.ts'
|
|
7
|
-
export * from './guards.ts'
|
|
8
7
|
export * from './misc.ts'
|
|
9
8
|
export * from './NoopTracer.ts'
|
|
10
9
|
export * from './object/index.ts'
|
|
@@ -12,32 +11,12 @@ export * from './promise.ts'
|
|
|
12
11
|
export * as QR from './qr.ts'
|
|
13
12
|
export * from './set.ts'
|
|
14
13
|
export * from './string.ts'
|
|
15
|
-
export * from './time.ts'
|
|
16
14
|
|
|
17
15
|
import type * as otel from '@opentelemetry/api'
|
|
18
16
|
import type { Types } from 'effect'
|
|
19
17
|
|
|
20
18
|
import { objectToString } from './misc.ts'
|
|
21
19
|
|
|
22
|
-
/**
|
|
23
|
-
* Recursively expands type aliases for better IDE hover display.
|
|
24
|
-
*
|
|
25
|
-
* Transforms `{ a: string } & { b: number }` into `{ a: string; b: number }`.
|
|
26
|
-
*/
|
|
27
|
-
export type Prettify<T> = T extends infer U ? { [K in keyof U]: Prettify<U[K]> } : never
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Type-level equality check. Returns `true` if `A` and `B` are exactly the same type.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* type Test1 = TypeEq<string, string> // true
|
|
35
|
-
* type Test2 = TypeEq<string, number> // false
|
|
36
|
-
* type Test3 = TypeEq<{ a: 1 }, { a: 1 }> // true
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export type TypeEq<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false
|
|
40
|
-
|
|
41
20
|
/**
|
|
42
21
|
* Type-level subtype check. Returns `true` if `A` extends `B`.
|
|
43
22
|
*
|
|
@@ -52,12 +31,6 @@ export type IsSubtype<A, B> = A extends B ? true : false
|
|
|
52
31
|
/** Compile-time assertion that `T` is `true`. Useful for type tests. */
|
|
53
32
|
export type AssertTrue<T extends true> = T
|
|
54
33
|
|
|
55
|
-
/** Removes `readonly` modifier from all properties of `T`. */
|
|
56
|
-
export type Writeable<T> = { -readonly [P in keyof T]: T[P] }
|
|
57
|
-
|
|
58
|
-
/** Recursively removes `readonly` modifier from all properties. */
|
|
59
|
-
export type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> }
|
|
60
|
-
|
|
61
34
|
/** Makes all properties of `T` nullable (allows `null`). */
|
|
62
35
|
export type Nullable<T> = { [K in keyof T]: T[K] | null }
|
|
63
36
|
|
|
@@ -119,7 +92,7 @@ export const debugCatch = <T>(try_: () => T): T => {
|
|
|
119
92
|
try {
|
|
120
93
|
return try_()
|
|
121
94
|
} catch (e: any) {
|
|
122
|
-
// oxlint-disable-next-line
|
|
95
|
+
// oxlint-disable-next-line no-debugger -- intentional breakpoint for debugging exceptions
|
|
123
96
|
debugger
|
|
124
97
|
throw e
|
|
125
98
|
}
|
|
@@ -165,16 +138,13 @@ export const prop =
|
|
|
165
138
|
/** Capitalizes the first letter of a string. */
|
|
166
139
|
export const capitalizeFirstLetter = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
|
|
167
140
|
|
|
168
|
-
/** Type guard that checks if a value is a readonly array. */
|
|
169
|
-
export const isReadonlyArray = <I, T>(value: ReadonlyArray<I> | T): value is ReadonlyArray<I> => Array.isArray(value)
|
|
170
|
-
|
|
171
141
|
/**
|
|
172
142
|
* Use this to make assertion at end of if-else chain that all members of a
|
|
173
143
|
* union have been accounted for.
|
|
174
144
|
*/
|
|
175
145
|
|
|
176
146
|
export const casesHandled = (unexpectedCase: never): never => {
|
|
177
|
-
// oxlint-disable-next-line
|
|
147
|
+
// oxlint-disable-next-line no-debugger -- intentional breakpoint for unhandled cases
|
|
178
148
|
debugger
|
|
179
149
|
throw new Error(`A case was not handled for value: ${truncate(objectToString(unexpectedCase), 1000)}`)
|
|
180
150
|
}
|
|
@@ -189,7 +159,7 @@ export const casesHandled = (unexpectedCase: never): never => {
|
|
|
189
159
|
*/
|
|
190
160
|
export const assertNever = (failIfFalse: boolean, msg?: string): void => {
|
|
191
161
|
if (failIfFalse === false) {
|
|
192
|
-
// oxlint-disable-next-line
|
|
162
|
+
// oxlint-disable-next-line no-debugger -- intentional breakpoint for impossible states
|
|
193
163
|
debugger
|
|
194
164
|
throw new Error(`This should never happen: ${msg}`)
|
|
195
165
|
}
|
|
@@ -204,7 +174,7 @@ export const assertNever = (failIfFalse: boolean, msg?: string): void => {
|
|
|
204
174
|
* ```
|
|
205
175
|
*/
|
|
206
176
|
export const debuggerPipe = <T>(val: T): T => {
|
|
207
|
-
// oxlint-disable-next-line
|
|
177
|
+
// oxlint-disable-next-line no-debugger -- intentional: this function's purpose is to trigger debugger
|
|
208
178
|
debugger
|
|
209
179
|
return val
|
|
210
180
|
}
|
|
@@ -231,7 +201,7 @@ const truncate = (str: string, length: number): string => {
|
|
|
231
201
|
* ```
|
|
232
202
|
*/
|
|
233
203
|
export const notYetImplemented = (msg?: string): never => {
|
|
234
|
-
// oxlint-disable-next-line
|
|
204
|
+
// oxlint-disable-next-line no-debugger -- intentional breakpoint for unimplemented code paths
|
|
235
205
|
debugger
|
|
236
206
|
throw new Error(`Not yet implemented: ${msg}`)
|
|
237
207
|
}
|
|
@@ -415,12 +385,6 @@ export const isNonEmptyString = (str: string | undefined | null): str is string
|
|
|
415
385
|
return typeof str === 'string' && str.length > 0
|
|
416
386
|
}
|
|
417
387
|
|
|
418
|
-
/** Type guard that checks if a value is a Promise (has a `then` method). */
|
|
419
|
-
export const isPromise = (value: any): value is Promise<unknown> => typeof value?.then === 'function'
|
|
420
|
-
|
|
421
|
-
/** Type guard that checks if a value is iterable (has a `Symbol.iterator` method). */
|
|
422
|
-
export const isIterable = <T>(value: any): value is Iterable<T> => typeof value?.[Symbol.iterator] === 'function'
|
|
423
|
-
|
|
424
388
|
/**
|
|
425
389
|
* Type-level utility that removes `undefined` from all property types.
|
|
426
390
|
* Used for compatibility with libraries that don't type optionals as `| undefined`.
|
package/src/node/mod.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import * as http from 'node:http'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { Effect, Layer } from 'effect'
|
|
3
|
+
import { NodeFileSystem } from '@effect/platform-node'
|
|
4
|
+
import { Effect, FileSystem, Layer, Option } from 'effect'
|
|
5
5
|
|
|
6
|
-
import { OtelTracer, UnknownError } from '../effect/mod.ts'
|
|
6
|
+
import { OtelTracer, Tracer, UnknownError } from '../effect/mod.ts'
|
|
7
7
|
import { makeNoopTracer } from '../NoopTracer.ts'
|
|
8
8
|
|
|
9
|
-
export * as Cli from '
|
|
10
|
-
export * as SocketServer from '
|
|
9
|
+
export * as Cli from 'effect/cli'
|
|
10
|
+
export * as SocketServer from 'effect/socket/SocketServer'
|
|
11
11
|
export * as PlatformNode from '@effect/platform-node'
|
|
12
12
|
|
|
13
|
-
export * as ChildProcessRunner from './ChildProcessRunner/ChildProcessRunner.ts'
|
|
14
|
-
export * as ChildProcessWorker from './ChildProcessRunner/ChildProcessWorker.ts'
|
|
15
|
-
|
|
16
13
|
// Enable debug logging for OpenTelemetry
|
|
17
14
|
// otel.diag.setLogger(new otel.DiagConsoleLogger(), otel.DiagLogLevel.ERROR)
|
|
18
15
|
|
|
19
16
|
// export const OtelLiveHttp = (args: any): Layer.Layer<never> => Layer.empty
|
|
20
17
|
|
|
21
|
-
export const getFreePort: Effect.Effect<number, UnknownError> = Effect.
|
|
18
|
+
export const getFreePort: Effect.Effect<number, UnknownError> = Effect.callback<number, UnknownError>((cb, signal) => {
|
|
22
19
|
const server = http.createServer()
|
|
23
20
|
|
|
24
21
|
signal.addEventListener('abort', () => {
|
|
@@ -46,47 +43,24 @@ export const getFreePort: Effect.Effect<number, UnknownError> = Effect.async<num
|
|
|
46
43
|
export const OtelLiveDummy: Layer.Layer<OtelTracer.OtelTracer> = Layer.suspend(() => {
|
|
47
44
|
const OtelTracerLive = Layer.succeed(OtelTracer.OtelTracer, makeNoopTracer())
|
|
48
45
|
|
|
49
|
-
const TracingLive =
|
|
50
|
-
Layer.provideMerge(OtelTracerLive),
|
|
51
|
-
)
|
|
46
|
+
const TracingLive = OtelTracer.layerWithoutOtelTracer.pipe(Layer.provideMerge(OtelTracerLive))
|
|
52
47
|
|
|
53
48
|
return TracingLive
|
|
54
49
|
})
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
* Layer that provides WatchBackend for recursive file watching via @parcel/watcher.
|
|
58
|
-
* This layer alone does NOT provide FileSystem - it only provides the watch backend.
|
|
59
|
-
*
|
|
60
|
-
* IMPORTANT: Layer ordering matters! When composing with NodeFileSystem.layer, use
|
|
61
|
-
* `NodeFileSystemWithWatch` instead, or ensure WatchBackend is available when FileSystem
|
|
62
|
-
* is constructed by using `Layer.provideMerge`:
|
|
63
|
-
*
|
|
64
|
-
* ```ts
|
|
65
|
-
* // ✅ CORRECT: Use the pre-composed layer
|
|
66
|
-
* Effect.provide(NodeFileSystemWithWatch)
|
|
67
|
-
*
|
|
68
|
-
* // ✅ CORRECT: Manual composition with Layer.provideMerge
|
|
69
|
-
* const layer = PlatformNode.NodeFileSystem.layer.pipe(Layer.provideMerge(NodeRecursiveWatchLayer))
|
|
70
|
-
* Effect.provide(layer)
|
|
71
|
-
*
|
|
72
|
-
* // ❌ WRONG: Chained Effect.provide - WatchBackend won't be used!
|
|
73
|
-
* Effect.provide(NodeRecursiveWatchLayer).pipe(Effect.provide(PlatformNode.NodeFileSystem.layer))
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @see https://github.com/Effect-TS/effect/issues/5913
|
|
77
|
-
*/
|
|
78
|
-
export const NodeRecursiveWatchLayer = ParcelWatcherLayer
|
|
51
|
+
export { NodeFileSystem }
|
|
79
52
|
|
|
80
53
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* Use this layer when you need to watch files recursively (e.g., watching nested directories).
|
|
85
|
-
* Without recursive watching, Node.js's built-in fs.watch only detects changes in the
|
|
86
|
-
* immediate directory, not in subdirectories.
|
|
54
|
+
* Effect 4 uses Node's native recursive watcher when no custom watch backend
|
|
55
|
+
* registers for the requested path. Keep the public Effect 3 compatibility
|
|
56
|
+
* layer while deliberately deferring to that native implementation.
|
|
87
57
|
*/
|
|
88
|
-
export
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
58
|
+
export const NodeRecursiveWatchLayer: Layer.Layer<FileSystem.WatchBackend> = Layer.succeed(
|
|
59
|
+
FileSystem.WatchBackend,
|
|
60
|
+
FileSystem.WatchBackend.of({
|
|
61
|
+
register: () => Option.none(),
|
|
62
|
+
}),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
/** FileSystem layer retaining the public recursive-watch composition API. */
|
|
66
|
+
export const NodeFileSystemWithWatch = NodeFileSystem.layer.pipe(Layer.provideMerge(NodeRecursiveWatchLayer))
|
package/src/object/index.ts
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
import { pipe } from 'effect'
|
|
2
|
-
|
|
3
|
-
export * from './omit.ts'
|
|
4
|
-
export * from './pick.ts'
|
|
5
1
|
export * from './stringify-object.ts'
|
|
6
|
-
|
|
7
|
-
type ValueOfRecord<R extends Record<any, any>> = R extends Record<any, infer V> ? V : never
|
|
8
|
-
|
|
9
|
-
export const mapObjectValues = <O_In extends Record<string, any>, V_Out>(
|
|
10
|
-
obj: O_In,
|
|
11
|
-
mapValue: (key: keyof O_In, val: ValueOfRecord<O_In>) => V_Out,
|
|
12
|
-
): { [K in keyof O_In]: V_Out } => {
|
|
13
|
-
const mappedEntries = Object.entries(obj).map(([key, val]) => [key, mapValue(key as keyof O_In, val)] as const)
|
|
14
|
-
return Object.fromEntries(mappedEntries) as any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type Entries<T> = { [K in keyof T]: [K, T[K]] }[keyof T][]
|
|
18
|
-
|
|
19
|
-
export const objectEntries = <T extends Record<string, any>>(obj: T): Entries<T> => Object.entries(obj) as Entries<T>
|
|
20
|
-
|
|
21
|
-
export const keyObjectFromObject = <TObj extends Record<string, any>>(obj: TObj): { [K in keyof TObj]: K } =>
|
|
22
|
-
pipe(
|
|
23
|
-
objectEntries(obj).map(([k]) => [k, k]),
|
|
24
|
-
Object.fromEntries,
|
|
25
|
-
)
|
package/src/string.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export const lowercaseFirstChar = (str: string) => str.charAt(0).toLowerCase() + str.slice(1)
|
|
2
|
-
export const uppercaseFirstChar = (str: string) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
3
|
-
|
|
4
1
|
/** Indents a string each line by `n` characters (default: spaces) */
|
|
5
2
|
export const indent = (str: string, n: number, char = ' '): string =>
|
|
6
3
|
str
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Effect, STM, TRef } from 'effect';
|
|
2
|
-
export type BucketQueue<A> = TRef.TRef<A[]>;
|
|
3
|
-
export declare const make: <A>() => STM.STM<BucketQueue<A>>;
|
|
4
|
-
export declare const offerAll: <A>(self: BucketQueue<A>, elements: ReadonlyArray<A>) => STM.STM<void, never, never>;
|
|
5
|
-
export declare const replace: <A>(self: BucketQueue<A>, elements: ReadonlyArray<A>) => STM.STM<void, never, never>;
|
|
6
|
-
export declare const clear: <A>(self: BucketQueue<A>) => STM.STM<void, never, never>;
|
|
7
|
-
export declare const takeBetween: <A>(bucket: BucketQueue<A>, min: number, max: number) => STM.STM<ReadonlyArray<A>>;
|
|
8
|
-
export declare const peekAll: <A>(bucket: BucketQueue<A>) => STM.STM<A[], never, never>;
|
|
9
|
-
/** Returns the elements up to the first element that matches the predicate, the rest is left in the queue
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const [elements, rest] = yield* BucketQueue.takeSplitWhere(bucket, (a) => a > 3)
|
|
14
|
-
* assert.deepStrictEqual(elements, [1, 2, 3])
|
|
15
|
-
* assert.deepStrictEqual(rest, [4, 5, 6])
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const takeSplitWhere: <A>(bucket: BucketQueue<A>, predicate: (a: A) => boolean) => STM.STM<A[], never, never>;
|
|
19
|
-
export declare const size: <A>(bucket: BucketQueue<A>) => Effect.Effect<number, never, never>;
|
|
20
|
-
//# sourceMappingURL=BucketQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BucketQueue.d.ts","sourceRoot":"","sources":["../../src/effect/BucketQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEjD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;AAE3C,eAAO,MAAM,IAAI,GAAI,CAAC,OAAK,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAuB,CAAA;AAExE,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,aAAa,CAAC,CAAC,CAAC,gCACV,CAAA;AAElE,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,aAAa,CAAC,CAAC,CAAC,gCAAoC,CAAA;AAE/G,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,gCAAuB,CAAA;AAEpE,eAAO,MAAM,WAAW,GAAI,CAAC,EAC3B,QAAQ,WAAW,CAAC,CAAC,CAAC,EACtB,KAAK,MAAM,EACX,KAAK,MAAM,KACV,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAUvB,CAAA;AAEJ,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,+BAAqB,CAAA;AAEtE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,+BAMlF,CAAA;AAEJ,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,wCAAuD,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Array, Effect, STM, TRef } from 'effect';
|
|
2
|
-
export const make = () => TRef.make([]);
|
|
3
|
-
export const offerAll = (self, elements) => TRef.update(self, (bucket) => Array.appendAll(bucket, elements));
|
|
4
|
-
export const replace = (self, elements) => TRef.set(self, elements);
|
|
5
|
-
export const clear = (self) => TRef.set(self, []);
|
|
6
|
-
export const takeBetween = (bucket, min, max) => STM.gen(function* () {
|
|
7
|
-
const bucketValue = yield* TRef.get(bucket);
|
|
8
|
-
if (bucketValue.length < min) {
|
|
9
|
-
return yield* STM.retry;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
const elements = bucketValue.splice(0, Math.min(max, bucketValue.length));
|
|
13
|
-
yield* TRef.set(bucket, bucketValue);
|
|
14
|
-
return elements;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export const peekAll = (bucket) => TRef.get(bucket);
|
|
18
|
-
/** Returns the elements up to the first element that matches the predicate, the rest is left in the queue
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* const [elements, rest] = yield* BucketQueue.takeSplitWhere(bucket, (a) => a > 3)
|
|
23
|
-
* assert.deepStrictEqual(elements, [1, 2, 3])
|
|
24
|
-
* assert.deepStrictEqual(rest, [4, 5, 6])
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export const takeSplitWhere = (bucket, predicate) => STM.gen(function* () {
|
|
28
|
-
const bucketValue = yield* TRef.get(bucket);
|
|
29
|
-
const [elements, rest] = Array.splitWhere(bucketValue, predicate);
|
|
30
|
-
yield* TRef.set(bucket, rest);
|
|
31
|
-
return elements;
|
|
32
|
-
});
|
|
33
|
-
export const size = (bucket) => TRef.get(bucket).pipe(Effect.map((_) => _.length));
|
|
34
|
-
//# sourceMappingURL=BucketQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BucketQueue.js","sourceRoot":"","sources":["../../src/effect/BucketQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAIjD,MAAM,CAAC,MAAM,IAAI,GAAG,GAA+B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAM,EAAE,CAAC,CAAA;AAExE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,IAAoB,EAAE,QAA0B,EAAE,EAAE,CAC9E,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAElE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,IAAoB,EAAE,QAA0B,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAe,CAAC,CAAA;AAE/G,MAAM,CAAC,MAAM,KAAK,GAAG,CAAI,IAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAsB,EACtB,GAAW,EACX,GAAW,EACgB,EAAE,CAC7B,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;IACf,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,WAAW,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;QACzE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QACpC,OAAO,QAAQ,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,MAAsB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,MAAsB,EAAE,SAA4B,EAAE,EAAE,CACxF,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;IACf,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;IACjE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC7B,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,MAAsB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../../src/effect/Scheduler.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGlC,eAAO,MAAM,cAAc,GAAI,cAAa,SAAS,CAAC,SAAS,CAAC,aAAa,CAAgC,wBAO5F,CAAA"}
|
package/dist/effect/Scheduler.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from 'effect/Scheduler';
|
|
2
|
-
import { Scheduler } from 'effect';
|
|
3
|
-
// Based on https://github.com/astoilkov/main-thread-scheduling/blob/4b99c26ab96781bc35a331f5c225ad9c8a62cb95/src/utils/waitNextTask.ts#L25
|
|
4
|
-
export const messageChannel = (shouldYield = Scheduler.defaultShouldYield) => Scheduler.makeBatched((task) => {
|
|
5
|
-
const messageChannel = new MessageChannel();
|
|
6
|
-
messageChannel.port1.postMessage(undefined);
|
|
7
|
-
messageChannel.port2.onmessage = task;
|
|
8
|
-
}, shouldYield);
|
|
9
|
-
//# sourceMappingURL=Scheduler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Scheduler.js","sourceRoot":"","sources":["../../src/effect/Scheduler.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,2IAA2I;AAC3I,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,cAAkD,SAAS,CAAC,kBAAkB,EAAE,EAAE,CAC/G,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;IAC7B,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAA;IAE3C,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IAE3C,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAA;AACvC,CAAC,EAAE,WAAW,CAAC,CAAA"}
|