@devframes/hub-ui 0.9.10 → 0.9.12

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.
@@ -2294,18 +2294,8 @@ function Lr(e, t) {
2294
2294
  proxify: !1
2295
2295
  });
2296
2296
  }
2297
- function Rr() {
2298
- let e, t;
2299
- return {
2300
- promise: new Promise((n, r) => {
2301
- e = n, t = r;
2302
- }),
2303
- resolve: e,
2304
- reject: t
2305
- };
2306
- }
2307
- function zr(e) {
2308
- let { transport: t, authToken: n, connectionMeta: r, events: i, clientRpc: a, rpcOptions: o = {}, callTimeout: s = 0 } = e, c = !1, l = "connecting", u = null, d = Rr();
2297
+ function Rr(e) {
2298
+ let { transport: t, authToken: n, connectionMeta: r, events: i, clientRpc: a, rpcOptions: o = {}, callTimeout: s = 0 } = e, c = !1, l = "connecting", u = null, d = Promise.withResolvers();
2309
2299
  function f(e, t = null) {
2310
2300
  if (t ? u = t : e === "connected" && (u = null), e === l) return;
2311
2301
  let n = l;
@@ -2433,7 +2423,7 @@ function zr(e) {
2433
2423
  }
2434
2424
  };
2435
2425
  }
2436
- function Br(e, t, n) {
2426
+ function zr(e, t, n) {
2437
2427
  let r = (() => {
2438
2428
  try {
2439
2429
  return new URL(t, n.href);
@@ -2451,9 +2441,9 @@ function Br(e, t, n) {
2451
2441
  let i = e ?? "";
2452
2442
  return /^https?:\/\//i.test(i) ? i : new URL(i, r).href;
2453
2443
  }
2454
- function Vr(e) {
2455
- let { authToken: t, connectionMeta: n, metaBaseUrl: r, events: i, clientRpc: a, rpcOptions: o = {}, sseOptions: s = {}, callTimeout: c = 0 } = e, l = Br(n.sse, r ?? "./", location);
2456
- return zr({
2444
+ function Br(e) {
2445
+ let { authToken: t, connectionMeta: n, metaBaseUrl: r, events: i, clientRpc: a, rpcOptions: o = {}, sseOptions: s = {}, callTimeout: c = 0 } = e, l = zr(n.sse, r ?? "./", location);
2446
+ return Rr({
2457
2447
  transport: "sse",
2458
2448
  authToken: t,
2459
2449
  connectionMeta: n,
@@ -2478,44 +2468,44 @@ function Vr(e) {
2478
2468
  })
2479
2469
  });
2480
2470
  }
2481
- function Hr(e) {
2482
- let { name: t, message: n, cause: r, ...i } = e, a = r instanceof Error ? r : Ur(r) ? Hr(r) : r, o = a === void 0 ? Error(n) : Error(n, { cause: a });
2471
+ function Vr(e) {
2472
+ let { name: t, message: n, cause: r, ...i } = e, a = r instanceof Error ? r : Hr(r) ? Vr(r) : r, o = a === void 0 ? Error(n) : Error(n, { cause: a });
2483
2473
  return o.name = t, Object.assign(o, i), o;
2484
2474
  }
2485
- function Ur(e) {
2475
+ function Hr(e) {
2486
2476
  return typeof e == "object" && !!e && typeof e.message == "string" && typeof e.name == "string";
2487
2477
  }
2488
- function Wr(e) {
2478
+ function Ur(e) {
2489
2479
  return typeof e == "object" && !!e && e.type === "static" && typeof e.path == "string";
2490
2480
  }
2491
- function Gr(e) {
2481
+ function Wr(e) {
2492
2482
  return typeof e == "object" && !!e && e.type === "query" && typeof e.records == "object" && e.records !== null;
2493
2483
  }
2494
- function Kr(e) {
2484
+ function Gr(e) {
2495
2485
  return typeof e == "object" && !!e && ("output" in e || "error" in e);
2496
2486
  }
2497
- function qr(e) {
2498
- if (e.error) throw Hr(e.error);
2487
+ function Kr(e) {
2488
+ if (e.error) throw Vr(e.error);
2499
2489
  return e.output;
2500
2490
  }
2501
- function Jr(e) {
2491
+ function qr(e) {
2502
2492
  return e.some((e) => e != null);
2503
2493
  }
2504
- function Yr(e) {
2494
+ function Jr(e) {
2505
2495
  return typeof e == "object" && e && "serialization" in e && "data" in e ? e.data : e;
2506
2496
  }
2507
- function Xr(e, t) {
2497
+ function Yr(e, t) {
2508
2498
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
2509
2499
  function i(e, t) {
2510
2500
  return t === "structured-clone" && Array.isArray(e) ? yn(e) : e;
2511
2501
  }
2512
2502
  function a(e, t) {
2513
- return i(Yr(e), t);
2503
+ return i(Jr(e), t);
2514
2504
  }
2515
2505
  async function o(e) {
2516
2506
  n.has(e.path) || n.set(e.path, t(e.path).then((t) => a(t, e.serialization)));
2517
2507
  let r = await n.get(e.path);
2518
- return Kr(r) ? qr(r) : r;
2508
+ return Gr(r) ? Kr(r) : r;
2519
2509
  }
2520
2510
  async function s(e, n) {
2521
2511
  return r.has(e) || r.set(e, t(e).then((e) => a(e, n))), await r.get(e);
@@ -2523,17 +2513,17 @@ function Xr(e, t) {
2523
2513
  async function c(t, n) {
2524
2514
  if (!(t in e)) throw Error(`[devframe-rpc] Function "${t}" not found in dump store`);
2525
2515
  let r = e[t];
2526
- if (Wr(r)) {
2527
- if (Jr(n)) throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);
2516
+ if (Ur(r)) {
2517
+ if (qr(n)) throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);
2528
2518
  return await o(r);
2529
2519
  }
2530
- if (Gr(r)) {
2520
+ if (Wr(r)) {
2531
2521
  let e = fe(n), i = r.records[e];
2532
- if (i) return qr(await s(i, r.serialization));
2533
- if (r.fallback) return qr(await s(r.fallback, r.serialization));
2522
+ if (i) return Kr(await s(i, r.serialization));
2523
+ if (r.fallback) return Kr(await s(r.fallback, r.serialization));
2534
2524
  throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);
2535
2525
  }
2536
- if (!Jr(n)) return r;
2526
+ if (!qr(n)) return r;
2537
2527
  throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);
2538
2528
  }
2539
2529
  return {
@@ -2544,8 +2534,8 @@ function Xr(e, t) {
2544
2534
  callEvent: async (e, t) => {}
2545
2535
  };
2546
2536
  }
2547
- async function Zr(e) {
2548
- let t = Xr(await e.fetchJsonFromBases(mi), e.fetchJsonFromBases);
2537
+ async function Xr(e) {
2538
+ let t = Yr(await e.fetchJsonFromBases(mi), e.fetchJsonFromBases);
2549
2539
  return {
2550
2540
  transport: "static",
2551
2541
  isTrusted: !0,
@@ -2561,29 +2551,29 @@ async function Zr(e) {
2561
2551
  close: () => {}
2562
2552
  };
2563
2553
  }
2564
- function Qr(e, t) {
2554
+ function Zr(e, t) {
2565
2555
  return `${e}${Ei}${t}`;
2566
2556
  }
2567
- function $r(e) {
2557
+ function Qr(e) {
2568
2558
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2569
2559
  e.client.register({
2570
2560
  name: C.broadcast.streamingChunk,
2571
2561
  type: "event",
2572
2562
  handler(e, n, r, i) {
2573
- t.get(Qr(e, n))?._push(r, i);
2563
+ t.get(Zr(e, n))?._push(r, i);
2574
2564
  }
2575
2565
  }), e.client.register({
2576
2566
  name: C.broadcast.streamingEnd,
2577
2567
  type: "event",
2578
2568
  handler(e, n, r) {
2579
- let i = Qr(e, n), a = t.get(i);
2569
+ let i = Zr(e, n), a = t.get(i);
2580
2570
  a && (a._end(r), t.delete(i));
2581
2571
  }
2582
2572
  }), e.client.register({
2583
2573
  name: C.broadcast.streamingUploadCancel,
2584
2574
  type: "event",
2585
2575
  handler(e, t) {
2586
- let r = Qr(e, t), i = n.get(r);
2576
+ let r = Zr(e, t), i = n.get(r);
2587
2577
  i && (i.abort("server cancelled upload"), n.delete(r));
2588
2578
  }
2589
2579
  }), e.events.on(C.client.isTrustedUpdated, (n) => {
@@ -2596,7 +2586,7 @@ function $r(e) {
2596
2586
  }
2597
2587
  });
2598
2588
  function r(n, r, i = {}) {
2599
- let a = Qr(n, r), o = t.get(a);
2589
+ let a = Zr(n, r), o = t.get(a);
2600
2590
  if (o) return o;
2601
2591
  let s = Nn({
2602
2592
  id: r,
@@ -2617,7 +2607,7 @@ function $r(e) {
2617
2607
  return s;
2618
2608
  }
2619
2609
  function i(t, r) {
2620
- let i = Qr(t, r), a = n.get(i);
2610
+ let i = Zr(t, r), a = n.get(i);
2621
2611
  if (a) return a;
2622
2612
  let o = Mn({ id: r });
2623
2613
  return o.events.on("chunk", (n, i) => {
@@ -2631,11 +2621,11 @@ function $r(e) {
2631
2621
  upload: i
2632
2622
  };
2633
2623
  }
2634
- function ei() {}
2635
- function ti(e) {
2624
+ function $r() {}
2625
+ function ei(e) {
2636
2626
  let t = e.url;
2637
2627
  e.authToken && (t = `${t}?${_i}=${encodeURIComponent(e.authToken)}`);
2638
- let n = new WebSocket(t), { onConnected: r = ei, onError: i = ei, onDisconnected: a = ei, definitions: o = Di } = e;
2628
+ let n = new WebSocket(t), { onConnected: r = $r, onError: i = $r, onDisconnected: a = $r, definitions: o = Di } = e;
2639
2629
  n.addEventListener("open", (e) => {
2640
2630
  r(e);
2641
2631
  }), n.addEventListener("error", (e) => {
@@ -2675,7 +2665,7 @@ function ti(e) {
2675
2665
  deserialize: s.deserialize
2676
2666
  };
2677
2667
  }
2678
- function ni(e, t, n) {
2668
+ function ti(e, t, n) {
2679
2669
  let r = (() => {
2680
2670
  try {
2681
2671
  return new URL(t, n.href);
@@ -2698,9 +2688,9 @@ function ni(e, t, n) {
2698
2688
  let o = new URL(a, r);
2699
2689
  return o.protocol = i, o.href;
2700
2690
  }
2701
- function ri(e) {
2702
- let { authToken: t, connectionMeta: n, metaBaseUrl: r, events: i, clientRpc: a, rpcOptions: o = {}, wsOptions: s = {}, callTimeout: c = 0 } = e, l = ni(n.websocket, r ?? "./", location);
2703
- return zr({
2691
+ function ni(e) {
2692
+ let { authToken: t, connectionMeta: n, metaBaseUrl: r, events: i, clientRpc: a, rpcOptions: o = {}, wsOptions: s = {}, callTimeout: c = 0 } = e, l = ti(n.websocket, r ?? "./", location);
2693
+ return Rr({
2704
2694
  transport: "websocket",
2705
2695
  authToken: t,
2706
2696
  connectionMeta: n,
@@ -2708,7 +2698,7 @@ function ri(e) {
2708
2698
  clientRpc: a,
2709
2699
  rpcOptions: o,
2710
2700
  callTimeout: c,
2711
- createChannel: (e) => ti({
2701
+ createChannel: (e) => ei({
2712
2702
  url: l,
2713
2703
  authToken: t,
2714
2704
  definitions: e.definitions,
@@ -2725,39 +2715,42 @@ function ri(e) {
2725
2715
  })
2726
2716
  });
2727
2717
  }
2728
- function ii(e) {
2718
+ function ri(e) {
2729
2719
  return e.includes(":");
2730
2720
  }
2731
- function ai(e, t) {
2732
- return ii(t) ? t : `${e}:${t}`;
2721
+ function ii(e, t) {
2722
+ return ri(t) ? t : `${e}:${t}`;
2733
2723
  }
2734
- function oi(e, t, n) {
2735
- let r = `devframe:settings:${n}:${t}`, i;
2736
- function a() {
2737
- return i ||= e.sharedState.get(r, { initialValue: {} }), i;
2738
- }
2724
+ function ai(e) {
2739
2725
  return {
2740
- async get(e) {
2741
- return (await a()).value()[e];
2726
+ async get(t) {
2727
+ return (await e()).value()[t];
2742
2728
  },
2743
- async set(e, t) {
2744
- (await a()).mutate((n) => {
2745
- n[e] = t;
2729
+ async set(t, n) {
2730
+ (await e()).mutate((e) => {
2731
+ e[t] = n;
2746
2732
  });
2747
2733
  },
2748
- async delete(e) {
2749
- (await a()).mutate((t) => {
2750
- delete t[e];
2734
+ async delete(t) {
2735
+ (await e()).mutate((e) => {
2736
+ delete e[t];
2751
2737
  });
2752
2738
  },
2753
2739
  async all() {
2754
- return (await a()).value();
2740
+ return (await e()).value();
2755
2741
  },
2756
- async onChange(e) {
2757
- return (await a()).on("updated", (t) => e(t));
2742
+ async onChange(t) {
2743
+ return (await e()).on("updated", (e) => t(e));
2758
2744
  }
2759
2745
  };
2760
2746
  }
2747
+ function oi(e, t, n) {
2748
+ let r = `devframe:settings:${n}:${t}`, i;
2749
+ function a() {
2750
+ return i ||= e.sharedState.get(r, { initialValue: {} }), i;
2751
+ }
2752
+ return ai(a);
2753
+ }
2761
2754
  function si(e, t) {
2762
2755
  return {
2763
2756
  global: oi(e, t, "global"),
@@ -2771,19 +2764,19 @@ function ci(e, t) {
2771
2764
  rpc: {
2772
2765
  namespace: t,
2773
2766
  register(n) {
2774
- if (ii(n.name)) throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);
2767
+ if (ri(n.name)) throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);
2775
2768
  e.client.register({
2776
2769
  ...n,
2777
2770
  name: `${t}:${n.name}`
2778
2771
  });
2779
2772
  },
2780
- call: ((n, ...r) => e.call(ai(t, n), ...r)),
2781
- callEvent: ((n, ...r) => e.callEvent(ai(t, n), ...r)),
2782
- callOptional: ((n, ...r) => e.callOptional(ai(t, n), ...r)),
2783
- sharedState: ((n, r) => e.sharedState.get(ai(t, n), r)),
2773
+ call: ((n, ...r) => e.call(ii(t, n), ...r)),
2774
+ callEvent: ((n, ...r) => e.callEvent(ii(t, n), ...r)),
2775
+ callOptional: ((n, ...r) => e.callOptional(ii(t, n), ...r)),
2776
+ sharedState: ((n, r) => e.sharedState.get(ii(t, n), r)),
2784
2777
  streaming: {
2785
- subscribe: (n, r, i) => e.streaming.subscribe(ai(t, n), r, i),
2786
- upload: (n, r) => e.streaming.upload(ai(t, n), r)
2778
+ subscribe: (n, r, i) => e.streaming.subscribe(ii(t, n), r, i),
2779
+ upload: (n, r) => e.streaming.upload(ii(t, n), r)
2787
2780
  }
2788
2781
  },
2789
2782
  settings: si(e, t),
@@ -2844,10 +2837,10 @@ async function ui(e = {}) {
2844
2837
  } else await t(e);
2845
2838
  }
2846
2839
  }
2847
- }, _ = li(e.transport ?? "auto", c), v = _ === "static" ? await Zr({ fetchJsonFromBases: h }) : _ === "sse" ? Vr({
2840
+ }, _ = li(e.transport ?? "auto", c), v = _ === "static" ? await Xr({ fetchJsonFromBases: h }) : _ === "sse" ? Br({
2848
2841
  ...g,
2849
2842
  sseOptions: e.sseOptions
2850
- }) : ri({
2843
+ }) : ni({
2851
2844
  ...g,
2852
2845
  wsOptions: e.wsOptions
2853
2846
  }), y;
@@ -2908,7 +2901,7 @@ async function ui(e = {}) {
2908
2901
  scope: void 0,
2909
2902
  close: () => v.close?.()
2910
2903
  };
2911
- C.sharedState = jr(C), C.streaming = $r(C), C.services = Ar(C);
2904
+ C.sharedState = jr(C), C.streaming = Qr(C), C.services = Ar(C);
2912
2905
  let w = /* @__PURE__ */ new Map();
2913
2906
  C.scope = ((e) => {
2914
2907
  if (!e) return C;
@@ -16325,8 +16318,7 @@ async function KA(e, t, n, r, i = /* @__PURE__ */ F(!0)) {
16325
16318
  await HA(e, /* @__PURE__ */ vo({
16326
16319
  .../* @__PURE__ */ Mo(D),
16327
16320
  current: S.get(e.id),
16328
- messages: n,
16329
- logs: n
16321
+ messages: n
16330
16322
  }));
16331
16323
  }, le = (e) => {
16332
16324
  e.type === "iframe" && e.frameId && !e.subTabs && oe.set(e.frameId, e.id), e.type !== "action" && e.groupId && ((r.value.groupLastChildIds ??= {})[e.groupId] = e.id), e.type !== "iframe" && (r.value.selectedDockRoute = null);
@@ -17271,7 +17263,7 @@ var nj, rj = t((() => {
17271
17263
  ref: o,
17272
17264
  class: "absolute inset-0 pointer-events-none"
17273
17265
  }, null, 512)])])], 2), [[vf, f.value]]),
17274
- W("div", { class: k(["absolute inset-0 flex items-center justify-center transition-opacity duration-300", _.value ? "opacity-100" : "opacity-0 pointer-events-none"]) }, [q(py, { class: k(["w-4 h-4", c.value ? "rotate-270" : "rotate-0"]) }, null, 8, ["class"])], 2)
17266
+ W("div", { class: k(["absolute inset-0 flex items-center justify-center transition-opacity duration-300", _.value ? "opacity-100" : "opacity-0 pointer-events-none"]) }, [q(py, { class: "w-4 h-4" })], 2)
17275
17267
  ], 38), ne.value ? (V(), H("div", {
17276
17268
  key: 0,
17277
17269
  class: "fixed pointer-events-none z-floating-anchor bg-primary/15",