@fncts/io 0.0.18 → 0.0.19

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.
Files changed (143) hide show
  1. package/Clock/definition.d.ts +1 -0
  2. package/Fiber/FiberContext.d.ts +5 -2
  3. package/Fiber/api/interruptAll.d.ts +1 -1
  4. package/Fiber/api/interruptAsFork.d.ts +8 -0
  5. package/Fiber/definition.d.ts +4 -6
  6. package/FiberRef/api.d.ts +5 -0
  7. package/FiberRef/definition.d.ts +2 -1
  8. package/FiberRef/unsafe.d.ts +12 -1
  9. package/FiberRefs/api.d.ts +5 -0
  10. package/Reloadable/api.d.ts +21 -0
  11. package/Reloadable/constructors.d.ts +23 -0
  12. package/Reloadable/definition.d.ts +20 -0
  13. package/Reloadable.d.ts +3 -0
  14. package/_cjs/Clock/definition.cjs +2 -1
  15. package/_cjs/Clock/definition.cjs.map +1 -1
  16. package/_cjs/Console/definition.cjs +1 -1
  17. package/_cjs/Console/definition.cjs.map +1 -1
  18. package/_cjs/Fiber/FiberContext.cjs +54 -51
  19. package/_cjs/Fiber/FiberContext.cjs.map +1 -1
  20. package/_cjs/Fiber/api/collectAll.cjs +2 -2
  21. package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
  22. package/_cjs/Fiber/api/interrupt.cjs +4 -2
  23. package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
  24. package/_cjs/Fiber/api/interruptAll.cjs +8 -8
  25. package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
  26. package/_cjs/Fiber/api/interruptAs.cjs +7 -1
  27. package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
  28. package/_cjs/Fiber/api/interruptAsFork.cjs +15 -0
  29. package/_cjs/Fiber/api/interruptAsFork.cjs.map +1 -0
  30. package/_cjs/Fiber/api/interruptFork.cjs +5 -5
  31. package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
  32. package/_cjs/Fiber/definition.cjs +2 -2
  33. package/_cjs/Fiber/definition.cjs.map +1 -1
  34. package/_cjs/FiberRef/api.cjs +10 -0
  35. package/_cjs/FiberRef/api.cjs.map +1 -1
  36. package/_cjs/FiberRef/definition.cjs +2 -1
  37. package/_cjs/FiberRef/definition.cjs.map +1 -1
  38. package/_cjs/FiberRef/unsafe.cjs +21 -5
  39. package/_cjs/FiberRef/unsafe.cjs.map +1 -1
  40. package/_cjs/FiberRefs/api.cjs +28 -2
  41. package/_cjs/FiberRefs/api.cjs.map +1 -1
  42. package/_cjs/FiberRefs/join.cjs +1 -1
  43. package/_cjs/FiberRefs/join.cjs.map +1 -1
  44. package/_cjs/IO/api/interrupt.cjs +5 -3
  45. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  46. package/_cjs/IO/api/zipC.cjs +10 -8
  47. package/_cjs/IO/api/zipC.cjs.map +1 -1
  48. package/_cjs/IO/api.cjs +2 -4
  49. package/_cjs/IO/api.cjs.map +1 -1
  50. package/_cjs/IO/runtime.cjs +7 -9
  51. package/_cjs/IO/runtime.cjs.map +1 -1
  52. package/_cjs/Layer/api.cjs +1 -1
  53. package/_cjs/Layer/api.cjs.map +1 -1
  54. package/_cjs/Random/definition.cjs +1 -1
  55. package/_cjs/Random/definition.cjs.map +1 -1
  56. package/_cjs/Reloadable/api.cjs +46 -0
  57. package/_cjs/Reloadable/api.cjs.map +1 -0
  58. package/_cjs/Reloadable/constructors.cjs +82 -0
  59. package/_cjs/Reloadable/constructors.cjs.map +1 -0
  60. package/_cjs/Reloadable/definition.cjs +58 -0
  61. package/_cjs/Reloadable/definition.cjs.map +1 -0
  62. package/_cjs/Reloadable.cjs +45 -0
  63. package/_cjs/Reloadable.cjs.map +1 -0
  64. package/_cjs/Scope/definition.cjs +1 -1
  65. package/_cjs/Scope/definition.cjs.map +1 -1
  66. package/_cjs/internal/IsFatal.cjs +129 -0
  67. package/_cjs/internal/IsFatal.cjs.map +1 -0
  68. package/_mjs/Clock/definition.mjs +2 -1
  69. package/_mjs/Clock/definition.mjs.map +1 -1
  70. package/_mjs/Console/definition.mjs +1 -1
  71. package/_mjs/Console/definition.mjs.map +1 -1
  72. package/_mjs/Fiber/FiberContext.mjs +54 -51
  73. package/_mjs/Fiber/FiberContext.mjs.map +1 -1
  74. package/_mjs/Fiber/api/collectAll.mjs +2 -2
  75. package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
  76. package/_mjs/Fiber/api/interrupt.mjs +3 -2
  77. package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
  78. package/_mjs/Fiber/api/interruptAll.mjs +6 -6
  79. package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
  80. package/_mjs/Fiber/api/interruptAs.mjs +3 -1
  81. package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
  82. package/_mjs/Fiber/api/interruptAsFork.mjs +8 -0
  83. package/_mjs/Fiber/api/interruptAsFork.mjs.map +1 -0
  84. package/_mjs/Fiber/api/interruptFork.mjs +5 -4
  85. package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
  86. package/_mjs/Fiber/definition.mjs +2 -2
  87. package/_mjs/Fiber/definition.mjs.map +1 -1
  88. package/_mjs/FiberRef/api.mjs +8 -0
  89. package/_mjs/FiberRef/api.mjs.map +1 -1
  90. package/_mjs/FiberRef/definition.mjs +2 -1
  91. package/_mjs/FiberRef/definition.mjs.map +1 -1
  92. package/_mjs/FiberRef/unsafe.mjs +17 -4
  93. package/_mjs/FiberRef/unsafe.mjs.map +1 -1
  94. package/_mjs/FiberRefs/api.mjs +22 -1
  95. package/_mjs/FiberRefs/api.mjs.map +1 -1
  96. package/_mjs/FiberRefs/join.mjs +1 -1
  97. package/_mjs/FiberRefs/join.mjs.map +1 -1
  98. package/_mjs/IO/api/interrupt.mjs +4 -3
  99. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  100. package/_mjs/IO/api/zipC.mjs +9 -8
  101. package/_mjs/IO/api/zipC.mjs.map +1 -1
  102. package/_mjs/IO/api.mjs +2 -3
  103. package/_mjs/IO/api.mjs.map +1 -1
  104. package/_mjs/IO/runtime.mjs +7 -8
  105. package/_mjs/IO/runtime.mjs.map +1 -1
  106. package/_mjs/Layer/api.mjs +1 -1
  107. package/_mjs/Layer/api.mjs.map +1 -1
  108. package/_mjs/Random/definition.mjs +1 -1
  109. package/_mjs/Random/definition.mjs.map +1 -1
  110. package/_mjs/Reloadable/api.mjs +30 -0
  111. package/_mjs/Reloadable/api.mjs.map +1 -0
  112. package/_mjs/Reloadable/constructors.mjs +55 -0
  113. package/_mjs/Reloadable/constructors.mjs.map +1 -0
  114. package/_mjs/Reloadable/definition.mjs +40 -0
  115. package/_mjs/Reloadable/definition.mjs.map +1 -0
  116. package/_mjs/Reloadable.mjs +5 -0
  117. package/_mjs/Reloadable.mjs.map +1 -0
  118. package/_mjs/Scope/definition.mjs +1 -1
  119. package/_mjs/Scope/definition.mjs.map +1 -1
  120. package/_mjs/internal/IsFatal.mjs +104 -0
  121. package/_mjs/internal/IsFatal.mjs.map +1 -0
  122. package/_src/Clock/definition.ts +1 -0
  123. package/_src/Fiber/FiberContext.ts +29 -24
  124. package/_src/Fiber/api/collectAll.ts +1 -4
  125. package/_src/Fiber/api/interruptAll.ts +2 -2
  126. package/_src/Fiber/api/interruptAs.ts +1 -1
  127. package/_src/Fiber/api/interruptAsFork.ts +7 -0
  128. package/_src/Fiber/api/interruptFork.ts +1 -1
  129. package/_src/Fiber/definition.ts +3 -5
  130. package/_src/FiberRef/api.ts +30 -15
  131. package/_src/FiberRef/definition.ts +1 -0
  132. package/_src/FiberRef/unsafe.ts +22 -3
  133. package/_src/FiberRefs/api.ts +16 -0
  134. package/_src/FiberRefs/join.ts +1 -1
  135. package/_src/IO/api.ts +2 -2
  136. package/_src/IO/runtime.ts +7 -11
  137. package/_src/Reloadable/api.ts +28 -0
  138. package/_src/Reloadable/constructors.ts +60 -0
  139. package/_src/Reloadable/definition.ts +34 -0
  140. package/_src/Reloadable.ts +5 -0
  141. package/_src/internal/IsFatal.ts +79 -0
  142. package/internal/IsFatal.d.ts +47 -0
  143. package/package.json +2 -2
