@fkn/lib 0.9.18 → 0.9.19
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-BPnL3UKE.d.ts → api-DnO1DsJC.d.ts} +11 -2
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +2 -2
- package/cloud/fs.js +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-BoteCXb4.d.ts → cloud-uE4g-WqI.d.ts} +3 -3
- package/cloud.d.ts +4 -4
- package/dgram.d.ts +1 -1
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/fs-BW5mVMmu.js +340 -0
- package/{fs-D5LFP4_n.d.ts → fs-CUmugp10.d.ts} +1 -1
- package/fs-DJm0bhjg.cjs +1 -0
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.d.ts +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +34 -3
- package/index.js +38 -27
- package/{net-5t6B2LnQ.d.ts → net-l7JVHsIR.d.ts} +1 -1
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/{proxy-DcALGZ-U.d.ts → proxy-7ib45Uo-.d.ts} +1 -1
- package/storage-BW-jDLUL.cjs +1 -0
- package/storage-C8hBot2f.js +51 -0
- package/storage-qxXFLgTM.d.ts +44 -0
- package/fs-Br0pOpNu.js +0 -315
- package/fs-fyR-J9up.cjs +0 -1
- package/storage-B1stLxSc.js +0 -37
- package/storage-BNQlgGqF.cjs +0 -1
- package/storage-CXIXrIxB.d.ts +0 -38
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as StorageQuota, i as StorageEntry, o as StorageReadResult, r as SealedGeneration, s as WriteData, t as KeyState } from "./storage-qxXFLgTM.js";
|
|
2
2
|
import { A as InstallOptions, D as MountDescriptor, F as PackagesFail, I as PickOptions, L as Placement, M as PackageQuery, N as PackageResult, O as Caller, j as InstalledPackage, k as ConnectOptions } from "./packages-vX-1yfRK.js";
|
|
3
3
|
import { t as AddressLookupResult } from "./lookup-BtwWaCZJ.js";
|
|
4
|
+
//#region src/api/connect-store.d.ts
|
|
5
|
+
type ConnectAvailability = 'connected' | 'disconnected' | 'unknown';
|
|
6
|
+
//#endregion
|
|
4
7
|
//#region src/api/storage-prompt.d.ts
|
|
5
8
|
type AdoptRequest = {
|
|
6
9
|
files: number;
|
|
@@ -461,7 +464,7 @@ declare const dataPlane: {
|
|
|
461
464
|
list: (scope?: string) => Promise<StorageEntry[]>;
|
|
462
465
|
quota: () => Promise<StorageQuota>;
|
|
463
466
|
readFile: (path: string, scope?: string) => Promise<StorageReadResult>;
|
|
464
|
-
writeFile: (path: string, data: WriteData, contentType: string | null, encryption: string, scope?: string) => Promise<void>;
|
|
467
|
+
writeFile: (path: string, data: WriteData, contentType: string | null, encryption: string | null, scope?: string, sealed?: SealedGeneration | null) => Promise<void>;
|
|
465
468
|
remove: (path: string, scope?: string) => Promise<void>;
|
|
466
469
|
keyState: () => Promise<KeyState>;
|
|
467
470
|
};
|
|
@@ -566,6 +569,7 @@ declare const makeResolvers: (callerOf: () => Caller | undefined, ownsOverlay?:
|
|
|
566
569
|
};
|
|
567
570
|
readonly fs: {
|
|
568
571
|
readonly available: () => Promise<boolean>;
|
|
572
|
+
readonly availability: () => Promise<ConnectAvailability>;
|
|
569
573
|
readonly list: () => Promise<StorageEntry[]>;
|
|
570
574
|
readonly quota: () => Promise<StorageQuota>;
|
|
571
575
|
readonly readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
@@ -701,6 +705,11 @@ declare const makeResolvers: (callerOf: () => Caller | undefined, ownsOverlay?:
|
|
|
701
705
|
readonly logout: () => void;
|
|
702
706
|
readonly onChange: (listener: () => void) => (() => void);
|
|
703
707
|
};
|
|
708
|
+
readonly shell: {
|
|
709
|
+
readonly updateReady: () => Promise<boolean>;
|
|
710
|
+
readonly onUpdate: (callback: () => void) => () => void;
|
|
711
|
+
readonly applyUpdate: () => Promise<boolean>;
|
|
712
|
+
};
|
|
704
713
|
readonly proxyFetch: (input: Parameters<Cloud['fetch']>[0], init: Parameters<Cloud['fetch']>[1]) => Promise<Response>;
|
|
705
714
|
readonly webVpnTcpSocket: (options: Parameters<Cloud['webvpn']['tcpSocket']>[0]) => Promise<LocalTcpSocket>;
|
|
706
715
|
readonly webVpnTcpSocketListener: (options: Parameters<Cloud['webvpn']['tcpSocketListener']>[0]) => Promise<{
|
package/cloud/fetch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as cloudFetch } from "../proxy-
|
|
1
|
+
import { t as cloudFetch } from "../proxy-7ib45Uo-.js";
|
|
2
2
|
export { cloudFetch as fetch };
|
package/cloud/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-BW-jDLUL.cjs");var r=e.t({STORAGE_NOT_FOUND:()=>n.p,StorageLockedError:()=>n.t,StorageNotFoundError:()=>n.n,available:()=>i,encryption:()=>n.i,isNotFound:()=>n.a,mkdir:()=>u,promises:()=>p,quota:()=>n.s,readFile:()=>a,readdir:()=>l,rename:()=>c,rm:()=>d,stat:()=>f,unlink:()=>s,unlock:()=>n.d,writeFile:()=>o}),{available:i,readFile:a,writeFile:o,unlink:s,rename:c,readdir:l,mkdir:u,rm:d,stat:f,promises:p}=t.t(n.u,{memfs:!1});exports.STORAGE_NOT_FOUND=n.p,exports.StorageLockedError=n.t,exports.StorageNotFoundError=n.n,exports.available=i,exports.encryption=n.i,exports.isNotFound=n.a,exports.mkdir=u,exports.promises=p,exports.quota=n.s,exports.readFile=a,exports.readdir=l,exports.rename=c,exports.rm=d,exports.stat=f,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}}),exports.unlink=s,exports.unlock=n.d,exports.writeFile=o;
|
package/cloud/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as STORAGE_NOT_FOUND } from "../storage-
|
|
1
|
+
import { n as STORAGE_NOT_FOUND } from "../storage-qxXFLgTM.js";
|
|
2
2
|
import { a as Stats } from "../index-CJ0vHTcS.js";
|
|
3
|
-
import { _ as encryption, a as readFile, b as unlock, c as rm, d as writeFile, f as EncryptionStatus, g as StorageQuota, h as StorageNotFoundError, i as promises, l as stat, m as StorageLockedError, o as readdir, p as FileEntry, r as mkdir, s as rename, t as available, u as unlink, v as isNotFound, y as quota } from "../fs-
|
|
3
|
+
import { _ as encryption, a as readFile, b as unlock, c as rm, d as writeFile, f as EncryptionStatus, g as StorageQuota, h as StorageNotFoundError, i as promises, l as stat, m as StorageLockedError, o as readdir, p as FileEntry, r as mkdir, s as rename, t as available, u as unlink, v as isNotFound, y as quota } from "../fs-CUmugp10.js";
|
|
4
4
|
export { type EncryptionStatus, type FileEntry, STORAGE_NOT_FOUND, type Stats, StorageLockedError, StorageNotFoundError, type StorageQuota, available, encryption, isNotFound, mkdir, promises, quota, readFile, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
package/cloud/fs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { t } from "../node-fs-DKfokOlh.js";
|
|
3
|
-
import { a as n, d as r, i, n as a, p as o, s, t as c, u as l } from "../storage-
|
|
3
|
+
import { a as n, d as r, i, n as a, p as o, s, t as c, u as l } from "../storage-C8hBot2f.js";
|
|
4
4
|
//#region src/lib/cloud/fs.ts
|
|
5
5
|
var u = /* @__PURE__ */ e({
|
|
6
6
|
STORAGE_NOT_FOUND: () => o,
|
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-l7JVHsIR.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-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-7ib45Uo-.js";
|
|
2
2
|
import { d as Frame, u as AttachFrameOptions } from "./index-DLaonjpx.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
|
-
import { n as fs_d_exports } from "./fs-
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
4
|
+
import { n as fs_d_exports } from "./fs-CUmugp10.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-l7JVHsIR.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
|
|
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-7ib45Uo-.js";
|
|
2
|
+
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-uE4g-WqI.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
|
-
import { n as fs_d_exports } from "./fs-
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
4
|
+
import { n as fs_d_exports } from "./fs-CUmugp10.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-l7JVHsIR.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 };
|
package/dgram.d.ts
CHANGED
package/fs/promises.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../fs-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../fs-DJm0bhjg.cjs");var{readFile:t,writeFile:n,appendFile:r,unlink:i,rename:a,readdir:o,mkdir:s,rm:c,rmdir:l,stat:u,lstat:d,access:f}=e.v,p=e.v;exports.access=f,exports.appendFile=r,exports.default=p,exports.lstat=d,exports.mkdir=s,exports.readFile=t,exports.readdir=o,exports.rename=a,exports.rm=c,exports.rmdir=l,exports.stat=u,exports.unlink=i,exports.writeFile=n;
|
package/fs/promises.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as e } from "../fs-
|
|
1
|
+
import { v as e } from "../fs-BW5mVMmu.js";
|
|
2
2
|
//#region src/lib/fs/promises.ts
|
|
3
3
|
var { readFile: t, writeFile: n, appendFile: r, unlink: i, rename: a, readdir: o, mkdir: s, rm: c, rmdir: l, stat: u, lstat: d, access: f } = e, p = e;
|
|
4
4
|
//#endregion
|
package/fs-BW5mVMmu.js
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { t } from "./node-fs-DKfokOlh.js";
|
|
3
|
+
import { c as n, f as r, l as i, o as a, r as o } from "./storage-C8hBot2f.js";
|
|
4
|
+
import { a as s, i as c, n as l, o as u, t as d } from "./opfs-BibrNGF0.js";
|
|
5
|
+
//#region src/lib/fs/hybrid.ts
|
|
6
|
+
var ee = /* @__PURE__ */ e({
|
|
7
|
+
adopt: () => V,
|
|
8
|
+
adoptable: () => H,
|
|
9
|
+
available: () => te,
|
|
10
|
+
list: () => oe,
|
|
11
|
+
onConflict: () => z,
|
|
12
|
+
pending: () => O,
|
|
13
|
+
pendingDeletes: () => k,
|
|
14
|
+
pull: () => ue,
|
|
15
|
+
readFile: () => se,
|
|
16
|
+
remove: () => le,
|
|
17
|
+
replicating: () => re,
|
|
18
|
+
writeFile: () => ce
|
|
19
|
+
}), f, p = async () => await (f ??= d().catch(() => !1)) ? !0 : (f = void 0, !1), m = () => o().catch(() => "unknown"), h = async () => await m() === "connected", te = async () => await p() || await h(), g = "fkn:fs:pending", _ = "fkn:fs:pending-delete", v = "fkn:fs:adopt-declined", y = !0, b = /* @__PURE__ */ new Map(), x = (e) => {
|
|
20
|
+
try {
|
|
21
|
+
let t = localStorage.getItem(e);
|
|
22
|
+
if (!t) return {};
|
|
23
|
+
let n = JSON.parse(t);
|
|
24
|
+
return Array.isArray(n) ? Object.fromEntries(n.filter((e) => typeof e == "string").map((e) => [e, null])) : n && typeof n == "object" ? n : {};
|
|
25
|
+
} catch {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
}, S = (e, t) => {
|
|
29
|
+
try {
|
|
30
|
+
Object.keys(t).length ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
|
|
31
|
+
} catch {}
|
|
32
|
+
}, C = () => x(g), w = (e, t) => {
|
|
33
|
+
let n = C();
|
|
34
|
+
e in n || (n[e] = t === void 0 ? b.get(e) ?? null : t, S(g, n));
|
|
35
|
+
}, T = (e) => {
|
|
36
|
+
let t = C();
|
|
37
|
+
e in t && (delete t[e], S(g, t), j() || (N = M));
|
|
38
|
+
}, E = () => x(_), ne = (e) => {
|
|
39
|
+
let t = E();
|
|
40
|
+
e in t || (t[e] = b.get(e) ?? null, S(_, t));
|
|
41
|
+
}, D = (e) => {
|
|
42
|
+
let t = E();
|
|
43
|
+
e in t && (delete t[e], S(_, t), j() || (N = M));
|
|
44
|
+
}, O = () => Object.keys(C()), k = () => Object.keys(E()), re = () => y, A = null, j = () => Object.keys(C()).length > 0 || Object.keys(E()).length > 0, M = 6e4, ie = 10 * 6e4, N = M, P = null, F = () => {
|
|
45
|
+
P || typeof window > "u" || !j() || (P = setTimeout(() => {
|
|
46
|
+
P = null, I();
|
|
47
|
+
}, N), N = Math.min(N * 2, ie));
|
|
48
|
+
}, I = () => {
|
|
49
|
+
A || !j() || (A = B(!1).then((e) => {
|
|
50
|
+
if (!j()) {
|
|
51
|
+
N = M;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
e.failed.length && F();
|
|
55
|
+
}).catch(() => {
|
|
56
|
+
F();
|
|
57
|
+
}).finally(() => {
|
|
58
|
+
A = null;
|
|
59
|
+
}));
|
|
60
|
+
}, ae = null, L = () => ae ??= import("./api-DQ-V4Lls.js").then((e) => e.n).then((e) => e.apiPromise), oe = async () => {
|
|
61
|
+
G();
|
|
62
|
+
let e = await m(), t = e === "connected", [n, r] = await Promise.all([p().then((e) => e ? l() : []).catch(() => []), t ? a().then((e) => ({
|
|
63
|
+
ok: !0,
|
|
64
|
+
entries: e
|
|
65
|
+
})).catch(() => ({
|
|
66
|
+
ok: !1,
|
|
67
|
+
entries: []
|
|
68
|
+
})) : Promise.resolve({
|
|
69
|
+
ok: e === "disconnected",
|
|
70
|
+
entries: []
|
|
71
|
+
})]);
|
|
72
|
+
e !== "unknown" && (y = r.ok), r.ok && e !== "unknown" && (b = new Map(r.entries.map((e) => [e.path, e.updatedAt])));
|
|
73
|
+
let i = /* @__PURE__ */ new Map(), o = (e) => {
|
|
74
|
+
let t = Date.parse(e.updatedAt ?? "");
|
|
75
|
+
return Number.isFinite(t) ? t : 0;
|
|
76
|
+
}, s = (e) => {
|
|
77
|
+
let t = i.get(e.path);
|
|
78
|
+
(!t || o(e) >= o(t)) && i.set(e.path, e);
|
|
79
|
+
};
|
|
80
|
+
for (let e of n) s(e);
|
|
81
|
+
for (let e of r.entries) s(e);
|
|
82
|
+
return r.ok && t && (he(n, r.entries).catch(() => {}), j() ? I() : W({
|
|
83
|
+
local: n,
|
|
84
|
+
remote: r.entries
|
|
85
|
+
}).catch(() => {})), [...i.values()];
|
|
86
|
+
}, se = async (e) => {
|
|
87
|
+
if (await p()) try {
|
|
88
|
+
return await c(e);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
if (e?.name !== "NotFoundError") throw e;
|
|
91
|
+
}
|
|
92
|
+
let t = await n(e);
|
|
93
|
+
return await p() && u(e, t).catch(() => {}), t;
|
|
94
|
+
}, ce = async (e, t, n) => {
|
|
95
|
+
let i = t instanceof Blob ? t : new Blob([t], n?.contentType ? { type: n.contentType } : void 0);
|
|
96
|
+
if (await p()) {
|
|
97
|
+
await u(e, i, n), G();
|
|
98
|
+
let t = b.get(e) ?? null, a = await m();
|
|
99
|
+
if (a === "disconnected") return;
|
|
100
|
+
if (a === "unknown" || !y) {
|
|
101
|
+
w(e, t), F();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
r(e, i, n).then(() => T(e)).catch((n) => {
|
|
105
|
+
w(e, t), F(), console.warn("fs: cloud replicate failed, queued for adopt()", n);
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
let a = await m();
|
|
110
|
+
if (a === "connected") return r(e, i, n);
|
|
111
|
+
throw Error(a === "unknown" ? "fs: cloud unreachable" : "fs: no storage backend available");
|
|
112
|
+
}, le = async (e) => {
|
|
113
|
+
G();
|
|
114
|
+
let t = [];
|
|
115
|
+
await p() && t.push(s(e).catch(() => {}));
|
|
116
|
+
let n = await m();
|
|
117
|
+
if (n === "connected" ? t.push(i(e).then(() => D(e)).catch((t) => {
|
|
118
|
+
ne(e), F(), console.warn("fs: cloud delete failed, queued for retry", t);
|
|
119
|
+
})) : n === "unknown" && t.length && b.has(e) && (ne(e), F()), !t.length) throw Error(n === "unknown" ? "fs: cloud unreachable" : "fs: no storage backend available");
|
|
120
|
+
T(e), await Promise.all(t);
|
|
121
|
+
}, ue = async (e) => {
|
|
122
|
+
let t = await n(e);
|
|
123
|
+
return await p() && await u(e, t), t;
|
|
124
|
+
}, R = null, z = (e) => (R = e, () => {
|
|
125
|
+
R === e && (R = null);
|
|
126
|
+
}), de = async (e) => (await L()).cloud.fs.promptConflict({
|
|
127
|
+
path: e.path,
|
|
128
|
+
local: e.local,
|
|
129
|
+
cloud: e.cloud
|
|
130
|
+
}).catch(() => null), fe = async (e) => {
|
|
131
|
+
if (R) try {
|
|
132
|
+
return await R(e);
|
|
133
|
+
} catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return de(e);
|
|
137
|
+
}, B = async (e) => {
|
|
138
|
+
let t = {
|
|
139
|
+
uploaded: [],
|
|
140
|
+
kept: [],
|
|
141
|
+
resolved: [],
|
|
142
|
+
unresolved: [],
|
|
143
|
+
deleted: [],
|
|
144
|
+
failed: []
|
|
145
|
+
}, o = await m();
|
|
146
|
+
if (o === "unknown") throw Error("fs: cloud unreachable");
|
|
147
|
+
if (o !== "connected") throw Error("fs: this needs a signed-in account");
|
|
148
|
+
let s = await p(), [d, ee] = await Promise.all([s ? l() : Promise.resolve([]), a()]), f = new Map(ee.map((e) => [e.path, e])), h = C();
|
|
149
|
+
if (s) for (let e of Object.keys(h)) d.some((t) => t.path === e) || T(e);
|
|
150
|
+
for (let [e, n] of Object.entries(E())) {
|
|
151
|
+
let r = f.get(e);
|
|
152
|
+
if (!r) {
|
|
153
|
+
D(e);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (d.some((t) => t.path === e)) {
|
|
157
|
+
D(e);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (r.updatedAt !== n) {
|
|
161
|
+
D(e);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
await i(e), D(e), t.deleted.push(e);
|
|
166
|
+
} catch (n) {
|
|
167
|
+
t.failed.push({
|
|
168
|
+
path: e,
|
|
169
|
+
error: n instanceof Error ? n.message : String(n)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (let i of d) {
|
|
174
|
+
let a = f.get(i.path), o = i.path in h;
|
|
175
|
+
if (!o && (a || !e)) {
|
|
176
|
+
a && t.kept.push(i.path);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (o && a && a.updatedAt !== h[i.path]) {
|
|
180
|
+
let e = await fe({
|
|
181
|
+
path: i.path,
|
|
182
|
+
local: {
|
|
183
|
+
size: i.size,
|
|
184
|
+
updatedAt: i.updatedAt
|
|
185
|
+
},
|
|
186
|
+
cloud: {
|
|
187
|
+
size: a.size,
|
|
188
|
+
updatedAt: a.updatedAt
|
|
189
|
+
},
|
|
190
|
+
readLocal: () => c(i.path),
|
|
191
|
+
readCloud: () => n(i.path)
|
|
192
|
+
});
|
|
193
|
+
if (!e) {
|
|
194
|
+
t.unresolved.push(i.path);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
if (e === "cloud") await u(i.path, await n(i.path));
|
|
199
|
+
else {
|
|
200
|
+
let t = e === "local" ? await c(i.path) : e.merged;
|
|
201
|
+
await r(i.path, t, i.contentType ? { contentType: i.contentType } : void 0), e !== "local" && await u(i.path, t);
|
|
202
|
+
}
|
|
203
|
+
T(i.path), t.resolved.push({
|
|
204
|
+
path: i.path,
|
|
205
|
+
choice: e === "local" || e === "cloud" ? e : "merged"
|
|
206
|
+
});
|
|
207
|
+
} catch (e) {
|
|
208
|
+
if (e?.code === "FKN_E2E_LOCKED") throw e;
|
|
209
|
+
t.failed.push({
|
|
210
|
+
path: i.path,
|
|
211
|
+
error: e instanceof Error ? e.message : String(e)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
let e = await c(i.path);
|
|
218
|
+
await r(i.path, e, i.contentType ? { contentType: i.contentType } : void 0), T(i.path), t.uploaded.push(i.path);
|
|
219
|
+
} catch (e) {
|
|
220
|
+
if (w(i.path), e?.code === "FKN_E2E_LOCKED") throw e;
|
|
221
|
+
t.failed.push({
|
|
222
|
+
path: i.path,
|
|
223
|
+
error: e instanceof Error ? e.message : String(e)
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return t;
|
|
228
|
+
}, V = async () => {
|
|
229
|
+
for (; A;) await A;
|
|
230
|
+
let e = B(!0);
|
|
231
|
+
A = e.then(() => {}, () => {});
|
|
232
|
+
try {
|
|
233
|
+
return await e;
|
|
234
|
+
} finally {
|
|
235
|
+
A = null;
|
|
236
|
+
}
|
|
237
|
+
}, H = async () => {
|
|
238
|
+
if (!await h() || !await p()) return {
|
|
239
|
+
paths: [],
|
|
240
|
+
bytes: 0
|
|
241
|
+
};
|
|
242
|
+
let [e, t] = await Promise.all([l(), a()]), n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path));
|
|
243
|
+
return {
|
|
244
|
+
paths: r.map((e) => e.path),
|
|
245
|
+
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
246
|
+
};
|
|
247
|
+
}, pe = () => new Set(Object.keys(x(v))), me = (e) => {
|
|
248
|
+
let t = x(v);
|
|
249
|
+
for (let n of e) t[n] = null;
|
|
250
|
+
S(v, t);
|
|
251
|
+
}, U = null, W = (e) => U || (U = (async () => {
|
|
252
|
+
if (!await h()) return;
|
|
253
|
+
let t = e ?? (await p() ? {
|
|
254
|
+
local: await l(),
|
|
255
|
+
remote: await a()
|
|
256
|
+
} : null);
|
|
257
|
+
if (!t) return;
|
|
258
|
+
let n = new Set(t.remote.map((e) => e.path)), r = pe(), i = t.local.filter((e) => !n.has(e.path) && !r.has(e.path));
|
|
259
|
+
if (!i.length) return;
|
|
260
|
+
let o = await L(), s = i.reduce((e, t) => e + t.size, 0);
|
|
261
|
+
if (!await o.cloud.fs.promptAdopt({
|
|
262
|
+
files: i.length,
|
|
263
|
+
bytes: s
|
|
264
|
+
}).catch(() => !1)) {
|
|
265
|
+
me(i.map((e) => e.path));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
await V();
|
|
269
|
+
})().catch(() => {}).finally(() => {
|
|
270
|
+
U = null;
|
|
271
|
+
}), U), he = async (e, t) => {
|
|
272
|
+
let n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path)), i = await L(), a = async () => {
|
|
273
|
+
await V().catch(() => {});
|
|
274
|
+
let e = await H().catch(() => ({
|
|
275
|
+
paths: [],
|
|
276
|
+
bytes: 0
|
|
277
|
+
}));
|
|
278
|
+
await i.cloud.fs.setAdoptSource({
|
|
279
|
+
files: e.paths.length,
|
|
280
|
+
bytes: e.bytes
|
|
281
|
+
}, a).catch(() => {});
|
|
282
|
+
};
|
|
283
|
+
await i.cloud.fs.setAdoptSource({
|
|
284
|
+
files: r.length,
|
|
285
|
+
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
286
|
+
}, a);
|
|
287
|
+
}, ge = !1, G = () => {
|
|
288
|
+
ge || typeof window > "u" || (ge = !0, window.addEventListener("online", () => {
|
|
289
|
+
I();
|
|
290
|
+
}), import("./account.js").then((e) => e.onChange(() => {
|
|
291
|
+
W().catch(() => {}), I();
|
|
292
|
+
})).catch(() => {}));
|
|
293
|
+
}, _e = /* @__PURE__ */ e({
|
|
294
|
+
adopt: () => J,
|
|
295
|
+
adoptable: () => Y,
|
|
296
|
+
appendFile: () => Pe,
|
|
297
|
+
appendFileSync: () => Se,
|
|
298
|
+
available: () => ye,
|
|
299
|
+
default: () => Ge,
|
|
300
|
+
exists: () => Ve,
|
|
301
|
+
existsSync: () => Ce,
|
|
302
|
+
flush: () => Ue,
|
|
303
|
+
lstatSync: () => Te,
|
|
304
|
+
mkdir: () => Le,
|
|
305
|
+
mkdirSync: () => De,
|
|
306
|
+
mount: () => He,
|
|
307
|
+
onConflict: () => $,
|
|
308
|
+
pending: () => X,
|
|
309
|
+
pendingDeletes: () => Z,
|
|
310
|
+
promises: () => K,
|
|
311
|
+
pull: () => q,
|
|
312
|
+
readFile: () => Me,
|
|
313
|
+
readFileSync: () => be,
|
|
314
|
+
readdir: () => Ie,
|
|
315
|
+
readdirSync: () => Ee,
|
|
316
|
+
remount: () => We,
|
|
317
|
+
rename: () => Be,
|
|
318
|
+
renameSync: () => je,
|
|
319
|
+
replicating: () => Q,
|
|
320
|
+
rm: () => Re,
|
|
321
|
+
rmSync: () => Oe,
|
|
322
|
+
rmdirSync: () => ke,
|
|
323
|
+
stat: () => Fe,
|
|
324
|
+
statSync: () => we,
|
|
325
|
+
unlink: () => ze,
|
|
326
|
+
unlinkSync: () => Ae,
|
|
327
|
+
writeFile: () => Ne,
|
|
328
|
+
writeFileSync: () => xe
|
|
329
|
+
}), ve = t(ee, { memfs: !0 }), { available: ye, readFileSync: be, writeFileSync: xe, appendFileSync: Se, existsSync: Ce, statSync: we, lstatSync: Te, readdirSync: Ee, mkdirSync: De, rmSync: Oe, rmdirSync: ke, unlinkSync: Ae, renameSync: je, readFile: Me, writeFile: Ne, appendFile: Pe, stat: Fe, readdir: Ie, mkdir: Le, rm: Re, unlink: ze, rename: Be, exists: Ve, promises: K, mount: He, flush: Ue, remount: We } = ve, q = ue, J = V, Y = H, X = O, Z = k, Q = re, $ = z, Ge = {
|
|
330
|
+
...ve,
|
|
331
|
+
pull: q,
|
|
332
|
+
adopt: J,
|
|
333
|
+
adoptable: Y,
|
|
334
|
+
pending: X,
|
|
335
|
+
pendingDeletes: Z,
|
|
336
|
+
replicating: Q,
|
|
337
|
+
onConflict: $
|
|
338
|
+
};
|
|
339
|
+
//#endregion
|
|
340
|
+
export { ke as A, Ee as C, Q as D, je as E, Ne as F, xe as I, we as M, ze as N, Re as O, Ae as P, Ie as S, Be as T, Z as _, ye as a, Me as b, Ue as c, Te as d, Le as f, X as g, $ as h, Se as i, Fe as j, Oe as k, Ge as l, He as m, Y as n, Ve as o, De as p, Pe as r, Ce as s, J as t, _e as u, K as v, We as w, be as x, q as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as STORAGE_NOT_FOUND } from "./storage-
|
|
1
|
+
import { n as STORAGE_NOT_FOUND } from "./storage-qxXFLgTM.js";
|
|
2
2
|
import { a as Stats, i as ReadOptions, n as Callback, o as WriteData, r as MakeOptions, s as WriteOptions } from "./index-CJ0vHTcS.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/storage.d.ts
|
package/fs-DJm0bhjg.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./node-fs-BMR2yCEt.cjs"),n=require("./storage-BW-jDLUL.cjs"),r=require("./opfs-CXMESVLc.cjs");var i=e.t({adopt:()=>F,adoptable:()=>I,available:()=>l,list:()=>re,onConflict:()=>ce,pending:()=>C,pendingDeletes:()=>w,pull:()=>se,readFile:()=>ie,remove:()=>oe,replicating:()=>ee,writeFile:()=>ae}),a,o=async()=>await(a??=r.t().catch(()=>!1))?!0:(a=void 0,!1),s=()=>n.r().catch(()=>`unknown`),c=async()=>await s()===`connected`,l=async()=>await o()||await c(),u=`fkn:fs:pending`,d=`fkn:fs:pending-delete`,f=`fkn:fs:adopt-declined`,p=!0,m=new Map,h=e=>{try{let t=localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return Array.isArray(n)?Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,null])):n&&typeof n==`object`?n:{}}catch{return{}}},g=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}catch{}},_=()=>h(u),v=(e,t)=>{let n=_();e in n||(n[e]=t===void 0?m.get(e)??null:t,g(u,n))},y=e=>{let t=_();e in t&&(delete t[e],g(u,t),E()||(O=D))},b=()=>h(d),x=e=>{let t=b();e in t||(t[e]=m.get(e)??null,g(d,t))},S=e=>{let t=b();e in t&&(delete t[e],g(d,t),E()||(O=D))},C=()=>Object.keys(_()),w=()=>Object.keys(b()),ee=()=>p,T=null,E=()=>Object.keys(_()).length>0||Object.keys(b()).length>0,D=6e4,te=10*6e4,O=D,k=null,A=()=>{k||typeof window>`u`||!E()||(k=setTimeout(()=>{k=null,j()},O),O=Math.min(O*2,te))},j=()=>{T||!E()||(T=P(!1).then(e=>{if(!E()){O=D;return}e.failed.length&&A()}).catch(()=>{A()}).finally(()=>{T=null}))},ne=null,M=()=>ne??=Promise.resolve().then(()=>require("./api-kHMHDGar.cjs")).then(e=>e.n).then(e=>e.apiPromise),re=async()=>{B();let e=await s(),t=e===`connected`,[i,a]=await Promise.all([o().then(e=>e?r.n():[]).catch(()=>[]),t?n.o().then(e=>({ok:!0,entries:e})).catch(()=>({ok:!1,entries:[]})):Promise.resolve({ok:e===`disconnected`,entries:[]})]);e!==`unknown`&&(p=a.ok),a.ok&&e!==`unknown`&&(m=new Map(a.entries.map(e=>[e.path,e.updatedAt])));let c=new Map,l=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},u=e=>{let t=c.get(e.path);(!t||l(e)>=l(t))&&c.set(e.path,e)};for(let e of i)u(e);for(let e of a.entries)u(e);return a.ok&&t&&(pe(i,a.entries).catch(()=>{}),E()?j():R({local:i,remote:a.entries}).catch(()=>{})),[...c.values()]},ie=async e=>{if(await o())try{return await r.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let t=await n.c(e);return await o()&&r.o(e,t).catch(()=>{}),t},ae=async(e,t,i)=>{let a=t instanceof Blob?t:new Blob([t],i?.contentType?{type:i.contentType}:void 0);if(await o()){await r.o(e,a,i),B();let t=m.get(e)??null,o=await s();if(o===`disconnected`)return;if(o===`unknown`||!p){v(e,t),A();return}n.f(e,a,i).then(()=>y(e)).catch(n=>{v(e,t),A(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let c=await s();if(c===`connected`)return n.f(e,a,i);throw Error(c===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},oe=async e=>{B();let t=[];await o()&&t.push(r.a(e).catch(()=>{}));let i=await s();if(i===`connected`?t.push(n.l(e).then(()=>S(e)).catch(t=>{x(e),A(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):i===`unknown`&&t.length&&m.has(e)&&(x(e),A()),!t.length)throw Error(i===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);y(e),await Promise.all(t)},se=async e=>{let t=await n.c(e);return await o()&&await r.o(e,t),t},N=null,ce=e=>(N=e,()=>{N===e&&(N=null)}),le=async e=>(await M()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null),ue=async e=>{if(N)try{return await N(e)}catch{return null}return le(e)},P=async e=>{let t={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},i=await s();if(i===`unknown`)throw Error(`fs: cloud unreachable`);if(i!==`connected`)throw Error(`fs: this needs a signed-in account`);let a=await o(),[c,l]=await Promise.all([a?r.n():Promise.resolve([]),n.o()]),u=new Map(l.map(e=>[e.path,e])),d=_();if(a)for(let e of Object.keys(d))c.some(t=>t.path===e)||y(e);for(let[e,r]of Object.entries(b())){let i=u.get(e);if(!i){S(e);continue}if(c.some(t=>t.path===e)){S(e);continue}if(i.updatedAt!==r){S(e);continue}try{await n.l(e),S(e),t.deleted.push(e)}catch(n){t.failed.push({path:e,error:n instanceof Error?n.message:String(n)})}}for(let i of c){let a=u.get(i.path),o=i.path in d;if(!o&&(a||!e)){a&&t.kept.push(i.path);continue}if(o&&a&&a.updatedAt!==d[i.path]){let e=await ue({path:i.path,local:{size:i.size,updatedAt:i.updatedAt},cloud:{size:a.size,updatedAt:a.updatedAt},readLocal:()=>r.i(i.path),readCloud:()=>n.c(i.path)});if(!e){t.unresolved.push(i.path);continue}try{if(e===`cloud`)await r.o(i.path,await n.c(i.path));else{let t=e===`local`?await r.i(i.path):e.merged;await n.f(i.path,t,i.contentType?{contentType:i.contentType}:void 0),e!==`local`&&await r.o(i.path,t)}y(i.path),t.resolved.push({path:i.path,choice:e===`local`||e===`cloud`?e:`merged`})}catch(e){if(e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:i.path,error:e instanceof Error?e.message:String(e)})}continue}try{let e=await r.i(i.path);await n.f(i.path,e,i.contentType?{contentType:i.contentType}:void 0),y(i.path),t.uploaded.push(i.path)}catch(e){if(v(i.path),e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:i.path,error:e instanceof Error?e.message:String(e)})}}return t},F=async()=>{for(;T;)await T;let e=P(!0);T=e.then(()=>{},()=>{});try{return await e}finally{T=null}},I=async()=>{if(!await c()||!await o())return{paths:[],bytes:0};let[e,t]=await Promise.all([r.n(),n.o()]),i=new Set(t.map(e=>e.path)),a=e.filter(e=>!i.has(e.path));return{paths:a.map(e=>e.path),bytes:a.reduce((e,t)=>e+t.size,0)}},de=()=>new Set(Object.keys(h(f))),fe=e=>{let t=h(f);for(let n of e)t[n]=null;g(f,t)},L=null,R=e=>L||(L=(async()=>{if(!await c())return;let t=e??(await o()?{local:await r.n(),remote:await n.o()}:null);if(!t)return;let i=new Set(t.remote.map(e=>e.path)),a=de(),s=t.local.filter(e=>!i.has(e.path)&&!a.has(e.path));if(!s.length)return;let l=await M(),u=s.reduce((e,t)=>e+t.size,0);if(!await l.cloud.fs.promptAdopt({files:s.length,bytes:u}).catch(()=>!1)){fe(s.map(e=>e.path));return}await F()})().catch(()=>{}).finally(()=>{L=null}),L),pe=async(e,t)=>{let n=new Set(t.map(e=>e.path)),r=e.filter(e=>!n.has(e.path)),i=await M(),a=async()=>{await F().catch(()=>{});let e=await I().catch(()=>({paths:[],bytes:0}));await i.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},a).catch(()=>{})};await i.cloud.fs.setAdoptSource({files:r.length,bytes:r.reduce((e,t)=>e+t.size,0)},a)},z=!1,B=()=>{z||typeof window>`u`||(z=!0,window.addEventListener(`online`,()=>{j()}),Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{R().catch(()=>{}),j()})).catch(()=>{}))},me=e.t({adopt:()=>J,adoptable:()=>Y,appendFile:()=>Ee,appendFileSync:()=>G,available:()=>H,default:()=>Le,exists:()=>Ne,existsSync:()=>he,flush:()=>Fe,lstatSync:()=>_e,mkdir:()=>ke,mkdirSync:()=>ye,mount:()=>K,onConflict:()=>$,pending:()=>X,pendingDeletes:()=>Z,promises:()=>Pe,pull:()=>q,readFile:()=>we,readFileSync:()=>U,readdir:()=>Oe,readdirSync:()=>ve,remount:()=>Ie,rename:()=>Me,renameSync:()=>Ce,replicating:()=>Q,rm:()=>Ae,rmSync:()=>be,rmdirSync:()=>xe,stat:()=>De,statSync:()=>ge,unlink:()=>je,unlinkSync:()=>Se,writeFile:()=>Te,writeFileSync:()=>W}),V=t.t(i,{memfs:!0}),{available:H,readFileSync:U,writeFileSync:W,appendFileSync:G,existsSync:he,statSync:ge,lstatSync:_e,readdirSync:ve,mkdirSync:ye,rmSync:be,rmdirSync:xe,unlinkSync:Se,renameSync:Ce,readFile:we,writeFile:Te,appendFile:Ee,stat:De,readdir:Oe,mkdir:ke,rm:Ae,unlink:je,rename:Me,exists:Ne,promises:Pe,mount:K,flush:Fe,remount:Ie}=V,q=se,J=F,Y=I,X=C,Z=w,Q=ee,$=ce,Le={...V,pull:q,adopt:J,adoptable:Y,pending:X,pendingDeletes:Z,replicating:Q,onConflict:$};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return q}});
|
package/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-DJm0bhjg.cjs");exports.adopt=e.t,exports.adoptable=e.n,exports.appendFile=e.r,exports.appendFileSync=e.i,exports.available=e.a,exports.default=e.l,exports.exists=e.o,exports.existsSync=e.s,exports.flush=e.c,exports.lstatSync=e.d,exports.mkdir=e.f,exports.mkdirSync=e.p,exports.mount=e.m,exports.onConflict=e.h,exports.pending=e.g,exports.pendingDeletes=e._,exports.promises=e.v,exports.pull=e.y,exports.readFile=e.b,exports.readFileSync=e.x,exports.readdir=e.S,exports.readdirSync=e.C,exports.remount=e.w,exports.rename=e.T,exports.renameSync=e.E,exports.replicating=e.D,exports.rm=e.O,exports.rmSync=e.k,exports.rmdirSync=e.A,exports.stat=e.j,exports.statSync=e.M,exports.unlink=e.N,exports.unlinkSync=e.P,exports.writeFile=e.F,exports.writeFileSync=e.I;
|
package/fs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, v as j, w as M, x as N, y as P } from "./fs-
|
|
1
|
+
import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, v as j, w as M, x as N, y as P } from "./fs-BW5mVMmu.js";
|
|
2
2
|
export { A as adopt, T as adoptable, O as appendFile, b as appendFileSync, p as available, C as default, E as exists, k as existsSync, h as flush, g as lstatSync, _ as mkdir, D as mkdirSync, w as mount, y as onConflict, v as pending, f as pendingDeletes, j as promises, P as pull, m as readFile, N as readFileSync, u as readdir, t as readdirSync, M as remount, d as rename, r as renameSync, n as replicating, c as rm, S as rmSync, e as rmdirSync, x as stat, o as statSync, s as unlink, l as unlinkSync, i as writeFile, a as writeFileSync };
|
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-l7JVHsIR.js";
|
|
2
2
|
import { Buffer } from "buffer";
|
|
3
3
|
import { Stream } from "stream";
|
|
4
4
|
import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib-ulyxIbTr.cjs"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-ulyxIbTr.cjs"),n=require("./api-kHMHDGar.cjs"),r=require("./cloud-BQoppUw4.cjs"),i=require("./dns.cjs"),a=require("./net-COzDDBnS.cjs"),o=require("./dgram-D2Or5f2e.cjs"),s=require("./http.cjs"),c=require("./extension-4BM5hKrn.cjs"),l=require("./desktop.cjs"),u=require("./fs-DJm0bhjg.cjs"),d=require("./opfs.cjs"),f=require("./packages.cjs"),p=require("./account.cjs"),m=require("./connect-button-BBEjXzB3.cjs");let h=require("osra");var g=1e4,_=150,v=()=>new Promise(e=>{if(t.P())return e(!0);let n,r=setTimeout(()=>i(t.P()),g),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.P()),_)},o=new MutationObserver(()=>{t.P()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.P()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),y=async e=>c.r()||e.lockdown||!r.a()||await v()?t.r(e):r.i(e),b=`https://fkn.app`,x=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let r=await n.i;if(!r)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);(0,h.relay)(r,e,{key:`fkn-api`,...r.emit instanceof MessagePort?{}:{originA:t?.originA??b,originB:t?.originB??`*`},unregisterSignal:t?.unregisterSignal})},S=async()=>typeof window>`u`?!1:(await n.t).connect.prompt(location.origin).catch(()=>!1),C=async()=>typeof window>`u`?null:(await n.t).relay.prompt().catch(()=>null),w=e.t({applyUpdate:()=>D,onUpdate:()=>E,updateReady:()=>T}),T=async()=>typeof window>`u`?!1:n.t.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),E=async e=>{if(typeof window>`u`)return()=>{};let t=await n.t.catch(()=>null);if(!t||typeof t.shell?.onUpdate!=`function`)return()=>{};let r=await t.shell.onUpdate(e).catch(()=>null);return typeof r==`function`?r:()=>{}},D=async()=>typeof window>`u`?!1:n.t.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.n,exports.FORGEABLE_HEADERS=t.k,exports.LOCATOR_DENIED=t.g,exports.LOCATOR_ERROR=t.u,exports.LOCATOR_UNSUPPORTED=t.h,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return p.t}}),exports.assertAttachableFrameUrl=t.s,exports.assertFetchableUrl=t.S,exports.assertForgeableHeaders=t.A,exports.assertLockdownApplicable=t.c,exports.assertOneCookieIdentity=t.j,exports.attachFrame=y,exports.attachFramePermission=t.i,exports.box=t.R,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return r.n}}),exports.connect=S,exports.connectButtonUrl=m.t,exports.cookies=t.b,exports.createFrame=t.a,exports.createVideoElementHandle=t.z,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return l.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return o.i}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return i.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return c.t}}),exports.fetch=c.n,exports.fetchCredentialedPermission=t.w,exports.fetchLocalPermission=t.T,exports.fetchPermission=t.E,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return u.u}}),exports.gotoPermission=t.o,exports.handleRevivableModules=t.L,exports.hasForgedCookie=t.M,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return s.t}}),exports.isBlockedFetchUrl=t.D,exports.isBlockedFrameUrl=t.l,exports.isExtensionExposed=t.P,exports.isLocalNetworkUrl=t.O,exports.isLocatorDenied=t.d,exports.isLocatorUnsupported=t.m,exports.isTerminalError=t.p,exports.isType=t.B,exports.modifyRequestHeadersPermission=t._,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return a.s}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return d.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return f.t}}),exports.permissions=t.t,exports.promptInstall=c.i,exports.promptRelay=C,exports.readCookiePermission=t.x,exports.relayWorker=x,exports.removeRequestHeaderRule=t.v,exports.revive=t.V,exports.setMissingExtensionHandler=t.F,exports.setRequestHeaderRule=t.y,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return w}}),exports.type=t.H,exports.waitForExtensionExposure=t.I;
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as account_d_exports } from "./account.js";
|
|
2
2
|
import { S as packages_d_exports } from "./packages-vX-1yfRK.js";
|
|
3
3
|
import { A as LOCATOR_DENIED, B as SelectorPart, C as RemoteVideoElement, D as isType, E as createVideoElementHandle, F as isTerminalError, G as setRequestHeaderRule, H as RequestHeaderRule, I as Executor, J as cookies, K as CookieDetails, L as Gate, M as LOCATOR_UNSUPPORTED, N as isLocatorDenied, O as revive, P as isLocatorUnsupported, Q as assertFetchableUrl, R as GateTools, S as BoxedVideoElement, T as box, U as modifyRequestHeadersPermission, V as HeaderOperation, W as removeRequestHeaderRule, X as FetchInit, Y as readCookiePermission, Z as ProxyFetchRequest, _ as gotoPermission, a as PermissionGrant, at as FORGEABLE_HEADERS, b as isBlockedFrameUrl, c as ATTACH_FRAME_EVENT_KEY, ct as hasForgedCookie, d as Frame, et as fetchCredentialedPermission, f as FrameBackend, g as createFrame, h as attachFramePermission, i as waitForExtensionExposure, it as isLocalNetworkUrl, j as LOCATOR_ERROR, k as type, m as Locator, n as isExtensionExposed, nt as fetchPermission, o as PermissionRequest, ot as assertForgeableHeaders, p as GotoOptions, q as SiteCookie, r as setMissingExtensionHandler, rt as isBlockedFetchUrl, s as permissions, st as assertOneCookieIdentity, tt as fetchLocalPermission, u as AttachFrameOptions, v as assertAttachableFrameUrl, w as VideoElementState, x as handleRevivableModules, y as assertLockdownApplicable, z as OperationRequest } from "./index-DLaonjpx.js";
|
|
4
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
4
|
+
import { n as cloud_d_exports } from "./cloud-uE4g-WqI.js";
|
|
5
5
|
import { t as dns_d_exports } from "./dns.js";
|
|
6
|
-
import { s as net_d_exports } from "./net-
|
|
6
|
+
import { s as net_d_exports } from "./net-l7JVHsIR.js";
|
|
7
7
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
8
8
|
import { t as http_d_exports } from "./http.js";
|
|
9
9
|
import { t as desktop_d_exports } from "./desktop.js";
|
|
@@ -27,5 +27,36 @@ declare const connect: () => Promise<boolean>;
|
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/lib/relay-prompt.d.ts
|
|
29
29
|
declare const promptRelay: () => Promise<string | null>;
|
|
30
|
+
declare namespace shell_d_exports {
|
|
31
|
+
export { applyUpdate, onUpdate, updateReady };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The FKN shell's update surface, for apps that want a say in when the platform frame reloads.
|
|
35
|
+
*
|
|
36
|
+
* The broker downloads updates behind the page and never applies one on its own authority,
|
|
37
|
+
* because only the app knows what a reload costs right now (a torrent mid-download is the case
|
|
38
|
+
* that matters). An app that subscribes here learns when a newer shell is ready and calls
|
|
39
|
+
* applyUpdate() at a moment of its choosing; the reload covers ONLY the FKN frame, and whether
|
|
40
|
+
* the app then reloads its own page is its own decision. Apps that ignore this module entirely
|
|
41
|
+
* keep today's behavior: the shell offers the update in its own header instead.
|
|
42
|
+
*/
|
|
43
|
+
/** Whether a newer FKN shell is downloaded and ready to apply. */
|
|
44
|
+
declare const updateReady: () => Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Subscribe to "a newer FKN shell is ready". Fires immediately when an update is already
|
|
47
|
+
* waiting at subscribe time, so a late subscriber misses nothing. Returns an unsubscribe;
|
|
48
|
+
* a shell without this surface yields a noop unsubscribe rather than an error.
|
|
49
|
+
*/
|
|
50
|
+
declare const onUpdate: (callback: () => void) => Promise<() => void>;
|
|
51
|
+
/**
|
|
52
|
+
* Apply a ready update by reloading the FKN frame this page mounted. Resolves true when the
|
|
53
|
+
* reload was taken, false when there is nothing to apply or this caller does not own the frame.
|
|
54
|
+
*
|
|
55
|
+
* The page's FKN connection does NOT survive the frame reload: calling this means "now is a
|
|
56
|
+
* safe moment", and reloading your own page right after (which remounts the frame fresh) is the
|
|
57
|
+
* expected next step. An app that never calls this keeps today's behavior, where the shell
|
|
58
|
+
* offers the update in its own header instead.
|
|
59
|
+
*/
|
|
60
|
+
declare const applyUpdate: () => Promise<boolean>;
|
|
30
61
|
//#endregion
|
|
31
|
-
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, type Executor, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, type OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, 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, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
62
|
+
export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CookieDetails, type Executor, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, Locator, type OperationRequest, PermissionGrant, PermissionRequest, ProxyFetchRequest, 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, relayWorker, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,46 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as L,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as X } from "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as ne } from "./
|
|
13
|
-
import { t as re } from "./
|
|
14
|
-
import { t as ie } from "./
|
|
15
|
-
import {
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { A as t, B as n, D as r, E as i, F as a, H as o, I as s, L as c, M as ee, O as l, P as u, R as d, S as f, T as p, V as m, _ as h, a as g, b as _, c as v, d as y, g as b, h as x, i as S, j as C, k as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as M, u as N, v as P, w as F, x as I, y as te, z as L } from "./lib-CegQxwDI.js";
|
|
3
|
+
import { i as R, t as z } from "./api-DQ-V4Lls.js";
|
|
4
|
+
import { a as B, i as V, n as H } from "./cloud-C8CeqUht.js";
|
|
5
|
+
import { t as U } from "./dns.js";
|
|
6
|
+
import { s as W } from "./net-BbmQeMpt.js";
|
|
7
|
+
import { i as G } from "./dgram-DlGl_ho1.js";
|
|
8
|
+
import { t as K } from "./http.js";
|
|
9
|
+
import { i as q, n as J, r as Y, t as X } from "./extension-DVO10P3i.js";
|
|
10
|
+
import { t as Z } from "./desktop.js";
|
|
11
|
+
import { u as Q } from "./fs-BW5mVMmu.js";
|
|
12
|
+
import { t as ne } from "./opfs.js";
|
|
13
|
+
import { t as re } from "./packages.js";
|
|
14
|
+
import { t as ie } from "./account.js";
|
|
15
|
+
import { t as ae } from "./connect-button-Ds9KpXHe.js";
|
|
16
|
+
import { relay as oe } from "osra";
|
|
16
17
|
//#region src/lib/frame.ts
|
|
17
|
-
var
|
|
18
|
-
if (
|
|
19
|
-
let t, n = setTimeout(() => r(
|
|
18
|
+
var se = 1e4, ce = 150, le = () => new Promise((e) => {
|
|
19
|
+
if (u()) return e(!0);
|
|
20
|
+
let t, n = setTimeout(() => r(u()), se), r = (r) => {
|
|
20
21
|
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
|
|
21
22
|
}, i = () => {
|
|
22
|
-
clearTimeout(t), t = setTimeout(() => r(
|
|
23
|
+
clearTimeout(t), t = setTimeout(() => r(u()), ce);
|
|
23
24
|
}, a = new MutationObserver(() => {
|
|
24
|
-
|
|
25
|
+
u() && r(!0);
|
|
25
26
|
}), o = () => {
|
|
26
|
-
document.readyState === "complete" && !
|
|
27
|
+
document.readyState === "complete" && !u() && i();
|
|
27
28
|
};
|
|
28
29
|
a.observe(document.documentElement, {
|
|
29
30
|
attributes: !0,
|
|
30
31
|
attributeFilter: ["data-fkn-extension"]
|
|
31
32
|
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
32
|
-
}),
|
|
33
|
+
}), ue = async (e) => Y() || e.lockdown || !B() || await le() ? A(e) : V(e), de = "https://fkn.app", fe = async (e, t) => {
|
|
33
34
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
34
|
-
let n = await
|
|
35
|
+
let n = await R;
|
|
35
36
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
36
|
-
|
|
37
|
+
oe(n, e, {
|
|
37
38
|
key: "fkn-api",
|
|
38
39
|
...n.emit instanceof MessagePort ? {} : {
|
|
39
|
-
originA: t?.originA ??
|
|
40
|
+
originA: t?.originA ?? de,
|
|
40
41
|
originB: t?.originB ?? "*"
|
|
41
42
|
},
|
|
42
43
|
unregisterSignal: t?.unregisterSignal
|
|
43
44
|
});
|
|
44
|
-
},
|
|
45
|
+
}, pe = async () => typeof window > "u" ? !1 : (await z).connect.prompt(location.origin).catch(() => !1), $ = async () => typeof window > "u" ? null : (await z).relay.prompt().catch(() => null), me = /* @__PURE__ */ e({
|
|
46
|
+
applyUpdate: () => _e,
|
|
47
|
+
onUpdate: () => ge,
|
|
48
|
+
updateReady: () => he
|
|
49
|
+
}), he = async () => typeof window > "u" ? !1 : z.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), ge = async (e) => {
|
|
50
|
+
if (typeof window > "u") return () => {};
|
|
51
|
+
let t = await z.catch(() => null);
|
|
52
|
+
if (!t || typeof t.shell?.onUpdate != "function") return () => {};
|
|
53
|
+
let n = await t.shell.onUpdate(e).catch(() => null);
|
|
54
|
+
return typeof n == "function" ? n : () => {};
|
|
55
|
+
}, _e = async () => typeof window > "u" ? !1 : z.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
45
56
|
//#endregion
|
|
46
|
-
export {
|
|
57
|
+
export { D as ATTACH_FRAME_EVENT_KEY, w as FORGEABLE_HEADERS, b as LOCATOR_DENIED, N as LOCATOR_ERROR, x as LOCATOR_UNSUPPORTED, ie as account, j as assertAttachableFrameUrl, f as assertFetchableUrl, t as assertForgeableHeaders, v as assertLockdownApplicable, C as assertOneCookieIdentity, ue as attachFrame, S as attachFramePermission, d as box, H as cloud, pe as connect, ae as connectButtonUrl, _ as cookies, g as createFrame, L as createVideoElementHandle, Z as desktop, G as dgram, U as dns, X as extension, J as fetch, F as fetchCredentialedPermission, p as fetchLocalPermission, i as fetchPermission, Q as fs, O as gotoPermission, c as handleRevivableModules, ee as hasForgedCookie, K as http, r as isBlockedFetchUrl, T as isBlockedFrameUrl, u as isExtensionExposed, l as isLocalNetworkUrl, y as isLocatorDenied, E as isLocatorUnsupported, k as isTerminalError, n as isType, h as modifyRequestHeadersPermission, W as net, ne as opfs, re as packages, M as permissions, q as promptInstall, $ as promptRelay, I as readCookiePermission, fe as relayWorker, P as removeRequestHeaderRule, m as revive, a as setMissingExtensionHandler, te as setRequestHeaderRule, me as shell, o as type, s as waitForExtensionExposure };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as TcpSocketOption, r as LocalTcpSocket, t as Resolvers } from "./api-
|
|
1
|
+
import { i as TcpSocketOption, r as LocalTcpSocket, t as Resolvers } from "./api-DnO1DsJC.js";
|
|
2
2
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
3
3
|
import { DuplexOptions, Stream } from "stream";
|
|
4
4
|
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-l7JVHsIR.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-kHMHDGar.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}});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { t } from "./api-DQ-V4Lls.js";
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/api/storage.ts
|
|
5
|
+
var n = "FKN_STORAGE_NOT_FOUND", r = /* @__PURE__ */ e({
|
|
6
|
+
StorageLockedError: () => i,
|
|
7
|
+
StorageNotFoundError: () => a,
|
|
8
|
+
availability: () => p,
|
|
9
|
+
available: () => c,
|
|
10
|
+
encryption: () => y,
|
|
11
|
+
isNotFound: () => o,
|
|
12
|
+
list: () => m,
|
|
13
|
+
quota: () => h,
|
|
14
|
+
readFile: () => g,
|
|
15
|
+
remove: () => v,
|
|
16
|
+
unlock: () => b,
|
|
17
|
+
writeFile: () => _
|
|
18
|
+
}), i = class extends Error {
|
|
19
|
+
code = "FKN_E2E_LOCKED";
|
|
20
|
+
constructor() {
|
|
21
|
+
super("storage locked: this account stores encrypted data, unlock it from the FKN card or unlock()");
|
|
22
|
+
}
|
|
23
|
+
}, a = class extends Error {
|
|
24
|
+
code = n;
|
|
25
|
+
constructor(e = "storage: no object at that path") {
|
|
26
|
+
super(e);
|
|
27
|
+
}
|
|
28
|
+
}, o = (e) => e?.code === n, s = (e) => {
|
|
29
|
+
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;
|
|
30
|
+
}, c = () => t.then((e) => e.cloud.fs.available()).catch(() => !1), l = 8e3, u = 1e3, d = !1, f = async () => {
|
|
31
|
+
let e = (await t).cloud.fs;
|
|
32
|
+
return typeof e.availability == "function" ? e.availability() : await e.available() ? "connected" : "disconnected";
|
|
33
|
+
}, p = async () => {
|
|
34
|
+
let e = d ? u : l, t = await new Promise((t) => {
|
|
35
|
+
let n = setTimeout(() => t("timeout"), e);
|
|
36
|
+
f().then((e) => {
|
|
37
|
+
clearTimeout(n), t(e);
|
|
38
|
+
}, () => {
|
|
39
|
+
clearTimeout(n), t("unknown");
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return t === "timeout" ? (d = !0, "unknown") : (d = !1, t);
|
|
43
|
+
}, m = () => t.then((e) => e.cloud.fs.list()), h = () => t.then((e) => e.cloud.fs.quota()), g = async (e) => {
|
|
44
|
+
let n = await (await t).cloud.fs.readFile(e).catch(s);
|
|
45
|
+
return new Blob([n]);
|
|
46
|
+
}, _ = async (e, n, r) => {
|
|
47
|
+
let i = await t, a = n instanceof Blob ? new Uint8Array(await n.arrayBuffer()) : n;
|
|
48
|
+
await i.cloud.fs.writeFile(e, a, r?.contentType ?? null).catch(s);
|
|
49
|
+
}, v = (e) => t.then((t) => t.cloud.fs.remove(e)).then(() => void 0), y = () => t.then((e) => e.cloud.fs.encryption()), b = () => t.then((e) => e.cloud.fs.unlock());
|
|
50
|
+
//#endregion
|
|
51
|
+
export { o as a, g as c, b as d, _ as f, y as i, v as l, a as n, m as o, n as p, p as r, h as s, i as t, r as u };
|
|
@@ -0,0 +1,44 @@
|
|
|
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/fs-Br0pOpNu.js
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./node-fs-DKfokOlh.js";
|
|
3
|
-
import { c as n, f as r, l as i, o as a, r as o } from "./storage-B1stLxSc.js";
|
|
4
|
-
import { a as s, i as c, n as l, o as u, t as d } from "./opfs-BibrNGF0.js";
|
|
5
|
-
//#region src/lib/fs/hybrid.ts
|
|
6
|
-
var f = /* @__PURE__ */ e({
|
|
7
|
-
adopt: () => F,
|
|
8
|
-
adoptable: () => I,
|
|
9
|
-
available: () => te,
|
|
10
|
-
list: () => ie,
|
|
11
|
-
onConflict: () => N,
|
|
12
|
-
pending: () => D,
|
|
13
|
-
pendingDeletes: () => O,
|
|
14
|
-
pull: () => ce,
|
|
15
|
-
readFile: () => ae,
|
|
16
|
-
remove: () => se,
|
|
17
|
-
replicating: () => k,
|
|
18
|
-
writeFile: () => oe
|
|
19
|
-
}), ee, p = async () => await (ee ??= d().catch(() => !1)) ? !0 : (ee = void 0, !1), m = () => o().catch(() => !1), te = async () => await p() || await m(), h = "fkn:fs:pending", g = "fkn:fs:pending-delete", _ = "fkn:fs:adopt-declined", v = !0, y = /* @__PURE__ */ new Map(), b = (e) => {
|
|
20
|
-
try {
|
|
21
|
-
let t = localStorage.getItem(e);
|
|
22
|
-
if (!t) return {};
|
|
23
|
-
let n = JSON.parse(t);
|
|
24
|
-
return Array.isArray(n) ? Object.fromEntries(n.filter((e) => typeof e == "string").map((e) => [e, null])) : n && typeof n == "object" ? n : {};
|
|
25
|
-
} catch {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
28
|
-
}, x = (e, t) => {
|
|
29
|
-
try {
|
|
30
|
-
Object.keys(t).length ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
|
|
31
|
-
} catch {}
|
|
32
|
-
}, S = () => b(h), C = (e) => {
|
|
33
|
-
let t = S();
|
|
34
|
-
e in t || (t[e] = y.get(e) ?? null, x(h, t));
|
|
35
|
-
}, w = (e) => {
|
|
36
|
-
let t = S();
|
|
37
|
-
e in t && (delete t[e], x(h, t));
|
|
38
|
-
}, T = () => b(g), ne = (e) => {
|
|
39
|
-
let t = T();
|
|
40
|
-
e in t || (t[e] = y.get(e) ?? null, x(g, t));
|
|
41
|
-
}, E = (e) => {
|
|
42
|
-
let t = T();
|
|
43
|
-
e in t && (delete t[e], x(g, t));
|
|
44
|
-
}, D = () => Object.keys(S()), O = () => Object.keys(T()), k = () => v, A = null, re = null, j = () => re ??= import("./api-DQ-V4Lls.js").then((e) => e.n).then((e) => e.apiPromise), ie = async () => {
|
|
45
|
-
me();
|
|
46
|
-
let e = await m(), [t, n] = await Promise.all([p().then((e) => e ? l() : []).catch(() => []), e ? a().then((e) => ({
|
|
47
|
-
ok: !0,
|
|
48
|
-
entries: e
|
|
49
|
-
})).catch(() => ({
|
|
50
|
-
ok: !1,
|
|
51
|
-
entries: []
|
|
52
|
-
})) : Promise.resolve({
|
|
53
|
-
ok: !0,
|
|
54
|
-
entries: []
|
|
55
|
-
})]);
|
|
56
|
-
v = n.ok, n.ok && (y = new Map(n.entries.map((e) => [e.path, e.updatedAt])));
|
|
57
|
-
let r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
58
|
-
let t = Date.parse(e.updatedAt ?? "");
|
|
59
|
-
return Number.isFinite(t) ? t : 0;
|
|
60
|
-
}, o = (e) => {
|
|
61
|
-
let t = r.get(e.path);
|
|
62
|
-
(!t || i(e) >= i(t)) && r.set(e.path, e);
|
|
63
|
-
};
|
|
64
|
-
for (let e of t) o(e);
|
|
65
|
-
for (let e of n.entries) o(e);
|
|
66
|
-
if (n.ok && e) {
|
|
67
|
-
pe(t, n.entries).catch(() => {});
|
|
68
|
-
let e = Object.keys(S()).length || Object.keys(T()).length;
|
|
69
|
-
e && !A ? A = P(!1).catch(() => {}).finally(() => {
|
|
70
|
-
A = null;
|
|
71
|
-
}) : e || R({
|
|
72
|
-
local: t,
|
|
73
|
-
remote: n.entries
|
|
74
|
-
}).catch(() => {});
|
|
75
|
-
}
|
|
76
|
-
return [...r.values()];
|
|
77
|
-
}, ae = async (e) => {
|
|
78
|
-
if (await p()) try {
|
|
79
|
-
return await c(e);
|
|
80
|
-
} catch (e) {
|
|
81
|
-
if (e?.name !== "NotFoundError") throw e;
|
|
82
|
-
}
|
|
83
|
-
let t = await n(e);
|
|
84
|
-
return await p() && u(e, t).catch(() => {}), t;
|
|
85
|
-
}, oe = async (e, t, n) => {
|
|
86
|
-
let i = t instanceof Blob ? t : new Blob([t], n?.contentType ? { type: n.contentType } : void 0);
|
|
87
|
-
if (await p()) {
|
|
88
|
-
if (await u(e, i, n), !await m()) return;
|
|
89
|
-
if (!v) {
|
|
90
|
-
C(e);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
r(e, i, n).then(() => w(e)).catch((t) => {
|
|
94
|
-
C(e), console.warn("fs: cloud replicate failed, queued for adopt()", t);
|
|
95
|
-
});
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (await m()) return r(e, i, n);
|
|
99
|
-
throw Error("fs: no storage backend available");
|
|
100
|
-
}, se = async (e) => {
|
|
101
|
-
let t = [];
|
|
102
|
-
await p() && t.push(s(e).catch(() => {}));
|
|
103
|
-
let n = await m();
|
|
104
|
-
if (n && t.push(i(e).then(() => E(e)).catch((t) => {
|
|
105
|
-
ne(e), console.warn("fs: cloud delete failed, queued for retry", t);
|
|
106
|
-
})), !t.length) throw Error("fs: no storage backend available");
|
|
107
|
-
n && w(e), await Promise.all(t);
|
|
108
|
-
}, ce = async (e) => {
|
|
109
|
-
let t = await n(e);
|
|
110
|
-
return await p() && await u(e, t), t;
|
|
111
|
-
}, M = null, N = (e) => (M = e, () => {
|
|
112
|
-
M === e && (M = null);
|
|
113
|
-
}), le = async (e) => (await j()).cloud.fs.promptConflict({
|
|
114
|
-
path: e.path,
|
|
115
|
-
local: e.local,
|
|
116
|
-
cloud: e.cloud
|
|
117
|
-
}).catch(() => null), ue = async (e) => {
|
|
118
|
-
if (M) try {
|
|
119
|
-
return await M(e);
|
|
120
|
-
} catch {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
return le(e);
|
|
124
|
-
}, P = async (e) => {
|
|
125
|
-
let t = {
|
|
126
|
-
uploaded: [],
|
|
127
|
-
kept: [],
|
|
128
|
-
resolved: [],
|
|
129
|
-
unresolved: [],
|
|
130
|
-
deleted: [],
|
|
131
|
-
failed: []
|
|
132
|
-
};
|
|
133
|
-
if (!await m()) throw Error("fs: this needs a signed-in account");
|
|
134
|
-
if (!await p()) return t;
|
|
135
|
-
let [o, s] = await Promise.all([l(), a()]), d = new Map(s.map((e) => [e.path, e])), f = S();
|
|
136
|
-
for (let [e, n] of Object.entries(T())) {
|
|
137
|
-
let r = d.get(e);
|
|
138
|
-
if (!r) {
|
|
139
|
-
E(e);
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
if (o.some((t) => t.path === e)) {
|
|
143
|
-
E(e);
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
if (r.updatedAt !== n) {
|
|
147
|
-
E(e);
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
await i(e), E(e), t.deleted.push(e);
|
|
152
|
-
} catch (n) {
|
|
153
|
-
t.failed.push({
|
|
154
|
-
path: e,
|
|
155
|
-
error: n instanceof Error ? n.message : String(n)
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
for (let i of o) {
|
|
160
|
-
let a = d.get(i.path), o = i.path in f;
|
|
161
|
-
if (!o && (a || !e)) {
|
|
162
|
-
a && t.kept.push(i.path);
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (o && a && a.updatedAt !== f[i.path]) {
|
|
166
|
-
let e = await ue({
|
|
167
|
-
path: i.path,
|
|
168
|
-
local: {
|
|
169
|
-
size: i.size,
|
|
170
|
-
updatedAt: i.updatedAt
|
|
171
|
-
},
|
|
172
|
-
cloud: {
|
|
173
|
-
size: a.size,
|
|
174
|
-
updatedAt: a.updatedAt
|
|
175
|
-
},
|
|
176
|
-
readLocal: () => c(i.path),
|
|
177
|
-
readCloud: () => n(i.path)
|
|
178
|
-
});
|
|
179
|
-
if (!e) {
|
|
180
|
-
t.unresolved.push(i.path);
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
try {
|
|
184
|
-
if (e === "cloud") await u(i.path, await n(i.path));
|
|
185
|
-
else {
|
|
186
|
-
let t = e === "local" ? await c(i.path) : e.merged;
|
|
187
|
-
await r(i.path, t, i.contentType ? { contentType: i.contentType } : void 0), e !== "local" && await u(i.path, t);
|
|
188
|
-
}
|
|
189
|
-
w(i.path), t.resolved.push({
|
|
190
|
-
path: i.path,
|
|
191
|
-
choice: e === "local" || e === "cloud" ? e : "merged"
|
|
192
|
-
});
|
|
193
|
-
} catch (e) {
|
|
194
|
-
if (e?.code === "FKN_E2E_LOCKED") throw e;
|
|
195
|
-
t.failed.push({
|
|
196
|
-
path: i.path,
|
|
197
|
-
error: e instanceof Error ? e.message : String(e)
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
let e = await c(i.path);
|
|
204
|
-
await r(i.path, e, i.contentType ? { contentType: i.contentType } : void 0), w(i.path), t.uploaded.push(i.path);
|
|
205
|
-
} catch (e) {
|
|
206
|
-
if (C(i.path), e?.code === "FKN_E2E_LOCKED") throw e;
|
|
207
|
-
t.failed.push({
|
|
208
|
-
path: i.path,
|
|
209
|
-
error: e instanceof Error ? e.message : String(e)
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return t;
|
|
214
|
-
}, F = () => P(!0), I = async () => {
|
|
215
|
-
if (!await m() || !await p()) return {
|
|
216
|
-
paths: [],
|
|
217
|
-
bytes: 0
|
|
218
|
-
};
|
|
219
|
-
let [e, t] = await Promise.all([l(), a()]), n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path));
|
|
220
|
-
return {
|
|
221
|
-
paths: r.map((e) => e.path),
|
|
222
|
-
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
223
|
-
};
|
|
224
|
-
}, de = () => new Set(Object.keys(b(_))), fe = (e) => {
|
|
225
|
-
let t = b(_);
|
|
226
|
-
for (let n of e) t[n] = null;
|
|
227
|
-
x(_, t);
|
|
228
|
-
}, L = null, R = (e) => L || (L = (async () => {
|
|
229
|
-
if (!await m()) return;
|
|
230
|
-
let t = e ?? (await p() ? {
|
|
231
|
-
local: await l(),
|
|
232
|
-
remote: await a()
|
|
233
|
-
} : null);
|
|
234
|
-
if (!t) return;
|
|
235
|
-
let n = new Set(t.remote.map((e) => e.path)), r = de(), i = t.local.filter((e) => !n.has(e.path) && !r.has(e.path));
|
|
236
|
-
if (!i.length) return;
|
|
237
|
-
let o = await j(), s = i.reduce((e, t) => e + t.size, 0);
|
|
238
|
-
if (!await o.cloud.fs.promptAdopt({
|
|
239
|
-
files: i.length,
|
|
240
|
-
bytes: s
|
|
241
|
-
}).catch(() => !1)) {
|
|
242
|
-
fe(i.map((e) => e.path));
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
await F();
|
|
246
|
-
})().catch(() => {}).finally(() => {
|
|
247
|
-
L = null;
|
|
248
|
-
}), L), pe = async (e, t) => {
|
|
249
|
-
let n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path)), i = await j(), a = async () => {
|
|
250
|
-
await F().catch(() => {});
|
|
251
|
-
let e = await I().catch(() => ({
|
|
252
|
-
paths: [],
|
|
253
|
-
bytes: 0
|
|
254
|
-
}));
|
|
255
|
-
await i.cloud.fs.setAdoptSource({
|
|
256
|
-
files: e.paths.length,
|
|
257
|
-
bytes: e.bytes
|
|
258
|
-
}, a).catch(() => {});
|
|
259
|
-
};
|
|
260
|
-
await i.cloud.fs.setAdoptSource({
|
|
261
|
-
files: r.length,
|
|
262
|
-
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
263
|
-
}, a);
|
|
264
|
-
}, z = !1, me = () => {
|
|
265
|
-
z || typeof window > "u" || (z = !0, import("./account.js").then((e) => e.onChange(() => {
|
|
266
|
-
R().catch(() => {});
|
|
267
|
-
})).catch(() => {}));
|
|
268
|
-
}, he = /* @__PURE__ */ e({
|
|
269
|
-
adopt: () => J,
|
|
270
|
-
adoptable: () => Y,
|
|
271
|
-
appendFile: () => Ee,
|
|
272
|
-
appendFileSync: () => W,
|
|
273
|
-
available: () => V,
|
|
274
|
-
default: () => Le,
|
|
275
|
-
exists: () => Ne,
|
|
276
|
-
existsSync: () => G,
|
|
277
|
-
flush: () => Fe,
|
|
278
|
-
lstatSync: () => _e,
|
|
279
|
-
mkdir: () => ke,
|
|
280
|
-
mkdirSync: () => ye,
|
|
281
|
-
mount: () => K,
|
|
282
|
-
onConflict: () => $,
|
|
283
|
-
pending: () => X,
|
|
284
|
-
pendingDeletes: () => Z,
|
|
285
|
-
promises: () => Pe,
|
|
286
|
-
pull: () => q,
|
|
287
|
-
readFile: () => we,
|
|
288
|
-
readFileSync: () => H,
|
|
289
|
-
readdir: () => Oe,
|
|
290
|
-
readdirSync: () => ve,
|
|
291
|
-
remount: () => Ie,
|
|
292
|
-
rename: () => Me,
|
|
293
|
-
renameSync: () => Ce,
|
|
294
|
-
replicating: () => Q,
|
|
295
|
-
rm: () => Ae,
|
|
296
|
-
rmSync: () => be,
|
|
297
|
-
rmdirSync: () => xe,
|
|
298
|
-
stat: () => De,
|
|
299
|
-
statSync: () => ge,
|
|
300
|
-
unlink: () => je,
|
|
301
|
-
unlinkSync: () => Se,
|
|
302
|
-
writeFile: () => Te,
|
|
303
|
-
writeFileSync: () => U
|
|
304
|
-
}), B = t(f, { memfs: !0 }), { available: V, readFileSync: H, writeFileSync: U, appendFileSync: W, existsSync: G, statSync: ge, lstatSync: _e, readdirSync: ve, mkdirSync: ye, rmSync: be, rmdirSync: xe, unlinkSync: Se, renameSync: Ce, readFile: we, writeFile: Te, appendFile: Ee, stat: De, readdir: Oe, mkdir: ke, rm: Ae, unlink: je, rename: Me, exists: Ne, promises: Pe, mount: K, flush: Fe, remount: Ie } = B, q = ce, J = F, Y = I, X = D, Z = O, Q = k, $ = N, Le = {
|
|
305
|
-
...B,
|
|
306
|
-
pull: q,
|
|
307
|
-
adopt: J,
|
|
308
|
-
adoptable: Y,
|
|
309
|
-
pending: X,
|
|
310
|
-
pendingDeletes: Z,
|
|
311
|
-
replicating: Q,
|
|
312
|
-
onConflict: $
|
|
313
|
-
};
|
|
314
|
-
//#endregion
|
|
315
|
-
export { xe as A, ve as C, Q as D, Ce as E, Te as F, U as I, ge as M, je as N, Ae as O, Se as P, Oe as S, Me as T, Z as _, V as a, we as b, Fe as c, _e as d, ke as f, X as g, $ as h, W as i, De as j, be as k, Le as l, K as m, Y as n, Ne as o, ye as p, Ee as r, G as s, J as t, he as u, Pe as v, Ie as w, H as x, q as y };
|
package/fs-fyR-J9up.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./node-fs-BMR2yCEt.cjs"),n=require("./storage-BNQlgGqF.cjs"),r=require("./opfs-CXMESVLc.cjs");var i=e.t({adopt:()=>E,adoptable:()=>D,available:()=>c,list:()=>ie,onConflict:()=>le,pending:()=>te,pendingDeletes:()=>ne,pull:()=>ce,readFile:()=>ae,remove:()=>se,replicating:()=>x,writeFile:()=>oe}),a,o=async()=>await(a??=r.t().catch(()=>!1))?!0:(a=void 0,!1),s=()=>n.r().catch(()=>!1),c=async()=>await o()||await s(),l=`fkn:fs:pending`,u=`fkn:fs:pending-delete`,d=`fkn:fs:adopt-declined`,f=!0,p=new Map,m=e=>{try{let t=localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return Array.isArray(n)?Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,null])):n&&typeof n==`object`?n:{}}catch{return{}}},h=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}catch{}},g=()=>m(l),_=e=>{let t=g();e in t||(t[e]=p.get(e)??null,h(l,t))},v=e=>{let t=g();e in t&&(delete t[e],h(l,t))},y=()=>m(u),ee=e=>{let t=y();e in t||(t[e]=p.get(e)??null,h(u,t))},b=e=>{let t=y();e in t&&(delete t[e],h(u,t))},te=()=>Object.keys(g()),ne=()=>Object.keys(y()),x=()=>f,S=null,re=null,C=()=>re??=Promise.resolve().then(()=>require("./api-kHMHDGar.cjs")).then(e=>e.n).then(e=>e.apiPromise),ie=async()=>{he();let e=await s(),[t,i]=await Promise.all([o().then(e=>e?r.n():[]).catch(()=>[]),e?n.o().then(e=>({ok:!0,entries:e})).catch(()=>({ok:!1,entries:[]})):Promise.resolve({ok:!0,entries:[]})]);f=i.ok,i.ok&&(p=new Map(i.entries.map(e=>[e.path,e.updatedAt])));let a=new Map,c=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},l=e=>{let t=a.get(e.path);(!t||c(e)>=c(t))&&a.set(e.path,e)};for(let e of t)l(e);for(let e of i.entries)l(e);if(i.ok&&e){me(t,i.entries).catch(()=>{});let e=Object.keys(g()).length||Object.keys(y()).length;e&&!S?S=T(!1).catch(()=>{}).finally(()=>{S=null}):e||k({local:t,remote:i.entries}).catch(()=>{})}return[...a.values()]},ae=async e=>{if(await o())try{return await r.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let t=await n.c(e);return await o()&&r.o(e,t).catch(()=>{}),t},oe=async(e,t,i)=>{let a=t instanceof Blob?t:new Blob([t],i?.contentType?{type:i.contentType}:void 0);if(await o()){if(await r.o(e,a,i),!await s())return;if(!f){_(e);return}n.f(e,a,i).then(()=>v(e)).catch(t=>{_(e),console.warn(`fs: cloud replicate failed, queued for adopt()`,t)});return}if(await s())return n.f(e,a,i);throw Error(`fs: no storage backend available`)},se=async e=>{let t=[];await o()&&t.push(r.a(e).catch(()=>{}));let i=await s();if(i&&t.push(n.l(e).then(()=>b(e)).catch(t=>{ee(e),console.warn(`fs: cloud delete failed, queued for retry`,t)})),!t.length)throw Error(`fs: no storage backend available`);i&&v(e),await Promise.all(t)},ce=async e=>{let t=await n.c(e);return await o()&&await r.o(e,t),t},w=null,le=e=>(w=e,()=>{w===e&&(w=null)}),ue=async e=>(await C()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null),de=async e=>{if(w)try{return await w(e)}catch{return null}return ue(e)},T=async e=>{let t={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]};if(!await s())throw Error(`fs: this needs a signed-in account`);if(!await o())return t;let[i,a]=await Promise.all([r.n(),n.o()]),c=new Map(a.map(e=>[e.path,e])),l=g();for(let[e,r]of Object.entries(y())){let a=c.get(e);if(!a){b(e);continue}if(i.some(t=>t.path===e)){b(e);continue}if(a.updatedAt!==r){b(e);continue}try{await n.l(e),b(e),t.deleted.push(e)}catch(n){t.failed.push({path:e,error:n instanceof Error?n.message:String(n)})}}for(let a of i){let i=c.get(a.path),o=a.path in l;if(!o&&(i||!e)){i&&t.kept.push(a.path);continue}if(o&&i&&i.updatedAt!==l[a.path]){let e=await de({path:a.path,local:{size:a.size,updatedAt:a.updatedAt},cloud:{size:i.size,updatedAt:i.updatedAt},readLocal:()=>r.i(a.path),readCloud:()=>n.c(a.path)});if(!e){t.unresolved.push(a.path);continue}try{if(e===`cloud`)await r.o(a.path,await n.c(a.path));else{let t=e===`local`?await r.i(a.path):e.merged;await n.f(a.path,t,a.contentType?{contentType:a.contentType}:void 0),e!==`local`&&await r.o(a.path,t)}v(a.path),t.resolved.push({path:a.path,choice:e===`local`||e===`cloud`?e:`merged`})}catch(e){if(e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:a.path,error:e instanceof Error?e.message:String(e)})}continue}try{let e=await r.i(a.path);await n.f(a.path,e,a.contentType?{contentType:a.contentType}:void 0),v(a.path),t.uploaded.push(a.path)}catch(e){if(_(a.path),e?.code===`FKN_E2E_LOCKED`)throw e;t.failed.push({path:a.path,error:e instanceof Error?e.message:String(e)})}}return t},E=()=>T(!0),D=async()=>{if(!await s()||!await o())return{paths:[],bytes:0};let[e,t]=await Promise.all([r.n(),n.o()]),i=new Set(t.map(e=>e.path)),a=e.filter(e=>!i.has(e.path));return{paths:a.map(e=>e.path),bytes:a.reduce((e,t)=>e+t.size,0)}},fe=()=>new Set(Object.keys(m(d))),pe=e=>{let t=m(d);for(let n of e)t[n]=null;h(d,t)},O=null,k=e=>O||(O=(async()=>{if(!await s())return;let t=e??(await o()?{local:await r.n(),remote:await n.o()}:null);if(!t)return;let i=new Set(t.remote.map(e=>e.path)),a=fe(),c=t.local.filter(e=>!i.has(e.path)&&!a.has(e.path));if(!c.length)return;let l=await C(),u=c.reduce((e,t)=>e+t.size,0);if(!await l.cloud.fs.promptAdopt({files:c.length,bytes:u}).catch(()=>!1)){pe(c.map(e=>e.path));return}await E()})().catch(()=>{}).finally(()=>{O=null}),O),me=async(e,t)=>{let n=new Set(t.map(e=>e.path)),r=e.filter(e=>!n.has(e.path)),i=await C(),a=async()=>{await E().catch(()=>{});let e=await D().catch(()=>({paths:[],bytes:0}));await i.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},a).catch(()=>{})};await i.cloud.fs.setAdoptSource({files:r.length,bytes:r.reduce((e,t)=>e+t.size,0)},a)},A=!1,he=()=>{A||typeof window>`u`||(A=!0,Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{k().catch(()=>{})})).catch(()=>{}))},ge=e.t({adopt:()=>q,adoptable:()=>J,appendFile:()=>ye,appendFileSync:()=>F,available:()=>M,default:()=>$,exists:()=>Ee,existsSync:()=>I,flush:()=>G,lstatSync:()=>R,mkdir:()=>Se,mkdirSync:()=>B,mount:()=>Oe,onConflict:()=>Q,pending:()=>Y,pendingDeletes:()=>X,promises:()=>De,pull:()=>K,readFile:()=>W,readFileSync:()=>N,readdir:()=>xe,readdirSync:()=>z,remount:()=>ke,rename:()=>Te,renameSync:()=>U,replicating:()=>Z,rm:()=>Ce,rmSync:()=>V,rmdirSync:()=>_e,stat:()=>be,statSync:()=>L,unlink:()=>we,unlinkSync:()=>H,writeFile:()=>ve,writeFileSync:()=>P}),j=t.t(i,{memfs:!0}),{available:M,readFileSync:N,writeFileSync:P,appendFileSync:F,existsSync:I,statSync:L,lstatSync:R,readdirSync:z,mkdirSync:B,rmSync:V,rmdirSync:_e,unlinkSync:H,renameSync:U,readFile:W,writeFile:ve,appendFile:ye,stat:be,readdir:xe,mkdir:Se,rm:Ce,unlink:we,rename:Te,exists:Ee,promises:De,mount:Oe,flush:G,remount:ke}=j,K=ce,q=E,J=D,Y=te,X=ne,Z=x,Q=le,$={...j,pull:K,adopt:q,adoptable:J,pending:Y,pendingDeletes:X,replicating:Z,onConflict:Q};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return K}});
|
package/storage-B1stLxSc.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./api-DQ-V4Lls.js";
|
|
3
|
-
//#endregion
|
|
4
|
-
//#region src/api/storage.ts
|
|
5
|
-
var n = "FKN_STORAGE_NOT_FOUND", r = /* @__PURE__ */ e({
|
|
6
|
-
StorageLockedError: () => i,
|
|
7
|
-
StorageNotFoundError: () => a,
|
|
8
|
-
available: () => c,
|
|
9
|
-
encryption: () => m,
|
|
10
|
-
isNotFound: () => o,
|
|
11
|
-
list: () => l,
|
|
12
|
-
quota: () => u,
|
|
13
|
-
readFile: () => d,
|
|
14
|
-
remove: () => p,
|
|
15
|
-
unlock: () => h,
|
|
16
|
-
writeFile: () => f
|
|
17
|
-
}), i = class extends Error {
|
|
18
|
-
code = "FKN_E2E_LOCKED";
|
|
19
|
-
constructor() {
|
|
20
|
-
super("storage locked: this app stores encrypted data, unlock it from the FKN card or unlock()");
|
|
21
|
-
}
|
|
22
|
-
}, a = class extends Error {
|
|
23
|
-
code = n;
|
|
24
|
-
constructor(e = "storage: no object at that path") {
|
|
25
|
-
super(e);
|
|
26
|
-
}
|
|
27
|
-
}, o = (e) => e?.code === n, s = (e) => {
|
|
28
|
-
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;
|
|
29
|
-
}, c = () => t.then((e) => e.cloud.fs.available()).catch(() => !1), l = () => t.then((e) => e.cloud.fs.list()), u = () => t.then((e) => e.cloud.fs.quota()), d = async (e) => {
|
|
30
|
-
let n = await (await t).cloud.fs.readFile(e).catch(s);
|
|
31
|
-
return new Blob([n]);
|
|
32
|
-
}, f = async (e, n, r) => {
|
|
33
|
-
let i = await t, a = n instanceof Blob ? new Uint8Array(await n.arrayBuffer()) : n;
|
|
34
|
-
await i.cloud.fs.writeFile(e, a, r?.contentType ?? null).catch(s);
|
|
35
|
-
}, p = (e) => t.then((t) => t.cloud.fs.remove(e)).then(() => void 0), m = () => t.then((e) => e.cloud.fs.encryption()), h = () => t.then((e) => e.cloud.fs.unlock());
|
|
36
|
-
//#endregion
|
|
37
|
-
export { o as a, d as c, h as d, f, m as i, p as l, a as n, l as o, n as p, c as r, u as s, i as t, r as u };
|
package/storage-BNQlgGqF.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-kHMHDGar.cjs");var n=`FKN_STORAGE_NOT_FOUND`,r=e.t({StorageLockedError:()=>i,StorageNotFoundError:()=>a,available:()=>c,encryption:()=>m,isNotFound:()=>o,list:()=>l,quota:()=>u,readFile:()=>d,remove:()=>p,unlock:()=>h,writeFile:()=>f}),i=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: this app 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=()=>t.t.then(e=>e.cloud.fs.list()),u=()=>t.t.then(e=>e.cloud.fs.quota()),d=async e=>{let n=await(await t.t).cloud.fs.readFile(e).catch(s);return new Blob([n])},f=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)},p=e=>t.t.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),m=()=>t.t.then(e=>e.cloud.fs.encryption()),h=()=>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 d}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}});
|
package/storage-CXIXrIxB.d.ts
DELETED
|
@@ -1,38 +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
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* "There is no object at this path", as a thing a caller can TEST rather than parse.
|
|
28
|
-
*
|
|
29
|
-
* osra strips an Error's custom properties across the realm boundary but keeps `message` and
|
|
30
|
-
* `code`, so a code set here survives all the way to an app. The message does not survive being
|
|
31
|
-
* reworded, which is the problem this exists to end: absence arrives in two completely different
|
|
32
|
-
* sentences depending on which half of the read failed, and every consumer was left regex-matching
|
|
33
|
-
* both. Ripple got one of them and missed the other, and a library quietly went un-backed-up for a
|
|
34
|
-
* day because a missing backup read as a transient error.
|
|
35
|
-
*/
|
|
36
|
-
declare const STORAGE_NOT_FOUND = "FKN_STORAGE_NOT_FOUND";
|
|
37
|
-
//#endregion
|
|
38
|
-
export { StorageReadResult as a, StorageQuota as i, STORAGE_NOT_FOUND as n, WriteData as o, StorageEntry as r, KeyState as t };
|