@holistics/anfra-sdk 0.16.0 → 0.17.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 +2 -1
  2. package/dist/ambient.d.ts +2 -1
  3. package/dist/api.d.ts +11 -5
  4. package/dist/api.js +40 -30
  5. package/dist/app.d.ts +5 -5
  6. package/dist/app.js +22 -12
  7. package/dist/{bootstrap-hLhpijIb.d.ts → bootstrap-q1J7GUxa.d.ts} +55 -18
  8. package/dist/build.d.ts +2 -2
  9. package/dist/chunk-32566ZNE.js +1278 -0
  10. package/dist/{chunk-S6XLP6U4.js → chunk-3ZWUCECU.js} +45 -20
  11. package/dist/{chunk-THYCARLT.js → chunk-6GBHCW5E.js} +102 -30
  12. package/dist/{chunk-KFD6CHLI.js → chunk-ACKFOANJ.js} +2 -0
  13. package/dist/{chunk-CYZQ7ZTJ.js → chunk-C26OVN2S.js} +6 -1
  14. package/dist/{chunk-PTNYQOEY.js → chunk-EL7CAVZ3.js} +1 -1
  15. package/dist/{chunk-SKSKC747.js → chunk-J5BTCP6T.js} +1 -1
  16. package/dist/chunk-SWNVCTT6.js +161 -0
  17. package/dist/common.d.ts +3 -3
  18. package/dist/common.js +19 -9
  19. package/dist/{data-BGX3V42T.js → data-TDUQTG3P.js} +8 -6
  20. package/dist/{declaration-ZL5B676C.js → declaration-RJFU4ZLJ.js} +2 -2
  21. package/dist/errors-IhdhKO-6.d.ts +119 -0
  22. package/dist/host.d.ts +2 -2
  23. package/dist/host.js +17 -17
  24. package/dist/{menu-BFLb7dVq.d.ts → menu-CRAFaQ8s.d.ts} +21 -5
  25. package/dist/{overview-7YU7JW6Q.js → overview-RV2IV6PJ.js} +23 -23
  26. package/dist/{plugin-B7SpJLBm.d.ts → plugin-BdLabbah.d.ts} +2 -2
  27. package/dist/plugins.d.ts +11 -2
  28. package/dist/plugins.js +38 -21
  29. package/dist/{queries-QFN4DI25.js → queries-5TTPOB7R.js} +32 -30
  30. package/dist/{structure-Z2QK5MGH.js → structure-MTLCRTJ4.js} +11 -9
  31. package/dist/{tab-LSITVMKV.js → tab-XL2HS5W4.js} +20 -18
  32. package/dist/testing.d.ts +1 -1
  33. package/dist/testing.js +4 -4
  34. package/dist/{types-CKytl8ds.d.ts → types-C_i7V0DA.d.ts} +46 -14
  35. package/package.json +2 -1
  36. package/dist/chunk-F6B3EGFV.js +0 -750
  37. package/dist/chunk-KCTLO3CO.js +0 -41
  38. package/dist/errors-CKvqVaqU.d.ts +0 -30
@@ -15,11 +15,13 @@ import {
15
15
  import {
16
16
  attributeRequests,
17
17
  stateOf
18
- } from "./chunk-CYZQ7ZTJ.js";
18
+ } from "./chunk-C26OVN2S.js";
19
19
  import {
20
+ badge,
20
21
  codeBlock,
21
22
  collapsible,
22
23
  columnIcon,
24
+ control,
23
25
  copyIcon,
24
26
  drawTab,
25
27
  fields,
@@ -34,7 +36,7 @@ import {
34
36
  stateDot,
35
37
  table,
36
38
  trustIndicator
37
- } from "./chunk-F6B3EGFV.js";
39
+ } from "./chunk-32566ZNE.js";
38
40
  import "./chunk-K633QHGO.js";