@@ -11,6 +11,7 @@ export declare abstract class Clock {
11
11
  }
12
12
  /**
13
13
  * @tsplus static fncts.io.ClockOps Tag
14
+ * @tsplus implicit
14
15
  * @tsplus location "@fncts/io/Clock/definition"
15
16
  */
16
17
  export declare const ClockTag: import("@fncts/base/data/Tag").Tag<Clock>;
@@ -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 = AtomicReference<HashMap<FiberRef<unknown>, Cons<readonly [FiberId.Runtime, unknown]>>>;
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
- private unsafeInterruptAs;
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 interruptAllAs_(fs: Iterable<Fiber<any, any>>, id: FiberId, __tsplusTrace?: string): UIO<void>;
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>;
@@ -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. If the
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 interruptAs: (fiberId: FiberId) => UIO<Exit<E, A>>;
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 interruptAs: (fiberId: FiberId) => UIO<Exit<E, A>>;
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>>>, interruptAs: (fiberId: FiberId) => UIO<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;
@@ -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
  }
@@ -9,11 +9,12 @@ import { Supervisor } from "@fncts/io/Supervisor/definition";
9
9
  import type { LogSpan } from "../LogSpan.js";
10
10
  import type { Scheduler } from "@fncts/io/internal/Scheduler.js";
