@fkn/lib 0.9.23 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account.cjs +1 -1
- package/account.d.ts +7 -3
- package/account.js +7 -7
- package/api-BCJO3EWi.cjs +3 -0
- package/api-CesI0aMl.d.ts +677 -0
- package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
- package/api.cjs +1 -0
- package/api.d.ts +3 -0
- package/api.js +2 -0
- package/attach-policy.cjs +1 -0
- package/attach-policy.d.ts +35 -0
- package/attach-policy.js +43 -0
- package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.d.ts +7 -6
- package/cloud/fs/promises.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/fs.js +10 -9
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/cloud-B2ZG-0MF.cjs +1 -0
- package/cloud-B7pI3pp1.d.ts +37 -0
- package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +4 -4
- package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
- package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
- package/contract-D6ksmIm6.d.ts +394 -0
- package/contract.cjs +0 -0
- package/contract.d.ts +3 -0
- package/contract.js +0 -0
- package/desktop.js +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +6 -47
- package/dgram.js +406 -2
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -3
- package/dns.js +2 -2
- package/extension-CJUeVRXf.d.ts +361 -0
- package/extension-DBazc3ff.cjs +1 -0
- package/extension-Dw9gzvei.js +84 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +8 -9
- package/fs/promises.js +2 -2
- package/fs-DYP7utdw.cjs +1 -0
- package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
- package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
- package/fs.cjs +1 -1
- package/fs.d.ts +2 -2
- package/fs.js +1 -1
- package/http.cjs +3 -3
- package/http.d.ts +4 -6
- package/http.js +8 -8
- package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
- package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
- package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
- package/index.cjs +1 -1
- package/index.d.ts +12 -13
- package/index.js +60 -49
- package/lib-DLM2M3_i.cjs +53 -0
- package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
- package/messages-DvpKMTsY.d.ts +28 -0
- package/messages.cjs +1 -0
- package/messages.d.ts +2 -0
- package/messages.js +4 -0
- package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +318 -3
- package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
- package/opfs/promises.d.ts +7 -8
- package/opfs/promises.js +1 -1
- package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
- package/opfs.d.ts +24 -26
- package/opfs.js +3 -3
- package/package.json +27 -2
- package/packages.cjs +1 -1
- package/packages.d.ts +143 -2
- package/packages.js +15 -15
- package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
- package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
- package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
- package/react.d.ts +3 -7
- package/react.js +2 -2
- package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
- package/storage-DLB4ciMf.cjs +1 -0
- package/utils-BvgGdrgN.cjs +1 -0
- package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
- package/wire-Gbo-D74t.d.ts +91 -0
- package/wire.cjs +1 -0
- package/wire.d.ts +2 -0
- package/wire.js +4 -0
- package/api-BGYSJVvR.d.ts +0 -789
- package/api-C-TpWHAU.cjs +0 -3
- package/cloud-BqjwL5KM.cjs +0 -1
- package/cloud-DMTkzfcf.d.ts +0 -36
- package/dgram-BLN-mfgq.cjs +0 -1
- package/dgram-DHQcHefn.js +0 -405
- package/extension-B8Y0sUwC.js +0 -78
- package/extension-CMPZjuaV.d.ts +0 -16
- package/extension-CgSGjcSl.cjs +0 -1
- package/fs-BNnozBMU.cjs +0 -1
- package/lib-DbiVHPXE.cjs +0 -53
- package/lookup-BtwWaCZJ.d.ts +0 -7
- package/net-B6RHtWwe.cjs +0 -1
- package/net-yBkobZqK.js +0 -317
- package/packages-Cn8S-Hkn.d.ts +0 -217
- package/storage-qxXFLgTM.d.ts +0 -44
- package/storage-xAeRQQiz.cjs +0 -1
- package/utils-QfNXtEhb.cjs +0 -1
package/packages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-BCJO3EWi.cjs"),n=require("./busy-Dv8wzE5M.cjs");let r=require("osra");var i=e.t({attach:()=>j,connect:()=>T,hide:()=>w,install:()=>p,isVisible:()=>G,list:()=>m,mount:()=>A,onConnect:()=>W,onVisibilityChange:()=>K,pick:()=>f,search:()=>d,show:()=>C,uninstall:()=>h}),a=`fkn-packages-connection`,o=3e4,s=(e,t)=>Object.assign(Error(t),{code:e}),c=async()=>{if(!t.c)throw s(`unavailable`,`packages: no FKN transport in this realm - use relayWorker to bridge workers`);return t.a},l=(e,t,n)=>(0,r.expose)(e??{},{transport:t,key:a,unregisterSignal:n}),u=async(e,t,n={})=>{let{signal:r,closed:i}=n;if(r?.aborted)throw s(`unavailable`,`packages.connect: aborted before connecting`);let a=new AbortController;r&&r.addEventListener(`abort`,()=>a.abort(r.reason),{once:!0});let c=new AbortController,u=new Promise((e,n)=>{let a=setTimeout(()=>n(s(`timeout`,`packages.connect: the package did not complete the connection`)),o);c.signal.addEventListener(`abort`,()=>clearTimeout(a),{once:!0}),t.addEventListener(`message`,e=>{if(e.data?.type===`fkn-packages-nack`){let t=e.data.message;n(s(`unavailable`,typeof t==`string`&&t?t:`packages.connect: the package refused the connection`))}},{signal:c.signal}),t.start(),r&&r.addEventListener(`abort`,()=>n(s(`unavailable`,`packages.connect: aborted before connecting`)),{once:!0,signal:c.signal}),i?.then(()=>n(s(`unavailable`,`packages.connect: the package closed before connecting`)))});try{return await Promise.race([l(e,t,a.signal),u])}catch(e){a.abort(e);try{t.close()}catch{}throw e}finally{c.abort()}},d=async e=>{let t=await(await c()).packages.search(e);if(`error`in t)throw s(t.error,t.message);return t.results},f=async(e,t)=>{let n=await(await c()).packages.pick(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?[]:n.results},p=async(e,t)=>{let n=await(await c()).packages.install(e,t);if(`error`in n)throw s(n.error,n.message);return`declined`in n?null:n.installed},m=async()=>(await(await c()).packages.list()).results,h=async e=>{let t=await(await c()).packages.uninstall(e);if(`error`in t)throw s(t.error,t.message)},g=({x:e,y:t,width:n,height:r})=>({x:Math.round(e),y:Math.round(t),width:Math.round(n),height:Math.round(r)}),_=(e,t)=>{let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,width:Math.max(0,Math.min(e.x+e.width,t.x+t.width)-n),height:Math.max(0,Math.min(e.y+e.height,t.y+t.height)-r)}},v=(e,t)=>{let n=t;for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t);if((e.overflowX!==`visible`||e.overflowY!==`visible`)&&(n=_(n,g(t.getBoundingClientRect())),n.width===0||n.height===0))break}return n},y=e=>{let t=getComputedStyle(e),n=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius];if(n.some(e=>e.includes(`%`)||e.includes(` `)))return;let r=n.map(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:0});return r.some(e=>e>0)?r:void 0},b=(e,t)=>{if(!e)return!1;let n=(e,t)=>e===t||!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;return n(e.rect,t.rect)&&n(e.clip,t.clip)&&((e,t)=>e===t||!!e&&!!t&&e.every((e,n)=>e===t[n]))(e.radius,t.radius)},x=new Map;n.r(`package view`,()=>x.size>0);var S=async(e,t)=>{let n=x.get(e);if(n){for(let e of n)t&&e.element!==t||(e.stop(),n.delete(e));if(n.size>0)return;x.delete(e)}let r=await(await c()).packages.hide(e);if(`error`in r)throw s(r.error,r.message)},C=async(e,t)=>{let{element:n,rect:r}=t;if(!n&&!r)throw s(`invalid`,`packages.show: pass an element or a rect`);let i=(await c()).packages,a=()=>{if(!n)return{rect:g(r)};let e=g(n.getBoundingClientRect());return{rect:e,clip:v(n,e),radius:y(n)}},o=!0,l,u=0,d=async t=>{l=t;let n=await i.show(e,t);if(`error`in n)throw o=!1,s(n.error,n.message)};await d(a());let f=()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{}),u=requestAnimationFrame(f)};n&&(u=requestAnimationFrame(f));let p={element:n,stop:()=>{o=!1,cancelAnimationFrame(u)}},m=x.get(e)??new Set;return m.add(p),x.set(e,m),{hide:()=>{S(e,n).catch(()=>{})},refresh:()=>{if(!o)return;let e=a();b(l,e)||d(e).catch(()=>{})}}},w=async(e,t={})=>S(e,t.element),T=(async(e,r={})=>{let i=await(await c()).packages.connect(e,{protocol:r.protocol});if(`error`in i)throw s(i.error,i.message);let a=n.t(`package connection`),o=t.s()?.epoch??0,l=t.l((e,t)=>{t!==o&&(a(),l())});Promise.resolve(i.closed).then(()=>{a(),l()},()=>{a(),l()});let{port:d,closed:f}=i;if(r.raw)return{closed:f,port:d};let p=await u(r.payload,d,{signal:r.signal,closed:f});return r.signal&&r.signal.addEventListener(`abort`,()=>{try{d.postMessage({type:`fkn-packages-disconnect`})}catch{}},{once:!0}),{remote:p,closed:f,port:d}}),E=[`allow-scripts`,`allow-same-origin`],D=e=>{let t=e.getAttribute(`sandbox`);if(t!==null){let e=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),n=E.filter(t=>!e.has(t));if(n.length)throw s(`invalid`,`packages.mount: the iframe's sandbox attribute must include ${n.join(` and `)}, or the package cannot start`)}if(globalThis.crossOriginIsolated&&!new Set((e.getAttribute(`allow`)??``).toLowerCase().split(`;`).map(e=>e.trim().split(/\s+/)[0]).filter(Boolean)).has(`cross-origin-isolated`))throw s(`invalid`,`packages.mount: this page is cross-origin isolated, so the iframe's allow attribute must include 'cross-origin-isolated' to hand that down to the package`)},O=3e4,k=(e,t)=>new Promise((n,r)=>{let i=e=>{clearTimeout(o),window.removeEventListener(`message`,a),e?r(e):n()},a=n=>{if(n.source!==e.contentWindow||n.origin!==t)return;let r=n.data;if(r?.type===`fkn-packages-ready`)return i();r?.type===`fkn-packages-failed`&&i(s(`unavailable`,typeof r.message==`string`&&r.message?r.message:`packages.mount: the package failed to boot`))},o=setTimeout(()=>i(s(`timeout`,`packages.mount: the package did not register a connection handler`)),O);window.addEventListener(`message`,a)}),A=async(e,t)=>{let{iframe:r}=t;if(!(r instanceof HTMLIFrameElement))throw s(`invalid`,`packages.mount: pass the iframe to load the package into`);if(!r.isConnected)throw s(`invalid`,`packages.mount: the iframe must be in the document before mounting into it`);D(r);let i=await(await c()).packages.frame(e);if(`error`in i)throw s(i.error,i.message);r.src=i.url;let a={done:!1},o=()=>{},l=new Promise(e=>{o=e}),d=n.t(`mounted package`),f=()=>{if(!a.done){a.done=!0,d();try{r.contentWindow?.postMessage({type:`fkn-packages-close`},i.origin)}catch{}r.src=`about:blank`,o()}};try{await k(r,i.origin)}catch(e){throw f(),e}let p=new MessageChannel,m=r.contentWindow;if(!m)throw f(),s(`unavailable`,`packages.mount: the frame was detached before it could connect`);m.postMessage({type:`fkn-packages-port`,from:i.from,protocol:t.protocol,uri:i.uri,name:i.name,version:i.version},i.origin,[p.port2]);try{m.postMessage({type:`fkn-packages-visibility`,visible:!0},i.origin)}catch{}if(t.raw)return{closed:l,port:p.port1,frame:r,unmount:f};try{return{remote:await u(t.payload,p.port1,{signal:t.signal,closed:l}),closed:l,port:p.port1,frame:r,unmount:f}}catch(e){throw f(),e}},j=(e,t,n)=>u(t,e,{signal:n?.signal}),M=null,N=!1,P=new Set,F=[],I=new Map,L=!1,R=!1,z=e=>{let t=I.get(e);t&&(I.delete(e),t())},B=(e,t)=>{try{e.postMessage({type:`fkn-packages-nack`,message:t})}catch{}try{e.close()}catch{}},V=async(e,t)=>{let{port:n,...r}=e;e.port.addEventListener(`message`,t=>{t.data?.type===`fkn-packages-disconnect`&&z(e.port)});let i;try{i=await t.createPayload(r)}catch(t){throw B(e.port,t instanceof Error?t.message:`the package failed to produce a connection`),t}let a=new Promise(t=>I.set(e.port,t)),o=await l(i,e.port);t.handler?.({...r,remote:o,closed:a,port:e.port})},H=()=>{L||typeof window>`u`||window.parent===window||(L=!0,window.addEventListener(`message`,e=>{if(e.source!==window.parent)return;let t=e.data;if(t?.type===`fkn-packages-port`){let n=e.ports[0];if(!n)return;let r={port:n,from:typeof t.from==`string`?t.from:``,protocol:typeof t.protocol==`string`?t.protocol:null,uri:typeof t.uri==`string`?t.uri:``,name:typeof t.name==`string`?t.name:``,version:typeof t.version==`string`?t.version:``};M?V(r,M).catch(e=>console.warn(`packages.onConnect:`,e)):F.push(r)}if(t?.type===`fkn-packages-close`)for(let e of[...I.keys()])z(e);if(t?.type===`fkn-packages-visibility`){N=t.visible===!0;for(let e of P)try{e(N)}catch{}}}))},U=()=>{R||typeof window>`u`||window.parent===window||(R=!0,window.parent.postMessage({type:`fkn-packages-ready`},`*`))},W=(e,t)=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H();let n={createPayload:e,handler:t};for(M=n,U();F.length&&M===n;)V(F.shift(),n).catch(e=>console.warn(`packages.onConnect:`,e));return{unsubscribe:()=>{M===n&&(M=null)}}},G=()=>N,K=e=>{if(typeof window>`u`)return{unsubscribe:()=>{}};H(),P.add(e);try{e(N)}catch{}return{unsubscribe:()=>{P.delete(e)}}};exports.attach=j,exports.connect=T,exports.hide=w,exports.install=p,exports.isVisible=G,exports.list=m,exports.mount=A,exports.onConnect=W,exports.onVisibilityChange=K,exports.pick=f,exports.search=d,exports.show=C,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.uninstall=h;
|
package/packages.d.ts
CHANGED
|
@@ -1,2 +1,143 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { C as PackageQuery, D as PickOptions, N as Radii, O as Placement, R as SurfaceRect, T as PackagesErrorCode, _ as InstallOptions, l as ConnectOptions, v as InstalledPackage, w as PackageResult } from "./contract-D6ksmIm6.js";
|
|
2
|
+
import { Remote } from "osra";
|
|
3
|
+
declare namespace packages_d_exports {
|
|
4
|
+
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
5
|
+
}
|
|
6
|
+
type PackagesError = Error & {
|
|
7
|
+
code: PackagesErrorCode;
|
|
8
|
+
};
|
|
9
|
+
/** Search npm for FKN packages, e.g. `search({ type: 'plugin', id: 'stub' })`. */
|
|
10
|
+
declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
11
|
+
/** FKN-rendered picker over the same search; resolves the user's selection, already installed. [] on cancel. */
|
|
12
|
+
declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
13
|
+
/** Install a package for this app behind an FKN-rendered confirm, or with `{ noConfirm: true }` for a notice instead of a prompt. Resolves null when the user declines. */
|
|
14
|
+
declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
15
|
+
/** The packages installed by this app. */
|
|
16
|
+
declare const list: () => Promise<InstalledPackage[]>;
|
|
17
|
+
/** Uninstall a package from this app; its frames and connections are torn down. */
|
|
18
|
+
declare const uninstall: (uri: string) => Promise<void>;
|
|
19
|
+
type ShowOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* A placeholder the package frame is aligned to for as long as the view lives. The frame tracks its
|
|
22
|
+
* rect every animation frame, is clipped by its scrolling ancestors, and follows its border-radius,
|
|
23
|
+
* so it reads as inline content even though it renders in FKN's overlay.
|
|
24
|
+
*/
|
|
25
|
+
element?: HTMLElement;
|
|
26
|
+
/** an explicit viewport rect, for a caller that tracks placement itself */
|
|
27
|
+
rect?: SurfaceRect;
|
|
28
|
+
};
|
|
29
|
+
type PackageView = {
|
|
30
|
+
/** release this view; equivalent to `packages.hide(uri, { element })` */
|
|
31
|
+
hide: () => void;
|
|
32
|
+
/** force a re-measure, e.g. right after a layout change the tracker cannot observe */
|
|
33
|
+
refresh: () => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Show an installed, connected package's frame over this page, aligned to `element` (or an explicit
|
|
37
|
+
* `rect`). The package renders its own UI there; the app keeps the space in its own layout. Take it
|
|
38
|
+
* back down with `hide()` on the returned view, or with `packages.hide(uri)`. Throws a PackagesError
|
|
39
|
+
* with code 'not-installed' when the package has not been connected by this app.
|
|
40
|
+
*/
|
|
41
|
+
declare const show: (uri: string, options: ShowOptions) => Promise<PackageView>;
|
|
42
|
+
/**
|
|
43
|
+
* Hide a package's frame again, the counterpart to `show()`. Pass the same `element` to release only
|
|
44
|
+
* the view bound to it; with no element every view of this package is released. The connection is
|
|
45
|
+
* untouched, so the package can be shown again.
|
|
46
|
+
*/
|
|
47
|
+
declare const hide: (uri: string, options?: ShowOptions) => Promise<void>;
|
|
48
|
+
type PackageConnection<T = unknown> = {
|
|
49
|
+
/** the package's exposed payload */
|
|
50
|
+
remote: Remote<T>;
|
|
51
|
+
/** settles when the package side of the connection dies (uninstall, reload, crash) - reconnect by calling connect() again */
|
|
52
|
+
closed: Promise<void>;
|
|
53
|
+
/** the raw channel under `remote`, for direct messaging (osra envelopes ride it too - filter by your own message shape) */
|
|
54
|
+
port: MessagePort;
|
|
55
|
+
};
|
|
56
|
+
type AppConnectOptions = ConnectOptions & {
|
|
57
|
+
/** exposed to the package as ITS `remote` */
|
|
58
|
+
payload?: unknown;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
/** skip the osra handshake and hand back the untouched port - e.g. to transfer it into a worker and attach() there */
|
|
61
|
+
raw?: boolean;
|
|
62
|
+
};
|
|
63
|
+
type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
64
|
+
type Connect = {
|
|
65
|
+
<T = unknown>(uri: string, options?: AppConnectOptions & {
|
|
66
|
+
raw?: false;
|
|
67
|
+
}): Promise<PackageConnection<T>>;
|
|
68
|
+
(uri: string, options: AppConnectOptions & {
|
|
69
|
+
raw: true;
|
|
70
|
+
}): Promise<RawPackageConnection>;
|
|
71
|
+
};
|
|
72
|
+
/** Connect to an installed package. Throws a PackagesError with code 'not-installed' when it is not. */
|
|
73
|
+
declare const connect: Connect;
|
|
74
|
+
type MountOptions = AppConnectOptions & {
|
|
75
|
+
/**
|
|
76
|
+
* the iframe the package is loaded into. YOU create it and YOU own it: its attributes, its styles and
|
|
77
|
+
* its place in your layout are yours, and `mount` only navigates it.
|
|
78
|
+
*
|
|
79
|
+
* Set `allow` yourself for anything the package needs delegated, e.g. `allow="fullscreen; autoplay"`.
|
|
80
|
+
* Permissions policy is not inherited, so a capability this frame is not granted cannot be recovered
|
|
81
|
+
* by the package or by anything it nests inside itself.
|
|
82
|
+
*/
|
|
83
|
+
iframe: HTMLIFrameElement;
|
|
84
|
+
};
|
|
85
|
+
type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
86
|
+
/** the iframe you passed in, unchanged apart from its `src` */
|
|
87
|
+
frame: HTMLIFrameElement;
|
|
88
|
+
/** blank the frame and settle `closed`; the element stays in your layout because it is yours */
|
|
89
|
+
unmount: () => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Load a package into an iframe of YOUR OWN and connect to it, instead of positioning a frame the broker
|
|
93
|
+
* owns and clipping the overlay to it the way `show()` does.
|
|
94
|
+
*
|
|
95
|
+
* You pass the iframe, the same way `cloud.attachFrame` takes one. It lays out, scrolls, stacks and
|
|
96
|
+
* fullscreens with the rest of your page, there is no geometry to translate, and every attribute on it
|
|
97
|
+
* stays exactly as you set it: `mount` reads `sandbox` and `allow` to check the package can boot, then
|
|
98
|
+
* writes nothing but `src`. The package still gets its own origin and its own broker connection.
|
|
99
|
+
*
|
|
100
|
+
* Grant capabilities through the iframe's own `allow`, before calling this. Permissions policy is read
|
|
101
|
+
* at navigation and is not inherited, so it cannot be added afterwards on the frame handed back.
|
|
102
|
+
*
|
|
103
|
+
* Needs a package built against this version of the lib: an older one only accepts a port from fkn.app.
|
|
104
|
+
*/
|
|
105
|
+
declare const mount: <T = unknown>(uri: string, options: MountOptions) => Promise<MountedPackage<T>>;
|
|
106
|
+
/** Run this end of an already-brokered connection port, e.g. after transferring it into a worker. */
|
|
107
|
+
declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
108
|
+
signal?: AbortSignal;
|
|
109
|
+
}) => Promise<Remote<T>>;
|
|
110
|
+
type IncomingConnectionInfo = {
|
|
111
|
+
/** the connecting app's identity: its package uri when it runs on a sandbox origin, else its page origin */
|
|
112
|
+
from: string;
|
|
113
|
+
/** the contract tag the app passed to connect(), e.g. 'stub-source@1' */
|
|
114
|
+
protocol: string | null;
|
|
115
|
+
/** this package's normalized uri per the connecting app's install record, e.g. 'npm:@banou/stub-source-example' */
|
|
116
|
+
uri: string;
|
|
117
|
+
/** this package's npm name */
|
|
118
|
+
name: string;
|
|
119
|
+
/** the exact version this frame runs - the pin is encoded into the sandbox origin, immutable per version */
|
|
120
|
+
version: string;
|
|
121
|
+
};
|
|
122
|
+
type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
123
|
+
/** produces the payload exposed to a connecting app - called once per incoming connection */
|
|
124
|
+
type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
125
|
+
/**
|
|
126
|
+
* Serve connections from apps that installed this package. The first argument is called once per
|
|
127
|
+
* incoming connection with the connection info and returns the payload exposed to that app (its
|
|
128
|
+
* `remote`). The latest registration receives new connections; existing connections are unaffected.
|
|
129
|
+
*/
|
|
130
|
+
declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
131
|
+
unsubscribe: () => void;
|
|
132
|
+
};
|
|
133
|
+
/** True while a host app is showing this package's frame. Packages start hidden. */
|
|
134
|
+
declare const isVisible: () => boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Observe whether a host app is showing this package's frame, so it can render its UI only while on
|
|
137
|
+
* screen. The handler is called immediately with the current state, and on every change after.
|
|
138
|
+
*/
|
|
139
|
+
declare const onVisibilityChange: (handler: (visible: boolean) => void) => {
|
|
140
|
+
unsubscribe: () => void;
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
export { AppConnectOptions, Connect, type ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, type InstallOptions, type InstalledPackage, MountOptions, MountedPackage, PackageConnection, type PackageQuery, type PackageResult, PackageView, PackagesError, type PackagesErrorCode, type PickOptions, type Placement, type Radii, RawPackageConnection, ShowOptions, type SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, packages_d_exports as t, uninstall };
|
package/packages.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { a as t,
|
|
3
|
-
import { r as a, t as o } from "./busy-
|
|
2
|
+
import { a as t, c as n, l as r, s as i } from "./api-DLvscoll.js";
|
|
3
|
+
import { r as a, t as o } from "./busy-B189uX--.js";
|
|
4
4
|
import { expose as s } from "osra";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/packages.ts
|
|
6
6
|
var c = /* @__PURE__ */ e({
|
|
7
7
|
attach: () => F,
|
|
8
8
|
connect: () => k,
|
|
@@ -19,7 +19,7 @@ var c = /* @__PURE__ */ e({
|
|
|
19
19
|
uninstall: () => y
|
|
20
20
|
}), l = "fkn-packages-connection", u = 3e4, d = (e, t) => Object.assign(Error(t), { code: e }), f = async () => {
|
|
21
21
|
if (!n) throw d("unavailable", "packages: no FKN transport in this realm - use relayWorker to bridge workers");
|
|
22
|
-
return
|
|
22
|
+
return t;
|
|
23
23
|
}, p = (e, t, n) => s(e ?? {}, {
|
|
24
24
|
transport: t,
|
|
25
25
|
key: l,
|
|
@@ -84,7 +84,7 @@ var c = /* @__PURE__ */ e({
|
|
|
84
84
|
let n = t;
|
|
85
85
|
for (let t = e.parentElement; t; t = t.parentElement) {
|
|
86
86
|
let e = getComputedStyle(t);
|
|
87
|
-
if (
|
|
87
|
+
if ((e.overflowX !== "visible" || e.overflowY !== "visible") && (n = x(n, b(t.getBoundingClientRect())), n.width === 0 || n.height === 0)) break;
|
|
88
88
|
}
|
|
89
89
|
return n;
|
|
90
90
|
}, C = (e) => {
|
|
@@ -154,27 +154,27 @@ var E = async (e, t) => {
|
|
|
154
154
|
w(s, e) || l(e).catch(() => {});
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
}, O = async (e, t = {}) => E(e, t.element), k = (async (e,
|
|
158
|
-
let
|
|
159
|
-
if ("error" in
|
|
160
|
-
let a = o("package connection"), s =
|
|
157
|
+
}, O = async (e, t = {}) => E(e, t.element), k = (async (e, t = {}) => {
|
|
158
|
+
let n = await (await f()).packages.connect(e, { protocol: t.protocol });
|
|
159
|
+
if ("error" in n) throw d(n.error, n.message);
|
|
160
|
+
let a = o("package connection"), s = i()?.epoch ?? 0, c = r((e, t) => {
|
|
161
161
|
t !== s && (a(), c());
|
|
162
162
|
});
|
|
163
|
-
Promise.resolve(
|
|
163
|
+
Promise.resolve(n.closed).then(() => {
|
|
164
164
|
a(), c();
|
|
165
165
|
}, () => {
|
|
166
166
|
a(), c();
|
|
167
167
|
});
|
|
168
|
-
let { port: l, closed: u } =
|
|
169
|
-
if (
|
|
168
|
+
let { port: l, closed: u } = n;
|
|
169
|
+
if (t.raw) return {
|
|
170
170
|
closed: u,
|
|
171
171
|
port: l
|
|
172
172
|
};
|
|
173
|
-
let p = await m(
|
|
174
|
-
signal:
|
|
173
|
+
let p = await m(t.payload, l, {
|
|
174
|
+
signal: t.signal,
|
|
175
175
|
closed: u
|
|
176
176
|
});
|
|
177
|
-
return
|
|
177
|
+
return t.signal && t.signal.addEventListener("abort", () => {
|
|
178
178
|
try {
|
|
179
179
|
l.postMessage({ type: "fkn-packages-disconnect" });
|
|
180
180
|
} catch {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/
|
|
1
|
+
import { P as Resolvers } from "./contract-D6ksmIm6.js";
|
|
2
|
+
import "./api-CesI0aMl.js";
|
|
3
|
+
//#region src/proxy.d.ts
|
|
4
4
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
5
|
type FetchParameters = Parameters<ProxyFetch>;
|
|
6
6
|
declare const cloudFetch: (input: FetchParameters[0], init?: FetchParameters[1]) => Promise<Response>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./api-
|
|
1
|
+
const e=require("./api-BCJO3EWi.cjs"),t=require("./busy-Dv8wzE5M.cjs");var n=[`fkn.app`,`fkn.dev`,`sdbx.app`],r=e=>e.replace(/\.+$/,``),i=e=>{let t=r(e);return n.some(e=>t===e||t.endsWith(`.${e}`))},a=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}if(i(n.hostname))throw Error(`fetch refuses FKN platform domains (${n.hostname})`)},o=typeof FinalizationRegistry>`u`?void 0:new FinalizationRegistry(e=>e()),s=e=>{let n=e.body;if(!n)return e;let r=t.t(`streamed response`),i=n.getReader(),a=new ReadableStream({pull:async e=>{try{let{done:t,value:n}=await i.read();if(t){r(),e.close();return}e.enqueue(n)}catch(t){r(),e.error(t)}},cancel:async e=>{r(),await i.cancel(e).catch(()=>{})}}),s=new Response(a,{status:e.status,statusText:e.statusText,headers:e.headers});return o?.register(s,r),s},c=async e=>{if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:new Request(`https://body.invalid/`,{method:`POST`,body:e,duplex:`half`}).arrayBuffer()},l=async e=>{if(e.method===`GET`||e.method===`HEAD`)return;let t=await e.clone().arrayBuffer();return t.byteLength?t:void 0},u=async(t,n)=>{if(a(t),typeof t==`object`&&t&&!(t instanceof URL)&&typeof t.url==`string`){let r=t,i={};r.headers.forEach((e,t)=>{i[t]=e});let a=await c(n?.body===void 0?await l(r):n.body);return e.a.then(e=>e.cloud.fetch(r.url,{...n,method:n?.method??r.method,headers:n?.headers??i,body:a})).then(s)}let r=t instanceof URL?t.href:t,i=await c(n?.body);return e.a.then(e=>e.cloud.fetch(r,n?.body===void 0?n:{...n,body:i})).then(s)};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./busy-
|
|
3
|
-
//#region src/
|
|
1
|
+
import { a as e } from "./api-DLvscoll.js";
|
|
2
|
+
import { t } from "./busy-B189uX--.js";
|
|
3
|
+
//#region ../platform-policy/src/index.ts
|
|
4
4
|
var n = [
|
|
5
5
|
"fkn.app",
|
|
6
6
|
"fkn.dev",
|
package/react.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { t as connectButtonUrl } from "./connect-button-
|
|
1
|
+
import { t as connectButtonUrl } from "./connect-button-DdoEikEd.js";
|
|
2
2
|
import { CSSProperties, ReactElement } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/lib/react.d.ts
|
|
3
|
+
//#region src/react.d.ts
|
|
5
4
|
type ConnectButtonProps = {
|
|
6
5
|
className?: string;
|
|
7
6
|
style?: CSSProperties;
|
|
8
7
|
};
|
|
9
|
-
declare const ConnectButton: ({
|
|
10
|
-
className,
|
|
11
|
-
style
|
|
12
|
-
}?: ConnectButtonProps) => ReactElement;
|
|
8
|
+
declare const ConnectButton: ({ className, style }?: ConnectButtonProps) => ReactElement;
|
|
13
9
|
//#endregion
|
|
14
10
|
export { ConnectButton, ConnectButtonProps, connectButtonUrl };
|
package/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./connect-button-
|
|
1
|
+
import { t as e } from "./connect-button-CN4ZJwT6.js";
|
|
2
2
|
import { createElement as t } from "react";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/react.ts
|
|
4
4
|
var n = ({ className: n, style: r } = {}) => t("iframe", {
|
|
5
5
|
src: e(),
|
|
6
6
|
title: "Connect your FKN account",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./api-
|
|
3
|
-
|
|
4
|
-
//#region src/
|
|
5
|
-
var
|
|
2
|
+
import { a as t } from "./api-DLvscoll.js";
|
|
3
|
+
import { STORAGE_NOT_FOUND as n } from "./messages.js";
|
|
4
|
+
//#region src/storage.ts
|
|
5
|
+
var r = /* @__PURE__ */ e({
|
|
6
6
|
StorageLockedError: () => i,
|
|
7
7
|
StorageNotFoundError: () => a,
|
|
8
8
|
availability: () => p,
|
|
@@ -48,4 +48,4 @@ var n = "FKN_STORAGE_NOT_FOUND", r = /* @__PURE__ */ e({
|
|
|
48
48
|
await i.cloud.fs.writeFile(e, a, r?.contentType ?? null).catch(s);
|
|
49
49
|
}, v = (e) => t.then((t) => t.cloud.fs.remove(e)).then(() => void 0), y = () => t.then((e) => e.cloud.fs.encryption()), b = () => t.then((e) => e.cloud.fs.unlock());
|
|
50
50
|
//#endregion
|
|
51
|
-
export { o as a, g as c, b as d, _ as f, y as i, v as l, a as n, m as o,
|
|
51
|
+
export { o as a, g as c, b as d, _ as f, y as i, v as l, a as n, m as o, p as r, h as s, i as t, r as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-BCJO3EWi.cjs"),n=require("./messages.cjs");var r=e.t({StorageLockedError:()=>i,StorageNotFoundError:()=>a,availability:()=>p,available:()=>c,encryption:()=>y,isNotFound:()=>o,list:()=>m,quota:()=>h,readFile:()=>g,remove:()=>v,unlock:()=>b,writeFile:()=>_}),i=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: this account stores encrypted data, unlock it from the FKN card or unlock()`)}},a=class extends Error{code=n.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},o=e=>e?.code===n.STORAGE_NOT_FOUND,s=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new i:o(e)||e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new a(e.message):e},c=()=>t.a.then(e=>e.cloud.fs.available()).catch(()=>!1),l=8e3,u=1e3,d=!1,f=async()=>{let e=(await t.a).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},p=async()=>{let e=d?u:l,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);f().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(d=!0,`unknown`):(d=!1,t)},m=()=>t.a.then(e=>e.cloud.fs.list()),h=()=>t.a.then(e=>e.cloud.fs.quota()),g=async e=>{let n=await(await t.a).cloud.fs.readFile(e).catch(s);return new Blob([n])},_=async(e,n,r)=>{let i=await t.a,a=n instanceof Blob?new Uint8Array(await n.arrayBuffer()):n;await i.cloud.fs.writeFile(e,a,r?.contentType??null).catch(s)},v=e=>t.a.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),y=()=>t.a.then(e=>e.cloud.fs.encryption()),b=()=>t.a.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("ip-address");var t=new TextEncoder;new TextDecoder;var n=`webvpn-udp-port-ack`,r=524288,i=t=>e.Address4.isValid(t),a=t=>e.Address6.isValid(t),o=e=>i(e)?4:a(e)?6:0,s=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},c=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},l=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,hasRange:!0,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,hasRange:!1,offset:0,length:n.length,port:r,address:i,callback:t}}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Address4 as e, Address6 as t } from "ip-address";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/webvpn/utils.ts
|
|
3
3
|
var n = new TextEncoder();
|
|
4
4
|
new TextDecoder();
|
|
5
|
-
var r = "webvpn-udp-port-ack", i =
|
|
5
|
+
var r = "webvpn-udp-port-ack", i = 524288, a = (t) => e.isValid(t), o = (e) => t.isValid(e), s = (e) => a(e) ? 4 : o(e) ? 6 : 0, c = (...e) => {
|
|
6
6
|
if (typeof e[0] == "string") throw Error("FKN WebVPN does not support IPC connections");
|
|
7
7
|
let t = typeof e.at(-1) == "function" ? e.at(-1) : void 0;
|
|
8
8
|
return e[0] && typeof e[0] == "object" ? {
|
|
@@ -49,6 +49,5 @@ var r = "webvpn-udp-port-ack", i = 512 * 1024, a = (t) => e.isValid(t), o = (e)
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
new TextEncoder(), new TextDecoder();
|
|
53
52
|
//#endregion
|
|
54
53
|
export { o as a, c, a as i, n as l, r as n, l as o, s as r, u as s, i as t };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//#region src/wire.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Socket option codes as they appear on the WebVPN wire, and the option shapes built from them.
|
|
4
|
+
*
|
|
5
|
+
* These live in the library rather than beside the packet codecs because BOTH sides need them and
|
|
6
|
+
* only one side may own them. `@fkn/lib` already imported these constants at value level (see
|
|
7
|
+
* `webvpn/net.ts` and `webvpn/dgram.ts`), so the previous arrangement had the published package
|
|
8
|
+
* reaching into `src/api/webvpn/packets/*` for its own vocabulary, which dragged those modules and
|
|
9
|
+
* their imports into the library's type program.
|
|
10
|
+
*
|
|
11
|
+
* Owning them here inverts that: the codecs in `src/api/webvpn/packets/` import from this file, and
|
|
12
|
+
* the library needs nothing from the app to describe a socket option.
|
|
13
|
+
*
|
|
14
|
+
* The VALUES are protocol. They are the u8 discriminant of a tagged union nested inside a
|
|
15
|
+
* TcpSetOption or UdpSetOption client packet (metadata-stream tag 8), and a relay built against
|
|
16
|
+
* these numbers is deployed independently of any browser holding this file. Renumbering one is a
|
|
17
|
+
* wire break, not a refactor. Booleans go on the wire as u8, 0 for false and anything else true.
|
|
18
|
+
*/
|
|
19
|
+
declare const TCP_OPTION_NODELAY: 0;
|
|
20
|
+
declare const TCP_OPTION_TTL: 1;
|
|
21
|
+
declare const TCP_OPTION_KEEPALIVE: 2;
|
|
22
|
+
declare const TCP_OPTION_SEND_BUFFER_SIZE: 3;
|
|
23
|
+
declare const TCP_OPTION_RECV_BUFFER_SIZE: 4;
|
|
24
|
+
type TcpSocketOption = {
|
|
25
|
+
type: typeof TCP_OPTION_NODELAY;
|
|
26
|
+
value: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
type: typeof TCP_OPTION_TTL;
|
|
29
|
+
value: number;
|
|
30
|
+
} | {
|
|
31
|
+
type: typeof TCP_OPTION_KEEPALIVE;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
initialDelaySeconds: number;
|
|
34
|
+
} | {
|
|
35
|
+
type: typeof TCP_OPTION_SEND_BUFFER_SIZE;
|
|
36
|
+
value: number;
|
|
37
|
+
} | {
|
|
38
|
+
type: typeof TCP_OPTION_RECV_BUFFER_SIZE;
|
|
39
|
+
value: number;
|
|
40
|
+
};
|
|
41
|
+
declare const UDP_OPTION_BROADCAST: 0;
|
|
42
|
+
declare const UDP_OPTION_TTL: 1;
|
|
43
|
+
declare const UDP_OPTION_MULTICAST_TTL_V4: 2;
|
|
44
|
+
declare const UDP_OPTION_MULTICAST_LOOP_V4: 3;
|
|
45
|
+
declare const UDP_OPTION_MULTICAST_LOOP_V6: 4;
|
|
46
|
+
declare const UDP_OPTION_ADD_MEMBERSHIP_V4: 5;
|
|
47
|
+
declare const UDP_OPTION_DROP_MEMBERSHIP_V4: 6;
|
|
48
|
+
declare const UDP_OPTION_ADD_MEMBERSHIP_V6: 7;
|
|
49
|
+
declare const UDP_OPTION_DROP_MEMBERSHIP_V6: 8;
|
|
50
|
+
declare const UDP_OPTION_SEND_BUFFER_SIZE: 9;
|
|
51
|
+
declare const UDP_OPTION_RECV_BUFFER_SIZE: 10;
|
|
52
|
+
type UdpSocketOption = {
|
|
53
|
+
type: typeof UDP_OPTION_BROADCAST;
|
|
54
|
+
value: boolean;
|
|
55
|
+
} | {
|
|
56
|
+
type: typeof UDP_OPTION_TTL;
|
|
57
|
+
value: number;
|
|
58
|
+
} | {
|
|
59
|
+
type: typeof UDP_OPTION_MULTICAST_TTL_V4;
|
|
60
|
+
value: number;
|
|
61
|
+
} | {
|
|
62
|
+
type: typeof UDP_OPTION_MULTICAST_LOOP_V4;
|
|
63
|
+
value: boolean;
|
|
64
|
+
} | {
|
|
65
|
+
type: typeof UDP_OPTION_MULTICAST_LOOP_V6;
|
|
66
|
+
value: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
type: typeof UDP_OPTION_ADD_MEMBERSHIP_V4;
|
|
69
|
+
group: Uint8Array;
|
|
70
|
+
interface: Uint8Array;
|
|
71
|
+
} | {
|
|
72
|
+
type: typeof UDP_OPTION_DROP_MEMBERSHIP_V4;
|
|
73
|
+
group: Uint8Array;
|
|
74
|
+
interface: Uint8Array;
|
|
75
|
+
} | {
|
|
76
|
+
type: typeof UDP_OPTION_ADD_MEMBERSHIP_V6;
|
|
77
|
+
group: Uint8Array;
|
|
78
|
+
ifIndex: number;
|
|
79
|
+
} | {
|
|
80
|
+
type: typeof UDP_OPTION_DROP_MEMBERSHIP_V6;
|
|
81
|
+
group: Uint8Array;
|
|
82
|
+
ifIndex: number;
|
|
83
|
+
} | {
|
|
84
|
+
type: typeof UDP_OPTION_SEND_BUFFER_SIZE;
|
|
85
|
+
value: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: typeof UDP_OPTION_RECV_BUFFER_SIZE;
|
|
88
|
+
value: number;
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { UDP_OPTION_TTL as _, TCP_OPTION_TTL as a, UDP_OPTION_ADD_MEMBERSHIP_V6 as c, UDP_OPTION_DROP_MEMBERSHIP_V6 as d, UDP_OPTION_MULTICAST_LOOP_V4 as f, UDP_OPTION_SEND_BUFFER_SIZE as g, UDP_OPTION_RECV_BUFFER_SIZE as h, TCP_OPTION_SEND_BUFFER_SIZE as i, UDP_OPTION_BROADCAST as l, UDP_OPTION_MULTICAST_TTL_V4 as m, TCP_OPTION_NODELAY as n, TcpSocketOption as o, UDP_OPTION_MULTICAST_LOOP_V6 as p, TCP_OPTION_RECV_BUFFER_SIZE as r, UDP_OPTION_ADD_MEMBERSHIP_V4 as s, TCP_OPTION_KEEPALIVE as t, UDP_OPTION_DROP_MEMBERSHIP_V4 as u, UdpSocketOption as v };
|
package/wire.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=0,t=1,n=2,r=3,i=4,a=0,o=1,s=2,c=3,l=4,u=5,d=6,f=7,p=8,m=9,h=10;exports.TCP_OPTION_KEEPALIVE=n,exports.TCP_OPTION_NODELAY=e,exports.TCP_OPTION_RECV_BUFFER_SIZE=i,exports.TCP_OPTION_SEND_BUFFER_SIZE=r,exports.TCP_OPTION_TTL=t,exports.UDP_OPTION_ADD_MEMBERSHIP_V4=u,exports.UDP_OPTION_ADD_MEMBERSHIP_V6=f,exports.UDP_OPTION_BROADCAST=a,exports.UDP_OPTION_DROP_MEMBERSHIP_V4=d,exports.UDP_OPTION_DROP_MEMBERSHIP_V6=p,exports.UDP_OPTION_MULTICAST_LOOP_V4=c,exports.UDP_OPTION_MULTICAST_LOOP_V6=l,exports.UDP_OPTION_MULTICAST_TTL_V4=s,exports.UDP_OPTION_RECV_BUFFER_SIZE=h,exports.UDP_OPTION_SEND_BUFFER_SIZE=m,exports.UDP_OPTION_TTL=o;
|
package/wire.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as UDP_OPTION_TTL, a as TCP_OPTION_TTL, c as UDP_OPTION_ADD_MEMBERSHIP_V6, d as UDP_OPTION_DROP_MEMBERSHIP_V6, f as UDP_OPTION_MULTICAST_LOOP_V4, g as UDP_OPTION_SEND_BUFFER_SIZE, h as UDP_OPTION_RECV_BUFFER_SIZE, i as TCP_OPTION_SEND_BUFFER_SIZE, l as UDP_OPTION_BROADCAST, m as UDP_OPTION_MULTICAST_TTL_V4, n as TCP_OPTION_NODELAY, o as TcpSocketOption, p as UDP_OPTION_MULTICAST_LOOP_V6, r as TCP_OPTION_RECV_BUFFER_SIZE, s as UDP_OPTION_ADD_MEMBERSHIP_V4, t as TCP_OPTION_KEEPALIVE, u as UDP_OPTION_DROP_MEMBERSHIP_V4, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
|
|
2
|
+
export { TCP_OPTION_KEEPALIVE, TCP_OPTION_NODELAY, TCP_OPTION_RECV_BUFFER_SIZE, TCP_OPTION_SEND_BUFFER_SIZE, TCP_OPTION_TTL, TcpSocketOption, UDP_OPTION_ADD_MEMBERSHIP_V4, UDP_OPTION_ADD_MEMBERSHIP_V6, UDP_OPTION_BROADCAST, UDP_OPTION_DROP_MEMBERSHIP_V4, UDP_OPTION_DROP_MEMBERSHIP_V6, UDP_OPTION_MULTICAST_LOOP_V4, UDP_OPTION_MULTICAST_LOOP_V6, UDP_OPTION_MULTICAST_TTL_V4, UDP_OPTION_RECV_BUFFER_SIZE, UDP_OPTION_SEND_BUFFER_SIZE, UDP_OPTION_TTL, UdpSocketOption };
|
package/wire.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/wire.ts
|
|
2
|
+
var e = 0, t = 1, n = 2, r = 3, i = 4, a = 0, o = 1, s = 2, c = 3, l = 4, u = 5, d = 6, f = 7, p = 8, m = 9, h = 10;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { n as TCP_OPTION_KEEPALIVE, e as TCP_OPTION_NODELAY, i as TCP_OPTION_RECV_BUFFER_SIZE, r as TCP_OPTION_SEND_BUFFER_SIZE, t as TCP_OPTION_TTL, u as UDP_OPTION_ADD_MEMBERSHIP_V4, f as UDP_OPTION_ADD_MEMBERSHIP_V6, a as UDP_OPTION_BROADCAST, d as UDP_OPTION_DROP_MEMBERSHIP_V4, p as UDP_OPTION_DROP_MEMBERSHIP_V6, c as UDP_OPTION_MULTICAST_LOOP_V4, l as UDP_OPTION_MULTICAST_LOOP_V6, s as UDP_OPTION_MULTICAST_TTL_V4, h as UDP_OPTION_RECV_BUFFER_SIZE, m as UDP_OPTION_SEND_BUFFER_SIZE, o as UDP_OPTION_TTL };
|