@fkn/lib 0.9.34 → 0.9.36

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 (94) hide show
  1. package/account.cjs +1 -1
  2. package/account.d.ts +6 -6
  3. package/account.js +3 -3
  4. package/{api-Bgsg9t9D.d.ts → api-CaFuvyyV.d.ts} +1 -1
  5. package/{api-BdTgLphT.js → api-CtiKFcK3.js} +2 -2
  6. package/{api-MW-Lm0u8.cjs → api-Djf-XdZ4.cjs} +2 -2
  7. package/api.cjs +1 -1
  8. package/api.d.ts +2 -2
  9. package/api.js +1 -1
  10. package/attach-policy.cjs +1 -1
  11. package/attach-policy.d.ts +5 -5
  12. package/attach-policy.js +1 -1
  13. package/cloud/dns.d.ts +1 -1
  14. package/cloud/fetch.cjs +1 -1
  15. package/cloud/fetch.d.ts +1 -1
  16. package/cloud/fetch.js +1 -1
  17. package/cloud/fs/promises.d.ts +3 -4
  18. package/cloud/fs.cjs +1 -1
  19. package/cloud/fs.d.ts +2 -2
  20. package/cloud/fs.js +2 -2
  21. package/cloud/net.d.ts +1 -1
  22. package/cloud-CDRoRstb.js +428 -0
  23. package/{cloud-C40YCPuv.d.ts → cloud-Cqdq7Ujd.d.ts} +9 -5
  24. package/cloud-DG_-Rt-L.cjs +1 -0
  25. package/cloud.cjs +1 -1
  26. package/cloud.d.ts +4 -4
  27. package/cloud.js +2 -2
  28. package/{contract-Gd543I6m.d.ts → contract-BIHGp6cz.d.ts} +127 -2
  29. package/contract.cjs +1 -0
  30. package/contract.d.ts +2 -2
  31. package/contract.js +28 -0
  32. package/desktop.d.ts +7 -7
  33. package/dgram.cjs +1 -1
  34. package/dgram.d.ts +5 -5
  35. package/dgram.js +1 -1
  36. package/dns.cjs +1 -1
  37. package/dns.d.ts +3 -3
  38. package/dns.js +1 -1
  39. package/{extension-Bm-PwsD6.d.ts → extension-C9BRlqEY.d.ts} +17 -14
  40. package/extension-DisWHU7m.cjs +1 -0
  41. package/extension-jDvl0U_P.js +89 -0
  42. package/extension.cjs +1 -1
  43. package/extension.d.ts +3 -3
  44. package/extension.js +3 -3
  45. package/fs/promises.cjs +1 -1
  46. package/fs/promises.d.ts +3 -3
  47. package/fs/promises.js +1 -1
  48. package/{fs-CYcErwc4.d.ts → fs--NhtUyYa.d.ts} +1 -1
  49. package/{fs-O2bp9J0x.js → fs-BvNZePtN.js} +4 -4
  50. package/{fs-Bv3aFjqA.cjs → fs-D8RCGFNc.cjs} +1 -1
  51. package/fs.cjs +1 -1
  52. package/fs.d.ts +2 -2
  53. package/fs.js +1 -1
  54. package/{hosts-C4-8lWwz.js → hosts-77UAJbm1.js} +28 -18
  55. package/hosts-COiOMjp-.cjs +1 -0
  56. package/http.d.ts +20 -20
  57. package/{index-DIK21kfh.d.ts → index-BWJSnpRB.d.ts} +166 -10
  58. package/{index-Cg6y_FTi.d.ts → index-kuPqkS_-.d.ts} +26 -3
  59. package/index.cjs +1 -1
  60. package/index.d.ts +29 -11
  61. package/index.js +51 -45
  62. package/lib-DCPdYk-N.cjs +53 -0
  63. package/{lib-C3f3XmGZ.js → lib-hd9k5xOX.js} +436 -362
  64. package/{net-BBtYFEzu.d.ts → net-BWFTx3k_.d.ts} +2 -2
  65. package/net.cjs +1 -1
  66. package/net.d.ts +1 -1
  67. package/net.js +1 -1
  68. package/node-fs-BNTPsX5c.cjs +1 -0
  69. package/{node-fs-C9ECR_9H.js → node-fs-BZy9bzKd.js} +2 -2
  70. package/opfs/promises.d.ts +2 -2
  71. package/opfs.cjs +1 -1
  72. package/opfs.d.ts +2 -2
  73. package/opfs.js +1 -1
  74. package/package.json +1 -1
  75. package/packages.cjs +1 -1
  76. package/packages.d.ts +27 -27
  77. package/packages.js +1 -1
  78. package/{proxy-_m6Sqcr6.cjs → proxy-CYcaW5ew.cjs} +1 -1
  79. package/{proxy-fXckOcRn.js → proxy-DDwY3AVG.js} +1 -1
  80. package/{proxy-XeHtHIdZ.d.ts → proxy-DaljzPSa.d.ts} +2 -2
  81. package/react.d.ts +3 -3
  82. package/rooms.cjs +1 -1
  83. package/rooms.d.ts +8 -8
  84. package/rooms.js +1 -1
  85. package/{storage-C6Cd4J5E.js → storage-BbcnDCnc.js} +1 -1
  86. package/{storage-WZEvw3KN.d.ts → storage-ZrY4Y4L5.d.ts} +21 -2
  87. package/{storage-D2eBifiu.cjs → storage-dSi2dUKx.cjs} +1 -1
  88. package/cloud-DBNeXS9R.js +0 -272
  89. package/cloud-DHuqVKrl.cjs +0 -1
  90. package/extension-DALH11b4.js +0 -87
  91. package/extension-lR-cSs2P.cjs +0 -1
  92. package/hosts-DD4rDeQH.cjs +0 -1
  93. package/lib-WiHTYaNP.cjs +0 -53
  94. package/node-fs-DZPGCYWg.cjs +0 -1
