@fncts/io 0.0.30 → 0.0.32

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 (149) hide show
  1. package/Channel/api/runScoped.d.ts +1 -0
  2. package/Channel/api.d.ts +1 -0
  3. package/Channel/internal/ChannelExecutor.d.ts +2 -2
  4. package/Fiber/FiberMessage.d.ts +5 -5
  5. package/IO/api/blocking.d.ts +7 -0
  6. package/IO/api/provideSomeLayer.d.ts +1 -2
  7. package/IO/api/zipConcurrent.d.ts +2 -1
  8. package/IO/runtime.d.ts +4 -2
  9. package/IO.d.ts +1 -0
  10. package/Ref/Synchronized/definition.d.ts +3 -3
  11. package/Semaphore.d.ts +30 -0
  12. package/Stream/api.d.ts +24 -4
  13. package/SubscriptionRef.d.ts +3 -3
  14. package/_cjs/Channel/api/mapOutConcurrentIO.cjs +14 -16
  15. package/_cjs/Channel/api/mapOutConcurrentIO.cjs.map +1 -1
  16. package/_cjs/Channel/api/mergeAllWith.cjs +30 -32
  17. package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
  18. package/_cjs/Channel/api/runScoped.cjs +19 -3
  19. package/_cjs/Channel/api/runScoped.cjs.map +1 -1
  20. package/_cjs/Channel/api/toPull.cjs +1 -1
  21. package/_cjs/Channel/api/toPull.cjs.map +1 -1
  22. package/_cjs/Channel/api.cjs +3 -2
  23. package/_cjs/Channel/api.cjs.map +1 -1
  24. package/_cjs/Channel/internal/ChannelExecutor.cjs +61 -52
  25. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  26. package/_cjs/Fiber/FiberMessage.cjs +12 -11
  27. package/_cjs/Fiber/FiberMessage.cjs.map +1 -1
  28. package/_cjs/Fiber/FiberRuntime.cjs +28 -27
  29. package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
  30. package/_cjs/FiberScope/definition.cjs +2 -2
  31. package/_cjs/FiberScope/definition.cjs.map +1 -1
  32. package/_cjs/Hub/api.cjs.map +1 -1
  33. package/_cjs/{RuntimeConfig.cjs → IO/api/blocking.cjs} +13 -5
  34. package/_cjs/IO/api/blocking.cjs.map +1 -0
  35. package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
  36. package/_cjs/IO/api/raceWith.cjs +9 -12
  37. package/_cjs/IO/api/raceWith.cjs.map +1 -1
  38. package/_cjs/IO/api/stateful.cjs +3 -3
  39. package/_cjs/IO/api/stateful.cjs.map +1 -1
  40. package/_cjs/IO/api/withChildren.cjs +5 -4
  41. package/_cjs/IO/api/withChildren.cjs.map +1 -1
  42. package/_cjs/IO/api/zipConcurrent.cjs +23 -23
  43. package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
  44. package/_cjs/IO/runtime.cjs +8 -8
  45. package/_cjs/IO/runtime.cjs.map +1 -1
  46. package/_cjs/IO.cjs +11 -0
  47. package/_cjs/IO.cjs.map +1 -1
  48. package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
  49. package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
  50. package/_cjs/Ref/Synchronized/constructors.cjs +4 -5
  51. package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
  52. package/_cjs/Ref/Synchronized/definition.cjs +1 -2
  53. package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
  54. package/_cjs/Semaphore.cjs +90 -0
  55. package/_cjs/Semaphore.cjs.map +1 -0
  56. package/_cjs/Stream/api.cjs +101 -61
  57. package/_cjs/Stream/api.cjs.map +1 -1
  58. package/_cjs/SubscriptionRef.cjs +2 -3
  59. package/_cjs/SubscriptionRef.cjs.map +1 -1
  60. package/_cjs/internal/BackgroundScheduler.cjs +199 -0
  61. package/_cjs/internal/BackgroundScheduler.cjs.map +1 -0
  62. package/_mjs/Cached/definition.mjs.map +1 -1
  63. package/_mjs/Channel/api/mapOutConcurrentIO.mjs +14 -16
  64. package/_mjs/Channel/api/mapOutConcurrentIO.mjs.map +1 -1
  65. package/_mjs/Channel/api/mergeAllWith.mjs +30 -32
  66. package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
  67. package/_mjs/Channel/api/runScoped.mjs +19 -3
  68. package/_mjs/Channel/api/runScoped.mjs.map +1 -1
  69. package/_mjs/Channel/api/toPull.mjs +1 -1
  70. package/_mjs/Channel/api/toPull.mjs.map +1 -1
  71. package/_mjs/Channel/api.mjs +3 -2
  72. package/_mjs/Channel/api.mjs.map +1 -1
  73. package/_mjs/Channel/internal/ChannelExecutor.mjs +61 -52
  74. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  75. package/_mjs/Fiber/FiberMessage.mjs +5 -5
  76. package/_mjs/Fiber/FiberMessage.mjs.map +1 -1
  77. package/_mjs/Fiber/FiberRuntime.mjs +28 -27
  78. package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
  79. package/_mjs/FiberScope/definition.mjs +2 -2
  80. package/_mjs/FiberScope/definition.mjs.map +1 -1
  81. package/_mjs/Hub/api.mjs.map +1 -1
  82. package/_mjs/IO/api/blocking.mjs +12 -0
  83. package/_mjs/IO/api/blocking.mjs.map +1 -0
  84. package/_mjs/IO/api/provideSomeLayer.mjs.map +1 -1
  85. package/_mjs/IO/api/raceWith.mjs +9 -12
  86. package/_mjs/IO/api/raceWith.mjs.map +1 -1
  87. package/_mjs/IO/api/stateful.mjs +3 -3
  88. package/_mjs/IO/api/stateful.mjs.map +1 -1
  89. package/_mjs/IO/api/withChildren.mjs +5 -4
  90. package/_mjs/IO/api/withChildren.mjs.map +1 -1
  91. package/_mjs/IO/api/zipConcurrent.mjs +23 -23
  92. package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
  93. package/_mjs/IO/runtime.mjs +6 -6
  94. package/_mjs/IO/runtime.mjs.map +1 -1
  95. package/_mjs/IO.mjs +1 -0
  96. package/_mjs/IO.mjs.map +1 -1
  97. package/_mjs/Queue/api/filterInputIO.mjs.map +1 -1
  98. package/_mjs/Queue/api/filterOutputIO.mjs.map +1 -1
  99. package/_mjs/Ref/Synchronized/constructors.mjs +4 -5
  100. package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
  101. package/_mjs/Ref/Synchronized/definition.mjs +1 -2
  102. package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
  103. package/_mjs/Semaphore.mjs +78 -0
  104. package/_mjs/Semaphore.mjs.map +1 -0
  105. package/_mjs/Stream/api.mjs +93 -57
  106. package/_mjs/Stream/api.mjs.map +1 -1
  107. package/_mjs/SubscriptionRef.mjs +2 -3
  108. package/_mjs/SubscriptionRef.mjs.map +1 -1
  109. package/_mjs/internal/BackgroundScheduler.mjs +191 -0
  110. package/_mjs/internal/BackgroundScheduler.mjs.map +1 -0
  111. package/_src/Cached/definition.ts +1 -1
  112. package/_src/Channel/api/mapOutConcurrentIO.ts +1 -1
  113. package/_src/Channel/api/mergeAllWith.ts +1 -1
  114. package/_src/Channel/api/runScoped.ts +30 -5
  115. package/_src/Channel/api/toPull.ts +1 -1
  116. package/_src/Channel/api.ts +1 -0
  117. package/_src/Channel/internal/ChannelExecutor.ts +24 -20
  118. package/_src/Fiber/FiberMessage.ts +5 -5
  119. package/_src/Fiber/FiberRuntime.ts +1 -1
  120. package/_src/FiberRefs/api.ts +1 -1
  121. package/_src/Hub/api.ts +1 -1
  122. package/_src/IO/api/blocking.ts +9 -0
  123. package/_src/IO/api/provideSomeLayer.ts +1 -3
  124. package/_src/IO/api/raceWith.ts +1 -3
  125. package/_src/IO/api/stateful.ts +1 -1
  126. package/_src/IO/api/zipConcurrent.ts +26 -30
  127. package/_src/IO/runtime.ts +4 -4
  128. package/_src/IO.ts +1 -0
  129. package/_src/Queue/api/filterInputIO.ts +1 -1
  130. package/_src/Queue/api/filterOutputIO.ts +1 -1
  131. package/_src/Ref/Synchronized/constructors.ts +2 -2
  132. package/_src/Ref/Synchronized/definition.ts +1 -1
  133. package/_src/Semaphore.ts +81 -0
  134. package/_src/State/definition.ts +1 -1
  135. package/_src/Stream/api.ts +58 -7
  136. package/_src/Subject/Atomic.ts +1 -1
  137. package/_src/SubscriptionRef.ts +2 -2
  138. package/_src/global.ts +4 -4
  139. package/_src/index.ts +2 -2
  140. package/_src/internal/BackgroundScheduler.ts +276 -0
  141. package/global.d.ts +4 -4
  142. package/index.d.ts +2 -2
  143. package/internal/BackgroundScheduler.d.ts +47 -0
  144. package/package.json +3 -3
  145. package/RuntimeConfig.d.ts +0 -11
  146. package/_cjs/RuntimeConfig.cjs.map +0 -1
  147. package/_mjs/RuntimeConfig.mjs +0 -3
  148. package/_mjs/RuntimeConfig.mjs.map +0 -1
  149. package/_src/RuntimeConfig.ts +0 -6
