@lmvz-ds/components 0.18.2 → 0.20.0
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/CHANGELOG.md +16 -0
- package/README.md +45 -100
- package/assets/icons/checkmark.svg +4 -0
- package/cjs/{aria-loader-CfFuAbJn.js → aria-loader-Cec1zR2g.js} +1 -1
- package/cjs/ds.constants-DSnxZ3ia.js +16 -0
- package/cjs/icons-BQASWgk-.js +80 -0
- package/cjs/{index--7IqZZqn.js → index-3g9Z9sfF.js} +765 -2854
- package/cjs/index.cjs.js +12 -12
- package/cjs/lmvz-button.cjs.entry.js +4 -4
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +113 -0
- package/cjs/lmvz-chip.cjs.entry.js +68 -4
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +3 -3
- package/cjs/lmvz-icon.cjs.entry.js +10 -8
- package/cjs/lmvz-input.cjs.entry.js +4 -4
- package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
- package/cjs/lmvz-select.cjs.entry.js +3 -3
- package/cjs/loader.cjs.js +1 -1
- package/cjs/{logger-Bn2yoZGP.js → logger-DsM6xg6V.js} +3063 -833
- package/cjs/{reactive-controller-host-CtaVAiYJ.js → reactive-controller-host-BA4ZhjKA.js} +10 -10
- package/cjs/svg-BMBduILB.js +125 -0
- package/collection/api/ds.constants.js +2 -0
- package/collection/assets/icons/checkmark.svg +4 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-button/lmvz-button.css +1 -2
- package/collection/components/lmvz-button/lmvz-button.js +6 -3
- package/collection/components/lmvz-card/lmvz-card.css +1 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +207 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +424 -0
- package/collection/components/lmvz-chip/lmvz-chip.css +84 -1
- package/collection/components/lmvz-chip/lmvz-chip.js +110 -13
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.css +11 -10
- package/collection/components/lmvz-icon/lmvz-icon.js +8 -7
- package/collection/components/lmvz-input/lmvz-input.js +4 -4
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +11 -5
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/index.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/utils/aria/aria-validation-controller.js +1 -0
- package/collection/utils/icons/icons.js +2 -13
- package/collection/utils/icons/icons.unit.js +3 -15
- package/collection/utils/reactive-controller-host.js +9 -9
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.d.ts +11 -0
- package/components/lmvz-checkbox.d.ts.bak +11 -0
- package/components/lmvz-checkbox.js +1 -0
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/p-0s99QfRy.js +12 -0
- package/components/{p-CBLAeife.js → p-BuFx0tTm.js} +1 -1
- package/components/p-CGmJG63p.js +1 -0
- package/components/p-CcxjkCOx.js +1 -0
- package/components/{p-DQEkWkMh.js → p-DIrAQ4IB.js} +1 -1
- package/esm/{aria-loader-BF_AYtbb.js → aria-loader-BVolm0lC.js} +1 -1
- package/esm/ds.constants-Bmi89ll1.js +9 -0
- package/esm/icons-CmuFKDRz.js +75 -0
- package/esm/{index-7Ru1khgk.js → index-Dh_9sN0q.js} +389 -2478
- package/esm/index.js +5 -11
- package/esm/lmvz-button.entry.js +4 -4
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +111 -0
- package/esm/lmvz-chip.entry.js +69 -5
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-icon.entry.js +10 -8
- package/esm/lmvz-input.entry.js +4 -4
- package/esm/lmvz-menuitem.entry.js +4 -4
- package/esm/lmvz-select.entry.js +3 -3
- package/esm/loader.js +1 -1
- package/esm/{logger-fiRXhuXK.js → logger-CGmJG63p.js} +2870 -765
- package/esm/{reactive-controller-host-sR2jJxNG.js → reactive-controller-host-DHcPpJW7.js} +10 -10
- package/esm/svg-B2YoIRuh.js +121 -0
- package/hydrate/index.js +2383 -42
- package/hydrate/index.mjs +2383 -42
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-5aa17cd2.entry.js → p-0f7a4236.entry.js} +1 -1
- package/lmvz-components/p-0s99QfRy.js +12 -0
- package/lmvz-components/{p-30b99f11.entry.js → p-2f83d7a2.entry.js} +1 -1
- package/lmvz-components/{p-6dbb3f13.entry.js → p-32171f4f.entry.js} +1 -1
- package/lmvz-components/{p-59383f3a.entry.js → p-400b2318.entry.js} +1 -1
- package/lmvz-components/p-851969bd.entry.js +1 -0
- package/lmvz-components/p-9f9d845d.entry.js +1 -0
- package/lmvz-components/p-Bmi89ll1.js +1 -0
- package/lmvz-components/p-CFsC37ww.js +1 -0
- package/lmvz-components/p-CGmJG63p.js +1 -0
- package/lmvz-components/p-CcxjkCOx.js +1 -0
- package/lmvz-components/{p-Bkfdgg0T.js → p-GdMr6Qlp.js} +1 -1
- package/lmvz-components/p-a12f95da.entry.js +1 -0
- package/lmvz-components/{p-84267405.entry.js → p-ab4437dc.entry.js} +1 -1
- package/lmvz-components/{p-7a6bec13.entry.js → p-d0a0e206.entry.js} +1 -1
- package/lmvz-components/{p-B3dnXEPG.js → p-dhVSUYqd.js} +1 -1
- package/manifest.json +544 -28
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +6 -1
- package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
- package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
- package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +39 -0
- package/types/components/lmvz-chip/lmvz-chip.d.ts +18 -3
- package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +0 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
- package/types/components/lmvz-select/lmvz-select.d.ts +0 -1
- package/types/components.d.ts +221 -12
- package/types/index.d.ts +1 -2
- package/types/utils/aria/aria-validation-controller.d.ts +1 -2
- package/types/utils/aria/element-activation-controller.d.ts +0 -1
- package/types/utils/aria/list-keyboard-controller.d.ts +0 -1
- package/types/utils/assets.d.ts +0 -1
- package/types/utils/component.d.ts +0 -1
- package/types/utils/environment.d.ts +0 -1
- package/types/utils/http.d.ts +0 -1
- package/types/utils/http.unit.d.ts +0 -1
- package/types/utils/icons/icons-registry.d.ts +0 -1
- package/types/utils/icons/icons.d.ts +0 -2
- package/types/utils/icons/icons.unit.d.ts +0 -1
- package/types/utils/icons/public.d.ts +0 -1
- package/types/utils/public.d.ts +0 -1
- package/types/utils/reactive-controller-host.d.ts +0 -1
- package/cjs/icons-swqMn6s2.js +0 -163
- package/components/p-DXOTa5VF.js +0 -12
- package/components/p-fiRXhuXK.js +0 -1
- package/esm/icons-Ca8oMiRa.js +0 -157
- package/lmvz-components/p-0a41cc24.entry.js +0 -1
- package/lmvz-components/p-5f150890.entry.js +0 -1
- package/lmvz-components/p-Bh2Epkwf.js +0 -1
- package/lmvz-components/p-DXOTa5VF.js +0 -12
- package/lmvz-components/p-fiRXhuXK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as dual, h as hasProperty, e as isNumber, f as isBigInt, j as isString, p as pipeArguments, N as NodeInspectSymbol, s as symbol, k as symbol$1, n as cached, o as structure, q as
|
|
1
|
+
import { d as dual, h as hasProperty, e as isNumber, f as isBigInt, j as isString, p as pipeArguments, N as NodeInspectSymbol, s as symbol, k as symbol$1, n as cached, o as structure, q as of$1, u as reduce, v as empty$9, w as appendAll, x as isNil, y as reverse, z as empty$a, A as cons, B as reduce$1, C as set$2, m as match$6, D as get$4, E as appendAll$1, F as isEmpty$4, G as equals$1, H as modifyAt, I as orElseSome, J as map$6, K as append$1, L as of$2, M as map$7, O as keys, P as empty$b, Q as deferredMake, R as deferredAwait, S as deferredSucceed, U as deferredFailCause, V as deferredIsDone, W as exitIsFailure, X as exitIsSuccess, Y as exitMatch, Z as exitFailCause, _ as exitSucceed, $ as exitFail, a0 as exitZipRight, a1 as exitCollectAll, a2 as exitVoid, a3 as exitDie, a4 as exitMap, a5 as exitZip, a6 as isEqual, a7 as some, a8 as none$1, a9 as isSome, aa as toJSON, ab as format$1, ac as prepend, ad as reverse$1, ae as GenericTag, af as sync$2, ag as succeed$4, ah as async_, ai as constFalse, aj as void_$2, ak as asVoid$1, al as pipe, am as join$2, an as isCons, ao as contains, ap as head, aq as tailNonEmpty, l as left, ar as prepend$1, as as map$8, r as right, at as flatMap$3, au as fail$4, av as suspend$3, aw as either, ax as isLeft, a as isRight, ay as zip$3, az as forEachSequential, aA as zip$4, aB as map$9, aC as of$3, aD as fromIterable$1, aE as fromIterable$2, aF as append$2, aG as flatten$4, aH as empty$c, aI as last, aJ as getOrElse, aK as mapError$1, aL as catchAll$1, aM as unfold$1, aN as merge$1, aO as mapBoth, aP as sort, aQ as flatMap$4, aR as unsafeGet, aS as fromIterable$3, aT as hash, aU as PCGRandom, aV as forEachSequentialDiscard, aW as as$1, aX as fromIterable$4, aY as Reference, aZ as globalValue, a_ as fiberRefUnsafeMakeContext, a$ as add, b0 as empty$d, b1 as withFiberRuntime$1, b2 as headNonEmpty, b3 as isNonEmptyReadonlyArray, b4 as logLevelWarning, b5 as logLevelNone, b6 as logLevelTrace, b7 as logLevelInfo, b8 as logLevelFatal, b9 as logLevelError, ba as logLevelDebug, bb as logLevelAll, bc as make$n, bd as Class, be as get$5, bf as set$3, bg as string, bh as matchEffect, bi as matchCauseEffect$1, bj as zipRight$3, bk as failCause$6, bl as constVoid, bm as contextWithEffect, bn as provideContext, bo as get$6, bp as failCauseSync$1, bq as yieldNow$1, br as combine$2, bs as fiberRefUnsafeMake, bt as currentMaxOpsBeforeYield, bu as currentSchedulingPriority, bv as fiberRefGetWith, bw as currentConcurrency, bx as none$2, by as zipLeft$1, bz as flatten$5, bA as unsafeFromArray, bB as makeBy, bC as dedupe, bD as appendAll$2, bE as array, bF as fromNullable, bG as getEquivalence, bH as union, bI as allocate, bJ as lastNonEmpty, bK as span, bL as isNone, bM as getOrUndefined, bN as tap$1, bO as currentMetricLabels, bP as deferredUnsafeDone, bQ as isTagged, bR as make$o, bS as reduce$2, bT as difference, bU as empty$e, bV as union$1, bW as make$p, bX as isNonEmpty$2, bY as headNonEmpty$1, bZ as tailNonEmpty$1, b_ as onExit, b$ as uninterruptibleMask$1, c0 as transplant, c1 as CloseableScopeTypeId, c2 as ScopeTypeId, c3 as exitAsVoid, c4 as exit$1, c5 as sequential$2, c6 as isEffect$1, c7 as mapInputContext, c8 as merge$2, c9 as make$q, ca as OP_FAILURE, cb as OP_SUCCESS, i as identity, cc as combine$3, cd as currentRequestBatching, ce as isIterable, cf as unsafeMake$5, cg as currentContext, ch as currentForkScopeOverride, ci as compareAndSet, cj as runtimeMetrics, ck as currentInterruptedCause, cl as deferredUnsafeMake, cm as fiberRefUnsafeMakeRuntimeFlags, cn as exclude, co as WindDown, cp as Interruption, cq as diff$3, cr as updateRuntimeFlags, cs as interrupt$3, ct as fiberRefUnsafeMakePatch, cu as isEmpty$5, cv as whileLoop, cw as currentUnhandledErrorLogLevel, cx as isInterruptedOnly$1, cy as currentLogLevel, cz as currentLogSpan, cA as currentLogAnnotations, cB as size$2, cC as withRedactableContext, cD as interruptible$1, cE as OP_YIELD$1, cF as cooperativeYielding, cG as OP_ASYNC, cH as enable, cI as patch$4, cJ as die$2, cK as OP_ON_FAILURE, cL as OP_ON_SUCCESS, cM as OP_WHILE, cN as OP_ITERATOR, cO as OP_TAG, cP as unsafeGet$1, cQ as NoSuchElementException, cR as unsafeAsync, cS as runFork$1, cT as provideContext$1, cU as die$3, cV as OP_SYNC, cW as internalCall, cX as OP_REVERT_FLAGS, cY as stripFailures, cZ as OP_ON_SUCCESS_AND_FAILURE, c_ as OP_WITH_RUNTIME, c$ as blocked, d0 as runRequestBlock, d1 as OP_UPDATE_RUNTIME_FLAGS, d2 as RevertFlags, d3 as OP_COMMIT, d4 as OpSupervision, d5 as EffectTypeId, d6 as currentVersionMismatchErrorLogLevel, d7 as getCurrentVersion, d8 as empty$f, d9 as dieMessage$1, da as toStringUnknown, db as isInterruptedException, dc as fiberRefUnsafeMakeHashSet, dd as yieldWrapGet, de as exitIsExit, df as step$1, dg as uninterruptible$1, dh as getOption, di as scopeFork, dj as none$3, dk as makeLogger, dl as threadName, dm as pretty, dn as fiberIdWith$1, dp as exitMatchEffect, dq as interruptAsFiber, dr as parallel$2, ds as toReadonlyArray, dt as fiberRefLocally, du as stringLogger, dv as interruptible$2, dw as isInterrupted$1, dx as interruptFiber, dy as exitInterrupt, dz as fail$5, dA as failureOrCause$1, dB as flipCauseOption$1, dC as map$a, dD as isDieType$1, dE as interruptors$1, dF as head$1, dG as scopeClose, dH as scopeAddFinalizerExit, dI as scopeAddFinalizer, dJ as asyncInterrupt, dK as make$r, dL as RuntimeMetrics, dM as CooperativeYielding, dN as prettyErrors, dO as isContext, dP as provideSomeContext, dQ as whenEffect, dR as mergeAll$2, dS as gen$1, dT as zipWith$1, dU as fnUntraced, dV as catchAllCause$1, dW as find, dX as orDie, dY as failSync, dZ as interrupt$4, d_ as matchCause$1, d$ as acquireUseRelease$1, e0 as intoDeferred$1, e1 as splitAt, e2 as isEmpty$6, e3 as onInterrupt, e4 as filter, e5 as deferredInterruptWith, e6 as fiberId, e7 as match$7, e8 as combineAll, e9 as unsafeGet$2, ea as reduce$3, eb as map$b, ec as splitWhere, ed as filterMap } from './logger-CGmJG63p.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This module provides an implementation of the `Order` type class which is used to define a total ordering on some type `A`.
|
|
@@ -22,17 +22,17 @@ import { d as dual, h as hasProperty, e as isNumber, f as isBigInt, j as isStrin
|
|
|
22
22
|
* @category constructors
|
|
23
23
|
* @since 2.0.0
|
|
24
24
|
*/
|
|
25
|
-
const make$
|
|
25
|
+
const make$m = compare => (self, that) => self === that ? 0 : compare(self, that);
|
|
26
26
|
/**
|
|
27
27
|
* @category instances
|
|
28
28
|
* @since 2.0.0
|
|
29
29
|
*/
|
|
30
|
-
const number = /*#__PURE__*/make$
|
|
30
|
+
const number = /*#__PURE__*/make$m((self, that) => self < that ? -1 : 1);
|
|
31
31
|
/**
|
|
32
32
|
* @category mapping
|
|
33
33
|
* @since 2.0.0
|
|
34
34
|
*/
|
|
35
|
-
const mapInput = /*#__PURE__*/dual(2, (self, f) => make$
|
|
35
|
+
const mapInput = /*#__PURE__*/dual(2, (self, f) => make$m((b1, b2) => self(f(b1), f(b2))));
|
|
36
36
|
/**
|
|
37
37
|
* Test whether one value is _strictly greater than_ another.
|
|
38
38
|
*
|
|
@@ -166,7 +166,7 @@ const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
|
166
166
|
/**
|
|
167
167
|
* @since 2.0.0
|
|
168
168
|
*/
|
|
169
|
-
const TypeId$
|
|
169
|
+
const TypeId$6 = /*#__PURE__*/Symbol.for("effect/Duration");
|
|
170
170
|
const bigint0$1 = /*#__PURE__*/BigInt(0);
|
|
171
171
|
const bigint24 = /*#__PURE__*/BigInt(24);
|
|
172
172
|
const bigint60 = /*#__PURE__*/BigInt(60);
|
|
@@ -235,7 +235,7 @@ const infinityValue = {
|
|
|
235
235
|
_tag: "Infinity"
|
|
236
236
|
};
|
|
237
237
|
const DurationProto = {
|
|
238
|
-
[TypeId$
|
|
238
|
+
[TypeId$6]: TypeId$6,
|
|
239
239
|
[symbol$1]() {
|
|
240
240
|
return cached(this, structure(this.value));
|
|
241
241
|
},
|
|
@@ -273,7 +273,7 @@ const DurationProto = {
|
|
|
273
273
|
return pipeArguments(this, arguments);
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
const make$
|
|
276
|
+
const make$l = input => {
|
|
277
277
|
const duration = Object.create(DurationProto);
|
|
278
278
|
if (isNumber(input)) {
|
|
279
279
|
if (isNaN(input) || input <= 0) {
|
|
@@ -305,7 +305,7 @@ const make$o = input => {
|
|
|
305
305
|
* @since 2.0.0
|
|
306
306
|
* @category guards
|
|
307
307
|
*/
|
|
308
|
-
const isDuration = u => hasProperty(u, TypeId$
|
|
308
|
+
const isDuration = u => hasProperty(u, TypeId$6);
|
|
309
309
|
/**
|
|
310
310
|
* @since 3.5.0
|
|
311
311
|
* @category guards
|
|
@@ -330,52 +330,52 @@ const isZero = self => {
|
|
|
330
330
|
* @since 2.0.0
|
|
331
331
|
* @category constructors
|
|
332
332
|
*/
|
|
333
|
-
const zero = /*#__PURE__*/make$
|
|
333
|
+
const zero = /*#__PURE__*/make$l(0);
|
|
334
334
|
/**
|
|
335
335
|
* @since 2.0.0
|
|
336
336
|
* @category constructors
|
|
337
337
|
*/
|
|
338
|
-
const infinity = /*#__PURE__*/make$
|
|
338
|
+
const infinity = /*#__PURE__*/make$l(Infinity);
|
|
339
339
|
/**
|
|
340
340
|
* @since 2.0.0
|
|
341
341
|
* @category constructors
|
|
342
342
|
*/
|
|
343
|
-
const nanos = nanos => make$
|
|
343
|
+
const nanos = nanos => make$l(nanos);
|
|
344
344
|
/**
|
|
345
345
|
* @since 2.0.0
|
|
346
346
|
* @category constructors
|
|
347
347
|
*/
|
|
348
|
-
const micros = micros => make$
|
|
348
|
+
const micros = micros => make$l(micros * bigint1e3);
|
|
349
349
|
/**
|
|
350
350
|
* @since 2.0.0
|
|
351
351
|
* @category constructors
|
|
352
352
|
*/
|
|
353
|
-
const millis = millis => make$
|
|
353
|
+
const millis = millis => make$l(millis);
|
|
354
354
|
/**
|
|
355
355
|
* @since 2.0.0
|
|
356
356
|
* @category constructors
|
|
357
357
|
*/
|
|
358
|
-
const seconds = seconds => make$
|
|
358
|
+
const seconds = seconds => make$l(seconds * 1000);
|
|
359
359
|
/**
|
|
360
360
|
* @since 2.0.0
|
|
361
361
|
* @category constructors
|
|
362
362
|
*/
|
|
363
|
-
const minutes = minutes => make$
|
|
363
|
+
const minutes = minutes => make$l(minutes * 60_000);
|
|
364
364
|
/**
|
|
365
365
|
* @since 2.0.0
|
|
366
366
|
* @category constructors
|
|
367
367
|
*/
|
|
368
|
-
const hours = hours => make$
|
|
368
|
+
const hours = hours => make$l(hours * 3_600_000);
|
|
369
369
|
/**
|
|
370
370
|
* @since 2.0.0
|
|
371
371
|
* @category constructors
|
|
372
372
|
*/
|
|
373
|
-
const days = days => make$
|
|
373
|
+
const days = days => make$l(days * 86_400_000);
|
|
374
374
|
/**
|
|
375
375
|
* @since 2.0.0
|
|
376
376
|
* @category constructors
|
|
377
377
|
*/
|
|
378
|
-
const weeks = weeks => make$
|
|
378
|
+
const weeks = weeks => make$l(weeks * 604_800_000);
|
|
379
379
|
/**
|
|
380
380
|
* @since 2.0.0
|
|
381
381
|
* @category getters
|
|
@@ -556,2292 +556,203 @@ const format = self => {
|
|
|
556
556
|
};
|
|
557
557
|
|
|
558
558
|
/**
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*/
|
|
562
|
-
const none$2 = none$3;
|
|
563
|
-
/**
|
|
564
|
-
* Combine two `FiberId`s.
|
|
565
|
-
*
|
|
566
|
-
* @since 2.0.0
|
|
567
|
-
* @category constructors
|
|
568
|
-
*/
|
|
569
|
-
const combine$5 = combine$6;
|
|
570
|
-
/**
|
|
571
|
-
* Combines a set of `FiberId`s into a single `FiberId`.
|
|
572
|
-
*
|
|
573
|
-
* @since 2.0.0
|
|
574
|
-
* @category constructors
|
|
575
|
-
*/
|
|
576
|
-
const combineAll = combineAll$1;
|
|
577
|
-
/**
|
|
578
|
-
* Creates a string representing the name of the current thread of execution
|
|
579
|
-
* represented by the specified `FiberId`.
|
|
580
|
-
*
|
|
581
|
-
* @since 2.0.0
|
|
582
|
-
* @category destructors
|
|
583
|
-
*/
|
|
584
|
-
const threadName = threadName$1;
|
|
585
|
-
/**
|
|
586
|
-
* Unsafely creates a new `FiberId`.
|
|
587
|
-
*
|
|
588
|
-
* @since 2.0.0
|
|
589
|
-
* @category unsafe
|
|
590
|
-
*/
|
|
591
|
-
const unsafeMake$5 = unsafeMake$6;
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* @since 2.0.0
|
|
595
|
-
*/
|
|
596
|
-
/**
|
|
597
|
-
* Creates a new `HashMap`.
|
|
598
|
-
*
|
|
599
|
-
* @since 2.0.0
|
|
600
|
-
* @category constructors
|
|
601
|
-
*/
|
|
602
|
-
const empty$e = empty$f;
|
|
603
|
-
/**
|
|
604
|
-
* Creates a new `HashMap` from an iterable collection of key/value pairs.
|
|
605
|
-
*
|
|
606
|
-
* @since 2.0.0
|
|
607
|
-
* @category constructors
|
|
608
|
-
*/
|
|
609
|
-
const fromIterable$1 = fromIterable$2;
|
|
610
|
-
/**
|
|
611
|
-
* Checks if the `HashMap` contains any entries.
|
|
612
|
-
*
|
|
613
|
-
* @since 2.0.0
|
|
614
|
-
* @category elements
|
|
615
|
-
*/
|
|
616
|
-
const isEmpty$4 = isEmpty$5;
|
|
617
|
-
/**
|
|
618
|
-
* Safely lookup the value for the specified key in the `HashMap` using the
|
|
619
|
-
* internal hashing function.
|
|
620
|
-
*
|
|
621
|
-
* @since 2.0.0
|
|
622
|
-
* @category elements
|
|
623
|
-
*/
|
|
624
|
-
const get$4 = get$5;
|
|
625
|
-
/**
|
|
626
|
-
* Sets the specified key to the specified value using the internal hashing
|
|
627
|
-
* function.
|
|
628
|
-
*
|
|
629
|
-
* @since 2.0.0
|
|
630
|
-
*/
|
|
631
|
-
const set$2 = set$3;
|
|
632
|
-
/**
|
|
633
|
-
* Returns an `IterableIterator` of the keys within the `HashMap`.
|
|
634
|
-
*
|
|
635
|
-
* @since 2.0.0
|
|
636
|
-
* @category getters
|
|
637
|
-
*/
|
|
638
|
-
const keys = keys$1;
|
|
639
|
-
/**
|
|
640
|
-
* Set or remove the specified key in the `HashMap` using the specified
|
|
641
|
-
* update function. The value of the specified key will be computed using the
|
|
642
|
-
* provided hash.
|
|
643
|
-
*
|
|
644
|
-
* The update function will be invoked with the current value of the key if it
|
|
645
|
-
* exists, or `None` if no such value exists.
|
|
646
|
-
*
|
|
647
|
-
* @since 2.0.0
|
|
648
|
-
*/
|
|
649
|
-
const modifyAt = modifyAt$1;
|
|
650
|
-
/**
|
|
651
|
-
* Maps over the entries of the `HashMap` using the specified function.
|
|
652
|
-
*
|
|
653
|
-
* @since 2.0.0
|
|
654
|
-
* @category mapping
|
|
655
|
-
*/
|
|
656
|
-
const map$7 = map$8;
|
|
657
|
-
/**
|
|
658
|
-
* Reduces the specified state over the entries of the `HashMap`.
|
|
659
|
-
*
|
|
660
|
-
* @since 2.0.0
|
|
661
|
-
* @category folding
|
|
662
|
-
*/
|
|
663
|
-
const reduce$1 = reduce$2;
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* A data type for immutable linked lists representing ordered collections of elements of type `A`.
|
|
667
|
-
*
|
|
668
|
-
* This data type is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`.
|
|
669
|
-
*
|
|
670
|
-
* **Performance**
|
|
671
|
-
*
|
|
672
|
-
* - Time: `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list. This includes the index-based lookup of elements, `length`, `append` and `reverse`.
|
|
673
|
-
* - Space: `List` implements structural sharing of the tail list. This means that many operations are either zero- or constant-memory cost.
|
|
559
|
+
* Combines this collection of blocked requests with the specified collection
|
|
560
|
+
* of blocked requests, in parallel.
|
|
674
561
|
*
|
|
675
|
-
* @
|
|
562
|
+
* @internal
|
|
676
563
|
*/
|
|
564
|
+
const par = (self, that) => ({
|
|
565
|
+
_tag: "Par",
|
|
566
|
+
left: self,
|
|
567
|
+
right: that
|
|
568
|
+
});
|
|
677
569
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* Scala (https://www.scala-lang.org)
|
|
681
|
-
*
|
|
682
|
-
* Copyright EPFL and Lightbend, Inc.
|
|
570
|
+
* Combines this collection of blocked requests with the specified collection
|
|
571
|
+
* of blocked requests, in sequence.
|
|
683
572
|
*
|
|
684
|
-
*
|
|
685
|
-
* (http://www.apache.org/licenses/LICENSE-2.0).
|
|
686
|
-
*/
|
|
687
|
-
/**
|
|
688
|
-
* @since 2.0.0
|
|
689
|
-
* @category symbol
|
|
573
|
+
* @internal
|
|
690
574
|
*/
|
|
691
|
-
const
|
|
575
|
+
const seq = (self, that) => ({
|
|
576
|
+
_tag: "Seq",
|
|
577
|
+
left: self,
|
|
578
|
+
right: that
|
|
579
|
+
});
|
|
692
580
|
/**
|
|
693
|
-
*
|
|
581
|
+
* Flattens a collection of blocked requests into a collection of pipelined
|
|
582
|
+
* and batched requests that can be submitted for execution.
|
|
694
583
|
*
|
|
695
|
-
* @
|
|
696
|
-
* @since 2.0.0
|
|
584
|
+
* @internal
|
|
697
585
|
*/
|
|
698
|
-
const
|
|
586
|
+
const flatten$3 = self => {
|
|
587
|
+
let current = of$1(self);
|
|
588
|
+
let updated = empty$9();
|
|
589
|
+
// eslint-disable-next-line no-constant-condition
|
|
590
|
+
while (1) {
|
|
591
|
+
const [parallel, sequential] = reduce(current, [parallelCollectionEmpty(), empty$9()], ([parallel, sequential], blockedRequest) => {
|
|
592
|
+
const [par, seq] = step(blockedRequest);
|
|
593
|
+
return [parallelCollectionCombine(parallel, par), appendAll(sequential, seq)];
|
|
594
|
+
});
|
|
595
|
+
updated = merge(updated, parallel);
|
|
596
|
+
if (isNil(sequential)) {
|
|
597
|
+
return reverse(updated);
|
|
598
|
+
}
|
|
599
|
+
current = sequential;
|
|
600
|
+
}
|
|
601
|
+
throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
602
|
+
};
|
|
699
603
|
/**
|
|
700
|
-
*
|
|
701
|
-
*
|
|
604
|
+
* Takes one step in evaluating a collection of blocked requests, returning a
|
|
605
|
+
* collection of blocked requests that can be performed in parallel and a list
|
|
606
|
+
* of blocked requests that must be performed sequentially after those
|
|
607
|
+
* requests.
|
|
702
608
|
*/
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
return this.toJSON();
|
|
720
|
-
},
|
|
721
|
-
[symbol](that) {
|
|
722
|
-
return isList(that) && this._tag === that._tag && _equivalence(this, that);
|
|
723
|
-
},
|
|
724
|
-
[symbol$1]() {
|
|
725
|
-
return cached(this, array(toArray(this)));
|
|
726
|
-
},
|
|
727
|
-
[Symbol.iterator]() {
|
|
728
|
-
let done = false;
|
|
729
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
730
|
-
let self = this;
|
|
731
|
-
return {
|
|
732
|
-
next() {
|
|
733
|
-
if (done) {
|
|
734
|
-
return this.return();
|
|
609
|
+
const step = requests => {
|
|
610
|
+
let current = requests;
|
|
611
|
+
let parallel = parallelCollectionEmpty();
|
|
612
|
+
let stack = empty$9();
|
|
613
|
+
let sequential = empty$9();
|
|
614
|
+
// eslint-disable-next-line no-constant-condition
|
|
615
|
+
while (1) {
|
|
616
|
+
switch (current._tag) {
|
|
617
|
+
case "Empty":
|
|
618
|
+
{
|
|
619
|
+
if (isNil(stack)) {
|
|
620
|
+
return [parallel, sequential];
|
|
621
|
+
}
|
|
622
|
+
current = stack.head;
|
|
623
|
+
stack = stack.tail;
|
|
624
|
+
break;
|
|
735
625
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
626
|
+
case "Par":
|
|
627
|
+
{
|
|
628
|
+
stack = cons(current.right, stack);
|
|
629
|
+
current = current.left;
|
|
630
|
+
break;
|
|
739
631
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
632
|
+
case "Seq":
|
|
633
|
+
{
|
|
634
|
+
const left = current.left;
|
|
635
|
+
const right = current.right;
|
|
636
|
+
switch (left._tag) {
|
|
637
|
+
case "Empty":
|
|
638
|
+
{
|
|
639
|
+
current = right;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
case "Par":
|
|
643
|
+
{
|
|
644
|
+
const l = left.left;
|
|
645
|
+
const r = left.right;
|
|
646
|
+
current = par(seq(l, right), seq(r, right));
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
case "Seq":
|
|
650
|
+
{
|
|
651
|
+
const l = left.left;
|
|
652
|
+
const r = left.right;
|
|
653
|
+
current = seq(l, seq(r, right));
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
case "Single":
|
|
657
|
+
{
|
|
658
|
+
current = left;
|
|
659
|
+
sequential = cons(right, sequential);
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
break;
|
|
750
664
|
}
|
|
751
|
-
|
|
752
|
-
done: true,
|
|
753
|
-
value
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
},
|
|
758
|
-
pipe() {
|
|
759
|
-
return pipeArguments(this, arguments);
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
const makeCons = (head, tail) => {
|
|
763
|
-
const cons = Object.create(ConsProto);
|
|
764
|
-
cons.head = head;
|
|
765
|
-
cons.tail = tail;
|
|
766
|
-
return cons;
|
|
767
|
-
};
|
|
768
|
-
const NilHash = /*#__PURE__*/string("Nil");
|
|
769
|
-
const NilProto = {
|
|
770
|
-
[TypeId$6]: TypeId$6,
|
|
771
|
-
_tag: "Nil",
|
|
772
|
-
toString() {
|
|
773
|
-
return format$1(this.toJSON());
|
|
774
|
-
},
|
|
775
|
-
toJSON() {
|
|
776
|
-
return {
|
|
777
|
-
_id: "List",
|
|
778
|
-
_tag: "Nil"
|
|
779
|
-
};
|
|
780
|
-
},
|
|
781
|
-
[NodeInspectSymbol]() {
|
|
782
|
-
return this.toJSON();
|
|
783
|
-
},
|
|
784
|
-
[symbol$1]() {
|
|
785
|
-
return NilHash;
|
|
786
|
-
},
|
|
787
|
-
[symbol](that) {
|
|
788
|
-
return isList(that) && this._tag === that._tag;
|
|
789
|
-
},
|
|
790
|
-
[Symbol.iterator]() {
|
|
791
|
-
return {
|
|
792
|
-
next() {
|
|
793
|
-
return {
|
|
794
|
-
done: true,
|
|
795
|
-
value: undefined
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
};
|
|
799
|
-
},
|
|
800
|
-
pipe() {
|
|
801
|
-
return pipeArguments(this, arguments);
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
const _Nil = /*#__PURE__*/Object.create(NilProto);
|
|
805
|
-
/**
|
|
806
|
-
* Returns `true` if the specified value is a `List`, `false` otherwise.
|
|
807
|
-
*
|
|
808
|
-
* @since 2.0.0
|
|
809
|
-
* @category refinements
|
|
810
|
-
*/
|
|
811
|
-
const isList = u => hasProperty(u, TypeId$6);
|
|
812
|
-
/**
|
|
813
|
-
* Returns `true` if the specified value is a `List.Nil<A>`, `false` otherwise.
|
|
814
|
-
*
|
|
815
|
-
* @since 2.0.0
|
|
816
|
-
* @category refinements
|
|
817
|
-
*/
|
|
818
|
-
const isNil = self => self._tag === "Nil";
|
|
819
|
-
/**
|
|
820
|
-
* Returns `true` if the specified value is a `List.Cons<A>`, `false` otherwise.
|
|
821
|
-
*
|
|
822
|
-
* @since 2.0.0
|
|
823
|
-
* @category refinements
|
|
824
|
-
*/
|
|
825
|
-
const isCons = self => self._tag === "Cons";
|
|
826
|
-
/**
|
|
827
|
-
* Constructs a new empty `List<A>`.
|
|
828
|
-
*
|
|
829
|
-
* @since 2.0.0
|
|
830
|
-
* @category constructors
|
|
831
|
-
*/
|
|
832
|
-
const nil = () => _Nil;
|
|
833
|
-
/**
|
|
834
|
-
* Constructs a new `List.Cons<A>` from the specified `head` and `tail` values.
|
|
835
|
-
*
|
|
836
|
-
* @since 2.0.0
|
|
837
|
-
* @category constructors
|
|
838
|
-
*/
|
|
839
|
-
const cons = (head, tail) => makeCons(head, tail);
|
|
840
|
-
/**
|
|
841
|
-
* Constructs a new empty `List<A>`.
|
|
842
|
-
*
|
|
843
|
-
* Alias of {@link nil}.
|
|
844
|
-
*
|
|
845
|
-
* @since 2.0.0
|
|
846
|
-
* @category constructors
|
|
847
|
-
*/
|
|
848
|
-
const empty$d = nil;
|
|
849
|
-
/**
|
|
850
|
-
* Constructs a new `List<A>` from the specified value.
|
|
851
|
-
*
|
|
852
|
-
* @since 2.0.0
|
|
853
|
-
* @category constructors
|
|
854
|
-
*/
|
|
855
|
-
const of$1 = value => makeCons(value, _Nil);
|
|
856
|
-
/**
|
|
857
|
-
* Concatenates two lists, combining their elements.
|
|
858
|
-
* If either list is non-empty, the result is also a non-empty list.
|
|
859
|
-
*
|
|
860
|
-
* @example
|
|
861
|
-
* ```ts
|
|
862
|
-
* import * as assert from "node:assert"
|
|
863
|
-
* import { List } from "effect"
|
|
864
|
-
*
|
|
865
|
-
* assert.deepStrictEqual(
|
|
866
|
-
* List.make(1, 2).pipe(List.appendAll(List.make("a", "b")), List.toArray),
|
|
867
|
-
* [1, 2, "a", "b"]
|
|
868
|
-
* )
|
|
869
|
-
* ```
|
|
870
|
-
*
|
|
871
|
-
* @category concatenating
|
|
872
|
-
* @since 2.0.0
|
|
873
|
-
*/
|
|
874
|
-
const appendAll = /*#__PURE__*/dual(2, (self, that) => prependAll(that, self));
|
|
875
|
-
/**
|
|
876
|
-
* Prepends the specified element to the beginning of the list.
|
|
877
|
-
*
|
|
878
|
-
* @category concatenating
|
|
879
|
-
* @since 2.0.0
|
|
880
|
-
*/
|
|
881
|
-
const prepend = /*#__PURE__*/dual(2, (self, element) => cons(element, self));
|
|
882
|
-
/**
|
|
883
|
-
* Prepends the specified prefix list to the beginning of the specified list.
|
|
884
|
-
* If either list is non-empty, the result is also a non-empty list.
|
|
885
|
-
*
|
|
886
|
-
* @example
|
|
887
|
-
* ```ts
|
|
888
|
-
* import * as assert from "node:assert"
|
|
889
|
-
* import { List } from "effect"
|
|
890
|
-
*
|
|
891
|
-
* assert.deepStrictEqual(
|
|
892
|
-
* List.make(1, 2).pipe(List.prependAll(List.make("a", "b")), List.toArray),
|
|
893
|
-
* ["a", "b", 1, 2]
|
|
894
|
-
* )
|
|
895
|
-
* ```
|
|
896
|
-
*
|
|
897
|
-
* @category concatenating
|
|
898
|
-
* @since 2.0.0
|
|
899
|
-
*/
|
|
900
|
-
const prependAll = /*#__PURE__*/dual(2, (self, prefix) => {
|
|
901
|
-
if (isNil(self)) {
|
|
902
|
-
return prefix;
|
|
903
|
-
} else if (isNil(prefix)) {
|
|
904
|
-
return self;
|
|
905
|
-
} else {
|
|
906
|
-
const result = makeCons(prefix.head, self);
|
|
907
|
-
let curr = result;
|
|
908
|
-
let that = prefix.tail;
|
|
909
|
-
while (!isNil(that)) {
|
|
910
|
-
const temp = makeCons(that.head, self);
|
|
911
|
-
curr.tail = temp;
|
|
912
|
-
curr = temp;
|
|
913
|
-
that = that.tail;
|
|
914
|
-
}
|
|
915
|
-
return result;
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
/**
|
|
919
|
-
* Folds over the elements of the list using the specified function, using the
|
|
920
|
-
* specified initial value.
|
|
921
|
-
*
|
|
922
|
-
* @since 2.0.0
|
|
923
|
-
* @category folding
|
|
924
|
-
*/
|
|
925
|
-
const reduce = /*#__PURE__*/dual(3, (self, zero, f) => {
|
|
926
|
-
let acc = zero;
|
|
927
|
-
let these = self;
|
|
928
|
-
while (!isNil(these)) {
|
|
929
|
-
acc = f(acc, these.head);
|
|
930
|
-
these = these.tail;
|
|
931
|
-
}
|
|
932
|
-
return acc;
|
|
933
|
-
});
|
|
934
|
-
/**
|
|
935
|
-
* Returns a new list with the elements of the specified list in reverse order.
|
|
936
|
-
*
|
|
937
|
-
* @since 2.0.0
|
|
938
|
-
* @category elements
|
|
939
|
-
*/
|
|
940
|
-
const reverse = self => {
|
|
941
|
-
let result = empty$d();
|
|
942
|
-
let these = self;
|
|
943
|
-
while (!isNil(these)) {
|
|
944
|
-
result = prepend(result, these.head);
|
|
945
|
-
these = these.tail;
|
|
946
|
-
}
|
|
947
|
-
return result;
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
/** @internal */
|
|
951
|
-
const Structural = /*#__PURE__*/function () {
|
|
952
|
-
function Structural(args) {
|
|
953
|
-
if (args) {
|
|
954
|
-
Object.assign(this, args);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
Structural.prototype = StructuralPrototype;
|
|
958
|
-
return Structural;
|
|
959
|
-
}();
|
|
960
|
-
|
|
961
|
-
/** @internal */
|
|
962
|
-
const ContextPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferContextPatch");
|
|
963
|
-
function variance$2(a) {
|
|
964
|
-
return a;
|
|
965
|
-
}
|
|
966
|
-
/** @internal */
|
|
967
|
-
const PatchProto$2 = {
|
|
968
|
-
...Structural.prototype,
|
|
969
|
-
[ContextPatchTypeId]: {
|
|
970
|
-
_Value: variance$2,
|
|
971
|
-
_Patch: variance$2
|
|
972
|
-
}
|
|
973
|
-
};
|
|
974
|
-
const EmptyProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
|
|
975
|
-
_tag: "Empty"
|
|
976
|
-
});
|
|
977
|
-
const _empty$2 = /*#__PURE__*/Object.create(EmptyProto$2);
|
|
978
|
-
/**
|
|
979
|
-
* @internal
|
|
980
|
-
*/
|
|
981
|
-
const empty$c = () => _empty$2;
|
|
982
|
-
const AndThenProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
|
|
983
|
-
_tag: "AndThen"
|
|
984
|
-
});
|
|
985
|
-
const makeAndThen$2 = (first, second) => {
|
|
986
|
-
const o = Object.create(AndThenProto$2);
|
|
987
|
-
o.first = first;
|
|
988
|
-
o.second = second;
|
|
989
|
-
return o;
|
|
990
|
-
};
|
|
991
|
-
const AddServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
|
|
992
|
-
_tag: "AddService"
|
|
993
|
-
});
|
|
994
|
-
const makeAddService = (key, service) => {
|
|
995
|
-
const o = Object.create(AddServiceProto);
|
|
996
|
-
o.key = key;
|
|
997
|
-
o.service = service;
|
|
998
|
-
return o;
|
|
999
|
-
};
|
|
1000
|
-
const RemoveServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
|
|
1001
|
-
_tag: "RemoveService"
|
|
1002
|
-
});
|
|
1003
|
-
const makeRemoveService = key => {
|
|
1004
|
-
const o = Object.create(RemoveServiceProto);
|
|
1005
|
-
o.key = key;
|
|
1006
|
-
return o;
|
|
1007
|
-
};
|
|
1008
|
-
const UpdateServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
|
|
1009
|
-
_tag: "UpdateService"
|
|
1010
|
-
});
|
|
1011
|
-
const makeUpdateService = (key, update) => {
|
|
1012
|
-
const o = Object.create(UpdateServiceProto);
|
|
1013
|
-
o.key = key;
|
|
1014
|
-
o.update = update;
|
|
1015
|
-
return o;
|
|
1016
|
-
};
|
|
1017
|
-
/** @internal */
|
|
1018
|
-
const diff$6 = (oldValue, newValue) => {
|
|
1019
|
-
const missingServices = new Map(oldValue.unsafeMap);
|
|
1020
|
-
let patch = empty$c();
|
|
1021
|
-
for (const [tag, newService] of newValue.unsafeMap.entries()) {
|
|
1022
|
-
if (missingServices.has(tag)) {
|
|
1023
|
-
const old = missingServices.get(tag);
|
|
1024
|
-
missingServices.delete(tag);
|
|
1025
|
-
if (!equals$1(old, newService)) {
|
|
1026
|
-
patch = combine$4(makeUpdateService(tag, () => newService))(patch);
|
|
1027
|
-
}
|
|
1028
|
-
} else {
|
|
1029
|
-
missingServices.delete(tag);
|
|
1030
|
-
patch = combine$4(makeAddService(tag, newService))(patch);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
for (const [tag] of missingServices.entries()) {
|
|
1034
|
-
patch = combine$4(makeRemoveService(tag))(patch);
|
|
1035
|
-
}
|
|
1036
|
-
return patch;
|
|
1037
|
-
};
|
|
1038
|
-
/** @internal */
|
|
1039
|
-
const combine$4 = /*#__PURE__*/dual(2, (self, that) => makeAndThen$2(self, that));
|
|
1040
|
-
/** @internal */
|
|
1041
|
-
const patch$7 = /*#__PURE__*/dual(2, (self, context) => {
|
|
1042
|
-
if (self._tag === "Empty") {
|
|
1043
|
-
return context;
|
|
1044
|
-
}
|
|
1045
|
-
let wasServiceUpdated = false;
|
|
1046
|
-
let patches = of$2(self);
|
|
1047
|
-
const updatedContext = new Map(context.unsafeMap);
|
|
1048
|
-
while (isNonEmpty$2(patches)) {
|
|
1049
|
-
const head = headNonEmpty(patches);
|
|
1050
|
-
const tail = tailNonEmpty(patches);
|
|
1051
|
-
switch (head._tag) {
|
|
1052
|
-
case "Empty":
|
|
1053
|
-
{
|
|
1054
|
-
patches = tail;
|
|
1055
|
-
break;
|
|
1056
|
-
}
|
|
1057
|
-
case "AddService":
|
|
1058
|
-
{
|
|
1059
|
-
updatedContext.set(head.key, head.service);
|
|
1060
|
-
patches = tail;
|
|
1061
|
-
break;
|
|
1062
|
-
}
|
|
1063
|
-
case "AndThen":
|
|
1064
|
-
{
|
|
1065
|
-
patches = prepend$1(prepend$1(tail, head.second), head.first);
|
|
1066
|
-
break;
|
|
1067
|
-
}
|
|
1068
|
-
case "RemoveService":
|
|
1069
|
-
{
|
|
1070
|
-
updatedContext.delete(head.key);
|
|
1071
|
-
patches = tail;
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
case "UpdateService":
|
|
1075
|
-
{
|
|
1076
|
-
updatedContext.set(head.key, head.update(updatedContext.get(head.key)));
|
|
1077
|
-
wasServiceUpdated = true;
|
|
1078
|
-
patches = tail;
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
if (!wasServiceUpdated) {
|
|
1084
|
-
return makeContext(updatedContext);
|
|
1085
|
-
}
|
|
1086
|
-
const map = new Map();
|
|
1087
|
-
for (const [tag] of context.unsafeMap) {
|
|
1088
|
-
if (updatedContext.has(tag)) {
|
|
1089
|
-
map.set(tag, updatedContext.get(tag));
|
|
1090
|
-
updatedContext.delete(tag);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
for (const [tag, s] of updatedContext) {
|
|
1094
|
-
map.set(tag, s);
|
|
1095
|
-
}
|
|
1096
|
-
return makeContext(map);
|
|
1097
|
-
});
|
|
1098
|
-
|
|
1099
|
-
/** @internal */
|
|
1100
|
-
const HashSetPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferHashSetPatch");
|
|
1101
|
-
function variance$1(a) {
|
|
1102
|
-
return a;
|
|
1103
|
-
}
|
|
1104
|
-
/** @internal */
|
|
1105
|
-
const PatchProto$1 = {
|
|
1106
|
-
...Structural.prototype,
|
|
1107
|
-
[HashSetPatchTypeId]: {
|
|
1108
|
-
_Value: variance$1,
|
|
1109
|
-
_Key: variance$1,
|
|
1110
|
-
_Patch: variance$1
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
const EmptyProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
|
|
1114
|
-
_tag: "Empty"
|
|
1115
|
-
});
|
|
1116
|
-
const _empty$1 = /*#__PURE__*/Object.create(EmptyProto$1);
|
|
1117
|
-
/** @internal */
|
|
1118
|
-
const empty$b = () => _empty$1;
|
|
1119
|
-
const AndThenProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
|
|
1120
|
-
_tag: "AndThen"
|
|
1121
|
-
});
|
|
1122
|
-
/** @internal */
|
|
1123
|
-
const makeAndThen$1 = (first, second) => {
|
|
1124
|
-
const o = Object.create(AndThenProto$1);
|
|
1125
|
-
o.first = first;
|
|
1126
|
-
o.second = second;
|
|
1127
|
-
return o;
|
|
1128
|
-
};
|
|
1129
|
-
const AddProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
|
|
1130
|
-
_tag: "Add"
|
|
1131
|
-
});
|
|
1132
|
-
/** @internal */
|
|
1133
|
-
const makeAdd = value => {
|
|
1134
|
-
const o = Object.create(AddProto);
|
|
1135
|
-
o.value = value;
|
|
1136
|
-
return o;
|
|
1137
|
-
};
|
|
1138
|
-
const RemoveProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
|
|
1139
|
-
_tag: "Remove"
|
|
1140
|
-
});
|
|
1141
|
-
/** @internal */
|
|
1142
|
-
const makeRemove = value => {
|
|
1143
|
-
const o = Object.create(RemoveProto);
|
|
1144
|
-
o.value = value;
|
|
1145
|
-
return o;
|
|
1146
|
-
};
|
|
1147
|
-
/** @internal */
|
|
1148
|
-
const diff$5 = (oldValue, newValue) => {
|
|
1149
|
-
const [removed, patch] = reduce$3([oldValue, empty$b()], ([set, patch], value) => {
|
|
1150
|
-
if (has$1(value)(set)) {
|
|
1151
|
-
return [remove$1(value)(set), patch];
|
|
1152
|
-
}
|
|
1153
|
-
return [set, combine$3(makeAdd(value))(patch)];
|
|
1154
|
-
})(newValue);
|
|
1155
|
-
return reduce$3(patch, (patch, value) => combine$3(makeRemove(value))(patch))(removed);
|
|
1156
|
-
};
|
|
1157
|
-
/** @internal */
|
|
1158
|
-
const combine$3 = /*#__PURE__*/dual(2, (self, that) => makeAndThen$1(self, that));
|
|
1159
|
-
/** @internal */
|
|
1160
|
-
const patch$6 = /*#__PURE__*/dual(2, (self, oldValue) => {
|
|
1161
|
-
if (self._tag === "Empty") {
|
|
1162
|
-
return oldValue;
|
|
1163
|
-
}
|
|
1164
|
-
let set = oldValue;
|
|
1165
|
-
let patches = of$2(self);
|
|
1166
|
-
while (isNonEmpty$2(patches)) {
|
|
1167
|
-
const head = headNonEmpty(patches);
|
|
1168
|
-
const tail = tailNonEmpty(patches);
|
|
1169
|
-
switch (head._tag) {
|
|
1170
|
-
case "Empty":
|
|
1171
|
-
{
|
|
1172
|
-
patches = tail;
|
|
1173
|
-
break;
|
|
1174
|
-
}
|
|
1175
|
-
case "AndThen":
|
|
1176
|
-
{
|
|
1177
|
-
patches = prepend$1(head.first)(prepend$1(head.second)(tail));
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
case "Add":
|
|
1181
|
-
{
|
|
1182
|
-
set = add(head.value)(set);
|
|
1183
|
-
patches = tail;
|
|
1184
|
-
break;
|
|
1185
|
-
}
|
|
1186
|
-
case "Remove":
|
|
1187
|
-
{
|
|
1188
|
-
set = remove$1(head.value)(set);
|
|
1189
|
-
patches = tail;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
return set;
|
|
1194
|
-
});
|
|
1195
|
-
|
|
1196
|
-
/** @internal */
|
|
1197
|
-
const ReadonlyArrayPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferReadonlyArrayPatch");
|
|
1198
|
-
function variance(a) {
|
|
1199
|
-
return a;
|
|
1200
|
-
}
|
|
1201
|
-
const PatchProto = {
|
|
1202
|
-
...Structural.prototype,
|
|
1203
|
-
[ReadonlyArrayPatchTypeId]: {
|
|
1204
|
-
_Value: variance,
|
|
1205
|
-
_Patch: variance
|
|
1206
|
-
}
|
|
1207
|
-
};
|
|
1208
|
-
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
|
|
1209
|
-
_tag: "Empty"
|
|
1210
|
-
});
|
|
1211
|
-
const _empty = /*#__PURE__*/Object.create(EmptyProto);
|
|
1212
|
-
/**
|
|
1213
|
-
* @internal
|
|
1214
|
-
*/
|
|
1215
|
-
const empty$a = () => _empty;
|
|
1216
|
-
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
|
|
1217
|
-
_tag: "AndThen"
|
|
1218
|
-
});
|
|
1219
|
-
const makeAndThen = (first, second) => {
|
|
1220
|
-
const o = Object.create(AndThenProto);
|
|
1221
|
-
o.first = first;
|
|
1222
|
-
o.second = second;
|
|
1223
|
-
return o;
|
|
1224
|
-
};
|
|
1225
|
-
const AppendProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
|
|
1226
|
-
_tag: "Append"
|
|
1227
|
-
});
|
|
1228
|
-
const makeAppend = values => {
|
|
1229
|
-
const o = Object.create(AppendProto);
|
|
1230
|
-
o.values = values;
|
|
1231
|
-
return o;
|
|
1232
|
-
};
|
|
1233
|
-
const SliceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
|
|
1234
|
-
_tag: "Slice"
|
|
1235
|
-
});
|
|
1236
|
-
const makeSlice = (from, until) => {
|
|
1237
|
-
const o = Object.create(SliceProto);
|
|
1238
|
-
o.from = from;
|
|
1239
|
-
o.until = until;
|
|
1240
|
-
return o;
|
|
1241
|
-
};
|
|
1242
|
-
const UpdateProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
|
|
1243
|
-
_tag: "Update"
|
|
1244
|
-
});
|
|
1245
|
-
const makeUpdate = (index, patch) => {
|
|
1246
|
-
const o = Object.create(UpdateProto);
|
|
1247
|
-
o.index = index;
|
|
1248
|
-
o.patch = patch;
|
|
1249
|
-
return o;
|
|
1250
|
-
};
|
|
1251
|
-
/** @internal */
|
|
1252
|
-
const diff$4 = options => {
|
|
1253
|
-
let i = 0;
|
|
1254
|
-
let patch = empty$a();
|
|
1255
|
-
while (i < options.oldValue.length && i < options.newValue.length) {
|
|
1256
|
-
const oldElement = options.oldValue[i];
|
|
1257
|
-
const newElement = options.newValue[i];
|
|
1258
|
-
const valuePatch = options.differ.diff(oldElement, newElement);
|
|
1259
|
-
if (!equals$1(valuePatch, options.differ.empty)) {
|
|
1260
|
-
patch = combine$2(patch, makeUpdate(i, valuePatch));
|
|
1261
|
-
}
|
|
1262
|
-
i = i + 1;
|
|
1263
|
-
}
|
|
1264
|
-
if (i < options.oldValue.length) {
|
|
1265
|
-
patch = combine$2(patch, makeSlice(0, i));
|
|
1266
|
-
}
|
|
1267
|
-
if (i < options.newValue.length) {
|
|
1268
|
-
patch = combine$2(patch, makeAppend(drop(i)(options.newValue)));
|
|
1269
|
-
}
|
|
1270
|
-
return patch;
|
|
1271
|
-
};
|
|
1272
|
-
/** @internal */
|
|
1273
|
-
const combine$2 = /*#__PURE__*/dual(2, (self, that) => makeAndThen(self, that));
|
|
1274
|
-
/** @internal */
|
|
1275
|
-
const patch$5 = /*#__PURE__*/dual(3, (self, oldValue, differ) => {
|
|
1276
|
-
if (self._tag === "Empty") {
|
|
1277
|
-
return oldValue;
|
|
1278
|
-
}
|
|
1279
|
-
let readonlyArray = oldValue.slice();
|
|
1280
|
-
let patches = of$3(self);
|
|
1281
|
-
while (isNonEmptyArray(patches)) {
|
|
1282
|
-
const head = headNonEmpty$1(patches);
|
|
1283
|
-
const tail = tailNonEmpty$1(patches);
|
|
1284
|
-
switch (head._tag) {
|
|
1285
|
-
case "Empty":
|
|
1286
|
-
{
|
|
1287
|
-
patches = tail;
|
|
1288
|
-
break;
|
|
1289
|
-
}
|
|
1290
|
-
case "AndThen":
|
|
1291
|
-
{
|
|
1292
|
-
tail.unshift(head.first, head.second);
|
|
1293
|
-
patches = tail;
|
|
1294
|
-
break;
|
|
1295
|
-
}
|
|
1296
|
-
case "Append":
|
|
1297
|
-
{
|
|
1298
|
-
for (const value of head.values) {
|
|
1299
|
-
readonlyArray.push(value);
|
|
1300
|
-
}
|
|
1301
|
-
patches = tail;
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
case "Slice":
|
|
1305
|
-
{
|
|
1306
|
-
readonlyArray = readonlyArray.slice(head.from, head.until);
|
|
1307
|
-
patches = tail;
|
|
1308
|
-
break;
|
|
1309
|
-
}
|
|
1310
|
-
case "Update":
|
|
1311
|
-
{
|
|
1312
|
-
readonlyArray[head.index] = differ.patch(head.patch, readonlyArray[head.index]);
|
|
1313
|
-
patches = tail;
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
return readonlyArray;
|
|
1319
|
-
});
|
|
1320
|
-
|
|
1321
|
-
/** @internal */
|
|
1322
|
-
const DifferTypeId = /*#__PURE__*/Symbol.for("effect/Differ");
|
|
1323
|
-
/** @internal */
|
|
1324
|
-
const DifferProto = {
|
|
1325
|
-
[DifferTypeId]: {
|
|
1326
|
-
_P: identity,
|
|
1327
|
-
_V: identity
|
|
1328
|
-
},
|
|
1329
|
-
pipe() {
|
|
1330
|
-
return pipeArguments(this, arguments);
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
/** @internal */
|
|
1334
|
-
const make$n = params => {
|
|
1335
|
-
const differ = Object.create(DifferProto);
|
|
1336
|
-
differ.empty = params.empty;
|
|
1337
|
-
differ.diff = params.diff;
|
|
1338
|
-
differ.combine = params.combine;
|
|
1339
|
-
differ.patch = params.patch;
|
|
1340
|
-
return differ;
|
|
1341
|
-
};
|
|
1342
|
-
/** @internal */
|
|
1343
|
-
const environment = () => make$n({
|
|
1344
|
-
empty: empty$c(),
|
|
1345
|
-
combine: (first, second) => combine$4(second)(first),
|
|
1346
|
-
diff: (oldValue, newValue) => diff$6(oldValue, newValue),
|
|
1347
|
-
patch: (patch, oldValue) => patch$7(oldValue)(patch)
|
|
1348
|
-
});
|
|
1349
|
-
/** @internal */
|
|
1350
|
-
const hashSet = () => make$n({
|
|
1351
|
-
empty: empty$b(),
|
|
1352
|
-
combine: (first, second) => combine$3(second)(first),
|
|
1353
|
-
diff: (oldValue, newValue) => diff$5(oldValue, newValue),
|
|
1354
|
-
patch: (patch, oldValue) => patch$6(oldValue)(patch)
|
|
1355
|
-
});
|
|
1356
|
-
/** @internal */
|
|
1357
|
-
const readonlyArray = differ => make$n({
|
|
1358
|
-
empty: empty$a(),
|
|
1359
|
-
combine: (first, second) => combine$2(first, second),
|
|
1360
|
-
diff: (oldValue, newValue) => diff$4({
|
|
1361
|
-
oldValue,
|
|
1362
|
-
newValue,
|
|
1363
|
-
differ
|
|
1364
|
-
}),
|
|
1365
|
-
patch: (patch, oldValue) => patch$5(patch, oldValue, differ)
|
|
1366
|
-
});
|
|
1367
|
-
/** @internal */
|
|
1368
|
-
const update$3 = () => updateWith((_, a) => a);
|
|
1369
|
-
/** @internal */
|
|
1370
|
-
const updateWith = f => make$n({
|
|
1371
|
-
empty: identity,
|
|
1372
|
-
combine: (first, second) => {
|
|
1373
|
-
if (first === identity) {
|
|
1374
|
-
return second;
|
|
1375
|
-
}
|
|
1376
|
-
if (second === identity) {
|
|
1377
|
-
return first;
|
|
1378
|
-
}
|
|
1379
|
-
return a => second(first(a));
|
|
1380
|
-
},
|
|
1381
|
-
diff: (oldValue, newValue) => {
|
|
1382
|
-
if (equals$1(oldValue, newValue)) {
|
|
1383
|
-
return identity;
|
|
1384
|
-
}
|
|
1385
|
-
return constant(newValue);
|
|
1386
|
-
},
|
|
1387
|
-
patch: (patch, oldValue) => f(oldValue, patch(oldValue))
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
|
-
/** @internal */
|
|
1391
|
-
const BIT_MASK = 0xff;
|
|
1392
|
-
/** @internal */
|
|
1393
|
-
const BIT_SHIFT = 0x08;
|
|
1394
|
-
/** @internal */
|
|
1395
|
-
const active = patch => patch & BIT_MASK;
|
|
1396
|
-
/** @internal */
|
|
1397
|
-
const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
|
|
1398
|
-
/** @internal */
|
|
1399
|
-
const make$m = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
|
|
1400
|
-
/** @internal */
|
|
1401
|
-
const empty$9 = /*#__PURE__*/make$m(0, 0);
|
|
1402
|
-
/** @internal */
|
|
1403
|
-
const enable$2 = flag => make$m(flag, flag);
|
|
1404
|
-
/** @internal */
|
|
1405
|
-
const disable$1 = flag => make$m(flag, 0);
|
|
1406
|
-
/** @internal */
|
|
1407
|
-
const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$m(active(self) & ~flag, enabled(self)));
|
|
1408
|
-
/** @internal */
|
|
1409
|
-
const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
|
|
1410
|
-
/** @internal */
|
|
1411
|
-
const invert = n => ~n >>> 0 & BIT_MASK;
|
|
1412
|
-
|
|
1413
|
-
/** @internal */
|
|
1414
|
-
const None$1 = 0;
|
|
1415
|
-
/** @internal */
|
|
1416
|
-
const Interruption = 1 << 0;
|
|
1417
|
-
/** @internal */
|
|
1418
|
-
const OpSupervision = 1 << 1;
|
|
1419
|
-
/** @internal */
|
|
1420
|
-
const RuntimeMetrics = 1 << 2;
|
|
1421
|
-
/** @internal */
|
|
1422
|
-
const WindDown = 1 << 4;
|
|
1423
|
-
/** @internal */
|
|
1424
|
-
const CooperativeYielding = 1 << 5;
|
|
1425
|
-
/** @internal */
|
|
1426
|
-
const cooperativeYielding = self => isEnabled(self, CooperativeYielding);
|
|
1427
|
-
/** @internal */
|
|
1428
|
-
const enable$1 = /*#__PURE__*/dual(2, (self, flag) => self | flag);
|
|
1429
|
-
/** @internal */
|
|
1430
|
-
const interruptible$2 = self => interruption(self) && !windDown(self);
|
|
1431
|
-
/** @internal */
|
|
1432
|
-
const interruption = self => isEnabled(self, Interruption);
|
|
1433
|
-
/** @internal */
|
|
1434
|
-
const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
|
|
1435
|
-
/** @internal */
|
|
1436
|
-
const make$l = (...flags) => flags.reduce((a, b) => a | b, 0);
|
|
1437
|
-
/** @internal */
|
|
1438
|
-
const none$1 = /*#__PURE__*/make$l(None$1);
|
|
1439
|
-
/** @internal */
|
|
1440
|
-
const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
|
|
1441
|
-
const windDown = self => isEnabled(self, WindDown);
|
|
1442
|
-
/** @internal */
|
|
1443
|
-
const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$m(self ^ that, that));
|
|
1444
|
-
/** @internal */
|
|
1445
|
-
const patch$4 = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
|
|
1446
|
-
/** @internal */
|
|
1447
|
-
const differ$1 = /*#__PURE__*/make$n({
|
|
1448
|
-
empty: empty$9,
|
|
1449
|
-
diff: (oldValue, newValue) => diff$3(oldValue, newValue),
|
|
1450
|
-
combine: (first, second) => andThen(second)(first),
|
|
1451
|
-
patch: (_patch, oldValue) => patch$4(oldValue, _patch)
|
|
1452
|
-
});
|
|
1453
|
-
|
|
1454
|
-
/**
|
|
1455
|
-
* @since 2.0.0
|
|
1456
|
-
*/
|
|
1457
|
-
/**
|
|
1458
|
-
* Creates a `RuntimeFlagsPatch` describing enabling the provided `RuntimeFlag`.
|
|
1459
|
-
*
|
|
1460
|
-
* @since 2.0.0
|
|
1461
|
-
* @category constructors
|
|
1462
|
-
*/
|
|
1463
|
-
const enable = enable$2;
|
|
1464
|
-
/**
|
|
1465
|
-
* Creates a `RuntimeFlagsPatch` describing disabling the provided `RuntimeFlag`.
|
|
1466
|
-
*
|
|
1467
|
-
* @since 2.0.0
|
|
1468
|
-
* @category constructors
|
|
1469
|
-
*/
|
|
1470
|
-
const disable = disable$1;
|
|
1471
|
-
/**
|
|
1472
|
-
* Creates a `RuntimeFlagsPatch` which describes exclusion of the specified
|
|
1473
|
-
* `RuntimeFlag` from the set of `RuntimeFlags`.
|
|
1474
|
-
*
|
|
1475
|
-
* @category utils
|
|
1476
|
-
* @since 2.0.0
|
|
1477
|
-
*/
|
|
1478
|
-
const exclude = exclude$1;
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* Combines this collection of blocked requests with the specified collection
|
|
1482
|
-
* of blocked requests, in parallel.
|
|
1483
|
-
*
|
|
1484
|
-
* @internal
|
|
1485
|
-
*/
|
|
1486
|
-
const par = (self, that) => ({
|
|
1487
|
-
_tag: "Par",
|
|
1488
|
-
left: self,
|
|
1489
|
-
right: that
|
|
1490
|
-
});
|
|
1491
|
-
/**
|
|
1492
|
-
* Combines this collection of blocked requests with the specified collection
|
|
1493
|
-
* of blocked requests, in sequence.
|
|
1494
|
-
*
|
|
1495
|
-
* @internal
|
|
1496
|
-
*/
|
|
1497
|
-
const seq = (self, that) => ({
|
|
1498
|
-
_tag: "Seq",
|
|
1499
|
-
left: self,
|
|
1500
|
-
right: that
|
|
1501
|
-
});
|
|
1502
|
-
/**
|
|
1503
|
-
* Flattens a collection of blocked requests into a collection of pipelined
|
|
1504
|
-
* and batched requests that can be submitted for execution.
|
|
1505
|
-
*
|
|
1506
|
-
* @internal
|
|
1507
|
-
*/
|
|
1508
|
-
const flatten$4 = self => {
|
|
1509
|
-
let current = of$1(self);
|
|
1510
|
-
let updated = empty$d();
|
|
1511
|
-
// eslint-disable-next-line no-constant-condition
|
|
1512
|
-
while (1) {
|
|
1513
|
-
const [parallel, sequential] = reduce(current, [parallelCollectionEmpty(), empty$d()], ([parallel, sequential], blockedRequest) => {
|
|
1514
|
-
const [par, seq] = step$1(blockedRequest);
|
|
1515
|
-
return [parallelCollectionCombine(parallel, par), appendAll(sequential, seq)];
|
|
1516
|
-
});
|
|
1517
|
-
updated = merge(updated, parallel);
|
|
1518
|
-
if (isNil(sequential)) {
|
|
1519
|
-
return reverse(updated);
|
|
1520
|
-
}
|
|
1521
|
-
current = sequential;
|
|
1522
|
-
}
|
|
1523
|
-
throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
1524
|
-
};
|
|
1525
|
-
/**
|
|
1526
|
-
* Takes one step in evaluating a collection of blocked requests, returning a
|
|
1527
|
-
* collection of blocked requests that can be performed in parallel and a list
|
|
1528
|
-
* of blocked requests that must be performed sequentially after those
|
|
1529
|
-
* requests.
|
|
1530
|
-
*/
|
|
1531
|
-
const step$1 = requests => {
|
|
1532
|
-
let current = requests;
|
|
1533
|
-
let parallel = parallelCollectionEmpty();
|
|
1534
|
-
let stack = empty$d();
|
|
1535
|
-
let sequential = empty$d();
|
|
1536
|
-
// eslint-disable-next-line no-constant-condition
|
|
1537
|
-
while (1) {
|
|
1538
|
-
switch (current._tag) {
|
|
1539
|
-
case "Empty":
|
|
1540
|
-
{
|
|
1541
|
-
if (isNil(stack)) {
|
|
1542
|
-
return [parallel, sequential];
|
|
1543
|
-
}
|
|
1544
|
-
current = stack.head;
|
|
1545
|
-
stack = stack.tail;
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
case "Par":
|
|
1549
|
-
{
|
|
1550
|
-
stack = cons(current.right, stack);
|
|
1551
|
-
current = current.left;
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
case "Seq":
|
|
1555
|
-
{
|
|
1556
|
-
const left = current.left;
|
|
1557
|
-
const right = current.right;
|
|
1558
|
-
switch (left._tag) {
|
|
1559
|
-
case "Empty":
|
|
1560
|
-
{
|
|
1561
|
-
current = right;
|
|
1562
|
-
break;
|
|
1563
|
-
}
|
|
1564
|
-
case "Par":
|
|
1565
|
-
{
|
|
1566
|
-
const l = left.left;
|
|
1567
|
-
const r = left.right;
|
|
1568
|
-
current = par(seq(l, right), seq(r, right));
|
|
1569
|
-
break;
|
|
1570
|
-
}
|
|
1571
|
-
case "Seq":
|
|
1572
|
-
{
|
|
1573
|
-
const l = left.left;
|
|
1574
|
-
const r = left.right;
|
|
1575
|
-
current = seq(l, seq(r, right));
|
|
1576
|
-
break;
|
|
1577
|
-
}
|
|
1578
|
-
case "Single":
|
|
1579
|
-
{
|
|
1580
|
-
current = left;
|
|
1581
|
-
sequential = cons(right, sequential);
|
|
1582
|
-
break;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
break;
|
|
1586
|
-
}
|
|
1587
|
-
case "Single":
|
|
1588
|
-
{
|
|
1589
|
-
parallel = parallelCollectionAdd(parallel, current);
|
|
1590
|
-
if (isNil(stack)) {
|
|
1591
|
-
return [parallel, sequential];
|
|
1592
|
-
}
|
|
1593
|
-
current = stack.head;
|
|
1594
|
-
stack = stack.tail;
|
|
1595
|
-
break;
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
1600
|
-
};
|
|
1601
|
-
/**
|
|
1602
|
-
* Merges a collection of requests that must be executed sequentially with a
|
|
1603
|
-
* collection of requests that can be executed in parallel. If the collections
|
|
1604
|
-
* are both from the same single data source then the requests can be
|
|
1605
|
-
* pipelined while preserving ordering guarantees.
|
|
1606
|
-
*/
|
|
1607
|
-
const merge = (sequential, parallel) => {
|
|
1608
|
-
if (isNil(sequential)) {
|
|
1609
|
-
return of$1(parallelCollectionToSequentialCollection(parallel));
|
|
1610
|
-
}
|
|
1611
|
-
if (parallelCollectionIsEmpty(parallel)) {
|
|
1612
|
-
return sequential;
|
|
1613
|
-
}
|
|
1614
|
-
const seqHeadKeys = sequentialCollectionKeys(sequential.head);
|
|
1615
|
-
const parKeys = parallelCollectionKeys(parallel);
|
|
1616
|
-
if (seqHeadKeys.length === 1 && parKeys.length === 1 && equals$1(seqHeadKeys[0], parKeys[0])) {
|
|
1617
|
-
return cons(sequentialCollectionCombine(sequential.head, parallelCollectionToSequentialCollection(parallel)), sequential.tail);
|
|
1618
|
-
}
|
|
1619
|
-
return cons(parallelCollectionToSequentialCollection(parallel), sequential);
|
|
1620
|
-
};
|
|
1621
|
-
/** @internal */
|
|
1622
|
-
const RequestBlockParallelTypeId = /*#__PURE__*/Symbol.for("effect/RequestBlock/RequestBlockParallel");
|
|
1623
|
-
const parallelVariance = {
|
|
1624
|
-
/* c8 ignore next */
|
|
1625
|
-
_R: _ => _
|
|
1626
|
-
};
|
|
1627
|
-
class ParallelImpl {
|
|
1628
|
-
map;
|
|
1629
|
-
[RequestBlockParallelTypeId] = parallelVariance;
|
|
1630
|
-
constructor(map) {
|
|
1631
|
-
this.map = map;
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
/** @internal */
|
|
1635
|
-
const parallelCollectionEmpty = () => new ParallelImpl(empty$e());
|
|
1636
|
-
/** @internal */
|
|
1637
|
-
const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$9(_, append$1(blockedRequest.blockedRequest)), () => of$2(blockedRequest.blockedRequest))));
|
|
1638
|
-
/** @internal */
|
|
1639
|
-
const parallelCollectionCombine = (self, that) => new ParallelImpl(reduce$1(self.map, that.map, (map, value, key) => set$2(map, key, match$6(get$4(map, key), {
|
|
1640
|
-
onNone: () => value,
|
|
1641
|
-
onSome: other => appendAll$1(value, other)
|
|
1642
|
-
}))));
|
|
1643
|
-
/** @internal */
|
|
1644
|
-
const parallelCollectionIsEmpty = self => isEmpty$4(self.map);
|
|
1645
|
-
/** @internal */
|
|
1646
|
-
const parallelCollectionKeys = self => Array.from(keys(self.map));
|
|
1647
|
-
/** @internal */
|
|
1648
|
-
const parallelCollectionToSequentialCollection = self => sequentialCollectionMake(map$7(self.map, x => of$2(x)));
|
|
1649
|
-
// TODO
|
|
1650
|
-
// /** @internal */
|
|
1651
|
-
// export const parallelCollectionToChunk = <R>(
|
|
1652
|
-
// self: ParallelCollection<R>
|
|
1653
|
-
// ): Array<[RequestResolver.RequestResolver<unknown, R>, Array<Request.Entry<unknown>>]> => Array.from(self.map) as any
|
|
1654
|
-
/** @internal */
|
|
1655
|
-
const SequentialCollectionTypeId = /*#__PURE__*/Symbol.for("effect/RequestBlock/RequestBlockSequential");
|
|
1656
|
-
const sequentialVariance = {
|
|
1657
|
-
/* c8 ignore next */
|
|
1658
|
-
_R: _ => _
|
|
1659
|
-
};
|
|
1660
|
-
class SequentialImpl {
|
|
1661
|
-
map;
|
|
1662
|
-
[SequentialCollectionTypeId] = sequentialVariance;
|
|
1663
|
-
constructor(map) {
|
|
1664
|
-
this.map = map;
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
/** @internal */
|
|
1668
|
-
const sequentialCollectionMake = map => new SequentialImpl(map);
|
|
1669
|
-
/** @internal */
|
|
1670
|
-
const sequentialCollectionCombine = (self, that) => new SequentialImpl(reduce$1(that.map, self.map, (map, value, key) => set$2(map, key, match$6(get$4(map, key), {
|
|
1671
|
-
onNone: () => empty$g(),
|
|
1672
|
-
onSome: a => appendAll$1(a, value)
|
|
1673
|
-
}))));
|
|
1674
|
-
/** @internal */
|
|
1675
|
-
const sequentialCollectionKeys = self => Array.from(keys(self.map));
|
|
1676
|
-
/** @internal */
|
|
1677
|
-
const sequentialCollectionToChunk = self => Array.from(self.map);
|
|
1678
|
-
|
|
1679
|
-
/** @internal */
|
|
1680
|
-
const OP_STATE_PENDING = "Pending";
|
|
1681
|
-
/** @internal */
|
|
1682
|
-
const OP_STATE_DONE$1 = "Done";
|
|
1683
|
-
|
|
1684
|
-
/** @internal */
|
|
1685
|
-
const DeferredSymbolKey = "effect/Deferred";
|
|
1686
|
-
/** @internal */
|
|
1687
|
-
const DeferredTypeId = /*#__PURE__*/Symbol.for(DeferredSymbolKey);
|
|
1688
|
-
/** @internal */
|
|
1689
|
-
const deferredVariance = {
|
|
1690
|
-
/* c8 ignore next */
|
|
1691
|
-
_E: _ => _,
|
|
1692
|
-
/* c8 ignore next */
|
|
1693
|
-
_A: _ => _
|
|
1694
|
-
};
|
|
1695
|
-
/** @internal */
|
|
1696
|
-
const pending = joiners => {
|
|
1697
|
-
return {
|
|
1698
|
-
_tag: OP_STATE_PENDING,
|
|
1699
|
-
joiners
|
|
1700
|
-
};
|
|
1701
|
-
};
|
|
1702
|
-
/** @internal */
|
|
1703
|
-
const done$4 = effect => {
|
|
1704
|
-
return {
|
|
1705
|
-
_tag: OP_STATE_DONE$1,
|
|
1706
|
-
effect
|
|
1707
|
-
};
|
|
1708
|
-
};
|
|
1709
|
-
|
|
1710
|
-
/** @internal */
|
|
1711
|
-
class SingleShotGen {
|
|
1712
|
-
self;
|
|
1713
|
-
called = false;
|
|
1714
|
-
constructor(self) {
|
|
1715
|
-
this.self = self;
|
|
1716
|
-
}
|
|
1717
|
-
next(a) {
|
|
1718
|
-
return this.called ? {
|
|
1719
|
-
value: a,
|
|
1720
|
-
done: true
|
|
1721
|
-
} : (this.called = true, {
|
|
1722
|
-
value: this.self,
|
|
1723
|
-
done: false
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
return(a) {
|
|
1727
|
-
return {
|
|
1728
|
-
value: a,
|
|
1729
|
-
done: true
|
|
1730
|
-
};
|
|
1731
|
-
}
|
|
1732
|
-
throw(e) {
|
|
1733
|
-
throw e;
|
|
1734
|
-
}
|
|
1735
|
-
[Symbol.iterator]() {
|
|
1736
|
-
return new SingleShotGen(this.self);
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
// -----------------------------------------------------------------------------
|
|
1741
|
-
// Effect
|
|
1742
|
-
// -----------------------------------------------------------------------------
|
|
1743
|
-
/**
|
|
1744
|
-
* @internal
|
|
1745
|
-
*/
|
|
1746
|
-
const blocked = (blockedRequests, _continue) => {
|
|
1747
|
-
const effect = new EffectPrimitive("Blocked");
|
|
1748
|
-
effect.effect_instruction_i0 = blockedRequests;
|
|
1749
|
-
effect.effect_instruction_i1 = _continue;
|
|
1750
|
-
return effect;
|
|
1751
|
-
};
|
|
1752
|
-
/**
|
|
1753
|
-
* @internal
|
|
1754
|
-
*/
|
|
1755
|
-
const runRequestBlock = blockedRequests => {
|
|
1756
|
-
const effect = new EffectPrimitive("RunBlocked");
|
|
1757
|
-
effect.effect_instruction_i0 = blockedRequests;
|
|
1758
|
-
return effect;
|
|
1759
|
-
};
|
|
1760
|
-
/** @internal */
|
|
1761
|
-
const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
|
|
1762
|
-
/** @internal */
|
|
1763
|
-
class RevertFlags {
|
|
1764
|
-
patch;
|
|
1765
|
-
op;
|
|
1766
|
-
_op = OP_REVERT_FLAGS;
|
|
1767
|
-
constructor(patch, op) {
|
|
1768
|
-
this.patch = patch;
|
|
1769
|
-
this.op = op;
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
class EffectPrimitive {
|
|
1773
|
-
_op;
|
|
1774
|
-
effect_instruction_i0 = undefined;
|
|
1775
|
-
effect_instruction_i1 = undefined;
|
|
1776
|
-
effect_instruction_i2 = undefined;
|
|
1777
|
-
trace = undefined;
|
|
1778
|
-
[EffectTypeId] = effectVariance;
|
|
1779
|
-
constructor(_op) {
|
|
1780
|
-
this._op = _op;
|
|
1781
|
-
}
|
|
1782
|
-
[symbol](that) {
|
|
1783
|
-
return this === that;
|
|
1784
|
-
}
|
|
1785
|
-
[symbol$1]() {
|
|
1786
|
-
return cached(this, random(this));
|
|
1787
|
-
}
|
|
1788
|
-
pipe() {
|
|
1789
|
-
return pipeArguments(this, arguments);
|
|
1790
|
-
}
|
|
1791
|
-
toJSON() {
|
|
1792
|
-
return {
|
|
1793
|
-
_id: "Effect",
|
|
1794
|
-
_op: this._op,
|
|
1795
|
-
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
1796
|
-
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
1797
|
-
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
1798
|
-
};
|
|
1799
|
-
}
|
|
1800
|
-
toString() {
|
|
1801
|
-
return format$1(this.toJSON());
|
|
1802
|
-
}
|
|
1803
|
-
[NodeInspectSymbol]() {
|
|
1804
|
-
return this.toJSON();
|
|
1805
|
-
}
|
|
1806
|
-
[Symbol.iterator]() {
|
|
1807
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
/** @internal */
|
|
1811
|
-
class EffectPrimitiveFailure {
|
|
1812
|
-
_op;
|
|
1813
|
-
effect_instruction_i0 = undefined;
|
|
1814
|
-
effect_instruction_i1 = undefined;
|
|
1815
|
-
effect_instruction_i2 = undefined;
|
|
1816
|
-
trace = undefined;
|
|
1817
|
-
[EffectTypeId] = effectVariance;
|
|
1818
|
-
constructor(_op) {
|
|
1819
|
-
this._op = _op;
|
|
1820
|
-
// @ts-expect-error
|
|
1821
|
-
this._tag = _op;
|
|
1822
|
-
}
|
|
1823
|
-
[symbol](that) {
|
|
1824
|
-
return exitIsExit(that) && that._op === "Failure" &&
|
|
1825
|
-
// @ts-expect-error
|
|
1826
|
-
equals$1(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
1827
|
-
}
|
|
1828
|
-
[symbol$1]() {
|
|
1829
|
-
return pipe(
|
|
1830
|
-
// @ts-expect-error
|
|
1831
|
-
string(this._tag),
|
|
1832
|
-
// @ts-expect-error
|
|
1833
|
-
combine$7(hash(this.effect_instruction_i0)), cached(this));
|
|
1834
|
-
}
|
|
1835
|
-
get cause() {
|
|
1836
|
-
return this.effect_instruction_i0;
|
|
1837
|
-
}
|
|
1838
|
-
pipe() {
|
|
1839
|
-
return pipeArguments(this, arguments);
|
|
1840
|
-
}
|
|
1841
|
-
toJSON() {
|
|
1842
|
-
return {
|
|
1843
|
-
_id: "Exit",
|
|
1844
|
-
_tag: this._op,
|
|
1845
|
-
cause: this.cause.toJSON()
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
toString() {
|
|
1849
|
-
return format$1(this.toJSON());
|
|
1850
|
-
}
|
|
1851
|
-
[NodeInspectSymbol]() {
|
|
1852
|
-
return this.toJSON();
|
|
1853
|
-
}
|
|
1854
|
-
[Symbol.iterator]() {
|
|
1855
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
/** @internal */
|
|
1859
|
-
class EffectPrimitiveSuccess {
|
|
1860
|
-
_op;
|
|
1861
|
-
effect_instruction_i0 = undefined;
|
|
1862
|
-
effect_instruction_i1 = undefined;
|
|
1863
|
-
effect_instruction_i2 = undefined;
|
|
1864
|
-
trace = undefined;
|
|
1865
|
-
[EffectTypeId] = effectVariance;
|
|
1866
|
-
constructor(_op) {
|
|
1867
|
-
this._op = _op;
|
|
1868
|
-
// @ts-expect-error
|
|
1869
|
-
this._tag = _op;
|
|
1870
|
-
}
|
|
1871
|
-
[symbol](that) {
|
|
1872
|
-
return exitIsExit(that) && that._op === "Success" &&
|
|
1873
|
-
// @ts-expect-error
|
|
1874
|
-
equals$1(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
1875
|
-
}
|
|
1876
|
-
[symbol$1]() {
|
|
1877
|
-
return pipe(
|
|
1878
|
-
// @ts-expect-error
|
|
1879
|
-
string(this._tag),
|
|
1880
|
-
// @ts-expect-error
|
|
1881
|
-
combine$7(hash(this.effect_instruction_i0)), cached(this));
|
|
1882
|
-
}
|
|
1883
|
-
get value() {
|
|
1884
|
-
return this.effect_instruction_i0;
|
|
1885
|
-
}
|
|
1886
|
-
pipe() {
|
|
1887
|
-
return pipeArguments(this, arguments);
|
|
1888
|
-
}
|
|
1889
|
-
toJSON() {
|
|
1890
|
-
return {
|
|
1891
|
-
_id: "Exit",
|
|
1892
|
-
_tag: this._op,
|
|
1893
|
-
value: toJSON(this.value)
|
|
1894
|
-
};
|
|
1895
|
-
}
|
|
1896
|
-
toString() {
|
|
1897
|
-
return format$1(this.toJSON());
|
|
1898
|
-
}
|
|
1899
|
-
[NodeInspectSymbol]() {
|
|
1900
|
-
return this.toJSON();
|
|
1901
|
-
}
|
|
1902
|
-
[Symbol.iterator]() {
|
|
1903
|
-
return new SingleShotGen(new YieldWrap(this));
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
/** @internal */
|
|
1907
|
-
const isEffect$1 = u => hasProperty(u, EffectTypeId);
|
|
1908
|
-
/* @internal */
|
|
1909
|
-
const withFiberRuntime$1 = withRuntime => {
|
|
1910
|
-
const effect = new EffectPrimitive(OP_WITH_RUNTIME);
|
|
1911
|
-
effect.effect_instruction_i0 = withRuntime;
|
|
1912
|
-
return effect;
|
|
1913
|
-
};
|
|
1914
|
-
/* @internal */
|
|
1915
|
-
const acquireUseRelease$1 = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$3(acquire, a => flatMap$3(exit$1(suspend$3(() => restore(use(a)))), exit => {
|
|
1916
|
-
return suspend$3(() => release(a, exit)).pipe(matchCauseEffect$1({
|
|
1917
|
-
onFailure: cause => {
|
|
1918
|
-
switch (exit._tag) {
|
|
1919
|
-
case OP_FAILURE:
|
|
1920
|
-
return failCause$6(sequential$2(exit.effect_instruction_i0, cause));
|
|
1921
|
-
case OP_SUCCESS:
|
|
1922
|
-
return failCause$6(cause);
|
|
1923
|
-
}
|
|
1924
|
-
},
|
|
1925
|
-
onSuccess: () => exit
|
|
1926
|
-
}));
|
|
1927
|
-
}))));
|
|
1928
|
-
/* @internal */
|
|
1929
|
-
const as$1 = /*#__PURE__*/dual(2, (self, value) => flatMap$3(self, () => succeed$4(value)));
|
|
1930
|
-
/* @internal */
|
|
1931
|
-
const asVoid$1 = self => as$1(self, void 0);
|
|
1932
|
-
/* @internal */
|
|
1933
|
-
const custom = function () {
|
|
1934
|
-
const wrapper = new EffectPrimitive(OP_COMMIT);
|
|
1935
|
-
switch (arguments.length) {
|
|
1936
|
-
case 2:
|
|
1937
|
-
{
|
|
1938
|
-
wrapper.effect_instruction_i0 = arguments[0];
|
|
1939
|
-
wrapper.commit = arguments[1];
|
|
1940
|
-
break;
|
|
1941
|
-
}
|
|
1942
|
-
case 3:
|
|
1943
|
-
{
|
|
1944
|
-
wrapper.effect_instruction_i0 = arguments[0];
|
|
1945
|
-
wrapper.effect_instruction_i1 = arguments[1];
|
|
1946
|
-
wrapper.commit = arguments[2];
|
|
1947
|
-
break;
|
|
1948
|
-
}
|
|
1949
|
-
case 4:
|
|
1950
|
-
{
|
|
1951
|
-
wrapper.effect_instruction_i0 = arguments[0];
|
|
1952
|
-
wrapper.effect_instruction_i1 = arguments[1];
|
|
1953
|
-
wrapper.effect_instruction_i2 = arguments[2];
|
|
1954
|
-
wrapper.commit = arguments[3];
|
|
1955
|
-
break;
|
|
1956
|
-
}
|
|
1957
|
-
default:
|
|
1958
|
-
{
|
|
1959
|
-
throw new Error(getBugErrorMessage("you're not supposed to end up here"));
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
return wrapper;
|
|
1963
|
-
};
|
|
1964
|
-
/* @internal */
|
|
1965
|
-
const unsafeAsync = (register, blockingOn = none$2) => {
|
|
1966
|
-
const effect = new EffectPrimitive(OP_ASYNC);
|
|
1967
|
-
let cancelerRef = undefined;
|
|
1968
|
-
effect.effect_instruction_i0 = resume => {
|
|
1969
|
-
cancelerRef = register(resume);
|
|
1970
|
-
};
|
|
1971
|
-
effect.effect_instruction_i1 = blockingOn;
|
|
1972
|
-
return onInterrupt(effect, _ => isEffect$1(cancelerRef) ? cancelerRef : void_$2);
|
|
1973
|
-
};
|
|
1974
|
-
/* @internal */
|
|
1975
|
-
const asyncInterrupt = (register, blockingOn = none$2) => suspend$3(() => unsafeAsync(register, blockingOn));
|
|
1976
|
-
const async_ = (resume, blockingOn = none$2) => {
|
|
1977
|
-
return custom(resume, function () {
|
|
1978
|
-
let backingResume = undefined;
|
|
1979
|
-
let pendingEffect = undefined;
|
|
1980
|
-
function proxyResume(effect) {
|
|
1981
|
-
if (backingResume) {
|
|
1982
|
-
backingResume(effect);
|
|
1983
|
-
} else if (pendingEffect === undefined) {
|
|
1984
|
-
pendingEffect = effect;
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
const effect = new EffectPrimitive(OP_ASYNC);
|
|
1988
|
-
effect.effect_instruction_i0 = resume => {
|
|
1989
|
-
backingResume = resume;
|
|
1990
|
-
if (pendingEffect) {
|
|
1991
|
-
resume(pendingEffect);
|
|
1992
|
-
}
|
|
1993
|
-
};
|
|
1994
|
-
effect.effect_instruction_i1 = blockingOn;
|
|
1995
|
-
let cancelerRef = undefined;
|
|
1996
|
-
let controllerRef = undefined;
|
|
1997
|
-
if (this.effect_instruction_i0.length !== 1) {
|
|
1998
|
-
controllerRef = new AbortController();
|
|
1999
|
-
cancelerRef = internalCall(() => this.effect_instruction_i0(proxyResume, controllerRef.signal));
|
|
2000
|
-
} else {
|
|
2001
|
-
cancelerRef = internalCall(() => this.effect_instruction_i0(proxyResume));
|
|
2002
|
-
}
|
|
2003
|
-
return cancelerRef || controllerRef ? onInterrupt(effect, _ => {
|
|
2004
|
-
if (controllerRef) {
|
|
2005
|
-
controllerRef.abort();
|
|
2006
|
-
}
|
|
2007
|
-
return cancelerRef ?? void_$2;
|
|
2008
|
-
}) : effect;
|
|
2009
|
-
});
|
|
2010
|
-
};
|
|
2011
|
-
/* @internal */
|
|
2012
|
-
const catchAllCause$1 = /*#__PURE__*/dual(2, (self, f) => {
|
|
2013
|
-
const effect = new EffectPrimitive(OP_ON_FAILURE);
|
|
2014
|
-
effect.effect_instruction_i0 = self;
|
|
2015
|
-
effect.effect_instruction_i1 = f;
|
|
2016
|
-
return effect;
|
|
2017
|
-
});
|
|
2018
|
-
/* @internal */
|
|
2019
|
-
const catchAll$1 = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
|
|
2020
|
-
onFailure: f,
|
|
2021
|
-
onSuccess: succeed$4
|
|
2022
|
-
}));
|
|
2023
|
-
const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
|
|
2024
|
-
/* @internal */
|
|
2025
|
-
const capture = (obj, span) => {
|
|
2026
|
-
if (isSome(span)) {
|
|
2027
|
-
return new Proxy(obj, {
|
|
2028
|
-
has(target, p) {
|
|
2029
|
-
return p === spanSymbol || p === originalSymbol || p in target;
|
|
2030
|
-
},
|
|
2031
|
-
get(target, p) {
|
|
2032
|
-
if (p === spanSymbol) {
|
|
2033
|
-
return span.value;
|
|
2034
|
-
}
|
|
2035
|
-
if (p === originalSymbol) {
|
|
2036
|
-
return obj;
|
|
2037
|
-
}
|
|
2038
|
-
// @ts-expect-error
|
|
2039
|
-
return target[p];
|
|
2040
|
-
}
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
return obj;
|
|
2044
|
-
};
|
|
2045
|
-
/* @internal */
|
|
2046
|
-
const die$2 = defect => isObject(defect) && !(spanSymbol in defect) ? withFiberRuntime$1(fiber => failCause$6(die$3(capture(defect, currentSpanFromFiber(fiber))))) : failCause$6(die$3(defect));
|
|
2047
|
-
/* @internal */
|
|
2048
|
-
const dieMessage$1 = message => failCauseSync$1(() => die$3(new RuntimeException(message)));
|
|
2049
|
-
/* @internal */
|
|
2050
|
-
const either = self => matchEffect(self, {
|
|
2051
|
-
onFailure: e => succeed$4(left(e)),
|
|
2052
|
-
onSuccess: a => succeed$4(right(a))
|
|
2053
|
-
});
|
|
2054
|
-
/* @internal */
|
|
2055
|
-
const exit$1 = self => matchCause$1(self, {
|
|
2056
|
-
onFailure: exitFailCause,
|
|
2057
|
-
onSuccess: exitSucceed
|
|
2058
|
-
});
|
|
2059
|
-
/* @internal */
|
|
2060
|
-
const fail$4 = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime$1(fiber => failCause$6(fail$5(capture(error, currentSpanFromFiber(fiber))))) : failCause$6(fail$5(error));
|
|
2061
|
-
/* @internal */
|
|
2062
|
-
const failSync = evaluate => flatMap$3(sync$2(evaluate), fail$4);
|
|
2063
|
-
/* @internal */
|
|
2064
|
-
const failCause$6 = cause => {
|
|
2065
|
-
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
2066
|
-
effect.effect_instruction_i0 = cause;
|
|
2067
|
-
return effect;
|
|
2068
|
-
};
|
|
2069
|
-
/* @internal */
|
|
2070
|
-
const failCauseSync$1 = evaluate => flatMap$3(sync$2(evaluate), failCause$6);
|
|
2071
|
-
/* @internal */
|
|
2072
|
-
const fiberId = /*#__PURE__*/withFiberRuntime$1(state => succeed$4(state.id()));
|
|
2073
|
-
/* @internal */
|
|
2074
|
-
const fiberIdWith$1 = f => withFiberRuntime$1(state => f(state.id()));
|
|
2075
|
-
/* @internal */
|
|
2076
|
-
const flatMap$3 = /*#__PURE__*/dual(2, (self, f) => {
|
|
2077
|
-
const effect = new EffectPrimitive(OP_ON_SUCCESS);
|
|
2078
|
-
effect.effect_instruction_i0 = self;
|
|
2079
|
-
effect.effect_instruction_i1 = f;
|
|
2080
|
-
return effect;
|
|
2081
|
-
});
|
|
2082
|
-
/* @internal */
|
|
2083
|
-
const step = self => {
|
|
2084
|
-
const effect = new EffectPrimitive("OnStep");
|
|
2085
|
-
effect.effect_instruction_i0 = self;
|
|
2086
|
-
return effect;
|
|
2087
|
-
};
|
|
2088
|
-
/* @internal */
|
|
2089
|
-
const flatten$3 = self => flatMap$3(self, identity);
|
|
2090
|
-
/* @internal */
|
|
2091
|
-
const matchCause$1 = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
|
|
2092
|
-
onFailure: cause => succeed$4(options.onFailure(cause)),
|
|
2093
|
-
onSuccess: a => succeed$4(options.onSuccess(a))
|
|
2094
|
-
}));
|
|
2095
|
-
/* @internal */
|
|
2096
|
-
const matchCauseEffect$1 = /*#__PURE__*/dual(2, (self, options) => {
|
|
2097
|
-
const effect = new EffectPrimitive(OP_ON_SUCCESS_AND_FAILURE);
|
|
2098
|
-
effect.effect_instruction_i0 = self;
|
|
2099
|
-
effect.effect_instruction_i1 = options.onFailure;
|
|
2100
|
-
effect.effect_instruction_i2 = options.onSuccess;
|
|
2101
|
-
return effect;
|
|
2102
|
-
});
|
|
2103
|
-
/* @internal */
|
|
2104
|
-
const matchEffect = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
|
|
2105
|
-
onFailure: cause => {
|
|
2106
|
-
const defects$1 = defects(cause);
|
|
2107
|
-
if (defects$1.length > 0) {
|
|
2108
|
-
return failCause$6(electFailures(cause));
|
|
2109
|
-
}
|
|
2110
|
-
const failures$1 = failures(cause);
|
|
2111
|
-
if (failures$1.length > 0) {
|
|
2112
|
-
return options.onFailure(unsafeHead(failures$1));
|
|
2113
|
-
}
|
|
2114
|
-
return failCause$6(cause);
|
|
2115
|
-
},
|
|
2116
|
-
onSuccess: options.onSuccess
|
|
2117
|
-
}));
|
|
2118
|
-
/* @internal */
|
|
2119
|
-
const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend$3(() => {
|
|
2120
|
-
const arr = fromIterable$3(self);
|
|
2121
|
-
const ret = allocate(arr.length);
|
|
2122
|
-
let i = 0;
|
|
2123
|
-
return as$1(whileLoop({
|
|
2124
|
-
while: () => i < arr.length,
|
|
2125
|
-
body: () => f(arr[i], i),
|
|
2126
|
-
step: b => {
|
|
2127
|
-
ret[i++] = b;
|
|
2128
|
-
}
|
|
2129
|
-
}), ret);
|
|
2130
|
-
}));
|
|
2131
|
-
/* @internal */
|
|
2132
|
-
const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend$3(() => {
|
|
2133
|
-
const arr = fromIterable$3(self);
|
|
2134
|
-
let i = 0;
|
|
2135
|
-
return whileLoop({
|
|
2136
|
-
while: () => i < arr.length,
|
|
2137
|
-
body: () => f(arr[i], i),
|
|
2138
|
-
step: () => {
|
|
2139
|
-
i++;
|
|
2140
|
-
}
|
|
2141
|
-
});
|
|
2142
|
-
}));
|
|
2143
|
-
/* @internal */
|
|
2144
|
-
const interrupt$3 = /*#__PURE__*/flatMap$3(fiberId, fiberId => interruptWith(fiberId));
|
|
2145
|
-
/* @internal */
|
|
2146
|
-
const interruptWith = fiberId => failCause$6(interrupt$4(fiberId));
|
|
2147
|
-
/* @internal */
|
|
2148
|
-
const interruptible$1 = self => {
|
|
2149
|
-
const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
|
|
2150
|
-
effect.effect_instruction_i0 = enable(Interruption);
|
|
2151
|
-
effect.effect_instruction_i1 = () => self;
|
|
2152
|
-
return effect;
|
|
2153
|
-
};
|
|
2154
|
-
/* @internal */
|
|
2155
|
-
const intoDeferred$1 = /*#__PURE__*/dual(2, (self, deferred) => uninterruptibleMask$1(restore => flatMap$3(exit$1(restore(self)), exit => deferredDone(deferred, exit))));
|
|
2156
|
-
/* @internal */
|
|
2157
|
-
const map$6 = /*#__PURE__*/dual(2, (self, f) => flatMap$3(self, a => sync$2(() => f(a))));
|
|
2158
|
-
/* @internal */
|
|
2159
|
-
const mapBoth = /*#__PURE__*/dual(2, (self, options) => matchEffect(self, {
|
|
2160
|
-
onFailure: e => failSync(() => options.onFailure(e)),
|
|
2161
|
-
onSuccess: a => sync$2(() => options.onSuccess(a))
|
|
2162
|
-
}));
|
|
2163
|
-
/* @internal */
|
|
2164
|
-
const mapError$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
|
|
2165
|
-
onFailure: cause => {
|
|
2166
|
-
const either = failureOrCause$1(cause);
|
|
2167
|
-
switch (either._tag) {
|
|
2168
|
-
case "Left":
|
|
2169
|
-
{
|
|
2170
|
-
return failSync(() => f(either.left));
|
|
2171
|
-
}
|
|
2172
|
-
case "Right":
|
|
665
|
+
case "Single":
|
|
2173
666
|
{
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
const result = exitFailCause(cause1);
|
|
2184
|
-
return matchCauseEffect$1(cleanup(result), {
|
|
2185
|
-
onFailure: cause2 => exitFailCause(sequential$2(cause1, cause2)),
|
|
2186
|
-
onSuccess: () => result
|
|
2187
|
-
});
|
|
2188
|
-
},
|
|
2189
|
-
onSuccess: success => {
|
|
2190
|
-
const result = exitSucceed(success);
|
|
2191
|
-
return zipRight$3(cleanup(result), result);
|
|
2192
|
-
}
|
|
2193
|
-
})));
|
|
2194
|
-
/* @internal */
|
|
2195
|
-
const onInterrupt = /*#__PURE__*/dual(2, (self, cleanup) => onExit(self, exitMatch({
|
|
2196
|
-
onFailure: cause => isInterruptedOnly$1(cause) ? asVoid$1(cleanup(interruptors$1(cause))) : void_$2,
|
|
2197
|
-
onSuccess: () => void_$2
|
|
2198
|
-
})));
|
|
2199
|
-
/* @internal */
|
|
2200
|
-
const orDie = self => orDieWith(self, identity);
|
|
2201
|
-
/* @internal */
|
|
2202
|
-
const orDieWith = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
|
|
2203
|
-
onFailure: e => die$2(f(e)),
|
|
2204
|
-
onSuccess: succeed$4
|
|
2205
|
-
}));
|
|
2206
|
-
/* @internal */
|
|
2207
|
-
const succeed$4 = value => {
|
|
2208
|
-
const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
|
|
2209
|
-
effect.effect_instruction_i0 = value;
|
|
2210
|
-
return effect;
|
|
2211
|
-
};
|
|
2212
|
-
/* @internal */
|
|
2213
|
-
const suspend$3 = evaluate => {
|
|
2214
|
-
const effect = new EffectPrimitive(OP_COMMIT);
|
|
2215
|
-
effect.commit = evaluate;
|
|
2216
|
-
return effect;
|
|
2217
|
-
};
|
|
2218
|
-
/* @internal */
|
|
2219
|
-
const sync$2 = thunk => {
|
|
2220
|
-
const effect = new EffectPrimitive(OP_SYNC);
|
|
2221
|
-
effect.effect_instruction_i0 = thunk;
|
|
2222
|
-
return effect;
|
|
2223
|
-
};
|
|
2224
|
-
/* @internal */
|
|
2225
|
-
const tap$1 = /*#__PURE__*/dual(args => args.length === 3 || args.length === 2 && !(isObject(args[1]) && "onlyEffect" in args[1]), (self, f) => flatMap$3(self, a => {
|
|
2226
|
-
const b = typeof f === "function" ? f(a) : f;
|
|
2227
|
-
if (isEffect$1(b)) {
|
|
2228
|
-
return as$1(b, a);
|
|
2229
|
-
} else if (isPromiseLike(b)) {
|
|
2230
|
-
return unsafeAsync(resume => {
|
|
2231
|
-
b.then(_ => resume(succeed$4(a)), e => resume(fail$4(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
|
|
2232
|
-
});
|
|
2233
|
-
}
|
|
2234
|
-
return succeed$4(a);
|
|
2235
|
-
}));
|
|
2236
|
-
/* @internal */
|
|
2237
|
-
const transplant = f => withFiberRuntime$1(state => {
|
|
2238
|
-
const scopeOverride = state.getFiberRef(currentForkScopeOverride);
|
|
2239
|
-
const scope = pipe(scopeOverride, getOrElse(() => state.scope()));
|
|
2240
|
-
return f(fiberRefLocally(currentForkScopeOverride, some(scope)));
|
|
2241
|
-
});
|
|
2242
|
-
/* @internal */
|
|
2243
|
-
const uninterruptible$1 = self => {
|
|
2244
|
-
const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
|
|
2245
|
-
effect.effect_instruction_i0 = disable(Interruption);
|
|
2246
|
-
effect.effect_instruction_i1 = () => self;
|
|
2247
|
-
return effect;
|
|
2248
|
-
};
|
|
2249
|
-
/* @internal */
|
|
2250
|
-
const uninterruptibleMask$1 = f => custom(f, function () {
|
|
2251
|
-
const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
|
|
2252
|
-
effect.effect_instruction_i0 = disable(Interruption);
|
|
2253
|
-
effect.effect_instruction_i1 = oldFlags => interruption(oldFlags) ? internalCall(() => this.effect_instruction_i0(interruptible$1)) : internalCall(() => this.effect_instruction_i0(uninterruptible$1));
|
|
2254
|
-
return effect;
|
|
2255
|
-
});
|
|
2256
|
-
const void_$2 = /*#__PURE__*/succeed$4(void 0);
|
|
2257
|
-
/* @internal */
|
|
2258
|
-
const updateRuntimeFlags = patch => {
|
|
2259
|
-
const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
|
|
2260
|
-
effect.effect_instruction_i0 = patch;
|
|
2261
|
-
effect.effect_instruction_i1 = void 0;
|
|
2262
|
-
return effect;
|
|
2263
|
-
};
|
|
2264
|
-
/* @internal */
|
|
2265
|
-
const whenEffect = /*#__PURE__*/dual(2, (self, condition) => flatMap$3(condition, b => {
|
|
2266
|
-
if (b) {
|
|
2267
|
-
return pipe(self, map$6(some));
|
|
2268
|
-
}
|
|
2269
|
-
return succeed$4(none$4());
|
|
2270
|
-
}));
|
|
2271
|
-
/* @internal */
|
|
2272
|
-
const whileLoop = options => {
|
|
2273
|
-
const effect = new EffectPrimitive(OP_WHILE);
|
|
2274
|
-
effect.effect_instruction_i0 = options.while;
|
|
2275
|
-
effect.effect_instruction_i1 = options.body;
|
|
2276
|
-
effect.effect_instruction_i2 = options.step;
|
|
2277
|
-
return effect;
|
|
2278
|
-
};
|
|
2279
|
-
/* @internal */
|
|
2280
|
-
const fromIterator = iterator => suspend$3(() => {
|
|
2281
|
-
const effect = new EffectPrimitive(OP_ITERATOR);
|
|
2282
|
-
effect.effect_instruction_i0 = iterator();
|
|
2283
|
-
return effect;
|
|
2284
|
-
});
|
|
2285
|
-
/* @internal */
|
|
2286
|
-
const gen$1 = function () {
|
|
2287
|
-
const f = arguments.length === 1 ? arguments[0] : arguments[1].bind(arguments[0]);
|
|
2288
|
-
return fromIterator(() => f(pipe));
|
|
2289
|
-
};
|
|
2290
|
-
/** @internal */
|
|
2291
|
-
const fnUntraced = (body, ...pipeables) => Object.defineProperty(pipeables.length === 0 ? function (...args) {
|
|
2292
|
-
return fromIterator(() => body.apply(this, args));
|
|
2293
|
-
} : function (...args) {
|
|
2294
|
-
let effect = fromIterator(() => body.apply(this, args));
|
|
2295
|
-
for (const x of pipeables) {
|
|
2296
|
-
effect = x(effect, ...args);
|
|
2297
|
-
}
|
|
2298
|
-
return effect;
|
|
2299
|
-
}, "length", {
|
|
2300
|
-
value: body.length,
|
|
2301
|
-
configurable: true
|
|
2302
|
-
});
|
|
2303
|
-
/* @internal */
|
|
2304
|
-
const yieldNow$1 = options => {
|
|
2305
|
-
const effect = new EffectPrimitive(OP_YIELD$1);
|
|
2306
|
-
return typeof options?.priority !== "undefined" ? withSchedulingPriority(effect, options.priority) : effect;
|
|
2307
|
-
};
|
|
2308
|
-
/* @internal */
|
|
2309
|
-
const zip$3 = /*#__PURE__*/dual(2, (self, that) => flatMap$3(self, a => map$6(that, b => [a, b])));
|
|
2310
|
-
/* @internal */
|
|
2311
|
-
const zipLeft$1 = /*#__PURE__*/dual(2, (self, that) => flatMap$3(self, a => as$1(that, a)));
|
|
2312
|
-
/* @internal */
|
|
2313
|
-
const zipRight$3 = /*#__PURE__*/dual(2, (self, that) => flatMap$3(self, () => that));
|
|
2314
|
-
/* @internal */
|
|
2315
|
-
const zipWith$1 = /*#__PURE__*/dual(3, (self, that, f) => flatMap$3(self, a => map$6(that, b => f(a, b))));
|
|
2316
|
-
// -----------------------------------------------------------------------------
|
|
2317
|
-
// Fiber
|
|
2318
|
-
// -----------------------------------------------------------------------------
|
|
2319
|
-
/* @internal */
|
|
2320
|
-
const interruptFiber = self => flatMap$3(fiberId, fiberId => pipe(self, interruptAsFiber(fiberId)));
|
|
2321
|
-
/* @internal */
|
|
2322
|
-
const interruptAsFiber = /*#__PURE__*/dual(2, (self, fiberId) => flatMap$3(self.interruptAsFork(fiberId), () => self.await));
|
|
2323
|
-
// -----------------------------------------------------------------------------
|
|
2324
|
-
// LogLevel
|
|
2325
|
-
// -----------------------------------------------------------------------------
|
|
2326
|
-
/** @internal */
|
|
2327
|
-
const logLevelAll = {
|
|
2328
|
-
_tag: "All",
|
|
2329
|
-
syslog: 0,
|
|
2330
|
-
label: "ALL",
|
|
2331
|
-
ordinal: Number.MIN_SAFE_INTEGER,
|
|
2332
|
-
pipe() {
|
|
2333
|
-
return pipeArguments(this, arguments);
|
|
2334
|
-
}
|
|
2335
|
-
};
|
|
2336
|
-
/** @internal */
|
|
2337
|
-
const logLevelFatal = {
|
|
2338
|
-
_tag: "Fatal",
|
|
2339
|
-
syslog: 2,
|
|
2340
|
-
label: "FATAL",
|
|
2341
|
-
ordinal: 50000,
|
|
2342
|
-
pipe() {
|
|
2343
|
-
return pipeArguments(this, arguments);
|
|
2344
|
-
}
|
|
2345
|
-
};
|
|
2346
|
-
/** @internal */
|
|
2347
|
-
const logLevelError = {
|
|
2348
|
-
_tag: "Error",
|
|
2349
|
-
syslog: 3,
|
|
2350
|
-
label: "ERROR",
|
|
2351
|
-
ordinal: 40000,
|
|
2352
|
-
pipe() {
|
|
2353
|
-
return pipeArguments(this, arguments);
|
|
2354
|
-
}
|
|
2355
|
-
};
|
|
2356
|
-
/** @internal */
|
|
2357
|
-
const logLevelWarning = {
|
|
2358
|
-
_tag: "Warning",
|
|
2359
|
-
syslog: 4,
|
|
2360
|
-
label: "WARN",
|
|
2361
|
-
ordinal: 30000,
|
|
2362
|
-
pipe() {
|
|
2363
|
-
return pipeArguments(this, arguments);
|
|
2364
|
-
}
|
|
2365
|
-
};
|
|
2366
|
-
/** @internal */
|
|
2367
|
-
const logLevelInfo = {
|
|
2368
|
-
_tag: "Info",
|
|
2369
|
-
syslog: 6,
|
|
2370
|
-
label: "INFO",
|
|
2371
|
-
ordinal: 20000,
|
|
2372
|
-
pipe() {
|
|
2373
|
-
return pipeArguments(this, arguments);
|
|
667
|
+
parallel = parallelCollectionAdd(parallel, current);
|
|
668
|
+
if (isNil(stack)) {
|
|
669
|
+
return [parallel, sequential];
|
|
670
|
+
}
|
|
671
|
+
current = stack.head;
|
|
672
|
+
stack = stack.tail;
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
2374
676
|
}
|
|
677
|
+
throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
2375
678
|
};
|
|
2376
|
-
/**
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
679
|
+
/**
|
|
680
|
+
* Merges a collection of requests that must be executed sequentially with a
|
|
681
|
+
* collection of requests that can be executed in parallel. If the collections
|
|
682
|
+
* are both from the same single data source then the requests can be
|
|
683
|
+
* pipelined while preserving ordering guarantees.
|
|
684
|
+
*/
|
|
685
|
+
const merge = (sequential, parallel) => {
|
|
686
|
+
if (isNil(sequential)) {
|
|
687
|
+
return of$1(parallelCollectionToSequentialCollection(parallel));
|
|
2384
688
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
const logLevelTrace = {
|
|
2388
|
-
_tag: "Trace",
|
|
2389
|
-
syslog: 7,
|
|
2390
|
-
label: "TRACE",
|
|
2391
|
-
ordinal: 0,
|
|
2392
|
-
pipe() {
|
|
2393
|
-
return pipeArguments(this, arguments);
|
|
689
|
+
if (parallelCollectionIsEmpty(parallel)) {
|
|
690
|
+
return sequential;
|
|
2394
691
|
}
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
syslog: 7,
|
|
2400
|
-
label: "OFF",
|
|
2401
|
-
ordinal: Number.MAX_SAFE_INTEGER,
|
|
2402
|
-
pipe() {
|
|
2403
|
-
return pipeArguments(this, arguments);
|
|
692
|
+
const seqHeadKeys = sequentialCollectionKeys(sequential.head);
|
|
693
|
+
const parKeys = parallelCollectionKeys(parallel);
|
|
694
|
+
if (seqHeadKeys.length === 1 && parKeys.length === 1 && equals$1(seqHeadKeys[0], parKeys[0])) {
|
|
695
|
+
return cons(sequentialCollectionCombine(sequential.head, parallelCollectionToSequentialCollection(parallel)), sequential.tail);
|
|
2404
696
|
}
|
|
697
|
+
return cons(parallelCollectionToSequentialCollection(parallel), sequential);
|
|
2405
698
|
};
|
|
2406
|
-
// -----------------------------------------------------------------------------
|
|
2407
|
-
// FiberRef
|
|
2408
|
-
// -----------------------------------------------------------------------------
|
|
2409
699
|
/** @internal */
|
|
2410
|
-
const
|
|
2411
|
-
|
|
2412
|
-
const FiberRefTypeId = /*#__PURE__*/Symbol.for(FiberRefSymbolKey);
|
|
2413
|
-
const fiberRefVariance = {
|
|
700
|
+
const RequestBlockParallelTypeId = /*#__PURE__*/Symbol.for("effect/RequestBlock/RequestBlockParallel");
|
|
701
|
+
const parallelVariance = {
|
|
2414
702
|
/* c8 ignore next */
|
|
2415
|
-
|
|
2416
|
-
};
|
|
2417
|
-
/* @internal */
|
|
2418
|
-
const fiberRefGet = self => withFiberRuntime$1(fiber => exitSucceed(fiber.getFiberRef(self)));
|
|
2419
|
-
/* @internal */
|
|
2420
|
-
const fiberRefGetWith = /*#__PURE__*/dual(2, (self, f) => flatMap$3(fiberRefGet(self), f));
|
|
2421
|
-
/* @internal */
|
|
2422
|
-
const fiberRefSet = /*#__PURE__*/dual(2, (self, value) => fiberRefModify(self, () => [void 0, value]));
|
|
2423
|
-
/* @internal */
|
|
2424
|
-
const fiberRefModify = /*#__PURE__*/dual(2, (self, f) => withFiberRuntime$1(state => {
|
|
2425
|
-
const [b, a] = f(state.getFiberRef(self));
|
|
2426
|
-
state.setFiberRef(self, a);
|
|
2427
|
-
return succeed$4(b);
|
|
2428
|
-
}));
|
|
2429
|
-
/* @internal */
|
|
2430
|
-
const fiberRefLocally = /*#__PURE__*/dual(3, (use, self, value) => acquireUseRelease$1(zipLeft$1(fiberRefGet(self), fiberRefSet(self, value)), () => use, oldValue => fiberRefSet(self, oldValue)));
|
|
2431
|
-
/* @internal */
|
|
2432
|
-
const fiberRefLocallyWith = /*#__PURE__*/dual(3, (use, self, f) => fiberRefGetWith(self, a => fiberRefLocally(use, self, f(a))));
|
|
2433
|
-
/** @internal */
|
|
2434
|
-
const fiberRefUnsafeMake = (initial, options) => fiberRefUnsafeMakePatch(initial, {
|
|
2435
|
-
differ: update$3(),
|
|
2436
|
-
fork: options?.fork ?? identity,
|
|
2437
|
-
join: options?.join
|
|
2438
|
-
});
|
|
2439
|
-
/** @internal */
|
|
2440
|
-
const fiberRefUnsafeMakeHashSet = initial => {
|
|
2441
|
-
const differ = hashSet();
|
|
2442
|
-
return fiberRefUnsafeMakePatch(initial, {
|
|
2443
|
-
differ,
|
|
2444
|
-
fork: differ.empty
|
|
2445
|
-
});
|
|
2446
|
-
};
|
|
2447
|
-
/** @internal */
|
|
2448
|
-
const fiberRefUnsafeMakeReadonlyArray = initial => {
|
|
2449
|
-
const differ = readonlyArray(update$3());
|
|
2450
|
-
return fiberRefUnsafeMakePatch(initial, {
|
|
2451
|
-
differ,
|
|
2452
|
-
fork: differ.empty
|
|
2453
|
-
});
|
|
2454
|
-
};
|
|
2455
|
-
/** @internal */
|
|
2456
|
-
const fiberRefUnsafeMakeContext = initial => {
|
|
2457
|
-
const differ = environment();
|
|
2458
|
-
return fiberRefUnsafeMakePatch(initial, {
|
|
2459
|
-
differ,
|
|
2460
|
-
fork: differ.empty
|
|
2461
|
-
});
|
|
2462
|
-
};
|
|
2463
|
-
/** @internal */
|
|
2464
|
-
const fiberRefUnsafeMakePatch = (initial, options) => {
|
|
2465
|
-
const _fiberRef = {
|
|
2466
|
-
...CommitPrototype,
|
|
2467
|
-
[FiberRefTypeId]: fiberRefVariance,
|
|
2468
|
-
initial,
|
|
2469
|
-
commit() {
|
|
2470
|
-
return fiberRefGet(this);
|
|
2471
|
-
},
|
|
2472
|
-
diff: (oldValue, newValue) => options.differ.diff(oldValue, newValue),
|
|
2473
|
-
combine: (first, second) => options.differ.combine(first, second),
|
|
2474
|
-
patch: patch => oldValue => options.differ.patch(patch, oldValue),
|
|
2475
|
-
fork: options.fork,
|
|
2476
|
-
join: options.join ?? ((_, n) => n)
|
|
2477
|
-
};
|
|
2478
|
-
return _fiberRef;
|
|
2479
|
-
};
|
|
2480
|
-
/** @internal */
|
|
2481
|
-
const fiberRefUnsafeMakeRuntimeFlags = initial => fiberRefUnsafeMakePatch(initial, {
|
|
2482
|
-
differ: differ$1,
|
|
2483
|
-
fork: differ$1.empty
|
|
2484
|
-
});
|
|
2485
|
-
/** @internal */
|
|
2486
|
-
const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$i()));
|
|
2487
|
-
/** @internal */
|
|
2488
|
-
const currentSchedulingPriority = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentSchedulingPriority"), () => fiberRefUnsafeMake(0));
|
|
2489
|
-
/** @internal */
|
|
2490
|
-
const currentMaxOpsBeforeYield = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"), () => fiberRefUnsafeMake(2048));
|
|
2491
|
-
/** @internal */
|
|
2492
|
-
const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$e()));
|
|
2493
|
-
/** @internal */
|
|
2494
|
-
const currentLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogLevel"), () => fiberRefUnsafeMake(logLevelInfo));
|
|
2495
|
-
/** @internal */
|
|
2496
|
-
const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$d()));
|
|
2497
|
-
/** @internal */
|
|
2498
|
-
const withSchedulingPriority = /*#__PURE__*/dual(2, (self, scheduler) => fiberRefLocally(self, currentSchedulingPriority, scheduler));
|
|
2499
|
-
/** @internal */
|
|
2500
|
-
const currentConcurrency = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentConcurrency"), () => fiberRefUnsafeMake("unbounded"));
|
|
2501
|
-
/**
|
|
2502
|
-
* @internal
|
|
2503
|
-
*/
|
|
2504
|
-
const currentRequestBatching = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentRequestBatching"), () => fiberRefUnsafeMake(true));
|
|
2505
|
-
/** @internal */
|
|
2506
|
-
const currentUnhandledErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelDebug)));
|
|
2507
|
-
/** @internal */
|
|
2508
|
-
const currentVersionMismatchErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelWarning)));
|
|
2509
|
-
/** @internal */
|
|
2510
|
-
const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$j()));
|
|
2511
|
-
/** @internal */
|
|
2512
|
-
const currentForkScopeOverride = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentForkScopeOverride"), () => fiberRefUnsafeMake(none$4(), {
|
|
2513
|
-
fork: () => none$4(),
|
|
2514
|
-
join: (parent, _) => parent
|
|
2515
|
-
}));
|
|
2516
|
-
/** @internal */
|
|
2517
|
-
const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty$h, {
|
|
2518
|
-
fork: () => empty$h,
|
|
2519
|
-
join: (parent, _) => parent
|
|
2520
|
-
}));
|
|
2521
|
-
// -----------------------------------------------------------------------------
|
|
2522
|
-
// Scope
|
|
2523
|
-
// -----------------------------------------------------------------------------
|
|
2524
|
-
/** @internal */
|
|
2525
|
-
const ScopeTypeId = /*#__PURE__*/Symbol.for("effect/Scope");
|
|
2526
|
-
/** @internal */
|
|
2527
|
-
const CloseableScopeTypeId = /*#__PURE__*/Symbol.for("effect/CloseableScope");
|
|
2528
|
-
/* @internal */
|
|
2529
|
-
const scopeAddFinalizer = (self, finalizer) => self.addFinalizer(() => asVoid$1(finalizer));
|
|
2530
|
-
/* @internal */
|
|
2531
|
-
const scopeAddFinalizerExit = (self, finalizer) => self.addFinalizer(finalizer);
|
|
2532
|
-
/* @internal */
|
|
2533
|
-
const scopeClose = (self, exit) => self.close(exit);
|
|
2534
|
-
/* @internal */
|
|
2535
|
-
const scopeFork = (self, strategy) => self.fork(strategy);
|
|
2536
|
-
// -----------------------------------------------------------------------------
|
|
2537
|
-
// Errors
|
|
2538
|
-
// -----------------------------------------------------------------------------
|
|
2539
|
-
/** @internal */
|
|
2540
|
-
const YieldableError = /*#__PURE__*/function () {
|
|
2541
|
-
class YieldableError extends globalThis.Error {
|
|
2542
|
-
commit() {
|
|
2543
|
-
return fail$4(this);
|
|
2544
|
-
}
|
|
2545
|
-
toJSON() {
|
|
2546
|
-
const obj = {
|
|
2547
|
-
...this
|
|
2548
|
-
};
|
|
2549
|
-
if (this.message) obj.message = this.message;
|
|
2550
|
-
if (this.cause) obj.cause = this.cause;
|
|
2551
|
-
return obj;
|
|
2552
|
-
}
|
|
2553
|
-
[NodeInspectSymbol]() {
|
|
2554
|
-
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
2555
|
-
return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
2556
|
-
} else if ("Bun" in globalThis) {
|
|
2557
|
-
return pretty(fail$5(this), {
|
|
2558
|
-
renderErrorCause: true
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
return this;
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
// @effect-diagnostics-next-line floatingEffect:off
|
|
2565
|
-
Object.assign(YieldableError.prototype, StructuralCommitPrototype);
|
|
2566
|
-
return YieldableError;
|
|
2567
|
-
}();
|
|
2568
|
-
const makeException = (proto, tag) => {
|
|
2569
|
-
class Base extends YieldableError {
|
|
2570
|
-
_tag = tag;
|
|
2571
|
-
}
|
|
2572
|
-
Object.assign(Base.prototype, proto);
|
|
2573
|
-
Base.prototype.name = tag;
|
|
2574
|
-
return Base;
|
|
703
|
+
_R: _ => _
|
|
2575
704
|
};
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
}, "RuntimeException");
|
|
2582
|
-
/** @internal */
|
|
2583
|
-
const InterruptedExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/InterruptedException");
|
|
2584
|
-
/** @internal */
|
|
2585
|
-
const isInterruptedException = u => hasProperty(u, InterruptedExceptionTypeId);
|
|
2586
|
-
/** @internal */
|
|
2587
|
-
const NoSuchElementExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/NoSuchElement");
|
|
2588
|
-
/** @internal */
|
|
2589
|
-
const NoSuchElementException = /*#__PURE__*/makeException({
|
|
2590
|
-
[NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
|
|
2591
|
-
}, "NoSuchElementException");
|
|
2592
|
-
/** @internal */
|
|
2593
|
-
const UnknownExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/UnknownException");
|
|
2594
|
-
/** @internal */
|
|
2595
|
-
const UnknownException = /*#__PURE__*/function () {
|
|
2596
|
-
class UnknownException extends YieldableError {
|
|
2597
|
-
_tag = "UnknownException";
|
|
2598
|
-
error;
|
|
2599
|
-
constructor(cause, message) {
|
|
2600
|
-
super(message ?? "An unknown error occurred", {
|
|
2601
|
-
cause
|
|
2602
|
-
});
|
|
2603
|
-
this.error = cause;
|
|
2604
|
-
}
|
|
705
|
+
class ParallelImpl {
|
|
706
|
+
map;
|
|
707
|
+
[RequestBlockParallelTypeId] = parallelVariance;
|
|
708
|
+
constructor(map) {
|
|
709
|
+
this.map = map;
|
|
2605
710
|
}
|
|
2606
|
-
|
|
2607
|
-
[UnknownExceptionTypeId]: UnknownExceptionTypeId,
|
|
2608
|
-
name: "UnknownException"
|
|
2609
|
-
});
|
|
2610
|
-
return UnknownException;
|
|
2611
|
-
}();
|
|
2612
|
-
// -----------------------------------------------------------------------------
|
|
2613
|
-
// Exit
|
|
2614
|
-
// -----------------------------------------------------------------------------
|
|
2615
|
-
/** @internal */
|
|
2616
|
-
const exitIsExit = u => isEffect$1(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
2617
|
-
/** @internal */
|
|
2618
|
-
const exitIsFailure = self => self._tag === "Failure";
|
|
711
|
+
}
|
|
2619
712
|
/** @internal */
|
|
2620
|
-
const
|
|
713
|
+
const parallelCollectionEmpty = () => new ParallelImpl(empty$a());
|
|
2621
714
|
/** @internal */
|
|
2622
|
-
const
|
|
2623
|
-
switch (self._tag) {
|
|
2624
|
-
case OP_FAILURE:
|
|
2625
|
-
{
|
|
2626
|
-
return exitFailCause(self.effect_instruction_i0);
|
|
2627
|
-
}
|
|
2628
|
-
case OP_SUCCESS:
|
|
2629
|
-
{
|
|
2630
|
-
return exitSucceed(value);
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
});
|
|
715
|
+
const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$6(_, append$1(blockedRequest.blockedRequest)), () => of$2(blockedRequest.blockedRequest))));
|
|
2634
716
|
/** @internal */
|
|
2635
|
-
const
|
|
717
|
+
const parallelCollectionCombine = (self, that) => new ParallelImpl(reduce$1(self.map, that.map, (map, value, key) => set$2(map, key, match$6(get$4(map, key), {
|
|
718
|
+
onNone: () => value,
|
|
719
|
+
onSome: other => appendAll$1(value, other)
|
|
720
|
+
}))));
|
|
2636
721
|
/** @internal */
|
|
2637
|
-
const
|
|
722
|
+
const parallelCollectionIsEmpty = self => isEmpty$4(self.map);
|
|
2638
723
|
/** @internal */
|
|
2639
|
-
const
|
|
724
|
+
const parallelCollectionKeys = self => Array.from(keys(self.map));
|
|
2640
725
|
/** @internal */
|
|
2641
|
-
const
|
|
726
|
+
const parallelCollectionToSequentialCollection = self => sequentialCollectionMake(map$7(self.map, x => of$2(x)));
|
|
727
|
+
// TODO
|
|
728
|
+
// /** @internal */
|
|
729
|
+
// export const parallelCollectionToChunk = <R>(
|
|
730
|
+
// self: ParallelCollection<R>
|
|
731
|
+
// ): Array<[RequestResolver.RequestResolver<unknown, R>, Array<Request.Entry<unknown>>]> => Array.from(self.map) as any
|
|
2642
732
|
/** @internal */
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
733
|
+
const SequentialCollectionTypeId = /*#__PURE__*/Symbol.for("effect/RequestBlock/RequestBlockSequential");
|
|
734
|
+
const sequentialVariance = {
|
|
735
|
+
/* c8 ignore next */
|
|
736
|
+
_R: _ => _
|
|
2647
737
|
};
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
case OP_FAILURE:
|
|
2654
|
-
return exitFailCause(self.effect_instruction_i0);
|
|
2655
|
-
case OP_SUCCESS:
|
|
2656
|
-
return exitSucceed(f(self.effect_instruction_i0));
|
|
2657
|
-
}
|
|
2658
|
-
});
|
|
2659
|
-
/** @internal */
|
|
2660
|
-
const exitMatch = /*#__PURE__*/dual(2, (self, {
|
|
2661
|
-
onFailure,
|
|
2662
|
-
onSuccess
|
|
2663
|
-
}) => {
|
|
2664
|
-
switch (self._tag) {
|
|
2665
|
-
case OP_FAILURE:
|
|
2666
|
-
return onFailure(self.effect_instruction_i0);
|
|
2667
|
-
case OP_SUCCESS:
|
|
2668
|
-
return onSuccess(self.effect_instruction_i0);
|
|
2669
|
-
}
|
|
2670
|
-
});
|
|
2671
|
-
/** @internal */
|
|
2672
|
-
const exitMatchEffect = /*#__PURE__*/dual(2, (self, {
|
|
2673
|
-
onFailure,
|
|
2674
|
-
onSuccess
|
|
2675
|
-
}) => {
|
|
2676
|
-
switch (self._tag) {
|
|
2677
|
-
case OP_FAILURE:
|
|
2678
|
-
return onFailure(self.effect_instruction_i0);
|
|
2679
|
-
case OP_SUCCESS:
|
|
2680
|
-
return onSuccess(self.effect_instruction_i0);
|
|
738
|
+
class SequentialImpl {
|
|
739
|
+
map;
|
|
740
|
+
[SequentialCollectionTypeId] = sequentialVariance;
|
|
741
|
+
constructor(map) {
|
|
742
|
+
this.map = map;
|
|
2681
743
|
}
|
|
2682
|
-
}
|
|
2683
|
-
/** @internal */
|
|
2684
|
-
const exitSucceed = value => {
|
|
2685
|
-
const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
|
|
2686
|
-
effect.effect_instruction_i0 = value;
|
|
2687
|
-
return effect;
|
|
2688
|
-
};
|
|
2689
|
-
/** @internal */
|
|
2690
|
-
const exitVoid = /*#__PURE__*/exitSucceed(void 0);
|
|
2691
|
-
/** @internal */
|
|
2692
|
-
const exitZip = /*#__PURE__*/dual(2, (self, that) => exitZipWith(self, that, {
|
|
2693
|
-
onSuccess: (a, a2) => [a, a2],
|
|
2694
|
-
onFailure: sequential$2
|
|
2695
|
-
}));
|
|
744
|
+
}
|
|
2696
745
|
/** @internal */
|
|
2697
|
-
const
|
|
2698
|
-
onSuccess: (_, a2) => a2,
|
|
2699
|
-
onFailure: sequential$2
|
|
2700
|
-
}));
|
|
746
|
+
const sequentialCollectionMake = map => new SequentialImpl(map);
|
|
2701
747
|
/** @internal */
|
|
2702
|
-
const
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
})
|
|
2706
|
-
switch (self._tag) {
|
|
2707
|
-
case OP_FAILURE:
|
|
2708
|
-
{
|
|
2709
|
-
switch (that._tag) {
|
|
2710
|
-
case OP_SUCCESS:
|
|
2711
|
-
return exitFailCause(self.effect_instruction_i0);
|
|
2712
|
-
case OP_FAILURE:
|
|
2713
|
-
{
|
|
2714
|
-
return exitFailCause(onFailure(self.effect_instruction_i0, that.effect_instruction_i0));
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
case OP_SUCCESS:
|
|
2719
|
-
{
|
|
2720
|
-
switch (that._tag) {
|
|
2721
|
-
case OP_SUCCESS:
|
|
2722
|
-
return exitSucceed(onSuccess(self.effect_instruction_i0, that.effect_instruction_i0));
|
|
2723
|
-
case OP_FAILURE:
|
|
2724
|
-
return exitFailCause(that.effect_instruction_i0);
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
});
|
|
2729
|
-
const exitCollectAllInternal = (exits, combineCauses) => {
|
|
2730
|
-
const list = fromIterable$4(exits);
|
|
2731
|
-
if (!isNonEmpty$2(list)) {
|
|
2732
|
-
return none$4();
|
|
2733
|
-
}
|
|
2734
|
-
return pipe(tailNonEmpty(list), reduce$4(pipe(headNonEmpty(list), exitMap(of$2)), (accumulator, current) => pipe(accumulator, exitZipWith(current, {
|
|
2735
|
-
onSuccess: (list, value) => pipe(list, prepend$1(value)),
|
|
2736
|
-
onFailure: combineCauses
|
|
2737
|
-
}))), exitMap(reverse$1), exitMap(chunk => toReadonlyArray(chunk)), some);
|
|
2738
|
-
};
|
|
2739
|
-
// -----------------------------------------------------------------------------
|
|
2740
|
-
// Deferred
|
|
2741
|
-
// -----------------------------------------------------------------------------
|
|
748
|
+
const sequentialCollectionCombine = (self, that) => new SequentialImpl(reduce$1(that.map, self.map, (map, value, key) => set$2(map, key, match$6(get$4(map, key), {
|
|
749
|
+
onNone: () => empty$b(),
|
|
750
|
+
onSome: a => appendAll$1(a, value)
|
|
751
|
+
}))));
|
|
2742
752
|
/** @internal */
|
|
2743
|
-
const
|
|
2744
|
-
const _deferred = {
|
|
2745
|
-
...CommitPrototype,
|
|
2746
|
-
[DeferredTypeId]: deferredVariance,
|
|
2747
|
-
state: make$q(pending([])),
|
|
2748
|
-
commit() {
|
|
2749
|
-
return deferredAwait(this);
|
|
2750
|
-
},
|
|
2751
|
-
blockingOn: fiberId
|
|
2752
|
-
};
|
|
2753
|
-
return _deferred;
|
|
2754
|
-
};
|
|
2755
|
-
/* @internal */
|
|
2756
|
-
const deferredMake = () => flatMap$3(fiberId, id => deferredMakeAs(id));
|
|
2757
|
-
/* @internal */
|
|
2758
|
-
const deferredMakeAs = fiberId => sync$2(() => deferredUnsafeMake(fiberId));
|
|
2759
|
-
/* @internal */
|
|
2760
|
-
const deferredAwait = self => asyncInterrupt(resume => {
|
|
2761
|
-
const state = get$6(self.state);
|
|
2762
|
-
switch (state._tag) {
|
|
2763
|
-
case OP_STATE_DONE$1:
|
|
2764
|
-
{
|
|
2765
|
-
return resume(state.effect);
|
|
2766
|
-
}
|
|
2767
|
-
case OP_STATE_PENDING:
|
|
2768
|
-
{
|
|
2769
|
-
// we can push here as the internal state is mutable
|
|
2770
|
-
state.joiners.push(resume);
|
|
2771
|
-
return deferredInterruptJoiner(self, resume);
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
}, self.blockingOn);
|
|
2775
|
-
/* @internal */
|
|
2776
|
-
const deferredCompleteWith = /*#__PURE__*/dual(2, (self, effect) => sync$2(() => {
|
|
2777
|
-
const state = get$6(self.state);
|
|
2778
|
-
switch (state._tag) {
|
|
2779
|
-
case OP_STATE_DONE$1:
|
|
2780
|
-
{
|
|
2781
|
-
return false;
|
|
2782
|
-
}
|
|
2783
|
-
case OP_STATE_PENDING:
|
|
2784
|
-
{
|
|
2785
|
-
set$4(self.state, done$4(effect));
|
|
2786
|
-
for (let i = 0, len = state.joiners.length; i < len; i++) {
|
|
2787
|
-
state.joiners[i](effect);
|
|
2788
|
-
}
|
|
2789
|
-
return true;
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
}));
|
|
2793
|
-
/* @internal */
|
|
2794
|
-
const deferredDone = /*#__PURE__*/dual(2, (self, exit) => deferredCompleteWith(self, exit));
|
|
2795
|
-
/* @internal */
|
|
2796
|
-
const deferredFailCause = /*#__PURE__*/dual(2, (self, cause) => deferredCompleteWith(self, failCause$6(cause)));
|
|
2797
|
-
/* @internal */
|
|
2798
|
-
const deferredInterruptWith = /*#__PURE__*/dual(2, (self, fiberId) => deferredCompleteWith(self, interruptWith(fiberId)));
|
|
2799
|
-
/* @internal */
|
|
2800
|
-
const deferredIsDone = self => sync$2(() => get$6(self.state)._tag === OP_STATE_DONE$1);
|
|
2801
|
-
/* @internal */
|
|
2802
|
-
const deferredSucceed = /*#__PURE__*/dual(2, (self, value) => deferredCompleteWith(self, succeed$4(value)));
|
|
2803
|
-
/** @internal */
|
|
2804
|
-
const deferredUnsafeDone = (self, effect) => {
|
|
2805
|
-
const state = get$6(self.state);
|
|
2806
|
-
if (state._tag === OP_STATE_PENDING) {
|
|
2807
|
-
set$4(self.state, done$4(effect));
|
|
2808
|
-
for (let i = 0, len = state.joiners.length; i < len; i++) {
|
|
2809
|
-
state.joiners[i](effect);
|
|
2810
|
-
}
|
|
2811
|
-
}
|
|
2812
|
-
};
|
|
2813
|
-
const deferredInterruptJoiner = (self, joiner) => sync$2(() => {
|
|
2814
|
-
const state = get$6(self.state);
|
|
2815
|
-
if (state._tag === OP_STATE_PENDING) {
|
|
2816
|
-
const index = state.joiners.indexOf(joiner);
|
|
2817
|
-
if (index >= 0) {
|
|
2818
|
-
// we can splice here as the internal state is mutable
|
|
2819
|
-
state.joiners.splice(index, 1);
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
});
|
|
2823
|
-
// -----------------------------------------------------------------------------
|
|
2824
|
-
// Context
|
|
2825
|
-
// -----------------------------------------------------------------------------
|
|
2826
|
-
const constContext = /*#__PURE__*/withFiberRuntime$1(fiber => exitSucceed(fiber.currentContext));
|
|
2827
|
-
/* @internal */
|
|
2828
|
-
const context = () => constContext;
|
|
2829
|
-
/* @internal */
|
|
2830
|
-
const contextWithEffect = f => flatMap$3(context(), f);
|
|
2831
|
-
/* @internal */
|
|
2832
|
-
const provideContext = /*#__PURE__*/dual(2, (self, context) => fiberRefLocally(currentContext, context)(self));
|
|
2833
|
-
/* @internal */
|
|
2834
|
-
const provideSomeContext = /*#__PURE__*/dual(2, (self, context) => fiberRefLocallyWith(currentContext, parent => merge$1(parent, context))(self));
|
|
2835
|
-
/* @internal */
|
|
2836
|
-
const mapInputContext = /*#__PURE__*/dual(2, (self, f) => contextWithEffect(context => provideContext(self, f(context))));
|
|
2837
|
-
// -----------------------------------------------------------------------------
|
|
2838
|
-
// Tracing
|
|
2839
|
-
// -----------------------------------------------------------------------------
|
|
753
|
+
const sequentialCollectionKeys = self => Array.from(keys(self.map));
|
|
2840
754
|
/** @internal */
|
|
2841
|
-
const
|
|
2842
|
-
const span = fiber.currentSpan;
|
|
2843
|
-
return span !== undefined && span._tag === "Span" ? some(span) : none$4();
|
|
2844
|
-
};
|
|
755
|
+
const sequentialCollectionToChunk = self => Array.from(self.map);
|
|
2845
756
|
|
|
2846
757
|
/**
|
|
2847
758
|
* Creates a new `Deferred`.
|
|
@@ -3041,12 +952,12 @@ const empty$8 = () => {
|
|
|
3041
952
|
*/
|
|
3042
953
|
const get$3 = /*#__PURE__*/dual(2, (self, key) => {
|
|
3043
954
|
if (isEqual(key) === false) {
|
|
3044
|
-
return self.referential.has(key) ? some(self.referential.get(key)) : none$
|
|
955
|
+
return self.referential.has(key) ? some(self.referential.get(key)) : none$1();
|
|
3045
956
|
}
|
|
3046
957
|
const hash = key[symbol$1]();
|
|
3047
958
|
const bucket = self.buckets.get(hash);
|
|
3048
959
|
if (bucket === undefined) {
|
|
3049
|
-
return none$
|
|
960
|
+
return none$1();
|
|
3050
961
|
}
|
|
3051
962
|
return getFromBucket(self, bucket, key);
|
|
3052
963
|
});
|
|
@@ -3061,7 +972,7 @@ const getFromBucket = (self, bucket, key, remove = false) => {
|
|
|
3061
972
|
return some(value);
|
|
3062
973
|
}
|
|
3063
974
|
}
|
|
3064
|
-
return none$
|
|
975
|
+
return none$1();
|
|
3065
976
|
};
|
|
3066
977
|
/**
|
|
3067
978
|
* @since 2.0.0
|
|
@@ -3340,13 +1251,13 @@ const offer$2 = /*#__PURE__*/dual(2, (self, value) => {
|
|
|
3340
1251
|
const offerAll = /*#__PURE__*/dual(2, (self, values) => {
|
|
3341
1252
|
const iterator = values[Symbol.iterator]();
|
|
3342
1253
|
let next;
|
|
3343
|
-
let remainder = empty$
|
|
1254
|
+
let remainder = empty$b();
|
|
3344
1255
|
let offering = true;
|
|
3345
1256
|
while (offering && (next = iterator.next()) && !next.done) {
|
|
3346
1257
|
offering = offer$2(next.value)(self);
|
|
3347
1258
|
}
|
|
3348
1259
|
while (next != null && !next.done) {
|
|
3349
|
-
remainder = prepend
|
|
1260
|
+
remainder = prepend(next.value)(remainder);
|
|
3350
1261
|
next = iterator.next();
|
|
3351
1262
|
}
|
|
3352
1263
|
return reverse$1(remainder);
|
|
@@ -3375,14 +1286,14 @@ const poll = /*#__PURE__*/dual(2, (self, def) => {
|
|
|
3375
1286
|
* @since 2.0.0
|
|
3376
1287
|
*/
|
|
3377
1288
|
const pollUpTo = /*#__PURE__*/dual(2, (self, n) => {
|
|
3378
|
-
let result = empty$
|
|
1289
|
+
let result = empty$b();
|
|
3379
1290
|
let count = 0;
|
|
3380
1291
|
while (count < n) {
|
|
3381
1292
|
const element = poll(EmptyMutableQueue)(self);
|
|
3382
1293
|
if (element === EmptyMutableQueue) {
|
|
3383
1294
|
break;
|
|
3384
1295
|
}
|
|
3385
|
-
result = prepend
|
|
1296
|
+
result = prepend(element)(result);
|
|
3386
1297
|
count += 1;
|
|
3387
1298
|
}
|
|
3388
1299
|
return reverse$1(result);
|
|
@@ -3645,13 +1556,13 @@ const patch$3 = /*#__PURE__*/dual(2, (path, patch) => {
|
|
|
3645
1556
|
}
|
|
3646
1557
|
case "MapName":
|
|
3647
1558
|
{
|
|
3648
|
-
output = map$
|
|
1559
|
+
output = map$8(output, patch.f);
|
|
3649
1560
|
input = input.tail;
|
|
3650
1561
|
break;
|
|
3651
1562
|
}
|
|
3652
1563
|
case "Nested":
|
|
3653
1564
|
{
|
|
3654
|
-
output = prepend$
|
|
1565
|
+
output = prepend$1(output, patch.name);
|
|
3655
1566
|
input = input.tail;
|
|
3656
1567
|
break;
|
|
3657
1568
|
}
|
|
@@ -3659,7 +1570,7 @@ const patch$3 = /*#__PURE__*/dual(2, (path, patch) => {
|
|
|
3659
1570
|
{
|
|
3660
1571
|
const containsName = pipe(head(output), contains(patch.name));
|
|
3661
1572
|
if (containsName) {
|
|
3662
|
-
output = tailNonEmpty
|
|
1573
|
+
output = tailNonEmpty(output);
|
|
3663
1574
|
input = input.tail;
|
|
3664
1575
|
} else {
|
|
3665
1576
|
return left(MissingData(output, `Expected ${patch.name} to be in path in ConfigProvider#unnested`));
|
|
@@ -3722,8 +1633,8 @@ const makeFlat = options => ({
|
|
|
3722
1633
|
});
|
|
3723
1634
|
/** @internal */
|
|
3724
1635
|
const fromFlat = flat => make$h({
|
|
3725
|
-
load: config => flatMap$3(fromFlatLoop(flat, empty$
|
|
3726
|
-
onNone: () => fail$4(MissingData(empty$
|
|
1636
|
+
load: config => flatMap$3(fromFlatLoop(flat, empty$c(), config, false), chunk => match$6(head(chunk), {
|
|
1637
|
+
onNone: () => fail$4(MissingData(empty$c(), `Expected a single value having structure: ${config}`)),
|
|
3727
1638
|
onSome: succeed$4
|
|
3728
1639
|
})),
|
|
3729
1640
|
flattened: flat
|
|
@@ -3743,7 +1654,7 @@ const fromEnv = options => {
|
|
|
3743
1654
|
const load = (path, primitive, split = true) => {
|
|
3744
1655
|
const pathString = makePathString(path);
|
|
3745
1656
|
const current = getEnv();
|
|
3746
|
-
const valueOpt = pathString in current ? some(current[pathString]) : none$
|
|
1657
|
+
const valueOpt = pathString in current ? some(current[pathString]) : none$1();
|
|
3747
1658
|
return pipe(valueOpt, mapError$1(() => MissingData(path, `Expected ${pathString} to exist in the process context`)), flatMap$3(value => parsePrimitive(value, path, primitive, seqDelim, split)));
|
|
3748
1659
|
};
|
|
3749
1660
|
const enumerateChildren = path => sync$2(() => {
|
|
@@ -3760,7 +1671,7 @@ const fromEnv = options => {
|
|
|
3760
1671
|
}
|
|
3761
1672
|
return true;
|
|
3762
1673
|
}).flatMap(keyPath => keyPath.slice(path.length, path.length + 1));
|
|
3763
|
-
return fromIterable$
|
|
1674
|
+
return fromIterable$3(filteredKeyPaths);
|
|
3764
1675
|
});
|
|
3765
1676
|
return fromFlat(makeFlat({
|
|
3766
1677
|
load,
|
|
@@ -3769,8 +1680,8 @@ const fromEnv = options => {
|
|
|
3769
1680
|
}));
|
|
3770
1681
|
};
|
|
3771
1682
|
const extend$1 = (leftDef, rightDef, left, right) => {
|
|
3772
|
-
const leftPad = unfold$1(left.length, index => index >= right.length ? none$
|
|
3773
|
-
const rightPad = unfold$1(right.length, index => index >= left.length ? none$
|
|
1683
|
+
const leftPad = unfold$1(left.length, index => index >= right.length ? none$1() : some([leftDef(index), index + 1]));
|
|
1684
|
+
const rightPad = unfold$1(right.length, index => index >= left.length ? none$1() : some([rightDef(index), index + 1]));
|
|
3774
1685
|
const leftExtension = concat(left, leftPad);
|
|
3775
1686
|
const rightExtension = concat(right, rightPad);
|
|
3776
1687
|
return [leftExtension, rightExtension];
|
|
@@ -3837,12 +1748,12 @@ const fromFlatLoop = (flat, prefix, config, split) => {
|
|
|
3837
1748
|
{
|
|
3838
1749
|
return pipe(patch$3(prefix, flat.patch), flatMap$3(patchedPrefix => pipe(flat.enumerateChildren(patchedPrefix), flatMap$3(indicesFrom), flatMap$3(indices => {
|
|
3839
1750
|
if (indices.length === 0) {
|
|
3840
|
-
return suspend$3(() => map$
|
|
1751
|
+
return suspend$3(() => map$9(fromFlatLoop(flat, prefix, op.config, true), of$3));
|
|
3841
1752
|
}
|
|
3842
|
-
return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$2(prefix, `[${index}]`), op.config, true)), map$
|
|
3843
|
-
const flattened = flatten$
|
|
1753
|
+
return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$2(prefix, `[${index}]`), op.config, true)), map$9(chunkChunk => {
|
|
1754
|
+
const flattened = flatten$4(chunkChunk);
|
|
3844
1755
|
if (flattened.length === 0) {
|
|
3845
|
-
return of$3(empty$
|
|
1756
|
+
return of$3(empty$c());
|
|
3846
1757
|
}
|
|
3847
1758
|
return of$3(flattened);
|
|
3848
1759
|
}));
|
|
@@ -3851,11 +1762,11 @@ const fromFlatLoop = (flat, prefix, config, split) => {
|
|
|
3851
1762
|
case OP_HASHMAP:
|
|
3852
1763
|
{
|
|
3853
1764
|
return suspend$3(() => pipe(patch$3(prefix, flat.patch), flatMap$3(prefix => pipe(flat.enumerateChildren(prefix), flatMap$3(keys => {
|
|
3854
|
-
return pipe(keys, forEachSequential(key => fromFlatLoop(flat, concat(prefix, of$3(key)), op.valueConfig, split)), map$
|
|
1765
|
+
return pipe(keys, forEachSequential(key => fromFlatLoop(flat, concat(prefix, of$3(key)), op.valueConfig, split)), map$9(matrix => {
|
|
3855
1766
|
if (matrix.length === 0) {
|
|
3856
|
-
return of$3(empty$
|
|
1767
|
+
return of$3(empty$a());
|
|
3857
1768
|
}
|
|
3858
|
-
return pipe(transpose(matrix), map$
|
|
1769
|
+
return pipe(transpose(matrix), map$8(values => fromIterable$1(zip$3(fromIterable$2(keys), values))));
|
|
3859
1770
|
}));
|
|
3860
1771
|
})))));
|
|
3861
1772
|
}
|
|
@@ -3874,8 +1785,8 @@ const fromFlatLoop = (flat, prefix, config, split) => {
|
|
|
3874
1785
|
if (isRight(left) && isRight(right$1)) {
|
|
3875
1786
|
const path = pipe(prefix, join$2("."));
|
|
3876
1787
|
const fail = fromFlatLoopFail(prefix, path);
|
|
3877
|
-
const [lefts, rights] = extend$1(fail, fail, pipe(left.right, map$
|
|
3878
|
-
return pipe(lefts, zip$
|
|
1788
|
+
const [lefts, rights] = extend$1(fail, fail, pipe(left.right, map$8(right)), pipe(right$1.right, map$8(right)));
|
|
1789
|
+
return pipe(lefts, zip$3(rights), forEachSequential(([left, right]) => pipe(zip$4(left, right), map$9(([left, right]) => op.zip(left, right)))));
|
|
3879
1790
|
}
|
|
3880
1791
|
throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
3881
1792
|
})))));
|
|
@@ -3900,21 +1811,21 @@ const transpose = array => {
|
|
|
3900
1811
|
return Object.keys(array[0]).map(column => array.map(row => row[column]));
|
|
3901
1812
|
};
|
|
3902
1813
|
const indicesFrom = quotedIndices => pipe(forEachSequential(quotedIndices, parseQuotedIndex), mapBoth({
|
|
3903
|
-
onFailure: () => empty$
|
|
1814
|
+
onFailure: () => empty$c(),
|
|
3904
1815
|
onSuccess: sort(Order$1)
|
|
3905
|
-
}), either, map$
|
|
1816
|
+
}), either, map$9(merge$1));
|
|
3906
1817
|
const QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
|
|
3907
1818
|
const parseQuotedIndex = str => {
|
|
3908
1819
|
const match = str.match(QUOTED_INDEX_REGEX);
|
|
3909
1820
|
if (match !== null) {
|
|
3910
1821
|
const matchedIndex = match[2];
|
|
3911
|
-
return pipe(matchedIndex !== undefined && matchedIndex.length > 0 ? some(matchedIndex) : none$
|
|
1822
|
+
return pipe(matchedIndex !== undefined && matchedIndex.length > 0 ? some(matchedIndex) : none$1(), flatMap$4(parseInteger));
|
|
3912
1823
|
}
|
|
3913
|
-
return none$
|
|
1824
|
+
return none$1();
|
|
3914
1825
|
};
|
|
3915
1826
|
const parseInteger = str => {
|
|
3916
1827
|
const parsedIndex = Number.parseInt(str);
|
|
3917
|
-
return Number.isNaN(parsedIndex) ? none$
|
|
1828
|
+
return Number.isNaN(parsedIndex) ? none$1() : some(parsedIndex);
|
|
3918
1829
|
};
|
|
3919
1830
|
|
|
3920
1831
|
/** @internal */
|
|
@@ -4026,13 +1937,13 @@ class RandomImpl {
|
|
|
4026
1937
|
return sync$2(() => this.PRNG.number());
|
|
4027
1938
|
}
|
|
4028
1939
|
get nextBoolean() {
|
|
4029
|
-
return map$
|
|
1940
|
+
return map$9(this.next, n => n > 0.5);
|
|
4030
1941
|
}
|
|
4031
1942
|
get nextInt() {
|
|
4032
1943
|
return sync$2(() => this.PRNG.integer(Number.MAX_SAFE_INTEGER));
|
|
4033
1944
|
}
|
|
4034
1945
|
nextRange(min, max) {
|
|
4035
|
-
return map$
|
|
1946
|
+
return map$9(this.next, n => (max - min) * n + min);
|
|
4036
1947
|
}
|
|
4037
1948
|
nextIntBetween(min, max) {
|
|
4038
1949
|
return sync$2(() => this.PRNG.integer(max - min) + min);
|
|
@@ -4047,7 +1958,7 @@ const shuffleWith = (elements, nextIntBounded) => {
|
|
|
4047
1958
|
for (let i = buffer.length; i >= 2; i = i - 1) {
|
|
4048
1959
|
numbers.push(i);
|
|
4049
1960
|
}
|
|
4050
|
-
return pipe(numbers, forEachSequentialDiscard(n => pipe(nextIntBounded(n), map$
|
|
1961
|
+
return pipe(numbers, forEachSequentialDiscard(n => pipe(nextIntBounded(n), map$9(k => swap(buffer, n - 1, k)))), as$1(fromIterable$4(buffer)));
|
|
4051
1962
|
})));
|
|
4052
1963
|
};
|
|
4053
1964
|
const swap = (buffer, index1, index2) => {
|
|
@@ -4143,7 +2054,7 @@ const DisablePropagation = /*#__PURE__*/Reference()("effect/Tracer/DisablePropag
|
|
|
4143
2054
|
});
|
|
4144
2055
|
|
|
4145
2056
|
/** @internal */
|
|
4146
|
-
const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$
|
|
2057
|
+
const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$d(), /*#__PURE__*/add(clockTag, /*#__PURE__*/make$i()), /*#__PURE__*/add(consoleTag, defaultConsole), /*#__PURE__*/add(randomTag, /*#__PURE__*/make$g(/*#__PURE__*/Math.random())), /*#__PURE__*/add(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add(tracerTag, nativeTracer));
|
|
4147
2058
|
/**
|
|
4148
2059
|
* The `FiberRef` holding the default `Effect` services.
|
|
4149
2060
|
*
|
|
@@ -4205,11 +2116,11 @@ const findAncestor = (_ref, _parentStack, _childStack, _childModified = false) =
|
|
|
4205
2116
|
let ret = undefined;
|
|
4206
2117
|
while (ret === undefined) {
|
|
4207
2118
|
if (isNonEmptyReadonlyArray(parentStack) && isNonEmptyReadonlyArray(childStack)) {
|
|
4208
|
-
const parentFiberId = headNonEmpty
|
|
4209
|
-
const parentAncestors = tailNonEmpty
|
|
4210
|
-
const childFiberId = headNonEmpty
|
|
4211
|
-
const childRefValue = headNonEmpty
|
|
4212
|
-
const childAncestors = tailNonEmpty
|
|
2119
|
+
const parentFiberId = headNonEmpty(parentStack)[0];
|
|
2120
|
+
const parentAncestors = tailNonEmpty(parentStack);
|
|
2121
|
+
const childFiberId = headNonEmpty(childStack)[0];
|
|
2122
|
+
const childRefValue = headNonEmpty(childStack)[1];
|
|
2123
|
+
const childAncestors = tailNonEmpty(childStack);
|
|
4213
2124
|
if (parentFiberId.startTimeMillis < childFiberId.startTimeMillis) {
|
|
4214
2125
|
childStack = childAncestors;
|
|
4215
2126
|
childModified = true;
|
|
@@ -4291,9 +2202,9 @@ const delete_ = /*#__PURE__*/dual(2, (self, fiberRef) => {
|
|
|
4291
2202
|
/** @internal */
|
|
4292
2203
|
const get$2 = /*#__PURE__*/dual(2, (self, fiberRef) => {
|
|
4293
2204
|
if (!self.locals.has(fiberRef)) {
|
|
4294
|
-
return none$
|
|
2205
|
+
return none$1();
|
|
4295
2206
|
}
|
|
4296
|
-
return some(headNonEmpty
|
|
2207
|
+
return some(headNonEmpty(self.locals.get(fiberRef))[1]);
|
|
4297
2208
|
});
|
|
4298
2209
|
/** @internal */
|
|
4299
2210
|
const getOrDefault$1 = /*#__PURE__*/dual(2, (self, fiberRef) => pipe(get$2(self, fiberRef), getOrElse(() => fiberRef.initial)));
|
|
@@ -4314,7 +2225,7 @@ const unsafeUpdateAs = (locals, fiberId, fiberRef, value) => {
|
|
|
4314
2225
|
const oldStack = locals.get(fiberRef) ?? [];
|
|
4315
2226
|
let newStack;
|
|
4316
2227
|
if (isNonEmptyReadonlyArray(oldStack)) {
|
|
4317
|
-
const [currentId, currentValue] = headNonEmpty
|
|
2228
|
+
const [currentId, currentValue] = headNonEmpty(oldStack);
|
|
4318
2229
|
if (currentId[symbol](fiberId)) {
|
|
4319
2230
|
if (equals$1(currentValue, value)) {
|
|
4320
2231
|
return;
|
|
@@ -4474,22 +2385,22 @@ class RefImpl extends Class {
|
|
|
4474
2385
|
constructor(ref) {
|
|
4475
2386
|
super();
|
|
4476
2387
|
this.ref = ref;
|
|
4477
|
-
this.get = sync$2(() => get$
|
|
2388
|
+
this.get = sync$2(() => get$5(this.ref));
|
|
4478
2389
|
}
|
|
4479
2390
|
get;
|
|
4480
2391
|
modify(f) {
|
|
4481
2392
|
return sync$2(() => {
|
|
4482
|
-
const current = get$
|
|
2393
|
+
const current = get$5(this.ref);
|
|
4483
2394
|
const [b, a] = f(current);
|
|
4484
2395
|
if (current !== a) {
|
|
4485
|
-
set$
|
|
2396
|
+
set$3(a)(this.ref);
|
|
4486
2397
|
}
|
|
4487
2398
|
return b;
|
|
4488
2399
|
});
|
|
4489
2400
|
}
|
|
4490
2401
|
}
|
|
4491
2402
|
/** @internal */
|
|
4492
|
-
const unsafeMake$3 = value => new RefImpl(make$
|
|
2403
|
+
const unsafeMake$3 = value => new RefImpl(make$n(value));
|
|
4493
2404
|
/** @internal */
|
|
4494
2405
|
const make$e = value => sync$2(() => unsafeMake$3(value));
|
|
4495
2406
|
/** @internal */
|
|
@@ -4541,10 +2452,10 @@ const diff$2 = (oldValue, newValue) => {
|
|
|
4541
2452
|
const missingLocals = new Map(oldValue.locals);
|
|
4542
2453
|
let patch = empty$3;
|
|
4543
2454
|
for (const [fiberRef, pairs] of newValue.locals.entries()) {
|
|
4544
|
-
const newValue = headNonEmpty
|
|
2455
|
+
const newValue = headNonEmpty(pairs)[1];
|
|
4545
2456
|
const old = missingLocals.get(fiberRef);
|
|
4546
2457
|
if (old !== undefined) {
|
|
4547
|
-
const oldValue = headNonEmpty
|
|
2458
|
+
const oldValue = headNonEmpty(old)[1];
|
|
4548
2459
|
if (!equals$1(oldValue, newValue)) {
|
|
4549
2460
|
patch = combine$1({
|
|
4550
2461
|
_tag: OP_UPDATE,
|
|
@@ -4580,8 +2491,8 @@ const patch$2 = /*#__PURE__*/dual(3, (self, fiberId, oldValue) => {
|
|
|
4580
2491
|
let fiberRefs = oldValue;
|
|
4581
2492
|
let patches = of$3(self);
|
|
4582
2493
|
while (isNonEmptyReadonlyArray(patches)) {
|
|
4583
|
-
const head = headNonEmpty
|
|
4584
|
-
const tail = tailNonEmpty
|
|
2494
|
+
const head = headNonEmpty(patches);
|
|
2495
|
+
const tail = tailNonEmpty(patches);
|
|
4585
2496
|
switch (head._tag) {
|
|
4586
2497
|
case OP_EMPTY$1:
|
|
4587
2498
|
{
|
|
@@ -4617,7 +2528,7 @@ const patch$2 = /*#__PURE__*/dual(3, (self, fiberId, oldValue) => {
|
|
|
4617
2528
|
}
|
|
4618
2529
|
case OP_AND_THEN$1:
|
|
4619
2530
|
{
|
|
4620
|
-
patches = prepend$
|
|
2531
|
+
patches = prepend$1(head.first)(prepend$1(head.second)(tail));
|
|
4621
2532
|
break;
|
|
4622
2533
|
}
|
|
4623
2534
|
}
|
|
@@ -4658,7 +2569,7 @@ const make$c = (key, value) => {
|
|
|
4658
2569
|
const isMetricLabel = u => hasProperty(u, MetricLabelTypeId);
|
|
4659
2570
|
|
|
4660
2571
|
/* @internal */
|
|
4661
|
-
const asSome = self => map$
|
|
2572
|
+
const asSome = self => map$9(self, some);
|
|
4662
2573
|
/* @internal */
|
|
4663
2574
|
const catchSomeCause$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
|
|
4664
2575
|
onFailure: cause => {
|
|
@@ -4701,19 +2612,19 @@ const mapErrorCause = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self,
|
|
|
4701
2612
|
onSuccess: succeed$4
|
|
4702
2613
|
}));
|
|
4703
2614
|
/* @internal */
|
|
4704
|
-
const negate = self => map$
|
|
2615
|
+
const negate = self => map$9(self, b => !b);
|
|
4705
2616
|
/* @internal */
|
|
4706
2617
|
const patchFiberRefs = patch => updateFiberRefs((fiberId, fiberRefs) => pipe(patch, patch$2(fiberId, fiberRefs)));
|
|
4707
2618
|
/* @internal */
|
|
4708
|
-
const provideService = /*#__PURE__*/dual(3, (self, tag, service) => contextWithEffect(env => provideContext(self, add
|
|
2619
|
+
const provideService = /*#__PURE__*/dual(3, (self, tag, service) => contextWithEffect(env => provideContext(self, add(env, tag, service))));
|
|
4709
2620
|
/* @internal */
|
|
4710
|
-
const provideServiceEffect = /*#__PURE__*/dual(3, (self, tag, effect) => contextWithEffect(env => flatMap$3(effect, service => provideContext(self, pipe(env, add
|
|
2621
|
+
const provideServiceEffect = /*#__PURE__*/dual(3, (self, tag, effect) => contextWithEffect(env => flatMap$3(effect, service => provideContext(self, pipe(env, add(tag, service))))));
|
|
4711
2622
|
/* @internal */
|
|
4712
2623
|
const sleep = sleep$1;
|
|
4713
2624
|
/* @internal */
|
|
4714
|
-
const succeedNone = /*#__PURE__*/succeed$4(/*#__PURE__*/none$
|
|
2625
|
+
const succeedNone = /*#__PURE__*/succeed$4(/*#__PURE__*/none$1());
|
|
4715
2626
|
/* @internal */
|
|
4716
|
-
const summarized = /*#__PURE__*/dual(3, (self, summary, f) => flatMap$3(summary, start => flatMap$3(self, value => map$
|
|
2627
|
+
const summarized = /*#__PURE__*/dual(3, (self, summary, f) => flatMap$3(summary, start => flatMap$3(self, value => map$9(summary, end => [f(start, end), value]))));
|
|
4717
2628
|
/* @internal */
|
|
4718
2629
|
const tapErrorCause$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
|
|
4719
2630
|
onFailure: cause => zipRight$3(f(cause), failCause$6(cause)),
|
|
@@ -4725,8 +2636,8 @@ const updateFiberRefs = f => withFiberRuntime$1(state => {
|
|
|
4725
2636
|
return void_$2;
|
|
4726
2637
|
});
|
|
4727
2638
|
/* @internal */
|
|
4728
|
-
const when$1 = /*#__PURE__*/dual(2, (self, condition) => suspend$3(() => condition() ? map$
|
|
4729
|
-
const filterDisablePropagation = /*#__PURE__*/flatMap$4(span => get$
|
|
2639
|
+
const when$1 = /*#__PURE__*/dual(2, (self, condition) => suspend$3(() => condition() ? map$9(self, some) : succeed$4(none$1())));
|
|
2640
|
+
const filterDisablePropagation = /*#__PURE__*/flatMap$4(span => get$6(span.context, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(span.parent) : none$1() : some(span));
|
|
4730
2641
|
|
|
4731
2642
|
/** @internal */
|
|
4732
2643
|
const OP_SEQUENTIAL = "Sequential";
|
|
@@ -4821,7 +2732,7 @@ class Running {
|
|
|
4821
2732
|
this.runtimeFlags = runtimeFlags;
|
|
4822
2733
|
}
|
|
4823
2734
|
[symbol$1]() {
|
|
4824
|
-
return pipe(hash(FiberStatusSymbolKey), combine$
|
|
2735
|
+
return pipe(hash(FiberStatusSymbolKey), combine$2(hash(this._tag)), combine$2(hash(this.runtimeFlags)), cached(this));
|
|
4825
2736
|
}
|
|
4826
2737
|
[symbol](that) {
|
|
4827
2738
|
return isFiberStatus(that) && that._tag === OP_RUNNING && this.runtimeFlags === that.runtimeFlags;
|
|
@@ -4838,7 +2749,7 @@ class Suspended {
|
|
|
4838
2749
|
this.blockingOn = blockingOn;
|
|
4839
2750
|
}
|
|
4840
2751
|
[symbol$1]() {
|
|
4841
|
-
return pipe(hash(FiberStatusSymbolKey), combine$
|
|
2752
|
+
return pipe(hash(FiberStatusSymbolKey), combine$2(hash(this._tag)), combine$2(hash(this.runtimeFlags)), combine$2(hash(this.blockingOn)), cached(this));
|
|
4842
2753
|
}
|
|
4843
2754
|
[symbol](that) {
|
|
4844
2755
|
return isFiberStatus(that) && that._tag === OP_SUSPENDED && this.runtimeFlags === that.runtimeFlags && equals$1(this.blockingOn, that.blockingOn);
|
|
@@ -5115,7 +3026,7 @@ const _await$1 = self => self.await;
|
|
|
5115
3026
|
/** @internal */
|
|
5116
3027
|
const inheritAll$1 = self => self.inheritAll;
|
|
5117
3028
|
/** @internal */
|
|
5118
|
-
const join$1 = self => zipLeft$1(flatten$
|
|
3029
|
+
const join$1 = self => zipLeft$1(flatten$5(self.await), self.inheritAll);
|
|
5119
3030
|
/** @internal */
|
|
5120
3031
|
const currentFiberURI = "effect/FiberCurrent";
|
|
5121
3032
|
|
|
@@ -5129,7 +3040,7 @@ class MetricBoundariesImpl {
|
|
|
5129
3040
|
[MetricBoundariesTypeId] = MetricBoundariesTypeId;
|
|
5130
3041
|
constructor(values) {
|
|
5131
3042
|
this.values = values;
|
|
5132
|
-
this._hash = pipe(string(MetricBoundariesSymbolKey), combine$
|
|
3043
|
+
this._hash = pipe(string(MetricBoundariesSymbolKey), combine$2(array(this.values)));
|
|
5133
3044
|
}
|
|
5134
3045
|
_hash;
|
|
5135
3046
|
[symbol$1]() {
|
|
@@ -5211,7 +3122,7 @@ class HistogramKeyType {
|
|
|
5211
3122
|
[HistogramKeyTypeTypeId] = HistogramKeyTypeTypeId;
|
|
5212
3123
|
constructor(boundaries) {
|
|
5213
3124
|
this.boundaries = boundaries;
|
|
5214
|
-
this._hash = pipe(string(HistogramKeyTypeSymbolKey), combine$
|
|
3125
|
+
this._hash = pipe(string(HistogramKeyTypeSymbolKey), combine$2(hash(this.boundaries)));
|
|
5215
3126
|
}
|
|
5216
3127
|
_hash;
|
|
5217
3128
|
[symbol$1]() {
|
|
@@ -5249,7 +3160,7 @@ const metricKeyVariance = {
|
|
|
5249
3160
|
/* c8 ignore next */
|
|
5250
3161
|
_Type: _ => _
|
|
5251
3162
|
};
|
|
5252
|
-
const arrayEquivilence = /*#__PURE__*/getEquivalence
|
|
3163
|
+
const arrayEquivilence = /*#__PURE__*/getEquivalence(equals$1);
|
|
5253
3164
|
/** @internal */
|
|
5254
3165
|
class MetricKeyImpl {
|
|
5255
3166
|
name;
|
|
@@ -5262,7 +3173,7 @@ class MetricKeyImpl {
|
|
|
5262
3173
|
this.keyType = keyType;
|
|
5263
3174
|
this.description = description;
|
|
5264
3175
|
this.tags = tags;
|
|
5265
|
-
this._hash = pipe(string(this.name + this.description), combine$
|
|
3176
|
+
this._hash = pipe(string(this.name + this.description), combine$2(hash(this.keyType)), combine$2(array(this.tags)));
|
|
5266
3177
|
}
|
|
5267
3178
|
_hash;
|
|
5268
3179
|
[symbol$1]() {
|
|
@@ -5321,7 +3232,7 @@ class CounterState {
|
|
|
5321
3232
|
this.count = count;
|
|
5322
3233
|
}
|
|
5323
3234
|
[symbol$1]() {
|
|
5324
|
-
return pipe(hash(CounterStateSymbolKey), combine$
|
|
3235
|
+
return pipe(hash(CounterStateSymbolKey), combine$2(hash(this.count)), cached(this));
|
|
5325
3236
|
}
|
|
5326
3237
|
[symbol](that) {
|
|
5327
3238
|
return isCounterState(that) && this.count === that.count;
|
|
@@ -5330,7 +3241,7 @@ class CounterState {
|
|
|
5330
3241
|
return pipeArguments(this, arguments);
|
|
5331
3242
|
}
|
|
5332
3243
|
}
|
|
5333
|
-
const arrayEquals = /*#__PURE__*/getEquivalence
|
|
3244
|
+
const arrayEquals = /*#__PURE__*/getEquivalence(equals$1);
|
|
5334
3245
|
/** @internal */
|
|
5335
3246
|
class FrequencyState {
|
|
5336
3247
|
occurrences;
|
|
@@ -5341,10 +3252,10 @@ class FrequencyState {
|
|
|
5341
3252
|
}
|
|
5342
3253
|
_hash;
|
|
5343
3254
|
[symbol$1]() {
|
|
5344
|
-
return pipe(string(FrequencyStateSymbolKey), combine$
|
|
3255
|
+
return pipe(string(FrequencyStateSymbolKey), combine$2(array(fromIterable$2(this.occurrences.entries()))), cached(this));
|
|
5345
3256
|
}
|
|
5346
3257
|
[symbol](that) {
|
|
5347
|
-
return isFrequencyState(that) && arrayEquals(fromIterable$
|
|
3258
|
+
return isFrequencyState(that) && arrayEquals(fromIterable$2(this.occurrences.entries()), fromIterable$2(that.occurrences.entries()));
|
|
5348
3259
|
}
|
|
5349
3260
|
pipe() {
|
|
5350
3261
|
return pipeArguments(this, arguments);
|
|
@@ -5359,7 +3270,7 @@ class GaugeState {
|
|
|
5359
3270
|
this.value = value;
|
|
5360
3271
|
}
|
|
5361
3272
|
[symbol$1]() {
|
|
5362
|
-
return pipe(hash(GaugeStateSymbolKey), combine$
|
|
3273
|
+
return pipe(hash(GaugeStateSymbolKey), combine$2(hash(this.value)), cached(this));
|
|
5363
3274
|
}
|
|
5364
3275
|
[symbol](u) {
|
|
5365
3276
|
return isGaugeState(u) && this.value === u.value;
|
|
@@ -5385,7 +3296,7 @@ class HistogramState {
|
|
|
5385
3296
|
this.sum = sum;
|
|
5386
3297
|
}
|
|
5387
3298
|
[symbol$1]() {
|
|
5388
|
-
return pipe(hash(HistogramStateSymbolKey), combine$
|
|
3299
|
+
return pipe(hash(HistogramStateSymbolKey), combine$2(hash(this.buckets)), combine$2(hash(this.count)), combine$2(hash(this.min)), combine$2(hash(this.max)), combine$2(hash(this.sum)), cached(this));
|
|
5389
3300
|
}
|
|
5390
3301
|
[symbol](that) {
|
|
5391
3302
|
return isHistogramState(that) && equals$1(this.buckets, that.buckets) && this.count === that.count && this.min === that.min && this.max === that.max && this.sum === that.sum;
|
|
@@ -5413,7 +3324,7 @@ class SummaryState {
|
|
|
5413
3324
|
this.sum = sum;
|
|
5414
3325
|
}
|
|
5415
3326
|
[symbol$1]() {
|
|
5416
|
-
return pipe(hash(SummaryStateSymbolKey), combine$
|
|
3327
|
+
return pipe(hash(SummaryStateSymbolKey), combine$2(hash(this.error)), combine$2(hash(this.quantiles)), combine$2(hash(this.count)), combine$2(hash(this.min)), combine$2(hash(this.max)), combine$2(hash(this.sum)), cached(this));
|
|
5417
3328
|
}
|
|
5418
3329
|
[symbol](that) {
|
|
5419
3330
|
return isSummaryState(that) && this.error === that.error && equals$1(this.quantiles, that.quantiles) && this.count === that.count && this.min === that.min && this.max === that.max && this.sum === that.sum;
|
|
@@ -5535,7 +3446,7 @@ const histogram$1 = key => {
|
|
|
5535
3446
|
let sum = 0;
|
|
5536
3447
|
let min = Number.MAX_VALUE;
|
|
5537
3448
|
let max = Number.MIN_VALUE;
|
|
5538
|
-
pipe(bounds, sort(Order$1), map$
|
|
3449
|
+
pipe(bounds, sort(Order$1), map$8((n, i) => {
|
|
5539
3450
|
boundaries[i] = n;
|
|
5540
3451
|
}));
|
|
5541
3452
|
// Insert the value into the right bucket with a binary search
|
|
@@ -5665,16 +3576,16 @@ const calculateQuantiles = (error, sortedQuantiles, sortedSamples) => {
|
|
|
5665
3576
|
// The number of samples examined
|
|
5666
3577
|
const sampleCount = sortedSamples.length;
|
|
5667
3578
|
if (!isNonEmptyReadonlyArray(sortedQuantiles)) {
|
|
5668
|
-
return empty$
|
|
3579
|
+
return empty$c();
|
|
5669
3580
|
}
|
|
5670
3581
|
const head = sortedQuantiles[0];
|
|
5671
3582
|
const tail = sortedQuantiles.slice(1);
|
|
5672
|
-
const resolvedHead = resolveQuantile(error, sampleCount, none$
|
|
3583
|
+
const resolvedHead = resolveQuantile(error, sampleCount, none$1(), 0, head, sortedSamples);
|
|
5673
3584
|
const resolved = of$3(resolvedHead);
|
|
5674
3585
|
tail.forEach(quantile => {
|
|
5675
3586
|
resolved.push(resolveQuantile(error, sampleCount, resolvedHead.value, resolvedHead.consumed, quantile, resolvedHead.rest));
|
|
5676
3587
|
});
|
|
5677
|
-
return map$
|
|
3588
|
+
return map$8(resolved, rq => [rq.quantile, rq.value]);
|
|
5678
3589
|
};
|
|
5679
3590
|
/** @internal */
|
|
5680
3591
|
const resolveQuantile = (error, sampleCount, current, consumed, quantile, rest) => {
|
|
@@ -5696,7 +3607,7 @@ const resolveQuantile = (error, sampleCount, current, consumed, quantile, rest)
|
|
|
5696
3607
|
if (!isNonEmptyReadonlyArray(rest_1)) {
|
|
5697
3608
|
return {
|
|
5698
3609
|
quantile: quantile_1,
|
|
5699
|
-
value: none$
|
|
3610
|
+
value: none$1(),
|
|
5700
3611
|
consumed: consumed_1,
|
|
5701
3612
|
rest: []
|
|
5702
3613
|
};
|
|
@@ -5713,7 +3624,7 @@ const resolveQuantile = (error, sampleCount, current, consumed, quantile, rest)
|
|
|
5713
3624
|
}
|
|
5714
3625
|
// Split into two chunks - the first chunk contains all elements of the same
|
|
5715
3626
|
// value as the chunk head
|
|
5716
|
-
const headValue = headNonEmpty
|
|
3627
|
+
const headValue = headNonEmpty(rest_1); // Get head value since rest_1 is non-empty
|
|
5717
3628
|
const sameHead = span(rest_1, n => n === headValue);
|
|
5718
3629
|
// How many elements do we want to accept for this quantile
|
|
5719
3630
|
const desired = quantile_1 * sampleCount_1;
|
|
@@ -6033,7 +3944,7 @@ class ProxySupervisor {
|
|
|
6033
3944
|
this.underlying.onResume(fiber);
|
|
6034
3945
|
}
|
|
6035
3946
|
map(f) {
|
|
6036
|
-
return new ProxySupervisor(this, pipe(this.value, map$
|
|
3947
|
+
return new ProxySupervisor(this, pipe(this.value, map$9(f)));
|
|
6037
3948
|
}
|
|
6038
3949
|
zip(right) {
|
|
6039
3950
|
return new Zip(this, right);
|
|
@@ -6050,7 +3961,7 @@ class Zip {
|
|
|
6050
3961
|
this.right = right;
|
|
6051
3962
|
}
|
|
6052
3963
|
get value() {
|
|
6053
|
-
return zip$
|
|
3964
|
+
return zip$4(this.left.value, this.right.value);
|
|
6054
3965
|
}
|
|
6055
3966
|
onStart(context, effect, parent, fiber) {
|
|
6056
3967
|
this.left.onStart(context, effect, parent, fiber);
|
|
@@ -6073,7 +3984,7 @@ class Zip {
|
|
|
6073
3984
|
this.right.onResume(fiber);
|
|
6074
3985
|
}
|
|
6075
3986
|
map(f) {
|
|
6076
|
-
return new ProxySupervisor(this, pipe(this.value, map$
|
|
3987
|
+
return new ProxySupervisor(this, pipe(this.value, map$9(f)));
|
|
6077
3988
|
}
|
|
6078
3989
|
zip(right) {
|
|
6079
3990
|
return new Zip(this, right);
|
|
@@ -6107,7 +4018,7 @@ class Const {
|
|
|
6107
4018
|
//
|
|
6108
4019
|
}
|
|
6109
4020
|
map(f) {
|
|
6110
|
-
return new ProxySupervisor(this, pipe(this.value, map$
|
|
4021
|
+
return new ProxySupervisor(this, pipe(this.value, map$9(f)));
|
|
6111
4022
|
}
|
|
6112
4023
|
zip(right) {
|
|
6113
4024
|
return new Zip(this, right);
|
|
@@ -6129,7 +4040,7 @@ const none = /*#__PURE__*/globalValue("effect/Supervisor/none", () => fromEffect
|
|
|
6129
4040
|
* @since 2.0.0
|
|
6130
4041
|
* @category constructors
|
|
6131
4042
|
*/
|
|
6132
|
-
const make$8 = make$
|
|
4043
|
+
const make$8 = make$o;
|
|
6133
4044
|
|
|
6134
4045
|
/** @internal */
|
|
6135
4046
|
const OP_EMPTY = "Empty";
|
|
@@ -6173,28 +4084,28 @@ const patchLoop = (_supervisor, _patches) => {
|
|
|
6173
4084
|
let supervisor = _supervisor;
|
|
6174
4085
|
let patches = _patches;
|
|
6175
4086
|
while (isNonEmpty$2(patches)) {
|
|
6176
|
-
const head = headNonEmpty(patches);
|
|
4087
|
+
const head = headNonEmpty$1(patches);
|
|
6177
4088
|
switch (head._tag) {
|
|
6178
4089
|
case OP_EMPTY:
|
|
6179
4090
|
{
|
|
6180
|
-
patches = tailNonEmpty(patches);
|
|
4091
|
+
patches = tailNonEmpty$1(patches);
|
|
6181
4092
|
break;
|
|
6182
4093
|
}
|
|
6183
4094
|
case OP_ADD_SUPERVISOR:
|
|
6184
4095
|
{
|
|
6185
4096
|
supervisor = supervisor.zip(head.supervisor);
|
|
6186
|
-
patches = tailNonEmpty(patches);
|
|
4097
|
+
patches = tailNonEmpty$1(patches);
|
|
6187
4098
|
break;
|
|
6188
4099
|
}
|
|
6189
4100
|
case OP_REMOVE_SUPERVISOR:
|
|
6190
4101
|
{
|
|
6191
4102
|
supervisor = removeSupervisor(supervisor, head.supervisor);
|
|
6192
|
-
patches = tailNonEmpty(patches);
|
|
4103
|
+
patches = tailNonEmpty$1(patches);
|
|
6193
4104
|
break;
|
|
6194
4105
|
}
|
|
6195
4106
|
case OP_AND_THEN:
|
|
6196
4107
|
{
|
|
6197
|
-
patches = prepend
|
|
4108
|
+
patches = prepend(head.first)(prepend(head.second)(tailNonEmpty$1(patches)));
|
|
6198
4109
|
break;
|
|
6199
4110
|
}
|
|
6200
4111
|
}
|
|
@@ -6216,12 +4127,12 @@ const removeSupervisor = (self, that) => {
|
|
|
6216
4127
|
/** @internal */
|
|
6217
4128
|
const toSet = self => {
|
|
6218
4129
|
if (equals$1(self, none)) {
|
|
6219
|
-
return empty$
|
|
4130
|
+
return empty$e();
|
|
6220
4131
|
} else {
|
|
6221
4132
|
if (isZip(self)) {
|
|
6222
4133
|
return pipe(toSet(self.left), union$1(toSet(self.right)));
|
|
6223
4134
|
} else {
|
|
6224
|
-
return make$
|
|
4135
|
+
return make$p(self);
|
|
6225
4136
|
}
|
|
6226
4137
|
}
|
|
6227
4138
|
};
|
|
@@ -6232,11 +4143,11 @@ const diff = (oldValue, newValue) => {
|
|
|
6232
4143
|
}
|
|
6233
4144
|
const oldSupervisors = toSet(oldValue);
|
|
6234
4145
|
const newSupervisors = toSet(newValue);
|
|
6235
|
-
const added = pipe(newSupervisors, difference(oldSupervisors), reduce$
|
|
4146
|
+
const added = pipe(newSupervisors, difference(oldSupervisors), reduce$2(empty$2, (patch, supervisor) => combine(patch, {
|
|
6236
4147
|
_tag: OP_ADD_SUPERVISOR,
|
|
6237
4148
|
supervisor
|
|
6238
4149
|
})));
|
|
6239
|
-
const removed = pipe(oldSupervisors, difference(newSupervisors), reduce$
|
|
4150
|
+
const removed = pipe(oldSupervisors, difference(newSupervisors), reduce$2(empty$2, (patch, supervisor) => combine(patch, {
|
|
6240
4151
|
_tag: OP_REMOVE_SUPERVISOR,
|
|
6241
4152
|
supervisor
|
|
6242
4153
|
})));
|
|
@@ -6301,7 +4212,7 @@ const contOpSuccess = {
|
|
|
6301
4212
|
},
|
|
6302
4213
|
[OP_REVERT_FLAGS]: (self, cont, value) => {
|
|
6303
4214
|
self.patchRuntimeFlags(self.currentRuntimeFlags, cont.patch);
|
|
6304
|
-
if (interruptible$
|
|
4215
|
+
if (interruptible$1(self.currentRuntimeFlags) && self.isInterrupted()) {
|
|
6305
4216
|
return exitFailCause(self.getInterruptedCause());
|
|
6306
4217
|
} else {
|
|
6307
4218
|
return exitSucceed(value);
|
|
@@ -6336,7 +4247,7 @@ const contOpSuccess = {
|
|
|
6336
4247
|
const drainQueueWhileRunningTable = {
|
|
6337
4248
|
[OP_INTERRUPT_SIGNAL]: (self, runtimeFlags, cur, message) => {
|
|
6338
4249
|
self.processNewInterruptSignal(message.cause);
|
|
6339
|
-
return interruptible$
|
|
4250
|
+
return interruptible$1(runtimeFlags) ? exitFailCause(message.cause) : cur;
|
|
6340
4251
|
},
|
|
6341
4252
|
[OP_RESUME]: (_self, _runtimeFlags, _cur, _message) => {
|
|
6342
4253
|
throw new Error("It is illegal to have multiple concurrent run loops in a single fiber");
|
|
@@ -6352,7 +4263,7 @@ const drainQueueWhileRunningTable = {
|
|
|
6352
4263
|
/**
|
|
6353
4264
|
* Executes all requests, submitting requests to each data source in parallel.
|
|
6354
4265
|
*/
|
|
6355
|
-
const runBlockedRequests = self => forEachSequentialDiscard(flatten$
|
|
4266
|
+
const runBlockedRequests = self => forEachSequentialDiscard(flatten$3(self), requestsByRequestResolver => forEachConcurrentDiscard(sequentialCollectionToChunk(requestsByRequestResolver), ([dataSource, sequential]) => {
|
|
6356
4267
|
const map = new Map();
|
|
6357
4268
|
const arr = [];
|
|
6358
4269
|
for (const block of sequential) {
|
|
@@ -6553,13 +4464,13 @@ class FiberRuntime extends Class {
|
|
|
6553
4464
|
* In the background, interrupts the fiber as if interrupted from the specified fiber.
|
|
6554
4465
|
*/
|
|
6555
4466
|
interruptAsFork(fiberId) {
|
|
6556
|
-
return sync$2(() => this.tell(interruptSignal(interrupt$
|
|
4467
|
+
return sync$2(() => this.tell(interruptSignal(interrupt$3(fiberId))));
|
|
6557
4468
|
}
|
|
6558
4469
|
/**
|
|
6559
4470
|
* In the background, interrupts the fiber as if interrupted from the specified fiber.
|
|
6560
4471
|
*/
|
|
6561
4472
|
unsafeInterruptAsFork(fiberId) {
|
|
6562
|
-
this.tell(interruptSignal(interrupt$
|
|
4473
|
+
this.tell(interruptSignal(interrupt$3(fiberId)));
|
|
6563
4474
|
}
|
|
6564
4475
|
/**
|
|
6565
4476
|
* Adds an observer to the list of observers.
|
|
@@ -6753,7 +4664,7 @@ class FiberRuntime extends Class {
|
|
|
6753
4664
|
* log annotations and log level) may not be up-to-date.
|
|
6754
4665
|
*/
|
|
6755
4666
|
isInterrupted() {
|
|
6756
|
-
return !isEmpty$
|
|
4667
|
+
return !isEmpty$5(this.getFiberRef(currentInterruptedCause));
|
|
6757
4668
|
}
|
|
6758
4669
|
/**
|
|
6759
4670
|
* Adds an interruptor to the set of interruptors that are interrupting this
|
|
@@ -6787,7 +4698,7 @@ class FiberRuntime extends Class {
|
|
|
6787
4698
|
}
|
|
6788
4699
|
let told = false;
|
|
6789
4700
|
for (const child of this._children) {
|
|
6790
|
-
child.tell(interruptSignal(interrupt$
|
|
4701
|
+
child.tell(interruptSignal(interrupt$3(this.id())));
|
|
6791
4702
|
told = true;
|
|
6792
4703
|
}
|
|
6793
4704
|
return told;
|
|
@@ -6873,7 +4784,7 @@ class FiberRuntime extends Class {
|
|
|
6873
4784
|
const loggers = this.getLoggers();
|
|
6874
4785
|
const contextMap = this.getFiberRefs();
|
|
6875
4786
|
if (size$2(loggers) > 0) {
|
|
6876
|
-
const clockService = get$
|
|
4787
|
+
const clockService = get$6(this.getFiberRef(currentServices), clockTag);
|
|
6877
4788
|
const date = new Date(clockService.unsafeCurrentTimeMillis());
|
|
6878
4789
|
withRedactableContext(contextMap, () => {
|
|
6879
4790
|
for (const logger of loggers) {
|
|
@@ -6939,7 +4850,7 @@ class FiberRuntime extends Class {
|
|
|
6939
4850
|
evaluateEffect(effect0) {
|
|
6940
4851
|
this.currentSupervisor.onResume(this);
|
|
6941
4852
|
try {
|
|
6942
|
-
let effect = interruptible$
|
|
4853
|
+
let effect = interruptible$1(this.currentRuntimeFlags) && this.isInterrupted() ? exitFailCause(this.getInterruptedCause()) : effect0;
|
|
6943
4854
|
while (effect !== null) {
|
|
6944
4855
|
const eff = effect;
|
|
6945
4856
|
const exit = this.runLoop(eff);
|
|
@@ -6959,7 +4870,7 @@ class FiberRuntime extends Class {
|
|
|
6959
4870
|
effect = null;
|
|
6960
4871
|
}
|
|
6961
4872
|
} else {
|
|
6962
|
-
this.currentRuntimeFlags = pipe(this.currentRuntimeFlags, enable
|
|
4873
|
+
this.currentRuntimeFlags = pipe(this.currentRuntimeFlags, enable(WindDown));
|
|
6963
4874
|
const interruption = this.interruptAllChildren();
|
|
6964
4875
|
if (interruption !== null) {
|
|
6965
4876
|
effect = flatMap$3(interruption, () => exit);
|
|
@@ -7048,13 +4959,13 @@ class FiberRuntime extends Class {
|
|
|
7048
4959
|
this.tell(resume(effect));
|
|
7049
4960
|
}
|
|
7050
4961
|
};
|
|
7051
|
-
if (interruptible$
|
|
4962
|
+
if (interruptible$1(runtimeFlags)) {
|
|
7052
4963
|
this._asyncInterruptor = callback;
|
|
7053
4964
|
}
|
|
7054
4965
|
try {
|
|
7055
4966
|
asyncRegister(callback);
|
|
7056
4967
|
} catch (e) {
|
|
7057
|
-
callback(failCause$6(die$
|
|
4968
|
+
callback(failCause$6(die$2(e)));
|
|
7058
4969
|
}
|
|
7059
4970
|
}
|
|
7060
4971
|
pushStack(cont) {
|
|
@@ -7120,7 +5031,7 @@ class FiberRuntime extends Class {
|
|
|
7120
5031
|
switch (exit.cause._tag) {
|
|
7121
5032
|
case "Interrupt":
|
|
7122
5033
|
{
|
|
7123
|
-
return resume(exitFailCause(interrupt$
|
|
5034
|
+
return resume(exitFailCause(interrupt$3(none$2)));
|
|
7124
5035
|
}
|
|
7125
5036
|
case "Fail":
|
|
7126
5037
|
{
|
|
@@ -7128,7 +5039,7 @@ class FiberRuntime extends Class {
|
|
|
7128
5039
|
}
|
|
7129
5040
|
case "Die":
|
|
7130
5041
|
{
|
|
7131
|
-
return resume(die$
|
|
5042
|
+
return resume(die$3(exit.cause.defect));
|
|
7132
5043
|
}
|
|
7133
5044
|
}
|
|
7134
5045
|
});
|
|
@@ -7178,7 +5089,7 @@ class FiberRuntime extends Class {
|
|
|
7178
5089
|
case OP_ON_FAILURE:
|
|
7179
5090
|
case OP_ON_SUCCESS_AND_FAILURE:
|
|
7180
5091
|
{
|
|
7181
|
-
if (!(interruptible$
|
|
5092
|
+
if (!(interruptible$1(this.currentRuntimeFlags) && this.isInterrupted())) {
|
|
7182
5093
|
return internalCall(() => cont.effect_instruction_i1(cause));
|
|
7183
5094
|
} else {
|
|
7184
5095
|
return exitFailCause(stripFailures(cause));
|
|
@@ -7186,7 +5097,7 @@ class FiberRuntime extends Class {
|
|
|
7186
5097
|
}
|
|
7187
5098
|
case "OnStep":
|
|
7188
5099
|
{
|
|
7189
|
-
if (!(interruptible$
|
|
5100
|
+
if (!(interruptible$1(this.currentRuntimeFlags) && this.isInterrupted())) {
|
|
7190
5101
|
return exitSucceed(exitFailCause(cause));
|
|
7191
5102
|
} else {
|
|
7192
5103
|
return exitFailCause(stripFailures(cause));
|
|
@@ -7195,7 +5106,7 @@ class FiberRuntime extends Class {
|
|
|
7195
5106
|
case OP_REVERT_FLAGS:
|
|
7196
5107
|
{
|
|
7197
5108
|
this.patchRuntimeFlags(this.currentRuntimeFlags, cont.patch);
|
|
7198
|
-
if (interruptible$
|
|
5109
|
+
if (interruptible$1(this.currentRuntimeFlags) && this.isInterrupted()) {
|
|
7199
5110
|
return exitFailCause(sequential$2(cause, this.getInterruptedCause()));
|
|
7200
5111
|
} else {
|
|
7201
5112
|
return exitFailCause(cause);
|
|
@@ -7251,7 +5162,7 @@ class FiberRuntime extends Class {
|
|
|
7251
5162
|
// to interrupt. Interruption will cause immediate reversion of
|
|
7252
5163
|
// the flag, so as long as we "peek ahead", there's no need to
|
|
7253
5164
|
// set them to begin with.
|
|
7254
|
-
if (interruptible$
|
|
5165
|
+
if (interruptible$1(newRuntimeFlags) && this.isInterrupted()) {
|
|
7255
5166
|
return exitFailCause(this.getInterruptedCause());
|
|
7256
5167
|
} else {
|
|
7257
5168
|
// Impossible to short circuit, so record the changes
|
|
@@ -7343,7 +5254,7 @@ class FiberRuntime extends Class {
|
|
|
7343
5254
|
const level = this.getFiberRef(currentVersionMismatchErrorLogLevel);
|
|
7344
5255
|
if (level._tag === "Some") {
|
|
7345
5256
|
const effectVersion = cur[EffectTypeId]._V;
|
|
7346
|
-
this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$
|
|
5257
|
+
this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$f, level);
|
|
7347
5258
|
}
|
|
7348
5259
|
}
|
|
7349
5260
|
// @ts-expect-error
|
|
@@ -7355,15 +5266,15 @@ class FiberRuntime extends Class {
|
|
|
7355
5266
|
return YieldedOp;
|
|
7356
5267
|
}
|
|
7357
5268
|
yieldedOpChannel.currentOp = null;
|
|
7358
|
-
return op._op === OP_SUCCESS || op._op === OP_FAILURE ? op : exitFailCause(die$
|
|
5269
|
+
return op._op === OP_SUCCESS || op._op === OP_FAILURE ? op : exitFailCause(die$2(op));
|
|
7359
5270
|
}
|
|
7360
5271
|
} catch (e) {
|
|
7361
5272
|
if (cur !== YieldedOp && !hasProperty(cur, "_op") || !(cur._op in this)) {
|
|
7362
5273
|
cur = dieMessage$1(`Not a valid effect: ${toStringUnknown(cur)}`);
|
|
7363
5274
|
} else if (isInterruptedException(e)) {
|
|
7364
|
-
cur = exitFailCause(sequential$2(die$
|
|
5275
|
+
cur = exitFailCause(sequential$2(die$2(e), interrupt$3(none$2)));
|
|
7365
5276
|
} else {
|
|
7366
|
-
cur = die$
|
|
5277
|
+
cur = die$3(e);
|
|
7367
5278
|
}
|
|
7368
5279
|
}
|
|
7369
5280
|
}
|
|
@@ -7378,7 +5289,7 @@ const currentMinimumLogLevel = /*#__PURE__*/globalValue("effect/FiberRef/current
|
|
|
7378
5289
|
/** @internal */
|
|
7379
5290
|
const loggerWithConsoleLog = self => makeLogger(opts => {
|
|
7380
5291
|
const services = getOrDefault(opts.context, currentServices);
|
|
7381
|
-
get$
|
|
5292
|
+
get$6(services, consoleTag).unsafe.log(self.log(opts));
|
|
7382
5293
|
});
|
|
7383
5294
|
/** @internal */
|
|
7384
5295
|
const defaultLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Logger/defaultLogger"), () => loggerWithConsoleLog(stringLogger));
|
|
@@ -7410,11 +5321,11 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
|
|
|
7410
5321
|
span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
|
|
7411
5322
|
}));
|
|
7412
5323
|
/** @internal */
|
|
7413
|
-
const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$
|
|
5324
|
+
const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$p(defaultLogger, tracerLogger)));
|
|
7414
5325
|
// === all
|
|
7415
5326
|
const allResolveInput = input => {
|
|
7416
5327
|
if (Array.isArray(input) || isIterable(input)) {
|
|
7417
|
-
return [input, none$
|
|
5328
|
+
return [input, none$1()];
|
|
7418
5329
|
}
|
|
7419
5330
|
const keys = Object.keys(input);
|
|
7420
5331
|
const size = keys.length;
|
|
@@ -7436,7 +5347,7 @@ const allValidate = (effects, reconcile, options) => {
|
|
|
7436
5347
|
batching: options?.batching,
|
|
7437
5348
|
concurrentFinalizers: options?.concurrentFinalizers
|
|
7438
5349
|
}), eithers => {
|
|
7439
|
-
const none = none$
|
|
5350
|
+
const none = none$1();
|
|
7440
5351
|
const size = eithers.length;
|
|
7441
5352
|
const errors = new Array(size);
|
|
7442
5353
|
const successes = new Array(size);
|
|
@@ -7472,7 +5383,7 @@ const allEither = (effects, reconcile, options) => {
|
|
|
7472
5383
|
concurrentFinalizers: options?.concurrentFinalizers
|
|
7473
5384
|
});
|
|
7474
5385
|
}
|
|
7475
|
-
return map$
|
|
5386
|
+
return map$9(forEach$1(eitherEffects, identity, {
|
|
7476
5387
|
concurrency: options?.concurrency,
|
|
7477
5388
|
batching: options?.batching,
|
|
7478
5389
|
concurrentFinalizers: options?.concurrentFinalizers
|
|
@@ -7486,7 +5397,7 @@ const all$1 = (arg, options) => {
|
|
|
7486
5397
|
} else if (options?.mode === "either") {
|
|
7487
5398
|
return allEither(effects, reconcile, options);
|
|
7488
5399
|
}
|
|
7489
|
-
return options?.discard !== true && reconcile._tag === "Some" ? map$
|
|
5400
|
+
return options?.discard !== true && reconcile._tag === "Some" ? map$9(forEach$1(effects, identity, options), reconcile.value) : forEach$1(effects, identity, options);
|
|
7490
5401
|
};
|
|
7491
5402
|
/* @internal */
|
|
7492
5403
|
const forEach$1 = /*#__PURE__*/dual(args => isIterable(args[0]), (self, f, options) => withFiberRuntime$1(r => {
|
|
@@ -7498,7 +5409,7 @@ const forEach$1 = /*#__PURE__*/dual(args => isIterable(args[0]), (self, f, optio
|
|
|
7498
5409
|
}));
|
|
7499
5410
|
/* @internal */
|
|
7500
5411
|
const forEachParUnbounded = (self, f, batching) => suspend$3(() => {
|
|
7501
|
-
const as = fromIterable$
|
|
5412
|
+
const as = fromIterable$2(self);
|
|
7502
5413
|
const array = new Array(as.length);
|
|
7503
5414
|
const fn = (a, i) => flatMap$3(f(a, i), b => sync$2(() => array[i] = b));
|
|
7504
5415
|
return zipRight$3(forEachConcurrentDiscard(as, fn, batching, false), succeed$4(array));
|
|
@@ -7553,7 +5464,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
|
|
|
7553
5464
|
interrupted = true;
|
|
7554
5465
|
interruptAll();
|
|
7555
5466
|
};
|
|
7556
|
-
const stepOrExit = batching ? step : exit$1;
|
|
5467
|
+
const stepOrExit = batching ? step$1 : exit$1;
|
|
7557
5468
|
const processingFiber = runFiber(async_(resume => {
|
|
7558
5469
|
const pushResult = (res, index) => {
|
|
7559
5470
|
if (res._op === "Blocked") {
|
|
@@ -7625,7 +5536,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
|
|
|
7625
5536
|
next();
|
|
7626
5537
|
}
|
|
7627
5538
|
}));
|
|
7628
|
-
return asVoid$1(onExit(flatten$
|
|
5539
|
+
return asVoid$1(onExit(flatten$5(restore(join$1(processingFiber))), exitMatch({
|
|
7629
5540
|
onFailure: cause => {
|
|
7630
5541
|
onInterruptSignal();
|
|
7631
5542
|
const target = residual.length + 1;
|
|
@@ -7659,9 +5570,9 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
|
|
|
7659
5570
|
})));
|
|
7660
5571
|
/* @internal */
|
|
7661
5572
|
const forEachParN = (self, n, f, batching) => suspend$3(() => {
|
|
7662
|
-
const as = fromIterable$
|
|
5573
|
+
const as = fromIterable$2(self);
|
|
7663
5574
|
const array = new Array(as.length);
|
|
7664
|
-
const fn = (a, i) => map$
|
|
5575
|
+
const fn = (a, i) => map$9(f(a, i), b => array[i] = b);
|
|
7665
5576
|
return zipRight$3(forEachConcurrentDiscard(as, fn, batching, false, n), succeed$4(array));
|
|
7666
5577
|
});
|
|
7667
5578
|
/* @internal */
|
|
@@ -7769,7 +5680,7 @@ const zipRightOptions = /*#__PURE__*/dual(args => isEffect$1(args[1]), (self, th
|
|
|
7769
5680
|
return zipWithOptions(self, that, (_, b) => b, options);
|
|
7770
5681
|
});
|
|
7771
5682
|
/** @internal */
|
|
7772
|
-
const zipWithOptions = /*#__PURE__*/dual(args => isEffect$1(args[1]), (self, that, f, options) => map$
|
|
5683
|
+
const zipWithOptions = /*#__PURE__*/dual(args => isEffect$1(args[1]), (self, that, f, options) => map$9(all$1([self, that], {
|
|
7773
5684
|
concurrency: options?.concurrent ? 2 : 1,
|
|
7774
5685
|
batching: options?.batching,
|
|
7775
5686
|
concurrentFinalizers: options?.concurrentFinalizers
|
|
@@ -7821,11 +5732,11 @@ const ScopeImplProto = {
|
|
|
7821
5732
|
if (finalizers.length === 0) {
|
|
7822
5733
|
return void_$2;
|
|
7823
5734
|
}
|
|
7824
|
-
return isSequential(this.strategy) ? pipe(forEachSequential(finalizers, fin => exit$1(fin(exit))), flatMap$3(results => pipe(exitCollectAll(results), map$
|
|
5735
|
+
return isSequential(this.strategy) ? pipe(forEachSequential(finalizers, fin => exit$1(fin(exit))), flatMap$3(results => pipe(exitCollectAll(results), map$6(exitAsVoid), getOrElse(() => exitVoid)))) : isParallel(this.strategy) ? pipe(forEachParUnbounded(finalizers, fin => exit$1(fin(exit)), false), flatMap$3(results => pipe(exitCollectAll(results, {
|
|
7825
5736
|
parallel: true
|
|
7826
|
-
}), map$
|
|
5737
|
+
}), map$6(exitAsVoid), getOrElse(() => exitVoid)))) : pipe(forEachParN(finalizers, this.strategy.parallelism, fin => exit$1(fin(exit)), false), flatMap$3(results => pipe(exitCollectAll(results, {
|
|
7827
5738
|
parallel: true
|
|
7828
|
-
}), map$
|
|
5739
|
+
}), map$6(exitAsVoid), getOrElse(() => exitVoid))));
|
|
7829
5740
|
});
|
|
7830
5741
|
},
|
|
7831
5742
|
addFinalizer(fin) {
|
|
@@ -7852,7 +5763,7 @@ const scopeMake = (strategy = sequential$1) => sync$2(() => scopeUnsafeMake(stra
|
|
|
7852
5763
|
/* @internal */
|
|
7853
5764
|
const scopeExtend = /*#__PURE__*/dual(2, (effect, scope) => mapInputContext(effect,
|
|
7854
5765
|
// @ts-expect-error
|
|
7855
|
-
merge$
|
|
5766
|
+
merge$2(make$q(scopeTag, scope))));
|
|
7856
5767
|
// circular with Supervisor
|
|
7857
5768
|
/** @internal */
|
|
7858
5769
|
const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial, {
|
|
@@ -7860,7 +5771,7 @@ const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial,
|
|
|
7860
5771
|
fork: empty$2
|
|
7861
5772
|
});
|
|
7862
5773
|
/** @internal */
|
|
7863
|
-
const currentRuntimeFlags = /*#__PURE__*/fiberRefUnsafeMakeRuntimeFlags(none$
|
|
5774
|
+
const currentRuntimeFlags = /*#__PURE__*/fiberRefUnsafeMakeRuntimeFlags(none$3);
|
|
7864
5775
|
/** @internal */
|
|
7865
5776
|
const currentSupervisor = /*#__PURE__*/fiberRefUnsafeMakeSupervisor(none);
|
|
7866
5777
|
//
|
|
@@ -7907,7 +5818,7 @@ const race$1 = /*#__PURE__*/dual(2, (self, that) => fiberIdWith$1(parentFiberId
|
|
|
7907
5818
|
/** @internal */
|
|
7908
5819
|
const raceFibersWith = /*#__PURE__*/dual(3, (self, other, options) => withFiberRuntime$1((parentFiber, parentStatus) => {
|
|
7909
5820
|
const parentRuntimeFlags = parentStatus.runtimeFlags;
|
|
7910
|
-
const raceIndicator = make$
|
|
5821
|
+
const raceIndicator = make$n(true);
|
|
7911
5822
|
const leftFiber = unsafeMakeChildFiber(self, parentFiber, parentRuntimeFlags, options.selfScope);
|
|
7912
5823
|
const rightFiber = unsafeMakeChildFiber(other, parentFiber, parentRuntimeFlags, options.otherScope);
|
|
7913
5824
|
return async_(cb => {
|
|
@@ -7915,7 +5826,7 @@ const raceFibersWith = /*#__PURE__*/dual(3, (self, other, options) => withFiberR
|
|
|
7915
5826
|
rightFiber.addObserver(() => completeRace(rightFiber, leftFiber, options.onOtherWin, raceIndicator, cb));
|
|
7916
5827
|
leftFiber.startFork(self);
|
|
7917
5828
|
rightFiber.startFork(other);
|
|
7918
|
-
}, combine$
|
|
5829
|
+
}, combine$3(leftFiber.id(), rightFiber.id()));
|
|
7919
5830
|
}));
|
|
7920
5831
|
const completeRace = (winner, loser, cont, ab, cb) => {
|
|
7921
5832
|
if (compareAndSet(true, false)(ab)) {
|
|
@@ -7931,7 +5842,7 @@ const ensuring$3 = /*#__PURE__*/dual(2, (self, finalizer) => uninterruptibleMask
|
|
|
7931
5842
|
onSuccess: a => as$1(finalizer, a)
|
|
7932
5843
|
})));
|
|
7933
5844
|
/** @internal */
|
|
7934
|
-
const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith$1(id => ensuring$3(flatMap$3(forkDaemon$1(interruptible$
|
|
5845
|
+
const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith$1(id => ensuring$3(flatMap$3(forkDaemon$1(interruptible$2(self)), processing => async_(cb => {
|
|
7935
5846
|
const counts = entries.map(_ => _.listeners.count);
|
|
7936
5847
|
const checkDone = () => {
|
|
7937
5848
|
if (counts.every(count => count === 0)) {
|
|
@@ -8005,7 +5916,7 @@ const fail$2 = fail$5;
|
|
|
8005
5916
|
* @since 2.0.0
|
|
8006
5917
|
* @category Constructors
|
|
8007
5918
|
*/
|
|
8008
|
-
const die = die$
|
|
5919
|
+
const die = die$2;
|
|
8009
5920
|
/**
|
|
8010
5921
|
* Creates an `Interrupt` cause from a `FiberId`.
|
|
8011
5922
|
*
|
|
@@ -8020,7 +5931,7 @@ const die = die$3;
|
|
|
8020
5931
|
* @since 2.0.0
|
|
8021
5932
|
* @category Constructors
|
|
8022
5933
|
*/
|
|
8023
|
-
const interrupt$2 = interrupt$
|
|
5934
|
+
const interrupt$2 = interrupt$3;
|
|
8024
5935
|
/**
|
|
8025
5936
|
* Checks if a `Cause` is a `Die` type.
|
|
8026
5937
|
*
|
|
@@ -8109,7 +6020,7 @@ const flipCauseOption = flipCauseOption$1;
|
|
|
8109
6020
|
* @since 2.0.0
|
|
8110
6021
|
* @category Mapping
|
|
8111
6022
|
*/
|
|
8112
|
-
const map$4 = map$
|
|
6023
|
+
const map$4 = map$a;
|
|
8113
6024
|
|
|
8114
6025
|
/** @internal */
|
|
8115
6026
|
const IntervalSymbolKey = "effect/ScheduleInterval";
|
|
@@ -8209,19 +6120,19 @@ const make$6 = intervals => {
|
|
|
8209
6120
|
};
|
|
8210
6121
|
};
|
|
8211
6122
|
/** @internal */
|
|
8212
|
-
const intersect$2 = /*#__PURE__*/dual(2, (self, that) => intersectLoop(self.intervals, that.intervals, empty$
|
|
6123
|
+
const intersect$2 = /*#__PURE__*/dual(2, (self, that) => intersectLoop(self.intervals, that.intervals, empty$b()));
|
|
8213
6124
|
/** @internal */
|
|
8214
6125
|
const intersectLoop = (_left, _right, _acc) => {
|
|
8215
6126
|
let left = _left;
|
|
8216
6127
|
let right = _right;
|
|
8217
6128
|
let acc = _acc;
|
|
8218
6129
|
while (isNonEmpty$2(left) && isNonEmpty$2(right)) {
|
|
8219
|
-
const interval = pipe(headNonEmpty(left), intersect$3(headNonEmpty(right)));
|
|
8220
|
-
const intervals = isEmpty(interval) ? acc : pipe(acc, prepend
|
|
8221
|
-
if (pipe(headNonEmpty(left), lessThan$2(headNonEmpty(right)))) {
|
|
8222
|
-
left = tailNonEmpty(left);
|
|
6130
|
+
const interval = pipe(headNonEmpty$1(left), intersect$3(headNonEmpty$1(right)));
|
|
6131
|
+
const intervals = isEmpty(interval) ? acc : pipe(acc, prepend(interval));
|
|
6132
|
+
if (pipe(headNonEmpty$1(left), lessThan$2(headNonEmpty$1(right)))) {
|
|
6133
|
+
left = tailNonEmpty$1(left);
|
|
8223
6134
|
} else {
|
|
8224
|
-
right = tailNonEmpty(right);
|
|
6135
|
+
right = tailNonEmpty$1(right);
|
|
8225
6136
|
}
|
|
8226
6137
|
acc = intervals;
|
|
8227
6138
|
}
|
|
@@ -8493,7 +6404,7 @@ const forkIn$1 = /*#__PURE__*/dual(2, (self, scope) => withFiberRuntime$1((paren
|
|
|
8493
6404
|
return succeed$4(fiber);
|
|
8494
6405
|
}));
|
|
8495
6406
|
/** @internal */
|
|
8496
|
-
const raceFirst$1 = /*#__PURE__*/dual(2, (self, that) => pipe(exit$1(self), race$1(exit$1(that)), effect => flatten$
|
|
6407
|
+
const raceFirst$1 = /*#__PURE__*/dual(2, (self, that) => pipe(exit$1(self), race$1(exit$1(that)), effect => flatten$5(effect)));
|
|
8497
6408
|
// circular with Synchronized
|
|
8498
6409
|
/** @internal */
|
|
8499
6410
|
const SynchronizedSymbolKey = "effect/Ref/SynchronizedRef";
|
|
@@ -8615,7 +6526,7 @@ const unsafeFork = /*#__PURE__*/makeDual((runtime, self, options) => {
|
|
|
8615
6526
|
const supervisor = fiberRuntime.currentSupervisor;
|
|
8616
6527
|
// we can compare by reference here as _supervisor.none is wrapped with globalValue
|
|
8617
6528
|
if (supervisor !== none) {
|
|
8618
|
-
supervisor.onStart(runtime.context, effect, none$
|
|
6529
|
+
supervisor.onStart(runtime.context, effect, none$1(), fiberRuntime);
|
|
8619
6530
|
fiberRuntime.addObserver(exit => supervisor.onEnd(exit, fiberRuntime));
|
|
8620
6531
|
}
|
|
8621
6532
|
globalScope.add(runtime.runtimeFlags, fiberRuntime);
|
|
@@ -8749,10 +6660,10 @@ const make$3 = options => new RuntimeImpl(options.context, options.runtimeFlags,
|
|
|
8749
6660
|
/** @internal */
|
|
8750
6661
|
const runtime$1 = () => withFiberRuntime$1((state, status) => succeed$4(new RuntimeImpl(state.getFiberRef(currentContext), status.runtimeFlags, state.getFiberRefs())));
|
|
8751
6662
|
/** @internal */
|
|
8752
|
-
const defaultRuntimeFlags = /*#__PURE__*/make$
|
|
6663
|
+
const defaultRuntimeFlags = /*#__PURE__*/make$r(Interruption, CooperativeYielding, RuntimeMetrics);
|
|
8753
6664
|
/** @internal */
|
|
8754
6665
|
const defaultRuntime = /*#__PURE__*/make$3({
|
|
8755
|
-
context: /*#__PURE__*/empty$
|
|
6666
|
+
context: /*#__PURE__*/empty$d(),
|
|
8756
6667
|
runtimeFlags: defaultRuntimeFlags,
|
|
8757
6668
|
fiberRefs: /*#__PURE__*/empty$4()
|
|
8758
6669
|
});
|
|
@@ -8824,7 +6735,7 @@ class MemoMapImpl {
|
|
|
8824
6735
|
})));
|
|
8825
6736
|
return succeed$4([cached, map]);
|
|
8826
6737
|
}
|
|
8827
|
-
return pipe(make$e(0), flatMap$3(observers => pipe(deferredMake(), flatMap$3(deferred => pipe(make$e(() => void_$2), map$
|
|
6738
|
+
return pipe(make$e(0), flatMap$3(observers => pipe(deferredMake(), flatMap$3(deferred => pipe(make$e(() => void_$2), map$9(finalizerRef => {
|
|
8828
6739
|
const resource = uninterruptibleMask$1(restore => pipe(scopeMake(), flatMap$3(innerScope => pipe(restore(flatMap$3(makeBuilder(layer, innerScope, true), f => diffFiberRefs(f(this)))), exit$1, flatMap$3(exit => {
|
|
8829
6740
|
switch (exit._tag) {
|
|
8830
6741
|
case OP_FAILURE:
|
|
@@ -8843,11 +6754,11 @@ class MemoMapImpl {
|
|
|
8843
6754
|
}))), exit => pipe(get$1(finalizerRef), flatMap$3(finalizer => finalizer(exit)))];
|
|
8844
6755
|
return [resource, isFresh(layer) ? map : map.set(layer, memoized)];
|
|
8845
6756
|
}))))));
|
|
8846
|
-
}), flatten$
|
|
6757
|
+
}), flatten$5);
|
|
8847
6758
|
}
|
|
8848
6759
|
}
|
|
8849
6760
|
/** @internal */
|
|
8850
|
-
const makeMemoMap = /*#__PURE__*/suspend$3(() => map$
|
|
6761
|
+
const makeMemoMap = /*#__PURE__*/suspend$3(() => map$9(makeSynchronized(new Map()), ref => new MemoMapImpl(ref)));
|
|
8851
6762
|
/** @internal */
|
|
8852
6763
|
const unsafeMakeMemoMap = () => new MemoMapImpl(unsafeMakeSynchronized(new Map()));
|
|
8853
6764
|
/** @internal */
|
|
@@ -8910,9 +6821,9 @@ const makeBuilder = (self, scope, inMemoMap = false) => {
|
|
|
8910
6821
|
case "MergeAll":
|
|
8911
6822
|
{
|
|
8912
6823
|
const layers = op.layers;
|
|
8913
|
-
return map$
|
|
6824
|
+
return map$9(scopeFork(scope, parallel$1), parallelScope => memoMap => {
|
|
8914
6825
|
const contexts = new Array(layers.length);
|
|
8915
|
-
return map$
|
|
6826
|
+
return map$9(forEachConcurrentDiscard(layers, fnUntraced(function* (layer, i) {
|
|
8916
6827
|
const scope = yield* scopeFork(parallelScope, sequential$1);
|
|
8917
6828
|
const context = yield* memoMap.getOrElseMemoize(layer, scope);
|
|
8918
6829
|
contexts[i] = context;
|
|
@@ -8943,7 +6854,7 @@ const provideSomeRuntime = /*#__PURE__*/dual(2, (self, rt) => {
|
|
|
8943
6854
|
const rollbackFlags = diff$3(newFlags, oldFlags);
|
|
8944
6855
|
fiber.setFiberRefs(newRefs);
|
|
8945
6856
|
fiber.currentRuntimeFlags = newFlags;
|
|
8946
|
-
return ensuring$3(provideSomeContext(restore(self), merge$
|
|
6857
|
+
return ensuring$3(provideSomeContext(restore(self), merge$2(oldContext, rt.context)), withFiberRuntime$1(fiber => {
|
|
8947
6858
|
fiber.setFiberRefs(patch$1(fiber.id(), fiber.getFiberRefs())(rollbackRefs));
|
|
8948
6859
|
fiber.currentRuntimeFlags = patch$4(rollbackFlags)(fiber.currentRuntimeFlags);
|
|
8949
6860
|
return void_$2;
|
|
@@ -9047,7 +6958,7 @@ class ScheduleDriverImpl {
|
|
|
9047
6958
|
this.ref = ref;
|
|
9048
6959
|
}
|
|
9049
6960
|
get state() {
|
|
9050
|
-
return map$
|
|
6961
|
+
return map$9(get$1(this.ref), tuple => tuple[1]);
|
|
9051
6962
|
}
|
|
9052
6963
|
get last() {
|
|
9053
6964
|
return flatMap$3(get$1(this.ref), ([element, _]) => {
|
|
@@ -9065,13 +6976,13 @@ class ScheduleDriverImpl {
|
|
|
9065
6976
|
}
|
|
9066
6977
|
iterationMeta = /*#__PURE__*/unsafeMake$3(defaultIterationMetadata);
|
|
9067
6978
|
get reset() {
|
|
9068
|
-
return set(this.ref, [none$
|
|
6979
|
+
return set(this.ref, [none$1(), this.schedule.initial]).pipe(zipLeft$1(set(this.iterationMeta, defaultIterationMetadata)));
|
|
9069
6980
|
}
|
|
9070
6981
|
next(input) {
|
|
9071
|
-
return pipe(map$
|
|
6982
|
+
return pipe(map$9(get$1(this.ref), tuple => tuple[1]), flatMap$3(state => pipe(currentTimeMillis, flatMap$3(now => pipe(suspend$3(() => this.schedule.step(now, input, state)), flatMap$3(([state, out, decision]) => {
|
|
9072
6983
|
const setState = set(this.ref, [some(out), state]);
|
|
9073
6984
|
if (isDone(decision)) {
|
|
9074
|
-
return setState.pipe(zipRight$3(fail$4(none$
|
|
6985
|
+
return setState.pipe(zipRight$3(fail$4(none$1())));
|
|
9075
6986
|
}
|
|
9076
6987
|
const millis$1 = start(decision.intervals) - now;
|
|
9077
6988
|
if (millis$1 <= 0) {
|
|
@@ -9091,10 +7002,10 @@ const checkEffect = /*#__PURE__*/dual(2, (self, test) => makeWithState(self.init
|
|
|
9091
7002
|
if (isDone(decision)) {
|
|
9092
7003
|
return succeed$4([state, out, done]);
|
|
9093
7004
|
}
|
|
9094
|
-
return map$
|
|
7005
|
+
return map$9(test(input, out), cont => cont ? [state, out, decision] : [state, out, done]);
|
|
9095
7006
|
})));
|
|
9096
7007
|
/** @internal */
|
|
9097
|
-
const driver = self => pipe(make$e([none$
|
|
7008
|
+
const driver = self => pipe(make$e([none$1(), self.initial]), map$9(ref => new ScheduleDriverImpl(self, ref)));
|
|
9098
7009
|
/** @internal */
|
|
9099
7010
|
const intersect = /*#__PURE__*/dual(2, (self, that) => intersectWith(self, that, intersect$1));
|
|
9100
7011
|
/** @internal */
|
|
@@ -9128,9 +7039,9 @@ const intersectWithLoop = (self, that, input, lState, out, lInterval, rState, ou
|
|
|
9128
7039
|
/** @internal */
|
|
9129
7040
|
const map$3 = /*#__PURE__*/dual(2, (self, f) => mapEffect$1(self, out => sync$2(() => f(out))));
|
|
9130
7041
|
/** @internal */
|
|
9131
|
-
const mapEffect$1 = /*#__PURE__*/dual(2, (self, f) => makeWithState(self.initial, (now, input, state) => flatMap$3(self.step(now, input, state), ([state, out, decision]) => map$
|
|
7042
|
+
const mapEffect$1 = /*#__PURE__*/dual(2, (self, f) => makeWithState(self.initial, (now, input, state) => flatMap$3(self.step(now, input, state), ([state, out, decision]) => map$9(f(out), out2 => [state, out2, decision]))));
|
|
9132
7043
|
/** @internal */
|
|
9133
|
-
const passthrough = self => makeWithState(self.initial, (now, input, state) => pipe(self.step(now, input, state), map$
|
|
7044
|
+
const passthrough = self => makeWithState(self.initial, (now, input, state) => pipe(self.step(now, input, state), map$9(([state, _, decision]) => [state, input, decision])));
|
|
9134
7045
|
/** @internal */
|
|
9135
7046
|
const recurs = n => whileOutput(forever$1, out => out < n);
|
|
9136
7047
|
/** @internal */
|
|
@@ -9152,9 +7063,9 @@ class ScheduleDefect {
|
|
|
9152
7063
|
}
|
|
9153
7064
|
}
|
|
9154
7065
|
const isScheduleDefect = u => hasProperty(u, ScheduleDefectTypeId);
|
|
9155
|
-
const scheduleDefectWrap = self => catchAll$1(self, e => die$
|
|
7066
|
+
const scheduleDefectWrap = self => catchAll$1(self, e => die$3(new ScheduleDefect(e)));
|
|
9156
7067
|
/** @internal */
|
|
9157
|
-
const scheduleDefectRefailCause = cause => match$6(find(cause, _ => isDieType$1(_) && isScheduleDefect(_.defect) ? some(_.defect) : none$
|
|
7068
|
+
const scheduleDefectRefailCause = cause => match$6(find(cause, _ => isDieType$1(_) && isScheduleDefect(_.defect) ? some(_.defect) : none$1()), {
|
|
9158
7069
|
onNone: () => cause,
|
|
9159
7070
|
onSome: error => fail$5(error.error)
|
|
9160
7071
|
});
|
|
@@ -9187,7 +7098,7 @@ const repeat_combined = /*#__PURE__*/dual(2, (self, options) => {
|
|
|
9187
7098
|
});
|
|
9188
7099
|
/** @internal */
|
|
9189
7100
|
const repeatOrElse_Effect = /*#__PURE__*/dual(3, (self, schedule, orElse) => flatMap$3(driver(schedule), driver => matchEffect(self, {
|
|
9190
|
-
onFailure: error => orElse(error, none$
|
|
7101
|
+
onFailure: error => orElse(error, none$1()),
|
|
9191
7102
|
onSuccess: value => repeatOrElseEffectLoop(provideServiceEffect(self, CurrentIterationMetadata, get$1(driver.iterationMeta)), driver, (error, option) => provideServiceEffect(orElse(error, option), CurrentIterationMetadata, get$1(driver.iterationMeta)), value)
|
|
9192
7103
|
})));
|
|
9193
7104
|
/** @internal */
|
|
@@ -10113,14 +8024,14 @@ const ignore = ignore$1;
|
|
|
10113
8024
|
* @since 2.0.0
|
|
10114
8025
|
* @category Interruption
|
|
10115
8026
|
*/
|
|
10116
|
-
const interrupt = interrupt$
|
|
8027
|
+
const interrupt = interrupt$4;
|
|
10117
8028
|
/**
|
|
10118
8029
|
* Marks an effect as interruptible.
|
|
10119
8030
|
*
|
|
10120
8031
|
* @since 2.0.0
|
|
10121
8032
|
* @category Interruption
|
|
10122
8033
|
*/
|
|
10123
|
-
const interruptible = interruptible$
|
|
8034
|
+
const interruptible = interruptible$2;
|
|
10124
8035
|
/**
|
|
10125
8036
|
* Marks an effect as uninterruptible.
|
|
10126
8037
|
*
|
|
@@ -10225,7 +8136,7 @@ const asVoid = asVoid$1;
|
|
|
10225
8136
|
* @since 2.0.0
|
|
10226
8137
|
* @category Mapping
|
|
10227
8138
|
*/
|
|
10228
|
-
const map$2 = map$
|
|
8139
|
+
const map$2 = map$9;
|
|
10229
8140
|
/**
|
|
10230
8141
|
* Transforms or modifies the error produced by an effect without affecting its
|
|
10231
8142
|
* success value.
|
|
@@ -10820,7 +8731,7 @@ const flatMap$2 = flatMap$3;
|
|
|
10820
8731
|
* @since 2.0.0
|
|
10821
8732
|
* @category Sequencing
|
|
10822
8733
|
*/
|
|
10823
|
-
const flatten$2 = flatten$
|
|
8734
|
+
const flatten$2 = flatten$5;
|
|
10824
8735
|
/**
|
|
10825
8736
|
* Races two effects and returns the result of the first successful one.
|
|
10826
8737
|
*
|
|
@@ -11924,37 +9835,37 @@ class QueueImpl extends Class {
|
|
|
11924
9835
|
return this.queue.capacity();
|
|
11925
9836
|
}
|
|
11926
9837
|
get size() {
|
|
11927
|
-
return suspend$3(() => catchAll$1(this.unsafeSize(), () => interrupt$
|
|
9838
|
+
return suspend$3(() => catchAll$1(this.unsafeSize(), () => interrupt$4));
|
|
11928
9839
|
}
|
|
11929
9840
|
unsafeSize() {
|
|
11930
|
-
if (get$
|
|
11931
|
-
return none$
|
|
9841
|
+
if (get$5(this.shutdownFlag)) {
|
|
9842
|
+
return none$1();
|
|
11932
9843
|
}
|
|
11933
9844
|
return some(this.queue.length() - length(this.takers) + this.strategy.surplusSize());
|
|
11934
9845
|
}
|
|
11935
9846
|
get isEmpty() {
|
|
11936
|
-
return map$
|
|
9847
|
+
return map$9(this.size, size => size <= 0);
|
|
11937
9848
|
}
|
|
11938
9849
|
get isFull() {
|
|
11939
|
-
return map$
|
|
9850
|
+
return map$9(this.size, size => size >= this.capacity());
|
|
11940
9851
|
}
|
|
11941
9852
|
get shutdown() {
|
|
11942
9853
|
return uninterruptible$1(withFiberRuntime$1(state => {
|
|
11943
|
-
pipe(this.shutdownFlag, set$
|
|
9854
|
+
pipe(this.shutdownFlag, set$3(true));
|
|
11944
9855
|
return pipe(forEachConcurrentDiscard(unsafePollAll(this.takers), d => deferredInterruptWith(d, state.id()), false, false), zipRight$3(this.strategy.shutdown), whenEffect(deferredSucceed(this.shutdownHook, void 0)), asVoid$1);
|
|
11945
9856
|
}));
|
|
11946
9857
|
}
|
|
11947
9858
|
get isShutdown() {
|
|
11948
|
-
return sync$2(() => get$
|
|
9859
|
+
return sync$2(() => get$5(this.shutdownFlag));
|
|
11949
9860
|
}
|
|
11950
9861
|
get awaitShutdown() {
|
|
11951
9862
|
return deferredAwait(this.shutdownHook);
|
|
11952
9863
|
}
|
|
11953
9864
|
isActive() {
|
|
11954
|
-
return !get$
|
|
9865
|
+
return !get$5(this.shutdownFlag);
|
|
11955
9866
|
}
|
|
11956
9867
|
unsafeOffer(value) {
|
|
11957
|
-
if (get$
|
|
9868
|
+
if (get$5(this.shutdownFlag)) {
|
|
11958
9869
|
return false;
|
|
11959
9870
|
}
|
|
11960
9871
|
let noRemaining;
|
|
@@ -11979,8 +9890,8 @@ class QueueImpl extends Class {
|
|
|
11979
9890
|
}
|
|
11980
9891
|
offer(value) {
|
|
11981
9892
|
return suspend$3(() => {
|
|
11982
|
-
if (get$
|
|
11983
|
-
return interrupt$
|
|
9893
|
+
if (get$5(this.shutdownFlag)) {
|
|
9894
|
+
return interrupt$4;
|
|
11984
9895
|
}
|
|
11985
9896
|
let noRemaining;
|
|
11986
9897
|
if (this.queue.length() === 0) {
|
|
@@ -12005,11 +9916,11 @@ class QueueImpl extends Class {
|
|
|
12005
9916
|
}
|
|
12006
9917
|
offerAll(iterable) {
|
|
12007
9918
|
return suspend$3(() => {
|
|
12008
|
-
if (get$
|
|
12009
|
-
return interrupt$
|
|
9919
|
+
if (get$5(this.shutdownFlag)) {
|
|
9920
|
+
return interrupt$4;
|
|
12010
9921
|
}
|
|
12011
|
-
const values = fromIterable$
|
|
12012
|
-
const pTakers = this.queue.length() === 0 ? fromIterable$
|
|
9922
|
+
const values = fromIterable$2(iterable);
|
|
9923
|
+
const pTakers = this.queue.length() === 0 ? fromIterable$2(unsafePollN(this.takers, values.length)) : empty$c;
|
|
12013
9924
|
const [forTakers, remaining] = pipe(values, splitAt(pTakers.length));
|
|
12014
9925
|
for (let i = 0; i < pTakers.length; i++) {
|
|
12015
9926
|
const taker = pTakers[i];
|
|
@@ -12022,13 +9933,13 @@ class QueueImpl extends Class {
|
|
|
12022
9933
|
// Not enough takers, offer to the queue
|
|
12023
9934
|
const surplus = this.queue.offerAll(remaining);
|
|
12024
9935
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
12025
|
-
return isEmpty$
|
|
9936
|
+
return isEmpty$6(surplus) ? succeed$4(true) : this.strategy.handleSurplus(surplus, this.queue, this.takers, this.shutdownFlag);
|
|
12026
9937
|
});
|
|
12027
9938
|
}
|
|
12028
9939
|
get take() {
|
|
12029
9940
|
return withFiberRuntime$1(state => {
|
|
12030
|
-
if (get$
|
|
12031
|
-
return interrupt$
|
|
9941
|
+
if (get$5(this.shutdownFlag)) {
|
|
9942
|
+
return interrupt$4;
|
|
12032
9943
|
}
|
|
12033
9944
|
const item = this.queue.poll(EmptyMutableQueue);
|
|
12034
9945
|
if (item !== EmptyMutableQueue) {
|
|
@@ -12043,7 +9954,7 @@ class QueueImpl extends Class {
|
|
|
12043
9954
|
return pipe(suspend$3(() => {
|
|
12044
9955
|
pipe(this.takers, offer$2(deferred));
|
|
12045
9956
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
12046
|
-
return get$
|
|
9957
|
+
return get$5(this.shutdownFlag) ? interrupt$4 : deferredAwait(deferred);
|
|
12047
9958
|
}), onInterrupt(() => {
|
|
12048
9959
|
return sync$2(() => unsafeRemove(this.takers, deferred));
|
|
12049
9960
|
}));
|
|
@@ -12052,7 +9963,7 @@ class QueueImpl extends Class {
|
|
|
12052
9963
|
}
|
|
12053
9964
|
get takeAll() {
|
|
12054
9965
|
return suspend$3(() => {
|
|
12055
|
-
return get$
|
|
9966
|
+
return get$5(this.shutdownFlag) ? interrupt$4 : sync$2(() => {
|
|
12056
9967
|
const values = this.queue.pollUpTo(Number.POSITIVE_INFINITY);
|
|
12057
9968
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
12058
9969
|
return fromIterable$4(values);
|
|
@@ -12060,14 +9971,14 @@ class QueueImpl extends Class {
|
|
|
12060
9971
|
});
|
|
12061
9972
|
}
|
|
12062
9973
|
takeUpTo(max) {
|
|
12063
|
-
return suspend$3(() => get$
|
|
9974
|
+
return suspend$3(() => get$5(this.shutdownFlag) ? interrupt$4 : sync$2(() => {
|
|
12064
9975
|
const values = this.queue.pollUpTo(max);
|
|
12065
9976
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
12066
9977
|
return fromIterable$4(values);
|
|
12067
9978
|
}));
|
|
12068
9979
|
}
|
|
12069
9980
|
takeBetween(min, max) {
|
|
12070
|
-
return suspend$3(() => takeRemainderLoop(this, min, max, empty$
|
|
9981
|
+
return suspend$3(() => takeRemainderLoop(this, min, max, empty$b()));
|
|
12071
9982
|
}
|
|
12072
9983
|
}
|
|
12073
9984
|
/** @internal */
|
|
@@ -12078,7 +9989,7 @@ const takeRemainderLoop = (self, min, max, acc) => {
|
|
|
12078
9989
|
return pipe(takeUpTo(self, max), flatMap$3(bs => {
|
|
12079
9990
|
const remaining = min - bs.length;
|
|
12080
9991
|
if (remaining === 1) {
|
|
12081
|
-
return pipe(take$1(self), map$
|
|
9992
|
+
return pipe(take$1(self), map$9(b => pipe(acc, appendAll$1(bs), append$1(b))));
|
|
12082
9993
|
}
|
|
12083
9994
|
if (remaining > 1) {
|
|
12084
9995
|
return pipe(take$1(self), flatMap$3(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, pipe(acc, appendAll$1(bs), append$1(b)))));
|
|
@@ -12095,7 +10006,7 @@ const unsafeMake = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
|
|
|
12095
10006
|
return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
|
|
12096
10007
|
};
|
|
12097
10008
|
/** @internal */
|
|
12098
|
-
const make$2 = (queue, strategy) => pipe(deferredMake(), map$
|
|
10009
|
+
const make$2 = (queue, strategy) => pipe(deferredMake(), map$9(deferred => unsafeMake(queue, unbounded$2(), deferred, make$n(false), strategy)));
|
|
12099
10010
|
/** @internal */
|
|
12100
10011
|
class BackingQueueFromMutableQueue {
|
|
12101
10012
|
mutable;
|
|
@@ -12172,7 +10083,7 @@ class BackPressureStrategy {
|
|
|
12172
10083
|
this.unsafeOffer(iterable, deferred);
|
|
12173
10084
|
this.unsafeOnQueueEmptySpace(queue, takers);
|
|
12174
10085
|
unsafeCompleteTakers(this, queue, takers);
|
|
12175
|
-
return get$
|
|
10086
|
+
return get$5(isShutdown) ? interrupt$4 : deferredAwait(deferred);
|
|
12176
10087
|
}), onInterrupt(() => sync$2(() => this.unsafeRemove(deferred))));
|
|
12177
10088
|
});
|
|
12178
10089
|
}
|
|
@@ -12187,14 +10098,14 @@ class BackPressureStrategy {
|
|
|
12187
10098
|
if (offered && putter[2]) {
|
|
12188
10099
|
unsafeCompleteDeferred(putter[1], true);
|
|
12189
10100
|
} else if (!offered) {
|
|
12190
|
-
unsafeOfferAll(this.putters, pipe(unsafePollAll(this.putters), prepend
|
|
10101
|
+
unsafeOfferAll(this.putters, pipe(unsafePollAll(this.putters), prepend(putter)));
|
|
12191
10102
|
}
|
|
12192
10103
|
unsafeCompleteTakers(this, queue, takers);
|
|
12193
10104
|
}
|
|
12194
10105
|
}
|
|
12195
10106
|
}
|
|
12196
10107
|
unsafeOffer(iterable, deferred) {
|
|
12197
|
-
const stuff = fromIterable$
|
|
10108
|
+
const stuff = fromIterable$2(iterable);
|
|
12198
10109
|
for (let i = 0; i < stuff.length; i++) {
|
|
12199
10110
|
const value = stuff[i];
|
|
12200
10111
|
if (i === stuff.length - 1) {
|
|
@@ -12257,7 +10168,7 @@ const unsafeCompleteTakers = (strategy, queue, takers) => {
|
|
|
12257
10168
|
unsafeCompleteDeferred(taker, element);
|
|
12258
10169
|
strategy.unsafeOnQueueEmptySpace(queue, takers);
|
|
12259
10170
|
} else {
|
|
12260
|
-
unsafeOfferAll(takers, pipe(unsafePollAll(takers), prepend
|
|
10171
|
+
unsafeOfferAll(takers, pipe(unsafePollAll(takers), prepend(taker)));
|
|
12261
10172
|
}
|
|
12262
10173
|
keepPolling = true;
|
|
12263
10174
|
} else {
|
|
@@ -12508,7 +10419,7 @@ const concatAllWith = (channels, f, g) => {
|
|
|
12508
10419
|
op._tag = OP_CONCAT_ALL;
|
|
12509
10420
|
op.combineInners = f;
|
|
12510
10421
|
op.combineAll = g;
|
|
12511
|
-
op.onPull = () => PullAfterNext(none$
|
|
10422
|
+
op.onPull = () => PullAfterNext(none$1());
|
|
12512
10423
|
op.onEmit = () => Continue;
|
|
12513
10424
|
op.value = () => channels;
|
|
12514
10425
|
op.k = identity;
|
|
@@ -12520,7 +10431,7 @@ const concatMapWith = /*#__PURE__*/dual(4, (self, f, g, h) => {
|
|
|
12520
10431
|
op._tag = OP_CONCAT_ALL;
|
|
12521
10432
|
op.combineInners = g;
|
|
12522
10433
|
op.combineAll = h;
|
|
12523
|
-
op.onPull = () => PullAfterNext(none$
|
|
10434
|
+
op.onPull = () => PullAfterNext(none$1());
|
|
12524
10435
|
op.onEmit = () => Continue;
|
|
12525
10436
|
op.value = () => self;
|
|
12526
10437
|
op.k = f;
|
|
@@ -13870,14 +11781,14 @@ const mergeAllWith = ({
|
|
|
13870
11781
|
yield* addFinalizer(scope, shutdown(queue));
|
|
13871
11782
|
const cancelers = yield* unbounded();
|
|
13872
11783
|
yield* addFinalizer(scope, shutdown(cancelers));
|
|
13873
|
-
const lastDone = yield* make$d(none$
|
|
11784
|
+
const lastDone = yield* make$d(none$1());
|
|
13874
11785
|
const errorSignal = yield* make$k();
|
|
13875
11786
|
const withPermits = (yield* makeSemaphore(concurrencyN)).withPermits;
|
|
13876
11787
|
const pull = yield* toPullIn(pipeTo(queueReader, channels), scope);
|
|
13877
11788
|
function evaluatePull(pull) {
|
|
13878
11789
|
return pull.pipe(flatMap$2(match$7({
|
|
13879
11790
|
onLeft: done => succeed$1(some(done)),
|
|
13880
|
-
onRight: outElem => as(offer(queue, succeed$1(right(outElem))), none$
|
|
11791
|
+
onRight: outElem => as(offer(queue, succeed$1(right(outElem))), none$1())
|
|
13881
11792
|
})), repeat({
|
|
13882
11793
|
until: _ => isSome(_)
|
|
13883
11794
|
}), flatMap$2(outDone => update$1(lastDone, match$6({
|
|
@@ -14155,14 +12066,14 @@ class TakeImpl {
|
|
|
14155
12066
|
/** @internal */
|
|
14156
12067
|
const chunk = chunk => new TakeImpl(succeed$2(chunk));
|
|
14157
12068
|
/** @internal */
|
|
14158
|
-
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/fail$3(/*#__PURE__*/none$
|
|
12069
|
+
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/fail$3(/*#__PURE__*/none$1()));
|
|
14159
12070
|
/** @internal */
|
|
14160
12071
|
const failCause$1 = cause => new TakeImpl(failCause$4(pipe(cause, map$4(some))));
|
|
14161
12072
|
/** @internal */
|
|
14162
12073
|
const of = value => new TakeImpl(succeed$2(of$2(value)));
|
|
14163
12074
|
|
|
14164
12075
|
/** @internal */
|
|
14165
|
-
const end = () => fail$1(none$
|
|
12076
|
+
const end = () => fail$1(none$1());
|
|
14166
12077
|
/** @internal */
|
|
14167
12078
|
const failCause = cause => mapError(failCause$3(cause), some);
|
|
14168
12079
|
|
|
@@ -14199,7 +12110,7 @@ const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options)
|
|
|
14199
12110
|
if (options?.switch) {
|
|
14200
12111
|
return matchConcurrency(options?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), n => flatMapParSwitchBuffer(self, n, bufferSize, f));
|
|
14201
12112
|
}
|
|
14202
|
-
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as => pipe(as, map$
|
|
12113
|
+
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as => pipe(as, map$b(a => toChannel(f(a))), reduce$3(void_, (left, right) => pipe(left, zipRight(right)))))), _ => new StreamImpl(pipe(toChannel(self), concatMap(writeChunk), mergeMap(out => toChannel(f(out)), options))));
|
|
14203
12114
|
});
|
|
14204
12115
|
/** @internal */
|
|
14205
12116
|
const matchConcurrency = (concurrency, sequential, bounded) => {
|
|
@@ -14242,7 +12153,7 @@ const flattenExitOption = self => {
|
|
|
14242
12153
|
onSuccess: () => void_
|
|
14243
12154
|
})
|
|
14244
12155
|
}));
|
|
14245
|
-
return pipe(write(pipe(toEmit, filterMap(exit => isSuccess(exit) ? some(exit.value) : none$
|
|
12156
|
+
return pipe(write(pipe(toEmit, filterMap(exit => isSuccess(exit) ? some(exit.value) : none$1()))), flatMap$1(() => next));
|
|
14246
12157
|
};
|
|
14247
12158
|
const process = readWithCause({
|
|
14248
12159
|
onInput: chunk => processChunk(chunk, process),
|
|
@@ -14276,7 +12187,7 @@ const fromEffectOption = effect => new StreamImpl(unwrap(match$1(effect, {
|
|
|
14276
12187
|
/** @internal */
|
|
14277
12188
|
const fromQueue$1 = (queue, options) => pipe(takeBetween(queue, 1, options?.maxChunkSize ?? DefaultChunkSize), catchAllCause(cause => pipe(isShutdown(queue), flatMap$2(isShutdown => isShutdown && isInterrupted(cause) ? end() : failCause(cause)))), repeatEffectChunkOption, options?.shutdown ? ensuring(shutdown(queue)) : identity);
|
|
14278
12189
|
/** @internal */
|
|
14279
|
-
const map = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), mapOut(map$
|
|
12190
|
+
const map = /*#__PURE__*/dual(2, (self, f) => new StreamImpl(pipe(toChannel(self), mapOut(map$b(f)))));
|
|
14280
12191
|
/** @internal */
|
|
14281
12192
|
const mapEffectSequential = /*#__PURE__*/dual(2, (self, f) => {
|
|
14282
12193
|
const loop = iterator => {
|
|
@@ -14292,13 +12203,13 @@ const mapEffectSequential = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
14292
12203
|
return unwrap(map$2(f(value), a2 => flatMap$1(write(of$2(a2)), () => loop(iterator))));
|
|
14293
12204
|
}
|
|
14294
12205
|
};
|
|
14295
|
-
return new StreamImpl(pipe(toChannel(self), pipeTo(suspend$1(() => loop(empty$
|
|
12206
|
+
return new StreamImpl(pipe(toChannel(self), pipeTo(suspend$1(() => loop(empty$b()[Symbol.iterator]())))));
|
|
14296
12207
|
});
|
|
14297
12208
|
/** @internal */
|
|
14298
12209
|
const mapEffectPar = /*#__PURE__*/dual(3, (self, n, f) => new StreamImpl(pipe(toChannel(self), concatMap(writeChunk), mapOutEffectPar(f, n), mapOut(of$2))));
|
|
14299
12210
|
/** @internal */
|
|
14300
12211
|
const repeatEffectChunkOption = effect => unfoldChunkEffect(effect, effect => pipe(map$2(effect, chunk => some([chunk, effect])), catchAll(match$6({
|
|
14301
|
-
onNone: () => succeed$1(none$
|
|
12212
|
+
onNone: () => succeed$1(none$1()),
|
|
14302
12213
|
onSome: fail$1
|
|
14303
12214
|
}))));
|
|
14304
12215
|
/** @internal */
|
|
@@ -14370,14 +12281,14 @@ const groupByKey = /*#__PURE__*/dual(args => typeof args[0] !== "function", (sel
|
|
|
14370
12281
|
if (innerQueue === undefined) {
|
|
14371
12282
|
return pipe(bounded(options?.bufferSize ?? 16), flatMap$2(innerQueue => pipe(sync$1(() => {
|
|
14372
12283
|
map.set(key, innerQueue);
|
|
14373
|
-
}), zipRight$1(offer(outerQueue, of([key, innerQueue]))), zipRight$1(pipe(offer(innerQueue, chunk(values)), catchSomeCause(cause => isInterruptedOnly(cause) ? some(_void) : none$
|
|
12284
|
+
}), zipRight$1(offer(outerQueue, of([key, innerQueue]))), zipRight$1(pipe(offer(innerQueue, chunk(values)), catchSomeCause(cause => isInterruptedOnly(cause) ? some(_void) : none$1()))))));
|
|
14374
12285
|
}
|
|
14375
|
-
return catchSomeCause(offer(innerQueue, chunk(values)), cause => isInterruptedOnly(cause) ? some(_void) : none$
|
|
12286
|
+
return catchSomeCause(offer(innerQueue, chunk(values)), cause => isInterruptedOnly(cause) ? some(_void) : none$1());
|
|
14376
12287
|
}, {
|
|
14377
12288
|
discard: true
|
|
14378
12289
|
})), () => loop(map, outerQueue)),
|
|
14379
12290
|
onFailure: cause => fromEffect$3(offer(outerQueue, failCause$1(cause))),
|
|
14380
|
-
onDone: () => fromEffect$3(pipe(forEach(map.entries(), ([_, innerQueue]) => pipe(offer(innerQueue, end$1), catchSomeCause(cause => isInterruptedOnly(cause) ? some(_void) : none$
|
|
12291
|
+
onDone: () => fromEffect$3(pipe(forEach(map.entries(), ([_, innerQueue]) => pipe(offer(innerQueue, end$1), catchSomeCause(cause => isInterruptedOnly(cause) ? some(_void) : none$1())), {
|
|
14381
12292
|
discard: true
|
|
14382
12293
|
}), zipRight$1(offer(outerQueue, end$1))))
|
|
14383
12294
|
});
|