autoql-fe-utils 1.7.13 → 1.7.15
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/index.d.mts +4209 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.global.js +92 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +94 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1440,6 +1440,7 @@ __export(src_exports, {
|
|
|
1440
1440
|
roundToNearestLog10: () => roundToNearestLog10,
|
|
1441
1441
|
roundToNearestMultiple: () => roundToNearestMultiple,
|
|
1442
1442
|
roundUpToNearestMultiple: () => roundUpToNearestMultiple,
|
|
1443
|
+
runDashboardTileQuery: () => runDashboardTileQuery,
|
|
1443
1444
|
runDrilldown: () => runDrilldown,
|
|
1444
1445
|
runQuery: () => runQuery,
|
|
1445
1446
|
runQueryNewPage: () => runQueryNewPage,
|
|
@@ -4731,7 +4732,7 @@ var formatElement = ({
|
|
|
4731
4732
|
}
|
|
4732
4733
|
};
|
|
4733
4734
|
var getNumberFormatConfig = (d, scale) => {
|
|
4734
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4735
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4735
4736
|
const dNumber = typeof d === "string" ? parseFloat(d) : d;
|
|
4736
4737
|
let minimumFractionDigits = 0;
|
|
4737
4738
|
let maximumFractionDigits = 0;
|
|
@@ -4745,13 +4746,20 @@ var getNumberFormatConfig = (d, scale) => {
|
|
|
4745
4746
|
} else if (!isNaN(maxValue) && !isNaN(minValue)) {
|
|
4746
4747
|
domainRange = Math.abs(maxValue - minValue);
|
|
4747
4748
|
}
|
|
4748
|
-
const
|
|
4749
|
-
const
|
|
4749
|
+
const numTicks = (_d = (_c = scale == null ? void 0 : scale.tickLabels) == null ? void 0 : _c.length) != null ? _d : 1;
|
|
4750
|
+
const totalRange = Math.abs(((_f = (_e = scale == null ? void 0 : scale.tickLabels) == null ? void 0 : _e[numTicks - 1]) != null ? _f : 0) - ((_h = (_g = scale == null ? void 0 : scale.tickLabels) == null ? void 0 : _g[0]) != null ? _h : 0));
|
|
4751
|
+
const tickRange = totalRange / numTicks;
|
|
4750
4752
|
const absValue = Math.abs(dNumber);
|
|
4751
|
-
if (
|
|
4752
|
-
} else if (
|
|
4753
|
+
if (domainRange < 10 && (!tickRange || tickRange >= 1)) {
|
|
4754
|
+
} else if (domainRange >= 0 && domainRange < 1) {
|
|
4755
|
+
minimumFractionDigits = 3;
|
|
4756
|
+
maximumFractionDigits = 3;
|
|
4757
|
+
} else if (domainRange >= 1 && domainRange < 5) {
|
|
4753
4758
|
minimumFractionDigits = 2;
|
|
4754
4759
|
maximumFractionDigits = 2;
|
|
4760
|
+
} else if (domainRange >= 5 && domainRange < 10) {
|
|
4761
|
+
minimumFractionDigits = 1;
|
|
4762
|
+
maximumFractionDigits = 1;
|
|
4755
4763
|
} else if (absValue >= 1e3) {
|
|
4756
4764
|
notation = "compact";
|
|
4757
4765
|
if (absValue > 1e9) {
|
|
@@ -9929,6 +9937,86 @@ var runQuery = async ({
|
|
|
9929
9937
|
displayOverrides
|
|
9930
9938
|
});
|
|
9931
9939
|
};
|
|
9940
|
+
var runDashboardTileQuery = async ({
|
|
9941
|
+
query,
|
|
9942
|
+
userSelection,
|
|
9943
|
+
userSelectionFinal,
|
|
9944
|
+
translation,
|
|
9945
|
+
test,
|
|
9946
|
+
domain,
|
|
9947
|
+
apiKey,
|
|
9948
|
+
token,
|
|
9949
|
+
source,
|
|
9950
|
+
filters,
|
|
9951
|
+
orders,
|
|
9952
|
+
tableFilters,
|
|
9953
|
+
pageSize,
|
|
9954
|
+
allowSuggestions,
|
|
9955
|
+
cancelToken,
|
|
9956
|
+
scope,
|
|
9957
|
+
newColumns,
|
|
9958
|
+
displayOverrides,
|
|
9959
|
+
queryIndex,
|
|
9960
|
+
tileKey,
|
|
9961
|
+
dashboardId
|
|
9962
|
+
} = {}) => {
|
|
9963
|
+
if (!dashboardId) {
|
|
9964
|
+
console.error("No dashboard ID supplied in request");
|
|
9965
|
+
return Promise.reject({ error: "Dashboard ID not supplied" });
|
|
9966
|
+
}
|
|
9967
|
+
if (!tileKey) {
|
|
9968
|
+
console.error("No tile key supplied in request");
|
|
9969
|
+
return Promise.reject({ error: "Tile key not supplied" });
|
|
9970
|
+
}
|
|
9971
|
+
if (!apiKey || !domain || !token) {
|
|
9972
|
+
console.error("authentication invalid for request");
|
|
9973
|
+
return Promise.reject({ error: "authentication invalid for request" });
|
|
9974
|
+
}
|
|
9975
|
+
const url = `${domain}/autoql/api/v1/dashboards/${dashboardId}/tiles/${tileKey}/query?key=${apiKey}&query_index=${queryIndex || 0}`;
|
|
9976
|
+
const finalUserSelection = userSelectionFinal || transformUserSelection(userSelection);
|
|
9977
|
+
let finalScope = scope;
|
|
9978
|
+
if (!!(source == null ? void 0 : source.includes) && source.includes("data_messenger")) {
|
|
9979
|
+
finalScope = "data_messenger";
|
|
9980
|
+
}
|
|
9981
|
+
const config = {
|
|
9982
|
+
headers: {
|
|
9983
|
+
Authorization: `Bearer ${token}`
|
|
9984
|
+
}
|
|
9985
|
+
};
|
|
9986
|
+
const data = {
|
|
9987
|
+
text: query,
|
|
9988
|
+
source,
|
|
9989
|
+
translation,
|
|
9990
|
+
user_selection: finalUserSelection,
|
|
9991
|
+
test,
|
|
9992
|
+
session_filter_locks: filters,
|
|
9993
|
+
orders,
|
|
9994
|
+
filters: tableFilters,
|
|
9995
|
+
page_size: pageSize,
|
|
9996
|
+
date_format: "ISO8601",
|
|
9997
|
+
scope: finalScope,
|
|
9998
|
+
additional_selects: newColumns,
|
|
9999
|
+
display_overrides: displayOverrides,
|
|
10000
|
+
time_zone: getCurrentTimezone()
|
|
10001
|
+
};
|
|
10002
|
+
return import_axios.default.post(url, data, config).then((response) => {
|
|
10003
|
+
var _a;
|
|
10004
|
+
if (!((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data)) {
|
|
10005
|
+
throw new Error("Parse error" /* PARSE_ERROR */);
|
|
10006
|
+
}
|
|
10007
|
+
return Promise.resolve(transformQueryResponse(response, void 0, void 0, newColumns));
|
|
10008
|
+
}).catch((error) => {
|
|
10009
|
+
var _a, _b, _c, _d, _e;
|
|
10010
|
+
const referenceId = (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.reference_id;
|
|
10011
|
+
const isSubquery = (tableFilters == null ? void 0 : tableFilters.length) || (orders == null ? void 0 : orders.length);
|
|
10012
|
+
const needsSuggestions = referenceId === "1.1.430" || referenceId === "1.1.431" || isError500Type(referenceId);
|
|
10013
|
+
if (needsSuggestions && allowSuggestions && !isSubquery) {
|
|
10014
|
+
const queryId = (_e = (_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.data) == null ? void 0 : _e.query_id;
|
|
10015
|
+
return fetchSuggestions({ query, queryId, domain, apiKey, token, cancelToken });
|
|
10016
|
+
}
|
|
10017
|
+
return formatErrorResponse(error);
|
|
10018
|
+
});
|
|
10019
|
+
};
|
|
9932
10020
|
var exportCSV = ({
|
|
9933
10021
|
queryId,
|
|
9934
10022
|
domain,
|
|
@@ -12508,6 +12596,7 @@ function color() {
|
|
|
12508
12596
|
roundToNearestLog10,
|
|
12509
12597
|
roundToNearestMultiple,
|
|
12510
12598
|
roundUpToNearestMultiple,
|
|
12599
|
+
runDashboardTileQuery,
|
|
12511
12600
|
runDrilldown,
|
|
12512
12601
|
runQuery,
|
|
12513
12602
|
runQueryNewPage,
|