@@ -72,7 +72,15 @@ var e = {
72
72
  unsafe: !0,
73
73
  title: "Change page appearance (unsafe)",
74
74
  description: "Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network."
75
- }, d = (e) => e?.noSanitize ? u : l, f = {
75
+ }, d = {
76
+ scope: "frame.evaluate",
77
+ category: "evaluation",
78
+ severity: 3,
79
+ chip: "run code",
80
+ unsafe: !0,
81
+ title: "Run the app’s code on this site",
82
+ description: "Lets the app run its own script inside this site, with full access to the page and the data it shows."
83
+ }, f = (e) => e?.noSanitize ? u : l, p = {
76
84
  scope: "frame.fetchRead",
77
85
  category: "network",
78
86
  severity: 3,
@@ -80,7 +88,7 @@ var e = {
80
88
  unsafe: !0,
81
89
  title: "Read your account data on this site",
82
90
  description: "Lets the app read pages and data from this site as you, using the session in the frame."
83
- }, p = {
91
+ }, m = {
84
92
  scope: "frame.fetchWrite",
85
93
  category: "network",
86
94
  severity: 3,
@@ -88,11 +96,11 @@ var e = {
88
96
  unsafe: !0,
89
97
  title: "Change your account data on this site",
90
98
  description: "Lets the app send changes to this site as you, using the session in the frame."
91
- }, m = /* @__PURE__ */ new Set([
99
+ }, h = /* @__PURE__ */ new Set([
92
100
  "GET",
93
101
  "HEAD",
94
102
  "OPTIONS"
95
- ]), h = (e, t) => m.has((t?.method ?? "GET").toUpperCase()) ? f : p, g = {
103
+ ]), g = (e, t) => h.has((t?.method ?? "GET").toUpperCase()) ? p : m, _ = {
96
104
  click: a,
97
105
  fill: o,
98
106
  hover: s,
@@ -102,8 +110,9 @@ var e = {
102
110
  count: i,
103
111
  exists: r,
104
112
  videoElement: c,
105
- addStyleTag: d,
106
- fetch: h
113
+ addStyleTag: f,
114
+ fetch: g,
115
+ evaluate: d
107
116
  };
108
117
  [
109
118
  e,
@@ -117,22 +126,23 @@ var e = {
117
126
  c,
118
127
  l,
119
128
  u,
120
- f,
121
- p
129
+ p,
130
+ m,
131
+ d
122
132
  ].map((e) => e.scope);
123
- var _ = g, v = (e, t) => {
124
- let n = _[e];
133
+ var v = _, y = (e, t) => {
134
+ let n = v[e];
125
135
  return n ? (typeof n == "function" ? n(...t) : n).scope : null;
126
- }, y = (e, t) => {
136
+ }, b = (e, t) => {
127
137
  try {
128
138
  return new URL(e, t);
129
139
  } catch {
130
140
  return;
131
141
  }
132
- }, b = (e) => {
133
- let t = y(e, "https://s.invalid/"), n = y(e, "http://s.invalid/");
142
+ }, x = (e) => {
143
+ let t = b(e, "https://s.invalid/"), n = b(e, "http://s.invalid/");
134
144
  if (!t || !n) return { kind: "invalid" };
135
- let r = y(e);
145
+ let r = b(e);
136
146
  return !r || r.href !== t.href || r.href !== n.href ? { kind: "relative" } : r.protocol !== "https:" && r.protocol !== "http:" ? {
137
147
  kind: "unsupported",
138
148
  protocol: r.protocol
@@ -141,21 +151,21 @@ var _ = g, v = (e, t) => {
141
151
  host: r.hostname,
142
152
  protocol: r.protocol
143
153
  };
144
- }, x = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/, S = /^\[[0-9a-f:.]+\]$/, C = (e) => {
154
+ }, S = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/, C = /^\[[0-9a-f:.]+\]$/, w = (e) => {
145
155
  try {
146
156
  return new URL(`http://${e}/`).hostname;
147
157
  } catch {
148
158
  return;
149
159
  }
150
- }, w = (e, { ipv6: t = !1 } = {}) => {
160
+ }, T = (e, { ipv6: t = !1 } = {}) => {
151
161
  let n = [];
152
162
  for (let r of e) {
153
163
  let e = r.trim().toLowerCase();
154
164
  if (!e || e.length > 253) continue;
155
- let i = x.test(e) ? e : t && S.test(e) ? C(e) : void 0;
165
+ let i = S.test(e) ? e : t && C.test(e) ? w(e) : void 0;
156
166
  i && !n.includes(i) && n.push(i);
157
167
  }
158
168
  return n;
159
169
  };
160
170
  //#endregion
161
- export { n as _, l as a, b as c, c as d, v as f, e as g, t as h, o as i, f as l, i as m, a as n, u as o, r as p, s as r, h as s, w as t, p as u };
171
+ export { e as _, l as a, g as c, m as d, c as f, t as g, i as h, o as i, x as l, r as m, a as n, u as o, y as p, s as r, d as s, T as t, p as u, n as v };
@@ -0,0 +1 @@
1
+ var e={scope:`read.text`,category:`storage`,severity:1,chip:`read text`,title:`Read text from the page`,description:`Lets the app see the text shown on this page.`},t={scope:`read.info`,category:`storage`,severity:1,chip:`read details`,title:`Read info from the page`,description:`Lets the app read a detail of a part of the page.`},n={scope:`read.visible`,category:`storage`,severity:0,title:`See what’s visible on the page`,description:`Lets the app check which elements are currently on screen.`},r={scope:`read.check`,category:`storage`,severity:0,title:`Check if something is on the page`,description:`Lets the app test whether a specific element exists.`},i={scope:`read.count`,category:`storage`,severity:0,title:`Count items on the page`,description:`Lets the app count how many matching elements are present.`},a={scope:`act.click`,category:`interaction`,severity:3,chip:`click`,title:`Click on the page`,description:`Lets the app press buttons or links for you.`},o={scope:`act.type`,category:`interaction`,severity:1,chip:`type`,title:`Type into a text field`,description:`Lets the app fill in form fields on your behalf.`},s={scope:`act.hover`,category:`interaction`,severity:1,chip:`hover`,title:`Hover over the page`,description:`Lets the app point at things to reveal menus or tooltips.`},c={scope:`media.video`,category:`interaction`,severity:0,title:`Control video playback`,description:`Lets the app play, pause, seek, and read the video on the page.`},l={scope:`media.appear`,category:`interaction`,severity:0,title:`Change page appearance`,description:`Lets the app restyle parts of the page (safely filtered).`},u={scope:`media.appearU`,category:`evaluation`,severity:2,chip:`unfiltered styles`,unsafe:!0,title:`Change page appearance (unsafe)`,description:`Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.`},d={scope:`frame.evaluate`,category:`evaluation`,severity:3,chip:`run code`,unsafe:!0,title:`Run the app’s code on this site`,description:`Lets the app run its own script inside this site, with full access to the page and the data it shows.`},f=e=>e?.noSanitize?u:l,p={scope:`frame.fetchRead`,category:`network`,severity:3,chip:`load`,unsafe:!0,title:`Read your account data on this site`,description:`Lets the app read pages and data from this site as you, using the session in the frame.`},m={scope:`frame.fetchWrite`,category:`network`,severity:3,chip:`send`,unsafe:!0,title:`Change your account data on this site`,description:`Lets the app send changes to this site as you, using the session in the frame.`},h=new Set([`GET`,`HEAD`,`OPTIONS`]),g=(e,t)=>h.has((t?.method??`GET`).toUpperCase())?p:m,_={click:a,fill:o,hover:s,textContent:e,getAttribute:t,isVisible:n,count:i,exists:r,videoElement:c,addStyleTag:f,fetch:g,evaluate:d};[e,t,n,r,i,a,o,s,c,l,u,p,m,d].map(e=>e.scope);var v=_,y=(e,t)=>{let n=v[e];return n?(typeof n==`function`?n(...t):n).scope:null},b=(e,t)=>{try{return new URL(e,t)}catch{return}},x=e=>{let t=b(e,`https://s.invalid/`),n=b(e,`http://s.invalid/`);if(!t||!n)return{kind:`invalid`};let r=b(e);return!r||r.href!==t.href||r.href!==n.href?{kind:`relative`}:r.protocol!==`https:`&&r.protocol!==`http:`?{kind:`unsupported`,protocol:r.protocol}:{kind:`absolute`,host:r.hostname,protocol:r.protocol}},S=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/,C=/^\[[0-9a-f:.]+\]$/,w=e=>{try{return new URL(`http://${e}/`).hostname}catch{return}},T=(e,{ipv6:t=!1}={})=>{let n=[];for(let r of e){let e=r.trim().toLowerCase();if(!e||e.length>253)continue;let i=S.test(e)?e:t&&C.test(e)?w(e):void 0;i&&!n.includes(i)&&n.push(i)}return n};Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return n}});
package/http.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { n as Socket, t as Server$1 } from "./net-BBtYFEzu.js";
1
+ import { n as Socket, t as Server$1 } from "./net-BWFTx3k_.js";
2
2
  import { Buffer } from "buffer";
3
3
  import { Stream } from "stream";
4
4
  import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
5
5
  declare namespace http_d_exports {
6
6
  export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, createServer, _default as default, get, globalAgent, request };
7
7
  }
8
- declare const METHODS: string[];
9
- declare const STATUS_CODES: Record<number, string>;
10
- interface ParsedHead {
8
+ export declare const METHODS: string[];
9
+ export declare const STATUS_CODES: Record<number, string>;
10
+ export interface ParsedHead {
11
11
  /** request only */
12
12
  method?: string;
13
13
  /** request only */
@@ -27,7 +27,7 @@ interface ParserHandlers {
27
27
  onBody: (chunk: Uint8Array) => void;
28
28
  onComplete: () => void;
29
29
  }
30
- declare class HTTPParser {
30
+ export declare class HTTPParser {
31
31
  private readonly mode;
32
32
  private readonly handlers;
33
33
  private buf;
@@ -47,7 +47,7 @@ declare class HTTPParser {
47
47
  private consumeBody;
48
48
  private consumeChunked;
49
49
  }
50
- declare class IncomingMessage extends Stream.Readable {
50
+ export declare class IncomingMessage extends Stream.Readable {
51
51
  httpVersion: string;
52
52
  httpVersionMajor: number;
53
53
  httpVersionMinor: number;
@@ -95,10 +95,10 @@ declare abstract class OutgoingMessage extends Stream.Writable {
95
95
  end(chunk?: unknown, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
96
96
  protected _headBlock?: string;
97
97
  }
98
- interface ServerResponseOptions {
98
+ export interface ServerResponseOptions {
99
99
  req: IncomingMessage;
100
100
  }
101
- declare class ServerResponse extends OutgoingMessage {
101
+ export declare class ServerResponse extends OutgoingMessage {
102
102
  statusCode: number;
103
103
  statusMessage?: string;
104
104
  private _writeHeadCalled;
@@ -114,13 +114,13 @@ declare class ServerResponse extends OutgoingMessage {
114
114
  writeContinue(): void;
115
115
  setTimeout(msecs: number, callback?: () => void): this;
116
116
  }
117
- interface ClientRequestArgs extends RequestOptions {
117
+ export interface ClientRequestArgs extends RequestOptions {
118
118
  host?: string;
119
119
  hostname?: string;
120
120
  port?: number | string;
121
121
  path?: string;
122
122
  }
123
- declare class ClientRequest extends OutgoingMessage {
123
+ export declare class ClientRequest extends OutgoingMessage {
124
124
  method: string;
125
125
  path: string;
126
126
  host: string;
@@ -143,14 +143,14 @@ declare class ClientRequest extends OutgoingMessage {
143
143
  setNoDelay(noDelay?: boolean): void;
144
144
  setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
145
145
  }
146
- type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
146
+ export type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
147
147
  declare class ServerImpl extends Server$1 {
148
148
  constructor(options?: object | RequestListener, requestListener?: RequestListener);
149
149
  private _handleConnection;
150
150
  }
151
- declare const Server: typeof ServerImpl;
152
- type Server = ServerImpl;
153
- declare class Agent {
151
+ export declare const Server: typeof ServerImpl;
152
+ export type Server = ServerImpl;
153
+ export declare class Agent {
154
154
  maxSockets: number;
155
155
  maxFreeSockets: number;
156
156
  keepAlive: boolean;
@@ -163,11 +163,11 @@ declare class Agent {
163
163
  }): string;
164
164
  destroy(): void;
165
165
  }
166
- declare const globalAgent: Agent;
167
- declare const request: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
168
- declare const get: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
169
- declare const createServer: (options?: object | RequestListener, requestListener?: RequestListener) => Server;
170
- declare const _default: {
166
+ export declare const globalAgent: Agent;
167
+ export declare const request: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
168
+ export declare const get: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
169
+ export declare const createServer: (options?: object | RequestListener, requestListener?: RequestListener) => Server;
170
+ export declare const _default: {
171
171
  METHODS: string[];
172
172
  STATUS_CODES: Record<number, string>;
173
173
  Agent: typeof Agent;
@@ -182,4 +182,4 @@ declare const _default: {
182
182
  get: typeof get;
183
183
  };
184
184
  //#endregion
185
- export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, _default as default, createServer, get, globalAgent, request, http_d_exports as t };
185
+ export { _default as default, http_d_exports as t };
@@ -130,14 +130,39 @@ type FrameFetchResult = {
130
130
  headers: [string, string][];
131
131
  body: ArrayBuffer;
132
132
  };
133
- //#endregion
134
- //#region ../frame-locator/lib/operations.d.ts
133
+ declare namespace operations_d_exports {
134
+ export { PositionOptions$1 as PositionOptions, click, count, exists, fill, getAttribute, hover, isVisible, textContent };
135
+ }
135
136
  type PositionOptions$1 = OperationOptions & {
136
137
  position?: {
137
138
  x?: number;
138
139
  y?: number;
139
140
  };
140
141
  };
142
+ declare const click: {
143
+ readonly resolve: (context: LocatorContext, options?: PositionOptions$1) => void;
144
+ };
145
+ declare const hover: {
146
+ readonly resolve: (context: LocatorContext, options?: PositionOptions$1) => void;
147
+ };
148
+ declare const fill: {
149
+ readonly resolve: (context: LocatorContext, value: string, _options?: OperationOptions) => void;
150
+ };
151
+ declare const textContent: {
152
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => string;
153
+ };
154
+ declare const getAttribute: {
155
+ readonly resolve: (context: LocatorContext, name: string, _options?: OperationOptions) => string | null;
156
+ };
157
+ declare const isVisible: {
158
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => boolean;
159
+ };
160
+ declare const count: {
161
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => number;
162
+ };
163
+ declare const exists: {
164
+ readonly resolve: (context: LocatorContext, _options?: OperationOptions) => boolean;
165
+ };
141
166
  //#endregion
142
167
  //#region ../frame-locator/lib/modules.d.ts
143
168
  declare const defaultModules: {
@@ -592,15 +617,19 @@ declare const locatorModules: Extended<{
592
617
  };
593
618
  };
594
619
  readonly frame: {
595
- operations: {
596
- addStyleTag: {
620
+ readonly operations: {
621
+ readonly addStyleTag: {
597
622
  resolve: (context: LocatorContext, options: AddStyleTagOptions) => void;
598
623
  };
599
- fetch: {
624
+ readonly fetch: {
600
625
  resolve: (context: LocatorContext, url: string, init?: FrameFetchOptions) => Promise<FrameFetchResult>;
601
626
  kind: ChainKind;
602
627
  ensureArgs: (options: Record<string, unknown>) => unknown[];
603
628
  };
629
+ readonly evaluate: {
630
+ readonly kind: "frame";
631
+ readonly resolve: (_context: LocatorContext, _source: string, _arg?: unknown) => never;
632
+ };
604
633
  };
605
634
  };
606
635
  }>;
@@ -617,7 +646,8 @@ type PermissionCategory = 'interaction' | 'storage' | 'network' | 'evaluation';
617
646
  * What a category row says. `heading` is the name the popup, dashboard and activity log print;
618
647
  * `summary` is the owner's one-line account of the category. The row copy is a template over
619
648
  * `site`, the host the row consults (or its "first and N more" form), with a cloud variant for the
620
- * card, where no render proxy jar holds the user's browser cookies.
649
+ * cloud card: `cloudTitle` is the one short line the card shows, `cloudDescription` the line it
650
+ * draws under it where hovering cannot be counted on, and its tooltip everywhere else.
621
651
  */
622
652
  type CategoryMeta = {
623
653
  id: PermissionCategory;
@@ -707,6 +737,14 @@ declare const PERMISSIONS: readonly [{
707
737
  readonly unsafe: true;
708
738
  readonly title: 'Change page appearance (unsafe)';
709
739
  readonly description: 'Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.';
740
+ }, {
741
+ readonly scope: 'frame.evaluate';
742
+ readonly category: 'evaluation';
743
+ readonly severity: 3;
744
+ readonly chip: 'run code';
745
+ readonly unsafe: true;
746
+ readonly title: 'Run the app’s code on this site';
747
+ readonly description: 'Lets the app run its own script inside this site, with full access to the page and the data it shows.';
710
748
  }, {
711
749
  readonly scope: 'embed.iframe';
712
750
  readonly category: 'interaction';
@@ -826,7 +864,7 @@ type PermissionGrant = CategoryGrant | {
826
864
  site: string;
827
865
  allow: boolean;
828
866
  };
829
- declare const permissions$1: {
867
+ declare const permissions: {
830
868
  /**
831
869
  * Asks for permissions on one sheet (extension) or card (cloud), in the order given, and answers
832
870
  * one grant per request.
@@ -861,7 +899,7 @@ type GotoOptions = {
861
899
  waitUntil?: 'documentstart' | 'load';
862
900
  domains?: string[];
863
901
  };
864
- type Frame = FrameLocator<LocatorModules> & {
902
+ type Frame = Omit<FrameLocator<LocatorModules>, 'evaluate'> & {
865
903
  goto(url: string, options?: GotoOptions): Promise<void>;
866
904
  url(): string;
867
905
  /**
@@ -870,6 +908,38 @@ type Frame = FrameLocator<LocatorModules> & {
870
908
  * category or key the registry cannot place on a row is a `TypeError`, thrown before it is sent.
871
909
  */
872
910
  request(requests: CategoryRequest[]): Promise<CategoryGrant[]>;
911
+ /**
912
+ * Runs `pageFunction` inside the attached site's OWN page realm, as a script of that page would:
913
+ * it sees the site's `window`, its globals and its DOM. The function is sent as source
914
+ * (`Function.prototype.toString`), so it captures NOTHING from the caller's scope; everything it
915
+ * needs must come through `arg`. A plain source string is run as an expression, the way Playwright
916
+ * does, and is not called. A promise, returned by the function or produced by the expression, is
917
+ * awaited.
918
+ *
919
+ * `arg` and the result cross by structured clone, so an `ArrayBuffer` or a typed array of bytes
920
+ * survives the round trip. A thrown error or a rejected promise comes back as an `Error` carrying
921
+ * the page's own name and message. A result that cannot be cloned (a function, a DOM node) is a
922
+ * `LocatorInvalidError`, never a silent `undefined` and never a live handle into the page.
923
+ *
924
+ * Every limit is a `LocatorInvalidError` that names it, never a call left pending:
925
+ * - time, both backends: the code has 30 seconds to settle, counted after any consent card. Only
926
+ * the wait ends there; code that never settles keeps running in the page.
927
+ * - size, extension only: the source with its `arg`, and the result, each carry at most 32 MiB
928
+ * (binary data by its bytes, text by its UTF-8 size), the most its message relay carries.
929
+ * - `Blob`, extension only: the relay cannot carry one, so pass or return `await blob.arrayBuffer()`.
930
+ * The cloud backend has neither limit, and returns a `Blob` as a `Blob`.
931
+ *
932
+ * Needs the Evaluation grant on both backends; an app without it is refused by name. It runs on the
933
+ * attached frame only: a chain into a nested frame (`frameLocator(...).evaluate`) is refused.
934
+ *
935
+ * On the extension it also needs an extension new enough to run code (ABI 3, older ones are refused
936
+ * with `ExtensionOperationUnsupportedError`), and it runs where the page's content security policy
937
+ * allows it: a frame whose host the app declared has its CSP replaced, so code runs; an undeclared
938
+ * frame keeps its CSP, and a page that forbids `eval` refuses with a named error. On the cloud
939
+ * backend the code runs in the proxied document's realm, which mirage virtualizes, so there is no
940
+ * such limit.
941
+ */
942
+ evaluate<R = unknown, A = undefined>(pageFunction: ((arg: A) => R | Promise<R>) | string, arg?: A): Promise<Awaited<R>>;
873
943
  };
874
944
  type AttachFrameOptions = {
875
945
  iframe: HTMLIFrameElement;
@@ -882,17 +952,103 @@ type AttachFrameOptions = {
882
952
  */
883
953
  permissions?: CategoryRequest[];
884
954
  };
955
+ /** Where an attachment's window opens and how big it asks to be. */
956
+ type FrameWindowOptions = {
957
+ /**
958
+ * Where the window opens: an http or https address, which must also pass the rules an iframe src
959
+ * does. Omitted, the window opens blank and the app navigates it with `goto`, which is how an app
960
+ * keeps the click's activation when the url needs an await first.
961
+ */
962
+ url?: string;
963
+ /** Inner width in CSS pixels, 500 by default. The browser may clamp it. */
964
+ width?: number;
965
+ /** Inner height in CSS pixels, 700 by default. The browser may clamp it. */
966
+ height?: number;
967
+ };
968
+ /**
969
+ * `attachFrame`'s options when the attachment is a new window rather than an iframe.
970
+ *
971
+ * Call `attachFrame` directly in the click or key handler: the window opens before the first await,
972
+ * with the activation of that event, and the browser's popup rules apply to it as to any page's own
973
+ * `window.open`. `iframe` and `lockdown` do not apply to a window, and passing either is a TypeError.
974
+ */
975
+ type AttachWindowOptions = {
976
+ window: FrameWindowOptions;
977
+ domains?: string[];
978
+ /**
979
+ * Cloud, true by default: the window uses the cookie jar of the app that opened it, the same jar
980
+ * as that app's inline frames. A window whose app is on another site shares cookies only with
981
+ * those frames; its site storage stays its own. False: a jar of the window's own that ends with
982
+ * it. Extension: false is a TypeError, since the window is the site's own first-party tab.
983
+ */
984
+ syncCookies?: boolean;
985
+ /** Whole categories asked for once the window has connected, drawn in the window on the cloud backend. */
986
+ permissions?: CategoryRequest[];
987
+ };
988
+ /** The Frame of an attachment that lives in its own window. */
989
+ type WindowFrame = Frame & {
990
+ /**
991
+ * Ends the attachment and closes the window. On the cloud backend it first waits, at most 2
992
+ * seconds, for the window's cookie changes to be committed to its jar, so a `goto` on the app's
993
+ * inline frame right after sees the session. Idempotent, and never rejects.
994
+ */
995
+ close(): Promise<void>;
996
+ /**
997
+ * Resolves once the attachment has ended: the window was closed by anyone, reloaded, or left the
998
+ * page FKN attached; it stopped answering (a crash, a frozen page); it lost the app's cookie jar
999
+ * mid-session; or the app page went away. Never rejects. Calls made after it resolved reject with
1000
+ * the terminal detach error.
1001
+ */
1002
+ closed: Promise<void>;
1003
+ };
1004
+ /**
1005
+ * `window.open` returned null, so nothing was opened: the call ran without user activation, the
1006
+ * popup blocker refused it, or the calling frame is sandboxed without `allow-popups`.
1007
+ */
1008
+ declare class FrameWindowBlockedError extends Error {
1009
+ readonly name = "FrameWindowBlockedError";
1010
+ constructor();
1011
+ }
1012
+ /**
1013
+ * Why a window refused to attach.
1014
+ * `'jar-unreachable'`: the cookie jar of the app that opened it could not be reached.
1015
+ * `'bad-url'`: the window would not open that address.
1016
+ * `'opaque-opener'`: this page's origin is opaque (a sandboxed frame without `allow-same-origin`,
1017
+ * or a `file:` page). A window can never address such a page, so none is opened.
1018
+ * `'unknown'`: a reason this library does not know, sent by a newer window.
1019
+ */
1020
+ type FrameWindowRefusal = 'jar-unreachable' | 'bad-url' | 'opaque-opener' | 'unknown';
1021
+ /** The window refused to attach, by `reason`, after loading nothing. */
1022
+ declare class FrameWindowRefusedError extends Error {
1023
+ readonly name = "FrameWindowRefusedError";
1024
+ readonly reason: FrameWindowRefusal;
1025
+ /** `reason` is what the window said; anything this library does not know becomes `'unknown'`. */
1026
+ constructor(reason: unknown);
1027
+ }
885
1028
  type FrameBackend = {
886
1029
  executor: Executor;
887
1030
  gate?: Gate;
888
1031
  goto(url: string, options?: GotoOptions): Promise<void>;
889
1032
  url(): string;
890
1033
  request?(requests: CategoryRequest[]): Promise<CategoryGrant[]>;
1034
+ /**
1035
+ * Runs already-stringified source in the attached site's own realm and answers the cloned result.
1036
+ * The backend gates it (Evaluation) and runs it where the site's globals live. Optional so a
1037
+ * backend that cannot run code refuses `Frame.evaluate` by name rather than answering as if it had.
1038
+ */
1039
+ evaluate?(source: string, arg: unknown): Promise<unknown>;
891
1040
  };
892
1041
  declare const createFrame: (backend: FrameBackend) => Frame;
893
1042
  //#endregion
1043
+ //#region ../web-extension/lib/lib/frame-window.d.ts
1044
+ /** `attachFrame` in both of its shapes: an iframe the app mounted, or a window it opens. */
1045
+ type AttachFrameFunction = {
1046
+ (options: AttachWindowOptions): Promise<WindowFrame>;
1047
+ (options: AttachFrameOptions): Promise<Frame>;
1048
+ };
1049
+ //#endregion
894
1050
  //#region ../web-extension/lib/lib/frame.d.ts
895
1051
  declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY";
896
- declare const attachFrame: ({ iframe, domains, syncCookies, lockdown, permissions }: AttachFrameOptions) => Promise<Frame>;
1052
+ declare const attachFrame: AttachFrameFunction;
897
1053
  //#endregion
898
- export { Gate as A, VideoElementState as C, revive as D, isType as E, OperationRequest as M, SelectorPart as N, type as O, RemoteVideoElement as S, createVideoElementHandle as T, CATEGORIES as _, FrameBackend as a, handleRevivableModules as b, attachFramePermission as c, CategoryGrant as d, CategoryRequest as f, permissions$1 as g, PermissionRequest as h, Frame as i, GateTools as j, Executor as k, createFrame as l, PermissionGrant as m, attachFrame as n, GotoOptions as o, LegacyPermissionRequest as p, AttachFrameOptions as r, Locator as s, ATTACH_FRAME_EVENT_KEY as t, gotoPermission as u, CategoryMeta as v, box as w, BoxedVideoElement as x, PermissionCategory as y };
1054
+ export { VideoElementState as A, SelectorPart as B, permissions as C, handleRevivableModules as D, PermissionCategory as E, type as F, Executor as I, Gate as L, createVideoElementHandle as M, isType as N, BoxedVideoElement as O, revive as P, GateTools as R, PermissionRequest as S, CategoryMeta as T, gotoPermission as _, AttachWindowOptions as a, LegacyPermissionRequest as b, FrameWindowBlockedError as c, FrameWindowRefusedError as d, GotoOptions as f, createFrame as g, attachFramePermission as h, AttachFrameOptions as i, box as j, RemoteVideoElement as k, FrameWindowOptions as l, WindowFrame as m, attachFrame as n, Frame as o, Locator as p, AttachFrameFunction as r, FrameBackend as s, ATTACH_FRAME_EVENT_KEY as t, FrameWindowRefusal as u, CategoryGrant as v, CATEGORIES as w, PermissionGrant as x, CategoryRequest as y, OperationRequest as z };
@@ -1,13 +1,36 @@
1
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 { r as SealedRead } from "./storage-WZEvw3KN.js";
2
+ import { d as storage_d_exports, r as SealedRead } from "./storage-ZrY4Y4L5.js";
3
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
+ };
4
10
  type WriteData = Blob | ArrayBuffer | Uint8Array | string;
5
- //#endregion
6
- //#region src/fs/hybrid.d.ts
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
+ };
20
+ 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 };
22
+ }
23
+ declare const available$1: () => Promise<boolean>;
7
24
  declare const pending$1: () => string[];
8
25
  declare const pendingDeletes$1: () => string[];
9
26
  declare const replicating$1: () => boolean;
27
+ declare const list: () => Promise<FileEntry[]>;
28
+ declare const readFile$1: (path: string) => Promise<Blob>;
10
29
  declare const readFileSealed$1: (path: string) => Promise<SealedRead>;
30
+ declare const writeFile$1: (path: string, data: WriteData, opts?: {
31
+ contentType?: string;
32
+ }) => Promise<void>;
33
+ declare const remove: (path: string) => Promise<void>;
11
34
  declare const pull$1: (path: string) => Promise<Blob>;
12
35
  type AdoptSummary = {
13
36
  uploaded: 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-WiHTYaNP.cjs"),n=require("./api-MW-Lm0u8.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-DHuqVKrl.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-lR-cSs2P.cjs"),u=require("./desktop.cjs"),d=require("./fs-Bv3aFjqA.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.V())return e(!0);let n,r=setTimeout(()=>i(t.V()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.V()),y)},o=new MutationObserver(()=>{t.V()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.V()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),x=async e=>l.r()||e.lockdown||!i.a()||await b()?t.a(e):i.i(e),S=`https://fkn.app`,C=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??S,originB:t?.originB??`*`};(0,_.relay)(i,e,{key:`fkn-api`,...o,unregisterSignal:t?.unregisterSignal})},w=async()=>typeof window>`u`?!1:(await n.a).connect.prompt(location.origin).catch(()=>!1),T=async()=>typeof window>`u`?null:(await n.a).relay.prompt().catch(()=>null),E=new Set,D=e=>(E.add(e),()=>{E.delete(e)}),O=()=>{if(E.size===0)return!1;for(let e of[...E])try{e()}catch{}return!0},k=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},A=e.t({applyUpdate:()=>U,busyReasons:()=>H,onUpdate:()=>L,onUpdateTaken:()=>R,updateReady:()=>j}),j=async()=>typeof window>`u`?!1:n.a.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),M=new Set,N=!1,P=()=>{N=!0;for(let e of[...M])try{e()}catch{}},F=0,I=()=>{let e=n.s();!e||M.size===0||F===e.epoch||(F=e.epoch,N=!1,Promise.resolve(e.remote.shell?.onUpdate(P)).catch(()=>{F===e.epoch&&(F=0)}))};typeof window<`u`&&n.l(I);var L=async e=>{if(typeof window>`u`)return()=>{};if(M.add(e),N)try{e()}catch{}return I(),()=>{M.delete(e)}},R=e=>typeof window>`u`?()=>{}:D(e),z=0,B=!1,V=()=>{if(!O()&&!B){B=!0;try{location.reload()}catch{}}};typeof window<`u`&&n.l(()=>{let e=n.s();if(!e||z===e.epoch)return;z=e.epoch;let t=k(e.remote.shell,V);if(!t){z=0;return}t.catch(()=>{z===e.epoch&&(z=0)})});var H=()=>r.n(),U=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.C,exports.EXTENSION_ABI=t.G,exports.ExtensionOperationUnsupportedError=t.K,exports.ExtensionOutdatedError=t.q,exports.FORGEABLE_HEADERS=t.I,exports.LOCATOR_DENIED=t.y,exports.LOCATOR_ERROR=t.S,exports.LOCATOR_UNSUPPORTED=t.g,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.J,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.f,exports.assertFetchableUrl=t.k,exports.assertForgeableHeaders=t.L,exports.assertLockdownApplicable=t.p,exports.assertOneCookieIdentity=t.R,exports.attachFrame=x,exports.attachFramePermission=t.l,exports.box=t.Z,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=w,exports.connectButtonUrl=g.t,exports.cookies=t.D,exports.createFrame=t.u,exports.createVideoElementHandle=t.Q,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.j,exports.fetchLocalPermission=t.M,exports.fetchPermission=t.N,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.d,exports.handleRevivableModules=t.X,exports.hasForgedCookie=t.z,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.P,exports.isBlockedFrameUrl=t.m,exports.isExtensionExposed=t.V,exports.isLocalNetworkUrl=t.F,exports.isLocatorDenied=t.h,exports.isLocatorUnsupported=t.v,exports.isPermissionDenied=t.n,exports.isTerminalError=t.x,exports.isType=t.$,exports.modifyRequestHeadersPermission=t.w,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=T,exports.readCookiePermission=t.O,exports.readExtensionHandshake=t.H,exports.relayWorker=C,exports.removeRequestHeaderRule=t.T,exports.revive=t.et,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.U,exports.setRequestHeaderRule=t.E,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return A}}),exports.supportsOperation=t.Y,exports.type=t.tt,exports.waitForExtensionExposure=t.W;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DCPdYk-N.cjs"),n=require("./api-Djf-XdZ4.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./cloud-DG_-Rt-L.cjs"),a=require("./dns.cjs"),o=require("./net.cjs"),s=require("./dgram.cjs"),c=require("./http.cjs"),l=require("./extension-DisWHU7m.cjs"),u=require("./desktop.cjs"),d=require("./fs-D8RCGFNc.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.K())return e(!0);let n,r=setTimeout(()=>i(t.K()),v),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.K()),y)},o=new MutationObserver(()=>{t.K()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.K()&&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.O,exports.EXTENSION_ABI=t.X,exports.ExtensionOperationUnsupportedError=t.Z,exports.ExtensionOutdatedError=t.Q,exports.FORGEABLE_HEADERS=t.V,exports.FrameWindowBlockedError=t.d,exports.FrameWindowRefusedError=t.f,exports.LOCATOR_DENIED=t.w,exports.LOCATOR_ERROR=t.D,exports.LOCATOR_UNSUPPORTED=t.b,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.$,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return h.t}}),exports.assertAttachableFrameUrl=t.g,exports.assertFetchableUrl=t.P,exports.assertForgeableHeaders=t.H,exports.assertLockdownApplicable=t._,exports.assertOneCookieIdentity=t.U,exports.attachFrame=x,exports.attachFramePermission=t.p,exports.box=t.nt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return i.n}}),exports.connect=T,exports.connectButtonUrl=g.t,exports.cookies=t.M,exports.createFrame=t.m,exports.createVideoElementHandle=t.rt,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.I,exports.fetchLocalPermission=t.L,exports.fetchPermission=t.R,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return d.u}}),exports.gotoPermission=t.h,exports.handleRevivableModules=t.tt,exports.hasForgedCookie=t.W,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return c.t}}),exports.isBlockedFetchUrl=t.z,exports.isBlockedFrameUrl=t.v,exports.isExtensionExposed=t.K,exports.isLocalNetworkUrl=t.B,exports.isLocatorDenied=t.y,exports.isLocatorUnsupported=t.S,exports.isPermissionDenied=t.n,exports.isTerminalError=t.E,exports.isType=t.it,exports.modifyRequestHeadersPermission=t.k,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.N,exports.readExtensionHandshake=t.q,exports.relayWorker=w,exports.removeRequestHeaderRule=t.A,exports.revive=t.at,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return m.t}}),exports.setMissingExtensionHandler=t.J,exports.setRequestHeaderRule=t.j,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),exports.supportsOperation=t.et,exports.type=t.ot,exports.waitForExtensionExposure=t.Y;
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { t as account_d_exports } from "./account.js";
2
- import { A as modifyRequestHeadersPermission, C as LOCATOR_ERROR, D as isTerminalError, E as isLocatorUnsupported, F as cookies, G as isLocalNetworkUrl, H as fetchLocalPermission, I as readCookiePermission, J as assertOneCookieIdentity, K as FORGEABLE_HEADERS, L as FetchInit, M as setRequestHeaderRule, N as CookieDetails, O as HeaderOperation, P as SiteCookie, R as ProxyFetchRequest, S as LOCATOR_DENIED, T as isLocatorDenied, U as fetchPermission, V as fetchCredentialedPermission, W as isBlockedFetchUrl, Y as hasForgedCookie, _ 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 removeRequestHeaderRule, k as RequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as assertForgeableHeaders, s as readExtensionHandshake, t as extension_d_exports, u as EXTENSION_ABI, v as isPermissionDenied, w as LOCATOR_UNSUPPORTED, x as isBlockedFrameUrl, y as assertAttachableFrameUrl, z as assertFetchableUrl } from "./extension-Bm-PwsD6.js";
3
- import { A as Gate, C as VideoElementState, D as revive, E as isType, M as OperationRequest, N as SelectorPart, O as type, S as RemoteVideoElement, T as createVideoElementHandle, _ as CATEGORIES, a as FrameBackend, b as handleRevivableModules, c as attachFramePermission, d as CategoryGrant, f as CategoryRequest, g as permissions, h as PermissionRequest, i as Frame, j as GateTools, k as Executor, l as createFrame, m as PermissionGrant, o as GotoOptions, p as LegacyPermissionRequest, r as AttachFrameOptions, s as Locator, t as ATTACH_FRAME_EVENT_KEY, u as gotoPermission, v as CategoryMeta, w as box, x as BoxedVideoElement, y as PermissionCategory } from "./index-DIK21kfh.js";
4
- import { n as cloud_d_exports } from "./cloud-C40YCPuv.js";
2
+ import { A as VideoElementState, B as SelectorPart, C as permissions, D as handleRevivableModules, E as PermissionCategory, F as type, I as Executor, L as Gate, M as createVideoElementHandle, N as isType, O as BoxedVideoElement, P as revive, R as GateTools, S as PermissionRequest, T as CategoryMeta, _ as gotoPermission, a as AttachWindowOptions, b as LegacyPermissionRequest, c as FrameWindowBlockedError, d as FrameWindowRefusedError, f as GotoOptions, g as createFrame, h as attachFramePermission, i as AttachFrameOptions, j as box, k as RemoteVideoElement, l as FrameWindowOptions, m as WindowFrame, o as Frame, p as Locator, r as AttachFrameFunction, s as FrameBackend, t as ATTACH_FRAME_EVENT_KEY, u as FrameWindowRefusal, v as CategoryGrant, w as CATEGORIES, x as PermissionGrant, y as CategoryRequest, z as OperationRequest } from "./index-BWJSnpRB.js";
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-C9BRlqEY.js";
4
+ import { n as cloud_d_exports } from "./cloud-Cqdq7Ujd.js";
5
5
  import { t as dns_d_exports } from "./dns.js";
