@fkn/lib 0.6.0 → 0.6.2
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.d.ts +15 -0
- package/api-B0jZnr_N.d.ts +554 -0
- package/cloud/dgram.d.ts +2 -0
- package/cloud/dns.d.ts +3 -0
- package/cloud/fs/promises.d.ts +9 -0
- package/cloud/fs.d.ts +3 -0
- package/cloud/http.d.ts +2 -0
- package/cloud/net.d.ts +2 -0
- package/cloud-B4KIFGwa.cjs +1 -0
- package/{cloud-BFyf2uC7.js → cloud-Dsb33tl6.js} +29 -15
- package/cloud-jJi2d0cs.d.ts +41 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +7 -0
- package/cloud.js +1 -1
- package/connect-button-D8KXSL6s.d.ts +4 -0
- package/desktop.d.ts +52 -0
- package/dgram.d.ts +91 -0
- package/dns.d.ts +12 -0
- package/extension-3pxUYwrA.d.ts +16 -0
- package/extension.d.ts +3 -0
- package/fs/promises.d.ts +12 -0
- package/fs-K7ROdxDx.d.ts +41 -0
- package/fs.d.ts +92 -0
- package/http.d.ts +186 -0
- package/index-BJztAQIP.d.ts +721 -0
- package/index-C6ZoDJg8.d.ts +31 -0
- package/index.cjs +1 -1
- package/index.d.ts +28 -0
- package/index.js +1 -1
- package/lookup-BtwWaCZJ.d.ts +7 -0
- package/net-5SVFcuzM.d.ts +140 -0
- package/net.d.ts +2 -0
- package/opfs/promises.d.ts +12 -0
- package/opfs.d.ts +90 -0
- package/package.json +23 -23
- package/packages-D36R2vBv.d.ts +108 -0
- package/packages.d.ts +2 -0
- package/react.d.ts +14 -0
- package/api/account.d.ts +0 -7
- package/api/broker-bridge.d.ts +0 -12
- package/api/connect-store.d.ts +0 -9
- package/api/connect.d.ts +0 -2
- package/api/data-plane.d.ts +0 -28
- package/api/dns/index.d.ts +0 -1
- package/api/dns/lookup.d.ts +0 -8
- package/api/index.d.ts +0 -78
- package/api/install-prompt.d.ts +0 -2
- package/api/local-net/index.d.ts +0 -43
- package/api/overlay-mount.d.ts +0 -2
- package/api/overlay.d.ts +0 -17
- package/api/packages/host.d.ts +0 -12
- package/api/packages/identity.d.ts +0 -1
- package/api/packages/index.d.ts +0 -34
- package/api/packages/picker.d.ts +0 -28
- package/api/packages/registry.d.ts +0 -20
- package/api/packages/store.d.ts +0 -6
- package/api/packages/types.d.ts +0 -56
- package/api/preconnect.d.ts +0 -1
- package/api/proxy/index.d.ts +0 -1
- package/api/proxy/proxy-fetch.d.ts +0 -5
- package/api/quota.d.ts +0 -10
- package/api/rate-token.d.ts +0 -3
- package/api/session-limit.d.ts +0 -1
- package/api/storage.d.ts +0 -20
- package/api/toast.d.ts +0 -1
- package/api/token-source.d.ts +0 -4
- package/api/ui-events.d.ts +0 -8
- package/api/ui-host.d.ts +0 -2
- package/api/webvpn/index.d.ts +0 -3
- package/api/webvpn/packets/metadata.d.ts +0 -31
- package/api/webvpn/packets/tcp-listener.d.ts +0 -39
- package/api/webvpn/packets/tcp.d.ts +0 -88
- package/api/webvpn/packets/udp.d.ts +0 -183
- package/api/webvpn/packets/utils.d.ts +0 -24
- package/api/webvpn/tcp-listener.d.ts +0 -11
- package/api/webvpn/tcp.d.ts +0 -33
- package/api/webvpn/udp.d.ts +0 -33
- package/api/webvpn/utils.d.ts +0 -26
- package/api/webvpn/webtransport.d.ts +0 -62
- package/api/worker/client.d.ts +0 -3
- package/api/worker/protocol.d.ts +0 -15
- package/cloud-5o7yJHeX.cjs +0 -1
- package/lib/account.d.ts +0 -14
- package/lib/api.d.ts +0 -300
- package/lib/auto.d.ts +0 -5
- package/lib/cloud/dgram.d.ts +0 -2
- package/lib/cloud/dns.d.ts +0 -1
- package/lib/cloud/frame.d.ts +0 -3
- package/lib/cloud/fs-promises.d.ts +0 -5
- package/lib/cloud/fs.d.ts +0 -22
- package/lib/cloud/http.d.ts +0 -2
- package/lib/cloud/net.d.ts +0 -2
- package/lib/cloud.d.ts +0 -10
- package/lib/connect-button.d.ts +0 -1
- package/lib/connect.d.ts +0 -1
- package/lib/desktop.d.ts +0 -47
- package/lib/dns.d.ts +0 -6
- package/lib/dom.d.ts +0 -2
- package/lib/extension-prompt.d.ts +0 -1
- package/lib/extension.d.ts +0 -4
- package/lib/fkn-target.d.ts +0 -1
- package/lib/frame.d.ts +0 -2
- package/lib/fs/content-type.d.ts +0 -1
- package/lib/fs/hybrid.d.ts +0 -10
- package/lib/fs/index.d.ts +0 -87
- package/lib/fs/opfs.d.ts +0 -8
- package/lib/fs/promises.d.ts +0 -8
- package/lib/fs/types.d.ts +0 -16
- package/lib/index.d.ts +0 -18
- package/lib/node-fs/index.d.ts +0 -95
- package/lib/node-fs/shared.d.ts +0 -39
- package/lib/node-fs/store.d.ts +0 -21
- package/lib/opfs/index.d.ts +0 -84
- package/lib/opfs/promises.d.ts +0 -8
- package/lib/overlay.d.ts +0 -14
- package/lib/packages.d.ts +0 -69
- package/lib/proxy.d.ts +0 -5
- package/lib/quota.d.ts +0 -20
- package/lib/react.d.ts +0 -7
- package/lib/relay.d.ts +0 -5
- package/lib/storage.d.ts +0 -22
- package/lib/webvpn/dgram.d.ts +0 -86
- package/lib/webvpn/http.d.ts +0 -180
- package/lib/webvpn/index.d.ts +0 -1
- package/lib/webvpn/net.d.ts +0 -132
- package/lib/webvpn/utils.d.ts +0 -32
- package/sandbox.d.ts +0 -7
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Buffer as Buffer$1 } from "buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/node-fs/shared.d.ts
|
|
4
|
+
type ReadOptions = BufferEncoding | {
|
|
5
|
+
encoding?: BufferEncoding | null;
|
|
6
|
+
flag?: string;
|
|
7
|
+
} | null | undefined;
|
|
8
|
+
type WriteOptions = BufferEncoding | {
|
|
9
|
+
encoding?: BufferEncoding | null;
|
|
10
|
+
mode?: number;
|
|
11
|
+
flag?: string;
|
|
12
|
+
contentType?: string;
|
|
13
|
+
} | null | undefined;
|
|
14
|
+
type WriteData = string | Uint8Array | ArrayBuffer | DataView;
|
|
15
|
+
type MakeOptions = {
|
|
16
|
+
recursive?: boolean;
|
|
17
|
+
} | number | null | undefined;
|
|
18
|
+
type Callback<R> = (error: NodeJS.ErrnoException | null, result?: R) => void;
|
|
19
|
+
type Stats = {
|
|
20
|
+
size: number;
|
|
21
|
+
mtimeMs: number;
|
|
22
|
+
mtime: Date;
|
|
23
|
+
atimeMs: number;
|
|
24
|
+
ctimeMs: number;
|
|
25
|
+
mode: number;
|
|
26
|
+
isFile: () => boolean;
|
|
27
|
+
isDirectory: () => boolean;
|
|
28
|
+
isSymbolicLink: () => boolean;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { WriteData as a, Stats as i, MakeOptions as n, WriteOptions as o, ReadOptions as r, Callback as t };
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-bPaU3-Cz.cjs"),t=require("./api-DD5v1qP9.cjs"),n=require("./cloud-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-bPaU3-Cz.cjs"),t=require("./api-DD5v1qP9.cjs"),n=require("./cloud-B4KIFGwa.cjs"),r=require("./dns.cjs"),i=require("./net-CpuAhaQC.cjs"),a=require("./dgram-CE43gJq9.cjs"),o=require("./http.cjs"),s=require("./extension-D-NUXxzF.cjs"),c=require("./desktop.cjs"),l=require("./fs-BfmfMBiw.cjs"),u=require("./opfs.cjs"),d=require("./packages.cjs"),f=require("./account.cjs"),p=require("./connect-button-BBEjXzB3.cjs");let m=require("osra");var h=t=>s.r()||t.syncCookies!==!1?e.a(t):n.i(t),g=`https://fkn.app`,_=(e,n)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);if(!t.r?.contentWindow)throw Error(`FKN @fkn/lib: relayWorker called before the FKN iframe was injected`);(0,m.relay)({receive:window,emit:t.r.contentWindow},e,{key:`fkn-api`,originA:n?.originA??g,originB:n?.originB??`*`,unregisterSignal:n?.unregisterSignal})},v=async()=>typeof window>`u`?!1:(await t.t).connect.prompt(location.origin).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=e.i,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return f.t}}),exports.assertAttachableFrameUrl=e.l,exports.assertFetchableUrl=e.E,exports.assertLockdownApplicable=e.u,exports.attachFrame=h,exports.attachFramePermission=e.o,exports.box=e.R,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return n.n}}),exports.connect=v,exports.connectButtonUrl=p.t,exports.cookies=e.w,exports.createFrame=e.s,exports.createVideoElementHandle=e.z,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.i}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return r.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return s.t}}),exports.fetch=s.n,exports.fetchCredentialedPermission=e.O,exports.fetchLocalPermission=e.k,exports.fetchPermission=e.A,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return l.c}}),exports.gotoPermission=e.c,exports.handleRevivableModules=e.L,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.t}}),exports.isBlockedFetchUrl=e.j,exports.isBlockedFrameUrl=e.d,exports.isExtensionExposed=e.P,exports.isLocalNetworkUrl=e.M,exports.isType=e.B,exports.modifyRequestHeadersPermission=e.x,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.s}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return d.t}}),exports.permissions=e.r,exports.promptInstall=s.i,exports.readCookiePermission=e.T,exports.relayWorker=_,exports.removeRequestHeaderRule=e.S,exports.revive=e.V,exports.setMissingExtensionHandler=e.F,exports.setRequestHeaderRule=e.C,exports.type=e.H,exports.waitForExtensionExposure=e.I;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { t as account_d_exports } from "./account.js";
|
|
2
|
+
import { p as packages_d_exports } from "./packages-D36R2vBv.js";
|
|
3
|
+
import { n as cloud_d_exports } from "./cloud-jJi2d0cs.js";
|
|
4
|
+
import { A as RequestHeaderRule, B as assertFetchableUrl, C as attachFramePermission, D as assertLockdownApplicable, E as assertAttachableFrameUrl, F as SiteCookie, G as isBlockedFetchUrl, H as fetchCredentialedPermission, I as cookies, K as isLocalNetworkUrl, L as readCookiePermission, M as removeRequestHeaderRule, N as setRequestHeaderRule, O as isBlockedFrameUrl, P as CookieDetails, R as FetchInit, S as GotoOptions, T as gotoPermission, U as fetchLocalPermission, W as fetchPermission, _ as ATTACH_FRAME_EVENT_KEY, a as handleRevivableModules, b as Frame, c as VideoElementState, d as isType, f as revive, g as permissions, h as PermissionRequest, i as waitForExtensionExposure, j as modifyRequestHeadersPermission, k as HeaderOperation, l as box, m as PermissionGrant, n as isExtensionExposed, o as BoxedVideoElement, p as type, r as setMissingExtensionHandler, s as RemoteVideoElement, u as createVideoElementHandle, w as createFrame, x as FrameBackend, y as AttachFrameOptions, z as ProxyFetchRequest } from "./index-BJztAQIP.js";
|
|
5
|
+
import { t as dns_d_exports } from "./dns.js";
|
|
6
|
+
import { s as net_d_exports } from "./net-5SVFcuzM.js";
|
|
7
|
+
import { t as dgram_d_exports } from "./dgram.js";
|
|
8
|
+
import { t as http_d_exports } from "./http.js";
|
|
9
|
+
import { t as desktop_d_exports } from "./desktop.js";
|
|
10
|
+
import { i as promptInstall, n as fetch, t as extension_d_exports } from "./extension-3pxUYwrA.js";
|
|
11
|
+
import { t as index_d_exports } from "./fs.js";
|
|
12
|
+
import { t as index_d_exports$1 } from "./opfs.js";
|
|
13
|
+
import { t as connectButtonUrl } from "./connect-button-D8KXSL6s.js";
|
|
14
|
+
|
|
15
|
+
//#region src/lib/frame.d.ts
|
|
16
|
+
declare const attachFrame: (options: AttachFrameOptions) => Promise<Frame>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/lib/relay.d.ts
|
|
19
|
+
declare const relayWorker: (worker: Worker, options?: {
|
|
20
|
+
unregisterSignal?: AbortSignal;
|
|
21
|
+
originA?: string;
|
|
22
|
+
originB?: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/lib/connect.d.ts
|
|
26
|
+
declare const connect: () => Promise<boolean>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, FetchInit, Frame, FrameBackend, GotoOptions, HeaderOperation, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SiteCookie, VideoElementState, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertLockdownApplicable, 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, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as e, B as t, C as n, E as r, F as i, H as a, I as o, L as s, M as c, O as l, P as u, R as d, S as f, T as p, V as m, a as h, c as g, d as _, i as v, j as y, k as b, l as x, o as S, r as C, s as w, u as T, w as E, x as D, z as O } from "./proxy-C8SG1Beo.js";
|
|
2
2
|
import { r as k, t as A } from "./api--bnCFd4w.js";
|
|
3
|
-
import { i as j, n as M } from "./cloud-
|
|
3
|
+
import { i as j, n as M } from "./cloud-Dsb33tl6.js";
|
|
4
4
|
import { t as N } from "./dns.js";
|
|
5
5
|
import { s as P } from "./net-DKMWPXb_.js";
|
|
6
6
|
import { i as F } from "./dgram-wtjARbt0.js";
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { i as TcpSocketOption, r as LocalTcpSocket, t as Resolvers } from "./api-B0jZnr_N.js";
|
|
2
|
+
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
3
|
+
import { DuplexOptions, Stream } from "stream";
|
|
4
|
+
import { EventEmitter } from "events";
|
|
5
|
+
import { BindOptions } from "dgram";
|
|
6
|
+
|
|
7
|
+
//#region src/lib/webvpn/utils.d.ts
|
|
8
|
+
declare const isIPv4: (input: string) => boolean;
|
|
9
|
+
declare const isIPv6: (input: string) => boolean;
|
|
10
|
+
declare const isIP: (input: string) => 0 | 4 | 6;
|
|
11
|
+
declare namespace net_d_exports {
|
|
12
|
+
export { Server$1 as Server, Socket$2 as Socket, _default, connect, createConnection, createServer, _default as default, isIP, isIPv4, isIPv6 };
|
|
13
|
+
}
|
|
14
|
+
type WebVpnTcpSocket = Resolvers['cloud']['webvpn']['tcpSocket'];
|
|
15
|
+
type WebVpnTcpSocketListener = Resolvers['cloud']['webvpn']['tcpSocketListener'];
|
|
16
|
+
declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
17
|
+
_localAddress?: {
|
|
18
|
+
address: string;
|
|
19
|
+
family: string;
|
|
20
|
+
port: number;
|
|
21
|
+
};
|
|
22
|
+
_remoteAddress?: {
|
|
23
|
+
address: string;
|
|
24
|
+
family: string;
|
|
25
|
+
port: number;
|
|
26
|
+
};
|
|
27
|
+
_webVPNTcpSocketPromise?: Promise<(Awaited<ReturnType<WebVpnTcpSocket>> & {
|
|
28
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
29
|
+
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
30
|
+
}) | undefined>;
|
|
31
|
+
constructor(options?: SocketConstructorOpts & DuplexOptions & {
|
|
32
|
+
connection?: ReturnType<WebVpnTcpSocket>;
|
|
33
|
+
});
|
|
34
|
+
__webvpn_tcp_socket_init__(connection: ReturnType<WebVpnTcpSocket>): Promise<(LocalTcpSocket & {
|
|
35
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
36
|
+
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
37
|
+
}) | undefined>;
|
|
38
|
+
/** STREAM IMPL */
|
|
39
|
+
_read(size: number): void;
|
|
40
|
+
_write(chunk: Uint8Array, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
41
|
+
/** SOCKET IMPL */
|
|
42
|
+
connect(options: SocketConnectOpts, connectionListener?: (() => void) | undefined): this;
|
|
43
|
+
connect(port: number, host: string, connectionListener?: (() => void) | undefined): this;
|
|
44
|
+
connect(port: number, connectionListener?: (() => void) | undefined): this;
|
|
45
|
+
connect(path: string, connectionListener?: (() => void) | undefined): this;
|
|
46
|
+
connect(port: unknown, host?: unknown, connectionListener?: unknown): this;
|
|
47
|
+
_end(chunk: any, cb?: () => void): this;
|
|
48
|
+
_end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
|
|
49
|
+
_destroy(error?: Error | null | undefined): this;
|
|
50
|
+
destroySoon(): void;
|
|
51
|
+
resetAndDestroy(): this;
|
|
52
|
+
_timeoutMs?: number;
|
|
53
|
+
_timeoutTimer?: ReturnType<typeof setTimeout>;
|
|
54
|
+
_restartTimeoutTimer(): void;
|
|
55
|
+
setTimeout(timeout: number, callback?: (() => void) | undefined): this;
|
|
56
|
+
setNoDelay(noDelay?: boolean | undefined): this;
|
|
57
|
+
setKeepAlive(enable?: boolean | undefined, initialDelay?: number | undefined): this;
|
|
58
|
+
setSendBufferSize(size: number): this;
|
|
59
|
+
setRecvBufferSize(size: number): this;
|
|
60
|
+
_typeOfService?: number;
|
|
61
|
+
getTypeOfService(): number;
|
|
62
|
+
setTypeOfService(tos: number): this;
|
|
63
|
+
_setTcpOption(option: TcpSocketOption): void;
|
|
64
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
65
|
+
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
|
|
66
|
+
address(): AddressInfo | {};
|
|
67
|
+
unref(): this;
|
|
68
|
+
ref(): this;
|
|
69
|
+
autoSelectFamilyAttemptedAddresses: string[];
|
|
70
|
+
bufferSize: number;
|
|
71
|
+
bytesRead: number;
|
|
72
|
+
bytesWritten: number;
|
|
73
|
+
connecting: boolean;
|
|
74
|
+
pending: boolean;
|
|
75
|
+
get localAddress(): string;
|
|
76
|
+
get localPort(): number;
|
|
77
|
+
get localFamily(): string;
|
|
78
|
+
readyState: 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
|
|
79
|
+
get remoteAddress(): string;
|
|
80
|
+
get remotePort(): number;
|
|
81
|
+
get remoteFamily(): string;
|
|
82
|
+
timeout?: number | undefined;
|
|
83
|
+
}
|
|
84
|
+
interface EventEmitterOptions {
|
|
85
|
+
/**
|
|
86
|
+
* Enables automatic capturing of promise rejection.
|
|
87
|
+
*/
|
|
88
|
+
captureRejections?: boolean | undefined;
|
|
89
|
+
}
|
|
90
|
+
declare class Server$1 extends EventEmitter implements Server {
|
|
91
|
+
_localAddress?: {
|
|
92
|
+
address: string;
|
|
93
|
+
family: string;
|
|
94
|
+
port: number;
|
|
95
|
+
};
|
|
96
|
+
_webVPNTcpSocketListenerPromise?: Promise<Awaited<ReturnType<WebVpnTcpSocketListener>> | undefined>;
|
|
97
|
+
constructor(options?: ServerOpts & EventEmitterOptions & {
|
|
98
|
+
connection?: ReturnType<WebVpnTcpSocketListener>;
|
|
99
|
+
}, connectionListener?: (socket: Socket$2) => void);
|
|
100
|
+
__webvpn_tcp_socket_listener_init__(connection: ReturnType<WebVpnTcpSocketListener>): Promise<{
|
|
101
|
+
localAddress: string;
|
|
102
|
+
localFamily: "IPv4" | "IPv6";
|
|
103
|
+
localPort: number;
|
|
104
|
+
close: () => Promise<void>;
|
|
105
|
+
} | undefined>;
|
|
106
|
+
listen(port?: number | undefined, hostname?: string | undefined, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
107
|
+
listen(port?: number | undefined, hostname?: string | undefined, listeningListener?: (() => void) | undefined): this;
|
|
108
|
+
listen(port?: number | undefined, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
109
|
+
listen(port?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
110
|
+
listen(path: string, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
111
|
+
listen(path: string, listeningListener?: (() => void) | undefined): this;
|
|
112
|
+
listen(options: ListenOptions, listeningListener?: (() => void) | undefined): this;
|
|
113
|
+
listen(handle: any, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
114
|
+
listen(handle: any, listeningListener?: (() => void) | undefined): this;
|
|
115
|
+
listen(port?: unknown, hostname?: unknown, backlog?: unknown, listeningListener?: unknown): this;
|
|
116
|
+
close(callback?: ((err?: Error | undefined) => void) | undefined): this;
|
|
117
|
+
address(): string | AddressInfo | null;
|
|
118
|
+
getConnections(cb: (error: Error | null, count: number) => void): this;
|
|
119
|
+
ref(): this;
|
|
120
|
+
unref(): this;
|
|
121
|
+
maxConnections: number;
|
|
122
|
+
connections: number;
|
|
123
|
+
listening: boolean;
|
|
124
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
declare const connect: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
127
|
+
declare const createConnection: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
128
|
+
declare const createServer: (options?: ServerOpts | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
129
|
+
declare const _default: {
|
|
130
|
+
Socket: typeof Socket$2;
|
|
131
|
+
Server: typeof Server$1;
|
|
132
|
+
connect: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
133
|
+
createConnection: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
134
|
+
createServer: (options?: ServerOpts | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
135
|
+
isIP: (input: string) => 0 | 4 | 6;
|
|
136
|
+
isIPv4: (input: string) => boolean;
|
|
137
|
+
isIPv6: (input: string) => boolean;
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { createConnection as a, isIP as c, connect as i, isIPv4 as l, Socket$2 as n, createServer as o, _default as r, net_d_exports as s, Server$1 as t, isIPv6 as u };
|
package/net.d.ts
ADDED
|
@@ -0,0 +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-5SVFcuzM.js";
|
|
2
|
+
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../index-C6ZoDJg8.js";
|
|
2
|
+
import { promises } from "../opfs.js";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/opfs/promises.d.ts
|
|
5
|
+
declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
|
|
6
|
+
recursive?: boolean;
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}) => Promise<void>, rmdir: (path: import("node:fs").PathLike, options?: {
|
|
9
|
+
recursive?: boolean;
|
|
10
|
+
}) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { access, appendFile, promises as default, lstat, mkdir, readFile, readdir, rename, rm, rmdir, stat, unlink, writeFile };
|
package/opfs.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-C6ZoDJg8.js";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/opfs/index.d.ts
|
|
4
|
+
declare namespace index_d_exports {
|
|
5
|
+
export { Stats, appendFile, appendFileSync, available, fs as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, promises, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
|
|
6
|
+
}
|
|
7
|
+
declare const fs: {
|
|
8
|
+
available: () => Promise<boolean>;
|
|
9
|
+
readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string;
|
|
10
|
+
writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
|
|
11
|
+
appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
|
|
12
|
+
existsSync: (path: import("node:fs").PathLike) => boolean;
|
|
13
|
+
statSync: (path: import("node:fs").PathLike) => Stats;
|
|
14
|
+
lstatSync: (path: import("node:fs").PathLike) => Stats;
|
|
15
|
+
readdirSync: (path: import("node:fs").PathLike) => string[];
|
|
16
|
+
mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void;
|
|
17
|
+
rmSync: (path: import("node:fs").PathLike, options?: {
|
|
18
|
+
recursive?: boolean;
|
|
19
|
+
force?: boolean;
|
|
20
|
+
}) => void;
|
|
21
|
+
rmdirSync: (path: import("node:fs").PathLike, options?: {
|
|
22
|
+
recursive?: boolean;
|
|
23
|
+
}) => void;
|
|
24
|
+
unlinkSync: (path: import("node:fs").PathLike) => void;
|
|
25
|
+
renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void;
|
|
26
|
+
readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void;
|
|
27
|
+
writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
|
|
28
|
+
appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
|
|
29
|
+
stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void;
|
|
30
|
+
readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void;
|
|
31
|
+
mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void;
|
|
32
|
+
rm: (path: import("node:fs").PathLike, a: {
|
|
33
|
+
recursive?: boolean;
|
|
34
|
+
force?: boolean;
|
|
35
|
+
} | Callback<void>, b?: Callback<void>) => void;
|
|
36
|
+
unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void;
|
|
37
|
+
rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void;
|
|
38
|
+
exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void;
|
|
39
|
+
promises: {
|
|
40
|
+
readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
|
|
41
|
+
writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
|
|
42
|
+
appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
|
|
43
|
+
stat: (path: import("node:fs").PathLike) => Promise<Stats>;
|
|
44
|
+
lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
|
|
45
|
+
readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
|
|
46
|
+
mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
|
|
47
|
+
rm: (path: import("node:fs").PathLike, options?: {
|
|
48
|
+
recursive?: boolean;
|
|
49
|
+
force?: boolean;
|
|
50
|
+
}) => Promise<void>;
|
|
51
|
+
rmdir: (path: import("node:fs").PathLike, options?: {
|
|
52
|
+
recursive?: boolean;
|
|
53
|
+
}) => Promise<void>;
|
|
54
|
+
unlink: (path: import("node:fs").PathLike) => Promise<void>;
|
|
55
|
+
rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
|
|
56
|
+
access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
mount: () => Promise<void>;
|
|
59
|
+
flush: () => Promise<void>;
|
|
60
|
+
remount: () => Promise<void>;
|
|
61
|
+
};
|
|
62
|
+
declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
|
|
63
|
+
recursive?: boolean;
|
|
64
|
+
force?: boolean;
|
|
65
|
+
}) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
|
|
66
|
+
recursive?: boolean;
|
|
67
|
+
}) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
|
|
68
|
+
recursive?: boolean;
|
|
69
|
+
force?: boolean;
|
|
70
|
+
} | Callback<void>, b?: Callback<void>) => void, unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void, exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void, promises: {
|
|
71
|
+
readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
|
|
72
|
+
writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
|
|
73
|
+
appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
|
|
74
|
+
stat: (path: import("node:fs").PathLike) => Promise<Stats>;
|
|
75
|
+
lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
|
|
76
|
+
readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
|
|
77
|
+
mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
|
|
78
|
+
rm: (path: import("node:fs").PathLike, options?: {
|
|
79
|
+
recursive?: boolean;
|
|
80
|
+
force?: boolean;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
rmdir: (path: import("node:fs").PathLike, options?: {
|
|
83
|
+
recursive?: boolean;
|
|
84
|
+
}) => Promise<void>;
|
|
85
|
+
unlink: (path: import("node:fs").PathLike) => Promise<void>;
|
|
86
|
+
rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
|
|
87
|
+
access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
88
|
+
}, mount: () => Promise<void>, flush: () => Promise<void>, remount: () => Promise<void>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { type Stats, appendFile, appendFileSync, available, fs as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, promises, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, rm, rmSync, rmdirSync, stat, statSync, index_d_exports as t, unlink, unlinkSync, writeFile, writeFileSync };
|
package/package.json
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkn/lib",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"main": "index.js",
|
|
5
|
-
"types": "
|
|
5
|
+
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
10
|
"import": "./index.js",
|
|
11
11
|
"require": "./index.cjs"
|
|
12
12
|
},
|
|
13
13
|
"./fs": {
|
|
14
|
-
"types": "./
|
|
14
|
+
"types": "./fs.d.ts",
|
|
15
15
|
"import": "./fs.js",
|
|
16
16
|
"require": "./fs.cjs"
|
|
17
17
|
},
|
|
18
18
|
"./fs/promises": {
|
|
19
|
-
"types": "./
|
|
19
|
+
"types": "./fs/promises.d.ts",
|
|
20
20
|
"import": "./fs/promises.js",
|
|
21
21
|
"require": "./fs/promises.cjs"
|
|
22
22
|
},
|
|
23
23
|
"./opfs": {
|
|
24
|
-
"types": "./
|
|
24
|
+
"types": "./opfs.d.ts",
|
|
25
25
|
"import": "./opfs.js",
|
|
26
26
|
"require": "./opfs.cjs"
|
|
27
27
|
},
|
|
28
28
|
"./opfs/promises": {
|
|
29
|
-
"types": "./
|
|
29
|
+
"types": "./opfs/promises.d.ts",
|
|
30
30
|
"import": "./opfs/promises.js",
|
|
31
31
|
"require": "./opfs/promises.cjs"
|
|
32
32
|
},
|
|
33
33
|
"./cloud": {
|
|
34
|
-
"types": "./
|
|
34
|
+
"types": "./cloud.d.ts",
|
|
35
35
|
"import": "./cloud.js",
|
|
36
36
|
"require": "./cloud.cjs"
|
|
37
37
|
},
|
|
38
38
|
"./cloud/fs": {
|
|
39
|
-
"types": "./
|
|
39
|
+
"types": "./cloud/fs.d.ts",
|
|
40
40
|
"import": "./cloud/fs.js",
|
|
41
41
|
"require": "./cloud/fs.cjs"
|
|
42
42
|
},
|
|
43
43
|
"./cloud/fs/promises": {
|
|
44
|
-
"types": "./
|
|
44
|
+
"types": "./cloud/fs/promises.d.ts",
|
|
45
45
|
"import": "./cloud/fs/promises.js",
|
|
46
46
|
"require": "./cloud/fs/promises.cjs"
|
|
47
47
|
},
|
|
48
48
|
"./cloud/net": {
|
|
49
|
-
"types": "./
|
|
49
|
+
"types": "./cloud/net.d.ts",
|
|
50
50
|
"import": "./cloud/net.js",
|
|
51
51
|
"require": "./cloud/net.cjs"
|
|
52
52
|
},
|
|
53
53
|
"./cloud/dgram": {
|
|
54
|
-
"types": "./
|
|
54
|
+
"types": "./cloud/dgram.d.ts",
|
|
55
55
|
"import": "./cloud/dgram.js",
|
|
56
56
|
"require": "./cloud/dgram.cjs"
|
|
57
57
|
},
|
|
58
58
|
"./cloud/http": {
|
|
59
|
-
"types": "./
|
|
59
|
+
"types": "./cloud/http.d.ts",
|
|
60
60
|
"import": "./cloud/http.js",
|
|
61
61
|
"require": "./cloud/http.cjs"
|
|
62
62
|
},
|
|
63
63
|
"./cloud/dns": {
|
|
64
|
-
"types": "./
|
|
64
|
+
"types": "./cloud/dns.d.ts",
|
|
65
65
|
"import": "./cloud/dns.js",
|
|
66
66
|
"require": "./cloud/dns.cjs"
|
|
67
67
|
},
|
|
68
68
|
"./net": {
|
|
69
|
-
"types": "./
|
|
69
|
+
"types": "./net.d.ts",
|
|
70
70
|
"import": "./net.js",
|
|
71
71
|
"require": "./net.cjs"
|
|
72
72
|
},
|
|
73
73
|
"./dgram": {
|
|
74
|
-
"types": "./
|
|
74
|
+
"types": "./dgram.d.ts",
|
|
75
75
|
"import": "./dgram.js",
|
|
76
76
|
"require": "./dgram.cjs"
|
|
77
77
|
},
|
|
78
78
|
"./http": {
|
|
79
|
-
"types": "./
|
|
79
|
+
"types": "./http.d.ts",
|
|
80
80
|
"import": "./http.js",
|
|
81
81
|
"require": "./http.cjs"
|
|
82
82
|
},
|
|
83
83
|
"./dns": {
|
|
84
|
-
"types": "./
|
|
84
|
+
"types": "./dns.d.ts",
|
|
85
85
|
"import": "./dns.js",
|
|
86
86
|
"require": "./dns.cjs"
|
|
87
87
|
},
|
|
88
88
|
"./extension": {
|
|
89
|
-
"types": "./
|
|
89
|
+
"types": "./extension.d.ts",
|
|
90
90
|
"import": "./extension.js",
|
|
91
91
|
"require": "./extension.cjs"
|
|
92
92
|
},
|
|
93
93
|
"./desktop": {
|
|
94
|
-
"types": "./
|
|
94
|
+
"types": "./desktop.d.ts",
|
|
95
95
|
"import": "./desktop.js",
|
|
96
96
|
"require": "./desktop.cjs"
|
|
97
97
|
},
|
|
98
98
|
"./account": {
|
|
99
|
-
"types": "./
|
|
99
|
+
"types": "./account.d.ts",
|
|
100
100
|
"import": "./account.js",
|
|
101
101
|
"require": "./account.cjs"
|
|
102
102
|
},
|
|
103
103
|
"./packages": {
|
|
104
|
-
"types": "./
|
|
104
|
+
"types": "./packages.d.ts",
|
|
105
105
|
"import": "./packages.js",
|
|
106
106
|
"require": "./packages.cjs"
|
|
107
107
|
},
|
|
108
108
|
"./react": {
|
|
109
|
-
"types": "./
|
|
109
|
+
"types": "./react.d.ts",
|
|
110
110
|
"import": "./react.js",
|
|
111
111
|
"require": "./react.cjs"
|
|
112
112
|
},
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Remote } from "osra";
|
|
2
|
+
|
|
3
|
+
//#region src/api/packages/types.d.ts
|
|
4
|
+
type PackageQuery = {
|
|
5
|
+
/** package kind, e.g. 'plugin' - becomes the keyword `fkn-type:<type>` */type: string; /** host app scope, e.g. 'stub' - becomes the keyword `fkn-<type>--<id>` */
|
|
6
|
+
id?: string; /** package source; npm is the only origin implemented */
|
|
7
|
+
origin?: 'npm'; /** free text mixed into the registry query */
|
|
8
|
+
text?: string; /** result count, clamped to 1..100 */
|
|
9
|
+
size?: number;
|
|
10
|
+
};
|
|
11
|
+
type PackageResult = {
|
|
12
|
+
/** canonical version-free uri, e.g. 'npm:@banou/stub-plugin-foo' */uri: string;
|
|
13
|
+
origin: 'npm';
|
|
14
|
+
name: string; /** latest version per the search index - display only, install re-resolves from the packument */
|
|
15
|
+
version: string;
|
|
16
|
+
description: string;
|
|
17
|
+
keywords: string[];
|
|
18
|
+
publisher: string | null;
|
|
19
|
+
downloadsMonthly: number | null;
|
|
20
|
+
links: {
|
|
21
|
+
npm?: string;
|
|
22
|
+
homepage?: string;
|
|
23
|
+
repository?: string;
|
|
24
|
+
}; /** installed by the calling app */
|
|
25
|
+
installed: boolean;
|
|
26
|
+
};
|
|
27
|
+
type InstalledPackage = {
|
|
28
|
+
uri: string;
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
installedAt: number;
|
|
32
|
+
};
|
|
33
|
+
type PickOptions = {
|
|
34
|
+
/** untrusted, rendered as text in the picker header */title?: string;
|
|
35
|
+
multiple?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type InstallOptions = {
|
|
38
|
+
/** exact version to pin; defaults to the packument's latest dist-tag */version?: string;
|
|
39
|
+
};
|
|
40
|
+
type ConnectOptions = {
|
|
41
|
+
/** opaque contract tag delivered to the package's onConnect, e.g. 'stub-source@1' */protocol?: string;
|
|
42
|
+
};
|
|
43
|
+
type PackagesErrorCode = 'invalid' | 'not-installed' | 'unaddressable' | 'timeout' | 'unavailable' | 'denied';
|
|
44
|
+
type PackagesFail = {
|
|
45
|
+
error: PackagesErrorCode;
|
|
46
|
+
message: string;
|
|
47
|
+
};
|
|
48
|
+
declare namespace packages_d_exports {
|
|
49
|
+
export { AppConnectOptions, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, PackageConnection, PackageQuery, PackageResult, PackagesError, PackagesErrorCode, PickOptions, RawPackageConnection, attach, connect, install, list, onConnect, pick, search, uninstall };
|
|
50
|
+
}
|
|
51
|
+
type PackagesError = Error & {
|
|
52
|
+
code: PackagesErrorCode;
|
|
53
|
+
};
|
|
54
|
+
/** Search npm for FKN packages, e.g. `search({ type: 'plugin', id: 'stub' })`. */
|
|
55
|
+
declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
56
|
+
/** FKN-rendered picker over the same search; resolves the user's selection, already installed. [] on cancel. */
|
|
57
|
+
declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
58
|
+
/** Install a package for this app behind an FKN-rendered confirm. Resolves null when the user declines. */
|
|
59
|
+
declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
60
|
+
/** The packages installed by this app. */
|
|
61
|
+
declare const list: () => Promise<InstalledPackage[]>;
|
|
62
|
+
/** Uninstall a package from this app; its frames and connections are torn down. */
|
|
63
|
+
declare const uninstall: (uri: string) => Promise<void>;
|
|
64
|
+
type PackageConnection<T = unknown> = {
|
|
65
|
+
/** the package's exposed payload */remote: Remote<T>; /** settles when the package side of the connection dies (uninstall, reload, crash) - reconnect by calling connect() again */
|
|
66
|
+
closed: Promise<void>; /** the raw channel under `remote`, for direct messaging (osra envelopes ride it too - filter by your own message shape) */
|
|
67
|
+
port: MessagePort;
|
|
68
|
+
};
|
|
69
|
+
type AppConnectOptions = ConnectOptions & {
|
|
70
|
+
/** exposed to the package as ITS `remote` */payload?: unknown;
|
|
71
|
+
signal?: AbortSignal; /** skip the osra handshake and hand back the untouched port - e.g. to transfer it into a worker and attach() there */
|
|
72
|
+
raw?: boolean;
|
|
73
|
+
};
|
|
74
|
+
type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
75
|
+
type Connect = {
|
|
76
|
+
<T = unknown>(uri: string, options?: AppConnectOptions & {
|
|
77
|
+
raw?: false;
|
|
78
|
+
}): Promise<PackageConnection<T>>;
|
|
79
|
+
(uri: string, options: AppConnectOptions & {
|
|
80
|
+
raw: true;
|
|
81
|
+
}): Promise<RawPackageConnection>;
|
|
82
|
+
};
|
|
83
|
+
/** Connect to an installed package. Throws a PackagesError with code 'not-installed' when it is not. */
|
|
84
|
+
declare const connect: Connect;
|
|
85
|
+
/** Run this end of an already-brokered connection port, e.g. after transferring it into a worker. */
|
|
86
|
+
declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
87
|
+
signal?: AbortSignal;
|
|
88
|
+
}) => Promise<Remote<T>>;
|
|
89
|
+
type IncomingConnectionInfo = {
|
|
90
|
+
/** the connecting app's identity: its package uri when it runs on a sandbox origin, else its page origin */from: string; /** the contract tag the app passed to connect(), e.g. 'stub-source@1' */
|
|
91
|
+
protocol: string | null; /** this package's canonical uri per the connecting app's install record, e.g. 'npm:@banou/stub-source-example' */
|
|
92
|
+
uri: string; /** this package's npm name */
|
|
93
|
+
name: string; /** the exact version this frame runs - the pin is encoded into the sandbox origin, immutable per version */
|
|
94
|
+
version: string;
|
|
95
|
+
};
|
|
96
|
+
type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
97
|
+
/** produces the payload exposed to a connecting app - called once per incoming connection */
|
|
98
|
+
type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
99
|
+
/**
|
|
100
|
+
* Serve connections from apps that installed this package. The first argument is called once per
|
|
101
|
+
* incoming connection with the connection info and returns the payload exposed to that app (its
|
|
102
|
+
* `remote`). The latest registration receives new connections; existing connections are unaffected.
|
|
103
|
+
*/
|
|
104
|
+
declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
105
|
+
unsubscribe: () => void;
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { PackagesFail as C, PackagesErrorCode as S, ConnectOptions as _, PackageConnection as a, PackageQuery as b, attach as c, list as d, onConnect as f, uninstall as g, search as h, IncomingConnectionInfo as i, connect as l, pick as m, ConnectPayload as n, PackagesError as o, packages_d_exports as p, IncomingConnection as r, RawPackageConnection as s, AppConnectOptions as t, install as u, InstallOptions as v, PickOptions as w, PackageResult as x, InstalledPackage as y };
|
package/packages.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { S as PackagesErrorCode, _ as ConnectOptions, a as PackageConnection, b as PackageQuery, c as attach, d as list, f as onConnect, g as uninstall, h as search, i as IncomingConnectionInfo, l as connect, m as pick, n as ConnectPayload, o as PackagesError, r as IncomingConnection, s as RawPackageConnection, t as AppConnectOptions, u as install, v as InstallOptions, w as PickOptions, x as PackageResult, y as InstalledPackage } from "./packages-D36R2vBv.js";
|
|
2
|
+
export { AppConnectOptions, type ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, type InstallOptions, type InstalledPackage, PackageConnection, type PackageQuery, type PackageResult, PackagesError, type PackagesErrorCode, type PickOptions, RawPackageConnection, attach, connect, install, list, onConnect, pick, search, uninstall };
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as connectButtonUrl } from "./connect-button-D8KXSL6s.js";
|
|
2
|
+
import { CSSProperties, ReactElement } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/react.d.ts
|
|
5
|
+
type ConnectButtonProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
declare const ConnectButton: ({
|
|
10
|
+
className,
|
|
11
|
+
style
|
|
12
|
+
}?: ConnectButtonProps) => ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ConnectButton, ConnectButtonProps, connectButtonUrl };
|
package/api/account.d.ts
DELETED
package/api/broker-bridge.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Remote } from 'osra';
|
|
2
|
-
export type RemoteBrokerResolvers = {
|
|
3
|
-
ui: {
|
|
4
|
-
installPrompt: {
|
|
5
|
-
show: (reason?: string) => Promise<void>;
|
|
6
|
-
hide: () => void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export declare const bindInstallPromptPresenter: (show: (reason?: string) => Promise<void>, hide: () => void) => void;
|
|
11
|
-
export declare const initRemoteBrokerHost: () => void;
|
|
12
|
-
export declare const getRemoteBroker: () => Promise<Remote<RemoteBrokerResolvers> | null>;
|