@holistics/anfra-sdk 0.10.2 → 0.11.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.
package/dist/app.d.ts CHANGED
@@ -1,511 +1,8 @@
1
- import { X as Listener, ah as Unsubscribe, D as DatasetDescriptor, E as EntityKind, l as Condition, J as FilterDeclaration, K as FilterValueType, B as Backend, m as ConditionValue, p as DateDrillDeclaration, q as DateGrain, I as FilterAggregation, n as ControlMappingJson, o as CrossFilterJson, ab as SdkFeatures, ac as Selection, ad as SelectionCondition, a9 as Row, y as ExportOptions, z as ExportResult, Y as LocateKind, a1 as QueryDeclaration, a5 as QueryState, a3 as QueryResult, a4 as QuerySort, a as AppDeclaration, u as ExecuteOptions, v as ExecuteSummary, b as AppJson, L as InspectedApp, ai as User, aa as SdkEnvironment, a7 as RenderRequest, a8 as Rendering, W as LineageTarget, U as LineageOptions, V as LineageResult, Q as InspectedStructure } from './types-DznT0m7F.js';
2
- export { A as Aggregation, c as ArrowType, 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, r as DateTransformation, s as EntityRef, t as EntityUsage, w as ExportFormat, x as ExportFormatOptions, F as FILTER_AGGREGATIONS, G as FieldLineage, H as FieldSuggestionsRequest, M as InspectedControl, N as InspectedError, O as InspectedQuery, P as InspectedSelection, R as LineageCard, S as LineageDiagram, T as LineageNode, Z as LocateTarget, _ as MappingJson, $ as Operator, a0 as QueryDebug, a2 as QueryInput, a6 as RenderFormat, ae as SemanticType, af as StructureKind, ag as StructureNode } from './types-DznT0m7F.js';
3
- import { D as DataAppError } from './errors-CKvqVaqU.js';
4
- export { P as PermissionError, Q as QueryError, T as TransportError, V as ValidationError } from './errors-CKvqVaqU.js';
5
- export { B as BridgeError, a as BridgeMethod, F as FrameMessage, H as HostMessage, P as PROVISION_ELEMENT_ID, b as Provision } from './bridge-DUKdREoK.js';
6
-
7
- interface NotificationTarget {
8
- notifyChange(): void;
9
- }
10
- /**
11
- * The smallest thing that adapts to every framework: `subscribe(listener) => unsubscribe` is the
12
- * signature React's `useSyncExternalStore` wants, and a Vue adapter is a `shallowRef` plus a
13
- * `triggerRef`. Deliberately not named events (a taxonomy to version) nor a signal primitive
14
- * (owning a reactivity library). See docs/adr/0002.
15
- */
16
- declare class Observable implements NotificationTarget {
17
- private readonly listeners;
18
- private readonly parent?;
19
- constructor(parent?: NotificationTarget);
20
- subscribe(listener: Listener): Unsubscribe;
21
- /**
22
- * Public only so a child observable can bubble into its parent — an app subscriber sees every
23
- * entity's changes through one subscription. Subclasses call the protected `notify` instead.
24
- */
25
- notifyChange(): void;
26
- protected notify(): void;
27
- }
28
-
29
- interface ResolvedField {
30
- /**
31
- * The model's *name*, not a database id, and absent for a dataset-level metric. Backends resolve
32
- * fields by name, the way AQL does; `data_models[].id` is not reliably populated.
33
- */
34
- modelName?: string;
35
- fieldName: string;
36
- isMetric: boolean;
37
- type: string;
38
- label: string;
39
- }
40
- /**
41
- * Indexes one dataset's fields so validation is a lookup rather than a scan, and so we have a
42
- * candidate list to draw typo suggestions from.
43
- */
44
- declare class DatasetIndex {
45
- readonly descriptor: DatasetDescriptor;
46
- private readonly fields;
47
- readonly references: string[];
48
- constructor(descriptor: DatasetDescriptor);
49
- resolve(reference: string, entity: string): ResolvedField;
50
- }
51
-
52
- /**
53
- * Base for the interactive controls. They are one mechanism — a named condition that
54
- * maps onto queries — and differ only in the operators they produce. They are separate classes
55
- * because a single `Filter` accepting all 25 operators would be untypeable in any useful way, and
56
- * nobody should have to remember that a date drill is `transform_date_drill` with
57
- * `values: ['datetrunc month']`.
58
- */
59
- declare abstract class Control extends Observable {
60
- readonly name: string;
61
- abstract readonly kind: EntityKind;
62
- protected readonly app: AppContext & Observable;
63
- private pending;
64
- private applied?;
65
- private readonly initial;
66
- protected constructor(name: string, app: AppContext & Observable, initial: Condition);
67
- /**
68
- * Bring the elements marked `data-anfra-control` with this control's name into view. False when
69
- * none is on the page yet; never throws.
70
- */
71
- locate(): boolean;
72
- /** The reader's current value, which `execute()` will commit. */
73
- get condition(): Condition;
74
- /** The value this control's mapped queries last ran with. Undefined before the first execution. */
75
- get appliedCondition(): Condition | undefined;
76
- /**
77
- * False before the first execution: with nothing applied there is nothing to differ from, so a
78
- * control set from a URL at startup is not an unapplied change.
79
- */
80
- get isDirty(): boolean;
81
- setCondition(condition: Condition): void;
82
- reset(): void;
83
- /** @internal Called by the executor once the queries reading this control have been submitted. */
84
- commit(): void;
85
- abstract toJSON(): unknown;
86
- }
87
- declare class Filter extends Control {
88
- readonly kind: "filter";
89
- readonly declaration: FilterDeclaration;
90
- readonly type: FilterValueType;
91
- private readonly resolved?;
92
- private readonly datasetName?;
93
- private readonly backend?;
94
- private loadedOptions?;
95
- constructor(name: string, app: AppContext & Observable, declaration: FilterDeclaration, dataset?: DatasetIndex, backend?: Backend);
96
- setCondition(condition: Condition): void;
97
- /**
98
- * A number filter's values are strings, as query results give them, which keep every digit. A JS
99
- * number may already have lost some (`Number("9007199254740993")` is ...992), and nothing after
100
- * can tell, so the core API refuses one; this says so where the app hands it over.
101
- */
102
- private assertValues;
103
- /** True for a field-backed filter, false for a manual one. The two are separate axes from `type`. */
104
- get isFieldBacked(): boolean;
105
- /** A manual filter's static list, or whatever the last `loadOptions()` returned. */
106
- get options(): ConditionValue[];
107
- /**
108
- * Fetches option values for a field-backed filter.
109
- *
110
- * Lazy rather than fetched up front: building a distinct-values query for every filter is slow,
111
- * and readers often touch none of them. The backend decides which values this reader may see.
112
- */
113
- loadOptions(search?: string, signal?: AbortSignal): Promise<ConditionValue[]>;
114
- toJSON(): FilterDeclaration;
115
- }
116
- declare class DateDrillControl extends Control {
117
- readonly kind: "dateDrill";
118
- readonly declaration: DateDrillDeclaration;
119
- constructor(name: string, app: AppContext & Observable, declaration?: DateDrillDeclaration);
120
- setGrain(grain: DateGrain): void;
121
- toJSON(): DateDrillDeclaration;
122
- }
123
-
124
- /**
125
- * A directed edge from an interactive control to one field of one query.
126
- *
127
- * Always explicit: the field is never inferred from the control's own field, because "the control
128
- * happens to name a field this query also has" is exactly the coupling that breaks silently when
129
- * someone renames a dimension.
130
- */
131
- declare class Mapping {
132
- readonly kind: "control";
133
- readonly from: Control;
134
- readonly to: Query;
135
- readonly field: string;
136
- readonly aggregation?: FilterAggregation;
137
- constructor(from: Control, to: Query, field: string, aggregation?: FilterAggregation);
138
- /**
139
- * Includes the field, unlike Dashboard as Code's `${from}.${to}` — that form collides the moment
140
- * one control maps onto one query on two fields.
141
- */
142
- get id(): string;
143
- toJSON(): ControlMappingJson;
144
- }
145
- /**
146
- * A directed edge saying `from` may cross-filter `to`: when the reader selects rows in `from`, the
147
- * conditions derived from that selection apply to `to`.
148
- *
149
- * Carries no field. Which fields a selection conditions is decided at click time, from the rows the
150
- * author hands over — the same asymmetry that makes `CrossFilterInteraction` the one Dashboard as
151
- * Code interaction without a `field_path`. Two queries may cross-filter each other; only one
152
- * selection is live at a time, so a bidirectional pair is not a loop. See docs/adr/0005.
153
- */
154
- declare class CrossFilter {
155
- readonly kind: "crossFilter";
156
- readonly from: Query;
157
- readonly to: Query;
158
- constructor(from: Query, to: Query);
159
- /** No field to disambiguate, and one pair may only be declared once, so the pair is the id. */
160
- get id(): string;
161
- toJSON(): CrossFilterJson;
162
- }
163
- /** Either kind of edge. `app.mappings` returns this; narrow on `kind`. */
164
- type Edge = Mapping | CrossFilter;
165
-
166
- /**
167
- * What an entity needs from the app that owns it. An interface, so `query.ts` and `controls.ts`
168
- * never import `app.ts` at runtime.
169
- */
170
- interface AppContext {
171
- readonly timezone?: string;
172
- /** Server-side capabilities the host declared, so a declaration can refuse what would be dropped. */
173
- readonly features?: SdkFeatures;
174
- /** The live selection, if any. App-scoped: at most one query is the source at a time. */
175
- readonly selection?: Selection;
176
- datasetIndex(uname: string, entity: string): DatasetIndex;
177
- /** Control edges only — cross-filter edges reach a query through the selection instead. */
178
- mappingsTo(queryName: string): Mapping[];
179
- /**
180
- * Conditions the selection puts on this query, empty unless a cross-filter edge reaches it.
181
- *
182
- * `pending` is what the reader has picked and `applied` is what the query last ran with, matching
183
- * `Control.condition` / `Control.appliedCondition`: signatures read pending, payloads read
184
- * applied, and `execute()` commits between the two.
185
- */
186
- selectionConditionsFor(queryName: string, phase: 'pending' | 'applied'): readonly SelectionCondition[];
187
- /** The expression form, set instead of the conditions when the collapse would have been lossy. */
188
- selectionExpressionFor(queryName: string, phase: 'pending' | 'applied'): string | undefined;
189
- /** Replaces the app's selection with these rows of this query. */
190
- select(query: Query, rows: readonly Row[], fields?: readonly string[]): void;
191
- /** Runs one more page for a query that already has a result. */
192
- fetchPage(query: Query): Promise<void>;
193
- /** Exports a query's whole result, with what it was last run with. */
194
- exportQuery(query: Query, options?: ExportOptions): Promise<ExportResult>;
195
- /** Brings an entity's marked elements into view; false when none is on the page. */
196
- locate(kind: LocateKind, name: string): boolean;
197
- }
198
-
199
- declare class Query extends Observable {
200
- readonly kind: "query";
201
- readonly name: string;
202
- readonly declaration: QueryDeclaration;
203
- readonly dataset: DatasetIndex;
204
- private readonly app;
205
- private _state;
206
- private _result?;
207
- private _error?;
208
- private _page;
209
- /**
210
- * A sort applied to the result, independent of the query's own AQL — the same mechanism a click
211
- * on a table's column header uses. Kept off the declaration so setting it never re-authors the
212
- * query. See docs/adr/0001.
213
- */
214
- private _sort;
215
- /** The input signature of the last successful run; undefined until one has happened. */
216
- private lastRunSignature?;
217
- /**
218
- * Rows in the most recent page, not in the accumulated result. `fetchMore` appends, so comparing
219
- * the total against the page size would report "more" forever once two pages are held.
220
- */
221
- private lastPageRows;
222
- /** @internal Set by the executor so `abort()` can reach the in-flight request. */
223
- controller?: AbortController;
224
- constructor(name: string, app: AppContext & Observable, declaration: QueryDeclaration);
225
- /**
226
- * Bring the elements marked `data-anfra-query` with this query's name into view: scroll to the
227
- * first and show them all for a moment. False, and nothing done, when no element on the page is
228
- * marked with it yet; never throws, so an author's own button is safe.
229
- */
230
- locate(): boolean;
231
- get state(): QueryState;
232
- get result(): QueryResult | undefined;
233
- get error(): DataAppError | undefined;
234
- /** Rows per page, or undefined for a query that isn't paged and gets every row. */
235
- get pageSize(): number | undefined;
236
- get page(): number;
237
- get sort(): readonly QuerySort[];
238
- /** Replaces the sort applied to this query's result. Pass `[]` to clear it back to the AQL's own. */
239
- setSort(sort: readonly QuerySort[]): void;
240
- get hasMore(): boolean;
241
- /**
242
- * Everything that changes the rows: the declaration, the conditions reaching this query through
243
- * mappings, the conditions reaching it from the selection, the sort override, the app's timezone,
244
- * and the page. Compared against the last successful run to decide whether re-running would
245
- * produce anything new.
246
- */
247
- signature(): string;
248
- /**
249
- * False before the first run: with nothing applied there is nothing to have changed. Distinct
250
- * from `shouldRun`, which is true in that case precisely because there is no result yet.
251
- */
252
- get isDirty(): boolean;
253
- /** @internal */
254
- shouldRun(force?: boolean): boolean;
255
- /** Stops the in-flight request for this query. The pending `execute()` resolves without it. */
256
- abort(): void;
257
- /** Fetches the next page and appends it. Rejects rather than swallowing, unlike `execute()`. */
258
- fetchMore(): Promise<void>;
259
- /**
260
- * Exports this query's whole result as a file, and has the host save it for the reader.
261
- *
262
- * Every row, not only the pages loaded, with what the result on screen was last run with: the
263
- * mapped controls, the selection, the sort, the timezone. A control the reader changed but has
264
- * not applied is not in it. Resolves once the file is made and its download has started, with
265
- * its link and row count; rejects with a `DataAppError` naming this query, and changes nothing on
266
- * the query either way. Show the button when `Anfra.features.export` and
267
- * `Anfra.user.permissions.canExportData` are both true.
268
- */
269
- export(options?: ExportOptions): Promise<ExportResult>;
270
- /**
271
- * Cross-filters this query's targets by the rows the reader picked.
272
- *
273
- * Replaces whatever was selected, here or in another query: an app holds one selection at a time.
274
- * Pass no rows to clear it. The SDK never sees the click, so the author calls this from their own
275
- * chart's handler, passing the result rows they rendered.
276
- *
277
- * `fields` narrows which result columns take part, for a chart that renders fewer than the query
278
- * returned. A measure or an adhoc column never takes part, whether or not it is named here.
279
- */
280
- select(rows: Row | readonly Row[], options?: {
281
- fields?: readonly string[];
282
- }): void;
283
- /**
284
- * The rows of this query's current result that the reader has selected, for redrawing its own
285
- * highlight. Empty unless this query is the selection's source.
286
- *
287
- * Matched by value rather than by object identity. A source is never filtered by its own
288
- * selection, but it does re-run when it stops being some *other* query's target — which is
289
- * exactly what happens when the reader moves their selection from another panel to this one. Its
290
- * rows come back as new objects, and identity would drop the highlight at that moment.
291
- *
292
- * `app.selection.rows` still holds what the author passed, verbatim.
293
- */
294
- get selectedRows(): readonly Row[];
295
- /** @internal */
296
- markExecuting(): void;
297
- /** @internal */
298
- markSuccess(result: QueryResult, signature: string, append: boolean): void;
299
- /** @internal */
300
- markError(error: DataAppError): void;
301
- /** @internal Reverts an optimistic page bump when a `fetchMore` fails. */
302
- rewindPage(): void;
303
- /** @internal */
304
- resetPage(): void;
305
- toJSON(): QueryDeclaration;
306
- }
307
-
308
- declare class App extends Observable implements AppContext {
309
- readonly title?: string;
310
- private _timezone?;
311
- private readonly datasets;
312
- private readonly backend;
313
- readonly features?: SdkFeatures;
314
- private readonly _queries;
315
- private readonly _controls;
316
- private readonly _mappings;
317
- private readonly _crossFilters;
318
- private _selection?;
319
- private _appliedSelection?;
320
- /**
321
- * Whether a run has ever committed the selection. Needed because `undefined` is a real applied
322
- * value — "nothing selected" — unlike a control's condition, which is always present.
323
- */
324
- private selectionCommitted;
325
- constructor(declaration: AppDeclaration, datasets: Record<string, DatasetIndex>, backend: Backend, features?: SdkFeatures);
326
- get queries(): Record<string, Query>;
327
- get controls(): Record<string, Control>;
328
- /** Every edge in the app's entity graph, of both kinds. Narrow on `kind`. */
329
- get mappings(): readonly Edge[];
330
- get crossFilters(): readonly CrossFilter[];
331
- createQuery(name: string, declaration: QueryDeclaration): Query;
332
- createFilter(name: string, declaration: FilterDeclaration & {
333
- dataset?: string;
334
- }): Filter;
335
- createDateDrill(name: string, declaration?: DateDrillDeclaration): DateDrillControl;
336
- /**
337
- * Declares one edge. Always explicit — the field is never inferred from the control's own field,
338
- * because "the control happens to name a field this query also has" is exactly the coupling that
339
- * breaks silently when someone renames a dimension.
340
- *
341
- * There is no `unmap`: a mapping you do not want is one you do not declare.
342
- */
343
- mapControl(from: Control, to: Query, options: {
344
- field: string;
345
- aggregation?: FilterAggregation;
346
- }): Mapping;
347
- /**
348
- * Declares that selecting rows in `from` may cross-filter `to`.
349
- *
350
- * No field: which fields a selection conditions is decided when the reader picks rows, not here.
351
- * Explicit, like every other edge — there is no "cross-filter everything on this dataset",
352
- * because an author who adds a sixth query should not silently acquire five new edges.
353
- *
354
- * Declaring both directions is normal and is not a cycle: one selection is live at a time and
355
- * never cascades, so `a -> b` and `b -> a` simply means either chart may drive the other.
356
- */
357
- mapCrossFilter(from: Query, to: Query): CrossFilter;
358
- /**
359
- * What the reader has picked, if anything.
360
- *
361
- * Held here rather than on a query because it belongs to none of them: picking rows in a second
362
- * query replaces it. Every control still owns its own condition — this is the one piece of
363
- * reader state with no natural owner.
364
- */
365
- get selection(): Selection | undefined;
366
- /** The selection the cross-filtered queries last ran with. */
367
- get appliedSelection(): Selection | undefined;
368
- clearSelection(): void;
369
- /** Part of the declaration, not the environment. Changing it makes every query dirty. */
370
- setTimezone(timezone: string | undefined): void;
371
- get timezone(): string | undefined;
372
- datasetIndex(uname: string, entity: string): DatasetIndex;
373
- mappingsTo(queryName: string): Mapping[];
374
- /** The expression form, set only when the structured conditions would have been lossy. */
375
- selectionExpressionFor(queryName: string, phase: 'pending' | 'applied'): string | undefined;
376
- private selectionFor;
377
- selectionConditionsFor(queryName: string, phase: 'pending' | 'applied'): readonly SelectionCondition[];
378
- /**
379
- * The transformation each of this query's fields is currently drawn at, from the date drills
380
- * mapped onto it.
381
- *
382
- * `appliedCondition`, not `condition`: a drill the reader has changed but not applied has not
383
- * rebucketed anything yet, so the rows they are clicking still belong to the applied grain.
384
- */
385
- private drillTransformations;
386
- select(query: Query, rows: readonly Row[], fields?: readonly string[]): void;
387
- /** True when a control or the selection has changed since the queries reading it last ran. */
388
- get hasChanges(): boolean;
389
- /**
390
- * False before the first execution, matching `Control.isDirty`: with nothing applied there is
391
- * nothing to differ from, so a selection restored at startup is not an unapplied change.
392
- */
393
- private get isSelectionDirty();
394
- /**
395
- * Runs every query that would produce something new, and resolves with which succeeded and which
396
- * failed. Never rejects: a failed query sets its own `state` and `error`, because one broken
397
- * query must not blank the other four. See docs/adr/0002.
398
- */
399
- execute(options?: ExecuteOptions): Promise<ExecuteSummary>;
400
- /** Re-runs everything and asks the server to skip its result cache. */
401
- refresh(): Promise<ExecuteSummary>;
402
- abort(): void;
403
- /** @internal Backs `query.fetchMore()`. Rejects, so an explicit page request reports its failure. */
404
- fetchPage(query: Query): Promise<void>;
405
- /**
406
- * @internal Backs `query.export()`. Built from the applied state, as `fetchPage` is, so the file
407
- * holds what the reader is looking at, every row of it. Touches nothing on the query.
408
- */
409
- exportQuery(query: Query, options?: ExportOptions): Promise<ExportResult>;
410
- /**
411
- * The declaration and nothing else — no datasets, no backend, no reader state. This is the
412
- * shape a persisted Data App record will take, which is why mapping edges are already generic.
413
- */
414
- toJSON(): AppJson;
415
- /**
416
- * Everything a host needs to render this app, as plain data.
417
- *
418
- * Separate from `toJSON()` rather than an option on it: `toJSON()` is the declaration and is the
419
- * shape a persisted app takes, while this is a reading taken at a moment and already behind by
420
- * the time anyone sees it. Written out field by field because the live objects cannot cross a
421
- * port — getters are not cloned, and `Query.controller` holds an `AbortController` for exactly
422
- * as long as someone is likely to be watching. See docs/adr/0007.
423
- */
424
- toInspectJSON(): InspectedApp;
425
- /**
426
- * @internal This app's index among the frame's apps, which is how a marked element names it
427
- * (`data-anfra-query="1/revenue"`); 0 unless set by the instance that created it.
428
- */
429
- index: number;
430
- /**
431
- * Bring an entity's marked elements into view: scroll to the first, show the overlay on all for
432
- * a moment. False, and nothing done, when the document has none marked with it (or there is no
433
- * document at all). Used by `Query.locate()` and `Control.locate()`, and by the bootstrap for a
434
- * host's locate-by-entity.
435
- */
436
- locate(kind: LocateKind, name: string): boolean;
437
- private assertNameFree;
438
- /**
439
- * A field-backed filter usually lives in an app with one dataset, so requiring `dataset` on every
440
- * filter would be noise. With several, it has to be said.
441
- */
442
- private soleDataset;
443
- private assertAcyclic;
444
- }
445
-
446
- /** The package's version: anfra's own, as each release publishes the SDK with it. */
447
- declare const VERSION: string;
448
- /**
449
- * A provisioned SDK instance: the environment, plus the one factory an author needs.
450
- *
451
- * Authors never construct this. The provisioner builds it and exposes it to the sandbox
452
- * as `Anfra`, so author and agent code contains no setup at all — which matters most for the
453
- * agent, which cannot write boilerplate about a backend it has never seen. See docs/adr/0003.
454
- */
455
- declare class Sdk {
456
- readonly version: string;
457
- private readonly _apps;
458
- /**
459
- * Readable on purpose: an agent can check a field name against the real schema before writing
460
- * it. This is the useful half of runtime introspection *for an author*, which is why there is
461
- * still no `describe()` on this surface. Describing a running app is a separate thing, addressed
462
- * to the host rather than the author — see `App.toInspectJSON` and docs/adr/0007.
463
- */
464
- readonly datasets: Readonly<Record<string, DatasetDescriptor>>;
465
- /**
466
- * Who the app is running as. Provisioned like `datasets` rather than fetched, so author code
467
- * needs no await and no null check to greet someone or hide a control they cannot use.
468
- */
469
- readonly user: Readonly<User>;
470
- private readonly indices;
471
- private readonly backend;
472
- /**
473
- * What the host can do beyond queries. `export` says whether `query.export()` can work here, and
474
- * `render` whether `render()` can: show either's button only when it and
475
- * `user.permissions.canExportData` are both true. `lineage` says whether `lineage()` can.
476
- */
477
- readonly features: Readonly<SdkFeatures>;
478
- private readonly renderHook?;
479
- constructor(environment: SdkEnvironment);
480
- createApp(declaration?: AppDeclaration): App;
481
- /**
482
- * Render the whole app, or one block or container of its structure by id, as a PNG or a PDF, and
483
- * have the host save it for the reader. What is drawn is what the page shows now: `await
484
- * app.execute()` first for fresh results. Elements marked `data-anfra-render="skip"` are left out.
485
- * Rejects with a `ValidationError` naming what to fix.
486
- */
487
- render(request: RenderRequest): Promise<Rendering>;
488
- /**
489
- * Trace fields through the repo's catalog: what each one is built from (the fields, models and
490
- * sources upstream of it), as a diagram to draw. Name each field by its parent and its name in
491
- * it: `{ parent: 'orders', child: 'amount' }` for a model's field, `{ parent: 'ecommerce', child:
492
- * 'revenue' }` for a dataset's metric. Nothing needs ingesting first: the host builds the repo's
493
- * catalog when it has to. A field that cannot be traced answers its `error`, and the others still
494
- * answer; a host that cannot trace lineage (see `features.lineage`) rejects with a
495
- * `TransportError`.
496
- */
497
- lineage(targets: LineageTarget | readonly LineageTarget[], options?: LineageOptions): Promise<LineageResult>;
498
- /**
499
- * Every app this instance has built, for a host rendering an inspection panel.
500
- *
501
- * Not addressed to author code, which already holds whatever it created — this exists because the
502
- * bootstrap does not, and cannot otherwise reach an app at all. Holding them means they outlive
503
- * the author's own reference; the frame is discarded and rebuilt on every Run, which is what
504
- * bounds it. See docs/adr/0007.
505
- */
506
- get apps(): readonly App[];
507
- }
508
- declare function createSdk(environment: SdkEnvironment): Sdk;
1
+ import { S as Sdk } from './bootstrap-B7r0ggJN.js';
2
+ export { A as AnfraPlugins, a as App, C as Control, b as CrossFilter, D as DateDrillControl, E as Edge, F as Filter, c as FrameKernel, I as InstalledPlugins, M as Mapping, O as OVERLAY_ID, d as PluginApi, e as PluginMembers, f as PluginName, P as PluginSetup, Q as Query, g as STRUCTURE_ATTRIBUTES, V as VERSION, h as bootstrap, i as buildStructure, j as createSdk, p as parseRef } from './bootstrap-B7r0ggJN.js';
3
+ export { D as DataAppError, P as PermissionError, Q as QueryError, T as TransportError, V as ValidationError } from './errors-CKvqVaqU.js';
4
+ 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 QueryResult, a4 as QuerySort, a5 as QueryState, a6 as RenderFormat, a7 as RenderRequest, a8 as Rendering, a9 as Row, aa as SdkEnvironment, ab as SdkFeatures, ac as Selection, ad as SelectionCondition, ae as SemanticType, af as StructureKind, ag as StructureNode, ah as Unsubscribe, ai as User } from './types-BTyDyld7.js';
5
+ export { B as BridgeError, a as BridgeMessage, F as FrameMessage, H as HostMessage, P as PROVISION_ELEMENT_ID, b as PluginInfo, c as Provision } from './bridge-Byq62yS8.js';
509
6
 
