@feltdb/core 0.7.2 → 0.7.3

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.
@@ -1,4 +1,4 @@
1
- import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "./components-C5p2TfIU.js";
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "./components-Dxuhrv8_.js";
2
2
  import { t as x } from "./KeyManagementPanel-DZuSeWBK.js";
3
3
  import { ManagedInstanceUtil as S } from "./utils/managed-instance.js";
4
4
  import { ManagedInstancePanel as C } from "./components/ManagedInstancePanel.js";
@@ -8,8 +8,8 @@ import { BrowserRouter as I, Link as L, Route as R, Routes as z } from "react-ro
8
8
  import { jsx as B, jsxs as V } from "react/jsx-runtime";
9
9
  import { parseFlowSpec as H } from "@feltdb/core";
10
10
  //#region src/app.tsx
11
- function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default", deploymentRuntime: w = "browser", applicationUrl: T = "", developmentSession: E, onConnect: D }) {
12
- let [O, k] = F(null), A = e(s || null, C), j = o(s || null, O, C), { diagnostics: M } = n(s || null), N = v(s || null), [U, W] = F(), G = w !== "browser" || !!b, [K, q] = F([]), [J, Y] = F([]), [X, Z] = F(0), Q = (e) => ({
11
+ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default", deploymentRuntime: w = "browser", applicationUrl: T = "", developmentSession: E, managedPublish: D, onConnect: O }) {
12
+ let [k, A] = F(null), j = e(s || null, C), M = o(s || null, k, C), { diagnostics: N } = n(s || null), U = v(s || null), [W, G] = F(), K = w !== "browser" || !!b, [q, J] = F([]), [Y, X] = F([]), [Z, Q] = F(0), $ = (e) => ({
13
13
  pathname: e,
14
14
  search: window.location.search
15
15
  });
@@ -18,19 +18,19 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
18
18
  return fetch("/_feltdb/project", { cache: "no-store" }).then(async (t) => {
19
19
  if (!t.ok) throw Error("No project model endpoint");
20
20
  let n = await t.json();
21
- e && k(H(n.source));
21
+ e && A(H(n.source));
22
22
  }).catch(async () => {
23
23
  let t = s ? await s.collection("_flow_apps").all() : [];
24
- e && t[0]?.spec && k(t[0].spec);
24
+ e && t[0]?.spec && A(t[0].spec);
25
25
  }), () => {
26
26
  e = !1;
27
27
  };
28
28
  }, [s]), P(() => {
29
29
  if (!E?.sessionId) return;
30
30
  let e = !0, t = () => void fetch("/_feltdb/runtime", { cache: "no-store" }).then((e) => e.ok ? e.json() : { runtimes: [] }).then((t) => {
31
- e && q(t.runtimes || []);
31
+ e && J(t.runtimes || []);
32
32
  }).catch(() => {
33
- e && q([]);
33
+ e && J([]);
34
34
  });
35
35
  t();
36
36
  let n = window.setInterval(t, 2e3);
@@ -38,36 +38,36 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
38
38
  e = !1, window.clearInterval(n);
39
39
  };
40
40
  }, [E?.sessionId]), P(() => {
41
- let e = K[0]?.runtimeInstanceId;
41
+ let e = q[0]?.runtimeInstanceId;
42
42
  if (!e) {
43
- Y([]);
43
+ X([]);
44
44
  return;
45
45
  }
46
46
  let t = !0, n = 0, r = () => void fetch(`/_feltdb/observations?runtimeInstanceId=${encodeURIComponent(e)}&cursor=${n}&limit=100`, { cache: "no-store" }).then((e) => e.ok ? e.json() : { observations: [] }).then((e) => {
47
- t && (n = e.nextCursor ?? n, Z(e.dropped || 0), Y((t) => [...t, ...e.observations || []].slice(-200)));
47
+ t && (n = e.nextCursor ?? n, Q(e.dropped || 0), X((t) => [...t, ...e.observations || []].slice(-200)));
48
48
  }).catch(() => void 0);
49
49
  r();
50
50
  let i = window.setInterval(r, 1e3);
51
51
  return () => {
52
52
  t = !1, window.clearInterval(i);
53
53
  };
54
- }, [K[0]?.runtimeInstanceId]), /* @__PURE__ */ B(I, { children: /* @__PURE__ */ V("div", {
54
+ }, [q[0]?.runtimeInstanceId]), /* @__PURE__ */ B(I, { children: /* @__PURE__ */ V("div", {
55
55
  className: "studio-app",
56
56
  children: [/* @__PURE__ */ V("nav", {
57
57
  className: "studio-nav",
58
58
  children: [
59
59
  /* @__PURE__ */ V("div", {
60
60
  className: "nav-header",
61
- children: [/* @__PURE__ */ B("h1", { children: "FeltDB Studio" }), A && /* @__PURE__ */ B("div", {
61
+ children: [/* @__PURE__ */ B("h1", { children: "FeltDB Studio" }), j && /* @__PURE__ */ B("div", {
62
62
  className: "instance-info",
63
- children: A.namespace
63
+ children: j.namespace
64
64
  })]
65
65
  }),
66
66
  /* @__PURE__ */ B("div", {
67
67
  className: "nav-search",
68
68
  children: /* @__PURE__ */ B(d, {
69
69
  db: s,
70
- model: O
70
+ model: k
71
71
  })
72
72
  }),
73
73
  /* @__PURE__ */ V("ul", {
@@ -78,19 +78,19 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
78
78
  children: "Design"
79
79
  }),
80
80
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
81
- to: Q("/"),
81
+ to: $("/"),
82
82
  children: "Application"
83
83
  }) }),
84
84
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
85
- to: Q("/capabilities"),
85
+ to: $("/capabilities"),
86
86
  children: "Capabilities"
87
87
  }) }),
88
88
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
89
- to: Q("/workflows"),
89
+ to: $("/workflows"),
90
90
  children: "Workflows"
91
91
  }) }),
92
92
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
93
- to: Q("/agents"),
93
+ to: $("/agents"),
94
94
  children: "Agents"
95
95
  }) }),
