@holistics/anfra-sdk 0.15.1 → 0.17.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/README.md +2 -1
- package/dist/ambient.d.ts +2 -1
- package/dist/api.d.ts +11 -5
- package/dist/api.js +40 -30
- package/dist/app.d.ts +5 -5
- package/dist/app.js +22 -12
- package/dist/{bootstrap-hLhpijIb.d.ts → bootstrap-q1J7GUxa.d.ts} +55 -18
- package/dist/build.d.ts +2 -2
- package/dist/chunk-32566ZNE.js +1278 -0
- package/dist/{chunk-S6XLP6U4.js → chunk-3ZWUCECU.js} +45 -20
- package/dist/{chunk-YB7VYY72.js → chunk-6GBHCW5E.js} +102 -30
- package/dist/{chunk-KFD6CHLI.js → chunk-ACKFOANJ.js} +2 -0
- package/dist/{chunk-CYZQ7ZTJ.js → chunk-C26OVN2S.js} +6 -1
- package/dist/{chunk-PYAVAIAX.js → chunk-EL7CAVZ3.js} +1 -1
- package/dist/{chunk-GIHCQT6L.js → chunk-J5BTCP6T.js} +1 -1
- package/dist/chunk-SWNVCTT6.js +161 -0
- package/dist/common.d.ts +3 -3
- package/dist/common.js +19 -9
- package/dist/{data-BGX3V42T.js → data-TDUQTG3P.js} +8 -6
- package/dist/{declaration-ZL5B676C.js → declaration-RJFU4ZLJ.js} +2 -2
- package/dist/errors-IhdhKO-6.d.ts +119 -0
- package/dist/host.d.ts +2 -2
- package/dist/host.js +17 -17
- package/dist/{menu-BFLb7dVq.d.ts → menu-CRAFaQ8s.d.ts} +21 -5
- package/dist/{overview-L4KLGZNP.js → overview-RV2IV6PJ.js} +23 -23
- package/dist/{plugin-B7SpJLBm.d.ts → plugin-BdLabbah.d.ts} +2 -2
- package/dist/plugins.d.ts +11 -2
- package/dist/plugins.js +38 -21
- package/dist/{queries-QFN4DI25.js → queries-5TTPOB7R.js} +32 -30
- package/dist/{structure-Z2QK5MGH.js → structure-MTLCRTJ4.js} +11 -9
- package/dist/{tab-LSITVMKV.js → tab-XL2HS5W4.js} +20 -18
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +4 -4
- package/dist/{types-CKytl8ds.d.ts → types-C_i7V0DA.d.ts} +46 -14
- package/package.json +2 -1
- package/dist/chunk-F6B3EGFV.js +0 -750
- package/dist/chunk-KCTLO3CO.js +0 -41
- package/dist/errors-CKvqVaqU.d.ts +0 -30
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ inspects, and never thrown over: a wrong name or a block inside a block is repor
|
|
|
113
113
|
import { coreApiBackend, coreClient, loadDatasets } from '@holistics/anfra-sdk/api';
|
|
114
114
|
import { createHost } from '@holistics/anfra-sdk/host';
|
|
115
115
|
import {
|
|
116
|
-
corePlugin, exportPlugin, inspectPlugin, lineagePlugin, renderPlugin,
|
|
116
|
+
corePlugin, exportPlugin, inspectPlugin, lineagePlugin, renderPlugin, viewUnderlyingDataPlugin,
|
|
117
117
|
} from '@holistics/anfra-sdk/plugins';
|
|
118
118
|
|
|
119
119
|
const client = coreClient('/api'); // the core API, on whichever server serves it
|
|
@@ -127,6 +127,7 @@ const host = createHost({ // one per page
|
|
|
127
127
|
lineagePlugin(backend), // Anfra.lineage(), and the panel's Lineage tab
|
|
128
128
|
renderPlugin(), // Anfra.render(): the host saves PNGs and PDFs the frame makes
|
|
129
129
|
inspectPlugin(), // what an inspect panel needs
|
|
130
|
+
viewUnderlyingDataPlugin(), // "View underlying data" on a chart point's menu
|
|
130
131
|
],
|
|
131
132
|
allowOrigins: ['https://cdn.acme.com'], // optional: more origins apps may load from
|
|
132
133
|
});
|
package/dist/ambient.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* the surface, which is `Sdk` and the types it leads to.
|
|
8
8
|
*
|
|
9
9
|
* A query is a dataset and an AQL body: the SDK does not parse the AQL, so a syntax error or an
|
|
10
|
-
* unknown field arrives as a `
|
|
10
|
+
* unknown field arrives at execute, as a `DataAppError` with code `query_invalid`, rather than at
|
|
11
|
+
* the declaring line. See
|
|
11
12
|
* DESIGN.md for the shape of a whole app and CONTEXT.md for what each term means.
|
|
12
13
|
*/
|
|
13
14
|
import type { Sdk } from './app.js';
|
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'openapi-fetch';
|
|
2
|
-
import {
|
|
2
|
+
import { am as paths, al as components } from './types-C_i7V0DA.js';
|
|
3
3
|
import { DatasetDescriptor, Backend, BackendExportRequest, BackendQueryRequest } from './app.js';
|
|
4
4
|
import { DataAppError } from './app.js';
|
|
5
5
|
|
|
@@ -62,12 +62,18 @@ interface ApiErrorBody {
|
|
|
62
62
|
scope?: 'user' | 'client' | 'server' | string;
|
|
63
63
|
message: string;
|
|
64
64
|
details?: unknown;
|
|
65
|
+
context?: {
|
|
66
|
+
step?: string;
|
|
67
|
+
text?: string;
|
|
68
|
+
}[];
|
|
69
|
+
status?: number;
|
|
70
|
+
/** The request's id, as the server's log names it. */
|
|
71
|
+
request_id?: string;
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
67
|
-
* The SDK error an API error is
|
|
68
|
-
* (
|
|
69
|
-
* (
|
|
70
|
-
* (anfra-cloud does) still lands each one somewhere sensible.
|
|
74
|
+
* The SDK error an API error is: the API's own document, passed through. Nothing is re-mapped, so a
|
|
75
|
+
* code a host adds (anfra Cloud does) reaches the app as it is, by its scope. A body without a code
|
|
76
|
+
* (a proxy's error page) is read by its status.
|
|
71
77
|
*/
|
|
72
78
|
declare function toSdkError(status: number, body: ApiErrorBody | undefined): DataAppError;
|
|
73
79
|
|
package/dist/api.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
DataAppError,
|
|
3
|
+
connectionFailed,
|
|
4
|
+
contextOf,
|
|
5
|
+
fromHttpStatus,
|
|
6
|
+
invalidRequest,
|
|
7
|
+
toScope
|
|
8
|
+
} from "./chunk-SWNVCTT6.js";
|
|
6
9
|
import "./chunk-PKBMQBKP.js";
|
|
7
10
|
|
|
8
11
|
// src/api/client.ts
|
|
@@ -26,22 +29,20 @@ function violationsOf(details) {
|
|
|
26
29
|
if (!Array.isArray(vs) || vs.length === 0) return void 0;
|
|
27
30
|
return vs.map((v) => `${v.field}: ${v.message}`).join("\n");
|
|
28
31
|
}
|
|
32
|
+
function messageOf(body) {
|
|
33
|
+
return diagnosticsOf(body.details) ?? violationsOf(body.details) ?? body.message;
|
|
34
|
+
}
|
|
29
35
|
function toSdkError(status, body) {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
case "sidecar_unavailable":
|
|
41
|
-
return new TransportError(body.message, status);
|
|
42
|
-
default:
|
|
43
|
-
return body.scope === "server" || status >= 500 ? new TransportError(body.message, status) : new QueryError(body.message);
|
|
44
|
-
}
|
|
36
|
+
if (!body?.code) return fromHttpStatus(status, body?.message || `The server answered ${status}.`, { requestId: body?.request_id });
|
|
37
|
+
return new DataAppError({
|
|
38
|
+
code: body.code,
|
|
39
|
+
scope: toScope(body.scope),
|
|
40
|
+
message: messageOf(body),
|
|
41
|
+
status: body.status ?? status,
|
|
42
|
+
details: body.details,
|
|
43
|
+
context: contextOf(body.context),
|
|
44
|
+
requestId: body.request_id
|
|
45
|
+
});
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
// src/api/stream.ts
|
|
@@ -51,7 +52,12 @@ async function readEvents(body, onEvent) {
|
|
|
51
52
|
let buffered = "";
|
|
52
53
|
const line = (text) => {
|
|
53
54
|
if (!text.trim()) return false;
|
|
54
|
-
|
|
55
|
+
let event;
|
|
56
|
+
try {
|
|
57
|
+
event = JSON.parse(text);
|
|
58
|
+
} catch {
|
|
59
|
+
throw connectionFailed(`The server's answer is not one of its events: ${text.slice(0, 80)}`);
|
|
60
|
+
}
|
|
55
61
|
if (event.type === "ping") return false;
|
|
56
62
|
if (event.type === "end") {
|
|
57
63
|
const end = event;
|
|
@@ -77,7 +83,7 @@ async function readEvents(body, onEvent) {
|
|
|
77
83
|
} finally {
|
|
78
84
|
reader.releaseLock();
|
|
79
85
|
}
|
|
80
|
-
throw
|
|
86
|
+
throw connectionFailed("The connection to the server was cut before the answer ended.");
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
// src/api/backend.ts
|
|
@@ -111,9 +117,11 @@ function toColumns(columns) {
|
|
|
111
117
|
return columns.map((column) => {
|
|
112
118
|
const { semantic_type: semanticType, arrow_type: arrowType, db_type: dbType } = column;
|
|
113
119
|
if (semanticType === void 0 || arrowType === void 0 || dbType === void 0) {
|
|
114
|
-
throw new
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
throw new DataAppError({
|
|
121
|
+
code: "internal_server_error",
|
|
122
|
+
scope: "server",
|
|
123
|
+
message: `The server answered column '${column.name}' without its types (semantic_type, arrow_type, db_type), which a Data App decides by: the server is older than this SDK.`
|
|
124
|
+
});
|
|
117
125
|
}
|
|
118
126
|
return { ...column, semantic_type: semanticType, arrow_type: arrowType, db_type: dbType };
|
|
119
127
|
});
|
|
@@ -124,7 +132,7 @@ async function callCoreAPI(call) {
|
|
|
124
132
|
result = await call();
|
|
125
133
|
} catch (err) {
|
|
126
134
|
if (isAbort(err)) throw err;
|
|
127
|
-
throw
|
|
135
|
+
throw connectionFailed(`The server could not be reached: ${err.message}`);
|
|
128
136
|
}
|
|
129
137
|
const { data, error, response } = result;
|
|
130
138
|
if (!data) throw toSdkError(response.status, error?.error);
|
|
@@ -137,7 +145,7 @@ async function runQuery(client, body, signal) {
|
|
|
137
145
|
parseAs: "stream",
|
|
138
146
|
headers: { Accept: "application/x-ndjson" }
|
|
139
147
|
}));
|
|
140
|
-
if (!stream) throw
|
|
148
|
+
if (!stream) throw connectionFailed("The server answered the query with no body.");
|
|
141
149
|
const result = { sql: "", columns: [], result: { fields: [], records: [] }, has_more: false, timings: { steps: [], end_ms: 0 } };
|
|
142
150
|
try {
|
|
143
151
|
await readEvents(stream, (event) => {
|
|
@@ -161,7 +169,7 @@ async function runQuery(client, body, signal) {
|
|
|
161
169
|
});
|
|
162
170
|
} catch (err) {
|
|
163
171
|
if (isAbort(err) || !(err instanceof Error) || err.name !== "TypeError") throw err;
|
|
164
|
-
throw
|
|
172
|
+
throw connectionFailed(`The connection to the server failed: ${err.message}`);
|
|
165
173
|
}
|
|
166
174
|
return result;
|
|
167
175
|
}
|
|
@@ -199,7 +207,7 @@ function coreApiBackend(base, options = {}) {
|
|
|
199
207
|
const model = options.datasets?.[request.dataset]?.data_models.find((m) => m.name === request.model);
|
|
200
208
|
const field = model?.fields.find((f) => f.name === request.field);
|
|
201
209
|
if (!field) {
|
|
202
|
-
throw
|
|
210
|
+
throw invalidRequest(`Unknown field ${request.model}.${request.field} in dataset ${request.dataset}.`);
|
|
203
211
|
}
|
|
204
212
|
const ref = `${request.model}.${request.field}`;
|
|
205
213
|
const q = request.q.trim();
|
|
@@ -248,7 +256,9 @@ function toDescriptor(dataset) {
|
|
|
248
256
|
...field.label ? { label: field.label } : {},
|
|
249
257
|
type: field.type,
|
|
250
258
|
is_custom_measure: field.role === "measure",
|
|
251
|
-
...field.definedInDataset ? { defined_in_dataset: true } : {}
|
|
259
|
+
...field.definedInDataset ? { defined_in_dataset: true } : {},
|
|
260
|
+
...field.hidden ? { is_hidden: true } : {},
|
|
261
|
+
...field.role === "param" ? { is_param: true } : {}
|
|
252
262
|
}))
|
|
253
263
|
})),
|
|
254
264
|
metrics: (dataset.metrics ?? []).map((metric) => ({
|
|
@@ -261,7 +271,7 @@ function toDescriptor(dataset) {
|
|
|
261
271
|
async function loadDatasets(client, signal) {
|
|
262
272
|
const { data, error, response } = await client.POST("/core.show", { body: {}, signal });
|
|
263
273
|
if (!data) throw toSdkError(response.status, error?.error);
|
|
264
|
-
if (data.object.kind !== "repo") throw new
|
|
274
|
+
if (data.object.kind !== "repo") throw new DataAppError({ code: "internal_server_error", scope: "server", message: `core.show answered a ${data.object.kind}, not the repo.` });
|
|
265
275
|
const datasets = {};
|
|
266
276
|
data.object.datasets.filter((d) => d.models).forEach((d) => {
|
|
267
277
|
datasets[d.fqn] = toDescriptor(d);
|
package/dist/app.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 FrameMenuItem, I as InstalledPlugins, M as Mapping,
|
|
3
|
-
export { D as DataAppError,
|
|
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
|
|
5
|
-
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-
|
|
1
|
+
import { S as Sdk } from './bootstrap-q1J7GUxa.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-q1J7GUxa.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-IhdhKO-6.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 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';
|
|
5
|
+
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';
|
|
6
6
|
|
|
7
7
|
declare const SANDBOX_GLOBAL = "Anfra";
|
|
8
8
|
/**
|
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-ACKFOANJ.js";
|
|
5
5
|
import {
|
|
6
6
|
ATTR,
|
|
7
7
|
App,
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
createSdk,
|
|
23
23
|
installSandbox,
|
|
24
24
|
parseRef
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6GBHCW5E.js";
|
|
26
26
|
import {
|
|
27
27
|
FILTER_AGGREGATIONS
|
|
28
28
|
} from "./chunk-XIUFHRZE.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-3ZWUCECU.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_TOKENS,
|
|
32
32
|
DESIGN_TOKENS,
|
|
@@ -35,14 +35,19 @@ import {
|
|
|
35
35
|
designTheme,
|
|
36
36
|
resolveTheme
|
|
37
37
|
} from "./chunk-RXPNL7UR.js";
|
|
38
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-J5BTCP6T.js";
|
|
39
39
|
import {
|
|
40
40
|
DataAppError,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
GENERIC_CODES,
|
|
42
|
+
ValidationError,
|
|
43
|
+
callFailed,
|
|
44
|
+
connectionFailed,
|
|
45
|
+
forbidden,
|
|
46
|
+
fromHttpStatus,
|
|
47
|
+
hasErrorCode,
|
|
48
|
+
invalidRequest,
|
|
49
|
+
isDataAppError
|
|
50
|
+
} from "./chunk-SWNVCTT6.js";
|
|
46
51
|
import "./chunk-PKBMQBKP.js";
|
|
47
52
|
export {
|
|
48
53
|
App,
|
|
@@ -54,27 +59,32 @@ export {
|
|
|
54
59
|
DateDrillControl,
|
|
55
60
|
FILTER_AGGREGATIONS,
|
|
56
61
|
Filter,
|
|
62
|
+
GENERIC_CODES,
|
|
57
63
|
InstalledPlugins,
|
|
58
64
|
LAYER_ATTRIBUTE,
|
|
59
65
|
Mapping,
|
|
60
66
|
OVERLAY_ID,
|
|
61
67
|
PROVISION_ELEMENT_ID,
|
|
62
|
-
PermissionError,
|
|
63
68
|
Query,
|
|
64
|
-
QueryError,
|
|
65
69
|
SANDBOX_GLOBAL,
|
|
66
70
|
ATTR as STRUCTURE_ATTRIBUTES,
|
|
67
71
|
Sdk,
|
|
68
72
|
THEME_TOKENS,
|
|
69
|
-
TransportError,
|
|
70
73
|
VERSION,
|
|
71
74
|
ValidationError,
|
|
72
75
|
bootstrap,
|
|
73
76
|
buildStructure,
|
|
77
|
+
callFailed,
|
|
74
78
|
checkTarget,
|
|
79
|
+
connectionFailed,
|
|
75
80
|
createSdk,
|
|
76
81
|
designTheme,
|
|
82
|
+
forbidden,
|
|
83
|
+
fromHttpStatus,
|
|
84
|
+
hasErrorCode,
|
|
77
85
|
installSandbox,
|
|
86
|
+
invalidRequest,
|
|
87
|
+
isDataAppError,
|
|
78
88
|
parseRef,
|
|
79
89
|
resolveTheme
|
|
80
90
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DataAppError, V as ValidationError,
|
|
2
|
-
import { X as Listener,
|
|
3
|
-
import { e as PluginInfo, j as ThemeScheme, l as ThemeTokens, h as Theme, d as MenuTargetKind, c as MenuTarget, N as NodeTarget } from './menu-
|
|
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-IhdhKO-6.js';
|
|
2
|
+
import { X as Listener, aj as Unsubscribe, D as DatasetDescriptor, y as ExportOptions, z as ExportResult, a9 as RenderRequest, aa as Rendering, W as LineageTarget, U as LineageOptions, V as LineageResult, 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, ad as SdkFeatures, ae as Selection, af as SelectionCondition, ab as Row, Y as LocateKind, a1 as QueryDeclaration, a6 as QueryState, a4 as QueryResult, a5 as QuerySort, a as AppDeclaration, a3 as QueryRequest, u as ExecuteOptions, v as ExecuteSummary, f as BackendExportRequest, b as AppJson, L as InspectedApp, ak as User, ac as SdkEnvironment, Q as InspectedStructure } from './types-C_i7V0DA.js';
|
|
3
|
+
import { e as PluginInfo, j as ThemeScheme, l as ThemeTokens, h as Theme, d as MenuTargetKind, c as MenuTarget, N as NodeTarget } from './menu-CRAFaQ8s.js';
|
|
4
4
|
|
|
5
5
|
interface NotificationTarget {
|
|
6
6
|
notifyChange(): void;
|
|
@@ -259,7 +259,7 @@ interface AppContext {
|
|
|
259
259
|
/** Brings an entity's marked elements into view; false when none is on the page. */
|
|
260
260
|
locate(kind: LocateKind, name: string): boolean;
|
|
261
261
|
/** Opens the content menu on these rows of this query, for the event; whether one opens. */
|
|
262
|
-
menu(query: Query, event: Event, rows: readonly Row[], fields?: readonly string[]): boolean;
|
|
262
|
+
menu(query: Query, event: Event, rows: readonly Row[], fields?: readonly string[], measure?: string): boolean;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
declare class Query extends Observable {
|
|
@@ -330,11 +330,13 @@ declare class Query extends Observable {
|
|
|
330
330
|
* Opens the menu on these rows of this query: the items plugins and the host offer for a point
|
|
331
331
|
* of data, such as "View underlying data". Call it from your chart's own right-click handler,
|
|
332
332
|
* with the event and the rows under the pointer, as for `select`; `fields` narrows the dimensions
|
|
333
|
-
* that take part
|
|
334
|
-
*
|
|
333
|
+
* that take part, and `measure` names the measure column the point shows (a chart's series), for
|
|
334
|
+
* items that are about one measure. Whether a menu opens: when one does, the event's default (the
|
|
335
|
+
* browser's menu) is prevented, and when none would (no plugin offers one), nothing happens.
|
|
335
336
|
*/
|
|
336
337
|
menu(event: Event, rows: Row | readonly Row[], options?: {
|
|
337
338
|
fields?: readonly string[];
|
|
339
|
+
measure?: string;
|
|
338
340
|
}): boolean;
|
|
339
341
|
/**
|
|
340
342
|
* Cross-filters this query's targets by the rows the reader picked.
|
|
@@ -465,7 +467,12 @@ declare class App extends Observable implements AppContext {
|
|
|
465
467
|
* rebucketed anything yet, so the rows they are clicking still belong to the applied grain.
|
|
466
468
|
*/
|
|
467
469
|
private drillTransformations;
|
|
468
|
-
menu(query: Query, event: Event, rows: readonly Row[], fields?: readonly string[]): boolean;
|
|
470
|
+
menu(query: Query, event: Event, rows: readonly Row[], fields?: readonly string[], measure?: string): boolean;
|
|
471
|
+
/**
|
|
472
|
+
* @internal Backs the kernel's `queryRequest(query)`: what the query runs with now, from its applied
|
|
473
|
+
* state, as `fetchPage` and `exportQuery` build theirs.
|
|
474
|
+
*/
|
|
475
|
+
requestFor(query: Query): QueryRequest;
|
|
469
476
|
select(query: Query, rows: readonly Row[], fields?: readonly string[]): void;
|
|
470
477
|
/** True when a control or the selection has changed since the queries reading it last ran. */
|
|
471
478
|
get hasChanges(): boolean;
|
|
@@ -711,11 +718,16 @@ type PopoverSide = 'right' | 'left' | 'bottom' | 'top';
|
|
|
711
718
|
* carries only the listener and the item list until someone opens one. One is open at a time.
|
|
712
719
|
*/
|
|
713
720
|
|
|
714
|
-
/**
|
|
715
|
-
interface
|
|
716
|
-
/** Under the plugin's name once added (`underlying` is `explore.underlying`). */
|
|
717
|
-
id: string;
|
|
721
|
+
/** One entry a frame item shows for a target: what it runs, or why it can't. */
|
|
722
|
+
interface FrameMenuEntry {
|
|
718
723
|
label: string;
|
|
724
|
+
/** Why it can't run: shown, and the entry can't be picked. An entry with neither this nor `run` is left out. */
|
|
725
|
+
disabled?: string;
|
|
726
|
+
run?: () => unknown;
|
|
727
|
+
}
|
|
728
|
+
interface FrameMenuItemBase {
|
|
729
|
+
/** Under the plugin's name once added (`open` is `view-underlying-data.open`). */
|
|
730
|
+
id: string;
|
|
719
731
|
target: MenuTargetKind;
|
|
720
732
|
/**
|
|
721
733
|
* Whether it applies to this target; it shows when this is left out. Presentation only: frame code
|
|
@@ -723,8 +735,21 @@ interface FrameMenuItem {
|
|
|
723
735
|
* the host, in the calls the item makes.
|
|
724
736
|
*/
|
|
725
737
|
when?: (target: MenuTarget) => boolean;
|
|
726
|
-
run: (target: MenuTarget) => unknown;
|
|
727
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* An entry a plugin's frame half adds to the menu, for one kind of target: one `label` that runs
|
|
741
|
+
* `run`, or the `entries` it shows for each target, decided as the menu opens (one per measure of a
|
|
742
|
+
* point, say, or one that can't run and says why; none leaves the item out).
|
|
743
|
+
*/
|
|
744
|
+
type FrameMenuItem = FrameMenuItemBase & ({
|
|
745
|
+
label: string;
|
|
746
|
+
run: (target: MenuTarget) => unknown;
|
|
747
|
+
entries?: never;
|
|
748
|
+
} | {
|
|
749
|
+
entries: (target: MenuTarget) => readonly FrameMenuEntry[];
|
|
750
|
+
label?: never;
|
|
751
|
+
run?: never;
|
|
752
|
+
});
|
|
728
753
|
interface ModalInput {
|
|
729
754
|
title: string;
|
|
730
755
|
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
@@ -761,9 +786,13 @@ interface Opened {
|
|
|
761
786
|
declare const KERNEL_ERRORS: {
|
|
762
787
|
readonly DataAppError: typeof DataAppError;
|
|
763
788
|
readonly ValidationError: typeof ValidationError;
|
|
764
|
-
readonly
|
|
765
|
-
readonly
|
|
766
|
-
readonly
|
|
789
|
+
readonly invalidRequest: typeof invalidRequest;
|
|
790
|
+
readonly forbidden: typeof forbidden;
|
|
791
|
+
readonly connectionFailed: typeof connectionFailed;
|
|
792
|
+
readonly callFailed: typeof callFailed;
|
|
793
|
+
readonly fromHttpStatus: typeof fromHttpStatus;
|
|
794
|
+
readonly hasErrorCode: typeof hasErrorCode;
|
|
795
|
+
readonly isDataAppError: typeof isDataAppError;
|
|
767
796
|
};
|
|
768
797
|
interface FrameKernel {
|
|
769
798
|
/** The plugin's name: what its calls, events and API are named under. */
|
|
@@ -771,12 +800,20 @@ interface FrameKernel {
|
|
|
771
800
|
readonly window: Window;
|
|
772
801
|
/** The SDK instance the definition gets as `Anfra`: its apps, datasets and user. */
|
|
773
802
|
readonly sdk: Sdk;
|
|
774
|
-
/** The SDK's
|
|
803
|
+
/** The SDK's errors and the helpers that make them: reject with these, in the API's shape. */
|
|
775
804
|
readonly errors: typeof KERNEL_ERRORS;
|
|
776
805
|
/** The overlay every part of the SDK shows nodes with. */
|
|
777
806
|
readonly overlay: Overlay;
|
|
778
807
|
/** The page's structure as it is now. */
|
|
779
808
|
structure: () => BuiltStructure;
|
|
809
|
+
/**
|
|
810
|
+
* What a query runs with now, from its applied state: its dataset, its AQL, what reaches it
|
|
811
|
+
* (mapped controls, the selection, the reader's sort, date drills) and the timezone, as its own
|
|
812
|
+
* run and export are built. While a rerun is in flight, that is the rerun's request, not the one
|
|
813
|
+
* behind the result on screen. For a plugin that runs a variant of the query: it changes what it
|
|
814
|
+
* needs and sends it as `core.submitQuery`, through the pipeline like any query.
|
|
815
|
+
*/
|
|
816
|
+
queryRequest: (query: Query) => QueryRequest;
|
|
780
817
|
/** Make a host half's call, by its full name (`core.submitQuery`). */
|
|
781
818
|
call: <T = unknown>(name: string, request?: unknown, signal?: AbortSignal) => Promise<T>;
|
|
782
819
|
/** Send the host one of this plugin's events, by its name under the plugin. */
|
|
@@ -814,5 +851,5 @@ type PluginSetup = readonly [name: string, setup: ((kernel: FrameKernel) => void
|
|
|
814
851
|
/** Provision the SDK in `win` from its host, run the plugins' setups, and install it. Returns once `Anfra` exists. */
|
|
815
852
|
declare function bootstrap(win: Window, setups?: readonly PluginSetup[]): void;
|
|
816
853
|
|
|
817
|
-
export { Control as C, DateDrillControl as D, Filter as F, InstalledPlugins as I, Mapping as M, OVERLAY_ID as O, Query as Q, Sdk as S, VERSION as V, App as a, CrossFilter as b, ATTR as
|
|
818
|
-
export type { AnfraPlugins as A, Edge as E, PluginSetup as P, DeprecatedFeatures as c, FrameKernel as d,
|
|
854
|
+
export { Control as C, DateDrillControl as D, Filter as F, InstalledPlugins as I, Mapping as M, OVERLAY_ID as O, Query as Q, Sdk as S, VERSION as V, App as a, CrossFilter as b, ATTR as n, bootstrap as o, buildStructure as p, createSdk as q, parseRef as r };
|
|
855
|
+
export type { AnfraPlugins as A, Edge as E, PluginSetup as P, DeprecatedFeatures as c, FrameKernel as d, FrameMenuEntry as e, FrameMenuItem as f, ModalInput as g, Opened as h, PluginApi as i, PluginMembers as j, PluginName as k, PopoverInput as l, PopoverSide as m };
|
package/dist/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FrameHalf } from './host.js';
|
|
2
|
-
import './types-
|
|
3
|
-
import './menu-
|
|
2
|
+
import './types-C_i7V0DA.js';
|
|
3
|
+
import './menu-CRAFaQ8s.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @holistics/anfra-sdk/build: building an SDK plugin's frame half into the script source a host
|