@holistics/anfra-sdk 0.16.0 → 0.18.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-THYCARLT.js → chunk-2O2WVQXO.js} +102 -30
  10. package/dist/chunk-32566ZNE.js +1278 -0
  11. package/dist/{chunk-S6XLP6U4.js → chunk-3ZWUCECU.js} +45 -20
  12. package/dist/{chunk-KFD6CHLI.js → chunk-ACKFOANJ.js} +2 -0
  13. package/dist/{chunk-SKSKC747.js → chunk-B6URV5AO.js} +1 -1
  14. package/dist/{chunk-CYZQ7ZTJ.js → chunk-C26OVN2S.js} +6 -1
  15. package/dist/{chunk-PTNYQOEY.js → chunk-NS7HJHNK.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-AZCX6SY6.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
@@ -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-2O2WVQXO.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-B6URV5AO.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.18.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",