96
96
  /* @__PURE__ */ B("li", {
@@ -98,51 +98,51 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
98
98
  children: "Observe"
99
99
  }),
100
100
  E?.sessionId && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
101
- to: Q("/activity"),
101
+ to: $("/activity"),
102
102
  children: "Live Activity"
103
103
  }) }),
104
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
105
- to: Q("/overview"),
104
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
105
+ to: $("/overview"),
106
106
  children: "Overview"
107
107
  }) }),
108
108
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
109
- to: Q("/data"),
109
+ to: $("/data"),
110
110
  children: "Data"
111
111
  }) }),
112
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
113
- to: Q("/references"),
112
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
113
+ to: $("/references"),
114
114
  children: "References"
115
115
  }) }),
116
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
117
- to: Q("/operations"),
116
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
117
+ to: $("/operations"),
118
118
  children: "Operations"
119
119
  }) }),
120
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
121
- to: Q("/executions"),
120
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
121
+ to: $("/executions"),
122
122
  children: "Executions"
123
123
  }) }),
124
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
125
- to: Q("/peers"),
124
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
125
+ to: $("/peers"),
126
126
  children: "Peers"
127
127
  }) }),
128
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
129
- to: Q("/provenance"),
128
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
129
+ to: $("/provenance"),
130
130
  children: "Provenance"
131
131
  }) }),
132
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
133
- to: Q("/conflicts"),
132
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
133
+ to: $("/conflicts"),
134
134
  children: "Conflicts"
135
135
  }) }),
136
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
137
- to: Q("/health"),
136
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
137
+ to: $("/health"),
138
138
  children: "Health"
139
139
  }) }),
140
140
  /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
141
- to: Q("/settings"),
141
+ to: $("/settings"),
142
142
  children: "Settings"
143
143
  }) }),
144
- G && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
145
- to: Q("/api-keys"),
144
+ K && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(L, {
145
+ to: $("/api-keys"),
146
146
  children: "API Keys"
147
147
  }) })
148
148
  ]