@@ -1,6 +1,7 @@
1
1
  import { IO } from "@fncts/io/IO/definition";
2
2
  import { Channel } from "@fncts/io/Channel";
3
3
  import { Scope } from "@fncts/io/Scope/definition";
4
+ import { Future } from "@fncts/io/Future";
4
5
  /**
5
6
  * Runs a channel until the end is received
6
7
  * @tsplus getter fncts.io.Channel runScoped
package/Channel/api.d.ts CHANGED
@@ -356,6 +356,7 @@ export declare function orHaltWith<OutErr, E>(f: (e: OutErr) => E): <Env, InErr,
356
356
  export declare function pipeTo<OutErr, OutElem, OutDone, Env1, OutErr1, OutElem1, OutDone1>(right: Channel<Env1, OutErr, OutElem, OutDone, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone>(left: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => Channel<Env1 | Env, InErr, InElem, InDone, OutErr1, OutElem1, OutDone1>;
357
357
  /**
358
358
  * @tsplus pipeable fncts.io.Channel pipeToOrFail
359
+ * @tsplus pipeable-operator fncts.io.Channel >>>
359
360
  * @tsplus location "@fncts/io/Channel/api"
360
361
  */
361
362
  export declare function pipeToOrFail<OutElem, OutDone, Env1, OutErr1, OutElem1, OutDone1>(right: Channel<Env1, never, OutElem, OutDone, OutErr1, OutElem1, OutDone1>): <Env, InErr, InElem, InDone, OutErr>(left: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>) => Channel<Env1 | Env, InErr, InElem, InDone, OutErr1 | OutErr, OutElem1, OutDone1>;
@@ -1,15 +1,15 @@
1
1
  import { Channel } from "@fncts/io/Channel";
2
2
  import { Exit } from "@fncts/base/data/Exit/definition";
3
3
  import { URIO, IO } from "@fncts/io/IO/definition";
4
+ import { Cause } from "@fncts/base/data/Cause/definition";
4
5
  import { List, Nil } from "@fncts/base/collection/immutable/List/definition";
5
6
  import { Environment } from "@fncts/base/data/Environment/definition";
6
- import { Cause } from "@fncts/base/data/Cause/definition";
7
7
  import { ListBuffer } from "@fncts/base/collection/mutable/ListBuffer";
8
8
  import { Maybe } from "@fncts/base/data/Maybe/definition";
9
9
  import type { ChannelState } from "@fncts/io/Channel/internal/ChannelState";
10
10
  import * as State from "@fncts/io/Channel/internal/ChannelState";
11
11
  export type ErasedExecutor<R> = ChannelExecutor<R, unknown, unknown, unknown, unknown, unknown, unknown>;
