@statewalker/webrun-http-browser 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +302 -52
- package/dist/core/data-calls.d.ts +17 -0
- package/dist/core/data-calls.d.ts.map +1 -1
- package/dist/core/service-worker-control.d.ts +3 -1
- package/dist/core/service-worker-control.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3906 -265
- package/dist/link/errors.d.ts +2 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/http-link.d.ts +58 -0
- package/dist/link/http-link.d.ts.map +1 -0
- package/dist/link/index.d.ts +4 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/locks.d.ts +39 -0
- package/dist/link/locks.d.ts.map +1 -0
- package/dist/link/rendezvous.d.ts +21 -0
- package/dist/link/rendezvous.d.ts.map +1 -0
- package/dist/relay/index-sw.d.ts +12 -2
- package/dist/relay/index-sw.d.ts.map +1 -1
- package/dist/relay/index.d.ts +66 -8
- package/dist/relay/index.d.ts.map +1 -1
- package/dist/relay-sw.js +1160 -55
- package/dist/relay-worker.js +1161 -55
- package/dist/sw/handler-endpoint.d.ts +81 -0
- package/dist/sw/handler-endpoint.d.ts.map +1 -0
- package/dist/sw/handler-table.d.ts +53 -0
- package/dist/sw/handler-table.d.ts.map +1 -0
- package/dist/sw/http-sw-dispatcher.d.ts +162 -21
- package/dist/sw/http-sw-dispatcher.d.ts.map +1 -1
- package/dist/sw/index.d.ts +5 -0
- package/dist/sw/index.d.ts.map +1 -1
- package/dist/sw/protocol.d.ts +115 -0
- package/dist/sw/protocol.d.ts.map +1 -0
- package/dist/sw/sw-dispatcher.d.ts.map +1 -1
- package/dist/sw/sw-http-adapter.d.ts +199 -0
- package/dist/sw/sw-http-adapter.d.ts.map +1 -0
- package/dist/sw/sw-websocket.d.ts +16 -0
- package/dist/sw/sw-websocket.d.ts.map +1 -0
- package/dist/sw/worker-service.d.ts +45 -0
- package/dist/sw/worker-service.d.ts.map +1 -0
- package/dist/sw/worker-url.d.ts +9 -0
- package/dist/sw/worker-url.d.ts.map +1 -0
- package/dist/sw-worker.js +2075 -210
- package/dist/sw.d.ts +2 -0
- package/dist/sw.d.ts.map +1 -1
- package/dist/sw.js +3901 -531
- package/dist/worker.d.ts +10 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +3507 -0
- package/dist/ws/client.d.ts +73 -0
- package/dist/ws/client.d.ts.map +1 -0
- package/dist/ws/frames.d.ts +68 -0
- package/dist/ws/frames.d.ts.map +1 -0
- package/dist/ws/index.d.ts +6 -0
- package/dist/ws/index.d.ts.map +1 -0
- package/dist/ws/server.d.ts +53 -0
- package/dist/ws/server.d.ts.map +1 -0
- package/dist/ws/socket-core.d.ts +91 -0
- package/dist/ws/socket-core.d.ts.map +1 -0
- package/dist/ws/upgrade.d.ts +93 -0
- package/dist/ws/upgrade.d.ts.map +1 -0
- package/package.json +10 -5
- package/src/core/data-calls.ts +52 -2
- package/src/core/service-worker-control.ts +7 -1
- package/src/index.ts +3 -0
- package/src/link/errors.ts +3 -0
- package/src/link/http-link.ts +222 -0
- package/src/link/index.ts +3 -0
- package/src/link/locks.ts +97 -0
- package/src/link/rendezvous.ts +60 -0
- package/src/relay/index-sw.ts +84 -12
- package/src/relay/index.ts +203 -27
- package/src/sw/handler-endpoint.ts +278 -0
- package/src/sw/handler-table.ts +130 -0
- package/src/sw/http-sw-dispatcher.ts +649 -90
- package/src/sw/index.ts +5 -0
- package/src/sw/protocol.ts +103 -0
- package/src/sw/sw-dispatcher.ts +1 -20
- package/src/sw/sw-http-adapter.ts +613 -0
- package/src/sw/sw-websocket.ts +43 -0
- package/src/sw/worker-service.ts +133 -0
- package/src/sw/worker-url.ts +19 -0
- package/src/sw-worker.ts +8 -3
- package/src/sw.ts +2 -0
- package/src/worker.ts +9 -0
- package/src/ws/client.ts +346 -0
- package/src/ws/frames.ts +119 -0
- package/src/ws/index.ts +11 -0
- package/src/ws/server.ts +132 -0
- package/src/ws/socket-core.ts +251 -0
- package/src/ws/upgrade.ts +200 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type HttpLinkOptions } from "../link/http-link.js";
|
|
2
|
+
import type { WebSocketConnection } from "../ws/client.js";
|
|
3
|
+
export type FetchHandler = (request: Request) => Response | Promise<Response>;
|
|
4
|
+
export interface HandlerEndpointOptions extends HttpLinkOptions {
|
|
5
|
+
/** Asks whoever attaches this endpoint to do it again (its links died). */
|
|
6
|
+
requestRelink?: () => void;
|
|
7
|
+
/** Pokes the ServiceWorker so that it stays awake while calls are in flight. */
|
|
8
|
+
keepAlive?: () => void;
|
|
9
|
+
/** Period of `keepAlive` while calls are in flight, in ms. Default 20 s. */
|
|
10
|
+
keepAliveMs?: number;
|
|
11
|
+
/** How often a waiting call asks for a link again, in ms. Default 2 s. */
|
|
12
|
+
relinkRetryMs?: number;
|
|
13
|
+
/** How long a call waits for a link before failing, in ms. Default 30 s. */
|
|
14
|
+
relinkTimeoutMs?: number;
|
|
15
|
+
/** How long a socket waits for the far handler's answer, in ms. Default 15 s. */
|
|
16
|
+
wsConnectTimeoutMs?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How long a link replaced by a newer one of the same router keeps serving
|
|
19
|
+
* what it has, in ms. The ServiceWorker closes it first, once its requests
|
|
20
|
+
* are done; this only bounds a link it forgot. Default 30 s.
|
|
21
|
+
*/
|
|
22
|
+
supersededLinkMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface EndpointLinkPorts {
|
|
25
|
+
down: MessagePort;
|
|
26
|
+
ctl?: MessagePort;
|
|
27
|
+
up?: MessagePort;
|
|
28
|
+
}
|
|
29
|
+
/** The message calls through a lost ServiceWorker fail with. */
|
|
30
|
+
export declare const ROUTER_LOST_MESSAGE = "The ServiceWorker was lost while this call was in flight";
|
|
31
|
+
/**
|
|
32
|
+
* The handler's end of its links to the ServiceWorker, the same in a page and
|
|
33
|
+
* in a Dedicated Worker.
|
|
34
|
+
*
|
|
35
|
+
* - Serves `handler` on each link's `down` port, and answers WebSocket
|
|
36
|
+
* upgrades arriving on its `ctl` port by running them through `handler`.
|
|
37
|
+
* - Sends requests through the router on `up` (`fetch`) and opens sockets to
|
|
38
|
+
* other handlers over `ctl` (`connectWebSocket`).
|
|
39
|
+
* - Watches the ServiceWorker's router lock. When the ServiceWorker dies, the
|
|
40
|
+
* links made for it are dropped: calls in flight on them fail with
|
|
41
|
+
* `LinkLostError` ("may or may not have been applied") instead of hanging,
|
|
42
|
+
* and new calls wait for a link, asking for one (`requestRelink`) every
|
|
43
|
+
* `relinkRetryMs` until it comes.
|
|
44
|
+
* - While calls are in flight, calls `keepAlive` every `keepAliveMs`: port
|
|
45
|
+
* messages are not events, so without it the browser may stop the
|
|
46
|
+
* ServiceWorker in the middle of a long call.
|
|
47
|
+
*/
|
|
48
|
+
export declare class HandlerEndpoint {
|
|
49
|
+
readonly handler: FetchHandler;
|
|
50
|
+
readonly options: HandlerEndpointOptions;
|
|
51
|
+
private readonly _links;
|
|
52
|
+
private _waiters;
|
|
53
|
+
private readonly _sockets;
|
|
54
|
+
private _keepAliveTimer?;
|
|
55
|
+
private _closed;
|
|
56
|
+
constructor(handler: FetchHandler, options?: HandlerEndpointOptions);
|
|
57
|
+
/** Whether any link is live. */
|
|
58
|
+
get linked(): boolean;
|
|
59
|
+
/** Installs a fresh link made for the router holding `routerLock`. */
|
|
60
|
+
link(key: string, ports: EndpointLinkPorts, routerLock?: string): Promise<void>;
|
|
61
|
+
/** Drops the links attached under `key` (all of them without a key). */
|
|
62
|
+
unlink(key?: string, reason?: Error): Promise<void>;
|
|
63
|
+
/** The routers this endpoint has live links for. */
|
|
64
|
+
routerLocks(): Set<string | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Sends `request` through the ServiceWorker's router, as if the browser had
|
|
67
|
+
* fetched it: it reaches the handler its url routes to.
|
|
68
|
+
*/
|
|
69
|
+
fetch(request: Request): Promise<Response>;
|
|
70
|
+
/** Opens a socket to the handler `url` routes to, through the ServiceWorker. */
|
|
71
|
+
connectWebSocket(url: string, protocols?: string[]): Promise<WebSocketConnection>;
|
|
72
|
+
close(): Promise<void>;
|
|
73
|
+
private _drop;
|
|
74
|
+
private _routerLost;
|
|
75
|
+
/** A live link with `port`, waiting (and asking) for one when there is none. */
|
|
76
|
+
private _linkWith;
|
|
77
|
+
private _startKeepAlive;
|
|
78
|
+
private _onControl;
|
|
79
|
+
private _acceptSocket;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=handler-endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-endpoint.d.ts","sourceRoot":"","sources":["../../src/sw/handler-endpoint.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAI3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE9E,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,CAAC,EAAE,WAAW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IAavB,OAAO,CAAC,UAAU;YAiBJ,aAAa;CAmC5B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ServiceWorker's table of handler links, per key. Pure bookkeeping, no
|
|
3
|
+
* ports, so routing can be tested without a browser.
|
|
4
|
+
*/
|
|
5
|
+
/** What a `route` function sees of a handler. */
|
|
6
|
+
export interface HandlerInfo {
|
|
7
|
+
/** The handler slot, unique within its key. */
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly key: string;
|
|
10
|
+
/** Token of the current attachment; `drain` and `detach` must name it. */
|
|
11
|
+
readonly owner: string;
|
|
12
|
+
/** Requests sent to it whose responses have not finished. */
|
|
13
|
+
readonly inflight: number;
|
|
14
|
+
/** Whatever the attaching page sent. */
|
|
15
|
+
readonly meta: unknown;
|
|
16
|
+
/** When it attached (`Date.now()`); ties go to the oldest. */
|
|
17
|
+
readonly attachedAt: number;
|
|
18
|
+
/** Draining: it finishes what it has and gets nothing new. */
|
|
19
|
+
readonly draining: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Picks the handler for one request among the live (not draining) handlers of
|
|
23
|
+
* its key. `undefined` means none of them: the request waits for another, as
|
|
24
|
+
* when there is none at all.
|
|
25
|
+
*/
|
|
26
|
+
export type RouteFunction = <H extends HandlerInfo>(request: Request, key: string, handlers: H[]) => H | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The default route: the handler with the fewest requests in flight, the
|
|
29
|
+
* oldest on a tie. With one handler per key — one tab — that is the first
|
|
30
|
+
* live handler of the key, as before routing was pluggable.
|
|
31
|
+
*/
|
|
32
|
+
export declare const leastInflightRoute: RouteFunction;
|
|
33
|
+
export declare class HandlerTable<E extends HandlerInfo> {
|
|
34
|
+
private readonly _entries;
|
|
35
|
+
private _waiters;
|
|
36
|
+
/** Adds `entry`. Returns the entry it replaces (same key and id), if any. */
|
|
37
|
+
add(entry: E): E | undefined;
|
|
38
|
+
/** Removes `entry` if it is still the one in its slot. */
|
|
39
|
+
remove(entry: E): boolean;
|
|
40
|
+
get(key: string, id: string): E | undefined;
|
|
41
|
+
/** Every entry of `key`, draining or not. */
|
|
42
|
+
all(key: string): E[];
|
|
43
|
+
/** The entries of `key` that take new requests. */
|
|
44
|
+
live(key: string): E[];
|
|
45
|
+
entries(): E[];
|
|
46
|
+
get size(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves `true` once a live entry for `key` is added (at once if there is
|
|
49
|
+
* one, unless `next`), `false` after `ms`.
|
|
50
|
+
*/
|
|
51
|
+
waitFor(key: string, ms: number, next?: boolean): Promise<boolean>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=handler-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-table.d.ts","sourceRoot":"","sources":["../../src/sw/handler-table.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,WAAW,EAChD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,EAAE,KACV,CAAC,GAAG,SAAS,CAAC;AAEnB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAYhC,CAAC;AAEF,qBAAa,YAAY,CAAC,CAAC,SAAS,WAAW;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAiE;IAEjF,6EAA6E;IAC7E,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAgB3B;IAED,0DAA0D;IAC1D,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAMxB;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAE1C;IAED,6CAA6C;IAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,CAEpB;IAED,mDAAmD;IACnD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,CAErB;IAED,OAAO,IAAI,CAAC,EAAE,CAEb;IAED,IAAI,IAAI,IAAI,MAAM,CAIjB;IAED;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB/D;CACF"}
|
|
@@ -1,28 +1,169 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type HttpLink } from "../link/http-link.js";
|
|
2
|
+
import { PortRendezvous } from "../link/rendezvous.js";
|
|
3
|
+
import type { WebSocketConnection } from "../ws/client.js";
|
|
4
|
+
import { type HandlerInfo, HandlerTable, type RouteFunction } from "./handler-table.js";
|
|
5
|
+
export interface SwHttpDispatcherOptions {
|
|
6
|
+
self: ServiceWorkerGlobalScope;
|
|
7
|
+
log?: (...args: unknown[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Picks the handler of a request among the live handlers of its key.
|
|
10
|
+
* Default `leastInflightRoute`: the fewest requests in flight, the oldest on
|
|
11
|
+
* a tie — with one tab per key, the first live handler, as before.
|
|
12
|
+
*/
|
|
13
|
+
route?: RouteFunction;
|
|
14
|
+
/**
|
|
15
|
+
* How long a request waits for a handler while its key is handed over (the
|
|
16
|
+
* handlers it has are all draining, or `route` picked none), in ms. Past
|
|
17
|
+
* it, 503. Default 15 s.
|
|
18
|
+
*/
|
|
19
|
+
attachTimeoutMs?: number;
|
|
20
|
+
/**
|
|
21
|
+
* How long a request for a key with no handler waits for the pages to
|
|
22
|
+
* attach their links again (after a ServiceWorker restart), in ms. Past it,
|
|
23
|
+
* 404 for a key this worker has served before. Default 3 s.
|
|
24
|
+
*/
|
|
25
|
+
relinkTimeoutMs?: number;
|
|
26
|
+
/** How long a replaced link may finish its requests, in ms. Default 5 s. */
|
|
27
|
+
handoverMs?: number;
|
|
28
|
+
/** How long a socket waits for its handler's answer, in ms. Default 15 s. */
|
|
29
|
+
wsConnectTimeoutMs?: number;
|
|
30
|
+
/** Per-stream inactivity timeout of the links (webrun-rpc's). Default none. */
|
|
31
|
+
streamTimeout?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Period of the backup liveness check, in ms: handlers whose owner lock is
|
|
34
|
+
* no longer held are dropped. Default 5 s; 0 turns it off.
|
|
35
|
+
*/
|
|
36
|
+
livenessCheckMs?: number;
|
|
5
37
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
38
|
+
/** One attached handler link, as the ServiceWorker holds it. */
|
|
39
|
+
declare class HandlerEntry implements HandlerInfo {
|
|
40
|
+
readonly key: string;
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly owner: string;
|
|
43
|
+
readonly meta: unknown;
|
|
44
|
+
readonly link: HttpLink;
|
|
45
|
+
readonly ctl: MessagePort | undefined;
|
|
46
|
+
readonly clientId: string | undefined;
|
|
47
|
+
readonly ownerLock: string | undefined;
|
|
48
|
+
draining: boolean;
|
|
49
|
+
readonly attachedAt: number;
|
|
50
|
+
readonly sockets: PortRendezvous<WebSocketConnection>;
|
|
51
|
+
stopWatch: () => void;
|
|
52
|
+
closeUp?: () => Promise<void>;
|
|
53
|
+
constructor(key: string, id: string, owner: string, meta: unknown, link: HttpLink, ctl: MessagePort | undefined, clientId: string | undefined, ownerLock: string | undefined);
|
|
54
|
+
get inflight(): number;
|
|
10
55
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
56
|
+
/** The reason requests fail with when their handler dies under them. */
|
|
57
|
+
export declare const HANDLER_LOST_MESSAGE = "The handler was lost while this request was in flight";
|
|
58
|
+
/**
|
|
59
|
+
* The same-origin ServiceWorker: routes `fetch` events under its scope to
|
|
60
|
+
* handler links that pages attach — handlers in the pages themselves
|
|
61
|
+
* (`SwHttpAdapter.register`) or in Dedicated Workers
|
|
62
|
+
* (`SwHttpAdapter.attachWorker` + `serveHttpInWorker`).
|
|
63
|
+
*
|
|
64
|
+
* A url `<scope>/<key>/...` belongs to the handlers of `key`. Of those, the
|
|
65
|
+
* `route` option picks one per request. Requests and responses stream with
|
|
66
|
+
* backpressure in both directions, and an aborted fetch reaches the handler
|
|
67
|
+
* as a cancellation (webrun-rpc + webrun-http-streams).
|
|
68
|
+
*
|
|
69
|
+
* Urls of keys this worker never served go to the network untouched: the
|
|
70
|
+
* worker does not call `respondWith` for them.
|
|
71
|
+
*
|
|
72
|
+
* RESTARTS. The browser stops an idle ServiceWorker, and every port it held
|
|
73
|
+
* dies with it. Nothing is persisted but the set of keys ever served: the
|
|
74
|
+
* first request after a restart asks every window to attach its links again
|
|
75
|
+
* (`NEED_LINKS`) and waits for them.
|
|
76
|
+
*
|
|
77
|
+
* LIVENESS. Each handler holds an owner lock; when it is granted to this
|
|
78
|
+
* worker, the handler is gone and its requests in flight fail at once (502).
|
|
79
|
+
* This worker holds a router lock that handlers watch the same way.
|
|
80
|
+
*/
|
|
81
|
+
export declare class SwHttpDispatcher {
|
|
82
|
+
readonly self: ServiceWorkerGlobalScope;
|
|
83
|
+
readonly log: (...args: unknown[]) => void;
|
|
84
|
+
readonly options: SwHttpDispatcherOptions;
|
|
85
|
+
readonly table: HandlerTable<HandlerEntry>;
|
|
17
86
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
87
|
+
* Keys that were served at some point on this worker (sticky, kept in
|
|
88
|
+
* IndexedDB). Lets a fetch tell "a site url whose handler is gone → 404"
|
|
89
|
+
* from "an unknown url under the scope → the network".
|
|
20
90
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
91
|
+
readonly claimedKeys: Set<string>;
|
|
92
|
+
/** The Web Lock this worker holds while it lives; handlers watch it. */
|
|
93
|
+
readonly routerLock?: string;
|
|
94
|
+
private _routerHeld;
|
|
95
|
+
private _restored;
|
|
96
|
+
private _restoreSettled;
|
|
97
|
+
private _cleanup;
|
|
98
|
+
private _livenessTimer?;
|
|
99
|
+
private readonly _relinkRounds;
|
|
100
|
+
/** Keys whose last handler was drained: until the time stored, requests wait for the next. */
|
|
101
|
+
private readonly _vacant;
|
|
102
|
+
constructor(options: SwHttpDispatcherOptions);
|
|
103
|
+
get scope(): string;
|
|
104
|
+
/** The key `url` belongs to: its first path segment under the scope. */
|
|
105
|
+
keyOf(url: string | URL): string | undefined;
|
|
106
|
+
/** Whether `key` has ever been served on this worker. */
|
|
107
|
+
isClaimedKey(key: string): boolean;
|
|
108
|
+
/** Whether requests for `key` are this worker's to answer. */
|
|
109
|
+
serves(key: string): boolean;
|
|
24
110
|
start(): void;
|
|
25
|
-
|
|
111
|
+
stop(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Answers `request` as a fetch under the scope would be: through the
|
|
114
|
+
* handler its key routes to. A url outside the scope, or of a key this
|
|
115
|
+
* worker never served, goes to the network.
|
|
116
|
+
*/
|
|
117
|
+
dispatch(request: Request): Promise<Response>;
|
|
118
|
+
/**
|
|
119
|
+
* Opens a socket to the handler `url` routes to: the handler accepts or
|
|
120
|
+
* refuses it like an HTTP upgrade, and the socket's port comes back. After
|
|
121
|
+
* that the socket runs between the caller and the handler directly; this
|
|
122
|
+
* worker is not on its data path.
|
|
123
|
+
*/
|
|
124
|
+
connectWebSocket(url: string, protocols?: string[], headers?: [string, string][]): Promise<WebSocketConnection>;
|
|
125
|
+
private _onFetch;
|
|
126
|
+
private _attach;
|
|
127
|
+
private _add;
|
|
128
|
+
/**
|
|
129
|
+
* The backup of the owner-lock watches: every `livenessCheckMs`, drops the
|
|
130
|
+
* handlers whose owner lock is no longer held. Runs only while some handler
|
|
131
|
+
* has an owner lock, and keeps nothing awake: a timer is not an event.
|
|
132
|
+
*/
|
|
133
|
+
private _watchLiveness;
|
|
134
|
+
/** The entry a drain or detach names, if its owner token still matches. */
|
|
135
|
+
private _find;
|
|
136
|
+
/**
|
|
137
|
+
* Stops routing to `entry`, lets its requests in flight run for up to `ms`,
|
|
138
|
+
* then closes it. Requests that arrive meanwhile wait for the next owner.
|
|
139
|
+
*/
|
|
140
|
+
private _retire;
|
|
141
|
+
private _close;
|
|
142
|
+
/**
|
|
143
|
+
* The handler for `request`: picked by `route` among the live handlers of
|
|
144
|
+
* its key, waiting for one when there is none.
|
|
145
|
+
*/
|
|
146
|
+
private _acquire;
|
|
147
|
+
private _pick;
|
|
148
|
+
/**
|
|
149
|
+
* Asks every window to attach its links again, and waits until a handler
|
|
150
|
+
* for `key` is back, every window answered, or `relinkTimeoutMs` passed.
|
|
151
|
+
* At most one round per key every 10 s: a key whose tab is simply gone
|
|
152
|
+
* should not cost every request the wait.
|
|
153
|
+
*/
|
|
154
|
+
private _askForLinks;
|
|
155
|
+
private _linkRound;
|
|
156
|
+
/** Asks a version-1 page for a fresh port, as version 1's worker did. */
|
|
157
|
+
private _askLegacyPage;
|
|
158
|
+
private _onControl;
|
|
159
|
+
private _isOwnClient;
|
|
160
|
+
private _claim;
|
|
161
|
+
private _restoreClaimedKeys;
|
|
26
162
|
}
|
|
27
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Starts the same-origin dispatcher in a ServiceWorker. Returns a function
|
|
165
|
+
* that stops it.
|
|
166
|
+
*/
|
|
167
|
+
export declare function startHttpDispatcher(options: SwHttpDispatcherOptions): () => void;
|
|
168
|
+
export {};
|
|
28
169
|
//# sourceMappingURL=http-sw-dispatcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-sw-dispatcher.d.ts","sourceRoot":"","sources":["../../src/sw/http-sw-dispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-sw-dispatcher.d.ts","sourceRoot":"","sources":["../../src/sw/http-sw-dispatcher.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,QAAQ,EAId,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EAEZ,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAgB5B,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gEAAgE;AAChE,cAAM,YAAa,YAAW,WAAW;IAQrC,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CA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,cAAc;IA0BtB,OAAO,CAAC,UAAU;IAgClB,OAAO,CAAC,YAAY;YAUN,MAAM;YAUN,mBAAmB;CAIlC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,IAAI,CAMhF"}
|
package/dist/sw/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export * from "./handler-endpoint.js";
|
|
2
|
+
export * from "./handler-table.js";
|
|
1
3
|
export * from "./http-sw-dispatcher.js";
|
|
2
4
|
export * from "./sw-dispatcher.js";
|
|
5
|
+
export * from "./sw-http-adapter.js";
|
|
6
|
+
export * from "./sw-websocket.js";
|
|
7
|
+
export * from "./worker-service.js";
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sw/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The messages between pages, Dedicated Workers and the same-origin
|
|
3
|
+
* ServiceWorker. Internal: the shapes may change between versions, which is
|
|
4
|
+
* why every hand-shake carries `HTTP_LINK_PROTOCOL`.
|
|
5
|
+
*
|
|
6
|
+
* THREE PORTS PER HANDLER LINK. A page makes the channels and hands one end of
|
|
7
|
+
* each to the handler (itself, or a worker) and the other to the
|
|
8
|
+
* ServiceWorker; after that it carries nothing:
|
|
9
|
+
*
|
|
10
|
+
* - `down`: ServiceWorker → handler, the requests the handler serves;
|
|
11
|
+
* - `ctl`: a raw port next to them, for what HTTP over a stream cannot carry,
|
|
12
|
+
* transferred `MessagePort`s (WebSocket hand-over);
|
|
13
|
+
* - `up` (workers only): handler → ServiceWorker, the requests the handler
|
|
14
|
+
* sends through the router (to other handlers).
|
|
15
|
+
*/
|
|
16
|
+
/** Page → ServiceWorker: attach a handler link. The name is the one version 1 used. */
|
|
17
|
+
export declare const ATTACH_CALL = "UPDATE_COMMUNICATION_PORT";
|
|
18
|
+
/** Page → ServiceWorker: remove a handler link now. */
|
|
19
|
+
export declare const DETACH_CALL = "webrun-http:detach";
|
|
20
|
+
/** Page → ServiceWorker: stop routing to a link, let its requests finish, then remove it. */
|
|
21
|
+
export declare const DRAIN_CALL = "webrun-http:drain";
|
|
22
|
+
/** Page → ServiceWorker: open a WebSocket to a handler. */
|
|
23
|
+
export declare const WS_CONNECT_CALL = "webrun-http:ws-connect";
|
|
24
|
+
/** ServiceWorker → pages: attach your links again (the ServiceWorker restarted). */
|
|
25
|
+
export declare const NEED_LINKS_CALL = "webrun-http:need-links";
|
|
26
|
+
/**
|
|
27
|
+
* Page → ServiceWorker, plain messages (no reply). A message to the
|
|
28
|
+
* ServiceWorker object is an event: it starts a stopped worker and resets its
|
|
29
|
+
* idle timer. Port messages do neither.
|
|
30
|
+
*/
|
|
31
|
+
export declare const WAKE_MESSAGE = "webrun-http:wake";
|
|
32
|
+
export declare const KEEPALIVE_MESSAGE = "webrun-http:keepalive";
|
|
33
|
+
export interface AttachParams {
|
|
34
|
+
/** `HTTP_LINK_PROTOCOL`; absent from version 1 pages. */
|
|
35
|
+
wire?: string;
|
|
36
|
+
key: string;
|
|
37
|
+
/** The handler slot. Attaching an id that is attached already replaces it. */
|
|
38
|
+
id?: string;
|
|
39
|
+
/** Token of this attachment, named by `drain` / `detach`. */
|
|
40
|
+
owner?: string;
|
|
41
|
+
/** A Web Lock the handler holds while it lives. */
|
|
42
|
+
ownerLock?: string;
|
|
43
|
+
/** Whatever the host wants a `route` function to see. */
|
|
44
|
+
meta?: unknown;
|
|
45
|
+
/** Which ports follow `down` in the transfer list, in this order. */
|
|
46
|
+
ctl?: boolean;
|
|
47
|
+
up?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface AttachReply {
|
|
50
|
+
/** `HTTP_LINK_PROTOCOL`: proves the worker speaks it. */
|
|
51
|
+
accepted: string;
|
|
52
|
+
/** The Web Lock the ServiceWorker holds while it lives; absent without Web Locks. */
|
|
53
|
+
routerLock?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DrainParams {
|
|
56
|
+
key: string;
|
|
57
|
+
id: string;
|
|
58
|
+
owner: string;
|
|
59
|
+
/** How long requests in flight may run before the link is closed anyway. */
|
|
60
|
+
ms?: number;
|
|
61
|
+
}
|
|
62
|
+
export interface NeedLinksParams {
|
|
63
|
+
/** Links made for this router are alive; only the others need attaching again. */
|
|
64
|
+
routerLock?: string;
|
|
65
|
+
}
|
|
66
|
+
/** The `ctl` port's messages. */
|
|
67
|
+
export type ControlMessage = {
|
|
68
|
+
t: "ws-connect";
|
|
69
|
+
id: string;
|
|
70
|
+
url: string;
|
|
71
|
+
protocols: string[];
|
|
72
|
+
headers?: [string, string][];
|
|
73
|
+
} | {
|
|
74
|
+
t: "ws-accept";
|
|
75
|
+
id: string;
|
|
76
|
+
protocol: string;
|
|
77
|
+
port: MessagePort;
|
|
78
|
+
} | {
|
|
79
|
+
t: "ws-refuse";
|
|
80
|
+
id: string;
|
|
81
|
+
status: number;
|
|
82
|
+
message: string;
|
|
83
|
+
} | {
|
|
84
|
+
t: "ws-open";
|
|
85
|
+
id: string;
|
|
86
|
+
url: string;
|
|
87
|
+
protocols: string[];
|
|
88
|
+
} | {
|
|
89
|
+
t: "ws-opened";
|
|
90
|
+
id: string;
|
|
91
|
+
protocol: string;
|
|
92
|
+
port: MessagePort;
|
|
93
|
+
} | {
|
|
94
|
+
t: "ws-failed";
|
|
95
|
+
id: string;
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
/** Page ↔ worker: what `attachWorker` and `serveHttpInWorker` exchange. */
|
|
99
|
+
export declare const WORKER_HELLO = "webrun-http:worker-hello";
|
|
100
|
+
export type WorkerControlMessage = {
|
|
101
|
+
type: "ready";
|
|
102
|
+
ownerLock?: string;
|
|
103
|
+
} | {
|
|
104
|
+
type: "link";
|
|
105
|
+
key: string;
|
|
106
|
+
routerLock?: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: "unlink";
|
|
109
|
+
key: string;
|
|
110
|
+
} | {
|
|
111
|
+
type: "relink";
|
|
112
|
+
} | {
|
|
113
|
+
type: "keepalive";
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/sw/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,uFAAuF;AACvF,eAAO,MAAM,WAAW,8BAA8B,CAAC;AACvD,uDAAuD;AACvD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,6FAA6F;AAC7F,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,2DAA2D;AAC3D,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,oFAAoF;AACpF,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD;;;;GAIG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,S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,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACnE;IAAE,CAAC,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,2EAA2E;AAC3E,eAAO,MAAM,YAAY,6BAA6B,CAAC;AAEvD,MAAM,MAAM,oBAAoB,GAE5B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAErC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAElD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAE/B;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAElB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw-dispatcher.d.ts","sourceRoot":"","sources":["../../src/sw/sw-dispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sw-dispatcher.d.ts","sourceRoot":"","sources":["../../src/sw/sw-dispatcher.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;I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