11
11
  import { Patch } from "@fncts/base/data/Patch";
12
+ import { IsFatal } from "../internal/IsFatal.js";
12
13
  /**
13
14
  * @tsplus static fncts.io.FiberRefOps unsafeMakePatch
14
15
  * @tsplus location "@fncts/io/FiberRef/unsafe"
15
16
  */
16
- export declare function unsafeMakePatch<Value, Patch>(initial: Value, diff: (oldValue: Value, newValue: Value) => Patch, combine: (first: Patch, second: Patch) => Patch, patch: (patch: Patch) => (oldValue: Value) => Value, fork: Patch): FiberRef.WithPatch<Value, Patch>;
17
+ export declare function unsafeMakePatch<Value, Patch>(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): FiberRef.WithPatch<Value, Patch>;
17
18
  /**
18
19
  * @tsplus static fncts.io.FiberRefOps unsafeMakeEnvironment
19
20
  * @tsplus location "@fncts/io/FiberRef/unsafe"
@@ -64,3 +65,13 @@ export declare const currentScheduler: import("./definition.js").FiberRef.WithPa
64
65
  * @tsplus location "@fncts/io/FiberRef/unsafe"
65
66
  */
66
67
  export declare const currentSupervisor: import("./definition.js").FiberRef.WithPatch<import("../Supervisor.js").Supervisor<any>, (_: import("../Supervisor.js").Supervisor<any>) => import("../Supervisor.js").Supervisor<any>>;
