@trilogy-data/trilogy-studio-components 0.1.17 → 0.1.18

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 (43) hide show
  1. package/dist/{AssetAutoImporter-COld6ovI.js → AssetAutoImporter-CUqhhNvb.js} +14 -14
  2. package/dist/{CommunityModels-B5DGmouF.js → CommunityModels-BKBxewjm.js} +2 -2
  3. package/dist/{ConnectionView-C9-aVTdE.js → ConnectionView-Dyqm2oeV.js} +14 -14
  4. package/dist/{Dashboard-C8vFmGcL.js → Dashboard-Bsoj1oUW.js} +169 -169
  5. package/dist/{DashboardCreatorInline-DheLBs4U.js → DashboardCreatorInline-BLbkDxBF.js} +1 -1
  6. package/dist/{DashboardMobile-B7HffPju.js → DashboardMobile-Ao8NtF1f.js} +16 -16
  7. package/dist/{DrilldownPane-S2dy0Wvj.js → DrilldownPane-OZMttRBx.js} +2691 -2666
  8. package/dist/{Editor-DKEg-QmG.js → Editor-N40lTR0s.js} +1 -1
  9. package/dist/{IDE-4OJAmj7h.js → IDE-kbUDZPcL.js} +5 -5
  10. package/dist/{JobsView-DE0m37jI.js → JobsView-AYNUDnKG.js} +1 -1
  11. package/dist/{LLMChat-DvoCO2NW.js → LLMChat-CZTQUh53.js} +2 -2
  12. package/dist/{LLMConnectionList-cXc3m9rK.js → LLMConnectionList-BkvCZP5Q.js} +1 -1
  13. package/dist/{LLMView-DzEvz9u4.js → LLMView-CaTlmLGb.js} +2 -2
  14. package/dist/{MobileIDE-w2cNPXWA.js → MobileIDE-Bi7GNE2X.js} +10 -10
  15. package/dist/{ModelCard-DPtVjIMJ.js → ModelCard-Cd6OxExX.js} +2 -2
  16. package/dist/{ModelCreator-gJ86t8SP.js → ModelCreator-DeI-n86Z.js} +1 -1
  17. package/dist/{ModelView-C5y1IU22.js → ModelView-Surdb5KW.js} +2 -2
  18. package/dist/{ResultComponent-DV46CwMw.js → ResultComponent-CXkTwZFS.js} +1 -1
  19. package/dist/{Sidebar-C6FJOAJk.js → Sidebar-CfOATms_.js} +60 -60
  20. package/dist/{TutorialPage-BF9ao6-m.js → TutorialPage-IisHiPL6.js} +8 -8
  21. package/dist/{UserProfile-DPc9-B3S.js → UserProfile-CQAUnKyQ.js} +1 -1
  22. package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
  23. package/dist/composables/useCrossFilterEligibility.d.ts +18 -0
  24. package/dist/composables/useCrossFilterEligibility.d.ts.map +1 -0
  25. package/dist/composables/useResolvedCrossFilterController.d.ts +30 -0
  26. package/dist/composables/useResolvedCrossFilterController.d.ts.map +1 -0
  27. package/dist/dashboard.js +151 -77
  28. package/dist/dashboards/barChartSpec.d.ts +39 -0
  29. package/dist/dashboards/barChartSpec.d.ts.map +1 -1
  30. package/dist/dashboards/crossFilters.d.ts +3 -0
  31. package/dist/dashboards/crossFilters.d.ts.map +1 -1
  32. package/dist/entry.dashboard.d.ts +6 -2
  33. package/dist/entry.dashboard.d.ts.map +1 -1
  34. package/dist/main.d.ts +6 -2
  35. package/dist/main.d.ts.map +1 -1
  36. package/dist/{queryExecutionService-obvMrWcu.js → queryExecutionService-KrjL0UCa.js} +167 -128
  37. package/dist/stores/queryExecutionService.d.ts +9 -0
  38. package/dist/stores/queryExecutionService.d.ts.map +1 -1
  39. package/dist/stores.js +1 -1
  40. package/dist/trilogy-studio-components.css +1 -1
  41. package/dist/{useDashboard-B_MH66Yb.js → useDashboard-CtX3sEag.js} +275 -275
  42. package/dist/views.js +2 -2
  43. package/package.json +1 -1
@@ -181,7 +181,7 @@ class W {
181
181
  return this.cache.size;
182
182
  }
183
183
  }
