@trilogy-data/trilogy-studio-components 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/AssetAutoImporter-OHphsfW9.js +403 -0
  2. package/dist/ChatCreatorModal-CuXha6Dg.js +218 -0
  3. package/dist/ChatModelSelect-Cz7axWjP.js +40 -0
  4. package/dist/{CodeBlock-PT4no49I.js → CodeBlock-BBsaC6hX.js} +4 -4
  5. package/dist/{CommunityModels-D7zWnHgG.js → CommunityModels-CIQQhO-y.js} +106 -75
  6. package/dist/{ConnectionErrorPopup-FSs7U-Yl.js → ConnectionErrorPopup-7vpqgF0s.js} +1 -1
  7. package/dist/{ConnectionView-COnTTuA4.js → ConnectionView-7Jj_Ggdi.js} +49 -49
  8. package/dist/{CreateEditorFromDatasourcePopup-snOh1d5h.js → CreateEditorFromDatasourcePopup-CrVHUWFl.js} +4 -4
  9. package/dist/{Dashboard-D1ZCTw5r.js → Dashboard-DxSi9W6Q.js} +276 -280
  10. package/dist/{DashboardImportSelector-CNxibXlS.js → DashboardImportSelector-kuDRDYi8.js} +2 -2
  11. package/dist/{DashboardMobile-D_m0xv17.js → DashboardMobile-CZEgTb0R.js} +39 -39
  12. package/dist/{DrilldownPane-CBs5ZojS.js → DrilldownPane-BheRHJMs.js} +5 -7
  13. package/dist/{Editor-DhsP18KE.js → Editor-D6tdutTm.js} +106 -104
  14. package/dist/{ErrorMessage-XMn_08gJ.js → ErrorMessage-D5JeF3Iz.js} +4 -4
  15. package/dist/{GlobalChatPanel-DFx9A4yP.js → GlobalChatPanel-BXZh0sdD.js} +169 -134
  16. package/dist/{IDE-BRMLxTfP.js → IDE-T8PmyAQ_.js} +200 -203
  17. package/dist/{JobsView-C9PYS6pZ.js → JobsView-Ca97MiSd.js} +12 -13
  18. package/dist/{LLMChat-Cqg6pTgC.js → LLMChat-Cch33Yd_.js} +3 -3
  19. package/dist/{LLMView-VkJpP-49.js → LLMView-BDb6wD74.js} +26 -26
  20. package/dist/{LoadingView-s1uznGwG.js → LoadingView-B-xFwd2N.js} +2 -2
  21. package/dist/{MarkdownRenderer-BNDuEyG-.js → MarkdownRenderer-BWvdx0k3.js} +531 -430
  22. package/dist/MobileIDE-DpdEQEqc.js +783 -0
  23. package/dist/{ModelCard-D8tKkK9-.js → ModelCard-DkAMP4X9.js} +19 -20
  24. package/dist/{ModelView-rAurf9n8.js → ModelView-DomyhN8g.js} +7 -7
  25. package/dist/PageLoading-BAvKGo9h.js +5937 -0
  26. package/dist/{ResultComponent-_-1qZCfv.js → ResultComponent-zoOSoRLe.js} +8 -8
  27. package/dist/{Results-CQGpFmPQ.js → Results-dq-SlJbU.js} +17 -19
  28. package/dist/{StatusIcon-BylPx2EO.js → StatusIcon-AbxNvJ6p.js} +2 -2
  29. package/dist/{StoreTokenModal-zCSYhfrw.js → StoreTokenModal-CM8WXdu1.js} +2 -2
  30. package/dist/{SymbolsPane-BpmL___H.js → SymbolsPane-DfaxeaPS.js} +6 -3
  31. package/dist/{TrilogyEmbedProvider-WA_dlv9e.js → TrilogyEmbedProvider-D3h0gYnX.js} +9 -9
  32. package/dist/{TutorialPage-CZGBRJdq.js → TutorialPage-BtEJG7cT.js} +27 -28
  33. package/dist/{VegaLiteChart-CmkOw6yD.js → VegaLiteChart-BVyAab-o.js} +12191 -10975
  34. package/dist/{WelcomePage-CLKvAvk-.js → WelcomePage-BoqzYBLr.js} +5 -5
  35. package/dist/{embedTheme-Bub46ILG.js → _plugin-vue_export-helper-f9Rw-Il4.js} +14 -6
  36. package/dist/assets/{css.worker-9aDGcEUy.js → css.worker-niORQtzO.js} +14 -14
  37. package/dist/assets/{html.worker-D2LKDpnG.js → html.worker-CO5LvJpF.js} +17 -17
  38. package/dist/assets/json.worker-BezHzWUV.js +58 -0
  39. package/dist/assets/{ts.worker-Bz0-EaKK.js → ts.worker-CYhxGg0r.js} +107 -107
  40. package/dist/{results-DTgAKr5j.js → base-DuKnVD-A.js} +216 -45
  41. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -1
  42. package/dist/components/FeedbackBanner.vue.d.ts +4 -0
  43. package/dist/components/FeedbackBanner.vue.d.ts.map +1 -0
  44. package/dist/components/TipsCTA.vue.d.ts +1 -1
  45. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  46. package/dist/components/chartHelpers.d.ts +9 -1
  47. package/dist/components/chartHelpers.d.ts.map +1 -1
  48. package/dist/components/chartRenderManager.d.ts +4 -1
  49. package/dist/components/chartRenderManager.d.ts.map +1 -1
  50. package/dist/components/community/AddStoreModal.vue.d.ts +1 -1
  51. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -1
  52. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -1
  53. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +54 -0
  54. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +1 -0
  55. package/dist/components/dashboard/DashboardProvenance.vue.d.ts +30 -0
  56. package/dist/components/dashboard/DashboardProvenance.vue.d.ts.map +1 -0
  57. package/dist/components/dashboard/ReportLayout.vue.d.ts +19 -0
  58. package/dist/components/dashboard/ReportLayout.vue.d.ts.map +1 -0
  59. package/dist/components/editor/Editor.vue.d.ts +3 -3
  60. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  61. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +62 -0
  62. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +1 -0
  63. package/dist/components/editor/ValidationComponent.vue.d.ts +50 -0
  64. package/dist/components/editor/ValidationComponent.vue.d.ts.map +1 -0
  65. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts.map +1 -1
  66. package/dist/components/llm/ChatCreatorModal.vue.d.ts +17 -1
  67. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -1
  68. package/dist/components/llm/ChatModelSelect.vue.d.ts +13 -0
  69. package/dist/components/llm/ChatModelSelect.vue.d.ts.map +1 -0
  70. package/dist/components/llm/GlobalChatPanel.vue.d.ts.map +1 -1
  71. package/dist/components/model/ModelCard.vue.d.ts +3 -3
  72. package/dist/components/sidebar/CommunityModelList.vue.d.ts +33 -50
  73. package/dist/components/sidebar/CommunityModelList.vue.d.ts.map +1 -1
  74. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -1
  75. package/dist/components/sidebar/EditorList.vue.d.ts +32 -49
  76. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  77. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  78. package/dist/components/sidebar/Sidebar.vue.d.ts +65 -99
  79. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  80. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +3 -3
  81. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  82. package/dist/{remoteWorker-Dkv3TJ0j.js → connections-CWH3zwH2.js} +4544 -4126
  83. package/dist/connections.js +3 -4
  84. package/dist/{cssMode-D4Rzr1Cu.js → cssMode-zpO2ap2B.js} +5 -6
  85. package/dist/dashboard.js +54 -57
  86. package/dist/dashboards/layerSpec.d.ts +38 -4
  87. package/dist/dashboards/layerSpec.d.ts.map +1 -1
  88. package/dist/dashboards/lineAreaSpec.d.ts +8 -80
  89. package/dist/dashboards/lineAreaSpec.d.ts.map +1 -1
  90. package/dist/dashboards/mapSpec.d.ts +1 -0
  91. package/dist/dashboards/mapSpec.d.ts.map +1 -1
  92. package/dist/dashboards/spec.d.ts.map +1 -1
  93. package/dist/data/tutorial/documentation.d.ts.map +1 -1
  94. package/dist/data/tutorial/startupScripts.d.ts +3 -0
  95. package/dist/data/tutorial/startupScripts.d.ts.map +1 -0
  96. package/dist/{dist-CXoL8kXK.js → dist-1z5KURzS.js} +55 -50
  97. package/dist/{dist-DKkuvbPb.js → dist-Bv3D2p5A.js} +20 -18
  98. package/dist/{editor.main-Cl8i7rHY.js → editor.main-BQh6DxDB.js} +33 -33
  99. package/dist/{editorRefinementRuntime-C_YmXRy4.js → editorStore-CAlMJftt.js} +2084 -946
  100. package/dist/embed.js +2 -2
  101. package/dist/entry.dashboard.d.ts +1 -0
  102. package/dist/entry.dashboard.d.ts.map +1 -1
  103. package/dist/{freemarker2-fW5NBILf.js → freemarker2-DQBqlEXc.js} +1 -1
  104. package/dist/{globalChatRuntime-oMLiPLNC.js → globalChatRuntime-CyS7vH51.js} +18 -18
  105. package/dist/{handlebars-dG4w8UUY.js → handlebars-tgYxaM70.js} +1 -1
  106. package/dist/{helpers-DcWCa6bX.js → helpers-BbVlA3Pf.js} +39 -39
  107. package/dist/{html-1Dq70BdU.js → html-jJahD3Mi.js} +1 -1
  108. package/dist/{htmlMode--IQmLBeh.js → htmlMode-BA1-8l2e.js} +5 -6
  109. package/dist/{javascript-CTzBM4sF.js → javascript-Cypfo7va.js} +1 -1
  110. package/dist/{jsonMode-DzeJjIEH.js → jsonMode-xJye8PWS.js} +25 -25
  111. package/dist/{liquid-DlHThiki.js → liquid-BGDrv5da.js} +1 -1
  112. package/dist/llm/data/constants.d.ts +1 -1
  113. package/dist/llm/data/constants.d.ts.map +1 -1
  114. package/dist/llm/data/trilogySyntax.generated.d.ts +7 -1
  115. package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
  116. package/dist/llm/docsIndex.d.ts.map +1 -1
  117. package/dist/llm/openai.d.ts +2 -1
  118. package/dist/llm/openai.d.ts.map +1 -1
  119. package/dist/llm-ClU-2rgk.js +18493 -0
  120. package/dist/llm.js +2 -3
  121. package/dist/{localStorage-CSuYS7QE.js → localStorage-CGQ1iJXt.js} +39 -42
  122. package/dist/{lspLanguageFeatures-Cdfs3EKq.js → lspLanguageFeatures-V3e_p9oN.js} +32 -32
  123. package/dist/{mdx-fn3g4PH5.js → mdx-BUR1aImW.js} +1 -1
  124. package/dist/models/helpers.d.ts.map +1 -1
  125. package/dist/monaco.js +3 -3
  126. package/dist/{python-CCVj0pFt.js → python-YLkl0pc6.js} +1 -1
  127. package/dist/{razor-Cj3flYnk.js → razor-BP8TRMDY.js} +1 -1
  128. package/dist/{reconcile-Bk7M797_.js → reconcile-DXIvGwBk.js} +1 -1
  129. package/dist/{remoteStoreSync-CLvZJrTK.js → remoteStoreSync-CuQBWpWf.js} +3 -3
  130. package/dist/remotes/displayHelpers.d.ts.map +1 -1
  131. package/dist/remotes/genericStoreMetadata.d.ts +1 -0
  132. package/dist/remotes/genericStoreMetadata.d.ts.map +1 -1
  133. package/dist/remotes/models.d.ts +37 -5
  134. package/dist/remotes/models.d.ts.map +1 -1
  135. package/dist/remotes/staticStorePresets.d.ts +22 -0
  136. package/dist/remotes/staticStorePresets.d.ts.map +1 -0
  137. package/dist/remotes/storeService.d.ts +25 -4
  138. package/dist/remotes/storeService.d.ts.map +1 -1
  139. package/dist/{rolldown-runtime-Dqa2HsxW.js → rolldown-runtime-B0aSnxlc.js} +2 -2
  140. package/dist/static/test_import.vue.d.ts +4 -0
  141. package/dist/static/test_import.vue.d.ts.map +1 -0
  142. package/dist/stores/communityApiStore.d.ts +32 -60
  143. package/dist/stores/communityApiStore.d.ts.map +1 -1
  144. package/dist/stores/connectionStore.d.ts.map +1 -1
  145. package/dist/stores/resolver.d.ts +5 -0
  146. package/dist/stores/resolver.d.ts.map +1 -1
  147. package/dist/stores/urlStore.d.ts +1 -0
  148. package/dist/stores/urlStore.d.ts.map +1 -1
  149. package/dist/stores-LlyiwSbK.js +2604 -0
  150. package/dist/stores.js +4 -7
  151. package/dist/trilogy-studio-components.css +1 -1
  152. package/dist/{tsMode-GI4xMYAl.js → tsMode-BH9HS_sH.js} +64 -66
  153. package/dist/{typescript-CPibXi3J.js → typescript-BM-ynfk9.js} +1 -1
  154. package/dist/{useChatWithTools-GV1ufcqw.js → useChatWithTools-m3Jn_SV-.js} +11 -11
  155. package/dist/{useDashboard-OoBKkkuQ.js → useDashboard-BOAuvVEw.js} +1013 -1021
  156. package/dist/{tabulator_esm-CxLvGDp8.js → useGlobalChatPanel-DuP1q7_f.js} +1729 -711
  157. package/dist/{useResizableDialog-B0ePSts4.js → useResizableDialog-Cs90WJdF.js} +2 -2
  158. package/dist/views/MobileIDE.vue.d.ts.map +1 -1
  159. package/dist/views/ModelView.vue.d.ts +6 -6
  160. package/dist/views/ModelView.vue.d.ts.map +1 -1
  161. package/dist/views/TutorialPage.vue.d.ts +41 -58
  162. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  163. package/dist/views.js +193 -195
  164. package/dist/{editor.api2-ClD5pp8H.js → workers-B9Eybl-M.js} +16252 -15926
  165. package/dist/{xml-BNyphceI.js → xml-M5WFPSpA.js} +1 -1
  166. package/dist/{yaml-DE5Vz0PH.js → yaml-CEeFwjz9.js} +1 -1
  167. package/package.json +29 -20
  168. package/dist/AssetAutoImporter-DfMd_DSk.js +0 -403
  169. package/dist/ChatCreatorModal-BTqY06B6.js +0 -177
  170. package/dist/DashboardCreatorInline-LWvf--2x.js +0 -129
  171. package/dist/DataTable-DoRDynP1.js +0 -365
  172. package/dist/EditorCreatorInline-D6_y1H_h.js +0 -125
  173. package/dist/LoadingButton-OH3frQuO.js +0 -138
  174. package/dist/MobileIDE-CHGJoh05.js +0 -781
  175. package/dist/ModalDialog-D1EOG4rl.js +0 -42
  176. package/dist/ModelCreator-DrxLxeyH.js +0 -253
  177. package/dist/PageLoading-I6mr-7NB.js +0 -2666
  178. package/dist/Tooltip-Dihir4zs.js +0 -103
  179. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  180. package/dist/assets/json.worker-CJ5MmO5Q.js +0 -58
  181. package/dist/base-C8IuZWqY.js +0 -164
  182. package/dist/connectionHistoryStorage-DKJHiKJY.js +0 -111
  183. package/dist/connectionHistoryStore-DQeBvStZ.js +0 -61
  184. package/dist/connections-CJSb1TZl.js +0 -229
  185. package/dist/constants-DgFEYN2b.js +0 -7
  186. package/dist/dashboardStore-CNkWQ4r7.js +0 -641
  187. package/dist/demoSetup-DiW3ROFQ.js +0 -2941
  188. package/dist/editorRefinementToolExecutor-mX8ClQ63.js +0 -4498
  189. package/dist/editorStore-Ch7k-gse.js +0 -972
  190. package/dist/formatting-BbJ5ICgh.js +0 -6
  191. package/dist/llm-_807I79k.js +0 -11965
  192. package/dist/llmStore-CSzM1IZd.js +0 -153
  193. package/dist/monaco.contribution-ikesdolO.js +0 -128
  194. package/dist/stores-C1wUWiFm.js +0 -1708
  195. package/dist/trilogy-BroD2Qmp.js +0 -4
  196. package/dist/urlStore-Dgmwx1YI.js +0 -54
  197. package/dist/useGlobalChatPanel-CIeUyZba.js +0 -85
  198. package/dist/useIsMobile-CNpUQAvk.js +0 -8
  199. package/dist/usePrismHighlight-DVyDiDAL.js +0 -183
  200. package/dist/workers-Br7ThUKL.js +0 -47
