effect-browser 0.3.0-beta.23 → 0.3.0-beta.25
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/README.md +437 -142
- package/dist/Action.d.mts +1 -1
- package/dist/Action.mjs +61 -9
- package/dist/Action.mjs.map +1 -1
- package/dist/Browser.d.mts +2 -2
- package/dist/Browser.mjs +2 -2
- package/dist/BrowserError.d.mts +2 -2
- package/dist/BrowserError.mjs +194 -41
- package/dist/BrowserError.mjs.map +1 -1
- package/dist/BrowserEvent.d.mts +2 -2
- package/dist/BrowserEvent.mjs +185 -35
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/Cdp.d.mts +15 -0
- package/dist/Cdp.mjs +22 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change.d.mts +2 -2
- package/dist/Change.mjs +40 -7
- package/dist/Change.mjs.map +1 -1
- package/dist/Frame.d.mts +2 -2
- package/dist/Frame.mjs +132 -14
- package/dist/Frame.mjs.map +1 -1
- package/dist/InputStyle.d.mts +153 -0
- package/dist/InputStyle.mjs +2 -0
- package/dist/Layout.d.mts +2 -0
- package/dist/Layout.mjs +123 -0
- package/dist/Layout.mjs.map +1 -0
- package/dist/Overlay.d.mts +2 -0
- package/dist/Overlay.mjs +58 -0
- package/dist/Overlay.mjs.map +1 -0
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +2 -2
- package/dist/PageTime.d.mts +2 -0
- package/dist/PageTime.mjs +17 -0
- package/dist/PageTime.mjs.map +1 -0
- package/dist/Pose.d.mts +2 -0
- package/dist/Pose.mjs +65 -0
- package/dist/Pose.mjs.map +1 -0
- package/dist/Site.d.mts +984 -0
- package/dist/Site.mjs +110 -0
- package/dist/Site.mjs.map +1 -0
- package/dist/Snapshot.d.mts +2 -2
- package/dist/Snapshot.mjs +87 -6
- package/dist/Snapshot.mjs.map +1 -1
- package/dist/Text.d.mts +2 -0
- package/dist/Text.mjs +45 -0
- package/dist/Text.mjs.map +1 -0
- package/dist/Window.d.mts +2 -2
- package/dist/Window.mjs +31 -6
- package/dist/Window.mjs.map +1 -1
- package/dist/ai/BrowserTools.d.mts +4987 -0
- package/dist/ai/BrowserTools.mjs +3 -0
- package/dist/ai/PageControl.d.mts +286 -0
- package/dist/ai/PageControl.mjs +426 -0
- package/dist/ai/PageControl.mjs.map +1 -0
- package/dist/ai/PromptCache.d.mts +16 -0
- package/dist/ai/PromptCache.mjs +72 -0
- package/dist/ai/PromptCache.mjs.map +1 -0
- package/dist/ai/Tabs.d.mts +2 -0
- package/dist/ai/Tabs.mjs +72 -0
- package/dist/ai/Tabs.mjs.map +1 -0
- package/dist/ai/ToolError.d.mts +34 -0
- package/dist/ai/ToolError.mjs +2 -0
- package/dist/ai/index.d.mts +6 -0
- package/dist/ai/index.mjs +6 -0
- package/dist/index.d.mts +7 -15
- package/dist/index.mjs +9 -8
- package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
- package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
- package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
- package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
- package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
- package/dist/{BrowserEvent-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
- package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
- package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
- package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
- package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
- package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +54 -21
- package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
- package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
- package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
- package/dist/internal/Release-CFONkPDP.d.mts +39 -0
- package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
- package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
- package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
- package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
- package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
- package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
- package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
- package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
- package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
- package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
- package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
- package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
- package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
- package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
- package/dist/internal/cdp/workerd.d.mts +13 -0
- package/dist/internal/cdp/workerd.mjs +19 -0
- package/dist/internal/cdp/workerd.mjs.map +1 -0
- package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
- package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
- package/dist/{connection-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
- package/dist/{connection-CK83pvqP.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
- package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
- package/dist/internal/events-DzCrww-y.mjs +72 -0
- package/dist/internal/events-DzCrww-y.mjs.map +1 -0
- package/dist/internal/fold.inpage-CyVZQHZL.d.mts +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
- package/dist/internal/functions-jBOs6GKv.mjs +27 -0
- package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
- package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
- package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
- package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
- package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +24 -19
- package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
- package/dist/internal/page-DFQb-YOK.mjs +436 -0
- package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
- package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
- package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
- package/dist/policy/Policy.d.mts +60 -6
- package/dist/policy/Policy.mjs +52 -9
- package/dist/policy/Policy.mjs.map +1 -1
- package/dist/policy/index.d.mts +2 -0
- package/dist/policy/index.mjs +2 -0
- package/dist/presentation/Film.d.mts +332 -0
- package/dist/presentation/Film.mjs +298 -0
- package/dist/presentation/Film.mjs.map +1 -0
- package/dist/presentation/Motion.d.mts +5 -1
- package/dist/presentation/Motion.mjs +16 -2
- package/dist/presentation/Motion.mjs.map +1 -1
- package/dist/presentation/Presentation.d.mts +48 -6
- package/dist/presentation/Presentation.mjs +28 -9
- package/dist/presentation/Presentation.mjs.map +1 -1
- package/dist/presentation/Stage.d.mts +40 -6
- package/dist/presentation/Stage.mjs +1 -262
- package/dist/presentation/index.d.mts +5 -0
- package/dist/presentation/index.mjs +5 -0
- package/dist/supervisor/Release.d.mts +2 -0
- package/dist/supervisor/Release.mjs +40 -0
- package/dist/supervisor/Release.mjs.map +1 -0
- package/dist/supervisor/Supervisor.d.mts +2 -104
- package/dist/supervisor/Supervisor.mjs +2 -515
- package/dist/supervisor/index.d.mts +3 -0
- package/dist/supervisor/index.mjs +3 -0
- package/dist/testing/HttpCassette.d.mts +98 -0
- package/dist/testing/HttpCassette.mjs +146 -0
- package/dist/testing/HttpCassette.mjs.map +1 -0
- package/dist/testing/Story.d.mts +31 -0
- package/dist/testing/Story.mjs +76 -0
- package/dist/testing/Story.mjs.map +1 -0
- package/dist/testing/TestBrowser.d.mts +191 -0
- package/dist/testing/TestBrowser.mjs +105 -0
- package/dist/testing/TestBrowser.mjs.map +1 -0
- package/dist/testing/TestModel.d.mts +133 -0
- package/dist/testing/TestModel.mjs +209 -0
- package/dist/testing/TestModel.mjs.map +1 -0
- package/dist/testing/TestPage.d.mts +2 -0
- package/dist/testing/TestPage.mjs +47 -0
- package/dist/testing/TestPage.mjs.map +1 -0
- package/dist/testing/index.d.mts +6 -337
- package/dist/testing/index.mjs +6 -515
- package/dist/timeline/Moment.d.mts +3 -0
- package/dist/timeline/Moment.mjs +3 -0
- package/dist/timeline/Stillness.d.mts +34 -0
- package/dist/timeline/Stillness.mjs +2 -0
- package/dist/timeline/index.d.mts +3 -0
- package/dist/timeline/index.mjs +3 -0
- package/dist/walk/Walk.d.mts +2 -0
- package/dist/walk/Walk.mjs +2 -0
- package/dist/walk/index.d.mts +2 -0
- package/dist/walk/index.mjs +2 -0
- package/package.json +54 -133
- package/src/Action.ts +73 -8
- package/src/Browser.ts +85 -14
- package/src/BrowserError.ts +258 -63
- package/src/BrowserEvent.ts +264 -48
- package/src/Cdp.ts +42 -0
- package/src/Change.ts +75 -4
- package/src/Frame.ts +247 -14
- package/src/{Style.ts → InputStyle.ts} +130 -18
- package/src/Layout.ts +187 -0
- package/src/Overlay.ts +76 -0
- package/src/Page.ts +144 -275
- package/src/PageTime.ts +72 -0
- package/src/Pose.ts +81 -0
- package/src/Site.ts +136 -0
- package/src/Snapshot.ts +179 -3
- package/src/Text.ts +60 -0
- package/src/Window.ts +53 -3
- package/src/ai/BrowserTools.ts +778 -0
- package/src/ai/PageControl.ts +702 -0
- package/src/ai/PromptCache.ts +87 -0
- package/src/ai/Tabs.ts +84 -0
- package/src/ai/ToolError.ts +50 -0
- package/src/ai/index.ts +36 -0
- package/src/ai/internal/crops.ts +38 -0
- package/src/ai/internal/points.ts +57 -0
- package/src/ai/internal/receipts.ts +107 -0
- package/src/index.ts +87 -6
- package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
- package/src/{providers → internal/cdp}/connection.ts +19 -12
- package/src/internal/cdp/workerd.ts +36 -0
- package/src/{Clock.ts → internal/clock.ts} +20 -0
- package/src/internal/input/actions.ts +1 -1
- package/src/internal/input/dispatch.ts +2 -2
- package/src/internal/input/guard.inpage.ts +1 -1
- package/src/internal/input/guard.ts +1 -1
- package/src/internal/input/perform.ts +35 -7
- package/src/internal/input/pointer.ts +9 -6
- package/src/internal/input/targets.inpage.ts +3 -3
- package/src/internal/input/targets.ts +1 -1
- package/src/{Matching.ts → internal/matching.ts} +28 -19
- package/src/internal/page/bridge.ts +67 -35
- package/src/internal/page/clock.inpage.ts +306 -0
- package/src/internal/page/compose.inpage.ts +101 -0
- package/src/internal/page/context.ts +4 -2
- package/src/internal/page/functions.ts +84 -0
- package/src/internal/page/navigation.ts +1 -1
- package/src/internal/page/openings.ts +2 -2
- package/src/internal/page/overlay.inpage.ts +96 -0
- package/src/internal/page/overlay.ts +89 -0
- package/src/internal/page/page.ts +39 -29
- package/src/internal/page/port.ts +14 -8
- package/src/internal/page/pose.inpage.ts +200 -0
- package/src/internal/page/pose.ts +80 -0
- package/src/internal/page/replies.ts +1 -1
- package/src/internal/page/requests.ts +1 -1
- package/src/internal/page/scripts.ts +1 -1
- package/src/internal/page/time.inpage.ts +49 -0
- package/src/internal/page/time.ts +122 -0
- package/src/internal/page/viewport.ts +3 -2
- package/src/internal/pictures/capture.ts +1 -4
- package/src/internal/pictures/dimensions.ts +1 -1
- package/src/internal/pictures/frame.ts +1 -1
- package/src/internal/pictures/pictures.ts +144 -91
- package/src/internal/reading/context.inpage.ts +2 -2
- package/src/internal/reading/expect.inpage.ts +1 -1
- package/src/internal/reading/layout.inpage.ts +193 -0
- package/src/internal/reading/layout.ts +101 -0
- package/src/internal/reading/names.inpage.ts +15 -0
- package/src/internal/reading/outline.inpage.ts +5 -21
- package/src/internal/reading/reading.ts +33 -21
- package/src/internal/reading/ready.inpage.ts +21 -26
- package/src/internal/reading/ready.ts +26 -5
- package/src/internal/reading/subjects.inpage.ts +3 -3
- package/src/internal/reading/text.inpage.ts +3 -16
- package/src/internal/reading/walk.inpage.ts +1 -1
- package/src/internal/timeline/changes.inpage.ts +7 -15
- package/src/internal/timeline/changes.ts +17 -5
- package/src/internal/timeline/record.inpage.ts +15 -6
- package/src/internal/timeline/sight.inpage.ts +2 -2
- package/src/internal/timeline/window.ts +3 -4
- package/src/policy/Policy.ts +70 -16
- package/src/policy/index.ts +12 -0
- package/src/presentation/Film.ts +451 -0
- package/src/presentation/Motion.ts +45 -3
- package/src/presentation/Presentation.ts +60 -14
- package/src/presentation/Stage.ts +73 -35
- package/src/presentation/index.ts +30 -0
- package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
- package/src/supervisor/Release.ts +45 -0
- package/src/supervisor/Supervisor.ts +80 -5
- package/src/supervisor/index.ts +18 -0
- package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
- package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
- package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
- package/src/testing/HttpCassette.ts +260 -0
- package/src/testing/Story.ts +103 -0
- package/src/testing/TestBrowser.ts +14 -4
- package/src/testing/TestModel.ts +297 -0
- package/src/testing/TestPage.ts +92 -4
- package/src/testing/index.ts +35 -1
- package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
- package/src/testing/{model.ts → internal/model.ts} +14 -8
- package/src/testing/{page.ts → internal/page.ts} +55 -51
- package/src/{moment → timeline}/Moment.ts +79 -29
- package/src/{stillness → timeline}/Stillness.ts +89 -46
- package/src/timeline/index.ts +18 -0
- package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
- package/src/{moment → timeline/internal}/words.ts +2 -2
- package/src/walk/Walk.ts +165 -0
- package/src/walk/index.ts +12 -0
- package/src/{plan → walk/internal}/choose.ts +23 -14
- package/src/{plan → walk/internal}/data.ts +37 -14
- package/src/{plan → walk/internal}/execute.ts +79 -36
- package/src/{plan → walk/internal}/record.ts +6 -6
- package/src/{plan → walk/internal}/targets.ts +35 -25
- package/dist/ActionPort.d.mts +0 -15
- package/dist/ActionPort.mjs.map +0 -1
- package/dist/Browser-BKPAbyys.mjs.map +0 -1
- package/dist/Change-Ba7INmay.d.mts +0 -69
- package/dist/Clock.d.mts +0 -57
- package/dist/Clock.mjs.map +0 -1
- package/dist/Frame-UEH2hO5T.d.mts +0 -124
- package/dist/Geometry.d.mts +0 -2
- package/dist/Geometry.mjs.map +0 -1
- package/dist/Matching.d.mts +0 -37
- package/dist/Matching.mjs.map +0 -1
- package/dist/Page-BF5izr8R.mjs.map +0 -1
- package/dist/Page-CvsOEorc.d.mts +0 -566
- package/dist/Released-tURbFmal.d.mts +0 -15
- package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
- package/dist/Stillness-CNlvayIo.mjs +0 -136
- package/dist/Stillness-CNlvayIo.mjs.map +0 -1
- package/dist/Style-AO4V7Czt.mjs.map +0 -1
- package/dist/Style.d.mts +0 -72
- package/dist/Style.mjs +0 -2
- package/dist/Url.d.mts +0 -26
- package/dist/Url.mjs.map +0 -1
- package/dist/Window-CMddGMt1.d.mts +0 -34
- package/dist/connection-CK83pvqP.mjs.map +0 -1
- package/dist/moment/Moment.mjs.map +0 -1
- package/dist/plan/index.mjs.map +0 -1
- package/dist/presentation/Stage.mjs.map +0 -1
- package/dist/presentation/feed.d.mts +0 -20
- package/dist/presentation/feed.mjs +0 -18
- package/dist/presentation/feed.mjs.map +0 -1
- package/dist/providers/Cdp.d.mts +0 -9
- package/dist/providers/Cdp.mjs +0 -15
- package/dist/providers/Cdp.mjs.map +0 -1
- package/dist/providers/Chromium.d.mts +0 -32
- package/dist/providers/Chromium.mjs +0 -55
- package/dist/providers/Chromium.mjs.map +0 -1
- package/dist/providers/Released.d.mts +0 -2
- package/dist/providers/Released.mjs +0 -12
- package/dist/providers/Released.mjs.map +0 -1
- package/dist/stillness/Stillness.d.mts +0 -12
- package/dist/stillness/Stillness.mjs +0 -2
- package/dist/supervisor/Supervisor.mjs.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
- package/dist/workerd/Cdp.d.mts +0 -8
- package/dist/workerd/Cdp.mjs +0 -13
- package/dist/workerd/Cdp.mjs.map +0 -1
- package/src/plan/index.ts +0 -36
- package/src/providers/Cdp.ts +0 -16
- package/src/providers/Chromium.ts +0 -99
- package/src/providers/Released.ts +0 -13
- package/src/workerd/Cdp.ts +0 -11
- /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
- /package/src/{Url.ts → internal/url.ts} +0 -0
- /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
package/dist/Action.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PressOptions, c as nameOf, i as Name, l as recorded, o as ScrollOptions, r as ClickOptions, s as TypeOptions, t as Action, u as targetOf } from "./Action-
|
|
1
|
+
import { a as PressOptions, c as nameOf, i as Name, l as recorded, o as ScrollOptions, r as ClickOptions, s as TypeOptions, t as Action, u as targetOf } from "./internal/Action-CkanNTUw.mjs";
|
|
2
2
|
export { Action, ClickOptions, Name, PressOptions, ScrollOptions, TypeOptions, nameOf, recorded, targetOf };
|
package/dist/Action.mjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { Point } from "./
|
|
3
|
-
import { redact, withheld } from "./
|
|
4
|
-
import { Schema } from "effect";
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as Point } from "./internal/geometry-Lxyflb9J.mjs";
|
|
3
|
+
import { i as redact, o as withheld } from "./internal/url-DB0pQYk6.mjs";
|
|
4
|
+
import { Function, Schema } from "effect";
|
|
5
5
|
//#region src/Action.ts
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Typed browser actions, shared by execution, policy, recordings and replay.
|
|
8
|
+
*
|
|
9
|
+
* @stability stable
|
|
10
|
+
* @since 0.3.0
|
|
11
|
+
*/
|
|
7
12
|
var Action_exports = /* @__PURE__ */ __exportAll({
|
|
8
13
|
Action: () => Action,
|
|
9
14
|
ClickOptions: () => ClickOptions,
|
|
@@ -18,6 +23,11 @@ var Action_exports = /* @__PURE__ */ __exportAll({
|
|
|
18
23
|
const Ref$1 = Schema.String.check(Schema.isPattern(/^e\d+$/));
|
|
19
24
|
const Target = Schema.Union([Ref$1, Point]);
|
|
20
25
|
const optionalNumber = Schema.optional(Schema.Finite);
|
|
26
|
+
/**
|
|
27
|
+
* @stability stable
|
|
28
|
+
* @category options
|
|
29
|
+
* @since 0.3.0
|
|
30
|
+
*/
|
|
21
31
|
const ClickOptions = Schema.Struct({
|
|
22
32
|
button: Schema.optional(Schema.Literals([
|
|
23
33
|
"left",
|
|
@@ -27,22 +37,42 @@ const ClickOptions = Schema.Struct({
|
|
|
27
37
|
clickCount: optionalNumber,
|
|
28
38
|
holdMillis: optionalNumber
|
|
29
39
|
});
|
|
40
|
+
/**
|
|
41
|
+
* @stability stable
|
|
42
|
+
* @category options
|
|
43
|
+
* @since 0.3.0
|
|
44
|
+
*/
|
|
30
45
|
const TypeOptions = Schema.Struct({
|
|
31
46
|
into: Schema.optional(Ref$1),
|
|
32
47
|
replace: Schema.optional(Schema.Boolean),
|
|
33
48
|
submit: Schema.optional(Schema.Boolean),
|
|
34
49
|
secret: Schema.optional(Schema.Boolean)
|
|
35
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* @stability stable
|
|
53
|
+
* @category options
|
|
54
|
+
* @since 0.3.0
|
|
55
|
+
*/
|
|
36
56
|
const PressOptions = Schema.Struct({
|
|
37
57
|
on: Schema.optional(Ref$1),
|
|
38
58
|
times: optionalNumber,
|
|
39
59
|
holdMillis: optionalNumber
|
|
40
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* @stability stable
|
|
63
|
+
* @category options
|
|
64
|
+
* @since 0.3.0
|
|
65
|
+
*/
|
|
41
66
|
const ScrollOptions = Schema.Struct({
|
|
42
67
|
at: Schema.optional(Target),
|
|
43
68
|
dx: optionalNumber,
|
|
44
69
|
dy: optionalNumber
|
|
45
70
|
});
|
|
71
|
+
/**
|
|
72
|
+
* @stability stable
|
|
73
|
+
* @category schemas
|
|
74
|
+
* @since 0.3.0
|
|
75
|
+
*/
|
|
46
76
|
const Action = Schema.TaggedUnion({
|
|
47
77
|
Click: {
|
|
48
78
|
target: Target,
|
|
@@ -72,6 +102,11 @@ const Action = Schema.TaggedUnion({
|
|
|
72
102
|
/** A script's code and arguments are never retained. */
|
|
73
103
|
Act: { document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) }
|
|
74
104
|
});
|
|
105
|
+
/**
|
|
106
|
+
* @stability stable
|
|
107
|
+
* @category schemas
|
|
108
|
+
* @since 0.3.0
|
|
109
|
+
*/
|
|
75
110
|
const Name = Schema.Literals([
|
|
76
111
|
"click",
|
|
77
112
|
"hover",
|
|
@@ -85,8 +120,14 @@ const Name = Schema.Literals([
|
|
|
85
120
|
"reload",
|
|
86
121
|
"act"
|
|
87
122
|
]);
|
|
88
|
-
/**
|
|
89
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Effective semantics suitable for policy and records; credentials never survive.
|
|
125
|
+
*
|
|
126
|
+
* @stability stable
|
|
127
|
+
* @category combinators
|
|
128
|
+
* @since 0.3.0
|
|
129
|
+
*/
|
|
130
|
+
const recorded = Function.dual(2, (value, revealed) => {
|
|
90
131
|
if (value._tag === "Type") {
|
|
91
132
|
const secret = !revealed || value.options?.secret === true;
|
|
92
133
|
return {
|
|
@@ -103,7 +144,7 @@ const recorded = (value, revealed) => {
|
|
|
103
144
|
...value,
|
|
104
145
|
url: redact(value.url)
|
|
105
146
|
} : value;
|
|
106
|
-
};
|
|
147
|
+
});
|
|
107
148
|
/** The stable event vocabulary for an action. */
|
|
108
149
|
const names = {
|
|
109
150
|
Click: "click",
|
|
@@ -118,8 +159,19 @@ const names = {
|
|
|
118
159
|
Reload: "reload",
|
|
119
160
|
Act: "act"
|
|
120
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* @stability stable
|
|
164
|
+
* @category combinators
|
|
165
|
+
* @since 0.3.0
|
|
166
|
+
*/
|
|
121
167
|
const nameOf = (action) => names[action._tag];
|
|
122
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* The primary target, if this action addresses an element or point.
|
|
170
|
+
*
|
|
171
|
+
* @stability stable
|
|
172
|
+
* @category combinators
|
|
173
|
+
* @since 0.3.0
|
|
174
|
+
*/
|
|
123
175
|
const targetOf = (action) => {
|
|
124
176
|
switch (action._tag) {
|
|
125
177
|
case "Click":
|
package/dist/Action.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.mjs","names":["Ref","Url.withheld","Url.redact"],"sources":["../src/Action.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Action.mjs","names":["Ref","Url.withheld","Url.redact"],"sources":["../src/Action.ts"],"sourcesContent":["/**\n * Typed browser actions, shared by execution, policy, recordings and replay.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport { Function, Schema } from \"effect\";\n\nimport { Point } from \"./internal/geometry.ts\";\nimport * as Url from \"./internal/url.ts\";\n\nconst Ref = Schema.String.check(Schema.isPattern(/^e\\d+$/));\nconst Target = Schema.Union([Ref, Point]);\nconst optionalNumber = Schema.optional(Schema.Finite);\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport const ClickOptions = Schema.Struct({\n button: Schema.optional(Schema.Literals([\"left\", \"right\", \"middle\"])),\n clickCount: optionalNumber,\n holdMillis: optionalNumber,\n});\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport const TypeOptions = Schema.Struct({\n into: Schema.optional(Ref),\n replace: Schema.optional(Schema.Boolean),\n submit: Schema.optional(Schema.Boolean),\n secret: Schema.optional(Schema.Boolean),\n});\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport const PressOptions = Schema.Struct({\n on: Schema.optional(Ref),\n times: optionalNumber,\n holdMillis: optionalNumber,\n});\n\n/**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport const ScrollOptions = Schema.Struct({\n at: Schema.optional(Target),\n dx: optionalNumber,\n dy: optionalNumber,\n});\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const Action = Schema.TaggedUnion({\n Click: { target: Target, options: Schema.optional(ClickOptions) },\n Hover: { target: Target },\n Drag: { from: Target, to: Target },\n Type: { text: Schema.String, options: Schema.optional(TypeOptions) },\n Press: { keys: Schema.String, options: Schema.optional(PressOptions) },\n Scroll: { options: Schema.optional(ScrollOptions) },\n Select: { ref: Ref, values: Schema.Array(Schema.String) },\n Goto: { url: Schema.String },\n Back: {},\n Reload: {},\n /** A script's code and arguments are never retained. */\n Act: { document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) },\n});\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Action = typeof Action.Type;\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport const Name = Schema.Literals([\n \"click\",\n \"hover\",\n \"drag\",\n \"type\",\n \"press\",\n \"scroll\",\n \"select\",\n \"navigate\",\n \"back\",\n \"reload\",\n \"act\",\n]);\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport type Name = typeof Name.Type;\n\n/**\n * Effective semantics suitable for policy and records; credentials never survive.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const recorded: {\n (revealed: boolean): (value: Action) => Action;\n (value: Action, revealed: boolean): Action;\n} = Function.dual(2, (value: Action, revealed: boolean): Action => {\n if (value._tag === \"Type\") {\n const secret = !revealed || value.options?.secret === true;\n\n return {\n ...value,\n text: secret ? Url.withheld : value.text,\n options: {\n ...value.options,\n replace: value.options?.into === undefined ? false : (value.options.replace ?? true),\n secret: secret || value.options?.secret,\n },\n };\n }\n\n return value._tag === \"Goto\" ? { ...value, url: Url.redact(value.url) } : value;\n});\n\n/** The stable event vocabulary for an action. */\nconst names: Record<Action[\"_tag\"], Name> = {\n Click: \"click\",\n Hover: \"hover\",\n Drag: \"drag\",\n Type: \"type\",\n Press: \"press\",\n Scroll: \"scroll\",\n Select: \"select\",\n Goto: \"navigate\",\n Back: \"back\",\n Reload: \"reload\",\n Act: \"act\",\n};\n\n/**\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const nameOf = (action: Action): Name => names[action._tag];\n\n/**\n * The primary target, if this action addresses an element or point.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const targetOf = (action: Action) => {\n switch (action._tag) {\n case \"Click\":\n case \"Hover\":\n return action.target;\n case \"Drag\":\n return action.from;\n case \"Type\":\n return action.options?.into;\n case \"Press\":\n return action.options?.on;\n case \"Scroll\":\n return action.options?.at;\n case \"Select\":\n return action.ref;\n case \"Goto\":\n case \"Back\":\n case \"Reload\":\n case \"Act\":\n return undefined;\n }\n};\n"],"mappings":"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"}
|
package/dist/Browser.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InitScript, c as RequestPolicy, d as Suspension, f as make, i as EventOptions, l as Service, o as Options, r as CaptureSource, s as RequestDecision, t as Browser, u as SuspendOptions } from "./Browser-
|
|
2
|
-
export { Browser, CaptureSource, EventOptions, InitScript, Options, RequestDecision, RequestPolicy, Service, SuspendOptions, Suspension, make };
|
|
1
|
+
import { a as InitScript, c as RequestPolicy, d as Suspension, f as make, i as EventOptions, l as Service, o as Options, p as newPage, r as CaptureSource, s as RequestDecision, t as Browser, u as SuspendOptions } from "./internal/Browser-DD9Vm1c-.mjs";
|
|
2
|
+
export { Browser, CaptureSource, EventOptions, InitScript, Options, RequestDecision, RequestPolicy, Service, SuspendOptions, Suspension, make, newPage };
|
package/dist/Browser.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as make, r as Suspension, t as Browser } from "./Browser-
|
|
2
|
-
export { Browser, Suspension, make };
|
|
1
|
+
import { a as newPage, i as make, r as Suspension, t as Browser } from "./internal/Browser-vzD7i2oj.mjs";
|
|
2
|
+
export { Browser, Suspension, make, newPage };
|
package/dist/BrowserError.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { BrowserError, Busy, Closed, Consequence, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout,
|
|
1
|
+
import { C as isBrowserError, D as undispatched, E as refuse, S as failWith, T as reasonOf, _ as Suspended, a as Closed, b as call, c as Failed, d as NavigationFailed, f as NotActionable, g as StaleRef, h as PolicyTimeout, i as Busy, l as InvalidRequest, m as PolicyDenied, n as BrowserErrorReason, o as Consequence, p as NotFound, s as EventHistoryExpired, t as BrowserError, u as Limit, v as Threw, w as isBrowserErrorReason, x as consequence, y as Timeout } from "./internal/BrowserError-CsuRYcDX.mjs";
|
|
2
|
+
export { BrowserError, BrowserErrorReason, Busy, Closed, Consequence, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout, StaleRef, Suspended, Threw, Timeout, call, consequence, failWith, isBrowserError, isBrowserErrorReason, reasonOf, refuse, undispatched };
|
package/dist/BrowserError.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { redactWithin } from "./
|
|
1
|
+
import { t as __exportAll } from "./internal/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { a as redactWithin } from "./internal/url-DB0pQYk6.mjs";
|
|
3
3
|
import { DisconnectCause } from "./BrowserEvent.mjs";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
//#region src/BrowserError.ts
|
|
@@ -11,10 +11,12 @@ import { Effect, Schema } from "effect";
|
|
|
11
11
|
* reached the browser first. `consequence` says what that leaves: what was lost, and whether the
|
|
12
12
|
* call can be repeated. `message` is a sentence for operators.
|
|
13
13
|
*
|
|
14
|
+
* @stability stable
|
|
14
15
|
* @since 0.3.0
|
|
15
16
|
*/
|
|
16
17
|
var BrowserError_exports = /* @__PURE__ */ __exportAll({
|
|
17
18
|
BrowserError: () => BrowserError,
|
|
19
|
+
BrowserErrorReason: () => BrowserErrorReason,
|
|
18
20
|
Busy: () => Busy,
|
|
19
21
|
Closed: () => Closed,
|
|
20
22
|
EventHistoryExpired: () => EventHistoryExpired,
|
|
@@ -26,7 +28,6 @@ var BrowserError_exports = /* @__PURE__ */ __exportAll({
|
|
|
26
28
|
NotFound: () => NotFound,
|
|
27
29
|
PolicyDenied: () => PolicyDenied,
|
|
28
30
|
PolicyTimeout: () => PolicyTimeout,
|
|
29
|
-
Reason: () => Reason,
|
|
30
31
|
StaleRef: () => StaleRef,
|
|
31
32
|
Suspended: () => Suspended,
|
|
32
33
|
Threw: () => Threw,
|
|
@@ -34,12 +35,20 @@ var BrowserError_exports = /* @__PURE__ */ __exportAll({
|
|
|
34
35
|
call: () => call,
|
|
35
36
|
consequence: () => consequence,
|
|
36
37
|
failWith: () => failWith,
|
|
38
|
+
isBrowserError: () => isBrowserError,
|
|
39
|
+
isBrowserErrorReason: () => isBrowserErrorReason,
|
|
37
40
|
reasonOf: () => reasonOf,
|
|
38
41
|
refuse: () => refuse,
|
|
39
42
|
undispatched: () => undispatched
|
|
40
43
|
});
|
|
41
|
-
/**
|
|
42
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The operation did not finish in time.
|
|
46
|
+
*
|
|
47
|
+
* @stability stable
|
|
48
|
+
* @category errors
|
|
49
|
+
* @since 0.3.0
|
|
50
|
+
*/
|
|
51
|
+
var Timeout = class extends Schema.TaggedError("effect-browser/BrowserError/Timeout")("Timeout", { millis: Schema.Finite }) {
|
|
43
52
|
get message() {
|
|
44
53
|
return `timed out after ${this.millis} ms`;
|
|
45
54
|
}
|
|
@@ -47,8 +56,12 @@ var Timeout = class extends Schema.TaggedError()("Timeout", { millis: Schema.Fin
|
|
|
47
56
|
/**
|
|
48
57
|
* The operation waited its turn behind others on its page and was not given one in time, or was
|
|
49
58
|
* asked to fail fast: the page may be well, only busy.
|
|
59
|
+
*
|
|
60
|
+
* @stability stable
|
|
61
|
+
* @category errors
|
|
62
|
+
* @since 0.3.0
|
|
50
63
|
*/
|
|
51
|
-
var Busy = class extends Schema.TaggedError()("Busy", {
|
|
64
|
+
var Busy = class extends Schema.TaggedError("effect-browser/BrowserError/Busy")("Busy", {
|
|
52
65
|
waitedMillis: Schema.Finite,
|
|
53
66
|
/** The operations ahead of it: those holding the page and those asked before it. */
|
|
54
67
|
ahead: Schema.Int
|
|
@@ -58,38 +71,74 @@ var Busy = class extends Schema.TaggedError()("Busy", {
|
|
|
58
71
|
return `the page was busy: it waited ${this.waitedMillis} ms behind ${this.ahead} other ${others}`;
|
|
59
72
|
}
|
|
60
73
|
};
|
|
61
|
-
/**
|
|
62
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Input is withheld by a scoped suspension; nothing was dispatched.
|
|
76
|
+
*
|
|
77
|
+
* @stability stable
|
|
78
|
+
* @category errors
|
|
79
|
+
* @since 0.3.0
|
|
80
|
+
*/
|
|
81
|
+
var Suspended = class extends Schema.TaggedError("effect-browser/BrowserError/Suspended")("Suspended", {}) {
|
|
63
82
|
get message() {
|
|
64
83
|
return "browser input is suspended";
|
|
65
84
|
}
|
|
66
85
|
};
|
|
67
|
-
/**
|
|
68
|
-
|
|
86
|
+
/**
|
|
87
|
+
* The browser has as many pages open as `maxPages` allows, and none closed in time.
|
|
88
|
+
*
|
|
89
|
+
* @stability stable
|
|
90
|
+
* @category errors
|
|
91
|
+
* @since 0.3.0
|
|
92
|
+
*/
|
|
93
|
+
var Limit = class extends Schema.TaggedError("effect-browser/BrowserError/Limit")("Limit", { maxPages: Schema.Int }) {
|
|
69
94
|
get message() {
|
|
70
95
|
return `the browser already has ${this.maxPages} pages open, as many as it allows`;
|
|
71
96
|
}
|
|
72
97
|
};
|
|
73
|
-
/**
|
|
74
|
-
|
|
98
|
+
/**
|
|
99
|
+
* A ref from an earlier snapshot no longer names an element on the page.
|
|
100
|
+
*
|
|
101
|
+
* @stability stable
|
|
102
|
+
* @category errors
|
|
103
|
+
* @since 0.3.0
|
|
104
|
+
*/
|
|
105
|
+
var StaleRef = class extends Schema.TaggedError("effect-browser/BrowserError/StaleRef")("StaleRef", { ref: Schema.String }) {
|
|
75
106
|
get message() {
|
|
76
107
|
return `${this.ref} is not on the page any more`;
|
|
77
108
|
}
|
|
78
109
|
};
|
|
79
|
-
/**
|
|
80
|
-
|
|
110
|
+
/**
|
|
111
|
+
* What the operation looked for is not on the page.
|
|
112
|
+
*
|
|
113
|
+
* @stability stable
|
|
114
|
+
* @category errors
|
|
115
|
+
* @since 0.3.0
|
|
116
|
+
*/
|
|
117
|
+
var NotFound = class extends Schema.TaggedError("effect-browser/BrowserError/NotFound")("NotFound", { target: Schema.String }) {
|
|
81
118
|
get message() {
|
|
82
119
|
return `${this.target} was not found`;
|
|
83
120
|
}
|
|
84
121
|
};
|
|
85
|
-
/**
|
|
86
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The element exists but cannot take this input: covered, disabled, hidden or the wrong kind.
|
|
124
|
+
*
|
|
125
|
+
* @stability stable
|
|
126
|
+
* @category errors
|
|
127
|
+
* @since 0.3.0
|
|
128
|
+
*/
|
|
129
|
+
var NotActionable = class extends Schema.TaggedError("effect-browser/BrowserError/NotActionable")("NotActionable", { detail: Schema.String }) {
|
|
87
130
|
get message() {
|
|
88
131
|
return this.detail;
|
|
89
132
|
}
|
|
90
133
|
};
|
|
91
|
-
/**
|
|
92
|
-
|
|
134
|
+
/**
|
|
135
|
+
* A navigation failed, for example on a DNS error or a refused connection.
|
|
136
|
+
*
|
|
137
|
+
* @stability stable
|
|
138
|
+
* @category errors
|
|
139
|
+
* @since 0.3.0
|
|
140
|
+
*/
|
|
141
|
+
var NavigationFailed = class extends Schema.TaggedError("effect-browser/BrowserError/NavigationFailed")("NavigationFailed", {
|
|
93
142
|
url: Schema.String,
|
|
94
143
|
detail: Schema.String
|
|
95
144
|
}) {
|
|
@@ -107,8 +156,12 @@ const closedBy = {
|
|
|
107
156
|
/**
|
|
108
157
|
* The page is gone: it was closed (`page`) or crashed, or its browser was lost for one of the
|
|
109
158
|
* browser's `DisconnectCause`s.
|
|
159
|
+
*
|
|
160
|
+
* @stability stable
|
|
161
|
+
* @category errors
|
|
162
|
+
* @since 0.3.0
|
|
110
163
|
*/
|
|
111
|
-
var Closed = class extends Schema.TaggedError()("Closed", { cause: Schema.Literals([
|
|
164
|
+
var Closed = class extends Schema.TaggedError("effect-browser/BrowserError/Closed")("Closed", { cause: Schema.Literals([
|
|
112
165
|
"page",
|
|
113
166
|
"crashed",
|
|
114
167
|
...DisconnectCause.literals
|
|
@@ -117,14 +170,26 @@ var Closed = class extends Schema.TaggedError()("Closed", { cause: Schema.Litera
|
|
|
117
170
|
return closedBy[this.cause];
|
|
118
171
|
}
|
|
119
172
|
};
|
|
120
|
-
/**
|
|
121
|
-
|
|
173
|
+
/**
|
|
174
|
+
* The request itself is invalid, such as a ref that is not a ref or a point off the screen.
|
|
175
|
+
*
|
|
176
|
+
* @stability stable
|
|
177
|
+
* @category errors
|
|
178
|
+
* @since 0.3.0
|
|
179
|
+
*/
|
|
180
|
+
var InvalidRequest = class extends Schema.TaggedError("effect-browser/BrowserError/InvalidRequest")("InvalidRequest", { detail: Schema.String }) {
|
|
122
181
|
get message() {
|
|
123
182
|
return this.detail;
|
|
124
183
|
}
|
|
125
184
|
};
|
|
126
|
-
/**
|
|
127
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The input policy refused the action before any input was sent.
|
|
187
|
+
*
|
|
188
|
+
* @stability stable
|
|
189
|
+
* @category errors
|
|
190
|
+
* @since 0.3.0
|
|
191
|
+
*/
|
|
192
|
+
var PolicyDenied = class extends Schema.TaggedError("effect-browser/BrowserError/PolicyDenied")("PolicyDenied", {
|
|
128
193
|
detail: Schema.String,
|
|
129
194
|
/** What made the policy deny, such as the failure of the judge it asked. */
|
|
130
195
|
cause: Schema.optional(Schema.Defect())
|
|
@@ -133,14 +198,26 @@ var PolicyDenied = class extends Schema.TaggedError()("PolicyDenied", {
|
|
|
133
198
|
return `the input policy denied this action: ${this.detail}`;
|
|
134
199
|
}
|
|
135
200
|
};
|
|
136
|
-
/**
|
|
137
|
-
|
|
201
|
+
/**
|
|
202
|
+
* The input policy did not release its hold within its own bound.
|
|
203
|
+
*
|
|
204
|
+
* @stability stable
|
|
205
|
+
* @category errors
|
|
206
|
+
* @since 0.3.0
|
|
207
|
+
*/
|
|
208
|
+
var PolicyTimeout = class extends Schema.TaggedError("effect-browser/BrowserError/PolicyTimeout")("PolicyTimeout", { millis: Schema.Finite }) {
|
|
138
209
|
get message() {
|
|
139
210
|
return `the input policy did not allow this action within ${this.millis} ms`;
|
|
140
211
|
}
|
|
141
212
|
};
|
|
142
|
-
/**
|
|
143
|
-
|
|
213
|
+
/**
|
|
214
|
+
* The requested event cursor fell behind the browser's bounded replay history.
|
|
215
|
+
*
|
|
216
|
+
* @stability stable
|
|
217
|
+
* @category errors
|
|
218
|
+
* @since 0.3.0
|
|
219
|
+
*/
|
|
220
|
+
var EventHistoryExpired = class extends Schema.TaggedError("effect-browser/BrowserError/EventHistoryExpired")("EventHistoryExpired", {
|
|
144
221
|
after: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
145
222
|
oldest: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
146
223
|
latest: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
@@ -149,19 +226,38 @@ var EventHistoryExpired = class extends Schema.TaggedError()("EventHistoryExpire
|
|
|
149
226
|
return `event history after ${this.after} expired; retained sequences are ${this.oldest}–${this.latest}`;
|
|
150
227
|
}
|
|
151
228
|
};
|
|
152
|
-
/**
|
|
153
|
-
|
|
229
|
+
/**
|
|
230
|
+
* The browser, the connection or the provider failed in a way the other reasons do not cover.
|
|
231
|
+
*
|
|
232
|
+
* @stability stable
|
|
233
|
+
* @category errors
|
|
234
|
+
* @since 0.3.0
|
|
235
|
+
*/
|
|
236
|
+
var Failed = class extends Schema.TaggedError("effect-browser/BrowserError/Failed")("Failed", { detail: Schema.String }) {
|
|
154
237
|
get message() {
|
|
155
238
|
return this.detail;
|
|
156
239
|
}
|
|
157
240
|
};
|
|
158
|
-
/**
|
|
159
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Caller code threw in the page's main world. Its source and payload stay private.
|
|
243
|
+
*
|
|
244
|
+
* @stability stable
|
|
245
|
+
* @category errors
|
|
246
|
+
* @since 0.3.0
|
|
247
|
+
*/
|
|
248
|
+
var Threw = class extends Schema.TaggedError("effect-browser/BrowserError/Threw")("Threw", {}) {
|
|
160
249
|
get message() {
|
|
161
250
|
return "the page script threw";
|
|
162
251
|
}
|
|
163
252
|
};
|
|
164
|
-
|
|
253
|
+
/**
|
|
254
|
+
* What went wrong, as `BrowserError`'s `reason`.
|
|
255
|
+
*
|
|
256
|
+
* @stability stable
|
|
257
|
+
* @category errors
|
|
258
|
+
* @since 0.3.0
|
|
259
|
+
*/
|
|
260
|
+
const BrowserErrorReason = Schema.Union([
|
|
165
261
|
Timeout,
|
|
166
262
|
Busy,
|
|
167
263
|
Suspended,
|
|
@@ -178,16 +274,43 @@ const Reason = Schema.Union([
|
|
|
178
274
|
Failed,
|
|
179
275
|
Threw
|
|
180
276
|
]);
|
|
181
|
-
|
|
277
|
+
/**
|
|
278
|
+
* @stability stable
|
|
279
|
+
* @category errors
|
|
280
|
+
* @since 0.3.0
|
|
281
|
+
*/
|
|
282
|
+
var BrowserError = class extends Schema.TaggedError("effect-browser/BrowserError")("BrowserError", {
|
|
182
283
|
operation: Schema.String,
|
|
183
|
-
reason:
|
|
284
|
+
reason: BrowserErrorReason,
|
|
184
285
|
dispatched: Schema.Boolean
|
|
185
286
|
}) {
|
|
186
287
|
get message() {
|
|
187
288
|
return `${this.operation} failed${this.dispatched ? " after it was sent" : ""}: ${this.reason.message}`;
|
|
188
289
|
}
|
|
189
290
|
};
|
|
190
|
-
/**
|
|
291
|
+
/**
|
|
292
|
+
* Whether a value is a `BrowserError`.
|
|
293
|
+
*
|
|
294
|
+
* @stability stable
|
|
295
|
+
* @category guards
|
|
296
|
+
* @since 0.3.0
|
|
297
|
+
*/
|
|
298
|
+
const isBrowserError = Schema.is(BrowserError);
|
|
299
|
+
/**
|
|
300
|
+
* Whether a value is one of `BrowserError`'s reasons.
|
|
301
|
+
*
|
|
302
|
+
* @stability stable
|
|
303
|
+
* @category guards
|
|
304
|
+
* @since 0.3.0
|
|
305
|
+
*/
|
|
306
|
+
const isBrowserErrorReason = Schema.is(BrowserErrorReason);
|
|
307
|
+
/**
|
|
308
|
+
* What `error` leaves, from its reason and whether it was dispatched alone.
|
|
309
|
+
*
|
|
310
|
+
* @stability stable
|
|
311
|
+
* @category combinators
|
|
312
|
+
* @since 0.3.0
|
|
313
|
+
*/
|
|
191
314
|
const consequence = ({ reason, dispatched }) => {
|
|
192
315
|
const repeat = dispatched ? "check" : "safe";
|
|
193
316
|
switch (reason._tag) {
|
|
@@ -220,29 +343,59 @@ const consequence = ({ reason, dispatched }) => {
|
|
|
220
343
|
};
|
|
221
344
|
}
|
|
222
345
|
};
|
|
223
|
-
/**
|
|
346
|
+
/**
|
|
347
|
+
* A failure before any of the operation's input reached the page.
|
|
348
|
+
*
|
|
349
|
+
* @stability stable
|
|
350
|
+
* @category constructors
|
|
351
|
+
* @since 0.3.0
|
|
352
|
+
*/
|
|
224
353
|
const undispatched = (operation, reason) => new BrowserError({
|
|
225
354
|
operation,
|
|
226
355
|
reason,
|
|
227
356
|
dispatched: false
|
|
228
357
|
});
|
|
229
|
-
/**
|
|
358
|
+
/**
|
|
359
|
+
* Fail an operation before dispatch, preserving its typed reason.
|
|
360
|
+
*
|
|
361
|
+
* @stability stable
|
|
362
|
+
* @category constructors
|
|
363
|
+
* @since 0.3.0
|
|
364
|
+
*/
|
|
230
365
|
const failWith = (operation, reason) => Effect.fail(undispatched(operation, reason));
|
|
231
|
-
/**
|
|
366
|
+
/**
|
|
367
|
+
* Refuse an invalid request before sending anything.
|
|
368
|
+
*
|
|
369
|
+
* @stability stable
|
|
370
|
+
* @category constructors
|
|
371
|
+
* @since 0.3.0
|
|
372
|
+
*/
|
|
232
373
|
const refuse = (operation, detail) => failWith(operation, new InvalidRequest({ detail }));
|
|
233
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Translate a protocol/provider failure, redacting diagnostic addresses by default.
|
|
376
|
+
*
|
|
377
|
+
* @stability stable
|
|
378
|
+
* @category constructors
|
|
379
|
+
* @since 0.3.0
|
|
380
|
+
*/
|
|
234
381
|
const reasonOf = (cause, timeoutMillis, closed = "connection", redact = redactWithin) => {
|
|
235
382
|
const message = cause instanceof Error ? cause.message : typeof cause === "string" ? cause : "unknown error";
|
|
236
383
|
if (/has been closed|Target closed|Session closed|browser has disconnected|Target page, context or browser/i.test(message)) return new Closed({ cause: closed });
|
|
237
384
|
if (cause instanceof Error && cause.name === "TimeoutError" && timeoutMillis !== void 0) return new Timeout({ millis: timeoutMillis });
|
|
238
385
|
return new Failed({ detail: (redact(message).split("\n")[0] ?? "unknown error").replace(/^[\w.]+: /, "") });
|
|
239
386
|
};
|
|
240
|
-
/**
|
|
387
|
+
/**
|
|
388
|
+
* A native call whose action wrapper owns any later dispatch evidence.
|
|
389
|
+
*
|
|
390
|
+
* @stability stable
|
|
391
|
+
* @category constructors
|
|
392
|
+
* @since 0.3.0
|
|
393
|
+
*/
|
|
241
394
|
const call = (operation, run, closedBy, timeoutMillis) => Effect.tryPromise({
|
|
242
395
|
try: run,
|
|
243
396
|
catch: (cause) => undispatched(operation, reasonOf(cause, timeoutMillis, closedBy()))
|
|
244
397
|
});
|
|
245
398
|
//#endregion
|
|
246
|
-
export { BrowserError, Busy, Closed, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout,
|
|
399
|
+
export { BrowserError, BrowserErrorReason, Busy, Closed, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout, StaleRef, Suspended, Threw, Timeout, call, consequence, failWith, isBrowserError, isBrowserErrorReason, reasonOf, refuse, BrowserError_exports as t, undispatched };
|
|
247
400
|
|
|
248
401
|
//# sourceMappingURL=BrowserError.mjs.map
|