68
+ /**
69
+ * @tsplus static fncts.io.FiberRefOps currentIsFatal
70
+ * @tsplus location "@fncts/io/FiberRef/unsafe"
71
+ */
72
+ export declare const currentIsFatal: import("./definition.js").FiberRef.WithPatch<IsFatal, (_: IsFatal) => IsFatal>;
73
+ /**
74
+ * @tsplus static fncts.io.FiberRefOps currentReportFatal
75
+ * @tsplus location "@fncts/io/FiberRef/unsafe"
76
+ */
77
+ export declare const currentReportFatal: import("./definition.js").FiberRef.WithPatch<(t: unknown) => never, (_: (t: unknown) => never) => (t: unknown) => never>;
@@ -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;
@@ -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>>;
@@ -0,0 +1,3 @@
1
+ export * from "./Reloadable/api.js";
2
+ export * from "./Reloadable/constructors.js";
3
+ export * from "./Reloadable/definition.js";
@@ -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("19435fc3-3855-4914-989b-3d23ff58fa87");
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;;;;;;AAGO,MAAMC,QAAQ,gBAAGC,+DAAjB","names":["Clock","ClockTag","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Clock/definition.ts"],"sourcesContent":[null]}
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("d4a1e3a7-acd8-4e99-90cd-6d866a63acff");
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,+DAAnB","names":["Console","ConsoleTag","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/Console/definition.ts"],"sourcesContent":[null]}
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]}
@@ -179,12 +179,12 @@ class FiberContext {
179
179
  this.interruptExit = new InterruptExit(v => {
180
180
  if (this.unsafeIsInterruptible) {
181
181
  this.interruptStatus.pop();
182
- return tsplus_module_11.succeedNow(v, fileName_1 + ":492:27");
182
+ return tsplus_module_11.succeedNow(v, fileName_1 + ":498:27");
183
183
  } else {
184
184
  return tsplus_module_11.succeed(() => {
185
185
  this.interruptStatus.pop();
186
186
  return v;
187
- }, fileName_1 + ":494:24");
187
+ }, fileName_1 + ":500:24");
188
188
  }
189
189
  });
190
190
  this.unsafeSetRef(tsplus_module_10.currentSupervisor, this.runtimeConfig.supervisor);
@@ -204,7 +204,7 @@ class FiberContext {
204
204
 
205
205
  get inheritRefs() {
206
206
  return tsplus_module_11.defer(() => {
207
- const childFiberRefLocals = this.fiberRefLocals.get;
207
+ const childFiberRefLocals = this.fiberRefLocals;
208
208
 
209
209
  if (tsplus_module_12.isEmpty(childFiberRefLocals)) {
210
210
  return tsplus_module_11.unit;
@@ -242,18 +242,22 @@ class FiberContext {
242
242
  return tsplus_module_11.flatMap_(tsplus_module_19.environment(fileName_1 + ":136:33"), r => tsplus_module_11.flatMap_(tsplus_module_21.make(fileName_1 + ":137:30"), p => tsplus_module_11.flatMap_(this.evalOn(tsplus_module_20.fulfill_(tsplus_module_19.provideEnvironment_(effect, r, fileName_1 + ":138:46"), p, fileName_1 + ":138:57"), tsplus_module_20.fulfill_(tsplus_module_19.provideEnvironment_(orElse, r, fileName_1 + ":138:87"), p, fileName_1 + ":138:98")), () => tsplus_module_18.wait(p, fileName_1 + ":139:17"), fileName_1 + ":138:8"), fileName_1 + ":137:18"), fileName_1 + ":136:18");
243
243
  }
244
244
 
245
+ get fiberRefs() {
246
+ return tsplus_module_13.make(this.fiberRefLocals);
247
+ }
248
+
245
249
  get await() {
246
250
  return tsplus_module_11.asyncInterrupt(k => {
247
- const cb = x => k(tsplus_module_11.fromExit(() => x, fileName_1 + ":145:78"));
251
+ const cb = x => k(tsplus_module_11.fromExit(() => x, fileName_1 + ":149:78"));
248
252
 
249
253
  const result = this.unsafeAddObserver(cb);
250
254
 
251
255
  if (result == null) {
252
- return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":148:38"));
256
+ return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":152:38"));
253
257
  } else {
254
- return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":150:42"));
258
+ return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":154:42"));
255
259
  }
