@holistics/anfra-sdk 0.21.0 → 0.22.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/api.d.ts +1 -1
- package/dist/app.d.ts +5 -5
- package/dist/app.js +3 -3
- package/dist/{bootstrap-BxBqFhgm.d.ts → bootstrap-fGoj2ap1.d.ts} +49 -4
- package/dist/build.d.ts +2 -2
- package/dist/{chunk-7NZOMBYE.js → chunk-7GQZU5FL.js} +1 -1
- package/dist/{chunk-ACKFOANJ.js → chunk-DWQUIHUX.js} +4 -1
- package/dist/{chunk-E3Q3FRKQ.js → chunk-EOFPMSND.js} +1 -1
- package/dist/{chunk-IHRNKDMO.js → chunk-YPGMBSOZ.js} +381 -11
- package/dist/common.d.ts +3 -3
- package/dist/common.js +1 -1
- package/dist/{errors-DR05L6-y.d.ts → errors-kH5eHvNO.d.ts} +1 -1
- package/dist/host.d.ts +2 -2
- package/dist/host.js +3 -3
- package/dist/{overview-KOQJNG2Y.js → overview-CD6NY3VQ.js} +2 -2
- package/dist/{plugin-BIcighnC.d.ts → plugin-DG2NDTCT.d.ts} +2 -2
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +3 -3
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{menu-CuTKq-dC.d.ts → theme-FQ_1b569.d.ts} +71 -55
- package/dist/{types-C_-1rgj2.d.ts → types-BE767W6G.d.ts} +94 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'openapi-fetch';
|
|
2
|
-
import {
|
|
2
|
+
import { aF as paths, aE as components } from './types-BE767W6G.js';
|
|
3
3
|
import { DatasetDescriptor, Backend, BackendExportRequest, BackendQueryRequest } from './app.js';
|
|
4
4
|
import { DataAppError } from './app.js';
|
|
5
5
|
|
package/dist/app.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { S as Sdk } from './bootstrap-
|
|
2
|
-
export { A as AnfraPlugins, a as App, C as Control, b as CrossFilter, D as DateDrillControl, c as DeprecatedFeatures, E as Edge, F as Filter, d as FrameKernel, e as FrameMenuEntry, f as FrameMenuItem, I as InstalledPlugins, M as Mapping, g as ModalInput, O as OVERLAY_ID, h as Opened, i as PluginApi, j as PluginMembers, k as PluginName, P as PluginSetup, l as PopoverInput, m as PopoverSide, Q as Query, n as STRUCTURE_ATTRIBUTES, V as VERSION, o as bootstrap, p as buildStructure, q as createSdk, r as parseRef } from './bootstrap-
|
|
3
|
-
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-
|
|
4
|
-
export { A as Aggregation, a as
|
|
1
|
+
import { S as Sdk } from './bootstrap-fGoj2ap1.js';
|
|
2
|
+
export { A as AnfraPlugins, a as App, C as Control, b as CrossFilter, D as DateDrillControl, c as DeprecatedFeatures, E as Edge, F as Filter, d as FrameKernel, e as FrameMenuEntry, f as FrameMenuItem, I as InstalledPlugins, M as Mapping, g as ModalInput, O as OVERLAY_ID, h as Opened, i as PluginApi, j as PluginMembers, k as PluginName, P as PluginSetup, l as PopoverInput, m as PopoverSide, Q as Query, n as STRUCTURE_ATTRIBUTES, V as VERSION, o as bootstrap, p as buildStructure, q as createSdk, r as parseRef } from './bootstrap-fGoj2ap1.js';
|
|
3
|
+
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-kH5eHvNO.js';
|
|
4
|
+
export { A as Aggregation, a as Annotation, b as AnnotationInput, c as AnnotationKind, d as AnnotationSeverity, e as AppDeclaration, f as AppJson, g as ArrowType, B as Backend, h as BackendCondition, i as BackendDateDrill, j as BackendExportRequest, k as BackendFilter, l as BackendLineageRequest, m as BackendQueryRequest, n as BackendQueryResult, o as BackendSort, C as CallStamp, p as ColumnMeta, q as Condition, r as ConditionValue, s as ControlMappingJson, t as CrossFilterJson, D as DatasetDescriptor, u as DateDrillDeclaration, v as DateGrain, w as DateTransformation, E as EntityKind, x as EntityRef, y as EntityUsage, z as ExecuteOptions, F as ExecuteSummary, G as ExportFormat, H as ExportFormatOptions, I as ExportOptions, J as ExportResult, K as FILTER_AGGREGATIONS, L as FieldLineage, M as FieldSuggestionsRequest, N as FilterAggregation, O as FilterDeclaration, P as FilterValueType, Q as InspectedApp, R as InspectedControl, S as InspectedError, T as InspectedQuery, U as InspectedSelection, V as InspectedStructure, W as LineageCard, X as LineageDiagram, Y as LineageNode, Z as LineageOptions, _ as LineageResult, $ as LineageTarget, a0 as Listener, a1 as LocateKind, a2 as LocateTarget, a3 as MappingJson, a4 as Operator, a5 as QueryCacheResult, a6 as QueryCacheSettings, a7 as QueryDebug, a8 as QueryDeclaration, a9 as QueryInput, aa as QueryInputDefaults, ab as QueryPagination, ac as QueryPivot, ad as QueryRequest, ae as QueryResult, af as QuerySeeds, ag as QuerySort, ah as QueryStamp, ai as QueryState, aj as QueryTimings, ak as RangeAnchor, al as RenderFormat, am as RenderRequest, an as Rendering, ao as ResolvedRowsAnchor, ap as Row, aq as RowsAnchor, ar as SdkEnvironment, as as SdkFeatures, at as Selection, au as SelectionCondition, av as SemanticType, aw as SeriesAnchor, ax as SeriesPoint, ay as StructureKind, az as StructureNode, aA as Unsubscribe, aB as User, aC as ValueAnchor, aD as WeekStartDay } from './types-BE767W6G.js';
|
|
5
5
|
export { A as AppConsoleEvent, a as AppErrorEvent, b as AppErrorKind } from './runtimeErrors-gswksjDk.js';
|
|
6
|
-
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
|
|
6
|
+
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 TargetPoint, h as TargetRect, i as Theme, j as ThemeInput, k as ThemeScheme, l as ThemeToken, m as ThemeTokens, n as checkTarget, o as designTheme, r as resolveTheme } from './theme-FQ_1b569.js';
|
|
7
7
|
|
|
8
8
|
declare const SANDBOX_GLOBAL = "Anfra";
|
|
9
9
|
/**
|
package/dist/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-UUKXJSE4.js";
|
|
2
2
|
import {
|
|
3
3
|
checkTarget
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DWQUIHUX.js";
|
|
5
5
|
import {
|
|
6
6
|
ATTR,
|
|
7
7
|
App,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
createSdk,
|
|
23
23
|
installSandbox,
|
|
24
24
|
parseRef
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YPGMBSOZ.js";
|
|
26
26
|
import {
|
|
27
27
|
FILTER_AGGREGATIONS
|
|
28
28
|
} from "./chunk-XIUFHRZE.js";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
designTheme,
|
|
36
36
|
resolveTheme
|
|
37
37
|
} from "./chunk-RXPNL7UR.js";
|
|
38
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-EOFPMSND.js";
|
|
39
39
|
import "./chunk-GPBYPSWK.js";
|
|
40
40
|
import {
|
|
41
41
|
DataAppError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DataAppError, V as ValidationError, k as invalidRequest, h as forbidden, g as connectionFailed, f as callFailed, i as fromHttpStatus, j as hasErrorCode, l as isDataAppError } from './errors-
|
|
2
|
-
import {
|
|
3
|
-
import { e as PluginInfo,
|
|
1
|
+
import { D as DataAppError, V as ValidationError, k as invalidRequest, h as forbidden, g as connectionFailed, f as callFailed, i as fromHttpStatus, j as hasErrorCode, l as isDataAppError } from './errors-kH5eHvNO.js';
|
|
2
|
+
import { a0 as Listener, aA as Unsubscribe, D as DatasetDescriptor, I as ExportOptions, J as ExportResult, am as RenderRequest, an as Rendering, $ as LineageTarget, Z as LineageOptions, _ as LineageResult, E as EntityKind, q as Condition, O as FilterDeclaration, B as Backend, P as FilterValueType, r as ConditionValue, u as DateDrillDeclaration, v as DateGrain, N as FilterAggregation, t as CrossFilterJson, s as ControlMappingJson, aa as QueryInputDefaults, as as SdkFeatures, at as Selection, au as SelectionCondition, ap as Row, z as ExecuteOptions, F as ExecuteSummary, a1 as LocateKind, a9 as QueryInput, a8 as QueryDeclaration, a6 as QueryCacheSettings, ag as QuerySort, ai as QueryState, ae as QueryResult, a as Annotation, b as AnnotationInput, e as AppDeclaration, aD as WeekStartDay, ad as QueryRequest, j as BackendExportRequest, C as CallStamp, f as AppJson, Q as InspectedApp, aB as User, ar as SdkEnvironment, V as InspectedStructure } from './types-BE767W6G.js';
|
|
3
|
+
import { R as RowsTarget, e as PluginInfo, k as ThemeScheme, m as ThemeTokens, i as Theme, d as MenuTargetKind, c as MenuTarget, N as NodeTarget } from './theme-FQ_1b569.js';
|
|
4
4
|
|
|
5
5
|
interface NotificationTarget {
|
|
6
6
|
notifyChange(): void;
|
|
@@ -418,6 +418,15 @@ declare class Query extends Observable {
|
|
|
418
418
|
runningSignature?: string;
|
|
419
419
|
/** The signature of its last run, when that run failed. */
|
|
420
420
|
private failedSignature?;
|
|
421
|
+
/** Each plugin's annotations on the current result, by plugin, in the order they were first set. */
|
|
422
|
+
private annotationSets;
|
|
423
|
+
/**
|
|
424
|
+
* The results that are the current one: the last run's, and each that a page extended it into, so
|
|
425
|
+
* annotations computed before a `fetchMore` still land.
|
|
426
|
+
*/
|
|
427
|
+
private currentResults;
|
|
428
|
+
/** `annotations` as last read, until a set or the result changes. */
|
|
429
|
+
private resolvedAnnotations?;
|
|
421
430
|
constructor(name: string, app: AppContext & Observable, declaration: QueryDeclaration, id: number);
|
|
422
431
|
/** What it was declared with, or last updated to. */
|
|
423
432
|
get declaration(): QueryDeclaration;
|
|
@@ -427,7 +436,8 @@ declare class Query extends Observable {
|
|
|
427
436
|
get isRemoved(): boolean;
|
|
428
437
|
/**
|
|
429
438
|
* Swaps what this query is: its dataset, its AQL, its page size, its cache, checked as `createQuery` checks
|
|
430
|
-
* them. Its name, its edges and its result stay; the result until the rerun replaces it
|
|
439
|
+
* them. Its name, its edges and its result stay; the result until the rerun replaces it, but its
|
|
440
|
+
* annotations go at once, and plugins can't annotate that result any more. Runs
|
|
431
441
|
* nothing: the query is dirty, and the next `app.execute()` reruns it, so several edits go out
|
|
432
442
|
* as one run. Back to the first page. A run or page in flight is aborted, and `fetchMore` does
|
|
433
443
|
* nothing until the rerun. A new AQL or dataset clears the sort (unless `sort` is given) and a
|
|
@@ -547,6 +557,18 @@ declare class Query extends Observable {
|
|
|
547
557
|
* `app.selection.rows` still holds what the author passed, verbatim.
|
|
548
558
|
*/
|
|
549
559
|
get selectedRows(): readonly Row[];
|
|
560
|
+
/**
|
|
561
|
+
* What plugins say about this query's current result, every plugin's merged: draw the kinds your
|
|
562
|
+
* chart declares in `data-anfra-annotations`, by `index` for a rows anchor. Each has its plugin
|
|
563
|
+
* and a stable `key`. A change notifies through `subscribe`; they go when the result is replaced.
|
|
564
|
+
*/
|
|
565
|
+
get annotations(): readonly Annotation[];
|
|
566
|
+
/** @internal Whether `result` is this query's current result, or one a page has since extended. */
|
|
567
|
+
isCurrentResult(result: QueryResult): boolean;
|
|
568
|
+
/** @internal `kernel.annotate`'s, checked by then: replace one plugin's set, `[]` clearing it. */
|
|
569
|
+
setAnnotations(plugin: string, annotations: readonly AnnotationInput[]): void;
|
|
570
|
+
/** Every plugin's annotations go, with the result they were about. */
|
|
571
|
+
private clearAnnotations;
|
|
550
572
|
/** @internal */
|
|
551
573
|
markExecuting(): void;
|
|
552
574
|
/** @internal The cache duration it runs with: its own, or its app's default. Absent: the backend's default. */
|
|
@@ -696,6 +718,11 @@ declare class App extends Observable implements AppContext {
|
|
|
696
718
|
*/
|
|
697
719
|
private drillTransformations;
|
|
698
720
|
menu(query: Query, event: Event, rows: readonly Row[], fields?: readonly string[], measure?: string): boolean;
|
|
721
|
+
/**
|
|
722
|
+
* @internal What a menu on these rows of the query is about: their conditions, derived as a
|
|
723
|
+
* cross-filter's, and the annotations plugins set on them (on `measure`'s, when given).
|
|
724
|
+
*/
|
|
725
|
+
rowsTarget(query: Query, rows: readonly Row[], fields?: readonly string[], measure?: string): RowsTarget;
|
|
699
726
|
/**
|
|
700
727
|
* @internal Backs the kernel's `queryRequest(query)`: what the query runs with now, from its applied
|
|
701
728
|
* state, as `fetchPage` and `exportQuery` build theirs.
|
|
@@ -954,6 +981,14 @@ interface BuiltStructure extends InspectedStructure {
|
|
|
954
981
|
*/
|
|
955
982
|
declare function buildStructure(doc: Document, apps: readonly App[]): BuiltStructure;
|
|
956
983
|
|
|
984
|
+
/**
|
|
985
|
+
* The kernel's UI body: the menu, the modal and the popover plugins draw content UI with, in the
|
|
986
|
+
* plugin layer, on the host's `--anfra-*` tokens. Sent to a frame the first time it opens one
|
|
987
|
+
* (`anfra.body` for `anfra`), so a frame that never does carries none of it. The kernel hands it its
|
|
988
|
+
* shadow root, and keeps one open at a time. Also the annotations badge, and the list its popover
|
|
989
|
+
* shows (docs/designs/sdk-plugins.md, Annotations).
|
|
990
|
+
*/
|
|
991
|
+
|
|
957
992
|
/** Which side of its anchor a popover opens on. */
|
|
958
993
|
type PopoverSide = 'right' | 'left' | 'bottom' | 'top';
|
|
959
994
|
|
|
@@ -1102,6 +1137,16 @@ interface FrameKernel {
|
|
|
1102
1137
|
modal: (input: ModalInput) => Promise<Opened>;
|
|
1103
1138
|
/** Open a popover beside a node or a point, following it as the page scrolls. */
|
|
1104
1139
|
popover: (input: PopoverInput) => Promise<Opened>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Set this plugin's annotations on a query, replacing its last set; `[]` clears it. `result` is
|
|
1142
|
+
* the `query.result` they were computed from: when it is no longer the query's, nothing changes
|
|
1143
|
+
* and this returns false. Throws on a malformed annotation; a rows anchor's row the result lacks
|
|
1144
|
+
* is dropped quietly. They go when the query's result is replaced, or at once when the
|
|
1145
|
+
* definition updates the query, so annotate each new result (`query.subscribe`).
|
|
1146
|
+
*/
|
|
1147
|
+
annotate: (query: Query, annotations: readonly AnnotationInput[], options: {
|
|
1148
|
+
result: QueryResult;
|
|
1149
|
+
}) => boolean;
|
|
1105
1150
|
}
|
|
1106
1151
|
|
|
1107
1152
|
/** A plugin's frame setup, as the host's frame script hands it over: its name and its function. */
|
package/dist/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FrameHalf } from './host.js';
|
|
2
|
-
import './types-
|
|
3
|
-
import './
|
|
2
|
+
import './types-BE767W6G.js';
|
|
3
|
+
import './theme-FQ_1b569.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @holistics/anfra-sdk/build: building an SDK plugin's frame half into the script source a host
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/common/menu.ts
|
|
2
2
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
3
|
var isRect = (value) => isObject(value) && ["x", "y", "width", "height"].every((key) => typeof value[key] === "number");
|
|
4
|
+
var isPoint = (value) => isObject(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
|
|
4
5
|
var isNode = (value) => isObject(value) && typeof value.key === "string" && typeof value.kind === "string" && Array.isArray(value.problems) && Array.isArray(value.children);
|
|
5
6
|
function checkNode(value) {
|
|
6
7
|
if (!isObject(value) || value.kind !== "node" || !isNode(value.node) || !Array.isArray(value.ancestors) || !value.ancestors.every(isNode) || !isRect(value.rect)) return void 0;
|
|
@@ -22,6 +23,7 @@ function checkTarget(value) {
|
|
|
22
23
|
if (value.measure !== void 0 && typeof value.measure !== "string") return void 0;
|
|
23
24
|
const node = value.node === void 0 ? void 0 : checkNode(value.node);
|
|
24
25
|
if (value.node !== void 0 && !node) return void 0;
|
|
26
|
+
if (value.at !== void 0 && !isPoint(value.at)) return void 0;
|
|
25
27
|
return {
|
|
26
28
|
kind: "rows",
|
|
27
29
|
app: value.app,
|
|
@@ -31,7 +33,8 @@ function checkTarget(value) {
|
|
|
31
33
|
...value.measure !== void 0 ? { measure: value.measure } : {},
|
|
32
34
|
conditions: value.conditions,
|
|
33
35
|
...value.expression !== void 0 ? { expression: value.expression } : {},
|
|
34
|
-
...node ? { node } : {}
|
|
36
|
+
...node ? { node } : {},
|
|
37
|
+
...value.at !== void 0 ? { at: { x: value.at.x, y: value.at.y } } : {}
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
|