@holistics/anfra-sdk 0.17.0 → 0.19.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 (32) hide show
  1. package/dist/api.d.ts +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/app.d.ts +6 -5
  4. package/dist/app.js +4 -4
  5. package/dist/{bootstrap-q1J7GUxa.d.ts → bootstrap-5xNrSbJb.d.ts} +12 -6
  6. package/dist/build.d.ts +2 -2
  7. package/dist/{chunk-GV7SVWEK.js → chunk-4TXKXLWK.js} +42 -11
  8. package/dist/{chunk-J5BTCP6T.js → chunk-CDZ7MBXC.js} +1 -1
  9. package/dist/{chunk-C26OVN2S.js → chunk-EIPHDMZ7.js} +25 -0
  10. package/dist/{chunk-SWNVCTT6.js → chunk-HELL45MM.js} +148 -2
  11. package/dist/{chunk-6GBHCW5E.js → chunk-OS4CRPTU.js} +159 -23
  12. package/dist/{chunk-3ZWUCECU.js → chunk-SXKJQU7A.js} +11 -2
  13. package/dist/{chunk-EL7CAVZ3.js → chunk-ZSIJLBKG.js} +1 -1
  14. package/dist/common.d.ts +4 -3
  15. package/dist/common.js +1 -1
  16. package/dist/{data-TDUQTG3P.js → data-ESPFZ5IM.js} +1 -1
  17. package/dist/{declaration-RJFU4ZLJ.js → declaration-RYRBX7PH.js} +2 -2
  18. package/dist/{errors-IhdhKO-6.d.ts → errors-BlRfqyty.d.ts} +2 -2
  19. package/dist/host.d.ts +9 -2
  20. package/dist/host.js +108 -16
  21. package/dist/{menu-CRAFaQ8s.d.ts → menu-Dmfu51qo.d.ts} +4 -2
  22. package/dist/{overview-RV2IV6PJ.js → overview-S6FTM2JT.js} +84 -43
  23. package/dist/{plugin-BdLabbah.d.ts → plugin-C_Cc_e9L.d.ts} +2 -2
  24. package/dist/plugins.d.ts +1 -1
  25. package/dist/plugins.js +15 -11
  26. package/dist/{queries-5TTPOB7R.js → queries-FWMX7H5Z.js} +2 -2
  27. package/dist/runtimeErrors-gswksjDk.d.ts +55 -0
  28. package/dist/{structure-MTLCRTJ4.js → structure-VFRJFC4C.js} +1 -1
  29. package/dist/testing.d.ts +1 -1
  30. package/dist/testing.js +4 -4
  31. package/dist/{types-C_i7V0DA.d.ts → types-DKQjAL1O.d.ts} +69 -72
  32. package/package.json +1 -1
@@ -6,7 +6,7 @@ import {
6
6
  eventShortcut,
7
7
  isTyping,
8
8
  normalizeShortcut
9
- } from "./chunk-3ZWUCECU.js";
9
+ } from "./chunk-SXKJQU7A.js";
10
10
  import {
11
11
  DEFAULT_TOKENS,
12
12
  PROVISION_ELEMENT_ID,
@@ -15,22 +15,90 @@ import {
15
15
  } from "./chunk-RXPNL7UR.js";
16
16
  import {
17
17
  version
18
- } from "./chunk-J5BTCP6T.js";
18
+ } from "./chunk-CDZ7MBXC.js";
19
19
  import {
20
20
  DataAppError,
21
+ MESSAGE_LIMIT,
21
22
  ValidationError,
22
23
  callFailed,
24
+ callOf,
23
25
  connectionFailed,
26
+ createBudget,
27
+ describeError,
24
28
  forbidden,
25
29
  fromHttpStatus,
26
30
  hasErrorCode,
27
31
  invalidRequest,
28
- isDataAppError
29
- } from "./chunk-SWNVCTT6.js";
32
+ isDataAppError,
33
+ namedCall,
34
+ snakeCase,
35
+ tagCall,
36
+ truncate
37
+ } from "./chunk-HELL45MM.js";
30
38
  import {
31
39
  __publicField
32
40
  } from "./chunk-PKBMQBKP.js";
