@fkn/lib 0.9.23 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account.cjs +1 -1
- package/account.d.ts +7 -3
- package/account.js +7 -7
- package/api-BCJO3EWi.cjs +3 -0
- package/api-CesI0aMl.d.ts +677 -0
- package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
- package/api.cjs +1 -0
- package/api.d.ts +3 -0
- package/api.js +2 -0
- package/attach-policy.cjs +1 -0
- package/attach-policy.d.ts +35 -0
- package/attach-policy.js +43 -0
- package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +2 -2
- 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 +7 -6
- package/cloud/fs/promises.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/fs.js +10 -9
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/cloud-B2ZG-0MF.cjs +1 -0
- package/cloud-B7pI3pp1.d.ts +37 -0
- package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +4 -4
- package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
- package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
- package/contract-D6ksmIm6.d.ts +394 -0
- package/contract.cjs +0 -0
- package/contract.d.ts +3 -0
- package/contract.js +0 -0
- package/desktop.js +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +6 -47
- package/dgram.js +406 -2
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -3
- package/dns.js +2 -2
- package/extension-CJUeVRXf.d.ts +361 -0
- package/extension-DBazc3ff.cjs +1 -0
- package/extension-Dw9gzvei.js +84 -0
- 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 +8 -9
- package/fs/promises.js +2 -2
- package/fs-DYP7utdw.cjs +1 -0
- package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
- package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.cjs +3 -3
- package/http.d.ts +4 -6
- package/http.js +8 -8
- package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
- package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
- package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
- package/index.cjs +1 -1
- package/index.d.ts +12 -13
- package/index.js +60 -49
- package/lib-DLM2M3_i.cjs +53 -0
- package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
- package/messages-DvpKMTsY.d.ts +28 -0
- package/messages.cjs +1 -0
- package/messages.d.ts +2 -0
- package/messages.js +4 -0
- package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +318 -3
- package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
- package/opfs/promises.d.ts +7 -8
- package/opfs/promises.js +1 -1
- package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
- package/opfs.d.ts +24 -26
- package/opfs.js +3 -3
- package/package.json +27 -2
- package/packages.cjs +1 -1
- package/packages.d.ts +143 -2
- package/packages.js +15 -15
- package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
- package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
- package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
- package/react.d.ts +3 -7
- package/react.js +2 -2
- package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
- package/storage-DLB4ciMf.cjs +1 -0
- package/utils-BvgGdrgN.cjs +1 -0
- package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
- package/wire-Gbo-D74t.d.ts +91 -0
- package/wire.cjs +1 -0
- package/wire.d.ts +2 -0
- package/wire.js +4 -0
- package/api-BGYSJVvR.d.ts +0 -789
- package/api-C-TpWHAU.cjs +0 -3
- package/cloud-BqjwL5KM.cjs +0 -1
- package/cloud-DMTkzfcf.d.ts +0 -36
- package/dgram-BLN-mfgq.cjs +0 -1
- package/dgram-DHQcHefn.js +0 -405
- package/extension-B8Y0sUwC.js +0 -78
- package/extension-CMPZjuaV.d.ts +0 -16
- package/extension-CgSGjcSl.cjs +0 -1
- package/fs-BNnozBMU.cjs +0 -1
- package/lib-DbiVHPXE.cjs +0 -53
- package/lookup-BtwWaCZJ.d.ts +0 -7
- package/net-B6RHtWwe.cjs +0 -1
- package/net-yBkobZqK.js +0 -317
- package/packages-Cn8S-Hkn.d.ts +0 -217
- package/storage-qxXFLgTM.d.ts +0 -44
- package/storage-xAeRQQiz.cjs +0 -1
- package/utils-QfNXtEhb.cjs +0 -1
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
+
import { A as ProxyFetchInit, C as PackageQuery, D as PickOptions, K as WriteData, O as Placement, P as Resolvers, S as OverlayState, T as PackagesErrorCode, U as UdpDatagram, V as TcpSocketOptions, W as UdpSocketOptions, _ as InstallOptions, a as ConflictChoice, c as ConnectAvailability, i as AdoptState, j as ProxyFetchInput, l as ConnectOptions, m as FrameConsentRequest, o as ConflictRequest, r as AdoptRequest, y as IpFamily, z as TcpSocketListenerOptions } from "./contract-D6ksmIm6.js";
|
|
3
|
+
import { Remote } from "osra";
|
|
4
|
+
//#region src/api-epochs.d.ts
|
|
5
|
+
type EpochListener<T> = (remote: T, epoch: number) => void;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/api.d.ts
|
|
8
|
+
declare const hasTransport: boolean;
|
|
9
|
+
type Api = Remote<Resolvers>;
|
|
10
|
+
/**
|
|
11
|
+
* The broker api. Settles when the first connection exists, exactly as before, but resolves with a
|
|
12
|
+
* stable facade that always routes to the NEWEST connection, so holding the resolved value across a
|
|
13
|
+
* broker replacement is safe. A call in flight at the moment of replacement rejects with a named
|
|
14
|
+
* error instead of hanging.
|
|
15
|
+
*/
|
|
16
|
+
declare const apiPromise: Promise<Api>;
|
|
17
|
+
/**
|
|
18
|
+
* `apiPromise` bounded by a deadline, for call sites that must not park forever.
|
|
19
|
+
*
|
|
20
|
+
* `apiPromise` NEVER REJECTS: `epochs.first` settles only when a broker connection exists, so a
|
|
21
|
+
* broker frame that never bridges leaves it pending for the life of the realm. Awaiting it directly
|
|
22
|
+
* is correct wherever hanging is the honest answer, and wrong wherever the caller owns a socket, a
|
|
23
|
+
* timer or a UI that has to say something.
|
|
24
|
+
*
|
|
25
|
+
* That distinction is not academic. In a WORKER realm the osra transport is `{receive: self,
|
|
26
|
+
* emit: self}`, which is inert until the page bridges it, so an unbridged worker parks every socket
|
|
27
|
+
* call here with no `listening`, no `error` and no rejection. The engine then reports a listener
|
|
28
|
+
* that neither succeeded nor failed, its reopen counters stay at 0 because reopen only runs from an
|
|
29
|
+
* `error` or `close` that never arrives, and the relay is never contacted at all. That state cost a
|
|
30
|
+
* long diagnosis: it presents as a transport fault and is invisible from every counter.
|
|
31
|
+
*
|
|
32
|
+
* The latch mirrors `storage.ts`: once the broker has missed one deadline, later calls stop paying
|
|
33
|
+
* the full wait. `net.ts` needs it especially, because its listen path is `bind('::').catch(() =>
|
|
34
|
+
* bind('0.0.0.0'))`, so an unbounded-then-rejecting version would charge the deadline twice.
|
|
35
|
+
*/
|
|
36
|
+
declare const API_DEADLINE_MS = 8000;
|
|
37
|
+
declare class BrokerUnreachableError extends Error {
|
|
38
|
+
constructor(what: string, ms: number);
|
|
39
|
+
}
|
|
40
|
+
declare const apiWithin: (what: string) => Promise<Api>;
|
|
41
|
+
/**
|
|
42
|
+
* Runs for the current broker connection on subscribe (if one exists) and for every later one.
|
|
43
|
+
* This is the seam every registration that crosses the connection must ride, because callbacks and
|
|
44
|
+
* subscriptions die with the connection they were sent on.
|
|
45
|
+
*/
|
|
46
|
+
declare const onApiEpoch: (listener: EpochListener<{
|
|
47
|
+
cloud: {
|
|
48
|
+
fetch: (input: ProxyFetchInput, init: ProxyFetchInit) => Promise<Response>;
|
|
49
|
+
quota: () => Promise<{
|
|
50
|
+
overQuota: boolean;
|
|
51
|
+
remaining: number;
|
|
52
|
+
usedBytes: number;
|
|
53
|
+
limitBytes: number;
|
|
54
|
+
premium: boolean;
|
|
55
|
+
bytesPerSecond: number;
|
|
56
|
+
}>;
|
|
57
|
+
dns: {
|
|
58
|
+
lookup: (hostname: string, options?: {
|
|
59
|
+
all?: boolean | undefined;
|
|
60
|
+
family?: 0 | 4 | 6;
|
|
61
|
+
} | undefined) => Promise<{
|
|
62
|
+
address: string;
|
|
63
|
+
family: 0 | 4 | 6;
|
|
64
|
+
}[] | {
|
|
65
|
+
address: string;
|
|
66
|
+
family: 0 | 4 | 6;
|
|
67
|
+
} | undefined>;
|
|
68
|
+
};
|
|
69
|
+
fs: {
|
|
70
|
+
available: () => Promise<boolean>;
|
|
71
|
+
availability: () => Promise<ConnectAvailability>;
|
|
72
|
+
list: () => Promise<{
|
|
73
|
+
path: string;
|
|
74
|
+
size: number;
|
|
75
|
+
contentType: string | null;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
encryption: string | null;
|
|
78
|
+
}[]>;
|
|
79
|
+
quota: () => Promise<{
|
|
80
|
+
usedBytes: number;
|
|
81
|
+
limitBytes: number;
|
|
82
|
+
remaining: number;
|
|
83
|
+
objects: number;
|
|
84
|
+
maxObjects: number;
|
|
85
|
+
}>;
|
|
86
|
+
readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
87
|
+
writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
88
|
+
remove: (path: string) => Promise<void>;
|
|
89
|
+
encryption: () => Promise<{
|
|
90
|
+
unlocked: boolean;
|
|
91
|
+
enrolled: boolean;
|
|
92
|
+
keyEpoch: number | null;
|
|
93
|
+
}>;
|
|
94
|
+
unlock: () => Promise<boolean>;
|
|
95
|
+
promptAdopt: (request: AdoptRequest) => Promise<boolean>;
|
|
96
|
+
promptConflict: (request: ConflictRequest) => Promise<ConflictChoice>;
|
|
97
|
+
setAdoptSource: (next: AdoptState | null, run: (() => Promise<void>) | null) => Promise<void>;
|
|
98
|
+
};
|
|
99
|
+
webvpn: {
|
|
100
|
+
tcpSocket: (options: TcpSocketOptions) => Promise<{
|
|
101
|
+
localAddress: string;
|
|
102
|
+
localFamily: IpFamily;
|
|
103
|
+
localPort: number;
|
|
104
|
+
remoteAddress: string;
|
|
105
|
+
remoteFamily: IpFamily;
|
|
106
|
+
remotePort: number;
|
|
107
|
+
dataReadableStream: ReadableStream<Uint8Array>;
|
|
108
|
+
dataWritableStream: WritableStream<Uint8Array>;
|
|
109
|
+
end: () => Promise<void>;
|
|
110
|
+
destroy: () => Promise<void>;
|
|
111
|
+
destroySoon: () => Promise<void>;
|
|
112
|
+
resetAndDestroy: () => Promise<void>;
|
|
113
|
+
setOption: (option: TcpSocketOption) => Promise<void>;
|
|
114
|
+
}>;
|
|
115
|
+
tcpSocketListener: (options: TcpSocketListenerOptions) => Promise<{
|
|
116
|
+
localAddress: string;
|
|
117
|
+
localFamily: IpFamily;
|
|
118
|
+
localPort: number;
|
|
119
|
+
close: () => Promise<void>;
|
|
120
|
+
}>;
|
|
121
|
+
udpSocket: (options: UdpSocketOptions) => Promise<{
|
|
122
|
+
socketId: number;
|
|
123
|
+
dataPort: MessagePort | undefined;
|
|
124
|
+
dataPortAcks: true | undefined;
|
|
125
|
+
closed: Promise<{
|
|
126
|
+
reason: string;
|
|
127
|
+
}>;
|
|
128
|
+
localAddress: string;
|
|
129
|
+
localFamily: IpFamily;
|
|
130
|
+
localPort: number;
|
|
131
|
+
dataReadableStream: ReadableStream<UdpDatagram>;
|
|
132
|
+
connect: (options: {
|
|
133
|
+
remoteAddress: string;
|
|
134
|
+
remotePort: number;
|
|
135
|
+
}) => Promise<{
|
|
136
|
+
local: boolean;
|
|
137
|
+
address: string;
|
|
138
|
+
family: IpFamily;
|
|
139
|
+
port: number;
|
|
140
|
+
}>;
|
|
141
|
+
disconnect: () => Promise<void>;
|
|
142
|
+
send: (options: {
|
|
143
|
+
message: ArrayBuffer;
|
|
144
|
+
address?: string;
|
|
145
|
+
port?: number;
|
|
146
|
+
}) => Promise<void>;
|
|
147
|
+
close: () => Promise<void>;
|
|
148
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
149
|
+
}>;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
overlay: {
|
|
153
|
+
setHost: (push: (state: OverlayState) => unknown, options?: {
|
|
154
|
+
exactClips?: boolean;
|
|
155
|
+
} | undefined) => Promise<void>;
|
|
156
|
+
};
|
|
157
|
+
installPrompt: {
|
|
158
|
+
show: (reason?: string | undefined) => Promise<void>;
|
|
159
|
+
hide: () => Promise<void>;
|
|
160
|
+
};
|
|
161
|
+
frameConsent: {
|
|
162
|
+
ensure: (request: FrameConsentRequest) => Promise<boolean>;
|
|
163
|
+
};
|
|
164
|
+
connect: {
|
|
165
|
+
prompt: (consumerOrigin: string) => Promise<boolean>;
|
|
166
|
+
};
|
|
167
|
+
relay: {
|
|
168
|
+
prompt: () => Promise<string>;
|
|
169
|
+
};
|
|
170
|
+
packages: {
|
|
171
|
+
search: (query: PackageQuery) => Promise<{
|
|
172
|
+
error: PackagesErrorCode;
|
|
173
|
+
message: string;
|
|
174
|
+
} | {
|
|
175
|
+
results: {
|
|
176
|
+
uri: string;
|
|
177
|
+
origin: 'npm';
|
|
178
|
+
name: string;
|
|
179
|
+
version: string;
|
|
180
|
+
description: string;
|
|
181
|
+
keywords: string[];
|
|
182
|
+
publisher: string | null;
|
|
183
|
+
downloadsMonthly: number | null;
|
|
184
|
+
links: {
|
|
185
|
+
npm?: string;
|
|
186
|
+
homepage?: string;
|
|
187
|
+
repository?: string;
|
|
188
|
+
};
|
|
189
|
+
installed: boolean;
|
|
190
|
+
}[];
|
|
191
|
+
}>;
|
|
192
|
+
pick: (query: PackageQuery, options?: PickOptions | undefined) => Promise<{
|
|
193
|
+
error: PackagesErrorCode;
|
|
194
|
+
message: string;
|
|
195
|
+
} | {
|
|
196
|
+
results: {
|
|
197
|
+
uri: string;
|
|
198
|
+
origin: 'npm';
|
|
199
|
+
name: string;
|
|
200
|
+
version: string;
|
|
201
|
+
description: string;
|
|
202
|
+
keywords: string[];
|
|
203
|
+
publisher: string | null;
|
|
204
|
+
downloadsMonthly: number | null;
|
|
205
|
+
links: {
|
|
206
|
+
npm?: string;
|
|
207
|
+
homepage?: string;
|
|
208
|
+
repository?: string;
|
|
209
|
+
};
|
|
210
|
+
installed: boolean;
|
|
211
|
+
}[];
|
|
212
|
+
failed: string[];
|
|
213
|
+
} | {
|
|
214
|
+
declined: true;
|
|
215
|
+
}>;
|
|
216
|
+
install: (uri: string, options?: InstallOptions | undefined) => Promise<{
|
|
217
|
+
error: PackagesErrorCode;
|
|
218
|
+
message: string;
|
|
219
|
+
} | {
|
|
220
|
+
installed: {
|
|
221
|
+
uri: string;
|
|
222
|
+
name: string;
|
|
223
|
+
version: string | null;
|
|
224
|
+
installedAt: number;
|
|
225
|
+
};
|
|
226
|
+
} | {
|
|
227
|
+
declined: true;
|
|
228
|
+
}>;
|
|
229
|
+
frame: (uri: string) => Promise<{
|
|
230
|
+
error: PackagesErrorCode;
|
|
231
|
+
message: string;
|
|
232
|
+
} | {
|
|
233
|
+
url: string;
|
|
234
|
+
origin: string;
|
|
235
|
+
uri: string;
|
|
236
|
+
name: string;
|
|
237
|
+
version: string | null;
|
|
238
|
+
from: string;
|
|
239
|
+
}>;
|
|
240
|
+
list: () => Promise<{
|
|
241
|
+
results: {
|
|
242
|
+
uri: string;
|
|
243
|
+
name: string;
|
|
244
|
+
version: string | null;
|
|
245
|
+
installedAt: number;
|
|
246
|
+
}[];
|
|
247
|
+
}>;
|
|
248
|
+
uninstall: (uri: string) => Promise<{
|
|
249
|
+
error: PackagesErrorCode;
|
|
250
|
+
message: string;
|
|
251
|
+
} | {
|
|
252
|
+
ok: true;
|
|
253
|
+
}>;
|
|
254
|
+
connect: (uri: string, options?: ConnectOptions | undefined) => Promise<{
|
|
255
|
+
error: PackagesErrorCode;
|
|
256
|
+
message: string;
|
|
257
|
+
} | {
|
|
258
|
+
port: MessagePort;
|
|
259
|
+
closed: Promise<void>;
|
|
260
|
+
}>;
|
|
261
|
+
show: (uri: string, placement: Placement) => Promise<{
|
|
262
|
+
error: PackagesErrorCode;
|
|
263
|
+
message: string;
|
|
264
|
+
} | {
|
|
265
|
+
ok: true;
|
|
266
|
+
}>;
|
|
267
|
+
hide: (uri: string) => Promise<{
|
|
268
|
+
error: PackagesErrorCode;
|
|
269
|
+
message: string;
|
|
270
|
+
} | {
|
|
271
|
+
ok: true;
|
|
272
|
+
}>;
|
|
273
|
+
};
|
|
274
|
+
account: {
|
|
275
|
+
info: () => Promise<{
|
|
276
|
+
name: string;
|
|
277
|
+
image: string | null;
|
|
278
|
+
premium: boolean;
|
|
279
|
+
premiumUntil: string | null;
|
|
280
|
+
} | null>;
|
|
281
|
+
login: (consumerOrigin: string) => Promise<boolean>;
|
|
282
|
+
logout: () => Promise<void>;
|
|
283
|
+
onChange: (listener: () => void) => Promise<() => Promise<void>>;
|
|
284
|
+
};
|
|
285
|
+
shell: {
|
|
286
|
+
updateReady: () => Promise<boolean>;
|
|
287
|
+
onUpdate: (callback: () => void) => Promise<() => Promise<void>>;
|
|
288
|
+
onUpdateTaken: (callback: () => void) => Promise<() => Promise<void>>;
|
|
289
|
+
applyUpdate: () => Promise<boolean>;
|
|
290
|
+
};
|
|
291
|
+
proxyFetch: (input: ProxyFetchInput, init: ProxyFetchInit) => Promise<Response>;
|
|
292
|
+
webVpnTcpSocket: (options: TcpSocketOptions) => Promise<{
|
|
293
|
+
localAddress: string;
|
|
294
|
+
localFamily: IpFamily;
|
|
295
|
+
localPort: number;
|
|
296
|
+
remoteAddress: string;
|
|
297
|
+
remoteFamily: IpFamily;
|
|
298
|
+
remotePort: number;
|
|
299
|
+
dataReadableStream: ReadableStream<Uint8Array>;
|
|
300
|
+
dataWritableStream: WritableStream<Uint8Array>;
|
|
301
|
+
end: () => Promise<void>;
|
|
302
|
+
destroy: () => Promise<void>;
|
|
303
|
+
destroySoon: () => Promise<void>;
|
|
304
|
+
resetAndDestroy: () => Promise<void>;
|
|
305
|
+
setOption: (option: TcpSocketOption) => Promise<void>;
|
|
306
|
+
}>;
|
|
307
|
+
webVpnTcpSocketListener: (options: TcpSocketListenerOptions) => Promise<{
|
|
308
|
+
localAddress: string;
|
|
309
|
+
localFamily: IpFamily;
|
|
310
|
+
localPort: number;
|
|
311
|
+
close: () => Promise<void>;
|
|
312
|
+
}>;
|
|
313
|
+
webVpnUdpSocket: (options: UdpSocketOptions) => Promise<{
|
|
314
|
+
socketId: number;
|
|
315
|
+
dataPort: MessagePort | undefined;
|
|
316
|
+
dataPortAcks: true | undefined;
|
|
317
|
+
closed: Promise<{
|
|
318
|
+
reason: string;
|
|
319
|
+
}>;
|
|
320
|
+
localAddress: string;
|
|
321
|
+
localFamily: IpFamily;
|
|
322
|
+
localPort: number;
|
|
323
|
+
dataReadableStream: ReadableStream<UdpDatagram>;
|
|
324
|
+
connect: (options: {
|
|
325
|
+
remoteAddress: string;
|
|
326
|
+
remotePort: number;
|
|
327
|
+
}) => Promise<{
|
|
328
|
+
local: boolean;
|
|
329
|
+
address: string;
|
|
330
|
+
family: IpFamily;
|
|
331
|
+
port: number;
|
|
332
|
+
}>;
|
|
333
|
+
disconnect: () => Promise<void>;
|
|
334
|
+
send: (options: {
|
|
335
|
+
message: ArrayBuffer;
|
|
336
|
+
address?: string;
|
|
337
|
+
port?: number;
|
|
338
|
+
}) => Promise<void>;
|
|
339
|
+
close: () => Promise<void>;
|
|
340
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
341
|
+
}>;
|
|
342
|
+
dnsLookup: (hostname: string, options?: {
|
|
343
|
+
all?: boolean | undefined;
|
|
344
|
+
family?: 0 | 4 | 6;
|
|
345
|
+
} | undefined) => Promise<{
|
|
346
|
+
address: string;
|
|
347
|
+
family: 0 | 4 | 6;
|
|
348
|
+
}[] | {
|
|
349
|
+
address: string;
|
|
350
|
+
family: 0 | 4 | 6;
|
|
351
|
+
} | undefined>;
|
|
352
|
+
setOverlayHost: (push: (state: OverlayState) => unknown, options?: {
|
|
353
|
+
exactClips?: boolean;
|
|
354
|
+
} | undefined) => Promise<void>;
|
|
355
|
+
showInstallPrompt: (reason?: string | undefined) => Promise<void>;
|
|
356
|
+
hideInstallPrompt: () => Promise<void>;
|
|
357
|
+
}>) => () => void;
|
|
358
|
+
declare const currentApiEpoch: () => {
|
|
359
|
+
remote: {
|
|
360
|
+
cloud: {
|
|
361
|
+
fetch: (input: ProxyFetchInput, init: ProxyFetchInit) => Promise<Response>;
|
|
362
|
+
quota: () => Promise<{
|
|
363
|
+
overQuota: boolean;
|
|
364
|
+
remaining: number;
|
|
365
|
+
usedBytes: number;
|
|
366
|
+
limitBytes: number;
|
|
367
|
+
premium: boolean;
|
|
368
|
+
bytesPerSecond: number;
|
|
369
|
+
}>;
|
|
370
|
+
dns: {
|
|
371
|
+
lookup: (hostname: string, options?: {
|
|
372
|
+
all?: boolean | undefined;
|
|
373
|
+
family?: 0 | 4 | 6;
|
|
374
|
+
} | undefined) => Promise<{
|
|
375
|
+
address: string;
|
|
376
|
+
family: 0 | 4 | 6;
|
|
377
|
+
}[] | {
|
|
378
|
+
address: string;
|
|
379
|
+
family: 0 | 4 | 6;
|
|
380
|
+
} | undefined>;
|
|
381
|
+
};
|
|
382
|
+
fs: {
|
|
383
|
+
available: () => Promise<boolean>;
|
|
384
|
+
availability: () => Promise<ConnectAvailability>;
|
|
385
|
+
list: () => Promise<{
|
|
386
|
+
path: string;
|
|
387
|
+
size: number;
|
|
388
|
+
contentType: string | null;
|
|
389
|
+
updatedAt: string;
|
|
390
|
+
encryption: string | null;
|
|
391
|
+
}[]>;
|
|
392
|
+
quota: () => Promise<{
|
|
393
|
+
usedBytes: number;
|
|
394
|
+
limitBytes: number;
|
|
395
|
+
remaining: number;
|
|
396
|
+
objects: number;
|
|
397
|
+
maxObjects: number;
|
|
398
|
+
}>;
|
|
399
|
+
readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
400
|
+
writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
401
|
+
remove: (path: string) => Promise<void>;
|
|
402
|
+
encryption: () => Promise<{
|
|
403
|
+
unlocked: boolean;
|
|
404
|
+
enrolled: boolean;
|
|
405
|
+
keyEpoch: number | null;
|
|
406
|
+
}>;
|
|
407
|
+
unlock: () => Promise<boolean>;
|
|
408
|
+
promptAdopt: (request: AdoptRequest) => Promise<boolean>;
|
|
409
|
+
promptConflict: (request: ConflictRequest) => Promise<ConflictChoice>;
|
|
410
|
+
setAdoptSource: (next: AdoptState | null, run: (() => Promise<void>) | null) => Promise<void>;
|
|
411
|
+
};
|
|
412
|
+
webvpn: {
|
|
413
|
+
tcpSocket: (options: TcpSocketOptions) => Promise<{
|
|
414
|
+
localAddress: string;
|
|
415
|
+
localFamily: IpFamily;
|
|
416
|
+
localPort: number;
|
|
417
|
+
remoteAddress: string;
|
|
418
|
+
remoteFamily: IpFamily;
|
|
419
|
+
remotePort: number;
|
|
420
|
+
dataReadableStream: ReadableStream<Uint8Array>;
|
|
421
|
+
dataWritableStream: WritableStream<Uint8Array>;
|
|
422
|
+
end: () => Promise<void>;
|
|
423
|
+
destroy: () => Promise<void>;
|
|
424
|
+
destroySoon: () => Promise<void>;
|
|
425
|
+
resetAndDestroy: () => Promise<void>;
|
|
426
|
+
setOption: (option: TcpSocketOption) => Promise<void>;
|
|
427
|
+
}>;
|
|
428
|
+
tcpSocketListener: (options: TcpSocketListenerOptions) => Promise<{
|
|
429
|
+
localAddress: string;
|
|
430
|
+
localFamily: IpFamily;
|
|
431
|
+
localPort: number;
|
|
432
|
+
close: () => Promise<void>;
|
|
433
|
+
}>;
|
|
434
|
+
udpSocket: (options: UdpSocketOptions) => Promise<{
|
|
435
|
+
socketId: number;
|
|
436
|
+
dataPort: MessagePort | undefined;
|
|
437
|
+
dataPortAcks: true | undefined;
|
|
438
|
+
closed: Promise<{
|
|
439
|
+
reason: string;
|
|
440
|
+
}>;
|
|
441
|
+
localAddress: string;
|
|
442
|
+
localFamily: IpFamily;
|
|
443
|
+
localPort: number;
|
|
444
|
+
dataReadableStream: ReadableStream<UdpDatagram>;
|
|
445
|
+
connect: (options: {
|
|
446
|
+
remoteAddress: string;
|
|
447
|
+
remotePort: number;
|
|
448
|
+
}) => Promise<{
|
|
449
|
+
local: boolean;
|
|
450
|
+
address: string;
|
|
451
|
+
family: IpFamily;
|
|
452
|
+
port: number;
|
|
453
|
+
}>;
|
|
454
|
+
disconnect: () => Promise<void>;
|
|
455
|
+
send: (options: {
|
|
456
|
+
message: ArrayBuffer;
|
|
457
|
+
address?: string;
|
|
458
|
+
port?: number;
|
|
459
|
+
}) => Promise<void>;
|
|
460
|
+
close: () => Promise<void>;
|
|
461
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
462
|
+
}>;
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
overlay: {
|
|
466
|
+
setHost: (push: (state: OverlayState) => unknown, options?: {
|
|
467
|
+
exactClips?: boolean;
|
|
468
|
+
} | undefined) => Promise<void>;
|
|
469
|
+
};
|
|
470
|
+
installPrompt: {
|
|
471
|
+
show: (reason?: string | undefined) => Promise<void>;
|
|
472
|
+
hide: () => Promise<void>;
|
|
473
|
+
};
|
|
474
|
+
frameConsent: {
|
|
475
|
+
ensure: (request: FrameConsentRequest) => Promise<boolean>;
|
|
476
|
+
};
|
|
477
|
+
connect: {
|
|
478
|
+
prompt: (consumerOrigin: string) => Promise<boolean>;
|
|
479
|
+
};
|
|
480
|
+
relay: {
|
|
481
|
+
prompt: () => Promise<string>;
|
|
482
|
+
};
|
|
483
|
+
packages: {
|
|
484
|
+
search: (query: PackageQuery) => Promise<{
|
|
485
|
+
error: PackagesErrorCode;
|
|
486
|
+
message: string;
|
|
487
|
+
} | {
|
|
488
|
+
results: {
|
|
489
|
+
uri: string;
|
|
490
|
+
origin: 'npm';
|
|
491
|
+
name: string;
|
|
492
|
+
version: string;
|
|
493
|
+
description: string;
|
|
494
|
+
keywords: string[];
|
|
495
|
+
publisher: string | null;
|
|
496
|
+
downloadsMonthly: number | null;
|
|
497
|
+
links: {
|
|
498
|
+
npm?: string;
|
|
499
|
+
homepage?: string;
|
|
500
|
+
repository?: string;
|
|
501
|
+
};
|
|
502
|
+
installed: boolean;
|
|
503
|
+
}[];
|
|
504
|
+
}>;
|
|
505
|
+
pick: (query: PackageQuery, options?: PickOptions | undefined) => Promise<{
|
|
506
|
+
error: PackagesErrorCode;
|
|
507
|
+
message: string;
|
|
508
|
+
} | {
|
|
509
|
+
results: {
|
|
510
|
+
uri: string;
|
|
511
|
+
origin: 'npm';
|
|
512
|
+
name: string;
|
|
513
|
+
version: string;
|
|
514
|
+
description: string;
|
|
515
|
+
keywords: string[];
|
|
516
|
+
publisher: string | null;
|
|
517
|
+
downloadsMonthly: number | null;
|
|
518
|
+
links: {
|
|
519
|
+
npm?: string;
|
|
520
|
+
homepage?: string;
|
|
521
|
+
repository?: string;
|
|
522
|
+
};
|
|
523
|
+
installed: boolean;
|
|
524
|
+
}[];
|
|
525
|
+
failed: string[];
|
|
526
|
+
} | {
|
|
527
|
+
declined: true;
|
|
528
|
+
}>;
|
|
529
|
+
install: (uri: string, options?: InstallOptions | undefined) => Promise<{
|
|
530
|
+
error: PackagesErrorCode;
|
|
531
|
+
message: string;
|
|
532
|
+
} | {
|
|
533
|
+
installed: {
|
|
534
|
+
uri: string;
|
|
535
|
+
name: string;
|
|
536
|
+
version: string | null;
|
|
537
|
+
installedAt: number;
|
|
538
|
+
};
|
|
539
|
+
} | {
|
|
540
|
+
declined: true;
|
|
541
|
+
}>;
|
|
542
|
+
frame: (uri: string) => Promise<{
|
|
543
|
+
error: PackagesErrorCode;
|
|
544
|
+
message: string;
|
|
545
|
+
} | {
|
|
546
|
+
url: string;
|
|
547
|
+
origin: string;
|
|
548
|
+
uri: string;
|
|
549
|
+
name: string;
|
|
550
|
+
version: string | null;
|
|
551
|
+
from: string;
|
|
552
|
+
}>;
|
|
553
|
+
list: () => Promise<{
|
|
554
|
+
results: {
|
|
555
|
+
uri: string;
|
|
556
|
+
name: string;
|
|
557
|
+
version: string | null;
|
|
558
|
+
installedAt: number;
|
|
559
|
+
}[];
|
|
560
|
+
}>;
|
|
561
|
+
uninstall: (uri: string) => Promise<{
|
|
562
|
+
error: PackagesErrorCode;
|
|
563
|
+
message: string;
|
|
564
|
+
} | {
|
|
565
|
+
ok: true;
|
|
566
|
+
}>;
|
|
567
|
+
connect: (uri: string, options?: ConnectOptions | undefined) => Promise<{
|
|
568
|
+
error: PackagesErrorCode;
|
|
569
|
+
message: string;
|
|
570
|
+
} | {
|
|
571
|
+
port: MessagePort;
|
|
572
|
+
closed: Promise<void>;
|
|
573
|
+
}>;
|
|
574
|
+
show: (uri: string, placement: Placement) => Promise<{
|
|
575
|
+
error: PackagesErrorCode;
|
|
576
|
+
message: string;
|
|
577
|
+
} | {
|
|
578
|
+
ok: true;
|
|
579
|
+
}>;
|
|
580
|
+
hide: (uri: string) => Promise<{
|
|
581
|
+
error: PackagesErrorCode;
|
|
582
|
+
message: string;
|
|
583
|
+
} | {
|
|
584
|
+
ok: true;
|
|
585
|
+
}>;
|
|
586
|
+
};
|
|
587
|
+
account: {
|
|
588
|
+
info: () => Promise<{
|
|
589
|
+
name: string;
|
|
590
|
+
image: string | null;
|
|
591
|
+
premium: boolean;
|
|
592
|
+
premiumUntil: string | null;
|
|
593
|
+
} | null>;
|
|
594
|
+
login: (consumerOrigin: string) => Promise<boolean>;
|
|
595
|
+
logout: () => Promise<void>;
|
|
596
|
+
onChange: (listener: () => void) => Promise<() => Promise<void>>;
|
|
597
|
+
};
|
|
598
|
+
shell: {
|
|
599
|
+
updateReady: () => Promise<boolean>;
|
|
600
|
+
onUpdate: (callback: () => void) => Promise<() => Promise<void>>;
|
|
601
|
+
onUpdateTaken: (callback: () => void) => Promise<() => Promise<void>>;
|
|
602
|
+
applyUpdate: () => Promise<boolean>;
|
|
603
|
+
};
|
|
604
|
+
proxyFetch: (input: ProxyFetchInput, init: ProxyFetchInit) => Promise<Response>;
|
|
605
|
+
webVpnTcpSocket: (options: TcpSocketOptions) => Promise<{
|
|
606
|
+
localAddress: string;
|
|
607
|
+
localFamily: IpFamily;
|
|
608
|
+
localPort: number;
|
|
609
|
+
remoteAddress: string;
|
|
610
|
+
remoteFamily: IpFamily;
|
|
611
|
+
remotePort: number;
|
|
612
|
+
dataReadableStream: ReadableStream<Uint8Array>;
|
|
613
|
+
dataWritableStream: WritableStream<Uint8Array>;
|
|
614
|
+
end: () => Promise<void>;
|
|
615
|
+
destroy: () => Promise<void>;
|
|
616
|
+
destroySoon: () => Promise<void>;
|
|
617
|
+
resetAndDestroy: () => Promise<void>;
|
|
618
|
+
setOption: (option: TcpSocketOption) => Promise<void>;
|
|
619
|
+
}>;
|
|
620
|
+
webVpnTcpSocketListener: (options: TcpSocketListenerOptions) => Promise<{
|
|
621
|
+
localAddress: string;
|
|
622
|
+
localFamily: IpFamily;
|
|
623
|
+
localPort: number;
|
|
624
|
+
close: () => Promise<void>;
|
|
625
|
+
}>;
|
|
626
|
+
webVpnUdpSocket: (options: UdpSocketOptions) => Promise<{
|
|
627
|
+
socketId: number;
|
|
628
|
+
dataPort: MessagePort | undefined;
|
|
629
|
+
dataPortAcks: true | undefined;
|
|
630
|
+
closed: Promise<{
|
|
631
|
+
reason: string;
|
|
632
|
+
}>;
|
|
633
|
+
localAddress: string;
|
|
634
|
+
localFamily: IpFamily;
|
|
635
|
+
localPort: number;
|
|
636
|
+
dataReadableStream: ReadableStream<UdpDatagram>;
|
|
637
|
+
connect: (options: {
|
|
638
|
+
remoteAddress: string;
|
|
639
|
+
remotePort: number;
|
|
640
|
+
}) => Promise<{
|
|
641
|
+
local: boolean;
|
|
642
|
+
address: string;
|
|
643
|
+
family: IpFamily;
|
|
644
|
+
port: number;
|
|
645
|
+
}>;
|
|
646
|
+
disconnect: () => Promise<void>;
|
|
647
|
+
send: (options: {
|
|
648
|
+
message: ArrayBuffer;
|
|
649
|
+
address?: string;
|
|
650
|
+
port?: number;
|
|
651
|
+
}) => Promise<void>;
|
|
652
|
+
close: () => Promise<void>;
|
|
653
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
654
|
+
}>;
|
|
655
|
+
dnsLookup: (hostname: string, options?: {
|
|
656
|
+
all?: boolean | undefined;
|
|
657
|
+
family?: 0 | 4 | 6;
|
|
658
|
+
} | undefined) => Promise<{
|
|
659
|
+
address: string;
|
|
660
|
+
family: 0 | 4 | 6;
|
|
661
|
+
}[] | {
|
|
662
|
+
address: string;
|
|
663
|
+
family: 0 | 4 | 6;
|
|
664
|
+
} | undefined>;
|
|
665
|
+
setOverlayHost: (push: (state: OverlayState) => unknown, options?: {
|
|
666
|
+
exactClips?: boolean;
|
|
667
|
+
} | undefined) => Promise<void>;
|
|
668
|
+
showInstallPrompt: (reason?: string | undefined) => Promise<void>;
|
|
669
|
+
hideInstallPrompt: () => Promise<void>;
|
|
670
|
+
};
|
|
671
|
+
epoch: number;
|
|
672
|
+
} | undefined;
|
|
673
|
+
/** Activity on the broker connection: every call flows through the facade, so these see all of it. */
|
|
674
|
+
declare const apiLastCall: () => number;
|
|
675
|
+
declare const apiInFlight: () => number;
|
|
676
|
+
//#endregion
|
|
677
|
+
export { apiPromise as a, hasTransport as c, apiLastCall as i, onApiEpoch as l, BrokerUnreachableError as n, apiWithin as o, apiInFlight as r, currentApiEpoch as s, API_DEADLINE_MS as t };
|