autoql-fe-utils 1.11.19 → 1.11.21
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.global.js +33 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +33 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -598,6 +598,7 @@ interface Column extends RawColumn {
|
|
|
598
598
|
custom?: boolean;
|
|
599
599
|
id?: string;
|
|
600
600
|
is_timestamp?: boolean;
|
|
601
|
+
quantity_type?: 'integer' | 'float';
|
|
601
602
|
}
|
|
602
603
|
interface AvailableSelect {
|
|
603
604
|
table_column: string;
|
|
@@ -1479,7 +1480,7 @@ declare const runQueryValidation: ({ text, domain, apiKey, token, cancelToken, }
|
|
|
1479
1480
|
declare const runQuery: ({ query, userSelection, userSelectionFinal, translation, test, domain, apiKey, token, source, filters, orders, tableFilters, pageSize, allowSuggestions, cancelToken, enableQueryValidation, skipQueryValidation, scope, newColumns, displayOverrides, }?: QueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1480
1481
|
declare const runCachedDashboardQuery: ({ query, domain, apiKey, token, source, orders, tableFilters, allowSuggestions, cancelToken, scope, newColumns, queryIndex, tileKey, dashboardId, force, }?: DashboardTileQueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1481
1482
|
declare const runCachedDashboardQueryPost: ({ query, domain, apiKey, token, source, orders, filters, tableFilters, allowSuggestions, cancelToken, scope, newColumns, queryIndex, tileKey, dashboardId, force, }?: DashboardTileQueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1482
|
-
declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilters, csvProgressCallback, }?: {
|
|
1483
|
+
declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilters, csvProgressCallback, source, scope, }?: {
|
|
1483
1484
|
queryId?: string;
|
|
1484
1485
|
domain?: string;
|
|
1485
1486
|
apiKey?: string;
|
|
@@ -1487,6 +1488,8 @@ declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilter
|
|
|
1487
1488
|
filters?: Object[];
|
|
1488
1489
|
tableFilters?: Object[];
|
|
1489
1490
|
csvProgressCallback?: Function;
|
|
1491
|
+
source?: string;
|
|
1492
|
+
scope?: string;
|
|
1490
1493
|
}) => Promise<axios.AxiosResponse<any, any, {}>>;
|
|
1491
1494
|
declare const runDrilldown: ({ queryID, groupBys, translation, test, domain, apiKey, token, orders, source, tableFilters, cancelToken, pageSize, newColumns, displayOverrides, }?: {
|
|
1492
1495
|
queryID?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -598,6 +598,7 @@ interface Column extends RawColumn {
|
|
|
598
598
|
custom?: boolean;
|
|
599
599
|
id?: string;
|
|
600
600
|
is_timestamp?: boolean;
|
|
601
|
+
quantity_type?: 'integer' | 'float';
|
|
601
602
|
}
|
|
602
603
|
interface AvailableSelect {
|
|
603
604
|
table_column: string;
|
|
@@ -1479,7 +1480,7 @@ declare const runQueryValidation: ({ text, domain, apiKey, token, cancelToken, }
|
|
|
1479
1480
|
declare const runQuery: ({ query, userSelection, userSelectionFinal, translation, test, domain, apiKey, token, source, filters, orders, tableFilters, pageSize, allowSuggestions, cancelToken, enableQueryValidation, skipQueryValidation, scope, newColumns, displayOverrides, }?: QueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1480
1481
|
declare const runCachedDashboardQuery: ({ query, domain, apiKey, token, source, orders, tableFilters, allowSuggestions, cancelToken, scope, newColumns, queryIndex, tileKey, dashboardId, force, }?: DashboardTileQueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1481
1482
|
declare const runCachedDashboardQueryPost: ({ query, domain, apiKey, token, source, orders, filters, tableFilters, allowSuggestions, cancelToken, scope, newColumns, queryIndex, tileKey, dashboardId, force, }?: DashboardTileQueryParams) => Promise<TransformedAxiosResponse | axios.AxiosResponse<any, any, {}>>;
|
|
1482
|
-
declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilters, csvProgressCallback, }?: {
|
|
1483
|
+
declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilters, csvProgressCallback, source, scope, }?: {
|
|
1483
1484
|
queryId?: string;
|
|
1484
1485
|
domain?: string;
|
|
1485
1486
|
apiKey?: string;
|
|
@@ -1487,6 +1488,8 @@ declare const exportCSV: ({ queryId, domain, apiKey, token, filters, tableFilter
|
|
|
1487
1488
|
filters?: Object[];
|
|
1488
1489
|
tableFilters?: Object[];
|
|
1489
1490
|
csvProgressCallback?: Function;
|
|
1491
|
+
source?: string;
|
|
1492
|
+
scope?: string;
|
|
1490
1493
|
}) => Promise<axios.AxiosResponse<any, any, {}>>;
|
|
1491
1494
|
declare const runDrilldown: ({ queryID, groupBys, translation, test, domain, apiKey, token, orders, source, tableFilters, cancelToken, pageSize, newColumns, displayOverrides, }?: {
|
|
1492
1495
|
queryID?: string;
|
package/dist/index.global.js
CHANGED
|
@@ -18435,13 +18435,20 @@
|
|
|
18435
18435
|
const validatedQuantityDecimals = !isNaN(quantityDecimals) ? quantityDecimals : 2;
|
|
18436
18436
|
const elementNumber = parseFloat(`${element}`);
|
|
18437
18437
|
if (!isNaN(elementNumber)) {
|
|
18438
|
-
|
|
18438
|
+
let numDecimals;
|
|
18439
|
+
if ((column == null ? void 0 : column.quantity_type) === "integer") {
|
|
18440
|
+
numDecimals = 0;
|
|
18441
|
+
} else if ((column == null ? void 0 : column.quantity_type) === "float") {
|
|
18442
|
+
numDecimals = validatedQuantityDecimals;
|
|
18443
|
+
} else {
|
|
18444
|
+
numDecimals = elementNumber % 1 !== 0 ? validatedQuantityDecimals : 0;
|
|
18445
|
+
}
|
|
18439
18446
|
formattedElement = new Intl.NumberFormat(languageCode, {
|
|
18440
18447
|
minimumFractionDigits: numDecimals,
|
|
18441
18448
|
maximumFractionDigits: numDecimals
|
|
18442
18449
|
}).format(elementNumber);
|
|
18443
|
-
if (formattedElement
|
|
18444
|
-
formattedElement = formattedElement
|
|
18450
|
+
if ((column == null ? void 0 : column.quantity_type) !== "float" && `${formattedElement}`.endsWith(".00")) {
|
|
18451
|
+
formattedElement = `${formattedElement}`.replace(".00", "");
|
|
18445
18452
|
}
|
|
18446
18453
|
}
|
|
18447
18454
|
break;
|
|
@@ -31085,16 +31092,27 @@
|
|
|
31085
31092
|
}
|
|
31086
31093
|
return transformedResponse;
|
|
31087
31094
|
};
|
|
31095
|
+
var detectQuantityType = (rows, colIndex) => {
|
|
31096
|
+
if (!(rows == null ? void 0 : rows.length)) return "float";
|
|
31097
|
+
for (const row of rows) {
|
|
31098
|
+
const val = row == null ? void 0 : row[colIndex];
|
|
31099
|
+
if (val === null || val === void 0) continue;
|
|
31100
|
+
const num = typeof val === "number" ? val : parseFloat(val);
|
|
31101
|
+
if (!isNaN(num) && num % 1 !== 0) return "float";
|
|
31102
|
+
}
|
|
31103
|
+
return "integer";
|
|
31104
|
+
};
|
|
31088
31105
|
var transformQueryResponseColumns = (response, addedColumns) => {
|
|
31089
|
-
var _a2, _b2;
|
|
31106
|
+
var _a2, _b2, _c, _d;
|
|
31090
31107
|
const columns = (_b2 = (_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.columns;
|
|
31108
|
+
const rows = (_d = (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.data) == null ? void 0 : _d.rows;
|
|
31091
31109
|
if (!(columns == null ? void 0 : columns.length)) {
|
|
31092
31110
|
return columns;
|
|
31093
31111
|
}
|
|
31094
31112
|
const isSingleValue = isSingleValueResponse(response);
|
|
31095
31113
|
const transformedColumns = columns.map((col, i) => {
|
|
31096
|
-
var _a3
|
|
31097
|
-
const dataSample = (
|
|
31114
|
+
var _a3;
|
|
31115
|
+
const dataSample = (_a3 = rows == null ? void 0 : rows.find((row) => row[i])) == null ? void 0 : _a3[i];
|
|
31098
31116
|
const drilldownGroupby = getDrilldownGroupby(response, col);
|
|
31099
31117
|
let additional = false;
|
|
31100
31118
|
let is_timestamp = false;
|
|
@@ -31111,6 +31129,7 @@
|
|
|
31111
31129
|
if (isSingleValue) {
|
|
31112
31130
|
is_visible = true;
|
|
31113
31131
|
}
|
|
31132
|
+
const quantity_type = col.type === "QUANTITY" /* QUANTITY */ ? detectQuantityType(rows, i) : void 0;
|
|
31114
31133
|
return new Column({
|
|
31115
31134
|
...col,
|
|
31116
31135
|
field: `${i}`,
|
|
@@ -31118,7 +31137,8 @@
|
|
|
31118
31137
|
drilldownGroupby,
|
|
31119
31138
|
additional,
|
|
31120
31139
|
is_visible,
|
|
31121
|
-
is_timestamp
|
|
31140
|
+
is_timestamp,
|
|
31141
|
+
quantity_type
|
|
31122
31142
|
});
|
|
31123
31143
|
});
|
|
31124
31144
|
return transformedColumns;
|
|
@@ -31568,7 +31588,9 @@
|
|
|
31568
31588
|
token,
|
|
31569
31589
|
filters,
|
|
31570
31590
|
tableFilters,
|
|
31571
|
-
csvProgressCallback
|
|
31591
|
+
csvProgressCallback,
|
|
31592
|
+
source = DEFAULT_SOURCE,
|
|
31593
|
+
scope = "null"
|
|
31572
31594
|
} = {}) => {
|
|
31573
31595
|
if (!token || !domain || !apiKey) {
|
|
31574
31596
|
return Promise.reject(new Error("Unauthenticated" /* UNAUTHENTICATED */));
|
|
@@ -31576,7 +31598,9 @@
|
|
|
31576
31598
|
const url2 = `${domain}/autoql/api/v1/query/${queryId}/export?key=${apiKey}`;
|
|
31577
31599
|
const data = {
|
|
31578
31600
|
session_filter_locks: filters,
|
|
31579
|
-
filters: tableFilters
|
|
31601
|
+
filters: tableFilters,
|
|
31602
|
+
source,
|
|
31603
|
+
scope
|
|
31580
31604
|
};
|
|
31581
31605
|
const config = {
|
|
31582
31606
|
headers: {
|