12
- export declare function readUpstream<R, E, A>(r: State.Read<R, E>, cont: () => IO<R, E, A>): IO<R, E, A>;
12
+ export declare function readUpstream<R, E, A, E1>(r: State.Read<R, E>, cont: () => IO<R, E1, A>, onFailure: (cause: Cause<E>) => IO<R, E1, A>): IO<R, E1, A>;
13
13
  export declare class ChannelExecutor<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone> {
14
14
  private providedEnv;
15
15
  private executeCloseLastSubstream;
@@ -26,7 +26,7 @@ export declare class InterruptSignal {
26
26
  * @tsplus static fncts.io.FiberMessageOps InterruptSignal
27
27
  * @tsplus location "@fncts/io/Fiber/FiberMessage"
28
28
  */
29
- export declare function mkInterruptSignal(cause: Cause<never>): FiberMessage;
29
+ export declare function interruptSignal(cause: Cause<never>): FiberMessage;
30
30
  export declare class GenStackTrace {
31
31
  readonly onTrace: (trace: Trace) => void;
32
32
  readonly _tag = FiberMessageTag.GenStackTrace;
@@ -36,7 +36,7 @@ export declare class GenStackTrace {
36
36
  * @tsplus static fncts.io.FiberMessageOps GenStackTrace
37
37
  * @tsplus location "@fncts/io/Fiber/FiberMessage"
38
38
  */
39
- export declare function mkGenStackTrace(onTrace: (trace: Trace) => void): FiberMessage;
39
+ export declare function genStackTrace(onTrace: (trace: Trace) => void): FiberMessage;
40
40
  export declare class Stateful {
41
41
  readonly onFiber: (fiber: FiberRuntime<any, any>, status: FiberStatus) => void;
42
42
  readonly _tag = FiberMessageTag.Stateful;
@@ -46,7 +46,7 @@ export declare class Stateful {
46
46
  * @tsplus static fncts.io.FiberMessageOps Stateful
47
47
  * @tsplus location "@fncts/io/Fiber/FiberMessage"
48
48
  */
49
- export declare function mkStateful(onFiber: (fiber: FiberRuntime<any, any>, status: FiberStatus) => void): FiberMessage;
49
+ export declare function stateful(onFiber: (fiber: FiberRuntime<any, any>, status: FiberStatus) => void): FiberMessage;
50
50
  export declare class Resume {
51
51
  readonly cont: IO<any, any, any>;
52
52
  readonly _tag = FiberMessageTag.Resume;
@@ -56,7 +56,7 @@ export declare class Resume {
56
56
  * @tsplus static fncts.io.FiberMessageOps Resume
57
57
  * @tsplus location "@fncts/io/Fiber/FiberMessage"
58
58
  */
59
- export declare function mkResume(cont: IO<any, any, any>): FiberMessage;
59
+ export declare function resume(cont: IO<any, any, any>): FiberMessage;
60
60
  export interface YieldNow {
61
61
  readonly _tag: FiberMessageTag.YieldNow;
62
62
  }
@@ -64,4 +64,4 @@ export interface YieldNow {
64
64
  * @tsplus static fncts.io.FiberMessageOps YieldNow
65
65
  * @tsplus location "@fncts/io/Fiber/FiberMessage"
66
66
  */
67
- export declare const YieldNow: FiberMessage;
67
+ export declare const yieldNow: FiberMessage;
@@ -0,0 +1,7 @@
1
+ import { IO } from "@fncts/io/IO/definition";
2
+ /**
3
+ * @tsplus static fncts.io.IOOps blocking
4
+ * @tsplus getter fncts.io.IO blocking
5
+ * @tsplus location "@fncts/io/IO/api/blocking"
6
+ */
7
+ export declare function blocking<R, E, A>(self: IO<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
@@ -1,9 +1,8 @@
1
1
  import { Layer } from "@fncts/io/Layer";
2
2
  import { IO } from "@fncts/io/IO/definition";
3
- import type { Erase } from "@fncts/typelevel/Intersection";
4
3
  /**
5
4
  * @tsplus static fncts.io.IOAspects provideSomeLayer
6
5
  * @tsplus pipeable fncts.io.IO provideSomeLayer
7
6
  * @tsplus location "@fncts/io/IO/api/provideSomeLayer"
8
7
  */
9
- export declare function provideSomeLayer<RIn, E1, ROut>(layer: Layer<RIn, E1, ROut>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").IO<R, E, A>) => import("../definition").IO<RIn & Erase<R, ROut>, E1 | E, A>;
8
+ export declare function provideSomeLayer<RIn, E1, ROut>(layer: Layer<RIn, E1, ROut>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").IO<R, E, A>) => import("../definition").IO<RIn | Exclude<R, ROut>, E1 | E, A>;
@@ -1,4 +1,5 @@
1
1
  import { IO } from "@fncts/io/IO/definition";
2
+ import { Zipped } from "@fncts/base/data/Zipped";
2
3
  import { Lazy } from "@fncts/base/data/function/definition";
3
4
  import { Future } from "@fncts/io/Future";
4
5
  import { Fiber } from "@fncts/io/Fiber/definition";
@@ -6,7 +7,7 @@ import { Fiber } from "@fncts/io/Fiber/definition";
6
7
  * @tsplus pipeable fncts.io.IO zipConcurrent
7
8
  * @tsplus location "@fncts/io/IO/api/zipConcurrent"
8
9
  */
9
- export declare function zipConcurrent<R1, E1, B>(that: IO<R1, E1, B>, __tsplusTrace?: string): <R, E, A>(self: import("../definition.js").IO<R, E, A>) => import("../definition.js").IO<R1 | R, E1 | E, readonly [A, B]>;
10
+ export declare function zipConcurrent<R1, E1, B>(that: IO<R1, E1, B>, __tsplusTrace?: string): <R, E, A>(self: import("../definition.js").IO<R, E, A>) => import("../definition.js").IO<R1 | R, E1 | E, import("@fncts/base/data/Zipped.js").Zipped.Make<A, B>>;
10
11
  /**
11
12
  * @tsplus pipeable fncts.io.IO zipWithConcurrent
12
13
  * @tsplus location "@fncts/io/IO/api/zipConcurrent"
package/IO/runtime.d.ts CHANGED
@@ -6,6 +6,8 @@ import { Supervisor } from "@fncts/io/Supervisor/definition";
6
6
  import { Nothing } from "@fncts/base/data/Maybe/definition";
7
7
  import { FiberScope } from "@fncts/io/FiberScope";
8
8
  import { Exit } from "@fncts/base/data/Exit/definition";
9
+ import { Either } from "@fncts/base/data/Either/definition";
10
+ import { Fiber } from "@fncts/io/Fiber/definition";
9
11
  import { FiberRuntime } from "@fncts/io/Fiber";
10
12
  import { FiberRefs } from "@fncts/io/FiberRefs";
11
13
  import { RuntimeFlags } from "@fncts/io/RuntimeFlags";
@@ -19,7 +21,7 @@ export declare class Runtime<R> {
19
21
  unsafeRunAsync: <E, A>(io: import("./definition.js").IO<R, E, A>, __tsplusTrace?: string) => void;
20
22
  unsafeRunAsyncWith: <E, A>(io: import("./definition.js").IO<R, E, A>, k: (exit: import("@fncts/base/data/Exit.js").Exit<E, A>) => any, __tsplusTrace?: string) => void;
21
23
  unsafeRunPromiseExit: <E, A>(io: import("./definition.js").IO<R, E, A>, __tsplusTrace?: string) => Promise<import("@fncts/base/data/Exit.js").Exit<E, A>>;
22
- unsafeRunSyncExit: <E, A>(io: import("./definition.js").IO<R, E, A>, __tsplusTrace?: string) => import("@fncts/base/data/Exit.js").Exit<E, A>;
24
+ unsafeRunOrFork: <E, A>(io: import("./definition.js").IO<R, E, A>, __tsplusTrace?: string) => import("@fncts/base/data/Either.js").Either<import("@fncts/io/Fiber").Fiber.Runtime<E, A>, import("@fncts/base/data/Exit.js").Exit<E, A>>;
23
25
  }
24
26
  /**
25
27
  * @tsplus static fncts.io.IOOps runtime
@@ -56,4 +58,4 @@ export declare const unsafeRunWith: <E, A>(io: import("./definition.js").IO<neve
56
58
  * @tsplus getter fncts.io.IO unsafeRunSyncExit
57
59
  * @tsplus location "@fncts/io/IO/runtime"
58
60
  */
59
- export declare const unsafeRunSyncExit: <E, A>(io: import("./definition.js").IO<never, E, A>, __tsplusTrace?: string) => import("@fncts/base/data/Exit.js").Exit<E, A>;
61
+ export declare const unsafeRunOrFork: <E, A>(io: import("./definition.js").IO<never, E, A>, __tsplusTrace?: string) => import("@fncts/base/data/Either.js").Either<import("@fncts/io/Fiber").Fiber.Runtime<E, A>, import("@fncts/base/data/Exit.js").Exit<E, A>>;
package/IO.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./IO/api/addFinalizer.js";
9
9
  export * from "./IO/api/addFinalizerExit.js";
10
10
  export * from "./IO/api/asyncInterrupt.js";
11
11
  export * from "./IO/api/asyncIO.js";
12
+ export * from "./IO/api/blocking.js";
12
13
  export * from "./IO/api/bracket.js";
13
14
  export * from "./IO/api/bracketExit.js";
14
15
  export * from "./IO/api/clockWith.js";
@@ -1,4 +1,4 @@
1
- import { TSemaphore } from "@fncts/io/TSemaphore/definition";
1
+ import { Semaphore } from "@fncts/io/Semaphore";
2
2
  import { Either } from "@fncts/base/data/Either/definition";
3
3
  import type { PRef } from "../definition.js";
4
4
  import { IO } from "@fncts/io/IO";
@@ -25,11 +25,11 @@ export declare const Synchronized: PSynchronizedOps;
25
25
  * @tsplus type fncts.io.Ref.Synchronized
26
26
  */
27
27
  export declare class PSynchronizedInternal<RA, RB, EA, EB, A, B> extends RefInternal<RA, RB, EA, EB, A, B> {
28
- readonly semaphore: TSemaphore;
28
+ readonly semaphore: Semaphore;
29
29
  readonly unsafeGet: IO<RB, EB, B>;
30
30
  readonly unsafeSet: (a: A) => IO<RA, EA, void>;
31
31
  readonly [SynchronizedTypeId]: SynchronizedTypeId;
32
- constructor(semaphore: TSemaphore, unsafeGet: IO<RB, EB, B>, unsafeSet: (a: A) => IO<RA, EA, void>);
32
+ constructor(semaphore: Semaphore, unsafeGet: IO<RB, EB, B>, unsafeSet: (a: A) => IO<RA, EA, void>);
33
33
  get get(): IO<RB, EB, B>;
34
34
  set(a: A, __tsplusTrace?: string): IO<RA, EA, void>;
35
35
  modify<C>(f: (b: B) => readonly [C, A], __tsplusTrace?: string | undefined): IO<RA | RB, EA | EB, C>;
package/Semaphore.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { IO, UIO } from "@fncts/io/IO/definition";
2
+ import { Either } from "@fncts/base/data/Either/definition";
3
+ import { FiberRef } from "@fncts/io/FiberRef/definition";
4
+ /**
5
+ * @tsplus type fncts.io.Semaphore
6
+ * @tsplus companion fncts.io.SemaphoreOps
7
+ */
8
+ export declare class Semaphore {
9
+ readonly permits: number;
10
+ constructor(permits: number);
11
+ taken: number;
12
+ waiters: Set<() => void>;
13
+ get free(): number;
14
+ runNext(): void;
15
+ take(n: number): import("./IO").IO<never, never, number>;
16
+ release(n: number): import("./IO").IO<never, never, void>;
17
+ withPermits(permits: number): <R, E, A>(io: import("./IO").IO<R, E, A>) => import("./IO").IO<R, E, A>;
18
+ withPermit<R, E, A>(io: IO<R, E, A>): IO<R, E, A>;
19
+ }
20
+ /**
21
+ * @tsplus static fncts.io.SemaphoreOps unsafeMake
22
+ * @tsplus location "@fncts/io/Semaphore"
23
+ */
24
+ export declare function unsafeMakeSemaphore(permits: number): Semaphore;
25
+ /**
26
+ * @tsplus static fncts.io.SemaphoreOps make
27
+ * @tsplus static fncts.io.SemaphoreOps __call
28
+ * @tsplus location "@fncts/io/Semaphore"
29
+ */
30
+ export declare function makeSemaphore(permits: number, __tsplusTrace?: string): UIO<Semaphore>;
package/Stream/api.d.ts CHANGED
@@ -21,7 +21,6 @@ import { Layer } from "@fncts/io/Layer";
21
21
  import type { PHub } from "../Hub.js";
22
22
  import type { Canceler } from "../IO.js";
23
23
  import type { PDequeue, PEnqueue, PQueue } from "../Queue.js";
24
- import { MergeDecision } from "../Channel/internal/MergeDecision.js";
25
24
  import { Hub } from "../Hub.js";
26
25
  import { Queue } from "../Queue.js";
27
26
  import { Stream } from "./definition.js";
@@ -310,6 +309,11 @@ export declare function contramapEnvironment<R, R0>(f: (r0: Environment<R0>) =>
310
309
  * @tsplus location "@fncts/io/Stream/api"
311
310
  */
312
311
  export declare function debounce(duration: Lazy<Duration>, __tsplusTrace?: string): <R, E, A>(stream: Stream<R, E, A>) => Stream<R, E, A>;
312
+ /**
313
+ * @tsplus static fncts.io.StreamOps defer
314
+ * @tsplus location "@fncts/io/Stream/api"
315
+ */
316
+ export declare function defer<R, E, A>(self: Lazy<Stream<R, E, A>>): Stream<R, E, A>;
313
317
  /**
314
318
  * Switches to the provided stream in case this one is empty.
315
319
  * @tsplus pipeable fncts.io.Stream defaultIfEmpty
@@ -729,10 +733,15 @@ export declare function mapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>, __tsplus
729
733
  * executing up to `n` invocations of `f` concurrently. Transformed elements
730
734
  * will be emitted in the original order.
731
735
  * @note This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
732
- * @tsplus pipeable fncts.io.Stream mapIOC
736
+ * @tsplus pipeable fncts.io.Stream mapIOConcurrently
737
+ * @tsplus location "@fncts/io/Stream/api"
738
+ */
739
+ export declare function mapIOConcurrently<A, R1, E1, B>(n: number, f: (a: A) => IO<R1, E1, B>, __tsplusTrace?: string): <R, E>(stream: Stream<R, E, A>) => Stream<R1 | R, E1 | E, B>;
740
+ /**
741
+ * @tsplus pipeable fncts.io.Stream mapIOConcurrentlyUnordered
733
742
  * @tsplus location "@fncts/io/Stream/api"
734
743
  */
735
- export declare function mapIOC<A, R1, E1, B>(n: number, f: (a: A) => IO<R1, E1, B>, __tsplusTrace?: string): <R, E>(stream: Stream<R, E, A>) => Stream<R1 | R, E1 | E, B>;
744
+ export declare function mapIOConcurrentlyUnordered<A, R1, E1, B>(n: number, f: (a: A) => IO<R1, E1, B>): <R, E>(self: Stream<R, E, A>) => Stream<R1 | R, E1 | E, B>;
736
745
  /**
737
746
  * Maps each element of this stream to another stream and returns the
738
747
  * non-deterministic merge of those streams, executing up to `n` inner streams
@@ -755,7 +764,6 @@ export declare function mergeMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>, n:
755
764
  * @tsplus location "@fncts/io/Stream/api"
756
765
  */
757
766
  export declare function mergeEither<R1, E1, B>(fb: Stream<R1, E1, B>, __tsplusTrace?: string): <R, E, A>(fa: Stream<R, E, A>) => Stream<R1 | R, E1 | E, import("@fncts/base/data/Either.js").Either<A, B>>;
758
- export declare function mergeWithHandler<R, E>(terminate: boolean, __tsplusTrace?: string): (exit: Exit<E, unknown>) => MergeDecision<R, E, unknown, E, unknown>;
759
767
  export type TerminationStrategy = "Left" | "Right" | "Both" | "Either";
760
768
  /**
761
769
  * @tsplus pipeable fncts.io.Stream mergeWith
@@ -811,6 +819,11 @@ export declare function orElseSucceed<A1>(a: Lazy<A1>, __tsplusTrace?: string):
811
819
  * @tsplus location "@fncts/io/Stream/api"
812
820
  */
813
821
  export declare function pipeThrough<A, R1, E1, L, Z>(sa: Sink<R1, E1, A, L, Z>, __tsplusTrace?: string): <R, E>(ma: Stream<R, E, A>) => Stream<R1 | R, E1 | E, L>;
822
+ /**
823
+ * @tsplus pipeable fncts.io.Stream pipeThroughChannelOrFail
824
+ * @tsplus location "@fncts/io/Stream/api"
825
+ */
826
+ export declare function pipeThroughChannelOrFail<A, R1, E1, B>(channel: Channel<R1, never, Conc<A>, any, E1, Conc<B>, any>): <R, E>(self: Stream<R, E, A>) => Stream<R1 | R, E1 | E, B>;
814
827
  /**
815
828
  * Provides the stream with its required environment, which eliminates
816
829
  * its dependency on `R`.
@@ -903,6 +916,13 @@ export declare function runIntoElementsScoped_<E, A, R1, E1>(queue: PQueue<R1, u
903
916
  * @tsplus location "@fncts/io/Stream/api"
904
917
  */
905
918
  export declare function runIntoQueueScoped<RA, RB, EA, EB, E1, A, B>(queue: PEnqueue<RA, RB, EA, EB, Take<E1, A>, B>, __tsplusTrace?: string): <R, E extends E1>(stream: Stream<R, E, A>) => import("../IO.js").IO<import("../Scope.js").Scope | RA | R, EA | E1 | E, void>;
919
+ /**
920
+ * Like runIntoQueue, but provides the result as a scoped IO
921
+ * to allow for scope composition.
922
+ * @tsplus pipeable fncts.io.Stream runIntoQueueElementsScoped
923
+ * @tsplus location "@fncts/io/Stream/api"
924
+ */
925
+ export declare function runIntoQueueElementsScoped<E, A>(queue: Lazy<Queue.Enqueue<Exit<Maybe<E>, A>>>): <R>(self: Stream<R, E, A>) => import("../IO.js").IO<import("../Scope.js").Scope | R, never, void>;
906
926
  /**
907
927
  * Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
908
928
  * composition.
@@ -1,4 +1,4 @@
1
- import { TSemaphore } from "@fncts/io/TSemaphore/definition";
1
+ import { Semaphore } from "@fncts/io/Semaphore";
2
2
  import { Hub } from "@fncts/io/Hub/definition";
3
3
  import { Ref, PRef } from "@fncts/io/Ref/definition";
4
4
  import { UIO, IO } from "@fncts/io/IO/definition";
@@ -8,11 +8,11 @@ import { Stream } from "@fncts/io/Stream";
8
8
  export declare const SubscriptionRefTypeId: unique symbol;
9
9
  export type SubscriptionRefTypeId = typeof SubscriptionRefTypeId;
10
10
  export declare class SubscriptionRefInternal<A> extends PSynchronizedInternal<never, never, never, never, A, A> {
11
- readonly semaphore: TSemaphore;
11
+ readonly semaphore: Semaphore;
12
12
  readonly hub: Hub<A>;
13
13
  readonly ref: Ref<A>;
14
14
  readonly [SubscriptionRefTypeId]: SubscriptionRefTypeId;
15
- constructor(semaphore: TSemaphore, hub: Hub<A>, ref: Ref<A>);
15
+ constructor(semaphore: Semaphore, hub: Hub<A>, ref: Ref<A>);
16
16
  changes: Stream<never, never, A>;
17
17
  set(a: A, __tsplusTrace?: string): UIO<void>;
18
18
  modifyIO<R1, E1, B>(f: (a: A) => IO<R1, E1, readonly [B, A]>, __tsplusTrace?: string): IO<R1, E1, B>;
@@ -10,21 +10,19 @@ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
10
10
  var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/operations"));
11
11
  var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
12
12
  var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
13
- var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/api"));
14
- var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/interrupt"));
15
- var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
16
- var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/raceFirst"));
17
- var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fulfill"));
18
- var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
19
- var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fork"));
20
- var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
21
- var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/constructors"));
22
- var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/STM/api/atomically"));
23
- var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
24
- var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
25
- var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interruptAll"));
26
- var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/addFinalizer"));
27
- var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/withChildren"));
13
+ var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/interrupt"));
14
+ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
15
+ var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/raceFirst"));
16
+ var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fulfill"));
17
+ var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
18
+ var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fork"));
19
+ var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
20
+ var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Semaphore"));
21
+ var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
22
+ var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
23
+ var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interruptAll"));
24
+ var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/addFinalizer"));
25
+ var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/withChildren"));
28
26
  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); }
29
27
  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; }
30
28
  const fileName_1 = "(@fncts/io) src/Channel/api/mapOutConcurrentIO.ts";
@@ -36,7 +34,7 @@ function mapOutConcurrentIO(n, f) {
36
34
  return tsplus_module_2.unwrapScoped(() => tsplus_module_5.map(queue => {
37
35
  const consumer = tsplus_module_2.unwrap(() => tsplus_module_5.matchCause(tsplus_module_1.failCauseNow, r => tsplus_module_3.match(tsplus_module_1.endNow, outElem => tsplus_module_1.zipRight(consumer)(tsplus_module_2.writeNow(outElem)))(r), fileName_1 + ":58:42")(tsplus_module_5.flatten(tsplus_module_4.take(queue, fileName_1 + ":58:18"), fileName_1 + ":58:23")));
38
36
  return consumer;
39
- }, fileName_1 + ":55:12")(tsplus_module_21.withChildren(getChildren => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(queue => tsplus_module_5.flatMap(errorSignal => tsplus_module_5.flatMap(permits => tsplus_module_5.flatMap(pull => tsplus_module_5.map(() => queue, fileName_1 + ":24:12")(tsplus_module_13.fork(tsplus_module_8.uninterruptible(tsplus_module_5.forever(tsplus_module_5.matchCauseIO(cause => tsplus_module_4.offer(tsplus_module_5.failCauseNow(cause, fileName_1 + ":26:53"), fileName_1 + ":26:37")(queue), r => tsplus_module_3.match(outDone => tsplus_module_5.asUnit(tsplus_module_5.zipRight(tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_6.left(outDone), fileName_1 + ":32:72"), fileName_1 + ":32:58")(queue), fileName_1 + ":32:46")(tsplus_module_8.interruptible(tsplus_module_7.withPermits(permits, fileName_1 + ":30:28")(n)(tsplus_module_5.unit), fileName_1 + ":31:47")), fileName_1 + ":32:96"), outElem => tsplus_module_5.flatMap(p => tsplus_module_5.flatMap(latch => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(() => void 0, fileName_1 + ":48:24")(tsplus_module_9.wait(latch, fileName_1 + ":48:30")), fileName_1 + ":38:24")(tsplus_module_7.withPermit(permits, fileName_1 + ":39:32")(tsplus_module_5.zipRight(tsplus_module_11.fulfill(p, fileName_1 + ":44:39")(tsplus_module_5.tapErrorCause(c => tsplus_module_9.failCause(c, fileName_1 + ":43:64")(p), fileName_1 + ":43:45")(tsplus_module_10.raceFirst(f(outElem), fileName_1 + ":42:41")(tsplus_module_9.wait(errorSignal, fileName_1 + ":41:40")))), fileName_1 + ":40:60")(tsplus_module_9.succeed_(undefined, fileName_1 + ":40:40")(latch)))), fileName_1 + ":37:24")(tsplus_module_4.offer(tsplus_module_5.map(tsplus_module_6.right, fileName_1 + ":37:48")(tsplus_module_9.wait(p, fileName_1 + ":37:38")), fileName_1 + ":37:36")(queue)), fileName_1 + ":36:38")(tsplus_module_12.make(fileName_1 + ":36:50")), fileName_1 + ":35:38")(tsplus_module_12.make(fileName_1 + ":35:50")))(r), fileName_1 + ":25:30")(pull), fileName_1 + ":51:14"), fileName_1 + ":51:22"), fileName_1 + ":51:38")), fileName_1 + ":23:32")(tsplus_module_14.toPull(self)), fileName_1 + ":22:32")(tsplus_module_16.atomically(tsplus_module_15.make(n, fileName_1 + ":22:48"), fileName_1 + ":22:51")), fileName_1 + ":21:32")(tsplus_module_12.make(fileName_1 + ":21:44")), fileName_1 + ":15:26")(tsplus_module_18.acquireRelease(() => tsplus_module_17.makeBounded(n, fileName_1 + ":17:32"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":18:31"), fileName_1 + ":16:30")), fileName_1 + ":14:12")(tsplus_module_20.addFinalizer(() => tsplus_module_5.flatMap(tsplus_module_19.interruptAll, fileName_1 + ":14:48")(getChildren), fileName_1 + ":14:28")), fileName_1 + ":12:22")));
37
+ }, fileName_1 + ":55:12")(tsplus_module_19.withChildren(getChildren => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(queue => tsplus_module_5.flatMap(errorSignal => tsplus_module_5.flatMap(permits => tsplus_module_5.flatMap(pull => tsplus_module_5.map(() => queue, fileName_1 + ":24:12")(tsplus_module_12.fork(tsplus_module_7.uninterruptible(tsplus_module_5.forever(tsplus_module_5.matchCauseIO(cause => tsplus_module_4.offer(tsplus_module_5.failCauseNow(cause, fileName_1 + ":26:53"), fileName_1 + ":26:37")(queue), r => tsplus_module_3.match(outDone => tsplus_module_5.asUnit(tsplus_module_5.zipRight(tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_6.left(outDone), fileName_1 + ":32:72"), fileName_1 + ":32:58")(queue), fileName_1 + ":32:46")(tsplus_module_7.interruptible(permits.withPermits(n)(tsplus_module_5.unit), fileName_1 + ":31:47")), fileName_1 + ":32:96"), outElem => tsplus_module_5.flatMap(p => tsplus_module_5.flatMap(latch => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(() => void 0, fileName_1 + ":48:24")(tsplus_module_8.wait(latch, fileName_1 + ":48:30")), fileName_1 + ":38:24")(permits.withPermit(tsplus_module_5.zipRight(tsplus_module_10.fulfill(p, fileName_1 + ":44:39")(tsplus_module_5.tapErrorCause(c => tsplus_module_8.failCause(c, fileName_1 + ":43:64")(p), fileName_1 + ":43:45")(tsplus_module_9.raceFirst(f(outElem), fileName_1 + ":42:41")(tsplus_module_8.wait(errorSignal, fileName_1 + ":41:40")))), fileName_1 + ":40:60")(tsplus_module_8.succeed_(undefined, fileName_1 + ":40:40")(latch)))), fileName_1 + ":37:24")(tsplus_module_4.offer(tsplus_module_5.map(tsplus_module_6.right, fileName_1 + ":37:48")(tsplus_module_8.wait(p, fileName_1 + ":37:38")), fileName_1 + ":37:36")(queue)), fileName_1 + ":36:38")(tsplus_module_11.make(fileName_1 + ":36:50")), fileName_1 + ":35:38")(tsplus_module_11.make(fileName_1 + ":35:50")))(r), fileName_1 + ":25:30")(pull), fileName_1 + ":51:14"), fileName_1 + ":51:22"), fileName_1 + ":51:38")), fileName_1 + ":23:32")(tsplus_module_13.toPull(self)), fileName_1 + ":22:32")(tsplus_module_14.makeSemaphore(n, fileName_1 + ":22:42")), fileName_1 + ":21:32")(tsplus_module_11.make(fileName_1 + ":21:44")), fileName_1 + ":15:26")(tsplus_module_16.acquireRelease(() => tsplus_module_15.makeBounded(n, fileName_1 + ":17:32"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":18:31"), fileName_1 + ":16:30")), fileName_1 + ":14:12")(tsplus_module_18.addFinalizer(() => tsplus_module_5.flatMap(tsplus_module_17.interruptAll, fileName_1 + ":14:48")(getChildren), fileName_1 + ":14:28")), fileName_1 + ":12:22")));
40
38
  };
41
39
  }
42
40
  //# sourceMappingURL=mapOutConcurrentIO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapOutConcurrentIO.cjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;AAGM,SAAUA,kBAAkB,CAChCC,CAAS,EACTC,CAA8C;EAE9C,OACEC,IAAmE,IACgB;IACnF,OAAOC,mCACLC,oBA2COC,KAAK,IAAI;MACd,MAAMC,QAAQ,GACZH,6BACEC,yDAAqDG,CAAC,IACpDC,8CAAyBC,OAAO,IAAKC,yBAAmCJ,QAAQ,EAA3CH,yBAAiBM,OAAO,CAAC,CAAmB,EAAjFF,CAAC,CAAiF,sEADpFF,KAAK,iDAEJ,CACF;MACH,OAAOC,QAAQ;IACjB,CAAC,yBAnDDK,8BAAiBC,WAAW,IAAIR,sDAGtBC,KAAK,4BAMLQ,WAAW,4BACXC,OAAO,4BACPC,IAAI,8BA8BHV,KAAK,uGA5BVD,6BACGY,KAAK,IAAKC,sBAAYb,6BAAgBY,KAAK,wBAAC,yBAAlCX,KAAK,CAA8B,EAC7CE,CAAC,IACAC,sBACGU,OAAO,IAAId,uBACVA,yBAE0Ba,sBAAYb,2BAAce,qBAAYD,OAAO,CAAC,wBAAC,yBAA/Cb,KAAK,CAA2C,uDAF1Ee,mCAAO,yBACQpB,CAAC,CAAC,sBAAS,yBACiD,wBAAO,EACnFS,OAAO,IAAIL,wBAEFiB,CAAC,4BACDC,KAAK,8IAYTA,KAAK,kDATLF,kCAAO,yBACLhB,yBACEmB,yBAGWF,CAAC,yBAHZjB,8BAEkBoB,CAAC,IAAKC,0BAAYD,CAAC,yBAAbH,CAAC,CAAa,yBAFtCK,2BACazB,CAAC,CAACQ,OAAO,CAAC,8CADvBI,WAAW,yBACa,CACe,CAC1B,yBAJfY,yBAAcE,SAAS,yBAAvBL,KAAK,CAAmB,CAKvB,CACF,0BATDL,sBAAYb,wFAAC,yBAAwB,yBAArCC,KAAK,CAAiC,0BADxBuB,4CAA0B,0BAD1BA,4CAAgC,CAchD,EArBNrB,CAAC,CAsBA,yBAzBLQ,IAAI,CA0BH,0HA5BmBb,IAAI,uDADJ2B,sBAAgB7B,CAAC,wBAAC,kDADlB4B,4CAA6B,0BALjDE,sCACEC,6BAAyE/B,CAAC,wBAAC,EAC1EK,KAAK,IAAIY,yBAACZ,KAAK,wBAAS,wBAC1B,0BALD2B,oCAAgB5B,yFAAW,CAA4B,wBAAC,CAwC1D,wBACH,CAQC,CACH;EACH,CAAC;AACH","names":["mapOutConcurrentIO","n","f","self","tsplus_module_2","tsplus_module_5","queue","consumer","r","tsplus_module_3","outElem","tsplus_module_1","tsplus_module_21","getChildren","errorSignal","permits","pull","cause","tsplus_module_4","outDone","tsplus_module_6","tsplus_module_7","p","latch","tsplus_module_11","c","tsplus_module_9","tsplus_module_10","undefined","tsplus_module_12","tsplus_module_15","tsplus_module_18","tsplus_module_17","tsplus_module_20"],"sourceRoot":"","sources":["../../../_src/Chann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BAD1BA,4CAAgC,CAchD,EArBNtB,CAAC,CAsBA,yBAzBLQ,IAAI,CA0BH,0HA5BmBb,IAAI,2BADJ4B,+BAAU9B,CAAC,wBAAC,0BADZ6B,4CAA6B,0BALjDE,sCACEC,6BAAyEhC,CAAC,wBAAC,EAC1EK,KAAK,IAAIY,yBAACZ,KAAK,wBAAS,wBAC1B,0BALD4B,oCAAgB7B,yFAAW,CAA4B,wBAAC,CAwC1D,wBACH,CAQC,CACH;EACH,CAAC;AACH","names":["mapOutConcurrentIO","n","f","self","tsplus_module_2","tsplus_module_5","queue","consumer","r","tsplus_module_3","outElem","tsplus_module_1","tsplus_module_19","getChildren","errorSignal","permits","pull","cause","tsplus_module_4","outDone","tsplus_module_6","withPermits","p","latch","withPermit","tsplus_module_10","c","tsplus_module_8","tsplus_module_9","undefined","tsplus_module_11","tsplus_module_14","tsplus_module_16","tsplus_module_15","tsplus_module_18"],"sourceRoot":"","sources":["../../../_src/Channel/api/mapOutConcurrentIO.ts"],"sourcesContent":[null]}
@@ -10,28 +10,26 @@ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
10
10
  var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/operations"));
11
11
  var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
12
12
  var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interruptAll"));
13
- var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/api"));
14
- var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
15
- var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
16
- var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
17
- var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/get"));
18
- var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
19
- var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/raceWith"));
20
- var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fork"));
21
- var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/race"));
22
- var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
23
- var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scoped"));
24
- var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
25
- var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
26
- var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/modify"));
27
- var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
28
- var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/constructors"));
29
- var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/STM/api/atomically"));
30
- var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/constructors"));
31
- var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
32
- var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
33
- var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/addFinalizer"));
34
- var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/withChildren"));
13
+ var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
14
+ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
15
+ var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
16
+ var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/get"));
17
+ var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
18
+ var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/raceWith"));
19
+ var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fork"));
20
+ var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/race"));
21
+ var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
22
+ var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scoped"));
23
+ var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
24
+ var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
25
+ var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/modify"));
26
+ var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
27
+ var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Semaphore"));
28
+ var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/constructors"));
29
+ var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
30
+ var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
31
+ var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/addFinalizer"));
32
+ var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/withChildren"));
35
33
  var _function = /*#__PURE__*/require("@fncts/base/data/function");
36
34
  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); }
37
35
  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; }
@@ -44,23 +42,23 @@ function mergeAllWith(n, f, bufferSize = 16, mergeStrategy = "BackPressure") {
44
42
  return tsplus_module_2.unwrapScoped(() => tsplus_module_5.map(queue => {
45
43
  const consumer = tsplus_module_2.unwrap(() => tsplus_module_5.matchCause(tsplus_module_1.failCauseNow, out => tsplus_module_3.match(tsplus_module_1.endNow, outElem => tsplus_module_1.zipRight(consumer)(tsplus_module_2.writeNow(outElem)))(out), fileName_1 + ":121:42")(tsplus_module_5.flatten(tsplus_module_4.take(queue, fileName_1 + ":121:18"), fileName_1 + ":121:23")));
46
44
  return consumer;
47
- }, fileName_1 + ":118:12")(tsplus_module_28.withChildren(getChildren => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(queue => tsplus_module_5.flatMap(cancelers => tsplus_module_5.flatMap(lastDone => tsplus_module_5.flatMap(errorSignal => tsplus_module_5.flatMap(permits => tsplus_module_5.flatMap(pull => {
48
- const evaluatePull = pull => tsplus_module_5.flatMap(md1 => tsplus_module_10.match(() => tsplus_module_5.unit, outDone => tsplus_module_20.update(md2 => tsplus_module_10.match(() => tsplus_module_19.just(outDone), lastDone => tsplus_module_19.just(f(lastDone, outDone)))(md2), fileName_1 + ":53:36")(lastDone))(md1), fileName_1 + ":49:23")(tsplus_module_5.repeatUntil(m => tsplus_module_21.isJust(m), fileName_1 + ":48:27")(tsplus_module_5.flatMap(ea => tsplus_module_3.match(outDone => tsplus_module_5.succeedNow(tsplus_module_19.just(outDone), fileName_1 + ":44:45"), outElem => tsplus_module_5.as(() => tsplus_module_19.nothing(), fileName_1 + ":45:84")(tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_9.right(outElem), fileName_1 + ":45:57"), fileName_1 + ":45:43")(queue)))(ea), fileName_1 + ":42:23")(pull)));
49
- return tsplus_module_5.map(() => queue, fileName_1 + ":61:12")(tsplus_module_14.fork(tsplus_module_5.repeatWhile(_function.identity, fileName_1 + ":114:27")(tsplus_module_5.matchCauseIO(cause => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":65:106")(tsplus_module_4.offer(tsplus_module_5.failCauseNow(cause, fileName_1 + ":65:95"), fileName_1 + ":65:79")(queue)), fileName_1 + ":65:67")(tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":65:38")(getChildren)), doneOrChannel => tsplus_module_3.match(outDone => tsplus_module_13.raceWith(() => tsplus_module_7.withPermits(permits, fileName_1 + ":70:32")(n)(tsplus_module_5.unit), (_, permitAcquisition) => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":72:106")(tsplus_module_8.interrupt(permitAcquisition)), fileName_1 + ":72:75")(tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":72:46")(getChildren)), (_, failureAwait) => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":82:34")(tsplus_module_5.flatMap(maybeDone => tsplus_module_10.match(() => tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_9.left(outDone), fileName_1 + ":78:66"), fileName_1 + ":78:52")(queue), lastDone => tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_9.left(f(lastDone, outDone)), fileName_1 + ":79:74"), fileName_1 + ":79:60")(queue))(maybeDone), fileName_1 + ":76:39")(tsplus_module_11.get(lastDone, fileName_1 + ":75:37"))), fileName_1 + ":74:58")(tsplus_module_8.interrupt(failureAwait)), fileName_1 + ":69:49")(tsplus_module_12.wait(errorSignal, fileName_1 + ":69:34")), channel => {
45
+ }, fileName_1 + ":118:12")(tsplus_module_26.withChildren(getChildren => tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(queue => tsplus_module_5.flatMap(cancelers => tsplus_module_5.flatMap(lastDone => tsplus_module_5.flatMap(errorSignal => tsplus_module_5.flatMap(permits => tsplus_module_5.flatMap(pull => {
46
+ const evaluatePull = pull => tsplus_module_5.flatMap(md1 => tsplus_module_9.match(() => tsplus_module_5.unit, outDone => tsplus_module_19.update(md2 => tsplus_module_9.match(() => tsplus_module_18.just(outDone), lastDone => tsplus_module_18.just(f(lastDone, outDone)))(md2), fileName_1 + ":53:36")(lastDone))(md1), fileName_1 + ":49:23")(tsplus_module_5.repeatUntil(m => tsplus_module_20.isJust(m), fileName_1 + ":48:27")(tsplus_module_5.flatMap(ea => tsplus_module_3.match(outDone => tsplus_module_5.succeedNow(tsplus_module_18.just(outDone), fileName_1 + ":44:45"), outElem => tsplus_module_5.as(() => tsplus_module_18.nothing(), fileName_1 + ":45:84")(tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_8.right(outElem), fileName_1 + ":45:57"), fileName_1 + ":45:43")(queue)))(ea), fileName_1 + ":42:23")(pull)));
47
+ return tsplus_module_5.map(() => queue, fileName_1 + ":61:12")(tsplus_module_13.fork(tsplus_module_5.repeatWhile(_function.identity, fileName_1 + ":114:27")(tsplus_module_5.matchCauseIO(cause => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":65:106")(tsplus_module_4.offer(tsplus_module_5.failCauseNow(cause, fileName_1 + ":65:95"), fileName_1 + ":65:79")(queue)), fileName_1 + ":65:67")(tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":65:38")(getChildren)), doneOrChannel => tsplus_module_3.match(outDone => tsplus_module_12.raceWith(() => permits.withPermits(n)(tsplus_module_5.unit), (_, permitAcquisition) => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":72:106")(tsplus_module_7.interrupt(permitAcquisition)), fileName_1 + ":72:75")(tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":72:46")(getChildren)), (_, failureAwait) => tsplus_module_5.zipRight(tsplus_module_5.as(() => false, fileName_1 + ":82:34")(tsplus_module_5.flatMap(maybeDone => tsplus_module_9.match(() => tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_8.left(outDone), fileName_1 + ":78:66"), fileName_1 + ":78:52")(queue), lastDone => tsplus_module_4.offer(tsplus_module_5.succeedNow(tsplus_module_8.left(f(lastDone, outDone)), fileName_1 + ":79:74"), fileName_1 + ":79:60")(queue))(maybeDone), fileName_1 + ":76:39")(tsplus_module_10.get(lastDone, fileName_1 + ":75:37"))), fileName_1 + ":74:58")(tsplus_module_7.interrupt(failureAwait)), fileName_1 + ":69:49")(tsplus_module_11.wait(errorSignal, fileName_1 + ":69:34")), channel => {
50
48
  switch (mergeStrategy) {
51
49
  case "BackPressure":
52
50
  return tsplus_module_5.flatMap(latch => {
53
- const raceIOs = tsplus_module_17.scoped(tsplus_module_5.flatMap(io => tsplus_module_15.race(tsplus_module_12.wait(errorSignal, fileName_1 + ":91:64"))(evaluatePull(io)), fileName_1 + ":90:67")(tsplus_module_16.toPull(channel)), fileName_1 + ":92:30");
54
- return tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(b => !b, fileName_1 + ":95:60")(tsplus_module_12.isDone(errorSignal, fileName_1 + ":95:49")), fileName_1 + ":94:30")(tsplus_module_12.wait(latch, fileName_1 + ":94:36")), fileName_1 + ":93:30")(tsplus_module_14.fork(tsplus_module_7.withPermit(permits, fileName_1 + ":93:38")(tsplus_module_5.zipRight(raceIOs, fileName_1 + ":93:83")(tsplus_module_12.succeed_(undefined, fileName_1 + ":93:63")(latch))), fileName_1 + ":93:93"));
55
- }, fileName_1 + ":89:46")(tsplus_module_18.make(fileName_1 + ":89:58"));
51
+ const raceIOs = tsplus_module_16.scoped(tsplus_module_5.flatMap(io => tsplus_module_14.race(tsplus_module_11.wait(errorSignal, fileName_1 + ":91:64"))(evaluatePull(io)), fileName_1 + ":90:67")(tsplus_module_15.toPull(channel)), fileName_1 + ":92:30");
52
+ return tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(b => !b, fileName_1 + ":95:60")(tsplus_module_11.isDone(errorSignal, fileName_1 + ":95:49")), fileName_1 + ":94:30")(tsplus_module_11.wait(latch, fileName_1 + ":94:36")), fileName_1 + ":93:30")(tsplus_module_13.fork(permits.withPermit(tsplus_module_5.zipRight(raceIOs, fileName_1 + ":93:83")(tsplus_module_11.succeed_(undefined, fileName_1 + ":93:63")(latch))), fileName_1 + ":93:93"));
53
+ }, fileName_1 + ":89:46")(tsplus_module_17.make(fileName_1 + ":89:58"));
56
54
  case "BufferSliding":
57
55
  return tsplus_module_5.flatMap(canceler => tsplus_module_5.flatMap(latch => tsplus_module_5.flatMap(size => tsplus_module_5.flatMap(() => {
58
- const raceIOs = tsplus_module_17.scoped(tsplus_module_5.flatMap(io => tsplus_module_15.race(tsplus_module_12.wait(canceler, fileName_1 + ":104:85"))(tsplus_module_15.race(tsplus_module_12.wait(errorSignal, fileName_1 + ":104:64"))(evaluatePull(io))), fileName_1 + ":103:67")(tsplus_module_16.toPull(channel)), fileName_1 + ":105:30");
59
- return tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(b => !b, fileName_1 + ":108:60")(tsplus_module_12.isDone(errorSignal, fileName_1 + ":108:49")), fileName_1 + ":107:30")(tsplus_module_12.wait(latch, fileName_1 + ":107:36")), fileName_1 + ":106:30")(tsplus_module_14.fork(tsplus_module_7.withPermit(permits, fileName_1 + ":106:38")(tsplus_module_5.zipRight(raceIOs, fileName_1 + ":106:83")(tsplus_module_12.succeed_(undefined, fileName_1 + ":106:63")(latch))), fileName_1 + ":106:93"));
60
- }, fileName_1 + ":102:30")(tsplus_module_5.when(() => size >= 0, fileName_1 + ":102:87")(tsplus_module_5.flatMap(f => tsplus_module_12.succeed_(undefined, fileName_1 + ":102:70")(f), fileName_1 + ":102:53")(tsplus_module_4.take(cancelers, fileName_1 + ":102:40")))), fileName_1 + ":101:47")(tsplus_module_4.size(cancelers, fileName_1 + ":101:57")), fileName_1 + ":100:47")(tsplus_module_18.make(fileName_1 + ":100:59")), fileName_1 + ":99:47")(tsplus_module_18.make(fileName_1 + ":99:59"));
56
+ const raceIOs = tsplus_module_16.scoped(tsplus_module_5.flatMap(io => tsplus_module_14.race(tsplus_module_11.wait(canceler, fileName_1 + ":104:85"))(tsplus_module_14.race(tsplus_module_11.wait(errorSignal, fileName_1 + ":104:64"))(evaluatePull(io))), fileName_1 + ":103:67")(tsplus_module_15.toPull(channel)), fileName_1 + ":105:30");
57
+ return tsplus_module_5.flatMap(() => tsplus_module_5.flatMap(() => tsplus_module_5.map(b => !b, fileName_1 + ":108:60")(tsplus_module_11.isDone(errorSignal, fileName_1 + ":108:49")), fileName_1 + ":107:30")(tsplus_module_11.wait(latch, fileName_1 + ":107:36")), fileName_1 + ":106:30")(tsplus_module_13.fork(permits.withPermit(tsplus_module_5.zipRight(raceIOs, fileName_1 + ":106:83")(tsplus_module_11.succeed_(undefined, fileName_1 + ":106:63")(latch))), fileName_1 + ":106:93"));
58
+ }, fileName_1 + ":102:30")(tsplus_module_5.when(() => size >= 0, fileName_1 + ":102:87")(tsplus_module_5.flatMap(f => tsplus_module_11.succeed_(undefined, fileName_1 + ":102:70")(f), fileName_1 + ":102:53")(tsplus_module_4.take(cancelers, fileName_1 + ":102:40")))), fileName_1 + ":101:47")(tsplus_module_4.size(cancelers, fileName_1 + ":101:57")), fileName_1 + ":100:47")(tsplus_module_17.make(fileName_1 + ":100:59")), fileName_1 + ":99:47")(tsplus_module_17.make(fileName_1 + ":99:59"));
61
59
  }
62
60
  })(doneOrChannel), fileName_1 + ":63:28")(pull)), fileName_1 + ":114:37"));
