@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.
Files changed (57) hide show
  1. package/account-generation-CSnZiN18.cjs +1 -0
  2. package/account-generation-D7TpIoKt.js +28 -0
  3. package/account.cjs +1 -1
  4. package/account.d.ts +11 -0
  5. package/account.js +5 -17
  6. package/{api-BE5zPvFZ.d.ts → api-Cbty0JUM.d.ts} +15 -13
  7. package/api.d.ts +2 -2
  8. package/cloud/dns.d.ts +1 -1
  9. package/cloud/fetch.d.ts +1 -1
  10. package/cloud/fs/promises.d.ts +1 -1
  11. package/cloud/fs.cjs +1 -1
  12. package/cloud/fs.d.ts +4 -4
  13. package/cloud/fs.js +31 -24
  14. package/cloud/net.d.ts +1 -1
  15. package/{cloud-5eldoFxK.d.ts → cloud-4t1WoEZn.d.ts} +3 -3
  16. package/cloud.d.ts +4 -4
  17. package/{contract-Cvr_8gCL.d.ts → contract-BRc2ptdC.d.ts} +29 -7
  18. package/contract.d.ts +2 -2
  19. package/dgram.d.ts +2 -2
  20. package/dns.d.ts +1 -1
  21. package/fs/promises.cjs +1 -1
  22. package/fs/promises.d.ts +1 -1
  23. package/fs/promises.js +1 -1
  24. package/fs-BTyRnUPI.cjs +1 -0
  25. package/{fs--NhtUyYa.d.ts → fs-D0MMRnHC.d.ts} +8 -4
  26. package/fs-q7Kg51hq.js +513 -0
  27. package/fs.cjs +1 -1
  28. package/fs.d.ts +4 -3
  29. package/fs.js +4 -2
  30. package/http.d.ts +1 -1
  31. package/{index-kuPqkS_-.d.ts → index-D2lvaQDs.d.ts} +28 -38
  32. package/index.cjs +1 -1
  33. package/index.d.ts +3 -3
  34. package/index.js +1 -1
  35. package/{messages-C66ghz_A.d.ts → messages-CRcziTuC.d.ts} +17 -1
  36. package/messages.cjs +1 -1
  37. package/messages.d.ts +2 -2
  38. package/messages.js +2 -2
  39. package/{net-zThwNoA8.d.ts → net-CcEZP6Bb.d.ts} +2 -2
  40. package/net.d.ts +1 -1
  41. package/{node-fs-BZy9bzKd.js → node-fs-CK2wWIYS.js} +140 -137
  42. package/node-fs-nfX7wisL.cjs +1 -0
  43. package/opfs.cjs +1 -1
  44. package/opfs.js +1 -1
  45. package/package.json +1 -1
  46. package/packages.d.ts +1 -1
  47. package/{proxy-Dc0gDOxz.d.ts → proxy-D6YtsO1g.d.ts} +2 -2
  48. package/rooms.d.ts +1 -1
  49. package/storage-BS5WMO4f.cjs +1 -0
  50. package/storage-BVr2Rb-d.d.ts +167 -0
  51. package/storage-BWmGrO6a.js +123 -0
  52. package/fs-CaQFRiIT.cjs +0 -1
  53. package/fs-D3IsGdnN.js +0 -360
  54. package/node-fs-BNTPsX5c.cjs +0 -1
  55. package/storage-BJd-mWHE.cjs +0 -1
  56. package/storage-DSvL-t80.js +0 -67
  57. package/storage-ZrY4Y4L5.d.ts +0 -88
@@ -1,36 +1,21 @@
1
- import { a as WriteData$1, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
2
- import { d as storage_d_exports, r as SealedRead } from "./storage-ZrY4Y4L5.js";
3
- //#region src/fs/types.d.ts
4
- type FileEntry = {
5
- path: string;
6
- size: number;
7
- contentType: string | null;
8
- updatedAt: string | null;
9
- };
10
- type WriteData = Blob | ArrayBuffer | Uint8Array | string;
11
- type FileSystem = {
12
- available: () => Promise<boolean>;
13
- list: () => Promise<FileEntry[]>;
14
- readFile: (path: string) => Promise<Blob>;
15
- writeFile: (path: string, data: WriteData, opts?: {
16
- contentType?: string;
17
- }) => Promise<void>;
18
- remove: (path: string) => Promise<void>;
19
- };
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 StorageAccountChangedError, b as PinOptions, d as captureAccount$1, g as storage_d_exports, i as SealedRead, o as StorageAccountPinUnsupportedError, p as isAccountChanged, v as FileEntry, x as WriteData$1, y as FileSystem } from "./storage-BVr2Rb-d.js";
3
+ import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-CRcziTuC.js";
20
4
  declare namespace hybrid_d_exports {
21
- export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
5
+ export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData$1 as WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, captureAccount, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
22
6
  }
