effect 3.16.7 → 3.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/stream.js +21 -15
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/internal/stream.js +21 -15
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/internal/stream.ts +24 -22
- package/src/internal/version.ts +1 -1
package/package.json
CHANGED
package/src/internal/stream.ts
CHANGED
|
@@ -5401,25 +5401,21 @@ export const repeatWith = dual<
|
|
|
5401
5401
|
Ref.get(driver.iterationMeta)
|
|
5402
5402
|
)
|
|
5403
5403
|
|
|
5404
|
-
const scheduleOutput = pipe(driver.last, Effect.orDie, Effect.map(options.onSchedule))
|
|
5405
5404
|
const process = pipe(self, provideLastIterationInfo, map(options.onElement), toChannel)
|
|
5406
5405
|
const loop: Channel.Channel<Chunk.Chunk<C>, unknown, E, unknown, void, unknown, R | R2> = channel.unwrap(
|
|
5407
|
-
Effect.match(
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
Effect.map((c) => pipe(core.write(Chunk.of(c)), core.flatMap(() => loop))),
|
|
5416
|
-
channel.unwrap
|
|
5417
|
-
)
|
|
5406
|
+
Effect.match(
|
|
5407
|
+
driver.next(void 0),
|
|
5408
|
+
{
|
|
5409
|
+
onFailure: () => core.void,
|
|
5410
|
+
onSuccess: (output) =>
|
|
5411
|
+
core.flatMap(
|
|
5412
|
+
process,
|
|
5413
|
+
() => channel.zipRight(core.write(Chunk.of(options.onSchedule(output))), loop)
|
|
5418
5414
|
)
|
|
5419
|
-
|
|
5420
|
-
|
|
5415
|
+
}
|
|
5416
|
+
)
|
|
5421
5417
|
)
|
|
5422
|
-
return new StreamImpl(
|
|
5418
|
+
return new StreamImpl(channel.zipRight(process, loop))
|
|
5423
5419
|
}),
|
|
5424
5420
|
unwrap
|
|
5425
5421
|
)
|
|
@@ -7218,20 +7214,26 @@ export const toReadableStreamRuntime = dual<
|
|
|
7218
7214
|
|
|
7219
7215
|
return new ReadableStream<A>({
|
|
7220
7216
|
start(controller) {
|
|
7221
|
-
fiber = runFork(runForEachChunk(self, (chunk) =>
|
|
7222
|
-
|
|
7217
|
+
fiber = runFork(runForEachChunk(self, (chunk) => {
|
|
7218
|
+
if (chunk.length === 0) return Effect.void
|
|
7219
|
+
return latch.whenOpen(Effect.sync(() => {
|
|
7223
7220
|
latch.unsafeClose()
|
|
7224
7221
|
for (const item of chunk) {
|
|
7225
7222
|
controller.enqueue(item)
|
|
7226
7223
|
}
|
|
7227
7224
|
currentResolve!()
|
|
7228
7225
|
currentResolve = undefined
|
|
7229
|
-
}))
|
|
7226
|
+
}))
|
|
7227
|
+
}))
|
|
7230
7228
|
fiber.addObserver((exit) => {
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7229
|
+
try {
|
|
7230
|
+
if (exit._tag === "Failure") {
|
|
7231
|
+
controller.error(Cause.squash(exit.cause))
|
|
7232
|
+
} else {
|
|
7233
|
+
controller.close()
|
|
7234
|
+
}
|
|
7235
|
+
} catch {
|
|
7236
|
+
// ignore
|
|
7235
7237
|
}
|
|
7236
7238
|
})
|
|
7237
7239
|
},
|
package/src/internal/version.ts
CHANGED