63
- }, fileName_1 + ":39:33")(tsplus_module_16.toPull(channels)), fileName_1 + ":38:33")(tsplus_module_23.atomically(tsplus_module_22.make(n, fileName_1 + ":38:49"), fileName_1 + ":38:52")), fileName_1 + ":37:33")(tsplus_module_18.make(fileName_1 + ":37:45")), fileName_1 + ":36:33")(tsplus_module_24.make(() => tsplus_module_19.nothing(), fileName_1 + ":36:42")), fileName_1 + ":35:33")(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeUnbounded(fileName_1 + ":35:71"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":35:112"), fileName_1 + ":35:51")), fileName_1 + ":29:26")(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeBounded(bufferSize, fileName_1 + ":31:32"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":32:31"), fileName_1 + ":30:30")), fileName_1 + ":28:12")(tsplus_module_27.addFinalizer(() => tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":28:48")(getChildren), fileName_1 + ":28:28")), fileName_1 + ":26:22")));
61
+ }, fileName_1 + ":39:33")(tsplus_module_15.toPull(channels)), fileName_1 + ":38:33")(tsplus_module_21.makeSemaphore(n, fileName_1 + ":38:43")), fileName_1 + ":37:33")(tsplus_module_17.make(fileName_1 + ":37:45")), fileName_1 + ":36:33")(tsplus_module_22.make(() => tsplus_module_18.nothing(), fileName_1 + ":36:42")), fileName_1 + ":35:33")(tsplus_module_24.acquireRelease(() => tsplus_module_23.makeUnbounded(fileName_1 + ":35:71"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":35:112"), fileName_1 + ":35:51")), fileName_1 + ":29:26")(tsplus_module_24.acquireRelease(() => tsplus_module_23.makeBounded(bufferSize, fileName_1 + ":31:32"), queue => tsplus_module_4.shutdown(queue, fileName_1 + ":32:31"), fileName_1 + ":30:30")), fileName_1 + ":28:12")(tsplus_module_25.addFinalizer(() => tsplus_module_5.flatMap(tsplus_module_6.interruptAll, fileName_1 + ":28:48")(getChildren), fileName_1 + ":28:28")), fileName_1 + ":26:22")));
64
62
  };