7
+ declare const captureAccount: typeof captureAccount$1;
23
8
  declare const available$1: () => Promise<boolean>;
24
9
  declare const pending$1: () => string[];
25
10
  declare const pendingDeletes$1: () => string[];
26
11
  declare const replicating$1: () => boolean;
27
- declare const list: () => Promise<FileEntry[]>;
28
- declare const readFile$1: (path: string) => Promise<Blob>;
29
- declare const readFileSealed$1: (path: string) => Promise<SealedRead>;
30
- declare const writeFile$1: (path: string, data: WriteData, opts?: {
12
+ declare const list: (opts?: PinOptions) => Promise<FileEntry[]>;
13
+ declare const readFile$1: (path: string, opts?: PinOptions) => Promise<Blob>;
14
+ declare const readFileSealed$1: (path: string, opts?: PinOptions) => Promise<SealedRead>;
15
+ declare const writeFile$1: (path: string, data: WriteData$1, opts?: {
31
16
  contentType?: string;
32
- }) => Promise<void>;
33
- declare const remove: (path: string) => Promise<void>;
17
+ } & PinOptions) => Promise<void>;
18
+ declare const remove: (path: string, opts?: PinOptions) => Promise<void>;
34
19
  declare const pull$1: (path: string) => Promise<Blob>;
