@floegence/floe-webapp-protocol 0.52.12 → 0.53.0

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/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ArtifactSource, ConnectionDiagnostic, ConnectionSnapshot, ConnectionState, Session } from '@floegence/flowersec-core';
2
- import type { ConnectionControllerOptions, PrivateLoopbackArtifactSourceV1, PrivateLoopbackConnectionControllerOptionsV1 } from '@floegence/flowersec-core/browser';
2
+ import type { ConnectionControllerOptions, HTTPDirectArtifactSourceV1, HTTPDirectConnectionControllerOptionsV1, PrivateLoopbackArtifactSourceV1, PrivateLoopbackConnectionControllerOptionsV1 } from '@floegence/flowersec-core/browser';
3
3
  import { type JSX } from 'solid-js';
4
4
  import type { ProtocolContract } from './contract';
5
5
  interface ProtocolContextValue {
@@ -26,9 +26,16 @@ export type ConnectConfig = SharedConnectConfig & (Readonly<{
26
26
  source: ArtifactSource;
27
27
  controller?: ConnectionControllerOptions;
28
28
  privateLoopback?: never;
29
+ httpDirect?: never;
29
30
  }> | Readonly<{
30
31
  source: PrivateLoopbackArtifactSourceV1;
31
32
  privateLoopback: PrivateLoopbackConnectionControllerOptionsV1;
33
+ httpDirect?: never;
34
+ controller?: never;
35
+ }> | Readonly<{
36
+ source: HTTPDirectArtifactSourceV1;
37
+ httpDirect: HTTPDirectConnectionControllerOptionsV1;
38
+ privateLoopback?: never;
32
39
  controller?: never;
33
40
  }>);
34
41
  export declare class ConnectionReplacementRequiredError extends Error {
package/dist/index2.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext as z, onCleanup as D, createComponent as L, useContext as O } from "solid-js";
1
+ import { createContext as x, onCleanup as z, createComponent as L, useContext as O } from "solid-js";
2
2
  import { createStore as k } from "solid-js/store";
3
3
  const j = () => import("@floegence/flowersec-core/browser");
4
4
  class N extends Error {
@@ -6,34 +6,34 @@ class N extends Error {
6
6
  super("Connection source or options changed; call replaceConnection() explicitly"), this.name = "ConnectionReplacementRequiredError";
7
7
  }
8
8
  }
9
- const S = z(), v = Object.freeze({
9
+ const D = x(), b = Object.freeze({
10
10
  state: "idle",
11
11
  attempt: 0
12
12
  }), h = Object.freeze({
13
13
  state: "idle",
14
14
  attempt: 0
15
15
  });
16
- function G(t) {
16
+ function H(t) {
17
17
  const [o, u] = k({
18
- snapshot: v,
18
+ snapshot: b,
19
19
  diagnostic: h,
20
20
  error: null
21
21
  }), f = t.contract;
22
22
  let c = null, C = null, a = null, i = null, l = 0;
23
- const y = (e, n, r) => c === e && a === n && l === r, P = (e, n, r, s, d) => {
24
- if (y(n, r, s))
23
+ const w = (e, r, n) => c === e && a === r && l === n, P = (e, r, n, s, d) => {
24
+ if (w(r, n, s))
25
25
  try {
26
- if (r.lifecycle?.synchronize(e), !y(n, r, s)) return;
26
+ if (n.lifecycle?.synchronize(e), !w(r, n, s)) return;
27
27
  const p = d.connectionDiagnostic(e);
28
28
  u({
29
29
  snapshot: e,
30
30
  diagnostic: p,
31
- error: F(e, p, d)
31
+ error: T(e, p, d)
32
32
  });
33
33
  } catch (p) {
34
- const x = p instanceof Error ? p : new Error("Floe connection binding failed");
35
- if (r.lifecycle?.dispose(), y(n, r, s)) {
36
- const b = Object.freeze({
34
+ const E = p instanceof Error ? p : new Error("Floe connection binding failed");
35
+ if (n.lifecycle?.dispose(), w(r, n, s)) {
36
+ const v = Object.freeze({
37
37
  state: "failed",
38
38
  attempt: e.attempt,
39
39
  failure: Object.freeze({
@@ -45,32 +45,32 @@ function G(t) {
45
45
  })
46
46
  });
47
47
  u({
48
- snapshot: b,
49
- diagnostic: d.connectionDiagnostic(b),
50
- error: x
48
+ snapshot: v,
49
+ diagnostic: d.connectionDiagnostic(v),
50
+ error: E
51
51
  });
52
52
  }
53
- n.close();
53
+ r.close();
54
54
  }
55
- }, w = async () => {
55
+ }, y = async () => {
56
56
  const e = l;
57
57
  C?.(), C = null;
58
- const n = c, r = a;
59
- c = null, a = null, r?.lifecycle?.dispose(), n !== null && await n.close(), e === l && c === null && a === null && u({
60
- snapshot: v,
58
+ const r = c, n = a;
59
+ c = null, a = null, n?.lifecycle?.dispose(), r !== null && await r.close(), e === l && c === null && a === null && u({
60
+ snapshot: b,
61
61
  diagnostic: h,
62
62
  error: null
63
63
  });
64
64
  }, m = async (e) => {
65
- const n = l, r = await j();
66
- if (n !== l) return;
67
- const s = e.privateLoopback === void 0 ? await r.createConnectionController(e.source, e.controller) : await r.createPrivateLoopbackConnectionControllerV1(e.source, e.privateLoopback);
68
- if (n !== l) {
65
+ const r = l, n = await j();
66
+ if (r !== l) return;
67
+ const s = e.httpDirect !== void 0 ? await n.createHTTPDirectConnectionControllerV1(e.source, e.httpDirect) : e.privateLoopback !== void 0 ? await n.createPrivateLoopbackConnectionControllerV1(e.source, e.privateLoopback) : await n.createConnectionController(e.source, e.controller);
68
+ if (r !== l) {
69
69
  await s.close();
70
70
  return;
71
71
  }
72
- a = e, c = s, C = s.subscribe((d) => P(d, s, e, n, r)), s.start(), await s.waitForSession();
73
- }, E = {
72
+ a = e, c = s, C = s.subscribe((d) => P(d, s, e, r, n)), s.start(), await s.waitForSession();
73
+ }, S = {
74
74
  status: () => o.snapshot.state,
75
75
  snapshot: () => o.snapshot,
76
76
  diagnostic: () => o.diagnostic,
@@ -93,38 +93,38 @@ function G(t) {
93
93
  },
94
94
  replaceConnection: async (e) => (i !== null && await i.catch(() => {
95
95
  }), i = (async () => {
96
- l += 1, await w(), l += 1, await m(e);
96
+ l += 1, await y(), l += 1, await m(e);
97
97
  })().finally(() => {
98
98
  i = null;
99
99
  }), i),
100
100
  retryNow: () => c?.retryNow() ?? !1,
101
101
  disconnect: () => {
102
- l += 1, w();
102
+ l += 1, y();
103
103
  }
104
104
  };
105
- return D(() => {
105
+ return z(() => {
106
106
  l += 1, C?.(), a?.lifecycle?.dispose(), c?.close();
107
- }), L(S.Provider, {
108
- value: E,
107
+ }), L(D.Provider, {
108
+ value: S,
109
109
  get children() {
110
110
  return t.children;
111
111
  }
112
112
  });
113
113
  }
114
- function B() {
115
- const t = O(S);
114
+ function V() {
115
+ const t = O(D);
116
116
  if (!t) throw new Error("useProtocol must be used within a ProtocolProvider");
117
117
  return t;
118
118
  }
119
119
  function R(t, o) {
120
- return t.source === o.source && t.controller === o.controller && t.privateLoopback === o.privateLoopback && t.lifecycle === o.lifecycle;
120
+ return t.source === o.source && t.controller === o.controller && t.privateLoopback === o.privateLoopback && t.httpDirect === o.httpDirect && t.lifecycle === o.lifecycle;
121
121
  }
122
- function F(t, o, u) {
122
+ function T(t, o, u) {
123
123
  const f = t.failure;
124
124
  return f === void 0 || t.state !== "failed" && t.state !== "closed" ? null : new u.ConnectionControllerError(t.state === "closed" ? "closed" : "failed", f, t.retryDisposition, o);
125
125
  }
126
126
  export {
127
127
  N as ConnectionReplacementRequiredError,
128
- G as ProtocolProvider,
129
- B as useProtocol
128
+ H as ProtocolProvider,
129
+ V as useProtocol
130
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-protocol",
3
- "version": "0.52.12",
3
+ "version": "0.53.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "solid-js": "^1.8.0"
35
35
  },
36
36
  "dependencies": {
37
- "@floegence/flowersec-core": "5.1.0"
37
+ "@floegence/flowersec-core": "5.2.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "solid-js": "^1.9.11",