65
63
  }
66
64
  //# sourceMappingURL=mergeAllWith.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeAllWith.cjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAqD;AAAA;;AAIrD;;;AAGM,SAAUA,YAAY,CAC1BC,CAAS,EACTC,CAAsC,EACtCC,UAAU,GAAG,EAAE,EACfC,gBAA+B,cAAc;EAE7C,OACEC,QAQC,IAC8G;IAC/G,OAAOC,mCACLC,oBA4FOC,KAAK,IAAI;MACd,MAAMC,QAAQ,GACZH,6BACEC,yDAAqDG,G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0EADLN,kCAAO,0BAAY9B,yBAAkCqC,OAAO,0BAAzCI,0BAAcC,SAAS,0BAAvBN,KAAK,CAAmB,CAAkB,CAAC;uCAJ9DpC,2BAAyD6C,IAAI,IAAI,CAAC,0BAAlE7C,wBAAwBL,CAAC,IAAK8C,0BAAUC,SAAS,0BAAnB/C,CAAC,CAAmB,+CAAlDc,SAAS,0BAA0C,CAAgB,gDADlDA,SAAS,oDADTkC,6CAA0B,0BAD1BA,4CAA0B;QAU5C;MAET,CAAC,EA5CHf,aAAa,CA6CZ,yBAlDPf,IAAI,CAmDD,CACqB;sDA3EHf,QAAQ,uDADRgD,sBAAgBpD,CAAC,wBAAC,kDADlBiD,4CAA0B,0BAD1BI,4BAAyB3B,0BAAS,wBAAC,0BADnC4B,sCAAkBC,qDAA0C,EAAGhD,KAAK,IAAIuB,yBAACvB,KAAK,yBAAS,wBAAC,0BAL7G+C,sCACEC,6BAAuErD,UAAU,wBAAC,EACjFK,KAAK,IAAIuB,yBAACvB,KAAK,wBAAS,wBAC1B,0BALDiD,oCAAgBlD,wFAAW,CAA4B,wBAAC,CAyF1D,wBACH,CAQC,CACH;EACH,CAAC;AACH","names":["mergeAllWith","n","f","bufferSize","mergeStrategy","channels","tsplus_module_2","tsplus_module_5","queue","consumer","out","tsplus_module_3","outElem","tsplus_module_1","tsplus_module_28","getChildren","cancelers","lastDone","errorSignal","permits","pull","evaluatePull","md1","tsplus_module_10","outDone","tsplus_module_20","md2","tsplus_module_19","m","tsplus_module_21","ea","tsplus_module_4","tsplus_module_9","identity","cause","doneOrChannel","tsplus_module_13","tsplus_module_7","_","permitAcquisition","failureAwait","maybeDone","channel","latch","raceIOs","io","tsplus_module_15","b","tsplus_module_12","undefined","tsplus_module_18","canceler","size","tsplus_module_22","tsplus_module_24","tsplus_module_26","tsplus_module_25","tsplus_module_27"],"sourceRoot":"","sources":["../../../_src/Channel/api/mergeAllWith.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"mergeAllWith.cjs","m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,+BACQC,QAAQ,4BACRT,KAAK,4BACLU,IAAI;cAEV,MAAMT,OAAO,2BAAGrC,wBAAwBsC,EAAE,IACxCC,4CAA8CM,QAAQ,2BAAtDN,4CAAsB5B,WAAW,2BAAjCG,YAAY,CAACwB,EAAE,CAAC,CAAwB,CAAqB,kDAD/CH,OAAO,EAEtB,yBAAO;iFAGCnC,oBAAwBwC,CAAC,IAAK,CAACA,CAAC,kDAAhC7B,WAAW,0BAAsB,gDADxCyB,KAAK,0EADLxB,OAAO,CAAC6B,UAAU,CAACzC,yBAAkCqC,OAAO,0BAAzCK,0BAAcC,SAAS,0BAAvBP,KAAK,CAAmB,CAAkB,CAAC;uCAJ9DpC,2BAAyD8C,IAAI,IAAI,CAAC,0BAAlE9C,wBAAwBL,CAAC,IAAK+C,0BAAUC,SAAS,0BAAnBhD,CAAC,CAAmB,+CAAlDc,SAAS,0BAA0C,CAAgB,gDADlDA,SAAS,oDADTmC,6CAA0B,0BAD1BA,4CAA0B;QAU5C;MAET,CAAC,EA5CHhB,aAAa,CA6CZ,yBAlDPf,IAAI,CAmDD,CACqB;sDA3EHf,QAAQ,2BADRiD,+BAAUrD,CAAC,wBAAC,0BADZkD,4CAA0B,0BAD1BI,4BAAyB5B,0BAAS,wBAAC,0BADnC6B,sCAAkBC,qDAA0C,EAAGjD,KAAK,IAAIuB,yBAACvB,KAAK,yBAAS,wBAAC,0BAL7GgD,sCACEC,6BAAuEtD,UAAU,wBAAC,EACjFK,KAAK,IAAIuB,yBAACvB,KAAK,wBAAS,wBAC1B,0BALDkD,oCAAgBnD,wFAAW,CAA4B,wBAAC,CAyF1D,wBACH,CAQC,CACH;EACH,CAAC;AACH","names":["mergeAllWith","n","f","bufferSize","mergeStrategy","channels","tsplus_module_2","tsplus_module_5","queue","consumer","out","tsplus_module_3","outElem","tsplus_module_1","tsplus_module_26","getChildren","cancelers","lastDone","errorSignal","permits","pull","evaluatePull","md1","tsplus_module_9","outDone","tsplus_module_19","md2","tsplus_module_18","m","tsplus_module_20","ea","tsplus_module_4","tsplus_module_8","identity","cause","doneOrChannel","tsplus_module_12","withPermits","_","permitAcquisition","failureAwait","maybeDone","channel","latch","raceIOs","io","tsplus_module_14","b","withPermit","tsplus_module_11","undefined","tsplus_module_17","canceler","size","tsplus_module_21","tsplus_module_22","tsplus_module_24","tsplus_module_23","tsplus_module_25"],"sourceRoot":"","sources":["../../../_src/Channel/api/mergeAllWith.ts"],"sourcesContent":[null]}
