@tellaro/tql 4.0.1 → 4.0.3

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.
@@ -1,7 +1,7 @@
1
1
  import { BOOLEAN_PREDICATE_MUTATORS as E, tokenizeTql as T, COMPARISON_OPERATORS as R, LOGICAL_OPERATORS as $, GROUP_BY_BUCKET_FUNCTIONS as P, AGGREGATION_FUNCTIONS as D, VISUALIZATION_TYPES as M, TYPE_HINTS as z, MUTATORS as U } from "./tokenizer.js";
2
- import { fuzzyMatch as v } from "./fuzzyMatcher.js";
2
+ import { fuzzyMatch as w } from "./fuzzyMatcher.js";
3
3
  import { getSchemaCache as I } from "./schemaCache.js";
4
- import { ALL_FIELD_TYPES as u, BETWEEN_FIELD_TYPES as w, ORDERED_FIELD_TYPES as f } from "./validator.js";
4
+ import { ALL_FIELD_TYPES as u, BETWEEN_FIELD_TYPES as v, ORDERED_FIELD_TYPES as f } from "./validator.js";
5
5
  const F = [
6
6
  {
7
7
  label: "Simple equality",
@@ -211,7 +211,7 @@ const F = [
211
211
  sum: { detail: "Sum", documentation: "Sum of numeric array elements" },
212
212
  min: { detail: "Minimum", documentation: "Minimum value in array" },
213
213
  max: { detail: "Maximum", documentation: "Maximum value in array" }
214
- }, g = {
214
+ }, y = {
215
215
  // String outputs
216
216
  lowercase: "keyword",
217
217
  uppercase: "keyword",
@@ -281,8 +281,8 @@ const F = [
281
281
  lte: f,
282
282
  // Numeric and date. `keyword` and `text` stay out because Python's `keyword_ops` excludes
283
283
  // `between` while including `gte` — see BETWEEN_FIELD_TYPES in `validator.ts`.
284
- between: w,
285
- not_between: w,
284
+ between: v,
285
+ not_between: v,
286
286
  // String operators (text/keyword only)
287
287
  contains: ["text", "keyword"],
288
288
  not_contains: ["text", "keyword"],
@@ -416,7 +416,7 @@ function H(e, t, i) {
416
416
  if (a.type === "mutator") {
417
417
  if (c)
418
418
  return { type: "after_pipe", partialText: d };
419
- const l = a.value.toLowerCase(), r = g[l];
419
+ const l = a.value.toLowerCase(), r = y[l];
420
420
  return {
421
421
  type: "after_mutator",
422
422
  mutatorName: l,
@@ -440,7 +440,7 @@ function H(e, t, i) {
440
440
  return { type: "after_field", fieldName: s.value, fieldType: l, partialText: d };
441
441
  }
442
442
  if (s?.type === "mutator") {
443
- const l = s.value.toLowerCase(), r = g[l];
443
+ const l = s.value.toLowerCase(), r = y[l];
444
444
  return { type: "after_mutator", mutatorName: l, mutatorOutputType: r, partialText: d };
445
445
  }
446
446
  }
@@ -455,7 +455,7 @@ function H(e, t, i) {
455
455
  return { type: "after_field", fieldName: s.value, fieldType: l, partialText: d };
456
456
  }
457
457
  if (s?.type === "mutator" && c) {
458
- const l = s.value.toLowerCase(), r = g[l];
458
+ const l = s.value.toLowerCase(), r = y[l];
459
459
  return { type: "after_mutator", mutatorName: l, mutatorOutputType: r, partialText: d };
460
460
  }
461
461
  return { type: "unknown", partialText: d };
@@ -480,7 +480,7 @@ function le(e, t = {}) {
480
480
  a.push(...W(n.fieldName, t));
481
481
  break;
482
482
  case "after_value":
483
- a.push(...C());
483
+ a.push(...O());
484
484
  break;
485
485
  case "at_value_end":
486
486
  break;
@@ -546,7 +546,7 @@ function le(e, t = {}) {
546
546
  a.push(...x(t.fields, n.partialText)), a.push(...J(n.partialText));
547
547
  break;
548
548
  default:
549
- a.push(...x(t.fields, n.partialText)), a.push(...b(n.partialText)), a.push(...C());
549
+ a.push(...x(t.fields, n.partialText)), a.push(...b(n.partialText)), a.push(...O());
550
550
  }
551
551
  t.includeAggregations && n.type === "start" && a.push(...A(n.partialText));
552
552
  let s = a;
@@ -556,10 +556,10 @@ function le(e, t = {}) {
556
556
  if (c) {
557
557
  const r = [];
558
558
  for (const m of a) {
559
- const p = v(l, m.label), _ = m.filterText ? v(l, m.filterText) : { matched: !1, score: 0 }, y = p.score >= _.score ? p : _;
560
- y.matched && y.score >= d && r.push({
559
+ const p = w(l, m.label), _ = m.filterText ? w(l, m.filterText) : { matched: !1, score: 0 }, g = p.score >= _.score ? p : _;
560
+ g.matched && g.score >= d && r.push({
561
561
  ...m,
562
- matchScore: y.score,
562
+ matchScore: g.score,
563
563
  matchedIndices: p.matched ? p.matchedIndices : void 0
564
564
  });
565
565
  }
@@ -597,9 +597,6 @@ function j(e) {
597
597
  { name: "@timestamp", description: "Event timestamp" },
598
598
  { name: "message", description: "Message content" },
599
599
  { name: "user.name", description: "User name" },
600
- { name: "os.family", description: "Operating system family" },
601
- { name: "os.type", description: "Operating system type" },
602
- { name: "os.version", description: "Operating system version" },
603
600
  { name: "customer", description: "Customer identifier" },
604
601
  { name: "stack", description: "Stack identifier" }
605
602
  ].filter((i) => !e || i.name.toLowerCase().includes(e.toLowerCase())).map((i) => ({
@@ -656,9 +653,9 @@ function K(e, t) {
656
653
  "not_matches"
657
654
  ], o = ["exists", "not_exists"], n = ["is", "is_not"];
658
655
  if (e === "in" || e === "not_in")
659
- return O(t) ? `${e} [$1]` : `${e} ["$1"]`;
656
+ return C(t) ? `${e} [$1]` : `${e} ["$1"]`;
660
657
  if (e === "between" || e === "not_between")
661
- return O(t) ? `${e} $1 AND $2` : `${e} "$1" AND "$2"`;
658
+ return C(t) ? `${e} $1 AND $2` : `${e} "$1" AND "$2"`;
662
659
  if (n.includes(e))
663
660
  return `${e} null`;
664
661
  if (o.includes(e))
@@ -692,10 +689,10 @@ function K(e, t) {
692
689
  return `${e} `;
693
690
  }
694
691
  }
695
- function O(e) {
692
+ function C(e) {
696
693
  return e === "long" || e === "integer" || e === "double" || e === "float" || e === "short" || e === "byte" || e === "half_float" || e === "scaled_float" || e === "unsigned_long";
697
694
  }
698
- function C() {
695
+ function O() {
699
696
  return $.filter((e) => e !== "NOT").map(
700
697
  (e, t) => L(e, t)
701
698
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellaro/tql",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Tellaro Query Language (TQL) parser, validator, and autocomplete for JavaScript/TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",