6
- import { u as index_d_exports } from "./index-Cg6y_FTi.js";
7
- import { s as net_d_exports } from "./net-BBtYFEzu.js";
6
+ import { u as index_d_exports } from "./index-kuPqkS_-.js";
7
+ import { s as net_d_exports } from "./net-BWFTx3k_.js";
8
8
  import { t as dgram_d_exports } from "./dgram.js";
9
9
  import { t as http_d_exports } from "./http.js";
10
10
  import { t as desktop_d_exports } from "./desktop.js";
@@ -13,20 +13,35 @@ import { t as packages_d_exports } from "./packages.js";
13
13
  import { t as rooms_d_exports } from "./rooms.js";
14
14
  import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
15
15
  //#region src/frame.d.ts
16
- declare const attachFrame: (options: AttachFrameOptions) => Promise<Frame>;
16
+ /**
17
+ * Attaches FKN to an iframe the app mounted, on the extension when it is installed and on the cloud
18
+ * render proxy otherwise, or with `{ window }` opens the attachment in a window of its own.
19
+ *
20
+ * A window opens before the first await, so call this directly in the click or key handler whose
21
+ * activation opens it. It never waits for the extension to expose itself: a click lands on a loaded
22
+ * page, where the extension has exposed itself or never will.
23
+ *
24
+ * In this release only the cloud backend serves a window. With the extension installed, a window
25
+ * is refused at once with `ExtensionOperationUnsupportedError` (operation `'attachWindow'`), before
26
+ * anything opens or is waited for, so the same click can still open one with
27
+ * `cloud.attachFrame({ window })`. That window runs on this app's cloud cookie jar, not on the
28
+ * extension's: a sign-in made in it reaches this app's cloud frames, never an iframe attached
29
+ * through the extension.
30
+ */
31
+ export declare const attachFrame: AttachFrameFunction;
17
32
  //#endregion
