@livestore/utils 0.3.1 → 0.3.2-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.json +1 -1
- package/dist/NoopTracer.d.ts +1 -0
- package/dist/NoopTracer.d.ts.map +1 -1
- package/dist/NoopTracer.js +1 -1
- package/dist/NoopTracer.js.map +1 -1
- package/dist/base64.d.ts.map +1 -1
- package/dist/base64.js +2 -2
- package/dist/base64.js.map +1 -1
- package/dist/cuid/cuid.browser.d.ts.map +1 -1
- package/dist/cuid/cuid.browser.js +12 -10
- package/dist/cuid/cuid.browser.js.map +1 -1
- package/dist/cuid/cuid.node.d.ts.map +1 -1
- package/dist/cuid/cuid.node.js +17 -11
- package/dist/cuid/cuid.node.js.map +1 -1
- package/dist/effect/Effect.d.ts.map +1 -1
- package/dist/effect/Effect.js +3 -3
- package/dist/effect/Effect.js.map +1 -1
- package/dist/effect/Scheduler.d.ts.map +1 -1
- package/dist/effect/Scheduler.js +0 -1
- package/dist/effect/Scheduler.js.map +1 -1
- package/dist/effect/Schema/debug-diff.test.js +1 -1
- package/dist/effect/Schema/index.d.ts +2 -2
- package/dist/effect/Schema/index.js +3 -3
- package/dist/effect/Subscribable.d.ts.map +1 -1
- package/dist/effect/Subscribable.js +2 -3
- package/dist/effect/Subscribable.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.d.ts +13 -17
- package/dist/effect/WebChannel/WebChannel.d.ts.map +1 -1
- package/dist/effect/WebChannel/WebChannel.js +5 -6
- package/dist/effect/WebChannel/WebChannel.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.d.ts +2 -2
- package/dist/effect/WebChannel/broadcastChannelWithAck.js +2 -2
- package/dist/effect/WebChannel/mod.d.ts +3 -3
- package/dist/effect/WebChannel/mod.d.ts.map +1 -1
- package/dist/effect/WebChannel/mod.js +3 -3
- package/dist/effect/WebChannel/mod.js.map +1 -1
- package/dist/effect/WebLock.d.ts +1 -1
- package/dist/effect/WebLock.d.ts.map +1 -1
- package/dist/effect/WebLock.js.map +1 -1
- package/dist/effect/WebSocket.test.js +1 -1
- package/dist/effect/index.d.ts +22 -23
- package/dist/effect/index.d.ts.map +1 -1
- package/dist/effect/index.js +25 -26
- package/dist/effect/index.js.map +1 -1
- package/dist/env.js +1 -1
- package/dist/fast-deep-equal.d.ts.map +1 -1
- package/dist/fast-deep-equal.js +9 -8
- package/dist/fast-deep-equal.js.map +1 -1
- package/dist/global.js.map +1 -1
- package/dist/index.d.ts +18 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -17
- package/dist/index.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/node/ChildProcessRunner/ChildProcessRunner.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js +3 -2
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js +2 -2
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts +4 -4
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js +3 -3
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js.map +1 -1
- package/dist/node/mod.d.ts +4 -4
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +5 -5
- package/dist/node/mod.js.map +1 -1
- package/dist/object/index.d.ts +3 -2
- package/dist/object/index.d.ts.map +1 -1
- package/dist/object/index.js +3 -2
- package/dist/object/index.js.map +1 -1
- package/dist/object/stringify-object.d.ts +9 -0
- package/dist/object/stringify-object.d.ts.map +1 -0
- package/dist/object/stringify-object.js +27 -0
- package/dist/object/stringify-object.js.map +1 -0
- package/dist/object/stringify-object.test.d.ts +2 -0
- package/dist/object/stringify-object.test.d.ts.map +1 -0
- package/dist/object/stringify-object.test.js +38 -0
- package/dist/object/stringify-object.test.js.map +1 -0
- package/package.json +43 -35
- package/src/NoopTracer.ts +2 -2
- package/src/base64.ts +2 -3
- package/src/cuid/cuid.browser.ts +20 -21
- package/src/cuid/cuid.node.ts +33 -34
- package/src/effect/Effect.ts +6 -3
- package/src/effect/Scheduler.ts +0 -1
- package/src/effect/Schema/debug-diff.test.ts +2 -2
- package/src/effect/Schema/index.ts +3 -3
- package/src/effect/Subscribable.ts +6 -5
- package/src/effect/WebChannel/WebChannel.test.ts +1 -1
- package/src/effect/WebChannel/WebChannel.ts +17 -21
- package/src/effect/WebChannel/broadcastChannelWithAck.ts +3 -3
- package/src/effect/WebChannel/mod.ts +3 -3
- package/src/effect/WebLock.ts +2 -2
- package/src/effect/WebSocket.test.ts +1 -1
- package/src/effect/index.ts +104 -110
- package/src/env.ts +1 -1
- package/src/fast-deep-equal.ts +9 -10
- package/src/index.ts +27 -17
- package/src/misc.ts +3 -3
- package/src/node/ChildProcessRunner/ChildProcessRunner.ts +1 -1
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.ts +3 -3
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.ts +3 -3
- package/src/node/ChildProcessRunner/ChildProcessWorker.ts +1 -4
- package/src/node/mod.ts +6 -6
- package/src/object/index.ts +3 -2
- package/src/object/stringify-object.test.ts +44 -0
- package/src/object/stringify-object.ts +27 -0
package/src/cuid/cuid.node.ts
CHANGED
|
@@ -15,32 +15,31 @@
|
|
|
15
15
|
import crypto from 'node:crypto'
|
|
16
16
|
import os from 'node:os'
|
|
17
17
|
|
|
18
|
-
const lim =
|
|
18
|
+
const lim = 2 ** 32 - 1
|
|
19
19
|
|
|
20
20
|
const getRandomValue = () => {
|
|
21
21
|
return Math.abs(crypto.randomBytes(4).readInt32BE() / lim)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const pad = (num: number | string, size: number) => {
|
|
25
|
-
const s =
|
|
25
|
+
const s = `000000000${num}`
|
|
26
26
|
return s.slice(s.length - size)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const fingerprint = () => {
|
|
30
|
-
const padding = 2
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
30
|
+
const padding = 2
|
|
31
|
+
const pid = pad(process.pid.toString(36), padding)
|
|
32
|
+
const hostname = os.hostname()
|
|
33
|
+
const length = hostname.length
|
|
34
|
+
const hostId = pad(
|
|
35
|
+
hostname
|
|
36
|
+
.split('')
|
|
37
|
+
.reduce((prev, char) => {
|
|
38
|
+
return +prev + char.charCodeAt(0)
|
|
39
|
+
}, +length + 36)
|
|
40
|
+
.toString(36),
|
|
41
|
+
padding,
|
|
42
|
+
)
|
|
44
43
|
|
|
45
44
|
return pid + hostId
|
|
46
45
|
}
|
|
@@ -48,7 +47,7 @@ const fingerprint = () => {
|
|
|
48
47
|
let c = 0
|
|
49
48
|
const blockSize = 4
|
|
50
49
|
const base = 36
|
|
51
|
-
const discreteValues =
|
|
50
|
+
const discreteValues = base ** blockSize
|
|
52
51
|
|
|
53
52
|
const randomBlock = () => {
|
|
54
53
|
return pad(Math.trunc(getRandomValue() * discreteValues).toString(base), blockSize)
|
|
@@ -63,28 +62,28 @@ const safeCounter = () => {
|
|
|
63
62
|
export const cuid = () => {
|
|
64
63
|
// Starting with a lowercase letter makes
|
|
65
64
|
// it HTML element ID friendly.
|
|
66
|
-
const letter = 'c'
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
const letter = 'c' // hard-coded allows for sequential access
|
|
66
|
+
// timestamp
|
|
67
|
+
// warning: this exposes the exact date and time
|
|
68
|
+
// that the uid was created.
|
|
69
|
+
const timestamp = Date.now().toString(base)
|
|
70
|
+
// Prevent same-machine collisions.
|
|
71
|
+
const counter = pad(safeCounter().toString(base), blockSize)
|
|
72
|
+
// A few chars to generate distinct ids for different
|
|
73
|
+
// clients (so different computers are far less
|
|
74
|
+
// likely to generate the same id)
|
|
75
|
+
const print = fingerprint()
|
|
76
|
+
// Grab some more chars from Math.random()
|
|
77
|
+
const random = randomBlock() + randomBlock()
|
|
79
78
|
|
|
80
79
|
return letter + timestamp + counter + print + random
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
export const slug = () => {
|
|
84
|
-
const date = Date.now().toString(36)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
const date = Date.now().toString(36)
|
|
84
|
+
const counter = safeCounter().toString(36).slice(-4)
|
|
85
|
+
const print = fingerprint().slice(0, 1) + fingerprint().slice(-1)
|
|
86
|
+
const random = randomBlock().slice(-2)
|
|
88
87
|
|
|
89
88
|
return date.slice(-2) + counter + print + random
|
|
90
89
|
}
|
package/src/effect/Effect.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { UnknownException } from 'effect/Cause'
|
|
|
5
5
|
import { log } from 'effect/Console'
|
|
6
6
|
import type { LazyArg } from 'effect/Function'
|
|
7
7
|
|
|
8
|
-
import { isPromise } from '../index.
|
|
9
|
-
import { UnknownError } from './Error.
|
|
8
|
+
import { isPromise } from '../index.ts'
|
|
9
|
+
import { UnknownError } from './Error.ts'
|
|
10
10
|
|
|
11
11
|
export * from 'effect/Effect'
|
|
12
12
|
|
|
@@ -57,7 +57,10 @@ export const tryAll = <Res>(
|
|
|
57
57
|
export const acquireReleaseLog = (label: string) =>
|
|
58
58
|
Effect.acquireRelease(Effect.log(`${label} acquire`), (_, ex) => Effect.log(`${label} release`, ex))
|
|
59
59
|
|
|
60
|
-
export const addFinalizerLog = (...msgs: any[]) =>
|
|
60
|
+
export const addFinalizerLog = (...msgs: any[]) =>
|
|
61
|
+
Effect.addFinalizer((exit) =>
|
|
62
|
+
Effect.log(...msgs, exit._tag === 'Success' ? 'with success' : `with failure: ${Cause.pretty(exit.cause)}`),
|
|
63
|
+
)
|
|
61
64
|
|
|
62
65
|
export const logBefore =
|
|
63
66
|
(...msgs: any[]) =>
|
package/src/effect/Scheduler.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Schema } from 'effect'
|
|
2
2
|
import { describe, expect, test } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import type { DiffItem } from './debug-diff.
|
|
5
|
-
import { debugDiff } from './debug-diff.
|
|
4
|
+
import type { DiffItem } from './debug-diff.ts'
|
|
5
|
+
import { debugDiff } from './debug-diff.ts'
|
|
6
6
|
|
|
7
7
|
describe('debug-diff', () => {
|
|
8
8
|
test('simple object', () => {
|
|
@@ -4,11 +4,11 @@ import { Effect, Hash, ParseResult, Schema } from 'effect'
|
|
|
4
4
|
import type { ParseError } from 'effect/ParseResult'
|
|
5
5
|
import type { ParseOptions } from 'effect/SchemaAST'
|
|
6
6
|
|
|
7
|
-
import { shouldNeverHappen } from '../../index.
|
|
7
|
+
import { shouldNeverHappen } from '../../index.ts'
|
|
8
8
|
|
|
9
9
|
export * from 'effect/Schema'
|
|
10
|
-
export * from './debug-diff.
|
|
11
|
-
export * from './msgpack.
|
|
10
|
+
export * from './debug-diff.ts'
|
|
11
|
+
export * from './msgpack.ts'
|
|
12
12
|
|
|
13
13
|
// NOTE this is a temporary workaround until Effect schema has a better way to hash schemas
|
|
14
14
|
// https://github.com/Effect-TS/effect/issues/2719
|
|
@@ -49,13 +49,14 @@ class SubscribableImpl<in out A> extends Effectable.Class<A> implements Subscrib
|
|
|
49
49
|
readonly [TypeId] = TypeId
|
|
50
50
|
// @ts-expect-error type symbol
|
|
51
51
|
readonly [Readable.TypeId] = Readable.TypeId
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
) {
|
|
52
|
+
readonly get: Effect.Effect<A>
|
|
53
|
+
readonly changes: Stream.Stream<A>
|
|
54
|
+
constructor(get: Effect.Effect<A>, changes: Stream.Stream<A>) {
|
|
56
55
|
super()
|
|
56
|
+
this.get = get
|
|
57
|
+
this.changes = changes
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
|
|
59
60
|
commit() {
|
|
60
61
|
return this.get
|
|
61
62
|
}
|
|
@@ -2,7 +2,7 @@ import * as Vitest from '@effect/vitest'
|
|
|
2
2
|
import { Effect, Schema, Stream } from 'effect'
|
|
3
3
|
import { JSDOM } from 'jsdom'
|
|
4
4
|
|
|
5
|
-
import * as WebChannel from './WebChannel.
|
|
5
|
+
import * as WebChannel from './WebChannel.ts'
|
|
6
6
|
|
|
7
7
|
Vitest.describe('WebChannel', () => {
|
|
8
8
|
Vitest.describe('windowChannel', () => {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Deferred, Either, Exit, GlobalValue, identity, Option, PubSub, Queue, Scope } from 'effect'
|
|
2
2
|
import type { DurationInput } from 'effect/Duration'
|
|
3
3
|
|
|
4
|
-
import { shouldNeverHappen } from '../../misc.
|
|
5
|
-
import * as Effect from '../Effect.
|
|
6
|
-
import * as Schema from '../Schema/index.
|
|
7
|
-
import * as Stream from '../Stream.
|
|
4
|
+
import { shouldNeverHappen } from '../../misc.ts'
|
|
5
|
+
import * as Effect from '../Effect.ts'
|
|
6
|
+
import * as Schema from '../Schema/index.ts'
|
|
7
|
+
import * as Stream from '../Stream.ts'
|
|
8
8
|
import {
|
|
9
9
|
DebugPingMessage,
|
|
10
10
|
type InputSchema,
|
|
11
|
+
listenToDebugPing,
|
|
12
|
+
mapSchema,
|
|
11
13
|
type WebChannel,
|
|
12
14
|
WebChannelHeartbeat,
|
|
13
15
|
WebChannelPing,
|
|
14
16
|
WebChannelPong,
|
|
15
17
|
WebChannelSymbol,
|
|
16
|
-
} from './common.
|
|
17
|
-
import { listenToDebugPing, mapSchema } from './common.js'
|
|
18
|
+
} from './common.ts'
|
|
18
19
|
|
|
19
20
|
export const shutdown = <MsgListen, MsgSend>(webChannel: WebChannel<MsgListen, MsgSend>): Effect.Effect<void> =>
|
|
20
21
|
Deferred.done(webChannel.closedDeferred, Exit.void)
|
|
@@ -158,13 +159,11 @@ export const windowChannel = <MsgListen, MsgSend, MsgListenEncoded, MsgSendEncod
|
|
|
158
159
|
}).pipe(Effect.withSpan(`WebChannel:windowChannel`)),
|
|
159
160
|
)
|
|
160
161
|
|
|
161
|
-
export const messagePortChannel: {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}): Effect.Effect<WebChannel<MsgListen, MsgSend>, never, Scope.Scope>
|
|
167
|
-
} = ({ port, schema: inputSchema, debugId }) =>
|
|
162
|
+
export const messagePortChannel: <MsgListen, MsgSend, MsgListenEncoded, MsgSendEncoded>(args: {
|
|
163
|
+
port: MessagePort
|
|
164
|
+
schema: InputSchema<MsgListen, MsgSend, MsgListenEncoded, MsgSendEncoded>
|
|
165
|
+
debugId?: string | number
|
|
166
|
+
}) => Effect.Effect<WebChannel<MsgListen, MsgSend>, never, Scope.Scope> = ({ port, schema: inputSchema, debugId }) =>
|
|
168
167
|
Effect.scopeWithCloseable((scope) =>
|
|
169
168
|
Effect.gen(function* () {
|
|
170
169
|
const schema = mapSchema(inputSchema)
|
|
@@ -247,13 +246,11 @@ export const sameThreadChannel = <MsgListen, MsgSend, MsgListenEncoded, MsgSendE
|
|
|
247
246
|
}),
|
|
248
247
|
)
|
|
249
248
|
|
|
250
|
-
export const messagePortChannelWithAck: {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}): Effect.Effect<WebChannel<MsgListen, MsgSend>, never, Scope.Scope>
|
|
256
|
-
} = ({ port, schema: inputSchema, debugId }) =>
|
|
249
|
+
export const messagePortChannelWithAck: <MsgListen, MsgSend, MsgListenEncoded, MsgSendEncoded>(args: {
|
|
250
|
+
port: MessagePort
|
|
251
|
+
schema: InputSchema<MsgListen, MsgSend, MsgListenEncoded, MsgSendEncoded>
|
|
252
|
+
debugId?: string | number
|
|
253
|
+
}) => Effect.Effect<WebChannel<MsgListen, MsgSend>, never, Scope.Scope> = ({ port, schema: inputSchema, debugId }) =>
|
|
257
254
|
Effect.scopeWithCloseable((scope) =>
|
|
258
255
|
Effect.gen(function* () {
|
|
259
256
|
const schema = mapSchema(inputSchema)
|
|
@@ -273,7 +270,6 @@ export const messagePortChannelWithAck: {
|
|
|
273
270
|
const ChannelMessage = Schema.Union(ChannelRequest, ChannelRequestAck).annotations({
|
|
274
271
|
title: 'webmesh.ChannelMessage',
|
|
275
272
|
})
|
|
276
|
-
type ChannelMessage = typeof ChannelMessage.Type
|
|
277
273
|
|
|
278
274
|
const debugInfo = {
|
|
279
275
|
sendTotal: 0,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Deferred, Exit, Predicate, Queue, Schema, Scope, Stream } from 'effect'
|
|
2
2
|
|
|
3
|
-
import * as Effect from '../Effect.
|
|
4
|
-
import type { InputSchema, WebChannel } from './common.
|
|
5
|
-
import { listenToDebugPing, mapSchema, WebChannelSymbol } from './common.
|
|
3
|
+
import * as Effect from '../Effect.ts'
|
|
4
|
+
import type { InputSchema, WebChannel } from './common.ts'
|
|
5
|
+
import { listenToDebugPing, mapSchema, WebChannelSymbol } from './common.ts'
|
|
6
6
|
|
|
7
7
|
const ConnectMessage = Schema.TaggedStruct('ConnectMessage', {
|
|
8
8
|
from: Schema.String,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './broadcastChannelWithAck.ts'
|
|
2
|
+
export * from './common.ts'
|
|
3
|
+
export * from './WebChannel.ts'
|
package/src/effect/WebLock.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const withLock =
|
|
|
12
12
|
onTaken?: Effect.Effect<void, E2>
|
|
13
13
|
options?: Omit<LockOptions, 'signal'>
|
|
14
14
|
}) =>
|
|
15
|
-
<Ctx, E, A>(eff: Effect.Effect<A, E, Ctx>): Effect.Effect<A
|
|
15
|
+
<Ctx, E, A>(eff: Effect.Effect<A, E, Ctx>): Effect.Effect<A, E | E2, Ctx> =>
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
const runtime = yield* Effect.runtime<Ctx>()
|
|
18
18
|
|
|
@@ -35,7 +35,7 @@ export const withLock =
|
|
|
35
35
|
|
|
36
36
|
// TODO also propagate Effect interruption to the execution
|
|
37
37
|
return Runtime.runPromiseExit(runtime)(eff)
|
|
38
|
-
})
|
|
38
|
+
}) as unknown as Promise<Exit.Exit<A, E>>
|
|
39
39
|
},
|
|
40
40
|
catch: (err) => err as any as E,
|
|
41
41
|
})
|
|
@@ -2,7 +2,7 @@ import { FetchHttpClient } from '@effect/platform'
|
|
|
2
2
|
import * as Vitest from '@effect/vitest'
|
|
3
3
|
import { Effect, Exit } from 'effect'
|
|
4
4
|
|
|
5
|
-
import { makeWebSocket } from './WebSocket.
|
|
5
|
+
import { makeWebSocket } from './WebSocket.ts'
|
|
6
6
|
|
|
7
7
|
Vitest.describe('WebSocket', () => {
|
|
8
8
|
Vitest.scopedLive(
|
package/src/effect/index.ts
CHANGED
|
@@ -1,137 +1,131 @@
|
|
|
1
|
-
import '../global.
|
|
1
|
+
import '../global.ts'
|
|
2
2
|
|
|
3
|
+
export * as OtelTracer from '@effect/opentelemetry/Tracer'
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Command,
|
|
6
|
+
CommandExecutor,
|
|
7
|
+
Error as PlatformError,
|
|
8
|
+
FetchHttpClient,
|
|
9
|
+
FileSystem,
|
|
10
|
+
Headers,
|
|
11
|
+
HttpClient,
|
|
12
|
+
HttpClientError,
|
|
13
|
+
HttpClientRequest,
|
|
14
|
+
HttpClientResponse,
|
|
15
|
+
HttpMiddleware,
|
|
16
|
+
HttpRouter,
|
|
17
|
+
HttpServer,
|
|
18
|
+
HttpServerRequest,
|
|
19
|
+
HttpServerResponse,
|
|
20
|
+
KeyValueStore,
|
|
21
|
+
Socket,
|
|
22
|
+
Terminal,
|
|
23
|
+
Transferable,
|
|
24
|
+
UrlParams,
|
|
25
|
+
Worker,
|
|
26
|
+
WorkerError,
|
|
27
|
+
WorkerRunner,
|
|
28
|
+
} from '@effect/platform'
|
|
29
|
+
export { BrowserWorker, BrowserWorkerRunner } from '@effect/platform-browser'
|
|
30
|
+
export {
|
|
31
|
+
Rpc,
|
|
32
|
+
RpcClient,
|
|
33
|
+
RpcGroup,
|
|
34
|
+
RpcMessage,
|
|
35
|
+
RpcMiddleware,
|
|
36
|
+
RpcSchema,
|
|
37
|
+
RpcSerialization,
|
|
38
|
+
RpcServer,
|
|
39
|
+
RpcTest,
|
|
40
|
+
RpcWorker,
|
|
41
|
+
} from '@effect/rpc'
|
|
42
|
+
export * as StandardSchema from '@standard-schema/spec'
|
|
43
|
+
export {
|
|
44
|
+
Array as ReadonlyArray,
|
|
45
|
+
Brand,
|
|
46
|
+
Cache,
|
|
47
|
+
Cause,
|
|
48
|
+
Channel,
|
|
49
|
+
Chunk,
|
|
50
|
+
// Logger,
|
|
51
|
+
Config,
|
|
52
|
+
Context,
|
|
53
|
+
Data,
|
|
54
|
+
Deferred,
|
|
55
|
+
Duration,
|
|
56
|
+
Either,
|
|
57
|
+
Equal,
|
|
58
|
+
ExecutionStrategy,
|
|
59
|
+
Exit,
|
|
8
60
|
Fiber,
|
|
61
|
+
FiberHandle,
|
|
9
62
|
FiberId,
|
|
10
|
-
FiberSet,
|
|
11
63
|
FiberMap,
|
|
12
|
-
FiberHandle,
|
|
13
|
-
Inspectable,
|
|
14
|
-
RuntimeFlags,
|
|
15
|
-
PubSub,
|
|
16
|
-
Exit,
|
|
17
|
-
Cause,
|
|
18
|
-
Runtime,
|
|
19
64
|
FiberRef,
|
|
20
65
|
FiberRefs,
|
|
21
66
|
FiberRefsPatch,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
MetricState,
|
|
25
|
-
Request,
|
|
26
|
-
Tracer,
|
|
27
|
-
Context,
|
|
28
|
-
Data,
|
|
29
|
-
Either,
|
|
30
|
-
Brand,
|
|
67
|
+
FiberSet,
|
|
68
|
+
GlobalValue,
|
|
31
69
|
Hash,
|
|
32
|
-
Equal,
|
|
33
|
-
Chunk,
|
|
34
|
-
Duration,
|
|
35
|
-
Array as ReadonlyArray,
|
|
36
|
-
Record as ReadonlyRecord,
|
|
37
|
-
SortedMap,
|
|
38
70
|
HashMap,
|
|
39
71
|
HashSet,
|
|
72
|
+
Inspectable,
|
|
73
|
+
identity,
|
|
74
|
+
Layer,
|
|
75
|
+
List,
|
|
76
|
+
LogLevel,
|
|
77
|
+
LogSpan,
|
|
78
|
+
Mailbox,
|
|
40
79
|
ManagedRuntime,
|
|
41
|
-
|
|
80
|
+
Match,
|
|
81
|
+
Metric,
|
|
82
|
+
MetricState,
|
|
42
83
|
MutableHashMap,
|
|
43
|
-
|
|
84
|
+
MutableHashSet,
|
|
44
85
|
Option,
|
|
45
|
-
|
|
46
|
-
// Logger,
|
|
47
|
-
Config,
|
|
48
|
-
Layer,
|
|
49
|
-
STM,
|
|
50
|
-
TRef,
|
|
51
|
-
Channel,
|
|
86
|
+
ParseResult,
|
|
52
87
|
Predicate,
|
|
88
|
+
Pretty,
|
|
89
|
+
PrimaryKey,
|
|
90
|
+
PubSub,
|
|
53
91
|
// Subscribable,
|
|
54
92
|
pipe,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
93
|
+
Queue,
|
|
94
|
+
Record as ReadonlyRecord,
|
|
95
|
+
Ref,
|
|
96
|
+
Request,
|
|
97
|
+
Runtime,
|
|
98
|
+
RuntimeFlags,
|
|
99
|
+
Scope,
|
|
100
|
+
SortedMap,
|
|
101
|
+
STM,
|
|
102
|
+
SynchronizedRef,
|
|
58
103
|
TestServices,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
104
|
+
TQueue,
|
|
105
|
+
TRef,
|
|
106
|
+
Tracer,
|
|
62
107
|
Types,
|
|
63
|
-
Cache,
|
|
64
108
|
} from 'effect'
|
|
65
|
-
|
|
66
|
-
export * as StandardSchema from '@standard-schema/spec'
|
|
67
|
-
|
|
68
109
|
export { dual } from 'effect/Function'
|
|
69
|
-
|
|
70
|
-
export * as Stream from './Stream.js'
|
|
71
|
-
|
|
72
|
-
export * as BucketQueue from './BucketQueue.js'
|
|
73
|
-
|
|
74
|
-
export * as SubscriptionRef from './SubscriptionRef.js'
|
|
75
|
-
export * as Subscribable from './Subscribable.js'
|
|
76
|
-
|
|
77
|
-
export * as Logger from './Logger.js'
|
|
78
|
-
|
|
79
|
-
export * as WebChannel from './WebChannel/mod.js'
|
|
80
|
-
export * as WebSocket from './WebSocket.js'
|
|
81
|
-
|
|
82
|
-
export * as SchemaAST from 'effect/SchemaAST'
|
|
83
110
|
export { TreeFormatter } from 'effect/ParseResult'
|
|
84
|
-
export { ParseResult, Pretty } from 'effect'
|
|
85
111
|
export type { Serializable, SerializableWithResult } from 'effect/Schema'
|
|
86
|
-
export * as Schema from './Schema/index.js'
|
|
87
|
-
export * as OtelTracer from '@effect/opentelemetry/Tracer'
|
|
88
|
-
export * as TaskTracing from './TaskTracing.js'
|
|
89
|
-
|
|
90
|
-
export {
|
|
91
|
-
Rpc,
|
|
92
|
-
RpcGroup,
|
|
93
|
-
RpcClient,
|
|
94
|
-
RpcMessage,
|
|
95
|
-
RpcSchema,
|
|
96
|
-
RpcMiddleware,
|
|
97
|
-
RpcServer,
|
|
98
|
-
RpcSerialization,
|
|
99
|
-
RpcTest,
|
|
100
|
-
RpcWorker,
|
|
101
|
-
} from '@effect/rpc'
|
|
102
112
|
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
HttpClientRequest,
|
|
114
|
-
HttpClientResponse,
|
|
115
|
-
FetchHttpClient,
|
|
116
|
-
Socket,
|
|
117
|
-
UrlParams,
|
|
118
|
-
HttpServerRequest,
|
|
119
|
-
Headers,
|
|
120
|
-
HttpMiddleware,
|
|
121
|
-
HttpRouter,
|
|
122
|
-
HttpServerResponse,
|
|
123
|
-
Command,
|
|
124
|
-
CommandExecutor,
|
|
125
|
-
KeyValueStore,
|
|
126
|
-
Error as PlatformError,
|
|
127
|
-
} from '@effect/platform'
|
|
128
|
-
export { BrowserWorker, BrowserWorkerRunner } from '@effect/platform-browser'
|
|
113
|
+
export * as SchemaAST from 'effect/SchemaAST'
|
|
114
|
+
export * as BucketQueue from './BucketQueue.ts'
|
|
115
|
+
export * as Logger from './Logger.ts'
|
|
116
|
+
export * as Schema from './Schema/index.ts'
|
|
117
|
+
export * as Stream from './Stream.ts'
|
|
118
|
+
export * as Subscribable from './Subscribable.ts'
|
|
119
|
+
export * as SubscriptionRef from './SubscriptionRef.ts'
|
|
120
|
+
export * as TaskTracing from './TaskTracing.ts'
|
|
121
|
+
export * as WebChannel from './WebChannel/mod.ts'
|
|
122
|
+
export * as WebSocket from './WebSocket.ts'
|
|
129
123
|
|
|
130
124
|
// export { DevTools as EffectDevtools } from '@effect/experimental'
|
|
131
125
|
|
|
132
|
-
export * as Effect from './Effect.
|
|
133
|
-
export *
|
|
134
|
-
export * as
|
|
135
|
-
export * from './
|
|
136
|
-
export * as ServiceContext from './ServiceContext.
|
|
137
|
-
export * as WebLock from './WebLock.
|
|
126
|
+
export * as Effect from './Effect.ts'
|
|
127
|
+
export * from './Error.ts'
|
|
128
|
+
export * as Schedule from './Schedule.ts'
|
|
129
|
+
export * as Scheduler from './Scheduler.ts'
|
|
130
|
+
export * as ServiceContext from './ServiceContext.ts'
|
|
131
|
+
export * as WebLock from './WebLock.ts'
|
package/src/env.ts
CHANGED
package/src/fast-deep-equal.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/* eslint-disable no-var */
|
|
2
|
-
|
|
3
1
|
// Copied from fast-deep-equal
|
|
4
2
|
// MIT License
|
|
5
3
|
|
|
6
4
|
export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
7
5
|
if (a === b) return true
|
|
8
6
|
|
|
9
|
-
if (a && b && typeof a
|
|
7
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
10
8
|
if (a.constructor !== b.constructor) return false
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
let length: number
|
|
11
|
+
let i: any
|
|
12
|
+
let keys: any
|
|
13
13
|
if (Array.isArray(a)) {
|
|
14
14
|
length = a.length
|
|
15
15
|
// @ts-expect-error ...
|
|
16
|
-
if (length
|
|
16
|
+
if (length !== b.length) return false
|
|
17
17
|
for (i = length; i-- !== 0; )
|
|
18
18
|
// @ts-expect-error ...
|
|
19
19
|
if (!deepEqual(a[i], b[i])) return false
|
|
@@ -37,7 +37,7 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
37
37
|
// @ts-expect-error ...
|
|
38
38
|
length = a.length
|
|
39
39
|
// @ts-expect-error ...
|
|
40
|
-
if (length
|
|
40
|
+
if (length !== b.length) return false
|
|
41
41
|
for (i = length; i-- !== 0; )
|
|
42
42
|
// @ts-expect-error ...
|
|
43
43
|
if (a[i] !== b[i]) return false
|
|
@@ -53,12 +53,10 @@ 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; )
|
|
57
|
-
// @ts-expect-error ...
|
|
58
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false
|
|
56
|
+
for (i = length; i-- !== 0; ) if (!Object.hasOwn(b, keys[i])) return false
|
|
59
57
|
|
|
60
58
|
for (i = length; i-- !== 0; ) {
|
|
61
|
-
|
|
59
|
+
const key = keys[i]
|
|
62
60
|
|
|
63
61
|
// @ts-expect-error ...
|
|
64
62
|
if (!deepEqual(a[key], b[key])) return false
|
|
@@ -68,5 +66,6 @@ export const deepEqual = <T>(a: T, b: T): boolean => {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
// true if both NaN, false otherwise
|
|
69
|
+
// biome-ignore lint/suspicious/noSelfCompare: comparing to itself is fine here
|
|
71
70
|
return a !== a && b !== b
|
|
72
71
|
}
|