33
41
 
42
+ // src/app/reporting.ts
43
+ var reporter;
44
+ function reportError(kind, err) {
45
+ try {
46
+ reporter?.(kind, err);
47
+ } catch {
48
+ }
49
+ }
50
+ var EVENTS_PER_MINUTE = 120;
51
+ function textOf(arg) {
52
+ if (typeof arg === "string") return arg;
53
+ if (arg instanceof Error) return `${arg.name}: ${arg.message}`;
54
+ try {
55
+ return JSON.stringify(arg) ?? String(arg);
56
+ } catch {
57
+ return String(arg);
58
+ }
59
+ }
60
+ function installReporting(own, win, captureConsole, now = Date.now) {
61
+ const dropped = (what) => (count) => win.console?.warn(
62
+ `anfra: ${count} ${what} over the ${EVENTS_PER_MINUTE} a minute a frame sends were not sent to the host.`
63
+ );
64
+ const errors = createBudget(EVENTS_PER_MINUTE, dropped("runtime errors"), now);
65
+ const lines = createBudget(EVENTS_PER_MINUTE, dropped("console lines"), now);
66
+ reporter = (kind, err) => {
67
+ if (errors.take()) own.emit("error", describeError(kind, err));
68
+ };
69
+ const onError = (event) => reportError("app.uncaught", event.error ?? event.message);
70
+ const onRejection = (event) => {
71
+ const api = callOf(event.reason);
72
+ reportError(api ? `call.${api}` : "app.uncaught", event.reason);
73
+ };
74
+ win.addEventListener("error", onError);
75
+ win.addEventListener("unhandledrejection", onRejection);
76
+ const console2 = win.console;
77
+ const originals = {};
78
+ if (captureConsole && console2) {
79
+ for (const level of ["error", "warn"]) {
80
+ const original = console2[level];
81
+ originals[level] = original;
82
+ console2[level] = (...args) => {
83
+ original.apply(console2, args);
84
+ if (typeof args[0] === "string" && args[0].startsWith("anfra:")) return;
85
+ try {
86
+ if (lines.take()) own.emit("console", { level, message: truncate(args.map(textOf).join(" "), MESSAGE_LIMIT), at: (/* @__PURE__ */ new Date()).toISOString() });
87
+ } catch {
88
+ }
89
+ };
90
+ }
91
+ }
92
+ return () => {
93
+ reporter = void 0;
94
+ errors.dispose();
95
+ lines.dispose();
96
+ win.removeEventListener("error", onError);
97
+ win.removeEventListener("unhandledrejection", onRejection);
98
+ for (const [level, original] of Object.entries(originals)) console2[level] = original;
99
+ };
100
+ }
101
+
34
102
  // src/app/observable.ts
35
103
  var Observable = class {
36
104
  constructor(parent) {
@@ -54,6 +122,7 @@ var Observable = class {
54
122
  listener();
55
123
  } catch (err) {
56
124
  console.error("anfra: a subscribe() listener threw; the queries carry on.", err);
125
+ reportError("app.listener", err);
57
126
  }
58
127
  });
59
128
  this.parent?.notifyChange();