18
33
  //#region src/relay.d.ts
19
- declare const relayWorker: (worker: Worker, options?: {
34
+ export declare const relayWorker: (worker: Worker, options?: {
20
35
  unregisterSignal?: AbortSignal;
21
36
  originA?: string;
22
37
  originB?: string;
23
38
  }) => Promise<void>;
24
39
  //#endregion
25
40
  //#region src/connect.d.ts
26
- declare const connect: () => Promise<boolean>;
41
+ export declare const connect: () => Promise<boolean>;
27
42
  //#endregion
28
43
  //#region src/relay-prompt.d.ts
29
- declare const promptRelay: () => Promise<string | null>;
44
+ export declare const promptRelay: () => Promise<string | null>;
30
45
  declare namespace shell_d_exports {
31
46
  export { applyUpdate, busyReasons, onUpdate, onUpdateTaken, updateReady };
32
47
  }
@@ -39,7 +54,10 @@ declare namespace shell_d_exports {
39
54
  * - **READY**, `onUpdate` / `updateReady`. A newer shell has been downloaded behind the page and
40
55
  * nothing has happened. The broker offers it in its own header, and `applyUpdate` is the app's
41
56
  * way to offer it too. It is never taken without a person asking, because only the app knows what
42
- * a reload costs right now, and a torrent mid-download is the case that matters.
57
+ * a reload costs right now, and a torrent mid-download is the case that matters. The one exception
58
+ * is a broker frame that finds a newer shell as it loads, before it has answered this page at all,
59
+ * while no other fkn.app window is open: it reloads its own frame first, so this page's first
60
+ * connection is simply to the newer shell and nothing of the app is interrupted.
43
61
  * - **TAKEN**, `onUpdateTaken`. Someone pressed update, here or in another tab, and the new shell is
44
62
  * now in control of every page on the origin. That leaves each one running a new worker against a
45
63
  * document from the old build, so the lib RELOADS THE PAGE by default to end the mix. An app that
@@ -111,4 +129,4 @@ declare const busyReasons: () => string[];
111
129
  */
112
130
  declare const applyUpdate: () => Promise<boolean>;
113
131
  //#endregion
114
- export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, box, cloud_d_exports as cloud, connect, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, promptRelay, readCookiePermission, readExtensionHandshake, relayWorker, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };
132
+ export { ATTACH_FRAME_EVENT_KEY, AttachFrameOptions, AttachWindowOptions, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, CookieDetails, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, supportsOperation, type, waitForExtensionExposure };