@@ -1,641 +0,0 @@
1
- import { Dt as e, Et as t, vt as n } from "./editorRefinementToolExecutor-mX8ClQ63.js";
2
- import { r } from "./editorStore-Ch7k-gse.js";
3
- import { s as i } from "./llm-_807I79k.js";
4
- import { defineStore as a } from "pinia";
5
- //#region dashboards/dashboardQueryExecutor.ts
6
- function o(e) {
7
- return typeof e == "string" ? e : typeof e?.error == "string" && e.error ? e.error : typeof e?.message == "string" && e.message ? e.message : "Unknown error occurred";
8
- }
9
- var s = class {
10
- queryQueue = /* @__PURE__ */ new Map();
11
- activeQueries = /* @__PURE__ */ new Set();
12
- queryWaiters = /* @__PURE__ */ new Map();
13
- latestQueryByItemId = /* @__PURE__ */ new Map();
14
- itemIdsByQueryId = /* @__PURE__ */ new Map();
15
- queryExecutionService;
16
- connectionName;
17
- dashboardId;
18
- getItemData;
19
- setItemData;
20
- getDashboardData;
21
- maxConcurrentQueries;
22
- retryAttempts;
23
- batchDelay;
24
- batchTimeout = null;
25
- constructor(e, t, n, r, i, a, o = {}) {
26
- this.queryExecutionService = e, this.connectionName = t, this.maxConcurrentQueries = o.maxConcurrentQueries || 10, this.retryAttempts = o.retryAttempts || 2, this.batchDelay = o.batchDelay || 0, this.dashboardId = n, this.getItemData = i, this.setItemData = a, this.getDashboardData = r;
27
- }
28
- cancelPendingQueriesForItem(e) {
29
- let t = this.latestQueryByItemId.get(e), n = [];
30
- this.queryQueue.forEach((r, i) => {
31
- r.itemId === e && i !== t && n.push(i);
32
- }), this.activeQueries.forEach((r) => {
33
- let i = this.itemIdsByQueryId.get(r);
34
- !i?.has(e) || r === t || [...i].some((t) => t !== e && this.latestQueryByItemId.get(t) === r) || n.push(r);
35
- }), n.forEach((t) => {
36
- console.log(`Cancelling outdated query ${t} for itemId ${e}`), this.cancelQuery(t);
37
- });
38
- }
39
- trackQueryForItem(e, t) {
40
- this.latestQueryByItemId.set(e, t);
41
- let n = this.itemIdsByQueryId.get(t);
42
- n ? n.add(e) : this.itemIdsByQueryId.set(t, /* @__PURE__ */ new Set([e]));
43
- }
44
- isLatestQueryForItem(e, t) {
45
- return this.latestQueryByItemId.get(e) === t;
46
- }
47
- isQueryInFlight(e) {
48
- return this.queryQueue.has(e) || this.activeQueries.has(e);
49
- }
50
- settleQueryLoading(e) {
51
- let t = this.itemIdsByQueryId.get(e);
52
- if (t) for (let e of t) {
53
- let t = this.latestQueryByItemId.get(e);
54
- t && this.isQueryInFlight(t) || this.setItemData(e, this.dashboardId, { loading: !1 });
55
- }
56
- }
57
- cleanupQueryTracking(e) {
58
- let t = this.itemIdsByQueryId.get(e);
59
- if (t) {
60
- for (let n of t) this.latestQueryByItemId.get(n) === e && this.latestQueryByItemId.delete(n);
61
- this.itemIdsByQueryId.delete(e);
62
- }
63
- }
64
- getDefaultPriority(e) {
65
- return this.getDashboardData(this.dashboardId).layout.find((t) => t.i === e)?.y || 0;
66
- }
67
- setConnection(e) {
68
- this.connectionName = e;
69
- }
70
- getDashboardImports() {
71
- return this.getDashboardData(this.dashboardId).imports.map((e) => ({
72
- name: e.name,
73
- alias: e.alias
74
- }));
75
- }
76
- waitForQuery(e) {
77
- return new Promise((t, n) => {
78
- if (!this.queryQueue.has(e) && !this.activeQueries.has(e)) {
79
- n(/* @__PURE__ */ Error(`Query ${e} not found or already completed`));
80
- return;
81
- }
82
- this.queryWaiters.set(e, {
83
- resolve: t,
84
- reject: n
85
- });
86
- });
87
- }
88
- getItemQueryText(e) {
89
- return (e.structured_content ? e.structured_content.query : e.content) || "";
90
- }
91
- enqueueItemQuery(e, t) {
92
- let n = this.getItemData(e, this.dashboardId), r = this.getItemQueryText(n);
93
- if (r.trim().length === 0) return this.setItemData(e, this.dashboardId, {
94
- error: null,
95
- loading: !1
96
- }), null;
97
- let i = n.filters || [], a = Object.assign({}, ...i.map((e) => e.parameters || {}));
98
- this.setItemData(e, this.dashboardId, {
99
- loading: !0,
100
- error: null
101
- });
102
- let o, s = () => this.isLatestQueryForItem(e, o), c = {
103
- dashboardId: this.dashboardId,
104
- queryInput: {
105
- text: r,
106
- extraFilters: i.map((e) => e.value),
107
- parameters: {
108
- ...n.parameters || {},
109
- ...a
110
- },
111
- extraContent: n.rootContent || []
112
- },
113
- priority: this.getDefaultPriority(e),
114
- itemId: e,
115
- onSuccess: (t) => {
116
- s() ? this.setItemData(e, this.dashboardId, { results: t.results }) : console.log(`Ignoring outdated query result for itemId ${e}`);
117
- },
118
- onError: (t) => {
119
- s() ? this.setItemData(e, this.dashboardId, { error: t }) : console.log(`Ignoring outdated query error for itemId ${e}`);
120
- },
121
- onProgress: (e) => {}
122
- }, l = this.generateQueryId(c);
123
- this.cancelPendingQueriesForItem(e);
124
- let u = this.findDuplicateQuery(c);
125
- if (u) console.log(`Deduplicating query for ${e}`), o = u.id, this.addCallbacksToExistingQuery(u, c);
126
- else {
127
- o = l;
128
- let n = {
129
- ...c,
130
- id: o,
131
- timestamp: Date.now(),
132
- retryCount: 0
133
- };
134
- this.queryQueue.set(o, n), t && this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${e}`), this.executeQuery(o));
135
- }
136
- return this.trackQueryForItem(e, o), o;
137
- }
138
- runSingle(e) {
139
- return this.enqueueItemQuery(e, !0);
140
- }
141
- runBatch(e) {
142
- this.batchTimeout && clearTimeout(this.batchTimeout);
143
- let t = e.map((e) => this.enqueueItemQuery(e, !1)).filter((e) => e !== null);
144
- return this.batchTimeout = setTimeout(() => {
145
- this.processBatch();
146
- }, this.batchDelay), t;
147
- }
148
- cancelQuery(e) {
149
- let t = this.queryWaiters.get(e);
150
- return t && (t.reject("Query was cancelled"), this.queryWaiters.delete(e)), this.cleanupQueryTracking(e), this.queryQueue.has(e) ? (this.queryQueue.delete(e), !0) : this.activeQueries.has(e) ? (this.activeQueries.delete(e), !0) : !1;
151
- }
152
- clearQueue() {
153
- this.queryWaiters.forEach((e, t) => {
154
- e.reject("Queue was cleared");
155
- }), this.queryWaiters.clear(), this.queryQueue.clear(), this.latestQueryByItemId.clear(), this.itemIdsByQueryId.clear(), this.batchTimeout &&= (clearTimeout(this.batchTimeout), null);
156
- }
157
- getStatus() {
158
- return {
159
- queued: this.queryQueue.size,
160
- active: this.activeQueries.size,
161
- queuedQueries: Array.from(this.queryQueue.values()),
162
- latestQueryByItemId: Object.fromEntries(this.latestQueryByItemId)
163
- };
164
- }
165
- async createDrilldownQuery(e, t, n, r, i = [], a = this.getDashboardImports()) {
166
- return await this.queryExecutionService.createConnectionDrilldownQuery(this.connectionName, e, "trilogy", a, t, n, r, i);
167
- }
168
- generateQueryId(e) {
169
- return `${e.dashboardId}-${e.itemId}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
170
- }
171
- findDuplicateQuery(e) {
172
- for (let [, t] of this.queryQueue) if (t.dashboardId === e.dashboardId && t.queryInput.text === e.queryInput.text && JSON.stringify(t.queryInput.extraFilters) === JSON.stringify(e.queryInput.extraFilters) && JSON.stringify(t.queryInput.parameters) === JSON.stringify(e.queryInput.parameters)) return t;
173
- return null;
174
- }
175
- addCallbacksToExistingQuery(e, t) {
176
- let n = e.onSuccess, r = e.onError, i = e.onProgress;
177
- e.onSuccess = (e) => {
178
- n(e), t.onSuccess(e);
179
- }, e.onError = (e) => {
180
- r(e), t.onError(e);
181
- }, e.onProgress = (e) => {
182
- i(e), t.onProgress(e);
183
- }, e.priority = Math.min(e.priority, t.priority);
184
- }
185
- processBatch() {
186
- if (this.queryQueue.size === 0) return;
187
- let e = Array.from(this.queryQueue.values()).sort((e, t) => e.priority === t.priority ? e.timestamp - t.timestamp : e.priority - t.priority), t = this.maxConcurrentQueries - this.activeQueries.size, n = e.slice(0, t);
188
- this.executeBatchQueries(n);
189
- }
190
- async executeBatchQueries(e) {
191
- if (e.length !== 0) try {
192
- let t = this.getDashboardImports(), n = [], r = [];
193
- for (let t of e) {
194
- let e = t.id;
195
- this.activeQueries.has(e) || this.queryQueue.has(e) && (this.queryQueue.delete(e), this.activeQueries.add(e), n.push({
196
- query: t.queryInput.text,
197
- label: e,
198
- extra_filters: t.queryInput.extraFilters,
199
- parameters: t.queryInput.parameters
200
- }), r.push(t));
201
- }
202
- if (n.length === 0) return;
203
- let i = Object.fromEntries(n.map((e) => [e.label, (t) => {
204
- r.find((t) => t.id === e.label)?.onSuccess(t);
205
- let n = this.queryWaiters.get(e.label);
206
- n && (n.resolve(t), this.queryWaiters.delete(e.label)), this.activeQueries.delete(e.label), this.settleQueryLoading(e.label), this.cleanupQueryTracking(e.label);
207
- }])), a = Object.fromEntries(n.map((e) => [e.label, (t) => {
208
- let n = o(t), i = r.find((t) => t.id === e.label);
209
- i && this.handleQueryError(i, n), this.activeQueries.delete(e.label), this.settleQueryLoading(e.label), this.cleanupQueryTracking(e.label);
210
- }])), { resultPromise: s } = await this.queryExecutionService.executeQueriesBatch(this.connectionName, n, "trilogy", t, [], {}, () => {}, () => {}, a, i, !1, r[0]?.queryInput.extraContent || []), c = await s;
211
- console.log(`Batch query executed successfully with ${c.results.length} results`);
212
- } catch (t) {
213
- let n = t instanceof Error ? t.message : "Unknown error occurred";
214
- for (let t of e) {
215
- let e = t.id;
216
- this.activeQueries.has(e) && (t.retryCount < this.retryAttempts ? (console.log(`Retrying query ${e} (attempt ${t.retryCount + 1})`), t.retryCount++, t.timestamp = Date.now(), this.activeQueries.delete(e), this.queryQueue.set(e, t), setTimeout(() => {
217
- this.queryQueue.has(e) && this.executeQuery(e);
218
- }, 1e3 * t.retryCount)) : (this.handleQueryError(t, n), this.activeQueries.delete(e), this.settleQueryLoading(e), this.cleanupQueryTracking(e)));
219
- }
220
- } finally {
221
- this.processBatch();
222
- }
223
- }
224
- handleQueryError(e, t) {
225
- let n = e.id;
226
- e.onError(t);
227
- let r = this.queryWaiters.get(n);
228
- r && (r.reject(t), this.queryWaiters.delete(n));
229
- }
230
- async executeQuery(e) {
231
- let t = this.queryQueue.get(e);
232
- if (t) try {
233
- this.queryQueue.delete(e), this.activeQueries.add(e);
234
- let n = this.getDashboardImports(), r = {
235
- ...t.queryInput,
236
- imports: n,
237
- editorType: "trilogy"
238
- }, { resultPromise: i } = await this.queryExecutionService.executeQuery(this.connectionName, r, () => {}, (e) => {
239
- e.error && t.onProgress(e);
240
- }), a = await i;
241
- if (a.success && a.results) {
242
- t.onSuccess(a);
243
- let n = this.queryWaiters.get(e);
244
- n && (n.resolve(a), this.queryWaiters.delete(e));
245
- } else if (a.error) {
246
- t.onError(a.error);
247
- let n = this.queryWaiters.get(e);
248
- n && (n.reject(a.error), this.queryWaiters.delete(e));
249
- }
250
- } catch (n) {
251
- let r = n instanceof Error ? n.message : "Unknown error occurred";
252
- if (t.retryCount < this.retryAttempts) console.log(`Retrying query ${e} (attempt ${t.retryCount + 1})`), t.retryCount++, t.timestamp = Date.now(), this.queryQueue.set(e, t), setTimeout(() => {
253
- this.queryQueue.has(e) && this.executeQuery(e);
254
- }, 1e3 * t.retryCount);
255
- else {
256
- t.onError(r);
257
- let n = this.queryWaiters.get(e);
258
- n && (n.reject(r), this.queryWaiters.delete(e));
259
- }
260
- } finally {
261
- this.activeQueries.delete(e), this.settleQueryLoading(e), this.cleanupQueryTracking(e), this.processBatch();
262
- }
263
- }
264
- }, c = (e) => e.replace(/\s+/g, "");
265
- function l(e) {
266
- if (!e) return;
267
- let t = r();
268
- return t.connections[e] || t.connectionByName(e);
269
- }
270
- var u = a("dashboards", {
271
- state: () => ({
272
- dashboards: {},
273
- activeDashboardId: "",
274
- queryExecutors: {},
275
- pendingChatPrompts: {}
276
- }),
277
- getters: {
278
- dashboardList: (e) => Object.values(e.dashboards),
279
- activeDashboard: (e) => e.activeDashboardId ? e.dashboards[e.activeDashboardId] : null,
280
- getConnectionDashboards: (e) => (t) => Object.values(e.dashboards).filter((e) => e.connectionId === t),
281
- unsavedDashboards: (e) => Object.values(e.dashboards).filter((e) => e.changed).length,
282
- activeQueryExecutor: (e) => e.activeDashboardId ? e.queryExecutors[e.activeDashboardId] : null,
283
- hasQueryExecutor: (e) => (t) => !!e.queryExecutors[t]
284
- },
285
- actions: {
286
- getOrCreateQueryExecutor(e, t) {
287
- if (!this.dashboards[e]) throw Error(`Dashboard with ID "${e}" not found.`);
288
- if (this.queryExecutors[e]) {
289
- let n = this.queryExecutors[e];
290
- return t.connectionName && n.connectionName !== t.connectionName && n.setConnection(t.connectionName), n;
291
- }
292
- let n = new s(t.queryExecutionService, t.connectionName, t.dashboardId, t.getDashboardData, t.getItemData, t.setItemData, t.options || {});
293
- return this.queryExecutors[e] = n, console.log(`Created new query executor for dashboard: ${e}`), n;
294
- },
295
- getQueryExecutor(e) {
296
- return this.queryExecutors[e] || null;
297
- },
298
- removeQueryExecutor(e) {
299
- return this.queryExecutors[e] ? (this.queryExecutors[e].clearQueue(), delete this.queryExecutors[e], console.log(`Removed query executor for dashboard: ${e}`), !0) : !1;
300
- },
301
- clearAllQueryExecutors() {
302
- Object.keys(this.queryExecutors).forEach((e) => {
303
- this.queryExecutors[e].clearQueue();
304
- }), this.queryExecutors = {}, console.log("Cleared all query executors");
305
- },
306
- getQueryExecutorStatuses() {
307
- let e = {};
308
- return Object.entries(this.queryExecutors).forEach(([t, n]) => {
309
- e[t] = {
310
- dashboardName: this.dashboards[t]?.name || "Unknown",
311
- ...n.getStatus()
312
- };
313
- }), e;
314
- },
315
- getDashboardByName(e) {
316
- return Object.values(this.dashboards).find((t) => t.name === e) || null;
317
- },
318
- newDashboard(t, n) {
319
- let r = t;
320
- if (Object.values(this.dashboards).some((e) => e.name === t)) throw Error(`A dashboard with name ${t} already exists.`);
321
- let i = l(n), a = new e({
322
- id: r,
323
- name: t,
324
- connection: i?.name || n,
325
- connectionId: i?.id || n,
326
- storage: "local",
327
- state: "editing"
328
- });
329
- return this.dashboards[r] = a, a;
330
- },
331
- newReport(e, t) {
332
- let n = this.newDashboard(e, t);
333
- return n.setLayoutType("report"), n;
334
- },
335
- cloneDashboard(t) {
336
- let n = this.dashboards[t];
337
- if (!n) throw Error(`Dashboard with ID "${t}" not found.`);
338
- let r = `${n.name} (copy)`, i = 1;
339
- for (; Object.values(this.dashboards).some((e) => e.name === r);) r = `${n.name} (copy ${i})`, i++;
340
- let a = new e({
341
- id: r,
342
- name: r,
343
- connection: n.connection,
344
- connectionId: n.connectionId,
345
- storage: n.storage,
346
- state: "editing"
347
- });
348
- return a.gridItems = Object.fromEntries(Object.entries(n.gridItems).map(([e, t]) => [e, {
349
- ...t,
350
- chartFilters: [],
351
- conceptFilters: [],
352
- filters: []
353
- }])), a.layout = n.layout.map((e) => ({ ...e })), a.imports = n.imports.map((e) => ({ ...e })), a.filter = n.filter, a.description = n.description, a.updatedAt = /* @__PURE__ */ new Date(), a.nextId = n.nextId, a.changed = !0, this.addDashboard(a), this.activeDashboardId = r, a;
354
- },
355
- forkDashboard(t, n) {
356
- let r = this.dashboards[t];
357
- if (!r) throw Error(`Dashboard with ID "${t}" not found.`);
358
- let i = `${r.name} / ${n}`, a = 1;
359
- for (; this.dashboards[i];) i = `${r.name} / ${n} (${a})`, a++;
360
- let o = new e({
361
- id: i,
362
- name: i,
363
- connection: r.connection,
364
- connectionId: r.connectionId,
365
- storage: r.storage,
366
- state: "editing",
367
- parentDashboardId: t,
368
- investigationName: n,
369
- investigationCreatedFrom: { timestamp: /* @__PURE__ */ new Date() },
370
- description: r.description
371
- });
372
- return o.gridItems = Object.fromEntries(Object.entries(r.gridItems).map(([e, t]) => [e, {
373
- ...t,
374
- chartFilters: [],
375
- conceptFilters: [],
376
- filters: []
377
- }])), o.layout = r.layout.map((e) => ({ ...e })), o.imports = r.imports.map((e) => ({ ...e })), o.filter = r.filter, o.nextId = r.nextId, o.changed = !0, r.children ||= [], r.children.push(i), r.changed = !0, this.addDashboard(o), this.activeDashboardId = i, o;
378
- },
379
- promoteDashboard(e) {
380
- let t = this.dashboards[e];
381
- if (!t) throw Error(`Dashboard with ID "${e}" not found.`);
382
- if (t.parentDashboardId) {
383
- let n = this.dashboards[t.parentDashboardId];
384
- n?.children && (n.children = n.children.filter((t) => t !== e), n.changed = !0);
385
- }
386
- return t.parentDashboardId = null, t.investigationName = void 0, t.investigationCreatedFrom = void 0, t.changed = !0, t;
387
- },
388
- getInvestigations(e) {
389
- return Object.values(this.dashboards).filter((t) => t.parentDashboardId === e && !t.deleted);
390
- },
391
- getRootDashboards() {
392
- return Object.values(this.dashboards).filter((e) => !e.parentDashboardId && !e.deleted);
393
- },
394
- addDashboard(e) {
395
- this.dashboards[e.id] = e;
396
- },
397
- loadDashboards(t) {
398
- Object.entries(t).forEach(([t, n]) => {
399
- this.dashboards[t] = e.fromSerialized(n);
400
- });
401
- },
402
- removeAllFilters(e) {
403
- if (this.dashboards[e]) return this.dashboards[e].removeAllFilters();
404
- throw Error(`Dashboard with ID "${e}" not found.`);
405
- },
406
- getConnectionDashboardsSync(e) {
407
- return Object.values(this.dashboards).filter((t) => t.connectionId === e);
408
- },
409
- setPendingChatPrompt(e, t) {
410
- this.pendingChatPrompts[e] = t;
411
- },
412
- consumePendingChatPrompt(e) {
413
- let t = this.pendingChatPrompts[e];
414
- return t === void 0 ? null : (delete this.pendingChatPrompts[e], t);
415
- },
416
- setActiveDashboard(e) {
417
- if (this.dashboards[e]) this.activeDashboardId = e;
418
- else throw Error(`Dashboard with ID "${e}" not found.`);
419
- },
420
- setDashboardState(e, t) {
421
- if (this.dashboards[e]) this.dashboards[e].state = t;
422
- else throw Error(`Dashboard with ID "${e}" not found.`);
423
- },
424
- updateDashboardName(e, t) {
425
- if (this.dashboards[e]) this.dashboards[e].name = t, this.dashboards[e].updatedAt = /* @__PURE__ */ new Date();
426
- else throw Error(`Dashboard with ID "${e}" not found.`);
427
- },
428
- updateDashboardFilter(e, t) {
429
- if (this.dashboards[e]) {
430
- let n = this.dashboards[e].filter;
431
- return (!t || c(t) === "") && (this.dashboards[e].filter = null, n != null) || (this.dashboards[e].filter = t, n !== t) ? Object.entries(this.dashboards[e].gridItems).map(([e, t]) => e) : [];
432
- } else throw Error(`Dashboard with ID "${e}" not found.`);
433
- },
434
- updateDashboardImports(e, t) {
435
- if (this.dashboards[e]) this.dashboards[e].imports = t;
436
- else throw Error(`Dashboard with ID "${e}" not found.`);
437
- },
438
- removeDashboard(e) {
439
- if (this.dashboards[e]) this.removeQueryExecutor(e), delete this.dashboards[e], this.activeDashboardId === e && (this.activeDashboardId = "");
440
- else throw Error(`Dashboard with ID "${e}" not found.`);
441
- },
442
- purgeDeletedDashboards() {
443
- for (let e of Object.keys(this.dashboards)) this.dashboards[e].deleted && (this.removeQueryExecutor(e), delete this.dashboards[e], this.activeDashboardId === e && (this.activeDashboardId = ""));
444
- },
445
- setState(e, t) {
446
- this.dashboards[e] && (this.dashboards[e].state = t);
447
- },
448
- setDashboardLayoutType(e, t) {
449
- let n = this.dashboards[e];
450
- if (!n) throw Error(`Dashboard with ID "${e}" not found.`);
451
- n.setLayoutType(t);
452
- },
453
- setDashboardTheme(e, t) {
454
- let n = this.dashboards[e];
455
- if (!n) throw Error(`Dashboard with ID "${e}" not found.`);
456
- n.setTheme(t);
457
- },
458
- addItemToDashboard(e, t, n = 0, r = 0, i = 5, a = null, o = null, s = null) {
459
- if (this.dashboards[e]) return this.dashboards[e].addItem(t, n, r, i, a, o, s);
460
- throw Error(`Dashboard with ID "${e}" not found.`);
461
- },
462
- updateDashboardTitle(e, t) {
463
- if (this.dashboards[e]) this.dashboards[e].name = t, this.dashboards[e].updatedAt = /* @__PURE__ */ new Date();
464
- else throw Error(`Dashboard with ID "${e}" not found.`);
465
- },
466
- updateItemContent(e, t, n) {
467
- if (this.dashboards[e]) this.dashboards[e].updateItemContent(t, n);
468
- else throw Error(`Dashboard with ID "${e}" not found.`);
469
- },
470
- updateItemCrossFilterEligibility(e, t, n) {
471
- if (this.dashboards[e]) this.dashboards[e].updateItemCrossFilterEligibility(t, n);
472
- else throw Error(`Dashboard with ID "${e}" not found.`);
473
- },
474
- updateItemResults(e, t, n) {
475
- if (this.dashboards[e]) this.dashboards[e].updateItemResults(t, n);
476
- else throw Error(`Dashboard with ID "${e}" not found.`);
477
- },
478
- updateItemLoading(e, t, n) {
479
- if (this.dashboards[e]) this.dashboards[e].updateItemLoading(t, n);
480
- else throw Error(`Dashboard with ID "${e}" not found.`);
481
- },
482
- updateItemError(e, t, n) {
483
- if (this.dashboards[e]) this.dashboards[e].updateItemError(t, n);
484
- else throw Error(`Dashboard with ID "${e}" not found.`);
485
- },
486
- updateItemDrilldown(e, t, n) {
487
- if (this.dashboards[e]) this.dashboards[e].updateItemDrilldown(t, n);
488
- else throw Error(`Dashboard with ID "${e}" not found.`);
489
- },
490
- updateItemDrilldownChartConfig(e, t, n) {
491
- if (this.dashboards[e]) this.dashboards[e].updateItemDrilldownChartConfig(t, n);
492
- else throw Error(`Dashboard with ID "${e}" not found.`);
493
- },
494
- updateItemType(e, t, n) {
495
- if (this.dashboards[e]) this.dashboards[e].updateItemType(t, n);
496
- else throw Error(`Dashboard with ID "${e} not found`);
497
- },
498
- updateItemCrossFilters(e, t, n, r, i) {
499
- if (this.dashboards[e]) return this.dashboards[e].updateItemCrossFilters(t, n, r, i);
500
- throw Error(`Dashboard with ID "${e}" not found.`);
501
- },
502
- removeItemCrossFilter(e, t, n) {
503
- if (this.dashboards[e]) return this.dashboards[e].removeItemCrossFilter(t, n), t;
504
- throw Error(`Dashboard with ID "${e}" not found.`);
505
- },
506
- removeItemCrossFilterSource(e, t) {
507
- if (this.dashboards[e]) return this.dashboards[e].removeItemCrossFilterSource(t);
508
- throw Error(`Dashboard with ID "${e}" not found.`);
509
- },
510
- updateItemName(e, t, n) {
511
- if (this.dashboards[e]) this.dashboards[e].updateItemName(t, n);
512
- else throw Error(`Dashboard with ID "${e}" not found.`);
513
- },
514
- updateItemChartConfig(e, t, n) {
515
- if (this.dashboards[e]) this.dashboards[e].updateItemChartConfig(t, n);
516
- else throw Error(`Dashboard with ID "${e}" not found.`);
517
- },
518
- updateMultipleItemProperties(e, t, n) {
519
- if (!this.dashboards[e]) throw Error(`Dashboard with ID "${e}" not found.`);
520
- this.dashboards[e].updateItemMultipleProperties(t, n);
521
- },
522
- updateDashboardConnection(e, t) {
523
- if (this.dashboards[e]) {
524
- let n = l(t);
525
- this.dashboards[e].connection = n?.name || t, this.dashboards[e].connectionId = n?.id || t, this.dashboards[e].changed = !0;
526
- } else throw Error(`Dashboard with ID "${e}" not found.`);
527
- },
528
- updateDashboardDescription(e, t) {
529
- if (this.dashboards[e]) this.dashboards[e].description = t;
530
- else throw Error(`Dashboard with ID "${e}" not found.`);
531
- },
532
- updateDashboardLayout(e, t) {
533
- if (this.dashboards[e]) this.dashboards[e].updateLayout(t);
534
- else throw Error(`Dashboard with ID "${e}" not found.`);
535
- },
536
- updateItemDimensions(e, t, n, r) {
537
- if (this.dashboards[e]) this.dashboards[e].updateItemDimensions(t, n, r);
538
- else throw Error(`Dashboard with ID "${e}" not found.`);
539
- },
540
- updateItemLayoutDimensions(e, t, n = null, r = null, i = null, a = null) {
541
- if (this.dashboards[e]) this.dashboards[e].updateItemLayoutDimensions(t, n, r, i, a);
542
- else throw Error(`Dashboard with ID "${e}" not found.`);
543
- },
544
- removeItemFromDashboard(e, t) {
545
- if (this.dashboards[e]) this.dashboards[e].removeItem(t);
546
- else throw Error(`Dashboard with ID "${e}" not found.`);
547
- },
548
- copyItemInDashboard(e, t) {
549
- if (this.dashboards[e]) return this.dashboards[e].copyItem(t);
550
- throw Error(`Dashboard with ID "${e}" not found.`);
551
- },
552
- clearDashboardItems(e) {
553
- if (this.dashboards[e]) this.dashboards[e].clearItems();
554
- else throw Error(`Dashboard with ID "${e}" not found.`);
555
- },
556
- serializeDashboards() {
557
- let e = {};
558
- return Object.entries(this.dashboards).forEach(([t, n]) => {
559
- n.storage === "local" && (e[t] = n.serialize());
560
- }), e;
561
- },
562
- async warmDashboardQueries(e, n, r) {
563
- let i = this.dashboards[e];
564
- if (i) {
565
- for (let e of Object.values(i.gridItems)) if (e.type === t.CHART || e.type === t.TABLE) {
566
- let t = typeof e.content == "string" ? e.content : e.content?.query || "";
567
- await n?.generateQuery(i.connectionId || i.connection, {
568
- text: t,
569
- editorType: "trilogy",
570
- imports: i.imports,
571
- extraContent: i.imports.map((e) => ({
572
- alias: e.name,
573
- contents: r.editors[e.id]?.contents || r.editors[e.name]?.contents || ""
574
- }))
575
- });
576
- }
577
- }
578
- },
579
- async populateCompletion(e, t, n) {
580
- let r = this.dashboards[e];
581
- if (r) {
582
- let i = await t?.validateQuery(r.connectionId || r.connection, {
583
- text: "select 1 as test;",
584
- editorType: "trilogy",
585
- imports: r.imports,
586
- extraContent: r.imports.map((e) => ({
587
- alias: e.name,
588
- contents: n.editors[e.id]?.contents || n.editors[e.name]?.contents || ""
589
- }))
590
- });
591
- return i ? i.data.completion_items : (console.log(`No results returned from validateQuery for dashboard ID "${e}".`), []);
592
- } else throw Error(`Dashboard with ID "${e}" not found.`);
593
- },
594
- async populateAIConcepts(e, t, n) {
595
- let r = await this.populateCompletion(e, t, n);
596
- if (!r) throw Error(`No completion items found for dashboard ID "${e}".`);
597
- return i(r);
598
- },
599
- async generatePromptSpec(e, t, r, i) {
600
- let a = await this.populateAIConcepts(this.activeDashboardId, r, i), o = await t.generateDashboardCompletion(e, n, a, 3);
601
- if (!o) throw Error("No response from LLM");
602
- return n(o);
603
- },
604
- async populateFromPromptSpec(e, n, r, i, a) {
605
- let o = this.dashboards[e];
606
- if (!o) throw Error(`Dashboard with ID "${e}" not found.`);
607
- o.name = n.name, o.description = n.description;
608
- let s = await this.populateAIConcepts(e, i, a);
609
- if (!s) throw Error(`No completion items found for dashboard ID "${e}".`);
610
- let c = async (e) => {
611
- let t = {
612
- text: e,
613
- editorType: "trilogy",
614
- imports: o.imports,
615
- extraContent: o.imports.map((e) => ({
616
- alias: e.name,
617
- contents: a.editors[e.id]?.contents || a.editors[e.name]?.contents || ""
618
- }))
619
- };
620
- return await (await i.executeQuery(o.connectionId || o.connection, t, () => {}, () => {}, (e) => {
621
- throw e;
622
- }, () => !0, !0)).resultPromise, !0;
623
- }, l = /* @__PURE__ */ new Map();
624
- for (let r of n.layout) {
625
- let i = n.gridItems[r.id], a = i.content, o = i.type.toLowerCase();
626
- [t.CHART, t.TABLE].includes(o) && (a = `Placeholder, prompt: ${a}`);
627
- let s = this.addItemToDashboard(e, "markdown", r.x, r.y, r.w, r.h, a, i.name);
628
- l.set(s, {
629
- type: o,
630
- content: a
631
- });
632
- }
633
- for (let n of l) {
634
- let i = n[0], a = n[1], o = a.content;
635
- [t.CHART, t.TABLE].includes(a.type) && (o = (await r.generateQueryCompletion(a.content, s, c)).content || "No query could be generated"), await this.updateItemContent(e, i, o), await this.updateItemType(e, i, a.type);
636
- }
637
- }
638
- }
639
- });
640
- //#endregion
641
- export { u as n, s as r, c as t };