35
20
  type AdoptSummary = {
36
21
  uploaded: string[];
@@ -71,29 +56,34 @@ type FileConflict = {
71
56
  * pins against a real channel. So a resolver whose answer ever crossed a realm would simply read as a
72
57
  * merge: one redundant write, never a wrong file.
73
58
  */
74
- type ConflictResolution = WriteData | null;
59
+ type ConflictResolution = WriteData$1 | null;
75
60
  type ConflictResolver = (conflict: FileConflict) => Promise<ConflictResolution> | ConflictResolution;
76
61
  declare const onConflict$1: (next: ConflictResolver) => (() => void);
62
+ /**
63
+ * Pushes the local files the account lacks, after what replication owes. It acts for the account
64
+ * this page is on when it is called: an entry queued for another account is skipped and stays queued
65
+ * for it, and a switch while it runs refuses the rest with `StorageAccountChangedError`.
66
+ */
77
67
  declare const adopt$1: () => Promise<AdoptSummary>;
78
68
  declare const adoptable$1: () => Promise<{
79
69
  paths: string[];
80
70
  bytes: number;
81
71
  }>;
82
72
  declare namespace index_d_exports {
83
- export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, SealedRead, Stats, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSealed, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
73
+ export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, SealedRead, Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, isAccountChanged, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSealed, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
84
74
  }
85
- declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, 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?: {
75
+ 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?: {
86
76
  recursive?: boolean;
87
77
  force?: boolean;
88
78
  }) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
89
79
  recursive?: boolean;
90
- }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => 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: {
80
+ }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, 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, appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => 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: {
91
81
  recursive?: boolean;
92
82
  force?: boolean;
93
83
  } | 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, exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void, promises: {
94
84
  readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
95
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
96
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
85
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
86
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
97
87
  stat: (path: import("node:fs").PathLike) => Promise<Stats>;
98
88
  lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
99
89
  readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
@@ -120,8 +110,8 @@ declare const onConflict: typeof onConflict$1;
120
110
  declare const _default: {
121
111
  available: () => Promise<boolean>;
122
112
  readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string;
123
- writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
124
- appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
113
+ writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
114
+ appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
125
115
  existsSync: (path: import("node:fs").PathLike) => boolean;
126
116
  statSync: (path: import("node:fs").PathLike) => Stats;
127
117
  lstatSync: (path: import("node:fs").PathLike) => Stats;
@@ -137,8 +127,8 @@ declare const _default: {
137
127
  unlinkSync: (path: import("node:fs").PathLike) => void;
138
128
  renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void;
139
129
  readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void;
140
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
141
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
130
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
131
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
142
132
  stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void;
143
133
  readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void;
144
134
  mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void;
@@ -151,8 +141,8 @@ declare const _default: {
151
141
  exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void;
152
142
  promises: {
153
143
  readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
154
- writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
155
- appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
144
+ writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
145
+ appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
156
146
  stat: (path: import("node:fs").PathLike) => Promise<Stats>;
157
147
  lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
158
148
  readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
package/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BfAg9mHD.cjs"),n=require("./api-jOTOA-5n.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-D7aQY4GH.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-D2zMdc2f.cjs"),u=require("./desktop.cjs"),d=require("./fs-CaQFRiIT.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.J())return e(!0);let n,r=setTimeout(()=>i(t.J()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.J()),y)},o=new MutationObserver(()=>{t.J()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.J()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{if(t.o(e)===`window`){let n=e;return l.r()?t.a(n):i.a()?i.i(n):t.a(n)}return S(e)}),S=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.s();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.l(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.b,exports.EXTENSION_ABI=t.Q,exports.ExtensionOperationUnsupportedError=t.$,exports.ExtensionOutdatedError=t.et,exports.FORGEABLE_HEADERS=t.U,exports.FrameWindowBlockedError=t.f,exports.FrameWindowRefusedError=t.p,exports.LOCATOR_DENIED=t.T,exports.LOCATOR_ERROR=t.k,exports.LOCATOR_UNSUPPORTED=t.x,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.tt,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t._,exports.assertFetchableUrl=t.I,exports.assertForgeableHeaders=t.W,exports.assertLockdownApplicable=t.v,exports.assertOneCookieIdentity=t.G,exports.attachFrame=x,exports.attachFramePermission=t.m,exports.box=t.it,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.P,exports.createFrame=t.h,exports.createVideoElementHandle=t.at,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.R,exports.fetchLocalPermission=t.z,exports.fetchPermission=t.B,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.g,exports.handleRevivableModules=t.rt,exports.hasForgedCookie=t.K,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.V,exports.isBlockedFrameUrl=t.y,exports.isExtensionExposed=t.J,exports.isLocalNetworkUrl=t.H,exports.isLocatorDenied=t.A,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.O,exports.isType=t.ot,exports.modifyRequestHeadersPermission=t.j,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.F,exports.readExtensionHandshake=t.Y,exports.relayWorker=w,exports.removeRequestHeaderRule=t.M,exports.revive=t.st,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.X,exports.setRequestHeaderRule=t.N,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.nt,exports.type=t.ct,exports.waitForExtensionExposure=t.Z;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BfAg9mHD.cjs"),n=require("./api-jOTOA-5n.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-D7aQY4GH.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-D2zMdc2f.cjs"),u=require("./desktop.cjs"),d=require("./fs-BTyRnUPI.cjs"),f=require("./opfs.cjs"),p=require("./packages.cjs"),m=require("./rooms.cjs"),h=require("./account.cjs"),g=require("./connect-button-BpXDs7tw.cjs");let _=require("osra");var v=1e4,y=150,b=()=>new Promise(e=>{if(t.J())return e(!0);let n,r=setTimeout(()=>i(t.J()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.J()),y)},o=new MutationObserver(()=>{t.J()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.J()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=(async e=>{if(t.o(e)===`window`){let n=e;return l.r()?t.a(n):i.a()?i.i(n):t.a(n)}return S(e)}),S=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let i=await n.u;if(!i)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);let a=r.t(`relayed worker`);t?.unregisterSignal?.aborted?a():t?.unregisterSignal?.addEventListener(`abort`,a,{once:!0});let o=i.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=n.s();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&n.l(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>r.n(),W=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.CATEGORIES=t.b,exports.EXTENSION_ABI=t.Q,exports.ExtensionOperationUnsupportedError=t.$,exports.ExtensionOutdatedError=t.et,exports.FORGEABLE_HEADERS=t.U,exports.FrameWindowBlockedError=t.f,exports.FrameWindowRefusedError=t.p,exports.LOCATOR_DENIED=t.T,exports.LOCATOR_ERROR=t.k,exports.LOCATOR_UNSUPPORTED=t.x,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.tt,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t._,exports.assertFetchableUrl=t.I,exports.assertForgeableHeaders=t.W,exports.assertLockdownApplicable=t.v,exports.assertOneCookieIdentity=t.G,exports.attachFrame=x,exports.attachFramePermission=t.m,exports.box=t.it,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.P,exports.createFrame=t.h,exports.createVideoElementHandle=t.at,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return l.t}}),exports.fetch=l.n,exports.fetchCredentialedPermission=t.R,exports.fetchLocalPermission=t.z,exports.fetchPermission=t.B,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.g,exports.handleRevivableModules=t.rt,exports.hasForgedCookie=t.K,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.V,exports.isBlockedFrameUrl=t.y,exports.isExtensionExposed=t.J,exports.isLocalNetworkUrl=t.H,exports.isLocatorDenied=t.A,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.O,exports.isType=t.ot,exports.modifyRequestHeadersPermission=t.j,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return p.t}}),exports.permissions=t.r,exports.promptInstall=l.i,exports.promptRelay=E,exports.readCookiePermission=t.F,exports.readExtensionHandshake=t.Y,exports.relayWorker=w,exports.removeRequestHeaderRule=t.M,exports.revive=t.st,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.X,exports.setRequestHeaderRule=t.N,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.nt,exports.type=t.ct,exports.waitForExtensionExposure=t.Z;
package/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as account_d_exports } from "./account.js";
2
2
  import { A as CATEGORIES, B as revive, C as gotoPermission, D as PermissionGrant, E as LegacyPermissionRequest, F as RemoteVideoElement, G as OperationRequest, H as Executor, I as VideoElementState, K as SelectorPart, L as box, M as PermissionCategory, N as handleRevivableModules, O as PermissionRequest, P as BoxedVideoElement, R as createVideoElementHandle, S as createFrame, T as CategoryRequest, U as Gate, V as type, W as GateTools, _ as FrameWindowRefusedError, a as AttachWindowOptions, b as WindowFrame, c as FrameBackendEvent, d as FrameEventMap, f as FrameMessageEvent, g as FrameWindowRefusal, h as FrameWindowOptions, i as AttachFrameOptions, j as CategoryMeta, k as permissions, l as FrameDocumentEvent, m as FrameWindowBlockedError, o as Frame, p as FramePostMessageOptions, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameEventListener, v as GotoOptions, w as CategoryGrant, x as attachFramePermission, y as Locator, z as isType } from "./index-D2CA-NX5.js";
3
3
  import { A as readCookiePermission, B as FORGEABLE_HEADERS, C as RequestHeaderRule, D as CookieDetails, E as setRequestHeaderRule, F as fetchCredentialedPermission, G as LOCATOR_ERROR, H as assertOneCookieIdentity, I as fetchLocalPermission, J as isLocatorUnsupported, K as LOCATOR_UNSUPPORTED, L as fetchPermission, M as ProxyFetchRequest, N as assertFetchableUrl, O as SiteCookie, R as isBlockedFetchUrl, S as HeaderOperation, T as removeRequestHeaderRule, U as hasForgedCookie, V as assertForgeableHeaders, W as LOCATOR_DENIED, Y as isTerminalError, _ as PermissionDeniedError, b as assertLockdownApplicable, c as setMissingExtensionHandler, d as ExtensionHandshake, f as ExtensionOperationUnsupportedError, g as PERMISSION_DENIED, h as supportsOperation, i as promptInstall, j as FetchInit, k as cookies, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as isLocatorDenied, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as modifyRequestHeadersPermission, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as isLocalNetworkUrl } from "./extension-DMU-CwMw.js";
4
- import { n as cloud_d_exports } from "./cloud-5eldoFxK.js";
4
+ import { n as cloud_d_exports } from "./cloud-4t1WoEZn.js";
5
5
  import { t as dns_d_exports } from "./dns.js";
6
- import { u as index_d_exports } from "./index-kuPqkS_-.js";
7
- import { s as net_d_exports } from "./net-zThwNoA8.js";
6
+ import { s as net_d_exports } from "./net-CcEZP6Bb.js";
8
7
  import { t as dgram_d_exports } from "./dgram.js";
9
8
  import { t as http_d_exports } from "./http.js";
10
9
  import { t as desktop_d_exports } from "./desktop.js";
10
+ import { u as index_d_exports } from "./index-D2lvaQDs.js";
11
11
  import { t as index_d_exports$1 } from "./opfs.js";
12
12
  import { t as packages_d_exports } from "./packages.js";
13
13
  import { t as rooms_d_exports } from "./rooms.js";
package/index.js CHANGED
@@ -9,7 +9,7 @@ import { t as ve } from "./dgram.js";
9
9
  import { t as G } from "./http.js";
10
10
  import { i as ye, n as be, r as K, t as xe } from "./extension-B9v933cT.js";
11
11
  import { t as Se } from "./desktop.js";
12
- import { u as Ce } from "./fs-D3IsGdnN.js";
12
+ import { u as Ce } from "./fs-q7Kg51hq.js";
13
13
  import { t as we } from "./opfs.js";
14
14
  import { t as Te } from "./packages.js";
15
15
  import { t as Ee } from "./rooms.js";
@@ -26,5 +26,21 @@ declare const STORAGE_NOT_FOUND = "FKN_STORAGE_NOT_FOUND";
26
26
  * same-realm callers, which is the cheaper test when it is available.
27
27
  */
28
28
  declare const STORAGE_UNREACHABLE = "FKN_API_UNREACHABLE";
29
+ /**
30
+ * The account pin's refusals, as message prefixes the broker throws, for the same reason as the e2e
31
+ * messages above: osra keeps an Error's message and strips its code across the SharedWorker hop.
32
+ *
33
+ * `ACCOUNT_CHANGED_MESSAGE`: the api refused a call because the signed-in account is not the one its
34
+ * pin was taken under. `ACCOUNT_PIN_INVALID_MESSAGE`: the api could not read the pin at all.
35
+ * `ACCOUNT_PIN_UNSUPPORTED_MESSAGE`: some hop (the broker document or its shared worker) is older than
36
+ * the pin, so the call was refused rather than sent unpinned. None of the three is a sign-out.
37
+ */
38
+ declare const ACCOUNT_CHANGED_MESSAGE = "fkn:account-changed";
39
+ declare const ACCOUNT_PIN_INVALID_MESSAGE = "fkn:account-pin-invalid";
40
+ declare const ACCOUNT_PIN_UNSUPPORTED_MESSAGE = "fkn:account-pin-unsupported";
41
+ /** The code of `StorageAccountChangedError`: a call made under one account was refused under another. */
42
+ declare const STORAGE_ACCOUNT_CHANGED = "FKN_ACCOUNT_CHANGED";
43
+ /** The code of `StorageAccountPinUnsupportedError`: the broker cannot pin calls, so none was sent. */
44
+ declare const STORAGE_ACCOUNT_PIN_UNSUPPORTED = "FKN_ACCOUNT_PIN_UNSUPPORTED";
29
45
  //#endregion
30
- export { STORAGE_NOT_FOUND as a, E2E_STALE_EPOCH_MESSAGE as i, E2E_LOCKED_MESSAGE as n, STORAGE_UNREACHABLE as o, E2E_RETIRED_FORMAT_MESSAGE as r, E2E_INTEGRITY_MESSAGE as t };
46
+ export { E2E_LOCKED_MESSAGE as a, STORAGE_ACCOUNT_CHANGED as c, STORAGE_UNREACHABLE as d, E2E_INTEGRITY_MESSAGE as i, STORAGE_ACCOUNT_PIN_UNSUPPORTED as l, ACCOUNT_PIN_INVALID_MESSAGE as n, E2E_RETIRED_FORMAT_MESSAGE as o, ACCOUNT_PIN_UNSUPPORTED_MESSAGE as r, E2E_STALE_EPOCH_MESSAGE as s, ACCOUNT_CHANGED_MESSAGE as t, STORAGE_NOT_FOUND as u };
package/messages.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`fkn:e2e-locked`,t=`fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset`,n=`fkn:e2e-integrity: stored data failed its integrity check`,r=`fkn:e2e-retired-format: stored data is in a format this version no longer opens`,i=`FKN_STORAGE_NOT_FOUND`,a=`FKN_API_UNREACHABLE`;exports.E2E_INTEGRITY_MESSAGE=n,exports.E2E_LOCKED_MESSAGE=e,exports.E2E_RETIRED_FORMAT_MESSAGE=r,exports.E2E_STALE_EPOCH_MESSAGE=t,exports.STORAGE_NOT_FOUND=i,exports.STORAGE_UNREACHABLE=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`fkn:e2e-locked`,t=`fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset`,n=`fkn:e2e-integrity: stored data failed its integrity check`,r=`fkn:e2e-retired-format: stored data is in a format this version no longer opens`,i=`FKN_STORAGE_NOT_FOUND`,a=`FKN_API_UNREACHABLE`,o=`fkn:account-changed`,s=`fkn:account-pin-invalid`,c=`fkn:account-pin-unsupported`,l=`FKN_ACCOUNT_CHANGED`,u=`FKN_ACCOUNT_PIN_UNSUPPORTED`;exports.ACCOUNT_CHANGED_MESSAGE=o,exports.ACCOUNT_PIN_INVALID_MESSAGE=s,exports.ACCOUNT_PIN_UNSUPPORTED_MESSAGE=c,exports.E2E_INTEGRITY_MESSAGE=n,exports.E2E_LOCKED_MESSAGE=e,exports.E2E_RETIRED_FORMAT_MESSAGE=r,exports.E2E_STALE_EPOCH_MESSAGE=t,exports.STORAGE_ACCOUNT_CHANGED=l,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=u,exports.STORAGE_NOT_FOUND=i,exports.STORAGE_UNREACHABLE=a;
package/messages.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as STORAGE_NOT_FOUND, i as E2E_STALE_EPOCH_MESSAGE, n as E2E_LOCKED_MESSAGE, o as STORAGE_UNREACHABLE, r as E2E_RETIRED_FORMAT_MESSAGE, t as E2E_INTEGRITY_MESSAGE } from "./messages-C66ghz_A.js";
2
- export { E2E_INTEGRITY_MESSAGE, E2E_LOCKED_MESSAGE, E2E_RETIRED_FORMAT_MESSAGE, E2E_STALE_EPOCH_MESSAGE, STORAGE_NOT_FOUND, STORAGE_UNREACHABLE };
1
+ import { a as E2E_LOCKED_MESSAGE, c as STORAGE_ACCOUNT_CHANGED, d as STORAGE_UNREACHABLE, i as E2E_INTEGRITY_MESSAGE, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, n as ACCOUNT_PIN_INVALID_MESSAGE, o as E2E_RETIRED_FORMAT_MESSAGE, r as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, s as E2E_STALE_EPOCH_MESSAGE, t as ACCOUNT_CHANGED_MESSAGE, u as STORAGE_NOT_FOUND } from "./messages-CRcziTuC.js";
2
+ export { ACCOUNT_CHANGED_MESSAGE, ACCOUNT_PIN_INVALID_MESSAGE, ACCOUNT_PIN_UNSUPPORTED_MESSAGE, E2E_INTEGRITY_MESSAGE, E2E_LOCKED_MESSAGE, E2E_RETIRED_FORMAT_MESSAGE, E2E_STALE_EPOCH_MESSAGE, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, STORAGE_UNREACHABLE };
package/messages.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/messages.ts
2
- var e = "fkn:e2e-locked", t = "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset", n = "fkn:e2e-integrity: stored data failed its integrity check", r = "fkn:e2e-retired-format: stored data is in a format this version no longer opens", i = "FKN_STORAGE_NOT_FOUND", a = "FKN_API_UNREACHABLE";
2
+ var e = "fkn:e2e-locked", t = "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset", n = "fkn:e2e-integrity: stored data failed its integrity check", r = "fkn:e2e-retired-format: stored data is in a format this version no longer opens", i = "FKN_STORAGE_NOT_FOUND", a = "FKN_API_UNREACHABLE", o = "fkn:account-changed", s = "fkn:account-pin-invalid", c = "fkn:account-pin-unsupported", l = "FKN_ACCOUNT_CHANGED", u = "FKN_ACCOUNT_PIN_UNSUPPORTED";
3
3
  //#endregion
4
- export { n as E2E_INTEGRITY_MESSAGE, e as E2E_LOCKED_MESSAGE, r as E2E_RETIRED_FORMAT_MESSAGE, t as E2E_STALE_EPOCH_MESSAGE, i as STORAGE_NOT_FOUND, a as STORAGE_UNREACHABLE };
4
+ export { o as ACCOUNT_CHANGED_MESSAGE, s as ACCOUNT_PIN_INVALID_MESSAGE, c as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, n as E2E_INTEGRITY_MESSAGE, e as E2E_LOCKED_MESSAGE, r as E2E_RETIRED_FORMAT_MESSAGE, t as E2E_STALE_EPOCH_MESSAGE, l as STORAGE_ACCOUNT_CHANGED, u as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as STORAGE_NOT_FOUND, a as STORAGE_UNREACHABLE };
@@ -1,6 +1,6 @@
1
1
  import { o as TcpSocketOption } from "./wire-Gbo-D74t.js";
2
- import { St as TcpSocketResult, U as Resolvers, bt as TcpSocketListenerResult } from "./contract-Cvr_8gCL.js";
3
- import "./api-BE5zPvFZ.js";
2
+ import { G as Resolvers, St as TcpSocketListenerResult, wt as TcpSocketResult } from "./contract-BRc2ptdC.js";
3
+ import "./api-Cbty0JUM.js";
4
4
  import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
5
5
  import { DuplexOptions, Stream } from "stream";
6
6
  import { EventEmitter } from "events";
package/net.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-zThwNoA8.js";
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 };