@holistics/anfra-sdk 0.20.0 → 0.22.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 (38) hide show
  1. package/README.md +5 -0
  2. package/dist/api.d.ts +11 -8
  3. package/dist/api.js +45 -22
  4. package/dist/app.d.ts +5 -5
  5. package/dist/app.js +5 -4
  6. package/dist/{bootstrap-DHU2haC5.d.ts → bootstrap-fGoj2ap1.d.ts} +324 -27
  7. package/dist/build.d.ts +2 -2
  8. package/dist/{chunk-32566ZNE.js → chunk-2TTGSNHA.js} +1 -1
  9. package/dist/{chunk-H52PO7MP.js → chunk-33HI2ODM.js} +25 -0
  10. package/dist/chunk-4UEESYHH.js +32 -0
  11. package/dist/{chunk-KKSOTHP4.js → chunk-7GQZU5FL.js} +1 -1
  12. package/dist/{chunk-4TXKXLWK.js → chunk-7I2HXY72.js} +1 -1
  13. package/dist/{chunk-DITKCHFQ.js → chunk-CLXZMA5D.js} +1 -1
  14. package/dist/{chunk-GBXK7F2V.js → chunk-D7DIJRAC.js} +14 -1
  15. package/dist/{chunk-ACKFOANJ.js → chunk-DWQUIHUX.js} +4 -1
  16. package/dist/{chunk-FTTVLHNN.js → chunk-EOFPMSND.js} +1 -1
  17. package/dist/{chunk-SXKJQU7A.js → chunk-GPBYPSWK.js} +22 -36
  18. package/dist/{chunk-EIPHDMZ7.js → chunk-UWRQXPPG.js} +69 -24
  19. package/dist/{chunk-T5T76SAR.js → chunk-YPGMBSOZ.js} +1209 -274
  20. package/dist/common.d.ts +3 -3
  21. package/dist/common.js +1 -1
  22. package/dist/{data-ESPFZ5IM.js → data-SZDYO55C.js} +7 -5
  23. package/dist/{declaration-RYRBX7PH.js → declaration-GYV6OUR3.js} +5 -3
  24. package/dist/{errors-189T_Mnc.d.ts → errors-kH5eHvNO.d.ts} +1 -1
  25. package/dist/host.d.ts +2 -2
  26. package/dist/host.js +31 -8
  27. package/dist/{overview-AWPXJACF.js → overview-CD6NY3VQ.js} +28 -13
  28. package/dist/{plugin-rRd-zHGt.d.ts → plugin-DG2NDTCT.d.ts} +7 -2
  29. package/dist/plugins.d.ts +1 -7
  30. package/dist/plugins.js +53 -17
  31. package/dist/{queries-FWMX7H5Z.js → queries-BWKWZQMG.js} +70 -17
  32. package/dist/{structure-VFRJFC4C.js → structure-JO4YZHKZ.js} +5 -3
  33. package/dist/{tab-XL2HS5W4.js → tab-QPHE7YUQ.js} +3 -3
  34. package/dist/testing.d.ts +2 -1
  35. package/dist/testing.js +8 -7
  36. package/dist/{menu-Cam-hOdJ.d.ts → theme-FQ_1b569.d.ts} +72 -55
  37. package/dist/{types-N0V9n38H.d.ts → types-BE767W6G.d.ts} +879 -129
  38. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isChanged,
3
3
  queryCounts
4
- } from "./chunk-4TXKXLWK.js";
4
+ } from "./chunk-7I2HXY72.js";
5
5
  import {
6
6
  columnKind
7
7
  } from "./chunk-HI3ZAXJK.js";
@@ -11,11 +11,13 @@ import {
11
11
  declaredFilters,
12
12
  isActive,
13
13
  queryInputs
14
- } from "./chunk-DITKCHFQ.js";
14
+ } from "./chunk-CLXZMA5D.js";
15
15
  import {
16
16
  attributeRequests,
17
17
  stateOf
18
- } from "./chunk-EIPHDMZ7.js";
18
+ } from "./chunk-UWRQXPPG.js";
19
+ import "./chunk-GPBYPSWK.js";
20
+ import "./chunk-HELL45MM.js";
19
21
  import {
20
22
  badge,
21
23
  codeBlock,
@@ -36,7 +38,7 @@ import {
36
38
  stateDot,
37
39
  table,
38
40
  trustIndicator
39
- } from "./chunk-32566ZNE.js";
41
+ } from "./chunk-2TTGSNHA.js";
40
42
  import "./chunk-K633QHGO.js";