256
- }, this.fiberId, fileName_1 + ":144:29");
260
+ }, this.fiberId, fileName_1 + ":148:29");
257
261
  }
258
262
 
259
263
  run() {
@@ -265,19 +269,19 @@ class FiberContext {
265
269
  }
266
270
 
267
271
  get status() {
268
- return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":164:25");
272
+ return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":168:25");
269
273
  }
270
274
 
271
275
  get trace() {
272
- return tsplus_module_11.succeed(() => this.unsafeCaptureTrace(tsplus_module_24.empty()), fileName_1 + ":168:22");
276
+ return tsplus_module_11.succeed(() => this.unsafeCaptureTrace(tsplus_module_24.empty()), fileName_1 + ":172:22");
273
277
  }
274
278
 
275
279
  interruptAs(fiberId) {
276
- return this.unsafeInterruptAs(fiberId);
280
+ return tsplus_module_11.apSecond_(this.interruptAsFork(fiberId), this.await, fileName_1 + ":176:50");
277
281
  }
278
282
 
279
283
  evalOn(effect, orElse) {
280
- return tsplus_module_11.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":176:20");
284
+ return tsplus_module_11.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":180:20");
281
285
  }
282
286
 
283
287
  get location() {
@@ -310,7 +314,7 @@ class FiberContext {
310
314
 
311
315
  if (message !== null) {
312
316
  const oldIO = current;
313
- current = tsplus_module_11.flatMap_(message, () => oldIO, fileName_1 + ":213:55");
317
+ current = tsplus_module_11.flatMap_(message, () => oldIO, fileName_1 + ":217:55");
314
318
  } else if (opCount === maxOpCount) {
315
319
  this.unsafeRunLater(current);
316
320
  current = null;
@@ -471,7 +475,7 @@ class FiberContext {
471
475
  if (this.unsafeShouldInterrupt) {
472
476
  if (this.unsafeExitAsync(epoch)) {
473
477
  this.unsafeSetInterrupting(true);
474
- current = tsplus_module_11.flatMap_(r.left, () => tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":336:67"), fileName_1 + ":336:45");
478
+ current = tsplus_module_11.flatMap_(r.left, () => tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":340:67"), fileName_1 + ":340:45");
475
479
  } else {
476
480
  current = null;
477
481
  }
@@ -587,9 +591,11 @@ class FiberContext {
587
591
  current = tsplus_module_11.failCauseNow(e.exit.cause, trace);
588
592
  }
589
593
  }
594
+ } else if (this.unsafeIsFatal(e)) {
595
+ this.unsafeHandleFatalError(e);
590
596
  } else {
591
597
  this.unsafeSetInterrupting(true);
592
- current = tsplus_module_11.haltNow(e, fileName_1 + ":431:42");
598
+ current = tsplus_module_11.haltNow(e, fileName_1 + ":437:42");
593
599
  }
594
600
  }
