@trilogy-data/trilogy-studio-components 0.1.28 → 0.1.30
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/README.md +1 -0
- package/dist/AssetAutoImporter-BA8C4p09.js +403 -0
- package/dist/{ChatCreatorModal-Cd40SvdM.js → ChatCreatorModal-94gZ9D-y.js} +1 -1
- package/dist/{CodeBlock-Dj-GfTbW.js → CodeBlock-C9o09ipr.js} +1 -1
- package/dist/{CommunityModels-lX2RhHCG.js → CommunityModels-D48H9Bqt.js} +6 -6
- package/dist/{ConnectionView-CZ06qjjE.js → ConnectionView-sEXGE8Vs.js} +5 -5
- package/dist/{CreateEditorFromDatasourcePopup-DwA938kf.js → CreateEditorFromDatasourcePopup-BUoegyem.js} +2 -2
- package/dist/{Dashboard-CQsIqWZC.js → Dashboard-C6adKZ7q.js} +202 -203
- package/dist/{DashboardImportSelector-CkqH52FX.js → DashboardImportSelector-CQqXshDj.js} +1 -1
- package/dist/{DashboardMobile-DWFlel5p.js → DashboardMobile-BU1nDLQv.js} +42 -42
- package/dist/{Editor-DQ66Vp6v.js → Editor-DO4VRvek.js} +9 -10
- package/dist/{ErrorMessage-D5JeF3Iz.js → ErrorMessage-Cz7q7vJI.js} +1 -1
- package/dist/{GlobalChatPanel-B_s3COHE.js → GlobalChatPanel-Ct6oSj_A.js} +20 -20
- package/dist/{IDE-4-Jg6gsM.js → IDE-kdaEhA4g.js} +19 -20
- package/dist/{JobsView-B5NWDUgP.js → JobsView-BcyWrDRf.js} +11 -11
- package/dist/{LLMChat-eKgEc-I3.js → LLMChat-Dg8VvTIP.js} +19 -19
- package/dist/{LLMView-CdTwMLVV.js → LLMView-CZNNYXC1.js} +61 -61
- package/dist/{LoadingView-Bu3wLJ7J.js → LoadingView-k2CIKiN7.js} +1 -1
- package/dist/{MarkdownRenderer-B6lqdkgc.js → MarkdownRenderer-Dlb_KGmk.js} +1 -1
- package/dist/{MobileIDE-CZlg20oa.js → MobileIDE-BQcdjWUT.js} +26 -27
- package/dist/{ModelCard-Bs_d7Jis.js → ModelCard-Dn2b5WLs.js} +5 -5
- package/dist/{ModelView-BP5yyecx.js → ModelView-BEi83zrX.js} +6 -6
- package/dist/{PageLoading-DKFeqkmK.js → PageLoading-C7H6q6U6.js} +248 -248
- package/dist/{ResultComponent-BaDheojB.js → ResultComponent-DW9Q9tp9.js} +5 -5
- package/dist/{Results-CrpHB101.js → Results-N2OttUlb.js} +19 -19
- package/dist/{StatusIcon-Clfyy-Yn.js → StatusIcon-B21tjIXx.js} +1 -1
- package/dist/{StoreTokenModal-CO5hXMs3.js → StoreTokenModal-CHgvjLGl.js} +1 -1
- package/dist/{SymbolsPane-XFVErDFb.js → SymbolsPane-DUrLpSSw.js} +11 -11
- package/dist/{TutorialPage-CMcTYDOV.js → TutorialPage-DHgPuFN0.js} +11 -11
- package/dist/{VegaLiteChart-DX_LbF3g.js → VegaLiteChart-BqHLSptG.js} +11116 -11067
- package/dist/{WelcomePage-B6E35FUa.js → WelcomePage-CN6ptsoF.js} +3 -3
- package/dist/agent.js +1349 -0
- package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
- package/dist/components/chartControlsManager.d.ts +0 -1
- package/dist/components/chartControlsManager.d.ts.map +1 -1
- package/dist/{cssMode-zpO2ap2B.js → cssMode-DW4OByy3.js} +2 -2
- package/dist/dashboard.js +63 -63
- package/dist/dashboards/chartTheme.d.ts +68 -0
- package/dist/dashboards/chartTheme.d.ts.map +1 -0
- package/dist/dashboards/donutSpec.d.ts +2 -1
- package/dist/dashboards/donutSpec.d.ts.map +1 -1
- package/dist/dashboards/headlineSpec.d.ts +2 -1
- package/dist/dashboards/headlineSpec.d.ts.map +1 -1
- package/dist/dashboards/helpers.d.ts +23 -0
- package/dist/dashboards/helpers.d.ts.map +1 -1
- package/dist/dashboards/index.d.ts +2 -0
- package/dist/dashboards/index.d.ts.map +1 -1
- package/dist/dashboards/layerSpec.d.ts +4 -1
- package/dist/dashboards/layerSpec.d.ts.map +1 -1
- package/dist/dashboards/pointSpec.d.ts +2 -1
- package/dist/dashboards/pointSpec.d.ts.map +1 -1
- package/dist/dashboards/spec.d.ts +8 -1
- package/dist/dashboards/spec.d.ts.map +1 -1
- package/dist/{editor.main-BQh6DxDB.js → editor.main-TuTbSVcN.js} +22 -22
- package/dist/{editorStore-CiWH_nGN.js → editorStore-Czhpct1j.js} +1751 -1181
- package/dist/entry.agent.d.ts +12 -0
- package/dist/entry.agent.d.ts.map +1 -0
- package/dist/entry.llm.d.ts +1 -1
- package/dist/entry.llm.d.ts.map +1 -1
- package/dist/{freemarker2-DQBqlEXc.js → freemarker2-ZGcKAI8o.js} +1 -1
- package/dist/{globalChatRuntime-DAERmOdu.js → globalChatRuntime-BnMYNYqe.js} +35 -35
- package/dist/{handlebars-tgYxaM70.js → handlebars-B3s0Qrrb.js} +1 -1
- package/dist/{helpers-C2pARJoZ.js → helpers-B3tq3RZK.js} +17 -17
- package/dist/{html-jJahD3Mi.js → html-DM1koKCG.js} +1 -1
- package/dist/{htmlMode-BA1-8l2e.js → htmlMode-CpPImbDh.js} +2 -2
- package/dist/{javascript-Cypfo7va.js → javascript-jClqu73w.js} +1 -1
- package/dist/{jsonMode-xJye8PWS.js → jsonMode-CwFYTPO9.js} +2 -2
- package/dist/{liquid-BGDrv5da.js → liquid-C6l-UINC.js} +1 -1
- package/dist/llm/chatAgentPrompt.d.ts +4 -16
- package/dist/llm/chatAgentPrompt.d.ts.map +1 -1
- package/dist/llm/dashboardAgentRuntime.d.ts +10 -10
- package/dist/llm/dashboardAgentTools.d.ts +10 -10
- package/dist/llm/data/prompts.d.ts +1 -1
- package/dist/llm/data/prompts.d.ts.map +1 -1
- package/dist/llm/data/trilogySyntax.generated.d.ts +3 -3
- package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
- package/dist/llm/returnToUserTool.d.ts +20 -0
- package/dist/llm/returnToUserTool.d.ts.map +1 -0
- package/dist/llm/toolLoopCore.d.ts +7 -0
- package/dist/llm/toolLoopCore.d.ts.map +1 -1
- package/dist/llm/utils.d.ts.map +1 -1
- package/dist/{llm-Wf4Etiu9.js → llm-Bc1CfjOE.js} +2203 -2722
- package/dist/llm.js +3 -3
- package/dist/{localStorage-C3xms-ab.js → localStorage-Cy0sHlT0.js} +19 -19
- package/dist/{lspLanguageFeatures-V3e_p9oN.js → lspLanguageFeatures-GDtuGOTD.js} +1 -1
- package/dist/{mdx-BUR1aImW.js → mdx-BQEQ0k1f.js} +1 -1
- package/dist/monaco.js +3 -3
- package/dist/{python-YLkl0pc6.js → python-USoVCfWY.js} +1 -1
- package/dist/{razor-BP8TRMDY.js → razor-BxmgiR-q.js} +1 -1
- package/dist/{reconcile-BH_ReGDR.js → reconcile-DtPcgEjQ.js} +1 -1
- package/dist/{remoteStoreSync-B0K8QScO.js → remoteStoreSync-CscErZ-I.js} +2 -2
- package/dist/{stores-DTGQZ4_B.js → stores-DgdADCiH.js} +323 -323
- package/dist/stores.js +3 -4
- package/dist/trilogy-studio-components.css +1 -1
- package/dist/{tsMode-BH9HS_sH.js → tsMode-BEQ7aXX4.js} +1 -1
- package/dist/{typescript-BM-ynfk9.js → typescript-CzBSjjfY.js} +1 -1
- package/dist/{useChatWithTools-BSrzJtYI.js → useChatWithTools-CMhGxdyr.js} +14 -14
- package/dist/{useDashboard-CGeIdDuX.js → useDashboard-CjZgjmgb.js} +553 -553
- package/dist/{useGlobalChatPanel-D9kMZLeF.js → useGlobalChatPanel-Doeilj18.js} +69 -70
- package/dist/views/LLMView.vue.d.ts +23 -23
- package/dist/views/TutorialPage.vue.d.ts +10 -10
- package/dist/views.js +147 -148
- package/dist/vite.agent.config.d.ts +3 -0
- package/dist/vite.agent.config.d.ts.map +1 -0
- package/dist/{workers-B9Eybl-M.js → workers-CHvkad0r.js} +2 -2
- package/dist/{xml-M5WFPSpA.js → xml-ODdyS0gX.js} +1 -1
- package/dist/{yaml-CEeFwjz9.js → yaml-PCBTA2qD.js} +1 -1
- package/package.json +7 -2
- package/dist/AssetAutoImporter-C_7Ms9xe.js +0 -403
- package/dist/rolldown-runtime-B0aSnxlc.js +0 -20
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
1
|
+
import { At as e, Dt as t, Et as n, Lt as r, Ot as i, Rt as a, St as o, Tt as s, bt as c, jt as l, kt as u, qt as d, vt as f, yt as p } from "./llm-Bc1CfjOE.js";
|
|
2
|
+
import { c as m, u as h } from "./base-DuKnVD-A.js";
|
|
3
|
+
import { C as g, F as _, H as v, I as y, L as b, N as x, P as S, R as C, S as ee, i as te, it as w, pt as ne, q as re, s as ie, t as ae, z as T } from "./editorStore-Czhpct1j.js";
|
|
4
|
+
import { t as E } from "./connections-CWH3zwH2.js";
|
|
5
|
+
import { n as oe, t as se } from "./chatHelpers-F_woEbYF.js";
|
|
6
6
|
import { computed as D, ref as O } from "vue";
|
|
7
7
|
import { defineStore as k } from "pinia";
|
|
8
8
|
//#region data/tips.ts
|
|
@@ -267,30 +267,30 @@ var A = class e {
|
|
|
267
267
|
let t = e;
|
|
268
268
|
return t.error ? "failed" : t.running ? "running" : t.connected ? "connected" : "disabled";
|
|
269
269
|
},
|
|
270
|
-
async newConnection(
|
|
271
|
-
if (this.connections[
|
|
272
|
-
let
|
|
273
|
-
if (
|
|
274
|
-
else if (
|
|
275
|
-
else if (
|
|
276
|
-
else if (
|
|
277
|
-
else if (
|
|
278
|
-
httpReferer:
|
|
279
|
-
appTitle:
|
|
270
|
+
async newConnection(r, a, o) {
|
|
271
|
+
if (this.connections[r]) throw Error(`LLM connection with name "${r}" already exists.`);
|
|
272
|
+
let c;
|
|
273
|
+
if (a === "demo") c = new u(r, o.model);
|
|
274
|
+
else if (a === "anthropic") c = new t(r, o.apiKey, o.model, o.saveCredential);
|
|
275
|
+
else if (a === "openai") c = new i(r, o.apiKey, o.model, o.saveCredential);
|
|
276
|
+
else if (a === "google") c = new n(r, o.apiKey, o.model, o.saveCredential);
|
|
277
|
+
else if (a === "openrouter") c = new e(r, o.apiKey, o.model, o.saveCredential, void 0, {
|
|
278
|
+
httpReferer: o.httpReferer,
|
|
279
|
+
appTitle: o.appTitle
|
|
280
280
|
});
|
|
281
|
-
else if (
|
|
282
|
-
else throw Error(`LLM provider type "${
|
|
283
|
-
return this.addConnection(
|
|
284
|
-
},
|
|
285
|
-
async fetchModelsForProvider(
|
|
286
|
-
let
|
|
287
|
-
if (
|
|
288
|
-
else if (
|
|
289
|
-
else if (
|
|
290
|
-
else if (
|
|
291
|
-
else if (
|
|
292
|
-
else throw Error(`LLM provider type "${
|
|
293
|
-
return await
|
|
281
|
+
else if (a === "deepseek") c = new s(r, o.apiKey, o.model, o.saveCredential);
|
|
282
|
+
else throw Error(`LLM provider type "${a}" not found.`);
|
|
283
|
+
return this.addConnection(c), this.resetConnectionInBackground(r), c;
|
|
284
|
+
},
|
|
285
|
+
async fetchModelsForProvider(r, a) {
|
|
286
|
+
let o, c = `__temp_${r}_${Date.now()}`;
|
|
287
|
+
if (r === "anthropic") o = new t(c, a, "", !1);
|
|
288
|
+
else if (r === "openai") o = new i(c, a, "", !1);
|
|
289
|
+
else if (r === "google") o = new n(c, a, "", !1);
|
|
290
|
+
else if (r === "openrouter") o = new e(c, a, "", !1);
|
|
291
|
+
else if (r === "deepseek") o = new s(c, a, "", !1);
|
|
292
|
+
else throw Error(`LLM provider type "${r}" not found.`);
|
|
293
|
+
return await o.reset(), o.models;
|
|
294
294
|
},
|
|
295
295
|
async generateValidatedCompletion(e, t = null, n = 3, r = null, i = null, a = !0) {
|
|
296
296
|
let o = r || this.activeConnection || "", s = i || [];
|
|
@@ -331,11 +331,11 @@ var A = class e {
|
|
|
331
331
|
};
|
|
332
332
|
},
|
|
333
333
|
async generateDashboardCompletion(e, t = null, n = [], r = 3) {
|
|
334
|
-
let i =
|
|
334
|
+
let i = f(e, n);
|
|
335
335
|
return this.generateValidatedCompletion(i, t, r).then((e) => e.content);
|
|
336
336
|
},
|
|
337
337
|
async generateQueryCompletion(e, t, n = null, r = 3, i = null) {
|
|
338
|
-
let a =
|
|
338
|
+
let a = c(e, t);
|
|
339
339
|
return this.generateValidatedCompletion(a, n, r, i);
|
|
340
340
|
},
|
|
341
341
|
async generateSQLQueryCompletion(e) {
|
|
@@ -348,13 +348,13 @@ var A = class e {
|
|
|
348
348
|
}));
|
|
349
349
|
},
|
|
350
350
|
async generateFilterQuery(e, t, n = null, r = 3) {
|
|
351
|
-
let i =
|
|
351
|
+
let i = p(e, t);
|
|
352
352
|
return this.generateValidatedCompletion(i, n, r).then((e) => e.content);
|
|
353
353
|
},
|
|
354
354
|
async generateChatName(e, t) {
|
|
355
355
|
let n = this.connections[e];
|
|
356
356
|
if (!n) throw Error(`LLM connection with name "${e}" not found.`);
|
|
357
|
-
let r =
|
|
357
|
+
let r = se(t), i = n.model, a = n.getFastModel();
|
|
358
358
|
try {
|
|
359
359
|
a !== i && (n.model = a);
|
|
360
360
|
let e = await n.generateCompletion({
|
|
@@ -362,7 +362,7 @@ var A = class e {
|
|
|
362
362
|
maxTokens: 50,
|
|
363
363
|
temperature: .7
|
|
364
364
|
}, null);
|
|
365
|
-
return
|
|
365
|
+
return oe(e.text);
|
|
366
366
|
} finally {
|
|
367
367
|
a !== i && (n.model = i);
|
|
368
368
|
}
|
|
@@ -657,7 +657,7 @@ var M = class {
|
|
|
657
657
|
}, N = (e) => e.replace(/\s+/g, "");
|
|
658
658
|
function P(e) {
|
|
659
659
|
if (!e) return;
|
|
660
|
-
let t =
|
|
660
|
+
let t = ee();
|
|
661
661
|
return t.connections[e] || t.connectionByName(e);
|
|
662
662
|
}
|
|
663
663
|
var F = k("dashboards", {
|
|
@@ -711,7 +711,7 @@ var F = k("dashboards", {
|
|
|
711
711
|
newDashboard(e, t) {
|
|
712
712
|
let n = e;
|
|
713
713
|
if (Object.values(this.dashboards).some((t) => t.name === e)) throw Error(`A dashboard with name ${e} already exists.`);
|
|
714
|
-
let r = P(t), i = new
|
|
714
|
+
let r = P(t), i = new a({
|
|
715
715
|
id: n,
|
|
716
716
|
name: e,
|
|
717
717
|
connection: r?.name || t,
|
|
@@ -730,7 +730,7 @@ var F = k("dashboards", {
|
|
|
730
730
|
if (!t) throw Error(`Dashboard with ID "${e}" not found.`);
|
|
731
731
|
let n = `${t.name} (copy)`, r = 1;
|
|
732
732
|
for (; Object.values(this.dashboards).some((e) => e.name === n);) n = `${t.name} (copy ${r})`, r++;
|
|
733
|
-
let i = new
|
|
733
|
+
let i = new a({
|
|
734
734
|
id: n,
|
|
735
735
|
name: n,
|
|
736
736
|
connection: t.connection,
|
|
@@ -750,7 +750,7 @@ var F = k("dashboards", {
|
|
|
750
750
|
if (!n) throw Error(`Dashboard with ID "${e}" not found.`);
|
|
751
751
|
let r = `${n.name} / ${t}`, i = 1;
|
|
752
752
|
for (; this.dashboards[r];) r = `${n.name} / ${t} (${i})`, i++;
|
|
753
|
-
let
|
|
753
|
+
let o = new a({
|
|
754
754
|
id: r,
|
|
755
755
|
name: r,
|
|
756
756
|
connection: n.connection,
|
|
@@ -762,12 +762,12 @@ var F = k("dashboards", {
|
|
|
762
762
|
investigationCreatedFrom: { timestamp: /* @__PURE__ */ new Date() },
|
|
763
763
|
description: n.description
|
|
764
764
|
});
|
|
765
|
-
return
|
|
765
|
+
return o.gridItems = Object.fromEntries(Object.entries(n.gridItems).map(([e, t]) => [e, {
|
|
766
766
|
...t,
|
|
767
767
|
chartFilters: [],
|
|
768
768
|
conceptFilters: [],
|
|
769
769
|
filters: []
|
|
770
|
-
}])),
|
|
770
|
+
}])), o.layout = n.layout.map((e) => ({ ...e })), o.imports = n.imports.map((e) => ({ ...e })), o.filter = n.filter, o.nextId = n.nextId, o.changed = !0, n.children ||= [], n.children.push(r), n.changed = !0, this.addDashboard(o), this.activeDashboardId = r, o;
|
|
771
771
|
},
|
|
772
772
|
promoteDashboard(e) {
|
|
773
773
|
let t = this.dashboards[e];
|
|
@@ -789,7 +789,7 @@ var F = k("dashboards", {
|
|
|
789
789
|
},
|
|
790
790
|
loadDashboards(e) {
|
|
791
791
|
Object.entries(e).forEach(([e, t]) => {
|
|
792
|
-
this.dashboards[e] =
|
|
792
|
+
this.dashboards[e] = a.fromSerialized(t);
|
|
793
793
|
});
|
|
794
794
|
},
|
|
795
795
|
removeAllFilters(e) {
|
|
@@ -954,15 +954,15 @@ var F = k("dashboards", {
|
|
|
954
954
|
}), e;
|
|
955
955
|
},
|
|
956
956
|
async warmDashboardQueries(e, t, n) {
|
|
957
|
-
let
|
|
958
|
-
if (
|
|
959
|
-
for (let e of Object.values(
|
|
960
|
-
let
|
|
961
|
-
await t?.generateQuery(
|
|
962
|
-
text:
|
|
957
|
+
let i = this.dashboards[e];
|
|
958
|
+
if (i) {
|
|
959
|
+
for (let e of Object.values(i.gridItems)) if (e.type === r.CHART || e.type === r.TABLE) {
|
|
960
|
+
let r = typeof e.content == "string" ? e.content : e.content?.query || "";
|
|
961
|
+
await t?.generateQuery(i.connectionId || i.connection, {
|
|
962
|
+
text: r,
|
|
963
963
|
editorType: "trilogy",
|
|
964
|
-
imports:
|
|
965
|
-
extraContent:
|
|
964
|
+
imports: i.imports,
|
|
965
|
+
extraContent: i.imports.map((e) => ({
|
|
966
966
|
alias: e.name,
|
|
967
967
|
contents: n.editors[e.id]?.contents || n.editors[e.name]?.contents || ""
|
|
968
968
|
}))
|
|
@@ -989,18 +989,18 @@ var F = k("dashboards", {
|
|
|
989
989
|
async populateAIConcepts(e, t, n) {
|
|
990
990
|
let r = await this.populateCompletion(e, t, n);
|
|
991
991
|
if (!r) throw Error(`No completion items found for dashboard ID "${e}".`);
|
|
992
|
-
return
|
|
992
|
+
return l(r);
|
|
993
993
|
},
|
|
994
994
|
async generatePromptSpec(e, t, n, r) {
|
|
995
|
-
let i = await this.populateAIConcepts(this.activeDashboardId, n, r), a = await t.generateDashboardCompletion(e,
|
|
995
|
+
let i = await this.populateAIConcepts(this.activeDashboardId, n, r), a = await t.generateDashboardCompletion(e, o, i, 3);
|
|
996
996
|
if (!a) throw Error("No response from LLM");
|
|
997
|
-
return
|
|
997
|
+
return o(a);
|
|
998
998
|
},
|
|
999
|
-
async populateFromPromptSpec(e, t, n,
|
|
999
|
+
async populateFromPromptSpec(e, t, n, i, a) {
|
|
1000
1000
|
let o = this.dashboards[e];
|
|
1001
1001
|
if (!o) throw Error(`Dashboard with ID "${e}" not found.`);
|
|
1002
1002
|
o.name = t.name, o.description = t.description;
|
|
1003
|
-
let s = await this.populateAIConcepts(e,
|
|
1003
|
+
let s = await this.populateAIConcepts(e, i, a);
|
|
1004
1004
|
if (!s) throw Error(`No completion items found for dashboard ID "${e}".`);
|
|
1005
1005
|
let c = async (e) => {
|
|
1006
1006
|
let t = {
|
|
@@ -1009,25 +1009,25 @@ var F = k("dashboards", {
|
|
|
1009
1009
|
imports: o.imports,
|
|
1010
1010
|
extraContent: o.imports.map((e) => ({
|
|
1011
1011
|
alias: e.name,
|
|
1012
|
-
contents:
|
|
1012
|
+
contents: a.editors[e.id]?.contents || a.editors[e.name]?.contents || ""
|
|
1013
1013
|
}))
|
|
1014
1014
|
};
|
|
1015
|
-
return await (await
|
|
1015
|
+
return await (await i.executeQuery(o.connectionId || o.connection, t, () => {}, () => {}, (e) => {
|
|
1016
1016
|
throw e;
|
|
1017
1017
|
}, () => !0, !0)).resultPromise, !0;
|
|
1018
1018
|
}, l = /* @__PURE__ */ new Map();
|
|
1019
1019
|
for (let n of t.layout) {
|
|
1020
|
-
let
|
|
1021
|
-
[
|
|
1022
|
-
let s = this.addItemToDashboard(e, "markdown", n.x, n.y, n.w, n.h,
|
|
1020
|
+
let i = t.gridItems[n.id], a = i.content, o = i.type.toLowerCase();
|
|
1021
|
+
[r.CHART, r.TABLE].includes(o) && (a = `Placeholder, prompt: ${a}`);
|
|
1022
|
+
let s = this.addItemToDashboard(e, "markdown", n.x, n.y, n.w, n.h, a, i.name);
|
|
1023
1023
|
l.set(s, {
|
|
1024
1024
|
type: o,
|
|
1025
|
-
content:
|
|
1025
|
+
content: a
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
for (let t of l) {
|
|
1029
|
-
let
|
|
1030
|
-
[
|
|
1029
|
+
let i = t[0], a = t[1], o = a.content;
|
|
1030
|
+
[r.CHART, r.TABLE].includes(a.type) && (o = (await n.generateQueryCompletion(a.content, s, c)).content || "No query could be generated"), await this.updateItemContent(e, i, o), await this.updateItemType(e, i, a.type);
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
@@ -1040,7 +1040,7 @@ var F = k("dashboards", {
|
|
|
1040
1040
|
};
|
|
1041
1041
|
}, ge = (e) => {
|
|
1042
1042
|
let t = e instanceof Error ? e.message : "Failed to fetch state";
|
|
1043
|
-
return e instanceof
|
|
1043
|
+
return e instanceof x ? e.status === 401 ? "Authentication required. Set this store’s token to read state." : e.status === 400 && /directory/i.test(t) ? `${t} Directory state requires a Trilogy server on 0.3.306 or newer.` : t : t;
|
|
1044
1044
|
}, B = (e) => [...e].sort((e, t) => t.submittedAt - e.submittedAt), _e = k("jobsApi", {
|
|
1045
1045
|
state: () => ({
|
|
1046
1046
|
filesByStore: {},
|
|
@@ -1057,11 +1057,11 @@ var F = k("dashboards", {
|
|
|
1057
1057
|
}),
|
|
1058
1058
|
actions: {
|
|
1059
1059
|
getGenericStore(e) {
|
|
1060
|
-
let t =
|
|
1060
|
+
let t = g().stores.find((t) => t.id === e);
|
|
1061
1061
|
return !t || t.type !== "generic" ? null : t;
|
|
1062
1062
|
},
|
|
1063
1063
|
getGenericStores() {
|
|
1064
|
-
return
|
|
1064
|
+
return g().stores.filter((e) => e.type === "generic");
|
|
1065
1065
|
},
|
|
1066
1066
|
getStoreJobs(e) {
|
|
1067
1067
|
return B(this.jobsByStore[e] || []);
|
|
@@ -1107,7 +1107,7 @@ var F = k("dashboards", {
|
|
|
1107
1107
|
}), delete this.filesByStore[e], delete this.jobsByStore[e], delete this.errors[e], delete this.storeStatus[e], delete this.loadingByStore[e], this.clearStateForStore(e), this.saveJobsToStorage();
|
|
1108
1108
|
},
|
|
1109
1109
|
clearStateForStore(e) {
|
|
1110
|
-
let t = (t) =>
|
|
1110
|
+
let t = (t) => v(t)?.storeId === e, n = (e) => {
|
|
1111
1111
|
Object.keys(e).filter(t).forEach((t) => delete e[t]);
|
|
1112
1112
|
};
|
|
1113
1113
|
n(this.stateByTarget), n(this.stateLoadingByTarget), n(this.stateErrorsByTarget);
|
|
@@ -1117,7 +1117,7 @@ var F = k("dashboards", {
|
|
|
1117
1117
|
},
|
|
1118
1118
|
refreshLoadedStateForTarget(e, t) {
|
|
1119
1119
|
Object.keys(this.stateByTarget).forEach((n) => {
|
|
1120
|
-
let r =
|
|
1120
|
+
let r = v(n);
|
|
1121
1121
|
r && r.storeId === e && re(r.target, t) && this.fetchStateForTarget(e, r.target);
|
|
1122
1122
|
});
|
|
1123
1123
|
},
|
|
@@ -1128,7 +1128,7 @@ var F = k("dashboards", {
|
|
|
1128
1128
|
if (!this.stateLoadingByTarget[i]) {
|
|
1129
1129
|
this.stateLoadingByTarget[i] = !0, delete this.stateErrorsByTarget[i];
|
|
1130
1130
|
try {
|
|
1131
|
-
let e = await
|
|
1131
|
+
let e = await b(r, t, n);
|
|
1132
1132
|
this.stateByTarget[i] = {
|
|
1133
1133
|
snapshot: e.snapshot,
|
|
1134
1134
|
cached: e.cached,
|
|
@@ -1142,7 +1142,7 @@ var F = k("dashboards", {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
},
|
|
1144
1144
|
async initialize() {
|
|
1145
|
-
|
|
1145
|
+
g().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
|
|
1146
1146
|
},
|
|
1147
1147
|
saveJobsToStorage() {
|
|
1148
1148
|
try {
|
|
@@ -1189,7 +1189,7 @@ var F = k("dashboards", {
|
|
|
1189
1189
|
if (t) {
|
|
1190
1190
|
this.loadingByStore[e] = !0, this.storeStatus[e] = "idle";
|
|
1191
1191
|
try {
|
|
1192
|
-
this.filesByStore[e] = await
|
|
1192
|
+
this.filesByStore[e] = await _(t), delete this.errors[e], this.storeStatus[e] = "connected";
|
|
1193
1193
|
} catch (t) {
|
|
1194
1194
|
let n = t instanceof Error ? t.message : "Failed to fetch files";
|
|
1195
1195
|
this.errors[e] = n, this.storeStatus[e] = "failed";
|
|
@@ -1261,7 +1261,7 @@ var F = k("dashboards", {
|
|
|
1261
1261
|
let i = R(e, t, n);
|
|
1262
1262
|
this.submittingByTarget[i] = !0;
|
|
1263
1263
|
try {
|
|
1264
|
-
let i = await
|
|
1264
|
+
let i = await C(r, n, t), a = this.buildLocalJob(e, t, n, i);
|
|
1265
1265
|
return this.upsertJob(e, a), delete this.errors[e], this.storeStatus[e] = "connected", a.status === "running" && this.startPolling(e, a.job_id), a;
|
|
1266
1266
|
} catch (r) {
|
|
1267
1267
|
let i = r instanceof Error ? r.message : `Failed to ${n} ${t}`;
|
|
@@ -1280,11 +1280,11 @@ var F = k("dashboards", {
|
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
1282
|
try {
|
|
1283
|
-
let n = await
|
|
1283
|
+
let n = await y(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
|
|
1284
1284
|
this.upsertJob(e, a), a.status !== "running" && (this.stopPolling(e, t), this.fetchFilesForStore(e), this.refreshLoadedStateForTarget(e, a.target));
|
|
1285
1285
|
} catch (n) {
|
|
1286
1286
|
let r = n instanceof Error ? n.message : `Failed to poll job ${t}`;
|
|
1287
|
-
n instanceof
|
|
1287
|
+
n instanceof x && n.status === 401 ? this.pauseJobPolling(e, t, "auth-paused", "Polling paused: authentication required. Update the store token to resume tracking.") : n instanceof x && n.status === 404 ? this.pauseJobPolling(e, t, "not-found", "Polling stopped: job was not found on the server.") : this.pauseJobPolling(e, t, "stopped", `Polling stopped locally. ${r}`);
|
|
1288
1288
|
} finally {
|
|
1289
1289
|
delete this.pollingByJob[n];
|
|
1290
1290
|
}
|
|
@@ -1299,7 +1299,7 @@ var F = k("dashboards", {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
this.stoppingByJob[n] = !0, this.stopPolling(e, t), delete this.pollingByJob[n];
|
|
1301
1301
|
try {
|
|
1302
|
-
let n = await
|
|
1302
|
+
let n = await S(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
|
|
1303
1303
|
a.status === "running" && (a.pollingState = "stopped", a.pollingError = "Cancel requested. Polling stopped locally."), this.upsertJob(e, a);
|
|
1304
1304
|
} catch (n) {
|
|
1305
1305
|
let r = n instanceof Error ? n.message : `Failed to cancel job ${t}`, a = {
|
|
@@ -1446,7 +1446,7 @@ function ye(e) {
|
|
|
1446
1446
|
//#endregion
|
|
1447
1447
|
//#region stores/useScreenNavigation.ts
|
|
1448
1448
|
var be = () => {
|
|
1449
|
-
let e = F(), t = ae(), n =
|
|
1449
|
+
let e = F(), t = ae(), n = ne(), r = g(), i = te(), a = null, o = {
|
|
1450
1450
|
activeScreen: O(H(V.SCREEN, "")),
|
|
1451
1451
|
activeSidebarScreen: O(H(V.SIDEBAR_SCREEN, "editors")),
|
|
1452
1452
|
activeEditor: O(H(V.EDITORS, "")),
|
|
@@ -1515,29 +1515,29 @@ var be = () => {
|
|
|
1515
1515
|
return e[e.length - 1] || n;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
return
|
|
1518
|
+
return E(o, null);
|
|
1519
1519
|
}, d = (e, t, n) => {
|
|
1520
1520
|
let r = o.tabs.value.find((t) => t.screen === e && t.address === n);
|
|
1521
1521
|
r && (r.title = u(e, t, n));
|
|
1522
|
-
},
|
|
1522
|
+
}, f = (e, t, n, r = !1) => {
|
|
1523
1523
|
let i = o.tabs.value.find((t) => t.screen === e && t.address === n);
|
|
1524
1524
|
if (i) {
|
|
1525
|
-
|
|
1525
|
+
v(i.id, r);
|
|
1526
1526
|
return;
|
|
1527
1527
|
}
|
|
1528
1528
|
let a = o.tabs.value.reduce((e, t) => {
|
|
1529
1529
|
let n = parseInt(t.id.replace("tab-", ""));
|
|
1530
1530
|
return isNaN(n) ? e : Math.max(e, n);
|
|
1531
1531
|
}, 0);
|
|
1532
|
-
r ||
|
|
1532
|
+
r || y(e);
|
|
1533
1533
|
let s = u(e, t, n), c = {
|
|
1534
1534
|
id: `tab-${++a}`,
|
|
1535
1535
|
title: s,
|
|
1536
1536
|
screen: e,
|
|
1537
1537
|
address: n
|
|
1538
1538
|
};
|
|
1539
|
-
o.tabs.value.push(c),
|
|
1540
|
-
},
|
|
1539
|
+
o.tabs.value.push(c), v(c.id, r);
|
|
1540
|
+
}, p = (e, t = null) => {
|
|
1541
1541
|
if (!e && !t) return;
|
|
1542
1542
|
if (!e && t) {
|
|
1543
1543
|
let n = o.tabs.value.find((e) => e.address === t);
|
|
@@ -1550,28 +1550,28 @@ var be = () => {
|
|
|
1550
1550
|
if (o.tabs.value.splice(n, 1), t) {
|
|
1551
1551
|
if (o.tabs.value.length > 0) {
|
|
1552
1552
|
let e = n > 0 ? n - 1 : 0;
|
|
1553
|
-
|
|
1554
|
-
} else
|
|
1553
|
+
v(o.tabs.value[e].id);
|
|
1554
|
+
} else f("welcome", "Welcome", "welcome");
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
|
|
1558
|
-
},
|
|
1557
|
+
h();
|
|
1558
|
+
}, m = (e) => {
|
|
1559
1559
|
let t = o.activeTab.value === e;
|
|
1560
|
-
o.tabs.value = o.tabs.value.filter((t) => t.id === e), t || (o.tabs.value.length > 0 ?
|
|
1561
|
-
},
|
|
1560
|
+
o.tabs.value = o.tabs.value.filter((t) => t.id === e), t || (o.tabs.value.length > 0 ? v(o.tabs.value[0].id) : f("welcome", "Welcome", "welcome")), h();
|
|
1561
|
+
}, h = () => {
|
|
1562
1562
|
let e = o.tabs.value.map((e) => e.screen), t = [];
|
|
1563
1563
|
e.includes("editors") || (o.activeEditor.value = "", t.push(V.EDITORS), t.push(V.ACTIVE_EDITOR_TAB)), e.includes("dashboard") || (o.activeDashboard.value = "", t.push(V.DASHBOARD)), e.includes("connections") || (o.activeConnectionKey.value = "", t.push(V.CONNECTIONS)), e.includes("models") || (o.activeModelKey.value = "", t.push(V.MODELS)), e.includes("community-models") || (o.activeCommunityModelKey.value = "", t.push(V.COMMUNITY_MODELS)), e.includes("jobs") || (o.activeJobsKey.value = "", t.push(V.JOBS)), e.includes("tutorial") || (o.activeDocumentationKey.value = "", t.push(V.TUTORIAL)), e.includes("llms") || (o.activeLLMConnectionKey.value = "", t.push(V.LLMS)), e.includes("settings") || t.push(V.SETTINGS), e.includes("profile") || t.push(V.PROFILE), e.includes("welcome") || t.push(V.WELCOME), ye(t);
|
|
1564
|
-
},
|
|
1564
|
+
}, _ = (e) => {
|
|
1565
1565
|
let t = o.tabs.value.findIndex((t) => t.id === e);
|
|
1566
1566
|
if (t !== -1) {
|
|
1567
1567
|
let e = o.tabs.value.findIndex((e) => e.id === o.activeTab.value) > t;
|
|
1568
|
-
o.tabs.value.splice(t + 1), e && (o.tabs.value.length > 0 ?
|
|
1568
|
+
o.tabs.value.splice(t + 1), e && (o.tabs.value.length > 0 ? v(o.tabs.value[o.tabs.value.length - 1].id) : f("welcome", "Welcome", "welcome"));
|
|
1569
1569
|
}
|
|
1570
|
-
|
|
1571
|
-
},
|
|
1570
|
+
h();
|
|
1571
|
+
}, v = (r, a = !1) => {
|
|
1572
1572
|
let s = o.tabs.value.find((e) => e.id === r);
|
|
1573
1573
|
if (s) {
|
|
1574
|
-
o.activeTab.value = r,
|
|
1574
|
+
o.activeTab.value = r, y(s.screen), l(s.screen, a);
|
|
1575
1575
|
let c = n.getUnreadTips(ce);
|
|
1576
1576
|
if (s.screen === "editors") o.activeEditor.value = s.address, t.activeEditorId = s.address, c = c.concat(n.getUnreadTips(le));
|
|
1577
1577
|
else if (s.screen === "dashboard") o.activeDashboard.value = s.address, e.activeDashboardId = s.address, c = o.fullScreen.value ? [] : c.concat(n.getUnreadTips(ue));
|
|
@@ -1586,10 +1586,10 @@ var be = () => {
|
|
|
1586
1586
|
} else s.screen === "tutorial" ? o.activeDocumentationKey.value = s.address : s.screen === "models" ? o.activeModelKey.value = s.address : s.screen === "dashboard-import" || s.screen === "asset-import" ? c = [] : s.screen === "community-models" ? (o.activeCommunityModelKey.value = s.address, c = c.concat(n.getUnreadTips(de))) : s.screen === "jobs" && (o.activeJobsKey.value = s.address);
|
|
1587
1587
|
o.mobileMenuOpen.value = !1, o.displayedTips.value = c, o.showTipModal.value = c.length > 0, s.address && !a && U(s.screen, s.address);
|
|
1588
1588
|
}
|
|
1589
|
-
},
|
|
1589
|
+
}, y = (e) => {
|
|
1590
1590
|
o.activeScreen.value !== e && (o.activeScreen.value = e, U(V.SCREEN, e));
|
|
1591
|
-
},
|
|
1592
|
-
c(e), e == "settings" ?
|
|
1591
|
+
}, b = (e) => {
|
|
1592
|
+
c(e), e == "settings" ? f("settings", "Settings", "settings") : e == "profile" && f("profile", "Profile", "profile");
|
|
1593
1593
|
};
|
|
1594
1594
|
return {
|
|
1595
1595
|
get activeScreen() {
|
|
@@ -1649,28 +1649,28 @@ var be = () => {
|
|
|
1649
1649
|
get fullScreen() {
|
|
1650
1650
|
return o.fullScreen;
|
|
1651
1651
|
},
|
|
1652
|
-
setActiveScreen:
|
|
1653
|
-
setActiveSidebarScreen:
|
|
1652
|
+
setActiveScreen: y,
|
|
1653
|
+
setActiveSidebarScreen: b,
|
|
1654
1654
|
setActiveEditor: (e) => {
|
|
1655
1655
|
if (e === null) {
|
|
1656
1656
|
W(V.EDITORS), o.activeEditor.value = "";
|
|
1657
1657
|
return;
|
|
1658
1658
|
}
|
|
1659
|
-
|
|
1659
|
+
f("editors", null, e);
|
|
1660
1660
|
},
|
|
1661
1661
|
setActiveDashboard: (e) => {
|
|
1662
1662
|
if (e === null) {
|
|
1663
1663
|
W(V.DASHBOARD), o.activeDashboard.value = "";
|
|
1664
1664
|
return;
|
|
1665
1665
|
}
|
|
1666
|
-
|
|
1666
|
+
f("dashboard", null, e);
|
|
1667
1667
|
},
|
|
1668
1668
|
setActiveConnectionKey: (e) => {
|
|
1669
1669
|
if (e === null) {
|
|
1670
1670
|
W(V.CONNECTIONS), o.activeConnectionKey.value = "";
|
|
1671
1671
|
return;
|
|
1672
1672
|
}
|
|
1673
|
-
|
|
1673
|
+
f("connections", null, e);
|
|
1674
1674
|
},
|
|
1675
1675
|
setActiveDocumentationKey: (e) => {
|
|
1676
1676
|
if (e === null) {
|
|
@@ -1678,28 +1678,28 @@ var be = () => {
|
|
|
1678
1678
|
return;
|
|
1679
1679
|
}
|
|
1680
1680
|
let t = e.split("+");
|
|
1681
|
-
|
|
1681
|
+
f("tutorial", t[t.length - 1], e);
|
|
1682
1682
|
},
|
|
1683
1683
|
setActiveLLMConnectionKey: (e) => {
|
|
1684
1684
|
if (e === null) {
|
|
1685
1685
|
W(V.LLMS), o.activeLLMConnectionKey.value = "";
|
|
1686
1686
|
return;
|
|
1687
1687
|
}
|
|
1688
|
-
|
|
1688
|
+
f("llms", null, e);
|
|
1689
1689
|
},
|
|
1690
1690
|
setActiveCommunityModelKey: (e) => {
|
|
1691
1691
|
if (e === null) {
|
|
1692
1692
|
W(V.COMMUNITY_MODELS), o.activeCommunityModelKey.value = "";
|
|
1693
1693
|
return;
|
|
1694
1694
|
}
|
|
1695
|
-
o.activeCommunityModelKey.value = e,
|
|
1695
|
+
o.activeCommunityModelKey.value = e, f("community-models", null, e);
|
|
1696
1696
|
},
|
|
1697
1697
|
setActiveJobsKey: (e) => {
|
|
1698
1698
|
if (e === null) {
|
|
1699
1699
|
W(V.JOBS), o.activeJobsKey.value = "";
|
|
1700
1700
|
return;
|
|
1701
1701
|
}
|
|
1702
|
-
o.activeJobsKey.value = e,
|
|
1702
|
+
o.activeJobsKey.value = e, f("jobs", null, e);
|
|
1703
1703
|
},
|
|
1704
1704
|
toggleMobileMenu: () => {
|
|
1705
1705
|
o.mobileMenuOpen.value = !o.mobileMenuOpen.value;
|
|
@@ -1711,12 +1711,12 @@ var be = () => {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
U(V.MODELS, e), o.activeModelKey.value = e;
|
|
1713
1713
|
},
|
|
1714
|
-
setActiveTab:
|
|
1715
|
-
openTab:
|
|
1714
|
+
setActiveTab: v,
|
|
1715
|
+
openTab: f,
|
|
1716
1716
|
updateTabName: d,
|
|
1717
|
-
closeTab:
|
|
1718
|
-
closeOtherTabsExcept:
|
|
1719
|
-
closeTabsToRightOf:
|
|
1717
|
+
closeTab: p,
|
|
1718
|
+
closeOtherTabsExcept: m,
|
|
1719
|
+
closeTabsToRightOf: _,
|
|
1720
1720
|
onInitialLoad: () => {
|
|
1721
1721
|
let e = o.modelImport.value, t = o.connectionImport.value, r = "editors", i = !1;
|
|
1722
1722
|
H(V.SKIP_TIPS, "") === "true" && n.updateSetting("skipAllTips", !0);
|
|
@@ -1725,61 +1725,61 @@ var be = () => {
|
|
|
1725
1725
|
"1",
|
|
1726
1726
|
"yes"
|
|
1727
1727
|
].includes(H(V.REMOTE, "").toLowerCase()) && !!H(V.STORE, "") && !!(s || c);
|
|
1728
|
-
(e && t || l) && (a && s ?
|
|
1729
|
-
let u = o.activeScreen.value, d = o.activeSidebarScreen.value,
|
|
1730
|
-
o.activeEditor.value && !i &&
|
|
1728
|
+
(e && t || l) && (a && s ? f("asset-import", null, "asset-import") : f("dashboard-import", null, "dashboard-import"), i = !0);
|
|
1729
|
+
let u = o.activeScreen.value, d = o.activeSidebarScreen.value, p = [];
|
|
1730
|
+
o.activeEditor.value && !i && p.push({
|
|
1731
1731
|
screen: "editors",
|
|
1732
1732
|
title: null,
|
|
1733
1733
|
key: o.activeEditor.value,
|
|
1734
1734
|
isActive: u === "editors"
|
|
1735
|
-
}), o.activeDashboard.value && !i &&
|
|
1735
|
+
}), o.activeDashboard.value && !i && p.push({
|
|
1736
1736
|
screen: "dashboard",
|
|
1737
1737
|
title: null,
|
|
1738
1738
|
key: o.activeDashboard.value,
|
|
1739
1739
|
isActive: u === "dashboard"
|
|
1740
|
-
}), o.activeConnectionKey.value && !i &&
|
|
1740
|
+
}), o.activeConnectionKey.value && !i && p.push({
|
|
1741
1741
|
screen: "connections",
|
|
1742
1742
|
title: null,
|
|
1743
1743
|
key: o.activeConnectionKey.value,
|
|
1744
1744
|
isActive: u === "connections"
|
|
1745
|
-
}), o.activeModelKey.value && !i &&
|
|
1745
|
+
}), o.activeModelKey.value && !i && p.push({
|
|
1746
1746
|
screen: "models",
|
|
1747
1747
|
title: null,
|
|
1748
1748
|
key: o.activeModelKey.value,
|
|
1749
1749
|
isActive: u === "models"
|
|
1750
|
-
}), o.activeCommunityModelKey.value && !i &&
|
|
1750
|
+
}), o.activeCommunityModelKey.value && !i && p.push({
|
|
1751
1751
|
screen: "community-models",
|
|
1752
1752
|
title: null,
|
|
1753
1753
|
key: o.activeCommunityModelKey.value,
|
|
1754
1754
|
isActive: u === "community-models"
|
|
1755
|
-
}), o.activeJobsKey.value && !i &&
|
|
1755
|
+
}), o.activeJobsKey.value && !i && p.push({
|
|
1756
1756
|
screen: "jobs",
|
|
1757
1757
|
title: null,
|
|
1758
1758
|
key: o.activeJobsKey.value,
|
|
1759
1759
|
isActive: u === "jobs"
|
|
1760
|
-
}), o.activeDocumentationKey.value && !i &&
|
|
1760
|
+
}), o.activeDocumentationKey.value && !i && p.push({
|
|
1761
1761
|
screen: "tutorial",
|
|
1762
1762
|
title: null,
|
|
1763
1763
|
key: o.activeDocumentationKey.value,
|
|
1764
1764
|
isActive: u === "tutorial"
|
|
1765
|
-
}), o.activeLLMConnectionKey.value && !i &&
|
|
1765
|
+
}), o.activeLLMConnectionKey.value && !i && p.push({
|
|
1766
1766
|
screen: "llms",
|
|
1767
1767
|
title: null,
|
|
1768
1768
|
key: o.activeLLMConnectionKey.value,
|
|
1769
1769
|
isActive: u === "llms"
|
|
1770
|
-
}), o.activeSidebarScreen.value === "settings" &&
|
|
1770
|
+
}), o.activeSidebarScreen.value === "settings" && p.push({
|
|
1771
1771
|
screen: "settings",
|
|
1772
1772
|
title: "Settings",
|
|
1773
1773
|
key: "settings",
|
|
1774
1774
|
isActive: u === "settings"
|
|
1775
|
-
}), o.activeSidebarScreen.value === "profile" &&
|
|
1775
|
+
}), o.activeSidebarScreen.value === "profile" && p.push({
|
|
1776
1776
|
screen: "profile",
|
|
1777
1777
|
title: "Profile",
|
|
1778
1778
|
key: "profile",
|
|
1779
1779
|
isActive: u === "profile"
|
|
1780
|
-
}),
|
|
1781
|
-
|
|
1782
|
-
}),
|
|
1780
|
+
}), p.sort((e, t) => e.isActive ? 1 : t.isActive ? -1 : 0), p.forEach((e) => {
|
|
1781
|
+
f(e.screen, e.title, e.key, !0);
|
|
1782
|
+
}), y(u), !d && p.length > 0 ? r = p[p.length - 1].screen : d && (r = d), b(r);
|
|
1783
1783
|
},
|
|
1784
1784
|
toggleFullScreen: (e) => {
|
|
1785
1785
|
o.fullScreen.value = e;
|
|
@@ -1787,8 +1787,8 @@ var be = () => {
|
|
|
1787
1787
|
addBackListeners: () => {
|
|
1788
1788
|
a ||= window.addEventListener("hashchange", () => {
|
|
1789
1789
|
let e = H(V.EDITORS, ""), t = H(V.DASHBOARD, ""), n = H(V.CONNECTIONS, ""), r = H(V.MODELS, ""), i = H(V.COMMUNITY_MODELS, ""), a = H(V.JOBS, ""), s = H(V.TUTORIAL, ""), c = H(V.LLMS, ""), l = H(V.SCREEN, ""), u = H(V.SIDEBAR_SCREEN, ""), d = !1;
|
|
1790
|
-
u !== o.activeSidebarScreen.value &&
|
|
1791
|
-
let
|
|
1790
|
+
u !== o.activeSidebarScreen.value && b(u), l !== o.activeScreen.value && (o.activeScreen.value = l, d = !0);
|
|
1791
|
+
let p = [
|
|
1792
1792
|
{
|
|
1793
1793
|
hash: e,
|
|
1794
1794
|
screen: "editors",
|
|
@@ -1830,14 +1830,14 @@ var be = () => {
|
|
|
1830
1830
|
current: o.activeLLMConnectionKey.value
|
|
1831
1831
|
}
|
|
1832
1832
|
];
|
|
1833
|
-
for (let { hash: e, screen: t, current: n } of
|
|
1833
|
+
for (let { hash: e, screen: t, current: n } of p) if (e && e !== n || t === l && d) {
|
|
1834
1834
|
let n = o.tabs.value.find((n) => n.screen === t && n.screen === l && n.address === e);
|
|
1835
1835
|
if (n && n.id !== o.activeTab.value) {
|
|
1836
|
-
|
|
1836
|
+
v(n.id, !0);
|
|
1837
1837
|
break;
|
|
1838
1838
|
}
|
|
1839
1839
|
if (!n && e) {
|
|
1840
|
-
|
|
1840
|
+
f(t, null, e);
|
|
1841
1841
|
break;
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
@@ -2141,163 +2141,163 @@ var je = class {
|
|
|
2141
2141
|
resultPromise: this.executeQueriesBatchInternal(e, t, n, r, i || [], a, f, p, o, s, c, l, u, d)
|
|
2142
2142
|
};
|
|
2143
2143
|
}
|
|
2144
|
-
async executeQueriesBatchInternal(e, n, r
|
|
2145
|
-
|
|
2146
|
-
let
|
|
2147
|
-
if (!
|
|
2144
|
+
async executeQueriesBatchInternal(e, t, n, r = [], i, a = {}, o, s, c, l, u, d, f = !1, p) {
|
|
2145
|
+
c && c();
|
|
2146
|
+
let m = this.connectionProvider.getConnection(e);
|
|
2147
|
+
if (!m) return {
|
|
2148
2148
|
success: !1,
|
|
2149
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2150
|
-
results:
|
|
2149
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2150
|
+
results: t.map((t) => ({
|
|
2151
2151
|
success: !1,
|
|
2152
2152
|
generated_sql: "",
|
|
2153
2153
|
columns: [],
|
|
2154
2154
|
error: `Connection ${e} not found.`,
|
|
2155
2155
|
executionTime: 0,
|
|
2156
|
-
results: new
|
|
2156
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2157
2157
|
resultSize: 0,
|
|
2158
2158
|
columnCount: 0
|
|
2159
2159
|
}))
|
|
2160
2160
|
};
|
|
2161
|
-
if (
|
|
2161
|
+
if (f) return {
|
|
2162
2162
|
success: !0,
|
|
2163
|
-
results:
|
|
2163
|
+
results: t.map((e) => ({
|
|
2164
2164
|
success: !0,
|
|
2165
2165
|
generated_sql: e.query,
|
|
2166
2166
|
columns: [],
|
|
2167
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2168
|
-
results: new
|
|
2167
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2168
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2169
2169
|
resultSize: 0,
|
|
2170
2170
|
columnCount: 0
|
|
2171
2171
|
})),
|
|
2172
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2172
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o
|
|
2173
2173
|
};
|
|
2174
|
-
if (!
|
|
2175
|
-
|
|
2174
|
+
if (!m.isConnected()) try {
|
|
2175
|
+
l && l({
|
|
2176
2176
|
message: "Connection is not active... Attempting to automatically reconnect.",
|
|
2177
2177
|
error: !0
|
|
2178
|
-
}), await this.connectionProvider.ensureConnected(e),
|
|
2178
|
+
}), await this.connectionProvider.ensureConnected(e), l && l({
|
|
2179
2179
|
message: "Reconnect Successful",
|
|
2180
2180
|
running: !0
|
|
2181
2181
|
});
|
|
2182
2182
|
} catch {
|
|
2183
|
-
return
|
|
2183
|
+
return u && Object.values(u).forEach((e) => e({
|
|
2184
2184
|
message: "Connection failed to reconnect.",
|
|
2185
2185
|
error: !0,
|
|
2186
2186
|
running: !1
|
|
2187
2187
|
})), {
|
|
2188
2188
|
success: !1,
|
|
2189
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2190
|
-
results:
|
|
2189
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2190
|
+
results: t.map((t) => ({
|
|
2191
2191
|
success: !1,
|
|
2192
2192
|
generated_sql: "",
|
|
2193
2193
|
columns: [],
|
|
2194
2194
|
error: `Connection ${e} not active, failed to reconnect.`,
|
|
2195
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2196
|
-
results: new
|
|
2195
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2196
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2197
2197
|
columnCount: 0,
|
|
2198
2198
|
resultSize: 0
|
|
2199
2199
|
}))
|
|
2200
2200
|
};
|
|
2201
2201
|
}
|
|
2202
2202
|
let g = this.connectionProvider.getConnectionSources(e);
|
|
2203
|
-
|
|
2204
|
-
let _ = this.resolveRegisteredFiles(e,
|
|
2203
|
+
p && (g = g.concat(p));
|
|
2204
|
+
let _ = this.resolveRegisteredFiles(e, m), v = this.connectionProvider.getConnectionWorkingPath?.(e) ?? null;
|
|
2205
2205
|
try {
|
|
2206
|
-
let
|
|
2207
|
-
|
|
2208
|
-
})]),
|
|
2209
|
-
if (
|
|
2210
|
-
let
|
|
2211
|
-
if (
|
|
2212
|
-
let
|
|
2213
|
-
...
|
|
2214
|
-
...
|
|
2215
|
-
},
|
|
2206
|
+
let a = await Promise.race([this.trilogyResolver.resolve_queries_batch(t, m.queryType, g, r, i, null, _.length > 0 ? _ : null, v), new Promise((e, t) => {
|
|
2207
|
+
s.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query batch cancelled by user")));
|
|
2208
|
+
})]), c = [];
|
|
2209
|
+
if (a && Array.isArray(a.data.queries)) for (let r = 0; r < a.data.queries.length; r++) {
|
|
2210
|
+
let l = a.data.queries[r];
|
|
2211
|
+
if (l.generated_sql) {
|
|
2212
|
+
let a = {
|
|
2213
|
+
...t[r]?.parameters || {},
|
|
2214
|
+
...l.parameters || {}
|
|
2215
|
+
}, f = Object.keys(a).length ? a : null;
|
|
2216
2216
|
try {
|
|
2217
|
-
let
|
|
2218
|
-
|
|
2217
|
+
let u = await Promise.race([m.executeSql(l.generated_sql, f), new Promise((e, t) => {
|
|
2218
|
+
s.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query execution cancelled by user")));
|
|
2219
2219
|
})]);
|
|
2220
|
-
w(
|
|
2221
|
-
let
|
|
2220
|
+
w(n) && this.enrichTrilogyColumns(l.columns || [], u);
|
|
2221
|
+
let p = Y(l.chart), h = await this.executeChartLayers(m, l.chart, u, a, s, n), g = {
|
|
2222
2222
|
success: !0,
|
|
2223
|
-
generatedSql:
|
|
2224
|
-
results:
|
|
2225
|
-
resultSize:
|
|
2226
|
-
columnCount:
|
|
2227
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2228
|
-
chartConfig:
|
|
2229
|
-
chartWarnings:
|
|
2230
|
-
layers:
|
|
2223
|
+
generatedSql: l.generated_sql,
|
|
2224
|
+
results: u,
|
|
2225
|
+
resultSize: u.data.length,
|
|
2226
|
+
columnCount: u.headers.size,
|
|
2227
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2228
|
+
chartConfig: p?.config,
|
|
2229
|
+
chartWarnings: p?.warnings.length ? p.warnings : void 0,
|
|
2230
|
+
layers: h
|
|
2231
2231
|
};
|
|
2232
|
-
|
|
2233
|
-
query:
|
|
2234
|
-
generatedQuery:
|
|
2235
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2232
|
+
d && l.label && d[l.label] && d[l.label](g), c.push(g), this.storeHistory && Q(e).recordQuery({
|
|
2233
|
+
query: t[r].query,
|
|
2234
|
+
generatedQuery: l.generated_sql,
|
|
2235
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2236
2236
|
status: "success",
|
|
2237
|
-
resultSize:
|
|
2238
|
-
resultColumns:
|
|
2237
|
+
resultSize: u.data.length,
|
|
2238
|
+
resultColumns: u.headers.size,
|
|
2239
2239
|
errorMessage: null,
|
|
2240
|
-
extraFilters:
|
|
2240
|
+
extraFilters: i
|
|
2241
2241
|
});
|
|
2242
|
-
} catch (
|
|
2243
|
-
let
|
|
2242
|
+
} catch (n) {
|
|
2243
|
+
let a = s.signal.aborted ? "Query execution cancelled by user" : n instanceof Error ? n.message : "Unknown error occurred during execution", d = {
|
|
2244
2244
|
success: !1,
|
|
2245
|
-
error:
|
|
2246
|
-
generatedSql:
|
|
2247
|
-
results: new
|
|
2245
|
+
error: a,
|
|
2246
|
+
generatedSql: l.generated_sql,
|
|
2247
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2248
2248
|
resultSize: 0,
|
|
2249
2249
|
columnCount: 0,
|
|
2250
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2250
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o
|
|
2251
2251
|
};
|
|
2252
|
-
|
|
2253
|
-
query:
|
|
2254
|
-
generatedQuery:
|
|
2255
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2252
|
+
c.push(d), console.error("Error callback for ", l.label, u), console.error("Error details:", n), u && l.label && u[l.label] && u[l.label](d), this.storeHistory && Q(e).recordQuery({
|
|
2253
|
+
query: t[r].query,
|
|
2254
|
+
generatedQuery: l.generated_sql,
|
|
2255
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2256
2256
|
status: "error",
|
|
2257
2257
|
resultSize: 0,
|
|
2258
2258
|
resultColumns: 0,
|
|
2259
|
-
errorMessage:
|
|
2260
|
-
extraFilters:
|
|
2259
|
+
errorMessage: a,
|
|
2260
|
+
extraFilters: i
|
|
2261
2261
|
});
|
|
2262
2262
|
}
|
|
2263
|
-
} else if (
|
|
2263
|
+
} else if (l.error) {
|
|
2264
2264
|
let e = {
|
|
2265
2265
|
success: !1,
|
|
2266
|
-
error:
|
|
2266
|
+
error: l.error,
|
|
2267
2267
|
generatedSql: "",
|
|
2268
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2269
|
-
results: new
|
|
2268
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2269
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2270
2270
|
resultSize: 0,
|
|
2271
2271
|
columnCount: 0
|
|
2272
2272
|
};
|
|
2273
|
-
|
|
2273
|
+
u && l.label && u[l.label] && u[l.label](e), c.push(e);
|
|
2274
2274
|
} else {
|
|
2275
2275
|
let e = {
|
|
2276
2276
|
success: !1,
|
|
2277
2277
|
error: "No SQL was generated for this query",
|
|
2278
2278
|
generatedSql: "",
|
|
2279
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2280
|
-
results: new
|
|
2279
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2280
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2281
2281
|
resultSize: 0,
|
|
2282
2282
|
columnCount: 0
|
|
2283
2283
|
};
|
|
2284
|
-
|
|
2284
|
+
c.push(e), u && l.label && u[l.label] && u[l.label](e);
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
return {
|
|
2288
2288
|
success: !0,
|
|
2289
|
-
results:
|
|
2290
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2289
|
+
results: c,
|
|
2290
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o
|
|
2291
2291
|
};
|
|
2292
2292
|
} catch (e) {
|
|
2293
|
-
let t =
|
|
2294
|
-
return
|
|
2293
|
+
let t = s.signal.aborted ? "Query batch cancelled by user" : e instanceof Error ? e.message : "Unknown error occurred";
|
|
2294
|
+
return u && Object.values(u).forEach((e) => e({
|
|
2295
2295
|
message: t,
|
|
2296
2296
|
error: !0,
|
|
2297
2297
|
running: !1
|
|
2298
2298
|
})), {
|
|
2299
2299
|
success: !1,
|
|
2300
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2300
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
|
|
2301
2301
|
results: []
|
|
2302
2302
|
};
|
|
2303
2303
|
}
|
|
@@ -2349,24 +2349,24 @@ var je = class {
|
|
|
2349
2349
|
async getEligibleCrossFilterFields(e, t = {}) {
|
|
2350
2350
|
let n = this.connectionProvider.getConnection(e);
|
|
2351
2351
|
if (!n) throw Error(`Connection ${e} not found.`);
|
|
2352
|
-
let r = t.imports ?? [], i = t.extraFilters ?? [], a = t.extraContent ?? [],
|
|
2352
|
+
let r = t.imports ?? [], i = t.extraFilters ?? [], a = t.extraContent ?? [], o = this.connectionProvider.getConnectionSources(e).concat(a), s = JSON.stringify({
|
|
2353
2353
|
connectionId: e,
|
|
2354
2354
|
queryType: n.queryType,
|
|
2355
2355
|
imports: r,
|
|
2356
2356
|
extraFilters: i,
|
|
2357
|
-
sources:
|
|
2357
|
+
sources: o,
|
|
2358
2358
|
currentFilename: t.currentFilename ?? null
|
|
2359
|
-
}),
|
|
2360
|
-
if (
|
|
2361
|
-
let
|
|
2359
|
+
}), c = this.eligibleCrossFilterFieldsCache.get(s);
|
|
2360
|
+
if (c) return [...c];
|
|
2361
|
+
let l = await this.validateQuery(e, {
|
|
2362
2362
|
text: "select 1 as cross_filter_probe;",
|
|
2363
2363
|
editorType: "trilogy",
|
|
2364
2364
|
imports: r,
|
|
2365
2365
|
extraFilters: i,
|
|
2366
2366
|
extraContent: a,
|
|
2367
2367
|
currentFilename: t.currentFilename
|
|
2368
|
-
}, !1),
|
|
2369
|
-
return this.eligibleCrossFilterFieldsCache.set(
|
|
2368
|
+
}, !1), u = d(l?.data.completion_items ?? []);
|
|
2369
|
+
return this.eligibleCrossFilterFieldsCache.set(s, u), [...u];
|
|
2370
2370
|
}
|
|
2371
2371
|
clearEligibleCrossFilterFieldsCache() {
|
|
2372
2372
|
this.eligibleCrossFilterFieldsCache.clear();
|
|
@@ -2381,11 +2381,11 @@ var je = class {
|
|
|
2381
2381
|
resultPromise: this.executeQueryInternal(e, t, s, c, n, r, i, a, o)
|
|
2382
2382
|
};
|
|
2383
2383
|
}
|
|
2384
|
-
async executeQueryInternal(n, r, i, a, o, s, c
|
|
2385
|
-
let
|
|
2386
|
-
if (
|
|
2384
|
+
async executeQueryInternal(e, t, n, r, i, a, o, s, c = !1) {
|
|
2385
|
+
let l = 0, u = 0, d = "";
|
|
2386
|
+
if (t.editorType === "python") {
|
|
2387
2387
|
let e = "Python files are editable but cannot be run locally.";
|
|
2388
|
-
return
|
|
2388
|
+
return o && o({
|
|
2389
2389
|
message: e,
|
|
2390
2390
|
error: !0,
|
|
2391
2391
|
running: !1
|
|
@@ -2397,29 +2397,29 @@ var je = class {
|
|
|
2397
2397
|
columnCount: 0
|
|
2398
2398
|
};
|
|
2399
2399
|
}
|
|
2400
|
-
|
|
2401
|
-
let
|
|
2402
|
-
if (!
|
|
2403
|
-
message: `Connection ${
|
|
2400
|
+
i && i();
|
|
2401
|
+
let f = this.connectionProvider.getConnection(e);
|
|
2402
|
+
if (!f) return o && o({
|
|
2403
|
+
message: `Connection ${e} not found.`,
|
|
2404
2404
|
error: !0,
|
|
2405
2405
|
running: !1
|
|
2406
2406
|
}), {
|
|
2407
2407
|
success: !1,
|
|
2408
|
-
error: `Connection ${
|
|
2408
|
+
error: `Connection ${e} not found.`,
|
|
2409
2409
|
executionTime: 0,
|
|
2410
2410
|
resultSize: 0,
|
|
2411
2411
|
columnCount: 0
|
|
2412
2412
|
};
|
|
2413
|
-
if (!
|
|
2414
|
-
|
|
2413
|
+
if (!f.isConnected() && !c) try {
|
|
2414
|
+
a && a({
|
|
2415
2415
|
message: "Connection is not active... Attempting to automatically reconnect.",
|
|
2416
2416
|
error: !0
|
|
2417
|
-
}), await this.connectionProvider.ensureConnected(
|
|
2417
|
+
}), await this.connectionProvider.ensureConnected(e), a && a({
|
|
2418
2418
|
message: "Reconnect Successful",
|
|
2419
2419
|
running: !0
|
|
2420
2420
|
});
|
|
2421
2421
|
} catch {
|
|
2422
|
-
return
|
|
2422
|
+
return o && o({
|
|
2423
2423
|
message: "Connection failed to reconnect.",
|
|
2424
2424
|
error: !0,
|
|
2425
2425
|
running: !1
|
|
@@ -2431,175 +2431,175 @@ var je = class {
|
|
|
2431
2431
|
columnCount: 0
|
|
2432
2432
|
};
|
|
2433
2433
|
}
|
|
2434
|
-
if (
|
|
2435
|
-
let
|
|
2436
|
-
if (
|
|
2434
|
+
if (t.editorType === "sql") try {
|
|
2435
|
+
let i = Oe(t.text);
|
|
2436
|
+
if (i.length === 0) {
|
|
2437
2437
|
let e = {
|
|
2438
2438
|
success: !0,
|
|
2439
|
-
generatedSql:
|
|
2440
|
-
results: new
|
|
2441
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2439
|
+
generatedSql: t.text,
|
|
2440
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2441
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2442
2442
|
resultSize: 0,
|
|
2443
2443
|
columnCount: 0
|
|
2444
2444
|
};
|
|
2445
|
-
return
|
|
2445
|
+
return s && s(e), e;
|
|
2446
2446
|
}
|
|
2447
|
-
if (
|
|
2448
|
-
let
|
|
2449
|
-
await Promise.race([
|
|
2450
|
-
|
|
2447
|
+
if (i.length > 1) {
|
|
2448
|
+
let e = i.slice(0, -1).join(";\n") + ";";
|
|
2449
|
+
await Promise.race([f.runScript(e), new Promise((e, t) => {
|
|
2450
|
+
r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2451
2451
|
})]);
|
|
2452
2452
|
}
|
|
2453
|
-
let
|
|
2454
|
-
ke(
|
|
2455
|
-
|
|
2456
|
-
})]),
|
|
2457
|
-
|
|
2453
|
+
let a = i[i.length - 1], o;
|
|
2454
|
+
ke(a) ? (await Promise.race([f.runScript(a), new Promise((e, t) => {
|
|
2455
|
+
r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2456
|
+
})]), o = new h(/* @__PURE__ */ new Map(), [])) : o = await Promise.race([f.executeSql(a, t.parameters ?? null), new Promise((e, t) => {
|
|
2457
|
+
r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2458
2458
|
})]);
|
|
2459
2459
|
let c = {
|
|
2460
2460
|
success: !0,
|
|
2461
|
-
generatedSql:
|
|
2462
|
-
results:
|
|
2463
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2464
|
-
resultSize:
|
|
2465
|
-
columnCount:
|
|
2461
|
+
generatedSql: t.text,
|
|
2462
|
+
results: o,
|
|
2463
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2464
|
+
resultSize: o.data.length,
|
|
2465
|
+
columnCount: o.headers.size
|
|
2466
2466
|
};
|
|
2467
|
-
return this.storeHistory && Q(
|
|
2468
|
-
query:
|
|
2469
|
-
generatedQuery:
|
|
2467
|
+
return this.storeHistory && Q(e).recordQuery({
|
|
2468
|
+
query: t.text,
|
|
2469
|
+
generatedQuery: t.text,
|
|
2470
2470
|
executionTime: c.executionTime,
|
|
2471
2471
|
status: "success",
|
|
2472
2472
|
resultSize: c.resultSize,
|
|
2473
2473
|
resultColumns: c.columnCount,
|
|
2474
2474
|
errorMessage: null,
|
|
2475
|
-
extraFilters:
|
|
2476
|
-
}),
|
|
2475
|
+
extraFilters: t.extraFilters
|
|
2476
|
+
}), s && s(c), c;
|
|
2477
2477
|
} catch (e) {
|
|
2478
2478
|
let t = e instanceof Error ? e.message : String(e);
|
|
2479
|
-
return
|
|
2479
|
+
return o && o({
|
|
2480
2480
|
message: t,
|
|
2481
2481
|
error: !0,
|
|
2482
2482
|
running: !1
|
|
2483
2483
|
}), {
|
|
2484
2484
|
success: !1,
|
|
2485
2485
|
error: t,
|
|
2486
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2486
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2487
2487
|
resultSize: 0,
|
|
2488
2488
|
columnCount: 0
|
|
2489
2489
|
};
|
|
2490
2490
|
}
|
|
2491
|
-
let
|
|
2492
|
-
|
|
2493
|
-
let g = this.resolveRegisteredFiles(
|
|
2491
|
+
let p = this.connectionProvider.getConnectionSources(e);
|
|
2492
|
+
t.extraContent && (p = p.concat(t.extraContent));
|
|
2493
|
+
let g = this.resolveRegisteredFiles(e, f), _ = this.connectionProvider.getConnectionWorkingPath?.(e) ?? null, v = null;
|
|
2494
2494
|
try {
|
|
2495
|
-
if (v = await Promise.race([this.trilogyResolver.resolve_query(
|
|
2496
|
-
|
|
2495
|
+
if (v = await Promise.race([this.trilogyResolver.resolve_query(t.text, f.queryType, t.editorType, p, t.imports, t.extraFilters, t.parameters, t.currentFilename || null, g.length > 0 ? g : null, _), new Promise((e, t) => {
|
|
2496
|
+
r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2497
2497
|
})]), v && v.data.generated_output) {
|
|
2498
|
-
let
|
|
2498
|
+
let e = v.data.columns || [], t = {
|
|
2499
2499
|
success: !0,
|
|
2500
2500
|
generatedSql: v.data.generated_sql,
|
|
2501
|
-
results: new
|
|
2502
|
-
name:
|
|
2503
|
-
type:
|
|
2504
|
-
purpose:
|
|
2501
|
+
results: new h(new Map(e.map((e) => [e.name, {
|
|
2502
|
+
name: e.name,
|
|
2503
|
+
type: m.STRING,
|
|
2504
|
+
purpose: e.purpose
|
|
2505
2505
|
}])), v.data.generated_output),
|
|
2506
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2506
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2507
2507
|
resultSize: v.data.generated_output.length,
|
|
2508
|
-
columnCount:
|
|
2508
|
+
columnCount: e.length,
|
|
2509
2509
|
selectCount: v.data.select_count
|
|
2510
2510
|
};
|
|
2511
|
-
return console.log(
|
|
2511
|
+
return console.log(t), s && s(t), t;
|
|
2512
2512
|
}
|
|
2513
|
-
if (!v || !v.data.generated_sql ||
|
|
2513
|
+
if (!v || !v.data.generated_sql || c) {
|
|
2514
2514
|
let e = {
|
|
2515
2515
|
success: !0,
|
|
2516
|
-
results: new
|
|
2517
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2516
|
+
results: new h(/* @__PURE__ */ new Map(), []),
|
|
2517
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2518
2518
|
resultSize: 0,
|
|
2519
2519
|
columnCount: 0
|
|
2520
2520
|
};
|
|
2521
|
-
return
|
|
2521
|
+
return s && s(e), e;
|
|
2522
2522
|
}
|
|
2523
|
-
|
|
2524
|
-
let
|
|
2525
|
-
...
|
|
2523
|
+
d = v.data.generated_sql;
|
|
2524
|
+
let i = Y(v.data.chart), a = v.data.columns, o = {
|
|
2525
|
+
...t.parameters || {},
|
|
2526
2526
|
...v.data.parameters || {}
|
|
2527
|
-
}, y = Object.keys(
|
|
2528
|
-
|
|
2527
|
+
}, y = Object.keys(o).length ? o : null, b = await Promise.race([f.executeSql(d, y), new Promise((e, t) => {
|
|
2528
|
+
r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2529
2529
|
})]);
|
|
2530
|
-
w(
|
|
2531
|
-
query:
|
|
2532
|
-
generatedQuery:
|
|
2533
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2530
|
+
w(t.editorType) && this.enrichTrilogyColumns(a, b), l = b.data.length, u = b.headers.size, this.storeHistory && Q(e).recordQuery({
|
|
2531
|
+
query: t.text,
|
|
2532
|
+
generatedQuery: d,
|
|
2533
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2534
2534
|
status: "success",
|
|
2535
|
-
resultSize:
|
|
2536
|
-
resultColumns:
|
|
2535
|
+
resultSize: l,
|
|
2536
|
+
resultColumns: u,
|
|
2537
2537
|
errorMessage: null,
|
|
2538
|
-
extraFilters:
|
|
2538
|
+
extraFilters: t.extraFilters
|
|
2539
2539
|
});
|
|
2540
|
-
let x = await this.executeChartLayers(
|
|
2540
|
+
let x = await this.executeChartLayers(f, v.data.chart, b, o, r, t.editorType), S = v?.data.select_count, C = {
|
|
2541
2541
|
success: !0,
|
|
2542
|
-
generatedSql:
|
|
2542
|
+
generatedSql: d,
|
|
2543
2543
|
results: b,
|
|
2544
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2545
|
-
resultSize:
|
|
2546
|
-
columnCount:
|
|
2544
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2545
|
+
resultSize: l,
|
|
2546
|
+
columnCount: u,
|
|
2547
2547
|
selectCount: S,
|
|
2548
|
-
chartConfig:
|
|
2549
|
-
chartWarnings:
|
|
2548
|
+
chartConfig: i?.config,
|
|
2549
|
+
chartWarnings: i?.warnings.length ? i.warnings : void 0,
|
|
2550
2550
|
layers: x
|
|
2551
2551
|
};
|
|
2552
|
-
return
|
|
2553
|
-
} catch (
|
|
2554
|
-
console.error("[query catch] raw error:",
|
|
2555
|
-
let
|
|
2552
|
+
return s && s(C), C;
|
|
2553
|
+
} catch (i) {
|
|
2554
|
+
console.error("[query catch] raw error:", i, "type:", typeof i, "ctor:", i?.constructor?.name);
|
|
2555
|
+
let a = r.signal.aborted ? "Query cancelled by user" : i instanceof Error ? i.message : typeof i == "string" ? i : (() => {
|
|
2556
2556
|
try {
|
|
2557
|
-
return `Unknown error: ${JSON.stringify(
|
|
2557
|
+
return `Unknown error: ${JSON.stringify(i)}`;
|
|
2558
2558
|
} catch {
|
|
2559
|
-
return `Unknown error: ${String(
|
|
2559
|
+
return `Unknown error: ${String(i)}`;
|
|
2560
2560
|
}
|
|
2561
2561
|
})();
|
|
2562
|
-
return this.storeHistory && Q(
|
|
2563
|
-
query:
|
|
2564
|
-
generatedQuery:
|
|
2565
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2562
|
+
return this.storeHistory && Q(e).recordQuery({
|
|
2563
|
+
query: t.text,
|
|
2564
|
+
generatedQuery: d,
|
|
2565
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2566
2566
|
status: "error",
|
|
2567
|
-
resultSize:
|
|
2568
|
-
resultColumns:
|
|
2569
|
-
errorMessage:
|
|
2570
|
-
}),
|
|
2571
|
-
message:
|
|
2567
|
+
resultSize: l,
|
|
2568
|
+
resultColumns: u,
|
|
2569
|
+
errorMessage: a
|
|
2570
|
+
}), o && o({
|
|
2571
|
+
message: a,
|
|
2572
2572
|
error: !0,
|
|
2573
2573
|
running: !1,
|
|
2574
|
-
generatedSql:
|
|
2574
|
+
generatedSql: d
|
|
2575
2575
|
}), {
|
|
2576
2576
|
success: !1,
|
|
2577
|
-
error:
|
|
2578
|
-
executionTime: (/* @__PURE__ */ new Date()).getTime() -
|
|
2579
|
-
resultSize:
|
|
2580
|
-
columnCount:
|
|
2577
|
+
error: a,
|
|
2578
|
+
executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
|
|
2579
|
+
resultSize: l,
|
|
2580
|
+
columnCount: u
|
|
2581
2581
|
};
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
|
-
async executeChartLayers(e, n, r, i, a
|
|
2585
|
-
let
|
|
2586
|
-
if (!
|
|
2587
|
-
let
|
|
2588
|
-
for (let
|
|
2589
|
-
let
|
|
2590
|
-
if (!
|
|
2591
|
-
|
|
2584
|
+
async executeChartLayers(e, t, n, r, i, a) {
|
|
2585
|
+
let o = t?.layers;
|
|
2586
|
+
if (!o || o.length < 2) return;
|
|
2587
|
+
let s = [n];
|
|
2588
|
+
for (let t = 1; t < o.length; t++) {
|
|
2589
|
+
let n = o[t];
|
|
2590
|
+
if (!n.generated_sql) {
|
|
2591
|
+
s.push(new h(/* @__PURE__ */ new Map(), []));
|
|
2592
2592
|
continue;
|
|
2593
2593
|
}
|
|
2594
|
-
let
|
|
2595
|
-
...
|
|
2596
|
-
...
|
|
2597
|
-
},
|
|
2598
|
-
|
|
2594
|
+
let c = {
|
|
2595
|
+
...r,
|
|
2596
|
+
...n.parameters || {}
|
|
2597
|
+
}, l = await Promise.race([e.executeSql(n.generated_sql, Object.keys(c).length ? c : null), new Promise((e, t) => {
|
|
2598
|
+
i.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
|
|
2599
2599
|
})]);
|
|
2600
|
-
w(
|
|
2600
|
+
w(a) && this.enrichTrilogyColumns(n.columns || [], l), s.push(l);
|
|
2601
2601
|
}
|
|
2602
|
-
return
|
|
2602
|
+
return s;
|
|
2603
2603
|
}
|
|
2604
2604
|
enrichTrilogyColumns(e, t) {
|
|
2605
2605
|
for (let n = 0; n < e.length; n++) {
|