184
- class lr {
184
+ class ur {
185
185
  constructor(e, t = 100) {
186
186
  w(this, "settingStore");
187
187
  w(this, "validateCache");
@@ -482,6 +482,12 @@ function de(r, e) {
482
482
  }
483
483
  }
484
484
  }
485
+ function wt(r = []) {
486
+ const e = /* @__PURE__ */ new Set();
487
+ for (const t of r)
488
+ t != null && t.label && e.add(t.label);
489
+ return Array.from(e);
490
+ }
485
491
  function B(r) {
486
492
  return { ...r };
487
493
  }
@@ -489,7 +495,7 @@ function ae(r, e) {
489
495
  const t = Object.keys(r).sort(), s = Object.keys(e).sort();
490
496
  return t.length !== s.length ? !1 : t.every((o, i) => o === s[i] && r[o] === e[o]);
491
497
  }
492
- function wt(r, e, t) {
498
+ function vt(r, e, t) {
493
499
  if (e.size === 0)
494
500
  return t && r.startsWith("local.") ? r.replace(/^local\./, "") : r;
495
501
  if (e.has(r))
@@ -501,12 +507,12 @@ function wt(r, e, t) {
501
507
  }
502
508
  return null;
503
509
  }
504
- function vt(r, e = [], t = {}) {
510
+ function St(r, e = [], t = {}) {
505
511
  const s = new Set(e), o = t.normalizeLocalFields ?? !1;
506
512
  return Object.entries(r).reduce((i, [n, a]) => {
507
513
  if (typeof a != "string")
508
514
  return i;
509
- const c = wt(n, s, o);
515
+ const c = vt(n, s, o);
510
516
  return c && (i[c] = a), i;
511
517
  }, {});
512
518
  }
@@ -531,7 +537,7 @@ function ke(r, e, t, s) {
531
537
  const a = i.some((c) => ae(c.value, t)) ? i.filter((c) => !ae(c.value, t)) : [...i, { source: e, value: B(t) }];
532
538
  return [...o, ...a];
533
539
  }
534
- function St(r, e, t, s, o) {
540
+ function Ct(r, e, t, s, o) {
535
541
  const i = [];
536
542
  return Object.entries(r).forEach(([n, a]) => {
537
543
  if (n === e) {
@@ -557,7 +563,7 @@ function St(r, e, t, s, o) {
557
563
  (u || l) && i.push(n);
558
564
  }), i;
559
565
  }
560
- function Ct(r, e, t) {
566
+ function Et(r, e, t) {
561
567
  const s = r[e];
562
568
  if (!s)
563
569
  return !1;
@@ -568,7 +574,7 @@ function Ct(r, e, t) {
568
574
  const n = le(s);
569
575
  return i || n;
570
576
  }
571
- function Et(r, e) {
577
+ function Dt(r, e) {
572
578
  const t = [];
573
579
  return Object.entries(r).forEach(([s, o]) => {
574
580
  if (s === e) {
@@ -583,7 +589,7 @@ function Et(r, e) {
583
589
  (n || a) && t.push(s);
584
590
  }), t;
585
591
  }
586
- function Dt(r) {
592
+ function xt(r) {
587
593
  const e = [];
588
594
  return Object.entries(r).forEach(([t, s]) => {
589
595
  var i, n, a;
@@ -591,12 +597,12 @@ function Dt(r) {
591
597
  s.conceptFilters = [], s.chartFilters = [], s.filters = [], o && e.push(t);
592
598
  }), e;
593
599
  }
594
- function xt(r = {}) {
600
+ function Tt(r = {}) {
595
601
  const e = /* @__PURE__ */ new Map(), t = () => {
596
602
  const o = r.validFields ? Be(r.validFields) : [];
597
603
  return new Set(o);
598
604
  }, s = (o) => {
599
- const i = vt(o.filters, t(), {
605
+ const i = St(o.filters, t(), {
600
606
  normalizeLocalFields: r.normalizeLocalFields ?? !0
601
607
  });
602
608
  return {
@@ -663,8 +669,8 @@ function xt(r = {}) {
663
669
  }
664
670
  };
665
671
  }
666
- function ur(r = {}) {
667
- const e = Q(0), t = xt(Be(r)), s = () => {
672
+ function hr(r = {}) {
673
+ const e = Q(0), t = Tt(Be(r)), s = () => {
668
674
  e.value += 1;
669
675
  };
670
676
  return {
@@ -881,21 +887,21 @@ Enter your markdown content here.`;
881
887
  t && le(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
882
888
  }
883
889
  removeItemCrossFilter(e, t) {
884
- Ct(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
890
+ Et(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
885
891
  }
886
892
  removeItemCrossFilterSource(e) {
887
893
  var o, i;
888
- const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Et(this.gridItems, e);
894
+ const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Dt(this.gridItems, e);
889
895
  return (s.length > 0 || t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), s;
890
896
  }
891
897
  removeAllFilters() {
892
- const e = Dt(this.gridItems);
898
+ const e = xt(this.gridItems);
893
899
  for (const t in this.gridItems)
894
900
  this.gridItems[t].parameters = {};
895
901
  return e.length > 0 && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), e;
896
902
  }
897
903
  updateItemCrossFilters(e, t, s, o) {
898
- const i = St(
904
+ const i = Ct(
899
905
  this.gridItems,
900
906
  e,
901
907
  t,
@@ -1035,7 +1041,7 @@ const fe = (r) => {
1035
1041
  return o[o.length - 1];
1036
1042
  }
1037
1043
  return r;
1038
- }, hr = V("llmConnections", {
1044
+ }, dr = V("llmConnections", {
1039
1045
  state: () => ({
1040
1046
  connections: {},
1041
1047
  activeConnection: ""
@@ -1236,7 +1242,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1236
1242
  hasActiveDefaultConnection: (r) => Object.values(r.connections).some((e) => e.isDefault && e.connected)
1237
1243
  }
1238
1244
  });
1239
- class Tt {
1245
+ class $t {
1240
1246
  constructor(e, t, s, o, i, n, a = {}) {
1241
1247
  w(this, "queryQueue", /* @__PURE__ */ new Map());
1242
1248
  w(this, "activeQueries", /* @__PURE__ */ new Set());
@@ -1605,7 +1611,7 @@ class Tt {
1605
1611
  }
1606
1612
  }
1607
1613
  }
1608
- const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
1614
+ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1609
1615
  state: () => ({
1610
1616
  dashboards: {},
1611
1617
  activeDashboardId: "",
@@ -1629,7 +1635,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
1629
1635
  throw new Error(`Dashboard with ID "${r}" not found.`);
1630
1636
  if (this.queryExecutors[r])
1631
1637
  return this.queryExecutors[r];
1632
- const t = new Tt(
1638
+ const t = new $t(
1633
1639
  e.queryExecutionService,
1634
1640
  e.connectionName,
1635
1641
  e.dashboardId,
@@ -1756,7 +1762,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
1756
1762
  updateDashboardFilter(r, e) {
1757
1763
  if (this.dashboards[r]) {
1758
1764
  let t = this.dashboards[r].filter;
1759
- return (!e || $t(e) === "") && (this.dashboards[r].filter = null, t != null) ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : (this.dashboards[r].filter = e, t !== e ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : []);
1765
+ return (!e || At(e) === "") && (this.dashboards[r].filter = null, t != null) ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : (this.dashboards[r].filter = e, t !== e ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : []);
1760
1766
  } else
1761
1767
  throw new Error(`Dashboard with ID "${r}" not found.`);
1762
1768
  },
@@ -2066,8 +2072,8 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2066
2072
  }
2067
2073
  }
2068
2074
  }
2069
- }), qe = (r) => new Promise((e) => setTimeout(e, r)), Ft = /* @__PURE__ */ new Set(), Me = /* @__PURE__ */ new Set(), Le = (r) => {
2070
- if (Ft.has(r))
2075
+ }), qe = (r) => new Promise((e) => setTimeout(e, r)), Qt = /* @__PURE__ */ new Set(), Me = /* @__PURE__ */ new Set(), Le = (r) => {
2076
+ if (Qt.has(r))
2071
2077
  return !0;
2072
2078
  let e = r;
2073
2079
  r.includes("://") || (e = `http://${r}`);
@@ -2108,7 +2114,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2108
2114
  `Network error, retrying after ${i}ms (Attempt ${o + 1}/${t})`
2109
2115
  ), await qe(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2110
2116
  }
2111
- }, Qt = (r, e, t, s, o) => r.filter((i) => {
2117
+ }, Ot = (r, e, t, s, o) => r.filter((i) => {
2112
2118
  const n = i.name.toLowerCase().includes(e.toLowerCase()), a = !t || i.engine === t;
2113
2119
  let c = !0;
2114
2120
  if (s !== "all") {
@@ -2116,7 +2122,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2116
2122
  c = s === "imported" && u || s === "not-imported" && !u;
2117
2123
  }
2118
2124
  return n && a && c;
2119
- }), dr = (r) => {
2125
+ }), fr = (r) => {
2120
2126
  switch (r) {
2121
2127
  case "bigquery":
2122
2128
  return "new-bigquery-oauth";
@@ -2125,7 +2131,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2125
2131
  default:
2126
2132
  return `new-${r}`;
2127
2133
  }
2128
- }, Ot = (r) => {
2134
+ }, _t = (r) => {
2129
2135
  const e = /* @__PURE__ */ new Set();
2130
2136
  return r.forEach((t) => {
2131
2137
  t.engine && e.add(t.engine);
@@ -2144,15 +2150,15 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2144
2150
  "X-Trilogy-Token": r
2145
2151
  }
2146
2152
  };
2147
- }, _t = async (r) => {
2153
+ }, kt = async (r) => {
2148
2154
  const e = `${r.baseUrl}/index.json`, t = await ce(e, Ke(r.token));
2149
2155
  if (!t.ok)
2150
2156
  throw new Error(`Failed to fetch store index: ${t.status} ${t.statusText}`);
2151
2157
  return t.json();
2152
- }, kt = async (r) => {
2158
+ }, qt = async (r) => {
2153
2159
  let e = null, t = [];
2154
2160
  try {
2155
- const o = (await _t(r)).models.map(async (n) => {
2161
+ const o = (await kt(r)).models.map(async (n) => {
2156
2162
  try {
2157
2163
  const a = await ce(n.url, Ke(r.token));
2158
2164
  if (!a.ok)
@@ -2168,7 +2174,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2168
2174
  s instanceof Error ? e = s.message : e = "Error fetching store data", console.error("Error fetching from generic store:", s);
2169
2175
  }
2170
2176
  return { files: t, error: e };
2171
- }, qt = async (r) => {
2177
+ }, Mt = async (r) => {
2172
2178
  let e = null, t = [];
2173
2179
  try {
2174
2180
  let s, o;
@@ -2195,7 +2201,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2195
2201
  s instanceof Error ? e = s.message : e = "Error fetching files", console.error("Error fetching from GitHub store:", s);
2196
2202
  }
2197
2203
  return { files: t, error: e };
2198
- }, Ue = async (r) => r.type === "github" ? qt(r) : kt(r), Mt = async (r, e) => {
2204
+ }, Ue = async (r) => r.type === "github" ? Mt(r) : qt(r), Lt = async (r, e) => {
2199
2205
  const t = {}, s = {};
2200
2206
  return await Promise.all(
2201
2207
  r.map(async (o) => {
@@ -2208,14 +2214,14 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2208
2214
  }
2209
2215
  })
2210
2216
  ), { filesByStore: t, errors: s };
2211
- }, we = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), R = (r) => r.replace(/\/$/, ""), Ie = (r) => R(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), ve = (r) => {
2217
+ }, we = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), R = (r) => r.replace(/\/$/, ""), Pe = (r) => R(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), ve = (r) => {
2212
2218
  try {
2213
2219
  const e = new URL(R(r));
2214
2220
  return we(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
2215
2221
  } catch {
2216
2222
  return we(R(r));
2217
2223
  }
2218
- }, ze = (r) => we(r.name || ve(r.baseUrl)), fr = (r) => ze(r), mr = (r) => ze(r), Pe = "trilogy-community-stores", je = (r) => {
2224
+ }, ze = (r) => we(r.name || ve(r.baseUrl)), mr = (r) => ze(r), gr = (r) => ze(r), Ie = "trilogy-community-stores", je = (r) => {
2219
2225
  const e = new URLSearchParams(window.location.search), t = e.get("store"), s = e.get("token");
2220
2226
  if (!t || !s)
2221
2227
  return;
@@ -2257,7 +2263,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2257
2263
  const e = [];
2258
2264
  return Object.values(r.filesByStore).forEach((t) => {
2259
2265
  e.push(...t);
2260
- }), Ot(e);
2266
+ }), _t(e);
2261
2267
  },
2262
2268
  // Check if any store has errors
2263
2269
  hasErrors: (r) => Object.keys(r.errors).length > 0,
@@ -2277,7 +2283,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2277
2283
  */
2278
2284
  loadStoresFromStorage() {
2279
2285
  try {
2280
- const r = localStorage.getItem(Pe);
2286
+ const r = localStorage.getItem(Ie);
2281
2287
  if (r) {
2282
2288
  const e = JSON.parse(r), t = new Map(this.stores.map((n) => [n.id, n])), s = e.map((n) => {
2283
2289
  const a = t.get(n.id);
@@ -2318,7 +2324,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2318
2324
  const { token: t, ...s } = e;
2319
2325
  return s;
2320
2326
  });
2321
- localStorage.setItem(Pe, JSON.stringify(r));
2327
+ localStorage.setItem(Ie, JSON.stringify(r));
2322
2328
  } catch (r) {
2323
2329
  console.error("Error saving stores to localStorage:", r);
2324
2330
  }
@@ -2334,7 +2340,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2334
2340
  console.log(
2335
2341
  `Fetching community model files from ${this.stores.map((e) => e.id).join(", ")}...`
2336
2342
  );
2337
- const r = await Mt(this.stores, (e, t) => {
2343
+ const r = await Lt(this.stores, (e, t) => {
2338
2344
  this.filesByStore[e] = t.files, t.error ? (this.errors[e] = t.error, this.storeStatus[e] = "failed") : this.storeStatus[e] = "connected", console.log(`Store ${e} completed: ${t.error ? "failed" : "success"}`);
2339
2345
  });
2340
2346
  console.log("All stores fetched:", r);
@@ -2368,7 +2374,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2368
2374
  filteredFiles(r, e, t, s, o = null) {
2369
2375
  const i = (a) => a in s.models;
2370
2376
  let n = this.allFiles;
2371
- return o && (n = this.filesByStore[o]), n ? Qt(n, r, e, t, i) : [];
2377
+ return o && (n = this.filesByStore[o]), n ? Ot(n, r, e, t, i) : [];
2372
2378
  },
2373
2379
  /**
2374
2380
  * Get files from a specific store
@@ -2389,7 +2395,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2389
2395
  if (r.type === "generic") {
2390
2396
  if (!r.baseUrl)
2391
2397
  throw new Error("Base URL is required for generic stores");
2392
- r.baseUrl = R(r.baseUrl), r.id = r.id || Ie(r.baseUrl), r.name = r.name || ve(r.baseUrl);
2398
+ r.baseUrl = R(r.baseUrl), r.id = r.id || Pe(r.baseUrl), r.name = r.name || ve(r.baseUrl);
2393
2399
  } else if (r.type === "github" && (!r.owner || !r.repo || !r.branch))
2394
2400
  throw new Error("Owner, repo, and branch are required for GitHub stores");
2395
2401
  if (this.stores.some((t) => t.id === r.id))
@@ -2452,7 +2458,7 @@ const $t = (r) => r.replace(/\s+/g, ""), At = V("dashboards", {
2452
2458
  throw new Error("Please fill in all required fields");
2453
2459
  const n = R(t), c = {
2454
2460
  type: "generic",
2455
- id: Ie(n),
2461
+ id: Pe(n),
2456
2462
  name: e || ve(n),
2457
2463
  baseUrl: n
2458
2464
  };
@@ -2499,13 +2505,13 @@ class Se extends Error {
2499
2505
  this.name = "JobsServiceError", this.status = s;
2500
2506
  }
2501
2507
  }
2502
- const I = (r, e = {}) => {
2508
+ const P = (r, e = {}) => {
2503
2509
  const t = new Headers(e.headers);
2504
2510
  return r && t.set("X-Trilogy-Token", r), {
2505
2511
  ...e,
2506
2512
  headers: t
2507
2513
  };
2508
- }, Ce = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), P = async (r, e) => {
2514
+ }, Ce = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), I = async (r, e) => {
2509
2515
  if (r.ok)
2510
2516
  return r;
2511
2517
  let t = "";
@@ -2519,35 +2525,35 @@ const I = (r, e = {}) => {
2519
2525
  t = "";
2520
2526
  }
2521
2527
  throw new Se(t || e, r.status);
2522
- }, Lt = async (r) => {
2528
+ }, Pt = async (r) => {
2523
2529
  const e = await fetch(
2524
2530
  `${r.baseUrl}/files`,
2525
- I(r.token, {
2531
+ P(r.token, {
2526
2532
  method: "GET"
2527
2533
  })
2528
2534
  );
2529
- return await P(e, `Failed to fetch files for ${r.name}`), e.json();
2530
- }, gr = async (r, e) => {
2535
+ return await I(e, `Failed to fetch files for ${r.name}`), e.json();
2536
+ }, yr = async (r, e) => {
2531
2537
  const t = Ce(e), s = await fetch(
2532
2538
  `${r.baseUrl}/files/${t}`,
2533
- I(r.token, {
2539
+ P(r.token, {
2534
2540
  method: "GET"
2535
2541
  })
2536
2542
  );
2537
2543
  if (s.ok)
2538
2544
  return s.text();
2539
- s.status !== 404 && await P(s, `Failed to fetch ${e}`);
2545
+ s.status !== 404 && await I(s, `Failed to fetch ${e}`);
2540
2546
  const o = await fetch(
2541
2547
  `${r.baseUrl}/${t}`,
2542
- I(r.token, {
2548
+ P(r.token, {
2543
2549
  method: "GET"
2544
2550
  })
2545
2551
  );
2546
- return await P(o, `Failed to fetch ${e}`), o.text();
2547
- }, yr = async (r, e, t) => {
2552
+ return await I(o, `Failed to fetch ${e}`), o.text();
2553
+ }, pr = async (r, e, t) => {
2548
2554
  const s = await fetch(
2549
2555
  `${r.baseUrl}/files`,
2550
- I(r.token, {
2556
+ P(r.token, {
2551
2557
  method: "POST",
2552
2558
  headers: {
2553
2559
  "Content-Type": "application/json"
@@ -2555,11 +2561,11 @@ const I = (r, e = {}) => {
2555
2561
  body: JSON.stringify({ path: e, content: t })
2556
2562
  })
2557
2563
  );
2558
- await P(s, `Failed to create ${e}`);
2559
- }, pr = async (r, e, t) => {
2564
+ await I(s, `Failed to create ${e}`);
2565
+ }, br = async (r, e, t) => {
2560
2566
  const s = await fetch(
2561
2567
  `${r.baseUrl}/files/${Ce(e)}`,
2562
- I(r.token, {
2568
+ P(r.token, {
2563
2569
  method: "PUT",
2564
2570
  headers: {
2565
2571
  "Content-Type": "application/json"
@@ -2567,19 +2573,19 @@ const I = (r, e = {}) => {
2567
2573
  body: JSON.stringify({ content: t })
2568
2574
  })
2569
2575
  );
2570
- await P(s, `Failed to update ${e}`);
2571
- }, br = async (r, e) => {
2576
+ await I(s, `Failed to update ${e}`);
2577
+ }, wr = async (r, e) => {
2572
2578
  const t = await fetch(
2573
2579
  `${r.baseUrl}/files/${Ce(e)}`,
2574
- I(r.token, {
2580
+ P(r.token, {
2575
2581
  method: "DELETE"
2576
2582
  })
2577
2583
  );
2578
- await P(t, `Failed to delete ${e}`);
2584
+ await I(t, `Failed to delete ${e}`);
2579
2585
  }, It = async (r, e, t) => {
2580
2586
  const s = await fetch(
2581
2587
  `${r.baseUrl}/${e}`,
2582
- I(r.token, {
2588
+ P(r.token, {
2583
2589
  method: "POST",
2584
2590
  headers: {
2585
2591
  "Content-Type": "application/json"
@@ -2587,31 +2593,31 @@ const I = (r, e = {}) => {
2587
2593
  body: JSON.stringify({ target: t })
2588
2594
  })
2589
2595
  );
2590
- return await P(s, `Failed to ${e} ${t}`), s.json();
2591
- }, Pt = async (r, e) => {
2596
+ return await I(s, `Failed to ${e} ${t}`), s.json();
2597
+ }, jt = async (r, e) => {
2592
2598
  const t = await fetch(
2593
2599
  `${r.baseUrl}/jobs/${e}`,
2594
- I(r.token, {
2600
+ P(r.token, {
2595
2601
  method: "GET"
2596
2602
  })
2597
2603
  );
2598
- return await P(t, `Failed to fetch job ${e}`), t.json();
2599
- }, jt = async (r, e) => {
2604
+ return await I(t, `Failed to fetch job ${e}`), t.json();
2605
+ }, Nt = async (r, e) => {
2600
2606
  const t = await fetch(
2601
2607
  `${r.baseUrl}/jobs/${e}/cancel`,
2602
- I(r.token, {
2608
+ P(r.token, {
2603
2609
  method: "POST"
2604
2610
  })
2605
2611
  );
2606
- return await P(t, `Failed to cancel job ${e}`), t.json();
2607
- }, U = /* @__PURE__ */ new Map(), Ne = "trilogy-jobs-api-state", Je = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, Nt = (r) => {
2612
+ return await I(t, `Failed to cancel job ${e}`), t.json();
2613
+ }, U = /* @__PURE__ */ new Map(), Ne = "trilogy-jobs-api-state", Je = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, Jt = (r) => {
2608
2614
  const e = r.pollingState, t = e === "unable-to-fetch" ? "stopped" : r.pollingState ?? "ok";
2609
2615
  return {
2610
2616
  ...r,
2611
2617
  pollingState: t,
2612
2618
  pollingError: t === "stopped" && !r.pollingError && e === "unable-to-fetch" ? "Polling stopped locally." : r.pollingError ?? null
2613
2619
  };
2614
- }, se = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), wr = V("jobsApi", {
2620
+ }, se = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), vr = V("jobsApi", {
2615
2621
  state: () => ({
2616
2622
  filesByStore: {},
2617
2623
  jobsByStore: {},
@@ -2680,7 +2686,7 @@ const I = (r, e = {}) => {
2680
2686
  this.jobsByStore = Object.fromEntries(
2681
2687
  Object.entries(e).map(([t, s]) => [
2682
2688
  t,
2683
- (s || []).map((o) => Nt(o))
2689
+ (s || []).map((o) => Jt(o))
2684
2690
  ])
2685
2691
  );
2686
2692
  } catch (r) {
@@ -2719,7 +2725,7 @@ const I = (r, e = {}) => {
2719
2725
  if (e) {
2720
2726
  this.loadingByStore[r] = !0, this.storeStatus[r] = "idle";
2721
2727
  try {
2722
- this.filesByStore[r] = await Lt(e), delete this.errors[r], this.storeStatus[r] = "connected";
2728
+ this.filesByStore[r] = await Pt(e), delete this.errors[r], this.storeStatus[r] = "connected";
2723
2729
  } catch (t) {
2724
2730
  const s = t instanceof Error ? t.message : "Failed to fetch files";
2725
2731
  this.errors[r] = s, this.storeStatus[r] = "failed";
@@ -2814,7 +2820,7 @@ const I = (r, e = {}) => {
2814
2820
  return;
2815
2821
  }
2816
2822
  try {
2817
- const i = await Pt(s, e), n = this.buildLocalJob(
2823
+ const i = await jt(s, e), n = this.buildLocalJob(
2818
2824
  r,
2819
2825
  o.target,
2820
2826
  o.operation,
@@ -2850,7 +2856,7 @@ const I = (r, e = {}) => {
2850
2856
  }
2851
2857
  this.stoppingByJob[t] = !0, this.stopPolling(r, e), delete this.pollingByJob[t];
2852
2858
  try {
2853
- const i = await jt(s, e), n = this.buildLocalJob(
2859
+ const i = await Nt(s, e), n = this.buildLocalJob(
2854
2860
  r,
2855
2861
  o.target,
2856
2862
  o.operation,
@@ -2872,7 +2878,7 @@ const I = (r, e = {}) => {
2872
2878
  }
2873
2879
  }
2874
2880
  });
2875
- class Jt {
2881
+ class Bt {
2876
2882
  constructor(e, t, s, o) {
2877
2883
  w(this, "queryExecutionService");
2878
2884
  w(this, "connectionStore");
@@ -3504,7 +3510,7 @@ ${JSON.stringify(o, null, 2)}`
3504
3510
  } : { success: !0, message: o.length > 0 ? `Hidden ${i.length} artifact(s). Not found: ${o.join(", ")}. Hidden artifacts remain accessible to you via list_artifacts and can be restored by the user.` : `Hidden ${i.length} artifact(s). They remain accessible via list_artifacts and can be restored by the user.` };
3505
3511
  }
3506
3512
  }
3507
- const Bt = V("chats", {
3513
+ const Rt = V("chats", {
3508
3514
  state: () => ({
3509
3515
  chats: {},
3510
3516
  activeChatId: "",
@@ -3703,7 +3709,7 @@ const Bt = V("chats", {
3703
3709
  });
3704
3710
  },
3705
3711
  getMessages: () => o.messages
3706
- }, m = new Jt(
3712
+ }, m = new Bt(
3707
3713
  a,
3708
3714
  n,
3709
3715
  this,
@@ -3782,14 +3788,14 @@ function L(r) {
3782
3788
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3783
3789
  t.delete(r), window.location.hash = `#${t.toString()}`;
3784
3790
  }
3785
- function Rt(r) {
3791
+ function Kt(r) {
3786
3792
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3787
3793
  r.forEach((s) => {
3788
3794
  t.delete(s);
3789
3795
  }), window.location.hash = `#${t.toString()}`;
3790
3796
  }
3791
- const Kt = () => {
3792
- const r = At(), e = Ye(), t = ot(), s = ie(), o = Bt();
3797
+ const Ut = () => {
3798
+ const r = Ft(), e = Ye(), t = ot(), s = ie(), o = Rt();
3793
3799
  let i = null;
3794
3800
  const n = {
3795
3801
  activeScreen: Q(F("screen", "")),
@@ -3924,7 +3930,7 @@ const Kt = () => {
3924
3930
  n.tabs.value = n.tabs.value.filter((b) => b.id === f), C || (n.tabs.value.length > 0 ? S(n.tabs.value[0].id) : d("welcome", "Welcome", "welcome")), m();
3925
3931
  }, m = () => {
3926
3932
  let f = n.tabs.value.map((b) => b.screen), C = [];
3927
- f.includes("editors") || (n.activeEditor.value = "", C.push("editors"), C.push("activeEditorTab")), f.includes("dashboard") || (n.activeDashboard.value = "", C.push("dashboard")), f.includes("connections") || (n.activeConnectionKey.value = "", C.push("connections")), f.includes("models") || (n.activeModelKey.value = "", C.push("model")), f.includes("community-models") || (n.activeCommunityModelKey.value = "", C.push("community-models")), f.includes("jobs") || (n.activeJobsKey.value = "", C.push("jobs")), f.includes("tutorial") || (n.activeDocumentationKey.value = "", C.push("tutorial")), f.includes("llms") || (n.activeLLMConnectionKey.value = "", C.push("llms")), f.includes("settings") || C.push("settings"), f.includes("profile") || C.push("profile"), f.includes("welcome") || C.push("welcome"), Rt(C);
3933
+ f.includes("editors") || (n.activeEditor.value = "", C.push("editors"), C.push("activeEditorTab")), f.includes("dashboard") || (n.activeDashboard.value = "", C.push("dashboard")), f.includes("connections") || (n.activeConnectionKey.value = "", C.push("connections")), f.includes("models") || (n.activeModelKey.value = "", C.push("model")), f.includes("community-models") || (n.activeCommunityModelKey.value = "", C.push("community-models")), f.includes("jobs") || (n.activeJobsKey.value = "", C.push("jobs")), f.includes("tutorial") || (n.activeDocumentationKey.value = "", C.push("tutorial")), f.includes("llms") || (n.activeLLMConnectionKey.value = "", C.push("llms")), f.includes("settings") || C.push("settings"), f.includes("profile") || C.push("profile"), f.includes("welcome") || C.push("welcome"), Kt(C);
3928
3934
  }, y = (f) => {
3929
3935
  const C = n.tabs.value.findIndex((b) => b.id === f);
3930
3936
  if (C !== -1) {
@@ -4219,11 +4225,11 @@ const Kt = () => {
4219
4225
  };
4220
4226
  };
4221
4227
  let me = null;
4222
- function vr() {
4223
- return me || (me = Kt()), me;
4228
+ function Sr() {
4229
+ return me || (me = Ut()), me;
4224
4230
  }
4225
4231
  const ge = 100;
4226
- class Ut {
4232
+ class zt {
4227
4233
  constructor() {
4228
4234
  w(this, "dbName");
4229
4235
  w(this, "storeName");
@@ -4338,7 +4344,7 @@ class Ut {
4338
4344
  }
4339
4345
  }
4340
4346
  let ye = null;
4341
- const pe = () => (ye || (ye = new Ut()), ye);
4347
+ const pe = () => (ye || (ye = new zt()), ye);
4342
4348
  function ne(r) {
4343
4349
  const e = Q([]), t = Q(!0), s = Q(null), o = async () => {
4344
4350
  t.value = !0;
@@ -4395,7 +4401,7 @@ function ne(r) {
4395
4401
  refreshHistory: o
4396
4402
  };
4397
4403
  }
4398
- class zt {
4404
+ class Ht {
4399
4405
  constructor(e) {
4400
4406
  this.connection = e;
4401
4407
  }
@@ -4412,13 +4418,13 @@ class zt {
4412
4418
  return this.connection.query(e, t ?? null);
4413
4419
  }
4414
4420
  }
4415
- class Ht {
4421
+ class Wt {
4416
4422
  constructor(e) {
4417
4423
  this.connectionStore = e;
4418
4424
  }
4419
4425
  getConnection(e) {
4420
4426
  const t = this.connectionStore.connections[e];
4421
- return t ? new zt(t) : null;
4427
+ return t ? new Ht(t) : null;
4422
4428
  }
4423
4429
  async ensureConnected(e) {
4424
4430
  const t = this.connectionStore.connections[e];
@@ -4430,15 +4436,16 @@ class Ht {
4430
4436
  return this.connectionStore.getConnectionSources(e);
4431
4437
  }
4432
4438
  }
4433
- function Wt(r) {
4439
+ function Gt(r) {
4434
4440
  return typeof r.getConnection == "function" && typeof r.ensureConnected == "function";
4435
4441
  }
4436
- class Sr {
4442
+ class Cr {
4437
4443
  constructor(e, t, s = !0) {
4438
4444
  w(this, "trilogyResolver");
4439
4445
  w(this, "connectionProvider");
4440
4446
  w(this, "storeHistory");
4441
- this.trilogyResolver = e, this.connectionProvider = Wt(t) ? t : new Ht(t), this.storeHistory = s;
4447
+ w(this, "eligibleCrossFilterFieldsCache", /* @__PURE__ */ new Map());
4448
+ this.trilogyResolver = e, this.connectionProvider = Gt(t) ? t : new Wt(t), this.storeHistory = s;
4442
4449
  }
4443
4450
  async executeQueriesBatch(e, t, s, o = [], i, n = {}, a, c, u, l, h = !1, d) {
4444
4451
  if (s === "python")
@@ -4745,6 +4752,37 @@ class Sr {
4745
4752
  t.currentFilename || null
4746
4753
  )) : null;
4747
4754
  }
4755
+ async getEligibleCrossFilterFields(e, t = {}) {
4756
+ const s = this.connectionProvider.getConnection(e);
4757
+ if (!s)
4758
+ throw new Error(`Connection ${e} not found.`);
4759
+ const o = t.imports ?? [], i = t.extraFilters ?? [], n = t.extraContent ?? [], a = this.connectionProvider.getConnectionSources(e).concat(n), c = JSON.stringify({
4760
+ connectionId: e,
4761
+ queryType: s.queryType,
4762
+ imports: o,
4763
+ extraFilters: i,
4764
+ sources: a,
4765
+ currentFilename: t.currentFilename ?? null
4766
+ }), u = this.eligibleCrossFilterFieldsCache.get(c);
4767
+ if (u)
4768
+ return [...u];
4769
+ const l = await this.validateQuery(
4770
+ e,
4771
+ {
4772
+ text: "select 1 as cross_filter_probe;",
4773
+ editorType: "trilogy",
4774
+ imports: o,
4775
+ extraFilters: i,
4776
+ extraContent: n,
4777
+ currentFilename: t.currentFilename
4778
+ },
4779
+ !1
4780
+ ), h = wt((l == null ? void 0 : l.data.completion_items) ?? []);
4781
+ return this.eligibleCrossFilterFieldsCache.set(c, h), [...h];
4782
+ }
4783
+ clearEligibleCrossFilterFieldsCache() {
4784
+ this.eligibleCrossFilterFieldsCache.clear();
4785
+ }
4748
4786
  async executeQuery(e, t, s, o, i, n, a = !1) {
4749
4787
  const c = (/* @__PURE__ */ new Date()).getTime(), u = new AbortController();
4750
4788
  return {
@@ -4931,46 +4969,47 @@ class Sr {
4931
4969
  }
4932
4970
  }
4933
4971
  export {
4934
- Ue as A,
4935
- Lt as B,
4936
- Ht as C,
4937
- Tt as D,
4938
- fr as E,
4972
+ ne as A,
4973
+ Ue as B,
4974
+ Wt as C,
4975
+ $t as D,
4976
+ Pt as E,
4939
4977
  mr as F,
4940
4978
  gr as G,
4941
- ze as H,
4942
- br as I,
4943
- yr as J,
4979
+ yr as H,
4980
+ ze as I,
4981
+ wr as J,
4944
4982
  pr as K,
4945
- ve as L,
4946
- re as M,
4947
- $t as N,
4948
- Sr as Q,
4949
- lr as T,
4950
- At as a,
4983
+ br as L,
4984
+ ve as M,
4985
+ re as N,
4986
+ At as O,
4987
+ Cr as Q,
4988
+ ur as T,
4989
+ Ft as a,
4951
4990
  ie as b,
4952
- wr as c,
4953
- Bt as d,
4954
- vr as e,
4955
- G as f,
4956
- M as g,
4957
- St as h,
4958
- Re as i,
4959
- Dt as j,
4960
- xt as k,
4961
- vt as l,
4962
- Et as m,
4963
- ur as n,
4964
- F as o,
4965
- L as p,
4966
- R as q,
4967
- Ct as r,
4968
- le as s,
4969
- Ie as t,
4970
- hr as u,
4971
- bt as v,
4972
- oe as w,
4973
- dr as x,
4974
- fe as y,
4975
- ne as z
4991
+ vr as c,
4992
+ Rt as d,
4993
+ Sr as e,
4994
+ Pe as f,
4995
+ F as g,
4996
+ M as h,
4997
+ hr as i,
4998
+ G as j,
4999
+ Ct as k,
5000
+ Re as l,
5001
+ xt as m,
5002
+ R as n,
5003
+ Tt as o,
5004
+ wt as p,
5005
+ St as q,
5006
+ L as r,
5007
+ Et as s,
5008
+ Dt as t,
5009
+ dr as u,
5010
+ le as v,
5011
+ bt as w,
5012
+ oe as x,
5013
+ fr as y,
5014
+ fe as z
4976
5015
  };