595
601
  }
@@ -607,15 +613,15 @@ class FiberContext {
607
613
  }
608
614
 
609
615
  unsafeGetRef(ref) {
610
- return tsplus_module_33.getOrElse_(tsplus_module_33.map_(tsplus_module_12.get_(this.fiberRefLocals.get, ref), _ => _.head[1]), () => tsplus_module_32.initial(ref));
616
+ return tsplus_module_33.getOrElse_(tsplus_module_33.map_(tsplus_module_12.get_(this.fiberRefLocals, ref), _ => _.head[1]), () => tsplus_module_32.initial(ref));
611
617
  }
612
618
 
613
619
  unsafeGetRefs(fiberRefLocals) {
614
- return tsplus_module_12.map_(fiberRefLocals.get, stack => stack.head[1]);
620
+ return tsplus_module_12.map_(fiberRefLocals, stack => stack.head[1]);
615
621
  }
616
622
 
617
623
  unsafeSetRef(ref, value) {
618
- const oldState = this.fiberRefLocals.get;
624
+ const oldState = this.fiberRefLocals;
619
625
  const oldStack = tsplus_module_33.getOrElse_(tsplus_module_12.get_(oldState, ref), () => tsplus_module_24.empty());
620
626
  let newStack;
621
627
 
@@ -628,11 +634,11 @@ class FiberContext {
628
634
  }
629
635
 
630
636
  const newState = tsplus_module_12.set_(oldState, ref, newStack);
631
- this.fiberRefLocals.set(newState);
637
+ this.fiberRefLocals = newState;
632
638
  }
633
639
 
634
640
  unsafeDeleteRef(ref) {
635
- this.fiberRefLocals.set(tsplus_module_12.remove_(this.fiberRefLocals.get, ref));
641
+ this.fiberRefLocals = tsplus_module_12.remove_(this.fiberRefLocals, ref);
636
642
  }
637
643
 
638
644
  unsafePoll() {
@@ -653,7 +659,7 @@ class FiberContext {
653
659
  this.stack.push(new Finalizer(finalizer, v => {
654
660
  this.unsafeDisableInterruption();
655
661
  this.unsafeRestoreInterruptStatus();
656
- return tsplus_module_11.map_(finalizer, () => v, fileName_1 + ":506:29");
662
+ return tsplus_module_11.map_(finalizer, () => v, fileName_1 + ":512:29");
657
663
  }));
658
664
  }
659
665
 
@@ -715,11 +721,11 @@ class FiberContext {
715
721
  this.stack.push(new TracedCont(cause => tsplus_module_11.matchCauseIO_(frame.finalizer, finalizerCause => {
716
722
  this.interruptStatus.pop();
717
723
  this.unsafeAddSuppressedCause(finalizerCause);
718
- return tsplus_module_11.failCauseNow(cause, fileName_1 + ":570:43");
724
+ return tsplus_module_11.failCauseNow(cause, fileName_1 + ":576:43");
719
725
  }, () => {
720
726
  this.interruptStatus.pop();
721
- return tsplus_module_11.failCauseNow(cause, fileName_1 + ":574:43");
722
- }, fileName_1 + ":566:45"), frame.trace));
727
+ return tsplus_module_11.failCauseNow(cause, fileName_1 + ":580:43");
728
+ }, fileName_1 + ":572:45"), frame.trace));
723
729
  unwinding = false;
724
730
  break;
725
731
  }
@@ -781,26 +787,24 @@ class FiberContext {
781
787
  }
782
788
  }
783
789
 