39
41
  import {
40
42
  blockNodeKey,
@@ -61,14 +63,14 @@ function showQuery(view, app, name, query) {
61
63
  if (view.filter === "dirty" && !query.isDirty) return false;
62
64
  return matches(view.search.trim().toLowerCase(), name, app.declaration.queries[name]?.dataset);
63
65
  }
64
- function showControl(view, app, name, control) {
66
+ function showControl(view, app, name, control2) {
65
67
  if (view.filter === "errors") return false;
66
- if (view.filter === "dirty" && !control.isDirty) return false;
68
+ if (view.filter === "dirty" && !control2.isDirty) return false;
67
69
  const declaration = app.declaration.filters[name] ?? app.declaration.dateDrills[name];
68
70
  const field = declaration && "field" in declaration ? declaration.field : void 0;
69
71
  return matches(view.search.trim().toLowerCase(), name, declaration?.label, field);
70
72
  }
71
- var errorText = (error) => `${error.name}${error.status !== void 0 ? ` (${error.status})` : ""}: ${error.message}`;
73
+ var errorText = (error) => `${error.code} (${error.scope}${error.status !== void 0 ? `, ${error.status}` : ""}): ${error.message}`;
72
74
  var queriesText = (n) => n === 1 ? "1 query" : `${n} queries`;
73
75
  function signatureSource(signature) {
74
76
  const source = { label: "Signature", code: signature, empty: "No signature." };
@@ -140,7 +142,7 @@ function queriesTab(root, context) {
140
142
  };
141
143
  const iconButton = (name, label, onclick, attributes = {}) => h(doc, "button", {
142
144
  type: "button",
143
- class: "row-action",
145
+ ...control("row-action"),
144
146
  "data-tip": label,
145
147
  "aria-label": label,
146
148
  ...attributes,
@@ -255,7 +257,7 @@ function queriesTab(root, context) {
255
257
  dot,
256
258
  h(doc, "span", { class: "time" }, formatTime(entry.at)),
257
259
  h(doc, "span", { class: "condition" }, summaryOf(entry)),
258
- shared && h(doc, "span", { class: "pill", "data-tip": "Another query declares the same dataset and AQL" }, "shared"),
260
+ shared && h(doc, "span", { ...badge(), "data-tip": "Another query declares the same dataset and AQL" }, "shared"),
259
261
  h(doc, "span", { class: "spacer" }),
260
262
  h(doc, "span", { class: "rows" }, entry.durationMs === void 0 ? "\u2026" : `${entry.durationMs} ms`)
261
263
  );
@@ -289,9 +291,9 @@ function queriesTab(root, context) {
289
291
  return collapsible(doc, `${key}:column:${column.name}`, [
290
292
  h(doc, "span", { class: "type", "aria-hidden": "true" }, columnIcon(doc, column)),
291
293
  h(doc, "span", { class: "name", "data-tip": columnKind(column) }, column.name),
292
- column.adhoc && h(doc, "span", { class: "pill warn" }, "ad hoc"),
294
+ column.adhoc && h(doc, "span", { ...badge("warn") }, "ad hoc"),
293
295
  h(doc, "span", { class: "spacer" }),
294
- unlabelled ? h(doc, "span", { class: "pill warn" }, "no label") : h(doc, "span", { class: "label" }, column.label)
296
+ unlabelled ? h(doc, "span", { ...badge("warn") }, "no label") : h(doc, "span", { class: "label" }, column.label)
295
297
  ], () => fields(doc, [
296
298
  ["Label", column.label || h(doc, "span", { class: "muted" }, "None")],
297
299
  ["Type", columnKind(column)],
@@ -320,9 +322,9 @@ function queriesTab(root, context) {
320
322
  h(
321
323
  doc,
322
324
  "span",
323
- { class: "segments small", role: "group", "aria-label": "Which filters" },
324
- h(doc, "button", { type: "button", "aria-pressed": String(!all), "data-testid": "filters-active", onclick: choose(false) }, `Active (${active.length})`),
325
- h(doc, "button", { type: "button", "aria-pressed": String(all), "data-testid": "filters-all", onclick: choose(true) }, `All (${filters.length})`)
325
+ { class: "a-tabs segments", "data-size": "sm", role: "group", "aria-label": "Which filters" },
326
+ h(doc, "button", { type: "button", class: "a-tab", "aria-pressed": String(!all), "data-testid": "filters-active", onclick: choose(false) }, `Active (${active.length})`),
327
+ h(doc, "button", { type: "button", class: "a-tab", "aria-pressed": String(all), "data-testid": "filters-all", onclick: choose(true) }, `All (${filters.length})`)
326
328
  )
327
329
  ],
328
330
  () => shown.length === 0 ? h(doc, "p", { class: "muted" }, "No active filters.") : h(doc, "ul", { class: "list filters", "data-testid": "filter-list" }, shown.map((input2) => h(
@@ -368,7 +370,7 @@ function queriesTab(root, context) {
368
370
  { class: "rows", "data-tip": query.state === "success" ? plural(query.rowCount, "row") : "No rows yet" },
369
371
  query.state === "success" ? query.rowCount.toLocaleString() : "\u2014"
370
372
  ),
371
- query.isDirty ? h(doc, "span", { class: "pill warn" }, "dirty") : query.debug?.fromCache && h(doc, "span", { class: "pill" }, "cache"),
373
+ query.isDirty ? h(doc, "span", { ...badge("warn") }, "dirty") : query.debug?.fromCache && h(doc, "span", { ...badge() }, "cache"),
372
374
  h(doc, "span", { class: "spacer" }),
373
375
  filterIndicator(doc, active),
374
376
  hasLineage && lineageButton(doc, panel, marker),
@@ -423,23 +425,23 @@ function queriesTab(root, context) {
423
425
  ];
424
426
  });
425
427
  }
426
- function controlRow(app, index, name, control, structure) {
428
+ function controlRow(app, index, name, control2, structure) {
427
429
  const key = entityKey("control", index, name);
428
430
  const declaration = app.declaration.filters[name] ?? app.declaration.dateDrills[name];
429
431
  const filter = declaration && "field" in declaration ? declaration : void 0;
430
432
  const targets = controlTargets(app, name);
431
433
  const fixed = filter?.options;
432
- const options = fixed ?? control.options;
434
+ const options = fixed ?? control2.options;
433
435
  const fallback = declaration?.default;
434
436
  const summary = h(
435
437
  doc,
436
438
  "span",
437
439
  { class: "line" },
438
440
  h(doc, "span", { class: "name" }, name),
439
- h(doc, "span", { class: "condition" }, control.condition.values?.length ? formatCondition(control.condition) : ""),
440
- control.isDirty && h(doc, "span", { class: "pill warn" }, "unapplied"),
441
+ h(doc, "span", { class: "condition" }, control2.condition.values?.length ? formatCondition(control2.condition) : ""),
442
+ control2.isDirty && h(doc, "span", { ...badge("warn") }, "unapplied"),
441
443
  h(doc, "span", { class: "spacer" }),
442
- isChanged(app, name, control) && h(doc, "span", { class: "changed", role: "img", "aria-label": "Changed from the default", "data-tip": "Changed from the default value" }, "M"),
444
+ isChanged(app, name, control2) && h(doc, "span", { class: "changed", role: "img", "aria-label": "Changed from the default", "data-tip": "Changed from the default value" }, "M"),
443
445
  h(doc, "span", {
444
446
  class: "indicator targets",
445
447
  "data-tip": targets.length ? `Applies to ${queriesText(targets.length)}
@@ -448,18 +450,18 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
448
450
  );
449
451
  return entityRow(key, summary, () => fields(doc, [
450
452
  ["Kind", [
451
- control.kind === "dateDrill" ? "Date drill" : "Filter",
453
+ control2.kind === "dateDrill" ? "Date drill" : "Filter",
452
454
  filter?.field && h(doc, "span", { class: "muted" }, ` on ${filter.field}`),
453
455
  filter?.type && h(doc, "span", { class: "muted" }, ` \xB7 ${filter.type}`)
454
456
  ]],
455
457
  !!declaration?.label && ["Label", declaration.label],
456
- ["Set to", formatCondition(control.condition)],
457
- ["Applied", formatCondition(control.appliedCondition)],
458
+ ["Set to", formatCondition(control2.condition)],
459
+ ["Applied", formatCondition(control2.appliedCondition)],
458
460
  !!fallback && ["Default", typeof fallback === "string" ? fallback : formatCondition(fallback)],
459
461
  options ? ["Options", collapsible(doc, `${key}:options`, `${options.length} ${fixed ? "fixed" : "loaded"}`, () => {
460
- const selected = control.condition.values?.map(String) ?? [];
462
+ const selected = control2.condition.values?.map(String) ?? [];
461
463
  return h(doc, "ul", { class: "chips" }, options.map((option) => h(doc, "li", { class: selected.includes(String(option)) ? "selected" : void 0 }, String(option))));
462
- }, { class: "inline" })] : control.kind === "filter" && ["Options", h(doc, "span", { class: "muted" }, "Not loaded")],
464
+ }, { class: "inline" })] : control2.kind === "filter" && ["Options", h(doc, "span", { class: "muted" }, "Not loaded")],
463
465
  ["Maps to", mapsTo(`${key}:maps`, index, targets, h(doc, "span", { class: "tone-warn" }, "No query, so it has no effect"))],
464
466
  ["On the page", drawn(structure, "control", index, name)]
465
467
  ]));
@@ -469,7 +471,7 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
469
471
  doc,
470
472
  "div",
471
473
  { class: "card", "data-testid": `selection-${label.toLowerCase()}` },
472
- h(doc, "header", {}, h(doc, "strong", {}, label), selection.lossy && h(doc, "span", { class: "pill warn" }, "lossy")),
474
+ h(doc, "header", {}, h(doc, "strong", {}, label), selection.lossy && h(doc, "span", { ...badge("warn") }, "lossy")),
473
475
  selection.lossy && h(
474
476
  doc,
475
477
  "p",
@@ -490,7 +492,7 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
490
492
  const queries = Object.entries(app.queries);
491
493
  const controls = Object.entries(app.controls);
492
494
  const shownQueries = queries.filter(([name, query]) => showQuery(view, app, name, query));
493
- const shownControls = controls.filter(([name, control]) => showControl(view, app, name, control));
495
+ const shownControls = controls.filter(([name, control2]) => showControl(view, app, name, control2));
494
496
  const none = (what) => search ? `No ${what} match "${search}".` : `No ${what} match the filter.`;
495
497
  const selections = [["Current", app.selection], ["Applied", app.appliedSelection]].filter(([, selection]) => selection);
496
498
  return h(
@@ -521,7 +523,7 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
521
523
  controls.length,
522
524
  filtering ? shownControls.length : void 0,
523
525
  view.filter === "errors" ? "Controls have no error state." : filtering ? none("controls") : "This app declares no controls.",
524
- () => shownControls.map(([name, control]) => controlRow(app, index, name, control, structure))
526
+ () => shownControls.map(([name, control2]) => controlRow(app, index, name, control2, structure))
525
527
  ),
526
528
  selections.length > 0 && section(
527
529
  "selection",
@@ -551,6 +553,7 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
551
553
  });
552
554
  const buttons = FILTERS.map((filter) => h(doc, "button", {
553
555
  type: "button",
556
+ class: "a-tab",
554
557
  "data-testid": `queries-filter-${filter}`,
555
558
  onclick: () => {
556
559
  view.filter = filter;
@@ -561,8 +564,8 @@ ${targets.map((t) => `${t.query} on ${t.field}`).join("\n")}` : "Applies to no q
561
564
  doc,
562
565
  "div",
563
566
  { class: "toolbar" },
564
- h(doc, "label", { class: "search" }, icon(doc, "search"), input),
565
- h(doc, "div", { class: "segments", role: "group", "aria-label": "Filter" }, buttons)
567
+ h(doc, "label", { class: "a-input search" }, icon(doc, "search"), input),
568
+ h(doc, "div", { class: "a-tabs segments", role: "group", "aria-label": "Filter" }, buttons)
566
569
  );
567
570
  const tab = drawTab(root, context, () => {
568
571
  const snapshot = panel.snapshot;
@@ -647,9 +650,8 @@ var CSS = `
647
650
  .filters .field { font-weight: 500; overflow-wrap: anywhere; }
648
651
  .filters .value { overflow-wrap: anywhere; }
649
652
  .filters .source { text-align: right; }
650
- .filters .link { padding: 0; font-size: 12px; }
653
+
651
654
  .pending { color: var(--warn); font-size: 12px; }
652
- .segments.small button { padding: 1px 8px; }
653
655
  .sub > summary .segments { margin: -2px 0; }
654
656
  .requests > .row + .row { margin-top: 6px; }
655
657
  .request > summary { min-height: 36px; padding: 4px 8px 4px 10px; }
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  stateOf
3
- } from "./chunk-CYZQ7ZTJ.js";
3
+ } from "./chunk-C26OVN2S.js";
4
4
  import {
5
+ badge,
6
+ control,
5
7
  copyIcon,
6
8
  drawTab,
7
9
  fields,
@@ -10,7 +12,7 @@ import {
10
12
  link,
11
13
  note,
12
14
  replace
13
- } from "./chunk-F6B3EGFV.js";
15
+ } from "./chunk-32566ZNE.js";
14
16
  import {
15
17
  LINEAGE_TAB,
16
18
  attributeFor,
@@ -102,7 +104,7 @@ function structureTab(root, context) {
102
104
  },
103
105
  node.children.length ? h(doc, "button", {
104
106
  type: "button",
105
- class: `row-action twist${open ? " open" : ""}`,
107
+ ...control("row-action", `twist${open ? " open" : ""}`),
106
108
  "aria-label": open ? "Collapse" : "Expand",
107
109
  tabindex: "-1",
108
110
  onclick: (event) => {
@@ -115,14 +117,14 @@ function structureTab(root, context) {
115
117
  h(doc, "span", { class: `kind ${node.kind}` }, node.kind),
116
118
  id && h(doc, "span", { class: "name" }, id),
117
119
  node.label && node.label !== id && h(doc, "span", { class: "label" }, node.label),
118
- node.problems.length > 0 && h(doc, "span", { class: "pill error", "aria-label": "Problems" }, "!"),
120
+ node.problems.length > 0 && h(doc, "span", { ...badge("error"), "data-size": "icon", "aria-label": "Problems" }, "!"),
119
121
  h(
120
122
  doc,
121
123
  "span",
122
124
  { class: "actions" },
123
125
  declared(node) && h(doc, "button", {
124
126
  type: "button",
125
- class: "row-action",
127
+ ...control("row-action"),
126
128
  "data-tip": "Show in Queries",
127
129
  "aria-label": "Show in Queries",
128
130
  "data-testid": "show-in-queries",
@@ -133,7 +135,7 @@ function structureTab(root, context) {
133
135
  }, icon(doc, "query")),
134
136
  hasLineage && (node.kind === "block" || declared(node)) && h(doc, "button", {
135
137
  type: "button",
136
- class: "row-action",
138
+ ...control("row-action"),
137
139
  "data-tip": "Show in Lineage",
138
140
  "aria-label": "Show in Lineage",
139
141
  "data-testid": "show-in-lineage",
@@ -144,7 +146,7 @@ function structureTab(root, context) {
144
146
  }, icon(doc, "lineage")),
145
147
  canRender && renderable(node) && h(doc, "button", {
146
148
  type: "button",
147
- class: "row-action",
149
+ ...control("row-action"),
148
150
  "data-tip": "Download PNG",
149
151
  "aria-label": "Download PNG",
150
152
  "data-testid": "download-node",
@@ -185,7 +187,7 @@ function structureTab(root, context) {
185
187
  copyIcon(doc, "Copy the attribute", () => attributeFor(node)),
186
188
  canRender && renderable(node) && ["png", "pdf"].map((format) => h(doc, "button", {
187
189
  type: "button",
188
- class: "tool",
190
+ ...control("tool"),
189
191
  "data-testid": `download-${format}`,
190
192
  onclick: () => {
191
193
  void render(node, format);
@@ -204,7 +206,7 @@ function structureTab(root, context) {
204
206
  replace(
205
207
  doc,
206
208
  head,
207
- problems > 0 && h(doc, "span", { class: "pill error", "data-tip": "Problems in the markup" }, plural(problems, "problem"))
209
+ problems > 0 && h(doc, "span", { ...badge("error"), "data-tip": "Problems in the markup" }, plural(problems, "problem"))
208
210
  );
209
211
  if (structure && panel.selection !== null && panel.selection !== revealed) {
210
212
  ancestorsOf(structure.nodes, panel.selection)?.forEach((key) => collapsed.delete(key));
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  STYLES,
3
+ control,
3
4
  h,
4
5
  icon,
5
6
  popover,
6
7
  replace,
7
8
  tooltips
8
- } from "./chunk-F6B3EGFV.js";
9
+ } from "./chunk-32566ZNE.js";
9
10
  import {
10
11
  LINEAGE_KINDS,
11
12
  LINEAGE_PRESETS,
@@ -215,9 +216,9 @@ function createCanvas(doc, options) {
215
216
  doc,
216
217
  "div",
217
218
  { class: "controls" },
218
- h(doc, "button", { type: "button", class: "row-action", "data-tip": "Zoom in", "aria-label": "Zoom in", onclick: () => zoomBy(1.25) }, icon(doc, "plus")),
219
- h(doc, "button", { type: "button", class: "row-action", "data-tip": "Zoom out", "aria-label": "Zoom out", onclick: () => zoomBy(0.8) }, icon(doc, "minus")),
220
- h(doc, "button", { type: "button", class: "row-action", "data-tip": "Fit to view", "aria-label": "Fit to view", "data-testid": "lineage-fit", onclick: () => fit(true) }, icon(doc, "fit"))
219
+ h(doc, "button", { type: "button", ...control("row-action"), "data-tip": "Zoom in", "aria-label": "Zoom in", onclick: () => zoomBy(1.25) }, icon(doc, "plus")),
220
+ h(doc, "button", { type: "button", ...control("row-action"), "data-tip": "Zoom out", "aria-label": "Zoom out", onclick: () => zoomBy(0.8) }, icon(doc, "minus")),
221
+ h(doc, "button", { type: "button", ...control("row-action"), "data-tip": "Fit to view", "aria-label": "Fit to view", "data-testid": "lineage-fit", onclick: () => fit(true) }, icon(doc, "fit"))
221
222
  );
222
223
  const element = h(doc, "div", { class: "canvas", "data-testid": "lineage-canvas" }, world, controls);
223
224
  const cards = /* @__PURE__ */ new Map();
@@ -492,7 +493,7 @@ function lineageTab(root, context) {
492
493
  const onPage = (node.kind === "block" || node.kind === "query" || node.kind === "control") && node.structureKey !== void 0;
493
494
  const action = (label, name, run, testid) => h(doc, "button", {
494
495
  type: "button",
495
- class: "row-action",
496
+ ...control("row-action"),
496
497
  "data-tip": label,
497
498
  "aria-label": label,
498
499
  "data-testid": testid,
@@ -552,6 +553,7 @@ function lineageTab(root, context) {
552
553
  };
553
554
  const row = (shown, onclick, badge, label, count, testid) => h(doc, "button", {
554
555
  type: "button",
556
+ class: "a-menu-item",
555
557
  role: "menuitemcheckbox",
556
558
  "aria-checked": String(shown),
557
559
  "data-testid": testid,
@@ -566,7 +568,7 @@ function lineageTab(root, context) {
566
568
  doc,
567
569
  "select",
568
570
  {
569
- class: "preset",
571
+ class: "a-input preset",
570
572
  "aria-label": "Preset",
571
573
  "data-testid": "lineage-preset",
572
574
  onchange: (event) => {
@@ -586,7 +588,7 @@ function lineageTab(root, context) {
586
588
  { class: "menu-wrap" },
587
589
  h(doc, "button", {
588
590
  type: "button",
589
- class: "tool",
591
+ ...control("tool"),
590
592
  "aria-haspopup": "menu",
591
593
  "aria-expanded": String(menu === where),
592
594
  "data-testid": "lineage-show",
@@ -598,7 +600,7 @@ function lineageTab(root, context) {
598
600
  menu === where && h(
599
601
  doc,
600
602
  "div",
601
- { class: "menu", role: "menu", popover: "manual", "data-testid": "lineage-show-menu" },
603
+ { class: "a-menu menu", role: "menu", popover: "manual", "data-testid": "lineage-show-menu" },
602
604
  LINEAGE_KINDS.filter((kind) => counts[kind]).map((kind) => row(
603
605
  !view.hidden.has(kind),
604
606
  () => toggle(kind),
@@ -622,10 +624,10 @@ function lineageTab(root, context) {
622
624
  ),
623
625
  h(doc, "span", { class: "spacer" }),
624
626
  loading && h(doc, "span", { class: "dot executing", role: "img", "aria-label": "Tracing", "data-tip": "Tracing the fields through the catalog\u2026" }),
625
- popover(doc, icon(doc, "help"), legend, { class: "pop-trigger row-action", "aria-label": "What the arrows mean" }),
627
+ popover(doc, icon(doc, "help"), legend, { ...control("row-action", "pop-trigger"), "aria-label": "What the arrows mean" }),
626
628
  where === "panel" && h(doc, "button", {
627
629
  type: "button",
628
- class: "row-action",
630
+ ...control("row-action"),
629
631
  "data-tip": "Open in a large view",
630
632
  "aria-label": "Open in a large view",
631
633
  "data-testid": "lineage-expand",
@@ -647,7 +649,7 @@ function lineageTab(root, context) {
647
649
  h(doc, "span", { class: "focus-label" }, `${KIND_LABELS[focused.kind]}: ${focused.label}`),
648
650
  h(doc, "button", {
649
651
  type: "button",
650
- class: "row-action",
652
+ ...control("row-action"),
651
653
  "aria-label": "Show everything",
652
654
  "data-testid": "lineage-unfocus",
653
655
  onclick: () => {
@@ -711,7 +713,7 @@ function lineageTab(root, context) {
711
713
  h(doc, "h3", {}, "Lineage"),
712
714
  h(doc, "p", { class: "muted" }, "From the page's blocks to the database tables. Click a card to follow its path.")
713
715
  ),
714
- h(doc, "button", { type: "button", class: "row-action", "aria-label": "Close", "data-testid": "lineage-close", onclick: () => expanded.close() }, icon(doc, "close"))
716
+ h(doc, "button", { type: "button", ...control("row-action"), "aria-label": "Close", "data-testid": "lineage-close", onclick: () => expanded.close() }, icon(doc, "close"))
715
717
  ),
716
718
  largeSurface.head,
717
719
  largeSurface.canvas.element
@@ -788,7 +790,7 @@ function lineageTab(root, context) {
788
790
  h(doc, "span", {}, "Nothing you picked is drawn here: it holds no query or control, or the current filter or focus hides it."),
789
791
  h(doc, "button", {
790
792
  type: "button",
791
- class: "row-action",
793
+ ...control("row-action"),
792
794
  "aria-label": "Dismiss",
793
795
  onclick: () => {
794
796
  missed = false;
@@ -857,12 +859,12 @@ var LINEAGE_STYLES = `
857
859
  /* Toolbar */
858
860
  .ltoolbar { flex: none; position: relative; z-index: 3; padding: 8px 14px; border-bottom: 1px solid var(--anfra-color-border); }
859
861
  .ltools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
860
- .preset { min-width: 0; max-width: 180px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); color: var(--anfra-color-fg); padding: 3px 6px; font: inherit; font-size: 12px; }
862
+ .preset { width: auto; min-width: 0; max-width: 180px; height: 24px; padding: 0 6px; background: var(--anfra-color-bg); font-size: 12px; line-height: 16px; }
861
863
  .menu-wrap { position: relative; }
862
- .menu { position: fixed; inset: auto; margin: 0; z-index: 10; min-width: 220px; max-height: calc(100vh - 16px); overflow: auto; color: var(--anfra-color-fg); padding: 4px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); box-shadow: 0 6px 20px oklch(0 0 0 / 0.15); }
863
- .menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 4px; background: none; padding: 4px 8px; font-size: 12px; text-align: left; }
864
- .menu button:hover { background: var(--hover); }
865
- .menu button[aria-checked="false"] { color: var(--anfra-color-muted); }
864
+ /* The class layer's Menu, placed in the top layer. */
865
+ .menu { position: fixed; inset: auto; margin: 0; z-index: 10; min-width: 220px; max-height: calc(100vh - 16px); border: 0; }
866
+ .menu .a-menu-item { gap: 8px; cursor: pointer; }
867
+ .menu .a-menu-item[aria-checked="false"] { color: var(--anfra-color-muted); }
866
868
  .menu button[aria-checked="false"] .badge { background: var(--hover); color: var(--anfra-color-muted); }
867
869
  .menu .badge { width: 16px; height: 16px; }
868
870
  .menu .badge .icon { width: 12px; height: 12px; }
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-CKvqVaqU.js';
4
+ import './errors-IhdhKO-6.js';
5
5
 
6
6
  /** The reader a test frame is provisioned with unless given. */
7
7
  declare const TEST_READER: User;
package/dist/testing.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  bootstrap
3
- } from "./chunk-THYCARLT.js";
3
+ } from "./chunk-6GBHCW5E.js";
4
4
  import "./chunk-XIUFHRZE.js";
5
5
  import {
6
6
  createEndpoint
7
- } from "./chunk-S6XLP6U4.js";
7
+ } from "./chunk-3ZWUCECU.js";
8
8
  import {
9
9
  PROVISION_ELEMENT_ID
10
10
  } from "./chunk-RXPNL7UR.js";
11
- import "./chunk-SKSKC747.js";
12
- import "./chunk-KCTLO3CO.js";
11
+ import "./chunk-J5BTCP6T.js";
12
+ import "./chunk-SWNVCTT6.js";
13
13
  import "./chunk-PKBMQBKP.js";
14
14
 
15
15
  // src/testing/frame.ts
@@ -170,7 +170,12 @@ interface paths {
170
170
  };
171
171
  get?: never;
172
172
  put?: never;
173
- /** Report whether a warm server is running and its sidecars are healthy */
173
+ /**
174
+ * Report the repo, and whether a warm server is running and its sidecars are healthy
175
+ * @description Report the repo, and whether a warm server is running and its sidecars are healthy.
176
+ *
177
+ * For this anfra's own version, and whether it is behind, see `anfra version`.
178
+ */
174
179
  post: operations["core.status"];
175
180
  delete?: never;
176
181
  options?: never;
@@ -204,7 +209,12 @@ interface paths {
204
209
  };
205
210
  get?: never;
206
211
  put?: never;
207
- /** Print the anfra version, and say when anfra or the anfra skills are behind */
212
+ /**
213
+ * Print the anfra version, and say when anfra or the anfra skills are behind
214
+ * @description Print the anfra version, and say when anfra or the anfra skills are behind.
215
+ *
216
+ * For this repo's server, and whether it is running, see `anfra status`.
217
+ */
208
218
  post: operations["core.version"];
209
219
  delete?: never;
210
220
  options?: never;
@@ -745,6 +755,12 @@ interface components {
745
755
  */
746
756
  type: "warehouse_query";
747
757
  };
758
+ RepoStatus: {
759
+ /** @description the repo's id, which names its state folder: <ANFRA_HOME>/repos/<id> */
760
+ id: string;
761
+ /** @description the repo's log file: anfra's and its sidecars' log; absent for a managed repo */
762
+ logs?: string;
763
+ };
748
764
  RepoValidation: {
749
765
  diagnostics: components["schemas"]["CompileError"][];
750
766
  reports: components["schemas"]["ValidationReport"][];
@@ -792,10 +808,13 @@ interface components {
792
808
  /** @description search query */
793
809
  query?: string[];
794
810
  };
795
- ServerInfo: {
796
- instance_id: string;
797
- url: string;
798
- version: string;
811
+ ServerStatus: {
812
+ instance_id?: string;
813
+ sidecars?: components["schemas"]["SidecarHealth"];
814
+ /** @enum {string} */
815
+ state: "healthy" | "degraded" | "not_running";
816
+ url?: string;
817
+ version?: string;
799
818
  };
800
819
  ShowDataset: {
801
820
  description?: string;
@@ -877,10 +896,8 @@ interface components {
877
896
  version?: string;
878
897
  };
879
898
  StatusResult: {
880
- server?: components["schemas"]["ServerInfo"];
881
- sidecars?: components["schemas"]["SidecarHealth"];
882
- /** @enum {string} */
883
- state: "healthy" | "degraded" | "not_running";
899
+ repo: components["schemas"]["RepoStatus"];
900
+ server: components["schemas"]["ServerStatus"];
884
901
  };
885
902
  StreamEnd: {
886
903
  error?: components["schemas"]["Response"];
@@ -1771,6 +1788,10 @@ interface DatasetDescriptor {
1771
1788
  type: string;
1772
1789
  is_custom_measure: boolean;
1773
1790
  defined_in_dataset?: boolean;
1791
+ /** Hidden from readers' field lists by the AML (`hidden: true`); a query can still name it. */
1792
+ is_hidden?: boolean;
1793
+ /** A param: a value a query passes in, not a column of the model. */
1794
+ is_param?: boolean;
1774
1795
  }[];
1775
1796
  }[];
1776
1797
  metrics: {
@@ -1881,7 +1902,7 @@ type DateTransformation = `datetrunc ${DateGrain}`;
1881
1902
  type Aggregation = 'sum' | 'avg' | 'max' | 'min' | 'count' | 'count distinct' | 'median' | 'stdev' | 'stdevp' | 'var' | 'varp' | 'running sum' | 'running avg' | 'running max' | 'running min' | 'custom';
1882
1903
  /**
1883
1904
  * A query is a dataset and a raw AQL body — nothing else. The SDK does not parse or validate the
1884
- * AQL: a syntax error, an unknown field, or an ambiguous name surfaces as a `QueryError` at
1905
+ * AQL: a syntax error, an unknown field, or an ambiguous name surfaces as a `query_invalid` error at
1885
1906
  * execute, not as a `ValidationError` here. See docs/adr/0001.
1886
1907
  *
1887
1908
  * Everything the AQL text can say — dimensions, measures, adhoc fields, static filters, its own
@@ -2162,7 +2183,11 @@ interface AppJson {
2162
2183
  */
2163
2184
  interface InspectedError {
2164
2185
  name: string;
2186
+ /** What happened, and who must act: the error's `code` and `scope`. */
2187
+ code: string;
2188
+ scope: string;
2165
2189
  message: string;
2190
+ requestId?: string;
2166
2191
  /** The query or control the error is about. Lost if the error itself is cloned. */
2167
2192
  entity?: string;
2168
2193
  status?: number;
@@ -2294,6 +2319,12 @@ interface BackendQueryRequest {
2294
2319
  /** Present on `refresh()`: skip any result cache. */
2295
2320
  bustCache?: boolean;
2296
2321
  }
2322
+ /**
2323
+ * What a query runs with now, apart from its page: its dataset, its AQL, what reaches it (mapped
2324
+ * controls, the selection, the reader's sort, date drills) and the timezone. A run and an export
2325
+ * are both built on it.
2326
+ */
2327
+ type QueryRequest = Pick<BackendQueryRequest, 'dataset' | 'aql' | 'input' | 'timezone'>;
2297
2328
  /** One page of a query's rows. `values` is positional: each row lines up with `columns`. */
2298
2329
  interface BackendQueryResult {
2299
2330
  columns: ColumnMeta[];
@@ -2394,8 +2425,9 @@ type LineageCard = Schemas['DiagramCard'];
2394
2425
  * What the SDK sends queries to, supplied by the provisioner. Each call either resolves or
2395
2426
  * rejects; how the backend gets there (synchronously, as polled jobs, over a bridge) is its own
2396
2427
  * business. A call whose `signal` aborts may reject with an `AbortError`, and its result is
2397
- * ignored either way. Reject with a `DataAppError` (`PermissionError`, `QueryError`, ...) to choose
2398
- * the error an author sees; anything else surfaces as a `QueryError`.
2428
+ * ignored either way. Reject with a `DataAppError` in the API's shape (`code`, `scope`, `message`,
2429
+ * using the generic codes where they apply; `fromHttpStatus` maps an HTTP status) to choose the
2430
+ * error an author sees; anything else surfaces as `call_failed`.
2399
2431
  */
2400
2432
  interface Backend {
2401
2433
  submitQuery(request: BackendQueryRequest, signal: AbortSignal): Promise<BackendQueryResult>;
@@ -2413,4 +2445,4 @@ interface Backend {
2413
2445
  }
2414
2446
 
2415
2447
  export { FILTER_AGGREGATIONS as F };
2416
- export type { Operator as $, Aggregation as A, Backend as B, ColumnMeta as C, DatasetDescriptor as D, EntityKind as E, FieldLineage as G, FieldSuggestionsRequest as H, FilterAggregation as I, FilterDeclaration as J, FilterValueType as K, InspectedApp as L, InspectedControl as M, InspectedError as N, InspectedQuery as O, InspectedSelection as P, InspectedStructure as Q, LineageCard as R, LineageDiagram as S, LineageNode as T, LineageOptions as U, LineageResult as V, LineageTarget as W, Listener as X, LocateKind as Y, LocateTarget as Z, MappingJson as _, AppDeclaration as a, QueryDebug as a0, QueryDeclaration as a1, QueryInput as a2, QueryResult as a3, QuerySort as a4, QueryState as a5, QueryTimings as a6, RenderFormat as a7, RenderRequest as a8, Rendering as a9, Row as aa, SdkEnvironment as ab, SdkFeatures as ac, Selection as ad, SelectionCondition as ae, SemanticType as af, StructureKind as ag, StructureNode as ah, Unsubscribe as ai, User as aj, paths as ak, components as al, AppJson as b, ArrowType as c, BackendCondition as d, BackendDateDrill as e, BackendExportRequest as f, BackendFilter as g, BackendLineageRequest as h, BackendQueryRequest as i, BackendQueryResult as j, BackendSort as k, Condition as l, ConditionValue as m, ControlMappingJson as n, CrossFilterJson as o, DateDrillDeclaration as p, DateGrain as q, DateTransformation as r, EntityRef as s, EntityUsage as t, ExecuteOptions as u, ExecuteSummary as v, ExportFormat as w, ExportFormatOptions as x, ExportOptions as y, ExportResult as z };
2448
+ export type { Operator as $, Aggregation as A, Backend as B, ColumnMeta as C, DatasetDescriptor as D, EntityKind as E, FieldLineage as G, FieldSuggestionsRequest as H, FilterAggregation as I, FilterDeclaration as J, FilterValueType as K, InspectedApp as L, InspectedControl as M, InspectedError as N, InspectedQuery as O, InspectedSelection as P, InspectedStructure as Q, LineageCard as R, LineageDiagram as S, LineageNode as T, LineageOptions as U, LineageResult as V, LineageTarget as W, Listener as X, LocateKind as Y, LocateTarget as Z, MappingJson as _, AppDeclaration as a, QueryDebug as a0, QueryDeclaration as a1, QueryInput as a2, QueryRequest as a3, QueryResult as a4, QuerySort as a5, QueryState as a6, QueryTimings as a7, RenderFormat as a8, RenderRequest as a9, Rendering as aa, Row as ab, SdkEnvironment as ac, SdkFeatures as ad, Selection as ae, SelectionCondition as af, SemanticType as ag, StructureKind as ah, StructureNode as ai, Unsubscribe as aj, User as ak, components as al, paths as am, AppJson as b, ArrowType as c, BackendCondition as d, BackendDateDrill as e, BackendExportRequest as f, BackendFilter as g, BackendLineageRequest as h, BackendQueryRequest as i, BackendQueryResult as j, BackendSort as k, Condition as l, ConditionValue as m, ControlMappingJson as n, CrossFilterJson as o, DateDrillDeclaration as p, DateGrain as q, DateTransformation as r, EntityRef as s, EntityUsage as t, ExecuteOptions as u, ExecuteSummary as v, ExportFormat as w, ExportFormatOptions as x, ExportOptions as y, ExportResult as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holistics/anfra-sdk",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Data Apps on anfra: the authoring layer (app), what hosts one (host), anfra's plugins (plugins), the core API client (api), and their shared contract (common)",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -61,6 +61,7 @@
61
61
  "prepack": "cp ../../LICENSE ../../NOTICE ."
62
62
  },
63
63
  "devDependencies": {
64
+ "@holistics/anfra-design": "workspace:*",
64
65
  "@types/node": "^22.20.4",
65
66
  "esbuild": "^0.28.2",
66
67
  "html-to-image": "1.11.13",