@@ -5,7 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.runScoped = runScoped;
7
7
  var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
8
- var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
8
+ var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fulfill"));
9
+ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
10
+ var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Scope/api"));
11
+ var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
12
+ var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/addFinalizer"));
13
+ var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
14
+ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
15
+ var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scope"));
16
+ var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/interrupt"));
9
17
  var _function = /*#__PURE__*/require("@fncts/base/data/function");
10
18
  var _ChannelExecutor = /*#__PURE__*/require("@fncts/io/Channel/internal/ChannelExecutor");
11
19
  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); }
@@ -31,7 +39,7 @@ function runScopedInterpret(channelState, exec) {
31
39
  }
32
40
  case "Read" /* ChannelStateTag.Read */:
33
41
  {
34
- return (0, _ChannelExecutor.readUpstream)(channelState, () => runScopedInterpret(exec.run(), exec));
42
+ return (0, _ChannelExecutor.readUpstream)(channelState, () => runScopedInterpret(exec.run(), exec), cause => tsplus_module_1.refailCause(cause, fileName_1 + ":29:36"));
35
43
  }
36
44
  }
37
45
  }
@@ -43,6 +51,14 @@ function runScopedInterpret(channelState, exec) {
43
51
  * @tsplus getter fncts.io.Channel runScoped
44
52
  */
45
53
  function runScoped(self) {
46
- return tsplus_module_1.flatMap(exec => tsplus_module_1.defer(() => runScopedInterpret(exec.run(), exec), fileName_1 + ":44:31"), fileName_1 + ":44:12")(tsplus_module_2.acquireReleaseExit(() => tsplus_module_1.succeed(() => new _ChannelExecutor.ChannelExecutor(() => self, null, _function.identity), fileName_1 + ":42:15"), (exec, exit) => exec.close(exit) ?? tsplus_module_1.unit, fileName_1 + ":41:31"));
54
+ const run = (channelFuture, scopeFuture, scope) => tsplus_module_1.flatMap(exec => tsplus_module_1.defer(() => tsplus_module_1.zipLeft(tsplus_module_3.wait(scopeFuture, fileName_1 + ":54:111"), fileName_1 + ":54:99")(tsplus_module_1.zipRight(tsplus_module_3.wait(channelFuture, fileName_1 + ":54:91"), fileName_1 + ":54:77")(tsplus_module_2.fulfill(channelFuture, fileName_1 + ":54:60")(runScopedInterpret(exec.run(), exec)))), fileName_1 + ":54:15"), fileName_1 + ":53:15")(tsplus_module_5.acquireReleaseExit(() => tsplus_module_1.succeed(() => new _ChannelExecutor.ChannelExecutor(() => self, null, _function.identity), fileName_1 + ":46:37"), (exec, exit) => {
55
+ const finalize = exec.close(exit);
56
+ if (finalize !== null) {
57
+ return tsplus_module_1.tapErrorCause(cause => tsplus_module_4.addFinalizer(() => tsplus_module_1.refailCause(cause, fileName_1 + ":49:83"), fileName_1 + ":49:68")(scope), fileName_1 + ":49:38")(finalize);
58
+ } else {
59
+ return tsplus_module_1.unit;
60
+ }
61
+ }, fileName_1 + ":46:26"));
62
+ return tsplus_module_10.uninterruptibleMask(restore => tsplus_module_1.flatMap(parent => tsplus_module_1.flatMap(child => tsplus_module_1.flatMap(channelFuture => tsplus_module_1.flatMap(scopeFuture => tsplus_module_1.flatMap(fiber => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(done => tsplus_module_1.map(() => done, fileName_1 + ":66:8")(fiber.inheritAll), fileName_1 + ":65:21")(restore(tsplus_module_3.wait(channelFuture, fileName_1 + ":65:43"), fileName_1 + ":65:29")), fileName_1 + ":64:8")(tsplus_module_6.addFinalizer(() => tsplus_module_3.succeed_(undefined, fileName_1 + ":64:44")(scopeFuture), fileName_1 + ":64:24")), fileName_1 + ":63:30")(tsplus_module_7.forkScoped(restore(run(channelFuture, scopeFuture, child), fileName_1 + ":63:38"), fileName_1 + ":63:78")), fileName_1 + ":62:30")(tsplus_module_8.make(fileName_1 + ":62:42")), fileName_1 + ":61:30")(tsplus_module_8.make(fileName_1 + ":61:42")), fileName_1 + ":60:30")(parent.fork), fileName_1 + ":59:30")(tsplus_module_9.scope));
47
63
  }
