autoql-fe-utils 1.11.21 → 1.11.22
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 +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.global.js +49 -15
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +51 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2675,6 +2675,7 @@ var FilterOperatorEnum = /* @__PURE__ */ ((FilterOperatorEnum2) => {
|
|
|
2675
2675
|
FilterOperatorEnum2["REGEX"] = "regex";
|
|
2676
2676
|
FilterOperatorEnum2["STARTS_WITH"] = "starts_with";
|
|
2677
2677
|
FilterOperatorEnum2["ENDS_WITH"] = "ends_with";
|
|
2678
|
+
FilterOperatorEnum2["IN"] = "in";
|
|
2678
2679
|
return FilterOperatorEnum2;
|
|
2679
2680
|
})(FilterOperatorEnum || {});
|
|
2680
2681
|
var FilterTypeEnum = {
|
|
@@ -2744,6 +2745,15 @@ var betweenMatcher = (cell, cond) => {
|
|
|
2744
2745
|
getLogger().warn("betweenMatcher: unsupported types for between fallback", { cell, low, high, type: cond.type });
|
|
2745
2746
|
return false;
|
|
2746
2747
|
};
|
|
2748
|
+
var inMatcher = (cell, cond) => {
|
|
2749
|
+
var _a2;
|
|
2750
|
+
if (cell == null) return false;
|
|
2751
|
+
const raw = String((_a2 = cond.value) != null ? _a2 : "");
|
|
2752
|
+
if (raw.length === 0) return true;
|
|
2753
|
+
const items = raw.split(",").map((s) => s.trim().toLowerCase());
|
|
2754
|
+
const set = new Set(items);
|
|
2755
|
+
return set.has(String(cell).toLowerCase());
|
|
2756
|
+
};
|
|
2747
2757
|
var FILTER_MATCHERS = {
|
|
2748
2758
|
["like" /* LIKE */]: likeMatcher,
|
|
2749
2759
|
["not_like" /* NOT_LIKE */]: notLikeMatcher,
|
|
@@ -2756,7 +2766,8 @@ var FILTER_MATCHERS = {
|
|
|
2756
2766
|
["regex" /* REGEX */]: regexMatcher,
|
|
2757
2767
|
["between" /* BETWEEN */]: betweenMatcher,
|
|
2758
2768
|
["starts_with" /* STARTS_WITH */]: (cell, cond) => String(cell).startsWith(String(cond.value)),
|
|
2759
|
-
["ends_with" /* ENDS_WITH */]: (cell, cond) => String(cell).endsWith(String(cond.value))
|
|
2769
|
+
["ends_with" /* ENDS_WITH */]: (cell, cond) => String(cell).endsWith(String(cond.value)),
|
|
2770
|
+
["in" /* IN */]: inMatcher
|
|
2760
2771
|
};
|
|
2761
2772
|
function isValidOperator(op) {
|
|
2762
2773
|
return Object.values(FilterOperatorEnum).includes(op);
|
|
@@ -2809,7 +2820,7 @@ function parseFilter(raw, type, defaultOperator = "like" /* LIKE */) {
|
|
|
2809
2820
|
if (typeof raw !== "string") return { operator: defaultOperator, value: raw, type };
|
|
2810
2821
|
const trimmed = raw.trim();
|
|
2811
2822
|
if (trimmed.length === 0) return { operator: defaultOperator, value: "", type };
|
|
2812
|
-
const opToken = `${"between" /* BETWEEN */}|[<>!=]=?|not_like`;
|
|
2823
|
+
const opToken = `${"between" /* BETWEEN */}|${"in" /* IN */}|[<>!=]=?|not_like`;
|
|
2813
2824
|
const opPattern = `^(${opToken})\\s*(.*)$`;
|
|
2814
2825
|
const opRe = compileSafeRegex(opPattern, "i");
|
|
2815
2826
|
const opMatch = opRe ? opRe.exec(trimmed) : null;
|
|
@@ -2817,7 +2828,11 @@ function parseFilter(raw, type, defaultOperator = "like" /* LIKE */) {
|
|
|
2817
2828
|
let op = String((_a2 = opMatch[1]) != null ? _a2 : "").toLowerCase();
|
|
2818
2829
|
const rest = (_b2 = opMatch[2]) != null ? _b2 : "";
|
|
2819
2830
|
if (op === "!") op = "not_like" /* NOT_LIKE */;
|
|
2831
|
+
if (op === "==") op = "=" /* EQ */;
|
|
2820
2832
|
if (type === FilterTypeEnum.STRING && op === "!=") op = "not_like" /* NOT_LIKE */;
|
|
2833
|
+
if (op === "in" /* IN */) {
|
|
2834
|
+
return { operator: "in" /* IN */, value: rest, type };
|
|
2835
|
+
}
|
|
2821
2836
|
if (op === "between" /* BETWEEN */) {
|
|
2822
2837
|
let parts = (_c = rest.split(/\s+to\s+|,/)) == null ? void 0 : _c.map((s) => s.trim()).filter((s) => s.length);
|
|
2823
2838
|
if ((!parts || parts.length < 2) && type === FilterTypeEnum.NUMBER) {
|
|
@@ -3377,10 +3392,7 @@ var createFilterFunction = ({
|
|
|
3377
3392
|
return false;
|
|
3378
3393
|
}
|
|
3379
3394
|
const raw = String(headerValue != null ? headerValue : "").trim();
|
|
3380
|
-
if (!raw)
|
|
3381
|
-
getLogger().warn("date filter: header value empty", { column });
|
|
3382
|
-
return false;
|
|
3383
|
-
}
|
|
3395
|
+
if (!raw) return true;
|
|
3384
3396
|
const parts = raw.split(" to ").map((s) => String(s).trim()).filter((s) => s.length > 0);
|
|
3385
3397
|
if (!parts.length) {
|
|
3386
3398
|
getLogger().warn("date filter: could not parse date range", { raw, column });
|
|
@@ -3407,24 +3419,23 @@ var createFilterFunction = ({
|
|
|
3407
3419
|
};
|
|
3408
3420
|
} else if ((column == null ? void 0 : column.type) === "DATE_STRING" /* DATE_STRING */) {
|
|
3409
3421
|
return (headerValue, rowValue) => {
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3422
|
+
const raw = String(headerValue != null ? headerValue : "").trim();
|
|
3423
|
+
if (!raw) return true;
|
|
3424
|
+
if (rowValue === void 0 || rowValue === null) return false;
|
|
3413
3425
|
const formattedElement = formatElement({
|
|
3414
3426
|
element: rowValue,
|
|
3415
3427
|
column,
|
|
3416
3428
|
config: dataFormatting
|
|
3417
3429
|
});
|
|
3418
|
-
const raw = String(headerValue != null ? headerValue : "").trim();
|
|
3419
3430
|
const lowerElement = String(formattedElement != null ? formattedElement : "").toLowerCase();
|
|
3420
3431
|
return matchesStringFilter(raw, lowerElement);
|
|
3421
3432
|
};
|
|
3422
3433
|
} else if (isColumnNumberType(column)) {
|
|
3423
3434
|
return (headerValue, rowValue) => {
|
|
3424
3435
|
try {
|
|
3425
|
-
if (rowValue === void 0 || rowValue === null) return false;
|
|
3426
3436
|
const raw = String(headerValue != null ? headerValue : "").trim();
|
|
3427
|
-
if (raw.length === 0) return
|
|
3437
|
+
if (raw.length === 0) return true;
|
|
3438
|
+
if (rowValue === void 0 || rowValue === null) return false;
|
|
3428
3439
|
const cond = parseFilter(raw, "number", "=");
|
|
3429
3440
|
return matchCell(rowValue, cond);
|
|
3430
3441
|
} catch (error) {
|
|
@@ -3434,10 +3445,9 @@ var createFilterFunction = ({
|
|
|
3434
3445
|
};
|
|
3435
3446
|
} else {
|
|
3436
3447
|
return (headerValue, rowValue) => {
|
|
3437
|
-
if (rowValue === void 0 || rowValue === null) {
|
|
3438
|
-
return false;
|
|
3439
|
-
}
|
|
3440
3448
|
const raw = String(headerValue != null ? headerValue : "").trim();
|
|
3449
|
+
if (!raw) return true;
|
|
3450
|
+
if (rowValue === void 0 || rowValue === null) return false;
|
|
3441
3451
|
const lowerValue = String(rowValue != null ? rowValue : "").toLowerCase();
|
|
3442
3452
|
const cond = parseFilter(raw, "string", "like" /* LIKE */);
|
|
3443
3453
|
return matchCell(lowerValue, { ...cond, type: "string", value: String(cond.value).toLowerCase() });
|
|
@@ -10831,6 +10841,30 @@ var fetchLLMSummary = ({
|
|
|
10831
10841
|
return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
|
|
10832
10842
|
});
|
|
10833
10843
|
};
|
|
10844
|
+
var fetchFollowOnQuery = ({
|
|
10845
|
+
data,
|
|
10846
|
+
queryID,
|
|
10847
|
+
domain,
|
|
10848
|
+
apiKey,
|
|
10849
|
+
token
|
|
10850
|
+
} = {}) => {
|
|
10851
|
+
if (!data) {
|
|
10852
|
+
return Promise.reject(new Error("No data supplied" /* NO_DATA_SUPPLIED */));
|
|
10853
|
+
}
|
|
10854
|
+
if (!token || !domain || !apiKey) {
|
|
10855
|
+
return Promise.reject(new Error("Unauthenticated" /* UNAUTHENTICATED */));
|
|
10856
|
+
}
|
|
10857
|
+
const url = `${domain}/autoql/api/v1/query/${queryID}/follow?key=${apiKey}`;
|
|
10858
|
+
const config = {
|
|
10859
|
+
headers: {
|
|
10860
|
+
Authorization: `Bearer ${token}`
|
|
10861
|
+
}
|
|
10862
|
+
};
|
|
10863
|
+
return axios.post(url, data, config).then((response) => Promise.resolve(response.data)).catch((error) => {
|
|
10864
|
+
var _a2;
|
|
10865
|
+
return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
|
|
10866
|
+
});
|
|
10867
|
+
};
|
|
10834
10868
|
var fetchLLMSummaryQuote = ({
|
|
10835
10869
|
data,
|
|
10836
10870
|
queryID,
|
|
@@ -12997,6 +13031,7 @@ export {
|
|
|
12997
13031
|
fetchDataPreview,
|
|
12998
13032
|
fetchExploreQueries,
|
|
12999
13033
|
fetchFilters,
|
|
13034
|
+
fetchFollowOnQuery,
|
|
13000
13035
|
fetchLLMSummary,
|
|
13001
13036
|
fetchLLMSummaryEstimate,
|
|
13002
13037
|
fetchLLMSummaryQuote,
|