effect 3.11.0 → 3.11.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/DateTime.js +4 -4
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Micro.js +100 -85
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/Stream.js +33 -10
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/internal/pool.js +4 -2
- package/dist/cjs/internal/pool.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/DateTime.d.ts +9 -0
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +148 -120
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +131 -42
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/esm/DateTime.js +4 -4
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Micro.js +100 -85
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Stream.js +33 -10
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/internal/pool.js +4 -2
- package/dist/esm/internal/pool.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/DateTime.ts +4 -5
- package/src/Micro.ts +201 -172
- package/src/Stream.ts +131 -42
- package/src/internal/pool.ts +4 -1
- package/src/internal/version.ts +1 -1
package/dist/cjs/DateTime.js
CHANGED
|
@@ -605,10 +605,10 @@ const setPartsUtc = exports.setPartsUtc = Internal.setPartsUtc;
|
|
|
605
605
|
// =============================================================================
|
|
606
606
|
// current time zone
|
|
607
607
|
// =============================================================================
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
608
|
+
/**
|
|
609
|
+
* @since 3.11.0
|
|
610
|
+
* @category current time zone
|
|
611
|
+
*/
|
|
612
612
|
class CurrentTimeZone extends /*#__PURE__*/Context.Tag("effect/DateTime/CurrentTimeZone")() {}
|
|
613
613
|
/**
|
|
614
614
|
* Set the time zone of a `DateTime` to the current time zone, which is
|
package/dist/cjs/DateTime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","names":["Context","_interopRequireWildcard","require","Effect","_Function","Internal","Layer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TypeId","exports","TimeZoneTypeId","isDateTime","isTimeZone","isTimeZoneOffset","isTimeZoneNamed","isUtc","isZoned","Equivalence","Order","clamp","unsafeFromDate","unsafeMake","unsafeMakeZoned","makeZoned","make","makeZonedFromString","now","unsafeNow","setZone","setZoneOffset","zoneUnsafeMakeNamed","zoneMakeOffset","zoneMakeNamed","zoneMakeNamedEffect","zoneMakeLocal","zoneFromString","zoneToString","setZoneNamed","unsafeSetZoneNamed","distance","distanceDurationEither","distanceDuration","min","max","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","between","isFuture","unsafeIsFuture","isPast","unsafeIsPast","toDateUtc","toDate","zonedOffset","zonedOffsetIso","toEpochMillis","removeTime","toParts","toPartsUtc","getPartUtc","getPart","setParts","setPartsUtc","CurrentTimeZone","Tag","setZoneCurrent","self","map","zone","withCurrentZone","dual","effect","provideService","withCurrentZoneLocal","provideServiceEffect","sync","withCurrentZoneOffset","offset","withCurrentZoneNamed","nowInCurrentZone","flatMap","mutate","mutateUtc","mapEpochMillis","withDate","withDateUtc","match","addDuration","subtractDuration","add","subtract","startOf","endOf","nearest","format","formatLocal","formatUtc","formatIntl","formatIso","formatIsoDate","formatIsoDateUtc","formatIsoOffset","formatIsoZoned","layerCurrentZone","succeed","layerCurrentZoneOffset","layerCurrentZoneNamed","zoneId","layerCurrentZoneLocal"],"sources":["../../src/DateTime.ts"],"sourcesContent":[null],"mappings":";;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MA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Time.js","names":["Context","_interopRequireWildcard","require","Effect","_Function","Internal","Layer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TypeId","exports","TimeZoneTypeId","isDateTime","isTimeZone","isTimeZoneOffset","isTimeZoneNamed","isUtc","isZoned","Equivalence","Order","clamp","unsafeFromDate","unsafeMake","unsafeMakeZoned","makeZoned","make","makeZonedFromString","now","unsafeNow","setZone","setZoneOffset","zoneUnsafeMakeNamed","zoneMakeOffset","zoneMakeNamed","zoneMakeNamedEffect","zoneMakeLocal","zoneFromString","zoneToString","setZoneNamed","unsafeSetZoneNamed","distance","distanceDurationEither","distanceDuration","min","max","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","between","isFuture","unsafeIsFuture","isPast","unsafeIsPast","toDateUtc","toDate","zonedOffset","zonedOffsetIso","toEpochMillis","removeTime","toParts","toPartsUtc","getPartUtc","getPart","setParts","setPartsUtc","CurrentTimeZone","Tag","setZoneCurrent","self","map","zone","withCurrentZone","dual","effect","provideService","withCurrentZoneLocal","provideServiceEffect","sync","withCurrentZoneOffset","offset","withCurrentZoneNamed","nowInCurrentZone","flatMap","mutate","mutateUtc","mapEpochMillis","withDate","withDateUtc","match","addDuration","subtractDuration","add","subtract","startOf","endOf","nearest","format","formatLocal","formatUtc","formatIntl","formatIso","formatIsoDate","formatIsoDateUtc","formatIsoOffset","formatIsoZoned","layerCurrentZone","succeed","layerCurrentZoneOffset","layerCurrentZoneNamed","zoneId","layerCurrentZoneLocal"],"sources":["../../src/DateTime.ts"],"sourcesContent":[null],"mappings":";;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAGA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAA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NowWith = exports.yieldNow = exports.yieldFlush = exports.withTrace = exports.
|
|
6
|
+
exports.onExit = exports.onError = exports.never = exports.matchEffect = exports.matchCauseEffect = exports.matchCause = exports.match = exports.mapErrorCause = exports.mapError = exports.map = exports.let = exports.isMicroExit = exports.isMicroCause = exports.isMicro = exports.interruptible = exports.interrupt = exports.ignoreLogged = exports.ignore = exports.gen = exports.fromOption = exports.fromEither = exports.forkScoped = exports.forkIn = exports.forkDaemon = exports.fork = exports.forever = exports.forEach = exports.flip = exports.flatten = exports.flatMap = exports.filterOrFailCause = exports.filterOrFail = exports.filterMap = exports.filter = exports.fiberJoin = exports.fiberInterruptAll = exports.fiberInterrupt = exports.fiberAwait = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.exitVoidAll = exports.exitVoid = exports.exitSucceed = exports.exitIsSuccess = exports.exitIsInterrupt = exports.exitIsFailure = exports.exitIsFail = exports.exitIsDie = exports.exitInterrupt = exports.exitFailCause = exports.exitFail = exports.exitDie = exports.exit = exports.ensuring = exports.either = exports.die = exports.delay = exports.context = exports.causeWithTrace = exports.causeSquash = exports.causeIsInterrupt = exports.causeIsFail = exports.causeIsDie = exports.causeInterrupt = exports.causeFail = exports.causeDie = exports.catchTag = exports.catchIf = exports.catchCauseIf = exports.catchAllDefect = exports.catchAllCause = exports.catchAll = exports.bindTo = exports.bind = exports.async = exports.asVoid = exports.asSome = exports.as = exports.andThen = exports.all = exports.addFinalizer = exports.acquireUseRelease = exports.acquireRelease = exports.TypeId = exports.TimeoutException = exports.TaggedError = exports.NoSuchElementException = exports.MicroScopeTypeId = exports.MicroScope = exports.MicroSchedulerDefault = exports.MicroFiberTypeId = exports.MicroExitTypeId = exports.MicroCauseTypeId = exports.MaxOpsBeforeYield = exports.Error = exports.Do = exports.CurrentScheduler = exports.CurrentConcurrency = void 0;
|
|
7
|
+
exports.zipWith = exports.zip = exports.yieldNowWith = exports.yieldNow = exports.yieldFlush = exports.withTrace = exports.withMicroFiber = exports.withConcurrency = exports.whileLoop = exports.when = exports.void = exports.updateService = exports.updateContext = exports.uninterruptibleMask = exports.uninterruptible = exports.tryPromise = exports.try = exports.timeoutOrElse = exports.timeoutOption = exports.timeout = exports.tapErrorCauseIf = exports.tapErrorCause = exports.tapError = exports.tapDefect = exports.tap = exports.sync = exports.suspend = exports.succeedSome = exports.succeedNone = exports.succeed = exports.sleep = exports.serviceOption = exports.service = exports.scoped = exports.scopeUnsafeMake = exports.scopeMake = exports.scope = exports.scheduleWithMaxElapsed = exports.scheduleWithMaxDelay = exports.scheduleUnion = exports.scheduleSpaced = exports.scheduleRecurs = exports.scheduleIntersect = exports.scheduleExponential = exports.scheduleAddDelay = exports.sandbox = exports.runSyncExit = exports.runSync = exports.runPromiseExit = exports.runPromise = exports.runFork = exports.retry = exports.replicateEffect = exports.replicate = exports.repeatExit = exports.repeat = exports.raceFirst = exports.raceAllFirst = exports.raceAll = exports.race = exports.provideServiceEffect = exports.provideService = exports.provideScope = exports.provideContext = exports.promise = exports.orElseSucceed = exports.orDie = exports.option = exports.onInterrupt = exports.onExitIf = void 0;
|
|
8
8
|
var Arr = _interopRequireWildcard(require("effect/Array"));
|
|
9
9
|
var Context = _interopRequireWildcard(require("./Context.js"));
|
|
10
10
|
var Effectable = _interopRequireWildcard(require("./Effectable.js"));
|
|
@@ -107,7 +107,7 @@ class MicroCauseImpl extends globalThis.Error {
|
|
|
107
107
|
return this.stack;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
class
|
|
110
|
+
class Fail extends MicroCauseImpl {
|
|
111
111
|
error;
|
|
112
112
|
constructor(error, traces = []) {
|
|
113
113
|
super("Fail", error, traces);
|
|
@@ -119,9 +119,9 @@ class FailImpl extends MicroCauseImpl {
|
|
|
119
119
|
* @experimental
|
|
120
120
|
* @category MicroCause
|
|
121
121
|
*/
|
|
122
|
-
const causeFail = (error, traces = []) => new
|
|
122
|
+
const causeFail = (error, traces = []) => new Fail(error, traces);
|
|
123
123
|
exports.causeFail = causeFail;
|
|
124
|
-
class
|
|
124
|
+
class Die extends MicroCauseImpl {
|
|
125
125
|
defect;
|
|
126
126
|
constructor(defect, traces = []) {
|
|
127
127
|
super("Die", defect, traces);
|
|
@@ -133,9 +133,9 @@ class DieImpl extends MicroCauseImpl {
|
|
|
133
133
|
* @experimental
|
|
134
134
|
* @category MicroCause
|
|
135
135
|
*/
|
|
136
|
-
const causeDie = (defect, traces = []) => new
|
|
136
|
+
const causeDie = (defect, traces = []) => new Die(defect, traces);
|
|
137
137
|
exports.causeDie = causeDie;
|
|
138
|
-
class
|
|
138
|
+
class Interrupt extends MicroCauseImpl {
|
|
139
139
|
constructor(traces = []) {
|
|
140
140
|
super("Interrupt", "interrupted", traces);
|
|
141
141
|
}
|
|
@@ -145,7 +145,7 @@ class InterruptImpl extends MicroCauseImpl {
|
|
|
145
145
|
* @experimental
|
|
146
146
|
* @category MicroCause
|
|
147
147
|
*/
|
|
148
|
-
const causeInterrupt = (traces = []) => new
|
|
148
|
+
const causeInterrupt = (traces = []) => new Interrupt(traces);
|
|
149
149
|
/**
|
|
150
150
|
* @since 3.4.6
|
|
151
151
|
* @experimental
|
|
@@ -192,22 +192,22 @@ const causeWithTrace = exports.causeWithTrace = /*#__PURE__*/(0, _Function.dual)
|
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
// ----------------------------------------------------------------------------
|
|
195
|
-
//
|
|
195
|
+
// MicroFiber
|
|
196
196
|
// ----------------------------------------------------------------------------
|
|
197
197
|
/**
|
|
198
198
|
* @since 3.11.0
|
|
199
199
|
* @experimental
|
|
200
|
-
* @category
|
|
200
|
+
* @category MicroFiber
|
|
201
201
|
*/
|
|
202
|
-
const
|
|
202
|
+
const MicroFiberTypeId = exports.MicroFiberTypeId = /*#__PURE__*/Symbol.for("effect/Micro/MicroFiber");
|
|
203
203
|
const fiberVariance = {
|
|
204
204
|
_A: _Function.identity,
|
|
205
205
|
_E: _Function.identity
|
|
206
206
|
};
|
|
207
|
-
class
|
|
207
|
+
class MicroFiberImpl {
|
|
208
208
|
context;
|
|
209
209
|
interruptible;
|
|
210
|
-
[
|
|
210
|
+
[MicroFiberTypeId];
|
|
211
211
|
_stack = [];
|
|
212
212
|
_observers = [];
|
|
213
213
|
_exit;
|
|
@@ -216,7 +216,7 @@ class FiberImpl {
|
|
|
216
216
|
constructor(context, interruptible = true) {
|
|
217
217
|
this.context = context;
|
|
218
218
|
this.interruptible = interruptible;
|
|
219
|
-
this[
|
|
219
|
+
this[MicroFiberTypeId] = fiberVariance;
|
|
220
220
|
}
|
|
221
221
|
getRef(ref) {
|
|
222
222
|
return InternalContext.unsafeGetReference(this.context, ref);
|
|
@@ -295,7 +295,7 @@ class FiberImpl {
|
|
|
295
295
|
}
|
|
296
296
|
} catch (error) {
|
|
297
297
|
if (!(0, _Predicate.hasProperty)(current, evaluate)) {
|
|
298
|
-
return exitDie(`
|
|
298
|
+
return exitDie(`MicroFiber.runLoop: Not a valid effect: ${String(current)}`);
|
|
299
299
|
}
|
|
300
300
|
return exitDie(error);
|
|
301
301
|
}
|
|
@@ -333,15 +333,22 @@ const fiberInterruptChildren = fiber => {
|
|
|
333
333
|
/**
|
|
334
334
|
* @since 3.11.0
|
|
335
335
|
* @experimental
|
|
336
|
-
* @category
|
|
336
|
+
* @category MicroFiber
|
|
337
337
|
*/
|
|
338
338
|
const fiberAwait = self => async(resume => sync(self.addObserver(exit => resume(succeed(exit)))));
|
|
339
339
|
/**
|
|
340
|
-
* @since 3.11.
|
|
340
|
+
* @since 3.11.2
|
|
341
341
|
* @experimental
|
|
342
|
-
* @category
|
|
342
|
+
* @category MicroFiber
|
|
343
343
|
*/
|
|
344
344
|
exports.fiberAwait = fiberAwait;
|
|
345
|
+
const fiberJoin = self => flatten(fiberAwait(self));
|
|
346
|
+
/**
|
|
347
|
+
* @since 3.11.0
|
|
348
|
+
* @experimental
|
|
349
|
+
* @category MicroFiber
|
|
350
|
+
*/
|
|
351
|
+
exports.fiberJoin = fiberJoin;
|
|
345
352
|
const fiberInterrupt = self => suspend(() => {
|
|
346
353
|
self.unsafeInterrupt();
|
|
347
354
|
return asVoid(fiberAwait(self));
|
|
@@ -349,7 +356,7 @@ const fiberInterrupt = self => suspend(() => {
|
|
|
349
356
|
/**
|
|
350
357
|
* @since 3.11.0
|
|
351
358
|
* @experimental
|
|
352
|
-
* @category
|
|
359
|
+
* @category MicroFiber
|
|
353
360
|
*/
|
|
354
361
|
exports.fiberInterrupt = fiberInterrupt;
|
|
355
362
|
const fiberInterruptAll = fibers => suspend(() => {
|
|
@@ -398,7 +405,7 @@ const MicroProto = {
|
|
|
398
405
|
},
|
|
399
406
|
toJSON() {
|
|
400
407
|
return {
|
|
401
|
-
_id: "
|
|
408
|
+
_id: "Micro",
|
|
402
409
|
op: this[identifier],
|
|
403
410
|
...(args in this ? {
|
|
404
411
|
args: this[args]
|
|
@@ -441,7 +448,7 @@ const makeExit = options => {
|
|
|
441
448
|
},
|
|
442
449
|
toJSON() {
|
|
443
450
|
return {
|
|
444
|
-
_id: "
|
|
451
|
+
_id: "MicroExit",
|
|
445
452
|
_tag: options.op,
|
|
446
453
|
[options.prop]: this[args]
|
|
447
454
|
};
|
|
@@ -496,10 +503,10 @@ const failCause = exports.failCause = /*#__PURE__*/makeExit({
|
|
|
496
503
|
}
|
|
497
504
|
});
|
|
498
505
|
/**
|
|
499
|
-
* Creates a `Micro` effect that
|
|
506
|
+
* Creates a `Micro` effect that fails with the given error.
|
|
500
507
|
*
|
|
501
|
-
* This
|
|
502
|
-
* type level.
|
|
508
|
+
* This results in a `Fail` variant of the `MicroCause` type, where the error is
|
|
509
|
+
* tracked at the type level.
|
|
503
510
|
*
|
|
504
511
|
* @since 3.4.0
|
|
505
512
|
* @experimental
|
|
@@ -507,10 +514,10 @@ const failCause = exports.failCause = /*#__PURE__*/makeExit({
|
|
|
507
514
|
*/
|
|
508
515
|
const fail = error => failCause(causeFail(error));
|
|
509
516
|
/**
|
|
510
|
-
* Creates a `Micro` effect that
|
|
517
|
+
* Creates a `Micro` effect that succeeds with a lazily evaluated value.
|
|
511
518
|
*
|
|
512
|
-
* If the evaluation of the value throws an error, the effect will fail with
|
|
513
|
-
* `
|
|
519
|
+
* If the evaluation of the value throws an error, the effect will fail with a
|
|
520
|
+
* `Die` variant of the `MicroCause` type.
|
|
514
521
|
*
|
|
515
522
|
* @since 3.4.0
|
|
516
523
|
* @experimental
|
|
@@ -569,7 +576,7 @@ const yieldNowWith = exports.yieldNowWith = /*#__PURE__*/makePrimitive({
|
|
|
569
576
|
*/
|
|
570
577
|
const yieldNow = exports.yieldNow = /*#__PURE__*/yieldNowWith(0);
|
|
571
578
|
/**
|
|
572
|
-
* Creates a `Micro` effect that will succeed with
|
|
579
|
+
* Creates a `Micro` effect that will succeed with the value wrapped in `Some`.
|
|
573
580
|
*
|
|
574
581
|
* @since 3.4.0
|
|
575
582
|
* @experimental
|
|
@@ -577,7 +584,7 @@ const yieldNow = exports.yieldNow = /*#__PURE__*/yieldNowWith(0);
|
|
|
577
584
|
*/
|
|
578
585
|
const succeedSome = a => succeed(Option.some(a));
|
|
579
586
|
/**
|
|
580
|
-
* Creates a `Micro` effect that
|
|
587
|
+
* Creates a `Micro` effect that succeeds with `None`.
|
|
581
588
|
*
|
|
582
589
|
* @since 3.4.0
|
|
583
590
|
* @experimental
|
|
@@ -596,8 +603,8 @@ const failCauseSync = evaluate => suspend(() => failCause(evaluate()));
|
|
|
596
603
|
/**
|
|
597
604
|
* Creates a `Micro` effect that will die with the specified error.
|
|
598
605
|
*
|
|
599
|
-
* This
|
|
600
|
-
* the type level.
|
|
606
|
+
* This results in a `Die` variant of the `MicroCause` type, where the error is
|
|
607
|
+
* not tracked at the type level.
|
|
601
608
|
*
|
|
602
609
|
* @since 3.4.0
|
|
603
610
|
* @experimental
|
|
@@ -608,8 +615,8 @@ const die = defect => exitDie(defect);
|
|
|
608
615
|
/**
|
|
609
616
|
* Creates a `Micro` effect that will fail with the lazily evaluated error.
|
|
610
617
|
*
|
|
611
|
-
* This
|
|
612
|
-
* type level.
|
|
618
|
+
* This results in a `Fail` variant of the `MicroCause` type, where the error is
|
|
619
|
+
* tracked at the type level.
|
|
613
620
|
*
|
|
614
621
|
* @since 3.4.6
|
|
615
622
|
* @experimental
|
|
@@ -650,8 +657,10 @@ const try_ = options => suspend(() => {
|
|
|
650
657
|
});
|
|
651
658
|
exports.try = try_;
|
|
652
659
|
/**
|
|
653
|
-
* Wrap a `Promise` into a `Micro` effect.
|
|
654
|
-
*
|
|
660
|
+
* Wrap a `Promise` into a `Micro` effect.
|
|
661
|
+
*
|
|
662
|
+
* Any errors will result in a `Die` variant of the `MicroCause` type, where the
|
|
663
|
+
* error is not tracked at the type level.
|
|
655
664
|
*
|
|
656
665
|
* @since 3.4.0
|
|
657
666
|
* @experimental
|
|
@@ -664,9 +673,6 @@ const promise = evaluate => asyncOptions(function (resume, signal) {
|
|
|
664
673
|
* Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
|
|
665
674
|
* converted into a specific error type.
|
|
666
675
|
*
|
|
667
|
-
* @since 3.4.0
|
|
668
|
-
* @experimental
|
|
669
|
-
* @category constructors
|
|
670
676
|
* @example
|
|
671
677
|
* ```ts
|
|
672
678
|
* import { Micro } from "effect"
|
|
@@ -676,6 +682,10 @@ const promise = evaluate => asyncOptions(function (resume, signal) {
|
|
|
676
682
|
* catch: (cause) => new Error("caught", { cause })
|
|
677
683
|
* })
|
|
678
684
|
* ```
|
|
685
|
+
*
|
|
686
|
+
* @since 3.4.0
|
|
687
|
+
* @experimental
|
|
688
|
+
* @category constructors
|
|
679
689
|
*/
|
|
680
690
|
exports.promise = promise;
|
|
681
691
|
const tryPromise = options => asyncOptions(function (resume, signal) {
|
|
@@ -686,15 +696,15 @@ const tryPromise = options => asyncOptions(function (resume, signal) {
|
|
|
686
696
|
}
|
|
687
697
|
}, options.try.length !== 0);
|
|
688
698
|
/**
|
|
689
|
-
* Create a `Micro` effect using the current `
|
|
699
|
+
* Create a `Micro` effect using the current `MicroFiber`.
|
|
690
700
|
*
|
|
691
701
|
* @since 3.4.0
|
|
692
702
|
* @experimental
|
|
693
703
|
* @category constructors
|
|
694
704
|
*/
|
|
695
705
|
exports.tryPromise = tryPromise;
|
|
696
|
-
const
|
|
697
|
-
op: "
|
|
706
|
+
const withMicroFiber = exports.withMicroFiber = /*#__PURE__*/makePrimitive({
|
|
707
|
+
op: "WithMicroFiber",
|
|
698
708
|
eval(fiber) {
|
|
699
709
|
return this[args](fiber);
|
|
700
710
|
}
|
|
@@ -706,7 +716,7 @@ const withFiber = exports.withFiber = /*#__PURE__*/makePrimitive({
|
|
|
706
716
|
* @experimental
|
|
707
717
|
* @category constructors
|
|
708
718
|
*/
|
|
709
|
-
const yieldFlush = exports.yieldFlush = /*#__PURE__*/
|
|
719
|
+
const yieldFlush = exports.yieldFlush = /*#__PURE__*/withMicroFiber(fiber => {
|
|
710
720
|
fiber.getRef(CurrentScheduler).flush();
|
|
711
721
|
return exitVoid;
|
|
712
722
|
});
|
|
@@ -812,7 +822,7 @@ const fromIterator = /*#__PURE__*/makePrimitive({
|
|
|
812
822
|
*/
|
|
813
823
|
const as = exports.as = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => map(self, _ => value));
|
|
814
824
|
/**
|
|
815
|
-
* Wrap the success value of this `Micro` effect in
|
|
825
|
+
* Wrap the success value of this `Micro` effect in a `Some`.
|
|
816
826
|
*
|
|
817
827
|
* @since 3.4.0
|
|
818
828
|
* @experimental
|
|
@@ -832,11 +842,11 @@ const flip = self => matchEffect(self, {
|
|
|
832
842
|
onSuccess: fail
|
|
833
843
|
});
|
|
834
844
|
/**
|
|
835
|
-
* A more flexible version of `flatMap
|
|
836
|
-
*
|
|
845
|
+
* A more flexible version of `flatMap` that combines `map` and `flatMap` into a
|
|
846
|
+
* single API.
|
|
837
847
|
*
|
|
838
|
-
* It also
|
|
839
|
-
*
|
|
848
|
+
* It also lets you directly pass a `Micro` effect, which will be executed after
|
|
849
|
+
* the current effect.
|
|
840
850
|
*
|
|
841
851
|
* @since 3.4.0
|
|
842
852
|
* @experimental
|
|
@@ -899,7 +909,7 @@ const sandbox = self => catchAllCause(self, fail);
|
|
|
899
909
|
* @category sequencing
|
|
900
910
|
*/
|
|
901
911
|
exports.sandbox = sandbox;
|
|
902
|
-
const raceAll = all =>
|
|
912
|
+
const raceAll = all => withMicroFiber(parent => async(resume => {
|
|
903
913
|
const effects = Arr.fromIterable(all);
|
|
904
914
|
const len = effects.length;
|
|
905
915
|
let doneCount = 0;
|
|
@@ -932,14 +942,14 @@ const raceAll = all => withFiber(parent => async(resume => {
|
|
|
932
942
|
/**
|
|
933
943
|
* Returns an effect that races all the specified effects,
|
|
934
944
|
* yielding the value of the first effect to succeed or fail. Losers of
|
|
935
|
-
* the race will be interrupted immediately
|
|
945
|
+
* the race will be interrupted immediately.
|
|
936
946
|
*
|
|
937
947
|
* @since 3.4.0
|
|
938
948
|
* @experimental
|
|
939
949
|
* @category sequencing
|
|
940
950
|
*/
|
|
941
951
|
exports.raceAll = raceAll;
|
|
942
|
-
const raceAllFirst = all =>
|
|
952
|
+
const raceAllFirst = all => withMicroFiber(parent => async(resume => {
|
|
943
953
|
let done = false;
|
|
944
954
|
const fibers = new Set();
|
|
945
955
|
const onExit = exit => {
|
|
@@ -959,7 +969,7 @@ const raceAllFirst = all => withFiber(parent => async(resume => {
|
|
|
959
969
|
}));
|
|
960
970
|
/**
|
|
961
971
|
* Returns an effect that races two effects, yielding the value of the first
|
|
962
|
-
* effect to succeed. Losers of the race will be interrupted immediately
|
|
972
|
+
* effect to succeed. Losers of the race will be interrupted immediately.
|
|
963
973
|
*
|
|
964
974
|
* @since 3.4.0
|
|
965
975
|
* @experimental
|
|
@@ -969,7 +979,7 @@ exports.raceAllFirst = raceAllFirst;
|
|
|
969
979
|
const race = exports.race = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => raceAll([self, that]));
|
|
970
980
|
/**
|
|
971
981
|
* Returns an effect that races two effects, yielding the value of the first
|
|
972
|
-
* effect to succeed *or* fail. Losers of the race will be interrupted immediately
|
|
982
|
+
* effect to succeed *or* fail. Losers of the race will be interrupted immediately.
|
|
973
983
|
*
|
|
974
984
|
* @since 3.4.0
|
|
975
985
|
* @experimental
|
|
@@ -1171,7 +1181,7 @@ class MicroSchedulerDefault {
|
|
|
1171
1181
|
* @category environment
|
|
1172
1182
|
*/
|
|
1173
1183
|
exports.MicroSchedulerDefault = MicroSchedulerDefault;
|
|
1174
|
-
const service = tag =>
|
|
1184
|
+
const service = tag => withMicroFiber(fiber => succeed(Context.unsafeGet(fiber.context, tag)));
|
|
1175
1185
|
/**
|
|
1176
1186
|
* Access the given `Context.Tag` from the environment, without tracking the
|
|
1177
1187
|
* dependency at the type level.
|
|
@@ -1184,7 +1194,7 @@ const service = tag => withFiber(fiber => succeed(Context.unsafeGet(fiber.contex
|
|
|
1184
1194
|
* @category environment
|
|
1185
1195
|
*/
|
|
1186
1196
|
exports.service = service;
|
|
1187
|
-
const serviceOption = tag =>
|
|
1197
|
+
const serviceOption = tag => withMicroFiber(fiber => succeed(Context.getOption(fiber.context, tag)));
|
|
1188
1198
|
/**
|
|
1189
1199
|
* Update the Context with the given mapping function.
|
|
1190
1200
|
*
|
|
@@ -1193,7 +1203,7 @@ const serviceOption = tag => withFiber(fiber => succeed(Context.getOption(fiber.
|
|
|
1193
1203
|
* @category environment
|
|
1194
1204
|
*/
|
|
1195
1205
|
exports.serviceOption = serviceOption;
|
|
1196
|
-
const updateContext = exports.updateContext = /*#__PURE__*/(0, _Function.dual)(2, (self, f) =>
|
|
1206
|
+
const updateContext = exports.updateContext = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => withMicroFiber(fiber => {
|
|
1197
1207
|
const prev = fiber.context;
|
|
1198
1208
|
fiber.context = f(prev);
|
|
1199
1209
|
return onExit(self, () => {
|
|
@@ -1208,7 +1218,7 @@ const updateContext = exports.updateContext = /*#__PURE__*/(0, _Function.dual)(2
|
|
|
1208
1218
|
* @experimental
|
|
1209
1219
|
* @category environment
|
|
1210
1220
|
*/
|
|
1211
|
-
const updateService = exports.updateService = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) =>
|
|
1221
|
+
const updateService = exports.updateService = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) => withMicroFiber(fiber => {
|
|
1212
1222
|
const prev = Context.unsafeGet(fiber.context, tag);
|
|
1213
1223
|
fiber.context = Context.add(fiber.context, tag, f(prev));
|
|
1214
1224
|
return onExit(self, () => {
|
|
@@ -1225,7 +1235,7 @@ const updateService = exports.updateService = /*#__PURE__*/(0, _Function.dual)(3
|
|
|
1225
1235
|
*/
|
|
1226
1236
|
const context = () => getContext;
|
|
1227
1237
|
exports.context = context;
|
|
1228
|
-
const getContext = /*#__PURE__*/
|
|
1238
|
+
const getContext = /*#__PURE__*/withMicroFiber(fiber => succeed(fiber.context));
|
|
1229
1239
|
/**
|
|
1230
1240
|
* Merge the given `Context` with the current context.
|
|
1231
1241
|
*
|
|
@@ -1284,10 +1294,8 @@ class CurrentScheduler extends /*#__PURE__*/Context.Reference()("effect/Micro/cu
|
|
|
1284
1294
|
* If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
|
|
1285
1295
|
* api to control the concurrency of that `Micro` when it is run.
|
|
1286
1296
|
*
|
|
1287
|
-
* @since 3.4.0
|
|
1288
|
-
* @experimental
|
|
1289
|
-
* @category environment refs
|
|
1290
1297
|
* @example
|
|
1298
|
+
* ```ts
|
|
1291
1299
|
* import * as Micro from "effect/Micro"
|
|
1292
1300
|
*
|
|
1293
1301
|
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
@@ -1295,6 +1303,11 @@ class CurrentScheduler extends /*#__PURE__*/Context.Reference()("effect/Micro/cu
|
|
|
1295
1303
|
* }).pipe(
|
|
1296
1304
|
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
1297
1305
|
* )
|
|
1306
|
+
* ```
|
|
1307
|
+
*
|
|
1308
|
+
* @since 3.4.0
|
|
1309
|
+
* @experimental
|
|
1310
|
+
* @category environment refs
|
|
1298
1311
|
*/
|
|
1299
1312
|
exports.CurrentScheduler = CurrentScheduler;
|
|
1300
1313
|
const withConcurrency = exports.withConcurrency = /*#__PURE__*/(0, _Function.dual)(2, (self, concurrency) => provideService(self, CurrentConcurrency, concurrency));
|
|
@@ -1543,7 +1556,7 @@ const catchCauseIf = exports.catchCauseIf = /*#__PURE__*/(0, _Function.dual)(3,
|
|
|
1543
1556
|
/**
|
|
1544
1557
|
* Catch the error of the given `Micro` effect, allowing you to recover from it.
|
|
1545
1558
|
*
|
|
1546
|
-
* It only catches expected
|
|
1559
|
+
* It only catches expected errors.
|
|
1547
1560
|
*
|
|
1548
1561
|
* @since 3.4.6
|
|
1549
1562
|
* @experimental
|
|
@@ -2060,7 +2073,7 @@ const interrupt = exports.interrupt = /*#__PURE__*/failCause( /*#__PURE__*/cause
|
|
|
2060
2073
|
* @experimental
|
|
2061
2074
|
* @category flags
|
|
2062
2075
|
*/
|
|
2063
|
-
const uninterruptible = self =>
|
|
2076
|
+
const uninterruptible = self => withMicroFiber(fiber => {
|
|
2064
2077
|
if (!fiber.interruptible) return self;
|
|
2065
2078
|
fiber.interruptible = false;
|
|
2066
2079
|
fiber._stack.push(setInterruptible(true));
|
|
@@ -2084,7 +2097,7 @@ const setInterruptible = /*#__PURE__*/makePrimitive({
|
|
|
2084
2097
|
* @experimental
|
|
2085
2098
|
* @category flags
|
|
2086
2099
|
*/
|
|
2087
|
-
const interruptible = self =>
|
|
2100
|
+
const interruptible = self => withMicroFiber(fiber => {
|
|
2088
2101
|
if (fiber.interruptible) return self;
|
|
2089
2102
|
fiber.interruptible = true;
|
|
2090
2103
|
fiber._stack.push(setInterruptible(false));
|
|
@@ -2098,9 +2111,6 @@ const interruptible = self => withFiber(fiber => {
|
|
|
2098
2111
|
* You can use the `restore` function to restore a `Micro` effect to the
|
|
2099
2112
|
* interruptibility state before the `uninterruptibleMask` was applied.
|
|
2100
2113
|
*
|
|
2101
|
-
* @since 3.4.0
|
|
2102
|
-
* @experimental
|
|
2103
|
-
* @category interruption
|
|
2104
2114
|
* @example
|
|
2105
2115
|
* ```ts
|
|
2106
2116
|
* import * as Micro from "effect/Micro"
|
|
@@ -2111,9 +2121,13 @@ const interruptible = self => withFiber(fiber => {
|
|
|
2111
2121
|
* )
|
|
2112
2122
|
* )
|
|
2113
2123
|
* ```
|
|
2124
|
+
*
|
|
2125
|
+
* @since 3.4.0
|
|
2126
|
+
* @experimental
|
|
2127
|
+
* @category interruption
|
|
2114
2128
|
*/
|
|
2115
2129
|
exports.interruptible = interruptible;
|
|
2116
|
-
const uninterruptibleMask = f =>
|
|
2130
|
+
const uninterruptibleMask = f => withMicroFiber(fiber => {
|
|
2117
2131
|
if (!fiber.interruptible) return f(_Function.identity);
|
|
2118
2132
|
fiber.interruptible = false;
|
|
2119
2133
|
fiber._stack.push(setInterruptible(true));
|
|
@@ -2182,7 +2196,7 @@ const whileLoop = exports.whileLoop = /*#__PURE__*/makePrimitive({
|
|
|
2182
2196
|
* @experimental
|
|
2183
2197
|
* @category collecting & elements
|
|
2184
2198
|
*/
|
|
2185
|
-
const forEach = (iterable, f, options) =>
|
|
2199
|
+
const forEach = (iterable, f, options) => withMicroFiber(parent => {
|
|
2186
2200
|
const concurrencyOption = options?.concurrency === "inherit" ? parent.getRef(CurrentConcurrency) : options?.concurrency ?? 1;
|
|
2187
2201
|
const concurrency = concurrencyOption === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrencyOption);
|
|
2188
2202
|
const items = Arr.fromIterable(iterable);
|
|
@@ -2321,22 +2335,22 @@ const let_ = exports.let = /*#__PURE__*/doNotation.let_(map);
|
|
|
2321
2335
|
// fibers & forking
|
|
2322
2336
|
// ----------------------------------------------------------------------------
|
|
2323
2337
|
/**
|
|
2324
|
-
* Run the `Micro` effect in a new `
|
|
2338
|
+
* Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
|
|
2325
2339
|
* aborted.
|
|
2326
2340
|
*
|
|
2327
2341
|
* When the parent `Micro` finishes, this `Micro` will be aborted.
|
|
2328
2342
|
*
|
|
2329
2343
|
* @since 3.4.0
|
|
2330
2344
|
* @experimental
|
|
2331
|
-
* @category
|
|
2345
|
+
* @category fiber & forking
|
|
2332
2346
|
*/
|
|
2333
|
-
const fork = self =>
|
|
2347
|
+
const fork = self => withMicroFiber(fiber => {
|
|
2334
2348
|
fiberMiddleware.interruptChildren ??= fiberInterruptChildren;
|
|
2335
2349
|
return succeed(unsafeFork(fiber, self));
|
|
2336
2350
|
});
|
|
2337
2351
|
exports.fork = fork;
|
|
2338
2352
|
const unsafeFork = (parent, effect, immediate = false, daemon = false) => {
|
|
2339
|
-
const child = new
|
|
2353
|
+
const child = new MicroFiberImpl(parent.context, parent.interruptible);
|
|
2340
2354
|
if (!daemon) {
|
|
2341
2355
|
parent.children().add(child);
|
|
2342
2356
|
child.addObserver(() => parent.children().delete(child));
|
|
@@ -2349,52 +2363,49 @@ const unsafeFork = (parent, effect, immediate = false, daemon = false) => {
|
|
|
2349
2363
|
return child;
|
|
2350
2364
|
};
|
|
2351
2365
|
/**
|
|
2352
|
-
* Run the `Micro` effect in a new `
|
|
2366
|
+
* Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
|
|
2353
2367
|
* aborted.
|
|
2354
2368
|
*
|
|
2355
2369
|
* It will not be aborted when the parent `Micro` finishes.
|
|
2356
2370
|
*
|
|
2357
2371
|
* @since 3.4.0
|
|
2358
2372
|
* @experimental
|
|
2359
|
-
* @category
|
|
2373
|
+
* @category fiber & forking
|
|
2360
2374
|
*/
|
|
2361
|
-
const forkDaemon = self =>
|
|
2375
|
+
const forkDaemon = self => withMicroFiber(fiber => succeed(unsafeFork(fiber, self, false, true)));
|
|
2362
2376
|
/**
|
|
2363
|
-
* Run the `Micro` effect in a new `
|
|
2377
|
+
* Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
|
|
2364
2378
|
* aborted.
|
|
2365
2379
|
*
|
|
2366
2380
|
* The lifetime of the handle will be attached to the provided `MicroScope`.
|
|
2367
2381
|
*
|
|
2368
2382
|
* @since 3.4.0
|
|
2369
2383
|
* @experimental
|
|
2370
|
-
* @category
|
|
2384
|
+
* @category fiber & forking
|
|
2371
2385
|
*/
|
|
2372
2386
|
exports.forkDaemon = forkDaemon;
|
|
2373
2387
|
const forkIn = exports.forkIn = /*#__PURE__*/(0, _Function.dual)(2, (self, scope) => uninterruptibleMask(restore => flatMap(scope.fork, scope => tap(restore(forkDaemon(onExit(self, exit => scope.close(exit)))), fiber => scope.addFinalizer(_ => fiberInterrupt(fiber))))));
|
|
2374
2388
|
/**
|
|
2375
|
-
* Run the `Micro` effect in a new `
|
|
2389
|
+
* Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
|
|
2376
2390
|
* aborted.
|
|
2377
2391
|
*
|
|
2378
2392
|
* The lifetime of the handle will be attached to the current `MicroScope`.
|
|
2379
2393
|
*
|
|
2380
2394
|
* @since 3.4.0
|
|
2381
2395
|
* @experimental
|
|
2382
|
-
* @category
|
|
2396
|
+
* @category fiber & forking
|
|
2383
2397
|
*/
|
|
2384
2398
|
const forkScoped = self => flatMap(scope, scope => forkIn(self, scope));
|
|
2385
2399
|
// ----------------------------------------------------------------------------
|
|
2386
2400
|
// execution
|
|
2387
2401
|
// ----------------------------------------------------------------------------
|
|
2388
2402
|
/**
|
|
2389
|
-
* Execute the `Micro` effect and return a `
|
|
2403
|
+
* Execute the `Micro` effect and return a `MicroFiber` that can be awaited, joined,
|
|
2390
2404
|
* or aborted.
|
|
2391
2405
|
*
|
|
2392
2406
|
* You can listen for the result by adding an observer using the handle's
|
|
2393
2407
|
* `addObserver` method.
|
|
2394
2408
|
*
|
|
2395
|
-
* @since 3.4.0
|
|
2396
|
-
* @experimental
|
|
2397
|
-
* @category execution
|
|
2398
2409
|
* @example
|
|
2399
2410
|
* ```ts
|
|
2400
2411
|
* import * as Micro from "effect/Micro"
|
|
@@ -2408,10 +2419,14 @@ const forkScoped = self => flatMap(scope, scope => forkIn(self, scope));
|
|
|
2408
2419
|
* console.log(exit)
|
|
2409
2420
|
* })
|
|
2410
2421
|
* ```
|
|
2422
|
+
*
|
|
2423
|
+
* @since 3.4.0
|
|
2424
|
+
* @experimental
|
|
2425
|
+
* @category execution
|
|
2411
2426
|
*/
|
|
2412
2427
|
exports.forkScoped = forkScoped;
|
|
2413
2428
|
const runFork = (effect, options) => {
|
|
2414
|
-
const fiber = new
|
|
2429
|
+
const fiber = new MicroFiberImpl(CurrentScheduler.context(options?.scheduler ?? new MicroSchedulerDefault()));
|
|
2415
2430
|
fiber.evaluate(effect);
|
|
2416
2431
|
if (options?.signal) {
|
|
2417
2432
|
if (options.signal.aborted) {
|
|
@@ -2458,7 +2473,7 @@ const runPromise = (effect, options) => runPromiseExit(effect, options).then(exi
|
|
|
2458
2473
|
* Attempt to execute the `Micro` effect synchronously and return the `MicroExit`.
|
|
2459
2474
|
*
|
|
2460
2475
|
* If any asynchronous effects are encountered, the function will return a
|
|
2461
|
-
* `CauseDie` containing the `
|
|
2476
|
+
* `CauseDie` containing the `MicroFiber`.
|
|
2462
2477
|
*
|
|
2463
2478
|
* @since 3.4.6
|
|
2464
2479
|
* @experimental
|