@@ -153,9 +153,9 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
153
153
  children: [
154
154
  E?.sessionId && /* @__PURE__ */ V("div", {
155
155
  className: "runtime-notice",
156
- children: ["Application runtime: ", K.length ? `Connected ✓ (${K[0].runtime}, ${K[0].namespace})` : "Not connected"]
156
+ children: ["Application runtime: ", q.length ? `Connected ✓ (${q[0].runtime}, ${q[0].namespace})` : "Not connected"]
157
157
  }),
158
- !G && /* @__PURE__ */ B("div", {
158
+ !K && /* @__PURE__ */ B("div", {
159
159
  className: "runtime-notice",
160
160
  children: "Browser data is read live from the generated application origin through the local Studio bridge."
161
161
  }),
@@ -165,13 +165,14 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
165
165
  element: /* @__PURE__ */ B(g, {
166
166
  db: s,
167
167
  namespace: C,
168
- projectSpec: O,
169
- onSpecChange: k
168
+ projectSpec: k,
169
+ managedPublish: D,
170
+ onSpecChange: A
170
171
  })
171
172
  }),
172
173
  /* @__PURE__ */ B(R, {
173
174
  path: "/overview",
174
- element: /* @__PURE__ */ B(y, { stats: j })
175
+ element: /* @__PURE__ */ B(y, { stats: M })
175
176
  }),
176
177
  /* @__PURE__ */ B(R, {
177
178
  path: "/activity",
@@ -180,15 +181,15 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
180
181
  children: [
181
182
  /* @__PURE__ */ B("h1", { children: "Live Activity" }),
182
183
  /* @__PURE__ */ V("p", { children: [
183
- J.some((e) => Date.now() - e.timestamp < 5e3) ? "Active" : "Idle",
184
+ Y.some((e) => Date.now() - e.timestamp < 5e3) ? "Active" : "Idle",
184
185
  " · Runtime ",
185
- K[0]?.runtimeInstanceId || "not connected"
186
+ q[0]?.runtimeInstanceId || "not connected"
186
187
  ] }),
187
- X > 0 && /* @__PURE__ */ V("p", {
188
+ Z > 0 && /* @__PURE__ */ V("p", {
188
189
  className: "runtime-notice",
189
190
  children: [
190
191
  "Observation is incomplete: ",
191
- X,
192
+ Z,
192
193
  " events dropped."
193
194
  ]
194
195
  }),
@@ -198,7 +199,7 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
198
199
  /* @__PURE__ */ B("th", { children: "Collection" }),
199
200
  /* @__PURE__ */ B("th", { children: "Status" }),
200
201
  /* @__PURE__ */ B("th", { children: "Duration" })
201
- ] }) }), /* @__PURE__ */ B("tbody", { children: [...J].reverse().map((e) => /* @__PURE__ */ V("tr", { children: [
202
+ ] }) }), /* @__PURE__ */ B("tbody", { children: [...Y].reverse().map((e) => /* @__PURE__ */ V("tr", { children: [
202
203
  /* @__PURE__ */ B("td", { children: new Date(e.timestamp).toLocaleTimeString() }),
203
204
  /* @__PURE__ */ B("td", { children: e.operation?.type }),
204
205
  /* @__PURE__ */ B("td", { children: e.operation?.collection || "—" }),
@@ -212,7 +213,7 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
212
213
  path: "/data",
213
214
  element: /* @__PURE__ */ B(u, {
214
215
  db: s,
215
- model: O,
216
+ model: k,
216
217
  namespace: C,
217
218
  applicationUrl: w === "browser" ? T : "",
218
219
  developmentSession: E
@@ -222,7 +223,7 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
222
223
  path: "/state",
223
224
  element: /* @__PURE__ */ B(u, {
224
225
  db: s,
225
- model: O,
226
+ model: k,
226
227
  namespace: C,
227
228
  applicationUrl: w === "browser" ? T : "",
228
229
  developmentSession: E
@@ -232,7 +233,7 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
232
233
  path: "/references",
233
234
  element: /* @__PURE__ */ B(p, {
234
235
  db: s,
235
- model: O,
236
+ model: k,
236
237
  namespace: C
237
238
  })
238
239
  }),
@@ -240,66 +241,66 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
240
241
  path: "/operations",
241
242
  element: /* @__PURE__ */ B(a, {
242
243
  db: s,
243
- model: O,
244
+ model: k,
244
245
  namespace: C
245
246
  })
246
247
  }),
247
248
  /* @__PURE__ */ B(R, {
248
249
  path: "/peers",
249
250
  element: /* @__PURE__ */ B(i, {
250
- peers: N,
251
- localInstance: A?.instanceId
251
+ peers: U,
252
+ localInstance: j?.instanceId
252
253
  })
253
254
  }),
254
255
  /* @__PURE__ */ B(R, {
255
256
  path: "/capabilities",
256
257
  element: /* @__PURE__ */ B(_, {
257
258
  db: s,
258
- model: O
259
+ model: k
259
260
  })
260
261
  }),
261
262
  /* @__PURE__ */ B(R, {
262
263
  path: "/executions",
263
264
  element: /* @__PURE__ */ B(l, {
264
265
  db: s,
265
- model: O
266
+ model: k
266
267
  })
267
268
  }),
268
269
  /* @__PURE__ */ B(R, {
269
270
  path: "/workflows",
270
271
  element: /* @__PURE__ */ B(h, {
271
272
  db: s,
272
- model: O
273
+ model: k
273
274
  })
274
275
  }),
275
276
  /* @__PURE__ */ B(R, {
276
277
  path: "/agents",
277
278
  element: /* @__PURE__ */ B(f, {
278
279
  db: s,
279
- model: O
280
+ model: k
280
281
  })
281
282
  }),
282
283
  /* @__PURE__ */ B(R, {
283
284
  path: "/provenance",
284
285
  element: /* @__PURE__ */ B(t, {
285
286
  db: s,
286
- model: O,
287
+ model: k,
287
288
  namespace: C,
288
- reference: U
289
+ reference: W
289
290
  })
290
291
  }),
291
292
  /* @__PURE__ */ B(R, {
292
293
  path: "/conflicts",
293
294
  element: /* @__PURE__ */ B(r, {
294
295
  db: s,
295
- diagnostics: M
296
+ diagnostics: N
296
297
  })
297
298
  }),
298
299
  /* @__PURE__ */ B(R, {
299
300
  path: "/health",
300
301
  element: /* @__PURE__ */ B(c, {
301
- diagnostics: M,
302
- model: O
302
+ diagnostics: N,
303
+ model: k
303
304
  })
304
305
  }),
305
306
  /* @__PURE__ */ B(R, {
@@ -308,7 +309,7 @@ function U({ db: s, remoteUrl: b = "", token: S = "", namespace: C = "default",
308
309
  db: s,
309
310
  remoteUrl: b,
310
311
  token: S,
311
- onConnect: D
312
+ onConnect: O
312
313
  })
313
314
  }),
314
315
  /* @__PURE__ */ B(R, {