41
43
  import {
42
44
  blockNodeKey,
@@ -46,13 +48,15 @@ import {
46
48
  entityNodeKey,
47
49
  formatAgo,
48
50
  formatCondition,
51
+ formatIn,
49
52
  formatTime,
50
53
  plural,
51
54
  usageOf
52
- } from "./chunk-H52PO7MP.js";
55
+ } from "./chunk-33HI2ODM.js";
53
56
  import "./chunk-PKBMQBKP.js";
54
57
 
55
58
  // src/plugins/inspect/tabs/queries.ts
59
+ var NO_CACHE_DURATION = "Neither the query nor the repo sets a cache duration (query.default.cache.duration).";
56
60
  var FIRST = 5;
57
61
  var FILTERS = ["all", "errors", "dirty"];
58
62
  var SOURCE_ICONS = { control: "control", crossFilter: "filter", declared: "code" };
@@ -92,6 +96,9 @@ var CALL_LABELS = {
92
96
  var labelOf = (entry) => CALL_LABELS[entry.call] ?? entry.call;
93
97
  var titleOf = (entry) => entry.call === "core.fieldSuggestions" && entry.field ? entry.field : entry.dataset || labelOf(entry);
94
98
  function summaryOf(entry) {
99
+ return [entry.stamp?.variant, describeCall(entry)].filter(Boolean).join(" \xB7 ");
100
+ }
101
+ function describeCall(entry) {
95
102
  const ended = entry.status !== "ok" && entry.status !== "pending" ? entry.status : void 0;
96
103
  if (entry.call === "core.fieldSuggestions") {
97
104
  return `suggestions for ${entry.field}${entry.q ? ` "${entry.q}"` : ""}${entry.numRows === void 0 ? "" : ` \xB7 ${entry.numRows}`}`;
@@ -103,14 +110,15 @@ function summaryOf(entry) {
103
110
  return [entry.targets?.join(", ") ?? entry.filename ?? (entry.caller === "frame" ? void 0 : entry.caller), ended].filter(Boolean).join(" \xB7 ");
104
111
  }
105
112
  return [
113
+ entry.bustCache ? "refresh" : void 0,
106
114
  entry.fromCache === void 0 ? void 0 : entry.fromCache ? "cache" : "database",
107
- entry.page && entry.page > 1 ? `page ${entry.page}` : void 0,
115
+ (entry.input?.pagination?.page ?? 1) > 1 ? `page ${entry.input?.pagination?.page}` : void 0,
108
116
  entry.status === "ok" ? plural(entry.numRows ?? 0, "row") : ended
109
117
  ].filter(Boolean).join(" \xB7 ");
110
118
  }
111
119
  function inputOf(entry) {
112
- const { input, page, pageSize, timezone, bustCache, dataset, aql, field, q, format, formatOptions, filename, targets, request } = entry;
113
- const shown = entry.call === "core.submitQuery" ? { dataset, page, pageSize, timezone, bustCache, ...input } : entry.call === "export.query" ? { dataset, timezone, format, formatOptions, filename, ...input } : entry.call === "core.fieldSuggestions" ? { dataset, field, q } : entry.call === "lineage.trace" ? { targets } : entry.call === "render.save" ? { filename } : typeof request === "object" && request !== null && !Array.isArray(request) ? request : { request };
120
+ const { input, bustCache, minCachedAt, dataset, aql, field, q, format, formatOptions, filename, targets, request } = entry;
121
+ const shown = entry.call === "core.submitQuery" ? { dataset, bustCache, minCachedAt, ...input } : entry.call === "export.query" ? { dataset, minCachedAt, format, formatOptions, filename, ...input } : entry.call === "core.fieldSuggestions" ? { dataset, field, q } : entry.call === "lineage.trace" ? { targets } : entry.call === "render.save" ? { filename } : typeof request === "object" && request !== null && !Array.isArray(request) ? request : { request };
114
122
  const kept = Object.entries(shown).filter(([, value]) => value !== void 0 && !(Array.isArray(value) && value.length === 0));
115
123
  return kept.length ? JSON.stringify(Object.fromEntries(kept), null, 2) : aql;
116
124
  }
@@ -210,6 +218,23 @@ function queriesTab(root, context) {
210
218
  })
211
219
  ), { class: "inline" });