510
7
  declare const SANDBOX_GLOBAL = "Anfra";
511
8
  /**
@@ -521,48 +18,11 @@ declare const SANDBOX_GLOBAL = "Anfra";
521
18
  declare function installSandbox(sdk: Sdk, target?: Record<string, unknown>): () => void;
522
19
 
523
20
  /**
524
- * The overlay: how a frame shows a node on its page, for the host's inspect panel and for the
525
- * definition's own `locate()`. A tinted box over each marked element and a label naming the node,
526
- * drawn above everything and ignoring the pointer. In the frame's document because the host cannot
527
- * reach it; the only UI the SDK draws, and only while someone is inspecting.
528
- */
529
- declare const OVERLAY_ID = "anfra-overlay";
530
-
531
- /**
532
- * The structure: a Data App's semantic parts, declared by the definition on its own elements with
533
- * `data-anfra-*` attributes and read from the running page. Optional and partial: anything
534
- * unmarked is simply not in it. Built only while a host inspects, and never thrown over: a problem
535
- * in the markup is reported on the node it concerns.
21
+ * The plugin layer: where whatever the SDK draws on a Data App's page goes (the overlay, a plugin's
22
+ * modal), above the definition's own page and apart from it. One element at the end of the
23
+ * document, holding one shadow root per part (the kernel's, each plugin's), so the page's styles
24
+ * don't reach in and theirs don't reach out. A rendering never draws it.
536
25
  */
