@trilogy-data/trilogy-studio-components 0.1.20 → 0.1.21
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/{AssetAutoImporter-9QMzD3ho.js → AssetAutoImporter-IfDvXCFE.js} +5 -5
- package/dist/{ChatCreatorModal-CpkL5ah4.js → ChatCreatorModal-BG6DyTV3.js} +2 -2
- package/dist/{CodeBlock-CDWXUAiQ.js → CodeBlock-Br-z9kG9.js} +1 -1
- package/dist/{CommunityModels-Dk7uEXRw.js → CommunityModels-DlK6gSx6.js} +7 -7
- package/dist/{ConfirmDialog-tNLC5CUN.js → ConfirmDialog-CYTEamQQ.js} +2 -2
- package/dist/{ConnectionView-DQTOod_j.js → ConnectionView-B_qlbq8s.js} +7 -7
- package/dist/{CreateEditorFromDatasourcePopup-D5mwCk5D.js → CreateEditorFromDatasourcePopup-bSSd8xci.js} +4 -4
- package/dist/{Dashboard-BcCVnVqI.js → Dashboard-BN0T29JU.js} +1384 -1295
- package/dist/{DashboardCreatorInline-C2ShZBai.js → DashboardCreatorInline-CPrHcaZC.js} +3 -3
- package/dist/{DashboardImportSelector-YRySr7k3.js → DashboardImportSelector-8mxsOld1.js} +1 -1
- package/dist/{DashboardMobile-CKaqqZkb.js → DashboardMobile-BFcFiWhG.js} +4 -4
- package/dist/{DataTable-Bf7xeKSf.js → DataTable-CcALeEBZ.js} +2 -2
- package/dist/{DrilldownPane-iReKVNZE.js → DrilldownPane-oN6u9FSj.js} +6110 -6053
- package/dist/{Editor-DUQhJCtJ.js → Editor-BRnH6Fhm.js} +7 -7
- package/dist/{EditorCreatorInline-D9h8RNE8.js → EditorCreatorInline-BDWVUdax.js} +2 -2
- package/dist/{ErrorMessage-QW4GXCEn.js → ErrorMessage-BcAwiBgc.js} +1 -1
- package/dist/{HintComponent-B1B6qtaG.js → HintComponent-BZ7QT0Cf.js} +1 -1
- package/dist/{IDE-nbO1W7BN.js → IDE-BYphurDi.js} +10 -10
- package/dist/{JobsView-BRgAiTvy.js → JobsView-Bzv-qCJD.js} +4 -4
- package/dist/{LLMChat-B5WBKFfx.js → LLMChat-DUReWNVL.js} +9 -9
- package/dist/{LLMConnectionList-JatTlgKd.js → LLMConnectionList-CS8b_fyI.js} +9 -9
- package/dist/{LLMView-BTq1yptw.js → LLMView-D031rgKZ.js} +8 -8
- package/dist/{LoadingButton--jhQCgPi.js → LoadingButton-3lCHccOe.js} +2 -2
- package/dist/{LoadingView-DXMQWonY.js → LoadingView-CCvQjQXB.js} +1 -1
- package/dist/{MarkdownRenderer-cdaHKql1.js → MarkdownRenderer-ToJ3ndVO.js} +3 -3
- package/dist/{MobileIDE-BFZxnpvD.js → MobileIDE-YK0ZzWHh.js} +17 -17
- package/dist/{ModalDialog-D-yprLG4.js → ModalDialog-DUjJI7a8.js} +1 -1
- package/dist/{ModelCard-BdSi4Tb5.js → ModelCard-DqfChNPX.js} +6 -6
- package/dist/{ModelCreator-BPfMWQL3.js → ModelCreator-DM1J950f.js} +4 -4
- package/dist/{ModelView-CsaxXoLJ.js → ModelView--DBf6oe2.js} +6 -6
- package/dist/{ResultComponent-DSRcNmRC.js → ResultComponent-DPeHR38g.js} +5 -5
- package/dist/{Sidebar-BKacsmb3.js → Sidebar-Dq-6dIQq.js} +11 -11
- package/dist/{StatusIcon-ytnp_iom.js → StatusIcon-BRguDu_P.js} +2 -2
- package/dist/{StoreTokenModal-CyPiGrhJ.js → StoreTokenModal-B379wQ3M.js} +2 -2
- package/dist/{SymbolsPane-CZaqqs5e.js → SymbolsPane-BrwZzMNn.js} +1 -1
- package/dist/{Tooltip-CDt1VNAs.js → Tooltip-Du2RDSUJ.js} +2 -2
- package/dist/{TrilogyEmbedProvider-scDWYeoJ.js → TrilogyEmbedProvider-SmcmJEz6.js} +1 -1
- package/dist/{TutorialPage-ZSgVaEzU.js → TutorialPage-A-44DRyk.js} +12 -12
- package/dist/{UserProfile-BNx75xfc.js → UserProfile-DmDQyEIc.js} +4 -4
- package/dist/{WelcomePage-jGXRVqLL.js → WelcomePage-CeP5qQXC.js} +2 -2
- package/dist/_plugin-vue_export-helper-Ckr1Vx8X.js +368 -0
- package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -1
- package/dist/components/Tooltip.vue.d.ts.map +1 -1
- package/dist/components/chartHelpers.d.ts.map +1 -1
- package/dist/components/dashboard/Dashboard.vue.d.ts +3 -1
- package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -1
- package/dist/components/dashboard/DashboardChart.vue.d.ts +2 -2
- package/dist/components/dashboard/DashboardFilter.vue.d.ts +1 -1
- package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -1
- package/dist/components/dashboard/DashboardHeader.vue.d.ts +10 -0
- package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -1
- package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +1 -1
- package/dist/components/dashboard/DashboardTable.vue.d.ts +1 -1
- package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
- package/dist/components/sidebar/DashboardList.vue.d.ts +2 -2
- package/dist/components/sidebar/DashboardListItem.vue.d.ts +1 -1
- package/dist/components/sidebar/Sidebar.vue.d.ts +2 -2
- package/dist/composables/useCrossFilterEligibility.d.ts.map +1 -1
- package/dist/composables/useEmbeddedDashboardGroup.d.ts +5 -9
- package/dist/composables/useEmbeddedDashboardGroup.d.ts.map +1 -1
- package/dist/composables/useResolvedCrossFilterController.d.ts +1 -1
- package/dist/composables/useResolvedCrossFilterController.d.ts.map +1 -1
- package/dist/connections/bigquery_oauth.d.ts +1 -0
- package/dist/connections/bigquery_oauth.d.ts.map +1 -1
- package/dist/connections/duckdb.d.ts.map +1 -1
- package/dist/connections/motherduck.d.ts +1 -1
- package/dist/connections/motherduck.d.ts.map +1 -1
- package/dist/connections/snowflake.d.ts +9 -2
- package/dist/connections/snowflake.d.ts.map +1 -1
- package/dist/connections.js +2 -2
- package/dist/dashboard.js +23 -18
- package/dist/dashboards/barChartSpec.d.ts.map +1 -1
- package/dist/dashboards/barHChartSpec.d.ts.map +1 -1
- package/dist/dashboards/base.d.ts +13 -13
- package/dist/dashboards/base.d.ts.map +1 -1
- package/dist/dashboards/conditions.d.ts +26 -0
- package/dist/dashboards/conditions.d.ts.map +1 -1
- package/dist/dashboards/crossFilters.d.ts +27 -9
- package/dist/dashboards/crossFilters.d.ts.map +1 -1
- package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -1
- package/dist/dashboards/helpers.d.ts +2 -0
- package/dist/dashboards/helpers.d.ts.map +1 -1
- package/dist/dashboards/spec.d.ts.map +1 -1
- package/dist/{editorStore-BTPcljeQ.js → editorStore-CHHdik0L.js} +1 -1
- package/dist/editors/results.d.ts +1 -0
- package/dist/editors/results.d.ts.map +1 -1
- package/dist/embed.js +2 -2
- package/dist/icons/registerMdiIcons.d.ts +2 -1
- package/dist/icons/registerMdiIcons.d.ts.map +1 -1
- package/dist/monaco.js +1 -1
- package/dist/{queryExecutionService-BxU16oNE.js → queryExecutionService-D1ynkTop.js} +850 -691
- package/dist/{remoteProject-CvjztZU1.js → remoteProject-DrsKUWjF.js} +1 -1
- package/dist/{snowflake-CY1Gnu3y.js → snowflake-BUHnLz1S.js} +1587 -1539
- package/dist/stores/dashboardStore.d.ts +2 -2
- package/dist/stores/dashboardStore.d.ts.map +1 -1
- package/dist/stores/queryExecutionService.d.ts.map +1 -1
- package/dist/stores/resolver.d.ts +2 -0
- package/dist/stores/resolver.d.ts.map +1 -1
- package/dist/stores.js +2 -2
- package/dist/trilogy-studio-components.css +1 -1
- package/dist/{useDashboard-Cl_8almf.js → useDashboard-DlVElw8y.js} +915 -884
- package/dist/{useResizableDialog-BZgmdwim.js → useResizableDialog-B6WRQMxc.js} +1 -1
- package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -1
- package/dist/views/TutorialPage.vue.d.ts +4 -2
- package/dist/views/TutorialPage.vue.d.ts.map +1 -1
- package/dist/views.js +109 -104
- package/package.json +1 -1
- package/dist/_plugin-vue_export-helper-BzkwV_Yn.js +0 -361
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (r, e, t) =>
|
|
4
|
-
import { k as
|
|
5
|
-
import { a as
|
|
6
|
-
import { ref as Q, toValue as
|
|
7
|
-
import { K as
|
|
8
|
-
import { E as
|
|
9
|
-
import { defineStore as
|
|
10
|
-
import { c as
|
|
11
|
-
const
|
|
1
|
+
var tt = Object.defineProperty;
|
|
2
|
+
var rt = (r, e, t) => e in r ? tt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var w = (r, e, t) => rt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { k as st, u as ot } from "./editorStore-CHHdik0L.js";
|
|
5
|
+
import { a as nt, c as it, b as at, q as _e, s as Qe, t as ct, M as lt, r as ut, C as Oe, u as ht } from "./toolLoopCore-CK_KVuAS.js";
|
|
6
|
+
import { ref as Q, toValue as Ve, computed as dt } from "vue";
|
|
7
|
+
import { K as se, l as ft } from "./constants-BXXolEur.js";
|
|
8
|
+
import { E as Ee, m as qe, R as B, C as mt } from "./snowflake-BUHnLz1S.js";
|
|
9
|
+
import { defineStore as Y } from "pinia";
|
|
10
|
+
import { c as gt, e as yt, A as ke, O as Me, G as Le, a as Pe, D as pt, g as bt, b as wt, C as vt } from "./chatAgentPrompt-DrX26_jN.js";
|
|
11
|
+
const St = [
|
|
12
12
|
{
|
|
13
13
|
id: "welcome",
|
|
14
14
|
title: "Welcome!",
|
|
@@ -36,7 +36,7 @@ const mt = [
|
|
|
36
36
|
category: "onboarding",
|
|
37
37
|
highlightDataTestId: "sidebar-icon-tutorial"
|
|
38
38
|
}
|
|
39
|
-
],
|
|
39
|
+
], Ct = [
|
|
40
40
|
{
|
|
41
41
|
id: "editor-intro",
|
|
42
42
|
title: "Settings",
|
|
@@ -79,7 +79,7 @@ const mt = [
|
|
|
79
79
|
category: "editor",
|
|
80
80
|
highlightDataTestId: "editor-generate-button"
|
|
81
81
|
}
|
|
82
|
-
],
|
|
82
|
+
], Et = [
|
|
83
83
|
{
|
|
84
84
|
id: "dashboard-intro",
|
|
85
85
|
title: "Dashboard",
|
|
@@ -134,7 +134,7 @@ const mt = [
|
|
|
134
134
|
content: "A basic dashboard is just charts and tables, but you can use Markdown blocks and filters to make more rich, interactive experiences. Markdown blocks can have source trilogy queries and have a special syntax for embedding results in line.",
|
|
135
135
|
category: "dashboard"
|
|
136
136
|
}
|
|
137
|
-
],
|
|
137
|
+
], Dt = [
|
|
138
138
|
{
|
|
139
139
|
id: "model-intro",
|
|
140
140
|
title: "Community Models",
|
|
@@ -149,7 +149,15 @@ const mt = [
|
|
|
149
149
|
category: "community",
|
|
150
150
|
highlightDataTestId: "copy-dashboard-share-button"
|
|
151
151
|
}
|
|
152
|
-
]
|
|
152
|
+
], je = /* @__PURE__ */ new Set(), ye = /* @__PURE__ */ new Map(), xt = {
|
|
153
|
+
query: "select 1 as resolver_warmup;",
|
|
154
|
+
dialect: "duckdb",
|
|
155
|
+
full_model: { name: "", sources: [] },
|
|
156
|
+
imports: [],
|
|
157
|
+
extra_filters: [],
|
|
158
|
+
parameters: {},
|
|
159
|
+
current_filename: "__resolver_warmup__.preql"
|
|
160
|
+
};
|
|
153
161
|
class W {
|
|
154
162
|
constructor(e = 100) {
|
|
155
163
|
w(this, "capacity");
|
|
@@ -181,7 +189,7 @@ class W {
|
|
|
181
189
|
return this.cache.size;
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
|
-
class
|
|
192
|
+
class Sr {
|
|
185
193
|
constructor(e, t = 100) {
|
|
186
194
|
w(this, "settingStore");
|
|
187
195
|
w(this, "validateCache");
|
|
@@ -343,28 +351,28 @@ class hr {
|
|
|
343
351
|
if (u)
|
|
344
352
|
return u;
|
|
345
353
|
const l = [], h = [];
|
|
346
|
-
if (e.forEach((y,
|
|
347
|
-
const
|
|
354
|
+
if (e.forEach((y, E) => {
|
|
355
|
+
const T = [...i || [], ...y.extra_filters || []], x = {
|
|
348
356
|
...n || {},
|
|
349
357
|
...y.parameters || {}
|
|
350
|
-
},
|
|
358
|
+
}, _ = this.createQueryCacheKey(
|
|
351
359
|
y.query,
|
|
352
360
|
t,
|
|
353
361
|
s,
|
|
354
362
|
o,
|
|
355
|
-
|
|
356
|
-
Object.keys(
|
|
363
|
+
T.length > 0 ? T : null,
|
|
364
|
+
Object.keys(x).length > 0 ? x : null,
|
|
357
365
|
null
|
|
358
|
-
),
|
|
359
|
-
|
|
360
|
-
index:
|
|
361
|
-
result: { ...
|
|
362
|
-
}) : h.push({ index:
|
|
366
|
+
), F = this.queryCache.get(_);
|
|
367
|
+
F ? l.push({
|
|
368
|
+
index: E,
|
|
369
|
+
result: { ...F.data, label: y.label }
|
|
370
|
+
}) : h.push({ index: E, component: y });
|
|
363
371
|
}), h.length === 0) {
|
|
364
|
-
const
|
|
365
|
-
data: { queries: l.sort((
|
|
372
|
+
const E = {
|
|
373
|
+
data: { queries: l.sort((T, x) => T.index - x.index).map((T) => T.result) }
|
|
366
374
|
};
|
|
367
|
-
return this.batchQueryCache.set(c,
|
|
375
|
+
return this.batchQueryCache.set(c, E), E;
|
|
368
376
|
}
|
|
369
377
|
const d = {
|
|
370
378
|
queries: h.map((y) => y.component),
|
|
@@ -383,26 +391,26 @@ class hr {
|
|
|
383
391
|
},
|
|
384
392
|
body: JSON.stringify(d)
|
|
385
393
|
}
|
|
386
|
-
)).data.queries.forEach((y,
|
|
387
|
-
const
|
|
394
|
+
)).data.queries.forEach((y, E) => {
|
|
395
|
+
const T = h[E].index, x = h[E].component, _ = [...i || [], ...x.extra_filters || []], F = {
|
|
388
396
|
...n || {},
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
|
|
397
|
+
...x.parameters || {}
|
|
398
|
+
}, C = this.createQueryCacheKey(
|
|
399
|
+
x.query,
|
|
392
400
|
t,
|
|
393
401
|
s,
|
|
394
402
|
o,
|
|
395
|
-
|
|
396
|
-
Object.keys(
|
|
403
|
+
_.length > 0 ? _ : null,
|
|
404
|
+
Object.keys(F).length > 0 ? F : null,
|
|
397
405
|
null
|
|
398
406
|
);
|
|
399
|
-
this.queryCache.set(
|
|
400
|
-
index:
|
|
401
|
-
result: { ...y, label:
|
|
407
|
+
this.queryCache.set(C, { data: y }), l.push({
|
|
408
|
+
index: T,
|
|
409
|
+
result: { ...y, label: x.label }
|
|
402
410
|
});
|
|
403
411
|
});
|
|
404
412
|
const m = {
|
|
405
|
-
data: { queries: l.sort((y,
|
|
413
|
+
data: { queries: l.sort((y, E) => y.index - E.index).map((y) => y.result) }
|
|
406
414
|
};
|
|
407
415
|
return this.batchQueryCache.set(c, m), m;
|
|
408
416
|
}
|
|
@@ -419,9 +427,31 @@ class hr {
|
|
|
419
427
|
"Content-Type": "application/json"
|
|
420
428
|
},
|
|
421
429
|
body: JSON.stringify(s)
|
|
422
|
-
}), a =
|
|
430
|
+
}), a = st.fromJSON(n.data);
|
|
423
431
|
return this.modelCache.set(o, a), a;
|
|
424
432
|
}
|
|
433
|
+
async warmResolver() {
|
|
434
|
+
const e = this.settingStore.settings.trilogyResolver.replace(/\/+$/, "");
|
|
435
|
+
if (!e || je.has(e))
|
|
436
|
+
return;
|
|
437
|
+
const t = ye.get(e);
|
|
438
|
+
if (t)
|
|
439
|
+
return t;
|
|
440
|
+
const s = this.fetchWithErrorHandling(`${e}/generate_query`, {
|
|
441
|
+
method: "POST",
|
|
442
|
+
headers: {
|
|
443
|
+
"Content-Type": "application/json"
|
|
444
|
+
},
|
|
445
|
+
body: JSON.stringify(xt)
|
|
446
|
+
}).then(() => {
|
|
447
|
+
je.add(e);
|
|
448
|
+
}).catch((o) => {
|
|
449
|
+
console.warn("Resolver warm-up request failed:", o);
|
|
450
|
+
}).finally(() => {
|
|
451
|
+
ye.delete(e);
|
|
452
|
+
});
|
|
453
|
+
return ye.set(e, s), s;
|
|
454
|
+
}
|
|
425
455
|
// Cache management methods
|
|
426
456
|
clearAllCaches() {
|
|
427
457
|
this.validateCache.clear(), this.formatCache.clear(), this.queryCache.clear(), this.batchQueryCache.clear(), this.modelCache.clear();
|
|
@@ -436,20 +466,67 @@ class hr {
|
|
|
436
466
|
};
|
|
437
467
|
}
|
|
438
468
|
}
|
|
439
|
-
function
|
|
469
|
+
function Tt(r) {
|
|
470
|
+
return r.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
471
|
+
}
|
|
472
|
+
function $t(r) {
|
|
473
|
+
let e = 0;
|
|
474
|
+
for (let t = 0; t < r.length; t++)
|
|
475
|
+
e = Math.imul(31, e) + r.charCodeAt(t) | 0;
|
|
476
|
+
return Math.abs(e).toString(36).slice(0, 5);
|
|
477
|
+
}
|
|
478
|
+
function oe(r) {
|
|
479
|
+
if (r instanceof Date) {
|
|
480
|
+
const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
|
|
481
|
+
return `${e}-${t}-${s}`;
|
|
482
|
+
}
|
|
483
|
+
return r !== null && typeof r == "object" && typeof r.toISODate == "function" ? r.toISODate() : r;
|
|
484
|
+
}
|
|
485
|
+
function Ie(r, e, t = "") {
|
|
486
|
+
const s = Tt(r) + "_" + $t(r) + t;
|
|
487
|
+
switch (e.op) {
|
|
488
|
+
case "eq": {
|
|
489
|
+
const o = oe(e.value);
|
|
490
|
+
return {
|
|
491
|
+
filterString: `${r} = :${s}`,
|
|
492
|
+
parameters: { [`:${s}`]: o }
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
case "range": {
|
|
496
|
+
const o = oe(e.value[0]), i = oe(e.value[1]);
|
|
497
|
+
return {
|
|
498
|
+
filterString: `${r} between :${s}_min and :${s}_max`,
|
|
499
|
+
parameters: {
|
|
500
|
+
[`:${s}_min`]: o,
|
|
501
|
+
[`:${s}_max`]: i
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
case "in": {
|
|
506
|
+
const o = {}, i = e.value.map((n, a) => (o[`:${s}_${a}`] = oe(n), `:${s}_${a}`));
|
|
507
|
+
return {
|
|
508
|
+
filterString: `${r} in (${i.join(", ")})`,
|
|
509
|
+
parameters: o
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
case "is_null":
|
|
513
|
+
return { filterString: `${r} IS NULL`, parameters: {} };
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function Cr(r) {
|
|
440
517
|
if (Array.isArray(r)) {
|
|
441
518
|
const t = {};
|
|
442
519
|
return r.forEach((o) => {
|
|
443
520
|
Object.entries(o).forEach(([i, n]) => {
|
|
444
521
|
t[i] || (t[i] = []), t[i].push(n);
|
|
445
522
|
});
|
|
446
|
-
}), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) =>
|
|
523
|
+
}), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) => pe(o, a)).join(" OR ")})` : pe(o, i[0])).join(" AND ");
|
|
447
524
|
}
|
|
448
525
|
return Object.keys(r).length === 0 ? "" : Object.entries(r).map(
|
|
449
|
-
([t, s]) =>
|
|
526
|
+
([t, s]) => pe(t, s)
|
|
450
527
|
).join(" AND ");
|
|
451
528
|
}
|
|
452
|
-
function
|
|
529
|
+
function Ne(r) {
|
|
453
530
|
if (r instanceof Date) {
|
|
454
531
|
const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
|
|
455
532
|
return `'${e}-${t}-${s}'::date`;
|
|
@@ -457,48 +534,83 @@ function _e(r) {
|
|
|
457
534
|
if (r === null)
|
|
458
535
|
return "NULL";
|
|
459
536
|
if (typeof r == "string")
|
|
460
|
-
return `'${r.replace(/'/g,
|
|
537
|
+
return `'${r.replace(/'/g, Ee)}'`;
|
|
461
538
|
if (typeof r == "boolean")
|
|
462
539
|
return r ? "TRUE" : "FALSE";
|
|
463
540
|
if (typeof r == "number")
|
|
464
541
|
return r.toString();
|
|
465
542
|
}
|
|
466
|
-
function
|
|
543
|
+
function pe(r, e) {
|
|
467
544
|
if (e === null)
|
|
468
545
|
return `${r} IS NULL`;
|
|
469
546
|
if (typeof e == "string") {
|
|
470
|
-
const t = e.replace(/'/g,
|
|
547
|
+
const t = e.replace(/'/g, Ee);
|
|
471
548
|
return `${r}='''${t}'''`;
|
|
472
549
|
} else {
|
|
473
550
|
if (Array.isArray(e))
|
|
474
|
-
return `${r} between ${
|
|
551
|
+
return `${r} between ${Ne(e[0])} and ${Ne(e[e.length - 1])}`;
|
|
475
552
|
if (typeof e == "number" || typeof e == "boolean")
|
|
476
553
|
return `${r}=${e}`;
|
|
477
554
|
if (e === void 0)
|
|
478
555
|
return `${r} IS NULL`;
|
|
479
556
|
{
|
|
480
|
-
const t = JSON.stringify(e).replace(/'/g,
|
|
557
|
+
const t = JSON.stringify(e).replace(/'/g, Ee);
|
|
481
558
|
return `${r}='${t}'`;
|
|
482
559
|
}
|
|
483
560
|
}
|
|
484
561
|
}
|
|
485
|
-
function
|
|
562
|
+
function At(r = []) {
|
|
486
563
|
const e = /* @__PURE__ */ new Set();
|
|
487
564
|
for (const t of r)
|
|
488
565
|
t != null && t.label && e.add(t.label);
|
|
489
566
|
return Array.from(e);
|
|
490
567
|
}
|
|
491
|
-
function
|
|
568
|
+
function ue(r) {
|
|
569
|
+
return { ...r };
|
|
570
|
+
}
|
|
571
|
+
function G(r) {
|
|
492
572
|
return { ...r };
|
|
493
573
|
}
|
|
494
|
-
function
|
|
574
|
+
function Ft(r, e) {
|
|
575
|
+
if (r.op !== e.op) return !1;
|
|
576
|
+
switch (r.op) {
|
|
577
|
+
case "is_null":
|
|
578
|
+
return !0;
|
|
579
|
+
case "eq":
|
|
580
|
+
return r.value === e.value;
|
|
581
|
+
case "range": {
|
|
582
|
+
const t = e;
|
|
583
|
+
return r.value[0] === t.value[0] && r.value[1] === t.value[1];
|
|
584
|
+
}
|
|
585
|
+
case "in": {
|
|
586
|
+
const t = e;
|
|
587
|
+
return r.value.length === t.value.length && r.value.every((s, o) => s === t.value[o]);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function he(r, e) {
|
|
592
|
+
const t = Object.keys(r).sort(), s = Object.keys(e).sort();
|
|
593
|
+
return t.length !== s.length ? !1 : t.every(
|
|
594
|
+
(o, i) => o === s[i] && Ft(r[o], e[o])
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
function _t(r, e) {
|
|
495
598
|
return Array.isArray(r) && Array.isArray(e) ? r.length === e.length && r.every((t, s) => t === e[s]) : r === e;
|
|
496
599
|
}
|
|
497
|
-
function
|
|
600
|
+
function Re(r, e) {
|
|
498
601
|
const t = Object.keys(r).sort(), s = Object.keys(e).sort();
|
|
499
|
-
return t.length !== s.length ? !1 : t.every(
|
|
602
|
+
return t.length !== s.length ? !1 : t.every(
|
|
603
|
+
(o, i) => o === s[i] && _t(r[o], e[o])
|
|
604
|
+
);
|
|
500
605
|
}
|
|
501
|
-
function
|
|
606
|
+
function Qt(r, e, t, s) {
|
|
607
|
+
const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
|
|
608
|
+
if (s === "remove") return o;
|
|
609
|
+
if (s === "add") return [...o, { source: e, value: G(t) }];
|
|
610
|
+
const a = i.some((c) => Re(c.value, t)) ? i.filter((c) => !Re(c.value, t)) : [...i, { source: e, value: G(t) }];
|
|
611
|
+
return [...o, ...a];
|
|
612
|
+
}
|
|
613
|
+
function Ot(r, e, t) {
|
|
502
614
|
if (e.size === 0)
|
|
503
615
|
return t && r.startsWith("local.") ? r.replace(/^local\./, "") : r;
|
|
504
616
|
if (e.has(r))
|
|
@@ -510,41 +622,62 @@ function St(r, e, t) {
|
|
|
510
622
|
}
|
|
511
623
|
return null;
|
|
512
624
|
}
|
|
513
|
-
function
|
|
625
|
+
function qt(r, e = [], t = {}) {
|
|
514
626
|
const s = new Set(e), o = t.normalizeLocalFields ?? !1;
|
|
515
627
|
return Object.entries(r).reduce((i, [n, a]) => {
|
|
516
|
-
if (typeof a != "
|
|
628
|
+
if (typeof a != "object" || a === null || !["eq", "range", "in", "is_null"].includes(a.op))
|
|
517
629
|
return i;
|
|
518
|
-
const c =
|
|
630
|
+
const c = Ot(n, s, o);
|
|
519
631
|
return c && (i[c] = a), i;
|
|
520
632
|
}, {});
|
|
521
633
|
}
|
|
522
|
-
function
|
|
523
|
-
|
|
634
|
+
function De(r) {
|
|
635
|
+
if (!r.length)
|
|
636
|
+
return { filterStrings: [], parameters: {} };
|
|
637
|
+
const e = {};
|
|
638
|
+
for (const o of r)
|
|
639
|
+
for (const [i, n] of Object.entries(o.value))
|
|
640
|
+
e[i] || (e[i] = []), e[i].push(n);
|
|
641
|
+
const t = [];
|
|
642
|
+
let s = {};
|
|
643
|
+
for (const [o, i] of Object.entries(e))
|
|
644
|
+
if (i.length > 1) {
|
|
645
|
+
const n = [];
|
|
646
|
+
for (let a = 0; a < i.length; a++) {
|
|
647
|
+
const { filterString: c, parameters: u } = Ie(o, i[a], `_or${a}`);
|
|
648
|
+
n.push(c), s = { ...s, ...u };
|
|
649
|
+
}
|
|
650
|
+
t.push(`(${n.join(" OR ")})`);
|
|
651
|
+
} else {
|
|
652
|
+
const { filterString: n, parameters: a } = Ie(o, i[0]);
|
|
653
|
+
t.push(n), s = { ...s, ...a };
|
|
654
|
+
}
|
|
655
|
+
return { filterStrings: t, parameters: s };
|
|
524
656
|
}
|
|
525
|
-
function
|
|
526
|
-
const e = r.conceptFilters || [], t = (r.filters || []).filter((
|
|
527
|
-
|
|
657
|
+
function fe(r) {
|
|
658
|
+
const e = r.conceptFilters || [], t = (r.filters || []).filter((a) => a.source !== "cross"), { filterStrings: s, parameters: o } = De(e), i = s.join(" AND ");
|
|
659
|
+
i && t.push({
|
|
528
660
|
source: "cross",
|
|
529
|
-
value:
|
|
661
|
+
value: i,
|
|
662
|
+
parameters: Object.keys(o).length ? o : void 0
|
|
530
663
|
});
|
|
531
|
-
const
|
|
532
|
-
return r.filters = t,
|
|
664
|
+
const n = JSON.stringify(t) !== JSON.stringify(r.filters || []);
|
|
665
|
+
return r.filters = t, n;
|
|
533
666
|
}
|
|
534
|
-
function
|
|
667
|
+
function kt(r, e, t, s) {
|
|
535
668
|
const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
|
|
536
669
|
if (s === "remove")
|
|
537
670
|
return o;
|
|
538
671
|
if (s === "add")
|
|
539
|
-
return [...o, { source: e, value:
|
|
540
|
-
const a = i.some((c) =>
|
|
672
|
+
return [...o, { source: e, value: ue(t) }];
|
|
673
|
+
const a = i.some((c) => he(c.value, t)) ? i.filter((c) => !he(c.value, t)) : [...i, { source: e, value: ue(t) }];
|
|
541
674
|
return [...o, ...a];
|
|
542
675
|
}
|
|
543
|
-
function
|
|
676
|
+
function Mt(r, e, t, s, o) {
|
|
544
677
|
const i = [];
|
|
545
678
|
return Object.entries(r).forEach(([n, a]) => {
|
|
546
679
|
if (n === e) {
|
|
547
|
-
const h =
|
|
680
|
+
const h = Qt(
|
|
548
681
|
a.chartFilters || [],
|
|
549
682
|
e,
|
|
550
683
|
s,
|
|
@@ -555,18 +688,18 @@ function Et(r, e, t, s, o) {
|
|
|
555
688
|
}
|
|
556
689
|
if (!a.allowCrossFilter)
|
|
557
690
|
return;
|
|
558
|
-
const c =
|
|
691
|
+
const c = kt(
|
|
559
692
|
a.conceptFilters || [],
|
|
560
693
|
e,
|
|
561
694
|
t,
|
|
562
695
|
o
|
|
563
696
|
), u = JSON.stringify(c) !== JSON.stringify(a.conceptFilters || []);
|
|
564
697
|
u && (a.conceptFilters = c);
|
|
565
|
-
const l =
|
|
698
|
+
const l = fe(a);
|
|
566
699
|
(u || l) && i.push(n);
|
|
567
700
|
}), i;
|
|
568
701
|
}
|
|
569
|
-
function
|
|
702
|
+
function Lt(r, e, t) {
|
|
570
703
|
const s = r[e];
|
|
571
704
|
if (!s)
|
|
572
705
|
return !1;
|
|
@@ -574,10 +707,10 @@ function Dt(r, e, t) {
|
|
|
574
707
|
(a) => a.source !== t
|
|
575
708
|
), i = JSON.stringify(o) !== JSON.stringify(s.conceptFilters || []);
|
|
576
709
|
i && (s.conceptFilters = o);
|
|
577
|
-
const n =
|
|
710
|
+
const n = fe(s);
|
|
578
711
|
return i || n;
|
|
579
712
|
}
|
|
580
|
-
function
|
|
713
|
+
function Pt(r, e) {
|
|
581
714
|
const t = [];
|
|
582
715
|
return Object.entries(r).forEach(([s, o]) => {
|
|
583
716
|
if (s === e) {
|
|
@@ -588,11 +721,11 @@ function xt(r, e) {
|
|
|
588
721
|
(c) => c.source !== e
|
|
589
722
|
), n = JSON.stringify(i) !== JSON.stringify(o.conceptFilters || []);
|
|
590
723
|
n && (o.conceptFilters = i);
|
|
591
|
-
const a =
|
|
724
|
+
const a = fe(o);
|
|
592
725
|
(n || a) && t.push(s);
|
|
593
726
|
}), t;
|
|
594
727
|
}
|
|
595
|
-
function
|
|
728
|
+
function jt(r) {
|
|
596
729
|
const e = [];
|
|
597
730
|
return Object.entries(r).forEach(([t, s]) => {
|
|
598
731
|
var i, n, a;
|
|
@@ -600,18 +733,18 @@ function Tt(r) {
|
|
|
600
733
|
s.conceptFilters = [], s.chartFilters = [], s.filters = [], o && e.push(t);
|
|
601
734
|
}), e;
|
|
602
735
|
}
|
|
603
|
-
function
|
|
736
|
+
function It(r = {}) {
|
|
604
737
|
const e = /* @__PURE__ */ new Map(), t = () => {
|
|
605
|
-
const o = r.validFields ?
|
|
738
|
+
const o = r.validFields ? Ve(r.validFields) : [];
|
|
606
739
|
return new Set(o);
|
|
607
740
|
}, s = (o) => {
|
|
608
|
-
const i =
|
|
741
|
+
const i = qt(o.filters, t(), {
|
|
609
742
|
normalizeLocalFields: r.normalizeLocalFields ?? !0
|
|
610
743
|
});
|
|
611
744
|
return {
|
|
612
745
|
source: o.source,
|
|
613
746
|
filters: i,
|
|
614
|
-
chart:
|
|
747
|
+
chart: G(o.chart || {}),
|
|
615
748
|
append: o.append
|
|
616
749
|
};
|
|
617
750
|
};
|
|
@@ -619,8 +752,8 @@ function $t(r = {}) {
|
|
|
619
752
|
getSelections() {
|
|
620
753
|
return Array.from(e.values()).flat().map((o) => ({
|
|
621
754
|
source: o.source,
|
|
622
|
-
filters:
|
|
623
|
-
chart:
|
|
755
|
+
filters: ue(o.filters),
|
|
756
|
+
chart: G(o.chart || {}),
|
|
624
757
|
append: o.append
|
|
625
758
|
}));
|
|
626
759
|
},
|
|
@@ -637,8 +770,8 @@ function $t(r = {}) {
|
|
|
637
770
|
if (a === "add")
|
|
638
771
|
return e.set(o.source, [n]), n.filters;
|
|
639
772
|
const l = c.some(
|
|
640
|
-
(h) =>
|
|
641
|
-
) ? c.filter((h) => !
|
|
773
|
+
(h) => he(h.filters, n.filters)
|
|
774
|
+
) ? c.filter((h) => !he(h.filters, n.filters)) : [...c, n];
|
|
642
775
|
return l.length === 0 ? e.delete(o.source) : e.set(o.source, l), n.filters;
|
|
643
776
|
},
|
|
644
777
|
clearSource(o) {
|
|
@@ -654,30 +787,33 @@ function $t(r = {}) {
|
|
|
654
787
|
return Array.from(e.entries()).filter(([i]) => i !== o).flatMap(
|
|
655
788
|
([i, n]) => n.map((a) => ({
|
|
656
789
|
source: i,
|
|
657
|
-
value:
|
|
790
|
+
value: ue(a.filters)
|
|
658
791
|
}))
|
|
659
792
|
);
|
|
660
793
|
},
|
|
661
794
|
getChartSelectionsFor(o) {
|
|
662
|
-
return (e.get(o) || []).map(
|
|
663
|
-
(i) => B(i.chart || i.filters)
|
|
664
|
-
);
|
|
795
|
+
return (e.get(o) || []).map((i) => G(i.chart || {}));
|
|
665
796
|
},
|
|
666
797
|
getFilterExpressionFor(o) {
|
|
667
|
-
|
|
798
|
+
const { filterStrings: i } = De(this.getSqlFilterInputsFor(o));
|
|
799
|
+
return i.join(" AND ");
|
|
668
800
|
},
|
|
669
801
|
getSqlFiltersFor(o, i = []) {
|
|
670
802
|
const n = this.getFilterExpressionFor(o);
|
|
671
803
|
return n ? [...i, n] : [...i];
|
|
804
|
+
},
|
|
805
|
+
getSqlParametersFor(o) {
|
|
806
|
+
const { parameters: i } = De(this.getSqlFilterInputsFor(o));
|
|
807
|
+
return i;
|
|
672
808
|
}
|
|
673
809
|
};
|
|
674
810
|
}
|
|
675
|
-
function
|
|
676
|
-
const e = Q(0), t =
|
|
811
|
+
function Er(r = {}) {
|
|
812
|
+
const e = Q(0), t = It(Ve(r)), s = () => {
|
|
677
813
|
e.value += 1;
|
|
678
814
|
};
|
|
679
815
|
return {
|
|
680
|
-
version:
|
|
816
|
+
version: dt(() => e.value),
|
|
681
817
|
applyDimensionClick(o, i) {
|
|
682
818
|
const n = t.applyDimensionClick(o, i);
|
|
683
819
|
return s(), n;
|
|
@@ -708,17 +844,20 @@ function dr(r = {}) {
|
|
|
708
844
|
},
|
|
709
845
|
getSqlFiltersFor(o, i = []) {
|
|
710
846
|
return e.value, t.getSqlFiltersFor(o, i);
|
|
847
|
+
},
|
|
848
|
+
getSqlParametersFor(o) {
|
|
849
|
+
return e.value, t.getSqlParametersFor(o);
|
|
711
850
|
}
|
|
712
851
|
};
|
|
713
852
|
}
|
|
714
|
-
const
|
|
853
|
+
const L = {
|
|
715
854
|
CHART: "chart",
|
|
716
855
|
MARKDOWN: "markdown",
|
|
717
856
|
TABLE: "table",
|
|
718
857
|
FILTER: "filter",
|
|
719
858
|
SECTION_HEADER: "section-header"
|
|
720
859
|
};
|
|
721
|
-
class
|
|
860
|
+
class V {
|
|
722
861
|
constructor({
|
|
723
862
|
id: e,
|
|
724
863
|
name: t,
|
|
@@ -732,7 +871,7 @@ class G {
|
|
|
732
871
|
filter: l = null,
|
|
733
872
|
imports: h = [],
|
|
734
873
|
version: d = 1,
|
|
735
|
-
state:
|
|
874
|
+
state: f = "editing",
|
|
736
875
|
description: v = ""
|
|
737
876
|
}) {
|
|
738
877
|
w(this, "id");
|
|
@@ -751,7 +890,7 @@ class G {
|
|
|
751
890
|
w(this, "description", "");
|
|
752
891
|
w(this, "changed", !1);
|
|
753
892
|
w(this, "deleted", !1);
|
|
754
|
-
this.id = e, this.name = t, this.storage = s, this.connection = o, this.layout = i, this.gridItems = n, this.nextId = a, this.createdAt = c || /* @__PURE__ */ new Date(), this.updatedAt = u || /* @__PURE__ */ new Date(), this.filter = l, this.imports = h, this.version = d, this.state =
|
|
893
|
+
this.id = e, this.name = t, this.storage = s, this.connection = o, this.layout = i, this.gridItems = n, this.nextId = a, this.createdAt = c || /* @__PURE__ */ new Date(), this.updatedAt = u || /* @__PURE__ */ new Date(), this.filter = l, this.imports = h, this.version = d, this.state = f, this.description = v, this.changed = !1;
|
|
755
894
|
}
|
|
756
895
|
delete() {
|
|
757
896
|
this.deleted = !0, this.changed = !0;
|
|
@@ -764,7 +903,7 @@ class G {
|
|
|
764
903
|
addItem(e, t = 0, s = 0, o = 4, i = null, n = null, a) {
|
|
765
904
|
const c = this.nextId.toString();
|
|
766
905
|
let u = 10;
|
|
767
|
-
e ===
|
|
906
|
+
e === L.MARKDOWN ? u = 3 : e === L.SECTION_HEADER && (u = 1);
|
|
768
907
|
let l = s;
|
|
769
908
|
l = this.layout.reduce((m, y) => Math.max(m, y.y + y.h), 0), this.layout.push({
|
|
770
909
|
x: t,
|
|
@@ -775,18 +914,18 @@ class G {
|
|
|
775
914
|
static: !1
|
|
776
915
|
});
|
|
777
916
|
let h = `Note ${c}`;
|
|
778
|
-
e ===
|
|
779
|
-
let d = a || h,
|
|
917
|
+
e === L.CHART ? h = `Chart ${c}` : e === L.TABLE ? h = `Table ${c}` : e === L.SECTION_HEADER && (h = "### Section Header");
|
|
918
|
+
let d = a || h, f = `# Markdown Cell
|
|
780
919
|
Enter your markdown content here.`;
|
|
781
|
-
e ===
|
|
782
|
-
let v = n ||
|
|
920
|
+
e === L.CHART ? f = "SELECT unnest([1,2,3,4]) as value, 'example' as dim" : e === L.TABLE ? f = "SELECT [1,2,3,4] as value, 'example' as dim" : e === L.SECTION_HEADER && (f = "");
|
|
921
|
+
let v = n || f;
|
|
783
922
|
return this.gridItems[c] = {
|
|
784
923
|
type: e,
|
|
785
924
|
content: v,
|
|
786
925
|
name: d,
|
|
787
926
|
width: 0,
|
|
788
927
|
height: 0,
|
|
789
|
-
allowCrossFilter: e !==
|
|
928
|
+
allowCrossFilter: e !== L.SECTION_HEADER
|
|
790
929
|
}, this.nextId++, this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0, c;
|
|
791
930
|
}
|
|
792
931
|
copyItem(e) {
|
|
@@ -887,24 +1026,24 @@ Enter your markdown content here.`;
|
|
|
887
1026
|
}
|
|
888
1027
|
updateItemFilters(e) {
|
|
889
1028
|
const t = this.gridItems[e];
|
|
890
|
-
t &&
|
|
1029
|
+
t && fe(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
|
|
891
1030
|
}
|
|
892
1031
|
removeItemCrossFilter(e, t) {
|
|
893
|
-
|
|
1032
|
+
Lt(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
|
|
894
1033
|
}
|
|
895
1034
|
removeItemCrossFilterSource(e) {
|
|
896
1035
|
var o, i;
|
|
897
|
-
const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s =
|
|
1036
|
+
const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Pt(this.gridItems, e);
|
|
898
1037
|
return (s.length > 0 || t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), s;
|
|
899
1038
|
}
|
|
900
1039
|
removeAllFilters() {
|
|
901
|
-
const e =
|
|
1040
|
+
const e = jt(this.gridItems);
|
|
902
1041
|
for (const t in this.gridItems)
|
|
903
1042
|
this.gridItems[t].parameters = {};
|
|
904
1043
|
return e.length > 0 && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), e;
|
|
905
1044
|
}
|
|
906
1045
|
updateItemCrossFilters(e, t, s, o) {
|
|
907
|
-
const i =
|
|
1046
|
+
const i = Mt(
|
|
908
1047
|
this.gridItems,
|
|
909
1048
|
e,
|
|
910
1049
|
t,
|
|
@@ -1025,10 +1164,10 @@ Enter your markdown content here.`;
|
|
|
1025
1164
|
loadStartTime: null,
|
|
1026
1165
|
allowCrossFilter: o.allowCrossFilter !== !1,
|
|
1027
1166
|
// Default to true if not explicitly false
|
|
1028
|
-
chartConfig:
|
|
1029
|
-
drilldownChartConfig:
|
|
1167
|
+
chartConfig: qe(o.chartConfig),
|
|
1168
|
+
drilldownChartConfig: qe(o.drilldownChartConfig)
|
|
1030
1169
|
};
|
|
1031
|
-
return new
|
|
1170
|
+
return new V({
|
|
1032
1171
|
...e,
|
|
1033
1172
|
createdAt: new Date(e.createdAt),
|
|
1034
1173
|
updatedAt: new Date(e.updatedAt),
|
|
@@ -1036,7 +1175,7 @@ Enter your markdown content here.`;
|
|
|
1036
1175
|
});
|
|
1037
1176
|
}
|
|
1038
1177
|
}
|
|
1039
|
-
const
|
|
1178
|
+
const be = (r) => {
|
|
1040
1179
|
const t = r.replace(/'''/g, "```").replace(/"""/g, "```").replace(/```(trilogy|sql|json)(\s|\n)/g, "```");
|
|
1041
1180
|
for (const s of ["```\\s*```", "```"]) {
|
|
1042
1181
|
const o = t.match(new RegExp(`${s}([\\s\\S]*)${s}`, "s"));
|
|
@@ -1044,7 +1183,7 @@ const fe = (r) => {
|
|
|
1044
1183
|
return o[o.length - 1];
|
|
1045
1184
|
}
|
|
1046
1185
|
return r;
|
|
1047
|
-
},
|
|
1186
|
+
}, Dr = Y("llmConnections", {
|
|
1048
1187
|
state: () => ({
|
|
1049
1188
|
connections: {},
|
|
1050
1189
|
activeConnection: ""
|
|
@@ -1072,20 +1211,20 @@ const fe = (r) => {
|
|
|
1072
1211
|
throw new Error(`LLM connection with name "${r}" already exists.`);
|
|
1073
1212
|
let s;
|
|
1074
1213
|
if (e === "demo")
|
|
1075
|
-
s = new
|
|
1214
|
+
s = new pt(r, t.model);
|
|
1076
1215
|
else if (e === "anthropic")
|
|
1077
|
-
s = new
|
|
1216
|
+
s = new ke(
|
|
1078
1217
|
r,
|
|
1079
1218
|
t.apiKey,
|
|
1080
1219
|
t.model,
|
|
1081
1220
|
t.saveCredential
|
|
1082
1221
|
);
|
|
1083
1222
|
else if (e === "openai")
|
|
1084
|
-
s = new
|
|
1223
|
+
s = new Me(r, t.apiKey, t.model, t.saveCredential);
|
|
1085
1224
|
else if (e === "google")
|
|
1086
|
-
s = new
|
|
1225
|
+
s = new Le(r, t.apiKey, t.model, t.saveCredential);
|
|
1087
1226
|
else if (e === "openrouter")
|
|
1088
|
-
s = new
|
|
1227
|
+
s = new Pe(
|
|
1089
1228
|
r,
|
|
1090
1229
|
t.apiKey,
|
|
1091
1230
|
t.model,
|
|
@@ -1105,13 +1244,13 @@ const fe = (r) => {
|
|
|
1105
1244
|
let t;
|
|
1106
1245
|
const s = `__temp_${r}_${Date.now()}`;
|
|
1107
1246
|
if (r === "anthropic")
|
|
1108
|
-
t = new
|
|
1247
|
+
t = new ke(s, e, "", !1);
|
|
1109
1248
|
else if (r === "openai")
|
|
1110
|
-
t = new
|
|
1249
|
+
t = new Me(s, e, "", !1);
|
|
1111
1250
|
else if (r === "google")
|
|
1112
|
-
t = new
|
|
1251
|
+
t = new Le(s, e, "", !1);
|
|
1113
1252
|
else if (r === "openrouter")
|
|
1114
|
-
t = new
|
|
1253
|
+
t = new Pe(s, e, "", !1);
|
|
1115
1254
|
else
|
|
1116
1255
|
throw new Error(`LLM provider type "${r}" not found.`);
|
|
1117
1256
|
return await t.reset(), t.models;
|
|
@@ -1135,7 +1274,7 @@ const fe = (r) => {
|
|
|
1135
1274
|
role: "assistant",
|
|
1136
1275
|
content: h.text,
|
|
1137
1276
|
toolCalls: h.toolCalls
|
|
1138
|
-
}), console.log("Initial LLM response:", h.text), l =
|
|
1277
|
+
}), console.log("Initial LLM response:", h.text), l = be(h.text), e)
|
|
1139
1278
|
for (; c < t && !u; )
|
|
1140
1279
|
try {
|
|
1141
1280
|
if (!l || l.trim() == "")
|
|
@@ -1148,8 +1287,8 @@ const fe = (r) => {
|
|
|
1148
1287
|
console.log(`Max attempts (${t}) reached, returning last response`);
|
|
1149
1288
|
break;
|
|
1150
1289
|
}
|
|
1151
|
-
let
|
|
1152
|
-
You had given a response: """${l}""" that failed validation on this error: ${
|
|
1290
|
+
let f = d.message, v = `
|
|
1291
|
+
You had given a response: """${l}""" that failed validation on this error: ${f}. Generate a new response that solves the original request while fixing the error. Ensure the new answer to validate is still enclosed within triple double quotes with no extra content. Put your reasoning on the fix before the quotes.`;
|
|
1153
1292
|
h = await this.generateCompletion(
|
|
1154
1293
|
n,
|
|
1155
1294
|
{
|
|
@@ -1163,7 +1302,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1163
1302
|
role: "assistant",
|
|
1164
1303
|
content: h.text,
|
|
1165
1304
|
toolCalls: h.toolCalls
|
|
1166
|
-
}), l =
|
|
1305
|
+
}), l = be(h.text), console.log(`Attempt ${c}. New extract:`, l);
|
|
1167
1306
|
}
|
|
1168
1307
|
return console.log("Exiting validation loop with attempts:", c), console.log("Final LLM response:", l), {
|
|
1169
1308
|
success: u,
|
|
@@ -1175,11 +1314,11 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1175
1314
|
};
|
|
1176
1315
|
},
|
|
1177
1316
|
async generateDashboardCompletion(r, e = null, t = [], s = 3) {
|
|
1178
|
-
let o =
|
|
1317
|
+
let o = at(r, t);
|
|
1179
1318
|
return this.generateValidatedCompletion(o, e, s).then((i) => i.content);
|
|
1180
1319
|
},
|
|
1181
1320
|
async generateQueryCompletion(r, e, t = null, s = 3, o = null) {
|
|
1182
|
-
let i =
|
|
1321
|
+
let i = it(r, e);
|
|
1183
1322
|
return this.generateValidatedCompletion(i, t, s, o);
|
|
1184
1323
|
},
|
|
1185
1324
|
async generateSQLQueryCompletion(r) {
|
|
@@ -1189,12 +1328,12 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1189
1328
|
success: !0,
|
|
1190
1329
|
prompt: r,
|
|
1191
1330
|
message: e.text,
|
|
1192
|
-
content:
|
|
1331
|
+
content: be(e.text),
|
|
1193
1332
|
attempts: 1
|
|
1194
1333
|
}));
|
|
1195
1334
|
},
|
|
1196
1335
|
async generateFilterQuery(r, e, t = null, s = 3) {
|
|
1197
|
-
let o =
|
|
1336
|
+
let o = nt(r, e);
|
|
1198
1337
|
return this.generateValidatedCompletion(o, t, s).then((i) => i.content);
|
|
1199
1338
|
},
|
|
1200
1339
|
/**
|
|
@@ -1208,7 +1347,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1208
1347
|
const t = this.connections[r];
|
|
1209
1348
|
if (!t)
|
|
1210
1349
|
throw new Error(`LLM connection with name "${r}" not found.`);
|
|
1211
|
-
const s =
|
|
1350
|
+
const s = gt(e), o = t.model, i = t.getFastModel();
|
|
1212
1351
|
try {
|
|
1213
1352
|
i !== o && (t.model = i);
|
|
1214
1353
|
const n = await t.generateCompletion(
|
|
@@ -1220,7 +1359,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1220
1359
|
},
|
|
1221
1360
|
null
|
|
1222
1361
|
);
|
|
1223
|
-
return
|
|
1362
|
+
return yt(n.text);
|
|
1224
1363
|
} finally {
|
|
1225
1364
|
i !== o && (t.model = o);
|
|
1226
1365
|
}
|
|
@@ -1245,7 +1384,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
|
|
|
1245
1384
|
hasActiveDefaultConnection: (r) => Object.values(r.connections).some((e) => e.isDefault && e.connected)
|
|
1246
1385
|
}
|
|
1247
1386
|
});
|
|
1248
|
-
class
|
|
1387
|
+
class Nt {
|
|
1249
1388
|
constructor(e, t, s, o, i, n, a = {}) {
|
|
1250
1389
|
w(this, "queryQueue", /* @__PURE__ */ new Map());
|
|
1251
1390
|
w(this, "activeQueries", /* @__PURE__ */ new Set());
|
|
@@ -1328,51 +1467,55 @@ class At {
|
|
|
1328
1467
|
* Queue a single query for execution
|
|
1329
1468
|
*/
|
|
1330
1469
|
runSingle(e) {
|
|
1331
|
-
let t = this.getItemData(e, this.dashboardId)
|
|
1332
|
-
|
|
1470
|
+
let t = this.getItemData(e, this.dashboardId);
|
|
1471
|
+
const s = this.getItemData(e, this.dashboardId).filters || [];
|
|
1472
|
+
let o = s.map((l) => l.value);
|
|
1473
|
+
const i = Object.assign(
|
|
1474
|
+
{},
|
|
1475
|
+
...s.map((l) => l.parameters || {})
|
|
1333
1476
|
);
|
|
1334
1477
|
this.setItemData(e, this.dashboardId, {
|
|
1335
1478
|
loading: !0,
|
|
1336
1479
|
error: null
|
|
1337
1480
|
});
|
|
1338
|
-
let
|
|
1481
|
+
let n = {
|
|
1339
1482
|
dashboardId: this.dashboardId,
|
|
1340
1483
|
queryInput: {
|
|
1341
1484
|
text: t.structured_content ? t.structured_content.query : t.content,
|
|
1342
|
-
extraFilters:
|
|
1343
|
-
parameters: t.parameters || {},
|
|
1485
|
+
extraFilters: o,
|
|
1486
|
+
parameters: { ...t.parameters || {}, ...i },
|
|
1344
1487
|
extraContent: t.rootContent || []
|
|
1345
1488
|
},
|
|
1346
1489
|
priority: this.getDefaultPriority(e),
|
|
1347
1490
|
itemId: e,
|
|
1348
|
-
onSuccess: (
|
|
1349
|
-
this.isLatestQueryForItem(
|
|
1350
|
-
results:
|
|
1491
|
+
onSuccess: (l) => {
|
|
1492
|
+
this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, {
|
|
1493
|
+
results: l.results
|
|
1351
1494
|
}) : console.log(`Ignoring outdated query result for itemId ${e}`);
|
|
1352
1495
|
},
|
|
1353
|
-
onError: (
|
|
1354
|
-
this.isLatestQueryForItem(
|
|
1496
|
+
onError: (l) => {
|
|
1497
|
+
this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, { error: l }) : console.log(`Ignoring outdated query error for itemId ${e}`);
|
|
1355
1498
|
},
|
|
1356
|
-
onProgress: (
|
|
1499
|
+
onProgress: (l) => {
|
|
1357
1500
|
}
|
|
1358
1501
|
};
|
|
1359
|
-
const
|
|
1502
|
+
const a = this.generateQueryId(n);
|
|
1360
1503
|
this.cancelPendingQueriesForItem(e);
|
|
1361
|
-
const
|
|
1362
|
-
let
|
|
1363
|
-
if (
|
|
1364
|
-
console.log(`Deduplicating query for ${
|
|
1504
|
+
const c = this.findDuplicateQuery(n);
|
|
1505
|
+
let u;
|
|
1506
|
+
if (c)
|
|
1507
|
+
console.log(`Deduplicating query for ${n.itemId}`), u = c.id, this.addCallbacksToExistingQuery(c, n);
|
|
1365
1508
|
else {
|
|
1366
|
-
|
|
1367
|
-
const
|
|
1368
|
-
...
|
|
1369
|
-
id:
|
|
1509
|
+
u = a;
|
|
1510
|
+
const l = {
|
|
1511
|
+
...n,
|
|
1512
|
+
id: u,
|
|
1370
1513
|
timestamp: Date.now(),
|
|
1371
1514
|
retryCount: 0
|
|
1372
1515
|
};
|
|
1373
|
-
this.queryQueue.set(
|
|
1516
|
+
this.queryQueue.set(u, l), this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${n.itemId}`), this.executeQuery(u));
|
|
1374
1517
|
}
|
|
1375
|
-
return this.latestQueryByItemId.set(e,
|
|
1518
|
+
return this.latestQueryByItemId.set(e, u), this.itemIdByQueryId.set(u, e), u;
|
|
1376
1519
|
}
|
|
1377
1520
|
/**
|
|
1378
1521
|
* Queue multiple queries for batch execution with prioritization
|
|
@@ -1380,7 +1523,15 @@ class At {
|
|
|
1380
1523
|
runBatch(e) {
|
|
1381
1524
|
const t = [];
|
|
1382
1525
|
return this.batchTimeout && clearTimeout(this.batchTimeout), e.forEach((s) => {
|
|
1383
|
-
let o = this.getItemData(s, this.dashboardId)
|
|
1526
|
+
let o = this.getItemData(s, this.dashboardId);
|
|
1527
|
+
const i = o.filters || [];
|
|
1528
|
+
let n = i.map((f) => f.value);
|
|
1529
|
+
const a = Object.assign(
|
|
1530
|
+
{},
|
|
1531
|
+
...i.map(
|
|
1532
|
+
(f) => f.parameters || {}
|
|
1533
|
+
)
|
|
1534
|
+
);
|
|
1384
1535
|
if (o.structured_content.query.trim().length === 0) {
|
|
1385
1536
|
this.setItemData(s, this.dashboardId, {
|
|
1386
1537
|
error: null,
|
|
@@ -1392,44 +1543,44 @@ class At {
|
|
|
1392
1543
|
loading: !0,
|
|
1393
1544
|
error: null
|
|
1394
1545
|
});
|
|
1395
|
-
let
|
|
1546
|
+
let u = {
|
|
1396
1547
|
dashboardId: this.dashboardId,
|
|
1397
1548
|
queryInput: {
|
|
1398
1549
|
text: o.structured_content ? o.structured_content.query : o.content,
|
|
1399
|
-
extraFilters:
|
|
1400
|
-
parameters: o.parameters || {},
|
|
1550
|
+
extraFilters: n,
|
|
1551
|
+
parameters: { ...o.parameters || {}, ...a },
|
|
1401
1552
|
extraContent: o.rootContent || []
|
|
1402
1553
|
},
|
|
1403
1554
|
priority: this.getDefaultPriority(s),
|
|
1404
1555
|
itemId: s,
|
|
1405
|
-
onSuccess: (
|
|
1406
|
-
this.isLatestQueryForItem(
|
|
1407
|
-
results:
|
|
1556
|
+
onSuccess: (f) => {
|
|
1557
|
+
this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, {
|
|
1558
|
+
results: f.results
|
|
1408
1559
|
}) : console.log(`Ignoring outdated batch query result for itemId ${s}`);
|
|
1409
1560
|
},
|
|
1410
|
-
onError: (
|
|
1411
|
-
this.isLatestQueryForItem(
|
|
1561
|
+
onError: (f) => {
|
|
1562
|
+
this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, { error: f }) : console.log(`Ignoring outdated batch query error for itemId ${s}`);
|
|
1412
1563
|
},
|
|
1413
|
-
onProgress: (
|
|
1564
|
+
onProgress: (f) => {
|
|
1414
1565
|
}
|
|
1415
1566
|
};
|
|
1416
|
-
const
|
|
1567
|
+
const l = this.generateQueryId(u);
|
|
1417
1568
|
this.cancelPendingQueriesForItem(s);
|
|
1418
|
-
const
|
|
1419
|
-
let
|
|
1420
|
-
if (
|
|
1421
|
-
console.log(`Deduplicating batch query for ${
|
|
1569
|
+
const h = this.findDuplicateQuery(u);
|
|
1570
|
+
let d;
|
|
1571
|
+
if (h)
|
|
1572
|
+
console.log(`Deduplicating batch query for ${u.itemId}`), d = h.id, this.addCallbacksToExistingQuery(h, u);
|
|
1422
1573
|
else {
|
|
1423
|
-
|
|
1424
|
-
const
|
|
1425
|
-
...
|
|
1426
|
-
id:
|
|
1574
|
+
d = l;
|
|
1575
|
+
const f = {
|
|
1576
|
+
...u,
|
|
1577
|
+
id: d,
|
|
1427
1578
|
timestamp: Date.now(),
|
|
1428
1579
|
retryCount: 0
|
|
1429
1580
|
};
|
|
1430
|
-
this.queryQueue.set(
|
|
1581
|
+
this.queryQueue.set(d, f);
|
|
1431
1582
|
}
|
|
1432
|
-
this.latestQueryByItemId.set(s,
|
|
1583
|
+
this.latestQueryByItemId.set(s, d), this.itemIdByQueryId.set(d, s), t.push(d);
|
|
1433
1584
|
}), this.batchTimeout = setTimeout(() => {
|
|
1434
1585
|
this.processBatch();
|
|
1435
1586
|
}, this.batchDelay), t;
|
|
@@ -1516,8 +1667,8 @@ class At {
|
|
|
1516
1667
|
o.map((l) => [
|
|
1517
1668
|
l.label,
|
|
1518
1669
|
(h) => {
|
|
1519
|
-
var
|
|
1520
|
-
(
|
|
1670
|
+
var f;
|
|
1671
|
+
(f = i.find((v) => v.id === l.label)) == null || f.onSuccess(h);
|
|
1521
1672
|
const d = this.queryWaiters.get(l.label);
|
|
1522
1673
|
d && (d.resolve(h), this.queryWaiters.delete(l.label)), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
|
|
1523
1674
|
}
|
|
@@ -1526,7 +1677,7 @@ class At {
|
|
|
1526
1677
|
o.map((l) => [
|
|
1527
1678
|
l.label,
|
|
1528
1679
|
(h) => {
|
|
1529
|
-
let d = i.find((
|
|
1680
|
+
let d = i.find((f) => f.id === l.label);
|
|
1530
1681
|
d && this.handleQueryError(d, h), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
|
|
1531
1682
|
}
|
|
1532
1683
|
])
|
|
@@ -1614,7 +1765,7 @@ class At {
|
|
|
1614
1765
|
}
|
|
1615
1766
|
}
|
|
1616
1767
|
}
|
|
1617
|
-
const
|
|
1768
|
+
const Rt = (r) => r.replace(/\s+/g, ""), Jt = Y("dashboards", {
|
|
1618
1769
|
state: () => ({
|
|
1619
1770
|
dashboards: {},
|
|
1620
1771
|
activeDashboardId: "",
|
|
@@ -1638,7 +1789,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1638
1789
|
throw new Error(`Dashboard with ID "${r}" not found.`);
|
|
1639
1790
|
if (this.queryExecutors[r])
|
|
1640
1791
|
return this.queryExecutors[r];
|
|
1641
|
-
const t = new
|
|
1792
|
+
const t = new Nt(
|
|
1642
1793
|
e.queryExecutionService,
|
|
1643
1794
|
e.connectionName,
|
|
1644
1795
|
e.dashboardId,
|
|
@@ -1682,7 +1833,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1682
1833
|
const t = r;
|
|
1683
1834
|
if (Object.values(this.dashboards).some((o) => o.name === r))
|
|
1684
1835
|
throw new Error(`A dashboard with name ${r} already exists.`);
|
|
1685
|
-
const s = new
|
|
1836
|
+
const s = new V({
|
|
1686
1837
|
id: t,
|
|
1687
1838
|
name: r,
|
|
1688
1839
|
connection: e,
|
|
@@ -1698,7 +1849,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1698
1849
|
let t = `${e.name} (copy)`, s = 1;
|
|
1699
1850
|
for (; Object.values(this.dashboards).some((i) => i.name === t); )
|
|
1700
1851
|
t = `${e.name} (copy ${s})`, s++;
|
|
1701
|
-
const o = new
|
|
1852
|
+
const o = new V({
|
|
1702
1853
|
id: t,
|
|
1703
1854
|
name: t,
|
|
1704
1855
|
connection: e.connection,
|
|
@@ -1728,7 +1879,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1728
1879
|
// Load dashboards from serialized data
|
|
1729
1880
|
loadDashboards(r) {
|
|
1730
1881
|
Object.entries(r).forEach(([e, t]) => {
|
|
1731
|
-
this.dashboards[e] =
|
|
1882
|
+
this.dashboards[e] = V.fromSerialized(t);
|
|
1732
1883
|
});
|
|
1733
1884
|
},
|
|
1734
1885
|
removeAllFilters(r) {
|
|
@@ -1765,7 +1916,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1765
1916
|
updateDashboardFilter(r, e) {
|
|
1766
1917
|
if (this.dashboards[r]) {
|
|
1767
1918
|
let t = this.dashboards[r].filter;
|
|
1768
|
-
return (!e ||
|
|
1919
|
+
return (!e || Rt(e) === "") && (this.dashboards[r].filter = null, t != null) ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : (this.dashboards[r].filter = e, t !== e ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : []);
|
|
1769
1920
|
} else
|
|
1770
1921
|
throw new Error(`Dashboard with ID "${r}" not found.`);
|
|
1771
1922
|
},
|
|
@@ -1948,7 +2099,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1948
2099
|
const s = this.dashboards[r];
|
|
1949
2100
|
if (s) {
|
|
1950
2101
|
for (const i of Object.values(s.gridItems))
|
|
1951
|
-
if (i.type ===
|
|
2102
|
+
if (i.type === L.CHART || i.type === L.TABLE) {
|
|
1952
2103
|
const n = typeof i.content == "string" ? i.content : ((o = i.content) == null ? void 0 : o.query) || "";
|
|
1953
2104
|
await (e == null ? void 0 : e.generateQuery(s.connection, {
|
|
1954
2105
|
text: n,
|
|
@@ -1996,7 +2147,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
1996
2147
|
);
|
|
1997
2148
|
if (!s)
|
|
1998
2149
|
throw new Error(`No completion items found for dashboard ID "${r}".`);
|
|
1999
|
-
return
|
|
2150
|
+
return bt(s);
|
|
2000
2151
|
},
|
|
2001
2152
|
async generatePromptSpec(r, e, t, s) {
|
|
2002
2153
|
let o = await this.populateAIConcepts(
|
|
@@ -2005,13 +2156,13 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2005
2156
|
s
|
|
2006
2157
|
), i = await e.generateDashboardCompletion(
|
|
2007
2158
|
r,
|
|
2008
|
-
|
|
2159
|
+
_e,
|
|
2009
2160
|
o,
|
|
2010
2161
|
3
|
|
2011
2162
|
);
|
|
2012
2163
|
if (!i)
|
|
2013
2164
|
throw new Error("No response from LLM");
|
|
2014
|
-
return
|
|
2165
|
+
return _e(i);
|
|
2015
2166
|
},
|
|
2016
2167
|
async populateFromPromptSpec(r, e, t, s, o) {
|
|
2017
2168
|
let i = this.dashboards[r];
|
|
@@ -2027,15 +2178,15 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2027
2178
|
text: u,
|
|
2028
2179
|
editorType: "trilogy",
|
|
2029
2180
|
imports: i.imports,
|
|
2030
|
-
extraContent: i.imports.map((
|
|
2181
|
+
extraContent: i.imports.map((f) => {
|
|
2031
2182
|
var v, m;
|
|
2032
2183
|
return {
|
|
2033
|
-
alias:
|
|
2034
|
-
contents: ((v = o.editors[
|
|
2184
|
+
alias: f.name,
|
|
2185
|
+
contents: ((v = o.editors[f.id]) == null ? void 0 : v.contents) || ((m = o.editors[f.name]) == null ? void 0 : m.contents) || ""
|
|
2035
2186
|
};
|
|
2036
2187
|
})
|
|
2037
|
-
}, h = (
|
|
2038
|
-
throw
|
|
2188
|
+
}, h = (f) => {
|
|
2189
|
+
throw f;
|
|
2039
2190
|
};
|
|
2040
2191
|
return await (await s.executeQuery(
|
|
2041
2192
|
i.connection,
|
|
@@ -2056,8 +2207,8 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2056
2207
|
let c = /* @__PURE__ */ new Map();
|
|
2057
2208
|
for (const u of e.layout) {
|
|
2058
2209
|
let l = e.gridItems[u.id], h = l.content, d = l.type.toLowerCase();
|
|
2059
|
-
[
|
|
2060
|
-
let
|
|
2210
|
+
[L.CHART, L.TABLE].includes(d) && (h = `Placeholder, prompt: ${h}`);
|
|
2211
|
+
let f = this.addItemToDashboard(
|
|
2061
2212
|
r,
|
|
2062
2213
|
"markdown",
|
|
2063
2214
|
u.x,
|
|
@@ -2067,28 +2218,28 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2067
2218
|
h,
|
|
2068
2219
|
l.name
|
|
2069
2220
|
);
|
|
2070
|
-
c.set(
|
|
2221
|
+
c.set(f, { type: d, content: h });
|
|
2071
2222
|
}
|
|
2072
2223
|
for (const u of c) {
|
|
2073
2224
|
let l = u[0], h = u[1], d = h.content;
|
|
2074
|
-
[
|
|
2225
|
+
[L.CHART, L.TABLE].includes(h.type) && (d = (await t.generateQueryCompletion(h.content, n, a)).content || "No query could be generated"), await this.updateItemContent(r, l, d), await this.updateItemType(r, l, h.type);
|
|
2075
2226
|
}
|
|
2076
2227
|
}
|
|
2077
2228
|
}
|
|
2078
|
-
}),
|
|
2079
|
-
if (
|
|
2229
|
+
}), Je = (r) => new Promise((e) => setTimeout(e, r)), Bt = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ new Set(), Ke = (r) => {
|
|
2230
|
+
if (Bt.has(r))
|
|
2080
2231
|
return !0;
|
|
2081
2232
|
let e = r;
|
|
2082
2233
|
r.includes("://") || (e = `http://${r}`);
|
|
2083
2234
|
try {
|
|
2084
2235
|
const t = new URL(e), s = t.host, o = t.hostname;
|
|
2085
|
-
if (
|
|
2236
|
+
if (Be.has(s) || Be.has(o))
|
|
2086
2237
|
return !0;
|
|
2087
2238
|
} catch {
|
|
2088
2239
|
}
|
|
2089
2240
|
return !1;
|
|
2090
|
-
},
|
|
2091
|
-
if (
|
|
2241
|
+
}, de = async (r, e, t = 5, s = 1e3) => {
|
|
2242
|
+
if (Ke(r))
|
|
2092
2243
|
throw new Error(
|
|
2093
2244
|
`Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
|
|
2094
2245
|
);
|
|
@@ -2101,12 +2252,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2101
2252
|
let c = a ? parseInt(a) * 1e3 : i;
|
|
2102
2253
|
console.log(
|
|
2103
2254
|
`Rate limited. Retrying after ${c}ms (Attempt ${o + 1}/${t})`
|
|
2104
|
-
), await
|
|
2255
|
+
), await Je(c), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
|
|
2105
2256
|
continue;
|
|
2106
2257
|
}
|
|
2107
2258
|
return n;
|
|
2108
2259
|
} catch (n) {
|
|
2109
|
-
if (
|
|
2260
|
+
if (Ke(r))
|
|
2110
2261
|
throw new Error(
|
|
2111
2262
|
`Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
|
|
2112
2263
|
);
|
|
@@ -2115,9 +2266,9 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2115
2266
|
throw n;
|
|
2116
2267
|
console.log(
|
|
2117
2268
|
`Network error, retrying after ${i}ms (Attempt ${o + 1}/${t})`
|
|
2118
|
-
), await
|
|
2269
|
+
), await Je(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
|
|
2119
2270
|
}
|
|
2120
|
-
},
|
|
2271
|
+
}, Kt = (r, e, t, s, o) => r.filter((i) => {
|
|
2121
2272
|
const n = i.name.toLowerCase().includes(e.toLowerCase()), a = !t || i.engine === t;
|
|
2122
2273
|
let c = !0;
|
|
2123
2274
|
if (s !== "all") {
|
|
@@ -2125,7 +2276,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2125
2276
|
c = s === "imported" && u || s === "not-imported" && !u;
|
|
2126
2277
|
}
|
|
2127
2278
|
return n && a && c;
|
|
2128
|
-
}),
|
|
2279
|
+
}), xr = (r) => {
|
|
2129
2280
|
switch (r) {
|
|
2130
2281
|
case "bigquery":
|
|
2131
2282
|
return "new-bigquery-oauth";
|
|
@@ -2134,36 +2285,36 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2134
2285
|
default:
|
|
2135
2286
|
return `new-${r}`;
|
|
2136
2287
|
}
|
|
2137
|
-
},
|
|
2288
|
+
}, Ut = (r) => {
|
|
2138
2289
|
const e = /* @__PURE__ */ new Set();
|
|
2139
2290
|
return r.forEach((t) => {
|
|
2140
2291
|
t.engine && e.add(t.engine);
|
|
2141
2292
|
}), Array.from(e).sort();
|
|
2142
|
-
},
|
|
2293
|
+
}, ne = {
|
|
2143
2294
|
type: "github",
|
|
2144
2295
|
id: "trilogy-data-trilogy-public-models-main",
|
|
2145
2296
|
name: "Trilogy Public Models",
|
|
2146
2297
|
owner: "trilogy-data",
|
|
2147
2298
|
repo: "trilogy-public-models",
|
|
2148
2299
|
branch: "main"
|
|
2149
|
-
},
|
|
2300
|
+
}, Ye = (r) => {
|
|
2150
2301
|
if (r)
|
|
2151
2302
|
return {
|
|
2152
2303
|
headers: {
|
|
2153
2304
|
"X-Trilogy-Token": r
|
|
2154
2305
|
}
|
|
2155
2306
|
};
|
|
2156
|
-
},
|
|
2157
|
-
const e = `${r.baseUrl}/index.json`, t = await
|
|
2307
|
+
}, zt = async (r) => {
|
|
2308
|
+
const e = `${r.baseUrl}/index.json`, t = await de(e, Ye(r.token));
|
|
2158
2309
|
if (!t.ok)
|
|
2159
2310
|
throw new Error(`Failed to fetch store index: ${t.status} ${t.statusText}`);
|
|
2160
2311
|
return t.json();
|
|
2161
|
-
},
|
|
2312
|
+
}, Ht = async (r) => {
|
|
2162
2313
|
let e = null, t = [];
|
|
2163
2314
|
try {
|
|
2164
|
-
const o = (await
|
|
2315
|
+
const o = (await zt(r)).models.map(async (n) => {
|
|
2165
2316
|
try {
|
|
2166
|
-
const a = await
|
|
2317
|
+
const a = await de(n.url, Ye(r.token));
|
|
2167
2318
|
if (!a.ok)
|
|
2168
2319
|
return console.warn(`Failed to fetch model ${n.name}: ${a.statusText}`), null;
|
|
2169
2320
|
const c = await a.json();
|
|
@@ -2177,12 +2328,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2177
2328
|
s instanceof Error ? e = s.message : e = "Error fetching store data", console.error("Error fetching from generic store:", s);
|
|
2178
2329
|
}
|
|
2179
2330
|
return { files: t, error: e };
|
|
2180
|
-
},
|
|
2331
|
+
}, Wt = async (r) => {
|
|
2181
2332
|
let e = null, t = [];
|
|
2182
2333
|
try {
|
|
2183
2334
|
let s, o;
|
|
2184
2335
|
r.owner === "trilogy-data" && r.repo === "trilogy-public-models" ? (s = "https://trilogy-data.github.io/trilogy-public-models/studio/index.json", o = "https://trilogy-data.github.io/trilogy-public-models/studio/") : (s = `https://api.github.com/repos/${r.owner}/${r.repo}/contents/studio/index.json?ref=${r.branch}`, o = `https://raw.githubusercontent.com/${r.owner}/${r.repo}/${r.branch}/studio/`);
|
|
2185
|
-
const i = await
|
|
2336
|
+
const i = await de(s);
|
|
2186
2337
|
if (i.status !== 200)
|
|
2187
2338
|
throw new Error(`Error fetching community data: ${await i.text()}`);
|
|
2188
2339
|
let n;
|
|
@@ -2193,7 +2344,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2193
2344
|
n = JSON.parse(atob(c.content));
|
|
2194
2345
|
}
|
|
2195
2346
|
const a = n.files.filter((c) => c.filename.endsWith(".json")).map(async (c) => {
|
|
2196
|
-
const u = `${o}${c.filename}`, l = await
|
|
2347
|
+
const u = `${o}${c.filename}`, l = await de(u);
|
|
2197
2348
|
if (!l.ok)
|
|
2198
2349
|
throw new Error(`Error fetching file ${c.filename}: ${l.statusText}`);
|
|
2199
2350
|
const h = await l.json();
|
|
@@ -2204,12 +2355,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2204
2355
|
s instanceof Error ? e = s.message : e = "Error fetching files", console.error("Error fetching from GitHub store:", s);
|
|
2205
2356
|
}
|
|
2206
2357
|
return { files: t, error: e };
|
|
2207
|
-
},
|
|
2358
|
+
}, Xe = async (r) => r.type === "github" ? Wt(r) : Ht(r), Gt = async (r, e) => {
|
|
2208
2359
|
const t = {}, s = {};
|
|
2209
2360
|
return await Promise.all(
|
|
2210
2361
|
r.map(async (o) => {
|
|
2211
2362
|
try {
|
|
2212
|
-
const { files: i, error: n } = await
|
|
2363
|
+
const { files: i, error: n } = await Xe(o);
|
|
2213
2364
|
t[o.id] = i, n && (s[o.id] = n), e && e(o.id, { files: i, error: n });
|
|
2214
2365
|
} catch (i) {
|
|
2215
2366
|
const n = i instanceof Error ? i.message : "Unknown error";
|
|
@@ -2217,29 +2368,29 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2217
2368
|
}
|
|
2218
2369
|
})
|
|
2219
2370
|
), { filesByStore: t, errors: s };
|
|
2220
|
-
},
|
|
2371
|
+
}, xe = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), K = (r) => r.replace(/\/$/, ""), Ue = (r) => K(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), Te = (r) => {
|
|
2221
2372
|
try {
|
|
2222
|
-
const e = new URL(
|
|
2223
|
-
return
|
|
2373
|
+
const e = new URL(K(r));
|
|
2374
|
+
return xe(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
|
|
2224
2375
|
} catch {
|
|
2225
|
-
return
|
|
2376
|
+
return xe(K(r));
|
|
2226
2377
|
}
|
|
2227
|
-
},
|
|
2378
|
+
}, Ze = (r) => xe(r.name || Te(r.baseUrl)), Tr = (r) => Ze(r), $r = (r) => Ze(r), ze = "trilogy-community-stores", He = (r) => {
|
|
2228
2379
|
const e = new URLSearchParams(window.location.search), t = e.get("store"), s = e.get("token");
|
|
2229
2380
|
if (!t || !s)
|
|
2230
2381
|
return;
|
|
2231
|
-
const o =
|
|
2232
|
-
(n) => n.type === "generic" &&
|
|
2382
|
+
const o = K(t), i = r.find(
|
|
2383
|
+
(n) => n.type === "generic" && K(n.baseUrl) === o
|
|
2233
2384
|
);
|
|
2234
2385
|
i && !i.token && (i.token = s);
|
|
2235
|
-
},
|
|
2386
|
+
}, le = Y("communityApi", {
|
|
2236
2387
|
state: () => ({
|
|
2237
2388
|
// Initialize with default store
|
|
2238
|
-
stores: [
|
|
2389
|
+
stores: [ne],
|
|
2239
2390
|
filesByStore: {},
|
|
2240
2391
|
errors: {},
|
|
2241
2392
|
// Initialize default store status as idle
|
|
2242
|
-
storeStatus: { [
|
|
2393
|
+
storeStatus: { [ne.id]: "idle" },
|
|
2243
2394
|
loading: !1,
|
|
2244
2395
|
// Modal state
|
|
2245
2396
|
showAddStoreModal: !1,
|
|
@@ -2266,7 +2417,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2266
2417
|
const e = [];
|
|
2267
2418
|
return Object.values(r.filesByStore).forEach((t) => {
|
|
2268
2419
|
e.push(...t);
|
|
2269
|
-
}),
|
|
2420
|
+
}), Ut(e);
|
|
2270
2421
|
},
|
|
2271
2422
|
// Check if any store has errors
|
|
2272
2423
|
hasErrors: (r) => Object.keys(r.errors).length > 0,
|
|
@@ -2286,7 +2437,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2286
2437
|
*/
|
|
2287
2438
|
loadStoresFromStorage() {
|
|
2288
2439
|
try {
|
|
2289
|
-
const r = localStorage.getItem(
|
|
2440
|
+
const r = localStorage.getItem(ze);
|
|
2290
2441
|
if (r) {
|
|
2291
2442
|
const e = JSON.parse(r), t = new Map(this.stores.map((n) => [n.id, n])), s = e.map((n) => {
|
|
2292
2443
|
const a = t.get(n.id);
|
|
@@ -2304,14 +2455,14 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2304
2455
|
...n,
|
|
2305
2456
|
...a
|
|
2306
2457
|
};
|
|
2307
|
-
}), i = [
|
|
2458
|
+
}), i = [ne, ...s].filter(
|
|
2308
2459
|
(n, a, c) => a === c.findIndex((u) => u.id === n.id)
|
|
2309
2460
|
);
|
|
2310
|
-
|
|
2461
|
+
He(i), this.stores = i, i.forEach((n) => {
|
|
2311
2462
|
this.storeStatus[n.id] || (this.storeStatus[n.id] = "idle");
|
|
2312
2463
|
});
|
|
2313
2464
|
}
|
|
2314
|
-
r ||
|
|
2465
|
+
r || He(this.stores);
|
|
2315
2466
|
} catch (r) {
|
|
2316
2467
|
console.error("Error loading stores from localStorage:", r);
|
|
2317
2468
|
}
|
|
@@ -2321,13 +2472,13 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2321
2472
|
*/
|
|
2322
2473
|
saveStoresToStorage() {
|
|
2323
2474
|
try {
|
|
2324
|
-
const r = this.stores.filter((e) => e.id !==
|
|
2475
|
+
const r = this.stores.filter((e) => e.id !== ne.id).map((e) => {
|
|
2325
2476
|
if (e.type !== "generic")
|
|
2326
2477
|
return e;
|
|
2327
2478
|
const { token: t, ...s } = e;
|
|
2328
2479
|
return s;
|
|
2329
2480
|
});
|
|
2330
|
-
localStorage.setItem(
|
|
2481
|
+
localStorage.setItem(ze, JSON.stringify(r));
|
|
2331
2482
|
} catch (r) {
|
|
2332
2483
|
console.error("Error saving stores to localStorage:", r);
|
|
2333
2484
|
}
|
|
@@ -2343,7 +2494,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2343
2494
|
console.log(
|
|
2344
2495
|
`Fetching community model files from ${this.stores.map((e) => e.id).join(", ")}...`
|
|
2345
2496
|
);
|
|
2346
|
-
const r = await
|
|
2497
|
+
const r = await Gt(this.stores, (e, t) => {
|
|
2347
2498
|
this.filesByStore[e] = t.files, t.error ? (this.errors[e] = t.error, this.storeStatus[e] = "failed") : this.storeStatus[e] = "connected", console.log(`Store ${e} completed: ${t.error ? "failed" : "success"}`);
|
|
2348
2499
|
});
|
|
2349
2500
|
console.log("All stores fetched:", r);
|
|
@@ -2364,7 +2515,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2364
2515
|
if (e) {
|
|
2365
2516
|
this.loading = !0, this.storeStatus[r] = "idle";
|
|
2366
2517
|
try {
|
|
2367
|
-
const t = await
|
|
2518
|
+
const t = await Xe(e);
|
|
2368
2519
|
this.filesByStore[r] = t.files, t.error ? (this.errors[r] = t.error, this.storeStatus[r] = "failed") : (delete this.errors[r], this.storeStatus[r] = "connected");
|
|
2369
2520
|
} finally {
|
|
2370
2521
|
this.loading = !1;
|
|
@@ -2377,7 +2528,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2377
2528
|
filteredFiles(r, e, t, s, o = null) {
|
|
2378
2529
|
const i = (a) => a in s.models;
|
|
2379
2530
|
let n = this.allFiles;
|
|
2380
|
-
return o && (n = this.filesByStore[o]), n ?
|
|
2531
|
+
return o && (n = this.filesByStore[o]), n ? Kt(n, r, e, t, i) : [];
|
|
2381
2532
|
},
|
|
2382
2533
|
/**
|
|
2383
2534
|
* Get files from a specific store
|
|
@@ -2398,7 +2549,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2398
2549
|
if (r.type === "generic") {
|
|
2399
2550
|
if (!r.baseUrl)
|
|
2400
2551
|
throw new Error("Base URL is required for generic stores");
|
|
2401
|
-
r.baseUrl =
|
|
2552
|
+
r.baseUrl = K(r.baseUrl), r.id = r.id || Ue(r.baseUrl), r.name = r.name || Te(r.baseUrl);
|
|
2402
2553
|
} else if (r.type === "github" && (!r.owner || !r.repo || !r.branch))
|
|
2403
2554
|
throw new Error("Owner, repo, and branch are required for GitHub stores");
|
|
2404
2555
|
if (this.stores.some((t) => t.id === r.id))
|
|
@@ -2459,10 +2610,10 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2459
2610
|
if (r === "generic") {
|
|
2460
2611
|
if (!t)
|
|
2461
2612
|
throw new Error("Please fill in all required fields");
|
|
2462
|
-
const n =
|
|
2613
|
+
const n = K(t), c = {
|
|
2463
2614
|
type: "generic",
|
|
2464
|
-
id:
|
|
2465
|
-
name: e ||
|
|
2615
|
+
id: Ue(n),
|
|
2616
|
+
name: e || Te(n),
|
|
2466
2617
|
baseUrl: n
|
|
2467
2618
|
};
|
|
2468
2619
|
await this.addStore(c);
|
|
@@ -2501,20 +2652,20 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
|
|
|
2501
2652
|
}
|
|
2502
2653
|
}
|
|
2503
2654
|
});
|
|
2504
|
-
class
|
|
2655
|
+
class $e extends Error {
|
|
2505
2656
|
constructor(t, s) {
|
|
2506
2657
|
super(t);
|
|
2507
2658
|
w(this, "status");
|
|
2508
2659
|
this.name = "JobsServiceError", this.status = s;
|
|
2509
2660
|
}
|
|
2510
2661
|
}
|
|
2511
|
-
const
|
|
2662
|
+
const I = (r, e = {}) => {
|
|
2512
2663
|
const t = new Headers(e.headers);
|
|
2513
2664
|
return r && t.set("X-Trilogy-Token", r), {
|
|
2514
2665
|
...e,
|
|
2515
2666
|
headers: t
|
|
2516
2667
|
};
|
|
2517
|
-
},
|
|
2668
|
+
}, Ae = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), N = async (r, e) => {
|
|
2518
2669
|
if (r.ok)
|
|
2519
2670
|
return r;
|
|
2520
2671
|
let t = "";
|
|
@@ -2527,36 +2678,36 @@ const P = (r, e = {}) => {
|
|
|
2527
2678
|
} catch {
|
|
2528
2679
|
t = "";
|
|
2529
2680
|
}
|
|
2530
|
-
throw new
|
|
2531
|
-
},
|
|
2681
|
+
throw new $e(t || e, r.status);
|
|
2682
|
+
}, Vt = async (r) => {
|
|
2532
2683
|
const e = await fetch(
|
|
2533
2684
|
`${r.baseUrl}/files`,
|
|
2534
|
-
|
|
2685
|
+
I(r.token, {
|
|
2535
2686
|
method: "GET"
|
|
2536
2687
|
})
|
|
2537
2688
|
);
|
|
2538
|
-
return await
|
|
2539
|
-
},
|
|
2540
|
-
const t =
|
|
2689
|
+
return await N(e, `Failed to fetch files for ${r.name}`), e.json();
|
|
2690
|
+
}, Ar = async (r, e) => {
|
|
2691
|
+
const t = Ae(e), s = await fetch(
|
|
2541
2692
|
`${r.baseUrl}/files/${t}`,
|
|
2542
|
-
|
|
2693
|
+
I(r.token, {
|
|
2543
2694
|
method: "GET"
|
|
2544
2695
|
})
|
|
2545
2696
|
);
|
|
2546
2697
|
if (s.ok)
|
|
2547
2698
|
return s.text();
|
|
2548
|
-
s.status !== 404 && await
|
|
2699
|
+
s.status !== 404 && await N(s, `Failed to fetch ${e}`);
|
|
2549
2700
|
const o = await fetch(
|
|
2550
2701
|
`${r.baseUrl}/${t}`,
|
|
2551
|
-
|
|
2702
|
+
I(r.token, {
|
|
2552
2703
|
method: "GET"
|
|
2553
2704
|
})
|
|
2554
2705
|
);
|
|
2555
|
-
return await
|
|
2556
|
-
},
|
|
2706
|
+
return await N(o, `Failed to fetch ${e}`), o.text();
|
|
2707
|
+
}, Fr = async (r, e, t) => {
|
|
2557
2708
|
const s = await fetch(
|
|
2558
2709
|
`${r.baseUrl}/files`,
|
|
2559
|
-
|
|
2710
|
+
I(r.token, {
|
|
2560
2711
|
method: "POST",
|
|
2561
2712
|
headers: {
|
|
2562
2713
|
"Content-Type": "application/json"
|
|
@@ -2564,11 +2715,11 @@ const P = (r, e = {}) => {
|
|
|
2564
2715
|
body: JSON.stringify({ path: e, content: t })
|
|
2565
2716
|
})
|
|
2566
2717
|
);
|
|
2567
|
-
await
|
|
2568
|
-
},
|
|
2718
|
+
await N(s, `Failed to create ${e}`);
|
|
2719
|
+
}, _r = async (r, e, t) => {
|
|
2569
2720
|
const s = await fetch(
|
|
2570
|
-
`${r.baseUrl}/files/${
|
|
2571
|
-
|
|
2721
|
+
`${r.baseUrl}/files/${Ae(e)}`,
|
|
2722
|
+
I(r.token, {
|
|
2572
2723
|
method: "PUT",
|
|
2573
2724
|
headers: {
|
|
2574
2725
|
"Content-Type": "application/json"
|
|
@@ -2576,19 +2727,19 @@ const P = (r, e = {}) => {
|
|
|
2576
2727
|
body: JSON.stringify({ content: t })
|
|
2577
2728
|
})
|
|
2578
2729
|
);
|
|
2579
|
-
await
|
|
2580
|
-
},
|
|
2730
|
+
await N(s, `Failed to update ${e}`);
|
|
2731
|
+
}, Qr = async (r, e) => {
|
|
2581
2732
|
const t = await fetch(
|
|
2582
|
-
`${r.baseUrl}/files/${
|
|
2583
|
-
|
|
2733
|
+
`${r.baseUrl}/files/${Ae(e)}`,
|
|
2734
|
+
I(r.token, {
|
|
2584
2735
|
method: "DELETE"
|
|
2585
2736
|
})
|
|
2586
2737
|
);
|
|
2587
|
-
await
|
|
2588
|
-
},
|
|
2738
|
+
await N(t, `Failed to delete ${e}`);
|
|
2739
|
+
}, Yt = async (r, e, t) => {
|
|
2589
2740
|
const s = await fetch(
|
|
2590
2741
|
`${r.baseUrl}/${e}`,
|
|
2591
|
-
|
|
2742
|
+
I(r.token, {
|
|
2592
2743
|
method: "POST",
|
|
2593
2744
|
headers: {
|
|
2594
2745
|
"Content-Type": "application/json"
|
|
@@ -2596,31 +2747,31 @@ const P = (r, e = {}) => {
|
|
|
2596
2747
|
body: JSON.stringify({ target: t })
|
|
2597
2748
|
})
|
|
2598
2749
|
);
|
|
2599
|
-
return await
|
|
2600
|
-
},
|
|
2750
|
+
return await N(s, `Failed to ${e} ${t}`), s.json();
|
|
2751
|
+
}, Xt = async (r, e) => {
|
|
2601
2752
|
const t = await fetch(
|
|
2602
2753
|
`${r.baseUrl}/jobs/${e}`,
|
|
2603
|
-
|
|
2754
|
+
I(r.token, {
|
|
2604
2755
|
method: "GET"
|
|
2605
2756
|
})
|
|
2606
2757
|
);
|
|
2607
|
-
return await
|
|
2608
|
-
},
|
|
2758
|
+
return await N(t, `Failed to fetch job ${e}`), t.json();
|
|
2759
|
+
}, Zt = async (r, e) => {
|
|
2609
2760
|
const t = await fetch(
|
|
2610
2761
|
`${r.baseUrl}/jobs/${e}/cancel`,
|
|
2611
|
-
|
|
2762
|
+
I(r.token, {
|
|
2612
2763
|
method: "POST"
|
|
2613
2764
|
})
|
|
2614
2765
|
);
|
|
2615
|
-
return await
|
|
2616
|
-
}, U = /* @__PURE__ */ new Map(),
|
|
2766
|
+
return await N(t, `Failed to cancel job ${e}`), t.json();
|
|
2767
|
+
}, U = /* @__PURE__ */ new Map(), We = "trilogy-jobs-api-state", Ge = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, er = (r) => {
|
|
2617
2768
|
const e = r.pollingState, t = e === "unable-to-fetch" ? "stopped" : r.pollingState ?? "ok";
|
|
2618
2769
|
return {
|
|
2619
2770
|
...r,
|
|
2620
2771
|
pollingState: t,
|
|
2621
2772
|
pollingError: t === "stopped" && !r.pollingError && e === "unable-to-fetch" ? "Polling stopped locally." : r.pollingError ?? null
|
|
2622
2773
|
};
|
|
2623
|
-
},
|
|
2774
|
+
}, ie = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), Or = Y("jobsApi", {
|
|
2624
2775
|
state: () => ({
|
|
2625
2776
|
filesByStore: {},
|
|
2626
2777
|
jobsByStore: {},
|
|
@@ -2633,16 +2784,16 @@ const P = (r, e = {}) => {
|
|
|
2633
2784
|
}),
|
|
2634
2785
|
actions: {
|
|
2635
2786
|
getGenericStore(r) {
|
|
2636
|
-
const t =
|
|
2787
|
+
const t = le().stores.find((s) => s.id === r);
|
|
2637
2788
|
return !t || t.type !== "generic" ? null : t;
|
|
2638
2789
|
},
|
|
2639
2790
|
getGenericStores() {
|
|
2640
|
-
return
|
|
2791
|
+
return le().stores.filter(
|
|
2641
2792
|
(e) => e.type === "generic"
|
|
2642
2793
|
);
|
|
2643
2794
|
},
|
|
2644
2795
|
getStoreJobs(r) {
|
|
2645
|
-
return
|
|
2796
|
+
return ie(this.jobsByStore[r] || []);
|
|
2646
2797
|
},
|
|
2647
2798
|
getJobsForTarget(r, e) {
|
|
2648
2799
|
return this.getStoreJobs(r).filter((t) => t.target === e);
|
|
@@ -2653,7 +2804,7 @@ const P = (r, e = {}) => {
|
|
|
2653
2804
|
) ? "running" : this.storeStatus[r] || "idle";
|
|
2654
2805
|
},
|
|
2655
2806
|
isSubmitting(r, e, t) {
|
|
2656
|
-
return !!this.submittingByTarget[
|
|
2807
|
+
return !!this.submittingByTarget[Ge(r, e, t)];
|
|
2657
2808
|
},
|
|
2658
2809
|
isPollingJob(r, e) {
|
|
2659
2810
|
return !!this.pollingByJob[z(r, e)];
|
|
@@ -2671,25 +2822,25 @@ const P = (r, e = {}) => {
|
|
|
2671
2822
|
}), delete this.filesByStore[r], delete this.jobsByStore[r], delete this.errors[r], delete this.storeStatus[r], delete this.loadingByStore[r], this.saveJobsToStorage();
|
|
2672
2823
|
},
|
|
2673
2824
|
async initialize() {
|
|
2674
|
-
|
|
2825
|
+
le().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
|
|
2675
2826
|
},
|
|
2676
2827
|
saveJobsToStorage() {
|
|
2677
2828
|
try {
|
|
2678
|
-
localStorage.setItem(
|
|
2829
|
+
localStorage.setItem(We, JSON.stringify(this.jobsByStore));
|
|
2679
2830
|
} catch (r) {
|
|
2680
2831
|
console.error("Error saving jobs to localStorage:", r);
|
|
2681
2832
|
}
|
|
2682
2833
|
},
|
|
2683
2834
|
loadJobsFromStorage() {
|
|
2684
2835
|
try {
|
|
2685
|
-
const r = localStorage.getItem(
|
|
2836
|
+
const r = localStorage.getItem(We);
|
|
2686
2837
|
if (!r)
|
|
2687
2838
|
return;
|
|
2688
2839
|
const e = JSON.parse(r);
|
|
2689
2840
|
this.jobsByStore = Object.fromEntries(
|
|
2690
2841
|
Object.entries(e).map(([t, s]) => [
|
|
2691
2842
|
t,
|
|
2692
|
-
(s || []).map((o) =>
|
|
2843
|
+
(s || []).map((o) => er(o))
|
|
2693
2844
|
])
|
|
2694
2845
|
);
|
|
2695
2846
|
} catch (r) {
|
|
@@ -2728,7 +2879,7 @@ const P = (r, e = {}) => {
|
|
|
2728
2879
|
if (e) {
|
|
2729
2880
|
this.loadingByStore[r] = !0, this.storeStatus[r] = "idle";
|
|
2730
2881
|
try {
|
|
2731
|
-
this.filesByStore[r] = await
|
|
2882
|
+
this.filesByStore[r] = await Vt(e), delete this.errors[r], this.storeStatus[r] = "connected";
|
|
2732
2883
|
} catch (t) {
|
|
2733
2884
|
const s = t instanceof Error ? t.message : "Failed to fetch files";
|
|
2734
2885
|
this.errors[r] = s, this.storeStatus[r] = "failed";
|
|
@@ -2740,17 +2891,17 @@ const P = (r, e = {}) => {
|
|
|
2740
2891
|
upsertJob(r, e) {
|
|
2741
2892
|
const t = this.jobsByStore[r] || [], s = t.findIndex((i) => i.job_id === e.job_id);
|
|
2742
2893
|
if (s === -1) {
|
|
2743
|
-
this.jobsByStore[r] =
|
|
2894
|
+
this.jobsByStore[r] = ie([e, ...t]), this.saveJobsToStorage();
|
|
2744
2895
|
return;
|
|
2745
2896
|
}
|
|
2746
2897
|
const o = [...t];
|
|
2747
2898
|
o[s] = {
|
|
2748
2899
|
...o[s],
|
|
2749
2900
|
...e
|
|
2750
|
-
}, this.jobsByStore[r] =
|
|
2901
|
+
}, this.jobsByStore[r] = ie(o), this.saveJobsToStorage();
|
|
2751
2902
|
},
|
|
2752
2903
|
replaceJobs(r, e) {
|
|
2753
|
-
this.jobsByStore[r] =
|
|
2904
|
+
this.jobsByStore[r] = ie(e), this.saveJobsToStorage();
|
|
2754
2905
|
},
|
|
2755
2906
|
removeJob(r, e) {
|
|
2756
2907
|
this.stopPolling(r, e), delete this.pollingByJob[z(r, e)], delete this.stoppingByJob[z(r, e)], this.jobsByStore[r] = (this.jobsByStore[r] || []).filter(
|
|
@@ -2800,10 +2951,10 @@ const P = (r, e = {}) => {
|
|
|
2800
2951
|
const s = this.getGenericStore(r);
|
|
2801
2952
|
if (!s)
|
|
2802
2953
|
throw new Error("Store not found or does not support jobs");
|
|
2803
|
-
const o =
|
|
2954
|
+
const o = Ge(r, e, t);
|
|
2804
2955
|
this.submittingByTarget[o] = !0;
|
|
2805
2956
|
try {
|
|
2806
|
-
const i = await
|
|
2957
|
+
const i = await Yt(s, t, e), n = this.buildLocalJob(r, e, t, i);
|
|
2807
2958
|
return this.upsertJob(r, n), delete this.errors[r], this.storeStatus[r] = "connected", n.status === "running" && this.startPolling(r, n.job_id), n;
|
|
2808
2959
|
} catch (i) {
|
|
2809
2960
|
const n = i instanceof Error ? i.message : `Failed to ${t} ${e}`;
|
|
@@ -2823,7 +2974,7 @@ const P = (r, e = {}) => {
|
|
|
2823
2974
|
return;
|
|
2824
2975
|
}
|
|
2825
2976
|
try {
|
|
2826
|
-
const i = await
|
|
2977
|
+
const i = await Xt(s, e), n = this.buildLocalJob(
|
|
2827
2978
|
r,
|
|
2828
2979
|
o.target,
|
|
2829
2980
|
o.operation,
|
|
@@ -2833,12 +2984,12 @@ const P = (r, e = {}) => {
|
|
|
2833
2984
|
this.upsertJob(r, n), n.status !== "running" && (this.stopPolling(r, e), this.fetchFilesForStore(r));
|
|
2834
2985
|
} catch (i) {
|
|
2835
2986
|
const n = i instanceof Error ? i.message : `Failed to poll job ${e}`;
|
|
2836
|
-
i instanceof
|
|
2987
|
+
i instanceof $e && i.status === 401 ? this.pauseJobPolling(
|
|
2837
2988
|
r,
|
|
2838
2989
|
e,
|
|
2839
2990
|
"auth-paused",
|
|
2840
2991
|
"Polling paused: authentication required. Update the store token to resume tracking."
|
|
2841
|
-
) : i instanceof
|
|
2992
|
+
) : i instanceof $e && i.status === 404 ? this.pauseJobPolling(
|
|
2842
2993
|
r,
|
|
2843
2994
|
e,
|
|
2844
2995
|
"not-found",
|
|
@@ -2859,7 +3010,7 @@ const P = (r, e = {}) => {
|
|
|
2859
3010
|
}
|
|
2860
3011
|
this.stoppingByJob[t] = !0, this.stopPolling(r, e), delete this.pollingByJob[t];
|
|
2861
3012
|
try {
|
|
2862
|
-
const i = await
|
|
3013
|
+
const i = await Zt(s, e), n = this.buildLocalJob(
|
|
2863
3014
|
r,
|
|
2864
3015
|
o.target,
|
|
2865
3016
|
o.operation,
|
|
@@ -2881,7 +3032,7 @@ const P = (r, e = {}) => {
|
|
|
2881
3032
|
}
|
|
2882
3033
|
}
|
|
2883
3034
|
});
|
|
2884
|
-
class
|
|
3035
|
+
class tr {
|
|
2885
3036
|
constructor(e, t, s, o) {
|
|
2886
3037
|
w(this, "queryExecutionService");
|
|
2887
3038
|
w(this, "connectionStore");
|
|
@@ -2944,7 +3095,7 @@ class Rt {
|
|
|
2944
3095
|
}
|
|
2945
3096
|
}
|
|
2946
3097
|
async executeTrilogyQuery(e, t, s, o) {
|
|
2947
|
-
var
|
|
3098
|
+
var f, v;
|
|
2948
3099
|
if (!e || typeof e != "string" || e.trim() === "")
|
|
2949
3100
|
return {
|
|
2950
3101
|
success: !1,
|
|
@@ -2969,7 +3120,7 @@ class Rt {
|
|
|
2969
3120
|
error: `Connection "${t}" is not currently connected. Please ensure the connection is active.`,
|
|
2970
3121
|
query: e
|
|
2971
3122
|
};
|
|
2972
|
-
const n = ((v = (
|
|
3123
|
+
const n = ((v = (f = this.chatStore) == null ? void 0 : f.activeChat) == null ? void 0 : v.imports) || [], a = n.map((m) => ({
|
|
2973
3124
|
name: m.name,
|
|
2974
3125
|
alias: m.alias || ""
|
|
2975
3126
|
}));
|
|
@@ -2989,9 +3140,9 @@ class Rt {
|
|
|
2989
3140
|
);
|
|
2990
3141
|
const l = /* @__PURE__ */ new Map();
|
|
2991
3142
|
u.forEach((m) => l.set(m.alias, m.contents)), c.forEach((m) => l.set(m.alias, m.contents)), n.forEach((m) => {
|
|
2992
|
-
var
|
|
2993
|
-
const y = m.alias || m.name,
|
|
2994
|
-
|
|
3143
|
+
var T, x;
|
|
3144
|
+
const y = m.alias || m.name, E = ((x = (T = this.editorStore) == null ? void 0 : T.editors[m.id]) == null ? void 0 : x.contents) || "";
|
|
3145
|
+
E && l.set(y, E);
|
|
2995
3146
|
});
|
|
2996
3147
|
const h = Array.from(l.entries()).map(
|
|
2997
3148
|
([m, y]) => ({
|
|
@@ -3034,11 +3185,11 @@ class Rt {
|
|
|
3034
3185
|
query: e,
|
|
3035
3186
|
generatedSql: y.generatedSql
|
|
3036
3187
|
};
|
|
3037
|
-
const
|
|
3188
|
+
const E = Qe();
|
|
3038
3189
|
return {
|
|
3039
3190
|
success: !0,
|
|
3040
3191
|
artifact: {
|
|
3041
|
-
id:
|
|
3192
|
+
id: E,
|
|
3042
3193
|
type: s,
|
|
3043
3194
|
data: y.results,
|
|
3044
3195
|
config: {
|
|
@@ -3051,7 +3202,7 @@ class Rt {
|
|
|
3051
3202
|
...o && { chartConfig: o }
|
|
3052
3203
|
}
|
|
3053
3204
|
},
|
|
3054
|
-
artifactId:
|
|
3205
|
+
artifactId: E,
|
|
3055
3206
|
executionTime: y.executionTime,
|
|
3056
3207
|
query: e,
|
|
3057
3208
|
generatedSql: y.generatedSql
|
|
@@ -3086,13 +3237,13 @@ class Rt {
|
|
|
3086
3237
|
})) : [], n = this.connectionStore.getConnectionSources(t), a = /* @__PURE__ */ new Map();
|
|
3087
3238
|
n.forEach((d) => a.set(d.alias, d.contents)), i.forEach((d) => a.set(d.alias, d.contents)), s.forEach((d) => {
|
|
3088
3239
|
var m, y;
|
|
3089
|
-
const
|
|
3090
|
-
v && a.set(
|
|
3240
|
+
const f = d.alias || d.name, v = ((y = (m = this.editorStore) == null ? void 0 : m.editors[d.id]) == null ? void 0 : y.contents) || "";
|
|
3241
|
+
v && a.set(f, v);
|
|
3091
3242
|
});
|
|
3092
3243
|
const c = Array.from(a.entries()).map(
|
|
3093
|
-
([d,
|
|
3244
|
+
([d, f]) => ({
|
|
3094
3245
|
alias: d,
|
|
3095
|
-
contents:
|
|
3246
|
+
contents: f
|
|
3096
3247
|
})
|
|
3097
3248
|
), u = {
|
|
3098
3249
|
text: e.trim(),
|
|
@@ -3187,14 +3338,14 @@ ${i}`,
|
|
|
3187
3338
|
try {
|
|
3188
3339
|
if (!(((o = (s = this.editorStore) == null ? void 0 : s.editors[e.id]) == null ? void 0 : o.contents) || ""))
|
|
3189
3340
|
return "No fields found in this data source.";
|
|
3190
|
-
const a = this.editorStore ? Object.values(this.editorStore.editors).filter((
|
|
3191
|
-
alias:
|
|
3192
|
-
contents:
|
|
3341
|
+
const a = this.editorStore ? Object.values(this.editorStore.editors).filter((f) => f.connection === t && !f.deleted).map((f) => ({
|
|
3342
|
+
alias: f.name,
|
|
3343
|
+
contents: f.contents
|
|
3193
3344
|
})) : [], c = this.connectionStore.getConnectionSources(t), u = /* @__PURE__ */ new Map();
|
|
3194
|
-
c.forEach((
|
|
3345
|
+
c.forEach((f) => u.set(f.alias, f.contents)), a.forEach((f) => u.set(f.alias, f.contents));
|
|
3195
3346
|
const l = Array.from(u.entries()).map(
|
|
3196
|
-
([
|
|
3197
|
-
alias:
|
|
3347
|
+
([f, v]) => ({
|
|
3348
|
+
alias: f,
|
|
3198
3349
|
contents: v
|
|
3199
3350
|
})
|
|
3200
3351
|
), h = {
|
|
@@ -3208,17 +3359,17 @@ ${i}`,
|
|
|
3208
3359
|
!1
|
|
3209
3360
|
);
|
|
3210
3361
|
if ((i = d == null ? void 0 : d.data) != null && i.completion_items) {
|
|
3211
|
-
const
|
|
3362
|
+
const f = d.data.completion_items.filter(
|
|
3212
3363
|
(m) => m.trilogyType === "concept"
|
|
3213
3364
|
);
|
|
3214
|
-
if (
|
|
3365
|
+
if (f.length === 0)
|
|
3215
3366
|
return "No fields found in this data source.";
|
|
3216
|
-
const v =
|
|
3367
|
+
const v = f.map((m) => {
|
|
3217
3368
|
let y = `- ${m.label} (${m.datatype || m.type})`;
|
|
3218
3369
|
return m.description && (y += `: ${m.description}`), m.calculation && (y += ` [calculated: ${m.calculation}]`), y;
|
|
3219
3370
|
}).join(`
|
|
3220
3371
|
`);
|
|
3221
|
-
return `AVAILABLE FIELDS (${
|
|
3372
|
+
return `AVAILABLE FIELDS (${f.length} total):
|
|
3222
3373
|
${v}`;
|
|
3223
3374
|
}
|
|
3224
3375
|
return "Unable to fetch field information for this data source.";
|
|
@@ -3306,7 +3457,7 @@ Use select_active_import to select a data source.`
|
|
|
3306
3457
|
success: !1,
|
|
3307
3458
|
error: "Markdown content is required and must be a non-empty string"
|
|
3308
3459
|
};
|
|
3309
|
-
const i =
|
|
3460
|
+
const i = Qe();
|
|
3310
3461
|
let n = null;
|
|
3311
3462
|
if (s && s.trim()) {
|
|
3312
3463
|
if (!o) {
|
|
@@ -3365,9 +3516,9 @@ Use select_active_import to select a data source.`
|
|
|
3365
3516
|
message: "No artifacts in the current chat session."
|
|
3366
3517
|
};
|
|
3367
3518
|
const t = e.artifacts.filter((c) => !c.hidden), s = e.artifacts.filter((c) => c.hidden), o = (c, u) => {
|
|
3368
|
-
var d,
|
|
3519
|
+
var d, f, v, m;
|
|
3369
3520
|
const l = [`- ID: ${c.id}, Type: ${c.type}`];
|
|
3370
|
-
(d = c.config) != null && d.title && l.push(`Title: "${c.config.title}"`), (
|
|
3521
|
+
(d = c.config) != null && d.title && l.push(`Title: "${c.config.title}"`), (f = c.config) != null && f.resultSize && l.push(`${c.config.resultSize} rows`), (v = c.config) != null && v.query && l.push(`Query: "${c.config.query.substring(0, 80)}..."`), c.type === "markdown" && ((m = c.data) != null && m.markdown) && l.push(`Content: "${c.data.markdown.substring(0, 80)}..."`);
|
|
3371
3522
|
const h = u === e.activeArtifactIndex ? " (currently selected)" : "";
|
|
3372
3523
|
return l.join(", ") + h;
|
|
3373
3524
|
}, i = t.length > 0 ? `Visible (${t.length}):
|
|
@@ -3405,10 +3556,10 @@ ${i}${n}`
|
|
|
3405
3556
|
if (s.config && (o.config = { ...s.config }), s.type === "markdown")
|
|
3406
3557
|
o.markdown = ((n = s.data) == null ? void 0 : n.markdown) || "", o.query = ((a = s.data) == null ? void 0 : a.query) || "", o.hasQueryResults = !!((c = s.data) != null && c.queryResults);
|
|
3407
3558
|
else if (s.data) {
|
|
3408
|
-
const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount:
|
|
3409
|
-
if (
|
|
3410
|
-
const v =
|
|
3411
|
-
o.data = { ...u, data: l }, o._truncated = `${
|
|
3559
|
+
const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount: f } = ct(u);
|
|
3560
|
+
if (f > 0) {
|
|
3561
|
+
const v = lt / 2;
|
|
3562
|
+
o.data = { ...u, data: l }, o._truncated = `${f} of ${d} rows cut off (showing first ${v} and last ${v}). Use get_artifact_rows to fetch any range.`, o._tail = h;
|
|
3412
3563
|
} else
|
|
3413
3564
|
o.data = u;
|
|
3414
3565
|
}
|
|
@@ -3420,7 +3571,7 @@ ${JSON.stringify(o, null, 2)}`
|
|
|
3420
3571
|
}
|
|
3421
3572
|
// Fetch a specific row range from a results or chart artifact
|
|
3422
3573
|
getArtifactRows(e, t, s) {
|
|
3423
|
-
var d,
|
|
3574
|
+
var d, f;
|
|
3424
3575
|
const o = (d = this.chatStore) == null ? void 0 : d.activeChat;
|
|
3425
3576
|
if (!o)
|
|
3426
3577
|
return { success: !1, error: "No active chat session." };
|
|
@@ -3435,7 +3586,7 @@ ${JSON.stringify(o, null, 2)}`
|
|
|
3435
3586
|
success: !1,
|
|
3436
3587
|
error: `Artifact "${e}" does not contain tabular data (type: ${i.type}). Only results and chart artifacts support row fetching.`
|
|
3437
3588
|
};
|
|
3438
|
-
const n = typeof ((
|
|
3589
|
+
const n = typeof ((f = i.data) == null ? void 0 : f.toJSON) == "function" ? i.data.toJSON() : i.data, a = n == null ? void 0 : n.data;
|
|
3439
3590
|
if (!Array.isArray(a))
|
|
3440
3591
|
return { success: !1, error: `Artifact "${e}" has no row data.` };
|
|
3441
3592
|
const c = a.length, u = Math.max(0, Math.min(t, c - 1)), l = Math.max(u, Math.min(s, c - 1)), h = a.slice(u, l + 1);
|
|
@@ -3513,7 +3664,7 @@ ${JSON.stringify(o, null, 2)}`
|
|
|
3513
3664
|
} : { success: !0, message: o.length > 0 ? `Hidden ${i.length} artifact(s). Not found: ${o.join(", ")}. Hidden artifacts remain accessible to you via list_artifacts and can be restored by the user.` : `Hidden ${i.length} artifact(s). They remain accessible via list_artifacts and can be restored by the user.` };
|
|
3514
3665
|
}
|
|
3515
3666
|
}
|
|
3516
|
-
const
|
|
3667
|
+
const rr = Y("chats", {
|
|
3517
3668
|
state: () => ({
|
|
3518
3669
|
chats: {},
|
|
3519
3670
|
activeChatId: "",
|
|
@@ -3548,7 +3699,7 @@ const Kt = V("chats", {
|
|
|
3548
3699
|
},
|
|
3549
3700
|
actions: {
|
|
3550
3701
|
newChat(r, e = "", t) {
|
|
3551
|
-
const s = new
|
|
3702
|
+
const s = new Oe({
|
|
3552
3703
|
llmConnectionName: r,
|
|
3553
3704
|
dataConnectionName: e,
|
|
3554
3705
|
name: t || `Chat ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
|
|
@@ -3597,7 +3748,7 @@ const Kt = V("chats", {
|
|
|
3597
3748
|
},
|
|
3598
3749
|
loadChats(r) {
|
|
3599
3750
|
Object.entries(r).forEach(([e, t]) => {
|
|
3600
|
-
this.chats[e] =
|
|
3751
|
+
this.chats[e] = Oe.fromSerialized(t);
|
|
3601
3752
|
});
|
|
3602
3753
|
},
|
|
3603
3754
|
serializeChats() {
|
|
@@ -3684,67 +3835,67 @@ const Kt = V("chats", {
|
|
|
3684
3835
|
content: e
|
|
3685
3836
|
});
|
|
3686
3837
|
try {
|
|
3687
|
-
const
|
|
3688
|
-
generateCompletion: async (
|
|
3689
|
-
const
|
|
3690
|
-
...
|
|
3838
|
+
const f = {
|
|
3839
|
+
generateCompletion: async (_, F, C) => {
|
|
3840
|
+
const M = {
|
|
3841
|
+
...F,
|
|
3691
3842
|
signal: l,
|
|
3692
|
-
onRateLimitBackoff: (
|
|
3693
|
-
this.setRateLimitBackoff(r,
|
|
3843
|
+
onRateLimitBackoff: (P, R) => {
|
|
3844
|
+
this.setRateLimitBackoff(r, P, R);
|
|
3694
3845
|
}
|
|
3695
|
-
},
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3846
|
+
}, X = await i.generateCompletion(
|
|
3847
|
+
_,
|
|
3848
|
+
M,
|
|
3849
|
+
C
|
|
3699
3850
|
);
|
|
3700
|
-
return this.clearRateLimitBackoff(r),
|
|
3851
|
+
return this.clearRateLimitBackoff(r), X;
|
|
3701
3852
|
}
|
|
3702
3853
|
}, v = {
|
|
3703
|
-
addMessage: (
|
|
3704
|
-
this.addMessageToChat(r,
|
|
3854
|
+
addMessage: (_) => {
|
|
3855
|
+
this.addMessageToChat(r, _);
|
|
3705
3856
|
},
|
|
3706
|
-
addArtifact: (
|
|
3707
|
-
this.addArtifactToChat(r,
|
|
3857
|
+
addArtifact: (_) => {
|
|
3858
|
+
this.addArtifactToChat(r, _), (_.type === "chart" || _.type === "markdown") && this.addMessageToChat(r, {
|
|
3708
3859
|
role: "assistant",
|
|
3709
3860
|
content: "",
|
|
3710
|
-
artifact:
|
|
3861
|
+
artifact: _,
|
|
3711
3862
|
hidden: !1
|
|
3712
3863
|
});
|
|
3713
3864
|
},
|
|
3714
3865
|
getMessages: () => o.messages
|
|
3715
|
-
}, m = new
|
|
3866
|
+
}, m = new tr(
|
|
3716
3867
|
a,
|
|
3717
3868
|
n,
|
|
3718
3869
|
this,
|
|
3719
3870
|
c
|
|
3720
3871
|
);
|
|
3721
|
-
await
|
|
3872
|
+
await ut(
|
|
3722
3873
|
e,
|
|
3723
3874
|
u,
|
|
3724
|
-
|
|
3875
|
+
f,
|
|
3725
3876
|
v,
|
|
3726
3877
|
{
|
|
3727
3878
|
getToolExecutor: () => m
|
|
3728
3879
|
},
|
|
3729
3880
|
{
|
|
3730
|
-
setActiveToolName: (
|
|
3881
|
+
setActiveToolName: (_) => this.setActiveToolName(r, _),
|
|
3731
3882
|
checkAborted: () => (l == null ? void 0 : l.aborted) ?? !1
|
|
3732
3883
|
},
|
|
3733
3884
|
{
|
|
3734
|
-
tools:
|
|
3885
|
+
tools: vt,
|
|
3735
3886
|
maxIterations: 50,
|
|
3736
3887
|
noToolCallReminder: "You must call a tool to proceed. If you are finished, call return_to_user with a summary of what was done. Do not respond with text only.",
|
|
3737
3888
|
buildSystemPrompt: () => this.buildSystemPrompt(r, t),
|
|
3738
|
-
onToolResult: async (
|
|
3739
|
-
|
|
3889
|
+
onToolResult: async (_, F) => {
|
|
3890
|
+
F.triggersSymbolRefresh && s.onSymbolsRefresh && await s.onSymbolsRefresh();
|
|
3740
3891
|
}
|
|
3741
3892
|
}
|
|
3742
3893
|
);
|
|
3743
3894
|
return;
|
|
3744
|
-
} catch (
|
|
3745
|
-
if (
|
|
3895
|
+
} catch (f) {
|
|
3896
|
+
if (f instanceof DOMException && f.name === "AbortError")
|
|
3746
3897
|
return;
|
|
3747
|
-
const v =
|
|
3898
|
+
const v = f instanceof Error ? f.message : "An unknown error occurred";
|
|
3748
3899
|
this.addMessageToChat(r, {
|
|
3749
3900
|
role: "assistant",
|
|
3750
3901
|
content: `Error: ${v}`
|
|
@@ -3764,7 +3915,7 @@ const Kt = V("chats", {
|
|
|
3764
3915
|
name: l.name.replace(/\//g, "."),
|
|
3765
3916
|
alias: ""
|
|
3766
3917
|
})) : [];
|
|
3767
|
-
return
|
|
3918
|
+
return wt({
|
|
3768
3919
|
dataConnectionName: i,
|
|
3769
3920
|
availableConnections: n,
|
|
3770
3921
|
availableConcepts: [],
|
|
@@ -3776,48 +3927,48 @@ const Kt = V("chats", {
|
|
|
3776
3927
|
}
|
|
3777
3928
|
}
|
|
3778
3929
|
});
|
|
3779
|
-
function
|
|
3930
|
+
function A(r, e = null) {
|
|
3780
3931
|
const t = window.location.hash;
|
|
3781
3932
|
if (!t || !t.startsWith("#"))
|
|
3782
3933
|
return e;
|
|
3783
3934
|
const o = new URLSearchParams(t.slice(1)).get(r);
|
|
3784
3935
|
return o !== null ? o : e;
|
|
3785
3936
|
}
|
|
3786
|
-
function
|
|
3937
|
+
function ae(r, e) {
|
|
3787
3938
|
const t = window.location.hash, s = new URLSearchParams(t.slice(1));
|
|
3788
3939
|
s.set(r, e), window.location.hash = `#${s.toString()}`;
|
|
3789
3940
|
}
|
|
3790
|
-
function
|
|
3941
|
+
function j(r) {
|
|
3791
3942
|
const e = window.location.hash, t = new URLSearchParams(e.slice(1));
|
|
3792
3943
|
t.delete(r), window.location.hash = `#${t.toString()}`;
|
|
3793
3944
|
}
|
|
3794
|
-
function
|
|
3945
|
+
function sr(r) {
|
|
3795
3946
|
const e = window.location.hash, t = new URLSearchParams(e.slice(1));
|
|
3796
3947
|
r.forEach((s) => {
|
|
3797
3948
|
t.delete(s);
|
|
3798
3949
|
}), window.location.hash = `#${t.toString()}`;
|
|
3799
3950
|
}
|
|
3800
|
-
const
|
|
3801
|
-
const r =
|
|
3951
|
+
const or = () => {
|
|
3952
|
+
const r = Jt(), e = ot(), t = ht(), s = le(), o = rr();
|
|
3802
3953
|
let i = null;
|
|
3803
3954
|
const n = {
|
|
3804
|
-
activeScreen: Q(
|
|
3955
|
+
activeScreen: Q(A("screen", "")),
|
|
3805
3956
|
activeSidebarScreen: Q(
|
|
3806
|
-
|
|
3957
|
+
A("sidebarScreen", "editors")
|
|
3807
3958
|
),
|
|
3808
|
-
activeEditor: Q(
|
|
3809
|
-
activeDashboard: Q(
|
|
3810
|
-
activeConnectionKey: Q(
|
|
3811
|
-
activeModelKey: Q(
|
|
3812
|
-
activeCommunityModelKey: Q(
|
|
3813
|
-
activeJobsKey: Q(
|
|
3814
|
-
activeLLMConnectionKey: Q(
|
|
3815
|
-
activeDocumentationKey: Q(
|
|
3959
|
+
activeEditor: Q(A("editors", "")),
|
|
3960
|
+
activeDashboard: Q(A("dashboard", "")),
|
|
3961
|
+
activeConnectionKey: Q(A("connections", "")),
|
|
3962
|
+
activeModelKey: Q(A("model", "")),
|
|
3963
|
+
activeCommunityModelKey: Q(A("community-models", "")),
|
|
3964
|
+
activeJobsKey: Q(A("jobs", "")),
|
|
3965
|
+
activeLLMConnectionKey: Q(A("llms", "")),
|
|
3966
|
+
activeDocumentationKey: Q(A("tutorial", "")),
|
|
3816
3967
|
// model import is legacy
|
|
3817
|
-
modelImport: Q(
|
|
3818
|
-
connectionImport: Q(
|
|
3968
|
+
modelImport: Q(A("import", A("model", ""))),
|
|
3969
|
+
connectionImport: Q(A("connection", "")),
|
|
3819
3970
|
mobileMenuOpen: Q(!1),
|
|
3820
|
-
initialSearch: Q(
|
|
3971
|
+
initialSearch: Q(A("initialSearch", "")),
|
|
3821
3972
|
tabs: Q([]),
|
|
3822
3973
|
activeTab: Q(null),
|
|
3823
3974
|
showTipModal: Q(!0),
|
|
@@ -3834,138 +3985,138 @@ const zt = () => {
|
|
|
3834
3985
|
"profile",
|
|
3835
3986
|
"settings",
|
|
3836
3987
|
"connections"
|
|
3837
|
-
]), c = (
|
|
3838
|
-
if (n.activeSidebarScreen.value !==
|
|
3839
|
-
if (
|
|
3840
|
-
|
|
3988
|
+
]), c = (g, S = !1) => {
|
|
3989
|
+
if (n.activeSidebarScreen.value !== g && (n.activeSidebarScreen.value = g, !S)) {
|
|
3990
|
+
if (g) {
|
|
3991
|
+
ae("sidebarScreen", g);
|
|
3841
3992
|
return;
|
|
3842
3993
|
}
|
|
3843
|
-
|
|
3994
|
+
j("sidebarScreen");
|
|
3844
3995
|
}
|
|
3845
|
-
}, u = (
|
|
3846
|
-
c(a.has(
|
|
3847
|
-
}, l = (
|
|
3848
|
-
if (
|
|
3849
|
-
return
|
|
3850
|
-
if (
|
|
3996
|
+
}, u = (g, S = !1) => {
|
|
3997
|
+
c(a.has(g) ? g : "", S);
|
|
3998
|
+
}, l = (g, S, b) => {
|
|
3999
|
+
if (S)
|
|
4000
|
+
return S;
|
|
4001
|
+
if (g === "dashboard") {
|
|
3851
4002
|
let p = r.dashboards[b];
|
|
3852
4003
|
if (p)
|
|
3853
4004
|
return p.name || "Untitled Dashboard";
|
|
3854
|
-
} else if (
|
|
4005
|
+
} else if (g === "editors") {
|
|
3855
4006
|
let p = e.editors[b];
|
|
3856
4007
|
if (p)
|
|
3857
4008
|
return p.name || "Untitled Editor";
|
|
3858
|
-
} else if (
|
|
3859
|
-
const p = b.split(
|
|
3860
|
-
if (
|
|
3861
|
-
const
|
|
3862
|
-
if (
|
|
3863
|
-
return
|
|
4009
|
+
} else if (g === "llms") {
|
|
4010
|
+
const p = b.split(se), D = p[0], O = p.length > 1 ? p[1] : null;
|
|
4011
|
+
if (O) {
|
|
4012
|
+
const $ = o.getChatById(O);
|
|
4013
|
+
if ($)
|
|
4014
|
+
return $.name;
|
|
3864
4015
|
}
|
|
3865
4016
|
return D || "LLM Chat";
|
|
3866
|
-
} else if (
|
|
3867
|
-
const p = b.split(
|
|
3868
|
-
if (
|
|
3869
|
-
return p.length === 2 ? `${
|
|
3870
|
-
} else if (
|
|
3871
|
-
const p = b.split(
|
|
4017
|
+
} else if (g === "community-models") {
|
|
4018
|
+
const p = b.split(se), D = p[0], O = s.stores.find(($) => $.id === D);
|
|
4019
|
+
if (O)
|
|
4020
|
+
return p.length === 2 ? `${O.name} - ${p[1]}` : p.length === 3 ? p[2] : O.name;
|
|
4021
|
+
} else if (g === "jobs") {
|
|
4022
|
+
const p = b.split(se), D = p[0], O = s.stores.find((k) => k.id === D), $ = (O == null ? void 0 : O.name) || D;
|
|
3872
4023
|
if (p.length === 1)
|
|
3873
|
-
return
|
|
3874
|
-
const
|
|
4024
|
+
return $;
|
|
4025
|
+
const q = decodeURIComponent(p[2] || "");
|
|
3875
4026
|
if (p[1] === "directory")
|
|
3876
|
-
return
|
|
4027
|
+
return q === "__root__" ? `${$} - Root` : q;
|
|
3877
4028
|
if (p[1] === "file") {
|
|
3878
|
-
const
|
|
3879
|
-
return
|
|
4029
|
+
const k = q.split("/");
|
|
4030
|
+
return k[k.length - 1] || $;
|
|
3880
4031
|
}
|
|
3881
4032
|
}
|
|
3882
|
-
return
|
|
3883
|
-
}, h = (
|
|
3884
|
-
const p = n.tabs.value.find((D) => D.screen ===
|
|
4033
|
+
return ft(b, null);
|
|
4034
|
+
}, h = (g, S, b) => {
|
|
4035
|
+
const p = n.tabs.value.find((D) => D.screen === g && D.address === b);
|
|
3885
4036
|
if (p) {
|
|
3886
|
-
let D = l(
|
|
4037
|
+
let D = l(g, S, b);
|
|
3887
4038
|
p.title = D;
|
|
3888
4039
|
}
|
|
3889
|
-
}, d = (
|
|
4040
|
+
}, d = (g, S, b, p = !1) => {
|
|
3890
4041
|
const D = n.tabs.value.find(
|
|
3891
|
-
(
|
|
4042
|
+
(J) => J.screen === g && J.address === b
|
|
3892
4043
|
);
|
|
3893
4044
|
if (D) {
|
|
3894
|
-
|
|
4045
|
+
E(D.id, p);
|
|
3895
4046
|
return;
|
|
3896
4047
|
}
|
|
3897
|
-
let
|
|
3898
|
-
const
|
|
3899
|
-
return isNaN(
|
|
4048
|
+
let $ = n.tabs.value.reduce((J, ee) => {
|
|
4049
|
+
const te = parseInt(ee.id.replace("tab-", ""));
|
|
4050
|
+
return isNaN(te) ? J : Math.max(J, te);
|
|
3900
4051
|
}, 0);
|
|
3901
|
-
p ||
|
|
3902
|
-
let
|
|
3903
|
-
const
|
|
3904
|
-
id: `tab-${
|
|
3905
|
-
title:
|
|
3906
|
-
screen:
|
|
4052
|
+
p || T(g);
|
|
4053
|
+
let q = l(g, S, b);
|
|
4054
|
+
const k = {
|
|
4055
|
+
id: `tab-${++$}`,
|
|
4056
|
+
title: q,
|
|
4057
|
+
screen: g,
|
|
3907
4058
|
address: b
|
|
3908
4059
|
};
|
|
3909
|
-
n.tabs.value.push(
|
|
3910
|
-
},
|
|
3911
|
-
if (!
|
|
4060
|
+
n.tabs.value.push(k), E(k.id, p);
|
|
4061
|
+
}, f = (g, S = null) => {
|
|
4062
|
+
if (!g && !S)
|
|
3912
4063
|
return;
|
|
3913
|
-
if (!
|
|
3914
|
-
const p = n.tabs.value.find((D) => D.address ===
|
|
4064
|
+
if (!g && S) {
|
|
4065
|
+
const p = n.tabs.value.find((D) => D.address === S);
|
|
3915
4066
|
if (p)
|
|
3916
|
-
|
|
4067
|
+
g = p.id;
|
|
3917
4068
|
else
|
|
3918
4069
|
return;
|
|
3919
4070
|
}
|
|
3920
|
-
const b = n.tabs.value.findIndex((p) => p.id ===
|
|
4071
|
+
const b = n.tabs.value.findIndex((p) => p.id === g);
|
|
3921
4072
|
if (b !== -1) {
|
|
3922
|
-
const p = n.activeTab.value ===
|
|
4073
|
+
const p = n.activeTab.value === g;
|
|
3923
4074
|
if (n.tabs.value.splice(b, 1), p)
|
|
3924
4075
|
if (n.tabs.value.length > 0) {
|
|
3925
4076
|
const D = b > 0 ? b - 1 : 0;
|
|
3926
|
-
|
|
4077
|
+
E(n.tabs.value[D].id);
|
|
3927
4078
|
} else
|
|
3928
4079
|
d("welcome", "Welcome", "welcome");
|
|
3929
4080
|
}
|
|
3930
4081
|
m();
|
|
3931
|
-
}, v = (
|
|
3932
|
-
const
|
|
3933
|
-
n.tabs.value = n.tabs.value.filter((b) => b.id ===
|
|
4082
|
+
}, v = (g) => {
|
|
4083
|
+
const S = n.activeTab.value === g;
|
|
4084
|
+
n.tabs.value = n.tabs.value.filter((b) => b.id === g), S || (n.tabs.value.length > 0 ? E(n.tabs.value[0].id) : d("welcome", "Welcome", "welcome")), m();
|
|
3934
4085
|
}, m = () => {
|
|
3935
|
-
let
|
|
3936
|
-
|
|
3937
|
-
}, y = (
|
|
3938
|
-
const
|
|
3939
|
-
if (
|
|
3940
|
-
const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) >
|
|
3941
|
-
n.tabs.value.splice(
|
|
4086
|
+
let g = n.tabs.value.map((b) => b.screen), S = [];
|
|
4087
|
+
g.includes("editors") || (n.activeEditor.value = "", S.push("editors"), S.push("activeEditorTab")), g.includes("dashboard") || (n.activeDashboard.value = "", S.push("dashboard")), g.includes("connections") || (n.activeConnectionKey.value = "", S.push("connections")), g.includes("models") || (n.activeModelKey.value = "", S.push("model")), g.includes("community-models") || (n.activeCommunityModelKey.value = "", S.push("community-models")), g.includes("jobs") || (n.activeJobsKey.value = "", S.push("jobs")), g.includes("tutorial") || (n.activeDocumentationKey.value = "", S.push("tutorial")), g.includes("llms") || (n.activeLLMConnectionKey.value = "", S.push("llms")), g.includes("settings") || S.push("settings"), g.includes("profile") || S.push("profile"), g.includes("welcome") || S.push("welcome"), sr(S);
|
|
4088
|
+
}, y = (g) => {
|
|
4089
|
+
const S = n.tabs.value.findIndex((b) => b.id === g);
|
|
4090
|
+
if (S !== -1) {
|
|
4091
|
+
const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) > S;
|
|
4092
|
+
n.tabs.value.splice(S + 1), p && (n.tabs.value.length > 0 ? E(n.tabs.value[n.tabs.value.length - 1].id) : d("welcome", "Welcome", "welcome"));
|
|
3942
4093
|
}
|
|
3943
4094
|
m();
|
|
3944
|
-
},
|
|
3945
|
-
const b = n.tabs.value.find((p) => p.id ===
|
|
4095
|
+
}, E = (g, S = !1) => {
|
|
4096
|
+
const b = n.tabs.value.find((p) => p.id === g);
|
|
3946
4097
|
if (b) {
|
|
3947
|
-
n.activeTab.value =
|
|
3948
|
-
let p = t.getUnreadTips(
|
|
4098
|
+
n.activeTab.value = g, T(b.screen), u(b.screen, S);
|
|
4099
|
+
let p = t.getUnreadTips(St);
|
|
3949
4100
|
if (b.screen === "editors")
|
|
3950
|
-
n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(
|
|
4101
|
+
n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(Ct));
|
|
3951
4102
|
else if (b.screen === "dashboard")
|
|
3952
|
-
n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(
|
|
4103
|
+
n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(Et));
|
|
3953
4104
|
else if (b.screen === "connections")
|
|
3954
4105
|
n.activeConnectionKey.value = b.address;
|
|
3955
4106
|
else if (b.screen === "llms") {
|
|
3956
4107
|
n.activeLLMConnectionKey.value = b.address;
|
|
3957
|
-
const D = b.address.split(
|
|
4108
|
+
const D = b.address.split(se);
|
|
3958
4109
|
if (D.length > 1) {
|
|
3959
|
-
const
|
|
3960
|
-
o.setActiveChat(
|
|
4110
|
+
const O = D[1];
|
|
4111
|
+
o.setActiveChat(O);
|
|
3961
4112
|
}
|
|
3962
|
-
} else b.screen === "tutorial" ? n.activeDocumentationKey.value = b.address : b.screen === "models" ? n.activeModelKey.value = b.address : b.screen === "dashboard-import" || b.screen === "asset-import" ? p = [] : b.screen === "community-models" ? (n.activeCommunityModelKey.value = b.address, p = p.concat(t.getUnreadTips(
|
|
3963
|
-
n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !
|
|
4113
|
+
} else b.screen === "tutorial" ? n.activeDocumentationKey.value = b.address : b.screen === "models" ? n.activeModelKey.value = b.address : b.screen === "dashboard-import" || b.screen === "asset-import" ? p = [] : b.screen === "community-models" ? (n.activeCommunityModelKey.value = b.address, p = p.concat(t.getUnreadTips(Dt))) : b.screen === "jobs" && (n.activeJobsKey.value = b.address);
|
|
4114
|
+
n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !S && ae(b.screen, b.address);
|
|
3964
4115
|
}
|
|
3965
|
-
},
|
|
3966
|
-
n.activeScreen.value !==
|
|
3967
|
-
},
|
|
3968
|
-
c(
|
|
4116
|
+
}, T = (g) => {
|
|
4117
|
+
n.activeScreen.value !== g && (n.activeScreen.value = g, ae("screen", g));
|
|
4118
|
+
}, x = (g) => {
|
|
4119
|
+
c(g), g == "settings" ? d("settings", "Settings", "settings") : g == "profile" && d("profile", "Profile", "profile");
|
|
3969
4120
|
};
|
|
3970
4121
|
return {
|
|
3971
4122
|
get activeScreen() {
|
|
@@ -4025,153 +4176,153 @@ const zt = () => {
|
|
|
4025
4176
|
get fullScreen() {
|
|
4026
4177
|
return n.fullScreen;
|
|
4027
4178
|
},
|
|
4028
|
-
setActiveScreen:
|
|
4029
|
-
setActiveSidebarScreen:
|
|
4030
|
-
setActiveEditor: (
|
|
4031
|
-
if (
|
|
4032
|
-
|
|
4179
|
+
setActiveScreen: T,
|
|
4180
|
+
setActiveSidebarScreen: x,
|
|
4181
|
+
setActiveEditor: (g) => {
|
|
4182
|
+
if (g === null) {
|
|
4183
|
+
j("editors"), n.activeEditor.value = "";
|
|
4033
4184
|
return;
|
|
4034
4185
|
}
|
|
4035
|
-
d("editors", null,
|
|
4186
|
+
d("editors", null, g);
|
|
4036
4187
|
},
|
|
4037
|
-
setActiveDashboard: (
|
|
4038
|
-
if (
|
|
4039
|
-
|
|
4188
|
+
setActiveDashboard: (g) => {
|
|
4189
|
+
if (g === null) {
|
|
4190
|
+
j("dashboard"), n.activeDashboard.value = "";
|
|
4040
4191
|
return;
|
|
4041
4192
|
}
|
|
4042
|
-
d("dashboard", null,
|
|
4193
|
+
d("dashboard", null, g);
|
|
4043
4194
|
},
|
|
4044
|
-
setActiveConnectionKey: (
|
|
4045
|
-
if (
|
|
4046
|
-
|
|
4195
|
+
setActiveConnectionKey: (g) => {
|
|
4196
|
+
if (g === null) {
|
|
4197
|
+
j("connections"), n.activeConnectionKey.value = "";
|
|
4047
4198
|
return;
|
|
4048
4199
|
}
|
|
4049
|
-
d("connections", null,
|
|
4200
|
+
d("connections", null, g);
|
|
4050
4201
|
},
|
|
4051
|
-
setActiveDocumentationKey: (
|
|
4052
|
-
if (
|
|
4053
|
-
|
|
4202
|
+
setActiveDocumentationKey: (g) => {
|
|
4203
|
+
if (g === null) {
|
|
4204
|
+
j("docs"), n.activeDocumentationKey.value = "";
|
|
4054
4205
|
return;
|
|
4055
4206
|
}
|
|
4056
|
-
let
|
|
4057
|
-
d("tutorial",
|
|
4207
|
+
let S = g.split("+");
|
|
4208
|
+
d("tutorial", S[S.length - 1], g);
|
|
4058
4209
|
},
|
|
4059
|
-
setActiveLLMConnectionKey: (
|
|
4060
|
-
if (
|
|
4061
|
-
|
|
4210
|
+
setActiveLLMConnectionKey: (g) => {
|
|
4211
|
+
if (g === null) {
|
|
4212
|
+
j("llms"), n.activeLLMConnectionKey.value = "";
|
|
4062
4213
|
return;
|
|
4063
4214
|
}
|
|
4064
|
-
d("llms", null,
|
|
4215
|
+
d("llms", null, g);
|
|
4065
4216
|
},
|
|
4066
|
-
setActiveCommunityModelKey: (
|
|
4067
|
-
if (
|
|
4068
|
-
|
|
4217
|
+
setActiveCommunityModelKey: (g) => {
|
|
4218
|
+
if (g === null) {
|
|
4219
|
+
j("community-models"), n.activeCommunityModelKey.value = "";
|
|
4069
4220
|
return;
|
|
4070
4221
|
}
|
|
4071
|
-
n.activeCommunityModelKey.value =
|
|
4222
|
+
n.activeCommunityModelKey.value = g, d("community-models", null, g);
|
|
4072
4223
|
},
|
|
4073
|
-
setActiveJobsKey: (
|
|
4074
|
-
if (
|
|
4075
|
-
|
|
4224
|
+
setActiveJobsKey: (g) => {
|
|
4225
|
+
if (g === null) {
|
|
4226
|
+
j("jobs"), n.activeJobsKey.value = "";
|
|
4076
4227
|
return;
|
|
4077
4228
|
}
|
|
4078
|
-
n.activeJobsKey.value =
|
|
4229
|
+
n.activeJobsKey.value = g, d("jobs", null, g);
|
|
4079
4230
|
},
|
|
4080
4231
|
toggleMobileMenu: () => {
|
|
4081
4232
|
n.mobileMenuOpen.value = !n.mobileMenuOpen.value;
|
|
4082
4233
|
},
|
|
4083
|
-
setActiveModelKey: (
|
|
4084
|
-
if (
|
|
4085
|
-
|
|
4234
|
+
setActiveModelKey: (g) => {
|
|
4235
|
+
if (g === null) {
|
|
4236
|
+
j("model");
|
|
4086
4237
|
return;
|
|
4087
4238
|
}
|
|
4088
|
-
|
|
4239
|
+
ae("model", g), n.activeModelKey.value = g;
|
|
4089
4240
|
},
|
|
4090
|
-
setActiveTab:
|
|
4241
|
+
setActiveTab: E,
|
|
4091
4242
|
openTab: d,
|
|
4092
4243
|
updateTabName: h,
|
|
4093
|
-
closeTab:
|
|
4244
|
+
closeTab: f,
|
|
4094
4245
|
closeOtherTabsExcept: v,
|
|
4095
4246
|
closeTabsToRightOf: y,
|
|
4096
4247
|
onInitialLoad: () => {
|
|
4097
|
-
const
|
|
4248
|
+
const g = n.modelImport.value, S = n.connectionImport.value;
|
|
4098
4249
|
let b = "editors", p = !1;
|
|
4099
|
-
if (
|
|
4100
|
-
const
|
|
4101
|
-
|
|
4250
|
+
if (A("skipTips", "") === "true" && t.updateSetting("skipAllTips", !0), g && S) {
|
|
4251
|
+
const q = A("assetType", ""), k = A("assetName", "");
|
|
4252
|
+
q && k ? d("asset-import", null, "asset-import") : d("dashboard-import", null, "dashboard-import"), p = !0;
|
|
4102
4253
|
}
|
|
4103
|
-
let D = n.activeScreen.value,
|
|
4104
|
-
const
|
|
4105
|
-
n.activeEditor.value && !p &&
|
|
4254
|
+
let D = n.activeScreen.value, O = n.activeSidebarScreen.value;
|
|
4255
|
+
const $ = [];
|
|
4256
|
+
n.activeEditor.value && !p && $.push({
|
|
4106
4257
|
screen: "editors",
|
|
4107
4258
|
title: null,
|
|
4108
4259
|
key: n.activeEditor.value,
|
|
4109
4260
|
isActive: D === "editors"
|
|
4110
|
-
}), n.activeDashboard.value && !p &&
|
|
4261
|
+
}), n.activeDashboard.value && !p && $.push({
|
|
4111
4262
|
screen: "dashboard",
|
|
4112
4263
|
title: null,
|
|
4113
4264
|
key: n.activeDashboard.value,
|
|
4114
4265
|
isActive: D === "dashboard"
|
|
4115
|
-
}), n.activeConnectionKey.value && !p &&
|
|
4266
|
+
}), n.activeConnectionKey.value && !p && $.push({
|
|
4116
4267
|
screen: "connections",
|
|
4117
4268
|
title: null,
|
|
4118
4269
|
key: n.activeConnectionKey.value,
|
|
4119
4270
|
isActive: D === "connections"
|
|
4120
|
-
}), n.activeModelKey.value && !p &&
|
|
4271
|
+
}), n.activeModelKey.value && !p && $.push({
|
|
4121
4272
|
screen: "models",
|
|
4122
4273
|
title: null,
|
|
4123
4274
|
key: n.activeModelKey.value,
|
|
4124
4275
|
isActive: D === "models"
|
|
4125
|
-
}), n.activeCommunityModelKey.value && !p &&
|
|
4276
|
+
}), n.activeCommunityModelKey.value && !p && $.push({
|
|
4126
4277
|
screen: "community-models",
|
|
4127
4278
|
title: null,
|
|
4128
4279
|
key: n.activeCommunityModelKey.value,
|
|
4129
4280
|
isActive: D === "community-models"
|
|
4130
|
-
}), n.activeJobsKey.value && !p &&
|
|
4281
|
+
}), n.activeJobsKey.value && !p && $.push({
|
|
4131
4282
|
screen: "jobs",
|
|
4132
4283
|
title: null,
|
|
4133
4284
|
key: n.activeJobsKey.value,
|
|
4134
4285
|
isActive: D === "jobs"
|
|
4135
|
-
}), n.activeDocumentationKey.value && !p &&
|
|
4286
|
+
}), n.activeDocumentationKey.value && !p && $.push({
|
|
4136
4287
|
screen: "tutorial",
|
|
4137
4288
|
title: null,
|
|
4138
4289
|
key: n.activeDocumentationKey.value,
|
|
4139
4290
|
isActive: D === "tutorial"
|
|
4140
|
-
}), n.activeLLMConnectionKey.value && !p &&
|
|
4291
|
+
}), n.activeLLMConnectionKey.value && !p && $.push({
|
|
4141
4292
|
screen: "llms",
|
|
4142
4293
|
title: null,
|
|
4143
4294
|
key: n.activeLLMConnectionKey.value,
|
|
4144
4295
|
isActive: D === "llms"
|
|
4145
|
-
}), n.activeSidebarScreen.value === "settings" &&
|
|
4296
|
+
}), n.activeSidebarScreen.value === "settings" && $.push({
|
|
4146
4297
|
screen: "settings",
|
|
4147
4298
|
title: "Settings",
|
|
4148
4299
|
key: "settings",
|
|
4149
4300
|
isActive: D === "settings"
|
|
4150
|
-
}), n.activeSidebarScreen.value === "profile" &&
|
|
4301
|
+
}), n.activeSidebarScreen.value === "profile" && $.push({
|
|
4151
4302
|
screen: "profile",
|
|
4152
4303
|
title: "Profile",
|
|
4153
4304
|
key: "profile",
|
|
4154
4305
|
isActive: D === "profile"
|
|
4155
|
-
}),
|
|
4156
|
-
d(
|
|
4157
|
-
}),
|
|
4306
|
+
}), $.sort((q, k) => q.isActive ? 1 : k.isActive ? -1 : 0), $.forEach((q) => {
|
|
4307
|
+
d(q.screen, q.title, q.key, !0);
|
|
4308
|
+
}), T(D), !O && $.length > 0 ? b = $[$.length - 1].screen : O && (b = O), x(b);
|
|
4158
4309
|
},
|
|
4159
|
-
toggleFullScreen: (
|
|
4160
|
-
n.fullScreen.value =
|
|
4310
|
+
toggleFullScreen: (g) => {
|
|
4311
|
+
n.fullScreen.value = g;
|
|
4161
4312
|
},
|
|
4162
4313
|
addBackListeners: () => {
|
|
4163
4314
|
i || (i = window.addEventListener("hashchange", () => {
|
|
4164
|
-
const
|
|
4165
|
-
let
|
|
4166
|
-
|
|
4167
|
-
const
|
|
4315
|
+
const g = A("editors", ""), S = A("dashboard", ""), b = A("connections", ""), p = A("model", ""), D = A("community-models", ""), O = A("jobs", ""), $ = A("docs", ""), q = A("llms", ""), k = A("screen", ""), J = A("sidebarScreen", "");
|
|
4316
|
+
let ee = !1;
|
|
4317
|
+
J !== n.activeSidebarScreen.value && x(J), k !== n.activeScreen.value && (n.activeScreen.value = k, ee = !0);
|
|
4318
|
+
const te = [
|
|
4168
4319
|
{
|
|
4169
|
-
hash:
|
|
4320
|
+
hash: g,
|
|
4170
4321
|
screen: "editors",
|
|
4171
4322
|
current: n.activeEditor.value
|
|
4172
4323
|
},
|
|
4173
4324
|
{
|
|
4174
|
-
hash:
|
|
4325
|
+
hash: S,
|
|
4175
4326
|
screen: "dashboard",
|
|
4176
4327
|
current: n.activeDashboard.value
|
|
4177
4328
|
},
|
|
@@ -4191,32 +4342,32 @@ const zt = () => {
|
|
|
4191
4342
|
current: n.activeCommunityModelKey.value
|
|
4192
4343
|
},
|
|
4193
4344
|
{
|
|
4194
|
-
hash:
|
|
4345
|
+
hash: O,
|
|
4195
4346
|
screen: "jobs",
|
|
4196
4347
|
current: n.activeJobsKey.value
|
|
4197
4348
|
},
|
|
4198
4349
|
{
|
|
4199
|
-
hash:
|
|
4350
|
+
hash: $,
|
|
4200
4351
|
screen: "tutorial",
|
|
4201
4352
|
current: n.activeDocumentationKey.value
|
|
4202
4353
|
},
|
|
4203
4354
|
{
|
|
4204
|
-
hash:
|
|
4355
|
+
hash: q,
|
|
4205
4356
|
screen: "llms",
|
|
4206
4357
|
current: n.activeLLMConnectionKey.value
|
|
4207
4358
|
}
|
|
4208
4359
|
];
|
|
4209
|
-
for (const { hash: H, screen:
|
|
4210
|
-
if (H && H !==
|
|
4211
|
-
const
|
|
4212
|
-
(
|
|
4360
|
+
for (const { hash: H, screen: me, current: et } of te)
|
|
4361
|
+
if (H && H !== et || me === k && ee) {
|
|
4362
|
+
const re = n.tabs.value.find(
|
|
4363
|
+
(ge) => ge.screen === me && ge.screen === k && ge.address === H
|
|
4213
4364
|
);
|
|
4214
|
-
if (
|
|
4215
|
-
|
|
4365
|
+
if (re && re.id !== n.activeTab.value) {
|
|
4366
|
+
E(re.id, !0);
|
|
4216
4367
|
break;
|
|
4217
4368
|
}
|
|
4218
|
-
if (!
|
|
4219
|
-
d(
|
|
4369
|
+
if (!re && H) {
|
|
4370
|
+
d(me, null, H);
|
|
4220
4371
|
break;
|
|
4221
4372
|
}
|
|
4222
4373
|
}
|
|
@@ -4227,12 +4378,12 @@ const zt = () => {
|
|
|
4227
4378
|
}
|
|
4228
4379
|
};
|
|
4229
4380
|
};
|
|
4230
|
-
let
|
|
4231
|
-
function
|
|
4232
|
-
return
|
|
4381
|
+
let we = null;
|
|
4382
|
+
function qr() {
|
|
4383
|
+
return we || (we = or()), we;
|
|
4233
4384
|
}
|
|
4234
|
-
const
|
|
4235
|
-
class
|
|
4385
|
+
const ve = 100;
|
|
4386
|
+
class nr {
|
|
4236
4387
|
constructor() {
|
|
4237
4388
|
w(this, "dbName");
|
|
4238
4389
|
w(this, "storeName");
|
|
@@ -4287,7 +4438,7 @@ class Ht {
|
|
|
4287
4438
|
});
|
|
4288
4439
|
}
|
|
4289
4440
|
// Get query history for a specific connection
|
|
4290
|
-
async getQueriesForConnection(e, t =
|
|
4441
|
+
async getQueriesForConnection(e, t = ve) {
|
|
4291
4442
|
return this.db || await this._initDB(), new Promise((s, o) => {
|
|
4292
4443
|
if (!this.db) {
|
|
4293
4444
|
o(new Error("Database not initialized"));
|
|
@@ -4328,15 +4479,15 @@ class Ht {
|
|
|
4328
4479
|
const n = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).index("connectionName"), a = n.count(IDBKeyRange.only(e));
|
|
4329
4480
|
a.onsuccess = () => {
|
|
4330
4481
|
const c = a.result;
|
|
4331
|
-
if (c <=
|
|
4482
|
+
if (c <= ve) {
|
|
4332
4483
|
t();
|
|
4333
4484
|
return;
|
|
4334
4485
|
}
|
|
4335
|
-
const u = c -
|
|
4486
|
+
const u = c - ve, l = n.openCursor(IDBKeyRange.only(e));
|
|
4336
4487
|
let h = 0;
|
|
4337
4488
|
l.onsuccess = (d) => {
|
|
4338
|
-
const
|
|
4339
|
-
|
|
4489
|
+
const f = d.target.result;
|
|
4490
|
+
f && h < u ? (f.delete(), h++, f.continue()) : t();
|
|
4340
4491
|
}, l.onerror = (d) => {
|
|
4341
4492
|
console.error("Error trimming history:", d.target.error), s(d.target.error);
|
|
4342
4493
|
};
|
|
@@ -4346,13 +4497,13 @@ class Ht {
|
|
|
4346
4497
|
});
|
|
4347
4498
|
}
|
|
4348
4499
|
}
|
|
4349
|
-
let
|
|
4350
|
-
const
|
|
4351
|
-
function
|
|
4500
|
+
let Se = null;
|
|
4501
|
+
const Ce = () => (Se || (Se = new nr()), Se);
|
|
4502
|
+
function ce(r) {
|
|
4352
4503
|
const e = Q([]), t = Q(!0), s = Q(null), o = async () => {
|
|
4353
4504
|
t.value = !0;
|
|
4354
4505
|
try {
|
|
4355
|
-
const c = await
|
|
4506
|
+
const c = await Ce().getQueriesForConnection(r);
|
|
4356
4507
|
e.value = c, s.value = null;
|
|
4357
4508
|
} catch (c) {
|
|
4358
4509
|
console.error("Failed to load query history:", c), s.value = "Failed to load query history";
|
|
@@ -4361,14 +4512,14 @@ function ne(r) {
|
|
|
4361
4512
|
}
|
|
4362
4513
|
}, i = async (c) => {
|
|
4363
4514
|
try {
|
|
4364
|
-
await
|
|
4515
|
+
await Ce().addQuery(r, c), await o();
|
|
4365
4516
|
} catch (u) {
|
|
4366
4517
|
console.error("Failed to record query:", u), s.value = "Failed to record query";
|
|
4367
4518
|
}
|
|
4368
4519
|
}, n = async () => {
|
|
4369
4520
|
t.value = !0;
|
|
4370
4521
|
try {
|
|
4371
|
-
await
|
|
4522
|
+
await Ce().clearConnectionHistory(r), e.value = [], s.value = null;
|
|
4372
4523
|
} catch (c) {
|
|
4373
4524
|
console.error("Failed to clear query history:", c), s.value = "Failed to clear query history";
|
|
4374
4525
|
} finally {
|
|
@@ -4376,19 +4527,19 @@ function ne(r) {
|
|
|
4376
4527
|
}
|
|
4377
4528
|
}, a = async (c, u) => {
|
|
4378
4529
|
const l = performance.now();
|
|
4379
|
-
let h = "success", d = null,
|
|
4530
|
+
let h = "success", d = null, f = 0, v = 0, m = null;
|
|
4380
4531
|
try {
|
|
4381
|
-
m = await c(u), m && Array.isArray(m) && (
|
|
4532
|
+
m = await c(u), m && Array.isArray(m) && (f = m.length, f > 0 && typeof m[0] == "object" && (v = Object.keys(m[0]).length));
|
|
4382
4533
|
} catch (y) {
|
|
4383
4534
|
throw h = "error", d = y instanceof Error ? y.message : String(y), y;
|
|
4384
4535
|
} finally {
|
|
4385
|
-
const
|
|
4536
|
+
const E = performance.now() - l;
|
|
4386
4537
|
await i({
|
|
4387
4538
|
query: u,
|
|
4388
|
-
executionTime:
|
|
4539
|
+
executionTime: E,
|
|
4389
4540
|
status: h,
|
|
4390
4541
|
errorMessage: d,
|
|
4391
|
-
resultSize:
|
|
4542
|
+
resultSize: f,
|
|
4392
4543
|
resultColumns: v
|
|
4393
4544
|
});
|
|
4394
4545
|
}
|
|
@@ -4404,7 +4555,7 @@ function ne(r) {
|
|
|
4404
4555
|
refreshHistory: o
|
|
4405
4556
|
};
|
|
4406
4557
|
}
|
|
4407
|
-
class
|
|
4558
|
+
class ir {
|
|
4408
4559
|
constructor(e) {
|
|
4409
4560
|
this.connection = e;
|
|
4410
4561
|
}
|
|
@@ -4421,13 +4572,13 @@ class Wt {
|
|
|
4421
4572
|
return this.connection.query(e, t ?? null);
|
|
4422
4573
|
}
|
|
4423
4574
|
}
|
|
4424
|
-
class
|
|
4575
|
+
class ar {
|
|
4425
4576
|
constructor(e) {
|
|
4426
4577
|
this.connectionStore = e;
|
|
4427
4578
|
}
|
|
4428
4579
|
getConnection(e) {
|
|
4429
4580
|
const t = this.connectionStore.connections[e];
|
|
4430
|
-
return t ? new
|
|
4581
|
+
return t ? new ir(t) : null;
|
|
4431
4582
|
}
|
|
4432
4583
|
async ensureConnected(e) {
|
|
4433
4584
|
const t = this.connectionStore.connections[e];
|
|
@@ -4439,16 +4590,16 @@ class Gt {
|
|
|
4439
4590
|
return this.connectionStore.getConnectionSources(e);
|
|
4440
4591
|
}
|
|
4441
4592
|
}
|
|
4442
|
-
function
|
|
4593
|
+
function cr(r) {
|
|
4443
4594
|
return typeof r.getConnection == "function" && typeof r.ensureConnected == "function";
|
|
4444
4595
|
}
|
|
4445
|
-
class
|
|
4596
|
+
class kr {
|
|
4446
4597
|
constructor(e, t, s = !0) {
|
|
4447
4598
|
w(this, "trilogyResolver");
|
|
4448
4599
|
w(this, "connectionProvider");
|
|
4449
4600
|
w(this, "storeHistory");
|
|
4450
4601
|
w(this, "eligibleCrossFilterFieldsCache", /* @__PURE__ */ new Map());
|
|
4451
|
-
this.trilogyResolver = e, this.connectionProvider =
|
|
4602
|
+
this.trilogyResolver = e, this.connectionProvider = cr(t) ? t : new ar(t), this.storeHistory = s;
|
|
4452
4603
|
}
|
|
4453
4604
|
async executeQueriesBatch(e, t, s, o = [], i, n = {}, a, c, u, l, h = !1, d) {
|
|
4454
4605
|
if (s === "python")
|
|
@@ -4464,7 +4615,7 @@ class Er {
|
|
|
4464
4615
|
executionTime: 0
|
|
4465
4616
|
})
|
|
4466
4617
|
};
|
|
4467
|
-
const
|
|
4618
|
+
const f = (/* @__PURE__ */ new Date()).getTime(), v = new AbortController();
|
|
4468
4619
|
return {
|
|
4469
4620
|
cancellation: {
|
|
4470
4621
|
cancel: () => v.abort(),
|
|
@@ -4477,7 +4628,7 @@ class Er {
|
|
|
4477
4628
|
o,
|
|
4478
4629
|
i || [],
|
|
4479
4630
|
n,
|
|
4480
|
-
|
|
4631
|
+
f,
|
|
4481
4632
|
v,
|
|
4482
4633
|
a,
|
|
4483
4634
|
c,
|
|
@@ -4488,33 +4639,34 @@ class Er {
|
|
|
4488
4639
|
)
|
|
4489
4640
|
};
|
|
4490
4641
|
}
|
|
4491
|
-
async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d,
|
|
4642
|
+
async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d, f = !1, v) {
|
|
4643
|
+
var E;
|
|
4492
4644
|
u && u();
|
|
4493
4645
|
const m = this.connectionProvider.getConnection(e);
|
|
4494
4646
|
if (!m)
|
|
4495
4647
|
return {
|
|
4496
4648
|
success: !1,
|
|
4497
4649
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4498
|
-
results: t.map((
|
|
4650
|
+
results: t.map((T) => ({
|
|
4499
4651
|
success: !1,
|
|
4500
4652
|
generated_sql: "",
|
|
4501
4653
|
columns: [],
|
|
4502
4654
|
error: `Connection ${e} not found.`,
|
|
4503
4655
|
executionTime: 0,
|
|
4504
|
-
results: new
|
|
4656
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4505
4657
|
resultSize: 0,
|
|
4506
4658
|
columnCount: 0
|
|
4507
4659
|
}))
|
|
4508
4660
|
};
|
|
4509
|
-
if (
|
|
4661
|
+
if (f)
|
|
4510
4662
|
return {
|
|
4511
4663
|
success: !0,
|
|
4512
|
-
results: t.map((
|
|
4664
|
+
results: t.map((T) => ({
|
|
4513
4665
|
success: !0,
|
|
4514
|
-
generated_sql:
|
|
4666
|
+
generated_sql: T.query,
|
|
4515
4667
|
columns: [],
|
|
4516
4668
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4517
|
-
results: new
|
|
4669
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4518
4670
|
resultSize: 0,
|
|
4519
4671
|
columnCount: 0
|
|
4520
4672
|
})),
|
|
@@ -4542,7 +4694,7 @@ class Er {
|
|
|
4542
4694
|
columns: [],
|
|
4543
4695
|
error: `Connection ${e} not active, failed to reconnect.`,
|
|
4544
4696
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4545
|
-
results: new
|
|
4697
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4546
4698
|
columnCount: 0,
|
|
4547
4699
|
resultSize: 0
|
|
4548
4700
|
}))
|
|
@@ -4551,7 +4703,7 @@ class Er {
|
|
|
4551
4703
|
let y = this.connectionProvider.getConnectionSources(e);
|
|
4552
4704
|
v && (y = y.concat(v));
|
|
4553
4705
|
try {
|
|
4554
|
-
const
|
|
4706
|
+
const T = await Promise.race([
|
|
4555
4707
|
this.trilogyResolver.resolve_queries_batch(
|
|
4556
4708
|
t,
|
|
4557
4709
|
m.queryType,
|
|
@@ -4559,90 +4711,94 @@ class Er {
|
|
|
4559
4711
|
o,
|
|
4560
4712
|
i
|
|
4561
4713
|
),
|
|
4562
|
-
new Promise((
|
|
4714
|
+
new Promise((F, C) => {
|
|
4563
4715
|
c.signal.addEventListener(
|
|
4564
4716
|
"abort",
|
|
4565
|
-
() =>
|
|
4717
|
+
() => C(new Error("Query batch cancelled by user"))
|
|
4566
4718
|
);
|
|
4567
4719
|
})
|
|
4568
4720
|
]), x = [];
|
|
4569
|
-
if (
|
|
4570
|
-
for (let
|
|
4571
|
-
const
|
|
4572
|
-
if (
|
|
4721
|
+
if (T && Array.isArray(T.data.queries))
|
|
4722
|
+
for (let F = 0; F < T.data.queries.length; F++) {
|
|
4723
|
+
const C = T.data.queries[F];
|
|
4724
|
+
if (C.generated_sql) {
|
|
4725
|
+
const M = {
|
|
4726
|
+
...((E = t[F]) == null ? void 0 : E.parameters) || {},
|
|
4727
|
+
...C.parameters || {}
|
|
4728
|
+
}, X = Object.keys(M).length ? M : null;
|
|
4573
4729
|
try {
|
|
4574
|
-
const
|
|
4575
|
-
m.executeSql(
|
|
4576
|
-
new Promise((
|
|
4730
|
+
const P = await Promise.race([
|
|
4731
|
+
m.executeSql(C.generated_sql, X),
|
|
4732
|
+
new Promise((Z, Fe) => {
|
|
4577
4733
|
c.signal.addEventListener(
|
|
4578
4734
|
"abort",
|
|
4579
|
-
() =>
|
|
4735
|
+
() => Fe(new Error("Query execution cancelled by user"))
|
|
4580
4736
|
);
|
|
4581
4737
|
})
|
|
4582
4738
|
]);
|
|
4583
|
-
(s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(
|
|
4584
|
-
let
|
|
4739
|
+
(s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(C.columns || [], P);
|
|
4740
|
+
let R = {
|
|
4585
4741
|
success: !0,
|
|
4586
|
-
generatedSql:
|
|
4587
|
-
results:
|
|
4588
|
-
resultSize:
|
|
4589
|
-
columnCount:
|
|
4742
|
+
generatedSql: C.generated_sql,
|
|
4743
|
+
results: P,
|
|
4744
|
+
resultSize: P.data.length,
|
|
4745
|
+
columnCount: P.headers.size,
|
|
4590
4746
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a
|
|
4591
4747
|
};
|
|
4592
|
-
d &&
|
|
4593
|
-
query: t[
|
|
4594
|
-
generatedQuery:
|
|
4748
|
+
d && C.label && d[C.label] && d[C.label](R), x.push(R), this.storeHistory && ce(e).recordQuery({
|
|
4749
|
+
query: t[F].query,
|
|
4750
|
+
generatedQuery: C.generated_sql,
|
|
4595
4751
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4596
4752
|
status: "success",
|
|
4597
|
-
resultSize:
|
|
4598
|
-
resultColumns:
|
|
4753
|
+
resultSize: P.data.length,
|
|
4754
|
+
resultColumns: P.headers.size,
|
|
4599
4755
|
errorMessage: null,
|
|
4600
4756
|
extraFilters: i
|
|
4601
4757
|
});
|
|
4602
|
-
} catch (
|
|
4603
|
-
const
|
|
4604
|
-
let
|
|
4758
|
+
} catch (P) {
|
|
4759
|
+
const R = c.signal.aborted ? "Query execution cancelled by user" : P instanceof Error ? P.message : "Unknown error occurred during execution";
|
|
4760
|
+
let Z = {
|
|
4605
4761
|
success: !1,
|
|
4606
|
-
error:
|
|
4607
|
-
generatedSql:
|
|
4608
|
-
results: new
|
|
4762
|
+
error: R,
|
|
4763
|
+
generatedSql: C.generated_sql,
|
|
4764
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4609
4765
|
resultSize: 0,
|
|
4610
4766
|
columnCount: 0,
|
|
4611
4767
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a
|
|
4612
4768
|
};
|
|
4613
|
-
x.push(
|
|
4614
|
-
query: t[
|
|
4615
|
-
generatedQuery:
|
|
4769
|
+
x.push(Z), console.error("Error callback for ", C.label, h), console.error("Error details:", P), h && C.label && h[C.label] && h[C.label](Z), this.storeHistory && ce(e).recordQuery({
|
|
4770
|
+
query: t[F].query,
|
|
4771
|
+
generatedQuery: C.generated_sql,
|
|
4616
4772
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4617
4773
|
status: "error",
|
|
4618
4774
|
resultSize: 0,
|
|
4619
4775
|
resultColumns: 0,
|
|
4620
|
-
errorMessage:
|
|
4776
|
+
errorMessage: R,
|
|
4621
4777
|
extraFilters: i
|
|
4622
4778
|
});
|
|
4623
4779
|
}
|
|
4624
|
-
else if (
|
|
4625
|
-
let
|
|
4780
|
+
} else if (C.error) {
|
|
4781
|
+
let M = {
|
|
4626
4782
|
success: !1,
|
|
4627
|
-
error:
|
|
4783
|
+
error: C.error,
|
|
4628
4784
|
generatedSql: "",
|
|
4629
4785
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4630
|
-
results: new
|
|
4786
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4631
4787
|
resultSize: 0,
|
|
4632
4788
|
columnCount: 0
|
|
4633
4789
|
};
|
|
4634
|
-
h &&
|
|
4790
|
+
h && C.label && h[C.label] && h[C.label](M), x.push(M);
|
|
4635
4791
|
} else {
|
|
4636
|
-
let
|
|
4792
|
+
let M = {
|
|
4637
4793
|
success: !1,
|
|
4638
4794
|
error: "No SQL was generated for this query",
|
|
4639
4795
|
generatedSql: "",
|
|
4640
4796
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
|
|
4641
|
-
results: new
|
|
4797
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4642
4798
|
resultSize: 0,
|
|
4643
4799
|
columnCount: 0
|
|
4644
4800
|
};
|
|
4645
|
-
x.push(
|
|
4801
|
+
x.push(M), h && C.label && h[C.label] && h[C.label](M);
|
|
4646
4802
|
}
|
|
4647
4803
|
}
|
|
4648
4804
|
return {
|
|
@@ -4650,10 +4806,10 @@ class Er {
|
|
|
4650
4806
|
results: x,
|
|
4651
4807
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - a
|
|
4652
4808
|
};
|
|
4653
|
-
} catch (
|
|
4654
|
-
const x = c.signal.aborted ? "Query batch cancelled by user" :
|
|
4809
|
+
} catch (T) {
|
|
4810
|
+
const x = c.signal.aborted ? "Query batch cancelled by user" : T instanceof Error ? T.message : "Unknown error occurred";
|
|
4655
4811
|
return h && Object.values(h).forEach(
|
|
4656
|
-
(
|
|
4812
|
+
(_) => _({
|
|
4657
4813
|
message: x,
|
|
4658
4814
|
error: !0,
|
|
4659
4815
|
running: !1
|
|
@@ -4780,7 +4936,7 @@ class Er {
|
|
|
4780
4936
|
currentFilename: t.currentFilename
|
|
4781
4937
|
},
|
|
4782
4938
|
!1
|
|
4783
|
-
), h =
|
|
4939
|
+
), h = At((l == null ? void 0 : l.data.completion_items) ?? []);
|
|
4784
4940
|
return this.eligibleCrossFilterFieldsCache.set(c, h), [...h];
|
|
4785
4941
|
}
|
|
4786
4942
|
clearEligibleCrossFilterFieldsCache() {
|
|
@@ -4823,8 +4979,8 @@ class Er {
|
|
|
4823
4979
|
};
|
|
4824
4980
|
}
|
|
4825
4981
|
i && i();
|
|
4826
|
-
const
|
|
4827
|
-
if (!
|
|
4982
|
+
const f = this.connectionProvider.getConnection(e);
|
|
4983
|
+
if (!f)
|
|
4828
4984
|
return {
|
|
4829
4985
|
success: !1,
|
|
4830
4986
|
error: `Connection ${e} not found.`,
|
|
@@ -4832,7 +4988,7 @@ class Er {
|
|
|
4832
4988
|
resultSize: 0,
|
|
4833
4989
|
columnCount: 0
|
|
4834
4990
|
};
|
|
4835
|
-
if (!
|
|
4991
|
+
if (!f.isConnected() && !u)
|
|
4836
4992
|
try {
|
|
4837
4993
|
n && n({
|
|
4838
4994
|
message: "Connection is not active... Attempting to automatically reconnect.",
|
|
@@ -4858,7 +5014,7 @@ class Er {
|
|
|
4858
5014
|
if (m = await Promise.race([
|
|
4859
5015
|
this.trilogyResolver.resolve_query(
|
|
4860
5016
|
t.text,
|
|
4861
|
-
|
|
5017
|
+
f.queryType,
|
|
4862
5018
|
t.editorType,
|
|
4863
5019
|
v,
|
|
4864
5020
|
t.imports,
|
|
@@ -4866,53 +5022,56 @@ class Er {
|
|
|
4866
5022
|
t.parameters,
|
|
4867
5023
|
t.currentFilename || null
|
|
4868
5024
|
),
|
|
4869
|
-
new Promise((
|
|
5025
|
+
new Promise((F, C) => {
|
|
4870
5026
|
o.signal.addEventListener(
|
|
4871
5027
|
"abort",
|
|
4872
|
-
() =>
|
|
5028
|
+
() => C(new Error("Query cancelled by user"))
|
|
4873
5029
|
);
|
|
4874
5030
|
})
|
|
4875
5031
|
]), m && m.data.generated_output) {
|
|
4876
|
-
let
|
|
5032
|
+
let F = m.data.columns || [], C = {
|
|
4877
5033
|
success: !0,
|
|
4878
5034
|
// hardcode result types for now
|
|
4879
5035
|
generatedSql: m.data.generated_sql,
|
|
4880
|
-
results: new
|
|
5036
|
+
results: new B(
|
|
4881
5037
|
new Map(
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
{ name:
|
|
5038
|
+
F.map((M) => [
|
|
5039
|
+
M.name,
|
|
5040
|
+
{ name: M.name, type: mt.STRING, purpose: M.purpose }
|
|
4885
5041
|
])
|
|
4886
5042
|
),
|
|
4887
5043
|
m.data.generated_output
|
|
4888
5044
|
),
|
|
4889
5045
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4890
5046
|
resultSize: m.data.generated_output.length,
|
|
4891
|
-
columnCount:
|
|
5047
|
+
columnCount: F.length,
|
|
4892
5048
|
selectCount: m.data.select_count
|
|
4893
5049
|
};
|
|
4894
|
-
return console.log(
|
|
5050
|
+
return console.log(C), c && c(C), C;
|
|
4895
5051
|
} else if (!m || !m.data.generated_sql || u) {
|
|
4896
|
-
let
|
|
5052
|
+
let F = {
|
|
4897
5053
|
success: !0,
|
|
4898
|
-
results: new
|
|
5054
|
+
results: new B(/* @__PURE__ */ new Map(), []),
|
|
4899
5055
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4900
5056
|
resultSize: 0,
|
|
4901
5057
|
columnCount: 0
|
|
4902
5058
|
};
|
|
4903
|
-
return c && c(
|
|
5059
|
+
return c && c(F), F;
|
|
4904
5060
|
}
|
|
4905
5061
|
d = m.data.generated_sql;
|
|
4906
|
-
const y = m.data.columns,
|
|
4907
|
-
|
|
4908
|
-
|
|
5062
|
+
const y = m.data.columns, E = {
|
|
5063
|
+
...t.parameters || {},
|
|
5064
|
+
...m.data.parameters || {}
|
|
5065
|
+
}, T = Object.keys(E).length ? E : null, x = await Promise.race([
|
|
5066
|
+
f.executeSql(d, T),
|
|
5067
|
+
new Promise((F, C) => {
|
|
4909
5068
|
o.signal.addEventListener(
|
|
4910
5069
|
"abort",
|
|
4911
|
-
() =>
|
|
5070
|
+
() => C(new Error("Query cancelled by user"))
|
|
4912
5071
|
);
|
|
4913
5072
|
})
|
|
4914
5073
|
]);
|
|
4915
|
-
(t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y,
|
|
5074
|
+
(t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y, x), l = x.data.length, h = x.headers.size, this.storeHistory && ce(e).recordQuery({
|
|
4916
5075
|
query: t.text,
|
|
4917
5076
|
generatedQuery: d,
|
|
4918
5077
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
@@ -4922,42 +5081,42 @@ class Er {
|
|
|
4922
5081
|
errorMessage: null,
|
|
4923
5082
|
extraFilters: t.extraFilters
|
|
4924
5083
|
});
|
|
4925
|
-
const
|
|
5084
|
+
const _ = m == null ? void 0 : m.data.select_count;
|
|
4926
5085
|
return c && c({
|
|
4927
5086
|
success: !0,
|
|
4928
5087
|
generatedSql: d,
|
|
4929
|
-
results:
|
|
5088
|
+
results: x,
|
|
4930
5089
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4931
5090
|
resultSize: l,
|
|
4932
5091
|
columnCount: h,
|
|
4933
|
-
selectCount:
|
|
5092
|
+
selectCount: _
|
|
4934
5093
|
}), {
|
|
4935
5094
|
success: !0,
|
|
4936
5095
|
generatedSql: d,
|
|
4937
|
-
results:
|
|
5096
|
+
results: x,
|
|
4938
5097
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4939
5098
|
resultSize: l,
|
|
4940
5099
|
columnCount: h,
|
|
4941
|
-
selectCount:
|
|
5100
|
+
selectCount: _
|
|
4942
5101
|
};
|
|
4943
5102
|
} catch (y) {
|
|
4944
|
-
const
|
|
4945
|
-
return this.storeHistory &&
|
|
5103
|
+
const E = o.signal.aborted ? "Query cancelled by user" : y instanceof Error ? y.message : "Unknown error occurred";
|
|
5104
|
+
return this.storeHistory && ce(e).recordQuery({
|
|
4946
5105
|
query: t.text,
|
|
4947
5106
|
generatedQuery: d,
|
|
4948
5107
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4949
5108
|
status: "error",
|
|
4950
5109
|
resultSize: l,
|
|
4951
5110
|
resultColumns: h,
|
|
4952
|
-
errorMessage:
|
|
5111
|
+
errorMessage: E
|
|
4953
5112
|
}), a && a({
|
|
4954
|
-
message:
|
|
5113
|
+
message: E,
|
|
4955
5114
|
error: !0,
|
|
4956
5115
|
running: !1,
|
|
4957
5116
|
generatedSql: d
|
|
4958
5117
|
}), {
|
|
4959
5118
|
success: !1,
|
|
4960
|
-
error:
|
|
5119
|
+
error: E,
|
|
4961
5120
|
executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
|
|
4962
5121
|
resultSize: l,
|
|
4963
5122
|
columnCount: h
|
|
@@ -4967,52 +5126,52 @@ class Er {
|
|
|
4967
5126
|
enrichTrilogyColumns(e, t) {
|
|
4968
5127
|
for (let s = 0; s < e.length; s++) {
|
|
4969
5128
|
let o = e[s], i = t.headers.get(o.name.replace("local.", "").replaceAll(".", "_"));
|
|
4970
|
-
i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, t.headers.set(i.name, i));
|
|
5129
|
+
i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, i.keys = o.keys || [], t.headers.set(i.name, i));
|
|
4971
5130
|
}
|
|
4972
5131
|
}
|
|
4973
5132
|
}
|
|
4974
5133
|
export {
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5134
|
+
ce as A,
|
|
5135
|
+
Xe as B,
|
|
5136
|
+
ar as C,
|
|
5137
|
+
Nt as D,
|
|
5138
|
+
Vt as E,
|
|
5139
|
+
Tr as F,
|
|
5140
|
+
$r as G,
|
|
5141
|
+
Ar as H,
|
|
5142
|
+
Ze as I,
|
|
5143
|
+
Qr as J,
|
|
5144
|
+
Fr as K,
|
|
5145
|
+
_r as L,
|
|
5146
|
+
Te as M,
|
|
5147
|
+
ne as N,
|
|
5148
|
+
Rt as O,
|
|
5149
|
+
kr as Q,
|
|
5150
|
+
Sr as T,
|
|
5151
|
+
Jt as a,
|
|
5152
|
+
le as b,
|
|
5153
|
+
Or as c,
|
|
5154
|
+
rr as d,
|
|
5155
|
+
qr as e,
|
|
5156
|
+
Ue as f,
|
|
5157
|
+
A as g,
|
|
5158
|
+
L as h,
|
|
5159
|
+
Er as i,
|
|
5160
|
+
V as j,
|
|
5161
|
+
Mt as k,
|
|
5162
|
+
De as l,
|
|
5163
|
+
jt as m,
|
|
5164
|
+
K as n,
|
|
5165
|
+
It as o,
|
|
5166
|
+
At as p,
|
|
5167
|
+
qt as q,
|
|
5168
|
+
j as r,
|
|
5169
|
+
Lt as s,
|
|
5170
|
+
Pt as t,
|
|
5171
|
+
Dr as u,
|
|
5172
|
+
fe as v,
|
|
5173
|
+
Cr as w,
|
|
5174
|
+
ae as x,
|
|
5175
|
+
xr as y,
|
|
5176
|
+
be as z
|
|
5018
5177
|
};
|