@fkn/lib 0.9.23 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account.cjs +1 -1
- package/account.d.ts +7 -3
- package/account.js +7 -7
- package/api-BCJO3EWi.cjs +3 -0
- package/api-CesI0aMl.d.ts +677 -0
- package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
- package/api.cjs +1 -0
- package/api.d.ts +3 -0
- package/api.js +2 -0
- package/attach-policy.cjs +1 -0
- package/attach-policy.d.ts +35 -0
- package/attach-policy.js +43 -0
- package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.d.ts +7 -6
- package/cloud/fs/promises.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/fs.js +10 -9
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/cloud-B2ZG-0MF.cjs +1 -0
- package/cloud-B7pI3pp1.d.ts +37 -0
- package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +4 -4
- package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
- package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
- package/contract-D6ksmIm6.d.ts +394 -0
- package/contract.cjs +0 -0
- package/contract.d.ts +3 -0
- package/contract.js +0 -0
- package/desktop.js +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +6 -47
- package/dgram.js +406 -2
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -3
- package/dns.js +2 -2
- package/extension-CJUeVRXf.d.ts +361 -0
- package/extension-DBazc3ff.cjs +1 -0
- package/extension-Dw9gzvei.js +84 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +8 -9
- package/fs/promises.js +2 -2
- package/fs-DYP7utdw.cjs +1 -0
- package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
- package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.cjs +3 -3
- package/http.d.ts +4 -6
- package/http.js +8 -8
- package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
- package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
- package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
- package/index.cjs +1 -1
- package/index.d.ts +12 -13
- package/index.js +60 -49
- package/lib-DLM2M3_i.cjs +53 -0
- package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
- package/messages-DvpKMTsY.d.ts +28 -0
- package/messages.cjs +1 -0
- package/messages.d.ts +2 -0
- package/messages.js +4 -0
- package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +318 -3
- package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
- package/opfs/promises.d.ts +7 -8
- package/opfs/promises.js +1 -1
- package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
- package/opfs.d.ts +24 -26
- package/opfs.js +3 -3
- package/package.json +27 -2
- package/packages.cjs +1 -1
- package/packages.d.ts +143 -2
- package/packages.js +15 -15
- package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
- package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
- package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
- package/react.d.ts +3 -7
- package/react.js +2 -2
- package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
- package/storage-DLB4ciMf.cjs +1 -0
- package/utils-BvgGdrgN.cjs +1 -0
- package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
- package/wire-Gbo-D74t.d.ts +91 -0
- package/wire.cjs +1 -0
- package/wire.d.ts +2 -0
- package/wire.js +4 -0
- package/api-BGYSJVvR.d.ts +0 -789
- package/api-C-TpWHAU.cjs +0 -3
- package/cloud-BqjwL5KM.cjs +0 -1
- package/cloud-DMTkzfcf.d.ts +0 -36
- package/dgram-BLN-mfgq.cjs +0 -1
- package/dgram-DHQcHefn.js +0 -405
- package/extension-B8Y0sUwC.js +0 -78
- package/extension-CMPZjuaV.d.ts +0 -16
- package/extension-CgSGjcSl.cjs +0 -1
- package/fs-BNnozBMU.cjs +0 -1
- package/lib-DbiVHPXE.cjs +0 -53
- package/lookup-BtwWaCZJ.d.ts +0 -7
- package/net-B6RHtWwe.cjs +0 -1
- package/net-yBkobZqK.js +0 -317
- package/packages-Cn8S-Hkn.d.ts +0 -217
- package/storage-qxXFLgTM.d.ts +0 -44
- package/storage-xAeRQQiz.cjs +0 -1
- package/utils-QfNXtEhb.cjs +0 -1
package/packages-Cn8S-Hkn.d.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { Remote } from "osra";
|
|
2
|
-
|
|
3
|
-
//#region src/api/packages/identity.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* A connection's identity. `id` is the normalized package uri when the other end runs on a sandbox
|
|
6
|
-
* tenant origin (e.g. 'npm:@banou/stub'), otherwise its plain page origin. Version-pinned tenant
|
|
7
|
-
* origins normalize to the version-free id, so a package keeps one identity (and one set of install
|
|
8
|
-
* records) across its own updates, for every handler rather than only for npm.
|
|
9
|
-
*/
|
|
10
|
-
type Caller = {
|
|
11
|
-
id: string;
|
|
12
|
-
origin: string; /** a package's display name, when provenance knew it. Attribution only, never an identity. */
|
|
13
|
-
name?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Set when PROVENANCE established this caller is a package, which is the only way to know it for a
|
|
16
|
-
* connection whose `origin` is this realm's own (a broker nested inside a tenant we mounted). Every
|
|
17
|
-
* other package caller is recognised from its browser-set tenant origin instead.
|
|
18
|
-
*/
|
|
19
|
-
isPackage?: boolean;
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/api/packages/types.d.ts
|
|
23
|
-
type PackageQuery = {
|
|
24
|
-
/** 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>` */
|
|
25
|
-
id?: string; /** package source; npm is the only origin implemented */
|
|
26
|
-
origin?: 'npm'; /** free text mixed into the registry query */
|
|
27
|
-
text?: string; /** result count, clamped to 1..100 */
|
|
28
|
-
size?: number;
|
|
29
|
-
};
|
|
30
|
-
type PackageResult = {
|
|
31
|
-
/** normalized version-free uri, e.g. 'npm:@banou/stub-plugin-foo' */uri: string;
|
|
32
|
-
origin: 'npm';
|
|
33
|
-
name: string; /** latest version per the search index - display only, install re-resolves from the packument */
|
|
34
|
-
version: string;
|
|
35
|
-
description: string;
|
|
36
|
-
keywords: string[];
|
|
37
|
-
publisher: string | null;
|
|
38
|
-
downloadsMonthly: number | null;
|
|
39
|
-
links: {
|
|
40
|
-
npm?: string;
|
|
41
|
-
homepage?: string;
|
|
42
|
-
repository?: string;
|
|
43
|
-
}; /** installed by the calling app */
|
|
44
|
-
installed: boolean;
|
|
45
|
-
};
|
|
46
|
-
type InstalledPackage = {
|
|
47
|
-
uri: string;
|
|
48
|
-
name: string; /** null when the handler addresses code directly and has no version to pin, e.g. a dev server */
|
|
49
|
-
version: string | null;
|
|
50
|
-
installedAt: number;
|
|
51
|
-
};
|
|
52
|
-
type PickOptions = {
|
|
53
|
-
/** untrusted, rendered as text in the picker header */title?: string;
|
|
54
|
-
multiple?: boolean;
|
|
55
|
-
};
|
|
56
|
-
type InstallOptions = {
|
|
57
|
-
/** exact version to pin; defaults to the packument's latest dist-tag */version?: string; /** skip the confirm prompt and report the install with a notice instead; the record stays scoped to the calling app */
|
|
58
|
-
noConfirm?: boolean;
|
|
59
|
-
};
|
|
60
|
-
type ConnectOptions = {
|
|
61
|
-
/** opaque contract tag delivered to the package's onConnect, e.g. 'stub-source@1' */protocol?: string;
|
|
62
|
-
};
|
|
63
|
-
/** viewport coordinates, the space both the app and the broker frame measure in */
|
|
64
|
-
type SurfaceRect = {
|
|
65
|
-
x: number;
|
|
66
|
-
y: number;
|
|
67
|
-
width: number;
|
|
68
|
-
height: number;
|
|
69
|
-
};
|
|
70
|
-
/** corner radii in css order: top-left, top-right, bottom-right, bottom-left */
|
|
71
|
-
type Radii = [number, number, number, number];
|
|
72
|
-
type Placement = {
|
|
73
|
-
/** where the package frame sits, so its own layout gets the full box */rect: SurfaceRect; /** the part of `rect` still visible after the placeholder's scroll ancestors clip it */
|
|
74
|
-
clip?: SurfaceRect; /** the placeholder's corner radii, so the frame follows a rounded container */
|
|
75
|
-
radius?: Radii;
|
|
76
|
-
};
|
|
77
|
-
type PackagesErrorCode = 'invalid' | 'not-installed' | 'unaddressable' | 'timeout' | 'unavailable' | 'denied';
|
|
78
|
-
type PackagesFail = {
|
|
79
|
-
error: PackagesErrorCode;
|
|
80
|
-
message: string;
|
|
81
|
-
};
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/api/packages/host.d.ts
|
|
84
|
-
type MountDescriptor = {
|
|
85
|
-
/** where to point the iframe: the tenant origin plus the package's path */url: string; /** the tenant origin alone, which is what a `postMessage` to that frame must target */
|
|
86
|
-
origin: string; /** the version-free identity, echoed to the package in the port message */
|
|
87
|
-
uri: string;
|
|
88
|
-
name: string;
|
|
89
|
-
version: string | null; /** the connecting app, as the BROKER knows it */
|
|
90
|
-
from: string;
|
|
91
|
-
};
|
|
92
|
-
declare namespace packages_d_exports {
|
|
93
|
-
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 };
|
|
94
|
-
}
|
|
95
|
-
type PackagesError = Error & {
|
|
96
|
-
code: PackagesErrorCode;
|
|
97
|
-
};
|
|
98
|
-
/** Search npm for FKN packages, e.g. `search({ type: 'plugin', id: 'stub' })`. */
|
|
99
|
-
declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
100
|
-
/** FKN-rendered picker over the same search; resolves the user's selection, already installed. [] on cancel. */
|
|
101
|
-
declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
102
|
-
/** Install a package for this app behind an FKN-rendered confirm, or with `{ noConfirm: true }` for a notice instead of a prompt. Resolves null when the user declines. */
|
|
103
|
-
declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
104
|
-
/** The packages installed by this app. */
|
|
105
|
-
declare const list: () => Promise<InstalledPackage[]>;
|
|
106
|
-
/** Uninstall a package from this app; its frames and connections are torn down. */
|
|
107
|
-
declare const uninstall: (uri: string) => Promise<void>;
|
|
108
|
-
type ShowOptions = {
|
|
109
|
-
/**
|
|
110
|
-
* A placeholder the package frame is aligned to for as long as the view lives. The frame tracks its
|
|
111
|
-
* rect every animation frame, is clipped by its scrolling ancestors, and follows its border-radius,
|
|
112
|
-
* so it reads as inline content even though it renders in FKN's overlay.
|
|
113
|
-
*/
|
|
114
|
-
element?: HTMLElement; /** an explicit viewport rect, for a caller that tracks placement itself */
|
|
115
|
-
rect?: SurfaceRect;
|
|
116
|
-
};
|
|
117
|
-
type PackageView = {
|
|
118
|
-
/** release this view; equivalent to `packages.hide(uri, { element })` */hide: () => void; /** force a re-measure, e.g. right after a layout change the tracker cannot observe */
|
|
119
|
-
refresh: () => void;
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Show an installed, connected package's frame over this page, aligned to `element` (or an explicit
|
|
123
|
-
* `rect`). The package renders its own UI there; the app keeps the space in its own layout. Take it
|
|
124
|
-
* back down with `hide()` on the returned view, or with `packages.hide(uri)`. Throws a PackagesError
|
|
125
|
-
* with code 'not-installed' when the package has not been connected by this app.
|
|
126
|
-
*/
|
|
127
|
-
declare const show: (uri: string, options: ShowOptions) => Promise<PackageView>;
|
|
128
|
-
/**
|
|
129
|
-
* Hide a package's frame again, the counterpart to `show()`. Pass the same `element` to release only
|
|
130
|
-
* the view bound to it; with no element every view of this package is released. The connection is
|
|
131
|
-
* untouched, so the package can be shown again.
|
|
132
|
-
*/
|
|
133
|
-
declare const hide: (uri: string, options?: ShowOptions) => Promise<void>;
|
|
134
|
-
type PackageConnection<T = unknown> = {
|
|
135
|
-
/** 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 */
|
|
136
|
-
closed: Promise<void>; /** the raw channel under `remote`, for direct messaging (osra envelopes ride it too - filter by your own message shape) */
|
|
137
|
-
port: MessagePort;
|
|
138
|
-
};
|
|
139
|
-
type AppConnectOptions = ConnectOptions & {
|
|
140
|
-
/** exposed to the package as ITS `remote` */payload?: unknown;
|
|
141
|
-
signal?: AbortSignal; /** skip the osra handshake and hand back the untouched port - e.g. to transfer it into a worker and attach() there */
|
|
142
|
-
raw?: boolean;
|
|
143
|
-
};
|
|
144
|
-
type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
145
|
-
type Connect = {
|
|
146
|
-
<T = unknown>(uri: string, options?: AppConnectOptions & {
|
|
147
|
-
raw?: false;
|
|
148
|
-
}): Promise<PackageConnection<T>>;
|
|
149
|
-
(uri: string, options: AppConnectOptions & {
|
|
150
|
-
raw: true;
|
|
151
|
-
}): Promise<RawPackageConnection>;
|
|
152
|
-
};
|
|
153
|
-
/** Connect to an installed package. Throws a PackagesError with code 'not-installed' when it is not. */
|
|
154
|
-
declare const connect: Connect;
|
|
155
|
-
type MountOptions = AppConnectOptions & {
|
|
156
|
-
/**
|
|
157
|
-
* the iframe the package is loaded into. YOU create it and YOU own it: its attributes, its styles and
|
|
158
|
-
* its place in your layout are yours, and `mount` only navigates it.
|
|
159
|
-
*
|
|
160
|
-
* Set `allow` yourself for anything the package needs delegated, e.g. `allow="fullscreen; autoplay"`.
|
|
161
|
-
* Permissions policy is not inherited, so a capability this frame is not granted cannot be recovered
|
|
162
|
-
* by the package or by anything it nests inside itself.
|
|
163
|
-
*/
|
|
164
|
-
iframe: HTMLIFrameElement;
|
|
165
|
-
};
|
|
166
|
-
type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
167
|
-
/** the iframe you passed in, unchanged apart from its `src` */frame: HTMLIFrameElement; /** blank the frame and settle `closed`; the element stays in your layout because it is yours */
|
|
168
|
-
unmount: () => void;
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* Load a package into an iframe of YOUR OWN and connect to it, instead of positioning a frame the broker
|
|
172
|
-
* owns and clipping the overlay to it the way `show()` does.
|
|
173
|
-
*
|
|
174
|
-
* You pass the iframe, the same way `cloud.attachFrame` takes one. It lays out, scrolls, stacks and
|
|
175
|
-
* fullscreens with the rest of your page, there is no geometry to translate, and every attribute on it
|
|
176
|
-
* stays exactly as you set it: `mount` reads `sandbox` and `allow` to check the package can boot, then
|
|
177
|
-
* writes nothing but `src`. The package still gets its own origin and its own broker connection.
|
|
178
|
-
*
|
|
179
|
-
* Grant capabilities through the iframe's own `allow`, before calling this. Permissions policy is read
|
|
180
|
-
* at navigation and is not inherited, so it cannot be added afterwards on the frame handed back.
|
|
181
|
-
*
|
|
182
|
-
* Needs a package built against this version of the lib: an older one only accepts a port from fkn.app.
|
|
183
|
-
*/
|
|
184
|
-
declare const mount: <T = unknown>(uri: string, options: MountOptions) => Promise<MountedPackage<T>>;
|
|
185
|
-
/** Run this end of an already-brokered connection port, e.g. after transferring it into a worker. */
|
|
186
|
-
declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
187
|
-
signal?: AbortSignal;
|
|
188
|
-
}) => Promise<Remote<T>>;
|
|
189
|
-
type IncomingConnectionInfo = {
|
|
190
|
-
/** 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' */
|
|
191
|
-
protocol: string | null; /** this package's normalized uri per the connecting app's install record, e.g. 'npm:@banou/stub-source-example' */
|
|
192
|
-
uri: string; /** this package's npm name */
|
|
193
|
-
name: string; /** the exact version this frame runs - the pin is encoded into the sandbox origin, immutable per version */
|
|
194
|
-
version: string;
|
|
195
|
-
};
|
|
196
|
-
type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
197
|
-
/** produces the payload exposed to a connecting app - called once per incoming connection */
|
|
198
|
-
type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
199
|
-
/**
|
|
200
|
-
* Serve connections from apps that installed this package. The first argument is called once per
|
|
201
|
-
* incoming connection with the connection info and returns the payload exposed to that app (its
|
|
202
|
-
* `remote`). The latest registration receives new connections; existing connections are unaffected.
|
|
203
|
-
*/
|
|
204
|
-
declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
205
|
-
unsubscribe: () => void;
|
|
206
|
-
};
|
|
207
|
-
/** True while a host app is showing this package's frame. Packages start hidden. */
|
|
208
|
-
declare const isVisible: () => boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Observe whether a host app is showing this package's frame, so it can render its UI only while on
|
|
211
|
-
* screen. The handler is called immediately with the current state, and on every change after.
|
|
212
|
-
*/
|
|
213
|
-
declare const onVisibilityChange: (handler: (visible: boolean) => void) => {
|
|
214
|
-
unsubscribe: () => void;
|
|
215
|
-
};
|
|
216
|
-
//#endregion
|
|
217
|
-
export { InstalledPackage as A, pick as C, MountDescriptor as D, uninstall as E, PickOptions as F, Placement as I, Radii as L, PackageResult as M, PackagesErrorCode as N, ConnectOptions as O, PackagesFail as P, SurfaceRect as R, packages_d_exports as S, show as T, isVisible as _, IncomingConnectionInfo as a, onConnect as b, PackageConnection as c, RawPackageConnection as d, ShowOptions as f, install as g, hide as h, IncomingConnection as i, PackageQuery as j, InstallOptions as k, PackageView as l, connect as m, Connect as n, MountOptions as o, attach as p, ConnectPayload as r, MountedPackage as s, AppConnectOptions as t, PackagesError as u, list as v, search as w, onVisibilityChange as x, mount as y, Caller as z };
|
package/storage-qxXFLgTM.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//#region src/api/storage.d.ts
|
|
2
|
-
type StorageEntry = {
|
|
3
|
-
path: string;
|
|
4
|
-
size: number;
|
|
5
|
-
contentType: string | null;
|
|
6
|
-
updatedAt: string;
|
|
7
|
-
encryption: string | null;
|
|
8
|
-
};
|
|
9
|
-
type StorageQuota = {
|
|
10
|
-
usedBytes: number;
|
|
11
|
-
limitBytes: number;
|
|
12
|
-
remaining: number;
|
|
13
|
-
objects: number;
|
|
14
|
-
maxObjects: number;
|
|
15
|
-
};
|
|
16
|
-
type WriteData = ArrayBuffer | Uint8Array | string;
|
|
17
|
-
type StorageReadResult = {
|
|
18
|
-
bytes: Uint8Array;
|
|
19
|
-
encryption: string | null;
|
|
20
|
-
appOrigin: string;
|
|
21
|
-
};
|
|
22
|
-
type KeyState = {
|
|
23
|
-
keyEpoch: number | null;
|
|
24
|
-
keyFingerprint: string | null;
|
|
25
|
-
storageEncrypted: boolean;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* "There is no object at this path", as a thing a caller can TEST rather than parse.
|
|
29
|
-
*
|
|
30
|
-
* osra's error boxer ships name, message, stack and cause ONLY, so this code survives same-realm
|
|
31
|
-
* hops but NOT the SharedWorker boundary; the message fallback in src/lib/storage.ts's rethrow is
|
|
32
|
-
* what carries absence across that hop and re-mints the coded error for apps. The message does not
|
|
33
|
-
* survive being reworded, which is the problem this exists to end: absence arrives in two
|
|
34
|
-
* completely different sentences depending on which half of the read failed, and every consumer
|
|
35
|
-
* was left regex-matching both. Ripple got one of them and missed the other, and a library quietly
|
|
36
|
-
* went un-backed-up for a day because a missing backup read as a transient error.
|
|
37
|
-
*/
|
|
38
|
-
declare const STORAGE_NOT_FOUND = "FKN_STORAGE_NOT_FOUND";
|
|
39
|
-
type SealedGeneration = {
|
|
40
|
-
epoch: number;
|
|
41
|
-
fingerprint: string;
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { StorageQuota as a, StorageEntry as i, STORAGE_NOT_FOUND as n, StorageReadResult as o, SealedGeneration as r, WriteData as s, KeyState as t };
|
package/storage-xAeRQQiz.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-C-TpWHAU.cjs");var n=`FKN_STORAGE_NOT_FOUND`,r=e.t({StorageLockedError:()=>i,StorageNotFoundError:()=>a,availability:()=>p,available:()=>c,encryption:()=>y,isNotFound:()=>o,list:()=>m,quota:()=>h,readFile:()=>g,remove:()=>v,unlock:()=>b,writeFile:()=>_}),i=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: this account stores encrypted data, unlock it from the FKN card or unlock()`)}},a=class extends Error{code=n;constructor(e=`storage: no object at that path`){super(e)}},o=e=>e?.code===n,s=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new i:o(e)||e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new a(e.message):e},c=()=>t.t.then(e=>e.cloud.fs.available()).catch(()=>!1),l=8e3,u=1e3,d=!1,f=async()=>{let e=(await t.t).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},p=async()=>{let e=d?u:l,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);f().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(d=!0,`unknown`):(d=!1,t)},m=()=>t.t.then(e=>e.cloud.fs.list()),h=()=>t.t.then(e=>e.cloud.fs.quota()),g=async e=>{let n=await(await t.t).cloud.fs.readFile(e).catch(s);return new Blob([n])},_=async(e,n,r)=>{let i=await t.t,a=n instanceof Blob?new Uint8Array(await n.arrayBuffer()):n;await i.cloud.fs.writeFile(e,a,r?.contentType??null).catch(s)},v=e=>t.t.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),y=()=>t.t.then(e=>e.cloud.fs.encryption()),b=()=>t.t.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}});
|
package/utils-QfNXtEhb.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("ip-address");var t=new TextEncoder;new TextDecoder;var n=`webvpn-udp-port-ack`,r=512*1024,i=t=>e.Address4.isValid(t),a=t=>e.Address6.isValid(t),o=e=>i(e)?4:a(e)?6:0,s=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},c=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},l=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,hasRange:!0,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,hasRange:!1,offset:0,length:n.length,port:r,address:i,callback:t}}};new TextEncoder,new TextDecoder,Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|