48
64
  //# sourceMappingURL=runScoped.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runScoped.cjs","mappings":";;;;;;;;AAEA;AACA;AAA2F;AAAA;;AAG3F,SAASA,kBAAkB,CACzBC,YAAuC,EACvCC,IAA0E;EAE1E;EACA,OAAO,CAAC,EAAE;IACR,QAAQD,YAAY,CAACE,IAAI;MACvB;QAA6B;UAC3B,OAAOC,wBAA4B,MAAMJ,kBAAkB,CAACE,IAAI,CAACG,GAAG,EAAE,EAAEH,IAAI,CAAC,yBAAtED,YAAY,CAACK,MAAM,CAAoD;;MAEhF;QAA2B;UACzB;UACAL,YAAY,GAAGC,IAAI,CAACG,GAAG,EAAE;UACzB;;MAEF;QAA2B;UACzB,OAAOD,+BAAYF,IAAI,CAACK,OAAO,EAAE,wBAAC;;MAEpC;QAA2B;UACzB,OAAO,iCAAY,EAACN,YAAY,EAAE,MAAMD,kBAAkB,CAACE,IAAI,CAACG,GAAG,EAAE,EAAEH,IAAI,CAAC,CAAC;;IAC9E;;EAGL,MAAM,IAAIM,KAAK,CAAC,KAAK,CAAC;AACxB;AAEA;;;;;AAKM,SAAUC,SAAS,CACvBC,IAAkE;EAElE,OAAON,wBAGIF,IAAI,IAAKE,4BAASJ,kBAAkB,CAACE,IAAI,CAACG,GAAG,EAAE,EAAEH,IAAI,CAAC,wBAAC,yBAH3DS,yCACLP,8BAAW,IAAIQ,gCAAe,CAAC,MAAMF,IAAI,EAAE,IAAI,EAAEG,kBAAQ,CAAC,wBAAC,EAC3D,CAACX,IAAI,EAAEY,IAAI,KAAKZ,IAAI,CAACa,KAAK,CAACD,IAAI,CAAC,wBAAW,wBAC5C,CAAkE;AACrE","names":["runScopedInterpret","channelState","exec","_tag","tsplus_module_1","run","effect","getDone","Error","runScoped","self","tsplus_module_2","ChannelExecutor","identity","exit","close"],"sourceRoot":"","sources":["../../../_src/Channel/api/runScoped.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"runScoped.cjs","mappings":";;;;;;;;;;;;;;;;AAEA;AACA;AAA2F;AAAA;;AAG3F,SAASA,kBAAkB,CACzBC,YAAuC,EACvCC,IAA0E;EAE1E;EACA,OAAO,CAAC,EAAE;IACR,QAAQD,YAAY,CAACE,IAAI;MACvB;QAA6B;UAC3B,OAAOC,wBAA4B,MAAMJ,kBAAkB,CAACE,IAAI,CAACG,GAAG,EAAE,EAAEH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ADTD,KAAK,CAACE,UAAU,0BADHL,OAAO,sBAACZ,aAAa,gDAAO,yBADzCkB,mCAAgBC,yBAAoBC,SAAS,yBAA7BnB,WAAW,CAAmB,wBAAC,qDADzBW,OAAO,CAACnB,GAAG,CAACO,aAAa,EAAEC,WAAW,EAAEa,KAAK,CAAC,wBAAC,kDAD/CO,2CAA0B,0BAD1BA,2CAA8B,0BAD9BR,MAAM,CAACS,IAAI,gDAQnC,CACH;AACH","names":["runScopedInterpret","channelState","exec","_tag","tsplus_module_1","run","effect","getDone","cause","Error","runScoped","self","channelFuture","scopeFuture","scope","tsplus_module_2","tsplus_module_5","ChannelExecutor","identity","exit","finalize","close","tsplus_module_4","tsplus_module_10","restore","parent","child","fiber","done","inheritAll","tsplus_module_6","tsplus_module_3","undefined","tsplus_module_8","fork"],"sourceRoot":"","sources":["../../../_src/Channel/api/runScoped.ts"],"sourcesContent":[null]}
@@ -34,7 +34,7 @@ function toPullInterpret(channelState, exec) {
34
34
  }
35
35
  case "Read" /* ChannelStateTag.Read */:
36
36
  {
37
- return (0, _ChannelExecutor.readUpstream)(channelState, () => toPullInterpret(exec.run(), exec));
37
+ return (0, _ChannelExecutor.readUpstream)(channelState, () => toPullInterpret(exec.run(), exec), tsplus_module_1.refailCause);
38
38
  }
39
39
  }
40
40
  }