@floegence/floe-webapp-protocol 0.36.66 → 0.36.67

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.
@@ -16,7 +16,10 @@ export interface RpcClientLike {
16
16
  }
17
17
  export interface RpcHelpers {
18
18
  call: <Req, Res>(typeId: number, payload: Req) => Promise<Res>;
19
+ /** Strict notification: detached transports fail with ProtocolNotConnectedError. */
19
20
  notify: <Req>(typeId: number, payload: Req) => Promise<void>;
21
+ /** Best-effort notification: detached transports are treated as already dropped. */
22
+ notifyBestEffort: <Req>(typeId: number, payload: Req) => Promise<void>;
20
23
  onNotify: <Payload>(typeId: number, handler: (payload: Payload) => void) => () => void;
21
24
  }
22
25
  export interface ProtocolContract<TApi = unknown> {
package/dist/index3.js CHANGED
@@ -1,52 +1,60 @@
1
- import { useProtocol as d } from "./index2.js";
2
- import { RpcProxyDetachedError as u } from "@floegence/flowersec-core/rpc";
3
- class f extends Error {
1
+ import { useProtocol as y } from "./index2.js";
2
+ import { RpcProxyDetachedError as d } from "@floegence/flowersec-core/rpc";
3
+ class u extends Error {
4
4
  constructor() {
5
5
  super("Not connected"), this.name = "ProtocolNotConnectedError";
6
6
  }
7
7
  }
8
- class a extends Error {
8
+ class p extends Error {
9
9
  typeId;
10
10
  code;
11
11
  constructor(t) {
12
12
  super(t.message ?? `RPC error: ${t.code}`, { cause: t.cause }), this.name = "RpcError", this.typeId = t.typeId, this.code = t.code;
13
13
  }
14
14
  }
15
- function l(e) {
16
- return { call: async (o, c) => {
17
- const n = e.rpcTransport();
18
- let r;
15
+ function h(c) {
16
+ const t = async (r, e) => {
17
+ const a = c.rpcTransport();
18
+ let o;
19
19
  try {
20
- r = await n.rpc.call(o, c);
21
- } catch (i) {
22
- throw i instanceof u ? new f() : new a({ typeId: o, code: -1, message: "RPC transport error", cause: i });
20
+ o = await a.rpc.call(r, e);
21
+ } catch (n) {
22
+ throw n instanceof d ? new u() : new p({ typeId: r, code: -1, message: "RPC transport error", cause: n });
23
23
  }
24
- if (r.error)
25
- throw new a({
26
- typeId: o,
27
- code: r.error.code,
28
- message: r.error.message ?? `RPC error: ${r.error.code}`,
29
- cause: r.error
24
+ if (o.error)
25
+ throw new p({
26
+ typeId: r,
27
+ code: o.error.code,
28
+ message: o.error.message ?? `RPC error: ${o.error.code}`,
29
+ cause: o.error
30
30
  });
31
- return r.payload;
32
- }, notify: async (o, c) => {
33
- const n = e.rpcTransport();
31
+ return o.payload;
32
+ }, s = async (r, e, a) => {
33
+ const o = c.rpcTransport();
34
34
  try {
35
- await n.rpc.notify(o, c);
36
- } catch (r) {
37
- if (r instanceof u) return;
38
- throw new a({ typeId: o, code: -1, message: "RPC notify transport error", cause: r });
35
+ await o.rpc.notify(r, e);
36
+ } catch (n) {
37
+ if (n instanceof d) {
38
+ if (a.detached === "ignore") return;
39
+ throw new u();
40
+ }
41
+ throw new p({ typeId: r, code: -1, message: "RPC notify transport error", cause: n });
39
42
  }
40
- }, onNotify: (o, c) => e.rpcTransport().rpc.onNotify(o, (r) => {
41
- c(r);
43
+ };
44
+ return { call: t, notify: async (r, e) => {
45
+ await s(r, e, { detached: "throw" });
46
+ }, notifyBestEffort: async (r, e) => {
47
+ await s(r, e, { detached: "ignore" });
48
+ }, onNotify: (r, e) => c.rpcTransport().rpc.onNotify(r, (o) => {
49
+ e(o);
42
50
  }) };
43
51
  }
44
- function m(e) {
45
- const t = d(), p = e?.contract ?? t.contract(), s = l(t), o = p.createRpc(s);
46
- return Object.assign(o, s);
52
+ function E(c) {
53
+ const t = y(), s = c?.contract ?? t.contract(), i = h(t), f = s.createRpc(i);
54
+ return Object.assign(f, i);
47
55
  }
48
56
  export {
49
- f as ProtocolNotConnectedError,
50
- a as RpcError,
51
- m as useRpc
57
+ u as ProtocolNotConnectedError,
58
+ p as RpcError,
59
+ E as useRpc
52
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-protocol",
3
- "version": "0.36.66",
3
+ "version": "0.36.67",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -20,6 +20,9 @@
20
20
  "files": [
21
21
  "dist"
22
22
  ],
23
+ "engines": {
24
+ "node": ">=24.0.0"
25
+ },
23
26
  "scripts": {
24
27
  "dev": "vite build --watch",
25
28
  "build": "pnpm clean && vite build && tsc -p tsconfig.build.json",
@@ -30,7 +33,7 @@
30
33
  "solid-js": "^1.8.0"
31
34
  },
32
35
  "dependencies": {
33
- "@floegence/flowersec-core": "^0.19.7"
36
+ "@floegence/flowersec-core": "^0.19.9"
34
37
  },
35
38
  "devDependencies": {
36
39
  "solid-js": "^1.9.11",