@holistics/anfra-sdk 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/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 +4 -3
  6. package/dist/{bootstrap-5xNrSbJb.d.ts → bootstrap-BxBqFhgm.d.ts} +279 -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-4TXKXLWK.js → chunk-7I2HXY72.js} +1 -1
  12. package/dist/{chunk-ZSIJLBKG.js → chunk-7NZOMBYE.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-CDZ7MBXC.js → chunk-E3Q3FRKQ.js} +1 -1
  16. package/dist/{chunk-SXKJQU7A.js → chunk-GPBYPSWK.js} +22 -36
  17. package/dist/{chunk-OS4CRPTU.js → chunk-IHRNKDMO.js} +830 -265
  18. package/dist/{chunk-EIPHDMZ7.js → chunk-UWRQXPPG.js} +69 -24
  19. package/dist/common.d.ts +3 -3
  20. package/dist/{data-ESPFZ5IM.js → data-SZDYO55C.js} +7 -5
  21. package/dist/{declaration-RYRBX7PH.js → declaration-GYV6OUR3.js} +5 -3
  22. package/dist/{errors-BlRfqyty.d.ts → errors-DR05L6-y.d.ts} +1 -1
  23. package/dist/host.d.ts +2 -2
  24. package/dist/host.js +29 -6
  25. package/dist/{menu-Dmfu51qo.d.ts → menu-CuTKq-dC.d.ts} +2 -1
  26. package/dist/{overview-S6FTM2JT.js → overview-KOQJNG2Y.js} +28 -13
  27. package/dist/{plugin-C_Cc_e9L.d.ts → plugin-BIcighnC.d.ts} +7 -2
  28. package/dist/plugins.d.ts +1 -7
  29. package/dist/plugins.js +53 -17
  30. package/dist/{queries-FWMX7H5Z.js → queries-BWKWZQMG.js} +70 -17
  31. package/dist/{structure-VFRJFC4C.js → structure-JO4YZHKZ.js} +5 -3
  32. package/dist/{tab-XL2HS5W4.js → tab-QPHE7YUQ.js} +3 -3
  33. package/dist/testing.d.ts +2 -1
  34. package/dist/testing.js +8 -7
  35. package/dist/{types-DKQjAL1O.d.ts → types-C_-1rgj2.d.ts} +783 -123
  36. package/package.json +1 -1
@@ -1,9 +1,14 @@
1
+ import {
2
+ copyStamp
3
+ } from "./chunk-GPBYPSWK.js";
1
4
  import {
2
5
  DATA_TAB,
3
6
  DECLARATION_TAB,
4
7
  QUERIES_TAB,
5
- STRUCTURE_TAB
6
- } from "./chunk-H52PO7MP.js";
8
+ STRUCTURE_TAB,
9
+ entityGone,
10
+ hasEntity
11
+ } from "./chunk-33HI2ODM.js";
7
12
 
8
13
  // src/plugins/inspect/model/requests.ts
9
14
  function describe(call, request) {
@@ -14,10 +19,8 @@ function describe(call, request) {
14
19
  dataset: r.dataset,
15
20
  aql: r.aql,
16
21
  input: r.input,
17
- page: r.page,
18
- pageSize: r.pageSize,
19
- timezone: r.timezone,
20
- bustCache: r.bustCache
22
+ bustCache: r.bustCache,
23
+ minCachedAt: r.minCachedAt
21
24
  };
22
25
  }
