@fkn/lib 0.9.33 → 0.9.35
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/account.cjs +1 -1
- package/account.d.ts +6 -6
- package/account.js +3 -3
- package/{api-Cc5qxCHP.d.ts → api-CfmRAze5.d.ts} +3 -1
- package/{api-BlAtp6lc.js → api-CtiKFcK3.js} +62 -47
- package/api-Djf-XdZ4.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/attach-policy.cjs +1 -1
- package/attach-policy.d.ts +32 -7
- package/attach-policy.js +16 -18
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.d.ts +3 -4
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +2 -2
- package/cloud/fs.js +2 -2
- package/cloud/net.d.ts +1 -1
- package/cloud-B9Sd7V1g.js +422 -0
- package/cloud-DCWD_0sd.cjs +1 -0
- package/{cloud-D0Ebu5bX.d.ts → cloud-DxitkM7z.d.ts} +9 -5
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +2 -2
- package/{contract-CahPObYc.d.ts → contract-D37GGkou.d.ts} +146 -1
- package/contract.cjs +1 -0
- package/contract.d.ts +2 -2
- package/contract.js +28 -0
- package/desktop.d.ts +7 -7
- package/dgram.cjs +1 -1
- package/dgram.d.ts +5 -5
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -3
- package/dns.js +1 -1
- package/extension-DJQ0oYdk.js +89 -0
- package/extension-DSrUjoLw.cjs +1 -0
- package/{extension-DNkuFy1Y.d.ts → extension-TRYu_aG-.d.ts} +36 -157
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +3 -3
- package/fs/promises.js +1 -1
- package/{fs-CYcErwc4.d.ts → fs--NhtUyYa.d.ts} +1 -1
- package/{fs-BSsWw8HM.js → fs-BvNZePtN.js} +4 -4
- package/{fs-DxDxbvRS.cjs → fs-D8RCGFNc.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/hosts-C4-8lWwz.js +161 -0
- package/hosts-DD4rDeQH.cjs +1 -0
- package/http.d.ts +20 -20
- package/{index-DH3_12nU.d.ts → index-C_Lqta5o.d.ts} +385 -7
- package/{index-Cg6y_FTi.d.ts → index-kuPqkS_-.d.ts} +26 -3
- package/index.cjs +1 -1
- package/index.d.ts +25 -10
- package/index.js +68 -62
- package/{lib-duLPF_WZ.js → lib-B-jGWfsv.js} +597 -396
- package/lib-Cjd91q7g.cjs +53 -0
- package/{net-BXPEJToS.d.ts → net-0SlODFSM.d.ts} +2 -2
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/node-fs-BNTPsX5c.cjs +1 -0
- package/{node-fs-C9ECR_9H.js → node-fs-BZy9bzKd.js} +2 -2
- package/opfs/promises.d.ts +2 -2
- package/opfs.cjs +1 -1
- package/opfs.d.ts +2 -2
- package/opfs.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +27 -27
- package/packages.js +1 -1
- package/{proxy-DxiJU5Y_.d.ts → proxy-Bmb2wxG1.d.ts} +2 -2
- package/proxy-CYcaW5ew.cjs +1 -0
- package/proxy-DDwY3AVG.js +60 -0
- package/react.d.ts +3 -3
- package/rooms.cjs +1 -1
- package/rooms.d.ts +8 -8
- package/rooms.js +1 -1
- package/{storage-Bo01npo9.js → storage-BbcnDCnc.js} +1 -1
- package/{storage-WZEvw3KN.d.ts → storage-ZrY4Y4L5.d.ts} +21 -2
- package/{storage-DEjjVCT2.cjs → storage-dSi2dUKx.cjs} +1 -1
- package/api-Beky02FK.cjs +0 -3
- package/cloud-BZmduWyX.cjs +0 -1
- package/cloud-DaVb11IV.js +0 -174
- package/extension-D70dtUvW.cjs +0 -1
- package/extension-DdXNlt9_.js +0 -84
- package/lib-DLM2M3_i.cjs +0 -53
- package/node-fs-DZPGCYWg.cjs +0 -1
- package/proxy-DexG-Wmk.cjs +0 -1
- package/proxy-VY0HRl2E.js +0 -75
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { B as SelectorPart, f as GotoOptions } from "./index-C_Lqta5o.js";
|
|
1
2
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
3
|
//#region src/contract.d.ts
|
|
3
4
|
/** The signed-in account, or null when nobody is. */
|
|
@@ -65,11 +66,152 @@ type AddressLookupResult = {
|
|
|
65
66
|
address: string;
|
|
66
67
|
family: 0 | 4 | 6;
|
|
67
68
|
};
|
|
69
|
+
/** @deprecated the pre-category fetch scopes. Still exported so a pinned library keeps compiling; the card maps them to `network`. */
|
|
68
70
|
type FrameFetchScope = 'frame.fetchRead' | 'frame.fetchWrite';
|
|
71
|
+
/**
|
|
72
|
+
* One row on the cloud consent card.
|
|
73
|
+
*
|
|
74
|
+
* A category asks for every capability in it; a `key` asks for one critical permission's own row,
|
|
75
|
+
* and is refused unless the registry has that key at severity 4. `attach` binds an "Allow once"
|
|
76
|
+
* answer to the attachment that asked, so no other attachment can consume it.
|
|
77
|
+
*/
|
|
69
78
|
type FrameConsentRequest = {
|
|
79
|
+
category: 'interaction' | 'storage' | 'network' | 'evaluation';
|
|
80
|
+
hosts: string[];
|
|
81
|
+
} | {
|
|
82
|
+
key: string;
|
|
83
|
+
hosts: string[];
|
|
84
|
+
attach?: string;
|
|
85
|
+
} | {
|
|
70
86
|
scope: FrameFetchScope;
|
|
71
87
|
hosts: string[];
|
|
72
88
|
};
|
|
89
|
+
/** `'once'` is a critical row answered Allow once, a handoff the middle page takes; `'session'` a row standing for the tab; `false` a refusal. */
|
|
90
|
+
type FrameConsentAnswer = 'once' | 'session' | false;
|
|
91
|
+
/** The osra key of an inline attachment's channel, which `/attach-frame` exposes to the library. */
|
|
92
|
+
declare const ATTACH_FRAME_KEY = "fkn-attach-frame";
|
|
93
|
+
/** The osra key of a window attachment's channel, which `/attach-window` exposes to its opener. */
|
|
94
|
+
declare const ATTACH_WINDOW_KEY = "fkn-attach-window";
|
|
95
|
+
/** The osra key of the render proxy shell's control channel, which its middle page drives. */
|
|
96
|
+
declare const SHELL_CONTROL_KEY = "sdbx-control";
|
|
97
|
+
/** Posted by a shell that could not start, `{ type, message }`, to the middle page framing it. */
|
|
98
|
+
declare const SHELL_ATTACH_ERROR = "sdbx-attach-error";
|
|
99
|
+
/** What an app and its window post to each other, every message carrying the attach id. */
|
|
100
|
+
declare const ATTACH_WINDOW_MESSAGE: {
|
|
101
|
+
/** app to window, repeated until the channel connects */
|
|
102
|
+
readonly hello: 'fkn-attach-window';
|
|
103
|
+
/** window to app, `{ reason }`: the window loaded nothing and exposes nothing */
|
|
104
|
+
readonly refused: 'fkn-attach-window-refused';
|
|
105
|
+
/** window to app: this window no longer answers the app, because it is going away or was dropped */
|
|
106
|
+
readonly gone: 'fkn-attach-window-gone';
|
|
107
|
+
/**
|
|
108
|
+
* app to window, whenever the app ends the attachment (its pagehide included): stop answering this
|
|
109
|
+
* app. `unanswered: true` when it ended because the window stopped answering its pings.
|
|
110
|
+
*/
|
|
111
|
+
readonly detach: 'fkn-attach-window-detach';
|
|
112
|
+
};
|
|
113
|
+
/** What a window's shell and its middle page say about the shell's cookie jar, all with the attach id. */
|
|
114
|
+
declare const SHELL_JAR_MESSAGE: {
|
|
115
|
+
/** shell to middle page, once per shell document: send me the port to the opener's jar host */
|
|
116
|
+
readonly request: 'sdbx-jar-request';
|
|
117
|
+
/** middle page to shell, carrying exactly one port */
|
|
118
|
+
readonly port: 'sdbx-jar-port';
|
|
119
|
+
/** shell to middle page, `{ mode, reason? }`, before the first navigation */
|
|
120
|
+
readonly mode: 'sdbx-jar-mode';
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Why a window's shell reached no jar, sent as the `reason` of an `'unreachable'` mode report. Only
|
|
124
|
+
* these names cross the wire, never a value or an error's own text.
|
|
125
|
+
*/
|
|
126
|
+
declare const SHELL_JAR_UNREACHABLE: readonly ['bad-attach', 'no-storage', 'bad-jar', 'no-parent', 'no-jar-host', 'no-token', 'no-indexeddb', 'failed'];
|
|
127
|
+
type ShellJarUnreachable = (typeof SHELL_JAR_UNREACHABLE)[number];
|
|
128
|
+
/**
|
|
129
|
+
* What a window's middle page, the jar anchor its app mounted (`/attach-jar`) and the anchor's jar
|
|
130
|
+
* host say, all with the attach id.
|
|
131
|
+
*/
|
|
132
|
+
declare const JAR_ANCHOR_MESSAGE: {
|
|
133
|
+
/** window to each frame of its opener: is the anchor for this attachment here? */
|
|
134
|
+
readonly hello: 'fkn-jar-hello';
|
|
135
|
+
/** anchor to the window it accepted */
|
|
136
|
+
readonly ready: 'fkn-jar-ready';
|
|
137
|
+
/** window to anchor, and anchor to jar host, carrying exactly one port */
|
|
138
|
+
readonly port: 'fkn-jar-port';
|
|
139
|
+
/** anchor to jar host, after every load of the host frame: are you the jar host? */
|
|
140
|
+
readonly who: 'fkn-jar-who';
|
|
141
|
+
/** jar host to anchor: the answer, the only one a port is relayed to */
|
|
142
|
+
readonly host: 'fkn-jar-host';
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* How long a window waits for its app's first hello, from when its page runs. The app says hello
|
|
146
|
+
* every 250 ms from the moment it opens the window, so only an app that went away misses it.
|
|
147
|
+
*/
|
|
148
|
+
declare const WINDOW_HELLO_TIMEOUT_MS = 20000;
|
|
149
|
+
/**
|
|
150
|
+
* How long a window waits, from mounting its shell, for the shell to report the jar it runs on: the
|
|
151
|
+
* shell's jar port wait (12 s), its partition token read (5 s) and a controller boot. The window
|
|
152
|
+
* exposes its channel only after that report, so the app waits for both of these and more.
|
|
153
|
+
*/
|
|
154
|
+
declare const WINDOW_JAR_MODE_TIMEOUT_MS = 30000;
|
|
155
|
+
/**
|
|
156
|
+
* How long an app waits for a window's channel. The window exposes it only once it has heard the
|
|
157
|
+
* app's hello and its shell has reported a jar, each on its own deadline above and one after the
|
|
158
|
+
* other, and says by name when it cannot; the margin covers the window's own page load and the
|
|
159
|
+
* channel's handshake after it. Any shorter and the app gives up on a window that is about to
|
|
160
|
+
* connect, or to say why it cannot.
|
|
161
|
+
*/
|
|
162
|
+
declare const WINDOW_HANDSHAKE_TIMEOUT_MS: number;
|
|
163
|
+
/** A goto on the shell's control channel. */
|
|
164
|
+
type ShellGotoOptions = GotoOptions & {
|
|
165
|
+
timeoutMs?: number;
|
|
166
|
+
/**
|
|
167
|
+
* For an attachment's first navigation: past its deadline, a document that committed but never
|
|
168
|
+
* fired load counts as loaded, the rule the inline attachment's first load follows. Ignored by a
|
|
169
|
+
* shell deployed before windows, which rejects at the deadline instead.
|
|
170
|
+
*/
|
|
171
|
+
commitFallback?: boolean;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* The render proxy shell's control channel (`SHELL_CONTROL_KEY`), as its middle page drives it.
|
|
175
|
+
* `policy` is the middle page's realm policy for the call; `flushCookies` and `sweepStorage` are
|
|
176
|
+
* absent from a shell deployed before windows.
|
|
177
|
+
*/
|
|
178
|
+
type ShellControl = {
|
|
179
|
+
ready(): Promise<boolean>;
|
|
180
|
+
/** Pulls the committed jar first, so a sign-in another realm committed rides this navigation. */
|
|
181
|
+
goto(url: string, options?: ShellGotoOptions): Promise<void>;
|
|
182
|
+
executeLocator(parts: SelectorPart[], operation: string, args: unknown[], policy?: unknown): Promise<unknown>;
|
|
183
|
+
/** Resolves once every cookie change made so far is committed to the jar's store. */
|
|
184
|
+
flushCookies?(): Promise<void>;
|
|
185
|
+
/** Removes a window shell's own site storage; resolves at once for a shell whose storage is shared. */
|
|
186
|
+
sweepStorage?(): Promise<void>;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* What a middle page exposes to the library, inline (`ATTACH_FRAME_KEY`) and for a window
|
|
190
|
+
* (`ATTACH_WINDOW_KEY`). `documentHost`, where the frame actually is, is absent from a middle page
|
|
191
|
+
* deployed before categories.
|
|
192
|
+
*/
|
|
193
|
+
type MiddleControl = {
|
|
194
|
+
ready(): Promise<boolean>;
|
|
195
|
+
goto(url: string, options?: GotoOptions & {
|
|
196
|
+
timeoutMs?: number;
|
|
197
|
+
}): Promise<void>;
|
|
198
|
+
executeLocator(parts: SelectorPart[], operation: string, args: unknown[]): Promise<unknown>;
|
|
199
|
+
documentHost?(): Promise<string>;
|
|
200
|
+
};
|
|
201
|
+
/** What a window's middle page adds to its channel. */
|
|
202
|
+
type WindowMiddleControl = MiddleControl & {
|
|
203
|
+
/** Draws the consent card in the window and answers each request in order. */
|
|
204
|
+
requestConsent(requests: FrameConsentRequest[]): Promise<FrameConsentAnswer[]>;
|
|
205
|
+
/** The app's heartbeat: a window that hears none for long enough stops answering. */
|
|
206
|
+
ping(): Promise<true>;
|
|
207
|
+
/** Resolves once every cookie change made in the window so far is committed to its jar. */
|
|
208
|
+
flushCookies(): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Removes the proxied site storage this window kept to itself, for an app about to close it.
|
|
211
|
+
* Resolves at once for a window on the web origin's own jar, whose storage is the app's.
|
|
212
|
+
*/
|
|
213
|
+
sweepStorage(): Promise<void>;
|
|
214
|
+
};
|
|
73
215
|
type DisplayCause =
|
|
74
216
|
/** the frame is not being painted at all, so an ancestor is display:none, visibility:hidden or equivalent */
|
|
75
217
|
'not-rendered' |
|
|
@@ -528,7 +670,10 @@ type Resolvers = {
|
|
|
528
670
|
hide: () => void;
|
|
529
671
|
};
|
|
530
672
|
frameConsent: {
|
|
673
|
+
/** the legacy single-row entry, kept so a pinned library keeps working */
|
|
531
674
|
ensure: (request: FrameConsentRequest) => Promise<boolean>;
|
|
675
|
+
/** one card with a row per request; answers in request order */
|
|
676
|
+
request: (requests: FrameConsentRequest[]) => Promise<FrameConsentAnswer[]>;
|
|
532
677
|
};
|
|
533
678
|
connect: {
|
|
534
679
|
prompt: (consumerOrigin: string) => Promise<boolean>;
|
|
@@ -599,4 +744,4 @@ type Resolvers = {
|
|
|
599
744
|
hideInstallPrompt: () => void;
|
|
600
745
|
};
|
|
601
746
|
//#endregion
|
|
602
|
-
export {
|
|
747
|
+
export { RoomPermissions as $, PackageResult as A, Resolvers as B, IpFamily as C, WindowMiddleControl as Ct, OverlayRect as D, MountDescriptor as E, ProxyFetch as F, RoomEvent as G, RoomCreateOptions as H, ProxyFetchInit as I, RoomMailbox as J, RoomHandle as K, ProxyFetchInput as L, PackagesFail as M, PickOptions as N, OverlayState as O, Placement as P, RoomPermission as Q, Quota as R, InstalledPackage as S, WINDOW_JAR_MODE_TIMEOUT_MS as St, MiddleControl as T, RoomDefaults as U, RoomBacklog as V, RoomEnd as W, RoomMessage as X, RoomMember as Y, RoomOpenOptions as Z, FrameConsentAnswer as _, UdpDatagram as _t, AddressLookupResult as a, SHELL_JAR_UNREACHABLE as at, HiddenSurface as b, WINDOW_HANDSHAKE_TIMEOUT_MS as bt, ConflictChoice as c, ShellGotoOptions as ct, ConnectAvailability as d, StorageQuota as dt, RoomsErrorCode as et, ConnectOptions as f, SurfaceRect as ft, EncryptionState as g, TcpSocketResult as gt, DnsLookup as h, TcpSocketOptions as ht, Account as i, SHELL_JAR_MESSAGE as it, PackagesErrorCode as j, PackageQuery as k, ConflictRequest as l, ShellJarUnreachable as lt, DisplayLevel as m, TcpSocketListenerResult as mt, ATTACH_WINDOW_KEY as n, SHELL_ATTACH_ERROR as nt, AdoptRequest as o, SetOverlayHost as ot, DisplayCause as p, TcpSocketListenerOptions as pt, RoomJoinOptions as q, ATTACH_WINDOW_MESSAGE as r, SHELL_CONTROL_KEY as rt, AdoptState as s, ShellControl as st, ATTACH_FRAME_KEY as t, RoomsFail as tt, ConflictSide as u, StorageEntry as ut, FrameConsentRequest as v, UdpSocketOptions as vt, JAR_ANCHOR_MESSAGE as w, WriteData as wt, InstallOptions as x, WINDOW_HELLO_TIMEOUT_MS as xt, FrameFetchScope as y, UdpSocketResult as yt, Radii as z };
|
package/contract.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`fkn-attach-frame`,t=`fkn-attach-window`,n=`sdbx-control`,r=`sdbx-attach-error`,i={hello:`fkn-attach-window`,refused:`fkn-attach-window-refused`,gone:`fkn-attach-window-gone`,detach:`fkn-attach-window-detach`},a={request:`sdbx-jar-request`,port:`sdbx-jar-port`,mode:`sdbx-jar-mode`},o=[`bad-attach`,`no-storage`,`bad-jar`,`no-parent`,`no-jar-host`,`no-token`,`no-indexeddb`,`failed`],s={hello:`fkn-jar-hello`,ready:`fkn-jar-ready`,port:`fkn-jar-port`,who:`fkn-jar-who`,host:`fkn-jar-host`},c=2e4,l=3e4,u=6e4;exports.ATTACH_FRAME_KEY=e,exports.ATTACH_WINDOW_KEY=t,exports.ATTACH_WINDOW_MESSAGE=i,exports.JAR_ANCHOR_MESSAGE=s,exports.SHELL_ATTACH_ERROR=r,exports.SHELL_CONTROL_KEY=n,exports.SHELL_JAR_MESSAGE=a,exports.SHELL_JAR_UNREACHABLE=o,exports.WINDOW_HANDSHAKE_TIMEOUT_MS=u,exports.WINDOW_HELLO_TIMEOUT_MS=c,exports.WINDOW_JAR_MODE_TIMEOUT_MS=l;
|
package/contract.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
export { Account, AddressLookupResult, AdoptRequest, AdoptState, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FrameConsentRequest, FrameFetchScope, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, Radii, Resolvers, RoomBacklog, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SetOverlayHost, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WriteData };
|
|
2
|
+
import { $ as RoomPermissions, A as PackageResult, B as Resolvers, C as IpFamily, Ct as WindowMiddleControl, D as OverlayRect, E as MountDescriptor, F as ProxyFetch, G as RoomEvent, H as RoomCreateOptions, I as ProxyFetchInit, J as RoomMailbox, K as RoomHandle, L as ProxyFetchInput, M as PackagesFail, N as PickOptions, O as OverlayState, P as Placement, Q as RoomPermission, R as Quota, S as InstalledPackage, St as WINDOW_JAR_MODE_TIMEOUT_MS, T as MiddleControl, U as RoomDefaults, V as RoomBacklog, W as RoomEnd, X as RoomMessage, Y as RoomMember, Z as RoomOpenOptions, _ as FrameConsentAnswer, _t as UdpDatagram, a as AddressLookupResult, at as SHELL_JAR_UNREACHABLE, b as HiddenSurface, bt as WINDOW_HANDSHAKE_TIMEOUT_MS, c as ConflictChoice, ct as ShellGotoOptions, d as ConnectAvailability, dt as StorageQuota, et as RoomsErrorCode, f as ConnectOptions, ft as SurfaceRect, g as EncryptionState, gt as TcpSocketResult, h as DnsLookup, ht as TcpSocketOptions, i as Account, it as SHELL_JAR_MESSAGE, j as PackagesErrorCode, k as PackageQuery, l as ConflictRequest, lt as ShellJarUnreachable, m as DisplayLevel, mt as TcpSocketListenerResult, n as ATTACH_WINDOW_KEY, nt as SHELL_ATTACH_ERROR, o as AdoptRequest, ot as SetOverlayHost, p as DisplayCause, pt as TcpSocketListenerOptions, q as RoomJoinOptions, r as ATTACH_WINDOW_MESSAGE, rt as SHELL_CONTROL_KEY, s as AdoptState, st as ShellControl, t as ATTACH_FRAME_KEY, tt as RoomsFail, u as ConflictSide, ut as StorageEntry, v as FrameConsentRequest, vt as UdpSocketOptions, w as JAR_ANCHOR_MESSAGE, wt as WriteData, x as InstallOptions, xt as WINDOW_HELLO_TIMEOUT_MS, y as FrameFetchScope, yt as UdpSocketResult, z as Radii } from "./contract-D37GGkou.js";
|
|
3
|
+
export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AddressLookupResult, AdoptRequest, AdoptState, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, MiddleControl, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, Radii, Resolvers, RoomBacklog, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
|
package/contract.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/contract.ts
|
|
2
|
+
var e = "fkn-attach-frame", t = "fkn-attach-window", n = "sdbx-control", r = "sdbx-attach-error", i = {
|
|
3
|
+
hello: "fkn-attach-window",
|
|
4
|
+
refused: "fkn-attach-window-refused",
|
|
5
|
+
gone: "fkn-attach-window-gone",
|
|
6
|
+
detach: "fkn-attach-window-detach"
|
|
7
|
+
}, a = {
|
|
8
|
+
request: "sdbx-jar-request",
|
|
9
|
+
port: "sdbx-jar-port",
|
|
10
|
+
mode: "sdbx-jar-mode"
|
|
11
|
+
}, o = [
|
|
12
|
+
"bad-attach",
|
|
13
|
+
"no-storage",
|
|
14
|
+
"bad-jar",
|
|
15
|
+
"no-parent",
|
|
16
|
+
"no-jar-host",
|
|
17
|
+
"no-token",
|
|
18
|
+
"no-indexeddb",
|
|
19
|
+
"failed"
|
|
20
|
+
], s = {
|
|
21
|
+
hello: "fkn-jar-hello",
|
|
22
|
+
ready: "fkn-jar-ready",
|
|
23
|
+
port: "fkn-jar-port",
|
|
24
|
+
who: "fkn-jar-who",
|
|
25
|
+
host: "fkn-jar-host"
|
|
26
|
+
}, c = 2e4, l = 3e4, u = 6e4;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { e as ATTACH_FRAME_KEY, t as ATTACH_WINDOW_KEY, i as ATTACH_WINDOW_MESSAGE, s as JAR_ANCHOR_MESSAGE, r as SHELL_ATTACH_ERROR, n as SHELL_CONTROL_KEY, a as SHELL_JAR_MESSAGE, o as SHELL_JAR_UNREACHABLE, u as WINDOW_HANDSHAKE_TIMEOUT_MS, c as WINDOW_HELLO_TIMEOUT_MS, l as WINDOW_JAR_MODE_TIMEOUT_MS };
|
package/desktop.d.ts
CHANGED
|
@@ -2,25 +2,25 @@ declare namespace desktop_d_exports {
|
|
|
2
2
|
export { available, dgram, dns, fetch, fs, net };
|
|
3
3
|
}
|
|
4
4
|
/** Typed placeholder for the planned desktop backend. Always false in this release. */
|
|
5
|
-
declare const available: () => boolean;
|
|
5
|
+
export declare const available: () => boolean;
|
|
6
6
|
/** Planned desktop fetch backend. Throws in this release. */
|
|
7
|
-
declare const fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
7
|
+
export declare const fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
8
8
|
/** Planned desktop DNS backend. Every method throws in this release. */
|
|
9
|
-
declare const dns: {
|
|
9
|
+
export declare const dns: {
|
|
10
10
|
lookup: (..._args: unknown[]) => never;
|
|
11
11
|
};
|
|
12
12
|
/** Planned desktop TCP backend. Every method throws in this release. */
|
|
13
|
-
declare const net: {
|
|
13
|
+
export declare const net: {
|
|
14
14
|
connect: (..._args: unknown[]) => never;
|
|
15
15
|
createConnection: (..._args: unknown[]) => never;
|
|
16
16
|
createServer: (..._args: unknown[]) => never;
|
|
17
17
|
};
|
|
18
18
|
/** Planned desktop UDP backend. Every method throws in this release. */
|
|
19
|
-
declare const dgram: {
|
|
19
|
+
export declare const dgram: {
|
|
20
20
|
createSocket: (..._args: unknown[]) => never;
|
|
21
21
|
};
|
|
22
22
|
/** Planned desktop storage backend. available() resolves false; storage operations throw. */
|
|
23
|
-
declare const fs: {
|
|
23
|
+
export declare const fs: {
|
|
24
24
|
available: () => Promise<boolean>;
|
|
25
25
|
readFile: (..._args: unknown[]) => never;
|
|
26
26
|
readFileSync: (..._args: unknown[]) => never;
|
|
@@ -55,4 +55,4 @@ declare const fs: {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
//#endregion
|
|
58
|
-
export {
|
|
58
|
+
export { desktop_d_exports as t };
|
package/dgram.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Beky02FK.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-BvgGdrgN.cjs");require("./wire.cjs");let i=require("buffer"),a=require("events"),o=require("ip-address");var s=e.t({Socket:()=>c,createSocket:()=>m,default:()=>h}),c=class extends a.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_busyRelease;_webVPNUdpSocketPromise;_dataPort;_socketId;_sendQueue=[];_sendQueueBytes=0;_sendFlushScheduled=!1;_peerTailCache=new Map;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type,e.connection&&this.__webvpn_udp_socket_init__(e.connection)}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}_dataPortAcks=!1;_dataPortConsumedBytes=0;_dataPortAckedBytes=0;_ackDataPortBatch(e){if(!this._dataPortAcks||!this._dataPort||(this._dataPortConsumedBytes+=e,this._dataPortAckedBytes!==0&&this._dataPortConsumedBytes-this._dataPortAckedBytes<524288))return;this._dataPortAckedBytes=this._dataPortConsumedBytes;let t={type:r.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0,this.listenerCount(`error`)>0&&this.emit(`error`,Error(e||`WebVPN session closed`)),this.emit(`close`))}_onDataPortBatch(e){let t=new DataView(e),n=!1,r,a=0;for(;a+4<=e.byteLength;){let o=t.getUint32(a);a+=4;let s=a+o;if(s>e.byteLength)break;let c=a+4,l=t.getUint8(c);c+=1;let u,d,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,d=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(d=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(d=`IPv6`,u=f(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,i.Buffer.from(e.slice(c,c+m)),{address:u,family:d,port:p,size:m})}catch(e){n||(n=!0,r=e)}a=s}if(n)throw r}_peerTail(e,t){if(e===void 0||t===void 0)return l;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=o.Address4.isValid(e)?d(e):p(e),a=new Uint8Array(1+i.byteLength+2);return a[0]=i.byteLength===4?0:1,a.set(i,1),new DataView(a.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,a),a}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let n=r.o(...e),i=this._type===`udp6`?`::`:`0.0.0.0`,a=this.__webvpn_udp_socket_init__(t.o(`a udp socket`).then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:n.address??i,port:n.port,dataPort:!0})));return n.callback&&a.then(e=>{e&&n.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._busyRelease??=n.t(`udp socket`),this._webVPNUdpSocketPromise=e.then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPortAcks=e.dataPortAcks===!0,this._dataPort.onmessage=e=>{try{this._onDataPortBatch(e.data)}finally{this._ackDataPortBatch(e.data.byteLength)}};else{let t=e.dataReadableStream.getReader();(async()=>{for(;;){let{value:e,done:n}=await t.read();if(n)return;this.emit(`message`,i.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size})}})().catch(e=>this._onTransportClosed(e instanceof Error?e.message:void 0))}return e.closed?.then(e=>this._onTransportClosed(e?.reason)).catch(()=>{}),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNUdpSocketPromise}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=this._destroyed;this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0;try{await t.close()}finally{try{e&&e()}finally{n||this.emit(`close`)}}}).catch(()=>{}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0,o=await t.connect({remotePort:n,remoteAddress:i});this._connectedLocally=o?.local===!0,this._remoteAddress=o?.address?{address:o.address,family:o.family,port:o.port}:{address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},this._connectGeneration+=1,a&&a()}).catch(e=>{this.emit(`error`,e)})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);let e=this._remoteAddress,t=this._connectedLocally,n=this._connectGeneration;this._remoteAddress=void 0,this._connectedLocally=void 0,this._webVPNUdpSocketPromise.then(e=>e?.disconnect?.()).catch(r=>{this._connectGeneration===n&&(this._remoteAddress=e,this._connectedLocally=t),this.emit(`error`,r)})}dropMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=r.s(...e),n=u(t.message),i=n;if(t.hasRange){let{offset:e,length:r}=t;if(!Number.isInteger(e)||e<0||e>n.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(r)||r<0||r>n.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=n.subarray(e,e+r)}let a=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let n=t.callback,r=t.address??a,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||o.Address4.isValid(r)||o.Address6.isValid(r))){this._portSend(i,s?void 0:r,s?void 0:t.port),n?.call(this,null,i.byteLength);return}e.send({port:t.port,address:r,message:i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}).then(()=>n?.call(this,null,i.byteLength),e=>n?n.call(this,e,0):this.emit(`error`,e))})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},l=new Uint8Array([2]),u=e=>{if(typeof e==`string`)return r.l.encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e)){let t=e.map(u),n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}return new Uint8Array(e)},d=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},f=e=>{let t=[];for(let n=0;n<16;n+=2)t.push(e[n]<<8|e[n+1]);let n=-1,r=1;for(let e=0;e<8;){if(t[e]!==0){e++;continue}let i=e;for(;i<8&&t[i]===0;)i++;i-e>r&&(n=e,r=i-e),e=i}return n===-1?t.map(e=>e.toString(16)).join(`:`):`${t.slice(0,n).map(e=>e.toString(16)).join(`:`)}::${t.slice(n+r).map(e=>e.toString(16)).join(`:`)}`},p=e=>{let t=new o.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},m=(e,t)=>{let n=new c(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},h={Socket:c,createSocket:m};exports.Socket=c,exports.createSocket=m,exports.default=h,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs"),n=require("./busy-Dv8wzE5M.cjs"),r=require("./utils-BvgGdrgN.cjs");require("./wire.cjs");let i=require("buffer"),a=require("events"),o=require("ip-address");var s=e.t({Socket:()=>c,createSocket:()=>m,default:()=>h}),c=class extends a.EventEmitter{_type;_localAddress;_remoteAddress;_connectedLocally;_connectGeneration=0;_destroyed=!1;_busyRelease;_webVPNUdpSocketPromise;_dataPort;_socketId;_sendQueue=[];_sendQueueBytes=0;_sendFlushScheduled=!1;_peerTailCache=new Map;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type,e.connection&&this.__webvpn_udp_socket_init__(e.connection)}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}_dataPortAcks=!1;_dataPortConsumedBytes=0;_dataPortAckedBytes=0;_ackDataPortBatch(e){if(!this._dataPortAcks||!this._dataPort||(this._dataPortConsumedBytes+=e,this._dataPortAckedBytes!==0&&this._dataPortConsumedBytes-this._dataPortAckedBytes<524288))return;this._dataPortAckedBytes=this._dataPortConsumedBytes;let t={type:r.n,consumedBytes:this._dataPortConsumedBytes};this._dataPort.postMessage(t)}_onTransportClosed(e){this._destroyed||(this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0,this.listenerCount(`error`)>0&&this.emit(`error`,Error(e||`WebVPN session closed`)),this.emit(`close`))}_onDataPortBatch(e){let t=new DataView(e),n=!1,r,a=0;for(;a+4<=e.byteLength;){let o=t.getUint32(a);a+=4;let s=a+o;if(s>e.byteLength)break;let c=a+4,l=t.getUint8(c);c+=1;let u,d,p;if(l===2){if(!this._remoteAddress){a=s;continue}u=this._remoteAddress.address,d=this._remoteAddress.family,p=this._remoteAddress.port}else{let n=new Uint8Array(e,c,l===0?4:16);l===0?(d=`IPv4`,u=`${n[0]}.${n[1]}.${n[2]}.${n[3]}`):(d=`IPv6`,u=f(n)),c+=n.byteLength,p=t.getUint16(c),c+=2}let m=t.getUint32(c);c+=4;try{this.emit(`message`,i.Buffer.from(e.slice(c,c+m)),{address:u,family:d,port:p,size:m})}catch(e){n||(n=!0,r=e)}a=s}if(n)throw r}_peerTail(e,t){if(e===void 0||t===void 0)return l;let n=`${e}|${t}`,r=this._peerTailCache.get(n);if(r)return r;let i=o.Address4.isValid(e)?d(e):p(e),a=new Uint8Array(1+i.byteLength+2);return a[0]=i.byteLength===4?0:1,a.set(i,1),new DataView(a.buffer).setUint16(1+i.byteLength,t),this._peerTailCache.size>=4096&&this._peerTailCache.clear(),this._peerTailCache.set(n,a),a}_portSend(e,t,n){let r=this._peerTail(t,n),i=new Uint8Array(8+r.byteLength+4+e.byteLength),a=new DataView(i.buffer);a.setUint32(0,i.byteLength-4),a.setUint32(4,this._socketId),i.set(r,8),a.setUint32(8+r.byteLength,e.byteLength),i.set(e,12+r.byteLength),this._sendQueue.push(i),this._sendQueueBytes+=i.byteLength,!this._sendFlushScheduled&&(this._sendFlushScheduled=!0,queueMicrotask(()=>{this._sendFlushScheduled=!1;let e=this._sendQueue,t=this._sendQueueBytes;if(this._sendQueue=[],this._sendQueueBytes=0,!e.length||!this._dataPort)return;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;this._dataPort.postMessage(n.buffer,[n.buffer])}))}addMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let n=r.o(...e),i=this._type===`udp6`?`::`:`0.0.0.0`,a=this.__webvpn_udp_socket_init__(t.o(`a udp socket`).then(e=>e.cloud.webvpn.udpSocket({type:this._type,address:n.address??i,port:n.port,dataPort:!0})));return n.callback&&a.then(e=>{e&&n.callback.call(this)}),this}__webvpn_udp_socket_init__(e,t){return t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort}),this._busyRelease??=n.t(`udp socket`),this._webVPNUdpSocketPromise=e.then(e=>{if(e.dataPort)this._socketId=e.socketId,this._dataPort=e.dataPort,this._dataPortAcks=e.dataPortAcks===!0,this._dataPort.onmessage=e=>{try{this._onDataPortBatch(e.data)}finally{this._ackDataPortBatch(e.data.byteLength)}};else{let t=e.dataReadableStream.getReader();(async()=>{for(;;){let{value:e,done:n}=await t.read();if(n)return;this.emit(`message`,i.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size})}})().catch(e=>this._onTransportClosed(e instanceof Error?e.message:void 0))}return e.closed?.then(e=>this._onTransportClosed(e?.reason)).catch(()=>{}),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{if(!e){this._busyRelease?.();return}this.emit(`listening`)}),this._webVPNUdpSocketPromise}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=this._destroyed;this._destroyed=!0,this._busyRelease?.(),this._dataPort?.close(),this._dataPort=void 0;try{await t.close()}finally{try{e&&e()}finally{n||this.emit(`close`)}}}).catch(()=>{}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0,o=await t.connect({remotePort:n,remoteAddress:i});this._connectedLocally=o?.local===!0,this._remoteAddress=o?.address?{address:o.address,family:o.family,port:o.port}:{address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},this._connectGeneration+=1,a&&a()}).catch(e=>{this.emit(`error`,e)})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);let e=this._remoteAddress,t=this._connectedLocally,n=this._connectGeneration;this._remoteAddress=void 0,this._connectedLocally=void 0,this._webVPNUdpSocketPromise.then(e=>e?.disconnect?.()).catch(r=>{this._connectGeneration===n&&(this._remoteAddress=e,this._connectedLocally=t),this.emit(`error`,r)})}dropMembership(e,t){if(o.Address4.isValid(e)){let n=d(e),r=t&&o.Address4.isValid(t)?d(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=p(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=r.s(...e),n=u(t.message),i=n;if(t.hasRange){let{offset:e,length:r}=t;if(!Number.isInteger(e)||e<0||e>n.byteLength)throw Object.assign(RangeError(`"offset" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});if(!Number.isInteger(r)||r<0||r>n.byteLength-e)throw Object.assign(RangeError(`"length" is outside of buffer bounds`),{code:`ERR_BUFFER_OUT_OF_BOUNDS`});i=n.subarray(e,e+r)}let a=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let n=t.callback,r=t.address??a,s=this._remoteAddress!==void 0&&t.address===void 0;if(this._dataPort&&(s||o.Address4.isValid(r)||o.Address6.isValid(r))){this._portSend(i,s?void 0:r,s?void 0:t.port),n?.call(this,null,i.byteLength);return}e.send({port:t.port,address:r,message:i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}).then(()=>n?.call(this,null,i.byteLength),e=>n?n.call(this,e,0):this.emit(`error`,e))})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},l=new Uint8Array([2]),u=e=>{if(typeof e==`string`)return r.l.encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e)){let t=e.map(u),n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}return new Uint8Array(e)},d=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},f=e=>{let t=[];for(let n=0;n<16;n+=2)t.push(e[n]<<8|e[n+1]);let n=-1,r=1;for(let e=0;e<8;){if(t[e]!==0){e++;continue}let i=e;for(;i<8&&t[i]===0;)i++;i-e>r&&(n=e,r=i-e),e=i}return n===-1?t.map(e=>e.toString(16)).join(`:`):`${t.slice(0,n).map(e=>e.toString(16)).join(`:`)}::${t.slice(n+r).map(e=>e.toString(16)).join(`:`)}`},p=e=>{let t=new o.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},m=(e,t)=>{let n=new c(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},h={Socket:c,createSocket:m};exports.Socket=c,exports.createSocket=m,exports.default=h,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
package/dgram.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
2
|
+
import { B as Resolvers, yt as UdpSocketResult } from "./contract-D37GGkou.js";
|
|
3
|
+
import "./api-CfmRAze5.js";
|
|
4
4
|
import { Buffer } from "buffer";
|
|
5
5
|
import { AddressInfo } from "net";
|
|
6
6
|
import { EventEmitter } from "events";
|
|
@@ -15,7 +15,7 @@ interface EventEmitterOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
captureRejections?: boolean | undefined;
|
|
17
17
|
}
|
|
18
|
-
declare class Socket extends EventEmitter implements Socket$2 {
|
|
18
|
+
export declare class Socket extends EventEmitter implements Socket$2 {
|
|
19
19
|
_type: 'udp4' | 'udp6';
|
|
20
20
|
_localAddress?: {
|
|
21
21
|
address: string;
|
|
@@ -112,10 +112,10 @@ declare class Socket extends EventEmitter implements Socket$2 {
|
|
|
112
112
|
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string | undefined): void;
|
|
113
113
|
[Symbol.asyncDispose](): Promise<void>;
|
|
114
114
|
}
|
|
115
|
-
declare const createSocket: (options: SocketType | SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void) => Socket;
|
|
115
|
+
export declare const createSocket: (options: SocketType | SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void) => Socket;
|
|
116
116
|
declare const _default: {
|
|
117
117
|
Socket: typeof Socket;
|
|
118
118
|
createSocket: typeof createSocket;
|
|
119
119
|
};
|
|
120
120
|
//#endregion
|
|
121
|
-
export {
|
|
121
|
+
export { _default as default, dgram_d_exports as t };
|
package/dgram.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { o as t } from "./api-
|
|
2
|
+
import { o as t } from "./api-CtiKFcK3.js";
|
|
3
3
|
import { t as n } from "./busy-B189uX--.js";
|
|
4
4
|
import { l as r, n as i, o as a, s as o } from "./utils-C-cAd4r4.js";
|
|
5
5
|
import "./wire.js";
|
package/dns.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs");var n=e.t({lookup:()=>r}),r=(e,n)=>t.a.then(t=>t.cloud.dns.lookup(e,n));exports.lookup=r,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/dns.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as AddressLookupResult } from "./contract-D37GGkou.js";
|
|
2
2
|
declare namespace dns_d_exports {
|
|
3
3
|
export { AddressLookupResult, lookup };
|
|
4
4
|
}
|
|
5
|
-
declare const lookup: <T extends boolean = false>(hostname: string, options?: {
|
|
5
|
+
export declare const lookup: <T extends boolean = false>(hostname: string, options?: {
|
|
6
6
|
all?: T;
|
|
7
7
|
family?: 0 | 4 | 6;
|
|
8
8
|
}) => Promise<T extends true ? AddressLookupResult[] : AddressLookupResult | undefined>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { type AddressLookupResult,
|
|
10
|
+
export { type AddressLookupResult, dns_d_exports as t };
|
package/dns.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { a as t } from "./api-
|
|
2
|
+
import { a as t } from "./api-CtiKFcK3.js";
|
|
3
3
|
//#region src/dns.ts
|
|
4
4
|
var n = /* @__PURE__ */ e({ lookup: () => r }), r = (e, n) => t.then((t) => t.cloud.dns.lookup(e, n));
|
|
5
5
|
//#endregion
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as ee, K as te, L as ne, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, W as b, X as x, Z as S, _ as C, a as w, at as T, b as E, d as D, et as O, f as k, g as A, h as re, i as j, it as M, j as N, k as P, m as F, n as I, nt as L, p as R, q as z, r as B, rt as V, t as H, tt as U, v as W, y as G, z as K } from "./lib-B-jGWfsv.js";
|
|
3
|
+
import { a as q, d as J } from "./api-CtiKFcK3.js";
|
|
4
|
+
import { t as Y } from "./proxy-DDwY3AVG.js";
|
|
5
|
+
import { available as X, fetch as ie } from "./desktop.js";
|
|
6
|
+
//#region src/extension-prompt.ts
|
|
7
|
+
var Z = async (e) => {
|
|
8
|
+
if (typeof window > "u") return !1;
|
|
9
|
+
if (c()) return !0;
|
|
10
|
+
let t = await q, n = null, r = new Promise((e) => {
|
|
11
|
+
n = () => {
|
|
12
|
+
c() && e(!0);
|
|
13
|
+
}, b.addEventListener("statuschange", n);
|
|
14
|
+
}), i = t.installPrompt.show(e).then(() => !1), a = await Promise.race([r, i]);
|
|
15
|
+
return n && b.removeEventListener("statuschange", n), await t.installPrompt.hide().catch(() => {}), a;
|
|
16
|
+
}, Q = null;
|
|
17
|
+
z(() => (Q ||= Z().then(() => void 0).finally(() => {
|
|
18
|
+
Q = null;
|
|
19
|
+
}), Q));
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/auto.ts
|
|
22
|
+
var $ = () => typeof document < "u" && c(), ae = async (e, t) => {
|
|
23
|
+
if (J(e), t?.credentials === "include") {
|
|
24
|
+
if (typeof document > "u") throw Error("fetch with credentials needs the FKN extension, which only exists in window realms");
|
|
25
|
+
return m(e, t);
|
|
26
|
+
}
|
|
27
|
+
return $() ? m(e, {
|
|
28
|
+
...t,
|
|
29
|
+
credentials: "omit"
|
|
30
|
+
}) : X() ? ie(e, t) : Y(e, t);
|
|
31
|
+
}, oe = /* @__PURE__ */ e({
|
|
32
|
+
ATTACH_FRAME_EVENT_KEY: () => j,
|
|
33
|
+
CATEGORIES: () => a,
|
|
34
|
+
EXTENSION_ABI: () => 2,
|
|
35
|
+
ExtensionOperationUnsupportedError: () => x,
|
|
36
|
+
ExtensionOutdatedError: () => S,
|
|
37
|
+
FORGEABLE_HEADERS: () => r,
|
|
38
|
+
FrameWindowBlockedError: () => D,
|
|
39
|
+
FrameWindowRefusedError: () => k,
|
|
40
|
+
LOCATOR_DENIED: () => i,
|
|
41
|
+
LOCATOR_ERROR: () => o,
|
|
42
|
+
LOCATOR_UNSUPPORTED: () => E,
|
|
43
|
+
PERMISSION_DENIED: () => H,
|
|
44
|
+
REQUIRED_EXTENSION_ABI: () => 0,
|
|
45
|
+
assertAttachableFrameUrl: () => A,
|
|
46
|
+
assertFetchableUrl: () => f,
|
|
47
|
+
assertForgeableHeaders: () => y,
|
|
48
|
+
assertLockdownApplicable: () => C,
|
|
49
|
+
assertOneCookieIdentity: () => l,
|
|
50
|
+
attachFrame: () => w,
|
|
51
|
+
attachFramePermission: () => R,
|
|
52
|
+
available: () => $,
|
|
53
|
+
box: () => U,
|
|
54
|
+
cookies: () => N,
|
|
55
|
+
createFrame: () => F,
|
|
56
|
+
createVideoElementHandle: () => L,
|
|
57
|
+
events: () => b,
|
|
58
|
+
extension: () => b,
|
|
59
|
+
fetch: () => m,
|
|
60
|
+
fetchCredentialedPermission: () => s,
|
|
61
|
+
fetchLocalPermission: () => u,
|
|
62
|
+
fetchPermission: () => ne,
|
|
63
|
+
gotoPermission: () => re,
|
|
64
|
+
handleRevivableModules: () => O,
|
|
65
|
+
hasForgedCookie: () => v,
|
|
66
|
+
isBlockedFetchUrl: () => h,
|
|
67
|
+
isBlockedFrameUrl: () => W,
|
|
68
|
+
isExtensionExposed: () => c,
|
|
69
|
+
isLocalNetworkUrl: () => K,
|
|
70
|
+
isLocatorDenied: () => G,
|
|
71
|
+
isLocatorUnsupported: () => g,
|
|
72
|
+
isPermissionDenied: () => I,
|
|
73
|
+
isTerminalError: () => _,
|
|
74
|
+
isType: () => V,
|
|
75
|
+
modifyRequestHeadersPermission: () => p,
|
|
76
|
+
permissions: () => B,
|
|
77
|
+
promptInstall: () => Z,
|
|
78
|
+
readCookiePermission: () => d,
|
|
79
|
+
readExtensionHandshake: () => te,
|
|
80
|
+
removeRequestHeaderRule: () => P,
|
|
81
|
+
revive: () => M,
|
|
82
|
+
setMissingExtensionHandler: () => z,
|
|
83
|
+
setRequestHeaderRule: () => n,
|
|
84
|
+
supportsOperation: () => t,
|
|
85
|
+
type: () => T,
|
|
86
|
+
waitForExtensionExposure: () => ee
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { Z as i, ae as n, $ as r, oe as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-Cjd91q7g.cjs"),n=require("./api-Djf-XdZ4.cjs"),r=require("./proxy-CYcaW5ew.cjs"),i=require("./desktop.cjs");var a=async e=>{if(typeof window>`u`)return!1;if(t.G())return!0;let r=await n.a,i=null,a=new Promise(e=>{i=()=>{t.G()&&e(!0)},t.W.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.W.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},o=null;t.q(()=>(o||=a().then(()=>void 0).finally(()=>{o=null}),o));var s=()=>typeof document<`u`&&t.G(),c=async(e,a)=>{if(n.d(e),a?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.P(e,a)}return s()?t.P(e,{...a,credentials:`omit`}):i.available()?i.fetch(e,a):r.t(e,a)},l=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.i,CATEGORIES:()=>t.D,EXTENSION_ABI:()=>2,ExtensionOperationUnsupportedError:()=>t.X,ExtensionOutdatedError:()=>t.Z,FORGEABLE_HEADERS:()=>t.B,FrameWindowBlockedError:()=>t.d,FrameWindowRefusedError:()=>t.f,LOCATOR_DENIED:()=>t.C,LOCATOR_ERROR:()=>t.E,LOCATOR_UNSUPPORTED:()=>t.b,PERMISSION_DENIED:()=>t.t,REQUIRED_EXTENSION_ABI:()=>0,assertAttachableFrameUrl:()=>t.g,assertFetchableUrl:()=>t.N,assertForgeableHeaders:()=>t.V,assertLockdownApplicable:()=>t._,assertOneCookieIdentity:()=>t.H,attachFrame:()=>t.a,attachFramePermission:()=>t.p,available:()=>s,box:()=>t.tt,cookies:()=>t.j,createFrame:()=>t.m,createVideoElementHandle:()=>t.nt,events:()=>t.W,extension:()=>t.W,fetch:()=>t.P,fetchCredentialedPermission:()=>t.F,fetchLocalPermission:()=>t.I,fetchPermission:()=>t.L,gotoPermission:()=>t.h,handleRevivableModules:()=>t.et,hasForgedCookie:()=>t.U,isBlockedFetchUrl:()=>t.R,isBlockedFrameUrl:()=>t.v,isExtensionExposed:()=>t.G,isLocalNetworkUrl:()=>t.z,isLocatorDenied:()=>t.y,isLocatorUnsupported:()=>t.S,isPermissionDenied:()=>t.n,isTerminalError:()=>t.T,isType:()=>t.rt,modifyRequestHeadersPermission:()=>t.O,permissions:()=>t.r,promptInstall:()=>a,readCookiePermission:()=>t.M,readExtensionHandshake:()=>t.K,removeRequestHeaderRule:()=>t.k,revive:()=>t.it,setMissingExtensionHandler:()=>t.q,setRequestHeaderRule:()=>t.A,supportsOperation:()=>t.$,type:()=>t.at,waitForExtensionExposure:()=>t.J});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|