@fkn/lib 0.9.40 → 0.9.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account-generation-CSnZiN18.cjs +1 -0
- package/account-generation-D7TpIoKt.js +28 -0
- package/account.cjs +1 -1
- package/account.d.ts +11 -0
- package/account.js +5 -17
- package/{api-BE5zPvFZ.d.ts → api-Cbty0JUM.d.ts} +15 -13
- 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 +4 -4
- package/cloud/fs.js +31 -24
- package/cloud/net.d.ts +1 -1
- package/{cloud-5eldoFxK.d.ts → cloud-4t1WoEZn.d.ts} +3 -3
- package/cloud.d.ts +4 -4
- package/{contract-Cvr_8gCL.d.ts → contract-BRc2ptdC.d.ts} +29 -7
- package/contract.d.ts +2 -2
- 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-BTyRnUPI.cjs +1 -0
- package/{fs--NhtUyYa.d.ts → fs-D0MMRnHC.d.ts} +8 -4
- package/fs-q7Kg51hq.js +513 -0
- package/fs.cjs +1 -1
- package/fs.d.ts +4 -3
- package/fs.js +4 -2
- package/http.d.ts +1 -1
- package/{index-kuPqkS_-.d.ts → index-D2lvaQDs.d.ts} +28 -38
- package/index.cjs +1 -1
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/{messages-C66ghz_A.d.ts → messages-CRcziTuC.d.ts} +17 -1
- package/messages.cjs +1 -1
- package/messages.d.ts +2 -2
- package/messages.js +2 -2
- package/{net-zThwNoA8.d.ts → net-CcEZP6Bb.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/{node-fs-BZy9bzKd.js → node-fs-CK2wWIYS.js} +140 -137
- package/node-fs-nfX7wisL.cjs +1 -0
- package/opfs.cjs +1 -1
- package/opfs.js +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-Dc0gDOxz.d.ts → proxy-D6YtsO1g.d.ts} +2 -2
- package/rooms.d.ts +1 -1
- package/storage-BS5WMO4f.cjs +1 -0
- package/storage-BVr2Rb-d.d.ts +167 -0
- package/storage-BWmGrO6a.js +123 -0
- package/fs-CaQFRiIT.cjs +0 -1
- package/fs-D3IsGdnN.js +0 -360
- package/node-fs-BNTPsX5c.cjs +0 -1
- package/storage-BJd-mWHE.cjs +0 -1
- package/storage-DSvL-t80.js +0 -67
- package/storage-ZrY4Y4L5.d.ts +0 -88
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./api-jOTOA-5n.cjs");var t=0,n=new Set,r=2e3,i=null,a=e=>{e?.switched!==!1&&(t+=1,i&&=(clearTimeout(i.timer),null));for(let e of[...n])try{e()}catch{}},o=!1,s=0,c=()=>{let t=e.s();t&&s!==t.epoch&&(s=t.epoch,Promise.resolve(t.remote.account.onChange(a)).catch(()=>{s===t.epoch&&(s=0)}))},l=()=>{!o&&e.c&&(o=!0,e.l(c))},u=()=>t,d=e=>(n.add(e),l(),()=>{n.delete(e)}),f=e=>{if(e!==t||i?.generation===e)return;let n=setTimeout(()=>{i?.timer===n&&(i=null,t===e&&a({switched:!0}))},r);i={generation:e,timer:n}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { c as e, l as t, s as n } from "./api-Dp-2AT3u.js";
|
|
2
|
+
//#region src/account-generation.ts
|
|
3
|
+
var r = 0, i = /* @__PURE__ */ new Set(), a = 2e3, o = null, s = (e) => {
|
|
4
|
+
e?.switched !== !1 && (r += 1, o &&= (clearTimeout(o.timer), null));
|
|
5
|
+
for (let e of [...i]) try {
|
|
6
|
+
e();
|
|
7
|
+
} catch {}
|
|
8
|
+
}, c = !1, l = 0, u = () => {
|
|
9
|
+
let e = n();
|
|
10
|
+
e && l !== e.epoch && (l = e.epoch, Promise.resolve(e.remote.account.onChange(s)).catch(() => {
|
|
11
|
+
l === e.epoch && (l = 0);
|
|
12
|
+
}));
|
|
13
|
+
}, d = () => {
|
|
14
|
+
!c && e && (c = !0, t(u));
|
|
15
|
+
}, f = () => r, p = (e) => (i.add(e), d(), () => {
|
|
16
|
+
i.delete(e);
|
|
17
|
+
}), m = (e) => {
|
|
18
|
+
if (e !== r || o?.generation === e) return;
|
|
19
|
+
let t = setTimeout(() => {
|
|
20
|
+
o?.timer === t && (o = null, r === e && s({ switched: !0 }));
|
|
21
|
+
}, a);
|
|
22
|
+
o = {
|
|
23
|
+
generation: e,
|
|
24
|
+
timer: t
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { p as i, d as n, m as r, f as t };
|
package/account.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs"),n=require("./account-generation-CSnZiN18.cjs");var r=e.t({info:()=>o,login:()=>i,logout:()=>a,onChange:()=>s}),i=async()=>typeof window>`u`?!1:(await t.a).account.login(location.origin).catch(()=>!1),a=async()=>{typeof window<`u`&&await(await t.a).account.logout().catch(()=>{})},o=async()=>{if(typeof window>`u`)return null;let e=await t.a.then(e=>e.account.info()).catch(()=>null);return e?{name:e.name,image:e.image,premium:e.premium,premiumUntil:e.premiumUntil?Date.parse(e.premiumUntil):null}:null},s=async e=>t.c?n.i(e):()=>{};exports.info=o,exports.login=i,exports.logout=a,exports.onChange=s,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/account.d.ts
CHANGED
|
@@ -14,6 +14,17 @@ export type AccountInfo = {
|
|
|
14
14
|
export declare const login: () => Promise<boolean>;
|
|
15
15
|
export declare const logout: () => Promise<void>;
|
|
16
16
|
export declare const info: () => Promise<AccountInfo | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Calls `callback` whenever the account this page acts as may have changed: a switch, a sign-in or a
|
|
19
|
+
* sign-out, in this tab or another. It carries no data, so re-read what you need. Works in a window and
|
|
20
|
+
* in a worker bridged with `relayWorker`; resolves to a no-op where there is no FKN transport at all.
|
|
21
|
+
*
|
|
22
|
+
* Storage moves to the new account BEFORE any callback runs. Calls made before this page learned of a
|
|
23
|
+
* switch never land in the new account (they are refused with `StorageAccountChangedError`). Work the
|
|
24
|
+
* app started before the notification and resumes after it is the app's to check: keep a counter this
|
|
25
|
+
* callback bumps, and compare it synchronously right before the storage call, which captures the
|
|
26
|
+
* account in the same synchronous step, so the check and the call are atomic.
|
|
27
|
+
*/
|
|
17
28
|
export declare const onChange: (callback: () => void) => Promise<() => void>;
|
|
18
29
|
//#endregion
|
|
19
30
|
export { account_d_exports as t };
|
package/account.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { a as t,
|
|
2
|
+
import { a as t, c as n } from "./api-Dp-2AT3u.js";
|
|
3
|
+
import { i as r } from "./account-generation-D7TpIoKt.js";
|
|
3
4
|
//#region src/account.ts
|
|
4
5
|
var i = /* @__PURE__ */ e({
|
|
5
6
|
info: () => s,
|
|
6
7
|
login: () => a,
|
|
7
8
|
logout: () => o,
|
|
8
|
-
onChange: () =>
|
|
9
|
+
onChange: () => c
|
|
9
10
|
}), a = async () => typeof window > "u" ? !1 : (await t).account.login(location.origin).catch(() => !1), o = async () => {
|
|
10
11
|
typeof window < "u" && await (await t).account.logout().catch(() => {});
|
|
11
12
|
}, s = async () => {
|
|
@@ -17,19 +18,6 @@ var i = /* @__PURE__ */ e({
|
|
|
17
18
|
premium: e.premium,
|
|
18
19
|
premiumUntil: e.premiumUntil ? Date.parse(e.premiumUntil) : null
|
|
19
20
|
} : null;
|
|
20
|
-
}, c =
|
|
21
|
-
for (let e of [...c]) try {
|
|
22
|
-
e();
|
|
23
|
-
} catch {}
|
|
24
|
-
}, u = 0, d = () => {
|
|
25
|
-
let e = r();
|
|
26
|
-
e && c.size !== 0 && u !== e.epoch && (u = e.epoch, Promise.resolve(e.remote.account.onChange(l)).catch(() => {
|
|
27
|
-
u === e.epoch && (u = 0);
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
typeof window < "u" && n(d);
|
|
31
|
-
var f = async (e) => typeof window > "u" ? () => {} : (c.add(e), d(), () => {
|
|
32
|
-
c.delete(e);
|
|
33
|
-
});
|
|
21
|
+
}, c = async (e) => n ? r(e) : () => {};
|
|
34
22
|
//#endregion
|
|
35
|
-
export { s as info, a as login, o as logout,
|
|
23
|
+
export { s as info, a as login, o as logout, c as onChange, i as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
2
|
+
import { $ as RoomJoinOptions, B as ProxyFetchInit, Ct as TcpSocketOptions, D as IpFamily, Et as UdpSocketOptions, F as PackagesErrorCode, G as Resolvers, L as PickOptions, M as OverlayState, Mt as WriteData, N as PackageQuery, R as Placement, T as InstallOptions, Tt as UdpDatagram, V as ProxyFetchInput, Z as RoomEvent, a as AccountChange, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomMailbox, it as RoomPermission, l as AdoptState, m as ConnectOptions, o as AccountPinOptions, ot as RoomsErrorCode, p as ConnectAvailability, q as RoomClaimOptions, rt as RoomOpenOptions, u as ConflictChoice, x as FrameConsentRequest, xt as TcpSocketListenerOptions } from "./contract-BRc2ptdC.js";
|
|
3
3
|
import { Remote } from "osra";
|
|
4
4
|
//#region src/api-epochs.d.ts
|
|
5
5
|
type EpochListener<T> = (remote: T, epoch: number) => void;
|
|
@@ -69,7 +69,7 @@ declare const onApiEpoch: (listener: EpochListener<{
|
|
|
69
69
|
fs: {
|
|
70
70
|
available: () => Promise<boolean>;
|
|
71
71
|
availability: () => Promise<ConnectAvailability>;
|
|
72
|
-
list: () => Promise<{
|
|
72
|
+
list: (opts?: AccountPinOptions | undefined) => Promise<{
|
|
73
73
|
path: string;
|
|
74
74
|
size: number;
|
|
75
75
|
contentType: string | null;
|
|
@@ -83,13 +83,14 @@ declare const onApiEpoch: (listener: EpochListener<{
|
|
|
83
83
|
objects: number;
|
|
84
84
|
maxObjects: number;
|
|
85
85
|
}>;
|
|
86
|
-
readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
87
|
-
readFileSealed: (path: string) => Promise<{
|
|
86
|
+
readFile: (path: string, opts?: AccountPinOptions | undefined) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
87
|
+
readFileSealed: (path: string, opts?: AccountPinOptions | undefined) => Promise<{
|
|
88
88
|
bytes: Uint8Array;
|
|
89
89
|
sealedAt: number | null;
|
|
90
90
|
}>;
|
|
91
|
-
writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
92
|
-
remove: (path: string) => Promise<void>;
|
|
91
|
+
writeFile: (path: string, data: WriteData, contentType: string | null, opts?: AccountPinOptions | undefined) => Promise<void>;
|
|
92
|
+
remove: (path: string, opts?: AccountPinOptions | undefined) => Promise<void>;
|
|
93
|
+
accountPin: () => Promise<string>;
|
|
93
94
|
encryption: () => Promise<{
|
|
94
95
|
unlocked: boolean;
|
|
95
96
|
enrolled: boolean;
|
|
@@ -683,7 +684,7 @@ declare const onApiEpoch: (listener: EpochListener<{
|
|
|
683
684
|
} | null>;
|
|
684
685
|
login: (consumerOrigin: string) => Promise<boolean>;
|
|
685
686
|
logout: () => Promise<void>;
|
|
686
|
-
onChange: (listener: () => void) => Promise<() => Promise<void>>;
|
|
687
|
+
onChange: (listener: (change?: AccountChange) => void) => Promise<() => Promise<void>>;
|
|
687
688
|
};
|
|
688
689
|
shell: {
|
|
689
690
|
updateReady: () => Promise<boolean>;
|
|
@@ -785,7 +786,7 @@ declare const currentApiEpoch: () => {
|
|
|
785
786
|
fs: {
|
|
786
787
|
available: () => Promise<boolean>;
|
|
787
788
|
availability: () => Promise<ConnectAvailability>;
|
|
788
|
-
list: () => Promise<{
|
|
789
|
+
list: (opts?: AccountPinOptions | undefined) => Promise<{
|
|
789
790
|
path: string;
|
|
790
791
|
size: number;
|
|
791
792
|
contentType: string | null;
|
|
@@ -799,13 +800,14 @@ declare const currentApiEpoch: () => {
|
|
|
799
800
|
objects: number;
|
|
800
801
|
maxObjects: number;
|
|
801
802
|
}>;
|
|
802
|
-
readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
803
|
-
readFileSealed: (path: string) => Promise<{
|
|
803
|
+
readFile: (path: string, opts?: AccountPinOptions | undefined) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
804
|
+
readFileSealed: (path: string, opts?: AccountPinOptions | undefined) => Promise<{
|
|
804
805
|
bytes: Uint8Array;
|
|
805
806
|
sealedAt: number | null;
|
|
806
807
|
}>;
|
|
807
|
-
writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
808
|
-
remove: (path: string) => Promise<void>;
|
|
808
|
+
writeFile: (path: string, data: WriteData, contentType: string | null, opts?: AccountPinOptions | undefined) => Promise<void>;
|
|
809
|
+
remove: (path: string, opts?: AccountPinOptions | undefined) => Promise<void>;
|
|
810
|
+
accountPin: () => Promise<string>;
|
|
809
811
|
encryption: () => Promise<{
|
|
810
812
|
unlocked: boolean;
|
|
811
813
|
enrolled: boolean;
|
|
@@ -1399,7 +1401,7 @@ declare const currentApiEpoch: () => {
|
|
|
1399
1401
|
} | null>;
|
|
1400
1402
|
login: (consumerOrigin: string) => Promise<boolean>;
|
|
1401
1403
|
logout: () => Promise<void>;
|
|
1402
|
-
onChange: (listener: () => void) => Promise<() => Promise<void>>;
|
|
1404
|
+
onChange: (listener: (change?: AccountChange) => void) => Promise<() => Promise<void>>;
|
|
1403
1405
|
};
|
|
1404
1406
|
shell: {
|
|
1405
1407
|
updateReady: () => Promise<boolean>;
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiPromise, c as hasTransport, i as apiLastCall, l as onApiEpoch, n as BrokerUnreachableError, o as apiWithin, r as apiInFlight, s as currentApiEpoch, t as API_DEADLINE_MS } from "./api-
|
|
1
|
+
import { G as Resolvers } from "./contract-BRc2ptdC.js";
|
|
2
|
+
import { a as apiPromise, c as hasTransport, i as apiLastCall, l as onApiEpoch, n as BrokerUnreachableError, o as apiWithin, r as apiInFlight, s as currentApiEpoch, t as API_DEADLINE_MS } from "./api-Cbty0JUM.js";
|
|
3
3
|
export { API_DEADLINE_MS, BrokerUnreachableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
package/cloud/dns.d.ts
CHANGED
package/cloud/fetch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as cloudFetch } from "../proxy-
|
|
1
|
+
import { t as cloudFetch } from "../proxy-D6YtsO1g.js";
|
|
2
2
|
export { cloudFetch as fetch };
|
package/cloud/fs/promises.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../../index-BQgZVQl7.js";
|
|
2
|
-
import "../../fs
|
|
2
|
+
import "../../fs-D0MMRnHC.js";
|
|
3
3
|
//#region src/cloud/fs-promises.d.ts
|
|
4
4
|
export declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (_path?: import("node:fs").PathLike, _options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
|
|
5
5
|
recursive?: boolean;
|
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-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-nfX7wisL.cjs"),n=require("../messages.cjs"),r=require("../storage-BS5WMO4f.cjs");var i=e.t({STORAGE_ACCOUNT_CHANGED:()=>n.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,STORAGE_NOT_FOUND:()=>n.STORAGE_NOT_FOUND,StorageAccountChangedError:()=>r.t,StorageAccountPinUnsupportedError:()=>r.n,StorageLockedError:()=>r.r,StorageNotFoundError:()=>r.i,availability:()=>r.a,available:()=>a,encryption:()=>r.s,isAccountChanged:()=>r.c,isNotFound:()=>r.u,list:()=>h,mkdir:()=>d,promises:()=>m,quota:()=>r.m,readFile:()=>o,readFileSealed:()=>g,readdir:()=>u,rename:()=>l,rm:()=>f,stat:()=>p,unlink:()=>c,unlock:()=>r.y,writeFile:()=>s}),{available:a,readFile:o,writeFile:s,unlink:c,rename:l,readdir:u,mkdir:d,rm:f,stat:p,promises:m}=t.t(r.v,{memfs:!1}),h=()=>r.f(),g=e=>r.g(e);exports.STORAGE_ACCOUNT_CHANGED=n.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.STORAGE_NOT_FOUND=n.STORAGE_NOT_FOUND,exports.StorageAccountChangedError=r.t,exports.StorageAccountPinUnsupportedError=r.n,exports.StorageLockedError=r.r,exports.StorageNotFoundError=r.i,exports.availability=r.a,exports.available=a,exports.encryption=r.s,exports.isAccountChanged=r.c,exports.isNotFound=r.u,exports.list=h,exports.mkdir=d,exports.promises=m,exports.quota=r.m,exports.readFile=o,exports.readFileSealed=g,exports.readdir=u,exports.rename=l,exports.rm=f,exports.stat=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.unlink=c,exports.unlock=r.y,exports.writeFile=s;
|
package/cloud/fs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Stats } from "../index-BQgZVQl7.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
export { type EncryptionStatus, type FileEntry, STORAGE_NOT_FOUND, type SealedRead, type Stats, StorageLockedError, StorageNotFoundError, type StorageQuota, available, encryption, isNotFound, mkdir, promises, quota, readFile, readFileSealed, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
|
2
|
+
import { _ as unlock, a as StorageAccountChangedError, c as StorageNotFoundError, f as encryption, h as quota, i as SealedRead, l as StorageQuota, m as isNotFound, n as EncryptionStatus, o as StorageAccountPinUnsupportedError, p as isAccountChanged, r as FileEntry, s as StorageLockedError, t as CloudAvailability, u as availability } from "../storage-BVr2Rb-d.js";
|
|
3
|
+
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, u as STORAGE_NOT_FOUND } from "../messages-CRcziTuC.js";
|
|
4
|
+
import { a as promises, c as readdir, d as stat, f as unlink, i as mkdir, l as rename, o as readFile, p as writeFile, r as list, s as readFileSealed, t as available, u as rm } from "../fs-D0MMRnHC.js";
|
|
5
|
+
export { type CloudAvailability, type EncryptionStatus, type FileEntry, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, type SealedRead, type Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, StorageLockedError, StorageNotFoundError, type StorageQuota, availability, available, encryption, isAccountChanged, isNotFound, list, mkdir, promises, quota, readFile, readFileSealed, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
package/cloud/fs.js
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "../node-fs-
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
2
|
+
import { t } from "../node-fs-CK2wWIYS.js";
|
|
3
|
+
import { STORAGE_ACCOUNT_CHANGED as n, STORAGE_ACCOUNT_PIN_UNSUPPORTED as r, STORAGE_NOT_FOUND as i } from "../messages.js";
|
|
4
|
+
import { a, c as o, f as s, g as c, i as l, m as u, n as d, r as f, s as p, t as m, u as h, v as g, y as _ } from "../storage-BWmGrO6a.js";
|
|
5
5
|
//#region src/cloud/fs.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
var v = /* @__PURE__ */ e({
|
|
7
|
+
STORAGE_ACCOUNT_CHANGED: () => n,
|
|
8
|
+
STORAGE_ACCOUNT_PIN_UNSUPPORTED: () => r,
|
|
9
|
+
STORAGE_NOT_FOUND: () => i,
|
|
10
|
+
StorageAccountChangedError: () => m,
|
|
11
|
+
StorageAccountPinUnsupportedError: () => d,
|
|
12
|
+
StorageLockedError: () => f,
|
|
13
|
+
StorageNotFoundError: () => l,
|
|
14
|
+
availability: () => a,
|
|
15
|
+
available: () => y,
|
|
16
|
+
encryption: () => p,
|
|
17
|
+
isAccountChanged: () => o,
|
|
18
|
+
isNotFound: () => h,
|
|
19
|
+
list: () => k,
|
|
20
|
+
mkdir: () => T,
|
|
21
|
+
promises: () => O,
|
|
22
|
+
quota: () => u,
|
|
23
|
+
readFile: () => b,
|
|
24
|
+
readFileSealed: () => A,
|
|
25
|
+
readdir: () => w,
|
|
26
|
+
rename: () => C,
|
|
27
|
+
rm: () => E,
|
|
28
|
+
stat: () => D,
|
|
29
|
+
unlink: () => S,
|
|
30
|
+
unlock: () => _,
|
|
31
|
+
writeFile: () => x
|
|
32
|
+
}), { available: y, readFile: b, writeFile: x, unlink: S, rename: C, readdir: w, mkdir: T, rm: E, stat: D, promises: O } = t(g, { memfs: !1 }), k = () => s(), A = (e) => c(e);
|
|
26
33
|
//#endregion
|
|
27
|
-
export { n as STORAGE_NOT_FOUND,
|
|
34
|
+
export { n as STORAGE_ACCOUNT_CHANGED, r as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as STORAGE_NOT_FOUND, m as StorageAccountChangedError, d as StorageAccountPinUnsupportedError, f as StorageLockedError, l as StorageNotFoundError, a as availability, y as available, p as encryption, o as isAccountChanged, h as isNotFound, k as list, T as mkdir, O as promises, u as quota, b as readFile, A as readFileSealed, w as readdir, C as rename, E as rm, D as stat, v as t, S as unlink, _ as unlock, x as writeFile };
|
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-CcEZP6Bb.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as AttachFrameFunction } from "./index-D2CA-NX5.js";
|
|
2
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
+
import { t as cloudFetch } from "./proxy-D6YtsO1g.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-D0MMRnHC.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-CcEZP6Bb.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
//#region src/cloud/frame.d.ts
|
package/cloud.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
-
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-D6YtsO1g.js";
|
|
2
|
+
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-4t1WoEZn.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-D0MMRnHC.js";
|
|
5
|
+
import { s as net_d_exports } from "./net-CcEZP6Bb.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 };
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { K as SelectorPart, v as GotoOptions } from "./index-D2CA-NX5.js";
|
|
2
2
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
3
3
|
//#region src/contract.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* What the broker's account change notification says. `switched` is true only when the account the
|
|
6
|
+
* broker acts as changed: another account, a sign-out or a sign-in. A renewal of the same account's
|
|
7
|
+
* token is false. A broker older than this sends no payload at all.
|
|
8
|
+
*/
|
|
9
|
+
type AccountChange = {
|
|
10
|
+
switched: boolean;
|
|
11
|
+
};
|
|
4
12
|
/** The signed-in account, or null when nobody is. */
|
|
5
13
|
type Account = {
|
|
6
14
|
name: string;
|
|
@@ -38,6 +46,14 @@ type StorageQuota = {
|
|
|
38
46
|
maxObjects: number;
|
|
39
47
|
};
|
|
40
48
|
type WriteData = ArrayBuffer | Uint8Array | string;
|
|
49
|
+
/**
|
|
50
|
+
* The trailing option of every pinned storage call: a value `accountPin()` answered. The api refuses the
|
|
51
|
+
* call ACCOUNT_CHANGED when the signed-in account (or the app) is not the one the pin was taken under.
|
|
52
|
+
* Absent, the call is sent exactly as it was before pins existed.
|
|
53
|
+
*/
|
|
54
|
+
type AccountPinOptions = {
|
|
55
|
+
accountPin?: string;
|
|
56
|
+
};
|
|
41
57
|
/** Encryption state of the account's cloud storage. */
|
|
42
58
|
type EncryptionState = {
|
|
43
59
|
unlocked: boolean;
|
|
@@ -754,9 +770,9 @@ type Resolvers = {
|
|
|
754
770
|
fs: {
|
|
755
771
|
available: () => Promise<boolean>;
|
|
756
772
|
availability: () => Promise<ConnectAvailability>;
|
|
757
|
-
list: () => Promise<StorageEntry[]>;
|
|
773
|
+
list: (opts?: AccountPinOptions) => Promise<StorageEntry[]>;
|
|
758
774
|
quota: () => Promise<StorageQuota>;
|
|
759
|
-
readFile: (path: string) => Promise<Uint8Array>;
|
|
775
|
+
readFile: (path: string, opts?: AccountPinOptions) => Promise<Uint8Array>;
|
|
760
776
|
/**
|
|
761
777
|
* The same read as `readFile`, plus the seal time the envelope authenticates, in milliseconds,
|
|
762
778
|
* or null for an envelope that carries no such field.
|
|
@@ -765,12 +781,18 @@ type Resolvers = {
|
|
|
765
781
|
* envelope's AAD; it is still the WRITER's own claim about when it sealed, so on its own it
|
|
766
782
|
* does not prove that this copy is the newest one.
|
|
767
783
|
*/
|
|
768
|
-
readFileSealed: (path: string) => Promise<{
|
|
784
|
+
readFileSealed: (path: string, opts?: AccountPinOptions) => Promise<{
|
|
769
785
|
bytes: Uint8Array;
|
|
770
786
|
sealedAt: number | null;
|
|
771
787
|
}>;
|
|
772
|
-
writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
773
|
-
remove: (path: string) => Promise<void>;
|
|
788
|
+
writeFile: (path: string, data: WriteData, contentType: string | null, opts?: AccountPinOptions) => Promise<void>;
|
|
789
|
+
remove: (path: string, opts?: AccountPinOptions) => Promise<void>;
|
|
790
|
+
/**
|
|
791
|
+
* A fresh opaque pin for the account signed in now, under the calling app. It names nobody: every
|
|
792
|
+
* call answers a new value and two pins cannot be compared. A broker without this member cannot
|
|
793
|
+
* pin, and the library sends it no storage call at all.
|
|
794
|
+
*/
|
|
795
|
+
accountPin: () => Promise<string>;
|
|
774
796
|
encryption: () => Promise<EncryptionState>;
|
|
775
797
|
unlock: () => Promise<boolean>;
|
|
776
798
|
promptAdopt: (request: AdoptRequest) => Promise<boolean>;
|
|
@@ -847,7 +869,7 @@ type Resolvers = {
|
|
|
847
869
|
info: () => Promise<Account | null>;
|
|
848
870
|
login: (consumerOrigin: string) => Promise<boolean>;
|
|
849
871
|
logout: () => void;
|
|
850
|
-
onChange: (listener: () => void) => (() => void);
|
|
872
|
+
onChange: (listener: (change?: AccountChange) => void) => (() => void);
|
|
851
873
|
};
|
|
852
874
|
shell: {
|
|
853
875
|
updateReady: () => Promise<boolean>;
|
|
@@ -865,4 +887,4 @@ type Resolvers = {
|
|
|
865
887
|
hideInstallPrompt: () => void;
|
|
866
888
|
};
|
|
867
889
|
//#endregion
|
|
868
|
-
export {
|
|
890
|
+
export { RoomJoinOptions as $, MountDescriptor as A, WINDOW_JAR_MODE_TIMEOUT_MS as At, ProxyFetchInit as B, FrameMessageRelay as C, TcpSocketOptions as Ct, IpFamily as D, UdpSocketResult as Dt, InstalledPackage as E, UdpSocketOptions as Et, PackagesErrorCode as F, Resolvers as G, Quota as H, PackagesFail as I, RoomCreateOptions as J, RoomBacklog as K, PickOptions as L, OverlayState as M, WriteData as Mt, PackageQuery as N, JAR_ANCHOR_MESSAGE as O, WINDOW_HANDSHAKE_TIMEOUT_MS as Ot, PackageResult as P, RoomHandle as Q, Placement as R, FrameFetchScope as S, TcpSocketListenerResult as St, InstallOptions as T, UdpDatagram as Tt, ROOM_TEMPORARY_MS as U, ProxyFetchInput as V, Radii as W, RoomEnd as X, RoomDefaults as Y, RoomEvent as Z, DnsLookup as _, ShellJarUnreachable as _t, AccountChange as a, RoomPermissions as at, FrameConsentAnswer as b, SurfaceRect as bt, AdoptRequest as c, SHELL_ATTACH_ERROR as ct, ConflictRequest as d, SHELL_JAR_MESSAGE as dt, RoomMailbox as et, ConflictSide as f, SHELL_JAR_UNREACHABLE as ft, DisplayLevel as g, ShellGotoOptions as gt, DisplayCause as h, ShellFrameMessage as ht, Account as i, RoomPermission as it, OverlayRect as j, WindowMiddleControl as jt, MiddleControl as k, WINDOW_HELLO_TIMEOUT_MS as kt, AdoptState as l, SHELL_CONTROL_KEY as lt, ConnectOptions as m, ShellControl as mt, ATTACH_WINDOW_KEY as n, RoomMessage as nt, AccountPinOptions as o, RoomsErrorCode as ot, ConnectAvailability as p, SetOverlayHost as pt, RoomClaimOptions as q, ATTACH_WINDOW_MESSAGE as r, RoomOpenOptions as rt, AddressLookupResult as s, RoomsFail as st, ATTACH_FRAME_KEY as t, RoomMember as tt, ConflictChoice as u, SHELL_FRAME_MESSAGE as ut, EncryptionState as v, StorageEntry as vt, HiddenSurface as w, TcpSocketResult as wt, FrameConsentRequest as x, TcpSocketListenerOptions as xt, FRAME_MESSAGE as y, StorageQuota as yt, ProxyFetch as z };
|
package/contract.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AddressLookupResult, AdoptRequest, AdoptState, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, MiddleControl, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, ROOM_TEMPORARY_MS, Radii, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
|
|
2
|
+
import { $ as RoomJoinOptions, A as MountDescriptor, At as WINDOW_JAR_MODE_TIMEOUT_MS, B as ProxyFetchInit, C as FrameMessageRelay, Ct as TcpSocketOptions, D as IpFamily, Dt as UdpSocketResult, E as InstalledPackage, Et as UdpSocketOptions, F as PackagesErrorCode, G as Resolvers, H as Quota, I as PackagesFail, J as RoomCreateOptions, K as RoomBacklog, L as PickOptions, M as OverlayState, Mt as WriteData, N as PackageQuery, O as JAR_ANCHOR_MESSAGE, Ot as WINDOW_HANDSHAKE_TIMEOUT_MS, P as PackageResult, Q as RoomHandle, R as Placement, S as FrameFetchScope, St as TcpSocketListenerResult, T as InstallOptions, Tt as UdpDatagram, U as ROOM_TEMPORARY_MS, V as ProxyFetchInput, W as Radii, X as RoomEnd, Y as RoomDefaults, Z as RoomEvent, _ as DnsLookup, _t as ShellJarUnreachable, a as AccountChange, at as RoomPermissions, b as FrameConsentAnswer, bt as SurfaceRect, c as AdoptRequest, ct as SHELL_ATTACH_ERROR, d as ConflictRequest, dt as SHELL_JAR_MESSAGE, et as RoomMailbox, f as ConflictSide, ft as SHELL_JAR_UNREACHABLE, g as DisplayLevel, gt as ShellGotoOptions, h as DisplayCause, ht as ShellFrameMessage, i as Account, it as RoomPermission, j as OverlayRect, jt as WindowMiddleControl, k as MiddleControl, kt as WINDOW_HELLO_TIMEOUT_MS, l as AdoptState, lt as SHELL_CONTROL_KEY, m as ConnectOptions, mt as ShellControl, n as ATTACH_WINDOW_KEY, nt as RoomMessage, o as AccountPinOptions, ot as RoomsErrorCode, p as ConnectAvailability, pt as SetOverlayHost, q as RoomClaimOptions, r as ATTACH_WINDOW_MESSAGE, rt as RoomOpenOptions, s as AddressLookupResult, st as RoomsFail, t as ATTACH_FRAME_KEY, tt as RoomMember, u as ConflictChoice, ut as SHELL_FRAME_MESSAGE, v as EncryptionState, vt as StorageEntry, w as HiddenSurface, wt as TcpSocketResult, x as FrameConsentRequest, xt as TcpSocketListenerOptions, y as FRAME_MESSAGE, yt as StorageQuota, z as ProxyFetch } from "./contract-BRc2ptdC.js";
|
|
3
|
+
export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AccountChange, AccountPinOptions, AddressLookupResult, AdoptRequest, AdoptState, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, MiddleControl, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, ROOM_TEMPORARY_MS, Radii, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
|
package/dgram.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
2
|
+
import { Dt as UdpSocketResult, G as Resolvers } from "./contract-BRc2ptdC.js";
|
|
3
|
+
import "./api-Cbty0JUM.js";
|
|
4
4
|
import { Buffer } from "buffer";
|
|
5
5
|
import { AddressInfo } from "net";
|
|
6
6
|
import { EventEmitter } from "events";
|
package/dns.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-BTyRnUPI.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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../index-BQgZVQl7.js";
|
|
2
|
-
import { v as promises } from "../index-
|
|
2
|
+
import { v as promises } from "../index-D2lvaQDs.js";
|
|
3
3
|
//#region src/fs/promises.d.ts
|
|
4
4
|
export declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
|
|
5
5
|
recursive?: boolean;
|
package/fs/promises.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as e } from "../fs-
|
|
1
|
+
import { v as e } from "../fs-q7Kg51hq.js";
|
|
2
2
|
//#region src/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-BTyRnUPI.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./busy-Dv8wzE5M.cjs"),n=require("./node-fs-nfX7wisL.cjs"),r=require("./messages.cjs"),i=require("./storage-BS5WMO4f.cjs"),a=require("./opfs-CXMESVLc.cjs");var o=e.t({adopt:()=>R,adoptable:()=>B,available:()=>f,captureAccount:()=>s,list:()=>ve,onConflict:()=>Se,pending:()=>ue,pendingDeletes:()=>de,pull:()=>P,readFile:()=>ye,readFileSealed:()=>N,remove:()=>xe,replicating:()=>fe,writeFile:()=>be}),s=i.o,c,l=async()=>await(c??=a.t().catch(()=>!1))?!0:(c=void 0,!1),u=()=>i.a().catch(()=>`unknown`),d=async()=>await u()===`connected`,f=async()=>await l()||await d(),ee=`fkn:fs:pending`,te=`fkn:fs:pending-delete`,p=`fkn:fs:adopt-declined`,m=!0,ne=new Map,re=null,ie=(e,t)=>{if(e===null)return!1;if(`generation`in e&&`generation`in t)return e.generation===t.generation;let n=e=>`pin`in e?e.pin:i.d(e),r=n(e);return r!==void 0&&r===n(t)},h=(e,t)=>ie(re,t)?ne.get(e)??null:null,g=e=>e===`write`?ee:te,_=e=>{try{let t=localStorage.getItem(g(e));if(!t)return{};let n=JSON.parse(t);if(Array.isArray(n))return Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,{base:null,pin:null}]));if(!n||typeof n!=`object`)return{};let r={};for(let[e,t]of Object.entries(n))if(t===null||typeof t==`string`)r[e]={base:t,pin:null};else if(typeof t==`object`){let{base:n,pin:i}=t;r[e]={base:typeof n==`string`?n:null,pin:typeof i==`string`&&i?i:null}}return r}catch{return{}}},v=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(g(e),JSON.stringify(t)):localStorage.removeItem(g(e))}catch{}},ae=()=>{try{let e=JSON.parse(localStorage.getItem(p)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}},y=new Map,oe=e=>`pin`in e?e.pin:i.d(e)??null,se=(e,t,n,r)=>{let i=_(e),a=i[t],o=oe(r);a&&o!==null&&a.pin===o||(i[t]={base:a?a.base:n,pin:o},v(e,i),o===null&&`generation`in r?y.set(`${e}:${t}`,r):y.delete(`${e}:${t}`))},ce=(e,t)=>{y.delete(`${e}:${t}`);let n=_(e);t in n&&(delete n[t],v(e,n),E()||(O=D))},b=(e,t,n)=>se(`write`,e,t,n),x=e=>ce(`write`,e),le=(e,t)=>se(`delete`,e,h(e,t),t),S=e=>ce(`delete`,e),ue=()=>Object.keys(_(`write`)),de=()=>Object.keys(_(`delete`)),fe=()=>m,C=new Map,pe=e=>C.get(e)===i.o().generation,me=(e,t,n)=>n.pin===null&&!y.has(`${e}:${t}`),w=null,T=!1;t.r(`storage replication`,()=>w!==null||V!==null);var E=()=>[`write`,`delete`].some(e=>Object.entries(_(e)).some(([t,n])=>n.pin===null?!me(e,t,n):!pe(n.pin))),D=6e4,he=6e5,O=D,k=null,A=()=>{!k&&typeof window<`u`&&E()&&(k=setTimeout(()=>{k=null,j()},O),O=Math.min(O*2,he))},j=()=>{if(w){T=!0;return}E()&&(w=Oe(!1,i.o()).then(e=>{if(!E()){O=D;return}e.failed.length&&A()}).catch(()=>{A()}).finally(()=>{w=null,ge()}))},ge=()=>{T&&(T=!1,j())},_e=null,M=()=>_e??=Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.apiPromise),ve=async e=>{let t=e?.pin??i.o();W();let n=await u(),r=n===`connected`,[o,s]=await Promise.all([l().then(e=>e?a.n():[]).catch(()=>[]),r?i.f({pin:t}).then(e=>({ok:!0,entries:e}),e=>({ok:!1,entries:[],changed:i.c(e)?e:void 0})):Promise.resolve({ok:n===`disconnected`,entries:[]})]);if(n!==`unknown`&&(m=s.ok),s.ok&&n!==`unknown`&&(ne=new Map(s.entries.map(e=>[e.path,e.updatedAt])),re=t),s.changed)throw s.changed;let c=new Map,d=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},f=e=>{let t=c.get(e.path);(!t||d(e)>=d(t))&&c.set(e.path,e)};for(let e of o)f(e);for(let e of s.entries)f(e);return s.ok&&r&&(Fe(o,s.entries).catch(()=>{}),E()?j():U({local:o,remote:s.entries,from:t}).catch(()=>{})),[...c.values()]},ye=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{return await a.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let r=await i.h(e,{pin:n});return await l()&&a.o(e,r).catch(()=>{}),r},N=async(e,t)=>{let n=t?.pin??i.o();if(await l())try{let t=await a.i(e);return{data:new Uint8Array(await t.arrayBuffer()),sealedAt:null}}catch(e){if(e?.name!==`NotFoundError`)throw e}return i.g(e,{pin:n})},be=async(e,t,n)=>{let r=n?.pin??i.o(),o=n?.contentType,s=o?{contentType:o}:void 0,c=t instanceof Blob?t:new Blob([t],s?{type:s.contentType}:void 0);if(await l()){await a.o(e,c,s),W();let t=h(e,r),n=await u();if(n===`disconnected`)return;if(n===`unknown`||!m){b(e,t,r),A();return}i.b(e,c,{...s,pin:r}).then(()=>x(e)).catch(n=>{b(e,t,r),i.c(n)||A(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let d=await u();if(d===`connected`)return i.b(e,c,{...s,pin:r});throw Error(d===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},xe=async(e,t)=>{let n=t?.pin??i.o();W();let r=[];await l()&&r.push(a.a(e).catch(()=>{}));let o=await u();if(o===`connected`?r.push(i._(e,{pin:n}).then(()=>S(e)).catch(t=>{le(e,n),i.c(t)||A(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):o===`unknown`&&r.length&&h(e,n)!==null&&(le(e,n),A()),!r.length)throw Error(o===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);x(e),await Promise.all(r)},P=async e=>{let t=i.o(),n=await i.h(e,{pin:t});return await l()&&await a.o(e,n),n},F=null,Se=e=>(F=e,()=>{F===e&&(F=null)}),Ce=async e=>{let t=await(await M()).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null);return t===`local`?e.readLocal():t===`cloud`?e.readCloud():null},we=async e=>{if(F)try{return await F(e)}catch{return null}return Ce(e)},I=class extends Error{},L=e=>e instanceof Error?e.message:String(e),Te=()=>{let e=new Map,t=t=>{let n=e.get(t);return n||e.set(t,n={writes:new Map,deletes:new Map}),n};for(let[e,n]of Object.entries(_(`write`)))t(n.pin).writes.set(e,n.base);for(let[e,n]of Object.entries(_(`delete`)))t(n.pin).deletes.set(e,n.base);return e},Ee=async()=>{for(let[e,t]of[...y]){let n=e.startsWith(`write:`)?`write`:`delete`,r=e.slice(n.length+1),a;try{a=await i.p(t)}catch(t){i.c(t)&&y.delete(e);continue}if(y.get(e)!==t)continue;y.delete(e);let o=_(n),s=o[r];s&&s.pin===null&&(o[r]={base:s.base,pin:a},v(n,o))}},De=async(e,t,n,r,o,s)=>{let c=new Map(t.map(e=>[e.path,e])),l=e=>{if(i.c(e))throw new I};for(let[t,a]of e.deletes){let e=c.get(t);if(!e){S(t);continue}if(r.some(e=>e.path===t)){S(t);continue}if(e.updatedAt!==a){S(t);continue}try{await i._(t,n),S(t),o.deleted.push(t)}catch(e){l(e),o.failed.push({path:t,error:L(e)})}}for(let t of r){let r=c.get(t.path),u=e.writes.has(t.path);if(!u){if(!s(t))continue;if(r){o.kept.push(t.path);continue}}let d=e.writes.get(t.path)??null;if(u&&r&&r.updatedAt!==d){let e=null,s=null,c=await we({path:t.path,local:{size:t.size,updatedAt:t.updatedAt},cloud:{size:r.size,updatedAt:r.updatedAt},readLocal:()=>e??=a.i(t.path),readCloud:()=>s??=i.h(t.path,n)});if(c==null){o.unresolved.push(t.path);continue}try{let r=e!==null&&c===await e,l=s!==null&&c===await s;l||await i.b(t.path,c,t.contentType?{contentType:t.contentType,...n}:n),r||await a.o(t.path,c),x(t.path),o.resolved.push({path:t.path,choice:r?`local`:l?`cloud`:`merged`})}catch(e){if(l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}continue}try{let e=await a.i(t.path);await i.b(t.path,e,t.contentType?{contentType:t.contentType,...n}:n),x(t.path),o.uploaded.push(t.path)}catch(e){if(u||b(t.path,r?.updatedAt??null,n.pin),l(e),e?.code===`FKN_E2E_LOCKED`)throw e;o.failed.push({path:t.path,error:L(e)})}}},Oe=async(e,t)=>{let n={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},r=await u();if(r===`unknown`)throw Error(`fs: cloud unreachable`);if(r!==`connected`)throw Error(`fs: this needs a signed-in account`);let o=await l(),s=o?await a.n():[];if(o)for(let e of Object.keys(_(`write`)))s.some(t=>t.path===e)||x(e);await Ee();for(let[e,r]of Te()){if(e===null||pe(e))continue;let a={pin:{pin:e}},o;try{o=await i.f(a)}catch(n){if(i.c(n)){C.set(e,t.generation);continue}if(i.l(n)){ke(e);continue}throw n}try{await De(r,o,a,s,n,()=>!1)}catch(n){if(!(n instanceof I))throw n;C.set(e,t.generation)}}if(e){let e={pin:t},r=await i.f(e),a=_(`write`),o=Te().get(null)??{writes:new Map,deletes:new Map},c=new Set([...n.uploaded,...n.resolved.map(({path:e})=>e),...n.unresolved,...n.failed.map(({path:e})=>e)]),l=e=>!(e.path in a)&&!c.has(e.path);try{await De(o,r,e,s,n,l)}catch(e){throw e instanceof I?new i.t:e}}return n},ke=e=>{for(let t of[`write`,`delete`]){let n=_(t),r=!1;for(let t of Object.values(n))t.pin===e&&(t.pin=null,r=!0);r&&v(t,n)}},Ae=async e=>{for(;w;)await w;let t=Oe(!0,e);w=t.then(()=>{},()=>{});try{return await t}finally{w=null,ge()}},R=()=>Ae(i.o()),z=(e,t)=>{let n=new Set(t.map(e=>e.path)),r=_(`write`);return e.filter(e=>{let t=r[e.path];return t?me(`write`,e.path,t):!n.has(e.path)})},B=async()=>{let e=i.o();if(!await d()||!await l())return{paths:[],bytes:0};let[t,n]=await Promise.all([a.n(),i.f({pin:e})]),r=z(t,n);return{paths:r.map(e=>e.path),bytes:r.reduce((e,t)=>e+t.size,0)}},je=()=>new Set(Object.keys(ae())),Me=e=>{let t=ae();for(let n of e)t[n]=null;try{localStorage.setItem(p,JSON.stringify(t))}catch{}},V=null,H=!1,U=e=>{if(V)return H=!0,V;let t=e?.from??i.o();return V=(async()=>{if(!await d())return;let n=e??(await l()?{local:await a.n(),remote:await i.f({pin:t})}:null);if(!n)return;let r=je(),o=z(n.local,n.remote).filter(e=>!r.has(e.path));if(!o.length)return;let s=await M(),c=o.reduce((e,t)=>e+t.size,0);if(!await s.cloud.fs.promptAdopt({files:o.length,bytes:c}).catch(()=>!1)){Me(o.map(e=>e.path));return}`generation`in t&&await Ae(t)})().catch(()=>{}).finally(()=>{V=null,H&&(H=!1,U())}),V},Ne=null,Pe=!1,Fe=async(e,t)=>{let n=z(e,t),r=await M(),i=async()=>{await R().catch(()=>{});let e=await B().catch(()=>({paths:[],bytes:0}));await r.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},i).catch(()=>{})},a={files:n.length,bytes:n.reduce((e,t)=>e+t.size,0)};Ne=()=>{r.cloud.fs.setAdoptSource(a,i).catch(()=>{})},Pe||(Pe=!0,Promise.resolve().then(()=>require("./api.cjs")).then(e=>e.onApiEpoch((e,t)=>{t>1&&Ne?.()})).catch(()=>{})),await r.cloud.fs.setAdoptSource(a,i)},Ie=!1,W=()=>{Ie||typeof window>`u`||(Ie=!0,window.addEventListener(`online`,()=>{j()}),Promise.resolve().then(()=>require("./account.cjs")).then(e=>e.onChange(()=>{U().catch(()=>{}),j()})).catch(()=>{}))},Le=e.t({STORAGE_ACCOUNT_CHANGED:()=>r.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>r.STORAGE_ACCOUNT_PIN_UNSUPPORTED,StorageAccountChangedError:()=>i.t,StorageAccountPinUnsupportedError:()=>i.n,adopt:()=>J,adoptable:()=>Y,appendFile:()=>et,appendFileSync:()=>He,available:()=>ze,default:()=>dt,exists:()=>st,existsSync:()=>Ue,flush:()=>G,isAccountChanged:()=>i.c,lstatSync:()=>Ge,mkdir:()=>rt,mkdirSync:()=>qe,mount:()=>lt,onConflict:()=>$,pending:()=>X,pendingDeletes:()=>Z,promises:()=>ct,pull:()=>K,readFile:()=>Qe,readFileSealed:()=>q,readFileSync:()=>Be,readdir:()=>nt,readdirSync:()=>Ke,remount:()=>ut,rename:()=>ot,renameSync:()=>Ze,replicating:()=>Q,rm:()=>it,rmSync:()=>Je,rmdirSync:()=>Ye,stat:()=>tt,statSync:()=>We,unlink:()=>at,unlinkSync:()=>Xe,writeFile:()=>$e,writeFileSync:()=>Ve}),Re=n.t(o,{memfs:!0}),{available:ze,readFileSync:Be,writeFileSync:Ve,appendFileSync:He,existsSync:Ue,statSync:We,lstatSync:Ge,readdirSync:Ke,mkdirSync:qe,rmSync:Je,rmdirSync:Ye,unlinkSync:Xe,renameSync:Ze,readFile:Qe,writeFile:$e,appendFile:et,stat:tt,readdir:nt,mkdir:rt,rm:it,unlink:at,rename:ot,exists:st,promises:ct,mount:lt,flush:G,remount:ut}=Re,K=P,q=N,J=R,Y=B,X=ue,Z=de,Q=fe,$=Se,dt={...Re,pull:K,readFileSealed:q,adopt:J,adoptable:Y,pending:X,pendingDeletes:Z,replicating:Q,onConflict:$};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return rt}}),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 He}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return K}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
2
|
+
import { _ as unlock, a as StorageAccountChangedError, c as StorageNotFoundError, f as encryption, g as storage_d_exports, h as quota, i as SealedRead, l as StorageQuota, m as isNotFound, n as EncryptionStatus, o as StorageAccountPinUnsupportedError, p as isAccountChanged, r as FileEntry, s as StorageLockedError, t as CloudAvailability, u as availability } from "./storage-BVr2Rb-d.js";
|
|
3
|
+
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, u as STORAGE_NOT_FOUND } from "./messages-CRcziTuC.js";
|
|
4
4
|
declare namespace fs_d_exports {
|
|
5
|
-
export { EncryptionStatus, FileEntry, STORAGE_NOT_FOUND, SealedRead, Stats, StorageLockedError, StorageNotFoundError, StorageQuota, available, encryption, isNotFound, mkdir, promises, quota, readFile, readFileSealed, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
|
5
|
+
export { CloudAvailability, EncryptionStatus, FileEntry, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, SealedRead, Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, StorageLockedError, StorageNotFoundError, StorageQuota, availability, available, encryption, isAccountChanged, isNotFound, list, mkdir, promises, quota, readFile, readFileSealed, readdir, rename, rm, stat, unlink, unlock, writeFile };
|
|
6
6
|
}
|
|
7
7
|
declare const available: () => Promise<boolean>, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
|
|
8
8
|
recursive?: boolean;
|
|
@@ -23,5 +23,9 @@ declare const available: () => Promise<boolean>, readFile: (path: import("node:f
|
|
|
23
23
|
lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
|
|
24
24
|
access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
25
25
|
};
|
|
26
|
+
/** Every object of this app in the account, with the server's stamps. */
|
|
27
|
+
declare const list: () => Promise<FileEntry[]>;
|
|
28
|
+
/** Not part of the node-style surface above, since node has no concept of a seal time; `readFile` is untouched. */
|
|
29
|
+
declare const readFileSealed: (path: string) => Promise<SealedRead>;
|
|
26
30
|
//#endregion
|
|
27
|
-
export {
|
|
31
|
+
export { promises as a, readdir as c, stat as d, unlink as f, mkdir as i, rename as l, fs_d_exports as n, readFile as o, writeFile as p, list as r, readFileSealed as s, available as t, rm as u };
|