@aintela/bi 0.2.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 +299 -0
- package/dist/BiClientProvider-CWJochvi.js +219 -0
- package/dist/BiClientProvider-CWJochvi.js.map +1 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
- package/dist/ChartContext-C_f_6khG.js +14 -0
- package/dist/ChartContext-C_f_6khG.js.map +1 -0
- package/dist/DashboardParametersContext-Clv--79U.js +39 -0
- package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
- package/dist/cards/ChartCard.d.ts +62 -0
- package/dist/cards/DataTableCard.d.ts +55 -0
- package/dist/cards/GaugeCard.d.ts +20 -0
- package/dist/cards/GaugeGroup.d.ts +12 -0
- package/dist/cards/MapBubbles.d.ts +35 -0
- package/dist/cards/MapConnections.d.ts +28 -0
- package/dist/cards/MetricCard.d.ts +15 -0
- package/dist/cards/MetricGroupCard.d.ts +10 -0
- package/dist/cards/TreeMapCard.d.ts +15 -0
- package/dist/cards/geoLayers.d.ts +23 -0
- package/dist/cards/index.d.ts +24 -0
- package/dist/cards/licenseGuard.d.ts +9 -0
- package/dist/cards/mapUtils.d.ts +23 -0
- package/dist/cards/useContainerRectangle.d.ts +9 -0
- package/dist/cards/worldMapPath.d.ts +7 -0
- package/dist/cards.d.ts +2 -0
- package/dist/cards.js +28 -0
- package/dist/cards.js.map +1 -0
- package/dist/client/BiClient.d.ts +160 -0
- package/dist/client/BiClientProvider.d.ts +21 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/composer/environment/environmentDom.d.ts +31 -0
- package/dist/composer/environment/types.d.ts +67 -0
- package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
- package/dist/composer/index.d.ts +66 -0
- package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
- package/dist/composer/llm/ExamplePad.d.ts +18 -0
- package/dist/composer/llm/PrototypePad.d.ts +13 -0
- package/dist/composer/llm/useDashboardPad.d.ts +25 -0
- package/dist/composer/models/catalog.d.ts +33 -0
- package/dist/composer/models/sketchModels.d.ts +102 -0
- package/dist/composer/models/utils.d.ts +9 -0
- package/dist/composer/pad/CardSketch.d.ts +25 -0
- package/dist/composer/pad/ClonedComponent.d.ts +13 -0
- package/dist/composer/pad/DashboardPad.d.ts +38 -0
- package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
- package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
- package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
- package/dist/composer/pad/FilterSketch.d.ts +10 -0
- package/dist/composer/pad/HoverButton.d.ts +12 -0
- package/dist/composer/pad/TitleSketch.d.ts +19 -0
- package/dist/composer/pad/ToolBox.d.ts +11 -0
- package/dist/composer/store/ComposerProvider.d.ts +36 -0
- package/dist/composer/store/createComposerStore.d.ts +107 -0
- package/dist/composer/store/drafts.d.ts +20 -0
- package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
- package/dist/composer/view/ComposerView.d.ts +49 -0
- package/dist/composer/view/DashboardPin.d.ts +3 -0
- package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
- package/dist/composer/view/DrawablePrompt.d.ts +22 -0
- package/dist/composer/view/EntryEmptyState.d.ts +22 -0
- package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
- package/dist/composer/view/composerAnimations.d.ts +11 -0
- package/dist/composer/view/composerTypes.d.ts +18 -0
- package/dist/composer/view/data/suggestions.d.ts +10 -0
- package/dist/composer/view/data/templates.d.ts +33 -0
- package/dist/composer/view/surfaces.d.ts +19 -0
- package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +99 -0
- package/dist/composer.js.map +1 -0
- package/dist/createBiTheme-TyUv_UHM.js +93 -0
- package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
- package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
- package/dist/data/dataUtils.d.ts +152 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/queryModel.d.ts +23 -0
- package/dist/data.d.ts +2 -0
- package/dist/data.js +37 -0
- package/dist/data.js.map +1 -0
- package/dist/dataUtils-CAUE5uZY.js +372 -0
- package/dist/dataUtils-CAUE5uZY.js.map +1 -0
- package/dist/filters/VizAutoComplete.d.ts +23 -0
- package/dist/filters/VizDatePicker.d.ts +9 -0
- package/dist/filters/VizDateRangePicker.d.ts +14 -0
- package/dist/filters/VizSelect.d.ts +12 -0
- package/dist/filters/VizTextField.d.ts +8 -0
- package/dist/filters/VizTriggerButton.d.ts +9 -0
- package/dist/filters/filterFactory.d.ts +30 -0
- package/dist/filters/friendlyName.d.ts +4 -0
- package/dist/filters/index.d.ts +15 -0
- package/dist/filters.d.ts +2 -0
- package/dist/filters.js +15 -0
- package/dist/filters.js.map +1 -0
- package/dist/grid/BiErrorBoundary.d.ts +24 -0
- package/dist/grid/ChartContext.d.ts +14 -0
- package/dist/grid/GridCard.d.ts +45 -0
- package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
- package/dist/grid/GridLayout.d.ts +147 -0
- package/dist/grid/gridModels.d.ts +33 -0
- package/dist/grid/index.d.ts +14 -0
- package/dist/grid/types.d.ts +23 -0
- package/dist/grid/useGridConfigTranslator.d.ts +72 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +20 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/DashboardParametersContext.d.ts +32 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/useDashboardData.d.ts +20 -0
- package/dist/hooks/useDashboardLazyData.d.ts +79 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +16 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-BYc79sSy.js +131 -0
- package/dist/index-BYc79sSy.js.map +1 -0
- package/dist/index-C6JQ6770.js +4545 -0
- package/dist/index-C6JQ6770.js.map +1 -0
- package/dist/index-CZbCaXMC.js +15 -0
- package/dist/index-CZbCaXMC.js.map +1 -0
- package/dist/index-D3OoOPjl.js +259 -0
- package/dist/index-D3OoOPjl.js.map +1 -0
- package/dist/index-D7Oo_dC-.js +94 -0
- package/dist/index-D7Oo_dC-.js.map +1 -0
- package/dist/index-D7tVPX8d.js +347 -0
- package/dist/index-D7tVPX8d.js.map +1 -0
- package/dist/index-DGyvUtY3.js +494 -0
- package/dist/index-DGyvUtY3.js.map +1 -0
- package/dist/index-DOpx0R4Y.js +41 -0
- package/dist/index-DOpx0R4Y.js.map +1 -0
- package/dist/index-wtSLspPh.js +1065 -0
- package/dist/index-wtSLspPh.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/dist/inline/Chart.d.ts +29 -0
- package/dist/inline/IFrame.d.ts +19 -0
- package/dist/inline/Metric.d.ts +16 -0
- package/dist/inline/MetricGroup.d.ts +11 -0
- package/dist/inline/index.d.ts +9 -0
- package/dist/inline/parseKnownNumbers.d.ts +11 -0
- package/dist/inline.d.ts +2 -0
- package/dist/inline.js +9 -0
- package/dist/inline.js.map +1 -0
- package/dist/runtime/IDashboardDefinition.d.ts +22 -0
- package/dist/runtime/biModuleSurface.d.ts +2 -0
- package/dist/runtime/createBiUiTools.d.ts +74 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/loadDashboardBundle.d.ts +32 -0
- package/dist/runtime/registerBiModules.d.ts +36 -0
- package/dist/runtime/version.d.ts +6 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +19 -0
- package/dist/runtime.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/BiThemeBridge.d.ts +32 -0
- package/dist/theme/biPalette.d.ts +23 -0
- package/dist/theme/createBiTheme.d.ts +25 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +15 -0
- package/dist/theme.js.map +1 -0
- package/dist/version-DnqajORq.js +83 -0
- package/dist/version-DnqajORq.js.map +1 -0
- package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
- package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
- package/dist/viewer/cardMetadata.d.ts +15 -0
- package/dist/viewer/index.d.ts +8 -0
- package/dist/viewer/models.d.ts +67 -0
- package/dist/viewer/useDashboardBundle.d.ts +73 -0
- package/dist/viewer.d.ts +2 -0
- package/dist/viewer.js +9 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +196 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var o = (t, e) => C(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
import r from "react";
|
|
5
|
+
const n = r.createContext(null), c = /* @__PURE__ */ o(({ value: t, children: e }) => /* @__PURE__ */ a(n.Provider, { value: t, children: e }), "ChartContextProvider");
|
|
6
|
+
function i() {
|
|
7
|
+
return r.useContext(n);
|
|
8
|
+
}
|
|
9
|
+
o(i, "useChartContext");
|
|
10
|
+
export {
|
|
11
|
+
c as C,
|
|
12
|
+
i as u
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ChartContext-C_f_6khG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartContext-C_f_6khG.js","sources":["../src/grid/ChartContext.tsx"],"sourcesContent":["import React from 'react';\n\n/**\n * Tells a card whether the enclosing `GridCard` is drawn \"Naked\" (no header,\n * so the card should render its own title) or \"Boxed\". Lives in its own module\n * so cards can read it without importing the grid (react-grid-layout) bundle.\n */\nexport interface ChartContextState {\n naked: boolean;\n}\n\nconst ChartContext = React.createContext<ChartContextState | null>(null);\n\nexport const ChartContextProvider: React.FC<{ value: ChartContextState; children: React.ReactNode }> = ({ value, children }) => (\n <ChartContext.Provider value={value}>{children}</ChartContext.Provider>\n);\n\nexport function useChartContext(): ChartContextState | null {\n return React.useContext(ChartContext);\n}\n"],"names":["ChartContext","React","ChartContextProvider","__name","value","children","jsx","useChartContext"],"mappings":";;;;AAWA,MAAMA,IAAeC,EAAM,cAAwC,IAAI,GAE1DC,IAA0F,gBAAAC,EAAA,CAAC,EAAE,OAAAC,GAAO,UAAAC,EAAA,MAC7G,gBAAAC,EAACN,EAAa,UAAb,EAAsB,OAAAI,GAAe,UAAAC,EAAA,CAAS,GADoD;AAIhG,SAASE,IAA4C;AACxD,SAAON,EAAM,WAAWD,CAAY;AACxC;AAFgBG,EAAAI,GAAA;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var e = (r, s) => P(r, "name", { value: s, configurable: !0 });
|
|
3
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
4
|
+
import { createContext as p, useState as b, useRef as x, useEffect as D, useContext as C } from "react";
|
|
5
|
+
const c = p(void 0);
|
|
6
|
+
function I({ values: r, children: s }) {
|
|
7
|
+
const [o, n] = b(r.parameters), t = JSON.stringify(r.parameters), d = x(t);
|
|
8
|
+
D(() => {
|
|
9
|
+
d.current !== t && (d.current = t, n(r.parameters));
|
|
10
|
+
}, [t, r.parameters]);
|
|
11
|
+
const f = {
|
|
12
|
+
dashboardId: r.dashboardId,
|
|
13
|
+
parameters: o,
|
|
14
|
+
refreshTick: r.refreshTick ?? 0,
|
|
15
|
+
datasetOverride: r.datasetOverride,
|
|
16
|
+
setParameter: /* @__PURE__ */ e((a, m) => {
|
|
17
|
+
n((i) => {
|
|
18
|
+
if (m === void 0) {
|
|
19
|
+
const { [a]: O, ...u } = i;
|
|
20
|
+
return u;
|
|
21
|
+
}
|
|
22
|
+
return { ...i, [a]: m };
|
|
23
|
+
});
|
|
24
|
+
}, "setParameter"),
|
|
25
|
+
getParameter: /* @__PURE__ */ e((a) => o[a], "getParameter")
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ h(c.Provider, { value: f, children: s });
|
|
28
|
+
}
|
|
29
|
+
e(I, "DashboardParametersProvider");
|
|
30
|
+
function K() {
|
|
31
|
+
return C(c);
|
|
32
|
+
}
|
|
33
|
+
e(K, "useDashboardParameters");
|
|
34
|
+
export {
|
|
35
|
+
c as D,
|
|
36
|
+
I as a,
|
|
37
|
+
K as u
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=DashboardParametersContext-Clv--79U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardParametersContext-Clv--79U.js","sources":["../src/hooks/DashboardParametersContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\n\nexport interface ParametersStateSlim {\n dashboardId: string;\n parameters: Record<string, string | string[]>;\n /**\n * Monotonic counter the host bumps to force every active\n * `useDashboardData` consumer to re-fetch with `noCache`. Defaults to 0;\n * the hook treats the first observed value as the baseline (mounting is\n * never a force-refresh).\n */\n refreshTick?: number;\n /**\n * Admin-only runtime override for the dataset on a parameterised\n * dashboard. Shipped in every data-fetch POST body; the server validates\n * and silently drops it for non-admin callers.\n */\n datasetOverride?: string;\n}\n\nexport interface ParametersState {\n dashboardId: string;\n parameters: Record<string, string | string[]>;\n setParameter: (key: string, value: string | string[] | undefined) => void;\n getParameter: (key: string) => string | string[] | undefined;\n refreshTick: number;\n datasetOverride?: string;\n}\n\nexport const DashboardParametersContext = createContext<ParametersState | undefined>(undefined);\n\nexport function DashboardParametersProvider({ values, children }: { values: ParametersStateSlim; children: ReactNode }) {\n const [stateParameters, setStateParameters] = useState<Record<string, string | string[]>>(values.parameters);\n\n // Sync local state when `values.parameters` changes from outside (URL,\n // host swapping dashboards, draft hydration). Compared structurally so a\n // host producing a fresh object every render does not re-sync.\n const valuesParametersKey = JSON.stringify(values.parameters);\n const lastKeyRef = useRef(valuesParametersKey);\n useEffect(() => {\n if (lastKeyRef.current === valuesParametersKey) return;\n lastKeyRef.current = valuesParametersKey;\n setStateParameters(values.parameters);\n }, [valuesParametersKey, values.parameters]);\n\n const state: ParametersState = {\n dashboardId: values.dashboardId,\n parameters: stateParameters,\n refreshTick: values.refreshTick ?? 0,\n datasetOverride: values.datasetOverride,\n setParameter: (key, value) => {\n setStateParameters((prev) => {\n if (value === undefined) {\n const { [key]: _removed, ...rest } = prev;\n return rest;\n }\n return { ...prev, [key]: value };\n });\n },\n getParameter: (key) => stateParameters[key],\n };\n\n return <DashboardParametersContext.Provider value={state}>{children}</DashboardParametersContext.Provider>;\n}\n\nexport function useDashboardParameters(): ParametersState | undefined {\n return useContext(DashboardParametersContext);\n}\n"],"names":["DashboardParametersContext","createContext","DashboardParametersProvider","values","children","stateParameters","setStateParameters","useState","valuesParametersKey","lastKeyRef","useRef","useEffect","state","__name","key","value","prev","_removed","rest","useDashboardParameters","useContext"],"mappings":";;;;AA8BO,MAAMA,IAA6BC,EAA2C,MAAS;AAEvF,SAASC,EAA4B,EAAE,QAAAC,GAAQ,UAAAC,KAAkE;AACpH,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAA4CJ,EAAO,UAAU,GAKrGK,IAAsB,KAAK,UAAUL,EAAO,UAAU,GACtDM,IAAaC,EAAOF,CAAmB;AAC7C,EAAAG,EAAU,MAAM;AACZ,IAAIF,EAAW,YAAYD,MAC3BC,EAAW,UAAUD,GACrBF,EAAmBH,EAAO,UAAU;AAAA,EACxC,GAAG,CAACK,GAAqBL,EAAO,UAAU,CAAC;AAE3C,QAAMS,IAAyB;AAAA,IAC3B,aAAaT,EAAO;AAAA,IACpB,YAAYE;AAAA,IACZ,aAAaF,EAAO,eAAe;AAAA,IACnC,iBAAiBA,EAAO;AAAA,IACxB,cAAc,gBAAAU,EAAA,CAACC,GAAKC,MAAU;AAC1B,MAAAT,EAAmB,CAACU,MAAS;AACzB,YAAID,MAAU,QAAW;AACrB,gBAAM,EAAE,CAACD,CAAG,GAAGG,GAAU,GAAGC,MAASF;AACrC,iBAAOE;AAAA,QACX;AACA,eAAO,EAAE,GAAGF,GAAM,CAACF,CAAG,GAAGC,EAAA;AAAA,MAC7B,CAAC;AAAA,IACL,GARc;AAAA,IASd,cAAc,gBAAAF,EAAA,CAACC,MAAQT,EAAgBS,CAAG,GAA5B;AAAA,EAA4B;AAG9C,2BAAQd,EAA2B,UAA3B,EAAoC,OAAOY,GAAQ,UAAAR,GAAS;AACxE;AAhCgBS,EAAAX,GAAA;AAkCT,SAASiB,IAAsD;AAClE,SAAOC,EAAWpB,CAA0B;AAChD;AAFgBa,EAAAM,GAAA;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DataResult } from '../data/dataUtils';
|
|
3
|
+
export interface ChartSeries {
|
|
4
|
+
dataKey: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
type?: 'line' | 'bar' | 'area';
|
|
8
|
+
}
|
|
9
|
+
export type ChartType = 'line' | 'bar' | 'barH' | 'barV' | 'donut' | 'pie' | 'scatter' | 'area' | 'stackedArea' | 'stackedBar' | 'combo';
|
|
10
|
+
type DomainValue = number | 'auto' | 'dataMin' | 'dataMax';
|
|
11
|
+
export interface AxisConfig {
|
|
12
|
+
hide?: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
tickAngle?: number;
|
|
15
|
+
tickCount?: number;
|
|
16
|
+
interval?: number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd';
|
|
17
|
+
tickSize?: number;
|
|
18
|
+
tickLine?: boolean;
|
|
19
|
+
axisLine?: boolean;
|
|
20
|
+
domain?: [DomainValue, DomainValue];
|
|
21
|
+
unit?: string;
|
|
22
|
+
reversed?: boolean;
|
|
23
|
+
fontSize?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
scale?: 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'time' | 'band' | 'point';
|
|
28
|
+
}
|
|
29
|
+
export interface ChartCardProps<TModel extends Record<string, any> = Record<string, any>> {
|
|
30
|
+
data?: DataResult<TModel> | null;
|
|
31
|
+
type: ChartType;
|
|
32
|
+
xAxis?: string;
|
|
33
|
+
series: ChartSeries[];
|
|
34
|
+
title?: string;
|
|
35
|
+
height?: number;
|
|
36
|
+
stacked?: boolean;
|
|
37
|
+
showLegend?: boolean;
|
|
38
|
+
showGrid?: boolean;
|
|
39
|
+
showTooltip?: boolean;
|
|
40
|
+
formatXAxis?: (value: unknown) => string;
|
|
41
|
+
formatYAxis?: (value: number) => string;
|
|
42
|
+
xAxisConfig?: AxisConfig;
|
|
43
|
+
yAxisConfig?: AxisConfig;
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
/** Max visible slices for pie/donut charts. Smaller slices are grouped into "Others". Default 4. */
|
|
46
|
+
maxSlices?: number;
|
|
47
|
+
/** Overrides the palette from chartDefaults / the theme when set. */
|
|
48
|
+
palette?: string[];
|
|
49
|
+
/** Background colour of the chart container (a theme token string is fine). */
|
|
50
|
+
backgroundColor?: string;
|
|
51
|
+
/** Colour of the grid lines; defaults to a translucent `text.primary`. */
|
|
52
|
+
gridColor?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Modulates the alpha of `baseColor` by `index/total`, returning a colour in
|
|
56
|
+
* `[minAlpha, maxAlpha]`. Used to render mono-shaded bars / slices where every
|
|
57
|
+
* mark shares one hue but varies in intensity. Built on MUI's `alpha()`, so it
|
|
58
|
+
* accepts hex, functional and keyword CSS colours alike.
|
|
59
|
+
*/
|
|
60
|
+
export declare function chartShade(baseColor: string, index: number, total: number, minAlpha?: number, maxAlpha?: number): string;
|
|
61
|
+
export declare function ChartCard<TModel extends Record<string, any> = Record<string, any>>({ data, type, xAxis, series, title, height, stacked, showLegend, showGrid, showTooltip, formatXAxis, formatYAxis, xAxisConfig, yAxisConfig, loading, maxSlices, palette: paletteOverride, backgroundColor, gridColor: gridColorOverride, }: ChartCardProps<TModel>): React.JSX.Element;
|
|
62
|
+
export default ChartCard;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GridCellClassNamePropType, GridCellParams, GridColumnHeaderParams, GridRowClassNameParams, GridRowHeightParams, GridRowHeightReturnValue, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
3
|
+
import { DataResult } from '../data/dataUtils';
|
|
4
|
+
import { LazyDataResult } from '../hooks/useDashboardLazyData';
|
|
5
|
+
export type ColumnFormats = 'compact' | 'number' | 'currency' | 'check' | 'percent' | 'date';
|
|
6
|
+
export interface DataTableColumn<TModel extends GridValidRowModel = any, T = any> {
|
|
7
|
+
field: string;
|
|
8
|
+
label: string;
|
|
9
|
+
align?: 'left' | 'center' | 'right';
|
|
10
|
+
width?: number;
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
format?: ColumnFormats | ((value: unknown) => string);
|
|
13
|
+
sortable?: boolean;
|
|
14
|
+
filterable?: boolean;
|
|
15
|
+
headerClassName?: string;
|
|
16
|
+
cellClassName?: string | GridCellClassNamePropType<TModel, T>;
|
|
17
|
+
renderHeader?: (params: GridColumnHeaderParams<TModel, T>) => React.ReactNode;
|
|
18
|
+
renderCell?: (params: GridCellParams<TModel, T, string>) => React.ReactNode;
|
|
19
|
+
/** `'singleSelect'` renders a dropdown filter (with {@link valueOptions}). */
|
|
20
|
+
type?: 'singleSelect';
|
|
21
|
+
valueOptions?: ReadonlyArray<unknown>;
|
|
22
|
+
/** `true` → restrict the singleSelect filter to `isAnyOf` (multi-select). */
|
|
23
|
+
multiSelectDropdown?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface DataTableCardProps<TModel extends Record<string, any> = Record<string, any>> {
|
|
26
|
+
/** Local mode — full rowset already in memory (`useDashboardData(...).toDataResult(schema)`). */
|
|
27
|
+
data?: DataResult<TModel> | null;
|
|
28
|
+
/** Server mode (mutually exclusive with `data`) — `useDashboardLazyData(viewId, schema)`. */
|
|
29
|
+
lazyData?: LazyDataResult<TModel>;
|
|
30
|
+
/** Column schema (`defineSchema(...)`). Loosely typed on purpose: an untyped `DataResult` + a typed schema is the common LLM pattern. */
|
|
31
|
+
schema?: {
|
|
32
|
+
build(): DataTableColumn<any>[];
|
|
33
|
+
};
|
|
34
|
+
title?: string;
|
|
35
|
+
pageSize?: number;
|
|
36
|
+
dense?: boolean;
|
|
37
|
+
striped?: boolean;
|
|
38
|
+
/** Override for the even-row stripe (defaults to `theme.palette.action.hover`). */
|
|
39
|
+
stripedColorEven?: string;
|
|
40
|
+
stripedColorOdd?: string;
|
|
41
|
+
maxHeight?: number | string;
|
|
42
|
+
/** Header background (defaults to a translucent `primary.main`). */
|
|
43
|
+
headerColor?: string;
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
autoFitHeaders?: boolean;
|
|
46
|
+
getRowHeight?: (params: GridRowHeightParams) => GridRowHeightReturnValue;
|
|
47
|
+
getRowClassName?: (params: GridRowClassNameParams<TModel & GridValidRowModel>) => string;
|
|
48
|
+
/** Default pinned columns at first render (`{ left?: string[]; right?: string[] }`). */
|
|
49
|
+
initialPinnedColumns?: {
|
|
50
|
+
left?: string[];
|
|
51
|
+
right?: string[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export declare function DataTableCard<TModel extends Record<string, any>>({ data, lazyData, schema, getRowClassName, title, striped, stripedColorEven, stripedColorOdd, getRowHeight, headerColor, pageSize, dense, loading, autoFitHeaders, initialPinnedColumns, }: DataTableCardProps<TModel>): React.JSX.Element;
|
|
55
|
+
export default DataTableCard;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface GaugeThreshold {
|
|
3
|
+
/** Upper bound of the band as a ratio in `[0, 1]`. */
|
|
4
|
+
value: number;
|
|
5
|
+
color: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GaugeCardProps {
|
|
8
|
+
value: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
label?: string;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
/** Bands from low to high. Defaults to error / warning / success at 33 % / 66 % / 100 %. */
|
|
15
|
+
thresholds?: GaugeThreshold[];
|
|
16
|
+
formatValue?: (value: number) => string;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function GaugeCard({ value, min, max, label, prefix, suffix, thresholds, formatValue, loading }: GaugeCardProps): React.JSX.Element;
|
|
20
|
+
export default GaugeCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GaugeCardProps } from './GaugeCard';
|
|
3
|
+
export interface GaugeGroupProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
materialIcon?: string;
|
|
6
|
+
footNote?: string;
|
|
7
|
+
partial?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
gauges: React.ReactElement<GaugeCardProps>[];
|
|
10
|
+
}
|
|
11
|
+
export declare const GaugeGroup: React.FC<GaugeGroupProps>;
|
|
12
|
+
export default GaugeGroup;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MapBubble {
|
|
3
|
+
lat: number;
|
|
4
|
+
lng: number;
|
|
5
|
+
value: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MapBubblesProps {
|
|
9
|
+
data?: {
|
|
10
|
+
rows: MapBubble[];
|
|
11
|
+
};
|
|
12
|
+
title?: string;
|
|
13
|
+
height?: number;
|
|
14
|
+
minBubbleSize?: number;
|
|
15
|
+
maxBubbleSize?: number;
|
|
16
|
+
/** Bubble colour; defaults to the first BI series colour. */
|
|
17
|
+
color?: string;
|
|
18
|
+
formatValue?: (value: number) => string;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/** Zoom multiplier (1 = whole world). Overrides auto-fit zoom when set. */
|
|
21
|
+
defaultZoom?: number;
|
|
22
|
+
/** Map center as [longitude, latitude]. Overrides auto-fit center when set. */
|
|
23
|
+
center?: [number, number];
|
|
24
|
+
/** When true (default), automatically centers and zooms to fit all bubbles. */
|
|
25
|
+
autoFit?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Geography topology URL(s). The first layer is the base (filled); further
|
|
28
|
+
* layers render as boundary overlays. Defaults to the nearest
|
|
29
|
+
* `GeoLayersProvider`, else the world base layer (`worldGeoLayers`).
|
|
30
|
+
* Pass `brazilGeoLayers` for the legacy world + Brazil-states pair.
|
|
31
|
+
*/
|
|
32
|
+
geoUrl?: string | readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export declare function MapBubblesCard({ data, title, height, minBubbleSize, maxBubbleSize, color, formatValue, loading, defaultZoom, center: centerProp, autoFit, geoUrl, }: MapBubblesProps): React.JSX.Element;
|
|
35
|
+
export default MapBubblesCard;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MapConnection {
|
|
3
|
+
fromLat: number;
|
|
4
|
+
fromLng: number;
|
|
5
|
+
toLat: number;
|
|
6
|
+
toLng: number;
|
|
7
|
+
value?: number;
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MapConnectionsProps {
|
|
11
|
+
data?: {
|
|
12
|
+
rows: MapConnection[];
|
|
13
|
+
};
|
|
14
|
+
title?: string;
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Arc colour; defaults to the second BI series colour. */
|
|
17
|
+
color?: string;
|
|
18
|
+
showEndpoints?: boolean;
|
|
19
|
+
formatValue?: (value: number) => string;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
defaultZoom?: number;
|
|
22
|
+
center?: [number, number];
|
|
23
|
+
autoFit?: boolean;
|
|
24
|
+
/** See `MapBubblesProps.geoUrl`. */
|
|
25
|
+
geoUrl?: string | readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function MapConnectionsCard({ data, title, height, color, showEndpoints, formatValue, loading, defaultZoom, center: centerProp, autoFit, geoUrl, }: MapConnectionsProps): React.JSX.Element;
|
|
28
|
+
export default MapConnectionsCard;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MetricCardProps {
|
|
3
|
+
currentValue: number;
|
|
4
|
+
previousValue?: number;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
suffix?: string;
|
|
7
|
+
differenceStyle?: 'percentage' | 'value' | 'absolute';
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
label?: string;
|
|
11
|
+
formatValue?: (value: number) => string;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function MetricCard({ currentValue, previousValue, prefix, suffix, differenceStyle, description, icon, label, formatValue, loading, }: MetricCardProps): React.JSX.Element;
|
|
15
|
+
export default MetricCard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MetricCardProps } from './MetricCard';
|
|
3
|
+
export interface MetricGroupCardProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
metrics: MetricCardProps[];
|
|
6
|
+
columns?: 2 | 3 | 4;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function MetricGroupCard({ title, metrics, columns, loading }: MetricGroupCardProps): React.JSX.Element;
|
|
10
|
+
export default MetricGroupCard;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DataResult } from '../data/dataUtils';
|
|
3
|
+
export interface TreeMapCardProps<TModel extends Record<string, any> = Record<string, any>> {
|
|
4
|
+
data?: DataResult<TModel> | null;
|
|
5
|
+
nameKey: keyof TModel & string;
|
|
6
|
+
valueKey: keyof TModel & string;
|
|
7
|
+
title?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
formatValue?: (value: number) => string;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
/** Overrides `theme.palette.bi.series`. */
|
|
12
|
+
palette?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function TreeMapCard<TModel extends Record<string, any> = Record<string, any>>({ data, nameKey, valueKey, title, height, formatValue, loading, palette: paletteOverride, }: TreeMapCardProps<TModel>): React.JSX.Element;
|
|
15
|
+
export default TreeMapCard;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** World countries (world-atlas, ~110 m). */
|
|
2
|
+
export declare const GEO_URL_WORLD = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json";
|
|
3
|
+
/** IBGE — Brazilian states at maximum quality (~1 MB). */
|
|
4
|
+
export declare const GEO_URL_BRAZIL_STATES = "https://servicodados.ibge.gov.br/api/v3/malhas/paises/BR?formato=application/vnd.geo+json&qualidade=maxima&intrarregiao=UF";
|
|
5
|
+
/** IBGE — Brazilian municipalities at minimum quality (~3.5 MB). Use sparingly. */
|
|
6
|
+
export declare const GEO_URL_BRAZIL_MUNICIPALITIES = "https://servicodados.ibge.gov.br/api/v3/malhas/paises/BR?formato=application/vnd.geo+json&qualidade=minima&intrarregiao=municipio";
|
|
7
|
+
/**
|
|
8
|
+
* The layer set the legacy app used everywhere: world countries as the base
|
|
9
|
+
* fill + Brazilian state boundaries as an overlay. Exported as a *named*
|
|
10
|
+
* default a host opts into (`<GeoLayersProvider layers={brazilGeoLayers}>`
|
|
11
|
+
* or `geoUrl={brazilGeoLayers}`); the cards' built-in default is the world
|
|
12
|
+
* base alone.
|
|
13
|
+
*/
|
|
14
|
+
export declare const brazilGeoLayers: readonly string[];
|
|
15
|
+
/** Cards' built-in default when neither a prop nor a provider sets layers. */
|
|
16
|
+
export declare const worldGeoLayers: readonly string[];
|
|
17
|
+
/** Sets the geography layer URLs for every map card in a subtree. */
|
|
18
|
+
export declare const GeoLayersProvider: import('react').Provider<readonly string[] | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the layers for a map card: explicit prop → nearest provider →
|
|
21
|
+
* {@link worldGeoLayers}.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useGeoLayers(override?: string | readonly string[]): readonly string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { MetricCard } from './MetricCard';
|
|
2
|
+
export type { MetricCardProps } from './MetricCard';
|
|
3
|
+
export { MetricGroupCard } from './MetricGroupCard';
|
|
4
|
+
export type { MetricGroupCardProps } from './MetricGroupCard';
|
|
5
|
+
export { GaugeCard } from './GaugeCard';
|
|
6
|
+
export type { GaugeCardProps, GaugeThreshold } from './GaugeCard';
|
|
7
|
+
export { GaugeGroup } from './GaugeGroup';
|
|
8
|
+
export type { GaugeGroupProps } from './GaugeGroup';
|
|
9
|
+
export { DataTableCard } from './DataTableCard';
|
|
10
|
+
export type { DataTableCardProps, DataTableColumn, ColumnFormats } from './DataTableCard';
|
|
11
|
+
export { ChartCard, chartShade } from './ChartCard';
|
|
12
|
+
export type { ChartCardProps, ChartSeries, ChartType, AxisConfig } from './ChartCard';
|
|
13
|
+
export { TreeMapCard } from './TreeMapCard';
|
|
14
|
+
export type { TreeMapCardProps } from './TreeMapCard';
|
|
15
|
+
export { MapBubblesCard } from './MapBubbles';
|
|
16
|
+
export type { MapBubblesProps, MapBubble } from './MapBubbles';
|
|
17
|
+
export { MapConnectionsCard } from './MapConnections';
|
|
18
|
+
export type { MapConnectionsProps, MapConnection } from './MapConnections';
|
|
19
|
+
export { GEO_URL_WORLD, GEO_URL_BRAZIL_STATES, GEO_URL_BRAZIL_MUNICIPALITIES, brazilGeoLayers, worldGeoLayers, GeoLayersProvider, useGeoLayers, } from './geoLayers';
|
|
20
|
+
export { computeMapViewport, BASE_SCALE } from './mapUtils';
|
|
21
|
+
export type { MapViewport } from './mapUtils';
|
|
22
|
+
export { CONTINENT_PATHS, MAP_VIEWBOX, latLngToXY } from './worldMapPath';
|
|
23
|
+
export { useContainerRectangle } from './useContainerRectangle';
|
|
24
|
+
export { warnIfMuiXLicenseMissing } from './licenseGuard';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DataTableCard` renders MUI X DataGrid **Pro**, whose licence key must be set
|
|
3
|
+
* by the HOST before first render (`LicenseInfo.setLicenseKey(...)` at boot —
|
|
4
|
+
* this package never ships a key). Without one the grid draws a watermark and
|
|
5
|
+
* logs a licence error; this guard makes the cause obvious once per session.
|
|
6
|
+
*/
|
|
7
|
+
export declare function warnIfMuiXLicenseMissing(): void;
|
|
8
|
+
/** Test seam. */
|
|
9
|
+
export declare function resetMuiXLicenseWarning(): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const BASE_SCALE = 150;
|
|
2
|
+
export interface MapViewport {
|
|
3
|
+
center: [number, number];
|
|
4
|
+
zoom: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Computes the projection center and zoom multiplier to best fit a set of
|
|
8
|
+
* coordinates.
|
|
9
|
+
*
|
|
10
|
+
* Priority:
|
|
11
|
+
* 1. Both `center` and `defaultZoom` provided → use them directly.
|
|
12
|
+
* 2. `autoFit` enabled (default) → derive center/zoom from coordinates.
|
|
13
|
+
* 3. `defaultZoom` only → derive center from data, apply the given zoom.
|
|
14
|
+
* 4. `center` only → use it, derive zoom from data.
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeMapViewport(coords: {
|
|
17
|
+
lat: number;
|
|
18
|
+
lng: number;
|
|
19
|
+
}[], opts?: {
|
|
20
|
+
autoFit?: boolean;
|
|
21
|
+
defaultZoom?: number;
|
|
22
|
+
center?: [number, number];
|
|
23
|
+
}): MapViewport;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Width/height of a container element, kept fresh with a ResizeObserver.
|
|
4
|
+
* Local copy of the chat library's hook of the same name (a runtime import of
|
|
5
|
+
* `@aintela/chat` would drag the whole chat barrel into every card).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useContainerRectangle(ref: React.RefObject<HTMLElement | null>, initialWidth?: number, initialHeight?: number,
|
|
8
|
+
/** Re-attach the observer when this changes (the element may mount after the first render). */
|
|
9
|
+
remeasureKey?: unknown): [number, number];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified equirectangular world map for dashboard visualizations.
|
|
3
|
+
* Coordinates: viewBox 0 0 1000 500, where x = (lng+180)/360*1000, y = (90-lat)/180*500.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CONTINENT_PATHS: string[];
|
|
6
|
+
export declare const MAP_VIEWBOX = "0 0 1000 500";
|
|
7
|
+
export declare function latLngToXY(lat: number, lng: number): [number, number];
|
package/dist/cards.d.ts
ADDED
package/dist/cards.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { B as e, C as r, a as o, D as C, G as L, b as d, c as i, d as t, e as G, f as n, M, g as _, h as p, i as u, j as T, T as E, k as I, l as c, m as A, n as l, u as R, o as S, w as g, p as B } from "./index-wtSLspPh.js";
|
|
2
|
+
export {
|
|
3
|
+
e as BASE_SCALE,
|
|
4
|
+
r as CONTINENT_PATHS,
|
|
5
|
+
o as ChartCard,
|
|
6
|
+
C as DataTableCard,
|
|
7
|
+
L as GEO_URL_BRAZIL_MUNICIPALITIES,
|
|
8
|
+
d as GEO_URL_BRAZIL_STATES,
|
|
9
|
+
i as GEO_URL_WORLD,
|
|
10
|
+
t as GaugeCard,
|
|
11
|
+
G as GaugeGroup,
|
|
12
|
+
n as GeoLayersProvider,
|
|
13
|
+
M as MAP_VIEWBOX,
|
|
14
|
+
_ as MapBubblesCard,
|
|
15
|
+
p as MapConnectionsCard,
|
|
16
|
+
u as MetricCard,
|
|
17
|
+
T as MetricGroupCard,
|
|
18
|
+
E as TreeMapCard,
|
|
19
|
+
I as brazilGeoLayers,
|
|
20
|
+
c as chartShade,
|
|
21
|
+
A as computeMapViewport,
|
|
22
|
+
l as latLngToXY,
|
|
23
|
+
R as useContainerRectangle,
|
|
24
|
+
S as useGeoLayers,
|
|
25
|
+
g as warnIfMuiXLicenseMissing,
|
|
26
|
+
B as worldGeoLayers
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one seam between this package and a server. Every hook, viewer and
|
|
3
|
+
* inline component reaches the network through a `BiClient`; nothing in the
|
|
4
|
+
* package reads `process.env`, `import.meta.env` or a hard-coded host.
|
|
5
|
+
*
|
|
6
|
+
* `createBiClient({ baseUrl })` gives you the default REST layout the legacy
|
|
7
|
+
* .NET WSServer exposes (`/Query/...`, `/Dashboard/...`, `/SubAgent/...`,
|
|
8
|
+
* `/open/...`). Every route is a function on `routes`, so a host whose server
|
|
9
|
+
* lays the endpoints out differently (the AIA `aia-bi` API, an AgentsServer
|
|
10
|
+
* artifact route) overrides just the routes it changes.
|
|
11
|
+
*/
|
|
12
|
+
export type BiFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
13
|
+
export interface ArtifactUrlScope {
|
|
14
|
+
/** Chat session that produced the artifact (the default scope). */
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
/** When set, takes priority over `sessionId` — the artifact belongs to a saved dashboard. */
|
|
17
|
+
dashboardId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface QueryExecutionBody {
|
|
20
|
+
parameters?: Record<string, unknown>;
|
|
21
|
+
/** Admin-only runtime dataset override (parameterised dashboards). */
|
|
22
|
+
datasetOverride?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PagedQueryBody extends QueryExecutionBody {
|
|
25
|
+
page: number;
|
|
26
|
+
pageSize: number;
|
|
27
|
+
sort: Array<{
|
|
28
|
+
field: string;
|
|
29
|
+
dir: 'asc' | 'desc';
|
|
30
|
+
}>;
|
|
31
|
+
filter: Array<{
|
|
32
|
+
field: string;
|
|
33
|
+
op: string;
|
|
34
|
+
value: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export interface ExportQueryBody extends QueryExecutionBody {
|
|
38
|
+
sort: Array<{
|
|
39
|
+
field: string;
|
|
40
|
+
dir: 'asc' | 'desc';
|
|
41
|
+
}>;
|
|
42
|
+
filter: Array<{
|
|
43
|
+
field: string;
|
|
44
|
+
op: string;
|
|
45
|
+
value: unknown;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export interface BiRoutes {
|
|
49
|
+
/** POST — run a registered query (by hash) for a dashboard. */
|
|
50
|
+
query(dashboardId: string, queryHash: string, opts: {
|
|
51
|
+
noCache?: boolean;
|
|
52
|
+
}): string;
|
|
53
|
+
/** POST — one page of a server-side view. */
|
|
54
|
+
queryPage(dashboardId: string, viewId: string): string;
|
|
55
|
+
/** POST — distinct values of one column of a view (filter dropdowns). */
|
|
56
|
+
queryDistinct(dashboardId: string, viewId: string, field: string): string;
|
|
57
|
+
/** POST — full-rowset export of a view. */
|
|
58
|
+
queryExport(dashboardId: string, viewId: string, format: 'csv' | 'xlsx'): string;
|
|
59
|
+
/** GET — the option rows behind an auto-complete filter. */
|
|
60
|
+
filterOptions(dashboardId: string, filterId: string): string;
|
|
61
|
+
/** GET — a dashboard document (draft). */
|
|
62
|
+
dashboard(dashboardId: string): string;
|
|
63
|
+
/** GET — sub-agent status while a dashboard is being generated. */
|
|
64
|
+
subAgentStatus(sessionId: string, subAgentId: string): string;
|
|
65
|
+
/** GET — the compiled CJS dashboard bundle. */
|
|
66
|
+
dashboardBundle(sessionId: string, scriptFileName: string): string;
|
|
67
|
+
/** URL of an image artifact (matplotlib PNG) for `<img src>`. */
|
|
68
|
+
artifact(src: string, scope: ArtifactUrlScope): string;
|
|
69
|
+
/** URL of an HTML artifact for `<iframe src>`. */
|
|
70
|
+
htmlArtifact(src: string, scope: ArtifactUrlScope): string;
|
|
71
|
+
/** GET — every dashboard the caller can see (lean list). */
|
|
72
|
+
dashboardList(): string;
|
|
73
|
+
/** GET — the draft whose `originalSessionId` is `sessionId` (404 when none). */
|
|
74
|
+
dashboardBySession(sessionId: string): string;
|
|
75
|
+
/** POST — create or update a dashboard document (`{ ...metadata, draft: {...} }`). */
|
|
76
|
+
dashboardUpsert(): string;
|
|
77
|
+
/** POST — overwrite one dashboard (move to folder, rename, …). */
|
|
78
|
+
dashboardUpdate(dashboardId: string): string;
|
|
79
|
+
/** DELETE — remove a dashboard. */
|
|
80
|
+
dashboardDelete(dashboardId: string): string;
|
|
81
|
+
/** POST — one of the verb routes: share / unshare / pin / unpin / publishAsDefault / unpublishAsDefault. */
|
|
82
|
+
dashboardAction(dashboardId: string, action: DashboardActionName): string;
|
|
83
|
+
/** GET (list) / POST (create) — dashboard folders. */
|
|
84
|
+
folders(): string;
|
|
85
|
+
/** GET / PATCH / DELETE — one folder. */
|
|
86
|
+
folder(folderId: string): string;
|
|
87
|
+
/** POST — share / unshare a folder (cascades to its dashboards). */
|
|
88
|
+
folderAction(folderId: string, action: FolderActionName): string;
|
|
89
|
+
/** GET — folders with their dashboards plus the root-level dashboards. */
|
|
90
|
+
folderHierarchy(): string;
|
|
91
|
+
}
|
|
92
|
+
export type DashboardActionName = 'share' | 'unshare' | 'pin' | 'unpin' | 'publishAsDefault' | 'unpublishAsDefault';
|
|
93
|
+
export type FolderActionName = 'share' | 'unshare';
|
|
94
|
+
export interface BiClientOptions {
|
|
95
|
+
/** Server origin, e.g. `https://bi.example.com`. No trailing slash needed. */
|
|
96
|
+
baseUrl: string;
|
|
97
|
+
/** `fetch` implementation (defaults to `globalThis.fetch`); inject for tests or a custom transport. */
|
|
98
|
+
fetch?: BiFetch;
|
|
99
|
+
/** Returns the `Authorization` header value (`Bearer …`) or `undefined` for none. May be async. */
|
|
100
|
+
getAuthHeader?: () => string | undefined | Promise<string | undefined>;
|
|
101
|
+
/** Extra headers on every request. */
|
|
102
|
+
headers?: Record<string, string>;
|
|
103
|
+
/** Route overrides — any subset of {@link BiRoutes}. */
|
|
104
|
+
routes?: Partial<BiRoutes>;
|
|
105
|
+
/**
|
|
106
|
+
* Legacy image URLs carried a `?t=<now>` cache-buster because the proxy
|
|
107
|
+
* served mutable files. Off by default; a host fronting a mutable store
|
|
108
|
+
* can turn it back on.
|
|
109
|
+
*/
|
|
110
|
+
cacheBustArtifacts?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface BiClient {
|
|
113
|
+
readonly baseUrl: string;
|
|
114
|
+
readonly routes: BiRoutes;
|
|
115
|
+
/** Low-level request: prefixes `baseUrl` on relative paths and adds auth + default headers. */
|
|
116
|
+
request(path: string, init?: RequestInit): Promise<Response>;
|
|
117
|
+
/** Same as `request`, but throws a descriptive `Error` on a non-2xx status. */
|
|
118
|
+
requestOk(path: string, init?: RequestInit): Promise<Response>;
|
|
119
|
+
runQuery<T = unknown>(dashboardId: string, queryHash: string, body: QueryExecutionBody, opts?: {
|
|
120
|
+
noCache?: boolean;
|
|
121
|
+
signal?: AbortSignal;
|
|
122
|
+
}): Promise<T>;
|
|
123
|
+
getQueryPage<T = unknown>(dashboardId: string, viewId: string, body: PagedQueryBody): Promise<T>;
|
|
124
|
+
getDistinctValues(dashboardId: string, viewId: string, field: string, body: QueryExecutionBody): Promise<{
|
|
125
|
+
values: Array<string | null>;
|
|
126
|
+
truncated?: boolean;
|
|
127
|
+
} | null>;
|
|
128
|
+
exportQuery(dashboardId: string, viewId: string, format: 'csv' | 'xlsx', body: ExportQueryBody): Promise<Blob>;
|
|
129
|
+
getFilterOptions<T = unknown>(dashboardId: string, filterId: string): Promise<T | null>;
|
|
130
|
+
getDashboard<T = unknown>(dashboardId: string): Promise<T>;
|
|
131
|
+
getSubAgentStatus<T = unknown>(sessionId: string, subAgentId: string): Promise<T | null>;
|
|
132
|
+
fetchDashboardBundle(sessionId: string, scriptFileName: string): Promise<string>;
|
|
133
|
+
artifactUrl(src: string, scope?: ArtifactUrlScope): string;
|
|
134
|
+
iframeUrl(src: string, scope?: ArtifactUrlScope): string;
|
|
135
|
+
listDashboards<T = unknown>(): Promise<T[]>;
|
|
136
|
+
/** `null` when no dashboard is bound to the session. */
|
|
137
|
+
getDashboardBySession<T = unknown>(sessionId: string): Promise<T | null>;
|
|
138
|
+
/** POST the upsert payload; resolves to the server's document (raw, un-flattened). */
|
|
139
|
+
upsertDashboard<T = unknown>(payload: unknown): Promise<T>;
|
|
140
|
+
updateDashboard(dashboardId: string, dashboard: unknown): Promise<void>;
|
|
141
|
+
/** `false` when the server answered 404. */
|
|
142
|
+
deleteDashboard(dashboardId: string): Promise<boolean>;
|
|
143
|
+
dashboardAction(dashboardId: string, action: DashboardActionName): Promise<void>;
|
|
144
|
+
listFolders<T = unknown>(): Promise<T[]>;
|
|
145
|
+
getFolder<T = unknown>(folderId: string): Promise<T>;
|
|
146
|
+
createFolder<T = unknown>(name: string, description?: string): Promise<T>;
|
|
147
|
+
updateFolder<T = unknown>(folderId: string, patch: unknown): Promise<T>;
|
|
148
|
+
deleteFolder(folderId: string): Promise<boolean>;
|
|
149
|
+
folderAction(folderId: string, action: FolderActionName): Promise<void>;
|
|
150
|
+
getDashboardHierarchy<T = unknown>(): Promise<T>;
|
|
151
|
+
}
|
|
152
|
+
/** The legacy WSServer / Express layout. Override per route through `BiClientOptions.routes`. */
|
|
153
|
+
export declare function defaultBiRoutes(baseUrl: string, cacheBust: boolean): BiRoutes;
|
|
154
|
+
/**
|
|
155
|
+
* ISO-8601 date strings → `Date` on JSON parse (the .NET server serialises
|
|
156
|
+
* `DateTime` as ISO). Same shape as the chat library's `dateReviver`, kept
|
|
157
|
+
* local so this subpath has no runtime dependency on it.
|
|
158
|
+
*/
|
|
159
|
+
export declare function biDateReviver(_key: string, value: unknown): unknown;
|
|
160
|
+
export declare function createBiClient(options: BiClientOptions): BiClient;
|