@typed/fx 1.27.3 → 1.28.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/cjs/AsyncData.js +1 -1
- package/dist/cjs/AsyncData.js.map +1 -1
- package/dist/cjs/Emitter.js +3 -3
- package/dist/cjs/Emitter.js.map +1 -1
- package/dist/cjs/Form.js +15 -15
- package/dist/cjs/Form.js.map +1 -1
- package/dist/cjs/FormEntry.js +3 -3
- package/dist/cjs/FormEntry.js.map +1 -1
- package/dist/cjs/Fx.js +11 -9
- package/dist/cjs/Fx.js.map +1 -1
- package/dist/cjs/Idle.js +8 -8
- package/dist/cjs/Idle.js.map +1 -1
- package/dist/cjs/Match.js +17 -17
- package/dist/cjs/Match.js.map +1 -1
- package/dist/cjs/Pull.js +3 -3
- package/dist/cjs/Pull.js.map +1 -1
- package/dist/cjs/Push.js +1 -1
- package/dist/cjs/Push.js.map +1 -1
- package/dist/cjs/RefArray.js +2 -2
- package/dist/cjs/RefArray.js.map +1 -1
- package/dist/cjs/RefChunk.js +1 -1
- package/dist/cjs/RefChunk.js.map +1 -1
- package/dist/cjs/RefHashMap.js +1 -1
- package/dist/cjs/RefHashMap.js.map +1 -1
- package/dist/cjs/RefHashSet.js +1 -1
- package/dist/cjs/RefHashSet.js.map +1 -1
- package/dist/cjs/RefSubject.js +150 -75
- package/dist/cjs/RefSubject.js.map +1 -1
- package/dist/cjs/Sink.js +14 -14
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +1 -1
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Subject.js +27 -22
- package/dist/cjs/Subject.js.map +1 -1
- package/dist/cjs/Typeclass.js +1 -1
- package/dist/cjs/Typeclass.js.map +1 -1
- package/dist/cjs/Versioned.js +4 -4
- package/dist/cjs/Versioned.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/DeferredRef.js +14 -11
- package/dist/cjs/internal/DeferredRef.js.map +1 -1
- package/dist/cjs/internal/core.js +71 -42
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/diff.js +1 -1
- package/dist/cjs/internal/diff.js.map +1 -1
- package/dist/cjs/internal/effect-loop-operator.js +1 -1
- package/dist/cjs/internal/effect-loop-operator.js.map +1 -1
- package/dist/cjs/internal/effect-operator.js +3 -3
- package/dist/cjs/internal/effect-operator.js.map +1 -1
- package/dist/cjs/internal/effect-producer.js +3 -3
- package/dist/cjs/internal/effect-producer.js.map +1 -1
- package/dist/cjs/internal/helpers.js +63 -42
- package/dist/cjs/internal/helpers.js.map +1 -1
- package/dist/cjs/internal/keyed.js +34 -26
- package/dist/cjs/internal/keyed.js.map +1 -1
- package/dist/cjs/internal/loop-operator.js +1 -1
- package/dist/cjs/internal/loop-operator.js.map +1 -1
- package/dist/cjs/internal/operator.js +1 -1
- package/dist/cjs/internal/operator.js.map +1 -1
- package/dist/cjs/internal/protos.js +1 -1
- package/dist/cjs/internal/protos.js.map +1 -1
- package/dist/cjs/internal/provide.js +1 -1
- package/dist/cjs/internal/provide.js.map +1 -1
- package/dist/cjs/internal/share.js +8 -13
- package/dist/cjs/internal/share.js.map +1 -1
- package/dist/cjs/internal/sync-operator.js +4 -4
- package/dist/cjs/internal/sync-operator.js.map +1 -1
- package/dist/cjs/internal/sync-producer.js +27 -23
- package/dist/cjs/internal/sync-producer.js.map +1 -1
- package/dist/cjs/internal/withKey.js +7 -7
- package/dist/cjs/internal/withKey.js.map +1 -1
- package/dist/dts/AsyncData.d.ts +2 -2
- package/dist/dts/AsyncData.d.ts.map +1 -1
- package/dist/dts/Emitter.d.ts +1 -1
- package/dist/dts/Emitter.d.ts.map +1 -1
- package/dist/dts/Fx.d.ts +39 -13
- package/dist/dts/Fx.d.ts.map +1 -1
- package/dist/dts/Idle.d.ts.map +1 -1
- package/dist/dts/Match.d.ts +1 -1
- package/dist/dts/Match.d.ts.map +1 -1
- package/dist/dts/Push.d.ts +4 -1
- package/dist/dts/Push.d.ts.map +1 -1
- package/dist/dts/RefArray.d.ts +1 -2
- package/dist/dts/RefArray.d.ts.map +1 -1
- package/dist/dts/RefChunk.d.ts.map +1 -1
- package/dist/dts/RefHashMap.d.ts +1 -1
- package/dist/dts/RefHashMap.d.ts.map +1 -1
- package/dist/dts/RefHashSet.d.ts.map +1 -1
- package/dist/dts/RefSubject.d.ts +64 -3
- package/dist/dts/RefSubject.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +2 -1
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Subject.d.ts +2 -1
- package/dist/dts/Subject.d.ts.map +1 -1
- package/dist/dts/Versioned.d.ts +3 -1
- package/dist/dts/Versioned.d.ts.map +1 -1
- package/dist/dts/internal/DeferredRef.d.ts +6 -4
- package/dist/dts/internal/DeferredRef.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts +25 -12
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/diff.d.ts +1 -1
- package/dist/dts/internal/diff.d.ts.map +1 -1
- package/dist/dts/internal/effect-operator.d.ts.map +1 -1
- package/dist/dts/internal/helpers.d.ts +8 -6
- package/dist/dts/internal/helpers.d.ts.map +1 -1
- package/dist/dts/internal/keyed.d.ts +2 -2
- package/dist/dts/internal/keyed.d.ts.map +1 -1
- package/dist/dts/internal/loop-operator.d.ts +1 -1
- package/dist/dts/internal/loop-operator.d.ts.map +1 -1
- package/dist/dts/internal/protos.d.ts +1 -1
- package/dist/dts/internal/protos.d.ts.map +1 -1
- package/dist/dts/internal/provide.d.ts.map +1 -1
- package/dist/dts/internal/share.d.ts +1 -1
- package/dist/dts/internal/share.d.ts.map +1 -1
- package/dist/dts/internal/strategies.d.ts.map +1 -1
- package/dist/dts/internal/sync-operator.d.ts.map +1 -1
- package/dist/dts/internal/sync-producer.d.ts +4 -4
- package/dist/dts/internal/sync-producer.d.ts.map +1 -1
- package/dist/esm/Emitter.js +1 -1
- package/dist/esm/Emitter.js.map +1 -1
- package/dist/esm/Form.js +14 -14
- package/dist/esm/Form.js.map +1 -1
- package/dist/esm/FormEntry.js +2 -2
- package/dist/esm/FormEntry.js.map +1 -1
- package/dist/esm/Fx.js +16 -5
- package/dist/esm/Fx.js.map +1 -1
- package/dist/esm/Idle.js +7 -7
- package/dist/esm/Idle.js.map +1 -1
- package/dist/esm/Match.js +17 -17
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Pull.js +2 -2
- package/dist/esm/Push.js.map +1 -1
- package/dist/esm/RefArray.js +1 -1
- package/dist/esm/RefArray.js.map +1 -1
- package/dist/esm/RefHashMap.js.map +1 -1
- package/dist/esm/RefSubject.js +140 -59
- package/dist/esm/RefSubject.js.map +1 -1
- package/dist/esm/Sink.js +13 -13
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Subject.js +29 -20
- package/dist/esm/Subject.js.map +1 -1
- package/dist/esm/Versioned.js +1 -1
- package/dist/esm/Versioned.js.map +1 -1
- package/dist/esm/internal/DeferredRef.js +13 -10
- package/dist/esm/internal/DeferredRef.js.map +1 -1
- package/dist/esm/internal/core.js +70 -37
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/diff.js.map +1 -1
- package/dist/esm/internal/effect-operator.js +2 -2
- package/dist/esm/internal/effect-producer.js +1 -1
- package/dist/esm/internal/helpers.js +62 -39
- package/dist/esm/internal/helpers.js.map +1 -1
- package/dist/esm/internal/keyed.js +26 -17
- package/dist/esm/internal/keyed.js.map +1 -1
- package/dist/esm/internal/share.js +7 -12
- package/dist/esm/internal/share.js.map +1 -1
- package/dist/esm/internal/sync-operator.js +3 -3
- package/dist/esm/internal/sync-operator.js.map +1 -1
- package/dist/esm/internal/sync-producer.js +7 -5
- package/dist/esm/internal/sync-producer.js.map +1 -1
- package/dist/esm/internal/withKey.js +6 -6
- package/dist/esm/internal/withKey.js.map +1 -1
- package/package.json +8 -7
- package/src/Emitter.ts +2 -1
- package/src/Form.ts +22 -30
- package/src/FormEntry.ts +2 -2
- package/src/Fx.ts +54 -36
- package/src/Idle.ts +7 -7
- package/src/Match.ts +24 -26
- package/src/Pull.ts +2 -2
- package/src/Push.ts +4 -1
- package/src/RefArray.ts +1 -1
- package/src/RefHashMap.ts +1 -1
- package/src/RefSubject.ts +262 -98
- package/src/Sink.ts +15 -14
- package/src/Subject.ts +55 -39
- package/src/Versioned.ts +4 -2
- package/src/internal/DeferredRef.ts +21 -11
- package/src/internal/core.ts +92 -61
- package/src/internal/diff.ts +1 -1
- package/src/internal/effect-operator.ts +2 -2
- package/src/internal/effect-producer.ts +3 -3
- package/src/internal/helpers.ts +89 -42
- package/src/internal/keyed.ts +47 -42
- package/src/internal/loop-operator.ts +1 -1
- package/src/internal/protos.ts +1 -1
- package/src/internal/share.ts +11 -26
- package/src/internal/sync-operator.ts +3 -3
- package/src/internal/sync-producer.ts +7 -5
- package/src/internal/withKey.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefHashMap.js","sourceRoot":"","sources":["../../src/RefHashMap.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"RefHashMap.js","sourceRoot":"","sources":["../../src/RefHashMap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAIzC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAuB7C,MAAM,UAAU,IAAI,CAClB,OAAwF;IAExF,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAMf,GAAS,EAAE,CAAC,UAAU,CAAC,MAAM,EAAyB,CAAA;AAE1D;;;;GAIG;A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AAI,CAAC,CAAC,EAAE,SAAS,GAAG,CAAa,UAAkC,EAAE,GAAM;IAC7E,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3D,CAAC,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAGhB,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,CAAa,UAAkC,EAAE,GAAM;IAC7E,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3D,CAAC,CAAC,CAAA"}
|
package/dist/esm/RefSubject.js
CHANGED
|
@@ -3,30 +3,36 @@
|
|
|
3
3
|
* @since 1.20.0
|
|
4
4
|
*/
|
|
5
5
|
import * as C from "@typed/context";
|
|
6
|
-
import
|
|
6
|
+
import * as Array from "effect/Array";
|
|
7
7
|
import * as Boolean from "effect/Boolean";
|
|
8
8
|
import * as Cause from "effect/Cause";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as Equal from "effect/Equal";
|
|
11
10
|
import * as ExecutionStrategy from "effect/ExecutionStrategy";
|
|
12
11
|
import * as Exit from "effect/Exit";
|
|
12
|
+
import * as Fiber from "effect/Fiber";
|
|
13
13
|
import { dual, identity } from "effect/Function";
|
|
14
14
|
import * as Layer from "effect/Layer";
|
|
15
|
+
import * as MutableRef from "effect/MutableRef";
|
|
15
16
|
import { sum } from "effect/Number";
|
|
16
17
|
import * as Option from "effect/Option";
|
|
17
|
-
import * as ReadonlyArray from "effect/ReadonlyArray";
|
|
18
18
|
import * as Scope from "effect/Scope";
|
|
19
|
-
import * as
|
|
19
|
+
import * as Unify from "effect/Unify";
|
|
20
|
+
import * as internal from "./internal/core.js";
|
|
20
21
|
import * as DeferredRef from "./internal/DeferredRef.js";
|
|
21
22
|
import { getExitEquivalence, matchEffectPrimitive, withScope } from "./internal/helpers.js";
|
|
22
23
|
import { FxEffectBase } from "./internal/protos.js";
|
|
23
24
|
import { runtimeToLayer } from "./internal/provide.js";
|
|
24
|
-
import
|
|
25
|
+
import { hold } from "./internal/share.js";
|
|
25
26
|
import * as Sink from "./Sink.js";
|
|
26
27
|
import * as Subject from "./Subject.js";
|
|
27
28
|
import { ComputedTypeId, FilteredTypeId, RefSubjectTypeId, TypeId } from "./TypeId.js";
|
|
28
29
|
import * as Versioned from "./Versioned.js";
|
|
29
30
|
const UNBOUNDED = { concurrency: "unbounded" };
|
|
31
|
+
// TODO: Kind of a Hack, but I don't really want to pollute the public API with this. What should we do with this?
|
|
32
|
+
const CURRENT_ENVIRONMENT_TAG = C.Tagged("@typed/environment/CurrentEnvironment");
|
|
33
|
+
const checkIsDOM = (ctx) => C.getOption(ctx, CURRENT_ENVIRONMENT_TAG).pipe(Option.map((s) => s === "dom" || s === "test:dom"),
|
|
34
|
+
// Default behavior should allow multiple updates via Fx interface
|
|
35
|
+
Option.getOrElse(() => true));
|
|
30
36
|
/**
|
|
31
37
|
* @since 1.20.0
|
|
32
38
|
*/
|
|
@@ -37,13 +43,13 @@ export function fromEffect(effect, options) {
|
|
|
37
43
|
* @since 1.20.0
|
|
38
44
|
*/
|
|
39
45
|
export function fromFx(fx, options) {
|
|
40
|
-
return DeferredRef.make(getExitEquivalence(options?.eq ??
|
|
46
|
+
return DeferredRef.make(getExitEquivalence(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({ deferredRef }) => makeCore(deferredRef, options)), Effect.tap(({ core, deferredRef }) => Effect.forkIn(fx.run(Sink.make((cause) => Effect.flatMap(Effect.sync(() => deferredRef.done(Exit.failCause(cause))), () => core.subject.onFailure(cause)), (value) => Effect.flatMap(Effect.sync(() => deferredRef.done(Exit.succeed(value))), () => setCore(core, value)))), core.scope)), Effect.map(({ core }) => new RefSubjectImpl(core)));
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
49
|
* @since 1.20.0
|
|
44
50
|
*/
|
|
45
51
|
export function fromRefSubject(ref, options) {
|
|
46
|
-
return DeferredRef.make(getExitEquivalence(options?.eq ??
|
|
52
|
+
return DeferredRef.make(getExitEquivalence(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({ deferredRef }) => makeCore(deferredRef, options)), Effect.tap(({ core, deferredRef }) => Effect.forkIn(ref.run(Sink.make((cause) => Effect.sync(() => deferredRef.done(Exit.failCause(cause))), (value) => Effect.sync(() => deferredRef.done(Exit.succeed(value))))), core.scope)), Effect.map(({ core }) => new DerivedImpl(core, persistCore(ref, core))));
|
|
47
53
|
}
|
|
48
54
|
function persistCore(ref, core) {
|
|
49
55
|
// Log any errors that fail to persist, but don't fail the consumer
|
|
@@ -80,13 +86,19 @@ export function unsafeMake(params) {
|
|
|
80
86
|
const { id, initial, options, scope } = params;
|
|
81
87
|
return Effect.flatMap(Effect.runtime(), (runtime) => {
|
|
82
88
|
const core = unsafeMakeCore(initial, id, runtime, scope, options);
|
|
89
|
+
const current = MutableRef.get(core.deferredRef.current);
|
|
83
90
|
// Sometimes we might be instantiating directly from a known value
|
|
84
91
|
// Here we seed the value and ensure the subject has it as well for re-broadcasting
|
|
85
|
-
if ("initialValue" in params) {
|
|
92
|
+
if ("initialValue" in params && Option.isNone(current)) {
|
|
86
93
|
core.deferredRef.done(Exit.succeed(params.initialValue));
|
|
87
94
|
return Effect.map(core.subject.onSuccess(params.initialValue), () => new RefSubjectImpl(core));
|
|
88
95
|
}
|
|
89
|
-
|
|
96
|
+
else if (Option.isSome(current)) {
|
|
97
|
+
return Effect.map(Effect.matchCauseEffect(current.value, core.subject), () => new RefSubjectImpl(core));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return Effect.succeed(new RefSubjectImpl(core));
|
|
101
|
+
}
|
|
90
102
|
});
|
|
91
103
|
}
|
|
92
104
|
class RefSubjectImpl extends FxEffectBase {
|
|
@@ -117,7 +129,7 @@ class RefSubjectImpl extends FxEffectBase {
|
|
|
117
129
|
runUpdates(run) {
|
|
118
130
|
return this.core.semaphore.withPermits(1)(run(this.getSetDelete));
|
|
119
131
|
}
|
|
120
|
-
unsafeGet = () => Option.getOrThrowWith(this.core.deferredRef.current, () => new Cause.NoSuchElementException());
|
|
132
|
+
unsafeGet = () => Option.getOrThrowWith(MutableRef.get(this.core.deferredRef.current), () => new Cause.NoSuchElementException());
|
|
121
133
|
onSuccess(value) {
|
|
122
134
|
return setCore(this.core, value);
|
|
123
135
|
}
|
|
@@ -197,12 +209,12 @@ export const runUpdates = dual(isRefSubjectDataFirst, function runUpdates(ref, f
|
|
|
197
209
|
else if (options.value === "initial") {
|
|
198
210
|
return ref.runUpdates((ref) => Effect.uninterruptibleMask((restore) => Effect.flatMap(ref.get, (initial) => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify((cause) => Cause.isInterruptedOnly(cause)
|
|
199
211
|
? options.onInterrupt(initial)
|
|
200
|
-
: Effect.
|
|
212
|
+
: Effect.void))))));
|
|
201
213
|
}
|
|
202
214
|
else {
|
|
203
215
|
return ref.runUpdates((ref) => Effect.uninterruptibleMask((restore) => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify((cause) => Cause.isInterruptedOnly(cause)
|
|
204
216
|
? Effect.flatMap(ref.get, options.onInterrupt)
|
|
205
|
-
: Effect.
|
|
217
|
+
: Effect.void)))));
|
|
206
218
|
}
|
|
207
219
|
});
|
|
208
220
|
class RefSubjectCore {
|
|
@@ -223,14 +235,30 @@ class RefSubjectCore {
|
|
|
223
235
|
_fiber = undefined;
|
|
224
236
|
}
|
|
225
237
|
function makeCore(initial, options) {
|
|
226
|
-
return Effect.runtime().pipe(Effect.bindTo("runtime"), Effect.let("executionStrategy", () => options?.executionStrategy ?? ExecutionStrategy.parallel), Effect.bind("scope", ({ executionStrategy, runtime }) => Scope.fork(C.get(runtime.context, Scope.Scope), executionStrategy)), Effect.bind("
|
|
238
|
+
return Effect.runtime().pipe(Effect.bindTo("runtime"), Effect.let("executionStrategy", () => options?.executionStrategy ?? ExecutionStrategy.parallel), Effect.bind("scope", ({ executionStrategy, runtime }) => Scope.fork(C.get(runtime.context, Scope.Scope), executionStrategy)), Effect.bind("id", () => Effect.fiberId), Effect.map(({ id, runtime, scope }) => unsafeMakeCore(initial, id, runtime, scope, options)), Effect.tap((core) => Scope.addFinalizer(core.scope, Effect.provide(core.subject.interrupt, core.runtime.context))));
|
|
227
239
|
}
|
|
228
240
|
function unsafeMakeCore(initial, id, runtime, scope, options) {
|
|
229
|
-
|
|
241
|
+
const subject = new Subject.HoldSubjectImpl();
|
|
242
|
+
const core = new RefSubjectCore(initial, subject, runtime, scope, DeferredRef.unsafeMake(id, getExitEquivalence(options?.eq ?? internal.deepEquals), subject.lastValue), Effect.unsafeMakeSemaphore(1));
|
|
243
|
+
const onSuccess = (a) => core.deferredRef.done(Exit.succeed(a));
|
|
244
|
+
const onCause = (cause) => core.deferredRef.done(Exit.failCause(cause));
|
|
245
|
+
const onError = (e) => onCause(Cause.fail(e));
|
|
246
|
+
// Initialize the core with the initial value if it is synchronous
|
|
247
|
+
matchEffectPrimitive(initial, {
|
|
248
|
+
Success: onSuccess,
|
|
249
|
+
Failure: onCause,
|
|
250
|
+
Some: onSuccess,
|
|
251
|
+
None: onError,
|
|
252
|
+
Left: onError,
|
|
253
|
+
Right: onSuccess,
|
|
254
|
+
Sync: (f) => onSuccess(f()),
|
|
255
|
+
Otherwise: () => false
|
|
256
|
+
});
|
|
257
|
+
return core;
|
|
230
258
|
}
|
|
231
259
|
function getOrInitializeCore(core, lockInitialize) {
|
|
232
260
|
return Effect.suspend(() => {
|
|
233
|
-
if (core._fiber === undefined && Option.isNone(core.deferredRef.current)) {
|
|
261
|
+
if (core._fiber === undefined && Option.isNone(MutableRef.get(core.deferredRef.current))) {
|
|
234
262
|
return initializeCoreAndTap(core, lockInitialize);
|
|
235
263
|
}
|
|
236
264
|
else {
|
|
@@ -243,7 +271,7 @@ function initializeCoreEffect(core, lock) {
|
|
|
243
271
|
core._fiber = undefined;
|
|
244
272
|
core.deferredRef.done(exit);
|
|
245
273
|
}));
|
|
246
|
-
return Effect.flatMap(Effect.forkIn(lock
|
|
274
|
+
return Effect.flatMap(Effect.forkIn(lock ? core.semaphore.withPermits(1)(initialize) : initialize, core.scope), (fiber) => Effect.sync(() => core._fiber = fiber));
|
|
247
275
|
}
|
|
248
276
|
function initializeCore(core, lock) {
|
|
249
277
|
const onSuccess = (a) => {
|
|
@@ -262,7 +290,7 @@ function initializeCore(core, lock) {
|
|
|
262
290
|
None: onError,
|
|
263
291
|
Left: onError,
|
|
264
292
|
Right: onSuccess,
|
|
265
|
-
Sync: (f) => onSuccess(f()),
|
|
293
|
+
Sync: (f) => Effect.suspend(() => onSuccess(f())),
|
|
266
294
|
Otherwise: () => initializeCoreEffect(core, lock)
|
|
267
295
|
});
|
|
268
296
|
}
|
|
@@ -289,7 +317,7 @@ function onFailureCore(core, cause) {
|
|
|
289
317
|
return sendEvent(core, exit);
|
|
290
318
|
}
|
|
291
319
|
else {
|
|
292
|
-
return Effect.
|
|
320
|
+
return Effect.void;
|
|
293
321
|
}
|
|
294
322
|
});
|
|
295
323
|
}
|
|
@@ -297,19 +325,19 @@ function interruptCore(core) {
|
|
|
297
325
|
return Effect.fiberIdWith((id) => {
|
|
298
326
|
core.deferredRef.reset();
|
|
299
327
|
const closeScope = Scope.close(core.scope, Exit.interrupt(id));
|
|
300
|
-
const interruptFiber = core._fiber ? Fiber.interrupt(core._fiber) : Effect.
|
|
328
|
+
const interruptFiber = core._fiber ? Fiber.interrupt(core._fiber) : Effect.void;
|
|
301
329
|
const interruptSubject = core.subject.interrupt;
|
|
302
330
|
return Effect.all([closeScope, interruptFiber, interruptSubject], { discard: true });
|
|
303
331
|
});
|
|
304
332
|
}
|
|
305
333
|
function deleteCore(core) {
|
|
306
334
|
return Effect.suspend(() => {
|
|
307
|
-
const current = core.deferredRef.current;
|
|
335
|
+
const current = MutableRef.get(core.deferredRef.current);
|
|
308
336
|
core.deferredRef.reset();
|
|
309
337
|
if (Option.isNone(current)) {
|
|
310
338
|
return Effect.succeed(Option.none());
|
|
311
339
|
}
|
|
312
|
-
return core.subject.subscriberCount.pipe(Effect.provide(core.runtime.context), Effect.flatMap((count) => count > 0 && !core._fiber ? initializeCore(core, false) : Effect.
|
|
340
|
+
return core.subject.subscriberCount.pipe(Effect.provide(core.runtime.context), Effect.flatMap((count) => count > 0 && !core._fiber ? initializeCore(core, false) : Effect.void), Effect.zipRight(Effect.asSome(current.value)));
|
|
313
341
|
});
|
|
314
342
|
}
|
|
315
343
|
function tapEventCore(core, effect) {
|
|
@@ -371,10 +399,20 @@ class ComputedImpl extends Versioned.VersionedTransform {
|
|
|
371
399
|
input;
|
|
372
400
|
f;
|
|
373
401
|
[ComputedTypeId] = ComputedTypeId;
|
|
402
|
+
_computed;
|
|
374
403
|
constructor(input, f) {
|
|
375
|
-
super(input, (fx) =>
|
|
404
|
+
super(input, (fx) => internal.mapEffect(fx, f), Effect.flatMap(f));
|
|
376
405
|
this.input = input;
|
|
377
406
|
this.f = f;
|
|
407
|
+
this._computed = hold(internal.fromFxEffect(Effect.contextWith((ctx) => {
|
|
408
|
+
if (checkIsDOM(ctx)) {
|
|
409
|
+
return internal.fromEffect(input).pipe((_) => internal.continueWith(_, () => input), internal.skipRepeats, (_) => internal.mapEffect(_, f), internal.skipRepeats);
|
|
410
|
+
}
|
|
411
|
+
return internal.fromEffect(Effect.flatMap(input, f));
|
|
412
|
+
})));
|
|
413
|
+
}
|
|
414
|
+
run(sink) {
|
|
415
|
+
return this._computed.run(sink);
|
|
378
416
|
}
|
|
379
417
|
unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
|
|
380
418
|
static make(input, f) {
|
|
@@ -385,10 +423,17 @@ class FilteredImpl extends Versioned.VersionedTransform {
|
|
|
385
423
|
input;
|
|
386
424
|
f;
|
|
387
425
|
[FilteredTypeId] = FilteredTypeId;
|
|
426
|
+
_filtered;
|
|
388
427
|
constructor(input, f) {
|
|
389
|
-
super(input, (fx) =>
|
|
428
|
+
super(input, (fx) => internal.filterMapEffect(fx, f), (effect) => Effect.flatten(Effect.flatMap(effect, f)));
|
|
390
429
|
this.input = input;
|
|
391
430
|
this.f = f;
|
|
431
|
+
this._filtered = hold(internal.fromFxEffect(Effect.contextWith((ctx) => {
|
|
432
|
+
if (checkIsDOM(ctx)) {
|
|
433
|
+
return internal.fromEffect(input).pipe((_) => internal.continueWith(_, () => input), internal.skipRepeats, (_) => internal.filterMapEffect(_, f), internal.skipRepeats);
|
|
434
|
+
}
|
|
435
|
+
return Effect.flatMap(input, f).pipe(internal.fromEffect, (_) => internal.filterMap(_, identity));
|
|
436
|
+
})));
|
|
392
437
|
}
|
|
393
438
|
static make(input, f) {
|
|
394
439
|
return new FilteredImpl(input, f);
|
|
@@ -396,13 +441,16 @@ class FilteredImpl extends Versioned.VersionedTransform {
|
|
|
396
441
|
asComputed() {
|
|
397
442
|
return ComputedImpl.make(this.input, this.f);
|
|
398
443
|
}
|
|
444
|
+
run(sink) {
|
|
445
|
+
return this._filtered.run(sink);
|
|
446
|
+
}
|
|
399
447
|
unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
|
|
400
448
|
}
|
|
401
449
|
/**
|
|
402
450
|
* @since 1.20.0
|
|
403
451
|
*/
|
|
404
452
|
export const skipRepeatsWith = dual(2, function skipRepeatsWith(ref, eq) {
|
|
405
|
-
const versioned = Versioned.transform(ref, (fx) =>
|
|
453
|
+
const versioned = Versioned.transform(ref, (fx) => internal.skipRepeatsWith(fx, eq), identity);
|
|
406
454
|
if (FilteredTypeId in ref) {
|
|
407
455
|
return FilteredImpl.make(versioned, Effect.succeedSome);
|
|
408
456
|
}
|
|
@@ -411,7 +459,7 @@ export const skipRepeatsWith = dual(2, function skipRepeatsWith(ref, eq) {
|
|
|
411
459
|
}
|
|
412
460
|
});
|
|
413
461
|
export function skipRepeats(ref) {
|
|
414
|
-
return skipRepeatsWith(ref,
|
|
462
|
+
return skipRepeatsWith(ref, internal.deepEquals);
|
|
415
463
|
}
|
|
416
464
|
/**
|
|
417
465
|
* @since 1.20.0
|
|
@@ -488,7 +536,7 @@ class RefSubjectTransformEffect extends FxEffectBase {
|
|
|
488
536
|
this.subject = new Subject.HoldSubjectImpl();
|
|
489
537
|
}
|
|
490
538
|
run(sink) {
|
|
491
|
-
return
|
|
539
|
+
return internal.skipRepeats(internal.merge(internal.tapEffect(internal.mapEffect(this.ref, this.from), this.subject.onSuccess), this.subject)).run(sink);
|
|
492
540
|
}
|
|
493
541
|
runUpdates(run) {
|
|
494
542
|
return this.ref.runUpdates((ref) => run({
|
|
@@ -575,7 +623,7 @@ class RefSubjectTuple extends FxEffectBase {
|
|
|
575
623
|
this.versioned = Versioned.hold(Versioned.tuple(refs));
|
|
576
624
|
this.version = this.versioned.version;
|
|
577
625
|
this.interrupt = Effect.all(refs.map((r) => r.interrupt), UNBOUNDED);
|
|
578
|
-
this.subscriberCount = Effect.map(Effect.all(refs.map((r) => r.subscriberCount), UNBOUNDED),
|
|
626
|
+
this.subscriberCount = Effect.map(Effect.all(refs.map((r) => r.subscriberCount), UNBOUNDED), Array.reduce(0, sum));
|
|
579
627
|
this.getSetDelete = {
|
|
580
628
|
get: this.versioned,
|
|
581
629
|
set: (a) => Effect.all(refs.map((r, i) => set(r, a[i])), UNBOUNDED),
|
|
@@ -642,7 +690,7 @@ class RefSubjectStruct extends FxEffectBase {
|
|
|
642
690
|
this.versioned = Versioned.hold(Versioned.struct(refs));
|
|
643
691
|
this.version = this.versioned.version;
|
|
644
692
|
this.interrupt = Effect.all(Object.values(refs).map((r) => r.interrupt), UNBOUNDED);
|
|
645
|
-
this.subscriberCount = Effect.map(Effect.all(Object.values(refs).map((r) => r.subscriberCount), UNBOUNDED),
|
|
693
|
+
this.subscriberCount = Effect.map(Effect.all(Object.values(refs).map((r) => r.subscriberCount), UNBOUNDED), Array.reduce(0, sum));
|
|
646
694
|
this.getSetDelete = {
|
|
647
695
|
get: this.versioned,
|
|
648
696
|
set: (a) => Effect.all(Object.keys(refs).map((k) => set(refs[k], a[k])), UNBOUNDED),
|
|
@@ -722,7 +770,16 @@ class RefSubjectTagged extends FxEffectBase {
|
|
|
722
770
|
onSuccess(value) {
|
|
723
771
|
return this.tag.withEffect((ref) => ref.onSuccess(value));
|
|
724
772
|
}
|
|
725
|
-
|
|
773
|
+
layer = (make) => this.tag.scoped(make);
|
|
774
|
+
make = (fxOrEffect, options) => {
|
|
775
|
+
return this.tag.scoped(Effect.gen(function* (_) {
|
|
776
|
+
let ref = yield* make(fxOrEffect, options);
|
|
777
|
+
if (options?.drop || options?.take) {
|
|
778
|
+
ref = slice(ref, options.drop ?? 0, options.take ?? Infinity);
|
|
779
|
+
}
|
|
780
|
+
return ref;
|
|
781
|
+
}));
|
|
782
|
+
};
|
|
726
783
|
}
|
|
727
784
|
/**
|
|
728
785
|
* @since 1.20.0
|
|
@@ -745,7 +802,7 @@ class RefSubjectFromTag extends FxEffectBase {
|
|
|
745
802
|
this.tag = tag;
|
|
746
803
|
this.f = f;
|
|
747
804
|
this._get = Effect.map(tag, f);
|
|
748
|
-
this._fx =
|
|
805
|
+
this._fx = internal.fromFxEffect(this._get);
|
|
749
806
|
this.version = Effect.flatMap(this._get, (ref) => ref.version);
|
|
750
807
|
this.interrupt = Effect.flatMap(this._get, (ref) => ref.interrupt);
|
|
751
808
|
this.subscriberCount = Effect.flatMap(this._get, (ref) => ref.subscriberCount);
|
|
@@ -919,7 +976,7 @@ export const decrement = (ref) => update(ref, sub);
|
|
|
919
976
|
* @since 1.20.0
|
|
920
977
|
*/
|
|
921
978
|
export const slice = dual(3, function slice(ref, drop, take) {
|
|
922
|
-
return new
|
|
979
|
+
return new RefSubjectSimpleTransform(ref, (_) => internal.slice(_, drop, take), identity);
|
|
923
980
|
});
|
|
924
981
|
/**
|
|
925
982
|
* @since 1.20.0
|
|
@@ -933,32 +990,71 @@ export const drop = dual(2, function drop(ref, drop) {
|
|
|
933
990
|
export const take = dual(2, function take(ref, take) {
|
|
934
991
|
return slice(ref, 0, take);
|
|
935
992
|
});
|
|
936
|
-
|
|
993
|
+
/**
|
|
994
|
+
* Get the current value of the RefSubject. If it has not been set yet, a Fiber will be used to wait for the value to be set.
|
|
995
|
+
*
|
|
996
|
+
* @since 1.25.0
|
|
997
|
+
*/
|
|
998
|
+
export const get = (ref) => ref;
|
|
999
|
+
/**
|
|
1000
|
+
* Synchronously get the current Exit value of the RefSubject. If it has not been set yet, a Cause.NoSuchElementException will be thrown.
|
|
1001
|
+
*
|
|
1002
|
+
* Note: This is unimplemented for RefSubject.tagged and RefSubject.fromTag because they require the Effect context by definition.
|
|
1003
|
+
* It will throw immediately.
|
|
1004
|
+
*
|
|
1005
|
+
* @since 1.25.0
|
|
1006
|
+
*/
|
|
1007
|
+
export const unsafeGetExit = (ref) => ref.unsafeGet();
|
|
1008
|
+
/**
|
|
1009
|
+
* Synchronously get the current value of the RefSubject.
|
|
1010
|
+
*
|
|
1011
|
+
* @since 1.25.0
|
|
1012
|
+
*/
|
|
1013
|
+
export const unsafeGet = (ref) => Effect.runSync(unsafeGetExit(ref));
|
|
1014
|
+
/**
|
|
1015
|
+
* Extract all values from an object using a Proxy
|
|
1016
|
+
*
|
|
1017
|
+
* @since 2.0.0
|
|
1018
|
+
*/
|
|
1019
|
+
export const proxy = (source) => {
|
|
1020
|
+
const target = {};
|
|
1021
|
+
return new Proxy(target, {
|
|
1022
|
+
get(self, prop) {
|
|
1023
|
+
if (prop in self)
|
|
1024
|
+
return self[prop];
|
|
1025
|
+
return self[prop] = map(source, (a) => a[prop]);
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
/**
|
|
1030
|
+
* @since 2.0.0
|
|
1031
|
+
*/
|
|
1032
|
+
export const withSpan = dual(isRefSubjectDataFirst, (ref, name, options) => new RefSubjectSimpleTransform(ref, (fx) => internal.withSpan(fx, name, options), Effect.withSpan(name, options)));
|
|
1033
|
+
class RefSubjectSimpleTransform extends FxEffectBase {
|
|
937
1034
|
ref;
|
|
938
|
-
|
|
939
|
-
|
|
1035
|
+
transformFx;
|
|
1036
|
+
transformEffect;
|
|
940
1037
|
[ComputedTypeId] = ComputedTypeId;
|
|
941
1038
|
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
942
1039
|
version;
|
|
943
1040
|
interrupt;
|
|
944
1041
|
subscriberCount;
|
|
945
1042
|
_fx;
|
|
946
|
-
constructor(ref,
|
|
1043
|
+
constructor(ref, transformFx, transformEffect) {
|
|
947
1044
|
super();
|
|
948
1045
|
this.ref = ref;
|
|
949
|
-
this.
|
|
950
|
-
this.
|
|
1046
|
+
this.transformFx = transformFx;
|
|
1047
|
+
this.transformEffect = transformEffect;
|
|
951
1048
|
this.version = ref.version;
|
|
952
1049
|
this.interrupt = ref.interrupt;
|
|
953
1050
|
this.subscriberCount = ref.subscriberCount;
|
|
954
|
-
this._fx =
|
|
955
|
-
this._effect = ref;
|
|
1051
|
+
this._fx = transformFx(ref);
|
|
956
1052
|
}
|
|
957
1053
|
run(sink) {
|
|
958
1054
|
return this._fx.run(sink);
|
|
959
1055
|
}
|
|
960
1056
|
toEffect() {
|
|
961
|
-
return this.ref;
|
|
1057
|
+
return this.transformEffect(this.ref);
|
|
962
1058
|
}
|
|
963
1059
|
runUpdates(run) {
|
|
964
1060
|
return this.ref.runUpdates(run);
|
|
@@ -972,24 +1068,9 @@ class RefSubjectSlice extends FxEffectBase {
|
|
|
972
1068
|
}
|
|
973
1069
|
}
|
|
974
1070
|
/**
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
* @since 1.25.0
|
|
978
|
-
*/
|
|
979
|
-
export const get = (ref) => ref;
|
|
980
|
-
/**
|
|
981
|
-
* Synchronously get the current Exit value of the RefSubject. If it has not been set yet, a Cause.NoSuchElementException will be thrown.
|
|
982
|
-
*
|
|
983
|
-
* Note: This is unimplemented for RefSubject.tagged and RefSubject.fromTag because they require the Effect context by definition.
|
|
984
|
-
* It will throw immediately.
|
|
985
|
-
*
|
|
986
|
-
* @since 1.25.0
|
|
1071
|
+
* @since 2.0.0
|
|
987
1072
|
*/
|
|
988
|
-
export const
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
*
|
|
992
|
-
* @since 1.25.0
|
|
993
|
-
*/
|
|
994
|
-
export const unsafeGet = (ref) => Effect.runSync(unsafeGetExit(ref));
|
|
1073
|
+
export const when = dual(2, function when(ref, options) {
|
|
1074
|
+
return map(ref, (a) => a ? options.onTrue : options.onFalse);
|
|
1075
|
+
});
|
|
995
1076
|
//# sourceMappingURL=RefSubject.js.map
|