@lmvz-ds/components 0.12.3-alpha.4 → 0.12.4-alpha.2
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/{Effect-BIlTHtLK.js → Effect-CNhHt4Xb.js} +615 -885
- package/dist/cjs/MutableQueue-Bk9tBfaK.js +462 -0
- package/dist/cjs/{aria-validation-controller-B7unOPxT.js → aria-validation-controller-B3hMkau3.js} +157 -156
- package/dist/cjs/assets-v1E2_ZyV.js +63 -0
- package/dist/cjs/{icons-BFM1yQ_r.js → icons-BoKNWYem.js} +21 -74
- package/dist/cjs/index.cjs.js +4 -2
- package/dist/cjs/lmvz-button.cjs.entry.js +3 -2
- package/dist/cjs/lmvz-card.cjs.entry.js +7 -2
- package/dist/cjs/lmvz-header.cjs.entry.js +3 -2
- package/dist/cjs/lmvz-icon.cjs.entry.js +5 -3
- package/dist/cjs/lmvz-input.cjs.entry.js +3 -2
- package/dist/cjs/lmvz-menuitem.cjs.entry.js +3 -2
- package/dist/collection/components/lmvz-card/lmvz-card.js +8 -3
- package/dist/collection/components/lmvz-icon/icons.js +2 -3
- package/dist/collection/utils/assets.js +10 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lmvz-button.js +1 -1
- package/dist/components/lmvz-card.js +1 -1
- package/dist/components/lmvz-header.js +1 -1
- package/dist/components/lmvz-icon.js +1 -1
- package/dist/components/lmvz-input.js +1 -1
- package/dist/components/lmvz-menuitem.js +1 -1
- package/dist/components/p-3I3wZmp8.js +1 -0
- package/dist/components/p-BAFsMKYu.js +1 -0
- package/dist/components/p-CdofjRtQ.js +1 -0
- package/dist/components/p-Cn8p9itA.js +1 -0
- package/dist/esm/{Effect-D9S7OTyY.js → Effect-BhQLGXPs.js} +568 -829
- package/dist/esm/MutableQueue-CNlEFklh.js +431 -0
- package/dist/esm/{aria-validation-controller-C7nQzCCq.js → aria-validation-controller-iA4YWFG-.js} +2 -1
- package/dist/esm/assets-Da86GVBR.js +60 -0
- package/dist/esm/{icons-BFqdzPxR.js → icons-Vi_eRDu3.js} +4 -57
- package/dist/esm/index.js +4 -2
- package/dist/esm/lmvz-button.entry.js +3 -2
- package/dist/esm/lmvz-card.entry.js +8 -3
- package/dist/esm/lmvz-header.entry.js +3 -2
- package/dist/esm/lmvz-icon.entry.js +5 -3
- package/dist/esm/lmvz-input.entry.js +3 -2
- package/dist/esm/lmvz-menuitem.entry.js +3 -2
- package/dist/lmvz-components/index.esm.js +1 -1
- package/dist/lmvz-components/lmvz-components.esm.js +1 -1
- package/dist/lmvz-components/p-0027e9d9.entry.js +1 -0
- package/dist/lmvz-components/p-1e9e0a1c.entry.js +1 -0
- package/dist/lmvz-components/p-274c36df.entry.js +1 -0
- package/dist/lmvz-components/p-4b70fe08.entry.js +1 -0
- package/dist/lmvz-components/p-68001ab7.entry.js +1 -0
- package/dist/lmvz-components/p-77e26e71.entry.js +1 -0
- package/dist/lmvz-components/p-BhQLGXPs.js +1 -0
- package/dist/lmvz-components/p-CXWyvf0D.js +1 -0
- package/dist/lmvz-components/p-D7I-Bc5i.js +1 -0
- package/dist/lmvz-components/p-DeAzFd-K.js +1 -0
- package/dist/lmvz-components/p-t67OMMtz.js +1 -0
- package/dist/manifest.json +1 -1
- package/dist/types/components/lmvz-card/lmvz-card.d.ts +1 -0
- package/dist/types/utils/{url.d.ts → assets.d.ts} +1 -1
- package/hydrate/index.js +490 -7
- package/hydrate/index.mjs +490 -7
- package/package.json +5 -5
- package/dist/collection/utils/url.js +0 -7
- package/dist/components/p-BFwzIh71.js +0 -1
- package/dist/components/p-CfWkZ_yJ.js +0 -1
- package/dist/lmvz-components/assets/LMVZ_logo_175.svg +0 -1
- package/dist/lmvz-components/assets/card-placeholder.svg +0 -4
- package/dist/lmvz-components/assets/fonts/Router-Bold.woff +0 -0
- package/dist/lmvz-components/assets/fonts/Router-Book.woff +0 -0
- package/dist/lmvz-components/assets/fonts/Router-Medium.woff +0 -0
- package/dist/lmvz-components/assets/icons/Logo.svg +0 -10
- package/dist/lmvz-components/assets/icons/actions.svg +0 -5
- package/dist/lmvz-components/assets/icons/adduser.svg +0 -3
- package/dist/lmvz-components/assets/icons/alert.svg +0 -3
- package/dist/lmvz-components/assets/icons/apple.svg +0 -3
- package/dist/lmvz-components/assets/icons/arrow-down.svg +0 -3
- package/dist/lmvz-components/assets/icons/arrow-left.svg +0 -3
- package/dist/lmvz-components/assets/icons/arrow-right.svg +0 -3
- package/dist/lmvz-components/assets/icons/arrow-up.svg +0 -3
- package/dist/lmvz-components/assets/icons/book.svg +0 -3
- package/dist/lmvz-components/assets/icons/bookmark.svg +0 -3
- package/dist/lmvz-components/assets/icons/checkmark.svg +0 -3
- package/dist/lmvz-components/assets/icons/chevron-down.svg +0 -3
- package/dist/lmvz-components/assets/icons/chevron-left.svg +0 -3
- package/dist/lmvz-components/assets/icons/chevron-right.svg +0 -3
- package/dist/lmvz-components/assets/icons/chevron-up.svg +0 -3
- package/dist/lmvz-components/assets/icons/close-l.svg +0 -3
- package/dist/lmvz-components/assets/icons/close-sm.svg +0 -3
- package/dist/lmvz-components/assets/icons/cog.svg +0 -4
- package/dist/lmvz-components/assets/icons/computer.svg +0 -3
- package/dist/lmvz-components/assets/icons/dashboard.svg +0 -6
- package/dist/lmvz-components/assets/icons/delete.svg +0 -3
- package/dist/lmvz-components/assets/icons/download.svg +0 -3
- package/dist/lmvz-components/assets/icons/edit.svg +0 -3
- package/dist/lmvz-components/assets/icons/external.svg +0 -3
- package/dist/lmvz-components/assets/icons/facebook.svg +0 -3
- package/dist/lmvz-components/assets/icons/favorite.svg +0 -3
- package/dist/lmvz-components/assets/icons/filter.svg +0 -3
- package/dist/lmvz-components/assets/icons/group.svg +0 -3
- package/dist/lmvz-components/assets/icons/hide.svg +0 -3
- package/dist/lmvz-components/assets/icons/home.svg +0 -3
- package/dist/lmvz-components/assets/icons/info.svg +0 -3
- package/dist/lmvz-components/assets/icons/instagram.svg +0 -3
- package/dist/lmvz-components/assets/icons/letter.svg +0 -3
- package/dist/lmvz-components/assets/icons/linkedin.svg +0 -5
- package/dist/lmvz-components/assets/icons/logout.svg +0 -3
- package/dist/lmvz-components/assets/icons/map.svg +0 -3
- package/dist/lmvz-components/assets/icons/minus.svg +0 -3
- package/dist/lmvz-components/assets/icons/navigation.svg +0 -3
- package/dist/lmvz-components/assets/icons/plus.svg +0 -3
- package/dist/lmvz-components/assets/icons/qr-scan.svg +0 -3
- package/dist/lmvz-components/assets/icons/question.svg +0 -10
- package/dist/lmvz-components/assets/icons/reader.svg +0 -3
- package/dist/lmvz-components/assets/icons/reset.svg +0 -3
- package/dist/lmvz-components/assets/icons/school.svg +0 -3
- package/dist/lmvz-components/assets/icons/search.svg +0 -3
- package/dist/lmvz-components/assets/icons/send.svg +0 -3
- package/dist/lmvz-components/assets/icons/settings.svg +0 -3
- package/dist/lmvz-components/assets/icons/share.svg +0 -10
- package/dist/lmvz-components/assets/icons/shopping-cart.svg +0 -3
- package/dist/lmvz-components/assets/icons/show.svg +0 -3
- package/dist/lmvz-components/assets/icons/snapchat.svg +0 -3
- package/dist/lmvz-components/assets/icons/sort.svg +0 -3
- package/dist/lmvz-components/assets/icons/speech-bubble.svg +0 -3
- package/dist/lmvz-components/assets/icons/star.svg +0 -3
- package/dist/lmvz-components/assets/icons/student.svg +0 -3
- package/dist/lmvz-components/assets/icons/upload.svg +0 -3
- package/dist/lmvz-components/assets/icons/user.svg +0 -3
- package/dist/lmvz-components/assets/icons/warn-circle.svg +0 -3
- package/dist/lmvz-components/assets/icons/warn-triangle.svg +0 -3
- package/dist/lmvz-components/assets/icons/whatsapp.svg +0 -4
- package/dist/lmvz-components/assets/icons/world.svg +0 -10
- package/dist/lmvz-components/assets/icons/x.svg +0 -3
- package/dist/lmvz-components/assets/icons/youtube.svg +0 -3
- package/dist/lmvz-components/assets/zukunftslinie.svg +0 -3
- package/dist/lmvz-components/p-6d71c048.entry.js +0 -1
- package/dist/lmvz-components/p-CDfcYSci.js +0 -1
- package/dist/lmvz-components/p-D9S7OTyY.js +0 -1
- package/dist/lmvz-components/p-DlrjrWsu.js +0 -1
- package/dist/lmvz-components/p-a4615e4b.entry.js +0 -1
- package/dist/lmvz-components/p-a8c88454.entry.js +0 -1
- package/dist/lmvz-components/p-e63e239a.entry.js +0 -1
- package/dist/lmvz-components/p-f956a5e7.entry.js +0 -1
- package/dist/lmvz-components/p-fefd2fe4.entry.js +0 -1
package/dist/cjs/{aria-validation-controller-B7unOPxT.js → aria-validation-controller-B3hMkau3.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-9ZJx0550.js');
|
|
4
|
-
var Effect = require('./Effect-
|
|
4
|
+
var Effect = require('./Effect-CNhHt4Xb.js');
|
|
5
|
+
var MutableQueue = require('./MutableQueue-Bk9tBfaK.js');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @since 2.0.0
|
|
@@ -68,7 +69,7 @@ const die = Effect.die;
|
|
|
68
69
|
* @since 2.0.0
|
|
69
70
|
* @category Constructors
|
|
70
71
|
*/
|
|
71
|
-
const interrupt$1 = Effect.interrupt
|
|
72
|
+
const interrupt$1 = Effect.interrupt;
|
|
72
73
|
/**
|
|
73
74
|
* Checks if a `Cause` is a `Die` type.
|
|
74
75
|
*
|
|
@@ -159,7 +160,7 @@ const flipCauseOption = Effect.flipCauseOption;
|
|
|
159
160
|
*/
|
|
160
161
|
const map$2 = Effect.map$1;
|
|
161
162
|
|
|
162
|
-
const _await = Effect._await
|
|
163
|
+
const _await = Effect._await;
|
|
163
164
|
/**
|
|
164
165
|
* Inherits values from all `FiberRef` instances into current fiber. This
|
|
165
166
|
* will resume immediately.
|
|
@@ -264,13 +265,13 @@ class QueueImpl extends Effect.Class {
|
|
|
264
265
|
return this.queue.capacity();
|
|
265
266
|
}
|
|
266
267
|
get size() {
|
|
267
|
-
return Effect.suspend(() => Effect.catchAll$1(this.unsafeSize(), () => Effect.interrupt$
|
|
268
|
+
return Effect.suspend(() => Effect.catchAll$1(this.unsafeSize(), () => Effect.interrupt$1));
|
|
268
269
|
}
|
|
269
270
|
unsafeSize() {
|
|
270
271
|
if (Effect.get$2(this.shutdownFlag)) {
|
|
271
272
|
return Effect.none();
|
|
272
273
|
}
|
|
273
|
-
return Effect.some(this.queue.length() -
|
|
274
|
+
return Effect.some(this.queue.length() - MutableQueue.length(this.takers) + this.strategy.surplusSize());
|
|
274
275
|
}
|
|
275
276
|
get isEmpty() {
|
|
276
277
|
return Effect.map(this.size, size => size <= 0);
|
|
@@ -299,8 +300,8 @@ class QueueImpl extends Effect.Class {
|
|
|
299
300
|
}
|
|
300
301
|
let noRemaining;
|
|
301
302
|
if (this.queue.length() === 0) {
|
|
302
|
-
const taker = Effect.pipe(this.takers,
|
|
303
|
-
if (taker !==
|
|
303
|
+
const taker = Effect.pipe(this.takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));
|
|
304
|
+
if (taker !== MutableQueue.EmptyMutableQueue) {
|
|
304
305
|
unsafeCompleteDeferred(taker, value);
|
|
305
306
|
noRemaining = true;
|
|
306
307
|
} else {
|
|
@@ -320,12 +321,12 @@ class QueueImpl extends Effect.Class {
|
|
|
320
321
|
offer(value) {
|
|
321
322
|
return Effect.suspend(() => {
|
|
322
323
|
if (Effect.get$2(this.shutdownFlag)) {
|
|
323
|
-
return Effect.interrupt$
|
|
324
|
+
return Effect.interrupt$1;
|
|
324
325
|
}
|
|
325
326
|
let noRemaining;
|
|
326
327
|
if (this.queue.length() === 0) {
|
|
327
|
-
const taker = Effect.pipe(this.takers,
|
|
328
|
-
if (taker !==
|
|
328
|
+
const taker = Effect.pipe(this.takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));
|
|
329
|
+
if (taker !== MutableQueue.EmptyMutableQueue) {
|
|
329
330
|
unsafeCompleteDeferred(taker, value);
|
|
330
331
|
noRemaining = true;
|
|
331
332
|
} else {
|
|
@@ -346,7 +347,7 @@ class QueueImpl extends Effect.Class {
|
|
|
346
347
|
offerAll(iterable) {
|
|
347
348
|
return Effect.suspend(() => {
|
|
348
349
|
if (Effect.get$2(this.shutdownFlag)) {
|
|
349
|
-
return Effect.interrupt$
|
|
350
|
+
return Effect.interrupt$1;
|
|
350
351
|
}
|
|
351
352
|
const values = Effect.fromIterable(iterable);
|
|
352
353
|
const pTakers = this.queue.length() === 0 ? Effect.fromIterable(unsafePollN(this.takers, values.length)) : Effect.empty$1;
|
|
@@ -368,10 +369,10 @@ class QueueImpl extends Effect.Class {
|
|
|
368
369
|
get take() {
|
|
369
370
|
return Effect.withFiberRuntime(state => {
|
|
370
371
|
if (Effect.get$2(this.shutdownFlag)) {
|
|
371
|
-
return Effect.interrupt$
|
|
372
|
+
return Effect.interrupt$1;
|
|
372
373
|
}
|
|
373
|
-
const item = this.queue.poll(
|
|
374
|
-
if (item !==
|
|
374
|
+
const item = this.queue.poll(MutableQueue.EmptyMutableQueue);
|
|
375
|
+
if (item !== MutableQueue.EmptyMutableQueue) {
|
|
375
376
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
376
377
|
return Effect.succeed$1(item);
|
|
377
378
|
} else {
|
|
@@ -381,9 +382,9 @@ class QueueImpl extends Effect.Class {
|
|
|
381
382
|
// - Clean up resources in case of interruption
|
|
382
383
|
const deferred = Effect.deferredUnsafeMake(state.id());
|
|
383
384
|
return Effect.pipe(Effect.suspend(() => {
|
|
384
|
-
Effect.pipe(this.takers,
|
|
385
|
+
Effect.pipe(this.takers, MutableQueue.offer(deferred));
|
|
385
386
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
386
|
-
return Effect.get$2(this.shutdownFlag) ? Effect.interrupt$
|
|
387
|
+
return Effect.get$2(this.shutdownFlag) ? Effect.interrupt$1 : Effect.deferredAwait(deferred);
|
|
387
388
|
}), Effect.onInterrupt(() => {
|
|
388
389
|
return Effect.sync(() => unsafeRemove(this.takers, deferred));
|
|
389
390
|
}));
|
|
@@ -392,7 +393,7 @@ class QueueImpl extends Effect.Class {
|
|
|
392
393
|
}
|
|
393
394
|
get takeAll() {
|
|
394
395
|
return Effect.suspend(() => {
|
|
395
|
-
return Effect.get$2(this.shutdownFlag) ? Effect.interrupt$
|
|
396
|
+
return Effect.get$2(this.shutdownFlag) ? Effect.interrupt$1 : Effect.sync(() => {
|
|
396
397
|
const values = this.queue.pollUpTo(Number.POSITIVE_INFINITY);
|
|
397
398
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
398
399
|
return Effect.fromIterable$1(values);
|
|
@@ -400,7 +401,7 @@ class QueueImpl extends Effect.Class {
|
|
|
400
401
|
});
|
|
401
402
|
}
|
|
402
403
|
takeUpTo(max) {
|
|
403
|
-
return Effect.suspend(() => Effect.get$2(this.shutdownFlag) ? Effect.interrupt$
|
|
404
|
+
return Effect.suspend(() => Effect.get$2(this.shutdownFlag) ? Effect.interrupt$1 : Effect.sync(() => {
|
|
404
405
|
const values = this.queue.pollUpTo(max);
|
|
405
406
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
406
407
|
return Effect.fromIterable$1(values);
|
|
@@ -427,15 +428,15 @@ const takeRemainderLoop = (self, min, max, acc) => {
|
|
|
427
428
|
}));
|
|
428
429
|
};
|
|
429
430
|
/** @internal */
|
|
430
|
-
const bounded$1 = requestedCapacity => Effect.pipe(Effect.sync(() =>
|
|
431
|
+
const bounded$1 = requestedCapacity => Effect.pipe(Effect.sync(() => MutableQueue.bounded(requestedCapacity)), Effect.flatMap(queue => make$2(backingQueueFromMutableQueue(queue), backPressureStrategy())));
|
|
431
432
|
/** @internal */
|
|
432
|
-
const unbounded$1 = () => Effect.pipe(Effect.sync(() =>
|
|
433
|
+
const unbounded$1 = () => Effect.pipe(Effect.sync(() => MutableQueue.unbounded()), Effect.flatMap(queue => make$2(backingQueueFromMutableQueue(queue), droppingStrategy())));
|
|
433
434
|
/** @internal */
|
|
434
435
|
const unsafeMake = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
|
|
435
436
|
return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
|
|
436
437
|
};
|
|
437
438
|
/** @internal */
|
|
438
|
-
const make$2 = (queue, strategy) => Effect.pipe(Effect.deferredMake(), Effect.map(deferred => unsafeMake(queue,
|
|
439
|
+
const make$2 = (queue, strategy) => Effect.pipe(Effect.deferredMake(), Effect.map(deferred => unsafeMake(queue, MutableQueue.unbounded(), deferred, Effect.make(false), strategy)));
|
|
439
440
|
/** @internal */
|
|
440
441
|
class BackingQueueFromMutableQueue {
|
|
441
442
|
mutable;
|
|
@@ -444,22 +445,22 @@ class BackingQueueFromMutableQueue {
|
|
|
444
445
|
this.mutable = mutable;
|
|
445
446
|
}
|
|
446
447
|
poll(def) {
|
|
447
|
-
return
|
|
448
|
+
return MutableQueue.poll(this.mutable, def);
|
|
448
449
|
}
|
|
449
450
|
pollUpTo(limit) {
|
|
450
|
-
return
|
|
451
|
+
return MutableQueue.pollUpTo(this.mutable, limit);
|
|
451
452
|
}
|
|
452
453
|
offerAll(elements) {
|
|
453
|
-
return
|
|
454
|
+
return MutableQueue.offerAll(this.mutable, elements);
|
|
454
455
|
}
|
|
455
456
|
offer(element) {
|
|
456
|
-
return
|
|
457
|
+
return MutableQueue.offer(this.mutable, element);
|
|
457
458
|
}
|
|
458
459
|
capacity() {
|
|
459
|
-
return
|
|
460
|
+
return MutableQueue.capacity(this.mutable);
|
|
460
461
|
}
|
|
461
462
|
length() {
|
|
462
|
-
return
|
|
463
|
+
return MutableQueue.length(this.mutable);
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
/** @internal */
|
|
@@ -488,14 +489,14 @@ const droppingStrategy = () => new DroppingStrategy();
|
|
|
488
489
|
/** @internal */
|
|
489
490
|
class BackPressureStrategy {
|
|
490
491
|
[QueueStrategyTypeId] = queueStrategyVariance;
|
|
491
|
-
putters = /*#__PURE__*/
|
|
492
|
+
putters = /*#__PURE__*/MutableQueue.unbounded();
|
|
492
493
|
surplusSize() {
|
|
493
|
-
return
|
|
494
|
+
return MutableQueue.length(this.putters);
|
|
494
495
|
}
|
|
495
496
|
onCompleteTakersWithEmptyQueue(takers) {
|
|
496
|
-
while (!
|
|
497
|
-
const taker =
|
|
498
|
-
const putter =
|
|
497
|
+
while (!MutableQueue.isEmpty(this.putters) && !MutableQueue.isEmpty(takers)) {
|
|
498
|
+
const taker = MutableQueue.poll(takers, void 0);
|
|
499
|
+
const putter = MutableQueue.poll(this.putters, void 0);
|
|
499
500
|
if (putter[2]) {
|
|
500
501
|
unsafeCompleteDeferred(putter[1], true);
|
|
501
502
|
}
|
|
@@ -512,15 +513,15 @@ class BackPressureStrategy {
|
|
|
512
513
|
this.unsafeOffer(iterable, deferred);
|
|
513
514
|
this.unsafeOnQueueEmptySpace(queue, takers);
|
|
514
515
|
unsafeCompleteTakers(this, queue, takers);
|
|
515
|
-
return Effect.get$2(isShutdown) ? Effect.interrupt$
|
|
516
|
+
return Effect.get$2(isShutdown) ? Effect.interrupt$1 : Effect.deferredAwait(deferred);
|
|
516
517
|
}), Effect.onInterrupt(() => Effect.sync(() => this.unsafeRemove(deferred))));
|
|
517
518
|
});
|
|
518
519
|
}
|
|
519
520
|
unsafeOnQueueEmptySpace(queue, takers) {
|
|
520
521
|
let keepPolling = true;
|
|
521
522
|
while (keepPolling && (queue.capacity() === Number.POSITIVE_INFINITY || queue.length() < queue.capacity())) {
|
|
522
|
-
const putter = Effect.pipe(this.putters,
|
|
523
|
-
if (putter ===
|
|
523
|
+
const putter = Effect.pipe(this.putters, MutableQueue.poll(MutableQueue.EmptyMutableQueue));
|
|
524
|
+
if (putter === MutableQueue.EmptyMutableQueue) {
|
|
524
525
|
keepPolling = false;
|
|
525
526
|
} else {
|
|
526
527
|
const offered = queue.offer(putter[0]);
|
|
@@ -538,9 +539,9 @@ class BackPressureStrategy {
|
|
|
538
539
|
for (let i = 0; i < stuff.length; i++) {
|
|
539
540
|
const value = stuff[i];
|
|
540
541
|
if (i === stuff.length - 1) {
|
|
541
|
-
Effect.pipe(this.putters,
|
|
542
|
+
Effect.pipe(this.putters, MutableQueue.offer([value, deferred, true]));
|
|
542
543
|
} else {
|
|
543
|
-
Effect.pipe(this.putters,
|
|
544
|
+
Effect.pipe(this.putters, MutableQueue.offer([value, deferred, false]));
|
|
544
545
|
}
|
|
545
546
|
}
|
|
546
547
|
}
|
|
@@ -571,15 +572,15 @@ const unsafeCompleteDeferred = (deferred, a) => {
|
|
|
571
572
|
};
|
|
572
573
|
/** @internal */
|
|
573
574
|
const unsafeOfferAll = (queue, as) => {
|
|
574
|
-
return Effect.pipe(queue,
|
|
575
|
+
return Effect.pipe(queue, MutableQueue.offerAll(as));
|
|
575
576
|
};
|
|
576
577
|
/** @internal */
|
|
577
578
|
const unsafePollAll = queue => {
|
|
578
|
-
return Effect.pipe(queue,
|
|
579
|
+
return Effect.pipe(queue, MutableQueue.pollUpTo(Number.POSITIVE_INFINITY));
|
|
579
580
|
};
|
|
580
581
|
/** @internal */
|
|
581
582
|
const unsafePollN = (queue, max) => {
|
|
582
|
-
return Effect.pipe(queue,
|
|
583
|
+
return Effect.pipe(queue, MutableQueue.pollUpTo(max));
|
|
583
584
|
};
|
|
584
585
|
/** @internal */
|
|
585
586
|
const unsafeRemove = (queue, a) => {
|
|
@@ -590,10 +591,10 @@ const unsafeCompleteTakers = (strategy, queue, takers) => {
|
|
|
590
591
|
// Check both a taker and an item are in the queue, starting with the taker
|
|
591
592
|
let keepPolling = true;
|
|
592
593
|
while (keepPolling && queue.length() !== 0) {
|
|
593
|
-
const taker = Effect.pipe(takers,
|
|
594
|
-
if (taker !==
|
|
595
|
-
const element = queue.poll(
|
|
596
|
-
if (element !==
|
|
594
|
+
const taker = Effect.pipe(takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue));
|
|
595
|
+
if (taker !== MutableQueue.EmptyMutableQueue) {
|
|
596
|
+
const element = queue.poll(MutableQueue.EmptyMutableQueue);
|
|
597
|
+
if (element !== MutableQueue.EmptyMutableQueue) {
|
|
597
598
|
unsafeCompleteDeferred(taker, element);
|
|
598
599
|
strategy.unsafeOnQueueEmptySpace(queue, takers);
|
|
599
600
|
} else {
|
|
@@ -604,7 +605,7 @@ const unsafeCompleteTakers = (strategy, queue, takers) => {
|
|
|
604
605
|
keepPolling = false;
|
|
605
606
|
}
|
|
606
607
|
}
|
|
607
|
-
if (keepPolling && queue.length() === 0 && !
|
|
608
|
+
if (keepPolling && queue.length() === 0 && !MutableQueue.isEmpty(takers)) {
|
|
608
609
|
strategy.onCompleteTakersWithEmptyQueue(takers);
|
|
609
610
|
}
|
|
610
611
|
};
|
|
@@ -738,7 +739,7 @@ class ContinuationKImpl {
|
|
|
738
739
|
this.onHalt = onHalt;
|
|
739
740
|
}
|
|
740
741
|
onExit(exit) {
|
|
741
|
-
return
|
|
742
|
+
return MutableQueue.isFailure(exit) ? this.onHalt(exit.cause) : this.onSuccess(exit.value);
|
|
742
743
|
}
|
|
743
744
|
}
|
|
744
745
|
/** @internal */
|
|
@@ -1049,7 +1050,7 @@ class PullFromChild {
|
|
|
1049
1050
|
const fin1 = this.childExecutor.close(exit);
|
|
1050
1051
|
const fin2 = this.parentSubexecutor.close(exit);
|
|
1051
1052
|
if (fin1 !== undefined && fin2 !== undefined) {
|
|
1052
|
-
return Effect.zipWith(Effect.exit$1(fin1), Effect.exit$1(fin2), (exit1, exit2) => Effect.pipe(exit1,
|
|
1053
|
+
return Effect.zipWith(Effect.exit$1(fin1), Effect.exit$1(fin2), (exit1, exit2) => Effect.pipe(exit1, MutableQueue.zipRight(exit2)));
|
|
1053
1054
|
} else if (fin1 !== undefined) {
|
|
1054
1055
|
return fin1;
|
|
1055
1056
|
} else if (fin2 !== undefined) {
|
|
@@ -1093,7 +1094,7 @@ class PullFromUpstream {
|
|
|
1093
1094
|
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
|
1094
1095
|
const result = fins.reduce((acc, next) => {
|
|
1095
1096
|
if (acc !== undefined && next !== undefined) {
|
|
1096
|
-
return Effect.zipWith(acc, Effect.exit$1(next), (exit1, exit2) =>
|
|
1097
|
+
return Effect.zipWith(acc, Effect.exit$1(next), (exit1, exit2) => MutableQueue.zipRight(exit1, exit2));
|
|
1097
1098
|
} else if (acc !== undefined) {
|
|
1098
1099
|
return acc;
|
|
1099
1100
|
} else if (next !== undefined) {
|
|
@@ -1137,7 +1138,7 @@ class DrainChildExecutors {
|
|
|
1137
1138
|
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
|
1138
1139
|
const result = fins.reduce((acc, next) => {
|
|
1139
1140
|
if (acc !== undefined && next !== undefined) {
|
|
1140
|
-
return Effect.zipWith(acc, Effect.exit$1(next), (exit1, exit2) =>
|
|
1141
|
+
return Effect.zipWith(acc, Effect.exit$1(next), (exit1, exit2) => MutableQueue.zipRight(exit1, exit2));
|
|
1141
1142
|
} else if (acc !== undefined) {
|
|
1142
1143
|
return acc;
|
|
1143
1144
|
} else if (next !== undefined) {
|
|
@@ -1256,7 +1257,7 @@ class ChannelExecutor {
|
|
|
1256
1257
|
switch (state._tag) {
|
|
1257
1258
|
case OP_DONE$1:
|
|
1258
1259
|
{
|
|
1259
|
-
return
|
|
1260
|
+
return MutableQueue.match(inputExecutor.getDone(), {
|
|
1260
1261
|
onFailure: cause => bridgeInput.error(cause),
|
|
1261
1262
|
onSuccess: value => bridgeInput.done(value)
|
|
1262
1263
|
});
|
|
@@ -1289,7 +1290,7 @@ class ChannelExecutor {
|
|
|
1289
1290
|
{
|
|
1290
1291
|
const executor = new ChannelExecutor(this._currentChannel.value(), this._providedEnv, effect => Effect.sync$1(() => {
|
|
1291
1292
|
const prevLastClose = this._closeLastSubstream === undefined ? Effect._void : this._closeLastSubstream;
|
|
1292
|
-
this._closeLastSubstream = Effect.pipe(prevLastClose, Effect.zipRight$
|
|
1293
|
+
this._closeLastSubstream = Effect.pipe(prevLastClose, Effect.zipRight$1(effect));
|
|
1293
1294
|
}));
|
|
1294
1295
|
executor._input = this._input;
|
|
1295
1296
|
const channel = this._currentChannel;
|
|
@@ -1366,7 +1367,7 @@ class ChannelExecutor {
|
|
|
1366
1367
|
try {
|
|
1367
1368
|
this._currentChannel = read.more(emitted);
|
|
1368
1369
|
} catch (error) {
|
|
1369
|
-
this._currentChannel = read.done.onExit(
|
|
1370
|
+
this._currentChannel = read.done.onExit(MutableQueue.die(error));
|
|
1370
1371
|
}
|
|
1371
1372
|
return undefined;
|
|
1372
1373
|
}, exit => {
|
|
@@ -1466,13 +1467,13 @@ class ChannelExecutor {
|
|
|
1466
1467
|
if (closeSubexecutors === undefined && runInProgressFinalizers === undefined && closeSelf === undefined) {
|
|
1467
1468
|
return undefined;
|
|
1468
1469
|
}
|
|
1469
|
-
return Effect.pipe(Effect.exit$1(ifNotNull(closeSubexecutors)), Effect.zip(Effect.exit$1(ifNotNull(runInProgressFinalizers))), Effect.zip(Effect.exit$1(ifNotNull(closeSelf))), Effect.map$2(([[exit1, exit2], exit3]) => Effect.pipe(exit1,
|
|
1470
|
+
return Effect.pipe(Effect.exit$1(ifNotNull(closeSubexecutors)), Effect.zip(Effect.exit$1(ifNotNull(runInProgressFinalizers))), Effect.zip(Effect.exit$1(ifNotNull(closeSelf))), Effect.map$2(([[exit1, exit2], exit3]) => Effect.pipe(exit1, MutableQueue.zipRight(exit2), MutableQueue.zipRight(exit3))), Effect.uninterruptible$1,
|
|
1470
1471
|
// TODO: remove
|
|
1471
1472
|
Effect.flatMap$1(exit => Effect.suspend$1(() => exit)));
|
|
1472
1473
|
}
|
|
1473
1474
|
doneSucceed(value) {
|
|
1474
1475
|
if (this._doneStack.length === 0) {
|
|
1475
|
-
this._done =
|
|
1476
|
+
this._done = MutableQueue.succeed(value);
|
|
1476
1477
|
this._currentChannel = undefined;
|
|
1477
1478
|
return Done();
|
|
1478
1479
|
}
|
|
@@ -1485,18 +1486,18 @@ class ChannelExecutor {
|
|
|
1485
1486
|
const finalizers = this.popNextFinalizers();
|
|
1486
1487
|
if (this._doneStack.length === 0) {
|
|
1487
1488
|
this._doneStack = finalizers.reverse();
|
|
1488
|
-
this._done =
|
|
1489
|
+
this._done = MutableQueue.succeed(value);
|
|
1489
1490
|
this._currentChannel = undefined;
|
|
1490
1491
|
return Done();
|
|
1491
1492
|
}
|
|
1492
|
-
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer),
|
|
1493
|
+
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), MutableQueue.succeed(value));
|
|
1493
1494
|
this.storeInProgressFinalizer(finalizerEffect);
|
|
1494
1495
|
const effect = Effect.pipe(finalizerEffect, Effect.ensuring(Effect.sync$1(() => this.clearInProgressFinalizer())), Effect.uninterruptible$1, Effect.flatMap$1(() => Effect.sync$1(() => this.doneSucceed(value))));
|
|
1495
1496
|
return fromEffect$2(effect);
|
|
1496
1497
|
}
|
|
1497
1498
|
doneHalt(cause) {
|
|
1498
1499
|
if (this._doneStack.length === 0) {
|
|
1499
|
-
this._done =
|
|
1500
|
+
this._done = MutableQueue.failCause(cause);
|
|
1500
1501
|
this._currentChannel = undefined;
|
|
1501
1502
|
return Done();
|
|
1502
1503
|
}
|
|
@@ -1513,11 +1514,11 @@ class ChannelExecutor {
|
|
|
1513
1514
|
const finalizers = this.popNextFinalizers();
|
|
1514
1515
|
if (this._doneStack.length === 0) {
|
|
1515
1516
|
this._doneStack = finalizers.reverse();
|
|
1516
|
-
this._done =
|
|
1517
|
+
this._done = MutableQueue.failCause(cause);
|
|
1517
1518
|
this._currentChannel = undefined;
|
|
1518
1519
|
return Done();
|
|
1519
1520
|
}
|
|
1520
|
-
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer),
|
|
1521
|
+
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), MutableQueue.failCause(cause));
|
|
1521
1522
|
this.storeInProgressFinalizer(finalizerEffect);
|
|
1522
1523
|
const effect = Effect.pipe(finalizerEffect, Effect.ensuring(Effect.sync$1(() => this.clearInProgressFinalizer())), Effect.uninterruptible$1, Effect.flatMap$1(() => Effect.sync$1(() => this.doneHalt(cause))));
|
|
1523
1524
|
return fromEffect$2(effect);
|
|
@@ -1581,7 +1582,7 @@ class ChannelExecutor {
|
|
|
1581
1582
|
this._activeSubexecutor = nextSubExec;
|
|
1582
1583
|
}
|
|
1583
1584
|
finishWithExit(exit) {
|
|
1584
|
-
const state =
|
|
1585
|
+
const state = MutableQueue.match(exit, {
|
|
1585
1586
|
onFailure: cause => this.doneHalt(cause),
|
|
1586
1587
|
onSuccess: value => this.doneSucceed(value)
|
|
1587
1588
|
});
|
|
@@ -1592,7 +1593,7 @@ class ChannelExecutor {
|
|
|
1592
1593
|
this.addFinalizer(() => Effect.pipe(closeFuncs, Effect.forEach(closeFunc => Effect.pipe(Effect.sync$1(() => closeFunc(subexecutorDone)), Effect.flatMap$1(closeEffect => closeEffect !== undefined ? closeEffect : Effect._void)), {
|
|
1593
1594
|
discard: true
|
|
1594
1595
|
})));
|
|
1595
|
-
const state = Effect.pipe(subexecutorDone,
|
|
1596
|
+
const state = Effect.pipe(subexecutorDone, MutableQueue.match({
|
|
1596
1597
|
onFailure: cause => this.doneHalt(cause),
|
|
1597
1598
|
onSuccess: value => this.doneSucceed(value)
|
|
1598
1599
|
}));
|
|
@@ -1635,7 +1636,7 @@ class ChannelExecutor {
|
|
|
1635
1636
|
}
|
|
1636
1637
|
this._activeSubexecutor = new Emit(emitted, this._activeSubexecutor);
|
|
1637
1638
|
return undefined;
|
|
1638
|
-
},
|
|
1639
|
+
}, MutableQueue.match({
|
|
1639
1640
|
onFailure: cause => {
|
|
1640
1641
|
const state = this.handleSubexecutorFailure(childExecutor, parentSubexecutor, cause);
|
|
1641
1642
|
return state === undefined ? undefined : effectOrUndefinedIgnored(state);
|
|
@@ -1652,21 +1653,21 @@ class ChannelExecutor {
|
|
|
1652
1653
|
case OP_PULL_FROM_UPSTREAM:
|
|
1653
1654
|
{
|
|
1654
1655
|
const modifiedParent = new PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);
|
|
1655
|
-
this._closeLastSubstream = childExecutor.close(
|
|
1656
|
+
this._closeLastSubstream = childExecutor.close(MutableQueue.succeed(doneValue));
|
|
1656
1657
|
this.replaceSubexecutor(modifiedParent);
|
|
1657
1658
|
break;
|
|
1658
1659
|
}
|
|
1659
1660
|
case OP_DRAIN_CHILD_EXECUTORS:
|
|
1660
1661
|
{
|
|
1661
1662
|
const modifiedParent = new DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);
|
|
1662
|
-
this._closeLastSubstream = childExecutor.close(
|
|
1663
|
+
this._closeLastSubstream = childExecutor.close(MutableQueue.succeed(doneValue));
|
|
1663
1664
|
this.replaceSubexecutor(modifiedParent);
|
|
1664
1665
|
break;
|
|
1665
1666
|
}
|
|
1666
1667
|
}
|
|
1667
1668
|
}
|
|
1668
1669
|
handleSubexecutorFailure(childExecutor, parentSubexecutor, cause) {
|
|
1669
|
-
return this.finishSubexecutorWithCloseEffect(
|
|
1670
|
+
return this.finishSubexecutorWithCloseEffect(MutableQueue.failCause(cause), exit => parentSubexecutor.close(exit), exit => childExecutor.close(exit));
|
|
1670
1671
|
}
|
|
1671
1672
|
pullFromUpstream(subexecutor) {
|
|
1672
1673
|
if (subexecutor.activeChildExecutors.length === 0) {
|
|
@@ -1684,7 +1685,7 @@ class ChannelExecutor {
|
|
|
1684
1685
|
return Read(subexecutor.upstreamExecutor, effect => {
|
|
1685
1686
|
const closeLastSubstream = this._closeLastSubstream === undefined ? Effect._void : this._closeLastSubstream;
|
|
1686
1687
|
this._closeLastSubstream = undefined;
|
|
1687
|
-
return Effect.pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.zipRight$
|
|
1688
|
+
return Effect.pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.zipRight$1(effect));
|
|
1688
1689
|
}, emitted => {
|
|
1689
1690
|
if (this._closeLastSubstream !== undefined) {
|
|
1690
1691
|
const closeLastSubstream = this._closeLastSubstream;
|
|
@@ -1720,7 +1721,7 @@ class ChannelExecutor {
|
|
|
1720
1721
|
return undefined;
|
|
1721
1722
|
}
|
|
1722
1723
|
const closeLastSubstream = this._closeLastSubstream;
|
|
1723
|
-
const state = this.finishSubexecutorWithCloseEffect(Effect.pipe(exit,
|
|
1724
|
+
const state = this.finishSubexecutorWithCloseEffect(Effect.pipe(exit, MutableQueue.map(a => subexecutor.combineWithChildResult(subexecutor.lastDone, a))), () => closeLastSubstream, exit => subexecutor.upstreamExecutor.close(exit));
|
|
1724
1725
|
return state === undefined ? undefined :
|
|
1725
1726
|
// NOTE: assuming finalizers cannot fail
|
|
1726
1727
|
effectOrUndefinedIgnored(state);
|
|
@@ -1752,7 +1753,7 @@ class ChannelExecutor {
|
|
|
1752
1753
|
}
|
|
1753
1754
|
const ifNotNull = effect => effect !== undefined ? effect : Effect._void;
|
|
1754
1755
|
const runFinalizers = (finalizers, exit) => {
|
|
1755
|
-
return Effect.pipe(Effect.forEach(finalizers, fin => Effect.exit$1(fin(exit))), Effect.map$2(exits => Effect.pipe(
|
|
1756
|
+
return Effect.pipe(Effect.forEach(finalizers, fin => Effect.exit$1(fin(exit))), Effect.map$2(exits => Effect.pipe(MutableQueue.all(exits), Effect.getOrElse(() => MutableQueue.void_))), Effect.flatMap$1(exit => Effect.suspend$1(() => exit)));
|
|
1756
1757
|
};
|
|
1757
1758
|
/**
|
|
1758
1759
|
* @internal
|
|
@@ -1810,7 +1811,7 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1810
1811
|
{
|
|
1811
1812
|
readStack.push(current);
|
|
1812
1813
|
return Effect.pipe(current.onEffect(state.effect), Effect.catchAllCause(cause => Effect.suspend$1(() => {
|
|
1813
|
-
const doneEffect = current.onDone(
|
|
1814
|
+
const doneEffect = current.onDone(MutableQueue.failCause(cause));
|
|
1814
1815
|
return doneEffect === undefined ? Effect._void : doneEffect;
|
|
1815
1816
|
})), Effect.matchCauseEffect({
|
|
1816
1817
|
onFailure,
|
|
@@ -1829,17 +1830,17 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1829
1830
|
};
|
|
1830
1831
|
/** @internal */
|
|
1831
1832
|
const runIn = /*#__PURE__*/Effect.dual(2, (self, scope) => {
|
|
1832
|
-
const run = (channelDeferred, scopeDeferred, scope) => Effect.acquireUseRelease(Effect.sync$1(() => new ChannelExecutor(self, void 0, Effect.identity)), exec => Effect.suspend$1(() => runScopedInterpret(exec.run(), exec).pipe(Effect.intoDeferred(channelDeferred), Effect.zipRight$
|
|
1833
|
+
const run = (channelDeferred, scopeDeferred, scope) => Effect.acquireUseRelease(Effect.sync$1(() => new ChannelExecutor(self, void 0, Effect.identity)), exec => Effect.suspend$1(() => runScopedInterpret(exec.run(), exec).pipe(Effect.intoDeferred(channelDeferred), Effect.zipRight$1(MutableQueue._await(channelDeferred)), Effect.zipLeft(MutableQueue._await(scopeDeferred)))), (exec, exit) => {
|
|
1833
1834
|
const finalize = exec.close(exit);
|
|
1834
1835
|
if (finalize === undefined) {
|
|
1835
1836
|
return Effect._void;
|
|
1836
1837
|
}
|
|
1837
|
-
return Effect.tapErrorCause(finalize, cause => Effect.addFinalizer(scope, Effect.failCause
|
|
1838
|
+
return Effect.tapErrorCause(finalize, cause => Effect.addFinalizer(scope, Effect.failCause(cause)));
|
|
1838
1839
|
});
|
|
1839
|
-
return Effect.uninterruptibleMask(restore => Effect.all$
|
|
1840
|
-
const interruptors$1 =
|
|
1841
|
-
return
|
|
1842
|
-
}).pipe(Effect.zipRight$
|
|
1840
|
+
return Effect.uninterruptibleMask(restore => Effect.all$1([Effect.fork(scope, Effect.sequential), MutableQueue.make(), MutableQueue.make()]).pipe(Effect.flatMap$1(([child, channelDeferred, scopeDeferred]) => restore(run(channelDeferred, scopeDeferred, child)).pipe(Effect.forkIn(scope), Effect.flatMap$1(fiber => scope.addFinalizer(exit => {
|
|
1841
|
+
const interruptors$1 = MutableQueue.isFailure(exit) ? interruptors(exit.cause) : undefined;
|
|
1842
|
+
return MutableQueue.isDone(channelDeferred).pipe(Effect.flatMap$1(isDone => isDone ? MutableQueue.succeed$1(scopeDeferred, void 0).pipe(Effect.zipRight$1(_await(fiber)), Effect.zipRight$1(inheritAll(fiber))) : MutableQueue.succeed$1(scopeDeferred, void 0).pipe(Effect.zipRight$1(interruptors$1 && Effect.size$1(interruptors$1) > 0 ? interruptAs(fiber, Effect.combineAll(interruptors$1)) : interrupt(fiber)), Effect.zipRight$1(inheritAll(fiber)))));
|
|
1843
|
+
}).pipe(Effect.zipRight$1(restore(MutableQueue._await(channelDeferred)))))))));
|
|
1843
1844
|
});
|
|
1844
1845
|
/** @internal */
|
|
1845
1846
|
const runScopedInterpret = (channelState, exec) => {
|
|
@@ -1860,7 +1861,7 @@ const runScopedInterpret = (channelState, exec) => {
|
|
|
1860
1861
|
}
|
|
1861
1862
|
case OP_READ:
|
|
1862
1863
|
{
|
|
1863
|
-
return readUpstream(op, () => runScopedInterpret(exec.run(), exec), Effect.failCause
|
|
1864
|
+
return readUpstream(op, () => runScopedInterpret(exec.run(), exec), Effect.failCause);
|
|
1864
1865
|
}
|
|
1865
1866
|
}
|
|
1866
1867
|
};
|
|
@@ -2007,7 +2008,7 @@ class SingleProducerAsyncInputImpl {
|
|
|
2007
2008
|
this.ref = ref;
|
|
2008
2009
|
}
|
|
2009
2010
|
awaitRead() {
|
|
2010
|
-
return Effect.flatten(modify(this.ref, state => state._tag === OP_STATE_EMPTY ? [
|
|
2011
|
+
return Effect.flatten(modify(this.ref, state => state._tag === OP_STATE_EMPTY ? [MutableQueue._await(state.notifyProducer), state] : [Effect._void, state]));
|
|
2011
2012
|
}
|
|
2012
2013
|
get close() {
|
|
2013
2014
|
return Effect.fiberIdWith(fiberId => this.error(interrupt$1(fiberId)));
|
|
@@ -2017,48 +2018,48 @@ class SingleProducerAsyncInputImpl {
|
|
|
2017
2018
|
switch (state._tag) {
|
|
2018
2019
|
case OP_STATE_EMPTY:
|
|
2019
2020
|
{
|
|
2020
|
-
return [
|
|
2021
|
+
return [MutableQueue._await(state.notifyProducer), state];
|
|
2021
2022
|
}
|
|
2022
2023
|
case OP_STATE_EMIT:
|
|
2023
2024
|
{
|
|
2024
|
-
return [Effect.forEach(state.notifyConsumers, deferred =>
|
|
2025
|
+
return [Effect.forEach(state.notifyConsumers, deferred => MutableQueue.succeed$1(deferred, Effect.left(value)), {
|
|
2025
2026
|
discard: true
|
|
2026
2027
|
}), stateDone(value)];
|
|
2027
2028
|
}
|
|
2028
2029
|
case OP_STATE_ERROR:
|
|
2029
2030
|
{
|
|
2030
|
-
return [Effect.interrupt$
|
|
2031
|
+
return [Effect.interrupt$2, state];
|
|
2031
2032
|
}
|
|
2032
2033
|
case OP_STATE_DONE:
|
|
2033
2034
|
{
|
|
2034
|
-
return [Effect.interrupt$
|
|
2035
|
+
return [Effect.interrupt$2, state];
|
|
2035
2036
|
}
|
|
2036
2037
|
}
|
|
2037
2038
|
}));
|
|
2038
2039
|
}
|
|
2039
2040
|
emit(element) {
|
|
2040
|
-
return Effect.flatMap$1(
|
|
2041
|
+
return Effect.flatMap$1(MutableQueue.make(), deferred => Effect.flatten(modify(this.ref, state => {
|
|
2041
2042
|
switch (state._tag) {
|
|
2042
2043
|
case OP_STATE_EMPTY:
|
|
2043
2044
|
{
|
|
2044
|
-
return [
|
|
2045
|
+
return [MutableQueue._await(state.notifyProducer), state];
|
|
2045
2046
|
}
|
|
2046
2047
|
case OP_STATE_EMIT:
|
|
2047
2048
|
{
|
|
2048
2049
|
const notifyConsumer = state.notifyConsumers[0];
|
|
2049
2050
|
const notifyConsumers = state.notifyConsumers.slice(1);
|
|
2050
2051
|
if (notifyConsumer !== undefined) {
|
|
2051
|
-
return [
|
|
2052
|
+
return [MutableQueue.succeed$1(notifyConsumer, Effect.right(element)), notifyConsumers.length === 0 ? stateEmpty(deferred) : stateEmit(notifyConsumers)];
|
|
2052
2053
|
}
|
|
2053
2054
|
throw new Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
2054
2055
|
}
|
|
2055
2056
|
case OP_STATE_ERROR:
|
|
2056
2057
|
{
|
|
2057
|
-
return [Effect.interrupt$
|
|
2058
|
+
return [Effect.interrupt$2, state];
|
|
2058
2059
|
}
|
|
2059
2060
|
case OP_STATE_DONE:
|
|
2060
2061
|
{
|
|
2061
|
-
return [Effect.interrupt$
|
|
2062
|
+
return [Effect.interrupt$2, state];
|
|
2062
2063
|
}
|
|
2063
2064
|
}
|
|
2064
2065
|
})));
|
|
@@ -2068,34 +2069,34 @@ class SingleProducerAsyncInputImpl {
|
|
|
2068
2069
|
switch (state._tag) {
|
|
2069
2070
|
case OP_STATE_EMPTY:
|
|
2070
2071
|
{
|
|
2071
|
-
return [
|
|
2072
|
+
return [MutableQueue._await(state.notifyProducer), state];
|
|
2072
2073
|
}
|
|
2073
2074
|
case OP_STATE_EMIT:
|
|
2074
2075
|
{
|
|
2075
|
-
return [Effect.forEach(state.notifyConsumers, deferred =>
|
|
2076
|
+
return [Effect.forEach(state.notifyConsumers, deferred => MutableQueue.failCause$1(deferred, cause), {
|
|
2076
2077
|
discard: true
|
|
2077
2078
|
}), stateError(cause)];
|
|
2078
2079
|
}
|
|
2079
2080
|
case OP_STATE_ERROR:
|
|
2080
2081
|
{
|
|
2081
|
-
return [Effect.interrupt$
|
|
2082
|
+
return [Effect.interrupt$2, state];
|
|
2082
2083
|
}
|
|
2083
2084
|
case OP_STATE_DONE:
|
|
2084
2085
|
{
|
|
2085
|
-
return [Effect.interrupt$
|
|
2086
|
+
return [Effect.interrupt$2, state];
|
|
2086
2087
|
}
|
|
2087
2088
|
}
|
|
2088
2089
|
}));
|
|
2089
2090
|
}
|
|
2090
2091
|
get take() {
|
|
2091
|
-
return this.takeWith(cause =>
|
|
2092
|
+
return this.takeWith(cause => MutableQueue.failCause(map$2(cause, Effect.left)), elem => MutableQueue.succeed(elem), done => MutableQueue.fail(Effect.right(done)));
|
|
2092
2093
|
}
|
|
2093
2094
|
takeWith(onError, onElement, onDone) {
|
|
2094
|
-
return Effect.flatMap$1(
|
|
2095
|
+
return Effect.flatMap$1(MutableQueue.make(), deferred => Effect.flatten(modify(this.ref, state => {
|
|
2095
2096
|
switch (state._tag) {
|
|
2096
2097
|
case OP_STATE_EMPTY:
|
|
2097
2098
|
{
|
|
2098
|
-
return [Effect.zipRight$
|
|
2099
|
+
return [Effect.zipRight$1(MutableQueue.succeed$1(state.notifyProducer, void 0), Effect.matchCause(MutableQueue._await(deferred), {
|
|
2099
2100
|
onFailure: onError,
|
|
2100
2101
|
onSuccess: Effect.match$1({
|
|
2101
2102
|
onLeft: onDone,
|
|
@@ -2105,7 +2106,7 @@ class SingleProducerAsyncInputImpl {
|
|
|
2105
2106
|
}
|
|
2106
2107
|
case OP_STATE_EMIT:
|
|
2107
2108
|
{
|
|
2108
|
-
return [Effect.matchCause(
|
|
2109
|
+
return [Effect.matchCause(MutableQueue._await(deferred), {
|
|
2109
2110
|
onFailure: onError,
|
|
2110
2111
|
onSuccess: Effect.match$1({
|
|
2111
2112
|
onLeft: onDone,
|
|
@@ -2126,7 +2127,7 @@ class SingleProducerAsyncInputImpl {
|
|
|
2126
2127
|
}
|
|
2127
2128
|
}
|
|
2128
2129
|
/** @internal */
|
|
2129
|
-
const make$1 = () => Effect.pipe(
|
|
2130
|
+
const make$1 = () => Effect.pipe(MutableQueue.make(), Effect.flatMap$1(deferred => make$3(stateEmpty(deferred))), Effect.map$2(ref => new SingleProducerAsyncInputImpl(ref)));
|
|
2130
2131
|
|
|
2131
2132
|
/** @internal */
|
|
2132
2133
|
const concatMap = /*#__PURE__*/Effect.dual(2, (self, f) => concatMapWith(self, f, () => void 0, () => void 0));
|
|
@@ -2168,19 +2169,19 @@ const mapOutEffectPar = /*#__PURE__*/Effect.dual(3, (self, f, n) => unwrapScoped
|
|
|
2168
2169
|
const queueReader = fromInput(input);
|
|
2169
2170
|
const queue = yield* bounded(n);
|
|
2170
2171
|
yield* Effect.addFinalizer(scope, shutdown(queue));
|
|
2171
|
-
const errorSignal = yield*
|
|
2172
|
+
const errorSignal = yield* MutableQueue.make();
|
|
2172
2173
|
const withPermits = n === Number.POSITIVE_INFINITY ? _ => Effect.identity : (yield* Effect.makeSemaphore(n)).withPermits;
|
|
2173
2174
|
const pull = yield* queueReader.pipe(pipeTo(self), toPullIn(scope));
|
|
2174
2175
|
yield* pull.pipe(Effect.matchCauseEffect({
|
|
2175
|
-
onFailure: cause => offer(queue, Effect.failCause
|
|
2176
|
+
onFailure: cause => offer(queue, Effect.failCause(cause)),
|
|
2176
2177
|
onSuccess: Effect.match$1({
|
|
2177
|
-
onLeft: outDone => Effect.zipRight$
|
|
2178
|
+
onLeft: outDone => Effect.zipRight$1(Effect.interruptible(withPermits(n)(Effect._void)), Effect.asVoid$1(offer(queue, Effect.succeed(Effect.left(outDone))))),
|
|
2178
2179
|
onRight: outElem => Effect.gen(function* () {
|
|
2179
|
-
const deferred = yield*
|
|
2180
|
-
const latch = yield*
|
|
2181
|
-
yield* offer(queue, Effect.map$2(
|
|
2182
|
-
yield*
|
|
2183
|
-
yield*
|
|
2180
|
+
const deferred = yield* MutableQueue.make();
|
|
2181
|
+
const latch = yield* MutableQueue.make();
|
|
2182
|
+
yield* offer(queue, Effect.map$2(MutableQueue._await(deferred), Effect.right));
|
|
2183
|
+
yield* MutableQueue.succeed$1(latch, void 0).pipe(Effect.zipRight$1(Effect.uninterruptibleMask(restore => Effect.exit$1(restore(MutableQueue._await(errorSignal))).pipe(Effect.raceFirst(Effect.exit$1(restore(f(outElem)))), Effect.flatMap$1(Effect.identity))).pipe(Effect.tapErrorCause(cause => MutableQueue.failCause$1(errorSignal, cause)), Effect.intoDeferred(deferred))), withPermits(1), Effect.forkIn(scope));
|
|
2184
|
+
yield* MutableQueue._await(latch);
|
|
2184
2185
|
})
|
|
2185
2186
|
})
|
|
2186
2187
|
}), Effect.forever, Effect.interruptible, Effect.forkIn(scope));
|
|
@@ -2211,7 +2212,7 @@ const mergeAllWith = ({
|
|
|
2211
2212
|
const cancelers = yield* unbounded();
|
|
2212
2213
|
yield* Effect.addFinalizer(scope, shutdown(cancelers));
|
|
2213
2214
|
const lastDone = yield* make$3(Effect.none());
|
|
2214
|
-
const errorSignal = yield*
|
|
2215
|
+
const errorSignal = yield* MutableQueue.make();
|
|
2215
2216
|
const withPermits = (yield* Effect.makeSemaphore(concurrencyN)).withPermits;
|
|
2216
2217
|
const pull = yield* toPullIn(pipeTo(queueReader, channels), scope);
|
|
2217
2218
|
function evaluatePull(pull) {
|
|
@@ -2223,37 +2224,37 @@ const mergeAllWith = ({
|
|
|
2223
2224
|
}), Effect.flatMap$1(outDone => update(lastDone, Effect.match({
|
|
2224
2225
|
onNone: () => Effect.some(outDone.value),
|
|
2225
2226
|
onSome: lastDone => Effect.some(f(lastDone, outDone.value))
|
|
2226
|
-
}))), Effect.catchAllCause(cause => isInterrupted(cause) ? Effect.failCause
|
|
2227
|
+
}))), Effect.catchAllCause(cause => isInterrupted(cause) ? Effect.failCause(cause) : offer(queue, Effect.failCause(cause)).pipe(Effect.zipRight$1(MutableQueue.succeed$1(errorSignal, void 0)), Effect.asVoid$1)));
|
|
2227
2228
|
}
|
|
2228
2229
|
yield* pull.pipe(Effect.matchCauseEffect({
|
|
2229
|
-
onFailure: cause => offer(queue, Effect.failCause
|
|
2230
|
+
onFailure: cause => offer(queue, Effect.failCause(cause)).pipe(Effect.zipRight$1(Effect.succeed(false))),
|
|
2230
2231
|
onSuccess: Effect.match$1({
|
|
2231
|
-
onLeft: outDone => Effect.raceWith(Effect.interruptible(
|
|
2232
|
+
onLeft: outDone => Effect.raceWith(Effect.interruptible(MutableQueue._await(errorSignal)), Effect.interruptible(withPermits(concurrencyN)(Effect._void)), {
|
|
2232
2233
|
onSelfDone: (_, permitAcquisition) => Effect.as(interrupt(permitAcquisition), false),
|
|
2233
|
-
onOtherDone: (_, failureAwait) => Effect.zipRight$
|
|
2234
|
+
onOtherDone: (_, failureAwait) => Effect.zipRight$1(interrupt(failureAwait), get(lastDone).pipe(Effect.flatMap$1(Effect.match({
|
|
2234
2235
|
onNone: () => offer(queue, Effect.succeed(Effect.left(outDone))),
|
|
2235
2236
|
onSome: lastDone => offer(queue, Effect.succeed(Effect.left(f(lastDone, outDone))))
|
|
2236
2237
|
})), Effect.as(false)))
|
|
2237
2238
|
}),
|
|
2238
2239
|
onRight: channel => match(mergeStrategy, {
|
|
2239
2240
|
onBackPressure: () => Effect.gen(function* () {
|
|
2240
|
-
const latch = yield*
|
|
2241
|
-
const raceEffects = Effect.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(Effect.flatMap$1(pull => Effect.race(Effect.exit$1(evaluatePull(pull)), Effect.exit$1(Effect.interruptible(
|
|
2242
|
-
yield*
|
|
2243
|
-
yield*
|
|
2244
|
-
const errored = yield*
|
|
2241
|
+
const latch = yield* MutableQueue.make();
|
|
2242
|
+
const raceEffects = Effect.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(Effect.flatMap$1(pull => Effect.race(Effect.exit$1(evaluatePull(pull)), Effect.exit$1(Effect.interruptible(MutableQueue._await(errorSignal))))), Effect.flatMap$1(Effect.identity)));
|
|
2243
|
+
yield* MutableQueue.succeed$1(latch, void 0).pipe(Effect.zipRight$1(raceEffects), withPermits(1), Effect.forkIn(scope));
|
|
2244
|
+
yield* MutableQueue._await(latch);
|
|
2245
|
+
const errored = yield* MutableQueue.isDone(errorSignal);
|
|
2245
2246
|
return !errored;
|
|
2246
2247
|
}),
|
|
2247
2248
|
onBufferSliding: () => Effect.gen(function* () {
|
|
2248
|
-
const canceler = yield*
|
|
2249
|
-
const latch = yield*
|
|
2249
|
+
const canceler = yield* MutableQueue.make();
|
|
2250
|
+
const latch = yield* MutableQueue.make();
|
|
2250
2251
|
const size$1 = yield* size(cancelers);
|
|
2251
|
-
yield* take(cancelers).pipe(Effect.flatMap$1(canceler =>
|
|
2252
|
+
yield* take(cancelers).pipe(Effect.flatMap$1(canceler => MutableQueue.succeed$1(canceler, void 0)), Effect.when$1(() => size$1 >= concurrencyN));
|
|
2252
2253
|
yield* offer(cancelers, canceler);
|
|
2253
|
-
const raceEffects = Effect.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(Effect.flatMap$1(pull => Effect.exit$1(evaluatePull(pull)).pipe(Effect.race(Effect.exit$1(Effect.interruptible(
|
|
2254
|
-
yield*
|
|
2255
|
-
yield*
|
|
2256
|
-
const errored = yield*
|
|
2254
|
+
const raceEffects = Effect.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(Effect.flatMap$1(pull => Effect.exit$1(evaluatePull(pull)).pipe(Effect.race(Effect.exit$1(Effect.interruptible(MutableQueue._await(errorSignal)))), Effect.race(Effect.exit$1(Effect.interruptible(MutableQueue._await(canceler)))))), Effect.flatMap$1(Effect.identity)));
|
|
2255
|
+
yield* MutableQueue.succeed$1(latch, void 0).pipe(Effect.zipRight$1(raceEffects), withPermits(1), Effect.forkIn(scope));
|
|
2256
|
+
yield* MutableQueue._await(latch);
|
|
2257
|
+
const errored = yield* MutableQueue.isDone(errorSignal);
|
|
2257
2258
|
return !errored;
|
|
2258
2259
|
})
|
|
2259
2260
|
})
|
|
@@ -2285,20 +2286,20 @@ const mergeWith = /*#__PURE__*/Effect.dual(2, (self, options) => {
|
|
|
2285
2286
|
function onDecision(decision) {
|
|
2286
2287
|
const op = decision;
|
|
2287
2288
|
if (op._tag === OP_DONE) {
|
|
2288
|
-
return Effect.succeed(fromEffect$3(Effect.zipRight$
|
|
2289
|
+
return Effect.succeed(fromEffect$3(Effect.zipRight$1(interrupt(fiber), op.effect)));
|
|
2289
2290
|
}
|
|
2290
|
-
return Effect.map$2(_await(fiber),
|
|
2291
|
-
onFailure: cause => fromEffect$3(op.f(
|
|
2291
|
+
return Effect.map$2(_await(fiber), MutableQueue.match({
|
|
2292
|
+
onFailure: cause => fromEffect$3(op.f(MutableQueue.failCause(cause))),
|
|
2292
2293
|
onSuccess: Effect.match$1({
|
|
2293
|
-
onLeft: done => fromEffect$3(op.f(
|
|
2294
|
+
onLeft: done => fromEffect$3(op.f(MutableQueue.succeed(done))),
|
|
2294
2295
|
onRight: elem => zipRight(write(elem), go(single(op.f)))
|
|
2295
2296
|
})
|
|
2296
2297
|
}));
|
|
2297
2298
|
}
|
|
2298
|
-
return
|
|
2299
|
-
onFailure: cause => onDecision(done(
|
|
2299
|
+
return MutableQueue.match(exit, {
|
|
2300
|
+
onFailure: cause => onDecision(done(MutableQueue.failCause(cause))),
|
|
2300
2301
|
onSuccess: Effect.match$1({
|
|
2301
|
-
onLeft: z => onDecision(done(
|
|
2302
|
+
onLeft: z => onDecision(done(MutableQueue.succeed(z))),
|
|
2302
2303
|
onRight: elem => Effect.succeed(flatMap$1(write(elem), () => flatMap$1(fromEffect$3(Effect.forkIn(Effect.interruptible(pull), scope)), leftFiber => go(both(leftFiber, fiber)))))
|
|
2303
2304
|
})
|
|
2304
2305
|
});
|
|
@@ -2311,26 +2312,26 @@ const mergeWith = /*#__PURE__*/Effect.dual(2, (self, options) => {
|
|
|
2311
2312
|
const leftJoin = Effect.interruptible(join(state.left));
|
|
2312
2313
|
const rightJoin = Effect.interruptible(join(state.right));
|
|
2313
2314
|
return unwrap(Effect.raceWith(leftJoin, rightJoin, {
|
|
2314
|
-
onSelfDone: (leftExit, rf) => Effect.zipRight$
|
|
2315
|
-
onOtherDone: (rightExit, lf) => Effect.zipRight$
|
|
2315
|
+
onSelfDone: (leftExit, rf) => Effect.zipRight$1(interrupt(rf), handleSide(leftExit, state.right, pullL)(options.onSelfDone, BothRunning, f => LeftDone(f))),
|
|
2316
|
+
onOtherDone: (rightExit, lf) => Effect.zipRight$1(interrupt(lf), handleSide(rightExit, state.left, pullR)(options.onOtherDone, (left, right) => BothRunning(right, left), f => RightDone(f)))
|
|
2316
2317
|
}));
|
|
2317
2318
|
}
|
|
2318
2319
|
case OP_LEFT_DONE:
|
|
2319
2320
|
{
|
|
2320
|
-
return unwrap(Effect.map$2(Effect.exit$1(pullR),
|
|
2321
|
-
onFailure: cause => fromEffect$3(state.f(
|
|
2321
|
+
return unwrap(Effect.map$2(Effect.exit$1(pullR), MutableQueue.match({
|
|
2322
|
+
onFailure: cause => fromEffect$3(state.f(MutableQueue.failCause(cause))),
|
|
2322
2323
|
onSuccess: Effect.match$1({
|
|
2323
|
-
onLeft: done => fromEffect$3(state.f(
|
|
2324
|
+
onLeft: done => fromEffect$3(state.f(MutableQueue.succeed(done))),
|
|
2324
2325
|
onRight: elem => flatMap$1(write(elem), () => go(LeftDone(state.f)))
|
|
2325
2326
|
})
|
|
2326
2327
|
})));
|
|
2327
2328
|
}
|
|
2328
2329
|
case OP_RIGHT_DONE:
|
|
2329
2330
|
{
|
|
2330
|
-
return unwrap(Effect.map$2(Effect.exit$1(pullL),
|
|
2331
|
-
onFailure: cause => fromEffect$3(state.f(
|
|
2331
|
+
return unwrap(Effect.map$2(Effect.exit$1(pullL), MutableQueue.match({
|
|
2332
|
+
onFailure: cause => fromEffect$3(state.f(MutableQueue.failCause(cause))),
|
|
2332
2333
|
onSuccess: Effect.match$1({
|
|
2333
|
-
onLeft: done => fromEffect$3(state.f(
|
|
2334
|
+
onLeft: done => fromEffect$3(state.f(MutableQueue.succeed(done))),
|
|
2334
2335
|
onRight: elem => flatMap$1(write(elem), () => go(RightDone(state.f)))
|
|
2335
2336
|
})
|
|
2336
2337
|
})));
|
|
@@ -2373,7 +2374,7 @@ const run$1 = self => Effect.scopedWith(scope => runIn(self, scope));
|
|
|
2373
2374
|
/** @internal */
|
|
2374
2375
|
const runDrain$2 = self => run$1(drain$1(self));
|
|
2375
2376
|
/** @internal */
|
|
2376
|
-
const scoped = effect => unwrap(Effect.uninterruptibleMask(restore => Effect.map$2(Effect.make$
|
|
2377
|
+
const scoped = effect => unwrap(Effect.uninterruptibleMask(restore => Effect.map$2(Effect.make$2(), scope => acquireReleaseOut(Effect.tapErrorCause(restore(Effect.extend(effect, scope)), cause => Effect.close(scope, MutableQueue.failCause(cause))), (_, exit) => Effect.close(scope, exit)))));
|
|
2377
2378
|
/** @internal */
|
|
2378
2379
|
const scopedWith$1 = f => unwrapScoped(Effect.map$2(Effect.scope, scope => flatMap$1(fromEffect$3(f(scope)), write)));
|
|
2379
2380
|
/** @internal */
|
|
@@ -2387,8 +2388,8 @@ const interpretToPull = (channelState, exec) => {
|
|
|
2387
2388
|
switch (state._tag) {
|
|
2388
2389
|
case OP_DONE$1:
|
|
2389
2390
|
{
|
|
2390
|
-
return
|
|
2391
|
-
onFailure: Effect.failCause
|
|
2391
|
+
return MutableQueue.match(exec.getDone(), {
|
|
2392
|
+
onFailure: Effect.failCause,
|
|
2392
2393
|
onSuccess: done => Effect.succeed(Effect.left(done))
|
|
2393
2394
|
});
|
|
2394
2395
|
}
|
|
@@ -2402,7 +2403,7 @@ const interpretToPull = (channelState, exec) => {
|
|
|
2402
2403
|
}
|
|
2403
2404
|
case OP_READ:
|
|
2404
2405
|
{
|
|
2405
|
-
return readUpstream(state, () => interpretToPull(exec.run(), exec), cause => Effect.failCause
|
|
2406
|
+
return readUpstream(state, () => interpretToPull(exec.run(), exec), cause => Effect.failCause(cause));
|
|
2406
2407
|
}
|
|
2407
2408
|
}
|
|
2408
2409
|
};
|
|
@@ -2421,8 +2422,8 @@ const writeChunkWriter = (idx, len, chunk) => {
|
|
|
2421
2422
|
/** @internal */
|
|
2422
2423
|
const zip = /*#__PURE__*/Effect.dual(args => isChannel(args[1]), (self, that, options) => options?.concurrent ? mergeWith(self, {
|
|
2423
2424
|
other: that,
|
|
2424
|
-
onSelfDone: exit1 => Await(exit2 => Effect.suspend$1(() =>
|
|
2425
|
-
onOtherDone: exit2 => Await(exit1 => Effect.suspend$1(() =>
|
|
2425
|
+
onSelfDone: exit1 => Await(exit2 => Effect.suspend$1(() => MutableQueue.zip(exit1, exit2))),
|
|
2426
|
+
onOtherDone: exit2 => Await(exit1 => Effect.suspend$1(() => MutableQueue.zip(exit1, exit2)))
|
|
2426
2427
|
}) : flatMap$1(self, a => map$1(that, b => [a, b])));
|
|
2427
2428
|
/** @internal */
|
|
2428
2429
|
const zipRight = /*#__PURE__*/Effect.dual(args => isChannel(args[1]), (self, that, options) => options?.concurrent ? map$1(zip(self, that, {
|
|
@@ -2493,18 +2494,18 @@ class TakeImpl {
|
|
|
2493
2494
|
}
|
|
2494
2495
|
}
|
|
2495
2496
|
/** @internal */
|
|
2496
|
-
const chunk = chunk => new TakeImpl(
|
|
2497
|
+
const chunk = chunk => new TakeImpl(MutableQueue.succeed(chunk));
|
|
2497
2498
|
/** @internal */
|
|
2498
|
-
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/
|
|
2499
|
+
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/MutableQueue.fail(/*#__PURE__*/Effect.none()));
|
|
2499
2500
|
/** @internal */
|
|
2500
|
-
const failCause$1 = cause => new TakeImpl(
|
|
2501
|
+
const failCause$1 = cause => new TakeImpl(MutableQueue.failCause(Effect.pipe(cause, map$2(Effect.some))));
|
|
2501
2502
|
/** @internal */
|
|
2502
|
-
const of = value => new TakeImpl(
|
|
2503
|
+
const of = value => new TakeImpl(MutableQueue.succeed(Effect.of(value)));
|
|
2503
2504
|
|
|
2504
2505
|
/** @internal */
|
|
2505
|
-
const end = () => Effect.fail$
|
|
2506
|
+
const end = () => Effect.fail$1(Effect.none());
|
|
2506
2507
|
/** @internal */
|
|
2507
|
-
const failCause = cause => Effect.mapError(Effect.failCause
|
|
2508
|
+
const failCause = cause => Effect.mapError(Effect.failCause(cause), Effect.some);
|
|
2508
2509
|
|
|
2509
2510
|
/** @internal */
|
|
2510
2511
|
const StreamSymbolKey = "effect/Stream";
|
|
@@ -2539,7 +2540,7 @@ const flatMap = /*#__PURE__*/Effect.dual(args => isStream(args[0]), (self, f, op
|
|
|
2539
2540
|
if (options?.switch) {
|
|
2540
2541
|
return matchConcurrency(options?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), n => flatMapParSwitchBuffer(self, n, bufferSize, f));
|
|
2541
2542
|
}
|
|
2542
|
-
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as => Effect.pipe(as, Effect.map$
|
|
2543
|
+
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as => Effect.pipe(as, Effect.map$3(a => toChannel(f(a))), Effect.reduce(void_, (left, right) => Effect.pipe(left, zipRight(right)))))), _ => new StreamImpl(Effect.pipe(toChannel(self), concatMap(writeChunk), mergeMap(out => toChannel(f(out)), options))));
|
|
2543
2544
|
});
|
|
2544
2545
|
/** @internal */
|
|
2545
2546
|
const matchConcurrency = (concurrency, sequential, bounded) => {
|
|
@@ -2571,10 +2572,10 @@ const flattenChunks = self => {
|
|
|
2571
2572
|
/** @internal */
|
|
2572
2573
|
const flattenExitOption = self => {
|
|
2573
2574
|
const processChunk = (chunk, cont) => {
|
|
2574
|
-
const [toEmit, rest] = Effect.pipe(chunk, Effect.splitWhere(exit => !
|
|
2575
|
+
const [toEmit, rest] = Effect.pipe(chunk, Effect.splitWhere(exit => !MutableQueue.isSuccess(exit)));
|
|
2575
2576
|
const next = Effect.pipe(Effect.head(rest), Effect.match({
|
|
2576
2577
|
onNone: () => cont,
|
|
2577
|
-
onSome:
|
|
2578
|
+
onSome: MutableQueue.match({
|
|
2578
2579
|
onFailure: cause => Effect.match(flipCauseOption(cause), {
|
|
2579
2580
|
onNone: () => void_,
|
|
2580
2581
|
onSome: failCause$2
|
|
@@ -2582,7 +2583,7 @@ const flattenExitOption = self => {
|
|
|
2582
2583
|
onSuccess: () => void_
|
|
2583
2584
|
})
|
|
2584
2585
|
}));
|
|
2585
|
-
return Effect.pipe(write(Effect.pipe(toEmit, Effect.filterMap(exit =>
|
|
2586
|
+
return Effect.pipe(write(Effect.pipe(toEmit, Effect.filterMap(exit => MutableQueue.isSuccess(exit) ? Effect.some(exit.value) : Effect.none()))), flatMap$1(() => next));
|
|
2586
2587
|
};
|
|
2587
2588
|
const process = readWithCause({
|
|
2588
2589
|
onInput: chunk => processChunk(chunk, process),
|
|
@@ -2606,7 +2607,7 @@ const toChannel = stream => {
|
|
|
2606
2607
|
/** @internal */
|
|
2607
2608
|
const fromEffect = effect => Effect.pipe(effect, Effect.mapError(Effect.some), fromEffectOption);
|
|
2608
2609
|
/** @internal */
|
|
2609
|
-
const fromEffectOption = effect => new StreamImpl(unwrap(Effect.match$
|
|
2610
|
+
const fromEffectOption = effect => new StreamImpl(unwrap(Effect.match$2(effect, {
|
|
2610
2611
|
onFailure: Effect.match({
|
|
2611
2612
|
onNone: () => void_,
|
|
2612
2613
|
onSome: fail
|
|
@@ -2616,7 +2617,7 @@ const fromEffectOption = effect => new StreamImpl(unwrap(Effect.match$3(effect,
|
|
|
2616
2617
|
/** @internal */
|
|
2617
2618
|
const fromQueue$1 = (queue, options) => Effect.pipe(takeBetween(queue, 1, options?.maxChunkSize ?? DefaultChunkSize), Effect.catchAllCause(cause => Effect.pipe(isShutdown(queue), Effect.flatMap$1(isShutdown => isShutdown && isInterrupted(cause) ? end() : failCause(cause)))), repeatEffectChunkOption, options?.shutdown ? ensuring(shutdown(queue)) : Effect.identity);
|
|
2618
2619
|
/** @internal */
|
|
2619
|
-
const map = /*#__PURE__*/Effect.dual(2, (self, f) => new StreamImpl(Effect.pipe(toChannel(self), mapOut(Effect.map$
|
|
2620
|
+
const map = /*#__PURE__*/Effect.dual(2, (self, f) => new StreamImpl(Effect.pipe(toChannel(self), mapOut(Effect.map$3(f)))));
|
|
2620
2621
|
/** @internal */
|
|
2621
2622
|
const mapEffectSequential = /*#__PURE__*/Effect.dual(2, (self, f) => {
|
|
2622
2623
|
const loop = iterator => {
|
|
@@ -2639,7 +2640,7 @@ const mapEffectPar = /*#__PURE__*/Effect.dual(3, (self, n, f) => new StreamImpl(
|
|
|
2639
2640
|
/** @internal */
|
|
2640
2641
|
const repeatEffectChunkOption = effect => unfoldChunkEffect(effect, effect => Effect.pipe(Effect.map$2(effect, chunk => Effect.some([chunk, effect])), Effect.catchAll(Effect.match({
|
|
2641
2642
|
onNone: () => Effect.succeed(Effect.none()),
|
|
2642
|
-
onSome: Effect.fail$
|
|
2643
|
+
onSome: Effect.fail$1
|
|
2643
2644
|
}))));
|
|
2644
2645
|
/** @internal */
|
|
2645
2646
|
const run = /*#__PURE__*/Effect.dual(2, (self, sink) => toChannel(self).pipe(pipeToOrFail(toChannel$1(sink)), runDrain$2));
|
|
@@ -2710,7 +2711,7 @@ const groupByKey = /*#__PURE__*/Effect.dual(args => typeof args[0] !== "function
|
|
|
2710
2711
|
if (innerQueue === undefined) {
|
|
2711
2712
|
return Effect.pipe(bounded(options?.bufferSize ?? 16), Effect.flatMap$1(innerQueue => Effect.pipe(Effect.sync$1(() => {
|
|
2712
2713
|
map.set(key, innerQueue);
|
|
2713
|
-
}), Effect.zipRight$
|
|
2714
|
+
}), Effect.zipRight$1(offer(outerQueue, of([key, innerQueue]))), Effect.zipRight$1(Effect.pipe(offer(innerQueue, chunk(values)), Effect.catchSomeCause(cause => isInterruptedOnly(cause) ? Effect.some(Effect._void) : Effect.none()))))));
|
|
2714
2715
|
}
|
|
2715
2716
|
return Effect.catchSomeCause(offer(innerQueue, chunk(values)), cause => isInterruptedOnly(cause) ? Effect.some(Effect._void) : Effect.none());
|
|
2716
2717
|
}, {
|
|
@@ -2719,7 +2720,7 @@ const groupByKey = /*#__PURE__*/Effect.dual(args => typeof args[0] !== "function
|
|
|
2719
2720
|
onFailure: cause => fromEffect$3(offer(outerQueue, failCause$1(cause))),
|
|
2720
2721
|
onDone: () => fromEffect$3(Effect.pipe(Effect.forEach(map.entries(), ([_, innerQueue]) => Effect.pipe(offer(innerQueue, end$1), Effect.catchSomeCause(cause => isInterruptedOnly(cause) ? Effect.some(Effect._void) : Effect.none())), {
|
|
2721
2722
|
discard: true
|
|
2722
|
-
}), Effect.zipRight$
|
|
2723
|
+
}), Effect.zipRight$1(offer(outerQueue, end$1))))
|
|
2723
2724
|
});
|
|
2724
2725
|
return make(unwrapScopedWith(scope => Effect.gen(function* () {
|
|
2725
2726
|
const map = new Map();
|