@fkn/lib 0.9.27 → 0.9.28
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/{api-Dv7Fy_CF.d.ts → api-CKoF03Me.d.ts} +319 -1
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-ZRqclRzO.d.ts → cloud-BX_24NAz.d.ts} +3 -3
- package/cloud.d.ts +3 -3
- package/{contract-BergoFCw.d.ts → contract-BzdjfQge.d.ts} +106 -1
- package/contract.d.ts +2 -2
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/{extension-CJUeVRXf.d.ts → extension-DwQOshkM.d.ts} +1 -1
- package/extension.d.ts +2 -2
- package/http.d.ts +1 -1
- package/{index-BhO-wymH.d.ts → index-DH3_12nU.d.ts} +36 -36
- package/index.cjs +1 -1
- package/index.d.ts +6 -5
- package/index.js +48 -47
- package/{net-C9Me0zVw.d.ts → net-Cy6QOTK3.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +6 -1
- package/packages.d.ts +1 -1
- package/{proxy-DkuZfeI4.d.ts → proxy-DahCiavd.d.ts} +2 -2
- package/rooms.cjs +1 -0
- package/rooms.d.ts +46 -0
- package/rooms.js +142 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import { A as ProxyFetchInit, C as PackageQuery, D as PickOptions,
|
|
2
|
+
import { $ as TcpSocketOptions, A as ProxyFetchInit, B as RoomJoinOptions, C as PackageQuery, D as PickOptions, F as RoomCreateOptions, G as RoomsErrorCode, O as Placement, P as Resolvers, R as RoomEvent, S as OverlayState, T as PackagesErrorCode, U as RoomPermission, Z as TcpSocketListenerOptions, _ as InstallOptions, a as ConflictChoice, c as ConnectAvailability, i as AdoptState, it as WriteData, j as ProxyFetchInput, l as ConnectOptions, m as FrameConsentRequest, nt as UdpSocketOptions, o as ConflictRequest, r as AdoptRequest, tt as UdpDatagram, y as IpFamily } from "./contract-BzdjfQge.js";
|
|
3
3
|
import { Remote } from "osra";
|
|
4
4
|
//#region src/api-epochs.d.ts
|
|
5
5
|
type EpochListener<T> = (remote: T, epoch: number) => void;
|
|
@@ -275,6 +275,165 @@ declare const onApiEpoch: (listener: EpochListener<{
|
|
|
275
275
|
ok: true;
|
|
276
276
|
}>;
|
|
277
277
|
};
|
|
278
|
+
rooms: {
|
|
279
|
+
available: () => Promise<boolean>;
|
|
280
|
+
create: (options?: RoomCreateOptions | undefined) => Promise<{
|
|
281
|
+
id: string;
|
|
282
|
+
key: string;
|
|
283
|
+
invite: string;
|
|
284
|
+
self: {
|
|
285
|
+
id: string;
|
|
286
|
+
permissions: {
|
|
287
|
+
readonly block: boolean;
|
|
288
|
+
readonly receive: boolean;
|
|
289
|
+
readonly remove: boolean;
|
|
290
|
+
readonly send: boolean;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
owner: string;
|
|
294
|
+
defaults: () => Promise<{
|
|
295
|
+
readonly send: boolean;
|
|
296
|
+
readonly receive: boolean;
|
|
297
|
+
}>;
|
|
298
|
+
members: () => Promise<{
|
|
299
|
+
id: string;
|
|
300
|
+
permissions: {
|
|
301
|
+
readonly block: boolean;
|
|
302
|
+
readonly receive: boolean;
|
|
303
|
+
readonly remove: boolean;
|
|
304
|
+
readonly send: boolean;
|
|
305
|
+
};
|
|
306
|
+
}[]>;
|
|
307
|
+
send: (text: string) => Promise<{
|
|
308
|
+
error: RoomsErrorCode;
|
|
309
|
+
message: string;
|
|
310
|
+
} | {
|
|
311
|
+
ok: true;
|
|
312
|
+
}>;
|
|
313
|
+
setDefault: (permission: "receive" | "send", value: boolean) => Promise<{
|
|
314
|
+
error: RoomsErrorCode;
|
|
315
|
+
message: string;
|
|
316
|
+
} | {
|
|
317
|
+
ok: true;
|
|
318
|
+
}>;
|
|
319
|
+
grant: (id: string, permission: RoomPermission) => Promise<{
|
|
320
|
+
error: RoomsErrorCode;
|
|
321
|
+
message: string;
|
|
322
|
+
} | {
|
|
323
|
+
ok: true;
|
|
324
|
+
}>;
|
|
325
|
+
revoke: (id: string, permission: RoomPermission) => Promise<{
|
|
326
|
+
error: RoomsErrorCode;
|
|
327
|
+
message: string;
|
|
328
|
+
} | {
|
|
329
|
+
ok: true;
|
|
330
|
+
}>;
|
|
331
|
+
remove: (id: string) => Promise<{
|
|
332
|
+
error: RoomsErrorCode;
|
|
333
|
+
message: string;
|
|
334
|
+
} | {
|
|
335
|
+
ok: true;
|
|
336
|
+
}>;
|
|
337
|
+
block: (id: string) => Promise<{
|
|
338
|
+
error: RoomsErrorCode;
|
|
339
|
+
message: string;
|
|
340
|
+
} | {
|
|
341
|
+
ok: true;
|
|
342
|
+
}>;
|
|
343
|
+
unblock: (id: string) => Promise<{
|
|
344
|
+
error: RoomsErrorCode;
|
|
345
|
+
message: string;
|
|
346
|
+
} | {
|
|
347
|
+
ok: true;
|
|
348
|
+
}>;
|
|
349
|
+
on: (listener: (event: RoomEvent) => void) => Promise<() => Promise<void>>;
|
|
350
|
+
leave: () => Promise<void>;
|
|
351
|
+
closed: Promise<{
|
|
352
|
+
reason: 'left' | 'removed' | 'blocked' | 'ended' | 'unavailable';
|
|
353
|
+
}>;
|
|
354
|
+
} | {
|
|
355
|
+
error: RoomsErrorCode;
|
|
356
|
+
message: string;
|
|
357
|
+
}>;
|
|
358
|
+
join: (invite: string, options?: RoomJoinOptions | undefined) => Promise<{
|
|
359
|
+
id: string;
|
|
360
|
+
key: string;
|
|
361
|
+
invite: string;
|
|
362
|
+
self: {
|
|
363
|
+
id: string;
|
|
364
|
+
permissions: {
|
|
365
|
+
readonly block: boolean;
|
|
366
|
+
readonly receive: boolean;
|
|
367
|
+
readonly remove: boolean;
|
|
368
|
+
readonly send: boolean;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
owner: string;
|
|
372
|
+
defaults: () => Promise<{
|
|
373
|
+
readonly send: boolean;
|
|
374
|
+
readonly receive: boolean;
|
|
375
|
+
}>;
|
|
376
|
+
members: () => Promise<{
|
|
377
|
+
id: string;
|
|
378
|
+
permissions: {
|
|
379
|
+
readonly block: boolean;
|
|
380
|
+
readonly receive: boolean;
|
|
381
|
+
readonly remove: boolean;
|
|
382
|
+
readonly send: boolean;
|
|
383
|
+
};
|
|
384
|
+
}[]>;
|
|
385
|
+
send: (text: string) => Promise<{
|
|
386
|
+
error: RoomsErrorCode;
|
|
387
|
+
message: string;
|
|
388
|
+
} | {
|
|
389
|
+
ok: true;
|
|
390
|
+
}>;
|
|
391
|
+
setDefault: (permission: "receive" | "send", value: boolean) => Promise<{
|
|
392
|
+
error: RoomsErrorCode;
|
|
393
|
+
message: string;
|
|
394
|
+
} | {
|
|
395
|
+
ok: true;
|
|
396
|
+
}>;
|
|
397
|
+
grant: (id: string, permission: RoomPermission) => Promise<{
|
|
398
|
+
error: RoomsErrorCode;
|
|
399
|
+
message: string;
|
|
400
|
+
} | {
|
|
401
|
+
ok: true;
|
|
402
|
+
}>;
|
|
403
|
+
revoke: (id: string, permission: RoomPermission) => Promise<{
|
|
404
|
+
error: RoomsErrorCode;
|
|
405
|
+
message: string;
|
|
406
|
+
} | {
|
|
407
|
+
ok: true;
|
|
408
|
+
}>;
|
|
409
|
+
remove: (id: string) => Promise<{
|
|
410
|
+
error: RoomsErrorCode;
|
|
411
|
+
message: string;
|
|
412
|
+
} | {
|
|
413
|
+
ok: true;
|
|
414
|
+
}>;
|
|
415
|
+
block: (id: string) => Promise<{
|
|
416
|
+
error: RoomsErrorCode;
|
|
417
|
+
message: string;
|
|
418
|
+
} | {
|
|
419
|
+
ok: true;
|
|
420
|
+
}>;
|
|
421
|
+
unblock: (id: string) => Promise<{
|
|
422
|
+
error: RoomsErrorCode;
|
|
423
|
+
message: string;
|
|
424
|
+
} | {
|
|
425
|
+
ok: true;
|
|
426
|
+
}>;
|
|
427
|
+
on: (listener: (event: RoomEvent) => void) => Promise<() => Promise<void>>;
|
|
428
|
+
leave: () => Promise<void>;
|
|
429
|
+
closed: Promise<{
|
|
430
|
+
reason: 'left' | 'removed' | 'blocked' | 'ended' | 'unavailable';
|
|
431
|
+
}>;
|
|
432
|
+
} | {
|
|
433
|
+
error: RoomsErrorCode;
|
|
434
|
+
message: string;
|
|
435
|
+
}>;
|
|
436
|
+
};
|
|
278
437
|
account: {
|
|
279
438
|
info: () => Promise<{
|
|
280
439
|
name: string;
|
|
@@ -592,6 +751,165 @@ declare const currentApiEpoch: () => {
|
|
|
592
751
|
ok: true;
|
|
593
752
|
}>;
|
|
594
753
|
};
|
|
754
|
+
rooms: {
|
|
755
|
+
available: () => Promise<boolean>;
|
|
756
|
+
create: (options?: RoomCreateOptions | undefined) => Promise<{
|
|
757
|
+
id: string;
|
|
758
|
+
key: string;
|
|
759
|
+
invite: string;
|
|
760
|
+
self: {
|
|
761
|
+
id: string;
|
|
762
|
+
permissions: {
|
|
763
|
+
readonly block: boolean;
|
|
764
|
+
readonly receive: boolean;
|
|
765
|
+
readonly remove: boolean;
|
|
766
|
+
readonly send: boolean;
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
owner: string;
|
|
770
|
+
defaults: () => Promise<{
|
|
771
|
+
readonly send: boolean;
|
|
772
|
+
readonly receive: boolean;
|
|
773
|
+
}>;
|
|
774
|
+
members: () => Promise<{
|
|
775
|
+
id: string;
|
|
776
|
+
permissions: {
|
|
777
|
+
readonly block: boolean;
|
|
778
|
+
readonly receive: boolean;
|
|
779
|
+
readonly remove: boolean;
|
|
780
|
+
readonly send: boolean;
|
|
781
|
+
};
|
|
782
|
+
}[]>;
|
|
783
|
+
send: (text: string) => Promise<{
|
|
784
|
+
error: RoomsErrorCode;
|
|
785
|
+
message: string;
|
|
786
|
+
} | {
|
|
787
|
+
ok: true;
|
|
788
|
+
}>;
|
|
789
|
+
setDefault: (permission: "receive" | "send", value: boolean) => Promise<{
|
|
790
|
+
error: RoomsErrorCode;
|
|
791
|
+
message: string;
|
|
792
|
+
} | {
|
|
793
|
+
ok: true;
|
|
794
|
+
}>;
|
|
795
|
+
grant: (id: string, permission: RoomPermission) => Promise<{
|
|
796
|
+
error: RoomsErrorCode;
|
|
797
|
+
message: string;
|
|
798
|
+
} | {
|
|
799
|
+
ok: true;
|
|
800
|
+
}>;
|
|
801
|
+
revoke: (id: string, permission: RoomPermission) => Promise<{
|
|
802
|
+
error: RoomsErrorCode;
|
|
803
|
+
message: string;
|
|
804
|
+
} | {
|
|
805
|
+
ok: true;
|
|
806
|
+
}>;
|
|
807
|
+
remove: (id: string) => Promise<{
|
|
808
|
+
error: RoomsErrorCode;
|
|
809
|
+
message: string;
|
|
810
|
+
} | {
|
|
811
|
+
ok: true;
|
|
812
|
+
}>;
|
|
813
|
+
block: (id: string) => Promise<{
|
|
814
|
+
error: RoomsErrorCode;
|
|
815
|
+
message: string;
|
|
816
|
+
} | {
|
|
817
|
+
ok: true;
|
|
818
|
+
}>;
|
|
819
|
+
unblock: (id: string) => Promise<{
|
|
820
|
+
error: RoomsErrorCode;
|
|
821
|
+
message: string;
|
|
822
|
+
} | {
|
|
823
|
+
ok: true;
|
|
824
|
+
}>;
|
|
825
|
+
on: (listener: (event: RoomEvent) => void) => Promise<() => Promise<void>>;
|
|
826
|
+
leave: () => Promise<void>;
|
|
827
|
+
closed: Promise<{
|
|
828
|
+
reason: 'left' | 'removed' | 'blocked' | 'ended' | 'unavailable';
|
|
829
|
+
}>;
|
|
830
|
+
} | {
|
|
831
|
+
error: RoomsErrorCode;
|
|
832
|
+
message: string;
|
|
833
|
+
}>;
|
|
834
|
+
join: (invite: string, options?: RoomJoinOptions | undefined) => Promise<{
|
|
835
|
+
id: string;
|
|
836
|
+
key: string;
|
|
837
|
+
invite: string;
|
|
838
|
+
self: {
|
|
839
|
+
id: string;
|
|
840
|
+
permissions: {
|
|
841
|
+
readonly block: boolean;
|
|
842
|
+
readonly receive: boolean;
|
|
843
|
+
readonly remove: boolean;
|
|
844
|
+
readonly send: boolean;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
owner: string;
|
|
848
|
+
defaults: () => Promise<{
|
|
849
|
+
readonly send: boolean;
|
|
850
|
+
readonly receive: boolean;
|
|
851
|
+
}>;
|
|
852
|
+
members: () => Promise<{
|
|
853
|
+
id: string;
|
|
854
|
+
permissions: {
|
|
855
|
+
readonly block: boolean;
|
|
856
|
+
readonly receive: boolean;
|
|
857
|
+
readonly remove: boolean;
|
|
858
|
+
readonly send: boolean;
|
|
859
|
+
};
|
|
860
|
+
}[]>;
|
|
861
|
+
send: (text: string) => Promise<{
|
|
862
|
+
error: RoomsErrorCode;
|
|
863
|
+
message: string;
|
|
864
|
+
} | {
|
|
865
|
+
ok: true;
|
|
866
|
+
}>;
|
|
867
|
+
setDefault: (permission: "receive" | "send", value: boolean) => Promise<{
|
|
868
|
+
error: RoomsErrorCode;
|
|
869
|
+
message: string;
|
|
870
|
+
} | {
|
|
871
|
+
ok: true;
|
|
872
|
+
}>;
|
|
873
|
+
grant: (id: string, permission: RoomPermission) => Promise<{
|
|
874
|
+
error: RoomsErrorCode;
|
|
875
|
+
message: string;
|
|
876
|
+
} | {
|
|
877
|
+
ok: true;
|
|
878
|
+
}>;
|
|
879
|
+
revoke: (id: string, permission: RoomPermission) => Promise<{
|
|
880
|
+
error: RoomsErrorCode;
|
|
881
|
+
message: string;
|
|
882
|
+
} | {
|
|
883
|
+
ok: true;
|
|
884
|
+
}>;
|
|
885
|
+
remove: (id: string) => Promise<{
|
|
886
|
+
error: RoomsErrorCode;
|
|
887
|
+
message: string;
|
|
888
|
+
} | {
|
|
889
|
+
ok: true;
|
|
890
|
+
}>;
|
|
891
|
+
block: (id: string) => Promise<{
|
|
892
|
+
error: RoomsErrorCode;
|
|
893
|
+
message: string;
|
|
894
|
+
} | {
|
|
895
|
+
ok: true;
|
|
896
|
+
}>;
|
|
897
|
+
unblock: (id: string) => Promise<{
|
|
898
|
+
error: RoomsErrorCode;
|
|
899
|
+
message: string;
|
|
900
|
+
} | {
|
|
901
|
+
ok: true;
|
|
902
|
+
}>;
|
|
903
|
+
on: (listener: (event: RoomEvent) => void) => Promise<() => Promise<void>>;
|
|
904
|
+
leave: () => Promise<void>;
|
|
905
|
+
closed: Promise<{
|
|
906
|
+
reason: 'left' | 'removed' | 'blocked' | 'ended' | 'unavailable';
|
|
907
|
+
}>;
|
|
908
|
+
} | {
|
|
909
|
+
error: RoomsErrorCode;
|
|
910
|
+
message: string;
|
|
911
|
+
}>;
|
|
912
|
+
};
|
|
595
913
|
account: {
|
|
596
914
|
info: () => Promise<{
|
|
597
915
|
name: string;
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { P as Resolvers } from "./contract-
|
|
2
|
-
import { a as apiPromise, c as hasTransport, i as apiLastCall, l as onApiEpoch, n as BrokerUnreachableError, o as apiWithin, r as apiInFlight, s as currentApiEpoch, t as API_DEADLINE_MS } from "./api-
|
|
1
|
+
import { P as Resolvers } from "./contract-BzdjfQge.js";
|
|
2
|
+
import { a as apiPromise, c as hasTransport, i as apiLastCall, l as onApiEpoch, n as BrokerUnreachableError, o as apiWithin, r as apiInFlight, s as currentApiEpoch, t as API_DEADLINE_MS } from "./api-CKoF03Me.js";
|
|
3
3
|
export { API_DEADLINE_MS, BrokerUnreachableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
package/cloud/dns.d.ts
CHANGED
package/cloud/fetch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as cloudFetch } from "../proxy-
|
|
1
|
+
import { t as cloudFetch } from "../proxy-DahCiavd.js";
|
|
2
2
|
export { cloudFetch as fetch };
|
package/cloud/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-Cy6QOTK3.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
-
import { i as Frame, r as AttachFrameOptions } from "./index-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-DahCiavd.js";
|
|
2
|
+
import { i as Frame, r as AttachFrameOptions } from "./index-DH3_12nU.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
4
|
import { n as fs_d_exports } from "./fs-CBVaShOR.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
5
|
+
import { s as net_d_exports } from "./net-Cy6QOTK3.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
//#region src/cloud/frame.d.ts
|
package/cloud.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
-
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-DahCiavd.js";
|
|
2
|
+
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-BX_24NAz.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
4
|
import { n as fs_d_exports } from "./fs-CBVaShOR.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
5
|
+
import { s as net_d_exports } from "./net-Cy6QOTK3.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
|
|
@@ -179,6 +179,106 @@ type MountDescriptor = {
|
|
|
179
179
|
/** the connecting app, as the BROKER knows it */
|
|
180
180
|
from: string;
|
|
181
181
|
};
|
|
182
|
+
type RoomPermission = 'send' | 'receive' | 'remove' | 'block';
|
|
183
|
+
type RoomPermissions = Readonly<Record<RoomPermission, boolean>>;
|
|
184
|
+
type RoomDefaults = Readonly<{
|
|
185
|
+
send: boolean;
|
|
186
|
+
receive: boolean;
|
|
187
|
+
}>;
|
|
188
|
+
/** A participant as this room sees them. The id is fresh in every room. */
|
|
189
|
+
type RoomMember = {
|
|
190
|
+
id: string;
|
|
191
|
+
permissions: RoomPermissions;
|
|
192
|
+
};
|
|
193
|
+
type RoomMessage = {
|
|
194
|
+
seq: number;
|
|
195
|
+
from: string;
|
|
196
|
+
at: number;
|
|
197
|
+
text: string;
|
|
198
|
+
};
|
|
199
|
+
type RoomEvent = {
|
|
200
|
+
type: 'message';
|
|
201
|
+
message: RoomMessage;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'joined';
|
|
204
|
+
member: RoomMember;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'left';
|
|
207
|
+
id: string;
|
|
208
|
+
reason: 'left' | 'removed' | 'blocked';
|
|
209
|
+
} | {
|
|
210
|
+
type: 'permissions';
|
|
211
|
+
id: string;
|
|
212
|
+
permissions: RoomPermissions;
|
|
213
|
+
} | {
|
|
214
|
+
type: 'defaults';
|
|
215
|
+
defaults: RoomDefaults;
|
|
216
|
+
};
|
|
217
|
+
type RoomsErrorCode = 'invalid' | 'not-found' | 'bad-key' | 'full' | 'blocked' | 'denied' | 'rate-limited' | 'too-large' | 'unavailable' | 'closed';
|
|
218
|
+
/** A refusal, as data. `packages` crosses the hop the same way, and for the same reason. */
|
|
219
|
+
type RoomsFail = {
|
|
220
|
+
error: RoomsErrorCode;
|
|
221
|
+
message: string;
|
|
222
|
+
};
|
|
223
|
+
/** Why the room ended for this app. It ends once. */
|
|
224
|
+
type RoomEnd = {
|
|
225
|
+
reason: 'left' | 'removed' | 'blocked' | 'ended' | 'unavailable';
|
|
226
|
+
};
|
|
227
|
+
type RoomCreateOptions = {
|
|
228
|
+
/** aborting it leaves the room; it never bounds the wait for the broker */
|
|
229
|
+
signal?: AbortSignal;
|
|
230
|
+
members?: number;
|
|
231
|
+
defaults?: Partial<RoomDefaults>;
|
|
232
|
+
};
|
|
233
|
+
type RoomJoinOptions = {
|
|
234
|
+
signal?: AbortSignal;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* A joined room, held by the broker: it owns the socket, the room key and the derived message key,
|
|
238
|
+
* and hands the app plaintext and member ids only.
|
|
239
|
+
*
|
|
240
|
+
* Every member that can be refused answers with a `RoomsFail` rather than throwing, so a refusal
|
|
241
|
+
* survives the osra hop as data. `leave` and `on` cannot be refused.
|
|
242
|
+
*/
|
|
243
|
+
type RoomHandle = {
|
|
244
|
+
/** the room's uuid */
|
|
245
|
+
id: string;
|
|
246
|
+
/** the room key, base64url. The api never sees it. Anyone holding it and the id can join. */
|
|
247
|
+
key: string;
|
|
248
|
+
/** `id` and `key` as one string, the thing to put in a link */
|
|
249
|
+
invite: string;
|
|
250
|
+
self: RoomMember;
|
|
251
|
+
owner: string;
|
|
252
|
+
defaults: () => Promise<RoomDefaults>;
|
|
253
|
+
members: () => Promise<RoomMember[]>;
|
|
254
|
+
/** at most 4,096 bytes of UTF-8, sealed before it leaves the browser; never truncated */
|
|
255
|
+
send: (text: string) => Promise<RoomsFail | {
|
|
256
|
+
ok: true;
|
|
257
|
+
}>;
|
|
258
|
+
setDefault: (permission: 'send' | 'receive', value: boolean) => Promise<RoomsFail | {
|
|
259
|
+
ok: true;
|
|
260
|
+
}>;
|
|
261
|
+
grant: (id: string, permission: RoomPermission) => Promise<RoomsFail | {
|
|
262
|
+
ok: true;
|
|
263
|
+
}>;
|
|
264
|
+
revoke: (id: string, permission: RoomPermission) => Promise<RoomsFail | {
|
|
265
|
+
ok: true;
|
|
266
|
+
}>;
|
|
267
|
+
remove: (id: string) => Promise<RoomsFail | {
|
|
268
|
+
ok: true;
|
|
269
|
+
}>;
|
|
270
|
+
block: (id: string) => Promise<RoomsFail | {
|
|
271
|
+
ok: true;
|
|
272
|
+
}>;
|
|
273
|
+
unblock: (id: string) => Promise<RoomsFail | {
|
|
274
|
+
ok: true;
|
|
275
|
+
}>;
|
|
276
|
+
/** the `account.onChange` shape: one broker-side registration, unsubscribed by the returned function */
|
|
277
|
+
on: (listener: (event: RoomEvent) => void) => (() => void);
|
|
278
|
+
leave: () => Promise<void>;
|
|
279
|
+
/** settles once, when the room ends for this app. Never rejects. */
|
|
280
|
+
closed: Promise<RoomEnd>;
|
|
281
|
+
};
|
|
182
282
|
type IpFamily = 'IPv4' | 'IPv6';
|
|
183
283
|
/** Viewport rect plus optional corner radii, as the overlay host reports them. */
|
|
184
284
|
type OverlayRect = {
|
|
@@ -381,6 +481,11 @@ type Resolvers = {
|
|
|
381
481
|
ok: true;
|
|
382
482
|
}>;
|
|
383
483
|
};
|
|
484
|
+
rooms: {
|
|
485
|
+
available: () => Promise<boolean>;
|
|
486
|
+
create: (options?: RoomCreateOptions) => Promise<RoomsFail | RoomHandle>;
|
|
487
|
+
join: (invite: string, options?: RoomJoinOptions) => Promise<RoomsFail | RoomHandle>;
|
|
488
|
+
};
|
|
384
489
|
account: {
|
|
385
490
|
info: () => Promise<Account | null>;
|
|
386
491
|
login: (consumerOrigin: string) => Promise<boolean>;
|
|
@@ -403,4 +508,4 @@ type Resolvers = {
|
|
|
403
508
|
hideInstallPrompt: () => void;
|
|
404
509
|
};
|
|
405
510
|
//#endregion
|
|
406
|
-
export { ProxyFetchInit as A,
|
|
511
|
+
export { TcpSocketOptions as $, ProxyFetchInit as A, RoomJoinOptions as B, PackageQuery as C, PickOptions as D, PackagesFail as E, RoomCreateOptions as F, RoomsErrorCode as G, RoomMessage as H, RoomDefaults as I, StorageEntry as J, RoomsFail as K, RoomEnd as L, Quota as M, Radii as N, Placement as O, Resolvers as P, TcpSocketListenerResult as Q, RoomEvent as R, OverlayState as S, PackagesErrorCode as T, RoomPermission as U, RoomMember as V, RoomPermissions as W, SurfaceRect as X, StorageQuota as Y, TcpSocketListenerOptions as Z, InstallOptions as _, ConflictChoice as a, MountDescriptor as b, ConnectAvailability as c, DisplayLevel as d, TcpSocketResult as et, DnsLookup as f, HiddenSurface as g, FrameFetchScope as h, AdoptState as i, WriteData as it, ProxyFetchInput as j, ProxyFetch as k, ConnectOptions as l, FrameConsentRequest as m, AddressLookupResult as n, UdpSocketOptions as nt, ConflictRequest as o, EncryptionState as p, SetOverlayHost as q, AdoptRequest as r, UdpSocketResult as rt, ConflictSide as s, Account as t, UdpDatagram as tt, DisplayCause as u, InstalledPackage as v, PackageResult as w, OverlayRect as x, IpFamily as y, RoomHandle as z };
|
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 { A as ProxyFetchInit, B 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, SetOverlayHost, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WriteData };
|
|
2
|
+
import { $ as TcpSocketOptions, A as ProxyFetchInit, B as RoomJoinOptions, C as PackageQuery, D as PickOptions, E as PackagesFail, F as RoomCreateOptions, G as RoomsErrorCode, H as RoomMessage, I as RoomDefaults, J as StorageEntry, K as RoomsFail, L as RoomEnd, M as Quota, N as Radii, O as Placement, P as Resolvers, Q as TcpSocketListenerResult, R as RoomEvent, S as OverlayState, T as PackagesErrorCode, U as RoomPermission, V as RoomMember, W as RoomPermissions, X as SurfaceRect, Y as StorageQuota, Z as TcpSocketListenerOptions, _ as InstallOptions, a as ConflictChoice, b as MountDescriptor, c as ConnectAvailability, d as DisplayLevel, et as TcpSocketResult, f as DnsLookup, g as HiddenSurface, h as FrameFetchScope, i as AdoptState, it as WriteData, j as ProxyFetchInput, k as ProxyFetch, l as ConnectOptions, m as FrameConsentRequest, n as AddressLookupResult, nt as UdpSocketOptions, o as ConflictRequest, p as EncryptionState, q as SetOverlayHost, r as AdoptRequest, rt as UdpSocketResult, s as ConflictSide, t as Account, tt as UdpDatagram, u as DisplayCause, v as InstalledPackage, w as PackageResult, x as OverlayRect, y as IpFamily, z as RoomHandle } from "./contract-BzdjfQge.js";
|
|
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, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMember, RoomMessage, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SetOverlayHost, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WriteData };
|
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 { P as Resolvers, rt as UdpSocketResult } from "./contract-BzdjfQge.js";
|
|
3
|
+
import "./api-CKoF03Me.js";
|
|
4
4
|
import { Buffer } from "buffer";
|
|
5
5
|
import { AddressInfo } from "net";
|
|
6
6
|
import { EventEmitter } from "events";
|
package/dns.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, n as attachFrame, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-
|
|
1
|
+
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, n as attachFrame, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-DH3_12nU.js";
|
|
2
2
|
//#region ../web-extension/lib/lib/forgeable-headers.d.ts
|
|
3
3
|
declare const FORGEABLE_HEADERS: string[];
|
|
4
4
|
declare const hasForgedCookie: (unsafeHeaders: [string, string][] | undefined) => boolean;
|
package/extension.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as modifyRequestHeadersPermission, B as fetch, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ as PermissionRequest, a as extension, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PermissionGrant, h as supportsOperation, i as promptInstall, j as removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, r as isExtensionAvailable, s as readExtensionHandshake, u as EXTENSION_ABI, v as permissions, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-
|
|
2
|
-
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, n as attachFrame, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-
|
|
1
|
+
import { A as modifyRequestHeadersPermission, B as fetch, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ as PermissionRequest, a as extension, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PermissionGrant, h as supportsOperation, i as promptInstall, j as removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, r as isExtensionAvailable, s as readExtensionHandshake, u as EXTENSION_ABI, v as permissions, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-DwQOshkM.js";
|
|
2
|
+
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, n as attachFrame, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-DH3_12nU.js";
|
|
3
3
|
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, type OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
|
package/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Socket, t as Server$1 } from "./net-
|
|
1
|
+
import { n as Socket, t as Server$1 } from "./net-Cy6QOTK3.js";
|
|
2
2
|
import { Buffer } from "buffer";
|
|
3
3
|
import { Stream } from "stream";
|
|
4
4
|
import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
|
|
@@ -126,54 +126,54 @@ declare const defaultModules: {
|
|
|
126
126
|
readonly element: {
|
|
127
127
|
readonly selectors: {
|
|
128
128
|
readonly locator: {
|
|
129
|
-
readonly to:
|
|
129
|
+
readonly to: 'element';
|
|
130
130
|
readonly css: true;
|
|
131
131
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
132
132
|
readonly render: (selector: unknown) => {
|
|
133
133
|
fragment: string;
|
|
134
|
-
separator:
|
|
134
|
+
separator: 'descend';
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
readonly frameLocator: {
|
|
138
|
-
readonly to:
|
|
138
|
+
readonly to: 'frame';
|
|
139
139
|
readonly css: true;
|
|
140
|
-
readonly barrier:
|
|
140
|
+
readonly barrier: 'down';
|
|
141
141
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
142
142
|
readonly render: (selector: unknown) => {
|
|
143
143
|
fragment: string;
|
|
144
|
-
separator:
|
|
144
|
+
separator: 'down';
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
147
|
readonly getByRole: {
|
|
148
|
-
readonly to:
|
|
148
|
+
readonly to: 'element';
|
|
149
149
|
readonly resolve: (context: LocatorContext, role: string) => Element[];
|
|
150
150
|
readonly render: (role: unknown) => {
|
|
151
151
|
fragment: string;
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
readonly getByText: {
|
|
155
|
-
readonly to:
|
|
155
|
+
readonly to: 'element';
|
|
156
156
|
readonly resolve: (context: LocatorContext, text: string) => Element[];
|
|
157
157
|
readonly render: (text: unknown) => {
|
|
158
158
|
fragment: string;
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
161
|
readonly getByTestId: {
|
|
162
|
-
readonly to:
|
|
162
|
+
readonly to: 'element';
|
|
163
163
|
readonly resolve: (context: LocatorContext, testId: string) => Element[];
|
|
164
164
|
readonly render: (testId: unknown) => {
|
|
165
165
|
fragment: string;
|
|
166
166
|
};
|
|
167
167
|
};
|
|
168
168
|
readonly first: {
|
|
169
|
-
readonly to:
|
|
169
|
+
readonly to: 'element';
|
|
170
170
|
readonly resolve: (context: LocatorContext) => Element[];
|
|
171
171
|
readonly render: () => {
|
|
172
172
|
fragment: string;
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
readonly nth: {
|
|
176
|
-
readonly to:
|
|
176
|
+
readonly to: 'element';
|
|
177
177
|
readonly resolve: (context: LocatorContext, index: number) => Element[];
|
|
178
178
|
readonly render: (index: unknown) => {
|
|
179
179
|
fragment: string;
|
|
@@ -210,31 +210,31 @@ declare const defaultModules: {
|
|
|
210
210
|
readonly frame: {
|
|
211
211
|
readonly selectors: {
|
|
212
212
|
readonly locator: {
|
|
213
|
-
readonly to:
|
|
213
|
+
readonly to: 'element';
|
|
214
214
|
readonly css: true;
|
|
215
215
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
216
216
|
readonly render: (selector: unknown) => {
|
|
217
217
|
fragment: string;
|
|
218
|
-
separator:
|
|
218
|
+
separator: 'descend';
|
|
219
219
|
};
|
|
220
220
|
};
|
|
221
221
|
readonly frameLocator: {
|
|
222
|
-
readonly to:
|
|
222
|
+
readonly to: 'frame';
|
|
223
223
|
readonly css: true;
|
|
224
|
-
readonly barrier:
|
|
224
|
+
readonly barrier: 'down';
|
|
225
225
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
226
226
|
readonly render: (selector: unknown) => {
|
|
227
227
|
fragment: string;
|
|
228
|
-
separator:
|
|
228
|
+
separator: 'down';
|
|
229
229
|
};
|
|
230
230
|
};
|
|
231
231
|
readonly owner: {
|
|
232
|
-
readonly to:
|
|
233
|
-
readonly barrier:
|
|
232
|
+
readonly to: 'frame';
|
|
233
|
+
readonly barrier: 'up';
|
|
234
234
|
readonly resolve: (_context: LocatorContext) => Element[];
|
|
235
235
|
readonly render: () => {
|
|
236
236
|
fragment: string;
|
|
237
|
-
separator:
|
|
237
|
+
separator: 'up';
|
|
238
238
|
};
|
|
239
239
|
};
|
|
240
240
|
};
|
|
@@ -412,54 +412,54 @@ declare const locatorModules: Extended<{
|
|
|
412
412
|
readonly element: {
|
|
413
413
|
readonly selectors: {
|
|
414
414
|
readonly locator: {
|
|
415
|
-
readonly to:
|
|
415
|
+
readonly to: 'element';
|
|
416
416
|
readonly css: true;
|
|
417
417
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
418
418
|
readonly render: (selector: unknown) => {
|
|
419
419
|
fragment: string;
|
|
420
|
-
separator:
|
|
420
|
+
separator: 'descend';
|
|
421
421
|
};
|
|
422
422
|
};
|
|
423
423
|
readonly frameLocator: {
|
|
424
|
-
readonly to:
|
|
424
|
+
readonly to: 'frame';
|
|
425
425
|
readonly css: true;
|
|
426
|
-
readonly barrier:
|
|
426
|
+
readonly barrier: 'down';
|
|
427
427
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
428
428
|
readonly render: (selector: unknown) => {
|
|
429
429
|
fragment: string;
|
|
430
|
-
separator:
|
|
430
|
+
separator: 'down';
|
|
431
431
|
};
|
|
432
432
|
};
|
|
433
433
|
readonly getByRole: {
|
|
434
|
-
readonly to:
|
|
434
|
+
readonly to: 'element';
|
|
435
435
|
readonly resolve: (context: LocatorContext, role: string) => Element[];
|
|
436
436
|
readonly render: (role: unknown) => {
|
|
437
437
|
fragment: string;
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
440
|
readonly getByText: {
|
|
441
|
-
readonly to:
|
|
441
|
+
readonly to: 'element';
|
|
442
442
|
readonly resolve: (context: LocatorContext, text: string) => Element[];
|
|
443
443
|
readonly render: (text: unknown) => {
|
|
444
444
|
fragment: string;
|
|
445
445
|
};
|
|
446
446
|
};
|
|
447
447
|
readonly getByTestId: {
|
|
448
|
-
readonly to:
|
|
448
|
+
readonly to: 'element';
|
|
449
449
|
readonly resolve: (context: LocatorContext, testId: string) => Element[];
|
|
450
450
|
readonly render: (testId: unknown) => {
|
|
451
451
|
fragment: string;
|
|
452
452
|
};
|
|
453
453
|
};
|
|
454
454
|
readonly first: {
|
|
455
|
-
readonly to:
|
|
455
|
+
readonly to: 'element';
|
|
456
456
|
readonly resolve: (context: LocatorContext) => Element[];
|
|
457
457
|
readonly render: () => {
|
|
458
458
|
fragment: string;
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
461
|
readonly nth: {
|
|
462
|
-
readonly to:
|
|
462
|
+
readonly to: 'element';
|
|
463
463
|
readonly resolve: (context: LocatorContext, index: number) => Element[];
|
|
464
464
|
readonly render: (index: unknown) => {
|
|
465
465
|
fragment: string;
|
|
@@ -496,31 +496,31 @@ declare const locatorModules: Extended<{
|
|
|
496
496
|
readonly frame: {
|
|
497
497
|
readonly selectors: {
|
|
498
498
|
readonly locator: {
|
|
499
|
-
readonly to:
|
|
499
|
+
readonly to: 'element';
|
|
500
500
|
readonly css: true;
|
|
501
501
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
502
502
|
readonly render: (selector: unknown) => {
|
|
503
503
|
fragment: string;
|
|
504
|
-
separator:
|
|
504
|
+
separator: 'descend';
|
|
505
505
|
};
|
|
506
506
|
};
|
|
507
507
|
readonly frameLocator: {
|
|
508
|
-
readonly to:
|
|
508
|
+
readonly to: 'frame';
|
|
509
509
|
readonly css: true;
|
|
510
|
-
readonly barrier:
|
|
510
|
+
readonly barrier: 'down';
|
|
511
511
|
readonly resolve: (context: LocatorContext, selector: string) => Element[];
|
|
512
512
|
readonly render: (selector: unknown) => {
|
|
513
513
|
fragment: string;
|
|
514
|
-
separator:
|
|
514
|
+
separator: 'down';
|
|
515
515
|
};
|
|
516
516
|
};
|
|
517
517
|
readonly owner: {
|
|
518
|
-
readonly to:
|
|
519
|
-
readonly barrier:
|
|
518
|
+
readonly to: 'frame';
|
|
519
|
+
readonly barrier: 'up';
|
|
520
520
|
readonly resolve: (_context: LocatorContext) => Element[];
|
|
521
521
|
readonly render: () => {
|
|
522
522
|
fragment: string;
|
|
523
|
-
separator:
|
|
523
|
+
separator: 'up';
|
|
524
524
|
};
|
|
525
525
|
};
|
|
526
526
|
};
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DLM2M3_i.cjs"),n=require("./api-BCJO3EWi.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-B2ZG-0MF.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-DBazc3ff.cjs"),u=require("./desktop.cjs"),d=require("./fs-J5h3i5eg.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DLM2M3_i.cjs"),n=require("./api-BCJO3EWi.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-B2ZG-0MF.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-DBazc3ff.cjs"),u=require("./desktop.cjs"),d=require("./fs-J5h3i5eg.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.F())return e(!0);let n,r=setTimeout(()=>i(t.F()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.F()),y)},o=new MutationObserver(()=>{t.F()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.F()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=async e=>l.r()||e.lockdown||!i.a()||await b()?t.r(e):i.i(e),S=`https://fkn.app`,C=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??S,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},w=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),T=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),E=new Set,D=e=>(E.add(e),()=>{E.delete(e)}),O=()=>{if(E.size===0)return!1;for(let e of[...E])try{e()}catch{}return!0},k=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},A=e.t({applyUpdate:()=>U,busyReasons:()=>H,onUpdate:()=>L,onUpdateTaken:()=>R,updateReady:()=>j}),j=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),M=new Set,N=!1,P=()=>{N=!0;for(let e of[...M])try{e()}catch{}},F=0,I=()=>{let e=n.s();!e||M.size===0||F===e.epoch||(F=e.epoch,N=!1,Promise.resolve(e.remote.shell?.onUpdate(P)).catch(()=>{F===e.epoch&&(F=0)}))};typeof window<`u`&&n.l(I);var L=async e=>{if(typeof window>`u`)return()=>{};if(M.add(e),N)try{e()}catch{}return I(),()=>{M.delete(e)}},R=e=>typeof window>`u`?()=>{}:D(e),z=0,B=!1,V=()=>{if(!O()&&!B){B=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||z===e.epoch)return;z=e.epoch;let t=k(e.remote.shell,V);if(!t){z=0;return}t.catch(()=>{z===e.epoch&&(z=0)})});var H=()=>r.n(),U=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.n,exports.EXTENSION_ABI=t.z,exports.ExtensionOperationUnsupportedError=t.B,exports.ExtensionOutdatedError=t.V,exports.FORGEABLE_HEADERS=t.A,exports.LOCATOR_DENIED=t.p,exports.LOCATOR_ERROR=t.g,exports.LOCATOR_UNSUPPORTED=t.u,exports.REQUIRED_EXTENSION_ABI=t.H,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.s,exports.assertFetchableUrl=t.C,exports.assertForgeableHeaders=t.j,exports.assertLockdownApplicable=t.c,exports.assertOneCookieIdentity=t.M,exports.attachFrame=x,exports.attachFramePermission=t.i,exports.box=t.G,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=w,exports.connectButtonUrl=g.t,exports.cookies=t.x,exports.createFrame=t.a,exports.createVideoElementHandle=t.K,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.T,exports.fetchLocalPermission=t.E,exports.fetchPermission=t.D,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.o,exports.handleRevivableModules=t.W,exports.hasForgedCookie=t.N,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.O,exports.isBlockedFrameUrl=t.l,exports.isExtensionExposed=t.F,exports.isLocalNetworkUrl=t.k,exports.isLocatorDenied=t.h,exports.isLocatorUnsupported=t._,exports.isTerminalError=t.f,exports.isType=t.q,exports.modifyRequestHeadersPermission=t.v,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.t,exports.promptInstall=l.i,exports.promptRelay=T,exports.readCookiePermission=t.S,exports.readExtensionHandshake=t.I,exports.relayWorker=C,exports.removeRequestHeaderRule=t.y,exports.revive=t.J,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.L,exports.setRequestHeaderRule=t.b,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return A}}),exports.supportsOperation=t.U,exports.type=t.Y,exports.waitForExtensionExposure=t.R;
|
package/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { t as account_d_exports } from "./account.js";
|
|
2
|
-
import { A as modifyRequestHeadersPermission, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ as PermissionRequest, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PermissionGrant, h as supportsOperation, i as promptInstall, j as removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as permissions, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-
|
|
3
|
-
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-
|
|
4
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
2
|
+
import { A as modifyRequestHeadersPermission, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ as PermissionRequest, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PermissionGrant, h as supportsOperation, i as promptInstall, j as removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as permissions, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-DwQOshkM.js";
|
|
3
|
+
import { C as OperationRequest, S as GateTools, _ as isType, a as FrameBackend, b as Executor, c as attachFramePermission, d as handleRevivableModules, f as BoxedVideoElement, g as createVideoElementHandle, h as box, i as Frame, l as createFrame, m as VideoElementState, o as GotoOptions, p as RemoteVideoElement, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as revive, w as SelectorPart, x as Gate, y as type } from "./index-DH3_12nU.js";
|
|
4
|
+
import { n as cloud_d_exports } from "./cloud-BX_24NAz.js";
|
|
5
5
|
import { t as dns_d_exports } from "./dns.js";
|
|
6
6
|
import { u as index_d_exports } from "./index-Cg6y_FTi.js";
|
|
7
|
-
import { s as net_d_exports } from "./net-
|
|
7
|
+
import { s as net_d_exports } from "./net-Cy6QOTK3.js";
|
|
8
8
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
9
9
|
import { t as http_d_exports } from "./http.js";
|
|
10
10
|
import { t as desktop_d_exports } from "./desktop.js";
|
|
11
11
|
import { t as index_d_exports$1 } from "./opfs.js";
|
|
12
12
|
import { t as packages_d_exports } from "./packages.js";
|
|
13
|
+
import { t as rooms_d_exports } from "./rooms.js";
|
|
13
14
|
import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
|
|
14
15
|
//#region src/frame.d.ts
|
|
15
16
|
declare const attachFrame: (options: AttachFrameOptions) => Promise<Frame>;
|
|
@@ -110,4 +111,4 @@ declare const busyReasons: () => string[];
|
|
|
110
111
|
*/
|
|
111
112
|
declare const applyUpdate: () => Promise<boolean>;
|
|
112
113
|
//#endregion
|
|
113
|
-
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, type OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, box, cloud_d_exports as cloud, connect, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, promptRelay, readCookiePermission, readExtensionHandshake, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
|
|
114
|
+
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, type OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, box, cloud_d_exports as cloud, connect, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, promptRelay, readCookiePermission, readExtensionHandshake, relayWorker, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as
|
|
2
|
+
import { A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as ee, L as te, M as ne, N as re, O as ie, R as ae, S as oe, T as se, U as ce, V as d, W as f, Y as p, _ as m, a as h, b as g, c as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, n as T, o as E, p as D, q as O, r as k, s as A, t as j, u as M, v as N, x as P, y as F, z as I } from "./lib-duLPF_WZ.js";
|
|
3
3
|
import { a as L, l as R, s as z, u as B } from "./api-DLvscoll.js";
|
|
4
4
|
import { n as V, t as H } from "./busy-B189uX--.js";
|
|
5
5
|
import { a as U, i as W, n as G } from "./cloud-DolBoNvR.js";
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { i as
|
|
11
|
-
import { t as
|
|
12
|
-
import { u as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
6
|
+
import { t as le } from "./dns.js";
|
|
7
|
+
import { t as ue } from "./net.js";
|
|
8
|
+
import { t as de } from "./dgram.js";
|
|
9
|
+
import { t as fe } from "./http.js";
|
|
10
|
+
import { i as pe, n as me, r as he, t as ge } from "./extension-Dw9gzvei.js";
|
|
11
|
+
import { t as _e } from "./desktop.js";
|
|
12
|
+
import { u as ve } from "./fs-Cvx2NT6o.js";
|
|
13
|
+
import { t as ye } from "./opfs.js";
|
|
14
|
+
import { t as be } from "./packages.js";
|
|
15
|
+
import { t as xe } from "./rooms.js";
|
|
16
|
+
import { t as Se } from "./account.js";
|
|
17
|
+
import { t as Ce } from "./connect-button-DtsN3X1J.js";
|
|
18
|
+
import { relay as we } from "osra";
|
|
18
19
|
//#region src/frame.ts
|
|
19
|
-
var
|
|
20
|
+
var Te = 1e4, Ee = 150, De = () => new Promise((e) => {
|
|
20
21
|
if (o()) return e(!0);
|
|
21
|
-
let t, n = setTimeout(() => r(o()),
|
|
22
|
+
let t, n = setTimeout(() => r(o()), Te), r = (r) => {
|
|
22
23
|
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", s), e(r);
|
|
23
24
|
}, i = () => {
|
|
24
|
-
clearTimeout(t), t = setTimeout(() => r(o()),
|
|
25
|
+
clearTimeout(t), t = setTimeout(() => r(o()), Ee);
|
|
25
26
|
}, a = new MutationObserver(() => {
|
|
26
27
|
o() && r(!0);
|
|
27
28
|
}), s = () => {
|
|
@@ -31,59 +32,59 @@ var Ce = 1e4, we = 150, Te = () => new Promise((e) => {
|
|
|
31
32
|
attributes: !0,
|
|
32
33
|
attributeFilter: ["data-fkn-extension"]
|
|
33
34
|
}), document.addEventListener("readystatechange", s), document.readyState === "complete" && i();
|
|
34
|
-
}),
|
|
35
|
+
}), Oe = async (e) => he() || e.lockdown || !U() || await De() ? k(e) : W(e), ke = "https://fkn.app", Ae = async (e, t) => {
|
|
35
36
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
36
37
|
let n = await B;
|
|
37
38
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
38
39
|
let r = H("relayed worker");
|
|
39
40
|
t?.unregisterSignal?.aborted ? r() : t?.unregisterSignal?.addEventListener("abort", r, { once: !0 });
|
|
40
41
|
let i = n.emit instanceof MessagePort ? {} : {
|
|
41
|
-
originA: t?.originA ??
|
|
42
|
+
originA: t?.originA ?? ke,
|
|
42
43
|
originB: t?.originB ?? "*"
|
|
43
44
|
};
|
|
44
|
-
|
|
45
|
+
we(n, e, {
|
|
45
46
|
key: "fkn-api",
|
|
46
47
|
...i,
|
|
47
48
|
unregisterSignal: t?.unregisterSignal
|
|
48
49
|
});
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
if (
|
|
53
|
-
for (let e of [...
|
|
50
|
+
}, je = async () => typeof window > "u" ? !1 : (await L).connect.prompt(location.origin).catch(() => !1), Me = async () => typeof window > "u" ? null : (await L).relay.prompt().catch(() => null), K = /* @__PURE__ */ new Set(), Ne = (e) => (K.add(e), () => {
|
|
51
|
+
K.delete(e);
|
|
52
|
+
}), Pe = () => {
|
|
53
|
+
if (K.size === 0) return !1;
|
|
54
|
+
for (let e of [...K]) try {
|
|
54
55
|
e();
|
|
55
56
|
} catch {}
|
|
56
57
|
return !0;
|
|
57
|
-
},
|
|
58
|
+
}, Fe = (e, t) => {
|
|
58
59
|
if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
|
|
59
|
-
},
|
|
60
|
-
applyUpdate: () =>
|
|
61
|
-
busyReasons: () =>
|
|
62
|
-
onUpdate: () =>
|
|
63
|
-
onUpdateTaken: () =>
|
|
64
|
-
updateReady: () =>
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
for (let e of [...
|
|
60
|
+
}, Ie = /* @__PURE__ */ e({
|
|
61
|
+
applyUpdate: () => He,
|
|
62
|
+
busyReasons: () => Ve,
|
|
63
|
+
onUpdate: () => ze,
|
|
64
|
+
onUpdateTaken: () => Z,
|
|
65
|
+
updateReady: () => Le
|
|
66
|
+
}), Le = async () => typeof window > "u" ? !1 : L.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), q = /* @__PURE__ */ new Set(), J = !1, Re = () => {
|
|
67
|
+
J = !0;
|
|
68
|
+
for (let e of [...q]) try {
|
|
68
69
|
e();
|
|
69
70
|
} catch {}
|
|
70
|
-
},
|
|
71
|
+
}, Y = 0, X = () => {
|
|
71
72
|
let e = z();
|
|
72
|
-
!e ||
|
|
73
|
-
|
|
73
|
+
!e || q.size === 0 || Y === e.epoch || (Y = e.epoch, J = !1, Promise.resolve(e.remote.shell?.onUpdate(Re)).catch(() => {
|
|
74
|
+
Y === e.epoch && (Y = 0);
|
|
74
75
|
}));
|
|
75
76
|
};
|
|
76
|
-
typeof window < "u" && R(
|
|
77
|
-
var
|
|
77
|
+
typeof window < "u" && R(X);
|
|
78
|
+
var ze = async (e) => {
|
|
78
79
|
if (typeof window > "u") return () => {};
|
|
79
|
-
if (
|
|
80
|
+
if (q.add(e), J) try {
|
|
80
81
|
e();
|
|
81
82
|
} catch {}
|
|
82
|
-
return
|
|
83
|
-
|
|
83
|
+
return X(), () => {
|
|
84
|
+
q.delete(e);
|
|
84
85
|
};
|
|
85
|
-
},
|
|
86
|
-
if (!
|
|
86
|
+
}, Z = (e) => typeof window > "u" ? () => {} : Ne(e), Q = 0, $ = !1, Be = () => {
|
|
87
|
+
if (!Pe() && !$) {
|
|
87
88
|
$ = !0;
|
|
88
89
|
try {
|
|
89
90
|
location.reload();
|
|
@@ -94,7 +95,7 @@ typeof window < "u" && R(() => {
|
|
|
94
95
|
let e = z();
|
|
95
96
|
if (!e || Q === e.epoch) return;
|
|
96
97
|
Q = e.epoch;
|
|
97
|
-
let t =
|
|
98
|
+
let t = Fe(e.remote.shell, Be);
|
|
98
99
|
if (!t) {
|
|
99
100
|
Q = 0;
|
|
100
101
|
return;
|
|
@@ -103,6 +104,6 @@ typeof window < "u" && R(() => {
|
|
|
103
104
|
Q === e.epoch && (Q = 0);
|
|
104
105
|
});
|
|
105
106
|
});
|
|
106
|
-
var
|
|
107
|
+
var Ve = () => V(), He = async () => typeof window > "u" ? !1 : L.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
107
108
|
//#endregion
|
|
108
|
-
export { T as ATTACH_FRAME_EVENT_KEY, I as EXTENSION_ABI, n as ExtensionOperationUnsupportedError, d as ExtensionOutdatedError, t as FORGEABLE_HEADERS, D as LOCATOR_DENIED, y as LOCATOR_ERROR, M as LOCATOR_UNSUPPORTED,
|
|
109
|
+
export { T as ATTACH_FRAME_EVENT_KEY, I as EXTENSION_ABI, n as ExtensionOperationUnsupportedError, d as ExtensionOutdatedError, t as FORGEABLE_HEADERS, D as LOCATOR_DENIED, y as LOCATOR_ERROR, M as LOCATOR_UNSUPPORTED, c as REQUIRED_EXTENSION_ABI, Se as account, A as assertAttachableFrameUrl, r as assertFetchableUrl, S as assertForgeableHeaders, _ as assertLockdownApplicable, ne as assertOneCookieIdentity, Oe as attachFrame, x as attachFramePermission, s as box, G as cloud, je as connect, Ce as connectButtonUrl, P as cookies, h as createFrame, ee as createVideoElementHandle, _e as desktop, de as dgram, le as dns, ge as extension, me as fetch, se as fetchCredentialedPermission, a as fetchLocalPermission, i as fetchPermission, ve as fs, E as gotoPermission, f as handleRevivableModules, re as hasForgedCookie, fe as http, ie as isBlockedFetchUrl, w as isBlockedFrameUrl, o as isExtensionExposed, C as isLocalNetworkUrl, b as isLocatorDenied, m as isLocatorUnsupported, v as isTerminalError, O as isType, N as modifyRequestHeadersPermission, ue as net, ye as opfs, be as packages, j as permissions, pe as promptInstall, Me as promptRelay, oe as readCookiePermission, l as readExtensionHandshake, Ae as relayWorker, F as removeRequestHeaderRule, u as revive, xe as rooms, te as setMissingExtensionHandler, g as setRequestHeaderRule, Ie as shell, ce as supportsOperation, p as type, ae as waitForExtensionExposure };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as TcpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
2
|
+
import { P as Resolvers, Q as TcpSocketListenerResult, et as TcpSocketResult } from "./contract-BzdjfQge.js";
|
|
3
|
+
import "./api-CKoF03Me.js";
|
|
4
4
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
5
5
|
import { DuplexOptions, Stream } from "stream";
|
|
6
6
|
import { EventEmitter } from "events";
|
package/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-Cy6QOTK3.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkn/lib",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -110,6 +110,11 @@
|
|
|
110
110
|
"import": "./packages.js",
|
|
111
111
|
"require": "./packages.cjs"
|
|
112
112
|
},
|
|
113
|
+
"./rooms": {
|
|
114
|
+
"types": "./rooms.d.ts",
|
|
115
|
+
"import": "./rooms.js",
|
|
116
|
+
"require": "./rooms.cjs"
|
|
117
|
+
},
|
|
113
118
|
"./react": {
|
|
114
119
|
"types": "./react.d.ts",
|
|
115
120
|
"import": "./react.js",
|
package/packages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as PackageQuery, D as PickOptions, N as Radii, O as Placement,
|
|
1
|
+
import { C as PackageQuery, D as PickOptions, N as Radii, O as Placement, T as PackagesErrorCode, X as SurfaceRect, _ as InstallOptions, l as ConnectOptions, v as InstalledPackage, w as PackageResult } from "./contract-BzdjfQge.js";
|
|
2
2
|
import { Remote } from "osra";
|
|
3
3
|
declare namespace packages_d_exports {
|
|
4
4
|
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Resolvers } from "./contract-
|
|
2
|
-
import "./api-
|
|
1
|
+
import { P as Resolvers } from "./contract-BzdjfQge.js";
|
|
2
|
+
import "./api-CKoF03Me.js";
|
|
3
3
|
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
package/rooms.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-BCJO3EWi.cjs"),n=require("./busy-Dv8wzE5M.cjs");var r=e.t({available:()=>d,create:()=>f,join:()=>p}),i={noSuchRoom:`rooms: no such room`,wrongKey:`rooms: wrong room key`,inviteNoKey:`rooms: the invite carries no key`,noSuchMember:`rooms: no such member`,roomFull:`rooms: the room is full`,tooManyRooms:`rooms: too many rooms`,tooManyConnections:`rooms: too many connections`,tooManyBlocks:`rooms: too many blocks`,blocked:`rooms: you are blocked from this room`,cannotSend:`rooms: you cannot send here`,permissionDenied:`rooms: permission denied`,notOwner:`rooms: not the room owner`,ownerNotRemovable:`rooms: the owner cannot be removed`,ownerKeepsEvery:`rooms: the owner keeps every permission`,removeYourself:`rooms: you cannot remove yourself`,tooFast:`rooms: sending too fast`,tooLarge:`rooms: the message is too large`,unavailable:`rooms: rooms are unavailable`,notEnabled:`rooms: rooms are not available`,alreadyJoined:`rooms: already joined`,malformed:`rooms: malformed frame`,ended:`rooms: the room has ended`},a=(e,t)=>Object.assign(Error(t),{code:e}),o=e=>e instanceof Error&&typeof e.code==`string`,s=async()=>{if(!t.c)return;let e=(await t.o(`a room`).catch(()=>void 0))?.rooms;return typeof e?.create==`function`?e:void 0},c=()=>{throw a(`unavailable`,i.unavailable)},l=e=>e===`blocked`?`blocked`:e===`not-found`?`ended`:`unavailable`,u=async e=>{let r=e.invite,s=e,c=0,u=e.self,d=await e.defaults().catch(()=>({send:!0,receive:!0})),f=!1,p=new Set,m=new Set,h=n.t(`room`),g=()=>{},_=()=>{},v=new Promise(e=>{_=e}),y=e=>{let t=[...m];m.clear();for(let n of t)try{n(e)}catch{}},b=e=>{f||(f=!0,g(),p.clear(),h(),y(a(`closed`,i.ended)),_({reason:e}))},x=e=>{if(!f){e.type===`defaults`&&(d=e.defaults),e.type===`permissions`&&e.id===u.id&&(u={id:u.id,permissions:e.permissions});for(let t of[...p])try{t(e)}catch{}}},S=(e,t)=>{Promise.resolve(e.on(x)).catch(()=>{}),Promise.resolve(e.closed).then(e=>{t===c&&b(e.reason)},()=>{})},C=async(e,t)=>{if(typeof e?.join!=`function`)return b(`unavailable`);let n=await e.join(r).catch(()=>void 0);if(f||t!==c)return;if(!n)return b(`unavailable`);if(`error`in n)return b(l(n.error));if(n.self.id!==u.id)return Promise.resolve(n.leave()).catch(()=>{}),b(`unavailable`);s=n,u=n.self,S(n,t);let i=await n.defaults().catch(()=>void 0);i&&!f&&t===c&&(d=i)};g=t.l((e,t)=>{let n=c;c=t,!(f||n===0||n===t)&&(y(a(`unavailable`,i.unavailable)),C(e.rooms,t))}),S(e,c);let w=async e=>{if(f)throw a(`closed`,i.ended);let t=()=>{},n=new Promise((e,n)=>{t=n});m.add(t);try{return await Promise.race([Promise.resolve(e(s)),n])}catch(e){throw o(e)?e:a(`unavailable`,i.unavailable)}finally{m.delete(t)}},T=async e=>{let t=await w(e);if(`error`in t)throw a(t.error,t.message)};return{id:e.id,key:e.key,invite:r,get self(){return u},owner:e.owner,defaults:()=>d,members:()=>w(e=>e.members()),send:e=>T(t=>t.send(e)),setDefault:(e,t)=>T(n=>n.setDefault(e,t)),grant:(e,t)=>T(n=>n.grant(e,t)),revoke:(e,t)=>T(n=>n.revoke(e,t)),remove:e=>T(t=>t.remove(e)),block:e=>T(t=>t.block(e)),unblock:e=>T(t=>t.unblock(e)),on:async e=>f?()=>{}:(p.add(e),()=>{p.delete(e)}),leave:async()=>{await Promise.resolve(s.leave()).catch(()=>{}),b(`left`)},closed:v}},d=async()=>{let e=await s();return e?e.available().catch(()=>!1):!1},f=async e=>{let t=await s();if(!t)throw a(`unavailable`,i.unavailable);let n=await t.create(e).catch(c);if(`error`in n)throw a(n.error,n.message);return u(n)},p=async(e,t)=>{let n=typeof e==`string`?e.indexOf(`.`):-1;if(n<=0||n===e.length-1)throw a(`invalid`,i.inviteNoKey);let r=await s();if(!r)throw a(`unavailable`,i.unavailable);let o=await r.join(e,t).catch(c);if(`error`in o)throw a(o.error,o.message);return u(o)};exports.available=d,exports.create=f,exports.join=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/rooms.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { B as RoomJoinOptions, F as RoomCreateOptions, G as RoomsErrorCode, H as RoomMessage, I as RoomDefaults, L as RoomEnd, R as RoomEvent, U as RoomPermission, V as RoomMember, W as RoomPermissions } from "./contract-BzdjfQge.js";
|
|
2
|
+
declare namespace rooms_d_exports {
|
|
3
|
+
export { RoomCreateOptions as CreateOptions, RoomJoinOptions as JoinOptions, Room, RoomDefaults, RoomEnd, RoomEvent, RoomMember, RoomMessage, RoomPermission, RoomPermissions, RoomsError, RoomsErrorCode, available, create, join };
|
|
4
|
+
}
|
|
5
|
+
/** Thrown by every member of this namespace. Match on `code`, never on the message. */
|
|
6
|
+
type RoomsError = Error & {
|
|
7
|
+
code: RoomsErrorCode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A joined room. The same object survives a broker replacement, so it is safe to hold for as long
|
|
11
|
+
* as the chat lasts.
|
|
12
|
+
*/
|
|
13
|
+
type Room = {
|
|
14
|
+
/** the room's uuid */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/** the room key, base64url. The server never sees it. Anyone holding it and the id can join. */
|
|
17
|
+
readonly key: string;
|
|
18
|
+
/** `id` and `key` as one string, the thing to put in a link */
|
|
19
|
+
readonly invite: string;
|
|
20
|
+
/** this app's member record, as this room sees it. The id is fresh in every room. */
|
|
21
|
+
readonly self: RoomMember;
|
|
22
|
+
readonly owner: string;
|
|
23
|
+
defaults: () => RoomDefaults;
|
|
24
|
+
members: () => Promise<RoomMember[]>;
|
|
25
|
+
/** at most 4,096 bytes of UTF-8, sealed before it leaves the browser. Rejects `too-large`, never truncates. */
|
|
26
|
+
send: (text: string) => Promise<void>;
|
|
27
|
+
setDefault: (permission: 'send' | 'receive', value: boolean) => Promise<void>;
|
|
28
|
+
grant: (id: string, permission: RoomPermission) => Promise<void>;
|
|
29
|
+
revoke: (id: string, permission: RoomPermission) => Promise<void>;
|
|
30
|
+
remove: (id: string) => Promise<void>;
|
|
31
|
+
block: (id: string) => Promise<void>;
|
|
32
|
+
unblock: (id: string) => Promise<void>;
|
|
33
|
+
/** Await the returned unsubscribe in cleanup, the `account.onChange` shape. */
|
|
34
|
+
on: (listener: (event: RoomEvent) => void) => Promise<() => void>;
|
|
35
|
+
leave: () => Promise<void>;
|
|
36
|
+
/** Settles once, when the room ends for this app. Never rejects. */
|
|
37
|
+
readonly closed: Promise<RoomEnd>;
|
|
38
|
+
};
|
|
39
|
+
/** Whether this realm can join a room: false in Node, false in a worker nothing bridged, false against a shell older than rooms. Answers rather than rejecting. */
|
|
40
|
+
declare const available: () => Promise<boolean>;
|
|
41
|
+
/** Open a room and become its owner. Share `room.invite` to let anyone else in. */
|
|
42
|
+
declare const create: (options?: RoomCreateOptions) => Promise<Room>;
|
|
43
|
+
/** `invite` is `room.invite`, or an id and a key joined by a dot. */
|
|
44
|
+
declare const join: (invite: string, options?: RoomJoinOptions) => Promise<Room>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { type RoomCreateOptions as CreateOptions, type RoomJoinOptions as JoinOptions, Room, type RoomDefaults, type RoomEnd, type RoomEvent, type RoomMember, type RoomMessage, type RoomPermission, type RoomPermissions, RoomsError, type RoomsErrorCode, available, create, join, rooms_d_exports as t };
|
package/rooms.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { c as t, l as n, o as r } from "./api-DLvscoll.js";
|
|
3
|
+
import { t as i } from "./busy-B189uX--.js";
|
|
4
|
+
//#region src/rooms.ts
|
|
5
|
+
var a = /* @__PURE__ */ e({
|
|
6
|
+
available: () => p,
|
|
7
|
+
create: () => m,
|
|
8
|
+
join: () => h
|
|
9
|
+
}), o = {
|
|
10
|
+
noSuchRoom: "rooms: no such room",
|
|
11
|
+
wrongKey: "rooms: wrong room key",
|
|
12
|
+
inviteNoKey: "rooms: the invite carries no key",
|
|
13
|
+
noSuchMember: "rooms: no such member",
|
|
14
|
+
roomFull: "rooms: the room is full",
|
|
15
|
+
tooManyRooms: "rooms: too many rooms",
|
|
16
|
+
tooManyConnections: "rooms: too many connections",
|
|
17
|
+
tooManyBlocks: "rooms: too many blocks",
|
|
18
|
+
blocked: "rooms: you are blocked from this room",
|
|
19
|
+
cannotSend: "rooms: you cannot send here",
|
|
20
|
+
permissionDenied: "rooms: permission denied",
|
|
21
|
+
notOwner: "rooms: not the room owner",
|
|
22
|
+
ownerNotRemovable: "rooms: the owner cannot be removed",
|
|
23
|
+
ownerKeepsEvery: "rooms: the owner keeps every permission",
|
|
24
|
+
removeYourself: "rooms: you cannot remove yourself",
|
|
25
|
+
tooFast: "rooms: sending too fast",
|
|
26
|
+
tooLarge: "rooms: the message is too large",
|
|
27
|
+
unavailable: "rooms: rooms are unavailable",
|
|
28
|
+
notEnabled: "rooms: rooms are not available",
|
|
29
|
+
alreadyJoined: "rooms: already joined",
|
|
30
|
+
malformed: "rooms: malformed frame",
|
|
31
|
+
ended: "rooms: the room has ended"
|
|
32
|
+
}, s = (e, t) => Object.assign(Error(t), { code: e }), c = (e) => e instanceof Error && typeof e.code == "string", l = async () => {
|
|
33
|
+
if (!t) return;
|
|
34
|
+
let e = (await r("a room").catch(() => void 0))?.rooms;
|
|
35
|
+
return typeof e?.create == "function" ? e : void 0;
|
|
36
|
+
}, u = () => {
|
|
37
|
+
throw s("unavailable", o.unavailable);
|
|
38
|
+
}, d = (e) => e === "blocked" ? "blocked" : e === "not-found" ? "ended" : "unavailable", f = async (e) => {
|
|
39
|
+
let t = e.invite, r = e, a = 0, l = e.self, u = await e.defaults().catch(() => ({
|
|
40
|
+
send: !0,
|
|
41
|
+
receive: !0
|
|
42
|
+
})), f = !1, p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), h = i("room"), g = () => {}, _ = () => {}, v = new Promise((e) => {
|
|
43
|
+
_ = e;
|
|
44
|
+
}), y = (e) => {
|
|
45
|
+
let t = [...m];
|
|
46
|
+
m.clear();
|
|
47
|
+
for (let n of t) try {
|
|
48
|
+
n(e);
|
|
49
|
+
} catch {}
|
|
50
|
+
}, b = (e) => {
|
|
51
|
+
f || (f = !0, g(), p.clear(), h(), y(s("closed", o.ended)), _({ reason: e }));
|
|
52
|
+
}, x = (e) => {
|
|
53
|
+
if (!f) {
|
|
54
|
+
e.type === "defaults" && (u = e.defaults), e.type === "permissions" && e.id === l.id && (l = {
|
|
55
|
+
id: l.id,
|
|
56
|
+
permissions: e.permissions
|
|
57
|
+
});
|
|
58
|
+
for (let t of [...p]) try {
|
|
59
|
+
t(e);
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
62
|
+
}, S = (e, t) => {
|
|
63
|
+
Promise.resolve(e.on(x)).catch(() => {}), Promise.resolve(e.closed).then((e) => {
|
|
64
|
+
t === a && b(e.reason);
|
|
65
|
+
}, () => {});
|
|
66
|
+
}, C = async (e, n) => {
|
|
67
|
+
if (typeof e?.join != "function") return b("unavailable");
|
|
68
|
+
let i = await e.join(t).catch(() => void 0);
|
|
69
|
+
if (f || n !== a) return;
|
|
70
|
+
if (!i) return b("unavailable");
|
|
71
|
+
if ("error" in i) return b(d(i.error));
|
|
72
|
+
if (i.self.id !== l.id) return Promise.resolve(i.leave()).catch(() => {}), b("unavailable");
|
|
73
|
+
r = i, l = i.self, S(i, n);
|
|
74
|
+
let o = await i.defaults().catch(() => void 0);
|
|
75
|
+
o && !f && n === a && (u = o);
|
|
76
|
+
};
|
|
77
|
+
g = n((e, t) => {
|
|
78
|
+
let n = a;
|
|
79
|
+
a = t, !(f || n === 0 || n === t) && (y(s("unavailable", o.unavailable)), C(e.rooms, t));
|
|
80
|
+
}), S(e, a);
|
|
81
|
+
let w = async (e) => {
|
|
82
|
+
if (f) throw s("closed", o.ended);
|
|
83
|
+
let t = () => {}, n = new Promise((e, n) => {
|
|
84
|
+
t = n;
|
|
85
|
+
});
|
|
86
|
+
m.add(t);
|
|
87
|
+
try {
|
|
88
|
+
return await Promise.race([Promise.resolve(e(r)), n]);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
throw c(e) ? e : s("unavailable", o.unavailable);
|
|
91
|
+
} finally {
|
|
92
|
+
m.delete(t);
|
|
93
|
+
}
|
|
94
|
+
}, T = async (e) => {
|
|
95
|
+
let t = await w(e);
|
|
96
|
+
if ("error" in t) throw s(t.error, t.message);
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
id: e.id,
|
|
100
|
+
key: e.key,
|
|
101
|
+
invite: t,
|
|
102
|
+
get self() {
|
|
103
|
+
return l;
|
|
104
|
+
},
|
|
105
|
+
owner: e.owner,
|
|
106
|
+
defaults: () => u,
|
|
107
|
+
members: () => w((e) => e.members()),
|
|
108
|
+
send: (e) => T((t) => t.send(e)),
|
|
109
|
+
setDefault: (e, t) => T((n) => n.setDefault(e, t)),
|
|
110
|
+
grant: (e, t) => T((n) => n.grant(e, t)),
|
|
111
|
+
revoke: (e, t) => T((n) => n.revoke(e, t)),
|
|
112
|
+
remove: (e) => T((t) => t.remove(e)),
|
|
113
|
+
block: (e) => T((t) => t.block(e)),
|
|
114
|
+
unblock: (e) => T((t) => t.unblock(e)),
|
|
115
|
+
on: async (e) => f ? () => {} : (p.add(e), () => {
|
|
116
|
+
p.delete(e);
|
|
117
|
+
}),
|
|
118
|
+
leave: async () => {
|
|
119
|
+
await Promise.resolve(r.leave()).catch(() => {}), b("left");
|
|
120
|
+
},
|
|
121
|
+
closed: v
|
|
122
|
+
};
|
|
123
|
+
}, p = async () => {
|
|
124
|
+
let e = await l();
|
|
125
|
+
return e ? e.available().catch(() => !1) : !1;
|
|
126
|
+
}, m = async (e) => {
|
|
127
|
+
let t = await l();
|
|
128
|
+
if (!t) throw s("unavailable", o.unavailable);
|
|
129
|
+
let n = await t.create(e).catch(u);
|
|
130
|
+
if ("error" in n) throw s(n.error, n.message);
|
|
131
|
+
return f(n);
|
|
132
|
+
}, h = async (e, t) => {
|
|
133
|
+
let n = typeof e == "string" ? e.indexOf(".") : -1;
|
|
134
|
+
if (n <= 0 || n === e.length - 1) throw s("invalid", o.inviteNoKey);
|
|
135
|
+
let r = await l();
|
|
136
|
+
if (!r) throw s("unavailable", o.unavailable);
|
|
137
|
+
let i = await r.join(e, t).catch(u);
|
|
138
|
+
if ("error" in i) throw s(i.error, i.message);
|
|
139
|
+
return f(i);
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
export { p as available, m as create, h as join, a as t };
|