784
- unsafeInterruptAs(fiberId) {
790
+ interruptAsFork(fiberId) {
785
791
  const interruptedCause = tsplus_module_27.interrupt(fiberId);
786
- return tsplus_module_11.defer(() => {
792
+ return tsplus_module_11.succeed(() => {
787
793
  const oldState = this.state;
788
794
 
789
795
  if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.interruptible && this.state.asyncCanceller._tag === "Registered") {
790
796
  const asyncCanceller = this.state.asyncCanceller.asyncCanceller;
791
- const interrupt = tsplus_module_11.failCauseNow(interruptedCause, fileName_1 + ":644:52");
797
+ const interrupt = tsplus_module_11.failCauseNow(interruptedCause, fileName_1 + ":650:52");
792
798
  this.state.status = tsplus_module_36.running(true);
793
799
  this.state.interruptors = new Set(oldState.interruptors).add(fiberId);
794
800
  this.state.asyncCanceller = tsplus_module_37.empty;
795
- this.unsafeRunLater(tsplus_module_11.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":648:60"));
801
+ this.unsafeRunLater(tsplus_module_11.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":654:60"));
796
802
  } else if (this.state._tag === "Executing") {
797
803
  const newCause = tsplus_module_27.then(this.state.suppressed, interruptedCause);
798
804
  this.state.interruptors.add(fiberId);
799
805
  this.state.suppressed = newCause;
800
806
  }
801
-
802
- return this.await;
803
- }, fileName_1 + ":635:20");
807
+ }, fileName_1 + ":641:14");
804
808
  }
805
809
 
806
810
  unsafeTryDone(exit, trace) {
@@ -818,7 +822,7 @@ class FiberContext {
818
822
  const mailbox = this.state.mailbox;
819
823
  this.state.mailbox = null;
820
824
  this.unsafeSetInterrupting(true);
821
- return tsplus_module_11.flatMap_(mailbox, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":670:60"), fileName_1 + ":670:42");
825
+ return tsplus_module_11.flatMap_(mailbox, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":675:60"), fileName_1 + ":675:42");
822
826
  } else if (this._children.size === 0) {
823
827
  // We are truly "done" because all the children of this fiber have terminated,
824
828
  // and there are no more pending effects that we have to execute on the fiber.
@@ -841,12 +845,12 @@ class FiberContext {
841
845
  let interruptChildren = tsplus_module_11.unit;
842
846
 
843
847
  this._children.forEach(child => {
844
- interruptChildren = tsplus_module_11.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":702:58");
848
+ interruptChildren = tsplus_module_11.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":707:58");
845
849
  });
846
850
 
847
851
  this._children.clear();
848
852
 
849
- return tsplus_module_11.flatMap_(interruptChildren, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":706:70"), fileName_1 + ":706:52");
853
+ return tsplus_module_11.flatMap_(interruptChildren, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":711:70"), fileName_1 + ":711:52");
850
854
  }
851
855
  }
852
856
  }
@@ -921,19 +925,10 @@ class FiberContext {
921
925
 
922
926
  unsafeFork(io, forkScope = tsplus_module_1.nothing(), trace) {
923
927
  const childId = tsplus_module_30.unsafeMake(tsplus_module_39.parse(trace));
924
- const childFiberRefLocals = tsplus_module_12.mapWithIndex_(this.fiberRefLocals.get, (fiberRef, stack) => {
925
- const oldValue = stack.head[1];
926
- const newValue = tsplus_module_32.patch(fiberRef)(tsplus_module_32.fork(fiberRef))(oldValue);
927
-
928
- if (oldValue === newValue) {
929
- return stack;
930
- } else {
931
- return tsplus_module_24.cons([childId, newValue], stack);
932
- }
933
- });
928
+ const childFiberRefLocals = tsplus_module_13.forkAs(this.fiberRefs, childId).fiberRefLocals;
934
929
  const parentScope = tsplus_module_33.getOrElse_(tsplus_module_33.orElse_(forkScope, () => this.unsafeGetRef(tsplus_module_10.forkScopeOverride)), () => this.scope);
935
930
  const grandChildren = new Set();
936
- const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), new _AtomicReference.AtomicReference(childFiberRefLocals), grandChildren);
931
+ const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), childFiberRefLocals, grandChildren);
937
932
 