@@ -73,6 +142,8 @@ var Query = class extends Observable {
73
142
  __publicField(this, "dataset");
74
143
  __publicField(this, "app");
75
144
  __publicField(this, "_state", "idle");
145
+ /** Its last run failed: not a `fetchMore`, whose failure leaves the pages already loaded to keep. */
146
+ __publicField(this, "runFailed", false);
76
147
  __publicField(this, "_result");
77
148
  __publicField(this, "_error");
78
149
  __publicField(this, "_page", 1);
@@ -178,9 +249,13 @@ var Query = class extends Observable {
178
249
  get isDirty() {
179
250
  return this.lastRunSignature !== void 0 && this.signature() !== this.lastRunSignature;
180
251
  }
181
- /** @internal */
252
+ /**
253
+ * @internal Also when its last run failed, whatever its inputs: so `execute()` is the retry, of
254
+ * the failed queries only, even after a forced run (`refresh()`) failed with unchanged inputs. Not
255
+ * after a failed `fetchMore`: rerun, it would drop the pages already loaded; `fetchMore` is its retry.
256
+ */
182
257
  shouldRun(force = false) {
183
- return force || this.lastRunSignature === void 0 || this.isDirty;
258
+ return force || this.runFailed || this.lastRunSignature === void 0 || this.isDirty;
184
259
  }
185
260
  /** Stops the in-flight request for this query. The pending `execute()` resolves without it. */
186
261
  abort() {
@@ -188,12 +263,17 @@ var Query = class extends Observable {
188
263
  }
189
264
  /** Fetches the next page and appends it. Rejects rather than swallowing, unlike `execute()`. */
190
265
  async fetchMore() {
191
- if (this.pageSize === void 0) {
192
- throw new ValidationError(`Query '${this.name}' declares no pageSize, so it has no more pages.`, this.name);
266
+ try {
267
+ if (this.pageSize === void 0) {
268
+ throw new ValidationError(`Query '${this.name}' declares no pageSize, so it has no more pages.`, this.name);
269
+ }
270
+ if (!this.hasMore) return;
271
+ this._page += 1;
272
+ await this.app.fetchPage(this);
273
+ } catch (err) {
274
+ tagCall(err, "fetch_more");
275
+ throw err;
193
276
  }
194
- if (!this.hasMore) return;
195
- this._page += 1;
196
- await this.app.fetchPage(this);
197
277
  }
198
278
  /**
199
279
  * Opens the menu on these rows of this query: the items plugins and the host offer for a point
@@ -251,6 +331,7 @@ var Query = class extends Observable {
251
331
  markSuccess(result, signature, append) {
252
332
  this._state = "success";
253
333
  this._error = void 0;
334
+ if (!append) this.runFailed = false;
254
335
  this.lastRunSignature = signature;
255
336
  this.lastPageRows = result.rows.length;
256
337
  if (append && this._result) {
@@ -261,8 +342,9 @@ var Query = class extends Observable {
261
342
  }
262
343
  this.notify();
263
344
  }
264
- /** @internal */
265
- markError(error) {
345
+ /** @internal `page` when it is a `fetchMore` that failed, not a run. */
346
+ markError(error, page = false) {
347
+ if (!page) this.runFailed = true;
266
348
  this._state = "error";
267
349
  this._error = error;
268
350
  this.notify();
@@ -430,7 +512,10 @@ var Filter = class extends Control {
430
512
  q: search ?? ""
431
513
  },
432
514
  signal
433
- );
515
+ ).catch((err) => {
516
+ tagCall(err, "load_options");
517
+ throw err;
518
+ });
434
519
  this.loadedOptions = [...options ?? []];
435
520
  this.notify();
436
521
  return this.loadedOptions;
@@ -787,14 +872,20 @@ function installContentUi(kernel) {
787
872
  groups,
788
873
  onPick: (key) => {
789
874
  const action = found.map((group) => group.run.get(key)).find(Boolean);
790
- Promise.resolve().then(action).catch((err) => win.console?.error("anfra: a menu item failed:", err));
875
+ Promise.resolve().then(action).catch((err) => {
876
+ win.console?.error("anfra: a menu item failed:", err);
877
+ reportError("plugin.uncaught", err);
878
+ });
791
879
  },
792
880
  onClose: () => {
793
881
  if (current === close) current = void 0;
794
882
  }
795
883
  });
796
884
  current = close;
797
- })().catch((err) => win.console?.error("anfra: the menu failed to open:", err));
885
+ })().catch((err) => {
886
+ win.console?.error("anfra: the menu failed to open:", err);
887
+ reportError("plugin.uncaught", err);
888
+ });
798
889
  return true;
