@gravitee/gamma-lib-observability 6.6.0 → 6.7.0

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 (36) hide show
  1. package/INTEGRATION.md +15 -0
  2. package/USAGE_GUIDE.md +1 -1
  3. package/dist/dashboard-access-provider.js +135 -123
  4. package/dist/dashboards/editor/CatalogOption.d.ts +15 -0
  5. package/dist/dashboards/editor/CatalogOption.d.ts.map +1 -0
  6. package/dist/dashboards/editor/DimensionSelect.d.ts +13 -1
  7. package/dist/dashboards/editor/DimensionSelect.d.ts.map +1 -1
  8. package/dist/dashboards/editor/FacetQueryFields.d.ts.map +1 -1
  9. package/dist/dashboards/editor/MetricSelect.d.ts +5 -3
  10. package/dist/dashboards/editor/MetricSelect.d.ts.map +1 -1
  11. package/dist/dashboards/editor/SeriesListEditor.d.ts.map +1 -1
  12. package/dist/dashboards/editor/TableQueryFields.d.ts.map +1 -1
  13. package/dist/dashboards/editor/convert-widget-type.d.ts +5 -0
  14. package/dist/dashboards/editor/convert-widget-type.d.ts.map +1 -1
  15. package/dist/dashboards/editor/dimension-reset.d.ts +13 -0
  16. package/dist/dashboards/editor/dimension-reset.d.ts.map +1 -0
  17. package/dist/dashboards/editor/testing/select-options.d.ts +21 -0
  18. package/dist/dashboards/editor/testing/select-options.d.ts.map +1 -0
  19. package/dist/dashboards/metric-catalog.d.ts +60 -12
  20. package/dist/dashboards/metric-catalog.d.ts.map +1 -1
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3860 -3738
  24. package/dist/providers/analytics-api-types-provider.d.ts +27 -0
  25. package/dist/providers/analytics-api-types-provider.d.ts.map +1 -0
  26. package/dist/providers/index.d.ts +1 -0
  27. package/dist/providers/index.d.ts.map +1 -1
  28. package/dist/routing/ObservabilityRoutes.d.ts.map +1 -1
  29. package/dist/routing/resolve-analytics-api-types.d.ts +20 -0
  30. package/dist/routing/resolve-analytics-api-types.d.ts.map +1 -0
  31. package/dist/routing/types.d.ts +20 -0
  32. package/dist/routing/types.d.ts.map +1 -1
  33. package/dist/testing/index.d.ts +7 -0
  34. package/dist/testing/index.d.ts.map +1 -1
  35. package/dist/testing.js +39 -36
  36. package/package.json +1 -1
