react-semaphor 0.1.172 → 0.1.173

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.
Files changed (29) hide show
  1. package/dist/chunks/{dashboard-controls-DA-lJWSK.js → dashboard-controls-B6WiXn_t.js} +4 -4
  2. package/dist/chunks/{dashboard-controls-BuKUWOU1.js → dashboard-controls-ByOgk4Je.js} +1 -1
  3. package/dist/chunks/{dashboard-json-CUTAJhWz.js → dashboard-json--V83knyP.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BTWzsbui.js → dashboard-json-BhyQb37-.js} +1 -1
  5. package/dist/chunks/{edit-dashboard-visual-BEWMIe7g.js → edit-dashboard-visual-BBlXAIn6.js} +4632 -4607
  6. package/dist/chunks/{edit-dashboard-visual-_uEu62dm.js → edit-dashboard-visual-Cvaa7yWQ.js} +35 -35
  7. package/dist/chunks/{editor-action-buttons-C5Ejuo4M.js → editor-action-buttons-CY7ioULi.js} +2 -2
  8. package/dist/chunks/{editor-action-buttons-WGWavDMB.js → editor-action-buttons-FLYhmv28.js} +1 -1
  9. package/dist/chunks/{index-DMR0K1Nf.js → index-B9kLqSMl.js} +73 -73
  10. package/dist/chunks/{index-C8T45uat.js → index-CkciFx-7.js} +2318 -2262
  11. package/dist/chunks/{resource-management-panel-BKAs9Em0.js → resource-management-panel-DzIeyziH.js} +3 -3
  12. package/dist/chunks/{resource-management-panel-DFC27hgo.js → resource-management-panel-NzY4o_yO.js} +1 -1
  13. package/dist/chunks/{schedule-dashboard-DC7XeEaW.js → schedule-dashboard-CWqTX2_E.js} +2 -2
  14. package/dist/chunks/{schedule-dashboard-r_XMtRaW.js → schedule-dashboard-D6bnu51y.js} +38 -38
  15. package/dist/chunks/{use-role-aware-display-preferences-CAbBsXoz.js → use-role-aware-display-preferences-CHeIMGXz.js} +1 -1
  16. package/dist/chunks/{use-role-aware-display-preferences-BOpxNd8x.js → use-role-aware-display-preferences-vNHoh1Xk.js} +1 -1
  17. package/dist/chunks/use-visual-utils-BswYPLMe.js +1 -0
  18. package/dist/chunks/use-visual-utils-CK6cVt23.js +338 -0
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/style.css +1 -1
  24. package/dist/surfboard/index.cjs +1 -1
  25. package/dist/surfboard/index.js +1 -1
  26. package/dist/types/main.d.ts +36 -0
  27. package/package.json +1 -1
  28. package/dist/chunks/use-visual-utils-BJxotk2m.js +0 -331
  29. package/dist/chunks/use-visual-utils-DG7j82aL.js +0 -1
