@fncts/io 0.0.18 → 0.0.20
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/Clock/definition.d.ts +1 -0
- package/Differ/api.d.ts +24 -0
- package/Differ/definition.d.ts +15 -0
- package/Fiber/FiberContext.d.ts +5 -2
- package/Fiber/api/interruptAll.d.ts +1 -1
- package/Fiber/api/interruptAsFork.d.ts +8 -0
- package/Fiber/definition.d.ts +4 -6
- package/FiberRef/api.d.ts +5 -0
- package/FiberRef/definition.d.ts +2 -1
- package/FiberRef/unsafe.d.ts +23 -6
- package/FiberRefs/api.d.ts +5 -0
- package/IOEnv/services.d.ts +2 -2
- package/Reloadable/api.d.ts +21 -0
- package/Reloadable/constructors.d.ts +23 -0
- package/Reloadable/definition.d.ts +20 -0
- package/Reloadable.d.ts +3 -0
- package/Supervisor/api.d.ts +11 -5
- package/Supervisor/definition.d.ts +28 -0
- package/SupervisorPatch.d.ts +61 -0
- package/_cjs/Clock/definition.cjs +2 -1
- package/_cjs/Clock/definition.cjs.map +1 -1
- package/_cjs/Console/definition.cjs +1 -1
- package/_cjs/Console/definition.cjs.map +1 -1
- package/_cjs/Differ/api.cjs +108 -0
- package/_cjs/Differ/api.cjs.map +1 -0
- package/_cjs/Differ/definition.cjs +23 -0
- package/_cjs/Differ/definition.cjs.map +1 -0
- package/_cjs/Fiber/FiberContext.cjs +54 -51
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/Fiber/api/collectAll.cjs +2 -2
- package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interrupt.cjs +4 -2
- package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAll.cjs +8 -8
- package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAs.cjs +7 -1
- package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAsFork.cjs +15 -0
- package/_cjs/Fiber/api/interruptAsFork.cjs.map +1 -0
- package/_cjs/Fiber/api/interruptFork.cjs +5 -5
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber/definition.cjs +2 -2
- package/_cjs/Fiber/definition.cjs.map +1 -1
- package/_cjs/FiberRef/api.cjs +10 -0
- package/_cjs/FiberRef/api.cjs.map +1 -1
- package/_cjs/FiberRef/definition.cjs +2 -1
- package/_cjs/FiberRef/definition.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +49 -19
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/FiberRefs/api.cjs +28 -2
- package/_cjs/FiberRefs/api.cjs.map +1 -1
- package/_cjs/FiberRefs/join.cjs +1 -1
- package/_cjs/FiberRefs/join.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +5 -3
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/zipC.cjs +10 -8
- package/_cjs/IO/api/zipC.cjs.map +1 -1
- package/_cjs/IO/api.cjs +2 -4
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +7 -9
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/IOEnv/definition.cjs.map +1 -1
- package/_cjs/IOEnv/services.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +1 -1
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Random/definition.cjs +1 -1
- package/_cjs/Random/definition.cjs.map +1 -1
- package/_cjs/Reloadable/api.cjs +46 -0
- package/_cjs/Reloadable/api.cjs.map +1 -0
- package/_cjs/Reloadable/constructors.cjs +82 -0
- package/_cjs/Reloadable/constructors.cjs.map +1 -0
- package/_cjs/Reloadable/definition.cjs +58 -0
- package/_cjs/Reloadable/definition.cjs.map +1 -0
- package/_cjs/Reloadable.cjs +45 -0
- package/_cjs/Reloadable.cjs.map +1 -0
- package/_cjs/Scope/definition.cjs +1 -1
- package/_cjs/Scope/definition.cjs.map +1 -1
- package/_cjs/Supervisor/api.cjs +44 -33
- package/_cjs/Supervisor/api.cjs.map +1 -1
- package/_cjs/Supervisor/definition.cjs +66 -1
- package/_cjs/Supervisor/definition.cjs.map +1 -1
- package/_cjs/SupervisorPatch.cjs +172 -0
- package/_cjs/SupervisorPatch.cjs.map +1 -0
- package/_cjs/internal/IsFatal.cjs +129 -0
- package/_cjs/internal/IsFatal.cjs.map +1 -0
- package/_mjs/Clock/definition.mjs +2 -1
- package/_mjs/Clock/definition.mjs.map +1 -1
- package/_mjs/Console/definition.mjs +1 -1
- package/_mjs/Console/definition.mjs.map +1 -1
- package/_mjs/Differ/api.mjs +90 -0
- package/_mjs/Differ/api.mjs.map +1 -0
- package/_mjs/Differ/definition.mjs +13 -0
- package/_mjs/Differ/definition.mjs.map +1 -0
- package/_mjs/Fiber/FiberContext.mjs +54 -51
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/Fiber/api/collectAll.mjs +2 -2
- package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interrupt.mjs +3 -2
- package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAll.mjs +6 -6
- package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAs.mjs +3 -1
- package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAsFork.mjs +8 -0
- package/_mjs/Fiber/api/interruptAsFork.mjs.map +1 -0
- package/_mjs/Fiber/api/interruptFork.mjs +5 -4
- package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
- package/_mjs/Fiber/definition.mjs +2 -2
- package/_mjs/Fiber/definition.mjs.map +1 -1
- package/_mjs/FiberRef/api.mjs +8 -0
- package/_mjs/FiberRef/api.mjs.map +1 -1
- package/_mjs/FiberRef/definition.mjs +2 -1
- package/_mjs/FiberRef/definition.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +42 -18
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/FiberRefs/api.mjs +22 -1
- package/_mjs/FiberRefs/api.mjs.map +1 -1
- package/_mjs/FiberRefs/join.mjs +1 -1
- package/_mjs/FiberRefs/join.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +4 -3
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/zipC.mjs +9 -8
- package/_mjs/IO/api/zipC.mjs.map +1 -1
- package/_mjs/IO/api.mjs +2 -3
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +7 -8
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/IOEnv/definition.mjs.map +1 -1
- package/_mjs/IOEnv/services.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +1 -1
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Random/definition.mjs +1 -1
- package/_mjs/Random/definition.mjs.map +1 -1
- package/_mjs/Reloadable/api.mjs +30 -0
- package/_mjs/Reloadable/api.mjs.map +1 -0
- package/_mjs/Reloadable/constructors.mjs +55 -0
- package/_mjs/Reloadable/constructors.mjs.map +1 -0
- package/_mjs/Reloadable/definition.mjs +40 -0
- package/_mjs/Reloadable/definition.mjs.map +1 -0
- package/_mjs/Reloadable.mjs +5 -0
- package/_mjs/Reloadable.mjs.map +1 -0
- package/_mjs/Scope/definition.mjs +1 -1
- package/_mjs/Scope/definition.mjs.map +1 -1
- package/_mjs/Supervisor/api.mjs +39 -32
- package/_mjs/Supervisor/api.mjs.map +1 -1
- package/_mjs/Supervisor/definition.mjs +55 -0
- package/_mjs/Supervisor/definition.mjs.map +1 -1
- package/_mjs/SupervisorPatch.mjs +131 -0
- package/_mjs/SupervisorPatch.mjs.map +1 -0
- package/_mjs/internal/IsFatal.mjs +104 -0
- package/_mjs/internal/IsFatal.mjs.map +1 -0
- package/_src/Clock/definition.ts +1 -0
- package/_src/Differ/api.ts +72 -0
- package/_src/Differ/definition.ts +16 -0
- package/_src/Fiber/FiberContext.ts +29 -24
- package/_src/Fiber/api/collectAll.ts +1 -4
- package/_src/Fiber/api/interruptAll.ts +2 -2
- package/_src/Fiber/api/interruptAs.ts +1 -1
- package/_src/Fiber/api/interruptAsFork.ts +7 -0
- package/_src/Fiber/api/interruptFork.ts +1 -1
- package/_src/Fiber/definition.ts +3 -5
- package/_src/FiberRef/api.ts +30 -15
- package/_src/FiberRef/definition.ts +1 -0
- package/_src/FiberRef/unsafe.ts +43 -22
- package/_src/FiberRefs/api.ts +16 -0
- package/_src/FiberRefs/join.ts +1 -1
- package/_src/IO/api.ts +2 -2
- package/_src/IO/runtime.ts +7 -11
- package/_src/IOEnv/definition.ts +0 -2
- package/_src/IOEnv/services.ts +5 -4
- package/_src/Reloadable/api.ts +28 -0
- package/_src/Reloadable/constructors.ts +60 -0
- package/_src/Reloadable/definition.ts +34 -0
- package/_src/Reloadable.ts +5 -0
- package/_src/Supervisor/api.ts +33 -29
- package/_src/Supervisor/definition.ts +59 -0
- package/_src/SupervisorPatch.ts +107 -0
- package/_src/global.ts +4 -0
- package/_src/internal/IsFatal.ts +79 -0
- package/global.d.ts +4 -0
- package/internal/IsFatal.d.ts +47 -0
- package/package.json +2 -2
package/Clock/definition.d.ts
CHANGED
package/Differ/api.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Environment } from "@fncts/base/data/Environment";
|
|
2
|
+
import type { Supervisor } from "@fncts/io/Supervisor";
|
|
3
|
+
import { Differ } from "./definition.js";
|
|
4
|
+
/**
|
|
5
|
+
* Constructs a differ that just diffs two values by returning a function that
|
|
6
|
+
* sets the value to the new value. This differ does not support combining
|
|
7
|
+
* multiple updates to the value compositionally and should only be used when
|
|
8
|
+
* there is no compositional way to update them.
|
|
9
|
+
* @tsplus static fncts.io.DifferOps update
|
|
10
|
+
* @tsplus location "@fncts/io/Differ/api"
|
|
11
|
+
*/
|
|
12
|
+
export declare function update<A>(): Differ<A, (_: A) => A>;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a differ that knows how to diff `Environment` values.
|
|
15
|
+
* @tsplus static fncts.io.DifferOps environment
|
|
16
|
+
* @tsplus location "@fncts/io/Differ/api"
|
|
17
|
+
*/
|
|
18
|
+
export declare function environment<A>(): Differ<Environment<A>, Environment.Patch<A, A>>;
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a differ that knows how to diff `Supervisor` values.
|
|
21
|
+
* @tsplus static fncts.io.DifferOps supervisor
|
|
22
|
+
* @tsplus location "@fncts/io/Differ/api"
|
|
23
|
+
*/
|
|
24
|
+
export declare function supervisor(): Differ<Supervisor<any>, Supervisor.Patch>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DifferTypeId: unique symbol;
|
|
2
|
+
export type DifferTypeId = typeof DifferTypeId;
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus type fncts.io.Differ
|
|
5
|
+
* @tsplus companion fncts.io.DifferOps
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class Differ<Value, Patch> {
|
|
8
|
+
readonly _typeId: DifferTypeId;
|
|
9
|
+
_Value: Value;
|
|
10
|
+
_Patch: Patch;
|
|
11
|
+
abstract readonly empty: Patch;
|
|
12
|
+
abstract combine(first: Patch, second: Patch): Patch;
|
|
13
|
+
abstract diff(oldValue: Value, newValue: Value): Patch;
|
|
14
|
+
abstract patch(patch: Patch): (oldValue: Value) => Value;
|
|
15
|
+
}
|
package/Fiber/FiberContext.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { Stack } from "@fncts/base/internal/Stack";
|
|
|
28
28
|
import { FiberTypeId } from "@fncts/io/Fiber/definition";
|
|
29
29
|
import { FiberState } from "@fncts/io/FiberState";
|
|
30
30
|
import { FiberStatus } from "@fncts/io/FiberStatus";
|
|
31
|
-
export type FiberRefLocals =
|
|
31
|
+
export type FiberRefLocals = HashMap<FiberRef<unknown>, Cons<readonly [FiberId.Runtime, unknown]>>;
|
|
32
32
|
type Erased = IO<any, any, any>;
|
|
33
33
|
type ErasedCont = (a: any) => Erased;
|
|
34
34
|
export declare class InterruptExit {
|
|
@@ -87,6 +87,7 @@ export declare class FiberContext<E, A> implements Fiber.Runtime<E, A>, Hashable
|
|
|
87
87
|
awaitAsync(k: FiberState.Callback<E, A>): void;
|
|
88
88
|
get children(): UIO<Conc<Fiber.Runtime<any, any>>>;
|
|
89
89
|
evalOnIO<R1, E1, B, R2, E2, C>(effect: IO<R1, E1, B>, orElse: IO<R2, E2, C>, __tsplusTrace?: string): IO<R1 & R2, E1 | E2, B | C>;
|
|
90
|
+
get fiberRefs(): FiberRefs;
|
|
90
91
|
get await(): UIO<Exit<E, A>>;
|
|
91
92
|
run(): void;
|
|
92
93
|
get scope(): FiberScope;
|
|
@@ -125,7 +126,7 @@ export declare class FiberContext<E, A> implements Fiber.Runtime<E, A>, Hashable
|
|
|
125
126
|
private unsafeNextEffect;
|
|
126
127
|
private unsafeNotifyObservers;
|
|
127
128
|
private unsafeRemoveObserver;
|
|
128
|
-
|
|
129
|
+
interruptAsFork(fiberId: FiberId): UIO<void>;
|
|
129
130
|
private unsafeTryDone;
|
|
130
131
|
private unsafeSetAsyncCanceller;
|
|
131
132
|
private unsafeReportUnhandled;
|
|
@@ -145,6 +146,8 @@ export declare class FiberContext<E, A> implements Fiber.Runtime<E, A>, Hashable
|
|
|
145
146
|
unsafeAddChild(child: FiberContext<unknown, unknown>): void;
|
|
146
147
|
private unsafeLog;
|
|
147
148
|
private unsafeLogWith;
|
|
149
|
+
private unsafeIsFatal;
|
|
150
|
+
private unsafeHandleFatalError;
|
|
148
151
|
get currentSupervisor(): Supervisor<any>;
|
|
149
152
|
}
|
|
150
153
|
export {};
|
|
@@ -6,7 +6,7 @@ import { UIO } from "@fncts/io/IO/definition";
|
|
|
6
6
|
* @tsplus static fncts.io.FiberOps interruptAllAs
|
|
7
7
|
* @tsplus location "@fncts/io/Fiber/api/interruptAll"
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function interruptAllAs(fs: Iterable<Fiber<any, any>>, id: FiberId, __tsplusTrace?: string): UIO<void>;
|
|
10
10
|
/**
|
|
11
11
|
* Interrupts all fibers and awaits their interruption
|
|
12
12
|
* @tsplus static fncts.io.FiberOps interruptAll
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
2
|
+
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
|
3
|
+
import { UIO } from "@fncts/io/IO/definition";
|
|
4
|
+
/**
|
|
5
|
+
* @tsplus fluent fncts.io.Fiber interruptAsFork
|
|
6
|
+
* @tsplus location "@fncts/io/Fiber/api/interruptAsFork"
|
|
7
|
+
*/
|
|
8
|
+
export declare function interruptAsFork<E, A>(self: Fiber<E, A>, fiberId: FiberId): UIO<void>;
|
package/Fiber/definition.d.ts
CHANGED
|
@@ -39,11 +39,9 @@ export interface FiberCommon<E, A> extends Fiber<E, A> {
|
|
|
39
39
|
*/
|
|
40
40
|
readonly inheritRefs: UIO<void>;
|
|
41
41
|
/**
|
|
42
|
-
* Interrupts the fiber as if interrupted from the specified fiber.
|
|
43
|
-
* fiber has already exited, the returned effect will resume immediately.
|
|
44
|
-
* Otherwise, the effect will resume when the fiber exits.
|
|
42
|
+
* Interrupts the fiber as if interrupted from the specified fiber.
|
|
45
43
|
*/
|
|
46
|
-
readonly
|
|
44
|
+
readonly interruptAsFork: (fiberId: FiberId) => UIO<void>;
|
|
47
45
|
/**
|
|
48
46
|
* Tentatively observes the fiber, but returns immediately if it is not already done.
|
|
49
47
|
*/
|
|
@@ -84,13 +82,13 @@ export declare class SyntheticFiber<E, A> implements FiberCommon<E, A> {
|
|
|
84
82
|
readonly children: UIO<Conc<Fiber.Runtime<any, any>>>;
|
|
85
83
|
readonly inheritRefs: UIO<void>;
|
|
86
84
|
readonly poll: UIO<Maybe<Exit<E, A>>>;
|
|
87
|
-
readonly
|
|
85
|
+
readonly interruptAsFork: (fiberId: FiberId) => UIO<void>;
|
|
88
86
|
readonly _tag = "SyntheticFiber";
|
|
89
87
|
readonly _typeId: FiberTypeId;
|
|
90
88
|
readonly _E: () => E;
|
|
91
89
|
readonly _A: () => A;
|
|
92
90
|
readonly await: import("../IO").UIO<import("@fncts/base/data/Exit").Exit<E, A>>;
|
|
93
|
-
constructor(id: FiberId, wait: UIO<Exit<E, A>>, children: UIO<Conc<Fiber.Runtime<any, any>>>, inheritRefs: UIO<void>, poll: UIO<Maybe<Exit<E, A>>>,
|
|
91
|
+
constructor(id: FiberId, wait: UIO<Exit<E, A>>, children: UIO<Conc<Fiber.Runtime<any, any>>>, inheritRefs: UIO<void>, poll: UIO<Maybe<Exit<E, A>>>, interruptAsFork: (fiberId: FiberId) => UIO<void>);
|
|
94
92
|
}
|
|
95
93
|
export type ConcreteFiber<E, A> = Fiber.Runtime<E, A> | Fiber.Synthetic<E, A>;
|
|
96
94
|
/**
|
package/FiberRef/api.d.ts
CHANGED
|
@@ -87,3 +87,8 @@ export declare function patch<Value, Patch>(self: FiberRef.WithPatch<Value, Patc
|
|
|
87
87
|
* @tsplus location "@fncts/io/FiberRef/api"
|
|
88
88
|
*/
|
|
89
89
|
export declare function fork<Value, Patch>(self: FiberRef.WithPatch<Value, Patch>): Patch;
|
|
90
|
+
/**
|
|
91
|
+
* @tsplus fluent fncts.io.FiberRef join
|
|
92
|
+
* @tsplus location "@fncts/io/FiberRef/api"
|
|
93
|
+
*/
|
|
94
|
+
export declare function join<Value, Patch>(self: FiberRef.WithPatch<Value, Patch>, oldValue: Value, newValue: Value): Value;
|
package/FiberRef/definition.d.ts
CHANGED
|
@@ -25,9 +25,10 @@ export declare class FiberRefInternal<Value, Patch> extends FiberRef<Value> impl
|
|
|
25
25
|
readonly _combine: (first: Patch, second: Patch) => Patch;
|
|
26
26
|
readonly _patch: (patch: Patch) => (oldValue: Value) => Value;
|
|
27
27
|
readonly _fork: Patch;
|
|
28
|
+
readonly _join: (oldValue: Value, newValue: Value) => Value;
|
|
28
29
|
readonly _Patch: Patch;
|
|
29
30
|
private readonly id;
|
|
30
|
-
constructor(_initial: Value, _diff: (oldValue: Value, newValue: Value) => Patch, _combine: (first: Patch, second: Patch) => Patch, _patch: (patch: Patch) => (oldValue: Value) => Value, _fork: Patch);
|
|
31
|
+
constructor(_initial: Value, _diff: (oldValue: Value, newValue: Value) => Patch, _combine: (first: Patch, second: Patch) => Patch, _patch: (patch: Patch) => (oldValue: Value) => Value, _fork: Patch, _join: (oldValue: Value, newValue: Value) => Value);
|
|
31
32
|
get [Symbol.hash](): number;
|
|
32
33
|
[Symbol.equals](that: unknown): boolean;
|
|
33
34
|
}
|
package/FiberRef/unsafe.d.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { FiberRef } from "@fncts/io/FiberRef/definition";
|
|
2
2
|
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
3
|
+
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
|
4
|
+
import { SupervisorPatch } from "@fncts/io/SupervisorPatch";
|
|
3
5
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
4
6
|
import { FiberScope } from "@fncts/io/FiberScope";
|
|
5
7
|
import { LogLevel } from "@fncts/io/LogLevel";
|
|
6
8
|
import { List } from "@fncts/base/collection/immutable/List/definition";
|
|
7
9
|
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
|
8
|
-
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
|
9
10
|
import type { LogSpan } from "../LogSpan.js";
|
|
10
11
|
import type { Scheduler } from "@fncts/io/internal/Scheduler.js";
|
|
11
|
-
import {
|
|
12
|
+
import { Differ } from "@fncts/io/Differ/definition";
|
|
13
|
+
import { IsFatal } from "../internal/IsFatal.js";
|
|
12
14
|
/**
|
|
13
15
|
* @tsplus static fncts.io.FiberRefOps unsafeMakePatch
|
|
14
16
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
15
17
|
*/
|
|
16
|
-
export declare function unsafeMakePatch<Value, Patch>(initial: Value,
|
|
18
|
+
export declare function unsafeMakePatch<Value, Patch>(initial: Value, differ: Differ<Value, Patch>, fork: Patch, join?: (oldValue: Value, newValue: Value) => Value): FiberRef.WithPatch<Value, Patch>;
|
|
17
19
|
/**
|
|
18
20
|
* @tsplus static fncts.io.FiberRefOps unsafeMakeEnvironment
|
|
19
21
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
20
22
|
*/
|
|
21
|
-
export declare function unsafeMakeEnvironment<A>(initial: Environment<A>): FiberRef.WithPatch<Environment<A>, Patch<A, A>>;
|
|
23
|
+
export declare function unsafeMakeEnvironment<A>(initial: Environment<A>): FiberRef.WithPatch<Environment<A>, Environment.Patch<A, A>>;
|
|
24
|
+
/**
|
|
25
|
+
* @tsplus static fncts.io.FiberRefOps unsafeMakeSupervisor
|
|
26
|
+
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
27
|
+
*/
|
|
28
|
+
export declare function unsafeMakeSupervisor(initial: Supervisor<any>): FiberRef.WithPatch<Supervisor<any>, SupervisorPatch>;
|
|
22
29
|
/**
|
|
23
30
|
* @tsplus static fncts.io.FiberRefOps unsafeMake
|
|
24
31
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
@@ -33,7 +40,7 @@ export declare const forkScopeOverride: import("./definition.js").FiberRef.WithP
|
|
|
33
40
|
* @tsplus static fncts.io.FiberRefOps currentEnvironment
|
|
34
41
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
35
42
|
*/
|
|
36
|
-
export declare const currentEnvironment: import("./definition.js").FiberRef.WithPatch<import("@fncts/base/data/Environment.js").Environment<unknown>, Patch<unknown, unknown>>;
|
|
43
|
+
export declare const currentEnvironment: import("./definition.js").FiberRef.WithPatch<import("@fncts/base/data/Environment.js").Environment<unknown>, import("@fncts/base/data/Environment.js").Environment.Patch<unknown, unknown>>;
|
|
37
44
|
/**
|
|
38
45
|
* @tsplus static fncts.io.FiberRefOps fiberName
|
|
39
46
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
@@ -63,4 +70,14 @@ export declare const currentScheduler: import("./definition.js").FiberRef.WithPa
|
|
|
63
70
|
* @tsplus static fncts.io.FiberRefOps currentSupervisor
|
|
64
71
|
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
65
72
|
*/
|
|
66
|
-
export declare const currentSupervisor: import("./definition.js").FiberRef.WithPatch<import("../Supervisor.js").Supervisor<any>,
|
|
73
|
+
export declare const currentSupervisor: import("./definition.js").FiberRef.WithPatch<import("../Supervisor.js").Supervisor<any>, import("../SupervisorPatch.js").SupervisorPatch>;
|
|
74
|
+
/**
|
|
75
|
+
* @tsplus static fncts.io.FiberRefOps currentIsFatal
|
|
76
|
+
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
77
|
+
*/
|
|
78
|
+
export declare const currentIsFatal: import("./definition.js").FiberRef.WithPatch<IsFatal, (_: IsFatal) => IsFatal>;
|
|
79
|
+
/**
|
|
80
|
+
* @tsplus static fncts.io.FiberRefOps currentReportFatal
|
|
81
|
+
* @tsplus location "@fncts/io/FiberRef/unsafe"
|
|
82
|
+
*/
|
|
83
|
+
export declare const currentReportFatal: import("./definition.js").FiberRef.WithPatch<(t: unknown) => never, (_: (t: unknown) => never) => (t: unknown) => never>;
|
package/FiberRefs/api.d.ts
CHANGED
|
@@ -14,3 +14,8 @@ export declare function fiberRefs(self: FiberRefs): HashSet<FiberRef<unknown>>;
|
|
|
14
14
|
* @tsplus location "@fncts/io/FiberRefs/api"
|
|
15
15
|
*/
|
|
16
16
|
export declare function make(fiberRefLocals: HashMap<FiberRef<unknown>, Cons<readonly [FiberId.Runtime, unknown]>>): FiberRefs;
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus fluent fncts.io.FiberRefs forkAs
|
|
19
|
+
* @tsplus location "@fncts/io/FiberRefs/api"
|
|
20
|
+
*/
|
|
21
|
+
export declare function forkAs(self: FiberRefs, childId: FiberId.Runtime): FiberRefs;
|
package/IOEnv/services.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FiberRef } from "@fncts/io/FiberRef/definition";
|
|
2
2
|
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
3
3
|
import { IOEnv } from "@fncts/io/IOEnv";
|
|
4
|
-
import type {
|
|
4
|
+
import type { EnvironmentPatch } from "@fncts/base/data/EnvironmentPatch";
|
|
5
5
|
/**
|
|
6
6
|
* @tsplus static fncts.io.IOEnvOps services
|
|
7
7
|
* @tsplus location "@fncts/io/IOEnv/services"
|
|
8
8
|
*/
|
|
9
|
-
export declare const services: FiberRef.WithPatch<Environment<IOEnv>,
|
|
9
|
+
export declare const services: FiberRef.WithPatch<Environment<IOEnv>, EnvironmentPatch<IOEnv, IOEnv>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Tag } from "@fncts/base/data/Tag/definition";
|
|
2
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
3
|
+
import type { Reloadable } from "./definition.js";
|
|
4
|
+
/**
|
|
5
|
+
* @tsplus static fncts.io.ReloadableOps get
|
|
6
|
+
* @tsplus location "@fncts/io/Reloadable/api"
|
|
7
|
+
*/
|
|
8
|
+
export declare function get<Service>(
|
|
9
|
+
/** @tsplus auto */ tag: Tag<Reloadable<Service>>): IO<Reloadable<Service>, unknown, Service>;
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus static fncts.io.ReloadableOps reload
|
|
12
|
+
* @tsplus location "@fncts/io/Reloadable/api"
|
|
13
|
+
*/
|
|
14
|
+
export declare function reload<Service>(
|
|
15
|
+
/** @tsplua auto */ tag: Tag<Reloadable<Service>>): IO<Reloadable<Service>, unknown, void>;
|
|
16
|
+
/**
|
|
17
|
+
* @tsplus static fncts.io.ReloadableOps reloadFork
|
|
18
|
+
* @tsplus location "@fncts/io/Reloadable/api"
|
|
19
|
+
*/
|
|
20
|
+
export declare function reloadFork<Service>(
|
|
21
|
+
/** @tsplus auto */ tag: Tag<Reloadable<Service>>): IO<Reloadable<Service>, never, void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Layer } from "@fncts/io/Layer";
|
|
2
|
+
import { Tag } from "@fncts/base/data/Tag/definition";
|
|
3
|
+
import { Schedule } from "@fncts/io/Schedule/definition";
|
|
4
|
+
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
5
|
+
import { Reloadable } from "./definition.js";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus static fncts.io.ReloadableOps auto
|
|
8
|
+
* @tsplus location "@fncts/io/Reloadable/constructors"
|
|
9
|
+
*/
|
|
10
|
+
export declare function auto<In, E, Out, Env>(layer: Layer<In, E, Out>, tag: Tag<Out>, schedule: Schedule<Env, any, any>,
|
|
11
|
+
/** @tsplus auto */ reloadableTag: Tag<Reloadable<Out>>): Layer<In | Env, E, Reloadable<Out>>;
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.io.ReloadableOps autoFromConfig
|
|
14
|
+
* @tsplus location "@fncts/io/Reloadable/constructors"
|
|
15
|
+
*/
|
|
16
|
+
export declare function autoFromConfig<In, E, Out, Env>(layer: Layer<In, E, Out>, tag: Tag<Out>, scheduleFromConfig: (env: Environment<In>) => Schedule<Env, any, any>,
|
|
17
|
+
/** @tsplus auto */ reloadableTag: Tag<Reloadable<Out>>): Layer<In | Env, E, Reloadable<Out>>;
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus static fncts.io.ReloadableOps manual
|
|
20
|
+
* @tsplus location "@fncts/io/Reloadable/constructors"
|
|
21
|
+
*/
|
|
22
|
+
export declare function manual<In, E, Out>(layer: Layer<In, E, Out>, tag: Tag<Out>,
|
|
23
|
+
/** @tsplus auto */ reloadableTag: Tag<Reloadable<Out>>): Layer<In, E, Reloadable<Out>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ScopedRef } from "@fncts/io/ScopedRef/definition";
|
|
2
|
+
import { IO, UIO } from "@fncts/io/IO/definition";
|
|
3
|
+
import { Tag } from "@fncts/base/data/Tag/definition";
|
|
4
|
+
/**
|
|
5
|
+
* @tsplus type fncts.io.Reloadable
|
|
6
|
+
* @tsplus companion fncts.io.ReloadableOps
|
|
7
|
+
*/
|
|
8
|
+
export declare class Reloadable<Service> {
|
|
9
|
+
readonly scopedRef: ScopedRef<Service>;
|
|
10
|
+
readonly reload: IO<never, unknown, void>;
|
|
11
|
+
_Service: (_: never) => Service;
|
|
12
|
+
constructor(scopedRef: ScopedRef<Service>, reload: IO<never, unknown, void>);
|
|
13
|
+
get get(): UIO<Service>;
|
|
14
|
+
get reloadFork(): UIO<void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @tsplus derive fncts.Tag[fncts.io.Reloadable]<_> 10
|
|
18
|
+
* @tsplus location "@fncts/io/Reloadable/definition"
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveTag<S>(...[tag]: [S] extends [Reloadable<infer X>] ? [tag: Tag<X>] : [tag: Tag<S>]): Tag<Reloadable<S>>;
|
package/Reloadable.d.ts
ADDED
package/Supervisor/api.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
|
2
|
-
import {
|
|
3
|
-
import { IO } from "@fncts/io/IO/definition";
|
|
4
|
-
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
|
-
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
6
|
-
import { Exit } from "@fncts/base/data/Exit/definition";
|
|
2
|
+
import { HashSet } from "@fncts/base/collection/immutable/HashSet/definition";
|
|
7
3
|
/**
|
|
8
4
|
* @tsplus fluent fncts.io.Supervisor zip
|
|
9
5
|
* @tsplus location "@fncts/io/Supervisor/api"
|
|
10
6
|
*/
|
|
11
7
|
export declare function zip_<A, B>(fa: Supervisor<A>, fb: Supervisor<B>): Supervisor<readonly [A, B]>;
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus getter fncts.io.Supervisor toSet
|
|
10
|
+
* @tsplus location "@fncts/io/Supervisor/api"
|
|
11
|
+
*/
|
|
12
|
+
export declare function toSet(self: Supervisor<any>): HashSet<Supervisor<any>>;
|
|
13
|
+
/**
|
|
14
|
+
* @tsplus fluent fncts.io.Supervisor removeSupervisor
|
|
15
|
+
* @tsplus location "@fncts/io/Supervisor/api"
|
|
16
|
+
*/
|
|
17
|
+
export declare function removeSupervisor(self: Supervisor<any>, that: Supervisor<any>): Supervisor<any>;
|
|
@@ -3,6 +3,12 @@ import { Environment } from "@fncts/base/data/Environment/definition";
|
|
|
3
3
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
4
4
|
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
5
5
|
import { Exit } from "@fncts/base/data/Exit/definition";
|
|
6
|
+
import type { SupervisorPatch } from "@fncts/io/SupervisorPatch";
|
|
7
|
+
export declare const enum SupervisorTag {
|
|
8
|
+
Const = 0,
|
|
9
|
+
Proxy = 1,
|
|
10
|
+
Zip = 2
|
|
11
|
+
}
|
|
6
12
|
/**
|
|
7
13
|
* @tsplus type fncts.io.Supervisor
|
|
8
14
|
* @tsplus companion fncts.io.SupervisorOps
|
|
@@ -15,8 +21,12 @@ export declare abstract class Supervisor<A> {
|
|
|
15
21
|
unsafeOnSuspend<E, A>(_fiber: Fiber.Runtime<E, A>): void;
|
|
16
22
|
unsafeOnResume<E, A>(_fiber: Fiber.Runtime<E, A>): void;
|
|
17
23
|
}
|
|
24
|
+
export declare namespace Supervisor {
|
|
25
|
+
type Patch = SupervisorPatch;
|
|
26
|
+
}
|
|
18
27
|
export declare class ConstSupervisor<A> extends Supervisor<A> {
|
|
19
28
|
readonly value: UIO<A>;
|
|
29
|
+
readonly _tag = SupervisorTag.Const;
|
|
20
30
|
constructor(value: UIO<A>);
|
|
21
31
|
unsafeOnStart(): void;
|
|
22
32
|
unsafeOnEnd(): void;
|
|
@@ -27,6 +37,7 @@ export declare class ConstSupervisor<A> extends Supervisor<A> {
|
|
|
27
37
|
export declare class ProxySupervisor<A> extends Supervisor<A> {
|
|
28
38
|
readonly value: UIO<A>;
|
|
29
39
|
readonly underlying: Supervisor<any>;
|
|
40
|
+
readonly _tag = SupervisorTag.Proxy;
|
|
30
41
|
constructor(value: UIO<A>, underlying: Supervisor<any>);
|
|
31
42
|
unsafeOnStart<R, E, A>(environment: Environment<R>, effect: IO<R, E, A>, parent: Maybe<Fiber.Runtime<E, A>>, fiber: Fiber.Runtime<E, A>): void;
|
|
32
43
|
unsafeOnEnd<E, A>(value: Exit<E, A>, fiber: Fiber.Runtime<E, A>): void;
|
|
@@ -34,3 +45,20 @@ export declare class ProxySupervisor<A> extends Supervisor<A> {
|
|
|
34
45
|
unsafeOnSuspend<E, A>(fiber: Fiber.Runtime<E, A>): void;
|
|
35
46
|
unsafeOnResume<E, A>(fiber: Fiber.Runtime<E, A>): void;
|
|
36
47
|
}
|
|
48
|
+
export declare class Zip<A, B> extends Supervisor<readonly [A, B]> {
|
|
49
|
+
readonly first: Supervisor<A>;
|
|
50
|
+
readonly second: Supervisor<B>;
|
|
51
|
+
readonly _tag = SupervisorTag.Zip;
|
|
52
|
+
constructor(first: Supervisor<A>, second: Supervisor<B>);
|
|
53
|
+
value: import("../IO").IO<never, never, readonly [A, B]>;
|
|
54
|
+
unsafeOnStart<R, E, A>(environment: Environment<R>, effect: IO<R, E, A>, parent: Maybe<Fiber.Runtime<any, any>>, fiber: Fiber.Runtime<E, A>): void;
|
|
55
|
+
unsafeOnEnd<E, A>(value: Exit<E, A>, fiber: Fiber.Runtime<E, A>): void;
|
|
56
|
+
unsafeOnEffect<E, A>(fiber: Fiber.Runtime<E, A>, effect: IO<any, any, any>): void;
|
|
57
|
+
unsafeOnSuspend<E, A>(fiber: Fiber.Runtime<E, A>): void;
|
|
58
|
+
unsafeOnResume<E, A>(fiber: Fiber.Runtime<E, A>): void;
|
|
59
|
+
}
|
|
60
|
+
export type Concrete = ConstSupervisor<any> | ProxySupervisor<any> | Zip<any, any>;
|
|
61
|
+
/**
|
|
62
|
+
* @tsplus macro remove
|
|
63
|
+
*/
|
|
64
|
+
export declare function concrete(_: Supervisor<any>): asserts _ is Concrete;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
|
2
|
+
import { List } from "@fncts/base/collection/immutable/List/definition";
|
|
3
|
+
export declare const SupervisorPatchTypeId: unique symbol;
|
|
4
|
+
export type SupervisorPatchTypeId = typeof SupervisorPatchTypeId;
|
|
5
|
+
export declare const enum SupervisorPatchTag {
|
|
6
|
+
AddSupervisor = 0,
|
|
7
|
+
Combine = 1,
|
|
8
|
+
Empty = 2,
|
|
9
|
+
RemoveSupervisor = 3
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @tsplus type fncts.io.SupervisorPatch
|
|
13
|
+
* @tsplus companion fncts.io.SupervisorPatchOps
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class SupervisorPatch {
|
|
16
|
+
readonly _typeId: SupervisorPatchTypeId;
|
|
17
|
+
}
|
|
18
|
+
export declare class AddSupervisor extends SupervisorPatch {
|
|
19
|
+
readonly supervisor: Supervisor<any>;
|
|
20
|
+
readonly _tag = SupervisorPatchTag.AddSupervisor;
|
|
21
|
+
constructor(supervisor: Supervisor<any>);
|
|
22
|
+
}
|
|
23
|
+
export declare class Combine extends SupervisorPatch {
|
|
24
|
+
readonly first: SupervisorPatch;
|
|
25
|
+
readonly second: SupervisorPatch;
|
|
26
|
+
readonly _tag = SupervisorPatchTag.Combine;
|
|
27
|
+
constructor(first: SupervisorPatch, second: SupervisorPatch);
|
|
28
|
+
}
|
|
29
|
+
export declare class Empty extends SupervisorPatch {
|
|
30
|
+
readonly _tag = SupervisorPatchTag.Empty;
|
|
31
|
+
}
|
|
32
|
+
export declare class RemoveSupervisor extends SupervisorPatch {
|
|
33
|
+
readonly supervisor: Supervisor<any>;
|
|
34
|
+
readonly _tag = SupervisorPatchTag.RemoveSupervisor;
|
|
35
|
+
constructor(supervisor: Supervisor<any>);
|
|
36
|
+
}
|
|
37
|
+
export type Concrete = AddSupervisor | Combine | Empty | RemoveSupervisor;
|
|
38
|
+
/**
|
|
39
|
+
* @tsplus macro remove
|
|
40
|
+
*/
|
|
41
|
+
export declare function concrete(_: SupervisorPatch): asserts _ is Concrete;
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus static fncts.io.SupervisorPatchOps empty
|
|
44
|
+
* @tsplus location "@fncts/io/SupervisorPatch"
|
|
45
|
+
*/
|
|
46
|
+
export declare const empty: SupervisorPatch;
|
|
47
|
+
/**
|
|
48
|
+
* @tsplus fluent fncts.io.SupervisorPatch combine
|
|
49
|
+
* @tsplus location "@fncts/io/SupervisorPatch"
|
|
50
|
+
*/
|
|
51
|
+
export declare function combine(first: SupervisorPatch, second: SupervisorPatch): SupervisorPatch;
|
|
52
|
+
/**
|
|
53
|
+
* @tsplus static fncts.io.SupervisorPatchOps diff
|
|
54
|
+
* @tsplus location "@fncts/io/SupervisorPatch"
|
|
55
|
+
*/
|
|
56
|
+
export declare function diff(oldValue: Supervisor<any>, newValue: Supervisor<any>): SupervisorPatch;
|
|
57
|
+
/**
|
|
58
|
+
* @tsplus fluent fncts.io.SupervisorPatch __call
|
|
59
|
+
* @tsplus location "@fncts/io/SupervisorPatch"
|
|
60
|
+
*/
|
|
61
|
+
export declare function apply(self: SupervisorPatch, supervisor: Supervisor<any>): Supervisor<any>;
|
|
@@ -18,10 +18,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
18
|
class Clock {}
|
|
19
19
|
/**
|
|
20
20
|
* @tsplus static fncts.io.ClockOps Tag
|
|
21
|
+
* @tsplus implicit
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
exports.Clock = Clock;
|
|
25
|
-
const ClockTag = /*#__PURE__*/tsplus_module_1.makeTag("
|
|
26
|
+
const ClockTag = /*#__PURE__*/tsplus_module_1.makeTag("fncts.io.Clock");
|
|
26
27
|
exports.ClockTag = ClockTag;
|
|
27
28
|
//# sourceMappingURL=definition.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.cjs","mappings":";;;;;;;;;;;;;AAAA;;;;AAIM,MAAgBA,KAAhB,CAAqB;AAK3B
|
|
1
|
+
{"version":3,"file":"definition.cjs","mappings":";;;;;;;;;;;;;AAAA;;;;AAIM,MAAgBA,KAAhB,CAAqB;AAK3B;;;;;;;AAIO,MAAMC,QAAQ,gBAAGC,wBAAW,gBAAX,CAAjB","names":["Clock","ClockTag","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Clock/definition.ts"],"sourcesContent":[null]}
|
|
@@ -22,6 +22,6 @@ class Console {}
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
exports.Console = Console;
|
|
25
|
-
const ConsoleTag = /*#__PURE__*/tsplus_module_1.makeTag("
|
|
25
|
+
const ConsoleTag = /*#__PURE__*/tsplus_module_1.makeTag("fncts.io.Console");
|
|
26
26
|
exports.ConsoleTag = ConsoleTag;
|
|
27
27
|
//# sourceMappingURL=definition.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.cjs","mappings":";;;;;;;;;;;;;AAAA;;;;AAIM,MAAgBA,OAAhB,CAAuB;AAM7B;;;;;;AAGO,MAAMC,UAAU,gBAAGC
|
|
1
|
+
{"version":3,"file":"definition.cjs","mappings":";;;;;;;;;;;;;AAAA;;;;AAIM,MAAgBA,OAAhB,CAAuB;AAM7B;;;;;;AAGO,MAAMC,UAAU,gBAAGC,wBAAa,kBAAb,CAAnB","names":["Console","ConsoleTag","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Console/definition.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.environment = environment;
|
|
7
|
+
exports.supervisor = supervisor;
|
|
8
|
+
exports.update = update;
|
|
9
|
+
|
|
10
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/function/api"));
|
|
11
|
+
|
|
12
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/EnvironmentPatch"));
|
|
13
|
+
|
|
14
|
+
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/SupervisorPatch"));
|
|
15
|
+
|
|
16
|
+
var _definition = /*#__PURE__*/require("./definition.cjs");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a differ that just diffs two values by returning a function that
|
|
24
|
+
* sets the value to the new value. This differ does not support combining
|
|
25
|
+
* multiple updates to the value compositionally and should only be used when
|
|
26
|
+
* there is no compositional way to update them.
|
|
27
|
+
*
|
|
28
|
+
* @tsplus static fncts.io.DifferOps update
|
|
29
|
+
*/
|
|
30
|
+
function update() {
|
|
31
|
+
return new class extends _definition.Differ {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.empty = tsplus_module_1.identity;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
combine(first, second) {
|
|
38
|
+
if (first === this.empty) return second;else if (second === this.empty) return first;
|
|
39
|
+
return tsplus_module_1.compose_(first, second);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
diff(oldValue, newValue) {
|
|
43
|
+
if (oldValue === newValue) return this.empty;else return () => newValue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
patch(patch) {
|
|
47
|
+
return patch;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Constructs a differ that knows how to diff `Environment` values.
|
|
54
|
+
*
|
|
55
|
+
* @tsplus static fncts.io.DifferOps environment
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
function environment() {
|
|
60
|
+
return new class extends _definition.Differ {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
this.empty = tsplus_module_2.empty();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
combine(first, second) {
|
|
67
|
+
return tsplus_module_2.combine(first, second);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
diff(oldValue, newValue) {
|
|
71
|
+
return tsplus_module_2.diff(oldValue, newValue);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
patch(patch) {
|
|
75
|
+
return oldValue => tsplus_module_2.apply(patch, oldValue);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Constructs a differ that knows how to diff `Supervisor` values.
|
|
82
|
+
*
|
|
83
|
+
* @tsplus static fncts.io.DifferOps supervisor
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
function supervisor() {
|
|
88
|
+
return new class extends _definition.Differ {
|
|
89
|
+
constructor() {
|
|
90
|
+
super(...arguments);
|
|
91
|
+
this.empty = tsplus_module_3.empty;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
combine(first, second) {
|
|
95
|
+
return tsplus_module_3.combine(first, second);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
diff(oldValue, newValue) {
|
|
99
|
+
return tsplus_module_3.diff(oldValue, newValue);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
patch(patch) {
|
|
103
|
+
return oldValue => tsplus_module_3.apply(patch, oldValue);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}();
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=api.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.cjs","mappings":";;;;;;;;;;;;;;;AAKA;;;;;;AAEA;;;;;;;;AAQM,SAAUA,MAAV,GAAgB;EACpB,OAAO,IAAK,cAAcC,kBAAd,CAAoC;IAApCC;;MAUV,aAAKC,wBAAL;IAID;;IAbCC,OAAO,CAACC,KAAD,EAAqBC,MAArB,EAAwC;MAC7C,IAAID,KAAK,KAAK,KAAKE,KAAnB,EAA0B,OAAOD,MAAP,CAA1B,KACK,IAAIA,MAAM,KAAK,KAAKC,KAApB,EAA2B,OAAOF,KAAP;MAChC,OAAOF,gCAAcG,MAAd,CAAP;IACD;;IACDE,IAAI,CAACC,QAAD,EAAcC,QAAd,EAAyB;MAC3B,IAAID,QAAQ,KAAKC,QAAjB,EAA2B,OAAO,KAAKH,KAAZ,CAA3B,KACK,OAAO,MAAMG,QAAb;IACN;;IAEDC,KAAK,CAACA,KAAD,EAAmB;MACtB,OAAOA,KAAP;IACD;;EAb6C,CAAzC,EAAP;AAeD;AAED;;;;;;;AAKM,SAAUC,WAAV,GAAqB;EACzB,OAAO,IAAK,cAAcX,kBAAd,CAA6D;IAA7DC;;MAOV,aAAQW,uBAAR;IAID;;IAVCT,OAAO,CAACC,KAAD,EAAiCC,MAAjC,EAAgE;MACrE,OAAOO,+BAAcP,MAAd,CAAP;IACD;;IACDE,IAAI,CAACC,QAAD,EAA2BC,QAA3B,EAAmD;MACrD,OAAOG,qBAAsBJ,QAAtB,EAAgCC,QAAhC,CAAP;IACD;;IAEDC,KAAK,CAACA,KAAD,EAA+B;MAClC,OAAQF,QAAD,IAAcI,6BAAMJ,QAAN,CAArB;IACD;;EAVsE,CAAlE,EAAP;AAYD;AAED;;;;;;;AAKM,SAAUK,UAAV,GAAoB;EACxB,OAAO,IAAK,cAAcb,kBAAd,CAAuD;IAAvDC;;MAOV,aAAKa,qBAAL;IAID;;IAVCX,OAAO,CAACC,KAAD,EAAyBC,MAAzB,EAAgD;MACrD,OAAOS,+BAAcT,MAAd,CAAP;IACD;;IACDE,IAAI,CAACC,QAAD,EAA4BC,QAA5B,EAAqD;MACvD,OAAOK,qBAAqBN,QAArB,EAA+BC,QAA/B,CAAP;IACD;;IAEDC,KAAK,CAACA,KAAD,EAAuB;MAC1B,OAAQF,QAAD,IAAcM,6BAAMN,QAAN,CAArB;IACD;;EAVgE,CAA5D,EAAP;AAYD","names":["update","Differ","constructor","tsplus_module_1","combine","first","second","empty","diff","oldValue","newValue","patch","environment","tsplus_module_2","supervisor","tsplus_module_3"],"sourceRoot":"","sources":["../../_src/Differ/api.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DifferTypeId = exports.Differ = void 0;
|
|
7
|
+
const DifferTypeId = /*#__PURE__*/Symbol.for("fncts.io.Differ");
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus type fncts.io.Differ
|
|
10
|
+
* @tsplus companion fncts.io.DifferOps
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
exports.DifferTypeId = DifferTypeId;
|
|
14
|
+
|
|
15
|
+
class Differ {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._typeId = DifferTypeId;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.Differ = Differ;
|
|
23
|
+
//# sourceMappingURL=definition.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.cjs","mappings":";;;;;;AAAO,MAAMA,YAAY,gBAAGC,MAAM,CAACC,GAAP,CAAW,iBAAX,CAArB;AAGP;;;;;;;AAIM,MAAgBC,MAAhB,CAAsB;EAA5BC;IACW,eAAwBJ,YAAxB;EAOV;;AAR2B","names":["DifferTypeId","Symbol","for","Differ","constructor"],"sourceRoot":"","sources":["../../_src/Differ/definition.ts"],"sourcesContent":[null]}
|