autoql-fe-utils 1.11.21 → 1.11.23

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.js CHANGED
@@ -861,6 +861,7 @@ __export(index_exports, {
861
861
  fetchDataPreview: () => fetchDataPreview,
862
862
  fetchExploreQueries: () => fetchExploreQueries,
863
863
  fetchFilters: () => fetchFilters,
864
+ fetchFollowOnQuery: () => fetchFollowOnQuery,
864
865
  fetchLLMSummary: () => fetchLLMSummary,
865
866
  fetchLLMSummaryEstimate: () => fetchLLMSummaryEstimate,
866
867
  fetchLLMSummaryQuote: () => fetchLLMSummaryQuote,
@@ -2335,7 +2336,7 @@ var isISODate = (str) => {
2335
2336
  if (/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
2336
2337
  return false;
2337
2338
  }
2338
- if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d{1,3})?$/.test(dateString)) {
2339
+ if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d{2}(:\d{2})?|Z)?$/.test(dateString)) {
2339
2340
  return true;
2340
2341
  }
2341
2342
  if (/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/.test(dateString)) {
@@ -3199,6 +3200,7 @@ var FilterOperatorEnum = /* @__PURE__ */ ((FilterOperatorEnum2) => {
3199
3200
  FilterOperatorEnum2["REGEX"] = "regex";
3200
3201
  FilterOperatorEnum2["STARTS_WITH"] = "starts_with";
3201
3202
  FilterOperatorEnum2["ENDS_WITH"] = "ends_with";
3203
+ FilterOperatorEnum2["IN"] = "in";
3202
3204
  return FilterOperatorEnum2;
3203
3205
  })(FilterOperatorEnum || {});
3204
3206
  var FilterTypeEnum = {
@@ -3268,6 +3270,15 @@ var betweenMatcher = (cell, cond) => {
3268
3270
  getLogger().warn("betweenMatcher: unsupported types for between fallback", { cell, low, high, type: cond.type });
3269
3271
  return false;
3270
3272
  };
3273
+ var inMatcher = (cell, cond) => {
3274
+ var _a2;
3275
+ if (cell == null) return false;
3276
+ const raw = String((_a2 = cond.value) != null ? _a2 : "");
3277
+ if (raw.length === 0) return true;
3278
+ const items = raw.split(",").map((s) => s.trim().toLowerCase());
3279
+ const set = new Set(items);
3280
+ return set.has(String(cell).toLowerCase());
3281
+ };
3271
3282
  var FILTER_MATCHERS = {
3272
3283
  ["like" /* LIKE */]: likeMatcher,
3273
3284
  ["not_like" /* NOT_LIKE */]: notLikeMatcher,
@@ -3280,7 +3291,8 @@ var FILTER_MATCHERS = {
3280
3291
  ["regex" /* REGEX */]: regexMatcher,
3281
3292
  ["between" /* BETWEEN */]: betweenMatcher,
3282
3293
  ["starts_with" /* STARTS_WITH */]: (cell, cond) => String(cell).startsWith(String(cond.value)),
3283
- ["ends_with" /* ENDS_WITH */]: (cell, cond) => String(cell).endsWith(String(cond.value))
3294
+ ["ends_with" /* ENDS_WITH */]: (cell, cond) => String(cell).endsWith(String(cond.value)),
3295
+ ["in" /* IN */]: inMatcher
3284
3296
  };
3285
3297
  function isValidOperator(op) {
3286
3298
  return Object.values(FilterOperatorEnum).includes(op);
@@ -3333,7 +3345,7 @@ function parseFilter(raw, type, defaultOperator = "like" /* LIKE */) {
3333
3345
  if (typeof raw !== "string") return { operator: defaultOperator, value: raw, type };
3334
3346
  const trimmed = raw.trim();
3335
3347
  if (trimmed.length === 0) return { operator: defaultOperator, value: "", type };
3336
- const opToken = `${"between" /* BETWEEN */}|[<>!=]=?|not_like`;
3348
+ const opToken = `${"between" /* BETWEEN */}|${"in" /* IN */}|[<>!=]=?|not_like`;
3337
3349
  const opPattern = `^(${opToken})\\s*(.*)$`;
3338
3350
  const opRe = compileSafeRegex(opPattern, "i");
3339
3351
  const opMatch = opRe ? opRe.exec(trimmed) : null;
@@ -3341,7 +3353,11 @@ function parseFilter(raw, type, defaultOperator = "like" /* LIKE */) {
3341
3353
  let op = String((_a2 = opMatch[1]) != null ? _a2 : "").toLowerCase();
3342
3354
  const rest = (_b2 = opMatch[2]) != null ? _b2 : "";
3343
3355
  if (op === "!") op = "not_like" /* NOT_LIKE */;
3356
+ if (op === "==") op = "=" /* EQ */;
3344
3357
  if (type === FilterTypeEnum.STRING && op === "!=") op = "not_like" /* NOT_LIKE */;
3358
+ if (op === "in" /* IN */) {
3359
+ return { operator: "in" /* IN */, value: rest, type };
3360
+ }
3345
3361
  if (op === "between" /* BETWEEN */) {
3346
3362
  let parts = (_c = rest.split(/\s+to\s+|,/)) == null ? void 0 : _c.map((s) => s.trim()).filter((s) => s.length);
3347
3363
  if ((!parts || parts.length < 2) && type === FilterTypeEnum.NUMBER) {
@@ -3901,10 +3917,7 @@ var createFilterFunction = ({
3901
3917
  return false;
3902
3918
  }
3903
3919
  const raw = String(headerValue != null ? headerValue : "").trim();
3904
- if (!raw) {
3905
- getLogger().warn("date filter: header value empty", { column });
3906
- return false;
3907
- }
3920
+ if (!raw) return true;
3908
3921
  const parts = raw.split(" to ").map((s) => String(s).trim()).filter((s) => s.length > 0);
3909
3922
  if (!parts.length) {
3910
3923
  getLogger().warn("date filter: could not parse date range", { raw, column });
@@ -3931,24 +3944,23 @@ var createFilterFunction = ({
3931
3944
  };
3932
3945
  } else if ((column == null ? void 0 : column.type) === "DATE_STRING" /* DATE_STRING */) {
3933
3946
  return (headerValue, rowValue) => {
3934
- if (rowValue === void 0 || rowValue === null) {
3935
- return false;
3936
- }
3947
+ const raw = String(headerValue != null ? headerValue : "").trim();
3948
+ if (!raw) return true;
3949
+ if (rowValue === void 0 || rowValue === null) return false;
3937
3950
  const formattedElement = formatElement({
3938
3951
  element: rowValue,
3939
3952
  column,
3940
3953
  config: dataFormatting
3941
3954
  });
3942
- const raw = String(headerValue != null ? headerValue : "").trim();
3943
3955
  const lowerElement = String(formattedElement != null ? formattedElement : "").toLowerCase();
3944
3956
  return matchesStringFilter(raw, lowerElement);
3945
3957
  };
3946
3958
  } else if (isColumnNumberType(column)) {
3947
3959
  return (headerValue, rowValue) => {
3948
3960
  try {
3949
- if (rowValue === void 0 || rowValue === null) return false;
3950
3961
  const raw = String(headerValue != null ? headerValue : "").trim();
3951
- if (raw.length === 0) return false;
3962
+ if (raw.length === 0) return true;
3963
+ if (rowValue === void 0 || rowValue === null) return false;
3952
3964
  const cond = parseFilter(raw, "number", "=");
3953
3965
  return matchCell(rowValue, cond);
3954
3966
  } catch (error) {
@@ -3958,10 +3970,9 @@ var createFilterFunction = ({
3958
3970
  };
3959
3971
  } else {
3960
3972
  return (headerValue, rowValue) => {
3961
- if (rowValue === void 0 || rowValue === null) {
3962
- return false;
3963
- }
3964
3973
  const raw = String(headerValue != null ? headerValue : "").trim();
3974
+ if (!raw) return true;
3975
+ if (rowValue === void 0 || rowValue === null) return false;
3965
3976
  const lowerValue = String(rowValue != null ? rowValue : "").toLowerCase();
3966
3977
  const cond = parseFilter(raw, "string", "like" /* LIKE */);
3967
3978
  return matchCell(lowerValue, { ...cond, type: "string", value: String(cond.value).toLowerCase() });
@@ -11355,6 +11366,30 @@ var fetchLLMSummary = ({
11355
11366
  return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
11356
11367
  });
11357
11368
  };
11369
+ var fetchFollowOnQuery = ({
11370
+ data,
11371
+ queryID,
11372
+ domain,
11373
+ apiKey,
11374
+ token
11375
+ } = {}) => {
11376
+ if (!data) {
11377
+ return Promise.reject(new Error("No data supplied" /* NO_DATA_SUPPLIED */));
11378
+ }
11379
+ if (!token || !domain || !apiKey) {
11380
+ return Promise.reject(new Error("Unauthenticated" /* UNAUTHENTICATED */));
11381
+ }
11382
+ const url = `${domain}/autoql/api/v1/query/${queryID}/follow?key=${apiKey}`;
11383
+ const config = {
11384
+ headers: {
11385
+ Authorization: `Bearer ${token}`
11386
+ }
11387
+ };
11388
+ return import_axios.default.post(url, data, config).then((response) => Promise.resolve(response.data)).catch((error) => {
11389
+ var _a2;
11390
+ return Promise.reject((_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data);
11391
+ });
11392
+ };
11358
11393
  var fetchLLMSummaryQuote = ({
11359
11394
  data,
11360
11395
  queryID,
@@ -13522,6 +13557,7 @@ function color() {
13522
13557
  fetchDataPreview,
13523
13558
  fetchExploreQueries,
13524
13559
  fetchFilters,
13560
+ fetchFollowOnQuery,
13525
13561
  fetchLLMSummary,
13526
13562
  fetchLLMSummaryEstimate,
13527
13563
  fetchLLMSummaryQuote,