26
+ declare const LAYER_ATTRIBUTE = "data-anfra-layer";
537
27
 
538
- declare const ATTR: {
539
- readonly container: "data-anfra-container";
540
- readonly block: "data-anfra-block";
541
- readonly query: "data-anfra-query";
542
- readonly control: "data-anfra-control";
543
- readonly label: "data-anfra-label";
544
- };
545
- /** A `[app/]name` reference as a marker writes it. */
546
- interface EntityRef {
547
- app: number;
548
- name: string;
549
- }
550
- /** Parse one token of a `data-anfra-query` or `data-anfra-control` attribute; undefined if malformed. */
551
- declare function parseRef(token: string): EntityRef | undefined;
552
- interface BuiltStructure extends InspectedStructure {
553
- /** The marked element behind each node key, for highlighting and picking. */
554
- elements: Map<string, Element>;
555
- /** The node keys an element stands for: its own node, and one per entity it is marked with. */
556
- keysOf: Map<Element, string[]>;
557
- }
558
- /**
559
- * Read the structure off the document: one node per container or block, and one per entity a
560
- * marked element names, placed under the nearest marked ancestor. Keys are index paths (`0.2.1`)
561
- * so an unchanged tree keeps the same keys from one snapshot to the next.
562
- */
563
- declare function buildStructure(doc: Document, apps: readonly App[]): BuiltStructure;
564
-
565
- /** Provision the SDK in `win` from its host, and install it. Returns once `Anfra` exists. */
566
- declare function bootstrap(win: Window): void;
567
-
568
- export { App, AppDeclaration, AppJson, Backend, Condition, ConditionValue, Control, ControlMappingJson, CrossFilter, CrossFilterJson, DataAppError, DatasetDescriptor, DateDrillControl, DateDrillDeclaration, DateGrain, type Edge, EntityKind, ExecuteOptions, ExecuteSummary, ExportOptions, ExportResult, Filter, FilterAggregation, FilterDeclaration, FilterValueType, InspectedApp, InspectedStructure, LineageOptions, LineageResult, LineageTarget, Listener, LocateKind, Mapping, OVERLAY_ID, Query, QueryDeclaration, QueryResult, QuerySort, QueryState, RenderRequest, Rendering, Row, SANDBOX_GLOBAL, ATTR as STRUCTURE_ATTRIBUTES, Sdk, SdkEnvironment, SdkFeatures, Selection, SelectionCondition, Unsubscribe, User, VERSION, bootstrap, buildStructure, createSdk, installSandbox, parseRef };
28
+ export { LAYER_ATTRIBUTE, SANDBOX_GLOBAL, Sdk, installSandbox };