212
220
  }
221
+ function cacheLine(cache, refreshed) {
222
+ if (!cache) return h(doc, "span", { class: "muted", "data-tip": NO_CACHE_DURATION }, "Not used");
223
+ if (cache.warning) return h(doc, "span", { class: cache.warning.code === "cache_disabled" ? "muted" : "tone-warn" }, `Not used: ${cache.warning.message}`);
224
+ const { key, cachedAt, expiresAt } = cache;
225
+ const parts = [
226
+ cache.hit ? "Hit" : refreshed ? "Refreshed" : "Miss",
227
+ cachedAt ? h(doc, "span", { "data-tip": formatTime(cachedAt) }, `read ${formatAgo(cachedAt)}`) : "not cached",
228
+ expiresAt && h(doc, "span", { "data-tip": formatTime(expiresAt) }, `expires ${formatIn(expiresAt)}`)
229
+ ].filter(Boolean);
230
+ return h(
231
+ doc,
232
+ "span",
233
+ { "data-testid": "cache" },
234
+ parts.flatMap((part, i) => i === 0 ? [part] : [" \xB7 ", part]),
235
+ key && copyIcon(doc, "Copy the cache key", () => key, { "data-testid": "copy-cache-key" })
236
+ );
237
+ }
213
238
  function mapsTo(key, app, targets, empty) {
214
239
  if (targets.length === 0) return empty;
215
240
  return collapsible(doc, key, queriesText(targets.length), () => h(doc, "ul", { class: "places" }, targets.map((target) => h(
@@ -234,7 +259,7 @@ function queriesTab(root, context) {
234
259
  items.length > FIRST && link(doc, all ? "Show fewer" : `Show all ${items.length}`, () => toggle(allRequests, scope), { "data-testid": "requests-more" })
235
260
  ];
236
261
  }
237
- function requestRow(scope, { entry, shared }, card) {
262
+ function requestRow(scope, { entry }, card) {
238
263
  const dot = h(doc, "span", { class: `dot ${entry.status}`, role: "img", "aria-label": `Status: ${entry.status}`, "data-tip": entry.status });
239
264
  const summary = card ? h(
240
265
  doc,
@@ -257,20 +282,23 @@ function queriesTab(root, context) {
257
282
  dot,
258
283
  h(doc, "span", { class: "time" }, formatTime(entry.at)),
259
284
  h(doc, "span", { class: "condition" }, summaryOf(entry)),
260
- shared && h(doc, "span", { ...badge(), "data-tip": "Another query declares the same dataset and AQL" }, "shared"),
261
285
  h(doc, "span", { class: "spacer" }),
262
286
  h(doc, "span", { class: "rows" }, entry.durationMs === void 0 ? "\u2026" : `${entry.durationMs} ms`)
263
287
  );
264
288
  const details = collapsible(doc, `${scope}:request:${entry.id}`, summary, () => [
265
289
  card ? fields(doc, [
266
290
  ["Type", labelOf(entry)],
291
+ (entry.call === "core.submitQuery" || entry.call === "export.query") && entry.status === "ok" && ["Cache", cacheLine(entry.cache, entry.bustCache)],
267
292
  ["Call", entry.call],
268
293
  !!entry.dataset && ["Dataset", entry.dataset],
269
294
  ["Caller", entry.caller],
270
295
  !!entry.trace && ["Middleware", entry.trace.join(" \u2192 ")],
271
296
  ["Sent at", formatTime(entry.at)],
272
297
  ["Duration", entry.durationMs === void 0 ? "Still running" : `${entry.durationMs} ms`]
273
- ]) : entry.error && h(doc, "p", { class: "error-text" }, entry.error),
298
+ ]) : [
299
+ entry.error && h(doc, "p", { class: "error-text" }, entry.error),
300
+ (entry.call === "core.submitQuery" || entry.call === "export.query") && entry.status === "ok" && fields(doc, [["Cache", cacheLine(entry.cache, entry.bustCache)]])
301
+ ],
274
302
  entry.preview && entry.columns && [
275
303
  h(doc, "p", { class: "preview-count" }, rowCount(entry.preview.length, entry.numRows)),
276
304
  entry.preview.length > 0 && table(doc, entry.columns, entry.preview, { "data-testid": "request-preview" })
@@ -370,7 +398,7 @@ function queriesTab(root, context) {
370
398
  { class: "rows", "data-tip": query.state === "success" ? plural(query.rowCount, "row") : "No rows yet" },
371
399
  query.state === "success" ? query.rowCount.toLocaleString() : "\u2014"
372
400
  ),
373
- query.isDirty ? h(doc, "span", { ...badge("warn") }, "dirty") : query.debug?.fromCache && h(doc, "span", { ...badge() }, "cache"),
401
+ query.isDirty ? h(doc, "span", { ...badge("warn") }, "dirty") : query.debug?.fromCache ? h(doc, "span", { ...badge() }, "cache") : query.debug?.cache?.warning && query.debug.cache.warning.code !== "cache_disabled" && h(doc, "span", { ...badge("warn"), "data-tip": query.debug.cache.warning.message }, "no cache"),
374
402
  h(doc, "span", { class: "spacer" }),
375
403
  filterIndicator(doc, active),
376
404
  hasLineage && lineageButton(doc, panel, marker),
@@ -381,7 +409,7 @@ function queriesTab(root, context) {
381
409
  query.error && h(doc, "span", { class: "error-text", role: "alert", "data-testid": "query-error" }, errorText(query.error))
382
410
  );
383
411
  return entityRow(key, summary, () => {
384
- const latest = requests.find(({ entry, shared }) => !shared && entry.call === "core.submitQuery" && entry.status !== "pending")?.entry;
412
+ const latest = requests.find(({ entry }) => entry.call === "core.submitQuery" && !entry.stamp?.variant && entry.status !== "pending")?.entry;
385
413
  const notRun = query.state === "success" || query.state === "error" ? "Not returned." : "Not run yet.";
386
414
  const lastRun = [
387
415
  query.debug && (query.debug.fromCache ? "cache" : "database"),
@@ -393,6 +421,7 @@ function queriesTab(root, context) {
393
421
  fields(doc, [
394
422
  ["Dataset", declaration?.dataset || h(doc, "span", { class: "muted" }, "none declared")],
395
423
  !!lastRun && ["Last run", lastRun],
424
+ !!query.debug && ["Cache", cacheLine(query.debug.cache, latest?.bustCache)],
396
425
  ["On the page", drawn(structure, "query", index, name)],
397
426
  ["Cross-filters", mapsTo(`${key}:cross`, index, crossFilterTargets(app, name), h(doc, "span", { class: "muted" }, "No query"))],
398
427
  query.selectedRowCount > 0 && ["Selected", plural(query.selectedRowCount, "row")],
@@ -486,7 +515,21 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
486
515
  ])
487
516
  );
488
517
  }
489
- function appSection(app, index, several, byQuery, structure) {
518
+ function removedRow(index, name, requests) {
519
+ const key = `removed:${index}/${name}`;
520
+ const summary = h(
521
+ doc,
522
+ "span",
523
+ { class: "line" },
524
+ h(doc, "span", { class: "name" }, name),
525
+ h(doc, "span", { ...badge(), "data-tip": "The app removed this query; these are the requests it made" }, "removed"),
526
+ h(doc, "span", { class: "spacer" }),
527
+ h(doc, "span", { class: "rows" }, plural(requests.length, "request"))
528
+ );
529
+ return entityRow(key, summary, () => requestList(key, requests, false));
530
+ }
531
+ function appSection(app, index, several, byQuery, removed, structure) {
532
+ const gone = removed.filter((ref) => ref.app === index);
490
533
  const search = view.search.trim();
491
534
  const filtering = search !== "" || view.filter !== "all";
492
535
  const queries = Object.entries(app.queries);
@@ -504,7 +547,7 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
504
547
  "p",
505
548
  { class: "app-line", "data-testid": "app-line" },
506
549
  several && h(doc, "strong", {}, `App ${index + 1} \xB7 `),
507
- `${app.title || "Untitled"} \xB7 ${app.timezone || "tenant timezone"} \xB7 `,
550
+ `${app.title || "Untitled"} \xB7 ${app.queryInput?.timezone ?? (app.timezone || "tenant timezone")} \xB7 `,
508
551
  app.hasChanges ? h(doc, "span", { class: "tone-warn" }, "unapplied changes") : "no unapplied changes"
509
552
  ),
510
553
  section(
@@ -533,6 +576,16 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
533
576
  void 0,
534
577
  "None.",
535
578
  () => selections.map(([label, selection]) => selectionCard(label, selection))
579
+ ),
580
+ // Not filtered: what a removed query asked is history, kept until the log drops it.
581
+ view.filter === "all" && gone.length > 0 && section(
582
+ "removed",
583
+ index,
584
+ "Removed queries",
585
+ gone.length,
586
+ void 0,
587
+ "None.",
588
+ () => gone.map((query) => removedRow(index, query.name, query.requests))
536
589
  )
537
590
  );
538
591
  }
@@ -579,9 +632,9 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
579
632
  });
580
633
  if (!snapshot) return note(doc, "Waiting for the Data App\u2026", { "data-testid": "inspect-waiting" });
581
634
  if (!snapshot.apps.length) return note(doc, "This Data App hasn't created an SDK app.", { "data-testid": "queries-no-app" });
582
- const { byQuery, other } = attributeRequests(state.requests.entries(), snapshot.apps);
635
+ const { byQuery, other, removed } = attributeRequests(state.requests.entries(), snapshot.apps);
583
636
  return [
584
- snapshot.apps.map((app, index) => appSection(app, index, snapshot.apps.length > 1, byQuery, snapshot.structure)),
637
+ snapshot.apps.map((app, index) => appSection(app, index, snapshot.apps.length > 1, byQuery, removed, snapshot.structure)),
585
638
  // At the end, so nothing the frame asked is hidden.
586
639
  other.length > 0 && section(
587
640
  "other",
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  stateOf
3
- } from "./chunk-EIPHDMZ7.js";
3
+ } from "./chunk-UWRQXPPG.js";
4
+ import "./chunk-GPBYPSWK.js";
5
+ import "./chunk-HELL45MM.js";
4
6
  import {
5
7
  badge,
6
8
  control,
@@ -12,7 +14,7 @@ import {
12
14
  link,
13
15
  note,
14
16
  replace
15
- } from "./chunk-32566ZNE.js";
17
+ } from "./chunk-2TTGSNHA.js";
16
18
  import {
17
19
  LINEAGE_TAB,
18
20
  attributeFor,
@@ -20,7 +22,7 @@ import {
20
22
  findNode,
21
23
  handleFor,
22
24
  plural
23
- } from "./chunk-H52PO7MP.js";
25
+ } from "./chunk-33HI2ODM.js";
24
26
  import "./chunk-PKBMQBKP.js";
25
27
 
26
28
  // src/plugins/inspect/tabs/structure.ts
@@ -6,7 +6,7 @@ import {
6
6
  popover,
7
7
  replace,
8
8
  tooltips
9
- } from "./chunk-32566ZNE.js";
9
+ } from "./chunk-2TTGSNHA.js";
10
10
  import {
11
11
  LINEAGE_KINDS,
12
12
  LINEAGE_PRESETS,
@@ -21,11 +21,11 @@ import {
21
21
  showsCrossFilters,
22
22
  stateOf,
23
23
  traceKey
24
- } from "./chunk-GBXK7F2V.js";
24
+ } from "./chunk-D7DIJRAC.js";
25
25
  import "./chunk-K633QHGO.js";
26
26
  import {
27
27
  findNode
28
- } from "./chunk-H52PO7MP.js";
28
+ } from "./chunk-33HI2ODM.js";
29
29
  import "./chunk-PKBMQBKP.js";
30
30
 
31
31
  // src/plugins/lineage/layout.ts
package/dist/testing.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PluginInfo } from './app.js';
2
2
  import { User, DatasetDescriptor } from './app.js';
3
3
  import { Sdk, PluginSetup } from './app.js';
4
- import './errors-189T_Mnc.js';
4
+ import './errors-kH5eHvNO.js';
5
5
 
6
6
  /** The reader a test frame is provisioned with unless given. */
7
7
  declare const TEST_READER: User;
@@ -27,6 +27,7 @@ interface TestFrame {
27
27
  calls: {
28
28
  name: string;
29
29
  request: unknown;
30
+ stamp?: unknown;
30
31
  }[];
31
32
  /** The frame's events, in order. */
32
33
  events: {
package/dist/testing.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  bootstrap
3
- } from "./chunk-T5T76SAR.js";
3
+ } from "./chunk-YPGMBSOZ.js";
4
4
  import "./chunk-XIUFHRZE.js";
5
- import {
6
- createEndpoint
7
- } from "./chunk-SXKJQU7A.js";
5
+ import "./chunk-4UEESYHH.js";
8
6
  import {
9
7
  PROVISION_ELEMENT_ID
10
8
  } from "./chunk-RXPNL7UR.js";
11
- import "./chunk-FTTVLHNN.js";
9
+ import "./chunk-EOFPMSND.js";
10
+ import {
11
+ createEndpoint
12
+ } from "./chunk-GPBYPSWK.js";
12
13
  import "./chunk-HELL45MM.js";
13
14
  import "./chunk-PKBMQBKP.js";
14
15
 
@@ -47,8 +48,8 @@ function testFrame(options = {}) {
47
48
  queueMicrotask(() => frameListeners.forEach((listener) => listener({ source: parent, data: message })));
48
49
  };
49
50
  const host = createEndpoint(toFrame, {
50
- answer: async (name, request, signal) => {
51
- calls.push({ name, request });
51
+ answer: async (name, request, signal, stamp) => {
52
+ calls.push({ name, request, ...stamp !== void 0 ? { stamp } : {} });
52
53
  if (name === "anfra.body") {
53
54
  const plugin = request.plugin;
54
55
  if (!options.bodies || !(plugin in options.bodies)) throw new Error(`No body for '${plugin}'.`);
@@ -1,4 +1,72 @@
1
- import { D as DatasetDescriptor, ak as User, ai as StructureNode, ab as Row, af as SelectionCondition } from './types-N0V9n38H.js';
1
+ import { ap as Row, au as SelectionCondition, az as StructureNode, a as Annotation, ah as QueryStamp, D as DatasetDescriptor, aB as User } from './types-BE767W6G.js';
2
+
3
+ /**
4
+ * What a menu on a Data App's content is about: a marked node of the page (a right-click on a
5
+ * block), or some of a query's result rows (a right-click on a chart's point, which the definition
6
+ * reports with `query.menu`). Built in the frame, and checked by the host, which trusts nothing the
7
+ * frame sends.
8
+ */
9
+
10
+ /** A box in the frame's viewport. */
11
+ interface TargetRect {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }
17
+ /** A point in the frame's viewport. */
18
+ interface TargetPoint {
19
+ x: number;
20
+ y: number;
21
+ }
22
+ /** A marked node, as the structure has it, its ancestors outermost first (both without children's children), and where it is. */
23
+ interface NodeTarget {
24
+ kind: 'node';
25
+ node: StructureNode;
26
+ ancestors: StructureNode[];
27
+ rect: TargetRect;
28
+ }
29
+ /**
30
+ * Rows of a query's result: the query, by its app's index and name; the rows as the definition
31
+ * passed them; the dimensions that took part; the measure the point belongs to, when the
32
+ * definition said; and the conditions they make, derived as a cross-filter's are (an AQL
33
+ * `expression` when per-field conditions would admit more rows). With the node the rows are drawn
34
+ * in, when the event was inside one.
35
+ */
36
+ interface RowsTarget {
37
+ kind: 'rows';
38
+ app: number;
39
+ query: string;
40
+ rows: Row[];
41
+ fields: string[];
42
+ /** The result column of the measure the point shows: a chart's series. */
43
+ measure?: string;
44
+ conditions: SelectionCondition[];
45
+ expression?: string;
46
+ node?: NodeTarget;
47
+ /**
48
+ * Where the gesture that opened it was, a point in the frame's viewport: the right-click's for
49
+ * `query.menu`, the badge's when an item runs from the annotations badge's popover. A plugin
50
+ * anchors a popover about the rows there.
51
+ */
52
+ at?: TargetPoint;
53
+ /**
54
+ * The annotations plugins set on these rows, for the frame's items only (a plugin's `when` on
55
+ * them, say): the host never gets them.
56
+ */
57
+ annotations?: Annotation[];
58
+ }
59
+ type MenuTarget = NodeTarget | RowsTarget;
60
+ type MenuTargetKind = MenuTarget['kind'];
61
+ /** One entry of a menu, as the host answers it for a target. */
62
+ interface MenuEntry {
63
+ id: string;
64
+ label: string;
65
+ /** Why it can't run: shown, and the entry can't be picked. */
66
+ disabled?: string;
67
+ }
68
+ /** A target as the frame sends it, or undefined when it isn't one: of its shape only, never trusted further. */
69
+ declare function checkTarget(value: unknown): MenuTarget | undefined;
2
70
 
3
71
  /**
4
72
  * The bridge: the postMessage protocol between a Data App's frame (`app`'s bootstrap) and the
@@ -55,6 +123,7 @@ type BridgeMessage =
55
123
  id: number;
56
124
  name: string;
57
125
  request: unknown;
126
+ stamp?: QueryStamp;
58
127
  } | {
59
128
  type: 'anfra:result';
60
129
  id: number;
@@ -129,57 +198,5 @@ declare function designTheme(scheme: ThemeScheme, style: Pick<CSSStyleDeclaratio
129
198
  */
130
199
  declare function resolveTheme(input: unknown): Theme;
131
200
 
132
- /**
133
- * What a menu on a Data App's content is about: a marked node of the page (a right-click on a
134
- * block), or some of a query's result rows (a right-click on a chart's point, which the definition
135
- * reports with `query.menu`). Built in the frame, and checked by the host, which trusts nothing the
136
- * frame sends.
137
- */
138
-
139
- /** A box in the frame's viewport. */
140
- interface TargetRect {
141
- x: number;
142
- y: number;
143
- width: number;
144
- height: number;
145
- }
146
- /** A marked node, as the structure has it, its ancestors outermost first (both without children's children), and where it is. */
147
- interface NodeTarget {
148
- kind: 'node';
149
- node: StructureNode;
150
- ancestors: StructureNode[];
151
- rect: TargetRect;
152
- }
153
- /**
154
- * Rows of a query's result: the query, by its app's index and name; the rows as the definition
155
- * passed them; the dimensions that took part; the measure the point belongs to, when the
156
- * definition said; and the conditions they make, derived as a cross-filter's are (an AQL
157
- * `expression` when per-field conditions would admit more rows). With the node the rows are drawn
158
- * in, when the event was inside one.
159
- */
160
- interface RowsTarget {
161
- kind: 'rows';
162
- app: number;
163
- query: string;
164
- rows: Row[];
165
- fields: string[];
166
- /** The result column of the measure the point shows: a chart's series. */
167
- measure?: string;
168
- conditions: SelectionCondition[];
169
- expression?: string;
170
- node?: NodeTarget;
171
- }
172
- type MenuTarget = NodeTarget | RowsTarget;
173
- type MenuTargetKind = MenuTarget['kind'];
174
- /** One entry of a menu, as the host answers it for a target. */
175
- interface MenuEntry {
176
- id: string;
177
- label: string;
178
- /** Why it can't run: shown, and the entry can't be picked. */
179
- disabled?: string;
180
- }
181
- /** A target as the frame sends it, or undefined when it isn't one: of its shape only, never trusted further. */
182
- declare function checkTarget(value: unknown): MenuTarget | undefined;
183
-
184
- export { DEFAULT_TOKENS as D, PROVISION_ELEMENT_ID as P, THEME_TOKENS as T, DESIGN_TOKENS as b, checkTarget as m, designTheme as n, resolveTheme as r };
185
- export type { BridgeError as B, FrameMessage as F, HostMessage as H, MenuEntry as M, NodeTarget as N, RowsTarget as R, BridgeMessage as a, MenuTarget as c, MenuTargetKind as d, PluginInfo as e, Provision as f, TargetRect as g, Theme as h, ThemeInput as i, ThemeScheme as j, ThemeToken as k, ThemeTokens as l };
201
+ export { DEFAULT_TOKENS as D, PROVISION_ELEMENT_ID as P, THEME_TOKENS as T, DESIGN_TOKENS as b, checkTarget as n, designTheme as o, resolveTheme as r };
202
+ export type { BridgeError as B, FrameMessage as F, HostMessage as H, MenuEntry as M, NodeTarget as N, RowsTarget as R, BridgeMessage as a, MenuTarget as c, MenuTargetKind as d, PluginInfo as e, Provision as f, TargetPoint as g, TargetRect as h, Theme as i, ThemeInput as j, ThemeScheme as k, ThemeToken as l, ThemeTokens as m };