@@ -0,0 +1,338 @@
1
+ import { az as G, aA as Y, p as J, q as K, aB as X, m as z, o as Z, u as v, aC as q, aD as ee, t as V, aE as te, n as f } from "./index-CkciFx-7.js";
2
+ import { useState as T, useEffect as re, useCallback as A } from "react";
3
+ function se(e) {
4
+ const o = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), n = e.toUpperCase().indexOf("ORDER BY");
5
+ let i = e.length;
6
+ if (n !== -1 && (i = n), r !== -1 && r < i && (i = r), o !== -1) {
7
+ const c = e.substring(0, o), s = e.substring(o);
8
+ return `${c} {{ filters | where }} AND ${s.substring(
9
+ 6
10
+ )}`;
11
+ } else if (t !== -1) {
12
+ const c = e.substring(0, t), s = e.substring(t);
13
+ return `${c} {{ filters | where }} ${s}`;
14
+ } else {
15
+ const c = e.substring(0, i), s = e.substring(i);
16
+ return console.log("beforeClause", c), console.log("afterClause", s), s ? `${c} {{ filters | where }} ${s}` : `${c.replace(/;$/, "")} {{ filters | where }}`;
17
+ }
18
+ }
19
+ function oe(e) {
20
+ const [o, t] = T(null), [r, n] = T(null), i = G();
21
+ return re(() => {
22
+ if (!e || e.trim() === "") {
23
+ t(null), n(null);
24
+ return;
25
+ }
26
+ if (!i)
27
+ return;
28
+ (async () => {
29
+ try {
30
+ if (!e.startsWith("http://") && !e.startsWith("https://"))
31
+ throw new Error(`Invalid URL format: ${e}`);
32
+ try {
33
+ new URL(e);
34
+ } catch {
35
+ throw new Error(`Invalid URL: ${e}`);
36
+ }
37
+ const d = `${e.endsWith("/") ? e : `${e}/`}index.js`;
38
+ try {
39
+ if (!(await fetch(d, { method: "HEAD" })).ok)
40
+ throw new Error(`Module not found at ${d}`);
41
+ } catch {
42
+ }
43
+ const m = await import(
44
+ /* @vite-ignore */
45
+ /* webpackIgnore: true */
46
+ d
47
+ );
48
+ if (typeof m.useChartStore != "function")
49
+ throw new Error("useChartStore is not a function");
50
+ t(() => m.useChartStore), n(null);
51
+ } catch (s) {
52
+ const d = s instanceof Error ? s.message : "Unknown error";
53
+ console.error("Failed to load remote chart store:", d), n(d), t(null);
54
+ }
55
+ })();
56
+ }, [e, i]), o;
57
+ }
58
+ function ae(e, o) {
59
+ if (e.length === 0)
60
+ return "";
61
+ if (o) {
62
+ const t = e.find((r) => r.id === o);
63
+ if (t) {
64
+ const r = t.tabTitle;
65
+ if (r == "All__Header")
66
+ return e[0].id;
67
+ if (r && r.endsWith("__Header")) {
68
+ const i = r.split("__")[0], c = e.find(
69
+ (s) => s.tabTitle === i
70
+ );
71
+ return c ? c.id : e[0].id;
72
+ }
73
+ return o;
74
+ }
75
+ }
76
+ return e[0].id;
77
+ }
78
+ async function _(e, o, t, r) {
79
+ if (!o || !t)
80
+ throw new Error("Missing auth token or visual ID");
81
+ const n = ["resource-by-id", "visual", t], i = r.getQueryData(n);
82
+ if (i)
83
+ return console.log("Using cached visual data for:", t), { data: i, fromCache: !0 };
84
+ console.log("Fetching visual data from network for:", t);
85
+ const c = V.loading("Loading visual...", {
86
+ position: "top-center"
87
+ });
88
+ try {
89
+ const s = await fetch(
90
+ `${e}/management/v1/visuals/${t}`,
91
+ {
92
+ headers: {
93
+ Authorization: `Bearer ${o}`
94
+ }
95
+ }
96
+ );
97
+ if (!s.ok)
98
+ throw new Error("Failed to load visual");
99
+ const d = await s.json();
100
+ return r.setQueryData(n, d), V.dismiss(c), { data: d, fromCache: !1 };
101
+ } catch (s) {
102
+ throw V.dismiss(c), s;
103
+ }
104
+ }
105
+ function H(e) {
106
+ if (typeof e == "string")
107
+ return JSON.parse(e);
108
+ if (typeof e == "object")
109
+ return e;
110
+ throw new Error("Invalid frame object format");
111
+ }
112
+ function ne(e, o) {
113
+ var i, c;
114
+ const t = (e == null ? void 0 : e.frameObject) ?? ((i = e == null ? void 0 : e.visual) == null ? void 0 : i.frameObject);
115
+ if (!t)
116
+ return !1;
117
+ const r = H(t);
118
+ if (!(r != null && r.cards) || r.cards.length === 0)
119
+ return !1;
120
+ const n = (c = r.cards) == null ? void 0 : c.find(
121
+ (s) => s.id === r.activeCardId
122
+ );
123
+ return n ? (te({
124
+ ...o,
125
+ frame: r,
126
+ card: n,
127
+ visualId: (e == null ? void 0 : e.id) || r.visualId
128
+ }), !0) : !1;
129
+ }
130
+ function ce() {
131
+ var S;
132
+ const { setCardSql: e } = z(), o = f((a) => a.frame), t = f((a) => a.card), r = f((a) => a.isDevMode), n = oe(
133
+ ((S = t.customCardPreferences) == null ? void 0 : S.url) || ""
134
+ ), i = f(
135
+ (a) => a.selectedSchemaName
136
+ ), c = f(
137
+ (a) => a.selectedDatamodelId
138
+ ), s = f(
139
+ (a) => a.selectedDatabaseName
140
+ ), d = f((a) => a.selectedTableName), m = f(
141
+ (a) => a.selectedConnectionId
142
+ ), h = f((a) => a.isShowingVisual), p = t.sql;
143
+ return { getUpdatedFrame: A(() => {
144
+ var I;
145
+ let a = p;
146
+ p && !p.includes("{{") && (a = se(p), e(a));
147
+ const w = (I = n == null ? void 0 : n.getState()) == null ? void 0 : I.settings, U = {
148
+ ...t,
149
+ dataSource: t.dataSource || { mode: "directSource" },
150
+ lastSelectedSchema: i,
151
+ lastSelectedDatamodelId: c,
152
+ lastSelectedDatabase: s,
153
+ lastSelectedTable: d,
154
+ connectionId: m,
155
+ // Only save sql/python if in dev mode
156
+ sql: r ? a : void 0,
157
+ python: r ? t.python : void 0,
158
+ // Only save config if in standard mode
159
+ config: r ? void 0 : t.config,
160
+ customCfg: h ? t.customCfg : null,
161
+ preferences: t.preferences,
162
+ // Preserve all preferences including column sizing
163
+ ...w && {
164
+ customCardPreferences: {
165
+ ...t.customCardPreferences,
166
+ settings: w
167
+ }
168
+ }
169
+ }, C = o.cards.map(
170
+ (g) => g.id === t.id ? U : g
171
+ );
172
+ return {
173
+ ...o,
174
+ cards: C,
175
+ activeCardId: ae(C, o.activeCardId)
176
+ };
177
+ }, [
178
+ t,
179
+ o,
180
+ r,
181
+ h,
182
+ i,
183
+ c,
184
+ s,
185
+ d,
186
+ m,
187
+ e,
188
+ n,
189
+ p
190
+ ]) };
191
+ }
192
+ function le() {
193
+ const { authToken: e, tokenProps: o } = Y(), t = J(), r = K(), { selectVisual: n } = X(), {
194
+ setFrame: i,
195
+ setCard: c,
196
+ setIsDevMode: s,
197
+ initializeModeDrafts: d,
198
+ setActiveTabCardId: m,
199
+ updateDataSource: h,
200
+ setQueryResultColumns: p,
201
+ setSelectedConnectionId: $,
202
+ setSelectedDatabaseName: S,
203
+ setSelectedSchemaName: a,
204
+ setSelectedTableName: w,
205
+ setSelectedDatamodelId: U,
206
+ setFilterValues: C,
207
+ setApplyFilters: I
208
+ } = z(), {
209
+ setIsDashboardEditing: g,
210
+ setIsVisualEditing: D,
211
+ setSelectedFrameId: N,
212
+ clearSelectedFrameId: O,
213
+ addFrame: x,
214
+ setIsDashboardPanelOpen: R
215
+ } = Z(), y = v((l) => l.selectedSheetId), W = v((l) => l.selectedFrameId), M = v((l) => l.dashboard), B = v((l) => l.filterValues), E = q((r == null ? void 0 : r.id) || "", {
216
+ enabled: !!(r != null && r.id) && !!(e != null && e.accessToken)
217
+ }), Q = A(
218
+ async (l) => {
219
+ try {
220
+ n(l), O();
221
+ const { data: b, fromCache: u } = await _(
222
+ o.apiServiceUrl,
223
+ (e == null ? void 0 : e.accessToken) || "",
224
+ l.id,
225
+ t
226
+ );
227
+ if (!ne(b, {
228
+ setFrame: i,
229
+ setCard: c,
230
+ setIsDevMode: s,
231
+ initializeModeDrafts: d,
232
+ setActiveTabCardId: m,
233
+ updateDataSource: h,
234
+ setQueryResultColumns: p,
235
+ setSelectedConnectionId: $,
236
+ setSelectedDatabaseName: S,
237
+ setSelectedSchemaName: a,
238
+ setSelectedTableName: w,
239
+ setSelectedDatamodelId: U,
240
+ setFilterValues: C,
241
+ setApplyFilters: I,
242
+ setIsDashboardEditing: g,
243
+ setIsVisualEditing: D,
244
+ dashboard: M,
245
+ selectedSheetId: y,
246
+ selectedFrameId: W,
247
+ filterValues: B
248
+ }))
249
+ throw new Error("Failed to setup editor with visual data");
250
+ return { success: !0, fromCache: u };
251
+ } catch (b) {
252
+ return console.error("Error editing visual:", b), { success: !1, error: "Failed to load visual for editing" };
253
+ }
254
+ },
255
+ [
256
+ e == null ? void 0 : e.accessToken,
257
+ o.apiServiceUrl,
258
+ t,
259
+ n,
260
+ i,
261
+ c,
262
+ g,
263
+ D,
264
+ s,
265
+ d,
266
+ m,
267
+ h,
268
+ p,
269
+ $,
270
+ S,
271
+ a,
272
+ w,
273
+ U,
274
+ C,
275
+ I,
276
+ O,
277
+ M,
278
+ y,
279
+ W,
280
+ B
281
+ ]
282
+ ), k = A(
283
+ async (l) => {
284
+ var b;
285
+ try {
286
+ if (n(l), !y)
287
+ return {
288
+ success: !1,
289
+ error: "No sheet selected. Please select a sheet first."
290
+ };
291
+ const { data: u, fromCache: L } = await _(
292
+ o.apiServiceUrl,
293
+ (e == null ? void 0 : e.accessToken) || "",
294
+ l.id,
295
+ t
296
+ ), P = (u == null ? void 0 : u.frameObject) ?? ((b = u == null ? void 0 : u.visual) == null ? void 0 : b.frameObject);
297
+ if (!P)
298
+ return { success: !1, error: "Visual has no frame data" };
299
+ const F = H(P);
300
+ if (!(F != null && F.cards) || F.cards.length === 0)
301
+ return { success: !1, error: "Visual frame is malformed" };
302
+ const j = {
303
+ ...ee(F),
304
+ visualId: l.id
305
+ // Link this frame to the library visual
306
+ };
307
+ return x(y, j, "end"), g(!0), N(j.id), R(!1), { success: !0, fromCache: L };
308
+ } catch (u) {
309
+ return console.error("Error adding visual:", u), { success: !1, error: "Failed to add visual to dashboard" };
310
+ }
311
+ },
312
+ [
313
+ e == null ? void 0 : e.accessToken,
314
+ o.apiServiceUrl,
315
+ t,
316
+ n,
317
+ y,
318
+ x,
319
+ g,
320
+ N,
321
+ R
322
+ ]
323
+ );
324
+ return {
325
+ visual: E.data,
326
+ isLoading: E.isLoading,
327
+ isError: E.isError,
328
+ error: E.error,
329
+ handleEditLibraryVisual: Q,
330
+ handleAddLibraryVisual: k,
331
+ getUpdatedFrame: ce().getUpdatedFrame,
332
+ refetch: E.refetch
333
+ };
334
+ }
335
+ export {
336
+ le as a,
337
+ oe as u
338
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DMR0K1Nf.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-B9kLqSMl.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-C8T45uat.js";
1
+ import { D as a } from "../chunks/index-CkciFx-7.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DMR0K1Nf.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-DFC27hgo.js"),h=require("./chunks/schedule-dashboard-DC7XeEaW.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-B9kLqSMl.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-NzY4o_yO.js"),h=require("./chunks/schedule-dashboard-CWqTX2_E.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-C8T45uat.js";
2
- import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-C8T45uat.js";
1
+ import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-CkciFx-7.js";
2
+ import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-CkciFx-7.js";
3
3
  import { EMPTY_SELECTION as oe } from "./types/index.js";
4
4
  import { jsx as a, jsxs as i } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
6
  import { useMemo as K, useEffect as Y } from "react";
7
- import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-BKAs9Em0.js";
8
- import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-r_XMtRaW.js";
7
+ import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-DzIeyziH.js";
8
+ import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-D6bnu51y.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC