@lmvz-ds/components 0.14.1 → 0.16.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/dist/cjs/app-globals-V2Kpy_OQ.js +3 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/{assets-BnJmIx_h.js → assets-XY-cBmal.js} +5 -2
- package/dist/cjs/assets-XY-cBmal.js.map +1 -0
- package/dist/cjs/header-integration_7.cjs.entry.js +1024 -0
- package/dist/cjs/header-integration_7.cjs.entry.js.map +1 -0
- package/dist/cjs/{Effect-CpZhfb0D.js → icons-BOM23oli.js} +1010 -236
- package/dist/cjs/icons-BOM23oli.js.map +1 -0
- package/dist/cjs/{index-9ZJx0550.js → index-B1Puzu82.js} +11 -651
- package/dist/cjs/index-B1Puzu82.js.map +1 -0
- package/dist/cjs/{index-QRnWYctw.js → index-ww_DCXU7.js} +431 -426
- package/dist/cjs/index-ww_DCXU7.js.map +1 -0
- package/dist/cjs/index.cjs.js +13 -12
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/lmvz-action.cjs.entry.js +5 -2
- package/dist/cjs/lmvz-action.cjs.entry.js.map +1 -0
- package/dist/cjs/lmvz-card.cjs.entry.js +7 -4
- package/dist/cjs/lmvz-card.cjs.entry.js.map +1 -0
- package/dist/cjs/lmvz-chip.cjs.entry.js +5 -2
- package/dist/cjs/lmvz-chip.cjs.entry.js.map +1 -0
- package/dist/cjs/lmvz-components.cjs.js +6 -3
- package/dist/cjs/lmvz-components.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +5 -2
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/api/ds.constants.js +1 -0
- package/dist/collection/api/ds.constants.js.map +1 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/index.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/lmvz-action/lmvz-action.js +2 -1
- package/dist/collection/components/lmvz-action/lmvz-action.js.map +1 -0
- package/dist/collection/components/lmvz-button/lmvz-button.css +4 -0
- package/dist/collection/components/lmvz-button/lmvz-button.js +3 -2
- package/dist/collection/components/lmvz-button/lmvz-button.js.map +1 -0
- package/dist/collection/components/lmvz-card/lmvz-card.css +4 -0
- package/dist/collection/components/lmvz-card/lmvz-card.js +4 -3
- package/dist/collection/components/lmvz-card/lmvz-card.js.map +1 -0
- package/dist/collection/components/lmvz-chip/lmvz-chip.js +3 -2
- package/dist/collection/components/lmvz-chip/lmvz-chip.js.map +1 -0
- package/dist/collection/components/lmvz-header/lmvz-header.js +17 -10
- package/dist/collection/components/lmvz-header/lmvz-header.js.map +1 -0
- package/dist/collection/components/lmvz-icon/icons.js +1 -0
- package/dist/collection/components/lmvz-icon/icons.js.map +1 -0
- package/dist/collection/components/lmvz-icon/lmvz-icon.js +8 -7
- package/dist/collection/components/lmvz-icon/lmvz-icon.js.map +1 -0
- package/dist/collection/components/lmvz-icon/public.js +1 -0
- package/dist/collection/components/lmvz-icon/public.js.map +1 -0
- package/dist/collection/components/lmvz-icon/test/icons.unit.js +1 -0
- package/dist/collection/components/lmvz-icon/test/icons.unit.js.map +1 -0
- package/dist/collection/components/lmvz-input/lmvz-input.js +35 -28
- package/dist/collection/components/lmvz-input/lmvz-input.js.map +1 -0
- package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js +5 -2
- package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js.map +1 -0
- package/dist/collection/components/lmvz-select/lmvz-select.css +197 -0
- package/dist/collection/components/lmvz-select/lmvz-select.js +224 -0
- package/dist/collection/components/lmvz-select/lmvz-select.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/integration/header-integration.js +5 -4
- package/dist/collection/integration/header-integration.js.map +1 -0
- package/dist/collection/utils/aria/aria-validation-controller.js +1 -0
- package/dist/collection/utils/aria/aria-validation-controller.js.map +1 -0
- package/dist/collection/utils/aria/element-activation-controller.js +1 -0
- package/dist/collection/utils/aria/element-activation-controller.js.map +1 -0
- package/dist/collection/utils/aria/list-keyboard-controller.js +7 -4
- package/dist/collection/utils/aria/list-keyboard-controller.js.map +1 -0
- package/dist/collection/utils/assets.js +1 -0
- package/dist/collection/utils/assets.js.map +1 -0
- package/dist/collection/utils/component.js +7 -4
- package/dist/collection/utils/component.js.map +1 -0
- package/dist/collection/utils/effect.js +1 -0
- package/dist/collection/utils/effect.js.map +1 -0
- package/dist/collection/utils/environment.js +1 -0
- package/dist/collection/utils/environment.js.map +1 -0
- package/dist/collection/utils/http.js +1 -0
- package/dist/collection/utils/http.js.map +1 -0
- package/dist/collection/utils/http.unit.js +1 -0
- package/dist/collection/utils/http.unit.js.map +1 -0
- package/dist/collection/utils/public.js +1 -0
- package/dist/collection/utils/public.js.map +1 -0
- package/dist/collection/utils/reactive-controller-host.js +1 -0
- package/dist/collection/utils/reactive-controller-host.js.map +1 -0
- package/dist/collection/utils/validation/svg.js +1 -0
- package/dist/collection/utils/validation/svg.js.map +1 -0
- package/dist/components/header-integration.d.ts +11 -0
- package/dist/components/header-integration.js +2 -0
- package/dist/components/header-integration.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -0
- package/dist/components/lmvz-action.js +2 -1
- package/dist/components/lmvz-action.js.map +1 -0
- package/dist/components/lmvz-button.js +2 -1
- package/dist/components/lmvz-button.js.map +1 -0
- package/dist/components/lmvz-card.js +2 -1
- package/dist/components/lmvz-card.js.map +1 -0
- package/dist/components/lmvz-chip.js +2 -1
- package/dist/components/lmvz-chip.js.map +1 -0
- package/dist/components/lmvz-header.js +2 -1
- package/dist/components/lmvz-header.js.map +1 -0
- package/dist/components/lmvz-icon.js +2 -1
- package/dist/components/lmvz-icon.js.map +1 -0
- package/dist/components/lmvz-input.js +2 -1
- package/dist/components/lmvz-input.js.map +1 -0
- package/dist/components/lmvz-menuitem.js +2 -1
- package/dist/components/lmvz-menuitem.js.map +1 -0
- package/dist/components/lmvz-select.d.ts +11 -0
- package/dist/components/lmvz-select.js +2 -0
- package/dist/components/lmvz-select.js.map +1 -0
- package/dist/components/p-B2g3aN-E.js +2 -0
- package/dist/components/p-B2g3aN-E.js.map +1 -0
- package/dist/components/p-BXdOuZTp.js +2 -0
- package/dist/components/p-BXdOuZTp.js.map +1 -0
- package/dist/components/p-BfTCfPZ1.js +3 -2
- package/dist/components/p-BfTCfPZ1.js.map +1 -0
- package/dist/components/p-BpCjj39Z.js +2 -0
- package/dist/components/p-BpCjj39Z.js.map +1 -0
- package/dist/components/p-BsHYIl56.js +2 -0
- package/dist/components/p-BsHYIl56.js.map +1 -0
- package/dist/components/p-C5rqq3bf.js +2 -0
- package/dist/components/p-C5rqq3bf.js.map +1 -0
- package/dist/components/p-CI0tffvo.js +2 -0
- package/dist/components/p-CI0tffvo.js.map +1 -0
- package/dist/components/p-CN0JX9-m.js +2 -1
- package/dist/components/p-CN0JX9-m.js.map +1 -0
- package/dist/components/p-ClmDNIy4.js +2 -0
- package/dist/components/p-ClmDNIy4.js.map +1 -0
- package/dist/components/p-DQEkWkMh.js +2 -0
- package/dist/components/p-DQEkWkMh.js.map +1 -0
- package/dist/components/p-X5fEFT9T.js +2 -0
- package/dist/components/p-X5fEFT9T.js.map +1 -0
- package/dist/components/p-vIq2biqy.js +13 -0
- package/dist/components/p-vIq2biqy.js.map +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/{assets-CvV1KMMV.js → assets-BD98wsl7.js} +4 -1
- package/dist/esm/assets-BD98wsl7.js.map +1 -0
- package/dist/esm/header-integration_7.entry.js +1016 -0
- package/dist/esm/header-integration_7.entry.js.map +1 -0
- package/dist/esm/{Effect-DyamyJqO.js → icons-D1lxdRXP.js} +975 -174
- package/dist/esm/icons-D1lxdRXP.js.map +1 -0
- package/dist/esm/{index-CekEw3_K.js → index-DoNkkDv1.js} +6 -1
- package/dist/esm/index-DoNkkDv1.js.map +1 -0
- package/dist/esm/{index-smGPjoDX.js → index-WeqgWisK.js} +11 -651
- package/dist/esm/index-WeqgWisK.js.map +1 -0
- package/dist/esm/index.js +7 -5
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lmvz-action.entry.js +5 -2
- package/dist/esm/lmvz-action.entry.js.map +1 -0
- package/dist/esm/lmvz-card.entry.js +7 -4
- package/dist/esm/lmvz-card.entry.js.map +1 -0
- package/dist/esm/lmvz-chip.entry.js +5 -2
- package/dist/esm/lmvz-chip.entry.js.map +1 -0
- package/dist/esm/lmvz-components.js +7 -4
- package/dist/esm/lmvz-components.js.map +1 -0
- package/dist/esm/loader.js +6 -3
- package/dist/esm/loader.js.map +1 -0
- package/dist/ext-libs.d.ts +1 -0
- package/dist/lmvz-components/index.esm.js +2 -1
- package/dist/lmvz-components/index.esm.js.map +1 -0
- package/dist/lmvz-components/lmvz-components.esm.js +2 -1
- package/dist/lmvz-components/lmvz-components.esm.js.map +1 -0
- package/dist/lmvz-components/p-33485219.entry.js +2 -0
- package/dist/lmvz-components/p-33485219.entry.js.map +1 -0
- package/dist/lmvz-components/p-76032c32.entry.js +2 -0
- package/dist/lmvz-components/p-76032c32.entry.js.map +1 -0
- package/dist/lmvz-components/p-7aeec9a8.entry.js +7 -0
- package/dist/lmvz-components/p-7aeec9a8.entry.js.map +1 -0
- package/dist/lmvz-components/p-84e0a9dd.entry.js +2 -0
- package/dist/lmvz-components/p-84e0a9dd.entry.js.map +1 -0
- package/dist/lmvz-components/p-CkJb8WVZ.js +2 -0
- package/dist/lmvz-components/p-CkJb8WVZ.js.map +1 -0
- package/dist/lmvz-components/p-DQuL1Twl.js +2 -1
- package/dist/lmvz-components/p-DQuL1Twl.js.map +1 -0
- package/dist/lmvz-components/p-WeqgWisK.js +3 -0
- package/dist/lmvz-components/p-WeqgWisK.js.map +1 -0
- package/dist/lmvz-components/p-Z9X0_ik0.js +2 -0
- package/dist/lmvz-components/p-Z9X0_ik0.js.map +1 -0
- package/dist/lmvz-components/p-eP0oxQ44.js +13 -0
- package/dist/lmvz-components/p-eP0oxQ44.js.map +1 -0
- package/dist/manifest.json +392 -68
- package/dist/stencil.config.base.js +45 -0
- package/dist/stencil.config.base.js.map +1 -0
- package/dist/stencil.config.dev.js +22 -0
- package/dist/stencil.config.dev.js.map +1 -0
- package/dist/stencil.config.integration.js +27 -0
- package/dist/stencil.config.integration.js.map +1 -0
- package/dist/stencil.config.js +16 -0
- package/dist/stencil.config.js.map +1 -0
- package/dist/stencil.config.prod.js +30 -0
- package/dist/stencil.config.prod.js.map +1 -0
- package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.base.d.ts +2 -0
- package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.d.ts +2 -0
- package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.integration.d.ts +2 -0
- package/dist/types/Users/patrick.nemenz/workspace/lmvz/lmvz-ds/packages/components/.stencil/stencil.config.prod.d.ts +2 -0
- package/dist/types/components/lmvz-action/lmvz-action.d.ts +1 -1
- package/dist/types/components/lmvz-button/lmvz-button.d.ts +2 -2
- package/dist/types/components/lmvz-card/lmvz-card.d.ts +1 -1
- package/dist/types/components/lmvz-header/lmvz-header.d.ts +4 -4
- package/dist/types/components/lmvz-icon/lmvz-icon.d.ts +4 -4
- package/dist/types/components/lmvz-input/lmvz-input.d.ts +4 -4
- package/dist/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +3 -3
- package/dist/types/components/lmvz-select/lmvz-select.d.ts +24 -0
- package/dist/types/components.d.ts +173 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/integration/header-integration.d.ts +5 -0
- package/dist/types/utils/aria/aria-validation-controller.d.ts +1 -1
- package/dist/types/utils/aria/element-activation-controller.d.ts +1 -1
- package/dist/types/utils/component.d.ts +2 -2
- package/dist/types/utils/http.d.ts +3 -3
- package/dist/types/utils/validation/svg.d.ts +1 -1
- package/hydrate/index.js +998 -436
- package/hydrate/index.mjs +998 -436
- package/package.json +37 -73
- package/readme.md +2 -2
- package/dist/cjs/aria-loader-BBKbBZLq.js +0 -76
- package/dist/cjs/component-CRc6eHcV.js +0 -138
- package/dist/cjs/element-activation-controller-DC_6T0Rt.js +0 -31
- package/dist/cjs/icons-Brr4vqiE.js +0 -653
- package/dist/cjs/index-Bp6Dd2i1.js +0 -94
- package/dist/cjs/lmvz-button.cjs.entry.js +0 -73
- package/dist/cjs/lmvz-header.cjs.entry.js +0 -142
- package/dist/cjs/lmvz-icon.cjs.entry.js +0 -87
- package/dist/cjs/lmvz-input.cjs.entry.js +0 -177
- package/dist/cjs/lmvz-menuitem.cjs.entry.js +0 -34
- package/dist/cjs/reactive-controller-host-DWpVosFu.js +0 -189
- package/dist/collection/utils/typing.js +0 -1
- package/dist/components/p-B3JVFwO1.js +0 -1
- package/dist/components/p-BaPwpeMs.js +0 -1
- package/dist/components/p-CSRpdnrt.js +0 -1
- package/dist/components/p-DK2hpvEW.js +0 -12
- package/dist/components/p-DcMNH3fv.js +0 -1
- package/dist/components/p-DugBvwmd.js +0 -1
- package/dist/esm/aria-loader-DB71Xewa.js +0 -69
- package/dist/esm/component-B3JVFwO1.js +0 -132
- package/dist/esm/element-activation-controller-CN0JX9-m.js +0 -29
- package/dist/esm/icons-C69Um2xB.js +0 -649
- package/dist/esm/index-BfTCfPZ1.js +0 -92
- package/dist/esm/lmvz-button.entry.js +0 -71
- package/dist/esm/lmvz-header.entry.js +0 -140
- package/dist/esm/lmvz-icon.entry.js +0 -85
- package/dist/esm/lmvz-input.entry.js +0 -175
- package/dist/esm/lmvz-menuitem.entry.js +0 -32
- package/dist/esm/reactive-controller-host-1nFoJEdT.js +0 -186
- package/dist/lmvz-components/p-0e5aa1a3.entry.js +0 -1
- package/dist/lmvz-components/p-18c18de4.entry.js +0 -1
- package/dist/lmvz-components/p-5775a56c.entry.js +0 -1
- package/dist/lmvz-components/p-814ee542.entry.js +0 -1
- package/dist/lmvz-components/p-9faac8f3.entry.js +0 -1
- package/dist/lmvz-components/p-B3JVFwO1.js +0 -1
- package/dist/lmvz-components/p-B3j8zrhV.js +0 -1
- package/dist/lmvz-components/p-BEoSvNlI.js +0 -1
- package/dist/lmvz-components/p-BTpia82J.js +0 -1
- package/dist/lmvz-components/p-BfTCfPZ1.js +0 -6
- package/dist/lmvz-components/p-CN0JX9-m.js +0 -1
- package/dist/lmvz-components/p-D7GrtdQF.js +0 -1
- package/dist/lmvz-components/p-DyamyJqO.js +0 -1
- package/dist/lmvz-components/p-c61f7daa.entry.js +0 -1
- package/dist/lmvz-components/p-c6bae21b.entry.js +0 -1
- package/dist/lmvz-components/p-cM67HC0Z.js +0 -12
- package/dist/lmvz-components/p-d4b68381.entry.js +0 -1
- package/dist/lmvz-components/p-smGPjoDX.js +0 -2
- package/dist/types/utils/typing.d.ts +0 -3
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var icons = require('./icons-BOM23oli.js');
|
|
4
|
+
require('./assets-XY-cBmal.js');
|
|
5
|
+
require('./index-B1Puzu82.js');
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @since 2.0.0
|
|
7
9
|
* @category constructors
|
|
8
10
|
*/
|
|
9
|
-
const make$3 =
|
|
11
|
+
const make$3 = icons.make;
|
|
10
12
|
/**
|
|
11
13
|
* @since 2.0.0
|
|
12
14
|
* @category getters
|
|
13
15
|
*/
|
|
14
|
-
const get =
|
|
16
|
+
const get = icons.get;
|
|
15
17
|
/**
|
|
16
18
|
* @since 2.0.0
|
|
17
19
|
* @category utils
|
|
18
20
|
*/
|
|
19
|
-
const modify =
|
|
21
|
+
const modify = icons.modify;
|
|
20
22
|
/**
|
|
21
23
|
* @since 2.0.0
|
|
22
24
|
* @category utils
|
|
23
25
|
*/
|
|
24
|
-
const update =
|
|
26
|
+
const update = icons.update;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Creates a `Fail` cause from an expected error.
|
|
@@ -37,7 +39,7 @@ const update = Effect.update;
|
|
|
37
39
|
* @since 2.0.0
|
|
38
40
|
* @category Constructors
|
|
39
41
|
*/
|
|
40
|
-
const fail$1 =
|
|
42
|
+
const fail$1 = icons.fail;
|
|
41
43
|
/**
|
|
42
44
|
* Creates a `Die` cause from an unexpected error.
|
|
43
45
|
*
|
|
@@ -52,7 +54,7 @@ const fail$1 = Effect.fail$1;
|
|
|
52
54
|
* @since 2.0.0
|
|
53
55
|
* @category Constructors
|
|
54
56
|
*/
|
|
55
|
-
const die =
|
|
57
|
+
const die = icons.die;
|
|
56
58
|
/**
|
|
57
59
|
* Creates an `Interrupt` cause from a `FiberId`.
|
|
58
60
|
*
|
|
@@ -67,7 +69,7 @@ const die = Effect.die;
|
|
|
67
69
|
* @since 2.0.0
|
|
68
70
|
* @category Constructors
|
|
69
71
|
*/
|
|
70
|
-
const interrupt$1 =
|
|
72
|
+
const interrupt$1 = icons.interrupt;
|
|
71
73
|
/**
|
|
72
74
|
* Checks if a `Cause` is a `Die` type.
|
|
73
75
|
*
|
|
@@ -76,7 +78,7 @@ const interrupt$1 = Effect.interrupt$1;
|
|
|
76
78
|
* @since 2.0.0
|
|
77
79
|
* @category Guards
|
|
78
80
|
*/
|
|
79
|
-
const isDieType =
|
|
81
|
+
const isDieType = icons.isDieType;
|
|
80
82
|
/**
|
|
81
83
|
* Checks if a `Cause` contains an interruption.
|
|
82
84
|
*
|
|
@@ -87,7 +89,7 @@ const isDieType = Effect.isDieType;
|
|
|
87
89
|
* @since 2.0.0
|
|
88
90
|
* @category Getters
|
|
89
91
|
*/
|
|
90
|
-
const isInterrupted =
|
|
92
|
+
const isInterrupted = icons.isInterrupted;
|
|
91
93
|
/**
|
|
92
94
|
* Checks if a `Cause` contains only interruptions.
|
|
93
95
|
*
|
|
@@ -100,7 +102,7 @@ const isInterrupted = Effect.isInterrupted;
|
|
|
100
102
|
* @since 2.0.0
|
|
101
103
|
* @category Getters
|
|
102
104
|
*/
|
|
103
|
-
const isInterruptedOnly =
|
|
105
|
+
const isInterruptedOnly = icons.isInterruptedOnly;
|
|
104
106
|
/**
|
|
105
107
|
* Collects all `FiberId`s responsible for interrupting a fiber.
|
|
106
108
|
*
|
|
@@ -113,7 +115,7 @@ const isInterruptedOnly = Effect.isInterruptedOnly;
|
|
|
113
115
|
* @since 2.0.0
|
|
114
116
|
* @category Getters
|
|
115
117
|
*/
|
|
116
|
-
const interruptors =
|
|
118
|
+
const interruptors = icons.interruptors;
|
|
117
119
|
/**
|
|
118
120
|
* Splits a `Cause` into either its first `Fail` error or the rest of the cause
|
|
119
121
|
* (which might only contain `Die` or `Interrupt`).
|
|
@@ -127,7 +129,7 @@ const interruptors = Effect.interruptors;
|
|
|
127
129
|
* @since 2.0.0
|
|
128
130
|
* @category Getters
|
|
129
131
|
*/
|
|
130
|
-
const failureOrCause =
|
|
132
|
+
const failureOrCause = icons.failureOrCause;
|
|
131
133
|
/**
|
|
132
134
|
* Strips out failures with an error of `None` from a `Cause<Option<E>>`.
|
|
133
135
|
*
|
|
@@ -141,7 +143,7 @@ const failureOrCause = Effect.failureOrCause;
|
|
|
141
143
|
* @since 2.0.0
|
|
142
144
|
* @category Getters
|
|
143
145
|
*/
|
|
144
|
-
const flipCauseOption =
|
|
146
|
+
const flipCauseOption = icons.flipCauseOption;
|
|
145
147
|
/**
|
|
146
148
|
* Transforms the errors in a `Cause` using a user-provided function.
|
|
147
149
|
*
|
|
@@ -156,9 +158,9 @@ const flipCauseOption = Effect.flipCauseOption;
|
|
|
156
158
|
* @since 2.0.0
|
|
157
159
|
* @category Mapping
|
|
158
160
|
*/
|
|
159
|
-
const map$2 =
|
|
161
|
+
const map$2 = icons.map;
|
|
160
162
|
|
|
161
|
-
const _await =
|
|
163
|
+
const _await = icons._await;
|
|
162
164
|
/**
|
|
163
165
|
* Inherits values from all `FiberRef` instances into current fiber. This
|
|
164
166
|
* will resume immediately.
|
|
@@ -166,7 +168,7 @@ const _await = Effect._await$1;
|
|
|
166
168
|
* @since 2.0.0
|
|
167
169
|
* @category destructors
|
|
168
170
|
*/
|
|
169
|
-
const inheritAll =
|
|
171
|
+
const inheritAll = icons.inheritAll;
|
|
170
172
|
/**
|
|
171
173
|
* Interrupts the fiber from whichever fiber is calling this method. If the
|
|
172
174
|
* fiber has already exited, the returned effect will resume immediately.
|
|
@@ -175,7 +177,7 @@ const inheritAll = Effect.inheritAll;
|
|
|
175
177
|
* @since 2.0.0
|
|
176
178
|
* @category interruption
|
|
177
179
|
*/
|
|
178
|
-
const interrupt =
|
|
180
|
+
const interrupt = icons.interruptFiber;
|
|
179
181
|
/**
|
|
180
182
|
* Interrupts the fiber as if interrupted from the specified fiber. If the
|
|
181
183
|
* fiber has already exited, the returned effect will resume immediately.
|
|
@@ -184,7 +186,7 @@ const interrupt = Effect.interruptFiber;
|
|
|
184
186
|
* @since 2.0.0
|
|
185
187
|
* @category interruption
|
|
186
188
|
*/
|
|
187
|
-
const interruptAs =
|
|
189
|
+
const interruptAs = icons.interruptAsFiber;
|
|
188
190
|
/**
|
|
189
191
|
* Joins the fiber, which suspends the joining fiber until the result of the
|
|
190
192
|
* fiber has been determined. Attempting to join a fiber that has erred will
|
|
@@ -195,7 +197,7 @@ const interruptAs = Effect.interruptAsFiber;
|
|
|
195
197
|
* @since 2.0.0
|
|
196
198
|
* @category destructors
|
|
197
199
|
*/
|
|
198
|
-
const join =
|
|
200
|
+
const join = icons.join;
|
|
199
201
|
|
|
200
202
|
/** @internal */
|
|
201
203
|
const EnqueueSymbolKey = "effect/QueueEnqueue";
|
|
@@ -232,7 +234,7 @@ const dequeueVariance = {
|
|
|
232
234
|
_Out: _ => _
|
|
233
235
|
};
|
|
234
236
|
/** @internal */
|
|
235
|
-
class QueueImpl extends
|
|
237
|
+
class QueueImpl extends icons.Class {
|
|
236
238
|
queue;
|
|
237
239
|
takers;
|
|
238
240
|
shutdownHook;
|
|
@@ -254,7 +256,7 @@ class QueueImpl extends Effect.Class {
|
|
|
254
256
|
this.strategy = strategy;
|
|
255
257
|
}
|
|
256
258
|
pipe() {
|
|
257
|
-
return
|
|
259
|
+
return icons.pipeArguments(this, arguments);
|
|
258
260
|
}
|
|
259
261
|
commit() {
|
|
260
262
|
return this.take;
|
|
@@ -263,43 +265,43 @@ class QueueImpl extends Effect.Class {
|
|
|
263
265
|
return this.queue.capacity();
|
|
264
266
|
}
|
|
265
267
|
get size() {
|
|
266
|
-
return
|
|
268
|
+
return icons.suspend(() => icons.catchAll$1(this.unsafeSize(), () => icons.interrupt$1));
|
|
267
269
|
}
|
|
268
270
|
unsafeSize() {
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
271
|
+
if (icons.get$1(this.shutdownFlag)) {
|
|
272
|
+
return icons.none();
|
|
271
273
|
}
|
|
272
|
-
return
|
|
274
|
+
return icons.some(this.queue.length() - icons.length(this.takers) + this.strategy.surplusSize());
|
|
273
275
|
}
|
|
274
276
|
get isEmpty() {
|
|
275
|
-
return
|
|
277
|
+
return icons.map$1(this.size, size => size <= 0);
|
|
276
278
|
}
|
|
277
279
|
get isFull() {
|
|
278
|
-
return
|
|
280
|
+
return icons.map$1(this.size, size => size >= this.capacity());
|
|
279
281
|
}
|
|
280
282
|
get shutdown() {
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
return
|
|
283
|
+
return icons.uninterruptible(icons.withFiberRuntime(state => {
|
|
284
|
+
icons.pipe(this.shutdownFlag, icons.set(true));
|
|
285
|
+
return icons.pipe(icons.forEachConcurrentDiscard(unsafePollAll(this.takers), d => icons.deferredInterruptWith(d, state.id()), false, false), icons.zipRight(this.strategy.shutdown), icons.whenEffect(icons.deferredSucceed(this.shutdownHook, void 0)), icons.asVoid);
|
|
284
286
|
}));
|
|
285
287
|
}
|
|
286
288
|
get isShutdown() {
|
|
287
|
-
return
|
|
289
|
+
return icons.sync(() => icons.get$1(this.shutdownFlag));
|
|
288
290
|
}
|
|
289
291
|
get awaitShutdown() {
|
|
290
|
-
return
|
|
292
|
+
return icons.deferredAwait(this.shutdownHook);
|
|
291
293
|
}
|
|
292
294
|
isActive() {
|
|
293
|
-
return !
|
|
295
|
+
return !icons.get$1(this.shutdownFlag);
|
|
294
296
|
}
|
|
295
297
|
unsafeOffer(value) {
|
|
296
|
-
if (
|
|
298
|
+
if (icons.get$1(this.shutdownFlag)) {
|
|
297
299
|
return false;
|
|
298
300
|
}
|
|
299
301
|
let noRemaining;
|
|
300
302
|
if (this.queue.length() === 0) {
|
|
301
|
-
const taker =
|
|
302
|
-
if (taker !==
|
|
303
|
+
const taker = icons.pipe(this.takers, icons.poll(icons.EmptyMutableQueue));
|
|
304
|
+
if (taker !== icons.EmptyMutableQueue) {
|
|
303
305
|
unsafeCompleteDeferred(taker, value);
|
|
304
306
|
noRemaining = true;
|
|
305
307
|
} else {
|
|
@@ -317,14 +319,14 @@ class QueueImpl extends Effect.Class {
|
|
|
317
319
|
return succeeded;
|
|
318
320
|
}
|
|
319
321
|
offer(value) {
|
|
320
|
-
return
|
|
321
|
-
if (
|
|
322
|
-
return
|
|
322
|
+
return icons.suspend(() => {
|
|
323
|
+
if (icons.get$1(this.shutdownFlag)) {
|
|
324
|
+
return icons.interrupt$1;
|
|
323
325
|
}
|
|
324
326
|
let noRemaining;
|
|
325
327
|
if (this.queue.length() === 0) {
|
|
326
|
-
const taker =
|
|
327
|
-
if (taker !==
|
|
328
|
+
const taker = icons.pipe(this.takers, icons.poll(icons.EmptyMutableQueue));
|
|
329
|
+
if (taker !== icons.EmptyMutableQueue) {
|
|
328
330
|
unsafeCompleteDeferred(taker, value);
|
|
329
331
|
noRemaining = true;
|
|
330
332
|
} else {
|
|
@@ -334,107 +336,107 @@ class QueueImpl extends Effect.Class {
|
|
|
334
336
|
noRemaining = false;
|
|
335
337
|
}
|
|
336
338
|
if (noRemaining) {
|
|
337
|
-
return
|
|
339
|
+
return icons.succeed$1(true);
|
|
338
340
|
}
|
|
339
341
|
// Not enough takers, offer to the queue
|
|
340
342
|
const succeeded = this.queue.offer(value);
|
|
341
343
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
342
|
-
return succeeded ?
|
|
344
|
+
return succeeded ? icons.succeed$1(true) : this.strategy.handleSurplus([value], this.queue, this.takers, this.shutdownFlag);
|
|
343
345
|
});
|
|
344
346
|
}
|
|
345
347
|
offerAll(iterable) {
|
|
346
|
-
return
|
|
347
|
-
if (
|
|
348
|
-
return
|
|
348
|
+
return icons.suspend(() => {
|
|
349
|
+
if (icons.get$1(this.shutdownFlag)) {
|
|
350
|
+
return icons.interrupt$1;
|
|
349
351
|
}
|
|
350
|
-
const values =
|
|
351
|
-
const pTakers = this.queue.length() === 0 ?
|
|
352
|
-
const [forTakers, remaining] =
|
|
352
|
+
const values = icons.fromIterable(iterable);
|
|
353
|
+
const pTakers = this.queue.length() === 0 ? icons.fromIterable(unsafePollN(this.takers, values.length)) : icons.empty;
|
|
354
|
+
const [forTakers, remaining] = icons.pipe(values, icons.splitAt(pTakers.length));
|
|
353
355
|
for (let i = 0; i < pTakers.length; i++) {
|
|
354
356
|
const taker = pTakers[i];
|
|
355
357
|
const item = forTakers[i];
|
|
356
358
|
unsafeCompleteDeferred(taker, item);
|
|
357
359
|
}
|
|
358
360
|
if (remaining.length === 0) {
|
|
359
|
-
return
|
|
361
|
+
return icons.succeed$1(true);
|
|
360
362
|
}
|
|
361
363
|
// Not enough takers, offer to the queue
|
|
362
364
|
const surplus = this.queue.offerAll(remaining);
|
|
363
365
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
364
|
-
return
|
|
366
|
+
return icons.isEmpty(surplus) ? icons.succeed$1(true) : this.strategy.handleSurplus(surplus, this.queue, this.takers, this.shutdownFlag);
|
|
365
367
|
});
|
|
366
368
|
}
|
|
367
369
|
get take() {
|
|
368
|
-
return
|
|
369
|
-
if (
|
|
370
|
-
return
|
|
370
|
+
return icons.withFiberRuntime(state => {
|
|
371
|
+
if (icons.get$1(this.shutdownFlag)) {
|
|
372
|
+
return icons.interrupt$1;
|
|
371
373
|
}
|
|
372
|
-
const item = this.queue.poll(
|
|
373
|
-
if (item !==
|
|
374
|
+
const item = this.queue.poll(icons.EmptyMutableQueue);
|
|
375
|
+
if (item !== icons.EmptyMutableQueue) {
|
|
374
376
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
375
|
-
return
|
|
377
|
+
return icons.succeed$1(item);
|
|
376
378
|
} else {
|
|
377
379
|
// Add the deferred to takers, then:
|
|
378
380
|
// - Try to take again in case a value was added since
|
|
379
381
|
// - Wait for the deferred to be completed
|
|
380
382
|
// - Clean up resources in case of interruption
|
|
381
|
-
const deferred =
|
|
382
|
-
return
|
|
383
|
-
|
|
383
|
+
const deferred = icons.deferredUnsafeMake(state.id());
|
|
384
|
+
return icons.pipe(icons.suspend(() => {
|
|
385
|
+
icons.pipe(this.takers, icons.offer(deferred));
|
|
384
386
|
unsafeCompleteTakers(this.strategy, this.queue, this.takers);
|
|
385
|
-
return
|
|
386
|
-
}),
|
|
387
|
-
return
|
|
387
|
+
return icons.get$1(this.shutdownFlag) ? icons.interrupt$1 : icons.deferredAwait(deferred);
|
|
388
|
+
}), icons.onInterrupt(() => {
|
|
389
|
+
return icons.sync(() => unsafeRemove(this.takers, deferred));
|
|
388
390
|
}));
|
|
389
391
|
}
|
|
390
392
|
});
|
|
391
393
|
}
|
|
392
394
|
get takeAll() {
|
|
393
|
-
return
|
|
394
|
-
return
|
|
395
|
+
return icons.suspend(() => {
|
|
396
|
+
return icons.get$1(this.shutdownFlag) ? icons.interrupt$1 : icons.sync(() => {
|
|
395
397
|
const values = this.queue.pollUpTo(Number.POSITIVE_INFINITY);
|
|
396
398
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
397
|
-
return
|
|
399
|
+
return icons.fromIterable$1(values);
|
|
398
400
|
});
|
|
399
401
|
});
|
|
400
402
|
}
|
|
401
403
|
takeUpTo(max) {
|
|
402
|
-
return
|
|
404
|
+
return icons.suspend(() => icons.get$1(this.shutdownFlag) ? icons.interrupt$1 : icons.sync(() => {
|
|
403
405
|
const values = this.queue.pollUpTo(max);
|
|
404
406
|
this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers);
|
|
405
|
-
return
|
|
407
|
+
return icons.fromIterable$1(values);
|
|
406
408
|
}));
|
|
407
409
|
}
|
|
408
410
|
takeBetween(min, max) {
|
|
409
|
-
return
|
|
411
|
+
return icons.suspend(() => takeRemainderLoop(this, min, max, icons.empty$1()));
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
414
|
/** @internal */
|
|
413
415
|
const takeRemainderLoop = (self, min, max, acc) => {
|
|
414
416
|
if (max < min) {
|
|
415
|
-
return
|
|
417
|
+
return icons.succeed$1(acc);
|
|
416
418
|
}
|
|
417
|
-
return
|
|
419
|
+
return icons.pipe(takeUpTo(self, max), icons.flatMap(bs => {
|
|
418
420
|
const remaining = min - bs.length;
|
|
419
421
|
if (remaining === 1) {
|
|
420
|
-
return
|
|
422
|
+
return icons.pipe(take$1(self), icons.map$1(b => icons.pipe(acc, icons.appendAll(bs), icons.append(b))));
|
|
421
423
|
}
|
|
422
424
|
if (remaining > 1) {
|
|
423
|
-
return
|
|
425
|
+
return icons.pipe(take$1(self), icons.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, icons.pipe(acc, icons.appendAll(bs), icons.append(b)))));
|
|
424
426
|
}
|
|
425
|
-
return
|
|
427
|
+
return icons.succeed$1(icons.pipe(acc, icons.appendAll(bs)));
|
|
426
428
|
}));
|
|
427
429
|
};
|
|
428
430
|
/** @internal */
|
|
429
|
-
const bounded$1 = requestedCapacity =>
|
|
431
|
+
const bounded$1 = requestedCapacity => icons.pipe(icons.sync(() => icons.bounded(requestedCapacity)), icons.flatMap(queue => make$2(backingQueueFromMutableQueue(queue), backPressureStrategy())));
|
|
430
432
|
/** @internal */
|
|
431
|
-
const unbounded$1 = () =>
|
|
433
|
+
const unbounded$1 = () => icons.pipe(icons.sync(() => icons.unbounded()), icons.flatMap(queue => make$2(backingQueueFromMutableQueue(queue), droppingStrategy())));
|
|
432
434
|
/** @internal */
|
|
433
435
|
const unsafeMake = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
|
|
434
436
|
return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
|
|
435
437
|
};
|
|
436
438
|
/** @internal */
|
|
437
|
-
const make$2 = (queue, strategy) =>
|
|
439
|
+
const make$2 = (queue, strategy) => icons.pipe(icons.deferredMake(), icons.map$1(deferred => unsafeMake(queue, icons.unbounded(), deferred, icons.make$1(false), strategy)));
|
|
438
440
|
/** @internal */
|
|
439
441
|
class BackingQueueFromMutableQueue {
|
|
440
442
|
mutable;
|
|
@@ -443,22 +445,22 @@ class BackingQueueFromMutableQueue {
|
|
|
443
445
|
this.mutable = mutable;
|
|
444
446
|
}
|
|
445
447
|
poll(def) {
|
|
446
|
-
return
|
|
448
|
+
return icons.poll(this.mutable, def);
|
|
447
449
|
}
|
|
448
450
|
pollUpTo(limit) {
|
|
449
|
-
return
|
|
451
|
+
return icons.pollUpTo(this.mutable, limit);
|
|
450
452
|
}
|
|
451
453
|
offerAll(elements) {
|
|
452
|
-
return
|
|
454
|
+
return icons.offerAll(this.mutable, elements);
|
|
453
455
|
}
|
|
454
456
|
offer(element) {
|
|
455
|
-
return
|
|
457
|
+
return icons.offer(this.mutable, element);
|
|
456
458
|
}
|
|
457
459
|
capacity() {
|
|
458
|
-
return
|
|
460
|
+
return icons.capacity(this.mutable);
|
|
459
461
|
}
|
|
460
462
|
length() {
|
|
461
|
-
return
|
|
463
|
+
return icons.length(this.mutable);
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
466
|
/** @internal */
|
|
@@ -470,13 +472,13 @@ const isShutdown$1 = self => self.isShutdown;
|
|
|
470
472
|
/** @internal */
|
|
471
473
|
const shutdown$1 = self => self.shutdown;
|
|
472
474
|
/** @internal */
|
|
473
|
-
const offer$1 = /*#__PURE__*/
|
|
475
|
+
const offer$1 = /*#__PURE__*/icons.dual(2, (self, value) => self.offer(value));
|
|
474
476
|
/** @internal */
|
|
475
477
|
const take$1 = self => self.take;
|
|
476
478
|
/** @internal */
|
|
477
|
-
const takeUpTo = /*#__PURE__*/
|
|
479
|
+
const takeUpTo = /*#__PURE__*/icons.dual(2, (self, max) => self.takeUpTo(max));
|
|
478
480
|
/** @internal */
|
|
479
|
-
const takeBetween$1 = /*#__PURE__*/
|
|
481
|
+
const takeBetween$1 = /*#__PURE__*/icons.dual(3, (self, min, max) => self.takeBetween(min, max));
|
|
480
482
|
// -----------------------------------------------------------------------------
|
|
481
483
|
// Strategy
|
|
482
484
|
// -----------------------------------------------------------------------------
|
|
@@ -487,14 +489,14 @@ const droppingStrategy = () => new DroppingStrategy();
|
|
|
487
489
|
/** @internal */
|
|
488
490
|
class BackPressureStrategy {
|
|
489
491
|
[QueueStrategyTypeId] = queueStrategyVariance;
|
|
490
|
-
putters = /*#__PURE__*/
|
|
492
|
+
putters = /*#__PURE__*/icons.unbounded();
|
|
491
493
|
surplusSize() {
|
|
492
|
-
return
|
|
494
|
+
return icons.length(this.putters);
|
|
493
495
|
}
|
|
494
496
|
onCompleteTakersWithEmptyQueue(takers) {
|
|
495
|
-
while (!
|
|
496
|
-
const taker =
|
|
497
|
-
const putter =
|
|
497
|
+
while (!icons.isEmpty$1(this.putters) && !icons.isEmpty$1(takers)) {
|
|
498
|
+
const taker = icons.poll(takers, void 0);
|
|
499
|
+
const putter = icons.poll(this.putters, void 0);
|
|
498
500
|
if (putter[2]) {
|
|
499
501
|
unsafeCompleteDeferred(putter[1], true);
|
|
500
502
|
}
|
|
@@ -502,49 +504,49 @@ class BackPressureStrategy {
|
|
|
502
504
|
}
|
|
503
505
|
}
|
|
504
506
|
get shutdown() {
|
|
505
|
-
return
|
|
507
|
+
return icons.pipe(icons.fiberId, icons.flatMap(fiberId => icons.pipe(icons.sync(() => unsafePollAll(this.putters)), icons.flatMap(putters => icons.forEachConcurrentDiscard(putters, ([_, deferred, isLastItem]) => isLastItem ? icons.pipe(icons.deferredInterruptWith(deferred, fiberId), icons.asVoid) : icons.void_, false, false)))));
|
|
506
508
|
}
|
|
507
509
|
handleSurplus(iterable, queue, takers, isShutdown) {
|
|
508
|
-
return
|
|
509
|
-
const deferred =
|
|
510
|
-
return
|
|
510
|
+
return icons.withFiberRuntime(state => {
|
|
511
|
+
const deferred = icons.deferredUnsafeMake(state.id());
|
|
512
|
+
return icons.pipe(icons.suspend(() => {
|
|
511
513
|
this.unsafeOffer(iterable, deferred);
|
|
512
514
|
this.unsafeOnQueueEmptySpace(queue, takers);
|
|
513
515
|
unsafeCompleteTakers(this, queue, takers);
|
|
514
|
-
return
|
|
515
|
-
}),
|
|
516
|
+
return icons.get$1(isShutdown) ? icons.interrupt$1 : icons.deferredAwait(deferred);
|
|
517
|
+
}), icons.onInterrupt(() => icons.sync(() => this.unsafeRemove(deferred))));
|
|
516
518
|
});
|
|
517
519
|
}
|
|
518
520
|
unsafeOnQueueEmptySpace(queue, takers) {
|
|
519
521
|
let keepPolling = true;
|
|
520
522
|
while (keepPolling && (queue.capacity() === Number.POSITIVE_INFINITY || queue.length() < queue.capacity())) {
|
|
521
|
-
const putter =
|
|
522
|
-
if (putter ===
|
|
523
|
+
const putter = icons.pipe(this.putters, icons.poll(icons.EmptyMutableQueue));
|
|
524
|
+
if (putter === icons.EmptyMutableQueue) {
|
|
523
525
|
keepPolling = false;
|
|
524
526
|
} else {
|
|
525
527
|
const offered = queue.offer(putter[0]);
|
|
526
528
|
if (offered && putter[2]) {
|
|
527
529
|
unsafeCompleteDeferred(putter[1], true);
|
|
528
530
|
} else if (!offered) {
|
|
529
|
-
unsafeOfferAll(this.putters,
|
|
531
|
+
unsafeOfferAll(this.putters, icons.pipe(unsafePollAll(this.putters), icons.prepend(putter)));
|
|
530
532
|
}
|
|
531
533
|
unsafeCompleteTakers(this, queue, takers);
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
537
|
unsafeOffer(iterable, deferred) {
|
|
536
|
-
const stuff =
|
|
538
|
+
const stuff = icons.fromIterable(iterable);
|
|
537
539
|
for (let i = 0; i < stuff.length; i++) {
|
|
538
540
|
const value = stuff[i];
|
|
539
541
|
if (i === stuff.length - 1) {
|
|
540
|
-
|
|
542
|
+
icons.pipe(this.putters, icons.offer([value, deferred, true]));
|
|
541
543
|
} else {
|
|
542
|
-
|
|
544
|
+
icons.pipe(this.putters, icons.offer([value, deferred, false]));
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
547
|
}
|
|
546
548
|
unsafeRemove(deferred) {
|
|
547
|
-
unsafeOfferAll(this.putters,
|
|
549
|
+
unsafeOfferAll(this.putters, icons.pipe(unsafePollAll(this.putters), icons.filter(([, _]) => _ !== deferred)));
|
|
548
550
|
}
|
|
549
551
|
}
|
|
550
552
|
/** @internal */
|
|
@@ -554,11 +556,11 @@ class DroppingStrategy {
|
|
|
554
556
|
return 0;
|
|
555
557
|
}
|
|
556
558
|
get shutdown() {
|
|
557
|
-
return
|
|
559
|
+
return icons.void_;
|
|
558
560
|
}
|
|
559
561
|
onCompleteTakersWithEmptyQueue() {}
|
|
560
562
|
handleSurplus(_iterable, _queue, _takers, _isShutdown) {
|
|
561
|
-
return
|
|
563
|
+
return icons.succeed$1(false);
|
|
562
564
|
}
|
|
563
565
|
unsafeOnQueueEmptySpace(_queue, _takers) {
|
|
564
566
|
//
|
|
@@ -566,44 +568,44 @@ class DroppingStrategy {
|
|
|
566
568
|
}
|
|
567
569
|
/** @internal */
|
|
568
570
|
const unsafeCompleteDeferred = (deferred, a) => {
|
|
569
|
-
return
|
|
571
|
+
return icons.deferredUnsafeDone(deferred, icons.succeed$1(a));
|
|
570
572
|
};
|
|
571
573
|
/** @internal */
|
|
572
574
|
const unsafeOfferAll = (queue, as) => {
|
|
573
|
-
return
|
|
575
|
+
return icons.pipe(queue, icons.offerAll(as));
|
|
574
576
|
};
|
|
575
577
|
/** @internal */
|
|
576
578
|
const unsafePollAll = queue => {
|
|
577
|
-
return
|
|
579
|
+
return icons.pipe(queue, icons.pollUpTo(Number.POSITIVE_INFINITY));
|
|
578
580
|
};
|
|
579
581
|
/** @internal */
|
|
580
582
|
const unsafePollN = (queue, max) => {
|
|
581
|
-
return
|
|
583
|
+
return icons.pipe(queue, icons.pollUpTo(max));
|
|
582
584
|
};
|
|
583
585
|
/** @internal */
|
|
584
586
|
const unsafeRemove = (queue, a) => {
|
|
585
|
-
unsafeOfferAll(queue,
|
|
587
|
+
unsafeOfferAll(queue, icons.pipe(unsafePollAll(queue), icons.filter(b => a !== b)));
|
|
586
588
|
};
|
|
587
589
|
/** @internal */
|
|
588
590
|
const unsafeCompleteTakers = (strategy, queue, takers) => {
|
|
589
591
|
// Check both a taker and an item are in the queue, starting with the taker
|
|
590
592
|
let keepPolling = true;
|
|
591
593
|
while (keepPolling && queue.length() !== 0) {
|
|
592
|
-
const taker =
|
|
593
|
-
if (taker !==
|
|
594
|
-
const element = queue.poll(
|
|
595
|
-
if (element !==
|
|
594
|
+
const taker = icons.pipe(takers, icons.poll(icons.EmptyMutableQueue));
|
|
595
|
+
if (taker !== icons.EmptyMutableQueue) {
|
|
596
|
+
const element = queue.poll(icons.EmptyMutableQueue);
|
|
597
|
+
if (element !== icons.EmptyMutableQueue) {
|
|
596
598
|
unsafeCompleteDeferred(taker, element);
|
|
597
599
|
strategy.unsafeOnQueueEmptySpace(queue, takers);
|
|
598
600
|
} else {
|
|
599
|
-
unsafeOfferAll(takers,
|
|
601
|
+
unsafeOfferAll(takers, icons.pipe(unsafePollAll(takers), icons.prepend(taker)));
|
|
600
602
|
}
|
|
601
603
|
keepPolling = true;
|
|
602
604
|
} else {
|
|
603
605
|
keepPolling = false;
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
|
-
if (keepPolling && queue.length() === 0 && !
|
|
608
|
+
if (keepPolling && queue.length() === 0 && !icons.isEmpty$1(takers)) {
|
|
607
609
|
strategy.onCompleteTakersWithEmptyQueue(takers);
|
|
608
610
|
}
|
|
609
611
|
};
|
|
@@ -737,7 +739,7 @@ class ContinuationKImpl {
|
|
|
737
739
|
this.onHalt = onHalt;
|
|
738
740
|
}
|
|
739
741
|
onExit(exit) {
|
|
740
|
-
return
|
|
742
|
+
return icons.isFailure(exit) ? this.onHalt(exit.cause) : this.onSuccess(exit.value);
|
|
741
743
|
}
|
|
742
744
|
}
|
|
743
745
|
/** @internal */
|
|
@@ -828,13 +830,13 @@ const channelVariance = {
|
|
|
828
830
|
const proto$5 = {
|
|
829
831
|
[ChannelTypeId]: channelVariance,
|
|
830
832
|
pipe() {
|
|
831
|
-
return
|
|
833
|
+
return icons.pipeArguments(this, arguments);
|
|
832
834
|
}
|
|
833
835
|
};
|
|
834
836
|
/** @internal */
|
|
835
|
-
const isChannel = u =>
|
|
837
|
+
const isChannel = u => icons.hasProperty(u, ChannelTypeId) || icons.isEffect(u);
|
|
836
838
|
/** @internal */
|
|
837
|
-
const acquireReleaseOut = /*#__PURE__*/
|
|
839
|
+
const acquireReleaseOut = /*#__PURE__*/icons.dual(2, (self, release) => {
|
|
838
840
|
const op = Object.create(proto$5);
|
|
839
841
|
op._tag = OP_BRACKET_OUT;
|
|
840
842
|
op.acquire = () => self;
|
|
@@ -847,26 +849,26 @@ const concatAllWith = (channels, f, g) => {
|
|
|
847
849
|
op._tag = OP_CONCAT_ALL;
|
|
848
850
|
op.combineInners = f;
|
|
849
851
|
op.combineAll = g;
|
|
850
|
-
op.onPull = () => PullAfterNext(
|
|
852
|
+
op.onPull = () => PullAfterNext(icons.none());
|
|
851
853
|
op.onEmit = () => Continue;
|
|
852
854
|
op.value = () => channels;
|
|
853
|
-
op.k =
|
|
855
|
+
op.k = icons.identity;
|
|
854
856
|
return op;
|
|
855
857
|
};
|
|
856
858
|
/** @internal */
|
|
857
|
-
const concatMapWith = /*#__PURE__*/
|
|
859
|
+
const concatMapWith = /*#__PURE__*/icons.dual(4, (self, f, g, h) => {
|
|
858
860
|
const op = Object.create(proto$5);
|
|
859
861
|
op._tag = OP_CONCAT_ALL;
|
|
860
862
|
op.combineInners = g;
|
|
861
863
|
op.combineAll = h;
|
|
862
|
-
op.onPull = () => PullAfterNext(
|
|
864
|
+
op.onPull = () => PullAfterNext(icons.none());
|
|
863
865
|
op.onEmit = () => Continue;
|
|
864
866
|
op.value = () => self;
|
|
865
867
|
op.k = f;
|
|
866
868
|
return op;
|
|
867
869
|
});
|
|
868
870
|
/** @internal */
|
|
869
|
-
const embedInput = /*#__PURE__*/
|
|
871
|
+
const embedInput = /*#__PURE__*/icons.dual(2, (self, input) => {
|
|
870
872
|
const op = Object.create(proto$5);
|
|
871
873
|
op._tag = OP_BRIDGE;
|
|
872
874
|
op.input = input;
|
|
@@ -874,7 +876,7 @@ const embedInput = /*#__PURE__*/Effect.dual(2, (self, input) => {
|
|
|
874
876
|
return op;
|
|
875
877
|
});
|
|
876
878
|
/** @internal */
|
|
877
|
-
const ensuringWith = /*#__PURE__*/
|
|
879
|
+
const ensuringWith = /*#__PURE__*/icons.dual(2, (self, finalizer) => {
|
|
878
880
|
const op = Object.create(proto$5);
|
|
879
881
|
op._tag = OP_ENSURING;
|
|
880
882
|
op.channel = self;
|
|
@@ -893,7 +895,7 @@ const failCauseSync = evaluate => {
|
|
|
893
895
|
return op;
|
|
894
896
|
};
|
|
895
897
|
/** @internal */
|
|
896
|
-
const flatMap$1 = /*#__PURE__*/
|
|
898
|
+
const flatMap$1 = /*#__PURE__*/icons.dual(2, (self, f) => {
|
|
897
899
|
const op = Object.create(proto$5);
|
|
898
900
|
op._tag = OP_FOLD;
|
|
899
901
|
op.channel = self;
|
|
@@ -908,7 +910,7 @@ const fromEffect$3 = effect => {
|
|
|
908
910
|
return op;
|
|
909
911
|
};
|
|
910
912
|
/** @internal */
|
|
911
|
-
const pipeTo = /*#__PURE__*/
|
|
913
|
+
const pipeTo = /*#__PURE__*/icons.dual(2, (self, that) => {
|
|
912
914
|
const op = Object.create(proto$5);
|
|
913
915
|
op._tag = OP_PIPE_TO;
|
|
914
916
|
op.left = () => self;
|
|
@@ -918,7 +920,7 @@ const pipeTo = /*#__PURE__*/Effect.dual(2, (self, that) => {
|
|
|
918
920
|
/** @internal */
|
|
919
921
|
const readWith = options => readWithCause({
|
|
920
922
|
onInput: options.onInput,
|
|
921
|
-
onFailure: cause =>
|
|
923
|
+
onFailure: cause => icons.match(failureOrCause(cause), {
|
|
922
924
|
onLeft: options.onFailure,
|
|
923
925
|
onRight: failCause$2
|
|
924
926
|
}),
|
|
@@ -1016,9 +1018,9 @@ const Read = (upstream, onEffect, onEmit, onDone) => {
|
|
|
1016
1018
|
/** @internal */
|
|
1017
1019
|
const isFromEffect = self => self._tag === OP_FROM_EFFECT;
|
|
1018
1020
|
/** @internal */
|
|
1019
|
-
const effect = self => isFromEffect(self) ? self.effect :
|
|
1021
|
+
const effect = self => isFromEffect(self) ? self.effect : icons._void;
|
|
1020
1022
|
/** @internal */
|
|
1021
|
-
const effectOrUndefinedIgnored = self => isFromEffect(self) ?
|
|
1023
|
+
const effectOrUndefinedIgnored = self => isFromEffect(self) ? icons.ignore(self.effect) : undefined;
|
|
1022
1024
|
|
|
1023
1025
|
/** @internal */
|
|
1024
1026
|
const OP_PULL_FROM_CHILD = "PullFromChild";
|
|
@@ -1048,7 +1050,7 @@ class PullFromChild {
|
|
|
1048
1050
|
const fin1 = this.childExecutor.close(exit);
|
|
1049
1051
|
const fin2 = this.parentSubexecutor.close(exit);
|
|
1050
1052
|
if (fin1 !== undefined && fin2 !== undefined) {
|
|
1051
|
-
return
|
|
1053
|
+
return icons.zipWith(icons.exit(fin1), icons.exit(fin2), (exit1, exit2) => icons.pipe(exit1, icons.zipRight$1(exit2)));
|
|
1052
1054
|
} else if (fin1 !== undefined) {
|
|
1053
1055
|
return fin1;
|
|
1054
1056
|
} else if (fin2 !== undefined) {
|
|
@@ -1092,11 +1094,11 @@ class PullFromUpstream {
|
|
|
1092
1094
|
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
|
1093
1095
|
const result = fins.reduce((acc, next) => {
|
|
1094
1096
|
if (acc !== undefined && next !== undefined) {
|
|
1095
|
-
return
|
|
1097
|
+
return icons.zipWith(acc, icons.exit(next), (exit1, exit2) => icons.zipRight$1(exit1, exit2));
|
|
1096
1098
|
} else if (acc !== undefined) {
|
|
1097
1099
|
return acc;
|
|
1098
1100
|
} else if (next !== undefined) {
|
|
1099
|
-
return
|
|
1101
|
+
return icons.exit(next);
|
|
1100
1102
|
} else {
|
|
1101
1103
|
return undefined;
|
|
1102
1104
|
}
|
|
@@ -1136,11 +1138,11 @@ class DrainChildExecutors {
|
|
|
1136
1138
|
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
|
1137
1139
|
const result = fins.reduce((acc, next) => {
|
|
1138
1140
|
if (acc !== undefined && next !== undefined) {
|
|
1139
|
-
return
|
|
1141
|
+
return icons.zipWith(acc, icons.exit(next), (exit1, exit2) => icons.zipRight$1(exit1, exit2));
|
|
1140
1142
|
} else if (acc !== undefined) {
|
|
1141
1143
|
return acc;
|
|
1142
1144
|
} else if (next !== undefined) {
|
|
1143
|
-
return
|
|
1145
|
+
return icons.exit(next);
|
|
1144
1146
|
} else {
|
|
1145
1147
|
return undefined;
|
|
1146
1148
|
}
|
|
@@ -1231,7 +1233,7 @@ class ChannelExecutor {
|
|
|
1231
1233
|
if (this._currentChannel === undefined) {
|
|
1232
1234
|
result = Done();
|
|
1233
1235
|
} else {
|
|
1234
|
-
if (
|
|
1236
|
+
if (icons.isEffect(this._currentChannel)) {
|
|
1235
1237
|
this._currentChannel = fromEffect$3(this._currentChannel);
|
|
1236
1238
|
}
|
|
1237
1239
|
switch (this._currentChannel._tag) {
|
|
@@ -1250,23 +1252,23 @@ class ChannelExecutor {
|
|
|
1250
1252
|
if (this._input !== undefined) {
|
|
1251
1253
|
const inputExecutor = this._input;
|
|
1252
1254
|
this._input = undefined;
|
|
1253
|
-
const drainer = () =>
|
|
1255
|
+
const drainer = () => icons.flatMap$1(bridgeInput.awaitRead(), () => icons.suspend$1(() => {
|
|
1254
1256
|
const state = inputExecutor.run();
|
|
1255
1257
|
switch (state._tag) {
|
|
1256
1258
|
case OP_DONE$1:
|
|
1257
1259
|
{
|
|
1258
|
-
return
|
|
1260
|
+
return icons.match$1(inputExecutor.getDone(), {
|
|
1259
1261
|
onFailure: cause => bridgeInput.error(cause),
|
|
1260
1262
|
onSuccess: value => bridgeInput.done(value)
|
|
1261
1263
|
});
|
|
1262
1264
|
}
|
|
1263
1265
|
case OP_EMIT$1:
|
|
1264
1266
|
{
|
|
1265
|
-
return
|
|
1267
|
+
return icons.flatMap$1(bridgeInput.emit(inputExecutor.getEmit()), () => drainer());
|
|
1266
1268
|
}
|
|
1267
1269
|
case OP_FROM_EFFECT:
|
|
1268
1270
|
{
|
|
1269
|
-
return
|
|
1271
|
+
return icons.matchCauseEffect(state.effect, {
|
|
1270
1272
|
onFailure: cause => bridgeInput.error(cause),
|
|
1271
1273
|
onSuccess: () => drainer()
|
|
1272
1274
|
});
|
|
@@ -1277,18 +1279,18 @@ class ChannelExecutor {
|
|
|
1277
1279
|
}
|
|
1278
1280
|
}
|
|
1279
1281
|
}));
|
|
1280
|
-
result = fromEffect$2(
|
|
1282
|
+
result = fromEffect$2(icons.flatMap$1(icons.forkDaemon(icons.interruptible(drainer())), fiber => icons.sync$1(() => this.addFinalizer(exit => icons.flatMap$1(interrupt(fiber), () => icons.suspend$1(() => {
|
|
1281
1283
|
const effect = this.restorePipe(exit, inputExecutor);
|
|
1282
|
-
return effect !== undefined ? effect :
|
|
1284
|
+
return effect !== undefined ? effect : icons._void;
|
|
1283
1285
|
}))))));
|
|
1284
1286
|
}
|
|
1285
1287
|
break;
|
|
1286
1288
|
}
|
|
1287
1289
|
case OP_CONCAT_ALL:
|
|
1288
1290
|
{
|
|
1289
|
-
const executor = new ChannelExecutor(this._currentChannel.value(), this._providedEnv, effect =>
|
|
1290
|
-
const prevLastClose = this._closeLastSubstream === undefined ?
|
|
1291
|
-
this._closeLastSubstream =
|
|
1291
|
+
const executor = new ChannelExecutor(this._currentChannel.value(), this._providedEnv, effect => icons.sync$1(() => {
|
|
1292
|
+
const prevLastClose = this._closeLastSubstream === undefined ? icons._void : this._closeLastSubstream;
|
|
1293
|
+
this._closeLastSubstream = icons.pipe(prevLastClose, icons.zipRight$2(effect));
|
|
1292
1294
|
}));
|
|
1293
1295
|
executor._input = this._input;
|
|
1294
1296
|
const channel = this._currentChannel;
|
|
@@ -1322,15 +1324,15 @@ class ChannelExecutor {
|
|
|
1322
1324
|
}
|
|
1323
1325
|
case OP_FROM_EFFECT$1:
|
|
1324
1326
|
{
|
|
1325
|
-
const effect = this._providedEnv === undefined ? this._currentChannel.effect() :
|
|
1326
|
-
result = fromEffect$2(
|
|
1327
|
+
const effect = this._providedEnv === undefined ? this._currentChannel.effect() : icons.pipe(this._currentChannel.effect(), icons.provide(this._providedEnv));
|
|
1328
|
+
result = fromEffect$2(icons.matchCauseEffect(effect, {
|
|
1327
1329
|
onFailure: cause => {
|
|
1328
1330
|
const state = this.doneHalt(cause);
|
|
1329
|
-
return state !== undefined && isFromEffect(state) ? state.effect :
|
|
1331
|
+
return state !== undefined && isFromEffect(state) ? state.effect : icons._void;
|
|
1330
1332
|
},
|
|
1331
1333
|
onSuccess: value => {
|
|
1332
1334
|
const state = this.doneSucceed(value);
|
|
1333
|
-
return state !== undefined && isFromEffect(state) ? state.effect :
|
|
1335
|
+
return state !== undefined && isFromEffect(state) ? state.effect : icons._void;
|
|
1334
1336
|
}
|
|
1335
1337
|
}));
|
|
1336
1338
|
break;
|
|
@@ -1343,7 +1345,7 @@ class ChannelExecutor {
|
|
|
1343
1345
|
this._input = leftExec;
|
|
1344
1346
|
this.addFinalizer(exit => {
|
|
1345
1347
|
const effect = this.restorePipe(exit, previousInput);
|
|
1346
|
-
return effect !== undefined ? effect :
|
|
1348
|
+
return effect !== undefined ? effect : icons._void;
|
|
1347
1349
|
});
|
|
1348
1350
|
this._currentChannel = this._currentChannel.right();
|
|
1349
1351
|
break;
|
|
@@ -1353,7 +1355,7 @@ class ChannelExecutor {
|
|
|
1353
1355
|
const previousEnv = this._providedEnv;
|
|
1354
1356
|
this._providedEnv = this._currentChannel.context();
|
|
1355
1357
|
this._currentChannel = this._currentChannel.inner;
|
|
1356
|
-
this.addFinalizer(() =>
|
|
1358
|
+
this.addFinalizer(() => icons.sync$1(() => {
|
|
1357
1359
|
this._providedEnv = previousEnv;
|
|
1358
1360
|
}));
|
|
1359
1361
|
break;
|
|
@@ -1361,11 +1363,11 @@ class ChannelExecutor {
|
|
|
1361
1363
|
case OP_READ$1:
|
|
1362
1364
|
{
|
|
1363
1365
|
const read = this._currentChannel;
|
|
1364
|
-
result = Read(this._input,
|
|
1366
|
+
result = Read(this._input, icons.identity, emitted => {
|
|
1365
1367
|
try {
|
|
1366
1368
|
this._currentChannel = read.more(emitted);
|
|
1367
1369
|
} catch (error) {
|
|
1368
|
-
this._currentChannel = read.done.onExit(
|
|
1370
|
+
this._currentChannel = read.done.onExit(icons.die$1(error));
|
|
1369
1371
|
}
|
|
1370
1372
|
return undefined;
|
|
1371
1373
|
}, exit => {
|
|
@@ -1425,7 +1427,7 @@ class ChannelExecutor {
|
|
|
1425
1427
|
}
|
|
1426
1428
|
next = this._doneStack.pop();
|
|
1427
1429
|
}
|
|
1428
|
-
const effect = finalizers.length === 0 ?
|
|
1430
|
+
const effect = finalizers.length === 0 ? icons._void : runFinalizers(finalizers, exit);
|
|
1429
1431
|
this.storeInProgressFinalizer(effect);
|
|
1430
1432
|
return effect;
|
|
1431
1433
|
}
|
|
@@ -1448,30 +1450,30 @@ class ChannelExecutor {
|
|
|
1448
1450
|
const effect = currInput.close(exit);
|
|
1449
1451
|
return effect;
|
|
1450
1452
|
}
|
|
1451
|
-
return
|
|
1453
|
+
return icons._void;
|
|
1452
1454
|
}
|
|
1453
1455
|
close(exit) {
|
|
1454
1456
|
let runInProgressFinalizers = undefined;
|
|
1455
1457
|
const finalizer = this._inProgressFinalizer;
|
|
1456
1458
|
if (finalizer !== undefined) {
|
|
1457
|
-
runInProgressFinalizers =
|
|
1459
|
+
runInProgressFinalizers = icons.pipe(finalizer, icons.ensuring(icons.sync$1(() => this.clearInProgressFinalizer())));
|
|
1458
1460
|
}
|
|
1459
1461
|
let closeSelf = undefined;
|
|
1460
1462
|
const selfFinalizers = this.popAllFinalizers(exit);
|
|
1461
1463
|
if (selfFinalizers !== undefined) {
|
|
1462
|
-
closeSelf =
|
|
1464
|
+
closeSelf = icons.pipe(selfFinalizers, icons.ensuring(icons.sync$1(() => this.clearInProgressFinalizer())));
|
|
1463
1465
|
}
|
|
1464
1466
|
const closeSubexecutors = this._activeSubexecutor === undefined ? undefined : this._activeSubexecutor.close(exit);
|
|
1465
1467
|
if (closeSubexecutors === undefined && runInProgressFinalizers === undefined && closeSelf === undefined) {
|
|
1466
1468
|
return undefined;
|
|
1467
1469
|
}
|
|
1468
|
-
return
|
|
1470
|
+
return icons.pipe(icons.exit(ifNotNull(closeSubexecutors)), icons.zip(icons.exit(ifNotNull(runInProgressFinalizers))), icons.zip(icons.exit(ifNotNull(closeSelf))), icons.map$2(([[exit1, exit2], exit3]) => icons.pipe(exit1, icons.zipRight$1(exit2), icons.zipRight$1(exit3))), icons.uninterruptible$1,
|
|
1469
1471
|
// TODO: remove
|
|
1470
|
-
|
|
1472
|
+
icons.flatMap$1(exit => icons.suspend$1(() => exit)));
|
|
1471
1473
|
}
|
|
1472
1474
|
doneSucceed(value) {
|
|
1473
1475
|
if (this._doneStack.length === 0) {
|
|
1474
|
-
this._done =
|
|
1476
|
+
this._done = icons.succeed$2(value);
|
|
1475
1477
|
this._currentChannel = undefined;
|
|
1476
1478
|
return Done();
|
|
1477
1479
|
}
|
|
@@ -1484,18 +1486,18 @@ class ChannelExecutor {
|
|
|
1484
1486
|
const finalizers = this.popNextFinalizers();
|
|
1485
1487
|
if (this._doneStack.length === 0) {
|
|
1486
1488
|
this._doneStack = finalizers.reverse();
|
|
1487
|
-
this._done =
|
|
1489
|
+
this._done = icons.succeed$2(value);
|
|
1488
1490
|
this._currentChannel = undefined;
|
|
1489
1491
|
return Done();
|
|
1490
1492
|
}
|
|
1491
|
-
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer),
|
|
1493
|
+
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), icons.succeed$2(value));
|
|
1492
1494
|
this.storeInProgressFinalizer(finalizerEffect);
|
|
1493
|
-
const effect =
|
|
1495
|
+
const effect = icons.pipe(finalizerEffect, icons.ensuring(icons.sync$1(() => this.clearInProgressFinalizer())), icons.uninterruptible$1, icons.flatMap$1(() => icons.sync$1(() => this.doneSucceed(value))));
|
|
1494
1496
|
return fromEffect$2(effect);
|
|
1495
1497
|
}
|
|
1496
1498
|
doneHalt(cause) {
|
|
1497
1499
|
if (this._doneStack.length === 0) {
|
|
1498
|
-
this._done =
|
|
1500
|
+
this._done = icons.failCause(cause);
|
|
1499
1501
|
this._currentChannel = undefined;
|
|
1500
1502
|
return Done();
|
|
1501
1503
|
}
|
|
@@ -1512,13 +1514,13 @@ class ChannelExecutor {
|
|
|
1512
1514
|
const finalizers = this.popNextFinalizers();
|
|
1513
1515
|
if (this._doneStack.length === 0) {
|
|
1514
1516
|
this._doneStack = finalizers.reverse();
|
|
1515
|
-
this._done =
|
|
1517
|
+
this._done = icons.failCause(cause);
|
|
1516
1518
|
this._currentChannel = undefined;
|
|
1517
1519
|
return Done();
|
|
1518
1520
|
}
|
|
1519
|
-
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer),
|
|
1521
|
+
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), icons.failCause(cause));
|
|
1520
1522
|
this.storeInProgressFinalizer(finalizerEffect);
|
|
1521
|
-
const effect =
|
|
1523
|
+
const effect = icons.pipe(finalizerEffect, icons.ensuring(icons.sync$1(() => this.clearInProgressFinalizer())), icons.uninterruptible$1, icons.flatMap$1(() => icons.sync$1(() => this.doneHalt(cause))));
|
|
1522
1524
|
return fromEffect$2(effect);
|
|
1523
1525
|
}
|
|
1524
1526
|
processCancellation() {
|
|
@@ -1528,11 +1530,11 @@ class ChannelExecutor {
|
|
|
1528
1530
|
return Done();
|
|
1529
1531
|
}
|
|
1530
1532
|
runBracketOut(bracketOut) {
|
|
1531
|
-
const effect =
|
|
1532
|
-
onFailure: cause =>
|
|
1533
|
+
const effect = icons.uninterruptible$1(icons.matchCauseEffect(this.provide(bracketOut.acquire()), {
|
|
1534
|
+
onFailure: cause => icons.sync$1(() => {
|
|
1533
1535
|
this._currentChannel = failCause$2(cause);
|
|
1534
1536
|
}),
|
|
1535
|
-
onSuccess: out =>
|
|
1537
|
+
onSuccess: out => icons.sync$1(() => {
|
|
1536
1538
|
this.addFinalizer(exit => this.provide(bracketOut.finalizer(out, exit)));
|
|
1537
1539
|
this._currentChannel = write(out);
|
|
1538
1540
|
})
|
|
@@ -1543,7 +1545,7 @@ class ChannelExecutor {
|
|
|
1543
1545
|
if (this._providedEnv === undefined) {
|
|
1544
1546
|
return effect;
|
|
1545
1547
|
}
|
|
1546
|
-
return
|
|
1548
|
+
return icons.pipe(effect, icons.provide(this._providedEnv));
|
|
1547
1549
|
}
|
|
1548
1550
|
runEnsuring(ensuring) {
|
|
1549
1551
|
this.addFinalizer(ensuring.finalizer);
|
|
@@ -1580,18 +1582,18 @@ class ChannelExecutor {
|
|
|
1580
1582
|
this._activeSubexecutor = nextSubExec;
|
|
1581
1583
|
}
|
|
1582
1584
|
finishWithExit(exit) {
|
|
1583
|
-
const state =
|
|
1585
|
+
const state = icons.match$1(exit, {
|
|
1584
1586
|
onFailure: cause => this.doneHalt(cause),
|
|
1585
1587
|
onSuccess: value => this.doneSucceed(value)
|
|
1586
1588
|
});
|
|
1587
1589
|
this._activeSubexecutor = undefined;
|
|
1588
|
-
return state === undefined ?
|
|
1590
|
+
return state === undefined ? icons._void : effect(state);
|
|
1589
1591
|
}
|
|
1590
1592
|
finishSubexecutorWithCloseEffect(subexecutorDone, ...closeFuncs) {
|
|
1591
|
-
this.addFinalizer(() =>
|
|
1593
|
+
this.addFinalizer(() => icons.pipe(closeFuncs, icons.forEach(closeFunc => icons.pipe(icons.sync$1(() => closeFunc(subexecutorDone)), icons.flatMap$1(closeEffect => closeEffect !== undefined ? closeEffect : icons._void)), {
|
|
1592
1594
|
discard: true
|
|
1593
1595
|
})));
|
|
1594
|
-
const state =
|
|
1596
|
+
const state = icons.pipe(subexecutorDone, icons.match$1({
|
|
1595
1597
|
onFailure: cause => this.doneHalt(cause),
|
|
1596
1598
|
onSuccess: value => this.doneSucceed(value)
|
|
1597
1599
|
}));
|
|
@@ -1613,7 +1615,7 @@ class ChannelExecutor {
|
|
|
1613
1615
|
}
|
|
1614
1616
|
}
|
|
1615
1617
|
pullFromChild(childExecutor, parentSubexecutor, onEmitted, subexecutor) {
|
|
1616
|
-
return Read(childExecutor,
|
|
1618
|
+
return Read(childExecutor, icons.identity, emitted => {
|
|
1617
1619
|
const childExecutorDecision = onEmitted(emitted);
|
|
1618
1620
|
switch (childExecutorDecision._tag) {
|
|
1619
1621
|
case OP_CONTINUE:
|
|
@@ -1634,7 +1636,7 @@ class ChannelExecutor {
|
|
|
1634
1636
|
}
|
|
1635
1637
|
this._activeSubexecutor = new Emit(emitted, this._activeSubexecutor);
|
|
1636
1638
|
return undefined;
|
|
1637
|
-
},
|
|
1639
|
+
}, icons.match$1({
|
|
1638
1640
|
onFailure: cause => {
|
|
1639
1641
|
const state = this.handleSubexecutorFailure(childExecutor, parentSubexecutor, cause);
|
|
1640
1642
|
return state === undefined ? undefined : effectOrUndefinedIgnored(state);
|
|
@@ -1651,21 +1653,21 @@ class ChannelExecutor {
|
|
|
1651
1653
|
case OP_PULL_FROM_UPSTREAM:
|
|
1652
1654
|
{
|
|
1653
1655
|
const modifiedParent = new PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);
|
|
1654
|
-
this._closeLastSubstream = childExecutor.close(
|
|
1656
|
+
this._closeLastSubstream = childExecutor.close(icons.succeed$2(doneValue));
|
|
1655
1657
|
this.replaceSubexecutor(modifiedParent);
|
|
1656
1658
|
break;
|
|
1657
1659
|
}
|
|
1658
1660
|
case OP_DRAIN_CHILD_EXECUTORS:
|
|
1659
1661
|
{
|
|
1660
1662
|
const modifiedParent = new DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);
|
|
1661
|
-
this._closeLastSubstream = childExecutor.close(
|
|
1663
|
+
this._closeLastSubstream = childExecutor.close(icons.succeed$2(doneValue));
|
|
1662
1664
|
this.replaceSubexecutor(modifiedParent);
|
|
1663
1665
|
break;
|
|
1664
1666
|
}
|
|
1665
1667
|
}
|
|
1666
1668
|
}
|
|
1667
1669
|
handleSubexecutorFailure(childExecutor, parentSubexecutor, cause) {
|
|
1668
|
-
return this.finishSubexecutorWithCloseEffect(
|
|
1670
|
+
return this.finishSubexecutorWithCloseEffect(icons.failCause(cause), exit => parentSubexecutor.close(exit), exit => childExecutor.close(exit));
|
|
1669
1671
|
}
|
|
1670
1672
|
pullFromUpstream(subexecutor) {
|
|
1671
1673
|
if (subexecutor.activeChildExecutors.length === 0) {
|
|
@@ -1681,19 +1683,19 @@ class ChannelExecutor {
|
|
|
1681
1683
|
}
|
|
1682
1684
|
performPullFromUpstream(subexecutor) {
|
|
1683
1685
|
return Read(subexecutor.upstreamExecutor, effect => {
|
|
1684
|
-
const closeLastSubstream = this._closeLastSubstream === undefined ?
|
|
1686
|
+
const closeLastSubstream = this._closeLastSubstream === undefined ? icons._void : this._closeLastSubstream;
|
|
1685
1687
|
this._closeLastSubstream = undefined;
|
|
1686
|
-
return
|
|
1688
|
+
return icons.pipe(this._executeCloseLastSubstream(closeLastSubstream), icons.zipRight$2(effect));
|
|
1687
1689
|
}, emitted => {
|
|
1688
1690
|
if (this._closeLastSubstream !== undefined) {
|
|
1689
1691
|
const closeLastSubstream = this._closeLastSubstream;
|
|
1690
1692
|
this._closeLastSubstream = undefined;
|
|
1691
|
-
return
|
|
1693
|
+
return icons.pipe(this._executeCloseLastSubstream(closeLastSubstream), icons.map$2(() => {
|
|
1692
1694
|
const childExecutor = new ChannelExecutor(subexecutor.createChild(emitted), this._providedEnv, this._executeCloseLastSubstream);
|
|
1693
1695
|
childExecutor._input = this._input;
|
|
1694
1696
|
const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(Pulled(emitted)));
|
|
1695
1697
|
this._activeSubexecutor = new PullFromChild(childExecutor, new PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);
|
|
1696
|
-
if (
|
|
1698
|
+
if (icons.isSome(emitSeparator)) {
|
|
1697
1699
|
this._activeSubexecutor = new Emit(emitSeparator.value, this._activeSubexecutor);
|
|
1698
1700
|
}
|
|
1699
1701
|
return undefined;
|
|
@@ -1703,7 +1705,7 @@ class ChannelExecutor {
|
|
|
1703
1705
|
childExecutor._input = this._input;
|
|
1704
1706
|
const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(Pulled(emitted)));
|
|
1705
1707
|
this._activeSubexecutor = new PullFromChild(childExecutor, new PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);
|
|
1706
|
-
if (
|
|
1708
|
+
if (icons.isSome(emitSeparator)) {
|
|
1707
1709
|
this._activeSubexecutor = new Emit(emitSeparator.value, this._activeSubexecutor);
|
|
1708
1710
|
}
|
|
1709
1711
|
return undefined;
|
|
@@ -1713,13 +1715,13 @@ class ChannelExecutor {
|
|
|
1713
1715
|
if (this._closeLastSubstream !== undefined) {
|
|
1714
1716
|
const closeLastSubstream = this._closeLastSubstream;
|
|
1715
1717
|
this._closeLastSubstream = undefined;
|
|
1716
|
-
return
|
|
1718
|
+
return icons.pipe(this._executeCloseLastSubstream(closeLastSubstream), icons.map$2(() => this.replaceSubexecutor(drain)));
|
|
1717
1719
|
}
|
|
1718
1720
|
this.replaceSubexecutor(drain);
|
|
1719
1721
|
return undefined;
|
|
1720
1722
|
}
|
|
1721
1723
|
const closeLastSubstream = this._closeLastSubstream;
|
|
1722
|
-
const state = this.finishSubexecutorWithCloseEffect(
|
|
1724
|
+
const state = this.finishSubexecutorWithCloseEffect(icons.pipe(exit, icons.map$3(a => subexecutor.combineWithChildResult(subexecutor.lastDone, a))), () => closeLastSubstream, exit => subexecutor.upstreamExecutor.close(exit));
|
|
1723
1725
|
return state === undefined ? undefined :
|
|
1724
1726
|
// NOTE: assuming finalizers cannot fail
|
|
1725
1727
|
effectOrUndefinedIgnored(state);
|
|
@@ -1729,7 +1731,7 @@ class ChannelExecutor {
|
|
|
1729
1731
|
if (subexecutor.activeChildExecutors.length === 0) {
|
|
1730
1732
|
const lastClose = this._closeLastSubstream;
|
|
1731
1733
|
if (lastClose !== undefined) {
|
|
1732
|
-
this.addFinalizer(() =>
|
|
1734
|
+
this.addFinalizer(() => icons.succeed(lastClose));
|
|
1733
1735
|
}
|
|
1734
1736
|
return this.finishSubexecutorWithCloseEffect(subexecutor.upstreamDone, () => lastClose, exit => subexecutor.upstreamExecutor.close(exit));
|
|
1735
1737
|
}
|
|
@@ -1738,7 +1740,7 @@ class ChannelExecutor {
|
|
|
1738
1740
|
if (activeChild === undefined) {
|
|
1739
1741
|
const [emitSeparator, remainingExecutors] = this.applyUpstreamPullStrategy(true, rest, subexecutor.onPull(NoUpstream(rest.reduce((n, curr) => curr !== undefined ? n + 1 : n, 0))));
|
|
1740
1742
|
this.replaceSubexecutor(new DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, remainingExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull));
|
|
1741
|
-
if (
|
|
1743
|
+
if (icons.isSome(emitSeparator)) {
|
|
1742
1744
|
this._emitted = emitSeparator.value;
|
|
1743
1745
|
return Emit$1();
|
|
1744
1746
|
}
|
|
@@ -1749,9 +1751,9 @@ class ChannelExecutor {
|
|
|
1749
1751
|
return undefined;
|
|
1750
1752
|
}
|
|
1751
1753
|
}
|
|
1752
|
-
const ifNotNull = effect => effect !== undefined ? effect :
|
|
1754
|
+
const ifNotNull = effect => effect !== undefined ? effect : icons._void;
|
|
1753
1755
|
const runFinalizers = (finalizers, exit) => {
|
|
1754
|
-
return
|
|
1756
|
+
return icons.pipe(icons.forEach(finalizers, fin => icons.exit(fin(exit))), icons.map$2(exits => icons.pipe(icons.all(exits), icons.getOrElse(() => icons.void_$1))), icons.flatMap$1(exit => icons.suspend$1(() => exit)));
|
|
1755
1757
|
};
|
|
1756
1758
|
/**
|
|
1757
1759
|
* @internal
|
|
@@ -1761,7 +1763,7 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1761
1763
|
const read = () => {
|
|
1762
1764
|
const current = readStack.pop();
|
|
1763
1765
|
if (current === undefined || current.upstream === undefined) {
|
|
1764
|
-
return
|
|
1766
|
+
return icons.dieMessage("Unexpected end of input for channel execution");
|
|
1765
1767
|
}
|
|
1766
1768
|
const state = current.upstream.run();
|
|
1767
1769
|
switch (state._tag) {
|
|
@@ -1770,17 +1772,17 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1770
1772
|
const emitEffect = current.onEmit(current.upstream.getEmit());
|
|
1771
1773
|
if (readStack.length === 0) {
|
|
1772
1774
|
if (emitEffect === undefined) {
|
|
1773
|
-
return
|
|
1775
|
+
return icons.suspend$1(onSuccess);
|
|
1774
1776
|
}
|
|
1775
|
-
return
|
|
1777
|
+
return icons.pipe(emitEffect, icons.matchCauseEffect({
|
|
1776
1778
|
onFailure,
|
|
1777
1779
|
onSuccess
|
|
1778
1780
|
}));
|
|
1779
1781
|
}
|
|
1780
1782
|
if (emitEffect === undefined) {
|
|
1781
|
-
return
|
|
1783
|
+
return icons.suspend$1(() => read());
|
|
1782
1784
|
}
|
|
1783
|
-
return
|
|
1785
|
+
return icons.pipe(emitEffect, icons.matchCauseEffect({
|
|
1784
1786
|
onFailure,
|
|
1785
1787
|
onSuccess: () => read()
|
|
1786
1788
|
}));
|
|
@@ -1790,17 +1792,17 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1790
1792
|
const doneEffect = current.onDone(current.upstream.getDone());
|
|
1791
1793
|
if (readStack.length === 0) {
|
|
1792
1794
|
if (doneEffect === undefined) {
|
|
1793
|
-
return
|
|
1795
|
+
return icons.suspend$1(onSuccess);
|
|
1794
1796
|
}
|
|
1795
|
-
return
|
|
1797
|
+
return icons.pipe(doneEffect, icons.matchCauseEffect({
|
|
1796
1798
|
onFailure,
|
|
1797
1799
|
onSuccess
|
|
1798
1800
|
}));
|
|
1799
1801
|
}
|
|
1800
1802
|
if (doneEffect === undefined) {
|
|
1801
|
-
return
|
|
1803
|
+
return icons.suspend$1(() => read());
|
|
1802
1804
|
}
|
|
1803
|
-
return
|
|
1805
|
+
return icons.pipe(doneEffect, icons.matchCauseEffect({
|
|
1804
1806
|
onFailure,
|
|
1805
1807
|
onSuccess: () => read()
|
|
1806
1808
|
}));
|
|
@@ -1808,10 +1810,10 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1808
1810
|
case OP_FROM_EFFECT:
|
|
1809
1811
|
{
|
|
1810
1812
|
readStack.push(current);
|
|
1811
|
-
return
|
|
1812
|
-
const doneEffect = current.onDone(
|
|
1813
|
-
return doneEffect === undefined ?
|
|
1814
|
-
})),
|
|
1813
|
+
return icons.pipe(current.onEffect(state.effect), icons.catchAllCause(cause => icons.suspend$1(() => {
|
|
1814
|
+
const doneEffect = current.onDone(icons.failCause(cause));
|
|
1815
|
+
return doneEffect === undefined ? icons._void : doneEffect;
|
|
1816
|
+
})), icons.matchCauseEffect({
|
|
1815
1817
|
onFailure,
|
|
1816
1818
|
onSuccess: () => read()
|
|
1817
1819
|
}));
|
|
@@ -1820,25 +1822,25 @@ const readUpstream = (r, onSuccess, onFailure) => {
|
|
|
1820
1822
|
{
|
|
1821
1823
|
readStack.push(current);
|
|
1822
1824
|
readStack.push(state);
|
|
1823
|
-
return
|
|
1825
|
+
return icons.suspend$1(() => read());
|
|
1824
1826
|
}
|
|
1825
1827
|
}
|
|
1826
1828
|
};
|
|
1827
1829
|
return read();
|
|
1828
1830
|
};
|
|
1829
1831
|
/** @internal */
|
|
1830
|
-
const runIn = /*#__PURE__*/
|
|
1831
|
-
const run = (channelDeferred, scopeDeferred, scope) =>
|
|
1832
|
+
const runIn = /*#__PURE__*/icons.dual(2, (self, scope) => {
|
|
1833
|
+
const run = (channelDeferred, scopeDeferred, scope) => icons.acquireUseRelease(icons.sync$1(() => new ChannelExecutor(self, void 0, icons.identity)), exec => icons.suspend$1(() => runScopedInterpret(exec.run(), exec).pipe(icons.intoDeferred(channelDeferred), icons.zipRight$2(icons._await$1(channelDeferred)), icons.zipLeft(icons._await$1(scopeDeferred)))), (exec, exit) => {
|
|
1832
1834
|
const finalize = exec.close(exit);
|
|
1833
1835
|
if (finalize === undefined) {
|
|
1834
|
-
return
|
|
1836
|
+
return icons._void;
|
|
1835
1837
|
}
|
|
1836
|
-
return
|
|
1838
|
+
return icons.tapErrorCause(finalize, cause => icons.addFinalizer(scope, icons.failCause$1(cause)));
|
|
1837
1839
|
});
|
|
1838
|
-
return
|
|
1839
|
-
const interruptors$1 =
|
|
1840
|
-
return
|
|
1841
|
-
}).pipe(
|
|
1840
|
+
return icons.uninterruptibleMask(restore => icons.all$1([icons.fork(scope, icons.sequential), icons.make$2(), icons.make$2()]).pipe(icons.flatMap$1(([child, channelDeferred, scopeDeferred]) => restore(run(channelDeferred, scopeDeferred, child)).pipe(icons.forkIn(scope), icons.flatMap$1(fiber => scope.addFinalizer(exit => {
|
|
1841
|
+
const interruptors$1 = icons.isFailure(exit) ? interruptors(exit.cause) : undefined;
|
|
1842
|
+
return icons.isDone(channelDeferred).pipe(icons.flatMap$1(isDone => isDone ? icons.succeed$3(scopeDeferred, void 0).pipe(icons.zipRight$2(_await(fiber)), icons.zipRight$2(inheritAll(fiber))) : icons.succeed$3(scopeDeferred, void 0).pipe(icons.zipRight$2(interruptors$1 && icons.size(interruptors$1) > 0 ? interruptAs(fiber, icons.combineAll(interruptors$1)) : interrupt(fiber)), icons.zipRight$2(inheritAll(fiber)))));
|
|
1843
|
+
}).pipe(icons.zipRight$2(restore(icons._await$1(channelDeferred)))))))));
|
|
1842
1844
|
});
|
|
1843
1845
|
/** @internal */
|
|
1844
1846
|
const runScopedInterpret = (channelState, exec) => {
|
|
@@ -1846,7 +1848,7 @@ const runScopedInterpret = (channelState, exec) => {
|
|
|
1846
1848
|
switch (op._tag) {
|
|
1847
1849
|
case OP_FROM_EFFECT:
|
|
1848
1850
|
{
|
|
1849
|
-
return
|
|
1851
|
+
return icons.pipe(op.effect, icons.flatMap$1(() => runScopedInterpret(exec.run(), exec)));
|
|
1850
1852
|
}
|
|
1851
1853
|
case OP_EMIT$1:
|
|
1852
1854
|
{
|
|
@@ -1855,11 +1857,11 @@ const runScopedInterpret = (channelState, exec) => {
|
|
|
1855
1857
|
}
|
|
1856
1858
|
case OP_DONE$1:
|
|
1857
1859
|
{
|
|
1858
|
-
return
|
|
1860
|
+
return icons.suspend$1(() => exec.getDone());
|
|
1859
1861
|
}
|
|
1860
1862
|
case OP_READ:
|
|
1861
1863
|
{
|
|
1862
|
-
return readUpstream(op, () => runScopedInterpret(exec.run(), exec),
|
|
1864
|
+
return readUpstream(op, () => runScopedInterpret(exec.run(), exec), icons.failCause$1);
|
|
1863
1865
|
}
|
|
1864
1866
|
}
|
|
1865
1867
|
};
|
|
@@ -1955,7 +1957,7 @@ const BufferSliding = _ => {
|
|
|
1955
1957
|
return op;
|
|
1956
1958
|
};
|
|
1957
1959
|
/** @internal */
|
|
1958
|
-
const match = /*#__PURE__*/
|
|
1960
|
+
const match = /*#__PURE__*/icons.dual(2, (self, {
|
|
1959
1961
|
onBackPressure,
|
|
1960
1962
|
onBufferSliding
|
|
1961
1963
|
}) => {
|
|
@@ -2006,97 +2008,97 @@ class SingleProducerAsyncInputImpl {
|
|
|
2006
2008
|
this.ref = ref;
|
|
2007
2009
|
}
|
|
2008
2010
|
awaitRead() {
|
|
2009
|
-
return
|
|
2011
|
+
return icons.flatten(modify(this.ref, state => state._tag === OP_STATE_EMPTY ? [icons._await$1(state.notifyProducer), state] : [icons._void, state]));
|
|
2010
2012
|
}
|
|
2011
2013
|
get close() {
|
|
2012
|
-
return
|
|
2014
|
+
return icons.fiberIdWith(fiberId => this.error(interrupt$1(fiberId)));
|
|
2013
2015
|
}
|
|
2014
2016
|
done(value) {
|
|
2015
|
-
return
|
|
2017
|
+
return icons.flatten(modify(this.ref, state => {
|
|
2016
2018
|
switch (state._tag) {
|
|
2017
2019
|
case OP_STATE_EMPTY:
|
|
2018
2020
|
{
|
|
2019
|
-
return [
|
|
2021
|
+
return [icons._await$1(state.notifyProducer), state];
|
|
2020
2022
|
}
|
|
2021
2023
|
case OP_STATE_EMIT:
|
|
2022
2024
|
{
|
|
2023
|
-
return [
|
|
2025
|
+
return [icons.forEach(state.notifyConsumers, deferred => icons.succeed$3(deferred, icons.left(value)), {
|
|
2024
2026
|
discard: true
|
|
2025
2027
|
}), stateDone(value)];
|
|
2026
2028
|
}
|
|
2027
2029
|
case OP_STATE_ERROR:
|
|
2028
2030
|
{
|
|
2029
|
-
return [
|
|
2031
|
+
return [icons.interrupt$2, state];
|
|
2030
2032
|
}
|
|
2031
2033
|
case OP_STATE_DONE:
|
|
2032
2034
|
{
|
|
2033
|
-
return [
|
|
2035
|
+
return [icons.interrupt$2, state];
|
|
2034
2036
|
}
|
|
2035
2037
|
}
|
|
2036
2038
|
}));
|
|
2037
2039
|
}
|
|
2038
2040
|
emit(element) {
|
|
2039
|
-
return
|
|
2041
|
+
return icons.flatMap$1(icons.make$2(), deferred => icons.flatten(modify(this.ref, state => {
|
|
2040
2042
|
switch (state._tag) {
|
|
2041
2043
|
case OP_STATE_EMPTY:
|
|
2042
2044
|
{
|
|
2043
|
-
return [
|
|
2045
|
+
return [icons._await$1(state.notifyProducer), state];
|
|
2044
2046
|
}
|
|
2045
2047
|
case OP_STATE_EMIT:
|
|
2046
2048
|
{
|
|
2047
2049
|
const notifyConsumer = state.notifyConsumers[0];
|
|
2048
2050
|
const notifyConsumers = state.notifyConsumers.slice(1);
|
|
2049
2051
|
if (notifyConsumer !== undefined) {
|
|
2050
|
-
return [
|
|
2052
|
+
return [icons.succeed$3(notifyConsumer, icons.right(element)), notifyConsumers.length === 0 ? stateEmpty(deferred) : stateEmit(notifyConsumers)];
|
|
2051
2053
|
}
|
|
2052
2054
|
throw new Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
2053
2055
|
}
|
|
2054
2056
|
case OP_STATE_ERROR:
|
|
2055
2057
|
{
|
|
2056
|
-
return [
|
|
2058
|
+
return [icons.interrupt$2, state];
|
|
2057
2059
|
}
|
|
2058
2060
|
case OP_STATE_DONE:
|
|
2059
2061
|
{
|
|
2060
|
-
return [
|
|
2062
|
+
return [icons.interrupt$2, state];
|
|
2061
2063
|
}
|
|
2062
2064
|
}
|
|
2063
2065
|
})));
|
|
2064
2066
|
}
|
|
2065
2067
|
error(cause) {
|
|
2066
|
-
return
|
|
2068
|
+
return icons.flatten(modify(this.ref, state => {
|
|
2067
2069
|
switch (state._tag) {
|
|
2068
2070
|
case OP_STATE_EMPTY:
|
|
2069
2071
|
{
|
|
2070
|
-
return [
|
|
2072
|
+
return [icons._await$1(state.notifyProducer), state];
|
|
2071
2073
|
}
|
|
2072
2074
|
case OP_STATE_EMIT:
|
|
2073
2075
|
{
|
|
2074
|
-
return [
|
|
2076
|
+
return [icons.forEach(state.notifyConsumers, deferred => icons.failCause$2(deferred, cause), {
|
|
2075
2077
|
discard: true
|
|
2076
2078
|
}), stateError(cause)];
|
|
2077
2079
|
}
|
|
2078
2080
|
case OP_STATE_ERROR:
|
|
2079
2081
|
{
|
|
2080
|
-
return [
|
|
2082
|
+
return [icons.interrupt$2, state];
|
|
2081
2083
|
}
|
|
2082
2084
|
case OP_STATE_DONE:
|
|
2083
2085
|
{
|
|
2084
|
-
return [
|
|
2086
|
+
return [icons.interrupt$2, state];
|
|
2085
2087
|
}
|
|
2086
2088
|
}
|
|
2087
2089
|
}));
|
|
2088
2090
|
}
|
|
2089
2091
|
get take() {
|
|
2090
|
-
return this.takeWith(cause =>
|
|
2092
|
+
return this.takeWith(cause => icons.failCause(map$2(cause, icons.left)), elem => icons.succeed$2(elem), done => icons.fail$1(icons.right(done)));
|
|
2091
2093
|
}
|
|
2092
2094
|
takeWith(onError, onElement, onDone) {
|
|
2093
|
-
return
|
|
2095
|
+
return icons.flatMap$1(icons.make$2(), deferred => icons.flatten(modify(this.ref, state => {
|
|
2094
2096
|
switch (state._tag) {
|
|
2095
2097
|
case OP_STATE_EMPTY:
|
|
2096
2098
|
{
|
|
2097
|
-
return [
|
|
2099
|
+
return [icons.zipRight$2(icons.succeed$3(state.notifyProducer, void 0), icons.matchCause(icons._await$1(deferred), {
|
|
2098
2100
|
onFailure: onError,
|
|
2099
|
-
onSuccess:
|
|
2101
|
+
onSuccess: icons.match({
|
|
2100
2102
|
onLeft: onDone,
|
|
2101
2103
|
onRight: onElement
|
|
2102
2104
|
})
|
|
@@ -2104,9 +2106,9 @@ class SingleProducerAsyncInputImpl {
|
|
|
2104
2106
|
}
|
|
2105
2107
|
case OP_STATE_EMIT:
|
|
2106
2108
|
{
|
|
2107
|
-
return [
|
|
2109
|
+
return [icons.matchCause(icons._await$1(deferred), {
|
|
2108
2110
|
onFailure: onError,
|
|
2109
|
-
onSuccess:
|
|
2111
|
+
onSuccess: icons.match({
|
|
2110
2112
|
onLeft: onDone,
|
|
2111
2113
|
onRight: onElement
|
|
2112
2114
|
})
|
|
@@ -2114,21 +2116,21 @@ class SingleProducerAsyncInputImpl {
|
|
|
2114
2116
|
}
|
|
2115
2117
|
case OP_STATE_ERROR:
|
|
2116
2118
|
{
|
|
2117
|
-
return [
|
|
2119
|
+
return [icons.succeed(onError(state.cause)), state];
|
|
2118
2120
|
}
|
|
2119
2121
|
case OP_STATE_DONE:
|
|
2120
2122
|
{
|
|
2121
|
-
return [
|
|
2123
|
+
return [icons.succeed(onDone(state.done)), state];
|
|
2122
2124
|
}
|
|
2123
2125
|
}
|
|
2124
2126
|
})));
|
|
2125
2127
|
}
|
|
2126
2128
|
}
|
|
2127
2129
|
/** @internal */
|
|
2128
|
-
const make$1 = () =>
|
|
2130
|
+
const make$1 = () => icons.pipe(icons.make$2(), icons.flatMap$1(deferred => make$3(stateEmpty(deferred))), icons.map$2(ref => new SingleProducerAsyncInputImpl(ref)));
|
|
2129
2131
|
|
|
2130
2132
|
/** @internal */
|
|
2131
|
-
const concatMap = /*#__PURE__*/
|
|
2133
|
+
const concatMap = /*#__PURE__*/icons.dual(2, (self, f) => concatMapWith(self, f, () => void 0, () => void 0));
|
|
2132
2134
|
/** @internal */
|
|
2133
2135
|
const drain$1 = self => {
|
|
2134
2136
|
const drainer = readWithCause({
|
|
@@ -2139,9 +2141,9 @@ const drain$1 = self => {
|
|
|
2139
2141
|
return pipeTo(self, drainer);
|
|
2140
2142
|
};
|
|
2141
2143
|
/** @internal */
|
|
2142
|
-
const ensuring$1 = /*#__PURE__*/
|
|
2144
|
+
const ensuring$1 = /*#__PURE__*/icons.dual(2, (self, finalizer) => ensuringWith(self, () => finalizer));
|
|
2143
2145
|
/** @internal */
|
|
2144
|
-
const flatten$1 = self => flatMap$1(self,
|
|
2146
|
+
const flatten$1 = self => flatMap$1(self, icons.identity);
|
|
2145
2147
|
/** @internal */
|
|
2146
2148
|
const fromInput = input => unwrap(input.takeWith(failCause$2, elem => flatMap$1(write(elem), () => fromInput(input)), succeed));
|
|
2147
2149
|
/** @internal */
|
|
@@ -2151,9 +2153,9 @@ const identityChannel = () => readWith({
|
|
|
2151
2153
|
onDone: succeedNow
|
|
2152
2154
|
});
|
|
2153
2155
|
/** @internal */
|
|
2154
|
-
const map$1 = /*#__PURE__*/
|
|
2156
|
+
const map$1 = /*#__PURE__*/icons.dual(2, (self, f) => flatMap$1(self, a => sync(() => f(a))));
|
|
2155
2157
|
/** @internal */
|
|
2156
|
-
const mapOut = /*#__PURE__*/
|
|
2158
|
+
const mapOut = /*#__PURE__*/icons.dual(2, (self, f) => {
|
|
2157
2159
|
const reader = readWith({
|
|
2158
2160
|
onInput: outElem => flatMap$1(write(f(outElem)), () => reader),
|
|
2159
2161
|
onFailure: fail,
|
|
@@ -2162,30 +2164,30 @@ const mapOut = /*#__PURE__*/Effect.dual(2, (self, f) => {
|
|
|
2162
2164
|
return pipeTo(self, reader);
|
|
2163
2165
|
});
|
|
2164
2166
|
/** @internal */
|
|
2165
|
-
const mapOutEffectPar = /*#__PURE__*/
|
|
2167
|
+
const mapOutEffectPar = /*#__PURE__*/icons.dual(3, (self, f, n) => unwrapScopedWith$1(scope => icons.gen(function* () {
|
|
2166
2168
|
const input = yield* make$1();
|
|
2167
2169
|
const queueReader = fromInput(input);
|
|
2168
2170
|
const queue = yield* bounded(n);
|
|
2169
|
-
yield*
|
|
2170
|
-
const errorSignal = yield*
|
|
2171
|
-
const withPermits = n === Number.POSITIVE_INFINITY ? _ =>
|
|
2171
|
+
yield* icons.addFinalizer(scope, shutdown(queue));
|
|
2172
|
+
const errorSignal = yield* icons.make$2();
|
|
2173
|
+
const withPermits = n === Number.POSITIVE_INFINITY ? _ => icons.identity : (yield* icons.makeSemaphore(n)).withPermits;
|
|
2172
2174
|
const pull = yield* queueReader.pipe(pipeTo(self), toPullIn(scope));
|
|
2173
|
-
yield* pull.pipe(
|
|
2174
|
-
onFailure: cause => offer(queue,
|
|
2175
|
-
onSuccess:
|
|
2176
|
-
onLeft: outDone =>
|
|
2177
|
-
onRight: outElem =>
|
|
2178
|
-
const deferred = yield*
|
|
2179
|
-
const latch = yield*
|
|
2180
|
-
yield* offer(queue,
|
|
2181
|
-
yield*
|
|
2182
|
-
yield*
|
|
2175
|
+
yield* pull.pipe(icons.matchCauseEffect({
|
|
2176
|
+
onFailure: cause => offer(queue, icons.failCause$1(cause)),
|
|
2177
|
+
onSuccess: icons.match({
|
|
2178
|
+
onLeft: outDone => icons.zipRight$2(icons.interruptible(withPermits(n)(icons._void)), icons.asVoid$1(offer(queue, icons.succeed(icons.left(outDone))))),
|
|
2179
|
+
onRight: outElem => icons.gen(function* () {
|
|
2180
|
+
const deferred = yield* icons.make$2();
|
|
2181
|
+
const latch = yield* icons.make$2();
|
|
2182
|
+
yield* offer(queue, icons.map$2(icons._await$1(deferred), icons.right));
|
|
2183
|
+
yield* icons.succeed$3(latch, void 0).pipe(icons.zipRight$2(icons.uninterruptibleMask(restore => icons.exit(restore(icons._await$1(errorSignal))).pipe(icons.raceFirst(icons.exit(restore(f(outElem)))), icons.flatMap$1(icons.identity))).pipe(icons.tapErrorCause(cause => icons.failCause$2(errorSignal, cause)), icons.intoDeferred(deferred))), withPermits(1), icons.forkIn(scope));
|
|
2184
|
+
yield* icons._await$1(latch);
|
|
2183
2185
|
})
|
|
2184
2186
|
})
|
|
2185
|
-
}),
|
|
2186
|
-
const consumer = unwrap(
|
|
2187
|
+
}), icons.forever, icons.interruptible, icons.forkIn(scope));
|
|
2188
|
+
const consumer = unwrap(icons.matchCause(icons.flatten(take(queue)), {
|
|
2187
2189
|
onFailure: failCause$2,
|
|
2188
|
-
onSuccess:
|
|
2190
|
+
onSuccess: icons.match({
|
|
2189
2191
|
onLeft: succeedNow,
|
|
2190
2192
|
onRight: outElem => flatMap$1(write(outElem), () => consumer)
|
|
2191
2193
|
})
|
|
@@ -2194,75 +2196,75 @@ const mapOutEffectPar = /*#__PURE__*/Effect.dual(3, (self, f, n) => unwrapScoped
|
|
|
2194
2196
|
})));
|
|
2195
2197
|
/** @internal */
|
|
2196
2198
|
const mergeAll = options => {
|
|
2197
|
-
return channels => mergeAllWith(options)(channels,
|
|
2199
|
+
return channels => mergeAllWith(options)(channels, icons.constVoid);
|
|
2198
2200
|
};
|
|
2199
2201
|
/** @internal */
|
|
2200
2202
|
const mergeAllWith = ({
|
|
2201
2203
|
bufferSize = 16,
|
|
2202
2204
|
concurrency,
|
|
2203
2205
|
mergeStrategy = BackPressure()
|
|
2204
|
-
}) => (channels, f) => unwrapScopedWith$1(scope =>
|
|
2206
|
+
}) => (channels, f) => unwrapScopedWith$1(scope => icons.gen(function* () {
|
|
2205
2207
|
const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : concurrency;
|
|
2206
2208
|
const input = yield* make$1();
|
|
2207
2209
|
const queueReader = fromInput(input);
|
|
2208
2210
|
const queue = yield* bounded(bufferSize);
|
|
2209
|
-
yield*
|
|
2211
|
+
yield* icons.addFinalizer(scope, shutdown(queue));
|
|
2210
2212
|
const cancelers = yield* unbounded();
|
|
2211
|
-
yield*
|
|
2212
|
-
const lastDone = yield* make$3(
|
|
2213
|
-
const errorSignal = yield*
|
|
2214
|
-
const withPermits = (yield*
|
|
2213
|
+
yield* icons.addFinalizer(scope, shutdown(cancelers));
|
|
2214
|
+
const lastDone = yield* make$3(icons.none());
|
|
2215
|
+
const errorSignal = yield* icons.make$2();
|
|
2216
|
+
const withPermits = (yield* icons.makeSemaphore(concurrencyN)).withPermits;
|
|
2215
2217
|
const pull = yield* toPullIn(pipeTo(queueReader, channels), scope);
|
|
2216
2218
|
function evaluatePull(pull) {
|
|
2217
|
-
return pull.pipe(
|
|
2218
|
-
onLeft: done =>
|
|
2219
|
-
onRight: outElem =>
|
|
2220
|
-
})),
|
|
2221
|
-
until: _ =>
|
|
2222
|
-
}),
|
|
2223
|
-
onNone: () =>
|
|
2224
|
-
onSome: lastDone =>
|
|
2225
|
-
}))),
|
|
2219
|
+
return pull.pipe(icons.flatMap$1(icons.match({
|
|
2220
|
+
onLeft: done => icons.succeed(icons.some(done)),
|
|
2221
|
+
onRight: outElem => icons.as(offer(queue, icons.succeed(icons.right(outElem))), icons.none())
|
|
2222
|
+
})), icons.repeat({
|
|
2223
|
+
until: _ => icons.isSome(_)
|
|
2224
|
+
}), icons.flatMap$1(outDone => update(lastDone, icons.match$2({
|
|
2225
|
+
onNone: () => icons.some(outDone.value),
|
|
2226
|
+
onSome: lastDone => icons.some(f(lastDone, outDone.value))
|
|
2227
|
+
}))), icons.catchAllCause(cause => isInterrupted(cause) ? icons.failCause$1(cause) : offer(queue, icons.failCause$1(cause)).pipe(icons.zipRight$2(icons.succeed$3(errorSignal, void 0)), icons.asVoid$1)));
|
|
2226
2228
|
}
|
|
2227
|
-
yield* pull.pipe(
|
|
2228
|
-
onFailure: cause => offer(queue,
|
|
2229
|
-
onSuccess:
|
|
2230
|
-
onLeft: outDone =>
|
|
2231
|
-
onSelfDone: (_, permitAcquisition) =>
|
|
2232
|
-
onOtherDone: (_, failureAwait) =>
|
|
2233
|
-
onNone: () => offer(queue,
|
|
2234
|
-
onSome: lastDone => offer(queue,
|
|
2235
|
-
})),
|
|
2229
|
+
yield* pull.pipe(icons.matchCauseEffect({
|
|
2230
|
+
onFailure: cause => offer(queue, icons.failCause$1(cause)).pipe(icons.zipRight$2(icons.succeed(false))),
|
|
2231
|
+
onSuccess: icons.match({
|
|
2232
|
+
onLeft: outDone => icons.raceWith(icons.interruptible(icons._await$1(errorSignal)), icons.interruptible(withPermits(concurrencyN)(icons._void)), {
|
|
2233
|
+
onSelfDone: (_, permitAcquisition) => icons.as(interrupt(permitAcquisition), false),
|
|
2234
|
+
onOtherDone: (_, failureAwait) => icons.zipRight$2(interrupt(failureAwait), get(lastDone).pipe(icons.flatMap$1(icons.match$2({
|
|
2235
|
+
onNone: () => offer(queue, icons.succeed(icons.left(outDone))),
|
|
2236
|
+
onSome: lastDone => offer(queue, icons.succeed(icons.left(f(lastDone, outDone))))
|
|
2237
|
+
})), icons.as(false)))
|
|
2236
2238
|
}),
|
|
2237
2239
|
onRight: channel => match(mergeStrategy, {
|
|
2238
|
-
onBackPressure: () =>
|
|
2239
|
-
const latch = yield*
|
|
2240
|
-
const raceEffects =
|
|
2241
|
-
yield*
|
|
2242
|
-
yield*
|
|
2243
|
-
const errored = yield*
|
|
2240
|
+
onBackPressure: () => icons.gen(function* () {
|
|
2241
|
+
const latch = yield* icons.make$2();
|
|
2242
|
+
const raceEffects = icons.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(icons.flatMap$1(pull => icons.race(icons.exit(evaluatePull(pull)), icons.exit(icons.interruptible(icons._await$1(errorSignal))))), icons.flatMap$1(icons.identity)));
|
|
2243
|
+
yield* icons.succeed$3(latch, void 0).pipe(icons.zipRight$2(raceEffects), withPermits(1), icons.forkIn(scope));
|
|
2244
|
+
yield* icons._await$1(latch);
|
|
2245
|
+
const errored = yield* icons.isDone(errorSignal);
|
|
2244
2246
|
return !errored;
|
|
2245
2247
|
}),
|
|
2246
|
-
onBufferSliding: () =>
|
|
2247
|
-
const canceler = yield*
|
|
2248
|
-
const latch = yield*
|
|
2248
|
+
onBufferSliding: () => icons.gen(function* () {
|
|
2249
|
+
const canceler = yield* icons.make$2();
|
|
2250
|
+
const latch = yield* icons.make$2();
|
|
2249
2251
|
const size$1 = yield* size(cancelers);
|
|
2250
|
-
yield* take(cancelers).pipe(
|
|
2252
|
+
yield* take(cancelers).pipe(icons.flatMap$1(canceler => icons.succeed$3(canceler, void 0)), icons.when(() => size$1 >= concurrencyN));
|
|
2251
2253
|
yield* offer(cancelers, canceler);
|
|
2252
|
-
const raceEffects =
|
|
2253
|
-
yield*
|
|
2254
|
-
yield*
|
|
2255
|
-
const errored = yield*
|
|
2254
|
+
const raceEffects = icons.scopedWith(scope => toPullIn(pipeTo(queueReader, channel), scope).pipe(icons.flatMap$1(pull => icons.exit(evaluatePull(pull)).pipe(icons.race(icons.exit(icons.interruptible(icons._await$1(errorSignal)))), icons.race(icons.exit(icons.interruptible(icons._await$1(canceler)))))), icons.flatMap$1(icons.identity)));
|
|
2255
|
+
yield* icons.succeed$3(latch, void 0).pipe(icons.zipRight$2(raceEffects), withPermits(1), icons.forkIn(scope));
|
|
2256
|
+
yield* icons._await$1(latch);
|
|
2257
|
+
const errored = yield* icons.isDone(errorSignal);
|
|
2256
2258
|
return !errored;
|
|
2257
2259
|
})
|
|
2258
2260
|
})
|
|
2259
2261
|
})
|
|
2260
|
-
}),
|
|
2262
|
+
}), icons.repeat({
|
|
2261
2263
|
while: _ => _
|
|
2262
|
-
}),
|
|
2263
|
-
const consumer =
|
|
2264
|
+
}), icons.forkIn(scope));
|
|
2265
|
+
const consumer = icons.pipe(take(queue), icons.flatten, icons.matchCause({
|
|
2264
2266
|
onFailure: failCause$2,
|
|
2265
|
-
onSuccess:
|
|
2267
|
+
onSuccess: icons.match({
|
|
2266
2268
|
onLeft: succeedNow,
|
|
2267
2269
|
onRight: outElem => flatMap$1(write(outElem), () => consumer)
|
|
2268
2270
|
})
|
|
@@ -2270,11 +2272,11 @@ const mergeAllWith = ({
|
|
|
2270
2272
|
return embedInput(consumer, input);
|
|
2271
2273
|
}));
|
|
2272
2274
|
/** @internal */
|
|
2273
|
-
const mergeMap = /*#__PURE__*/
|
|
2275
|
+
const mergeMap = /*#__PURE__*/icons.dual(3, (self, f, options) => mergeAll(options)(mapOut(self, f)));
|
|
2274
2276
|
/** @internal */
|
|
2275
|
-
const mergeWith = /*#__PURE__*/
|
|
2277
|
+
const mergeWith = /*#__PURE__*/icons.dual(2, (self, options) => {
|
|
2276
2278
|
function merge(scope) {
|
|
2277
|
-
return
|
|
2279
|
+
return icons.gen(function* () {
|
|
2278
2280
|
const input = yield* make$1();
|
|
2279
2281
|
const queueReader = fromInput(input);
|
|
2280
2282
|
const pullL = yield* toPullIn(pipeTo(queueReader, self), scope);
|
|
@@ -2284,21 +2286,21 @@ const mergeWith = /*#__PURE__*/Effect.dual(2, (self, options) => {
|
|
|
2284
2286
|
function onDecision(decision) {
|
|
2285
2287
|
const op = decision;
|
|
2286
2288
|
if (op._tag === OP_DONE) {
|
|
2287
|
-
return
|
|
2289
|
+
return icons.succeed(fromEffect$3(icons.zipRight$2(interrupt(fiber), op.effect)));
|
|
2288
2290
|
}
|
|
2289
|
-
return
|
|
2290
|
-
onFailure: cause => fromEffect$3(op.f(
|
|
2291
|
-
onSuccess:
|
|
2292
|
-
onLeft: done => fromEffect$3(op.f(
|
|
2291
|
+
return icons.map$2(_await(fiber), icons.match$1({
|
|
2292
|
+
onFailure: cause => fromEffect$3(op.f(icons.failCause(cause))),
|
|
2293
|
+
onSuccess: icons.match({
|
|
2294
|
+
onLeft: done => fromEffect$3(op.f(icons.succeed$2(done))),
|
|
2293
2295
|
onRight: elem => zipRight(write(elem), go(single(op.f)))
|
|
2294
2296
|
})
|
|
2295
2297
|
}));
|
|
2296
2298
|
}
|
|
2297
|
-
return
|
|
2298
|
-
onFailure: cause => onDecision(done(
|
|
2299
|
-
onSuccess:
|
|
2300
|
-
onLeft: z => onDecision(done(
|
|
2301
|
-
onRight: elem =>
|
|
2299
|
+
return icons.match$1(exit, {
|
|
2300
|
+
onFailure: cause => onDecision(done(icons.failCause(cause))),
|
|
2301
|
+
onSuccess: icons.match({
|
|
2302
|
+
onLeft: z => onDecision(done(icons.succeed$2(z))),
|
|
2303
|
+
onRight: elem => icons.succeed(flatMap$1(write(elem), () => flatMap$1(fromEffect$3(icons.forkIn(icons.interruptible(pull), scope)), leftFiber => go(both(leftFiber, fiber)))))
|
|
2302
2304
|
})
|
|
2303
2305
|
});
|
|
2304
2306
|
};
|
|
@@ -2307,50 +2309,50 @@ const mergeWith = /*#__PURE__*/Effect.dual(2, (self, options) => {
|
|
|
2307
2309
|
switch (state._tag) {
|
|
2308
2310
|
case OP_BOTH_RUNNING:
|
|
2309
2311
|
{
|
|
2310
|
-
const leftJoin =
|
|
2311
|
-
const rightJoin =
|
|
2312
|
-
return unwrap(
|
|
2313
|
-
onSelfDone: (leftExit, rf) =>
|
|
2314
|
-
onOtherDone: (rightExit, lf) =>
|
|
2312
|
+
const leftJoin = icons.interruptible(join(state.left));
|
|
2313
|
+
const rightJoin = icons.interruptible(join(state.right));
|
|
2314
|
+
return unwrap(icons.raceWith(leftJoin, rightJoin, {
|
|
2315
|
+
onSelfDone: (leftExit, rf) => icons.zipRight$2(interrupt(rf), handleSide(leftExit, state.right, pullL)(options.onSelfDone, BothRunning, f => LeftDone(f))),
|
|
2316
|
+
onOtherDone: (rightExit, lf) => icons.zipRight$2(interrupt(lf), handleSide(rightExit, state.left, pullR)(options.onOtherDone, (left, right) => BothRunning(right, left), f => RightDone(f)))
|
|
2315
2317
|
}));
|
|
2316
2318
|
}
|
|
2317
2319
|
case OP_LEFT_DONE:
|
|
2318
2320
|
{
|
|
2319
|
-
return unwrap(
|
|
2320
|
-
onFailure: cause => fromEffect$3(state.f(
|
|
2321
|
-
onSuccess:
|
|
2322
|
-
onLeft: done => fromEffect$3(state.f(
|
|
2321
|
+
return unwrap(icons.map$2(icons.exit(pullR), icons.match$1({
|
|
2322
|
+
onFailure: cause => fromEffect$3(state.f(icons.failCause(cause))),
|
|
2323
|
+
onSuccess: icons.match({
|
|
2324
|
+
onLeft: done => fromEffect$3(state.f(icons.succeed$2(done))),
|
|
2323
2325
|
onRight: elem => flatMap$1(write(elem), () => go(LeftDone(state.f)))
|
|
2324
2326
|
})
|
|
2325
2327
|
})));
|
|
2326
2328
|
}
|
|
2327
2329
|
case OP_RIGHT_DONE:
|
|
2328
2330
|
{
|
|
2329
|
-
return unwrap(
|
|
2330
|
-
onFailure: cause => fromEffect$3(state.f(
|
|
2331
|
-
onSuccess:
|
|
2332
|
-
onLeft: done => fromEffect$3(state.f(
|
|
2331
|
+
return unwrap(icons.map$2(icons.exit(pullL), icons.match$1({
|
|
2332
|
+
onFailure: cause => fromEffect$3(state.f(icons.failCause(cause))),
|
|
2333
|
+
onSuccess: icons.match({
|
|
2334
|
+
onLeft: done => fromEffect$3(state.f(icons.succeed$2(done))),
|
|
2333
2335
|
onRight: elem => flatMap$1(write(elem), () => go(RightDone(state.f)))
|
|
2334
2336
|
})
|
|
2335
2337
|
})));
|
|
2336
2338
|
}
|
|
2337
2339
|
}
|
|
2338
2340
|
}
|
|
2339
|
-
return fromEffect$3(
|
|
2340
|
-
const inherit =
|
|
2341
|
+
return fromEffect$3(icons.withFiberRuntime$1(parent => {
|
|
2342
|
+
const inherit = icons.withFiberRuntime$1(state => {
|
|
2341
2343
|
state.transferChildren(parent.scope());
|
|
2342
|
-
return
|
|
2344
|
+
return icons._void;
|
|
2343
2345
|
});
|
|
2344
|
-
const leftFiber =
|
|
2345
|
-
const rightFiber =
|
|
2346
|
-
return
|
|
2346
|
+
const leftFiber = icons.interruptible(pullL).pipe(icons.ensuring(inherit), icons.forkIn(scope));
|
|
2347
|
+
const rightFiber = icons.interruptible(pullR).pipe(icons.ensuring(inherit), icons.forkIn(scope));
|
|
2348
|
+
return icons.zipWith(leftFiber, rightFiber, (left, right) => BothRunning(left, right));
|
|
2347
2349
|
})).pipe(flatMap$1(go), embedInput(input));
|
|
2348
2350
|
});
|
|
2349
2351
|
}
|
|
2350
2352
|
return unwrapScopedWith$1(merge);
|
|
2351
2353
|
});
|
|
2352
2354
|
/** @internal */
|
|
2353
|
-
const pipeToOrFail = /*#__PURE__*/
|
|
2355
|
+
const pipeToOrFail = /*#__PURE__*/icons.dual(2, (self, that) => suspend$1(() => {
|
|
2354
2356
|
let channelException = undefined;
|
|
2355
2357
|
const reader = readWith({
|
|
2356
2358
|
onInput: outElem => flatMap$1(write(outElem), () => reader),
|
|
@@ -2361,47 +2363,47 @@ const pipeToOrFail = /*#__PURE__*/Effect.dual(2, (self, that) => suspend$1(() =>
|
|
|
2361
2363
|
onDone: succeedNow
|
|
2362
2364
|
});
|
|
2363
2365
|
const writer = readWithCause({
|
|
2364
|
-
onInput: outElem =>
|
|
2365
|
-
onFailure: cause => isDieType(cause) && isChannelException(cause.defect) &&
|
|
2366
|
+
onInput: outElem => icons.pipe(write(outElem), flatMap$1(() => writer)),
|
|
2367
|
+
onFailure: cause => isDieType(cause) && isChannelException(cause.defect) && icons.equals(cause.defect, channelException) ? fail(cause.defect.error) : failCause$2(cause),
|
|
2366
2368
|
onDone: succeedNow
|
|
2367
2369
|
});
|
|
2368
2370
|
return pipeTo(pipeTo(pipeTo(self, reader), that), writer);
|
|
2369
2371
|
}));
|
|
2370
2372
|
/** @internal */
|
|
2371
|
-
const run$1 = self =>
|
|
2373
|
+
const run$1 = self => icons.scopedWith(scope => runIn(self, scope));
|
|
2372
2374
|
/** @internal */
|
|
2373
2375
|
const runDrain$2 = self => run$1(drain$1(self));
|
|
2374
2376
|
/** @internal */
|
|
2375
|
-
const scoped = effect => unwrap(
|
|
2377
|
+
const scoped = effect => unwrap(icons.uninterruptibleMask(restore => icons.map$2(icons.make$3(), scope => acquireReleaseOut(icons.tapErrorCause(restore(icons.extend(effect, scope)), cause => icons.close(scope, icons.failCause(cause))), (_, exit) => icons.close(scope, exit)))));
|
|
2376
2378
|
/** @internal */
|
|
2377
|
-
const scopedWith$1 = f => unwrapScoped(
|
|
2379
|
+
const scopedWith$1 = f => unwrapScoped(icons.map$2(icons.scope, scope => flatMap$1(fromEffect$3(f(scope)), write)));
|
|
2378
2380
|
/** @internal */
|
|
2379
|
-
const toPullIn = /*#__PURE__*/
|
|
2381
|
+
const toPullIn = /*#__PURE__*/icons.dual(2, (self, scope) => icons.zip(icons.sync$1(() => new ChannelExecutor(self, void 0, icons.identity)), icons.runtime()).pipe(icons.tap(([executor, runtime]) => icons.addFinalizerExit(scope, exit => {
|
|
2380
2382
|
const finalizer = executor.close(exit);
|
|
2381
|
-
return finalizer !== undefined ?
|
|
2382
|
-
})),
|
|
2383
|
+
return finalizer !== undefined ? icons.provide(finalizer, runtime) : icons._void;
|
|
2384
|
+
})), icons.uninterruptible$1, icons.map$2(([executor]) => icons.suspend$1(() => interpretToPull(executor.run(), executor)))));
|
|
2383
2385
|
/** @internal */
|
|
2384
2386
|
const interpretToPull = (channelState, exec) => {
|
|
2385
2387
|
const state = channelState;
|
|
2386
2388
|
switch (state._tag) {
|
|
2387
2389
|
case OP_DONE$1:
|
|
2388
2390
|
{
|
|
2389
|
-
return
|
|
2390
|
-
onFailure:
|
|
2391
|
-
onSuccess: done =>
|
|
2391
|
+
return icons.match$1(exec.getDone(), {
|
|
2392
|
+
onFailure: icons.failCause$1,
|
|
2393
|
+
onSuccess: done => icons.succeed(icons.left(done))
|
|
2392
2394
|
});
|
|
2393
2395
|
}
|
|
2394
2396
|
case OP_EMIT$1:
|
|
2395
2397
|
{
|
|
2396
|
-
return
|
|
2398
|
+
return icons.succeed(icons.right(exec.getEmit()));
|
|
2397
2399
|
}
|
|
2398
2400
|
case OP_FROM_EFFECT:
|
|
2399
2401
|
{
|
|
2400
|
-
return
|
|
2402
|
+
return icons.pipe(state.effect, icons.flatMap$1(() => interpretToPull(exec.run(), exec)));
|
|
2401
2403
|
}
|
|
2402
2404
|
case OP_READ:
|
|
2403
2405
|
{
|
|
2404
|
-
return readUpstream(state, () => interpretToPull(exec.run(), exec), cause =>
|
|
2406
|
+
return readUpstream(state, () => interpretToPull(exec.run(), exec), cause => icons.failCause$1(cause));
|
|
2405
2407
|
}
|
|
2406
2408
|
}
|
|
2407
2409
|
};
|
|
@@ -2415,16 +2417,16 @@ const unwrapScopedWith$1 = f => concatAllWith(scopedWith$1(f), (d, _) => d, (d,
|
|
|
2415
2417
|
const writeChunk = outs => writeChunkWriter(0, outs.length, outs);
|
|
2416
2418
|
/** @internal */
|
|
2417
2419
|
const writeChunkWriter = (idx, len, chunk) => {
|
|
2418
|
-
return idx === len ? void_ :
|
|
2420
|
+
return idx === len ? void_ : icons.pipe(write(icons.pipe(chunk, icons.unsafeGet(idx))), flatMap$1(() => writeChunkWriter(idx + 1, len, chunk)));
|
|
2419
2421
|
};
|
|
2420
2422
|
/** @internal */
|
|
2421
|
-
const zip = /*#__PURE__*/
|
|
2423
|
+
const zip = /*#__PURE__*/icons.dual(args => isChannel(args[1]), (self, that, options) => options?.concurrent ? mergeWith(self, {
|
|
2422
2424
|
other: that,
|
|
2423
|
-
onSelfDone: exit1 => Await(exit2 =>
|
|
2424
|
-
onOtherDone: exit2 => Await(exit1 =>
|
|
2425
|
+
onSelfDone: exit1 => Await(exit2 => icons.suspend$1(() => icons.zip$1(exit1, exit2))),
|
|
2426
|
+
onOtherDone: exit2 => Await(exit1 => icons.suspend$1(() => icons.zip$1(exit1, exit2)))
|
|
2425
2427
|
}) : flatMap$1(self, a => map$1(that, b => [a, b])));
|
|
2426
2428
|
/** @internal */
|
|
2427
|
-
const zipRight = /*#__PURE__*/
|
|
2429
|
+
const zipRight = /*#__PURE__*/icons.dual(args => isChannel(args[1]), (self, that, options) => options?.concurrent ? map$1(zip(self, that, {
|
|
2428
2430
|
concurrent: true
|
|
2429
2431
|
}), tuple => tuple[1]) : flatMap$1(self, () => that));
|
|
2430
2432
|
/** @internal */
|
|
@@ -2436,7 +2438,7 @@ const ChannelException = error => ({
|
|
|
2436
2438
|
error
|
|
2437
2439
|
});
|
|
2438
2440
|
/** @internal */
|
|
2439
|
-
const isChannelException = u =>
|
|
2441
|
+
const isChannelException = u => icons.hasProperty(u, ChannelExceptionTypeId);
|
|
2440
2442
|
|
|
2441
2443
|
/** @internal */
|
|
2442
2444
|
const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
|
|
@@ -2460,7 +2462,7 @@ class SinkImpl {
|
|
|
2460
2462
|
this.channel = channel;
|
|
2461
2463
|
}
|
|
2462
2464
|
pipe() {
|
|
2463
|
-
return
|
|
2465
|
+
return icons.pipeArguments(this, arguments);
|
|
2464
2466
|
}
|
|
2465
2467
|
}
|
|
2466
2468
|
/** @internal */
|
|
@@ -2468,7 +2470,7 @@ const drain = /*#__PURE__*/new SinkImpl(/*#__PURE__*/drain$1(/*#__PURE__*/identi
|
|
|
2468
2470
|
/** @internal */
|
|
2469
2471
|
const fromEffect$1 = effect => new SinkImpl(fromEffect$3(effect));
|
|
2470
2472
|
/** @internal */
|
|
2471
|
-
const toChannel$1 = self =>
|
|
2473
|
+
const toChannel$1 = self => icons.isEffect(self) ? toChannel$1(fromEffect$1(self)) : self.channel;
|
|
2472
2474
|
|
|
2473
2475
|
/** @internal */
|
|
2474
2476
|
const TakeSymbolKey = "effect/Take";
|
|
@@ -2488,22 +2490,22 @@ class TakeImpl {
|
|
|
2488
2490
|
this.exit = exit;
|
|
2489
2491
|
}
|
|
2490
2492
|
pipe() {
|
|
2491
|
-
return
|
|
2493
|
+
return icons.pipeArguments(this, arguments);
|
|
2492
2494
|
}
|
|
2493
2495
|
}
|
|
2494
2496
|
/** @internal */
|
|
2495
|
-
const chunk = chunk => new TakeImpl(
|
|
2497
|
+
const chunk = chunk => new TakeImpl(icons.succeed$2(chunk));
|
|
2496
2498
|
/** @internal */
|
|
2497
|
-
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/
|
|
2499
|
+
const end$1 = /*#__PURE__*/new TakeImpl(/*#__PURE__*/icons.fail$1(/*#__PURE__*/icons.none()));
|
|
2498
2500
|
/** @internal */
|
|
2499
|
-
const failCause$1 = cause => new TakeImpl(
|
|
2501
|
+
const failCause$1 = cause => new TakeImpl(icons.failCause(icons.pipe(cause, map$2(icons.some))));
|
|
2500
2502
|
/** @internal */
|
|
2501
|
-
const of = value => new TakeImpl(
|
|
2503
|
+
const of = value => new TakeImpl(icons.succeed$2(icons.of(value)));
|
|
2502
2504
|
|
|
2503
2505
|
/** @internal */
|
|
2504
|
-
const end = () =>
|
|
2506
|
+
const end = () => icons.fail$2(icons.none());
|
|
2505
2507
|
/** @internal */
|
|
2506
|
-
const failCause = cause =>
|
|
2508
|
+
const failCause = cause => icons.mapError(icons.failCause$1(cause), icons.some);
|
|
2507
2509
|
|
|
2508
2510
|
/** @internal */
|
|
2509
2511
|
const StreamSymbolKey = "effect/Stream";
|
|
@@ -2523,22 +2525,22 @@ class StreamImpl {
|
|
|
2523
2525
|
this.channel = channel;
|
|
2524
2526
|
}
|
|
2525
2527
|
pipe() {
|
|
2526
|
-
return
|
|
2528
|
+
return icons.pipeArguments(this, arguments);
|
|
2527
2529
|
}
|
|
2528
2530
|
}
|
|
2529
2531
|
/** @internal */
|
|
2530
|
-
const isStream = u =>
|
|
2532
|
+
const isStream = u => icons.hasProperty(u, StreamTypeId) || icons.isEffect(u);
|
|
2531
2533
|
/** @internal */
|
|
2532
2534
|
const DefaultChunkSize = 4096;
|
|
2533
2535
|
/** @internal */
|
|
2534
|
-
const ensuring = /*#__PURE__*/
|
|
2536
|
+
const ensuring = /*#__PURE__*/icons.dual(2, (self, finalizer) => new StreamImpl(icons.pipe(toChannel(self), ensuring$1(finalizer))));
|
|
2535
2537
|
/** @internal */
|
|
2536
|
-
const flatMap = /*#__PURE__*/
|
|
2538
|
+
const flatMap = /*#__PURE__*/icons.dual(args => isStream(args[0]), (self, f, options) => {
|
|
2537
2539
|
const bufferSize = options?.bufferSize ?? 16;
|
|
2538
2540
|
if (options?.switch) {
|
|
2539
2541
|
return matchConcurrency(options?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), n => flatMapParSwitchBuffer(self, n, bufferSize, f));
|
|
2540
2542
|
}
|
|
2541
|
-
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as =>
|
|
2543
|
+
return matchConcurrency(options?.concurrency, () => new StreamImpl(concatMap(toChannel(self), as => icons.pipe(as, icons.map$4(a => toChannel(f(a))), icons.reduce(void_, (left, right) => icons.pipe(left, zipRight(right)))))), _ => new StreamImpl(icons.pipe(toChannel(self), concatMap(writeChunk), mergeMap(out => toChannel(f(out)), options))));
|
|
2542
2544
|
});
|
|
2543
2545
|
/** @internal */
|
|
2544
2546
|
const matchConcurrency = (concurrency, sequential, bounded) => {
|
|
@@ -2551,13 +2553,13 @@ const matchConcurrency = (concurrency, sequential, bounded) => {
|
|
|
2551
2553
|
return concurrency > 1 ? bounded(concurrency) : sequential();
|
|
2552
2554
|
}
|
|
2553
2555
|
};
|
|
2554
|
-
const flatMapParSwitchBuffer = /*#__PURE__*/
|
|
2556
|
+
const flatMapParSwitchBuffer = /*#__PURE__*/icons.dual(4, (self, n, bufferSize, f) => new StreamImpl(icons.pipe(toChannel(self), concatMap(writeChunk), mergeMap(out => toChannel(f(out)), {
|
|
2555
2557
|
concurrency: n,
|
|
2556
2558
|
mergeStrategy: BufferSliding(),
|
|
2557
2559
|
bufferSize
|
|
2558
2560
|
}))));
|
|
2559
2561
|
/** @internal */
|
|
2560
|
-
const flatten = /*#__PURE__*/
|
|
2562
|
+
const flatten = /*#__PURE__*/icons.dual(args => isStream(args[0]), (self, options) => flatMap(self, icons.identity, options));
|
|
2561
2563
|
/** @internal */
|
|
2562
2564
|
const flattenChunks = self => {
|
|
2563
2565
|
const flatten = readWithCause({
|
|
@@ -2565,59 +2567,59 @@ const flattenChunks = self => {
|
|
|
2565
2567
|
onFailure: failCause$2,
|
|
2566
2568
|
onDone: () => void_
|
|
2567
2569
|
});
|
|
2568
|
-
return new StreamImpl(
|
|
2570
|
+
return new StreamImpl(icons.pipe(toChannel(self), pipeTo(flatten)));
|
|
2569
2571
|
};
|
|
2570
2572
|
/** @internal */
|
|
2571
2573
|
const flattenExitOption = self => {
|
|
2572
2574
|
const processChunk = (chunk, cont) => {
|
|
2573
|
-
const [toEmit, rest] =
|
|
2574
|
-
const next =
|
|
2575
|
+
const [toEmit, rest] = icons.pipe(chunk, icons.splitWhere(exit => !icons.isSuccess(exit)));
|
|
2576
|
+
const next = icons.pipe(icons.head(rest), icons.match$2({
|
|
2575
2577
|
onNone: () => cont,
|
|
2576
|
-
onSome:
|
|
2577
|
-
onFailure: cause =>
|
|
2578
|
+
onSome: icons.match$1({
|
|
2579
|
+
onFailure: cause => icons.match$2(flipCauseOption(cause), {
|
|
2578
2580
|
onNone: () => void_,
|
|
2579
2581
|
onSome: failCause$2
|
|
2580
2582
|
}),
|
|
2581
2583
|
onSuccess: () => void_
|
|
2582
2584
|
})
|
|
2583
2585
|
}));
|
|
2584
|
-
return
|
|
2586
|
+
return icons.pipe(write(icons.pipe(toEmit, icons.filterMap(exit => icons.isSuccess(exit) ? icons.some(exit.value) : icons.none()))), flatMap$1(() => next));
|
|
2585
2587
|
};
|
|
2586
2588
|
const process = readWithCause({
|
|
2587
2589
|
onInput: chunk => processChunk(chunk, process),
|
|
2588
2590
|
onFailure: cause => failCause$2(cause),
|
|
2589
2591
|
onDone: () => void_
|
|
2590
2592
|
});
|
|
2591
|
-
return new StreamImpl(
|
|
2593
|
+
return new StreamImpl(icons.pipe(toChannel(self), pipeTo(process)));
|
|
2592
2594
|
};
|
|
2593
2595
|
/** @internal */
|
|
2594
|
-
const flattenTake = self => flattenChunks(flattenExitOption(
|
|
2596
|
+
const flattenTake = self => flattenChunks(flattenExitOption(icons.pipe(self, map(take => take.exit))));
|
|
2595
2597
|
/** @internal */
|
|
2596
2598
|
const toChannel = stream => {
|
|
2597
2599
|
if ("channel" in stream) {
|
|
2598
2600
|
return stream.channel;
|
|
2599
|
-
} else if (
|
|
2601
|
+
} else if (icons.isEffect(stream)) {
|
|
2600
2602
|
return toChannel(fromEffect(stream));
|
|
2601
2603
|
} else {
|
|
2602
2604
|
throw new TypeError(`Expected a Stream.`);
|
|
2603
2605
|
}
|
|
2604
2606
|
};
|
|
2605
2607
|
/** @internal */
|
|
2606
|
-
const fromEffect = effect =>
|
|
2608
|
+
const fromEffect = effect => icons.pipe(effect, icons.mapError(icons.some), fromEffectOption);
|
|
2607
2609
|
/** @internal */
|
|
2608
|
-
const fromEffectOption = effect => new StreamImpl(unwrap(
|
|
2609
|
-
onFailure:
|
|
2610
|
+
const fromEffectOption = effect => new StreamImpl(unwrap(icons.match$3(effect, {
|
|
2611
|
+
onFailure: icons.match$2({
|
|
2610
2612
|
onNone: () => void_,
|
|
2611
2613
|
onSome: fail
|
|
2612
2614
|
}),
|
|
2613
|
-
onSuccess: a => write(
|
|
2615
|
+
onSuccess: a => write(icons.of(a))
|
|
2614
2616
|
})));
|
|
2615
2617
|
/** @internal */
|
|
2616
|
-
const fromQueue$1 = (queue, options) =>
|
|
2618
|
+
const fromQueue$1 = (queue, options) => icons.pipe(takeBetween(queue, 1, options?.maxChunkSize ?? DefaultChunkSize), icons.catchAllCause(cause => icons.pipe(isShutdown(queue), icons.flatMap$1(isShutdown => isShutdown && isInterrupted(cause) ? end() : failCause(cause)))), repeatEffectChunkOption, options?.shutdown ? ensuring(shutdown(queue)) : icons.identity);
|
|
2617
2619
|
/** @internal */
|
|
2618
|
-
const map = /*#__PURE__*/
|
|
2620
|
+
const map = /*#__PURE__*/icons.dual(2, (self, f) => new StreamImpl(icons.pipe(toChannel(self), mapOut(icons.map$4(f)))));
|
|
2619
2621
|
/** @internal */
|
|
2620
|
-
const mapEffectSequential = /*#__PURE__*/
|
|
2622
|
+
const mapEffectSequential = /*#__PURE__*/icons.dual(2, (self, f) => {
|
|
2621
2623
|
const loop = iterator => {
|
|
2622
2624
|
const next = iterator.next();
|
|
2623
2625
|
if (next.done) {
|
|
@@ -2628,29 +2630,29 @@ const mapEffectSequential = /*#__PURE__*/Effect.dual(2, (self, f) => {
|
|
|
2628
2630
|
});
|
|
2629
2631
|
} else {
|
|
2630
2632
|
const value = next.value;
|
|
2631
|
-
return unwrap(
|
|
2633
|
+
return unwrap(icons.map$2(f(value), a2 => flatMap$1(write(icons.of(a2)), () => loop(iterator))));
|
|
2632
2634
|
}
|
|
2633
2635
|
};
|
|
2634
|
-
return new StreamImpl(
|
|
2636
|
+
return new StreamImpl(icons.pipe(toChannel(self), pipeTo(suspend$1(() => loop(icons.empty$1()[Symbol.iterator]())))));
|
|
2635
2637
|
});
|
|
2636
2638
|
/** @internal */
|
|
2637
|
-
const mapEffectPar = /*#__PURE__*/
|
|
2639
|
+
const mapEffectPar = /*#__PURE__*/icons.dual(3, (self, n, f) => new StreamImpl(icons.pipe(toChannel(self), concatMap(writeChunk), mapOutEffectPar(f, n), mapOut(icons.of))));
|
|
2638
2640
|
/** @internal */
|
|
2639
|
-
const repeatEffectChunkOption = effect => unfoldChunkEffect(effect, effect =>
|
|
2640
|
-
onNone: () =>
|
|
2641
|
-
onSome:
|
|
2641
|
+
const repeatEffectChunkOption = effect => unfoldChunkEffect(effect, effect => icons.pipe(icons.map$2(effect, chunk => icons.some([chunk, effect])), icons.catchAll(icons.match$2({
|
|
2642
|
+
onNone: () => icons.succeed(icons.none()),
|
|
2643
|
+
onSome: icons.fail$2
|
|
2642
2644
|
}))));
|
|
2643
2645
|
/** @internal */
|
|
2644
|
-
const run = /*#__PURE__*/
|
|
2646
|
+
const run = /*#__PURE__*/icons.dual(2, (self, sink) => toChannel(self).pipe(pipeToOrFail(toChannel$1(sink)), runDrain$2));
|
|
2645
2647
|
/** @internal */
|
|
2646
2648
|
const runDrain$1 = self => run(self, drain);
|
|
2647
2649
|
/** @internal */
|
|
2648
|
-
const scopedWith = f => new StreamImpl(scopedWith$1(scope => f(scope).pipe(
|
|
2650
|
+
const scopedWith = f => new StreamImpl(scopedWith$1(scope => f(scope).pipe(icons.map$2(icons.of))));
|
|
2649
2651
|
/** @internal */
|
|
2650
2652
|
const suspend = stream => new StreamImpl(suspend$1(() => toChannel(stream())));
|
|
2651
2653
|
/** @internal */
|
|
2652
2654
|
const unfoldChunkEffect = (s, f) => suspend(() => {
|
|
2653
|
-
const loop = s => unwrap(
|
|
2655
|
+
const loop = s => unwrap(icons.map$2(f(s), icons.match$2({
|
|
2654
2656
|
onNone: () => void_,
|
|
2655
2657
|
onSome: ([chunk, s]) => flatMap$1(write(chunk), () => loop(s))
|
|
2656
2658
|
})));
|
|
@@ -2674,9 +2676,9 @@ const groupByVariance = {
|
|
|
2674
2676
|
_V: _ => _
|
|
2675
2677
|
};
|
|
2676
2678
|
/** @internal */
|
|
2677
|
-
const isGroupBy = u =>
|
|
2679
|
+
const isGroupBy = u => icons.hasProperty(u, GroupByTypeId);
|
|
2678
2680
|
/** @internal */
|
|
2679
|
-
const evaluate = /*#__PURE__*/
|
|
2681
|
+
const evaluate = /*#__PURE__*/icons.dual(args => isGroupBy(args[0]), (self, f, options) => flatMap(self.grouped, ([key, queue]) => f(key, flattenTake(fromQueue$1(queue, {
|
|
2680
2682
|
shutdown: true
|
|
2681
2683
|
}))), {
|
|
2682
2684
|
concurrency: "unbounded",
|
|
@@ -2686,12 +2688,12 @@ const evaluate = /*#__PURE__*/Effect.dual(args => isGroupBy(args[0]), (self, f,
|
|
|
2686
2688
|
const make = grouped => ({
|
|
2687
2689
|
[GroupByTypeId]: groupByVariance,
|
|
2688
2690
|
pipe() {
|
|
2689
|
-
return
|
|
2691
|
+
return icons.pipeArguments(this, arguments);
|
|
2690
2692
|
},
|
|
2691
2693
|
grouped
|
|
2692
2694
|
});
|
|
2693
2695
|
/** @internal */
|
|
2694
|
-
const mapEffectOptions = /*#__PURE__*/
|
|
2696
|
+
const mapEffectOptions = /*#__PURE__*/icons.dual(args => typeof args[0] !== "function", (self, f, options) => {
|
|
2695
2697
|
if (options?.key) {
|
|
2696
2698
|
return evaluate(groupByKey(self, options.key, {
|
|
2697
2699
|
bufferSize: options.bufferSize
|
|
@@ -2702,29 +2704,29 @@ const mapEffectOptions = /*#__PURE__*/Effect.dual(args => typeof args[0] !== "fu
|
|
|
2702
2704
|
}) : mapEffectPar(self, n, f));
|
|
2703
2705
|
});
|
|
2704
2706
|
/** @internal */
|
|
2705
|
-
const groupByKey = /*#__PURE__*/
|
|
2707
|
+
const groupByKey = /*#__PURE__*/icons.dual(args => typeof args[0] !== "function", (self, f, options) => {
|
|
2706
2708
|
const loop = (map, outerQueue) => readWithCause({
|
|
2707
|
-
onInput: input => flatMap$1(fromEffect$3(
|
|
2709
|
+
onInput: input => flatMap$1(fromEffect$3(icons.forEach(groupByIterable(input, f), ([key, values]) => {
|
|
2708
2710
|
const innerQueue = map.get(key);
|
|
2709
2711
|
if (innerQueue === undefined) {
|
|
2710
|
-
return
|
|
2712
|
+
return icons.pipe(bounded(options?.bufferSize ?? 16), icons.flatMap$1(innerQueue => icons.pipe(icons.sync$1(() => {
|
|
2711
2713
|
map.set(key, innerQueue);
|
|
2712
|
-
}),
|
|
2714
|
+
}), icons.zipRight$2(offer(outerQueue, of([key, innerQueue]))), icons.zipRight$2(icons.pipe(offer(innerQueue, chunk(values)), icons.catchSomeCause(cause => isInterruptedOnly(cause) ? icons.some(icons._void) : icons.none()))))));
|
|
2713
2715
|
}
|
|
2714
|
-
return
|
|
2716
|
+
return icons.catchSomeCause(offer(innerQueue, chunk(values)), cause => isInterruptedOnly(cause) ? icons.some(icons._void) : icons.none());
|
|
2715
2717
|
}, {
|
|
2716
2718
|
discard: true
|
|
2717
2719
|
})), () => loop(map, outerQueue)),
|
|
2718
2720
|
onFailure: cause => fromEffect$3(offer(outerQueue, failCause$1(cause))),
|
|
2719
|
-
onDone: () => fromEffect$3(
|
|
2721
|
+
onDone: () => fromEffect$3(icons.pipe(icons.forEach(map.entries(), ([_, innerQueue]) => icons.pipe(offer(innerQueue, end$1), icons.catchSomeCause(cause => isInterruptedOnly(cause) ? icons.some(icons._void) : icons.none())), {
|
|
2720
2722
|
discard: true
|
|
2721
|
-
}),
|
|
2723
|
+
}), icons.zipRight$2(offer(outerQueue, end$1))))
|
|
2722
2724
|
});
|
|
2723
|
-
return make(unwrapScopedWith(scope =>
|
|
2725
|
+
return make(unwrapScopedWith(scope => icons.gen(function* () {
|
|
2724
2726
|
const map = new Map();
|
|
2725
2727
|
const queue = yield* unbounded();
|
|
2726
|
-
yield*
|
|
2727
|
-
return yield* toChannel(self).pipe(pipeTo(loop(map, queue)), drain$1, runIn(scope),
|
|
2728
|
+
yield* icons.addFinalizer(scope, shutdown(queue));
|
|
2729
|
+
return yield* toChannel(self).pipe(pipeTo(loop(map, queue)), drain$1, runIn(scope), icons.forkIn(scope), icons.as(flattenTake(fromQueue$1(queue, {
|
|
2728
2730
|
shutdown: true
|
|
2729
2731
|
}))));
|
|
2730
2732
|
})));
|
|
@@ -2734,7 +2736,7 @@ const groupByKey = /*#__PURE__*/Effect.dual(args => typeof args[0] !== "function
|
|
|
2734
2736
|
*
|
|
2735
2737
|
* @internal
|
|
2736
2738
|
*/
|
|
2737
|
-
const groupByIterable = /*#__PURE__*/
|
|
2739
|
+
const groupByIterable = /*#__PURE__*/icons.dual(2, (iterable, f) => {
|
|
2738
2740
|
const builder = [];
|
|
2739
2741
|
const iterator = iterable[Symbol.iterator]();
|
|
2740
2742
|
const map = new Map();
|
|
@@ -2751,7 +2753,7 @@ const groupByIterable = /*#__PURE__*/Effect.dual(2, (iterable, f) => {
|
|
|
2751
2753
|
map.set(key, innerBuilder);
|
|
2752
2754
|
}
|
|
2753
2755
|
}
|
|
2754
|
-
return
|
|
2756
|
+
return icons.unsafeFromArray(builder.map(tuple => [tuple[0], icons.unsafeFromArray(tuple[1])]));
|
|
2755
2757
|
});
|
|
2756
2758
|
|
|
2757
2759
|
/**
|
|
@@ -35606,24 +35608,27 @@ let validationQueue = null;
|
|
|
35606
35608
|
function initializeValidationStream() {
|
|
35607
35609
|
if (validationStreamFiber)
|
|
35608
35610
|
return;
|
|
35609
|
-
const program =
|
|
35611
|
+
const program = icons.gen(function* () {
|
|
35610
35612
|
const queue = (validationQueue = yield* bounded(100));
|
|
35611
|
-
const stream = fromQueue(queue).pipe(mapEffect(({ context, onComplete }) =>
|
|
35613
|
+
const stream = fromQueue(queue).pipe(mapEffect(({ context, onComplete }) => icons.async((resume) => {
|
|
35612
35614
|
axeExports.run(context, {}, (error, results) => {
|
|
35613
35615
|
onComplete(error, results);
|
|
35614
|
-
resume(
|
|
35616
|
+
resume(icons._void);
|
|
35615
35617
|
});
|
|
35616
35618
|
})));
|
|
35617
35619
|
yield* runDrain(stream);
|
|
35618
35620
|
});
|
|
35619
|
-
validationStreamFiber =
|
|
35621
|
+
validationStreamFiber = icons.runFork(program);
|
|
35620
35622
|
}
|
|
35621
35623
|
function enqueueValidation(validationRequest) {
|
|
35622
35624
|
initializeValidationStream();
|
|
35623
35625
|
if (!validationQueue)
|
|
35624
35626
|
return;
|
|
35625
|
-
|
|
35627
|
+
icons.runPromise(validationQueue.offer(validationRequest));
|
|
35626
35628
|
}
|
|
35627
35629
|
|
|
35628
35630
|
exports.enqueueValidation = enqueueValidation;
|
|
35629
35631
|
exports.initializeValidationStream = initializeValidationStream;
|
|
35632
|
+
//# sourceMappingURL=index-ww_DCXU7.js.map
|
|
35633
|
+
|
|
35634
|
+
//# sourceMappingURL=index-ww_DCXU7.js.map
|