| 1101 | }) |
| 1102 | |
| 1103 | const bufferUnbounded = <A, E, R>(self: Stream.Stream<A, E, R>): Stream.Stream<A, E, R> => { |
| 1104 | const queue = toQueue(self, { strategy: "unbounded" }) |
| 1105 | return new StreamImpl( |
| 1106 | channel.unwrapScoped( |
| 1107 | Effect.map(queue, (queue) => { |
| 1108 | const process: Channel.Channel<Chunk.Chunk<A>, unknown, E, unknown, void, unknown> = pipe( |
| 1109 | core.fromEffect(Queue.take(queue)), |
| 1110 | core.flatMap(InternalTake.match({ |
| 1111 | onEnd: () => core.void, |
| 1112 | onFailure: core.failCause, |
| 1113 | onSuccess: (value) => core.flatMap(core.write(value), () => process) |
| 1114 | })) |
| 1115 | ) |
| 1116 | return process |
| 1117 | }) |
| 1118 | ) |
| 1119 | ) |
| 1120 | } |
| 1121 | |
| 1122 | const bufferSignal = <A, E, R>( |
| 1123 | scoped: Effect.Effect<Queue.Queue<readonly [Take.Take<A, E>, Deferred.Deferred<void>]>, never, Scope.Scope>, |