938
933
  if (this.currentSupervisor !== tsplus_module_26.none) {
939
934
  this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(tsplus_module_10.currentEnvironment), io, tsplus_module_1.just(this), childContext);
@@ -942,7 +937,7 @@ class FiberContext {
942
937
  });
943
938
  }
944
939
 
945
- const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_31.interruptAs(parentScope.fiberId, fileName_1 + ":835:74") : io;
940
+ const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_31.interruptAs(parentScope.fiberId, fileName_1 + ":832:74") : io;
946
941
  childContext.nextIO = childIO;
947
942
  this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => childContext.runUntil(this.runtimeConfig.yieldOpCount));
948
943
  return childContext;
@@ -998,7 +993,7 @@ class FiberContext {
998
993
  this.unsafeCompleteRace(right, left, race.rightWins, raceIndicator, cb);
999
994
  }
1000
995
  }
1001
- }, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":884:20");
996
+ }, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":881:20");
1002
997
  }
1003
998
 
1004
999
  unsafeCompleteRace(winner, loser, cont, ab, cb) {
@@ -1021,11 +1016,11 @@ class FiberContext {
1021
1016
 
1022
1017
  unsafeEvalOn(effect, orElse) {
1023
1018
  if (this.state._tag === "Executing") {
1024
- const newMailbox = this.state.mailbox == null ? effect : tsplus_module_11.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":928:92");
1019
+ const newMailbox = this.state.mailbox == null ? effect : tsplus_module_11.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":925:92");
1025
1020
  this.state.mailbox = newMailbox;
1026
1021
  return tsplus_module_11.unit;
1027
1022
  } else {
1028
- return tsplus_module_11.asUnit(orElse, fileName_1 + ":932:20");
1023
+ return tsplus_module_11.asUnit(orElse, fileName_1 + ":929:20");
1029
1024
  }
1030
1025
  }
1031
1026
 
@@ -1042,14 +1037,14 @@ class FiberContext {
1042
1037
  unsafeAddChild(child) {
1043
1038
  this.unsafeEvalOn(tsplus_module_11.succeed(() => {
1044
1039
  this._children.add(child);
1045
- }, fileName_1 + ":948:17"), tsplus_module_11.unit);
1040
+ }, fileName_1 + ":945:17"), tsplus_module_11.unit);
1046
1041
  }
1047
1042
 
1048
1043
  unsafeLog(message, trace) {
1049
1044
  const logLevel = this.unsafeGetRef(tsplus_module_10.currentLogLevel);
1050
1045
  const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
1051
1046
  const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
1052
- this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, tsplus_module_27.empty(), this.fiberRefLocals.get, spans, annotations);
1047
+ this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, tsplus_module_27.empty(), this.fiberRefLocals, spans, annotations);
1053
1048
  }
1054
1049
 
1055
1050
  unsafeLogWith(message, cause, overrideLogLevel, overrideRef1 = null, overrideValue1 = null, trace) {
@@ -1069,12 +1064,20 @@ class FiberContext {
1069
1064
 
1070
1065
  contextMap = map;
1071
1066
  } else {
1072
- contextMap = this.fiberRefLocals.get;
1067
+ contextMap = this.fiberRefLocals;
1073
1068
  }
1074
1069
 
1075
1070
  this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
1076
1071
  }
1077
1072
 
1073
+ unsafeIsFatal(t) {
1074
+ return this.unsafeGetRef(tsplus_module_10.currentIsFatal).apply(t);
1075
+ }
1076
+
1077
+ unsafeHandleFatalError(t) {
1078
+ return this.unsafeGetRef(tsplus_module_10.currentReportFatal)(t);
1079
+ }
1080
+
1078
1081
  get currentSupervisor() {
1079
1082
  return this.unsafeGetRef(tsplus_module_10.currentSupervisor);
1080
1083
  }