799
890
  }
800
891
  function listen() {
@@ -819,6 +910,14 @@ function installContentUi(kernel) {
819
910
  hostKinds = new Set((Array.isArray(kinds) ? kinds : []).filter((kind) => kind === "node" || kind === "rows"));
820
911
  listen();
821
912
  });
913
+ const reported = (mount) => (root2) => {
914
+ try {
915
+ return mount(root2);
916
+ } catch (err) {
917
+ reportError("plugin.uncaught", err);
918
+ throw err;
919
+ }
920
+ };
822
921
  async function show(input, draw) {
823
922
  const body = await ui();
824
923
  closeCurrent();
@@ -843,7 +942,7 @@ function installContentUi(kernel) {
843
942
  modal: (input) => show(input, (body, onClose) => body.modal(root(), {
844
943
  title: input.title,
845
944
  size: input.size,
846
- mount: input.mount,
945
+ mount: reported(input.mount),
847
946
  onClose
848
947
  })),
849
948
  popover: (input) => show(input, (body, onClose) => {
@@ -862,7 +961,7 @@ function installContentUi(kernel) {
862
961
  return body.popover(root(), {
863
962
  anchor: rect,
864
963
  side: input.side,
865
- mount: input.mount,
964
+ mount: reported(input.mount),
866
965
  dismiss: input.dismiss,
867
966
  closeButton: input.closeButton,
868
967
  onClose
@@ -1881,7 +1980,9 @@ var App = class extends Observable {
1881
1980
  } catch (err) {
1882
1981
  if (superseded(query, controller)) return;
1883
1982
  if (isAbort(err)) return;
1884
- query.markError(toDataAppError(err, query.name));
1983
+ const error = toDataAppError(err, query.name);
1984
+ query.markError(error);
1985
+ reportError("call.query", error);
1885
1986
  failed.push(query.name);
1886
1987
  } finally {
1887
1988
  if (query.controller === controller) query.controller = void 0;
@@ -1921,7 +2022,7 @@ var App = class extends Observable {
1921
2022
  query.rewindPage();
1922
2023
  if (isAbort(err)) return;
1923
2024
  const error = toDataAppError(err, query.name);
1924
- query.markError(error);
2025
+ query.markError(error, true);
1925
2026
  throw error;
1926
2027
  } finally {
1927
2028
  if (query.controller === controller) query.controller = void 0;
@@ -2259,6 +2360,22 @@ ${code}
2259
2360
  if (!exported) throw new ValidationError("The host sent a plugin body that did not run.");
2260
2361
  return exported.default ?? exported;
2261
2362
  }
2363
+ function namedMember(member, api) {
2364
+ if (typeof member === "function") return namedCall(member, api);
2365
+ if (typeof member !== "object" || member === null) return member;
2366
+ const named = /* @__PURE__ */ new Map();
2367
+ return new Proxy(member, {
2368
+ get(target, key, receiver) {
2369
+ const value = Reflect.get(target, key, receiver);
2370
+ if (typeof value !== "function" || typeof key !== "string") return value;
2371
+ const made = named.get(key);
2372
+ if (made?.of === value) return made.fn;
2373
+ const fn = namedCall(value.bind(target), `${api}_${snakeCase(key)}`);
2374
+ named.set(key, { of: value, fn });
2375
+ return fn;
2376
+ }
2377
+ });
2378
+ }
2262
2379
  function createKernel(plugin, shared, entities) {
2263
2380
  const { window: win, sdk, endpoint } = shared;
2264
2381
  let loading;
@@ -2293,10 +2410,22 @@ function createKernel(plugin, shared, entities) {
2293
2410
  },
2294
2411
  provide(api) {
2295
2412
  if (plugin in sdk) throw new ValidationError(`Plugin '${plugin}' can't add a member Anfra already has.`);
2296
- Object.defineProperty(sdk, plugin, { value: api, enumerable: true });
2413
+ Object.defineProperty(sdk, plugin, { value: namedMember(api, snakeCase(plugin)), enumerable: true });
2297
2414
  },
2298
- provideOnQuery: (factory) => addExtension(sdk.extensions.query, entities.Query.prototype, "query", plugin, factory),
2299
- provideOnControl: (factory) => addExtension(sdk.extensions.control, entities.Control.prototype, "control", plugin, factory),
2415
+ provideOnQuery: (factory) => addExtension(
2416
+ sdk.extensions.query,
2417
+ entities.Query.prototype,
2418
+ "query",
2419
+ plugin,
2420
+ (query) => namedMember(factory(query), snakeCase(plugin))
2421
+ ),
2422
+ provideOnControl: (factory) => addExtension(
2423
+ sdk.extensions.control,
2424
+ entities.Control.prototype,
2425
+ "control",
2426
+ plugin,
2427
+ (control) => namedMember(factory(control), snakeCase(plugin))
2428
+ ),
2300
2429
  layer: () => layerRoot(win.document, plugin),
2301
2430
  menuItem: (item) => shared.contentUi?.addItem(plugin, item),
2302
2431
  modal: (input) => shared.contentUi.modal(input),
@@ -2471,6 +2600,11 @@ function bootstrap(win, setups = []) {
2471
2600
  if (!handler) throw invalidRequest(`Nothing in this frame answers '${name}'.`);
2472
2601
  return handler(request, signal);
2473
2602
  },
2603
+ // A plugin's answer that failed: the host reads only that the call failed, so it is reported here.
2604
+ hidden: (name, err) => {
2605
+ win.console?.error(`anfra: '${name}' failed; the host is told only that the call failed.`, err);
2606
+ reportError("plugin.uncaught", err);
2607
+ },
2474
2608
  event: (name, payload) => {
2475
2609
  listeners.get(name)?.forEach((listener) => {
2476
2610
  try {
@@ -2519,6 +2653,7 @@ function bootstrap(win, setups = []) {
2519
2653
  appListeners
2520
2654
  };
2521
2655
  const own = createKernel("anfra", shared, { Query, Control });
2656
+ installReporting(own, win, provision.captureConsole === true);
2522
2657
  installInspection(own);
2523
2658
  shared.contentUi = installContentUi(own);
2524
2659
  own.on("theme", (theme) => {
@@ -2546,6 +2681,7 @@ function bootstrap(win, setups = []) {
2546
2681
  setup(createKernel(name, shared, { Query, Control }));
2547
2682
  } catch (err) {
2548
2683
  win.console?.error(`anfra: plugin '${name}' failed to set up:`, err);
2684
+ reportError("plugin.uncaught", err);
2549
2685
  }
2550
2686
  }
2551
2687
  installSandbox(instance, win);
@@ -5,7 +5,7 @@ import {
5
5
  contextOf,
6
6
  isDataAppError,
7
7
  toScope
8
- } from "./chunk-SWNVCTT6.js";
8
+ } from "./chunk-HELL45MM.js";
9
9
 
10
10
  // src/common/endpoint.ts
11
11
  function abortError() {
@@ -67,7 +67,16 @@ function createEndpoint(post, handlers) {
67
67
  }).catch((err) => {
68
68
  if (controller.signal.aborted || isAbortError(err)) return;
69
69
  const error = toBridgeError(err);
70
- if (!isDataAppError(err)) console.error(`anfra: '${name}' failed; the other side is told only that the call failed.`, err);
70
+ if (!isDataAppError(err)) {
71
+ if (handlers.hidden) {
72
+ try {
73
+ handlers.hidden(name, err);
74
+ } catch {
75
+ }
76
+ } else {
77
+ console.error(`anfra: '${name}' failed; the other side is told only that the call failed.`, err);
78
+ }
79
+ }
71
80
  post({ type: "anfra:result", id, ok: false, error });
72
81
  }).finally(() => {
73
82
  if (inFlight.get(id) === controller) inFlight.delete(id);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./chunk-J5BTCP6T.js";
3
+ } from "./chunk-CDZ7MBXC.js";
4
4
 
5
5
  // src/plugins/version.ts
6
6
  var PLUGIN_VERSION = version;
package/dist/common.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { A as ApiErrorCode, D as DataAppError, a as DataAppErrorInit, E as ErrorCode, b as ErrorContextEntry, c as ErrorDetails, d as ErrorScope, F as FromHttpStatusOptions, G as GENERIC_CODES, e as GenericCode, V as ValidationError, f as callFailed, g as connectionFailed, h as forbidden, i as fromHttpStatus, j as hasErrorCode, k as invalidRequest, l as isDataAppError } from './errors-IhdhKO-6.js';
2
- export { A as Aggregation, a as AppDeclaration, b as AppJson, c as ArrowType, B as Backend, d as BackendCondition, e as BackendDateDrill, f as BackendExportRequest, g as BackendFilter, h as BackendLineageRequest, i as BackendQueryRequest, j as BackendQueryResult, k as BackendSort, C as ColumnMeta, l as Condition, m as ConditionValue, n as ControlMappingJson, o as CrossFilterJson, D as DatasetDescriptor, p as DateDrillDeclaration, q as DateGrain, r as DateTransformation, E as EntityKind, s as EntityRef, t as EntityUsage, u as ExecuteOptions, v as ExecuteSummary, w as ExportFormat, x as ExportFormatOptions, y as ExportOptions, z as ExportResult, F as FILTER_AGGREGATIONS, G as FieldLineage, H as FieldSuggestionsRequest, I as FilterAggregation, J as FilterDeclaration, K as FilterValueType, L as InspectedApp, M as InspectedControl, N as InspectedError, O as InspectedQuery, P as InspectedSelection, Q as InspectedStructure, R as LineageCard, S as LineageDiagram, T as LineageNode, U as LineageOptions, V as LineageResult, W as LineageTarget, X as Listener, Y as LocateKind, Z as LocateTarget, _ as MappingJson, $ as Operator, a0 as QueryDebug, a1 as QueryDeclaration, a2 as QueryInput, a3 as QueryRequest, a4 as QueryResult, a5 as QuerySort, a6 as QueryState, a7 as QueryTimings, a8 as RenderFormat, a9 as RenderRequest, aa as Rendering, ab as Row, ac as SdkEnvironment, ad as SdkFeatures, ae as Selection, af as SelectionCondition, ag as SemanticType, ah as StructureKind, ai as StructureNode, aj as Unsubscribe, ak as User } from './types-C_i7V0DA.js';
3
- export { B as BridgeError, a as BridgeMessage, D as DEFAULT_TOKENS, b as DESIGN_TOKENS, F as FrameMessage, H as HostMessage, M as MenuEntry, c as MenuTarget, d as MenuTargetKind, N as NodeTarget, P as PROVISION_ELEMENT_ID, e as PluginInfo, f as Provision, R as RowsTarget, T as THEME_TOKENS, g as TargetRect, h as Theme, i as ThemeInput, j as ThemeScheme, k as ThemeToken, l as ThemeTokens, m as checkTarget, n as designTheme, r as resolveTheme } from './menu-CRAFaQ8s.js';
1
+ export { A as ApiErrorCode, D as DataAppError, a as DataAppErrorInit, E as ErrorCode, b as ErrorContextEntry, c as ErrorDetails, d as ErrorScope, F as FromHttpStatusOptions, G as GENERIC_CODES, e as GenericCode, V as ValidationError, f as callFailed, g as connectionFailed, h as forbidden, i as fromHttpStatus, j as hasErrorCode, k as invalidRequest, l as isDataAppError } from './errors-BlRfqyty.js';
2
+ export { A as Aggregation, a as AppDeclaration, b as AppJson, c as ArrowType, B as Backend, d as BackendCondition, e as BackendDateDrill, f as BackendExportRequest, g as BackendFilter, h as BackendLineageRequest, i as BackendQueryRequest, j as BackendQueryResult, k as BackendSort, C as ColumnMeta, l as Condition, m as ConditionValue, n as ControlMappingJson, o as CrossFilterJson, D as DatasetDescriptor, p as DateDrillDeclaration, q as DateGrain, r as DateTransformation, E as EntityKind, s as EntityRef, t as EntityUsage, u as ExecuteOptions, v as ExecuteSummary, w as ExportFormat, x as ExportFormatOptions, y as ExportOptions, z as ExportResult, F as FILTER_AGGREGATIONS, G as FieldLineage, H as FieldSuggestionsRequest, I as FilterAggregation, J as FilterDeclaration, K as FilterValueType, L as InspectedApp, M as InspectedControl, N as InspectedError, O as InspectedQuery, P as InspectedSelection, Q as InspectedStructure, R as LineageCard, S as LineageDiagram, T as LineageNode, U as LineageOptions, V as LineageResult, W as LineageTarget, X as Listener, Y as LocateKind, Z as LocateTarget, _ as MappingJson, $ as Operator, a0 as QueryDebug, a1 as QueryDeclaration, a2 as QueryInput, a3 as QueryRequest, a4 as QueryResult, a5 as QuerySort, a6 as QueryState, a7 as QueryTimings, a8 as RenderFormat, a9 as RenderRequest, aa as Rendering, ab as Row, ac as SdkEnvironment, ad as SdkFeatures, ae as Selection, af as SelectionCondition, ag as SemanticType, ah as StructureKind, ai as StructureNode, aj as Unsubscribe, ak as User } from './types-DKQjAL1O.js';
3
+ export { A as AppConsoleEvent, a as AppErrorEvent, b as AppErrorKind } from './runtimeErrors-gswksjDk.js';
4
+ export { B as BridgeError, a as BridgeMessage, D as DEFAULT_TOKENS, b as DESIGN_TOKENS, F as FrameMessage, H as HostMessage, M as MenuEntry, c as MenuTarget, d as MenuTargetKind, N as NodeTarget, P as PROVISION_ELEMENT_ID, e as PluginInfo, f as Provision, R as RowsTarget, T as THEME_TOKENS, g as TargetRect, h as Theme, i as ThemeInput, j as ThemeScheme, k as ThemeToken, l as ThemeTokens, m as checkTarget, n as designTheme, r as resolveTheme } from './menu-Dmfu51qo.js';
package/dist/common.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  hasErrorCode,
25
25
  invalidRequest,
26
26
  isDataAppError
27
- } from "./chunk-SWNVCTT6.js";
27
+ } from "./chunk-HELL45MM.js";
28
28
  import "./chunk-PKBMQBKP.js";
29
29
  export {
30
30
  DEFAULT_TOKENS,
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  attributeRequests,
11
11
  stateOf
12
- } from "./chunk-C26OVN2S.js";
12
+ } from "./chunk-EIPHDMZ7.js";
13
13
  import {
14
14
  badge,
15
15
  collapsible,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stateOf
3
- } from "./chunk-C26OVN2S.js";
3
+ } from "./chunk-EIPHDMZ7.js";
4
4
  import {
5
5
  collapsible,
6
6
  copyIcon,
@@ -82,7 +82,7 @@ function declarationTab(root, context) {
82
82
  function checks(app, list, index) {
83
83
  return [
84
84
  h(doc, "h5", {}, "Checks", hint("Static checks on the declaration for mistakes the SDK reports late or never, such as cross-filters across datasets or controls mapped to no query. Click a row to jump to it.")),
85
- list.length === 0 ? note(doc, "No issues found.", { "data-testid": "checks-none" }) : h(doc, "ul", { class: "checks", "data-testid": "checks" }, list.map((check, i) => {
85
+ list.length === 0 ? note(doc, "No problems found.", { "data-testid": "checks-none" }) : h(doc, "ul", { class: "checks", "data-testid": "checks" }, list.map((check, i) => {
86
86
  const { mark, label, tone } = MARKS[check.level];
87
87
  return h(
88
88
  doc,
@@ -1,8 +1,8 @@
1
- import { al as components } from './types-C_i7V0DA.js';
1
+ import { al as components } from './types-DKQjAL1O.js';
2
2
 
3
3
  /**
4
4
  * A Data App's errors are the API's error document, not classes picked for it
5
- * (docs/designs/errors.md, "In a Data App"): every failure of a call is a `DataAppError` with the
5
+ * (docs/designs/errors/data-apps.md): every failure of a call is a `DataAppError` with the
6
6
  * envelope's fields, and the one other class, `ValidationError`, is what a declaration throws. An
7
7
  * app branches on `scope` (who must act) and `code` (what happened), and reads `details`.
8
8
  */
package/dist/host.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { PluginInfo, Theme, ThemeInput, Provision } from './app.js';
2
2
  import { DatasetDescriptor, User } from './app.js';
3
- import { C as Command, T as Tab, a as CallOptions, P as Panel, b as CommandState, c as Plugin, M as Middleware, d as CommandContribution, e as TabContribution, f as Contribution } from './plugin-BdLabbah.js';
4
- export { g as CallContext, h as CallDefinition, i as CallHandler, j as Caller, k as CommandRun, l as CommandStateContext, E as EventCheck, F as FrameHalf, H as HandlerCallOptions, m as HandlerContext, n as HostHalf, o as MountContext, p as PanelVerb, S as Snapshot, q as TabContext, r as definePlugin } from './plugin-BdLabbah.js';
3
+ import { C as Command, T as Tab, a as CallOptions, P as Panel, b as CommandState, c as Plugin, M as Middleware, d as CommandContribution, e as TabContribution, f as Contribution } from './plugin-C_Cc_e9L.js';
4
+ export { g as CallContext, h as CallDefinition, i as CallHandler, j as Caller, k as CommandRun, l as CommandStateContext, E as EventCheck, F as FrameHalf, H as HandlerCallOptions, m as HandlerContext, n as HostHalf, o as MountContext, p as PanelVerb, S as Snapshot, q as TabContext, r as definePlugin } from './plugin-C_Cc_e9L.js';
5
+ export { A as AppConsoleEvent, a as AppErrorEvent, b as AppErrorKind } from './runtimeErrors-gswksjDk.js';
5
6
 
6
7
  interface HostOptions {
7
8
  /** The plugins this page's Data Apps get. `core` is required: the app model runs its queries with it. */
@@ -30,6 +31,12 @@ interface HostOptions {
30
31
  contributions?: (contribution: Contribution) => boolean;
31
32
  /** The theme plugin UI follows: tabs, and frame halves in the plugin layer. Light defaults unless given. */
32
33
  theme?: ThemeInput;
34
+ /**
35
+ * Whether frames report their `console.error` / `console.warn` lines, as `anfra.console` on each
36
+ * mount. They can hold the app's data. Unless given, on in a development build of the host's page
37
+ * and off in a production one (`process.env.NODE_ENV`).
38
+ */
39
+ captureConsole?: boolean;
33
40
  }
34
41
  interface MountOptions {
35
42
  /** Where the frame goes: it is appended to this element. */