23
26
  case "core.fieldSuggestions": {
@@ -30,7 +33,7 @@ function describe(call, request) {
30
33
  dataset: r.dataset,
31
34
  aql: r.aql,
32
35
  input: r.input,
33
- timezone: r.timezone,
36
+ minCachedAt: r.minCachedAt,
34
37
  format: r.format,
35
38
  formatOptions: r.formatOptions,
36
39
  filename: r.filename
@@ -52,6 +55,7 @@ function summarize(call, result, previewRows) {
52
55
  const r = result;
53
56
  return {
54
57
  fromCache: r.debug?.fromCache,
58
+ cache: r.debug?.cache,
55
59
  numRows: r.meta?.numRows ?? r.values.length,
56
60
  columns: r.columns.map((column) => column.name),
57
61
  preview: r.values.slice(0, previewRows)
@@ -59,8 +63,10 @@ function summarize(call, result, previewRows) {
59
63
  }
60
64
  case "core.fieldSuggestions":
61
65
  return { numRows: result.length };
62
- case "export.query":
63
- return { numRows: result.rowCount };
66
+ case "export.query": {
67
+ const r = result;
68
+ return { numRows: r.rowCount, cache: r.cache };
69
+ }
64
70
  case "lineage.trace":
65
71
  return { numRows: result.results.length };
66
72
  default:
@@ -104,6 +110,7 @@ function createRequestLog({ limit = 200, previewRows = 20 } = {}) {
104
110
  ...details,
105
111
  id,
106
112
  call: context.name,
113
+ ...context.stamp && { stamp: copyStamp(context.stamp) },
107
114
  caller: callerOf(context),
108
115
  // A copy: the host keeps adding the middleware after this one.
109
116
  ...context.trace.length > 1 && { trace: context.trace.slice(0, -1) },
@@ -140,28 +147,44 @@ function createRequestLog({ limit = 200, previewRows = 20 } = {}) {
140
147
  }
141
148
  };
142
149
  }
143
- function queriesOf(entry, apps) {
144
- if (entry.call !== "core.submitQuery" && entry.call !== "export.query") return [];
145
- return apps.flatMap(
146
- (app, index) => Object.entries(app.declaration.queries).filter(([, q]) => q.dataset === entry.dataset && q.aql === entry.aql).map(([name]) => ({ app: index, name }))
147
- );
150
+ function queryOf(entry) {
151
+ if (!entry.stamp) return void 0;
152
+ const { app, query, id } = entry.stamp;
153
+ return { app, name: query, ...id !== void 0 && { id } };
154
+ }
155
+ function isCurrent(ref, apps) {
156
+ const queries = apps[ref.app]?.queries ?? {};
157
+ if (!Object.hasOwn(queries, ref.name)) return false;
158
+ const { id } = queries[ref.name];
159
+ return ref.id === void 0 || id === void 0 || ref.id === id;
148
160
  }
149
161
  function attributeRequests(entries, apps) {
150
162
  const byQuery = /* @__PURE__ */ new Map();
151
163
  const other = [];
164
+ const removed = [];
165
+ const removedByKey = /* @__PURE__ */ new Map();
152
166
  for (let i = entries.length - 1; i >= 0; i--) {
153
167
  const entry = entries[i];
154
- const refs = entry.aql && entry.dataset ? queriesOf({ ...entry, dataset: entry.dataset, aql: entry.aql }, apps) : [];
155
- if (refs.length === 0) other.push(entry);
156
- for (const ref of refs) {
157
- const key = `${ref.app}/${ref.name}`;
158
- const item = { entry, shared: refs.length > 1 };
159
- const list = byQuery.get(key);
160
- if (list) list.push(item);
161
- else byQuery.set(key, [item]);
168
+ const ref = queryOf(entry);
169
+ if (!ref) {
170
+ other.push(entry);
171
+ continue;
172
+ }
173
+ const key = `${ref.app}/${ref.name}`;
174
+ if (isCurrent(ref, apps)) {
175
+ byQuery.set(key, [...byQuery.get(key) ?? [], { entry }]);
176
+ continue;
177
+ }
178
+ const gone = removedByKey.get(key);
179
+ if (gone) {
180
+ gone.requests.push({ entry });
181
+ continue;
162
182
  }
183
+ const query = { app: ref.app, name: ref.name, requests: [{ entry }] };
184
+ removedByKey.set(key, query);
185
+ removed.push(query);
163
186
  }
164
- return { byQuery, other };
187
+ return { byQuery, other, removed };
165
188
  }
166
189
  function describeError(err) {
167
190
  if (!(err instanceof Error)) return String(err);
@@ -194,6 +217,7 @@ function createState() {
194
217
  }
195
218
  });
196
219
  let nonce = 0;
220
+ let following = false;
197
221
  const errors = [];
198
222
  const lines = [];
199
223
  const state = {
@@ -248,6 +272,26 @@ function createState() {
248
272
  }
249
273
  changed();
250
274
  },
275
+ follow(panel) {
276
+ if (following) return;
277
+ following = true;
278
+ panel.subscribe(() => {
279
+ if (panel.snapshot) state.prune(panel.snapshot.apps);
280
+ });
281
+ },
282
+ prune(apps) {
283
+ for (const key of state.queries.open) {
284
+ if (entityGone(key, apps)) state.queries.open.delete(key);
285
+ }
286
+ for (const key of state.data.open) {
287
+ const slash = key.indexOf("/");
288
+ if (!hasEntity(apps, "query", Number(key.slice(0, slash)), key.slice(slash + 1))) state.data.open.delete(key);
289
+ }
290
+ const target = state.revealed?.target;
291
+ if (target && "entity" in target && !hasEntity(apps, target.entity, target.app, target.name)) {
292
+ state.revealed = void 0;
293
+ }
294
+ },
251
295
  subscribe(listener) {
252
296
  listeners.add(listener);
253
297
  return () => {
@@ -260,7 +304,8 @@ function createState() {
260
304
  }
261
305
 
262
306
  export {
263
- queriesOf,
307
+ queryOf,
308
+ isCurrent,
264
309
  attributeRequests,
265
310
  stateOf,
266
311
  dropState
package/dist/common.d.ts CHANGED
@@ -1,4 +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-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';
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-DR05L6-y.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 CallStamp, l as ColumnMeta, m as Condition, n as ConditionValue, o as ControlMappingJson, p as CrossFilterJson, D as DatasetDescriptor, q as DateDrillDeclaration, r as DateGrain, s as DateTransformation, E as EntityKind, t as EntityRef, u as EntityUsage, v as ExecuteOptions, w as ExecuteSummary, x as ExportFormat, y as ExportFormatOptions, z as ExportOptions, F as ExportResult, G as FILTER_AGGREGATIONS, H as FieldLineage, I as FieldSuggestionsRequest, J as FilterAggregation, K as FilterDeclaration, L as FilterValueType, M as InspectedApp, N as InspectedControl, O as InspectedError, P as InspectedQuery, Q as InspectedSelection, R as InspectedStructure, S as LineageCard, T as LineageDiagram, U as LineageNode, V as LineageOptions, W as LineageResult, X as LineageTarget, Y as Listener, Z as LocateKind, _ as LocateTarget, $ as MappingJson, a0 as Operator, a1 as QueryCacheResult, a2 as QueryCacheSettings, a3 as QueryDebug, a4 as QueryDeclaration, a5 as QueryInput, a6 as QueryInputDefaults, a7 as QueryPagination, a8 as QueryPivot, a9 as QueryRequest, aa as QueryResult, ab as QuerySeeds, ac as QuerySort, ad as QueryStamp, ae as QueryState, af as QueryTimings, ag as RenderFormat, ah as RenderRequest, ai as Rendering, aj as Row, ak as SdkEnvironment, al as SdkFeatures, am as Selection, an as SelectionCondition, ao as SemanticType, ap as StructureKind, aq as StructureNode, ar as Unsubscribe, as as User, at as WeekStartDay } from './types-C_-1rgj2.js';
3
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';
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-CuTKq-dC.js';
@@ -5,11 +5,13 @@ import {
5
5
  declaredFilters,
6
6
  isActive,
7
7
  queryInputs
8
- } from "./chunk-DITKCHFQ.js";
8
+ } from "./chunk-CLXZMA5D.js";
9
9
  import {
10
10
  attributeRequests,
11
11
  stateOf
12
- } from "./chunk-EIPHDMZ7.js";
12
+ } from "./chunk-UWRQXPPG.js";
13
+ import "./chunk-GPBYPSWK.js";
14
+ import "./chunk-HELL45MM.js";
13
15
  import {
14
16
  badge,
15
17
  collapsible,
@@ -25,13 +27,13 @@ import {
25
27
  queryTrust,
26
28
  table,
27
29
  trustIndicator
28
- } from "./chunk-32566ZNE.js";
30
+ } from "./chunk-2TTGSNHA.js";
29
31
  import "./chunk-K633QHGO.js";
30
32
  import {
31
33
  entityNodeKey,
32
34
  formatAgo,
33
35
  plural
34
- } from "./chunk-H52PO7MP.js";
36
+ } from "./chunk-33HI2ODM.js";
35
37
  import "./chunk-PKBMQBKP.js";
36
38
 
37
39
  // src/plugins/inspect/tabs/data.ts
@@ -77,7 +79,7 @@ function rowCount(shown, total) {
77
79
  return total !== void 0 && total > shown ? `First ${shown} of ${total} rows` : plural(shown, "row");
78
80
  }
79
81
  function latestRows(requests) {
80
- return requests?.find(({ entry, shared }) => !shared && entry.status === "ok" && entry.preview && entry.columns && !(entry.page && entry.page > 1))?.entry;
82
+ return requests?.find(({ entry }) => entry.status === "ok" && entry.preview && entry.columns && !entry.stamp?.variant && (entry.input?.pagination?.page ?? 1) === 1)?.entry;
81
83
  }
82
84
  var handled = /* @__PURE__ */ new WeakMap();
83
85
  function dataTab(root, context) {
@@ -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
  collapsible,
6
8
  copyIcon,
@@ -12,13 +14,13 @@ import {
12
14
  link,
13
15
  note,
14
16
  popover
15
- } from "./chunk-32566ZNE.js";
17
+ } from "./chunk-2TTGSNHA.js";
16
18
  import {
17
19
  controlMappings,
18
20
  crossFilters,
19
21
  wiringChecks
20
22
  } from "./chunk-K633QHGO.js";
21
- import "./chunk-H52PO7MP.js";
23
+ import "./chunk-33HI2ODM.js";
22
24
  import "./chunk-PKBMQBKP.js";
23
25
 
24
26
  // src/plugins/inspect/tabs/declaration.ts
@@ -1,4 +1,4 @@
1
- import { al as components } from './types-DKQjAL1O.js';
1
+ import { au as components } from './types-C_-1rgj2.js';
2
2
 
3
3
  /**
4
4
  * A Data App's errors are the API's error document, not classes picked for it
package/dist/host.d.ts CHANGED
@@ -1,7 +1,7 @@
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-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';
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-BIcighnC.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-BIcighnC.js';
5
5
  export { A as AppConsoleEvent, a as AppErrorEvent, b as AppErrorKind } from './runtimeErrors-gswksjDk.js';
6
6
 
7
7
  interface HostOptions {