@fkn/lib 0.9.26 → 0.9.27
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-CesI0aMl.d.ts → api-Dv7Fy_CF.d.ts} +9 -1
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fs/promises.d.ts +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -2
- package/cloud/fs.js +20 -19
- package/cloud/net.d.ts +1 -1
- package/{cloud-B7pI3pp1.d.ts → cloud-ZRqclRzO.d.ts} +3 -3
- package/cloud.d.ts +4 -4
- package/{contract-D6ksmIm6.d.ts → contract-BergoFCw.d.ts} +12 -0
- package/contract.d.ts +1 -1
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +1 -1
- package/fs/promises.js +1 -1
- package/fs-CBVaShOR.d.ts +27 -0
- package/fs-Cvx2NT6o.js +360 -0
- package/fs-J5h3i5eg.cjs +1 -0
- package/fs.cjs +1 -1
- package/fs.d.ts +3 -2
- package/fs.js +2 -2
- package/http.d.ts +1 -1
- package/{index-CGJTVju4.d.ts → index-Cg6y_FTi.d.ts} +22 -6
- package/index.cjs +1 -1
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/{net-DAOcF3Eb.d.ts → net-C9Me0zVw.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-BubvP9sg.d.ts → proxy-DkuZfeI4.d.ts} +2 -2
- package/{storage-BjGr_vC4.js → storage-BL8vxHlW.js} +23 -7
- package/storage-Dr5F1jil.cjs +1 -0
- package/storage-WZEvw3KN.d.ts +69 -0
- package/fs-DYP7utdw.cjs +0 -1
- package/fs-DlGE0ZNu.d.ts +0 -73
- package/fs-d2ANVBkm.js +0 -347
- package/storage-DLB4ciMf.cjs +0 -1
package/fs-d2ANVBkm.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { r as t } from "./busy-B189uX--.js";
|
|
3
|
-
import { t as n } from "./node-fs-C9ECR_9H.js";
|
|
4
|
-
import { c as r, f as i, l as a, o, r as s } from "./storage-BjGr_vC4.js";
|
|
5
|
-
import { a as c, i as l, n as u, o as d, t as ee } from "./opfs-D0goLAQW.js";
|
|
6
|
-
//#region src/fs/hybrid.ts
|
|
7
|
-
var f = /* @__PURE__ */ e({
|
|
8
|
-
adopt: () => H,
|
|
9
|
-
adoptable: () => U,
|
|
10
|
-
available: () => te,
|
|
11
|
-
list: () => oe,
|
|
12
|
-
onConflict: () => B,
|
|
13
|
-
pending: () => k,
|
|
14
|
-
pendingDeletes: () => A,
|
|
15
|
-
pull: () => ue,
|
|
16
|
-
readFile: () => se,
|
|
17
|
-
remove: () => le,
|
|
18
|
-
replicating: () => re,
|
|
19
|
-
writeFile: () => ce
|
|
20
|
-
}), p, m = async () => await (p ??= ee().catch(() => !1)) ? !0 : (p = void 0, !1), h = () => s().catch(() => "unknown"), g = async () => await h() === "connected", te = async () => await m() || await g(), _ = "fkn:fs:pending", v = "fkn:fs:pending-delete", y = "fkn:fs:adopt-declined", b = !0, x = /* @__PURE__ */ new Map(), S = (e) => {
|
|
21
|
-
try {
|
|
22
|
-
let t = localStorage.getItem(e);
|
|
23
|
-
if (!t) return {};
|
|
24
|
-
let n = JSON.parse(t);
|
|
25
|
-
return Array.isArray(n) ? Object.fromEntries(n.filter((e) => typeof e == "string").map((e) => [e, null])) : n && typeof n == "object" ? n : {};
|
|
26
|
-
} catch {
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
}, C = (e, t) => {
|
|
30
|
-
try {
|
|
31
|
-
Object.keys(t).length ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
|
|
32
|
-
} catch {}
|
|
33
|
-
}, w = () => S(_), T = (e, t) => {
|
|
34
|
-
let n = w();
|
|
35
|
-
e in n || (n[e] = t === void 0 ? x.get(e) ?? null : t, C(_, n));
|
|
36
|
-
}, E = (e) => {
|
|
37
|
-
let t = w();
|
|
38
|
-
e in t && (delete t[e], C(_, t), M() || (P = N));
|
|
39
|
-
}, D = () => S(v), ne = (e) => {
|
|
40
|
-
let t = D();
|
|
41
|
-
e in t || (t[e] = x.get(e) ?? null, C(v, t));
|
|
42
|
-
}, O = (e) => {
|
|
43
|
-
let t = D();
|
|
44
|
-
e in t && (delete t[e], C(v, t), M() || (P = N));
|
|
45
|
-
}, k = () => Object.keys(w()), A = () => Object.keys(D()), re = () => b, j = null;
|
|
46
|
-
t("storage replication", () => j !== null || W !== null);
|
|
47
|
-
var M = () => Object.keys(w()).length > 0 || Object.keys(D()).length > 0, N = 6e4, ie = 6e5, P = N, F = null, I = () => {
|
|
48
|
-
F || typeof window > "u" || !M() || (F = setTimeout(() => {
|
|
49
|
-
F = null, L();
|
|
50
|
-
}, P), P = Math.min(P * 2, ie));
|
|
51
|
-
}, L = () => {
|
|
52
|
-
j || !M() || (j = V(!1).then((e) => {
|
|
53
|
-
if (!M()) {
|
|
54
|
-
P = N;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
e.failed.length && I();
|
|
58
|
-
}).catch(() => {
|
|
59
|
-
I();
|
|
60
|
-
}).finally(() => {
|
|
61
|
-
j = null;
|
|
62
|
-
}));
|
|
63
|
-
}, ae = null, R = () => ae ??= import("./api.js").then((e) => e.apiPromise), oe = async () => {
|
|
64
|
-
G();
|
|
65
|
-
let e = await h(), t = e === "connected", [n, r] = await Promise.all([m().then((e) => e ? u() : []).catch(() => []), t ? o().then((e) => ({
|
|
66
|
-
ok: !0,
|
|
67
|
-
entries: e
|
|
68
|
-
})).catch(() => ({
|
|
69
|
-
ok: !1,
|
|
70
|
-
entries: []
|
|
71
|
-
})) : Promise.resolve({
|
|
72
|
-
ok: e === "disconnected",
|
|
73
|
-
entries: []
|
|
74
|
-
})]);
|
|
75
|
-
e !== "unknown" && (b = r.ok), r.ok && e !== "unknown" && (x = new Map(r.entries.map((e) => [e.path, e.updatedAt])));
|
|
76
|
-
let i = /* @__PURE__ */ new Map(), a = (e) => {
|
|
77
|
-
let t = Date.parse(e.updatedAt ?? "");
|
|
78
|
-
return Number.isFinite(t) ? t : 0;
|
|
79
|
-
}, s = (e) => {
|
|
80
|
-
let t = i.get(e.path);
|
|
81
|
-
(!t || a(e) >= a(t)) && i.set(e.path, e);
|
|
82
|
-
};
|
|
83
|
-
for (let e of n) s(e);
|
|
84
|
-
for (let e of r.entries) s(e);
|
|
85
|
-
return r.ok && t && (ve(n, r.entries).catch(() => {}), M() ? L() : he({
|
|
86
|
-
local: n,
|
|
87
|
-
remote: r.entries
|
|
88
|
-
}).catch(() => {})), [...i.values()];
|
|
89
|
-
}, se = async (e) => {
|
|
90
|
-
if (await m()) try {
|
|
91
|
-
return await l(e);
|
|
92
|
-
} catch (e) {
|
|
93
|
-
if (e?.name !== "NotFoundError") throw e;
|
|
94
|
-
}
|
|
95
|
-
let t = await r(e);
|
|
96
|
-
return await m() && d(e, t).catch(() => {}), t;
|
|
97
|
-
}, ce = async (e, t, n) => {
|
|
98
|
-
let r = t instanceof Blob ? t : new Blob([t], n?.contentType ? { type: n.contentType } : void 0);
|
|
99
|
-
if (await m()) {
|
|
100
|
-
await d(e, r, n), G();
|
|
101
|
-
let t = x.get(e) ?? null, a = await h();
|
|
102
|
-
if (a === "disconnected") return;
|
|
103
|
-
if (a === "unknown" || !b) {
|
|
104
|
-
T(e, t), I();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
i(e, r, n).then(() => E(e)).catch((n) => {
|
|
108
|
-
T(e, t), I(), console.warn("fs: cloud replicate failed, queued for adopt()", n);
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
let a = await h();
|
|
113
|
-
if (a === "connected") return i(e, r, n);
|
|
114
|
-
throw Error(a === "unknown" ? "fs: cloud unreachable" : "fs: no storage backend available");
|
|
115
|
-
}, le = async (e) => {
|
|
116
|
-
G();
|
|
117
|
-
let t = [];
|
|
118
|
-
await m() && t.push(c(e).catch(() => {}));
|
|
119
|
-
let n = await h();
|
|
120
|
-
if (n === "connected" ? t.push(a(e).then(() => O(e)).catch((t) => {
|
|
121
|
-
ne(e), I(), console.warn("fs: cloud delete failed, queued for retry", t);
|
|
122
|
-
})) : n === "unknown" && t.length && x.has(e) && (ne(e), I()), !t.length) throw Error(n === "unknown" ? "fs: cloud unreachable" : "fs: no storage backend available");
|
|
123
|
-
E(e), await Promise.all(t);
|
|
124
|
-
}, ue = async (e) => {
|
|
125
|
-
let t = await r(e);
|
|
126
|
-
return await m() && await d(e, t), t;
|
|
127
|
-
}, z = null, B = (e) => (z = e, () => {
|
|
128
|
-
z === e && (z = null);
|
|
129
|
-
}), de = async (e) => (await R()).cloud.fs.promptConflict({
|
|
130
|
-
path: e.path,
|
|
131
|
-
local: e.local,
|
|
132
|
-
cloud: e.cloud
|
|
133
|
-
}).catch(() => null), fe = async (e) => {
|
|
134
|
-
if (z) try {
|
|
135
|
-
return await z(e);
|
|
136
|
-
} catch {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
return de(e);
|
|
140
|
-
}, V = async (e) => {
|
|
141
|
-
let t = {
|
|
142
|
-
uploaded: [],
|
|
143
|
-
kept: [],
|
|
144
|
-
resolved: [],
|
|
145
|
-
unresolved: [],
|
|
146
|
-
deleted: [],
|
|
147
|
-
failed: []
|
|
148
|
-
}, n = await h();
|
|
149
|
-
if (n === "unknown") throw Error("fs: cloud unreachable");
|
|
150
|
-
if (n !== "connected") throw Error("fs: this needs a signed-in account");
|
|
151
|
-
let s = await m(), [c, ee] = await Promise.all([s ? u() : Promise.resolve([]), o()]), f = new Map(ee.map((e) => [e.path, e])), p = w();
|
|
152
|
-
if (s) for (let e of Object.keys(p)) c.some((t) => t.path === e) || E(e);
|
|
153
|
-
for (let [e, n] of Object.entries(D())) {
|
|
154
|
-
let r = f.get(e);
|
|
155
|
-
if (!r) {
|
|
156
|
-
O(e);
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
if (c.some((t) => t.path === e)) {
|
|
160
|
-
O(e);
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
if (r.updatedAt !== n) {
|
|
164
|
-
O(e);
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
await a(e), O(e), t.deleted.push(e);
|
|
169
|
-
} catch (n) {
|
|
170
|
-
t.failed.push({
|
|
171
|
-
path: e,
|
|
172
|
-
error: n instanceof Error ? n.message : String(n)
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
for (let n of c) {
|
|
177
|
-
let a = f.get(n.path), o = n.path in p;
|
|
178
|
-
if (!o && (a || !e)) {
|
|
179
|
-
a && t.kept.push(n.path);
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (o && a && a.updatedAt !== p[n.path]) {
|
|
183
|
-
let e = await fe({
|
|
184
|
-
path: n.path,
|
|
185
|
-
local: {
|
|
186
|
-
size: n.size,
|
|
187
|
-
updatedAt: n.updatedAt
|
|
188
|
-
},
|
|
189
|
-
cloud: {
|
|
190
|
-
size: a.size,
|
|
191
|
-
updatedAt: a.updatedAt
|
|
192
|
-
},
|
|
193
|
-
readLocal: () => l(n.path),
|
|
194
|
-
readCloud: () => r(n.path)
|
|
195
|
-
});
|
|
196
|
-
if (!e) {
|
|
197
|
-
t.unresolved.push(n.path);
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
try {
|
|
201
|
-
if (e === "cloud") await d(n.path, await r(n.path));
|
|
202
|
-
else {
|
|
203
|
-
let t = e === "local" ? await l(n.path) : e.merged;
|
|
204
|
-
await i(n.path, t, n.contentType ? { contentType: n.contentType } : void 0), e !== "local" && await d(n.path, t);
|
|
205
|
-
}
|
|
206
|
-
E(n.path), t.resolved.push({
|
|
207
|
-
path: n.path,
|
|
208
|
-
choice: e === "local" || e === "cloud" ? e : "merged"
|
|
209
|
-
});
|
|
210
|
-
} catch (e) {
|
|
211
|
-
if (e?.code === "FKN_E2E_LOCKED") throw e;
|
|
212
|
-
t.failed.push({
|
|
213
|
-
path: n.path,
|
|
214
|
-
error: e instanceof Error ? e.message : String(e)
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
try {
|
|
220
|
-
let e = await l(n.path);
|
|
221
|
-
await i(n.path, e, n.contentType ? { contentType: n.contentType } : void 0), E(n.path), t.uploaded.push(n.path);
|
|
222
|
-
} catch (e) {
|
|
223
|
-
if (T(n.path), e?.code === "FKN_E2E_LOCKED") throw e;
|
|
224
|
-
t.failed.push({
|
|
225
|
-
path: n.path,
|
|
226
|
-
error: e instanceof Error ? e.message : String(e)
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return t;
|
|
231
|
-
}, H = async () => {
|
|
232
|
-
for (; j;) await j;
|
|
233
|
-
let e = V(!0);
|
|
234
|
-
j = e.then(() => {}, () => {});
|
|
235
|
-
try {
|
|
236
|
-
return await e;
|
|
237
|
-
} finally {
|
|
238
|
-
j = null;
|
|
239
|
-
}
|
|
240
|
-
}, U = async () => {
|
|
241
|
-
if (!await g() || !await m()) return {
|
|
242
|
-
paths: [],
|
|
243
|
-
bytes: 0
|
|
244
|
-
};
|
|
245
|
-
let [e, t] = await Promise.all([u(), o()]), n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path));
|
|
246
|
-
return {
|
|
247
|
-
paths: r.map((e) => e.path),
|
|
248
|
-
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
249
|
-
};
|
|
250
|
-
}, pe = () => new Set(Object.keys(S(y))), me = (e) => {
|
|
251
|
-
let t = S(y);
|
|
252
|
-
for (let n of e) t[n] = null;
|
|
253
|
-
C(y, t);
|
|
254
|
-
}, W = null, he = (e) => W || (W = (async () => {
|
|
255
|
-
if (!await g()) return;
|
|
256
|
-
let t = e ?? (await m() ? {
|
|
257
|
-
local: await u(),
|
|
258
|
-
remote: await o()
|
|
259
|
-
} : null);
|
|
260
|
-
if (!t) return;
|
|
261
|
-
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));
|
|
262
|
-
if (!i.length) return;
|
|
263
|
-
let a = await R(), s = i.reduce((e, t) => e + t.size, 0);
|
|
264
|
-
if (!await a.cloud.fs.promptAdopt({
|
|
265
|
-
files: i.length,
|
|
266
|
-
bytes: s
|
|
267
|
-
}).catch(() => !1)) {
|
|
268
|
-
me(i.map((e) => e.path));
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
await H();
|
|
272
|
-
})().catch(() => {}).finally(() => {
|
|
273
|
-
W = null;
|
|
274
|
-
}), W), ge = null, _e = !1, ve = async (e, t) => {
|
|
275
|
-
let n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path)), i = await R(), a = async () => {
|
|
276
|
-
await H().catch(() => {});
|
|
277
|
-
let e = await U().catch(() => ({
|
|
278
|
-
paths: [],
|
|
279
|
-
bytes: 0
|
|
280
|
-
}));
|
|
281
|
-
await i.cloud.fs.setAdoptSource({
|
|
282
|
-
files: e.paths.length,
|
|
283
|
-
bytes: e.bytes
|
|
284
|
-
}, a).catch(() => {});
|
|
285
|
-
}, o = {
|
|
286
|
-
files: r.length,
|
|
287
|
-
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
288
|
-
};
|
|
289
|
-
ge = () => {
|
|
290
|
-
i.cloud.fs.setAdoptSource(o, a).catch(() => {});
|
|
291
|
-
}, _e || (_e = !0, import("./api.js").then((e) => e.onApiEpoch((e, t) => {
|
|
292
|
-
t > 1 && ge?.();
|
|
293
|
-
})).catch(() => {})), await i.cloud.fs.setAdoptSource(o, a);
|
|
294
|
-
}, ye = !1, G = () => {
|
|
295
|
-
ye || typeof window > "u" || (ye = !0, window.addEventListener("online", () => {
|
|
296
|
-
L();
|
|
297
|
-
}), import("./account.js").then((e) => e.onChange(() => {
|
|
298
|
-
he().catch(() => {}), L();
|
|
299
|
-
})).catch(() => {}));
|
|
300
|
-
}, be = /* @__PURE__ */ e({
|
|
301
|
-
adopt: () => J,
|
|
302
|
-
adoptable: () => Y,
|
|
303
|
-
appendFile: () => Le,
|
|
304
|
-
appendFileSync: () => Te,
|
|
305
|
-
available: () => Se,
|
|
306
|
-
default: () => Je,
|
|
307
|
-
exists: () => Ue,
|
|
308
|
-
existsSync: () => Ee,
|
|
309
|
-
flush: () => Ke,
|
|
310
|
-
lstatSync: () => Oe,
|
|
311
|
-
mkdir: () => Be,
|
|
312
|
-
mkdirSync: () => Ae,
|
|
313
|
-
mount: () => Ge,
|
|
314
|
-
onConflict: () => $,
|
|
315
|
-
pending: () => X,
|
|
316
|
-
pendingDeletes: () => Z,
|
|
317
|
-
promises: () => We,
|
|
318
|
-
pull: () => q,
|
|
319
|
-
readFile: () => Fe,
|
|
320
|
-
readFileSync: () => Ce,
|
|
321
|
-
readdir: () => ze,
|
|
322
|
-
readdirSync: () => ke,
|
|
323
|
-
remount: () => qe,
|
|
324
|
-
rename: () => He,
|
|
325
|
-
renameSync: () => Pe,
|
|
326
|
-
replicating: () => Q,
|
|
327
|
-
rm: () => Ve,
|
|
328
|
-
rmSync: () => je,
|
|
329
|
-
rmdirSync: () => Me,
|
|
330
|
-
stat: () => Re,
|
|
331
|
-
statSync: () => De,
|
|
332
|
-
unlink: () => K,
|
|
333
|
-
unlinkSync: () => Ne,
|
|
334
|
-
writeFile: () => Ie,
|
|
335
|
-
writeFileSync: () => we
|
|
336
|
-
}), xe = n(f, { memfs: !0 }), { available: Se, readFileSync: Ce, writeFileSync: we, appendFileSync: Te, existsSync: Ee, statSync: De, lstatSync: Oe, readdirSync: ke, mkdirSync: Ae, rmSync: je, rmdirSync: Me, unlinkSync: Ne, renameSync: Pe, readFile: Fe, writeFile: Ie, appendFile: Le, stat: Re, readdir: ze, mkdir: Be, rm: Ve, unlink: K, rename: He, exists: Ue, promises: We, mount: Ge, flush: Ke, remount: qe } = xe, q = ue, J = H, Y = U, X = k, Z = A, Q = re, $ = B, Je = {
|
|
337
|
-
...xe,
|
|
338
|
-
pull: q,
|
|
339
|
-
adopt: J,
|
|
340
|
-
adoptable: Y,
|
|
341
|
-
pending: X,
|
|
342
|
-
pendingDeletes: Z,
|
|
343
|
-
replicating: Q,
|
|
344
|
-
onConflict: $
|
|
345
|
-
};
|
|
346
|
-
//#endregion
|
|
347
|
-
export { Me as A, ke as C, Q as D, Pe as E, Ie as F, we as I, De as M, K as N, Ve as O, Ne as P, ze as S, He as T, Z as _, Se as a, Fe as b, Ke as c, Oe as d, Be as f, X as g, $ as h, Te as i, Re as j, je as k, Je as l, Ge as m, Y as n, Ue as o, Ae as p, Le as r, Ee as s, J as t, be as u, We as v, qe as w, Ce as x, q as y };
|
package/storage-DLB4ciMf.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-BCJO3EWi.cjs"),n=require("./messages.cjs");var 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.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},o=e=>e?.code===n.STORAGE_NOT_FOUND,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.a.then(e=>e.cloud.fs.available()).catch(()=>!1),l=8e3,u=1e3,d=!1,f=async()=>{let e=(await t.a).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.a.then(e=>e.cloud.fs.list()),h=()=>t.a.then(e=>e.cloud.fs.quota()),g=async e=>{let n=await(await t.a).cloud.fs.readFile(e).catch(s);return new Blob([n])},_=async(e,n,r)=>{let i=await t.a,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.a.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),y=()=>t.a.then(e=>e.cloud.fs.encryption()),b=()=>t.a.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,"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}});
|