@livestore/utils 0.4.0 → 0.5.0-dev.0
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/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 +17 -0
- package/dist/NoopTracer.test.js.map +1 -0
- 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 +132 -307
- 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 +5 -4
- package/dist/browser/Opfs/debug-utils.js.map +1 -1
- 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 +21 -10
- package/dist/browser/WebChannelBrowser.js.map +1 -1
- package/dist/browser/WebError.d.ts +54 -86
- package/dist/browser/WebError.d.ts.map +1 -1
- package/dist/browser/WebError.js +91 -84
- package/dist/browser/WebError.js.map +1 -1
- package/dist/browser/WebError.test.js +6 -6
- package/dist/browser/WebError.test.js.map +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/effect/Debug.d.ts +4 -7
- package/dist/effect/Debug.d.ts.map +1 -1
- package/dist/effect/Debug.js +32 -36
- 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 +51 -47
- 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 +7 -7
- package/dist/effect/RpcClient.d.ts.map +1 -1
- package/dist/effect/RpcClient.js +72 -52
- 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 +7 -4
- 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 +55 -28
- 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 +9 -9
- 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 +64 -43
- package/dist/effect/WebChannel/WebChannel.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js +15 -15
- 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 +16 -9
- 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/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 +2 -2
- 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 +13 -18
- 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 +10 -13
- package/dist/effect/spanEvent.test.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.js +2 -2
- package/dist/misc.js.map +1 -1
- package/dist/mod.d.ts +0 -35
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +0 -8
- package/dist/mod.js.map +1 -1
- package/dist/node/mod.d.ts +17 -11
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +23 -16
- 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 +0 -9
- package/dist/object/index.js.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 +18 -36
- package/src/NoopTracer.test.ts +20 -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 +66 -59
- package/src/effect/Effect.test.ts +117 -0
- package/src/effect/Effect.ts +84 -71
- package/src/effect/Logger.ts +0 -48
- package/src/effect/OtelTracer.ts +2 -3
- package/src/effect/RpcClient.ts +80 -61
- 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 -55
- 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 +35 -69
- package/src/effect/spanEvent.test.ts +10 -13
- package/src/effect/spanEvent.ts +5 -3
- package/src/fast-deep-equal.ts +1 -2
- package/src/misc.ts +2 -2
- package/src/mod.ts +0 -36
- package/src/node/mod.ts +26 -20
- 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/unstable/observability'
|
|
4
|
+
export { Msgpack } from 'effect/unstable/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/unstable/http'
|
|
20
|
+
export { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup } from 'effect/unstable/httpapi'
|
|
21
|
+
export { KeyValueStore } from 'effect/unstable/persistence'
|
|
22
|
+
export { ChildProcess, ChildProcessSpawner } from 'effect/unstable/process'
|
|
23
|
+
export { Socket } from 'effect/unstable/socket'
|
|
24
|
+
export { Transferable, Worker, WorkerError, WorkerRunner } from 'effect/unstable/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/unstable/rpc'
|
|
64
37
|
export * as StandardSchema from '@standard-schema/spec'
|
|
65
38
|
export {
|
|
66
39
|
Array as ReadonlyArray,
|
|
@@ -70,81 +43,76 @@ export {
|
|
|
70
43
|
Channel,
|
|
71
44
|
Chunk,
|
|
72
45
|
Config,
|
|
73
|
-
ConfigError,
|
|
74
46
|
ConfigProvider,
|
|
75
47
|
Console,
|
|
76
48
|
Context,
|
|
77
49
|
Data,
|
|
78
50
|
Deferred,
|
|
79
51
|
Duration,
|
|
80
|
-
|
|
52
|
+
Result,
|
|
81
53
|
Equal,
|
|
82
|
-
ExecutionStrategy,
|
|
83
54
|
Exit,
|
|
84
|
-
FastCheck,
|
|
85
55
|
Fiber,
|
|
56
|
+
Filter,
|
|
57
|
+
FileSystem,
|
|
58
|
+
Terminal,
|
|
86
59
|
FiberHandle,
|
|
87
|
-
FiberId,
|
|
88
60
|
FiberMap,
|
|
89
|
-
FiberRef,
|
|
90
|
-
FiberRefs,
|
|
91
|
-
FiberRefsPatch,
|
|
92
61
|
FiberSet,
|
|
93
|
-
|
|
62
|
+
Formatter,
|
|
63
|
+
Function,
|
|
94
64
|
Hash,
|
|
95
65
|
HashMap,
|
|
96
66
|
HashSet,
|
|
97
67
|
Inspectable,
|
|
98
68
|
identity,
|
|
69
|
+
Latch,
|
|
99
70
|
Layer,
|
|
100
|
-
List,
|
|
101
71
|
LogLevel,
|
|
102
|
-
LogSpan,
|
|
103
|
-
Mailbox,
|
|
104
72
|
ManagedRuntime,
|
|
105
73
|
Match,
|
|
106
74
|
Metric,
|
|
107
|
-
MetricState,
|
|
108
75
|
MutableHashMap,
|
|
109
76
|
MutableHashSet,
|
|
77
|
+
MutableList,
|
|
110
78
|
Option,
|
|
111
79
|
Order,
|
|
112
|
-
ParseResult,
|
|
113
80
|
Predicate,
|
|
114
|
-
Pretty,
|
|
115
81
|
PrimaryKey,
|
|
82
|
+
PlatformError,
|
|
116
83
|
PubSub,
|
|
117
|
-
// Subscribable,
|
|
118
84
|
pipe,
|
|
119
85
|
Queue,
|
|
120
86
|
RcMap,
|
|
121
87
|
RcRef,
|
|
122
88
|
Record as ReadonlyRecord,
|
|
89
|
+
References,
|
|
123
90
|
Redacted,
|
|
124
91
|
Ref,
|
|
125
92
|
Request,
|
|
126
93
|
Runtime,
|
|
127
|
-
RuntimeFlags,
|
|
128
94
|
Scope,
|
|
129
95
|
ScopedRef,
|
|
96
|
+
Scheduler,
|
|
97
|
+
SchemaIssue,
|
|
98
|
+
SchemaAST,
|
|
99
|
+
SchemaGetter,
|
|
100
|
+
SchemaParser,
|
|
101
|
+
SchemaRepresentation,
|
|
102
|
+
SchemaTransformation,
|
|
103
|
+
Semaphore,
|
|
130
104
|
Sink,
|
|
131
|
-
|
|
132
|
-
|
|
105
|
+
Struct,
|
|
106
|
+
Graph,
|
|
133
107
|
SynchronizedRef,
|
|
134
|
-
TestClock,
|
|
135
|
-
TestServices,
|
|
136
|
-
TQueue,
|
|
137
|
-
TRef,
|
|
138
108
|
Tracer,
|
|
109
|
+
TxQueue,
|
|
110
|
+
TxRef,
|
|
139
111
|
Types,
|
|
140
112
|
} 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'
|
|
113
|
+
export * as FastCheck from 'effect/testing/FastCheck'
|
|
114
|
+
export * as TestClock from 'effect/testing/TestClock'
|
|
115
|
+
export * as TestConsole from 'effect/testing/TestConsole'
|
|
148
116
|
export * as Debug from './Debug.ts'
|
|
149
117
|
export * as Effect from './Effect.ts'
|
|
150
118
|
export * from './Error.ts'
|
|
@@ -152,9 +120,7 @@ export * as Logger from './Logger.ts'
|
|
|
152
120
|
export * as OtelTracer from './OtelTracer.ts'
|
|
153
121
|
export * as RpcClient from './RpcClient.ts'
|
|
154
122
|
export * as Schedule from './Schedule.ts'
|
|
155
|
-
export * as Scheduler from './Scheduler.ts'
|
|
156
123
|
export * as Schema from './Schema/index.ts'
|
|
157
|
-
export * as ServiceContext from './ServiceContext.ts'
|
|
158
124
|
export * as Stream from './Stream.ts'
|
|
159
125
|
export * as Subscribable from './Subscribable.ts'
|
|
160
126
|
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
|
@@ -53,7 +53,7 @@ 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; ) if (Object.
|
|
56
|
+
for (i = length; i-- !== 0; ) if (Object.hasOwn(b, keys[i]) === false) return false
|
|
57
57
|
|
|
58
58
|
for (i = length; i-- !== 0; ) {
|
|
59
59
|
const key = keys[i]
|
|
@@ -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
|
|
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
|
|
|
@@ -165,9 +138,6 @@ 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.
|
|
@@ -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/unstable/cli'
|
|
10
|
+
export * as SocketServer from 'effect/unstable/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,15 +43,21 @@ 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
51
|
/**
|
|
57
|
-
*
|
|
52
|
+
* Compatibility layer for the old Effect v3 @parcel/watcher backend.
|
|
53
|
+
*
|
|
54
|
+
* Effect v4 removed `@effect/platform-node/NodeFileSystem/ParcelWatcher`; its
|
|
55
|
+
* NodeFileSystem layer now performs recursive watching through Node's native
|
|
56
|
+
* `fs.watch(path, { recursive: true })` fallback. This layer deliberately
|
|
57
|
+
* registers no custom backend so existing `NodeRecursiveWatchLayer` consumers
|
|
58
|
+
* continue to compile while the v4 NodeFileSystem implementation handles watch
|
|
59
|
+
* events.
|
|
60
|
+
*
|
|
58
61
|
* This layer alone does NOT provide FileSystem - it only provides the watch backend.
|
|
59
62
|
*
|
|
60
63
|
* IMPORTANT: Layer ordering matters! When composing with NodeFileSystem.layer, use
|
|
@@ -75,18 +78,21 @@ export const OtelLiveDummy: Layer.Layer<OtelTracer.OtelTracer> = Layer.suspend((
|
|
|
75
78
|
*
|
|
76
79
|
* @see https://github.com/Effect-TS/effect/issues/5913
|
|
77
80
|
*/
|
|
78
|
-
export const NodeRecursiveWatchLayer =
|
|
81
|
+
export const NodeRecursiveWatchLayer: Layer.Layer<FileSystem.WatchBackend> = Layer.succeed(
|
|
82
|
+
FileSystem.WatchBackend,
|
|
83
|
+
FileSystem.WatchBackend.of({
|
|
84
|
+
register: () => Option.none(),
|
|
85
|
+
}),
|
|
86
|
+
)
|
|
79
87
|
|
|
80
88
|
/**
|
|
81
|
-
* Pre-composed layer providing FileSystem with recursive file watching
|
|
89
|
+
* Pre-composed layer providing FileSystem with recursive file watching.
|
|
82
90
|
* This is the recommended way to get a FileSystem that supports recursive watching.
|
|
83
91
|
*
|
|
84
92
|
* Use this layer when you need to watch files recursively (e.g., watching nested directories).
|
|
85
|
-
*
|
|
86
|
-
*
|
|
93
|
+
* Effect v4's NodeFileSystem uses Node.js's native recursive `fs.watch` support
|
|
94
|
+
* instead of the removed ParcelWatcher backend from Effect v3.
|
|
87
95
|
*/
|
|
88
96
|
export { NodeFileSystem } from '@effect/platform-node'
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export const NodeFileSystemWithWatch = NodeFileSystem.layer.pipe(Layer.provideMerge(ParcelWatcherLayer))
|
|
98
|
+
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 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@
|
|
|
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"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AAO,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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Runtime } from 'effect';
|
|
2
|
-
import { Effect, Exit, Layer } from 'effect';
|
|
3
|
-
export interface MainLayer<Ctx> {
|
|
4
|
-
layer: Layer.Layer<Ctx>;
|
|
5
|
-
close: Effect.Effect<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare const unsafeMainLayer: <Ctx>(original: Layer.Layer<Ctx>) => MainLayer<Ctx>;
|
|
8
|
-
export declare const make: <TStaticData, Ctx>(staticData: TStaticData, runtime: Runtime.Runtime<Ctx>, close?: Effect.Effect<void>) => ServiceContext<Ctx, TStaticData>;
|
|
9
|
-
export interface ServiceContext<Ctx, TStaticData> {
|
|
10
|
-
readonly provide: <E, A>(self: Effect.Effect<A, E, Ctx>) => Effect.Effect<A, E>;
|
|
11
|
-
/**
|
|
12
|
-
* Fire and Forget. Errors are logged however.
|
|
13
|
-
*/
|
|
14
|
-
readonly runWithErrorLog: <E, A>(self: Effect.Effect<A, E, Ctx>) => AbortCallback;
|
|
15
|
-
readonly runSync: <E, A>(self: Effect.Effect<A, E, Ctx>) => A;
|
|
16
|
-
/**
|
|
17
|
-
* Fire and Forget. A promise that never fails nor returns any value.
|
|
18
|
-
* Errors are logged however.
|
|
19
|
-
*/
|
|
20
|
-
readonly runPromiseWithErrorLog: <E, A>(self: Effect.Effect<A, E, Ctx>) => Promise<A | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* A Promise that never fails, the Resolved value is an Exit result that can be either Success or Failed
|
|
23
|
-
*/
|
|
24
|
-
readonly runPromiseExit: <E, A>(self: Effect.Effect<A, E, Ctx>) => Promise<Exit.Exit<A, E>>;
|
|
25
|
-
readonly runPromise: <E, A>(self: Effect.Effect<A, E, Ctx>) => Promise<A>;
|
|
26
|
-
readonly withRuntime: (fn: (runtime: Runtime.Runtime<Ctx>) => void) => void;
|
|
27
|
-
/** Closes the ServiceContext and closing all its layers */
|
|
28
|
-
readonly close: Effect.Effect<void>;
|
|
29
|
-
readonly closePromise: () => Promise<void>;
|
|
30
|
-
readonly staticData: TStaticData;
|
|
31
|
-
}
|
|
32
|
-
export type AbortCallback = () => void;
|
|
33
|
-
export declare const runWithErrorLog: <E, A>(self: Effect.Effect<A, E>) => () => void;
|
|
34
|
-
export declare const runPromiseWithErrorLog: <E, A>(self: Effect.Effect<A, E>) => Promise<A | undefined>;
|
|
35
|
-
export declare const MissingContext: Effect.Effect<never, never, never>;
|
|
36
|
-
export declare const empty: <Ctx, TStaticData>() => ServiceContext<Ctx, TStaticData>;
|
|
37
|
-
//# sourceMappingURL=ServiceContext.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