effect-browser 0.2.0-beta.9 → 0.3.0-beta.6
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 +707 -1184
- package/dist/Browser-B5AV7zPS.mjs +437 -0
- package/dist/Browser-B5AV7zPS.mjs.map +1 -0
- package/dist/Browser.d.mts +115 -3
- package/dist/Browser.mjs +2 -22
- package/dist/BrowserError-DXXIA6Rk.d.mts +135 -0
- package/dist/BrowserError.d.mts +2 -0
- package/dist/BrowserError.mjs +202 -0
- package/dist/BrowserError.mjs.map +1 -0
- package/dist/BrowserEvent-DzdNdvoh.d.mts +277 -0
- package/dist/BrowserEvent.d.mts +2 -0
- package/dist/BrowserEvent.mjs +295 -0
- package/dist/BrowserEvent.mjs.map +1 -0
- package/dist/Cdp.d.mts +32 -0
- package/dist/Cdp.mjs +61 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change-DNvztNLu.mjs +138 -0
- package/dist/Change-DNvztNLu.mjs.map +1 -0
- package/dist/Change-DVP2IJWm.d.mts +71 -0
- package/dist/Change.d.mts +2 -0
- package/dist/Change.mjs +2 -0
- package/dist/Chromium.d.mts +29 -81
- package/dist/Chromium.mjs +57 -392
- package/dist/Chromium.mjs.map +1 -1
- package/dist/Expect.d.mts +62 -0
- package/dist/Expect.mjs +114 -0
- package/dist/Expect.mjs.map +1 -0
- package/dist/Frame-BERmf_gM.d.mts +117 -0
- package/dist/Frame.d.mts +2 -0
- package/dist/Frame.mjs +123 -0
- package/dist/Frame.mjs.map +1 -0
- package/dist/Moment.d.mts +2 -0
- package/dist/Moment.mjs +288 -0
- package/dist/Moment.mjs.map +1 -0
- package/dist/Motion.d.mts +40 -0
- package/dist/Motion.mjs +122 -0
- package/dist/Motion.mjs.map +1 -0
- package/dist/Page-D4281dIi.mjs +618 -0
- package/dist/Page-D4281dIi.mjs.map +1 -0
- package/dist/Page-DYTdVhYa.d.mts +593 -0
- package/dist/Page.d.mts +2 -0
- package/dist/Page.mjs +2 -0
- package/dist/Plan-5MdsRzE5.mjs +314 -0
- package/dist/Plan-5MdsRzE5.mjs.map +1 -0
- package/dist/Plan-CNNOU1Tx.d.mts +112 -0
- package/dist/Plan.d.mts +2 -3
- package/dist/Plan.mjs +2 -2
- package/dist/Policy.d.mts +76 -0
- package/dist/Policy.mjs +237 -0
- package/dist/Policy.mjs.map +1 -0
- package/dist/Presentation.d.mts +48 -0
- package/dist/Presentation.mjs +117 -0
- package/dist/Presentation.mjs.map +1 -0
- package/dist/Snapshot-B34hZ4Jl.d.mts +68 -0
- package/dist/Snapshot.d.mts +2 -0
- package/dist/Snapshot.mjs +79 -0
- package/dist/Snapshot.mjs.map +1 -0
- package/dist/Stage.d.mts +54 -0
- package/dist/Stage.mjs +133 -0
- package/dist/Stage.mjs.map +1 -0
- package/dist/Supervisor-BtEG93gR.mjs +420 -0
- package/dist/Supervisor-BtEG93gR.mjs.map +1 -0
- package/dist/Supervisor-Im6-wbg5.d.mts +230 -0
- package/dist/Supervisor.d.mts +2 -0
- package/dist/Supervisor.mjs +2 -0
- package/dist/context-DAYjATgC.mjs +137 -0
- package/dist/context-DAYjATgC.mjs.map +1 -0
- package/dist/index.d.mts +17 -14
- package/dist/index.mjs +18 -13
- package/dist/match.inpage-xOe9LNO0.mjs +48 -0
- package/dist/match.inpage-xOe9LNO0.mjs.map +1 -0
- package/dist/page-BkRcLCWZ.mjs +5097 -0
- package/dist/page-BkRcLCWZ.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/url-CcL0K7S0.mjs +262 -0
- package/dist/url-CcL0K7S0.mjs.map +1 -0
- package/package.json +96 -61
- package/src/Browser.ts +625 -0
- package/src/BrowserError.ts +225 -0
- package/src/BrowserEvent.ts +294 -0
- package/src/Cdp.ts +101 -0
- package/src/Change.ts +88 -0
- package/src/Chromium.ts +102 -0
- package/src/Expect.ts +180 -0
- package/src/Frame.ts +130 -0
- package/src/Moment.ts +479 -0
- package/src/Motion.ts +166 -0
- package/src/Page.ts +520 -0
- package/src/Plan.ts +354 -0
- package/src/Policy.ts +325 -0
- package/src/Presentation.ts +195 -0
- package/src/Snapshot.ts +89 -0
- package/src/Stage.ts +223 -0
- package/src/Supervisor.ts +353 -0
- package/src/index.ts +20 -0
- package/src/internal/input/actions.ts +610 -0
- package/src/internal/input/dispatch.ts +161 -0
- package/src/internal/input/edit.inpage.ts +162 -0
- package/src/internal/input/evidence.inpage.ts +164 -0
- package/src/internal/input/guard.inpage.ts +605 -0
- package/src/internal/input/guard.ts +183 -0
- package/src/internal/input/keyboard.ts +112 -0
- package/src/internal/input/keys.ts +127 -0
- package/src/internal/input/perform.ts +322 -0
- package/src/internal/input/pointer.ts +153 -0
- package/src/internal/input/replies.ts +159 -0
- package/src/internal/input/settle.ts +50 -0
- package/src/internal/input/style.ts +186 -0
- package/src/internal/input/targets.inpage.ts +293 -0
- package/src/internal/input/targets.ts +148 -0
- package/src/internal/page/bridge.ts +386 -0
- package/src/internal/page/context.ts +302 -0
- package/src/internal/page/lane.ts +301 -0
- package/src/internal/page/navigation.ts +183 -0
- package/src/internal/page/openings.ts +87 -0
- package/src/internal/page/page.ts +137 -0
- package/src/internal/page/url.ts +100 -0
- package/src/internal/page/viewport.ts +43 -0
- package/src/internal/pictures/capture.ts +778 -0
- package/src/internal/pictures/clock.ts +141 -0
- package/src/internal/pictures/pictures.ts +520 -0
- package/src/internal/pictures/transport.ts +242 -0
- package/src/internal/reading/choose.ts +100 -0
- package/src/internal/reading/context.inpage.ts +201 -0
- package/src/internal/reading/controls.inpage.ts +158 -0
- package/src/internal/reading/expect.inpage.ts +70 -0
- package/src/internal/reading/match.inpage.ts +92 -0
- package/src/internal/reading/names.inpage.ts +306 -0
- package/src/internal/reading/outline.inpage.ts +260 -0
- package/src/internal/reading/reading.ts +223 -0
- package/src/internal/reading/ready.inpage.ts +154 -0
- package/src/internal/reading/ready.ts +105 -0
- package/src/internal/reading/subjects.inpage.ts +188 -0
- package/src/internal/reading/text.inpage.ts +135 -0
- package/src/internal/reading/walk.inpage.ts +220 -0
- package/src/internal/supervisor/lifecycle.ts +265 -0
- package/src/internal/timeline/changes.inpage.ts +216 -0
- package/src/internal/timeline/changes.ts +100 -0
- package/src/internal/timeline/events.ts +93 -0
- package/src/internal/timeline/fold.inpage.ts +123 -0
- package/src/internal/timeline/history.inpage.ts +229 -0
- package/src/internal/timeline/marks.inpage.ts +207 -0
- package/src/internal/timeline/record.inpage.ts +133 -0
- package/src/internal/timeline/sight.inpage.ts +122 -0
- package/src/internal/timeline/window.ts +96 -0
- package/src/internal/timeline/words.ts +65 -0
- package/dist/Bootstrap-B9UUXsvF.d.mts +0 -183
- package/dist/Bootstrap-CeQOWBy6.mjs +0 -189
- package/dist/Bootstrap-CeQOWBy6.mjs.map +0 -1
- package/dist/Bootstrap.d.mts +0 -3
- package/dist/Bootstrap.mjs +0 -2
- package/dist/Browser-BF9_sORP.d.mts +0 -388
- package/dist/Browser.mjs.map +0 -1
- package/dist/BrowserData-CPIIIHol.d.mts +0 -585
- package/dist/BrowserData.d.mts +0 -3
- package/dist/BrowserData.mjs +0 -695
- package/dist/BrowserData.mjs.map +0 -1
- package/dist/BrowserRuntime-B6nT1G4X.d.mts +0 -148
- package/dist/BrowserRuntime-C1r2aSRK.mjs +0 -6820
- package/dist/BrowserRuntime-C1r2aSRK.mjs.map +0 -1
- package/dist/BrowserRuntime.d.mts +0 -3
- package/dist/BrowserRuntime.mjs +0 -3
- package/dist/Capture.d.mts +0 -56
- package/dist/Capture.mjs +0 -678
- package/dist/Capture.mjs.map +0 -1
- package/dist/CaptureData-CYriZHX1.mjs +0 -201
- package/dist/CaptureData-CYriZHX1.mjs.map +0 -1
- package/dist/CaptureData.d.mts +0 -219
- package/dist/CaptureData.mjs +0 -2
- package/dist/Errors.d.mts +0 -158
- package/dist/Errors.mjs +0 -207
- package/dist/Errors.mjs.map +0 -1
- package/dist/Images-yCG9BmRU.mjs +0 -76
- package/dist/Images-yCG9BmRU.mjs.map +0 -1
- package/dist/OperationOptions-DAeRS6O9.mjs +0 -55
- package/dist/OperationOptions-DAeRS6O9.mjs.map +0 -1
- package/dist/PageControl.d.mts +0 -15
- package/dist/PageControl.mjs +0 -34
- package/dist/PageControl.mjs.map +0 -1
- package/dist/PageRegistry-B3q9DS3g.mjs +0 -164
- package/dist/PageRegistry-B3q9DS3g.mjs.map +0 -1
- package/dist/Plan-Dyxu2q8C.mjs +0 -543
- package/dist/Plan-Dyxu2q8C.mjs.map +0 -1
- package/dist/PlanData-B668RxbQ.d.mts +0 -4831
- package/dist/PlanData.d.mts +0 -3
- package/dist/PlanData.mjs +0 -268
- package/dist/PlanData.mjs.map +0 -1
- package/dist/PlanInput-BJcPPncs.mjs +0 -75
- package/dist/PlanInput-BJcPPncs.mjs.map +0 -1
- package/dist/PublicSession-DCSMMqOj.mjs +0 -5602
- package/dist/PublicSession-DCSMMqOj.mjs.map +0 -1
- package/dist/Testing.d.mts +0 -479
- package/dist/Testing.mjs +0 -2147
- package/dist/Testing.mjs.map +0 -1
- package/dist/Timeline-fV22Xk-S.d.mts +0 -29
- package/dist/Timeline.d.mts +0 -4
- package/dist/Timeline.mjs +0 -20
- package/dist/Timeline.mjs.map +0 -1
- package/dist/TimelineData-BsOn-YGZ.d.mts +0 -3818
- package/dist/TimelineData.d.mts +0 -3
- package/dist/TimelineData.mjs +0 -482
- package/dist/TimelineData.mjs.map +0 -1
package/dist/Browser.mjs
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { dual } from "effect/Function";
|
|
4
|
-
//#region src/Browser.ts
|
|
5
|
-
/**
|
|
6
|
-
* Check that `page` is a Page or Frame this session issued, by identity, and that its authority
|
|
7
|
-
* is still current: a foreign or copied object fails `UnregisteredSession`, a closed, stale or
|
|
8
|
-
* detached one fails with the same refusal its own operations would report. Adapters such as
|
|
9
|
-
* agent-browser hosts call it once when they bind, so a wrong target fails before any work.
|
|
10
|
-
*/
|
|
11
|
-
const checkPage = (session, page) => resolveTargetControlsForSession(session, page).pipe(Effect.asVoid);
|
|
12
|
-
/**
|
|
13
|
-
* Acquire, supervise and close one browser in a fresh scope. The callback keeps the concrete
|
|
14
|
-
* Chromium or provider session type. Its scoped work is joined before checked browser cleanup,
|
|
15
|
-
* and cleanup failures remain typed even when the callback has already failed or was cancelled.
|
|
16
|
-
* Acquisition is evaluated once; an uncertain result is never retried.
|
|
17
|
-
*/
|
|
18
|
-
const scoped = dual(2, (open, f) => Effect.scoped(Effect.flatMap(open, (session) => Effect.scoped(Effect.raceFirst(session.failure, Effect.suspend(() => f(session)))).pipe(Effect.onExit(() => session.closeChecked)))));
|
|
19
|
-
//#endregion
|
|
20
|
-
export { checkPage, scoped };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=Browser.mjs.map
|
|
1
|
+
import { r as make, t as Browser } from "./Browser-B5AV7zPS.mjs";
|
|
2
|
+
export { Browser, make };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
declare namespace BrowserError_d_exports {
|
|
3
|
+
export { BrowserError, Busy, Closed, Consequence, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout, Reason, StaleRef, Timeout, consequence };
|
|
4
|
+
}
|
|
5
|
+
declare const Timeout_base: Schema.Class<Timeout, Schema.TaggedStruct<"Timeout", {
|
|
6
|
+
readonly millis: Schema.Finite;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
/** The operation did not finish in time. */
|
|
9
|
+
declare class Timeout extends Timeout_base {
|
|
10
|
+
get message(): string;
|
|
11
|
+
}
|
|
12
|
+
declare const Busy_base: Schema.Class<Busy, Schema.TaggedStruct<"Busy", {
|
|
13
|
+
readonly waitedMillis: Schema.Finite;
|
|
14
|
+
/** The operations ahead of it: those holding the page and those asked before it. */
|
|
15
|
+
readonly ahead: Schema.Int;
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
17
|
+
/**
|
|
18
|
+
* The operation waited its turn behind others on its page and was not given one in time, or was
|
|
19
|
+
* asked to fail fast: the page may be well, only busy.
|
|
20
|
+
*/
|
|
21
|
+
declare class Busy extends Busy_base {
|
|
22
|
+
get message(): string;
|
|
23
|
+
}
|
|
24
|
+
declare const Limit_base: Schema.Class<Limit, Schema.TaggedStruct<"Limit", {
|
|
25
|
+
readonly maxPages: Schema.Int;
|
|
26
|
+
}>, import("effect/Cause").YieldableError>;
|
|
27
|
+
/** The browser has as many pages open as `maxPages` allows, and none closed in time. */
|
|
28
|
+
declare class Limit extends Limit_base {
|
|
29
|
+
get message(): string;
|
|
30
|
+
}
|
|
31
|
+
declare const StaleRef_base: Schema.Class<StaleRef, Schema.TaggedStruct<"StaleRef", {
|
|
32
|
+
readonly ref: Schema.String;
|
|
33
|
+
}>, import("effect/Cause").YieldableError>;
|
|
34
|
+
/** A ref from an earlier snapshot no longer names an element on the page. */
|
|
35
|
+
declare class StaleRef extends StaleRef_base {
|
|
36
|
+
get message(): string;
|
|
37
|
+
}
|
|
38
|
+
declare const NotFound_base: Schema.Class<NotFound, Schema.TaggedStruct<"NotFound", {
|
|
39
|
+
readonly target: Schema.String;
|
|
40
|
+
}>, import("effect/Cause").YieldableError>;
|
|
41
|
+
/** What the operation looked for is not on the page. */
|
|
42
|
+
declare class NotFound extends NotFound_base {
|
|
43
|
+
get message(): string;
|
|
44
|
+
}
|
|
45
|
+
declare const NotActionable_base: Schema.Class<NotActionable, Schema.TaggedStruct<"NotActionable", {
|
|
46
|
+
readonly detail: Schema.String;
|
|
47
|
+
}>, import("effect/Cause").YieldableError>;
|
|
48
|
+
/** The element exists but cannot take this input: covered, disabled, hidden or the wrong kind. */
|
|
49
|
+
declare class NotActionable extends NotActionable_base {
|
|
50
|
+
get message(): string;
|
|
51
|
+
}
|
|
52
|
+
declare const NavigationFailed_base: Schema.Class<NavigationFailed, Schema.TaggedStruct<"NavigationFailed", {
|
|
53
|
+
readonly url: Schema.String;
|
|
54
|
+
readonly detail: Schema.String;
|
|
55
|
+
}>, import("effect/Cause").YieldableError>;
|
|
56
|
+
/** A navigation failed, for example on a DNS error or a refused connection. */
|
|
57
|
+
declare class NavigationFailed extends NavigationFailed_base {
|
|
58
|
+
get message(): string;
|
|
59
|
+
}
|
|
60
|
+
declare const Closed_base: Schema.Class<Closed, Schema.TaggedStruct<"Closed", {
|
|
61
|
+
readonly cause: Schema.Literals<readonly ["page", "crashed", "connection", "session", "released"]>;
|
|
62
|
+
}>, import("effect/Cause").YieldableError>;
|
|
63
|
+
/**
|
|
64
|
+
* The page is gone: it was closed (`page`) or crashed, or its browser was lost for one of the
|
|
65
|
+
* browser's `DisconnectCause`s.
|
|
66
|
+
*/
|
|
67
|
+
declare class Closed extends Closed_base {
|
|
68
|
+
get message(): string;
|
|
69
|
+
}
|
|
70
|
+
declare const InvalidRequest_base: Schema.Class<InvalidRequest, Schema.TaggedStruct<"InvalidRequest", {
|
|
71
|
+
readonly detail: Schema.String;
|
|
72
|
+
}>, import("effect/Cause").YieldableError>;
|
|
73
|
+
/** The request itself is invalid, such as a ref that is not a ref or a point off the screen. */
|
|
74
|
+
declare class InvalidRequest extends InvalidRequest_base {
|
|
75
|
+
get message(): string;
|
|
76
|
+
}
|
|
77
|
+
declare const PolicyDenied_base: Schema.Class<PolicyDenied, Schema.TaggedStruct<"PolicyDenied", {
|
|
78
|
+
readonly detail: Schema.String;
|
|
79
|
+
/** What made the policy deny, such as the failure of the judge it asked. */
|
|
80
|
+
readonly cause: Schema.optional<Schema.Defect>;
|
|
81
|
+
}>, import("effect/Cause").YieldableError>;
|
|
82
|
+
/** The input policy refused the action before any input was sent. */
|
|
83
|
+
declare class PolicyDenied extends PolicyDenied_base {
|
|
84
|
+
get message(): string;
|
|
85
|
+
}
|
|
86
|
+
declare const PolicyTimeout_base: Schema.Class<PolicyTimeout, Schema.TaggedStruct<"PolicyTimeout", {
|
|
87
|
+
readonly millis: Schema.Finite;
|
|
88
|
+
}>, import("effect/Cause").YieldableError>;
|
|
89
|
+
/** The input policy did not release its hold within its own bound. */
|
|
90
|
+
declare class PolicyTimeout extends PolicyTimeout_base {
|
|
91
|
+
get message(): string;
|
|
92
|
+
}
|
|
93
|
+
declare const EventHistoryExpired_base: Schema.Class<EventHistoryExpired, Schema.TaggedStruct<"EventHistoryExpired", {
|
|
94
|
+
readonly after: Schema.Int;
|
|
95
|
+
readonly oldest: Schema.Int;
|
|
96
|
+
readonly latest: Schema.Int;
|
|
97
|
+
}>, import("effect/Cause").YieldableError>;
|
|
98
|
+
/** The requested event cursor fell behind the browser's bounded replay history. */
|
|
99
|
+
declare class EventHistoryExpired extends EventHistoryExpired_base {
|
|
100
|
+
get message(): string;
|
|
101
|
+
}
|
|
102
|
+
declare const Failed_base: Schema.Class<Failed, Schema.TaggedStruct<"Failed", {
|
|
103
|
+
readonly detail: Schema.String;
|
|
104
|
+
}>, import("effect/Cause").YieldableError>;
|
|
105
|
+
/** The browser, the connection or the provider failed in a way the other reasons do not cover. */
|
|
106
|
+
declare class Failed extends Failed_base {
|
|
107
|
+
get message(): string;
|
|
108
|
+
}
|
|
109
|
+
declare const Reason: Schema.Union<readonly [typeof Timeout, typeof Busy, typeof Limit, typeof StaleRef, typeof NotFound, typeof NotActionable, typeof NavigationFailed, typeof Closed, typeof InvalidRequest, typeof PolicyDenied, typeof PolicyTimeout, typeof EventHistoryExpired, typeof Failed]>;
|
|
110
|
+
type Reason = typeof Reason.Type;
|
|
111
|
+
declare const BrowserError_base: Schema.Class<BrowserError, Schema.TaggedStruct<"BrowserError", {
|
|
112
|
+
readonly operation: Schema.String;
|
|
113
|
+
readonly reason: Schema.Union<readonly [typeof Timeout, typeof Busy, typeof Limit, typeof StaleRef, typeof NotFound, typeof NotActionable, typeof NavigationFailed, typeof Closed, typeof InvalidRequest, typeof PolicyDenied, typeof PolicyTimeout, typeof EventHistoryExpired, typeof Failed]>;
|
|
114
|
+
readonly dispatched: Schema.Boolean;
|
|
115
|
+
}>, import("effect/Cause").YieldableError>;
|
|
116
|
+
declare class BrowserError extends BrowserError_base {
|
|
117
|
+
get message(): string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What a failure leaves. `lost` is `"page"` when the page is gone and its browser stands, and
|
|
121
|
+
* `"session"` when the browser is gone with its pages. `repeat` says whether the call can be made
|
|
122
|
+
* again, on what still stands: `"safe"`, as nothing reached the browser; `"check"`, as it may have
|
|
123
|
+
* taken effect, so look first, as an `Expect` attempt does; `"pointless"`, as it fails again unless
|
|
124
|
+
* something changes, such as
|
|
125
|
+
* a new ref; or `"resume"`, reading events again from a newer cursor.
|
|
126
|
+
*/
|
|
127
|
+
interface Consequence {
|
|
128
|
+
readonly lost: "nothing" | "page" | "session";
|
|
129
|
+
readonly repeat: "safe" | "check" | "pointless" | "resume";
|
|
130
|
+
}
|
|
131
|
+
/** What `error` leaves, from its reason and whether it was dispatched alone. */
|
|
132
|
+
declare const consequence: ({ reason, dispatched }: BrowserError) => Consequence;
|
|
133
|
+
//#endregion
|
|
134
|
+
export { Timeout as _, Consequence as a, InvalidRequest as c, NotActionable as d, NotFound as f, StaleRef as g, Reason as h, Closed as i, Limit as l, PolicyTimeout as m, BrowserError_d_exports as n, EventHistoryExpired as o, PolicyDenied as p, Busy as r, Failed as s, BrowserError as t, NavigationFailed as u, consequence as v };
|
|
135
|
+
//# sourceMappingURL=BrowserError-DXXIA6Rk.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as Timeout, a as Consequence, c as InvalidRequest, d as NotActionable, f as NotFound, g as StaleRef, h as Reason, i as Closed, l as Limit, m as PolicyTimeout, o as EventHistoryExpired, p as PolicyDenied, r as Busy, s as Failed, t as BrowserError, u as NavigationFailed, v as consequence } from "./BrowserError-DXXIA6Rk.mjs";
|
|
2
|
+
export { BrowserError, Busy, Closed, Consequence, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout, Reason, StaleRef, Timeout, consequence };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { DisconnectCause } from "./BrowserEvent.mjs";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
//#region src/BrowserError.ts
|
|
5
|
+
/**
|
|
6
|
+
* The one error every browser operation fails with.
|
|
7
|
+
*
|
|
8
|
+
* `reason` says what went wrong and `dispatched` says whether the action's own input (a press,
|
|
9
|
+
* key, wheel, selection or hover, not the pointer travelling toward a press) or a navigation
|
|
10
|
+
* reached the browser first. `consequence` says what that leaves: what was lost, and whether the
|
|
11
|
+
* call can be repeated. `message` is a sentence for operators.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.3.0
|
|
14
|
+
*/
|
|
15
|
+
var BrowserError_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
BrowserError: () => BrowserError,
|
|
17
|
+
Busy: () => Busy,
|
|
18
|
+
Closed: () => Closed,
|
|
19
|
+
EventHistoryExpired: () => EventHistoryExpired,
|
|
20
|
+
Failed: () => Failed,
|
|
21
|
+
InvalidRequest: () => InvalidRequest,
|
|
22
|
+
Limit: () => Limit,
|
|
23
|
+
NavigationFailed: () => NavigationFailed,
|
|
24
|
+
NotActionable: () => NotActionable,
|
|
25
|
+
NotFound: () => NotFound,
|
|
26
|
+
PolicyDenied: () => PolicyDenied,
|
|
27
|
+
PolicyTimeout: () => PolicyTimeout,
|
|
28
|
+
Reason: () => Reason,
|
|
29
|
+
StaleRef: () => StaleRef,
|
|
30
|
+
Timeout: () => Timeout,
|
|
31
|
+
consequence: () => consequence
|
|
32
|
+
});
|
|
33
|
+
/** The operation did not finish in time. */
|
|
34
|
+
var Timeout = class extends Schema.TaggedError()("Timeout", { millis: Schema.Finite }) {
|
|
35
|
+
get message() {
|
|
36
|
+
return `timed out after ${this.millis} ms`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The operation waited its turn behind others on its page and was not given one in time, or was
|
|
41
|
+
* asked to fail fast: the page may be well, only busy.
|
|
42
|
+
*/
|
|
43
|
+
var Busy = class extends Schema.TaggedError()("Busy", {
|
|
44
|
+
waitedMillis: Schema.Finite,
|
|
45
|
+
/** The operations ahead of it: those holding the page and those asked before it. */
|
|
46
|
+
ahead: Schema.Int
|
|
47
|
+
}) {
|
|
48
|
+
get message() {
|
|
49
|
+
const others = this.ahead === 1 ? "operation" : "operations";
|
|
50
|
+
return `the page was busy: it waited ${this.waitedMillis} ms behind ${this.ahead} other ${others}`;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/** The browser has as many pages open as `maxPages` allows, and none closed in time. */
|
|
54
|
+
var Limit = class extends Schema.TaggedError()("Limit", { maxPages: Schema.Int }) {
|
|
55
|
+
get message() {
|
|
56
|
+
return `the browser already has ${this.maxPages} pages open, as many as it allows`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/** A ref from an earlier snapshot no longer names an element on the page. */
|
|
60
|
+
var StaleRef = class extends Schema.TaggedError()("StaleRef", { ref: Schema.String }) {
|
|
61
|
+
get message() {
|
|
62
|
+
return `${this.ref} is not on the page any more`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/** What the operation looked for is not on the page. */
|
|
66
|
+
var NotFound = class extends Schema.TaggedError()("NotFound", { target: Schema.String }) {
|
|
67
|
+
get message() {
|
|
68
|
+
return `${this.target} was not found`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/** The element exists but cannot take this input: covered, disabled, hidden or the wrong kind. */
|
|
72
|
+
var NotActionable = class extends Schema.TaggedError()("NotActionable", { detail: Schema.String }) {
|
|
73
|
+
get message() {
|
|
74
|
+
return this.detail;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/** A navigation failed, for example on a DNS error or a refused connection. */
|
|
78
|
+
var NavigationFailed = class extends Schema.TaggedError()("NavigationFailed", {
|
|
79
|
+
url: Schema.String,
|
|
80
|
+
detail: Schema.String
|
|
81
|
+
}) {
|
|
82
|
+
get message() {
|
|
83
|
+
return `could not load ${this.url}: ${this.detail}`;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const closedBy = {
|
|
87
|
+
page: "the page was closed",
|
|
88
|
+
crashed: "the page crashed",
|
|
89
|
+
connection: "the connection to the browser was lost",
|
|
90
|
+
session: "the browser's session ended",
|
|
91
|
+
released: "the browser was released"
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The page is gone: it was closed (`page`) or crashed, or its browser was lost for one of the
|
|
95
|
+
* browser's `DisconnectCause`s.
|
|
96
|
+
*/
|
|
97
|
+
var Closed = class extends Schema.TaggedError()("Closed", { cause: Schema.Literals([
|
|
98
|
+
"page",
|
|
99
|
+
"crashed",
|
|
100
|
+
...DisconnectCause.literals
|
|
101
|
+
]) }) {
|
|
102
|
+
get message() {
|
|
103
|
+
return closedBy[this.cause];
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/** The request itself is invalid, such as a ref that is not a ref or a point off the screen. */
|
|
107
|
+
var InvalidRequest = class extends Schema.TaggedError()("InvalidRequest", { detail: Schema.String }) {
|
|
108
|
+
get message() {
|
|
109
|
+
return this.detail;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
/** The input policy refused the action before any input was sent. */
|
|
113
|
+
var PolicyDenied = class extends Schema.TaggedError()("PolicyDenied", {
|
|
114
|
+
detail: Schema.String,
|
|
115
|
+
/** What made the policy deny, such as the failure of the judge it asked. */
|
|
116
|
+
cause: Schema.optional(Schema.Defect())
|
|
117
|
+
}) {
|
|
118
|
+
get message() {
|
|
119
|
+
return `the input policy denied this action: ${this.detail}`;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/** The input policy did not release its hold within its own bound. */
|
|
123
|
+
var PolicyTimeout = class extends Schema.TaggedError()("PolicyTimeout", { millis: Schema.Finite }) {
|
|
124
|
+
get message() {
|
|
125
|
+
return `the input policy did not allow this action within ${this.millis} ms`;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
/** The requested event cursor fell behind the browser's bounded replay history. */
|
|
129
|
+
var EventHistoryExpired = class extends Schema.TaggedError()("EventHistoryExpired", {
|
|
130
|
+
after: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
131
|
+
oldest: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
132
|
+
latest: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
133
|
+
}) {
|
|
134
|
+
get message() {
|
|
135
|
+
return `event history after ${this.after} expired; retained sequences are ${this.oldest}–${this.latest}`;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
/** The browser, the connection or the provider failed in a way the other reasons do not cover. */
|
|
139
|
+
var Failed = class extends Schema.TaggedError()("Failed", { detail: Schema.String }) {
|
|
140
|
+
get message() {
|
|
141
|
+
return this.detail;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const Reason = Schema.Union([
|
|
145
|
+
Timeout,
|
|
146
|
+
Busy,
|
|
147
|
+
Limit,
|
|
148
|
+
StaleRef,
|
|
149
|
+
NotFound,
|
|
150
|
+
NotActionable,
|
|
151
|
+
NavigationFailed,
|
|
152
|
+
Closed,
|
|
153
|
+
InvalidRequest,
|
|
154
|
+
PolicyDenied,
|
|
155
|
+
PolicyTimeout,
|
|
156
|
+
EventHistoryExpired,
|
|
157
|
+
Failed
|
|
158
|
+
]);
|
|
159
|
+
var BrowserError = class extends Schema.TaggedError()("BrowserError", {
|
|
160
|
+
operation: Schema.String,
|
|
161
|
+
reason: Reason,
|
|
162
|
+
dispatched: Schema.Boolean
|
|
163
|
+
}) {
|
|
164
|
+
get message() {
|
|
165
|
+
return `${this.operation} failed${this.dispatched ? " after it was sent" : ""}: ${this.reason.message}`;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/** What `error` leaves, from its reason and whether it was dispatched alone. */
|
|
169
|
+
const consequence = ({ reason, dispatched }) => {
|
|
170
|
+
const repeat = dispatched ? "check" : "safe";
|
|
171
|
+
switch (reason._tag) {
|
|
172
|
+
case "Closed": return {
|
|
173
|
+
lost: reason.cause === "page" || reason.cause === "crashed" ? "page" : "session",
|
|
174
|
+
repeat
|
|
175
|
+
};
|
|
176
|
+
case "Busy":
|
|
177
|
+
case "Timeout":
|
|
178
|
+
case "Failed":
|
|
179
|
+
case "NavigationFailed": return {
|
|
180
|
+
lost: "nothing",
|
|
181
|
+
repeat
|
|
182
|
+
};
|
|
183
|
+
case "EventHistoryExpired": return {
|
|
184
|
+
lost: "nothing",
|
|
185
|
+
repeat: "resume"
|
|
186
|
+
};
|
|
187
|
+
case "StaleRef":
|
|
188
|
+
case "NotFound":
|
|
189
|
+
case "NotActionable":
|
|
190
|
+
case "InvalidRequest":
|
|
191
|
+
case "Limit":
|
|
192
|
+
case "PolicyDenied":
|
|
193
|
+
case "PolicyTimeout": return {
|
|
194
|
+
lost: "nothing",
|
|
195
|
+
repeat: "pointless"
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
//#endregion
|
|
200
|
+
export { BrowserError, Busy, Closed, EventHistoryExpired, Failed, InvalidRequest, Limit, NavigationFailed, NotActionable, NotFound, PolicyDenied, PolicyTimeout, Reason, StaleRef, Timeout, consequence, BrowserError_exports as t };
|
|
201
|
+
|
|
202
|
+
//# sourceMappingURL=BrowserError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserError.mjs","names":[],"sources":["../src/BrowserError.ts"],"sourcesContent":["/**\n * The one error every browser operation fails with.\n *\n * `reason` says what went wrong and `dispatched` says whether the action's own input (a press,\n * key, wheel, selection or hover, not the pointer travelling toward a press) or a navigation\n * reached the browser first. `consequence` says what that leaves: what was lost, and whether the\n * call can be repeated. `message` is a sentence for operators.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { DisconnectCause } from \"./BrowserEvent.ts\";\n\n/** The operation did not finish in time. */\nexport class Timeout extends Schema.TaggedError<Timeout>()(\"Timeout\", {\n millis: Schema.Finite,\n}) {\n override get message() {\n return `timed out after ${this.millis} ms`;\n }\n}\n\n/**\n * The operation waited its turn behind others on its page and was not given one in time, or was\n * asked to fail fast: the page may be well, only busy.\n */\nexport class Busy extends Schema.TaggedError<Busy>()(\"Busy\", {\n waitedMillis: Schema.Finite,\n /** The operations ahead of it: those holding the page and those asked before it. */\n ahead: Schema.Int,\n}) {\n override get message() {\n const others = this.ahead === 1 ? \"operation\" : \"operations\";\n\n return `the page was busy: it waited ${this.waitedMillis} ms behind ${this.ahead} other ${others}`;\n }\n}\n\n/** The browser has as many pages open as `maxPages` allows, and none closed in time. */\nexport class Limit extends Schema.TaggedError<Limit>()(\"Limit\", {\n maxPages: Schema.Int,\n}) {\n override get message() {\n return `the browser already has ${this.maxPages} pages open, as many as it allows`;\n }\n}\n\n/** A ref from an earlier snapshot no longer names an element on the page. */\nexport class StaleRef extends Schema.TaggedError<StaleRef>()(\"StaleRef\", {\n ref: Schema.String,\n}) {\n override get message() {\n return `${this.ref} is not on the page any more`;\n }\n}\n\n/** What the operation looked for is not on the page. */\nexport class NotFound extends Schema.TaggedError<NotFound>()(\"NotFound\", {\n target: Schema.String,\n}) {\n override get message() {\n return `${this.target} was not found`;\n }\n}\n\n/** The element exists but cannot take this input: covered, disabled, hidden or the wrong kind. */\nexport class NotActionable extends Schema.TaggedError<NotActionable>()(\"NotActionable\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\n/** A navigation failed, for example on a DNS error or a refused connection. */\nexport class NavigationFailed extends Schema.TaggedError<NavigationFailed>()(\"NavigationFailed\", {\n url: Schema.String,\n detail: Schema.String,\n}) {\n override get message() {\n return `could not load ${this.url}: ${this.detail}`;\n }\n}\n\nconst closedBy = {\n page: \"the page was closed\",\n crashed: \"the page crashed\",\n connection: \"the connection to the browser was lost\",\n session: \"the browser's session ended\",\n released: \"the browser was released\",\n};\n\n/**\n * The page is gone: it was closed (`page`) or crashed, or its browser was lost for one of the\n * browser's `DisconnectCause`s.\n */\nexport class Closed extends Schema.TaggedError<Closed>()(\"Closed\", {\n cause: Schema.Literals([\"page\", \"crashed\", ...DisconnectCause.literals]),\n}) {\n override get message() {\n return closedBy[this.cause];\n }\n}\n\n/** The request itself is invalid, such as a ref that is not a ref or a point off the screen. */\nexport class InvalidRequest extends Schema.TaggedError<InvalidRequest>()(\"InvalidRequest\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\n/** The input policy refused the action before any input was sent. */\nexport class PolicyDenied extends Schema.TaggedError<PolicyDenied>()(\"PolicyDenied\", {\n detail: Schema.String,\n /** What made the policy deny, such as the failure of the judge it asked. */\n cause: Schema.optional(Schema.Defect()),\n}) {\n override get message() {\n return `the input policy denied this action: ${this.detail}`;\n }\n}\n\n/** The input policy did not release its hold within its own bound. */\nexport class PolicyTimeout extends Schema.TaggedError<PolicyTimeout>()(\"PolicyTimeout\", {\n millis: Schema.Finite,\n}) {\n override get message() {\n return `the input policy did not allow this action within ${this.millis} ms`;\n }\n}\n\n/** The requested event cursor fell behind the browser's bounded replay history. */\nexport class EventHistoryExpired extends Schema.TaggedError<EventHistoryExpired>()(\n \"EventHistoryExpired\",\n {\n after: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n oldest: Schema.Int.check(Schema.isGreaterThan(0)),\n latest: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n },\n) {\n override get message() {\n return `event history after ${this.after} expired; retained sequences are ${this.oldest}–${this.latest}`;\n }\n}\n\n/** The browser, the connection or the provider failed in a way the other reasons do not cover. */\nexport class Failed extends Schema.TaggedError<Failed>()(\"Failed\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\nexport const Reason = Schema.Union([\n Timeout,\n Busy,\n Limit,\n StaleRef,\n NotFound,\n NotActionable,\n NavigationFailed,\n Closed,\n InvalidRequest,\n PolicyDenied,\n PolicyTimeout,\n EventHistoryExpired,\n Failed,\n]);\n\nexport type Reason = typeof Reason.Type;\n\nexport class BrowserError extends Schema.TaggedError<BrowserError>()(\"BrowserError\", {\n operation: Schema.String,\n reason: Reason,\n dispatched: Schema.Boolean,\n}) {\n override get message() {\n return `${this.operation} failed${this.dispatched ? \" after it was sent\" : \"\"}: ${this.reason.message}`;\n }\n}\n\n/**\n * What a failure leaves. `lost` is `\"page\"` when the page is gone and its browser stands, and\n * `\"session\"` when the browser is gone with its pages. `repeat` says whether the call can be made\n * again, on what still stands: `\"safe\"`, as nothing reached the browser; `\"check\"`, as it may have\n * taken effect, so look first, as an `Expect` attempt does; `\"pointless\"`, as it fails again unless\n * something changes, such as\n * a new ref; or `\"resume\"`, reading events again from a newer cursor.\n */\nexport interface Consequence {\n readonly lost: \"nothing\" | \"page\" | \"session\";\n readonly repeat: \"safe\" | \"check\" | \"pointless\" | \"resume\";\n}\n\n/** What `error` leaves, from its reason and whether it was dispatched alone. */\nexport const consequence = ({ reason, dispatched }: BrowserError): Consequence => {\n const repeat = dispatched ? \"check\" : \"safe\";\n\n switch (reason._tag) {\n case \"Closed\":\n return {\n lost: reason.cause === \"page\" || reason.cause === \"crashed\" ? \"page\" : \"session\",\n repeat,\n };\n case \"Busy\":\n case \"Timeout\":\n case \"Failed\":\n case \"NavigationFailed\":\n return { lost: \"nothing\", repeat };\n case \"EventHistoryExpired\":\n return { lost: \"nothing\", repeat: \"resume\" };\n case \"StaleRef\":\n case \"NotFound\":\n case \"NotActionable\":\n case \"InvalidRequest\":\n case \"Limit\":\n case \"PolicyDenied\":\n case \"PolicyTimeout\":\n return { lost: \"nothing\", repeat: \"pointless\" };\n }\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
declare namespace BrowserEvent_d_exports {
|
|
3
|
+
export { Action, ActionOptions, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled };
|
|
4
|
+
}
|
|
5
|
+
declare const PageOpened_base: Schema.Class<PageOpened, Schema.TaggedStruct<"PageOpened", {
|
|
6
|
+
readonly at: Schema.Finite;
|
|
7
|
+
readonly page: Schema.String;
|
|
8
|
+
readonly url: Schema.String;
|
|
9
|
+
readonly opener: Schema.optional<Schema.String>;
|
|
10
|
+
}>, {}>;
|
|
11
|
+
/** A page opened, and the page that opened it, as a link or `window.open` does, if one did. */
|
|
12
|
+
declare class PageOpened extends PageOpened_base {}
|
|
13
|
+
declare const PageClosed_base: Schema.Class<PageClosed, Schema.TaggedStruct<"PageClosed", {
|
|
14
|
+
readonly at: Schema.Finite;
|
|
15
|
+
readonly page: Schema.String;
|
|
16
|
+
readonly cause: Schema.Literals<readonly ["page", "crashed"]>;
|
|
17
|
+
}>, {}>;
|
|
18
|
+
/**
|
|
19
|
+
* The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser
|
|
20
|
+
* has no event of its own: `Disconnected` stands for all of them.
|
|
21
|
+
*/
|
|
22
|
+
declare class PageClosed extends PageClosed_base {}
|
|
23
|
+
declare const PageUntracked_base: Schema.Class<PageUntracked, Schema.TaggedStruct<"PageUntracked", {
|
|
24
|
+
readonly at: Schema.Finite;
|
|
25
|
+
readonly url: Schema.String;
|
|
26
|
+
readonly detail: Schema.String;
|
|
27
|
+
}>, {}>;
|
|
28
|
+
/**
|
|
29
|
+
* A tab the site opened that the library could not track, as its registration failed with
|
|
30
|
+
* `detail`. A tab that closed as it opened has no event.
|
|
31
|
+
*/
|
|
32
|
+
declare class PageUntracked extends PageUntracked_base {}
|
|
33
|
+
declare const Navigated_base: Schema.Class<Navigated, Schema.TaggedStruct<"Navigated", {
|
|
34
|
+
readonly at: Schema.Finite;
|
|
35
|
+
readonly page: Schema.String;
|
|
36
|
+
readonly url: Schema.String;
|
|
37
|
+
/**
|
|
38
|
+
* The page's documents counted from 0, the one it had when this browser began tracking it, one
|
|
39
|
+
* more for each new document. The count belongs to the page within one `Browser` and starts at
|
|
40
|
+
* 0 again on a new connection, so compare it only with the same page's in the same browser.
|
|
41
|
+
*/
|
|
42
|
+
readonly document: Schema.Int;
|
|
43
|
+
readonly sameDocument: Schema.Boolean;
|
|
44
|
+
}>, {}>;
|
|
45
|
+
/**
|
|
46
|
+
* The page's main frame moved to `url`: into a new document, or within the current one
|
|
47
|
+
* (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.
|
|
48
|
+
*/
|
|
49
|
+
declare class Navigated extends Navigated_base {}
|
|
50
|
+
declare const PageLoaded_base: Schema.Class<PageLoaded, Schema.TaggedStruct<"PageLoaded", {
|
|
51
|
+
readonly at: Schema.Finite;
|
|
52
|
+
readonly page: Schema.String;
|
|
53
|
+
readonly state: Schema.Literals<readonly ["domcontentloaded", "load"]>;
|
|
54
|
+
}>, {}>;
|
|
55
|
+
/** The page's document finished parsing (`domcontentloaded`) or loading (`load`). */
|
|
56
|
+
declare class PageLoaded extends PageLoaded_base {}
|
|
57
|
+
/**
|
|
58
|
+
* Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended
|
|
59
|
+
* its session, at or after the session's `expiresAt` (`session`), or its owner released it.
|
|
60
|
+
*/
|
|
61
|
+
declare const DisconnectCause: Schema.Literals<readonly ["connection", "session", "released"]>;
|
|
62
|
+
type DisconnectCause = typeof DisconnectCause.Type;
|
|
63
|
+
declare const Disconnected_base: Schema.Class<Disconnected, Schema.TaggedStruct<"Disconnected", {
|
|
64
|
+
readonly at: Schema.Finite;
|
|
65
|
+
readonly cause: Schema.Literals<readonly ["connection", "session", "released"]>;
|
|
66
|
+
}>, {}>;
|
|
67
|
+
/** The browser was lost to its owner, with every page in it. It happens once. */
|
|
68
|
+
declare class Disconnected extends Disconnected_base {}
|
|
69
|
+
declare const SessionEnding_base: Schema.Class<SessionEnding, Schema.TaggedStruct<"SessionEnding", {
|
|
70
|
+
readonly at: Schema.Finite;
|
|
71
|
+
readonly expiresAt: Schema.DateTimeUtc;
|
|
72
|
+
}>, {}>;
|
|
73
|
+
/** The provider ends this browser's session at `expiresAt`, a wall-clock instant. */
|
|
74
|
+
declare class SessionEnding extends SessionEnding_base {}
|
|
75
|
+
/**
|
|
76
|
+
* The words around a subject that say which one it is, each bound to it in the page rather than
|
|
77
|
+
* read off nearby text later. In a table, `row` is the row's header or first cell with text and
|
|
78
|
+
* `column` the header over it; elsewhere, `label` is the words just before it in its row, item,
|
|
79
|
+
* group or block, at most 40 characters. `heading` is the nearest heading above it, left out for
|
|
80
|
+
* what is pinned to the viewport. Row, column and heading are at most 60 characters.
|
|
81
|
+
*/
|
|
82
|
+
declare const SubjectContext: Schema.Struct<{
|
|
83
|
+
readonly row: Schema.optional<Schema.String>;
|
|
84
|
+
readonly column: Schema.optional<Schema.String>;
|
|
85
|
+
readonly label: Schema.optional<Schema.String>;
|
|
86
|
+
readonly heading: Schema.optional<Schema.String>;
|
|
87
|
+
}>;
|
|
88
|
+
type SubjectContext = typeof SubjectContext.Type;
|
|
89
|
+
declare const Subject_base: Schema.Class<Subject, Schema.Struct<{
|
|
90
|
+
readonly role: Schema.NullOr<Schema.String>;
|
|
91
|
+
readonly name: Schema.String;
|
|
92
|
+
readonly tag: Schema.String;
|
|
93
|
+
readonly context: Schema.Struct<{
|
|
94
|
+
readonly row: Schema.optional<Schema.String>;
|
|
95
|
+
readonly column: Schema.optional<Schema.String>;
|
|
96
|
+
readonly label: Schema.optional<Schema.String>;
|
|
97
|
+
readonly heading: Schema.optional<Schema.String>;
|
|
98
|
+
}>;
|
|
99
|
+
}>, {}>;
|
|
100
|
+
/**
|
|
101
|
+
* What an input acted on, or what `Page.find` found, as the page named it then: its role (null
|
|
102
|
+
* when it has none), its accessible name (empty when it has none), its lowercase tag and its
|
|
103
|
+
* context. For a point, it is the control under the point, or else the element painted there.
|
|
104
|
+
* Unlike a ref, it keeps its meaning after the page changes.
|
|
105
|
+
*/
|
|
106
|
+
declare class Subject extends Subject_base {}
|
|
107
|
+
/** An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport. */
|
|
108
|
+
declare const Box: Schema.Struct<{
|
|
109
|
+
readonly x: Schema.Finite;
|
|
110
|
+
readonly y: Schema.Finite;
|
|
111
|
+
readonly width: Schema.Finite;
|
|
112
|
+
readonly height: Schema.Finite;
|
|
113
|
+
}>;
|
|
114
|
+
type Box = typeof Box.Type;
|
|
115
|
+
/**
|
|
116
|
+
* What else an action was asked, where it changes what the action does: a click's button, count
|
|
117
|
+
* and hold, how `type` enters its text, how often and how long `press` holds its keys, how far
|
|
118
|
+
* `scroll` moves, and the options `select` chose. Only a completed action records them.
|
|
119
|
+
*/
|
|
120
|
+
declare const ActionOptions: Schema.Struct<{
|
|
121
|
+
readonly button: Schema.optional<Schema.Literals<readonly ["left", "right", "middle"]>>;
|
|
122
|
+
readonly clickCount: Schema.optional<Schema.Finite>;
|
|
123
|
+
readonly holdMillis: Schema.optional<Schema.Finite>;
|
|
124
|
+
readonly replace: Schema.optional<Schema.Boolean>;
|
|
125
|
+
readonly submit: Schema.optional<Schema.Boolean>;
|
|
126
|
+
readonly times: Schema.optional<Schema.Finite>;
|
|
127
|
+
readonly dx: Schema.optional<Schema.Finite>;
|
|
128
|
+
readonly dy: Schema.optional<Schema.Finite>;
|
|
129
|
+
readonly values: Schema.optional<Schema.$Array<Schema.String>>;
|
|
130
|
+
}>;
|
|
131
|
+
type ActionOptions = typeof ActionOptions.Type;
|
|
132
|
+
declare const Action_base: Schema.Class<Action, Schema.TaggedStruct<"Action", {
|
|
133
|
+
readonly at: Schema.Finite;
|
|
134
|
+
readonly startedAt: Schema.Finite;
|
|
135
|
+
readonly page: Schema.String;
|
|
136
|
+
readonly name: Schema.String;
|
|
137
|
+
readonly correlation: Schema.optional<Schema.String>;
|
|
138
|
+
readonly target: Schema.optional<Schema.String>;
|
|
139
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
140
|
+
readonly button: Schema.optional<Schema.Literals<readonly ["left", "right", "middle"]>>;
|
|
141
|
+
readonly clickCount: Schema.optional<Schema.Finite>;
|
|
142
|
+
readonly holdMillis: Schema.optional<Schema.Finite>;
|
|
143
|
+
readonly replace: Schema.optional<Schema.Boolean>;
|
|
144
|
+
readonly submit: Schema.optional<Schema.Boolean>;
|
|
145
|
+
readonly times: Schema.optional<Schema.Finite>;
|
|
146
|
+
readonly dx: Schema.optional<Schema.Finite>;
|
|
147
|
+
readonly dy: Schema.optional<Schema.Finite>;
|
|
148
|
+
readonly values: Schema.optional<Schema.$Array<Schema.String>>;
|
|
149
|
+
}>>;
|
|
150
|
+
readonly subject: Schema.optional<typeof Subject>;
|
|
151
|
+
readonly to: Schema.optional<typeof Subject>;
|
|
152
|
+
/** For an action at a point, the box of what it found there. */
|
|
153
|
+
readonly box: Schema.optional<Schema.Struct<{
|
|
154
|
+
readonly x: Schema.Finite;
|
|
155
|
+
readonly y: Schema.Finite;
|
|
156
|
+
readonly width: Schema.Finite;
|
|
157
|
+
readonly height: Schema.Finite;
|
|
158
|
+
}>>;
|
|
159
|
+
readonly text: Schema.optional<Schema.String>;
|
|
160
|
+
readonly x: Schema.optional<Schema.Finite>;
|
|
161
|
+
readonly y: Schema.optional<Schema.Finite>;
|
|
162
|
+
readonly ok: Schema.Boolean;
|
|
163
|
+
readonly dispatched: Schema.Boolean;
|
|
164
|
+
readonly error: Schema.optional<Schema.String>;
|
|
165
|
+
}>, {}>;
|
|
166
|
+
/**
|
|
167
|
+
* One page operation ended, including one its caller interrupted (`error: "interrupted"`).
|
|
168
|
+
* `target` is what the caller asked for: a ref, a point, a URL or keys, and `options` the rest.
|
|
169
|
+
* `subject` is what an element or point action found there, and `to` where a drag ended; an
|
|
170
|
+
* action that failed before finding its target has neither. Point actions carry the viewport
|
|
171
|
+
* point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a
|
|
172
|
+
* model's tool call id.
|
|
173
|
+
*/
|
|
174
|
+
declare class Action extends Action_base {}
|
|
175
|
+
declare const TrackPlanned_base: Schema.Class<TrackPlanned, Schema.TaggedStruct<"TrackPlanned", {
|
|
176
|
+
readonly at: Schema.Finite;
|
|
177
|
+
readonly page: Schema.String;
|
|
178
|
+
readonly from: Schema.Struct<{
|
|
179
|
+
readonly x: Schema.Finite;
|
|
180
|
+
readonly y: Schema.Finite;
|
|
181
|
+
}>;
|
|
182
|
+
readonly samples: Schema.$Array<Schema.Struct<{
|
|
183
|
+
readonly x: Schema.Finite;
|
|
184
|
+
readonly y: Schema.Finite;
|
|
185
|
+
readonly afterMillis: Schema.Finite;
|
|
186
|
+
}>>;
|
|
187
|
+
}>, {}>;
|
|
188
|
+
/** One whole glide, published before its first input. Offsets use the host monotonic clock. */
|
|
189
|
+
declare class TrackPlanned extends TrackPlanned_base {}
|
|
190
|
+
declare const TrackPerformed_base: Schema.Class<TrackPerformed, Schema.TaggedStruct<"TrackPerformed", {
|
|
191
|
+
readonly at: Schema.Finite;
|
|
192
|
+
readonly page: Schema.String;
|
|
193
|
+
readonly plan: Schema.Int;
|
|
194
|
+
readonly dispatched: Schema.Int;
|
|
195
|
+
readonly x: Schema.Finite;
|
|
196
|
+
readonly y: Schema.Finite;
|
|
197
|
+
readonly complete: Schema.Boolean;
|
|
198
|
+
}>, {}>;
|
|
199
|
+
/**
|
|
200
|
+
* The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`
|
|
201
|
+
* counts samples. `complete` means every sample was submitted, not acknowledged by the browser.
|
|
202
|
+
* The terminal point clips a canceled plan so a compositor never draws its unrealized future.
|
|
203
|
+
*/
|
|
204
|
+
declare class TrackPerformed extends TrackPerformed_base {}
|
|
205
|
+
declare const PointerPressed_base: Schema.Class<PointerPressed, Schema.TaggedStruct<"PointerPressed", {
|
|
206
|
+
readonly at: Schema.Finite;
|
|
207
|
+
readonly page: Schema.String;
|
|
208
|
+
readonly x: Schema.Finite;
|
|
209
|
+
readonly y: Schema.Finite;
|
|
210
|
+
readonly button: Schema.Literals<readonly ["left", "right", "middle"]>;
|
|
211
|
+
readonly clickCount: Schema.Int;
|
|
212
|
+
}>, {}>;
|
|
213
|
+
declare class PointerPressed extends PointerPressed_base {}
|
|
214
|
+
declare const PointerReleased_base: Schema.Class<PointerReleased, Schema.TaggedStruct<"PointerReleased", {
|
|
215
|
+
readonly at: Schema.Finite;
|
|
216
|
+
readonly page: Schema.String;
|
|
217
|
+
readonly x: Schema.Finite;
|
|
218
|
+
readonly y: Schema.Finite;
|
|
219
|
+
readonly button: Schema.Literals<readonly ["left", "right", "middle"]>;
|
|
220
|
+
readonly clickCount: Schema.Int;
|
|
221
|
+
}>, {}>;
|
|
222
|
+
declare class PointerReleased extends PointerReleased_base {}
|
|
223
|
+
declare const WheelScrolled_base: Schema.Class<WheelScrolled, Schema.TaggedStruct<"WheelScrolled", {
|
|
224
|
+
readonly at: Schema.Finite;
|
|
225
|
+
readonly page: Schema.String;
|
|
226
|
+
readonly x: Schema.Finite;
|
|
227
|
+
readonly y: Schema.Finite;
|
|
228
|
+
readonly dx: Schema.Finite;
|
|
229
|
+
readonly dy: Schema.Finite;
|
|
230
|
+
}>, {}>;
|
|
231
|
+
declare class WheelScrolled extends WheelScrolled_base {}
|
|
232
|
+
declare const KeyChanged_base: Schema.Class<KeyChanged, Schema.TaggedStruct<"KeyChanged", {
|
|
233
|
+
readonly at: Schema.Finite;
|
|
234
|
+
readonly page: Schema.String;
|
|
235
|
+
readonly key: Schema.String;
|
|
236
|
+
readonly phase: Schema.Literals<readonly ["down", "up"]>;
|
|
237
|
+
}>, {}>;
|
|
238
|
+
declare class KeyChanged extends KeyChanged_base {}
|
|
239
|
+
declare const TextInserted_base: Schema.Class<TextInserted, Schema.TaggedStruct<"TextInserted", {
|
|
240
|
+
readonly at: Schema.Finite;
|
|
241
|
+
readonly page: Schema.String;
|
|
242
|
+
readonly text: Schema.String;
|
|
243
|
+
}>, {}>;
|
|
244
|
+
/** Literal text insertion has no corresponding key events, including Unicode and newlines. */
|
|
245
|
+
declare class TextInserted extends TextInserted_base {}
|
|
246
|
+
declare const CursorChanged_base: Schema.Class<CursorChanged, Schema.TaggedStruct<"CursorChanged", {
|
|
247
|
+
readonly at: Schema.Finite;
|
|
248
|
+
readonly page: Schema.String;
|
|
249
|
+
readonly cursor: Schema.String;
|
|
250
|
+
}>, {}>;
|
|
251
|
+
/** The target's CSS cursor, obtained during target resolution without another browser call. */
|
|
252
|
+
declare class CursorChanged extends CursorChanged_base {}
|
|
253
|
+
declare const TrackEvent: Schema.Union<readonly [typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged]>;
|
|
254
|
+
type TrackEvent = typeof TrackEvent.Type;
|
|
255
|
+
declare const DialogShown_base: Schema.Class<DialogShown, Schema.TaggedStruct<"DialogShown", {
|
|
256
|
+
readonly at: Schema.Finite;
|
|
257
|
+
readonly page: Schema.String;
|
|
258
|
+
readonly kind: Schema.String;
|
|
259
|
+
readonly message: Schema.String;
|
|
260
|
+
readonly answer: Schema.Literals<readonly ["accepted", "dismissed"]>;
|
|
261
|
+
}>, {}>;
|
|
262
|
+
/**
|
|
263
|
+
* A JavaScript dialog appeared and was answered: an alert or a leave-page prompt accepted, a
|
|
264
|
+
* confirm or a prompt dismissed, as if its Cancel were pressed.
|
|
265
|
+
*/
|
|
266
|
+
declare class DialogShown extends DialogShown_base {}
|
|
267
|
+
declare const BrowserEvent: Schema.Union<readonly [typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
|
|
268
|
+
type BrowserEvent = typeof BrowserEvent.Type;
|
|
269
|
+
declare const RecordedEvent_base: Schema.Class<RecordedEvent, Schema.Struct<{
|
|
270
|
+
readonly sequence: Schema.Int;
|
|
271
|
+
readonly event: Schema.Union<readonly [typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>;
|
|
272
|
+
}>, {}>;
|
|
273
|
+
/** A position in the browser's one replayable event history. Sequences begin at one. */
|
|
274
|
+
declare class RecordedEvent extends RecordedEvent_base {}
|
|
275
|
+
//#endregion
|
|
276
|
+
export { TrackEvent as C, WheelScrolled as E, TextInserted as S, TrackPlanned as T, PointerReleased as _, BrowserEvent_d_exports as a, Subject as b, DisconnectCause as c, Navigated as d, PageClosed as f, PointerPressed as g, PageUntracked as h, BrowserEvent as i, Disconnected as l, PageOpened as m, ActionOptions as n, CursorChanged as o, PageLoaded as p, Box as r, DialogShown as s, Action as t, KeyChanged as u, RecordedEvent as v, TrackPerformed as w, SubjectContext as x, SessionEnding as y };
|
|
277
|
+
//# sourceMappingURL=BrowserEvent-DzdNdvoh.d.mts.map
|