@fkn/lib 0.9.34 → 0.9.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account.cjs +1 -1
- package/account.d.ts +6 -6
- package/account.js +3 -3
- package/{api-Bgsg9t9D.d.ts → api-CfmRAze5.d.ts} +1 -1
- package/{api-BdTgLphT.js → api-CtiKFcK3.js} +2 -2
- package/{api-MW-Lm0u8.cjs → api-Djf-XdZ4.cjs} +2 -2
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/attach-policy.d.ts +5 -5
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.d.ts +3 -4
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +2 -2
- package/cloud/fs.js +2 -2
- package/cloud/net.d.ts +1 -1
- package/cloud-B9Sd7V1g.js +422 -0
- package/cloud-DCWD_0sd.cjs +1 -0
- package/{cloud-C40YCPuv.d.ts → cloud-DxitkM7z.d.ts} +9 -5
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +2 -2
- package/{contract-Gd543I6m.d.ts → contract-D37GGkou.d.ts} +126 -1
- package/contract.cjs +1 -0
- package/contract.d.ts +2 -2
- package/contract.js +28 -0
- package/desktop.d.ts +7 -7
- package/dgram.cjs +1 -1
- package/dgram.d.ts +5 -5
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -3
- package/dns.js +1 -1
- package/extension-DJQ0oYdk.js +89 -0
- package/extension-DSrUjoLw.cjs +1 -0
- package/{extension-Bm-PwsD6.d.ts → extension-TRYu_aG-.d.ts} +16 -13
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +3 -3
- package/fs/promises.js +1 -1
- package/{fs-CYcErwc4.d.ts → fs--NhtUyYa.d.ts} +1 -1
- package/{fs-O2bp9J0x.js → fs-BvNZePtN.js} +4 -4
- package/{fs-Bv3aFjqA.cjs → fs-D8RCGFNc.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.d.ts +20 -20
- package/{index-DIK21kfh.d.ts → index-C_Lqta5o.d.ts} +110 -5
- package/{index-Cg6y_FTi.d.ts → index-kuPqkS_-.d.ts} +26 -3
- package/index.cjs +1 -1
- package/index.d.ts +25 -10
- package/index.js +51 -45
- package/{lib-C3f3XmGZ.js → lib-B-jGWfsv.js} +110 -60
- package/lib-Cjd91q7g.cjs +53 -0
- package/{net-BBtYFEzu.d.ts → net-0SlODFSM.d.ts} +2 -2
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/node-fs-BNTPsX5c.cjs +1 -0
- package/{node-fs-C9ECR_9H.js → node-fs-BZy9bzKd.js} +2 -2
- package/opfs/promises.d.ts +2 -2
- package/opfs.cjs +1 -1
- package/opfs.d.ts +2 -2
- package/opfs.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +27 -27
- package/packages.js +1 -1
- package/{proxy-XeHtHIdZ.d.ts → proxy-Bmb2wxG1.d.ts} +2 -2
- package/{proxy-_m6Sqcr6.cjs → proxy-CYcaW5ew.cjs} +1 -1
- package/{proxy-fXckOcRn.js → proxy-DDwY3AVG.js} +1 -1
- package/react.d.ts +3 -3
- package/rooms.cjs +1 -1
- package/rooms.d.ts +8 -8
- package/rooms.js +1 -1
- package/{storage-C6Cd4J5E.js → storage-BbcnDCnc.js} +1 -1
- package/{storage-WZEvw3KN.d.ts → storage-ZrY4Y4L5.d.ts} +21 -2
- package/{storage-D2eBifiu.cjs → storage-dSi2dUKx.cjs} +1 -1
- package/cloud-DBNeXS9R.js +0 -272
- package/cloud-DHuqVKrl.cjs +0 -1
- package/extension-DALH11b4.js +0 -87
- package/extension-lR-cSs2P.cjs +0 -1
- package/lib-WiHTYaNP.cjs +0 -53
- package/node-fs-DZPGCYWg.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./busy-Dv8wzE5M.cjs");let t=require("buffer");var n={json:`application/json`,txt:`text/plain`,html:`text/html`,htm:`text/html`,css:`text/css`,js:`text/javascript`,mjs:`text/javascript`,xml:`application/xml`,csv:`text/csv`,md:`text/markdown`,svg:`image/svg+xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,pdf:`application/pdf`,wasm:`application/wasm`},r=(e,t)=>{if(t)return t;let r=e.split(`/`).pop()??``,i=r.lastIndexOf(`.`);if(!(i<=0))return n[r.slice(i+1).toLowerCase()]},i=(e,t)=>({size:e,mtimeMs:t,mtime:new Date(t),atimeMs:t,ctimeMs:t,mode:420,isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}),a=(e=0)=>({size:0,mtimeMs:e,mtime:new Date(e),atimeMs:e,ctimeMs:e,mode:493,isFile:()=>!1,isDirectory:()=>!0,isSymbolicLink:()=>!1}),o=(e,t,n)=>{let r=Error(`${e}: ${{ENOENT:`no such file or directory`,EEXIST:`file already exists`,ENOTDIR:`not a directory`,EISDIR:`illegal operation on a directory`,ENOTEMPTY:`directory not empty`,ERR_FS_EISDIR:`is a directory`}[e]??e}, ${n} '${t}'`);return r.code=e,r.path=t,r.syscall=n,r},s=e=>{let t=[];for(let n of e.split(`/`))if(n&&n!==`.`){if(n===`..`){t.pop();continue}t.push(n)}return t.join(`/`)},c=e=>e.split(`/`).slice(0,-1).join(`/`),l=e=>typeof e==`string`?e:e instanceof URL?decodeURIComponent(e.pathname):e.toString(),u=e=>typeof e==`string`?e:e?.encoding??void 0,d=e=>typeof e==`object`?e?.contentType:void 0,f=e=>typeof e==`object`&&!!e?.recursive,p=(e,n)=>{let r=u(n);return r?t.Buffer.from(e).toString(r):t.Buffer.from(e)},m=(e,n)=>{if(typeof e==`string`)return new Uint8Array(t.Buffer.from(e,u(n)??`utf8`));if(e instanceof Uint8Array)return e.slice();if(e instanceof ArrayBuffer)return new Uint8Array(e).slice();if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength).slice();throw TypeError(`The "data" argument must be of type string, Buffer, TypedArray, or DataView`)},h=t=>{let n=new Map([[``,{kind:`dir`,mtimeMs:0}]]),l=new Set,u=new Set;e.r(`unsaved files`,()=>l.size>0||u.size>0);let d=new Set,f=()=>Date.now(),p=e=>{if(!e)return;let t=e.split(`/`),r=``;for(let e of t){r=r?`${r}/${e}`:e;let t=n.get(r);if(!t)n.set(r,{kind:`dir`,mtimeMs:f()});else if(t.kind===`file`)throw o(`ENOTDIR`,r,`mkdir`)}},m,h=0,g=async()=>{let e=await t.list().catch(()=>[]),r=new Set,i=!1;for(let a of e){let e=s(a.path);if(r.add(e),!u.has(e)&&(!l.has(e)||d.has(e)))try{let r=await(await t.readFile(a.path)).arrayBuffer();if(u.has(e)||l.has(e)&&!d.has(e))continue;p(c(e));let i=Date.parse(a.updatedAt??``);n.set(e,{kind:`file`,data:new Uint8Array(r),mtimeMs:Number.isFinite(i)?i:f(),contentType:a.contentType??void 0}),d.delete(e),l.delete(e)}catch{i=!0,d.add(e)}}for(let e of d)r.has(e)||d.delete(e);h=i?Date.now():0},_=()=>(m&&(h===0||Date.now()-h<5e3)||(m=g()),m),v=async()=>{m=void 0,h=0,await _()},y=async()=>{let e=[...l].map(async e=>{if(d.has(e))return;let i=n.get(e);if(i?.kind!==`file`){l.delete(e);return}let a=i.data,o=r(e,i.contentType);try{await t.writeFile(e,a,o?{contentType:o}:void 0);let r=n.get(e);r?.kind===`file`&&r.data===a&&l.delete(e)}catch{}}),i=[...u].map(async e=>{try{await t.remove(e),u.delete(e)}catch{}});await Promise.all([...e,...i])},b,x=()=>{b||=setTimeout(()=>{b=void 0,y().catch(()=>{})},250)};typeof addEventListener<`u`&&(addEventListener(`pagehide`,()=>{y().catch(()=>{})}),addEventListener(`visibilitychange`,()=>{typeof document<`u`&&document.visibilityState===`hidden`&&y().catch(()=>{})}));let S=e=>e.kind===`file`?i(e.data.byteLength,e.mtimeMs):a(e.mtimeMs),C=e=>Object.assign(Error(`storage: ${e} exists but could not be read, retry once its scope is available`),{code:`FKN_E2E_LOCKED`}),w=e=>{let t=s(e);return n.has(t)||d.has(t)},T=e=>{let t=s(e),r=n.get(t);if(!r)throw d.has(t)?C(e):o(`ENOENT`,e,`stat`);return S(r)},E=e=>{let t=s(e),r=n.get(t);if(!r)throw d.has(t)?C(e):o(`ENOENT`,e,`open`);if(r.kind===`dir`)throw o(`EISDIR`,e,`read`);return r.data},D=(e,t)=>{let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n},O=(e,t,r,i)=>{let a=s(e);if(!a)throw o(`EISDIR`,e,`open`);if(d.has(a))throw C(e);let m=n.get(a);if(m?.kind===`dir`)throw o(`EISDIR`,e,`open`);p(c(a));let h=r&&m?.kind===`file`?D(m.data,t):t;n.set(a,{kind:`file`,data:h,mtimeMs:f(),contentType:i??(m?.kind===`file`?m.contentType:void 0)}),l.add(a),u.delete(a),x()},k=(e,t)=>{let r=s(e);if(r){if(n.has(r)){if(t)return;throw o(`EEXIST`,e,`mkdir`)}if(!t&&!n.has(c(r)))throw o(`ENOENT`,e,`mkdir`);p(r)}},A=e=>{let t=s(e),r=n.get(t);if(!r)throw o(`ENOENT`,e,`scandir`);if(r.kind===`file`)throw o(`ENOTDIR`,e,`scandir`);let i=t?`${t}/`:``,a=new Set;for(let e of[...n.keys(),...d]){if(!e||!e.startsWith(i))continue;let t=e.slice(i.length);t&&a.add(t.split(`/`)[0])}return[...a]},j=(e,{op:t,recursive:r,force:i})=>{let a=s(e),c=n.get(a);if(!c&&d.has(a)){if(t===`rmdir`)throw o(`ENOTDIR`,e,`rmdir`);d.delete(a),l.delete(a),u.add(a),x();return}if(!c){if(i||t===`rmdir`&&r)return;throw o(`ENOENT`,e,t===`rmdir`?`rmdir`:`unlink`)}if(t===`unlink`&&c.kind===`dir`)throw o(`EISDIR`,e,`unlink`);if(t===`rmdir`&&c.kind===`file`)throw o(`ENOTDIR`,e,`rmdir`);if(t===`rm`&&c.kind===`dir`&&!r)throw o(`ERR_FS_EISDIR`,e,`rm`);let f=`${a}/`,p=[...n.keys()].filter(e=>e.startsWith(f));if(p.length&&!r)throw o(`ENOTEMPTY`,e,`rmdir`);for(let e of[a,...p]){let t=n.get(e);n.delete(e),t?.kind===`file`&&(l.delete(e),u.add(e))}x()};return{mount:_,remount:v,flush:y,exists:w,stat:T,readFile:E,writeFile:O,mkdir:k,readdir:A,remove:j,rename:(e,t)=>{let r=s(e),i=s(t);if(!r)throw o(`EBUSY`,e,`rename`);if(i===r||i.startsWith(`${r}/`))throw o(`EINVAL`,e,`rename`);if(d.has(r))throw C(e);if(d.has(i))throw C(t);let a=n.get(r);if(!a)throw o(`ENOENT`,e,`rename`);let f=n.get(i);if(f){if(f.kind!==a.kind)throw o(a.kind===`dir`?`ENOTDIR`:`EISDIR`,t,`rename`);j(i,{op:`rm`,recursive:!0,force:!0})}p(c(i));let m=`${r}/`,h=[r,...[...n.keys()].filter(e=>e.startsWith(m))];for(let e of h){let t=i+e.slice(r.length),a=n.get(e);n.set(t,a),n.delete(e),a.kind===`file`&&(l.add(t),u.delete(t),l.delete(e),u.add(e))}x()}}},g=(e,t)=>typeof e==`function`?e:t,_=e=>typeof e==`function`?void 0:e,v=(e,t)=>{e.then(e=>t(null,e),e=>t(e))},y=e=>{let t=h(e),n=(e,n)=>p(t.readFile(l(e)),n),r=(e,n,r)=>t.writeFile(l(e),m(n,r),!1,d(r)),i=(e,n,r)=>t.writeFile(l(e),m(n,r),!0,d(r)),a=e=>t.exists(l(e)),s=e=>t.stat(l(e)),c=e=>t.readdir(l(e)),u=(e,n)=>t.mkdir(l(e),f(n)),v=(e,n)=>t.remove(l(e),{op:`rm`,...n}),y=(e,n)=>t.remove(l(e),{op:`rmdir`,...n}),b=e=>t.remove(l(e),{op:`unlink`}),x=(e,n)=>t.rename(l(e),l(n)),S=(e,n)=>{t.mount().finally(()=>{let t;try{t=e()}catch(e){n(e);return}n(null,t)})},C=e=>t.mount().then(()=>e());return{available:e.available,readFileSync:n,writeFileSync:r,appendFileSync:i,existsSync:a,statSync:s,lstatSync:s,readdirSync:c,mkdirSync:u,rmSync:v,rmdirSync:y,unlinkSync:b,renameSync:x,readFile:(e,n,r)=>S(()=>p(t.readFile(l(e)),_(n)),g(n,r)),writeFile:(e,n,r,i)=>S(()=>t.writeFile(l(e),m(n,_(r)),!1,d(_(r))),g(r,i)),appendFile:(e,n,r,i)=>S(()=>t.writeFile(l(e),m(n,_(r)),!0,d(_(r))),g(r,i)),stat:(e,n)=>S(()=>t.stat(l(e)),n),readdir:(e,n,r)=>S(()=>t.readdir(l(e)),g(n,r)),mkdir:(e,n,r)=>S(()=>t.mkdir(l(e),f(_(n))),g(n,r)),rm:(e,n,r)=>S(()=>t.remove(l(e),{op:`rm`,..._(n)}),g(n,r)),unlink:(e,n)=>S(()=>t.remove(l(e),{op:`unlink`}),n),rename:(e,n,r)=>S(()=>t.rename(l(e),l(n)),r),exists:(e,n)=>{t.mount().finally(()=>n(t.exists(l(e))))},promises:{readFile:(e,n)=>C(()=>p(t.readFile(l(e)),n)),writeFile:(e,n,r)=>C(()=>t.writeFile(l(e),m(n,r),!1,d(r))),appendFile:(e,n,r)=>C(()=>t.writeFile(l(e),m(n,r),!0,d(r))),stat:e=>C(()=>t.stat(l(e))),lstat:e=>C(()=>t.stat(l(e))),readdir:e=>C(()=>t.readdir(l(e))),mkdir:(e,n)=>C(()=>t.mkdir(l(e),f(n))),rm:(e,n)=>C(()=>t.remove(l(e),{op:`rm`,...n})),rmdir:(e,n)=>C(()=>t.remove(l(e),{op:`rmdir`,...n})),unlink:e=>C(()=>t.remove(l(e),{op:`unlink`})),rename:(e,n)=>C(()=>t.rename(l(e),l(n))),access:e=>C(()=>{if(!t.exists(l(e)))throw o(`ENOENT`,l(e),`access`)})},mount:t.mount,flush:t.flush,remount:t.remount}},b=e=>{let t=async(t,n)=>{let r=await e.readFile(l(t));return p(new Uint8Array(await r.arrayBuffer()),n)},n=async(t,n,i)=>{let a=l(t),o=r(a,d(i));await e.writeFile(a,m(n,i),o?{contentType:o}:void 0)},c=t=>e.remove(l(t)),u=async(t,n)=>{let r=s(l(t)),i=s(l(n));if(r===i)return;let a=await e.readFile(r);await e.writeFile(i,a),await e.remove(r)},f=async t=>{let n=s(l(t)),r=n?`${n}/`:``,i=new Set;for(let t of await e.list()){let e=s(t.path);if(r&&!e.startsWith(r))continue;let n=e.slice(r.length);n&&i.add(n.split(`/`)[0])}return[...i]},h=async(e,t)=>{},y=async(t,n)=>{let r=s(l(t));if(!n?.recursive){await e.remove(l(t));return}let i=`${r}/`,a=await e.list();await Promise.all(a.filter(e=>{let t=s(e.path);return t===r||t.startsWith(i)}).map(t=>e.remove(t.path).catch(()=>{})))},b=async t=>{let n=s(l(t)),r=await e.list(),c=r.find(e=>s(e.path)===n);if(c){let e=Date.parse(c.updatedAt??``);return i(c.size,Number.isFinite(e)?e:0)}if(r.some(e=>s(e.path).startsWith(`${n}/`)))return a();throw o(`ENOENT`,l(t),`stat`)},x={readFile:t,writeFile:n,unlink:c,rename:u,readdir:f,mkdir:h,rm:y,rmdir:y,stat:b,lstat:b,access:async e=>{await b(e)}};return{available:e.available,promises:x,readFile:(e,n,r)=>v(t(e,_(n)),g(n,r)),writeFile:(e,t,r,i)=>v(n(e,t,_(r)),g(r,i)),unlink:(e,t)=>v(c(e),t),rename:(e,t,n)=>v(u(e,t),n),readdir:(e,t,n)=>v(f(e),g(t,n)),mkdir:(e,t,n)=>v(h(),g(t,n)),rm:(e,t,n)=>v(y(e,_(t)),g(t,n)),stat:(e,t)=>v(b(e),t)}};function x(e,t){return t.memfs?y(e):b(e)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
|
|
@@ -56,7 +56,7 @@ var n = {
|
|
|
56
56
|
return r.code = e, r.path = t, r.syscall = n, r;
|
|
57
57
|
}, s = (e) => {
|
|
58
58
|
let t = [];
|
|
59
|
-
for (let n of e.split("/")) if (
|
|
59
|
+
for (let n of e.split("/")) if (n && n !== ".") {
|
|
60
60
|
if (n === "..") {
|
|
61
61
|
t.pop();
|
|
62
62
|
continue;
|
|
@@ -95,7 +95,7 @@ var n = {
|
|
|
95
95
|
let e = await t.list().catch(() => []), r = /* @__PURE__ */ new Set(), i = !1;
|
|
96
96
|
for (let a of e) {
|
|
97
97
|
let e = s(a.path);
|
|
98
|
-
if (r.add(e), !u.has(e) && !
|
|
98
|
+
if (r.add(e), !u.has(e) && (!l.has(e) || d.has(e))) try {
|
|
99
99
|
let r = await (await t.readFile(a.path)).arrayBuffer();
|
|
100
100
|
if (u.has(e) || l.has(e) && !d.has(e)) continue;
|
|
101
101
|
p(c(e));
|
package/opfs/promises.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../index-BQgZVQl7.js";
|
|
2
2
|
import { promises } from "../opfs.js";
|
|
3
3
|
//#region src/opfs/promises.d.ts
|
|
4
|
-
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?: {
|
|
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;
|
|
6
6
|
force?: boolean;
|
|
7
7
|
}) => Promise<void>, rmdir: (path: import("node:fs").PathLike, options?: {
|
|
8
8
|
recursive?: boolean;
|
|
9
9
|
}) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export {
|
|
11
|
+
export { promises as default };
|
package/opfs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./node-fs-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./node-fs-BNTPsX5c.cjs"),n=require("./opfs-CXMESVLc.cjs");var r=e.t({appendFile:()=>b,appendFileSync:()=>c,available:()=>a,default:()=>i,exists:()=>D,existsSync:()=>l,flush:()=>A,lstatSync:()=>d,mkdir:()=>C,mkdirSync:()=>p,mount:()=>k,promises:()=>O,readFile:()=>v,readFileSync:()=>o,readdir:()=>S,readdirSync:()=>f,remount:()=>j,rename:()=>E,renameSync:()=>_,rm:()=>w,rmSync:()=>m,rmdirSync:()=>h,stat:()=>x,statSync:()=>u,unlink:()=>T,unlinkSync:()=>g,writeFile:()=>y,writeFileSync:()=>s}),i=t.t(n.r,{memfs:!0}),{available:a,readFileSync:o,writeFileSync:s,appendFileSync:c,existsSync:l,statSync:u,lstatSync:d,readdirSync:f,mkdirSync:p,rmSync:m,rmdirSync:h,unlinkSync:g,renameSync:_,readFile:v,writeFile:y,appendFile:b,stat:x,readdir:S,mkdir:C,rm:w,unlink:T,rename:E,exists:D,promises:O,mount:k,flush:A,remount:j}=i;exports.appendFile=b,exports.appendFileSync=c,exports.available=a,exports.default=i,exports.exists=D,exports.existsSync=l,exports.flush=A,exports.lstatSync=d,exports.mkdir=C,exports.mkdirSync=p,exports.mount=k,exports.promises=O,exports.readFile=v,exports.readFileSync=o,exports.readdir=S,exports.readdirSync=f,exports.remount=j,exports.rename=E,exports.renameSync=_,exports.rm=w,exports.rmSync=m,exports.rmdirSync=h,exports.stat=x,exports.statSync=u,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}}),exports.unlink=T,exports.unlinkSync=g,exports.writeFile=y,exports.writeFileSync=s;
|
package/opfs.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ declare const fs: {
|
|
|
57
57
|
flush: () => Promise<void>;
|
|
58
58
|
remount: () => Promise<void>;
|
|
59
59
|
};
|
|
60
|
-
declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
|
|
60
|
+
export declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
|
|
61
61
|
recursive?: boolean;
|
|
62
62
|
force?: boolean;
|
|
63
63
|
}) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
|
|
@@ -85,4 +85,4 @@ declare const available: () => Promise<boolean>, readFileSync: (path: import("no
|
|
|
85
85
|
access: (path: import("node:fs").PathLike) => Promise<void>;
|
|
86
86
|
}, mount: () => Promise<void>, flush: () => Promise<void>, remount: () => Promise<void>;
|
|
87
87
|
//#endregion
|
|
88
|
-
export { type Stats,
|
|
88
|
+
export { type Stats, fs as default, index_d_exports as t };
|
package/opfs.js
CHANGED
package/package.json
CHANGED
package/packages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs"),n=require("./busy-Dv8wzE5M.cjs");let r=require("osra");var i=e.t({attach:()=>j,connect:()=>T,hide:()=>w,install:()=>p,isVisible:()=>G,list:()=>m,mount:()=>A,onConnect:()=>W,onVisibilityChange:()=>K,pick:()=>f,search:()=>d,show:()=>C,uninstall:()=>h}),a=`fkn-packages-connection`,o=3e4,s=(e,t)=>Object.assign(Error(t),{code:e}),c=async()=>{if(!t.c)throw s(`unavailable`,`packages: no FKN transport in this realm - use relayWorker to bridge workers`);return t.a},l=(e,t,n)=>(0,r.expose)(e??{},{transport:t,key:a,unregisterSignal:n}),u=async(e,t,n={})=>{let{signal:r,closed:i}=n;if(r?.aborted)throw s(`unavailable`,`packages.connect: aborted before connecting`);let a=new AbortController;r&&r.addEventListener(`abort`,()=>a.abort(r.reason),{once:!0});let c=new AbortController,u=new Promise((e,n)=>{let a=setTimeout(()=>n(s(`timeout`,`packages.connect: the package did not complete the connection`)),o);c.signal.addEventListener(`abort`,()=>clearTimeout(a),{once:!0}),t.addEventListener(`message`,e=>{if(e.data?.type===`fkn-packages-nack`){let t=e.data.message;n(s(`unavailable`,typeof t==`string`&&t?t:`packages.connect: the package refused the connection`))}},{signal:c.signal}),t.start(),r&&r.addEventListener(`abort`,()=>n(s(`unavailable`,`packages.connect: aborted before connecting`)),{once:!0,signal:c.signal}),i?.then(()=>n(s(`unavailable`,`packages.connect: the package closed before connecting`)))});try{return await Promise.race([l(e,t,a.signal),u])}catch(e){a.abort(e);try{t.close()}catch{}throw e}finally{c.abort()}},d=async e=>{let t=await(await c()).packages.search(e);if(`error`in t)throw s(t.error,t.message);return t.results},f=async(e,t)=>{let n=await(await c()).packages.pick(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?[]:n.results},p=async(e,t)=>{let n=await(await c()).packages.install(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?null:n.installed},m=async()=>(await(await c()).packages.list()).results,h=async e=>{let t=await(await c()).packages.uninstall(e);if(`error`in t)throw s(t.error,t.message)},g=({x:e,y:t,width:n,height:r})=>({x:Math.round(e),y:Math.round(t),width:Math.round(n),height:Math.round(r)}),_=(e,t)=>{let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,width:Math.max(0,Math.min(e.x+e.width,t.x+t.width)-n),height:Math.max(0,Math.min(e.y+e.height,t.y+t.height)-r)}},v=(e,t)=>{let n=t;for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t);if((e.overflowX!==`visible`||e.overflowY!==`visible`)&&(n=_(n,g(t.getBoundingClientRect())),n.width===0||n.height===0))break}return n},y=e=>{let t=getComputedStyle(e),n=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius];if(n.some(e=>e.includes(`%`)||e.includes(` `)))return;let r=n.map(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:0});return r.some(e=>e>0)?r:void 0},b=(e,t)=>{if(!e)return!1;let n=(e,t)=>e===t||!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;return n(e.rect,t.rect)&&n(e.clip,t.clip)&&((e,t)=>e===t||!!e&&!!t&&e.every((e,n)=>e===t[n]))(e.radius,t.radius)},x=new Map;n.r(`package view`,()=>x.size>0);var S=async(e,t)=>{let n=x.get(e);if(n){for(let e of n)t&&e.element!==t||(e.stop(),n.delete(e));if(n.size>0)return;x.delete(e)}let r=await(await c()).packages.hide(e);if(`error`in r)throw s(r.error,r.message)},C=async(e,t)=>{let{element:n,rect:r}=t;if(!n&&!r)throw s(`invalid`,`packages.show: pass an element or a rect`);let i=(await c()).packages,a=()=>{if(!n)return{rect:g(r)};let e=g(n.getBoundingClientRect());return{rect:e,clip:v(n,e),radius:y(n)}},o=!0,l,u=0,d=async t=>{l=t;let n=await i.show(e,t);if(`error`in n)throw o=!1,s(n.error,n.message)};await d(a());let f=()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{}),u=requestAnimationFrame(f)};n&&(u=requestAnimationFrame(f));let p={element:n,stop:()=>{o=!1,cancelAnimationFrame(u)}},m=x.get(e)??new Set;return m.add(p),x.set(e,m),{hide:()=>{S(e,n).catch(()=>{})},refresh:()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{})}}},w=async(e,t={})=>S(e,t.element),T=(async(e,r={})=>{let i=await(await c()).packages.connect(e,{protocol:r.protocol,...r.path===void 0?{}:{path:r.path}});if(`error`in i)throw s(i.error,i.message);let a=n.t(`package connection`),o=t.s()?.epoch??0,l=t.l((e,t)=>{t!==o&&(a(),l())});Promise.resolve(i.closed).then(()=>{a(),l()},()=>{a(),l()});let{port:d,closed:f}=i;if(r.raw)return{closed:f,port:d};let p=await u(r.payload,d,{signal:r.signal,closed:f});return r.signal&&r.signal.addEventListener(`abort`,()=>{try{d.postMessage({type:`fkn-packages-disconnect`})}catch{}},{once:!0}),{remote:p,closed:f,port:d}}),E=[`allow-scripts`,`allow-same-origin`],D=e=>{let t=e.getAttribute(`sandbox`);if(t!==null){let e=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),n=E.filter(t=>!e.has(t));if(n.length)throw s(`invalid`,`packages.mount: the iframe's sandbox attribute must include ${n.join(` and `)}, or the package cannot start`)}if(globalThis.crossOriginIsolated&&!new Set((e.getAttribute(`allow`)??``).toLowerCase().split(`;`).map(e=>e.trim().split(/\s+/)[0]).filter(Boolean)).has(`cross-origin-isolated`))throw s(`invalid`,`packages.mount: this page is cross-origin isolated, so the iframe's allow attribute must include 'cross-origin-isolated' to hand that down to the package`)},O=3e4,k=(e,t)=>new Promise((n,r)=>{let i=e=>{clearTimeout(o),window.removeEventListener(`message`,a),e?r(e):n()},a=n=>{if(n.source!==e.contentWindow||n.origin!==t)return;let r=n.data;if(r?.type===`fkn-packages-ready`)return i();r?.type===`fkn-packages-failed`&&i(s(`unavailable`,typeof r.message==`string`&&r.message?r.message:`packages.mount: the package failed to boot`))},o=setTimeout(()=>i(s(`timeout`,`packages.mount: the package did not register a connection handler`)),O);window.addEventListener(`message`,a)}),A=async(e,t)=>{let{iframe:r}=t;if(!(r instanceof HTMLIFrameElement))throw s(`invalid`,`packages.mount: pass the iframe to load the package into`);if(!r.isConnected)throw s(`invalid`,`packages.mount: the iframe must be in the document before mounting into it`);D(r);let i=await(await c()).packages.frame(e);if(`error`in i)throw s(i.error,i.message);r.src=i.url;let a={done:!1},o=()=>{},l=new Promise(e=>{o=e}),d=n.t(`mounted package`),f=()=>{if(!a.done){a.done=!0,d();try{r.contentWindow?.postMessage({type:`fkn-packages-close`},i.origin)}catch{}r.src=`about:blank`,o()}};try{await k(r,i.origin)}catch(e){throw f(),e}let p=new MessageChannel,m=r.contentWindow;if(!m)throw f(),s(`unavailable`,`packages.mount: the frame was detached before it could connect`);m.postMessage({type:`fkn-packages-port`,from:i.from,protocol:t.protocol,uri:i.uri,name:i.name,version:i.version},i.origin,[p.port2]);try{m.postMessage({type:`fkn-packages-visibility`,visible:!0},i.origin)}catch{}if(t.raw)return{closed:l,port:p.port1,frame:r,unmount:f};try{return{remote:await u(t.payload,p.port1,{signal:t.signal,closed:l}),closed:l,port:p.port1,frame:r,unmount:f}}catch(e){throw f(),e}},j=(e,t,n)=>u(t,e,{signal:n?.signal}),M=null,N=!1,P=new Set,F=[],I=new Map,L=!1,R=!1,z=e=>{let t=I.get(e);t&&(I.delete(e),t())},B=(e,t)=>{try{e.postMessage({type:`fkn-packages-nack`,message:t})}catch{}try{e.close()}catch{}},V=async(e,t)=>{let{port:n,...r}=e;e.port.addEventListener(`message`,t=>{t.data?.type===`fkn-packages-disconnect`&&z(e.port)});let i;try{i=await t.createPayload(r)}catch(t){throw B(e.port,t instanceof Error?t.message:`the package failed to produce a connection`),t}let a=new Promise(t=>I.set(e.port,t)),o=await l(i,e.port);t.handler?.({...r,remote:o,closed:a,port:e.port})},H=()=>{L||typeof window>`u`||window.parent===window||(L=!0,window.addEventListener(`message`,e=>{if(e.source!==window.parent)return;let t=e.data;if(t?.type===`fkn-packages-port`){let n=e.ports[0];if(!n)return;let r={port:n,from:typeof t.from==`string`?t.from:``,protocol:typeof t.protocol==`string`?t.protocol:null,uri:typeof t.uri==`string`?t.uri:``,name:typeof t.name==`string`?t.name:``,version:typeof t.version==`string`?t.version:``};M?V(r,M).catch(e=>console.warn(`packages.onConnect:`,e)):F.push(r)}if(t?.type===`fkn-packages-close`)for(let e of[...I.keys()])z(e);if(t?.type===`fkn-packages-visibility`){N=t.visible===!0;for(let e of P)try{e(N)}catch{}}}))},U=()=>{R||typeof window>`u`||window.parent===window||(R=!0,window.parent.postMessage({type:`fkn-packages-ready`},`*`))},W=(e,t)=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H();let n={createPayload:e,handler:t};for(M=n,U();F.length&&M===n;)V(F.shift(),n).catch(e=>console.warn(`packages.onConnect:`,e));return{unsubscribe:()=>{M===n&&(M=null)}}},G=()=>N,K=e=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H(),P.add(e);try{e(N)}catch{}return{unsubscribe:()=>{P.delete(e)}}};exports.attach=j,exports.connect=T,exports.hide=w,exports.install=p,exports.isVisible=G,exports.list=m,exports.mount=A,exports.onConnect=W,exports.onVisibilityChange=K,exports.pick=f,exports.search=d,exports.show=C,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.uninstall=h;
|
package/packages.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as PackageResult, N as PickOptions, P as Placement, S as InstalledPackage, f as ConnectOptions, ft as SurfaceRect, j as PackagesErrorCode, k as PackageQuery, x as InstallOptions, z as Radii } from "./contract-D37GGkou.js";
|
|
2
2
|
import { Remote } from "osra";
|
|
3
3
|
declare namespace packages_d_exports {
|
|
4
4
|
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
5
5
|
}
|
|
6
|
-
type PackagesError = Error & {
|
|
6
|
+
export type PackagesError = Error & {
|
|
7
7
|
code: PackagesErrorCode;
|
|
8
8
|
};
|
|
9
9
|
/** Search npm for FKN packages, e.g. `search({ type: 'plugin', id: 'stub' })`. */
|
|
10
|
-
declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
10
|
+
export declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
11
11
|
/** FKN-rendered picker over the same search; resolves the user's selection, already installed. [] on cancel. */
|
|
12
|
-
declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
12
|
+
export declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
13
13
|
/** Install a package for this app behind an FKN-rendered confirm, or with `{ noConfirm: true }` for a notice instead of a prompt. Resolves null when the user declines. */
|
|
14
|
-
declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
14
|
+
export declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
15
15
|
/** The packages installed by this app. */
|
|
16
|
-
declare const list: () => Promise<InstalledPackage[]>;
|
|
16
|
+
export declare const list: () => Promise<InstalledPackage[]>;
|
|
17
17
|
/** Uninstall a package from this app; its frames and connections are torn down. */
|
|
18
|
-
declare const uninstall: (uri: string) => Promise<void>;
|
|
19
|
-
type ShowOptions = {
|
|
18
|
+
export declare const uninstall: (uri: string) => Promise<void>;
|
|
19
|
+
export type ShowOptions = {
|
|
20
20
|
/**
|
|
21
21
|
* A placeholder the package frame is aligned to for as long as the view lives. The frame tracks its
|
|
22
22
|
* rect every animation frame, is clipped by its scrolling ancestors, and follows its border-radius,
|
|
@@ -26,7 +26,7 @@ type ShowOptions = {
|
|
|
26
26
|
/** an explicit viewport rect, for a caller that tracks placement itself */
|
|
27
27
|
rect?: SurfaceRect;
|
|
28
28
|
};
|
|
29
|
-
type PackageView = {
|
|
29
|
+
export type PackageView = {
|
|
30
30
|
/** release this view; equivalent to `packages.hide(uri, { element })` */
|
|
31
31
|
hide: () => void;
|
|
32
32
|
/** force a re-measure, e.g. right after a layout change the tracker cannot observe */
|
|
@@ -38,14 +38,14 @@ type PackageView = {
|
|
|
38
38
|
* back down with `hide()` on the returned view, or with `packages.hide(uri)`. Throws a PackagesError
|
|
39
39
|
* with code 'not-installed' when the package has not been connected by this app.
|
|
40
40
|
*/
|
|
41
|
-
declare const show: (uri: string, options: ShowOptions) => Promise<PackageView>;
|
|
41
|
+
export declare const show: (uri: string, options: ShowOptions) => Promise<PackageView>;
|
|
42
42
|
/**
|
|
43
43
|
* Hide a package's frame again, the counterpart to `show()`. Pass the same `element` to release only
|
|
44
44
|
* the view bound to it; with no element every view of this package is released. The connection is
|
|
45
45
|
* untouched, so the package can be shown again.
|
|
46
46
|
*/
|
|
47
|
-
declare const hide: (uri: string, options?: ShowOptions) => Promise<void>;
|
|
48
|
-
type PackageConnection<T = unknown> = {
|
|
47
|
+
export declare const hide: (uri: string, options?: ShowOptions) => Promise<void>;
|
|
48
|
+
export type PackageConnection<T = unknown> = {
|
|
49
49
|
/** the package's exposed payload */
|
|
50
50
|
remote: Remote<T>;
|
|
51
51
|
/** settles when the package side of the connection dies (uninstall, reload, crash) - reconnect by calling connect() again */
|
|
@@ -53,15 +53,15 @@ type PackageConnection<T = unknown> = {
|
|
|
53
53
|
/** the raw channel under `remote`, for direct messaging (osra envelopes ride it too - filter by your own message shape) */
|
|
54
54
|
port: MessagePort;
|
|
55
55
|
};
|
|
56
|
-
type AppConnectOptions = ConnectOptions & {
|
|
56
|
+
export type AppConnectOptions = ConnectOptions & {
|
|
57
57
|
/** exposed to the package as ITS `remote` */
|
|
58
58
|
payload?: unknown;
|
|
59
59
|
signal?: AbortSignal;
|
|
60
60
|
/** skip the osra handshake and hand back the untouched port - e.g. to transfer it into a worker and attach() there */
|
|
61
61
|
raw?: boolean;
|
|
62
62
|
};
|
|
63
|
-
type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
64
|
-
type Connect = {
|
|
63
|
+
export type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
64
|
+
export type Connect = {
|
|
65
65
|
<T = unknown>(uri: string, options?: AppConnectOptions & {
|
|
66
66
|
raw?: false;
|
|
67
67
|
}): Promise<PackageConnection<T>>;
|
|
@@ -70,8 +70,8 @@ type Connect = {
|
|
|
70
70
|
}): Promise<RawPackageConnection>;
|
|
71
71
|
};
|
|
72
72
|
/** Connect to an installed package. Throws a PackagesError with code 'not-installed' when it is not. */
|
|
73
|
-
declare const connect: Connect;
|
|
74
|
-
type MountOptions = AppConnectOptions & {
|
|
73
|
+
export declare const connect: Connect;
|
|
74
|
+
export type MountOptions = AppConnectOptions & {
|
|
75
75
|
/**
|
|
76
76
|
* the iframe the package is loaded into. YOU create it and YOU own it: its attributes, its styles and
|
|
77
77
|
* its place in your layout are yours, and `mount` only navigates it.
|
|
@@ -82,7 +82,7 @@ type MountOptions = AppConnectOptions & {
|
|
|
82
82
|
*/
|
|
83
83
|
iframe: HTMLIFrameElement;
|
|
84
84
|
};
|
|
85
|
-
type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
85
|
+
export type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
86
86
|
/** the iframe you passed in, unchanged apart from its `src` */
|
|
87
87
|
frame: HTMLIFrameElement;
|
|
88
88
|
/** blank the frame and settle `closed`; the element stays in your layout because it is yours */
|
|
@@ -102,12 +102,12 @@ type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
|
102
102
|
*
|
|
103
103
|
* Needs a package built against this version of the lib: an older one only accepts a port from fkn.app.
|
|
104
104
|
*/
|
|
105
|
-
declare const mount: <T = unknown>(uri: string, options: MountOptions) => Promise<MountedPackage<T>>;
|
|
105
|
+
export declare const mount: <T = unknown>(uri: string, options: MountOptions) => Promise<MountedPackage<T>>;
|
|
106
106
|
/** Run this end of an already-brokered connection port, e.g. after transferring it into a worker. */
|
|
107
|
-
declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
107
|
+
export declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
108
108
|
signal?: AbortSignal;
|
|
109
109
|
}) => Promise<Remote<T>>;
|
|
110
|
-
type IncomingConnectionInfo = {
|
|
110
|
+
export type IncomingConnectionInfo = {
|
|
111
111
|
/** the connecting app's identity: its package uri when it runs on a sandbox origin, else its page origin */
|
|
112
112
|
from: string;
|
|
113
113
|
/** the contract tag the app passed to connect(), e.g. 'stub-source@1' */
|
|
@@ -119,25 +119,25 @@ type IncomingConnectionInfo = {
|
|
|
119
119
|
/** the exact version this frame runs - the pin is encoded into the sandbox origin, immutable per version */
|
|
120
120
|
version: string;
|
|
121
121
|
};
|
|
122
|
-
type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
122
|
+
export type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
123
123
|
/** produces the payload exposed to a connecting app - called once per incoming connection */
|
|
124
|
-
type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
124
|
+
export type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
125
125
|
/**
|
|
126
126
|
* Serve connections from apps that installed this package. The first argument is called once per
|
|
127
127
|
* incoming connection with the connection info and returns the payload exposed to that app (its
|
|
128
128
|
* `remote`). The latest registration receives new connections; existing connections are unaffected.
|
|
129
129
|
*/
|
|
130
|
-
declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
130
|
+
export declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
131
131
|
unsubscribe: () => void;
|
|
132
132
|
};
|
|
133
133
|
/** True while a host app is showing this package's frame. Packages start hidden. */
|
|
134
|
-
declare const isVisible: () => boolean;
|
|
134
|
+
export declare const isVisible: () => boolean;
|
|
135
135
|
/**
|
|
136
136
|
* Observe whether a host app is showing this package's frame, so it can render its UI only while on
|
|
137
137
|
* screen. The handler is called immediately with the current state, and on every change after.
|
|
138
138
|
*/
|
|
139
|
-
declare const onVisibilityChange: (handler: (visible: boolean) => void) => {
|
|
139
|
+
export declare const onVisibilityChange: (handler: (visible: boolean) => void) => {
|
|
140
140
|
unsubscribe: () => void;
|
|
141
141
|
};
|
|
142
142
|
//#endregion
|
|
143
|
-
export {
|
|
143
|
+
export { type ConnectOptions, type InstallOptions, type InstalledPackage, type PackageQuery, type PackageResult, type PackagesErrorCode, type PickOptions, type Placement, type Radii, type SurfaceRect, packages_d_exports as t };
|
package/packages.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { a as t, c as n, l as r, s as i } from "./api-
|
|
2
|
+
import { a as t, c as n, l as r, s as i } from "./api-CtiKFcK3.js";
|
|
3
3
|
import { r as a, t as o } from "./busy-B189uX--.js";
|
|
4
4
|
import { expose as s } from "osra";
|
|
5
5
|
//#region src/packages.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./api-
|
|
1
|
+
import { B as Resolvers } from "./contract-D37GGkou.js";
|
|
2
|
+
import "./api-CfmRAze5.js";
|
|
3
3
|
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./api-
|
|
1
|
+
const e=require("./api-Djf-XdZ4.cjs"),t=require("./busy-Dv8wzE5M.cjs");var n=typeof FinalizationRegistry>`u`?void 0:new FinalizationRegistry(e=>e()),r=e=>{let r=e.body;if(!r)return e;let i=t.t(`streamed response`),a=r.getReader(),o=new ReadableStream({pull:async e=>{try{let{done:t,value:n}=await a.read();if(t){i(),e.close();return}e.enqueue(n)}catch(t){i(),e.error(t)}},cancel:async e=>{i(),await a.cancel(e).catch(()=>{})}}),s=new Response(o,{status:e.status,statusText:e.statusText,headers:e.headers});return n?.register(s,i),s},i=async e=>{if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:new Request(`https://body.invalid/`,{method:`POST`,body:e,duplex:`half`}).arrayBuffer()},a=async e=>{if(e.method===`GET`||e.method===`HEAD`)return;let t=await e.clone().arrayBuffer();return t.byteLength?t:void 0},o=async(t,n)=>{if(e.d(t),typeof t==`object`&&t&&!(t instanceof URL)&&typeof t.url==`string`){let o=t,s={};o.headers.forEach((e,t)=>{s[t]=e});let c=await i(n?.body===void 0?await a(o):n.body);return e.a.then(e=>e.cloud.fetch(o.url,{...n,method:n?.method??o.method,headers:n?.headers??s,body:c})).then(r)}let o=t instanceof URL?t.href:t,s=await i(n?.body);return e.a.then(e=>e.cloud.fetch(o,n?.body===void 0?n:{...n,body:s})).then(r)};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, d as t } from "./api-
|
|
1
|
+
import { a as e, d as t } from "./api-CtiKFcK3.js";
|
|
2
2
|
import { t as n } from "./busy-B189uX--.js";
|
|
3
3
|
//#region src/proxy.ts
|
|
4
4
|
var r = typeof FinalizationRegistry > "u" ? void 0 : new FinalizationRegistry((e) => e()), i = (e) => {
|
package/react.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
|
|
2
2
|
import { CSSProperties, ReactElement } from "react";
|
|
3
3
|
//#region src/react.d.ts
|
|
4
|
-
type ConnectButtonProps = {
|
|
4
|
+
export type ConnectButtonProps = {
|
|
5
5
|
className?: string;
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
};
|
|
8
|
-
declare const ConnectButton: ({ className, style }?: ConnectButtonProps) => ReactElement;
|
|
8
|
+
export declare const ConnectButton: ({ className, style }?: ConnectButtonProps) => ReactElement;
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { connectButtonUrl };
|
package/rooms.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs"),n=require("./busy-Dv8wzE5M.cjs");var r=e.t({available:()=>f,create:()=>m,join:()=>h,open:()=>p}),i={wrongKey:`rooms: wrong room key`,inviteNoKey:`rooms: the invite carries no key`,badName:`rooms: the name is not one a room can have`,badKeyOption:`rooms: the key is not 32 bytes base64url`,noSuchMember:`rooms: no such member`,noSuchMessage:`rooms: no such message`,roomFull:`rooms: the room is full`,tooManyConnections:`rooms: too many connections`,tooManyBlocks:`rooms: too many blocks`,tooManyClaims:`rooms: too many claims`,mailboxFull:`rooms: the mailbox is full`,outOfStorage:`rooms: the owner is out of storage`,outOfQuota:`rooms: out of daily bandwidth`,blocked:`rooms: you are blocked from this room`,cannotSend:`rooms: you cannot send here`,permissionDenied:`rooms: permission denied`,notOwner:`rooms: not the room owner`,ownerNotRemovable:`rooms: the owner cannot be removed`,ownerKeepsEvery:`rooms: the owner keeps every permission`,removeYourself:`rooms: you cannot remove yourself`,needsAccount:`rooms: claiming needs an account`,needsPremium:`rooms: claiming needs premium`,nameClaimed:`rooms: the name is claimed`,notClaimed:`rooms: the room is not claimed`,noMailbox:`rooms: the room keeps no messages`,badLimit:`rooms: the limit is out of range`,tooFast:`rooms: sending too fast`,tooLarge:`rooms: the message is too large`,unavailable:`rooms: rooms are unavailable`,notEnabled:`rooms: rooms are not available`,alreadyJoined:`rooms: already joined`,notJoined:`rooms: not joined`,malformed:`rooms: malformed frame`,ended:`rooms: the room has ended`},a=(e,t)=>Object.assign(Error(t),{code:e}),o=e=>e instanceof Error&&typeof e.code==`string`,s={send:!0,receive:!0,maxMessageBytes:262144},c=async()=>{if(!t.c)return;let e=(await t.o(`a room`).catch(()=>void 0))?.rooms;return typeof e?.open==`function`?e:void 0},l=()=>{throw a(`unavailable`,i.unavailable)},u=e=>e===`blocked`?`blocked`:e===`not-found`?`ended`:`unavailable`,d=async e=>{let r=e.invite,c=e,l=0,d=e.self,f=e.owner,p=e.claimed,m=e.mailbox,h=await e.defaults().catch(()=>s),g=!1,_=new Set,v=new Set,y=n.t(`room`),b=()=>{},x=()=>{},S=new Promise(e=>{x=e}),C=e=>{let t=[...v];v.clear();for(let n of t)try{n(e)}catch{}},w=e=>{g||(g=!0,b(),_.clear(),y(),C(a(`closed`,i.ended)),x({reason:e}))},T=e=>{if(!g){e.type===`defaults`&&(h=e.defaults),e.type===`permissions`&&e.id===d.id&&(d={id:d.id,permissions:e.permissions,maxMessageBytes:e.maxMessageBytes}),e.type===`claim`&&(p=e.claimed,f=e.owner,p||(m=null));for(let t of[..._])try{t(e)}catch{}}},E=(e,t)=>{Promise.resolve(e.on(T)).catch(()=>{}),Promise.resolve(e.closed).then(e=>{t===l&&w(e.reason)},()=>{})},D=async(e,t)=>{if(typeof e?.join!=`function`)return w(`unavailable`);let n=await e.join(r).catch(()=>void 0);if(g||t!==l)return;if(!n)return w(`unavailable`);if(`error`in n)return w(u(n.error));if(n.self.id!==d.id)return Promise.resolve(n.leave()).catch(()=>{}),w(`unavailable`);c=n,d=n.self,f=n.owner,p=n.claimed,m=n.mailbox,E(n,t);let i=await n.defaults().catch(()=>void 0);i&&!g&&t===l&&(h=i)};b=t.l((e,t)=>{let n=l;l=t,!(g||n===0||n===t)&&(C(a(`unavailable`,i.unavailable)),D(e.rooms,t))}),E(e,l);let O=async e=>{if(g)throw a(`closed`,i.ended);let t=()=>{},n=new Promise((e,n)=>{t=n});v.add(t);try{return await Promise.race([Promise.resolve(e(c)),n])}catch(e){throw o(e)?e:a(`unavailable`,i.unavailable)}finally{v.delete(t)}},k=async e=>{let t=await O(e);if(`error`in t)throw a(t.error,t.message)},A=async e=>{let t=await O(e);if(typeof t==`object`&&t&&`error`in t)throw a(t.error,t.message);return t};return{id:e.id,name:e.name,key:e.key,invite:r,get self(){return d},get owner(){return f},get claimed(){return p},get mailbox(){return m},defaults:()=>h,members:()=>O(e=>e.members()),send:e=>k(t=>t.send(e)),edit:(e,t)=>k(n=>n.edit(e,t)),delete:(e,t)=>k(n=>n.delete(e,t)),backlog:(e,t)=>A(n=>n.backlog(e,t)),setDefault:(e,t)=>k(n=>n.setDefault(e,t)),limit:(e,t)=>k(n=>n.limit(e,t)),grant:(e,t)=>k(n=>n.grant(e,t)),revoke:(e,t)=>k(n=>n.revoke(e,t)),remove:e=>k(t=>t.remove(e)),block:e=>k(t=>t.block(e)),unblock:e=>k(t=>t.unblock(e)),claim:()=>k(e=>e.claim()),release:()=>k(e=>e.release()),usage:async()=>{let e=await A(e=>e.usage());return m=e,e},on:async e=>g?()=>{}:(_.add(e),()=>{_.delete(e)}),leave:async()=>{await Promise.resolve(c.leave()).catch(()=>{}),w(`left`)},closed:S}},f=async()=>{let e=await c();return e?e.available().catch(()=>!1):!1},p=async(e,t)=>{if(typeof e!=`string`||e.length===0||e.length>72)throw a(`invalid`,i.badName);let n=await c();if(!n)throw a(`unavailable`,i.unavailable);let r=await n.open(e,t).catch(l);if(`error`in r)throw a(r.error,r.message);return d(r)},m=async e=>{let t=await c();if(!t)throw a(`unavailable`,i.unavailable);let n=await t.create(e).catch(l);if(`error`in n)throw a(n.error,n.message);return d(n)},h=async(e,t)=>{let n=typeof e==`string`?e.indexOf(`.`):-1;if(n<=0||n===e.length-1)throw a(`invalid`,i.inviteNoKey);let r=await c();if(!r)throw a(`unavailable`,i.unavailable);let o=await r.join(e,t).catch(l);if(`error`in o)throw a(o.error,o.message);return d(o)};exports.available=f,exports.create=m,exports.join=h,exports.open=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/rooms.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as RoomPermissions, G as RoomEvent, H as RoomCreateOptions, J as RoomMailbox, Q as RoomPermission, U as RoomDefaults, V as RoomBacklog, W as RoomEnd, X as RoomMessage, Y as RoomMember, Z as RoomOpenOptions, et as RoomsErrorCode, q as RoomJoinOptions } from "./contract-D37GGkou.js";
|
|
2
2
|
declare namespace rooms_d_exports {
|
|
3
3
|
export { RoomCreateOptions as CreateOptions, RoomJoinOptions as JoinOptions, RoomOpenOptions as OpenOptions, Room, RoomBacklog, RoomDefaults, RoomEnd, RoomEvent, RoomMailbox, RoomMember, RoomMessage, RoomPermission, RoomPermissions, RoomsError, RoomsErrorCode, available, create, join, open };
|
|
4
4
|
}
|
|
5
5
|
/** Thrown by every member of this namespace. Match on `code`, never on the message. */
|
|
6
|
-
type RoomsError = Error & {
|
|
6
|
+
export type RoomsError = Error & {
|
|
7
7
|
code: RoomsErrorCode;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* A joined room. The same object survives a broker replacement, so it is safe to hold for as long
|
|
11
11
|
* as the chat lasts.
|
|
12
12
|
*/
|
|
13
|
-
type Room = {
|
|
13
|
+
export type Room = {
|
|
14
14
|
/** `<scope>/<name>`: the name under this app's own scope, or under `global` */
|
|
15
15
|
readonly id: string;
|
|
16
16
|
readonly name: string;
|
|
@@ -55,16 +55,16 @@ type Room = {
|
|
|
55
55
|
readonly closed: Promise<RoomEnd>;
|
|
56
56
|
};
|
|
57
57
|
/** Whether this realm can join a room: false in Node, false in a worker nothing bridged, false against a shell older than named rooms. Answers rather than rejecting. */
|
|
58
|
-
declare const available: () => Promise<boolean>;
|
|
58
|
+
export declare const available: () => Promise<boolean>;
|
|
59
59
|
/**
|
|
60
60
|
* Open a room by name: a name under this app's own scope, or `global/<name>` for the shared one.
|
|
61
61
|
* Nobody there means the room comes into being with you as its owner; somebody there means you join
|
|
62
62
|
* them, and the key has to match theirs. Share `room.invite` to let anyone else in.
|
|
63
63
|
*/
|
|
64
|
-
declare const open: (name: string, options?: RoomOpenOptions) => Promise<Room>;
|
|
64
|
+
export declare const open: (name: string, options?: RoomOpenOptions) => Promise<Room>;
|
|
65
65
|
/** Open a room under a random name and become its owner. Share `room.invite` to let anyone else in. */
|
|
66
|
-
declare const create: (options?: RoomCreateOptions) => Promise<Room>;
|
|
66
|
+
export declare const create: (options?: RoomCreateOptions) => Promise<Room>;
|
|
67
67
|
/** `invite` is `room.invite`: a key and a room id joined by a dot. */
|
|
68
|
-
declare const join: (invite: string, options?: RoomJoinOptions) => Promise<Room>;
|
|
68
|
+
export declare const join: (invite: string, options?: RoomJoinOptions) => Promise<Room>;
|
|
69
69
|
//#endregion
|
|
70
|
-
export { type RoomCreateOptions as CreateOptions, type RoomJoinOptions as JoinOptions, type RoomOpenOptions as OpenOptions,
|
|
70
|
+
export { type RoomCreateOptions as CreateOptions, type RoomJoinOptions as JoinOptions, type RoomOpenOptions as OpenOptions, type RoomBacklog, type RoomDefaults, type RoomEnd, type RoomEvent, type RoomMailbox, type RoomMember, type RoomMessage, type RoomPermission, type RoomPermissions, type RoomsErrorCode, rooms_d_exports as t };
|
package/rooms.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { c as t, l as n, o as r } from "./api-
|
|
2
|
+
import { c as t, l as n, o as r } from "./api-CtiKFcK3.js";
|
|
3
3
|
import { t as i } from "./busy-B189uX--.js";
|
|
4
4
|
//#region src/rooms.ts
|
|
5
5
|
var a = /* @__PURE__ */ e({
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare namespace storage_d_exports {
|
|
2
|
+
export { CloudAvailability, EncryptionStatus, FileEntry, SealedRead, StorageLockedError, StorageNotFoundError, StorageQuota, WriteData, availability, available, encryption, isNotFound, list, quota, readFile, readFileSealed, remove, unlock, writeFile };
|
|
3
|
+
}
|
|
2
4
|
type FileEntry = {
|
|
3
5
|
path: string;
|
|
4
6
|
size: number;
|
|
@@ -18,6 +20,7 @@ type EncryptionStatus = {
|
|
|
18
20
|
enrolled: boolean;
|
|
19
21
|
keyEpoch: number | null;
|
|
20
22
|
};
|
|
23
|
+
type WriteData = Blob | ArrayBuffer | Uint8Array | string;
|
|
21
24
|
declare class StorageLockedError extends Error {
|
|
22
25
|
code: string;
|
|
23
26
|
constructor();
|
|
@@ -42,7 +45,19 @@ declare class StorageNotFoundError extends Error {
|
|
|
42
45
|
}
|
|
43
46
|
/** Whether an error from this module means the path is empty, as opposed to unreadable. */
|
|
44
47
|
declare const isNotFound: (error: unknown) => boolean;
|
|
48
|
+
declare const available: () => Promise<boolean>;
|
|
49
|
+
type CloudAvailability = 'connected' | 'disconnected' | 'unknown';
|
|
50
|
+
/**
|
|
51
|
+
* Whether the cloud half is backed by an account, as three answers rather than two:
|
|
52
|
+
* 'disconnected' is an ANSWER (signed out, or the api refusing the stored token), 'unknown'
|
|
53
|
+
* means nobody could be asked, including a broker that never came up. Always settles within
|
|
54
|
+
* the probe deadline. A caller owing data to the cloud may drop that obligation only on
|
|
55
|
+
* 'disconnected'; treating 'unknown' the same silently loses the write.
|
|
56
|
+
*/
|
|
57
|
+
declare const availability: () => Promise<CloudAvailability>;
|
|
58
|
+
declare const list: () => Promise<FileEntry[]>;
|
|
45
59
|
declare const quota: () => Promise<StorageQuota>;
|
|
60
|
+
declare const readFile: (path: string) => Promise<Blob>;
|
|
46
61
|
/** The bytes of a cloud object and the seal time they carry, as an ISO string or null. */
|
|
47
62
|
type SealedRead = {
|
|
48
63
|
data: Uint8Array;
|
|
@@ -63,7 +78,11 @@ type SealedRead = {
|
|
|
63
78
|
* describe the bytes returned beside it. `readFile` is unchanged and unaffected.
|
|
64
79
|
*/
|
|
65
80
|
declare const readFileSealed: (path: string) => Promise<SealedRead>;
|
|
81
|
+
declare const writeFile: (path: string, data: WriteData, opts?: {
|
|
82
|
+
contentType?: string;
|
|
83
|
+
}) => Promise<void>;
|
|
84
|
+
declare const remove: (path: string) => Promise<void>;
|
|
66
85
|
declare const encryption: () => Promise<EncryptionStatus>;
|
|
67
86
|
declare const unlock: () => Promise<boolean>;
|
|
68
87
|
//#endregion
|
|
69
|
-
export { StorageNotFoundError as a, isNotFound as c,
|
|
88
|
+
export { StorageNotFoundError as a, isNotFound as c, storage_d_exports as d, unlock as f, StorageLockedError as i, quota as l, FileEntry as n, StorageQuota as o, SealedRead as r, encryption as s, EncryptionStatus as t, readFileSealed as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-Djf-XdZ4.cjs"),n=require("./messages.cjs");var r=e.t({StorageLockedError:()=>i,StorageNotFoundError:()=>a,availability:()=>p,available:()=>c,encryption:()=>x,isNotFound:()=>o,list:()=>m,quota:()=>h,readFile:()=>g,readFileSealed:()=>v,remove:()=>b,unlock:()=>S,writeFile:()=>y}),i=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: connect the app again to open encrypted data`)}},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])},_=e=>{if(e===null||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()},v=async e=>{let n=(await t.a).cloud.fs;if(typeof n.readFileSealed!=`function`)return{data:await n.readFile(e).catch(s),sealedAt:null};let r=await n.readFileSealed(e).catch(s);return{data:r.bytes,sealedAt:_(r.sealedAt)}},y=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)},b=e=>t.a.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),x=()=>t.a.then(e=>e.cloud.fs.encryption()),S=()=>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 r}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return x}}),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 y}}),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 b}});
|