package/INTEGRATION.md CHANGED
@@ -453,6 +453,19 @@ dashboards: {
453
453
 
454
454
  `scopeApiTypes` generates `API_TYPE` context filters (merged into every analytics query) and sets `scopeFilterField` to restrict which filter providers appear in the FilterBar. For non-API_TYPE scoping, use `contextFilters` + `scopeFilterField` directly.
455
455
 
456
+ The widget editor offers its metric and dimension catalog for the same API types: an APIM host sees the Gateway metrics alone, an AIM host the Gateway and LLM metrics with the MCP dimensions. A module whose editor should offer another set, or that scopes its queries by another field, declares `analyticsApiTypes` next to `scopeApiTypes` (globally or on the dashboards section):
457
+
458
+ ```ts
459
+ dashboards: {
460
+ enabled: true,
461
+ templates: [decisionsTemplate],
462
+ // AuthZ scopes on RECORD_TYPE through `contextFilters` and names the API type its editor offers.
463
+ analyticsApiTypes: ['AUTHZ'],
464
+ }
465
+ ```
466
+
467
+ `analyticsApiTypes` drives the editor's pickers only: the context filters and the query clamp are unchanged. The pickers follow the module's declaration, not a dashboard filter that narrows `API_TYPE` below it. With neither field declared, the editor offers the whole catalog; so does, today, a declaration the catalog knows no metric for: the AuthZ example above offers AuthZ metrics alone once the catalog carries them (OBS-143), and the whole catalog until then. A widget saved on a metric or dimension the host no longer offers still shows it, under "Custom", and saves it back unchanged; switching a widget's metric resets a group-by the new metric does not accept, the way it resets the measure; the JSON tab accepts any metric.
468
+
456
469
  ### Deep links into a dashboard
457
470
 
458
471
  `buildDashboardDeepLink` is the counterpart of `buildLogsDeepLink`, for sending a user from an
@@ -512,6 +525,8 @@ Each link renders in the dashboard toolbar as `Label →`. The `href` callback i
512
525
  interface DashboardFeatureConfig {
513
526
  enabled?: boolean; // default: true when the key is present
514
527
  templates: DashboardTemplate[];
528
+ scopeApiTypes?: readonly string[];
529
+ analyticsApiTypes?: readonly string[]; // what the widget editor offers; defaults to scopeApiTypes
515
530
  contextFilters?: FilterCondition[];
516
531
  scopeFilterField?: string;
517
532
  externalLinks?: ExternalDashboardLink[];
package/USAGE_GUIDE.md CHANGED
@@ -45,7 +45,7 @@ export const observability = defineObservabilityFeatures({
45
45
 
46
46
  `module` is your Gamma module id. It is **required** when dashboards are enabled: custom dashboards are created in, and listed for, that module only. See the [API reference](#defineobservabilityfeatures--api-reference).
47
47
 
48
- `scopeApiTypes` generates `API_TYPE` context filters and scoped filter providers for all features. Override per-feature when needed (e.g. logs scoped to `['MCP']` only while dashboards sees `['MCP', 'LLM']`).
48
+ `scopeApiTypes` generates `API_TYPE` context filters and scoped filter providers for all features. Override per-feature when needed (e.g. logs scoped to `['MCP']` only while dashboards sees `['MCP', 'LLM']`). The widget editor offers its metrics and dimensions for the same API types; declare `analyticsApiTypes` next to it when the editor should offer another set (it changes nothing about the queries).
49
49
 
50
50
  ### 2. Mount routes
51
51
 
@@ -36,8 +36,8 @@ function d(e) {
36
36
  }
37
37
  //#endregion
38
38
  //#region src/dashboards/grid.ts
39
- var ee = 24, f = 2, p = 12, m = 24 / p;
40
- function h(e) {
39
+ var ee = 24, te = 2, f = 12, p = 24 / f;
40
+ function m(e) {
41
41
  if (typeof e != "object" || !e) return "unreadable";
42
42
  let t = typeof e.version == "number" ? e.version : void 0;
43
43
  if (t !== void 0 && t >= 2) return "current";
@@ -47,18 +47,18 @@ function h(e) {
47
47
  r,
48
48
  i,
49
49
  a
50
- ].every((e) => Number.isFinite(e)) ? t === void 0 && n + i > p ? "current-unmarked" : "legacy" : "unreadable";
50
+ ].every((e) => Number.isFinite(e)) ? t === void 0 && n + i > f ? "current-unmarked" : "legacy" : "unreadable";
51
51
  }
52
- function te(e) {
53
- switch (h(e)) {
52
+ function ne(e) {
53
+ switch (m(e)) {
54
54
  case "legacy": return {
55
- x: e.x * m,
56
- y: e.y * m,
57
- cols: e.cols * m,
58
- rows: e.rows * m,
55
+ x: e.x * p,
56
+ y: e.y * p,
57
+ cols: e.cols * p,
58
+ rows: e.rows * p,
59
59
  version: 2,
60
- ...e.minCols !== void 0 && { minCols: e.minCols * m },
61
- ...e.minRows !== void 0 && { minRows: e.minRows * m }
60
+ ...e.minCols !== void 0 && { minCols: e.minCols * p },
61
+ ...e.minRows !== void 0 && { minRows: e.minRows * p }
62
62
  };
63
63
  case "current-unmarked": return {
64
64
  ...e,
@@ -68,10 +68,10 @@ function te(e) {
68
68
  case "unreadable": return e;
69
69
  }
70
70
  }
71
- function g(e) {
71
+ function h(e) {
72
72
  if (!e || !Array.isArray(e.widgets)) return e;
73
73
  let t = !1, n = e.widgets.map((e) => {
74
- let n = te(e.layout);
74
+ let n = ne(e.layout);
75
75
  return n === e.layout ? e : (t = !0, {
76
76
  ...e,
77
77
  layout: n
@@ -84,15 +84,15 @@ function g(e) {
84
84
  }
85
85
  //#endregion
86
86
  //#region src/data-sources/http-errors.ts
87
- var _ = class extends Error {
87
+ var g = class extends Error {
88
88
  status;
89
89
  call;
90
90
  detail;
91
91
  constructor(e, t, n, r) {
92
92
  super(t), this.name = "ObservabilityHttpError", this.status = e, n !== void 0 && (this.call = n), r !== void 0 && (this.detail = r);
93
93
  }
94
- }, v = 300;
95
- function ne(e) {
94
+ }, _ = 300;
95
+ function re(e) {
96
96
  if (typeof e != "object" || !e) return;
97
97
  let { message: t, detail: n, error: r } = e, i = [
98
98
  t,
@@ -101,14 +101,14 @@ function ne(e) {
101
101
  ].find((e) => typeof e == "string" && e.trim());
102
102
  return typeof i == "string" ? i : void 0;
103
103
  }
104
- function y(e) {
104
+ function v(e) {
105
105
  try {
106
106
  return JSON.parse(e);
107
107
  } catch {
108
108
  return;
109
109
  }
110
110
  }
111
- async function b(e) {
111
+ async function y(e) {
112
112
  if (typeof e.text != "function") return;
113
113
  let t;
114
114
  try {
@@ -118,76 +118,76 @@ async function b(e) {
118
118
  return;
119
119
  }
120
120
  if (!t || t.startsWith("<")) return;
121
- let n = t.startsWith("{") ? ne(y(t)) : t;
121
+ let n = t.startsWith("{") ? re(v(t)) : t;
122
122
  if (!n) return;
123
123
  let r = n.replace(/\s+/g, " ").trim();
124
- return r.length > v ? `${r.slice(0, v - 1)}…` : r;
124
+ return r.length > _ ? `${r.slice(0, _ - 1)}…` : r;
125
125
  }
126
- async function re(e, t) {
127
- return new _(e.status, `[gamma-lib-observability] HTTP ${e.status} on ${t}`, t, await b(e));
126
+ async function ie(e, t) {
127
+ return new g(e.status, `[gamma-lib-observability] HTTP ${e.status} on ${t}`, t, await y(e));
128
128
  }
129
- function x(e) {
129
+ function b(e) {
130
130
  if (typeof e != "object" || !e || !("status" in e)) return;
131
131
  let { status: t } = e;
132
132
  return typeof t == "number" ? t : void 0;
133
133
  }
134
- function S(e) {
134
+ function x(e) {
135
135
  if (typeof e != "object" || !e || !("call" in e)) return;
136
136
  let { call: t } = e;
137
137
  return typeof t == "string" ? t : void 0;
138
138
  }
139
- function C(e) {
139
+ function S(e) {
140
140
  if (typeof e != "object" || !e || !("detail" in e)) return;
141
141
  let { detail: t } = e;
142
142
  return typeof t == "string" && t ? t : void 0;
143
143
  }
144
- function w(e) {
145
- let t = x(e);
144
+ function C(e) {
145
+ let t = b(e);
146
146
  return t !== void 0 && t >= 400 && t < 500;
147
147
  }
148
- function T(e) {
149
- return x(e) === 403;
148
+ function w(e) {
149
+ return b(e) === 403;
150
150
  }
151
- function E(e) {
152
- return x(e) === 404;
151
+ function T(e) {
152
+ return b(e) === 404;
153
153
  }
154
154
  //#endregion
155
155
  //#region src/data-sources/dashboard-errors.ts
156
- var D = class extends Error {
156
+ var E = class extends Error {
157
157
  status;
158
158
  constructor(e, t) {
159
159
  super(t), this.name = "DashboardPersistenceError", this.status = e;
160
160
  }
161
- }, ie = class extends D {
161
+ }, ae = class extends E {
162
162
  constructor(e) {
163
163
  super(403, e), this.name = "DashboardForbiddenError";
164
164
  }
165
- }, ae = class extends D {
165
+ }, oe = class extends E {
166
166
  dashboardId;
167
167
  constructor(e, t) {
168
168
  super(404, t), this.name = "DashboardNotFoundError", this.dashboardId = e;
169
169
  }
170
- }, O = class extends D {
170
+ }, D = class extends E {
171
171
  currentVersion;
172
172
  currentDashboard;
173
173
  constructor(e, t, n) {
174
174
  super(412, e), this.name = "DashboardConflictError", this.currentDashboard = t, this.currentVersion = n;
175
175
  }
176
176
  };
177
- function oe(e) {
178
- return E(e);
179
- }
180
177
  function se(e) {
181
178
  return T(e);
182
179
  }
180
+ function ce(e) {
181
+ return w(e);
182
+ }
183
183
  //#endregion
184
184
  //#region src/data-sources/with-grid-migration.ts
185
- function ce(e) {
186
- let t = (e) => Promise.resolve(e).then(g, le);
185
+ function le(e) {
186
+ let t = (e) => Promise.resolve(e).then(h, ue);
187
187
  return {
188
188
  ...e.module !== void 0 && { module: e.module },
189
- fetchDashboard: (t, n) => Promise.resolve(e.fetchDashboard(t, n)).then(g),
190
- fetchDashboards: (t) => Promise.resolve(e.fetchDashboards(t)).then((e) => Array.isArray(e) ? e.map(g) : e),
189
+ fetchDashboard: (t, n) => Promise.resolve(e.fetchDashboard(t, n)).then(h),
190
+ fetchDashboards: (t) => Promise.resolve(e.fetchDashboards(t)).then((e) => Array.isArray(e) ? e.map(h) : e),
191
191
  createDashboard: (n, r) => t(e.createDashboard(n, r)),
192
192
  updateDashboard: (n, r, i) => t(e.updateDashboard(n, r, i)),
193
193
  deleteDashboard: (t, n) => e.deleteDashboard(t, n),
@@ -195,12 +195,12 @@ function ce(e) {
195
195
  ...e.takeReadRevision && { takeReadRevision: (t) => e.takeReadRevision?.(t) }
196
196
  };
197
197
  }
198
- function le(e) {
199
- if (!(e instanceof O)) throw e;
200
- let t = g(e.currentDashboard);
201
- throw t === e.currentDashboard ? e : ue(e, t);
198
+ function ue(e) {
199
+ if (!(e instanceof D)) throw e;
200
+ let t = h(e.currentDashboard);
201
+ throw t === e.currentDashboard ? e : de(e, t);
202
202
  }
203
- function ue(e, t) {
203
+ function de(e, t) {
204
204
  return Object.create(Object.getPrototypeOf(e), {
205
205
  ...Object.getOwnPropertyDescriptors(e),
206
206
  stack: {
@@ -219,84 +219,84 @@ function ue(e, t) {
219
219
  }
220
220
  //#endregion
221
221
  //#region src/providers/dashboard-persistence-provider.tsx
222
- var k = e(null);
223
- function A({ persistence: e, children: t }) {
224
- let n = r(() => ce(e), [e]);
225
- return /* @__PURE__ */ a(k.Provider, {
222
+ var O = e(null);
223
+ function k({ persistence: e, children: t }) {
224
+ let n = r(() => le(e), [e]);
225
+ return /* @__PURE__ */ a(O.Provider, {
226
226
  value: n,
227
227
  children: t
228
228
  });
229
229
  }
230
- function j() {
231
- return n(k);
230
+ function A() {
231
+ return n(O);
232
232
  }
233
- function M() {
234
- let e = n(k);
233
+ function j() {
234
+ let e = n(O);
235
235
  if (!e) throw Error("[gamma-lib-observability] useDashboardPersistence must be used within a <DashboardPersistenceProvider>. Wrap your component tree with <DashboardPersistenceProvider persistence={yourImpl}>.");
236
236
  return e;
237
237
  }
238
238
  //#endregion
239
239
  //#region src/providers/ContextFiltersProvider.tsx
240
- var N = e([]);
241
- function P({ filters: e, children: t }) {
240
+ var M = e([]);
241
+ function N({ filters: e, children: t }) {
242
242
  let n = r(() => e, [JSON.stringify(e)]);
243
- return /* @__PURE__ */ a(N.Provider, {
243
+ return /* @__PURE__ */ a(M.Provider, {
244
244
  value: n,
245
245
  children: t
246
246
  });
247
247
  }
248
- function F() {
249
- return n(N);
248
+ function P() {
249
+ return n(M);
250
250
  }
251
251
  //#endregion
252
252
  //#region src/dashboards/merge-filters.ts
253
- var I = new Set(["gte", "lte"]);
254
- function L(e) {
255
- return I.has(e.operator);
253
+ var F = new Set(["gte", "lte"]);
254
+ function I(e) {
255
+ return F.has(e.operator);
256
256
  }
257
- function R(...e) {
257
+ function L(...e) {
258
258
  let t = /* @__PURE__ */ new Map();
259
- for (let n of e) if (n) for (let [e, r] of z(n)) t.set(e, B(r));
259
+ for (let n of e) if (n) for (let [e, r] of R(n)) t.set(e, z(r));
260
260
  return Array.from(t.values()).flat();
261
261
  }
262
- function z(e) {
262
+ function R(e) {
263
263
  let t = /* @__PURE__ */ new Map();
264
264
  for (let n of e) t.set(n.field, [...t.get(n.field) ?? [], n]);
265
265
  return t;
266
266
  }
267
- function B(e) {
268
- return e.every(L) ? e.filter((t, n) => e.slice(n + 1).every((e) => e.operator !== t.operator)) : [e[e.length - 1]];
267
+ function z(e) {
268
+ return e.every(I) ? e.filter((t, n) => e.slice(n + 1).every((e) => e.operator !== t.operator)) : [e[e.length - 1]];
269
269
  }
270
270
  //#endregion
271
271
  //#region src/filters/scope-ceiling.ts
272
- var V = new Set(["eq", "in"]);
273
- function H(e, t) {
274
- let n = R(e, t), r = new Map(e.filter((e) => V.has(e.operator) && e.value.length > 0).map((e) => [e.field, e]));
272
+ var B = new Set(["eq", "in"]);
273
+ function V(e, t) {
274
+ let n = L(e, t), r = new Map(e.filter((e) => B.has(e.operator) && e.value.length > 0).map((e) => [e.field, e]));
275
275
  if (r.size === 0) return n;
276
276
  let i = /* @__PURE__ */ new Set();
277
277
  return n.flatMap((e) => {
278
278
  let t = r.get(e.field);
279
279
  if (!t || e === t) return [e];
280
- let n = fe(e, t);
280
+ let n = pe(e, t);
281
281
  return n === t ? i.has(e.field) ? [] : (i.add(e.field), [t]) : [n];
282
282
  });
283
283
  }
284
- function U(e, t) {
284
+ function H(e, t) {
285
285
  let n = /* @__PURE__ */ new Set();
286
286
  return [...e, ...t ?? []].filter((e) => {
287
- let t = de(e);
287
+ let t = fe(e);
288
288
  return n.has(t) ? !1 : (n.add(t), !0);
289
289
  });
290
290
  }
291
- function de(e) {
291
+ function fe(e) {
292
292
  return JSON.stringify([
293
293
  e.field,
294
294
  e.operator,
295
295
  [...e.value].sort()
296
296
  ]);
297
297
  }
298
- function fe(e, t) {
299
- if (!V.has(e.operator)) return t;
298
+ function pe(e, t) {
299
+ if (!B.has(e.operator)) return t;
300
300
  let n = new Set(t.value), r = e.value.map((e, t) => n.has(e) ? t : -1).filter((e) => e >= 0);
301
301
  return r.length === 0 ? t : r.length === e.value.length ? e : {
302
302
  ...e,
@@ -306,113 +306,125 @@ function fe(e, t) {
306
306
  }
307
307
  //#endregion
308
308
  //#region src/providers/clamped-data-sources.ts
309
- function pe(e, t) {
309
+ function me(e, t) {
310
310
  return {
311
311
  fetchTimeSeries: (n) => e.fetchTimeSeries({
312
312
  ...n,
313
- filters: U(t, n.filters)
313
+ filters: H(t, n.filters)
314
314
  }),
315
315
  fetchFacets: (n) => e.fetchFacets({
316
316
  ...n,
317
- filters: U(t, n.filters)
317
+ filters: H(t, n.filters)
318
318
  }),
319
319
  fetchMeasures: (n) => e.fetchMeasures({
320
320
  ...n,
321
- filters: U(t, n.filters)
321
+ filters: H(t, n.filters)
322
322
  })
323
323
  };
324
324
  }
325
- function W(e, t) {
325
+ function he(e, t) {
326
326
  let n = e.getById;
327
327
  return {
328
328
  fetchLogs: (n) => e.fetchLogs({
329
329
  ...n,
330
- filters: H(t, n.filters)
330
+ filters: V(t, n.filters)
331
331
  }),
332
332
  ...n ? { getById: (t, r, i) => n.call(e, t, r, i) } : {}
333
333
  };
334
334
  }
335
335
  //#endregion
336
336
  //#region src/providers/logs-data-source-provider.tsx
337
- var G = e(null);
338
- function me({ dataSource: e, children: t }) {
339
- return /* @__PURE__ */ a(G.Provider, {
337
+ var U = e(null);
338
+ function ge({ dataSource: e, children: t }) {
339
+ return /* @__PURE__ */ a(U.Provider, {
340
340
  value: e,
341
341
  children: t
342
342
  });
343
343
  }
344
- function he() {
345
- let e = K();
344
+ function _e() {
345
+ let e = W();
346
346
  if (!e) throw Error("[gamma-lib-observability] useLogsDataSource must be used within a <LogsDataSourceProvider>. Wrap your component tree with <LogsDataSourceProvider dataSource={yourImpl}>.");
347
347
  return e;
348
348
  }
349
- function K() {
350
- let e = n(G), t = F();
351
- return r(() => e ? W(e, t) : null, [e, t]);
349
+ function W() {
350
+ let e = n(U), t = P();
351
+ return r(() => e ? he(e, t) : null, [e, t]);
352
352
  }
353
353
  //#endregion
354
354
  //#region src/providers/metrics-data-source-provider.tsx
355
- var q = e(null);
356
- function ge({ dataSource: e, children: t }) {
357
- return /* @__PURE__ */ a(q.Provider, {
355
+ var G = e(null);
356
+ function ve({ dataSource: e, children: t }) {
357
+ return /* @__PURE__ */ a(G.Provider, {
358
358
  value: e,
359
359
  children: t
360
360
  });
361
361
  }
362
- function _e() {
363
- let e = J();
362
+ function ye() {
363
+ let e = K();
364
364
  if (!e) throw Error("[gamma-lib-observability] useMetricsDataSource must be used within a <MetricsDataSourceProvider>. Wrap your component tree with <MetricsDataSourceProvider dataSource={yourImpl}>.");
365
365
  return e;
366
366
  }
367
- function J() {
368
- let e = n(q), t = F();
369
- return r(() => e ? pe(e, t) : null, [e, t]);
367
+ function K() {
368
+ let e = n(G), t = P();
369
+ return r(() => e ? me(e, t) : null, [e, t]);
370
370
  }
371
371
  //#endregion
372
372
  //#region src/providers/traces-data-source-provider.tsx
373
- var Y = e(null);
374
- function ve({ dataSource: e, children: t }) {
375
- return /* @__PURE__ */ a(Y.Provider, {
373
+ var q = e(null);
374
+ function be({ dataSource: e, children: t }) {
375
+ return /* @__PURE__ */ a(q.Provider, {
376
376
  value: e,
377
377
  children: t
378
378
  });
379
379
  }
380
- function ye() {
381
- let e = n(Y);
380
+ function xe() {
381
+ let e = n(q);
382
382
  if (!e) throw Error("[gamma-lib-observability] useTracesDataSource must be used within a <TracesDataSourceProvider>. Wrap your component tree with <TracesDataSourceProvider dataSource={yourImpl}>.");
383
383
  return e;
384
384
  }
385
- function be() {
386
- return n(Y);
385
+ function Se() {
386
+ return n(q);
387
+ }
388
+ //#endregion
389
+ //#region src/providers/analytics-api-types-provider.tsx
390
+ var J = e(void 0);
391
+ function Ce({ apiTypes: e, children: t }) {
392
+ return /* @__PURE__ */ a(J.Provider, {
393
+ value: e,
394
+ children: t
395
+ });
396
+ }
397
+ function we() {
398
+ return n(J);
387
399
  }
388
400
  //#endregion
389
401
  //#region src/filters/filter-providers-context.tsx
390
- var X = e(null), Z = e(null);
391
- function xe({ providers: e, load: t, children: i }) {
392
- let o = r(() => e, [e]), s = n(Z);
393
- return /* @__PURE__ */ a(Z.Provider, {
402
+ var Y = e(null), X = e(null);
403
+ function Te({ providers: e, load: t, children: i }) {
404
+ let o = r(() => e, [e]), s = n(X);
405
+ return /* @__PURE__ */ a(X.Provider, {
394
406
  value: t ?? s,
395
- children: /* @__PURE__ */ a(X.Provider, {
407
+ children: /* @__PURE__ */ a(Y.Provider, {
396
408
  value: o,
397
409
  children: i
398
410
  })
399
411
  });
400
412
  }
401
- function Se() {
402
- let e = n(Z);
413
+ function Ee() {
414
+ let e = n(X);
403
415
  return e !== null && e.error !== null && e.error !== void 0 ? e : null;
404
416
  }
405
- function Q() {
406
- let e = n(X);
417
+ function Z() {
418
+ let e = n(Y);
407
419
  if (!e) throw Error("[gamma-lib-observability] useFilterProviders must be used within a <FilterProvidersProvider>. Wrap your component tree with <FilterProvidersProvider providers={[...]}>.");
408
420
  return e;
409
421
  }
410
- function Ce() {
411
- return n(X) ?? we;
422
+ function De() {
423
+ return n(Y) ?? Q;
412
424
  }
413
- var we = Object.freeze([]);
414
- function Te(e) {
415
- let t = Q();
425
+ var Q = Object.freeze([]);
426
+ function Oe(e) {
427
+ let t = Z();
416
428
  if (e) return t.find((t) => t.field === e);
417
429
  }
418
430
  //#endregion
@@ -423,7 +435,7 @@ var $ = e({
423
435
  reportRefused: () => {},
424
436
  reportGranted: () => {}
425
437
  });
426
- function Ee({ children: e }) {
438
+ function ke({ children: e }) {
427
439
  let [n, o] = i({
428
440
  read: !1,
429
441
  write: !1
@@ -453,8 +465,8 @@ function Ee({ children: e }) {
453
465
  children: e
454
466
  });
455
467
  }
456
- function De() {
468
+ function Ae() {
457
469
  return n($);
458
470
  }
459
471
  //#endregion
460
- export { se as A, ee as B, A as C, ie as D, O as E, C as F, d as G, g as H, x as I, s as K, w as L, _ as M, re as N, ae as O, S as P, T as R, F as S, j as T, l as U, f as V, u as W, U as _, Te as a, R as b, ve as c, ge as d, _e as f, K as g, he as h, Se as i, oe as j, D as k, be as l, me as m, De as n, Q as o, J as p, o as q, xe as r, Ce as s, Ee as t, ye as u, H as v, M as w, P as x, L as y, E as z };
472
+ export { oe as A, w as B, N as C, A as D, j as E, ie as F, l as G, ee as H, x as I, s as J, u as K, S as L, ce as M, se as N, D as O, g as P, b as R, L as S, k as T, te as U, T as V, h as W, o as Y, _e as _, Oe as a, V as b, Ce as c, Se as d, xe as f, ge as g, K as h, Ee as i, E as j, ae as k, we as l, ye as m, Ae as n, Z as o, ve as p, d as q, Te as r, De as s, ke as t, be as u, W as v, P as w, I as x, H as y, C as z };
@@ -0,0 +1,15 @@
1
+ export interface CatalogOptionProps {
2
+ /** What the author reads: the catalog label, or the technical name of an entry outside the catalog. */
3
+ readonly label: string;
4
+ /** The technical name the widget stores. */
5
+ readonly name: string;
6
+ }
7
+ /**
8
+ * One option of a catalog picker: label first, technical name underneath,
9
+ * unless the two only differ by case (`API` reads as "API" alone).
10
+ *
11
+ * The subtitle carries `data-option-subtitle` so a closed trigger can hide it
12
+ * and stay one line tall.
13
+ */
14
+ export declare function CatalogOption({ label, name }: CatalogOptionProps): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=CatalogOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CatalogOption.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/CatalogOption.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,uGAAuG;IACvG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,kBAAkB,2CAWhE"}
@@ -1,6 +1,12 @@
1
1
  export interface DimensionSelectProps {
2
2
  readonly value: string | undefined;
3
3
  readonly onChange: (field: string | undefined) => void;
4
+ /**
5
+ * The metrics this dimension groups. Only the dimensions every one of them
6
+ * accepts are offered, since the engine refuses a facet a metric does not
7
+ * declare. A metric outside the catalog constrains nothing.
8
+ */
9
+ readonly metrics: readonly string[];
4
10
  readonly id?: string;
5
11
  /** Adds a "None" entry that clears the dimension (used for series group-by). */
6
12
  readonly allowNone?: boolean;
@@ -8,5 +14,11 @@ export interface DimensionSelectProps {
8
14
  /** Distinguishes several dimension pickers rendered in the same form. */
9
15
  readonly ariaLabel?: string;
10
16
  }
11
- export declare function DimensionSelect({ value, onChange, id, allowNone, disabled, ariaLabel, }: DimensionSelectProps): import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * Dimension picker backed by the curated catalog, narrowed to what the
19
+ * selected metrics accept and to the API types the host declared (see
20
+ * `useAnalyticsApiTypes`). A dimension that is not offered is kept selectable
21
+ * so a saved widget shows it and saves it back unchanged.
22
+ */
23
+ export declare function DimensionSelect({ value, onChange, metrics, id, allowNone, disabled, ariaLabel, }: DimensionSelectProps): import("react/jsx-runtime").JSX.Element;
12
24
  //# sourceMappingURL=DimensionSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DimensionSelect.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/DimensionSelect.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,EAAE,EACF,SAAiB,EACjB,QAAQ,EACR,SAAuB,GACxB,EAAE,oBAAoB,2CAoCtB"}
1
+ {"version":3,"file":"DimensionSelect.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/DimensionSelect.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,EAAE,EACF,SAAiB,EACjB,QAAQ,EACR,SAAuB,GACxB,EAAE,oBAAoB,2CAkCtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FacetQueryFields.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/FacetQueryFields.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAa,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAcxG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,GAAG,eAAe,CAAC;IAC9D,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAoE3E"}
1
+ {"version":3,"file":"FacetQueryFields.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/FacetQueryFields.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAa,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAcxG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,GAAG,eAAe,CAAC;IAC9D,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAyE3E"}
@@ -4,9 +4,11 @@ export interface MetricSelectProps {
4
4
  readonly id?: string;
5
5
  }
6
6
  /**
7
- * Metric picker backed by the curated catalog. A metric that is not in the
8
- * catalog (e.g. hand-written in the JSON tab) is kept selectable so the form
9
- * never destroys an advanced configuration.
7
+ * Metric picker backed by the curated catalog, narrowed to the API types the
8
+ * host declared (see `useAnalyticsApiTypes`). A metric that is not offered,
9
+ * whether hand-written in the JSON tab or saved under another host's API
10
+ * types, is kept selectable under "Custom" so the form never destroys an
11
+ * advanced configuration: it shows, and is saved back unchanged.
10
12
  */
11
13
  export declare function MetricSelect({ value, onChange, id }: MetricSelectProps): import("react/jsx-runtime").JSX.Element;
12
14
  //# sourceMappingURL=MetricSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetricSelect.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/MetricSelect.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,2CAmCtE"}
1
+ {"version":3,"file":"MetricSelect.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/MetricSelect.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,2CAiCtE"}
@@ -1 +1 @@
1
- {"version":3,"file":"SeriesListEditor.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/SeriesListEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,oBAAoB,CAAC;AAwBjF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAwI3E"}
1
+ {"version":3,"file":"SeriesListEditor.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/SeriesListEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,oBAAoB,CAAC;AAyBjF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CA6I3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableQueryFields.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/TableQueryFields.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUtF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAmF3E"}
1
+ {"version":3,"file":"TableQueryFields.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/TableQueryFields.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAWtF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CA2F3E"}
@@ -1,3 +1,8 @@
1
1
  import { Widget, WidgetType } from '../../types/domain';
2
+ /** What a widget queries until the author says otherwise: the editor's defaults, shared with the query fields. */
3
+ export declare const DEFAULT_METRIC = "HTTP_REQUESTS";
4
+ export declare const DEFAULT_MEASURE = "COUNT";
5
+ /** Accepted by every metric of the catalog, so a group-by can always fall back to it. */
6
+ export declare const DEFAULT_DIMENSION = "API";
2
7
  export declare function convertWidgetType(widget: Widget, type: WidgetType): Widget;
3
8
  //# sourceMappingURL=convert-widget-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-widget-type.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/convert-widget-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAgB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkDxF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA6E1E"}
1
+ {"version":3,"file":"convert-widget-type.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/convert-widget-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAgB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMxF,kHAAkH;AAClH,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAC9C,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AA0CvC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA6E1E"}