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