@tellaro/tql 3.2.0 → 4.0.0

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,8 +1,19 @@
1
+ import { GROUP_BY_BUCKET_FUNCTIONS } from './tokenizer';
1
2
  import { TqlCompletionContext, TqlCompletionItem, TqlCompletionOptions } from './types';
2
3
  /**
3
4
  * Get completions for a TQL query at the cursor position
4
5
  */
5
6
  export declare function getCompletions(context: TqlCompletionContext, options?: TqlCompletionOptions): TqlCompletionItem[];
7
+ /**
8
+ * Group-by bucket function completions, offered after `by`.
9
+ *
10
+ * Insert text uses `$1`-style placeholders like the aggregation completions. Details name the
11
+ * argument forms both engines accept (see `GROUP_BY_BUCKET_FUNCTIONS` in `tokenizer.ts`).
12
+ */
13
+ export declare const BUCKET_FUNCTION_DETAILS: Record<(typeof GROUP_BY_BUCKET_FUNCTIONS)[number], {
14
+ insertText: string;
15
+ detail: string;
16
+ }>;
6
17
  /**
7
18
  * Get the word at the cursor position
8
19
  */
@@ -1,8 +1,8 @@
1
- import { BOOLEAN_PREDICATE_MUTATORS as L, tokenizeTql as T, COMPARISON_OPERATORS as E, LOGICAL_OPERATORS as R, AGGREGATION_FUNCTIONS as P, VISUALIZATION_TYPES as $, TYPE_HINTS as D, MUTATORS as M } from "./tokenizer.js";
2
- import { fuzzyMatch as _ } from "./fuzzyMatcher.js";
3
- import { getSchemaCache as S } from "./schemaCache.js";
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";
3
+ import { getSchemaCache as I } from "./schemaCache.js";
4
4
  import { ALL_FIELD_TYPES as u, BETWEEN_FIELD_TYPES as w, ORDERED_FIELD_TYPES as f } from "./validator.js";
5
- const z = [
5
+ const F = [
6
6
  {
7
7
  label: "Simple equality",
8
8
  insertText: 'field eq "value"',
@@ -105,7 +105,7 @@ const z = [
105
105
  description: "Top 10 results by count",
106
106
  category: "Stats"
107
107
  }
108
- ], U = {
108
+ ], G = {
109
109
  eq: { detail: "Equals", documentation: "Exact match comparison" },
110
110
  ne: { detail: "Not equals", documentation: "Match any value except this one" },
111
111
  gt: {
@@ -176,7 +176,7 @@ const z = [
176
176
  not_any: { detail: "Not any matches", documentation: "Negation of any" },
177
177
  not_all: { detail: "Not all match", documentation: "Negation of all" },
178
178
  not_none: { detail: "Not none match", documentation: "Negation of none" }
179
- }, F = {
179
+ }, B = {
180
180
  lowercase: { detail: "Convert to lowercase", documentation: "Transform string to lowercase" },
181
181
  uppercase: { detail: "Convert to uppercase", documentation: "Transform string to uppercase" },
182
182
  trim: { detail: "Trim whitespace", documentation: "Remove leading/trailing whitespace" },
@@ -237,7 +237,7 @@ const z = [
237
237
  // There is exactly one JS copy, in `tokenizer.ts`, pinned against both engines by
238
238
  // `tests/booleanPredicateSugar.spec.ts`.
239
239
  ...Object.fromEntries(
240
- L.map((e) => [e, "boolean"])
240
+ E.map((e) => [e, "boolean"])
241
241
  ),
242
242
  // `any` and `all` are collection OPERATORS rather than predicates — absent from both
243
243
  // engines' predicate sets, and not eligible for the `field | <name>` filter sugar — so
@@ -257,7 +257,7 @@ const z = [
257
257
  geo: "object",
258
258
  // Array output (returns array of strings)
259
259
  split: "keyword"
260
- }, G = {
260
+ }, q = {
261
261
  // Equality and membership — every field type, by NAME rather than by a transcribed list.
262
262
  eq: u,
263
263
  ne: u,
@@ -319,7 +319,7 @@ const z = [
319
319
  not_all: u,
320
320
  not_none: u
321
321
  };
322
- class B {
322
+ class Y {
323
323
  cache = /* @__PURE__ */ new Map();
324
324
  maxSize = 50;
325
325
  maxAge = 5e3;
@@ -341,16 +341,16 @@ class B {
341
341
  this.cache.clear();
342
342
  }
343
343
  }
344
- const k = new B();
344
+ const k = new Y();
345
345
  function V(e, t, i) {
346
346
  if (!e) return { type: "start", partialText: "" };
347
- const o = S().get(i)?.hash ?? "-", n = `${e.substring(0, t)}|${t}|${o}`, a = k.get(n);
347
+ const o = I().get(i)?.hash ?? "-", n = `${e.substring(0, t)}|${t}|${o}`, a = k.get(n);
348
348
  if (a)
349
349
  return a.fieldName && !a.fieldType && i && (a.fieldType = h(a.fieldName, i)), a;
350
- const s = Y(e, t, i);
350
+ const s = H(e, t, i);
351
351
  return k.set(n, s), s;
352
352
  }
353
- function Y(e, t, i) {
353
+ function H(e, t, i) {
354
354
  const n = T(e.substring(0, t)).filter((l) => l.type !== "whitespace");
355
355
  if (n.length === 0)
356
356
  return { type: "start" };
@@ -461,14 +461,14 @@ function Y(e, t, i) {
461
461
  return { type: "unknown", partialText: d };
462
462
  }
463
463
  function h(e, t) {
464
- return t ? S().getFieldType(t, e) : void 0;
464
+ return t ? I().getFieldType(t, e) : void 0;
465
465
  }
466
- function ie(e, t = {}) {
466
+ function le(e, t = {}) {
467
467
  const { query: i, cursorPosition: o } = e, n = V(i, o, t.fields), a = [];
468
468
  switch (n.type) {
469
469
  case "start":
470
470
  case "after_paren":
471
- a.push(...x(t.fields, n.partialText)), a.push(I("NOT")), t.includeSnippets !== !1 && a.push(...K(t, n.partialText));
471
+ a.push(...x(t.fields, n.partialText)), a.push(L("NOT")), t.includeSnippets !== !1 && a.push(...Z(t, n.partialText));
472
472
  break;
473
473
  case "after_field":
474
474
  a.push(...b(n.partialText, n.fieldType));
@@ -477,7 +477,7 @@ function ie(e, t = {}) {
477
477
  a.push(...b(n.partialText, n.mutatorOutputType));
478
478
  break;
479
479
  case "after_operator":
480
- a.push(...j(n.fieldName, t));
480
+ a.push(...W(n.fieldName, t));
481
481
  break;
482
482
  case "after_value":
483
483
  a.push(...C());
@@ -485,7 +485,7 @@ function ie(e, t = {}) {
485
485
  case "at_value_end":
486
486
  break;
487
487
  case "after_pipe":
488
- a.push(...W(n.partialText)), (!n.partialText || "stats".includes(n.partialText.toLowerCase())) && a.push({
488
+ a.push(...X(n.partialText)), (!n.partialText || "stats".includes(n.partialText.toLowerCase())) && a.push({
489
489
  label: "stats",
490
490
  insertText: "stats ",
491
491
  kind: "keyword",
@@ -522,27 +522,33 @@ function ie(e, t = {}) {
522
522
  kind: "keyword",
523
523
  detail: "Add another group-by field",
524
524
  sortOrder: 2
525
+ }), a.push({
526
+ label: "with other",
527
+ insertText: "with other ",
528
+ kind: "keyword",
529
+ detail: `Add an "Other" row for what the level's limit dropped (last group-by level only)`,
530
+ sortOrder: 3
525
531
  });
526
532
  break;
527
533
  case "after_double_colon":
528
- a.push(...Z(n.partialText));
534
+ a.push(...Q(n.partialText));
529
535
  break;
530
536
  case "after_arrow":
531
- a.push(...X(n.partialText));
537
+ a.push(...ee(n.partialText));
532
538
  break;
533
539
  case "in_viz_params":
534
- a.push(...Q(n.partialText));
540
+ a.push(...ae(n.partialText));
535
541
  break;
536
542
  case "after_stats":
537
- a.push(...O(n.partialText));
543
+ a.push(...A(n.partialText));
538
544
  break;
539
545
  case "after_by":
540
- a.push(...x(t.fields, n.partialText));
546
+ a.push(...x(t.fields, n.partialText)), a.push(...J(n.partialText));
541
547
  break;
542
548
  default:
543
549
  a.push(...x(t.fields, n.partialText)), a.push(...b(n.partialText)), a.push(...C());
544
550
  }
545
- t.includeAggregations && n.type === "start" && a.push(...O(n.partialText));
551
+ t.includeAggregations && n.type === "start" && a.push(...A(n.partialText));
546
552
  let s = a;
547
553
  const c = t.fuzzyMatching !== !1, d = t.minFuzzyScore ?? 0;
548
554
  if (n.partialText) {
@@ -550,7 +556,7 @@ function ie(e, t = {}) {
550
556
  if (c) {
551
557
  const r = [];
552
558
  for (const m of a) {
553
- const p = _(l, m.label), v = m.filterText ? _(l, m.filterText) : { matched: !1, score: 0 }, y = p.score >= v.score ? p : v;
559
+ const p = v(l, m.label), _ = m.filterText ? v(l, m.filterText) : { matched: !1, score: 0 }, y = p.score >= _.score ? p : _;
554
560
  y.matched && y.score >= d && r.push({
555
561
  ...m,
556
562
  matchScore: y.score,
@@ -567,7 +573,7 @@ function ie(e, t = {}) {
567
573
  }
568
574
  function x(e, t) {
569
575
  if (!e || e.length === 0)
570
- return q(t);
576
+ return j(t);
571
577
  const i = [];
572
578
  for (const o of e) {
573
579
  const n = N(o);
@@ -579,7 +585,7 @@ function x(e, t) {
579
585
  }
580
586
  return i;
581
587
  }
582
- function q(e) {
588
+ function j(e) {
583
589
  return [
584
590
  { name: "hostname", description: "Host/machine name" },
585
591
  { name: "status", description: "Status value" },
@@ -618,12 +624,12 @@ function N(e, t) {
618
624
  };
619
625
  }
620
626
  function b(e, t) {
621
- let i = [...E];
627
+ let i = [...R];
622
628
  return t && (i = i.filter((o) => {
623
- const n = G[o];
629
+ const n = q[o];
624
630
  return !n || n.includes(t);
625
631
  })), e && (i = i.filter((o) => o.toLowerCase().includes(e.toLowerCase()))), i.map((o, n) => {
626
- const a = U[o] || { detail: o, documentation: "" }, s = H(o, t);
632
+ const a = G[o] || { detail: o, documentation: "" }, s = K(o, t);
627
633
  return {
628
634
  label: o,
629
635
  insertText: s,
@@ -634,7 +640,7 @@ function b(e, t) {
634
640
  };
635
641
  });
636
642
  }
637
- function H(e, t) {
643
+ function K(e, t) {
638
644
  const i = [
639
645
  "contains",
640
646
  "not_contains",
@@ -650,9 +656,9 @@ function H(e, t) {
650
656
  "not_matches"
651
657
  ], o = ["exists", "not_exists"], n = ["is", "is_not"];
652
658
  if (e === "in" || e === "not_in")
653
- return A(t) ? `${e} [$1]` : `${e} ["$1"]`;
659
+ return O(t) ? `${e} [$1]` : `${e} ["$1"]`;
654
660
  if (e === "between" || e === "not_between")
655
- return A(t) ? `${e} $1 AND $2` : `${e} "$1" AND "$2"`;
661
+ return O(t) ? `${e} $1 AND $2` : `${e} "$1" AND "$2"`;
656
662
  if (n.includes(e))
657
663
  return `${e} null`;
658
664
  if (o.includes(e))
@@ -686,15 +692,15 @@ function H(e, t) {
686
692
  return `${e} `;
687
693
  }
688
694
  }
689
- function A(e) {
695
+ function O(e) {
690
696
  return e === "long" || e === "integer" || e === "double" || e === "float" || e === "short" || e === "byte" || e === "half_float" || e === "scaled_float" || e === "unsigned_long";
691
697
  }
692
698
  function C() {
693
- return R.filter((e) => e !== "NOT").map(
694
- (e, t) => I(e, t)
699
+ return $.filter((e) => e !== "NOT").map(
700
+ (e, t) => L(e, t)
695
701
  );
696
702
  }
697
- function I(e, t = 0) {
703
+ function L(e, t = 0) {
698
704
  return {
699
705
  label: e,
700
706
  insertText: e + " ",
@@ -703,7 +709,7 @@ function I(e, t = 0) {
703
709
  sortOrder: 30 + t
704
710
  };
705
711
  }
706
- function j(e, t) {
712
+ function W(e, t) {
707
713
  const i = [];
708
714
  return e && t?.fieldValues?.[e] && t.fieldValues[e].forEach((n, a) => {
709
715
  i.push({
@@ -744,8 +750,8 @@ function j(e, t) {
744
750
  }
745
751
  ), i;
746
752
  }
747
- function K(e, t) {
748
- return z.filter((o) => !t || o.label.toLowerCase().includes(t.toLowerCase())).map((o, n) => ({
753
+ function Z(e, t) {
754
+ return F.filter((o) => !t || o.label.toLowerCase().includes(t.toLowerCase())).map((o, n) => ({
749
755
  label: o.label,
750
756
  insertText: o.insertText,
751
757
  kind: "snippet",
@@ -754,10 +760,10 @@ function K(e, t) {
754
760
  sortOrder: 100 + n
755
761
  }));
756
762
  }
757
- function W(e) {
758
- return M.filter((t) => !e || t.toLowerCase().includes(e.toLowerCase())).map(
763
+ function X(e) {
764
+ return U.filter((t) => !e || t.toLowerCase().includes(e.toLowerCase())).map(
759
765
  (t, i) => {
760
- const o = F[t] || { detail: "Field mutator", documentation: "" };
766
+ const o = B[t] || { detail: "Field mutator", documentation: "" };
761
767
  return {
762
768
  label: t,
763
769
  insertText: t,
@@ -769,8 +775,8 @@ function W(e) {
769
775
  }
770
776
  );
771
777
  }
772
- function O(e) {
773
- return P.filter(
778
+ function A(e) {
779
+ return D.filter(
774
780
  (t) => !e || t.toLowerCase().includes(e.toLowerCase())
775
781
  ).map((t, i) => ({
776
782
  label: t,
@@ -780,8 +786,41 @@ function O(e) {
780
786
  sortOrder: 70 + i
781
787
  }));
782
788
  }
783
- function Z(e) {
784
- return D.filter(
789
+ const S = {
790
+ date_histogram: {
791
+ insertText: "date_histogram(${1:@timestamp}, ${2:1h})",
792
+ detail: "Time buckets: fixed (30s, 5m, 1h, 1d), calendar (minute hour day week month quarter year) or auto / auto(N)"
793
+ },
794
+ geotile: {
795
+ insertText: "geotile(${1:source.geo.location}, ${2:6})",
796
+ detail: "Map tiles of a geo_point field; precision 0-29 (default 7)"
797
+ },
798
+ geohash: {
799
+ insertText: "geohash(${1:source.geo.location}, ${2:4})",
800
+ detail: "Geohash cells of a geo_point field; precision 1-12 (default 5)"
801
+ },
802
+ range: {
803
+ insertText: "range(${1:network.bytes}, ${2:0, 1024, 65536})",
804
+ detail: "Numeric ranges from increasing boundaries: *-b1, b1-b2, ..., bn-*"
805
+ },
806
+ filters: {
807
+ insertText: "filters(${1:log.level eq 'error'} as '${2:Errors}', ${3:log.level eq 'info'} as '${4:Info}')",
808
+ detail: "One bucket per filter expression, labelled with `as`"
809
+ }
810
+ };
811
+ function J(e) {
812
+ return P.filter(
813
+ (t) => !e || t.includes(e.toLowerCase())
814
+ ).map((t, i) => ({
815
+ label: t,
816
+ insertText: S[t].insertText,
817
+ kind: "aggregation",
818
+ detail: S[t].detail,
819
+ sortOrder: 60 + i
820
+ }));
821
+ }
822
+ function Q(e) {
823
+ return z.filter(
785
824
  (t) => !e || t.toLowerCase().includes(e.toLowerCase())
786
825
  ).map((t, i) => ({
787
826
  label: t,
@@ -791,8 +830,8 @@ function Z(e) {
791
830
  sortOrder: 80 + i
792
831
  }));
793
832
  }
794
- function X(e) {
795
- return $.filter(
833
+ function ee(e) {
834
+ return M.filter(
796
835
  (t) => !e || t.toLowerCase().includes(e.toLowerCase())
797
836
  ).map((t, i) => ({
798
837
  label: t,
@@ -802,7 +841,7 @@ function X(e) {
802
841
  sortOrder: 90 + i
803
842
  }));
804
843
  }
805
- const J = [
844
+ const te = [
806
845
  // Titles & labels
807
846
  { name: "title", detail: "Chart title", insertText: 'title="' },
808
847
  { name: "x_label", detail: "X-axis label", insertText: 'x_label="' },
@@ -838,8 +877,8 @@ const J = [
838
877
  { name: "link", detail: 'Template URL for value links: "https://...{{value}}"', insertText: 'link="' },
839
878
  { name: "link_target", detail: "Link target: _self (default) or _blank", insertText: "link_target=" }
840
879
  ];
841
- function Q(e) {
842
- return J.filter(
880
+ function ae(e) {
881
+ return te.filter(
843
882
  (t) => !e || t.name.toLowerCase().includes(e.toLowerCase())
844
883
  ).map((t, i) => ({
845
884
  label: t.name,
@@ -849,7 +888,7 @@ function Q(e) {
849
888
  sortOrder: 95 + i
850
889
  }));
851
890
  }
852
- function re(e, t) {
891
+ function se(e, t) {
853
892
  const o = T(e).find(
854
893
  (n) => n.start <= t && n.end >= t && n.type !== "whitespace"
855
894
  );
@@ -859,18 +898,19 @@ function re(e, t) {
859
898
  end: o.end
860
899
  } : null;
861
900
  }
862
- function oe() {
901
+ function de() {
863
902
  return [" ", "(", ".", '"', "'", "|", ":", "="];
864
903
  }
865
- function le(e, t, i) {
904
+ function ce(e, t, i) {
866
905
  if (!e) return !1;
867
906
  if (i === " " || i === "(" || i === "." || i === "|" || i === ":" || i === "=") return !0;
868
907
  const o = T(e.substring(0, t)), n = o[o.length - 1];
869
908
  return !!(n && n.type === "field" && n.value.length >= 2);
870
909
  }
871
910
  export {
872
- oe as getCompletionTriggerCharacters,
873
- ie as getCompletions,
874
- re as getWordAtPosition,
875
- le as shouldTriggerCompletion
911
+ S as BUCKET_FUNCTION_DETAILS,
912
+ de as getCompletionTriggerCharacters,
913
+ le as getCompletions,
914
+ se as getWordAtPosition,
915
+ ce as shouldTriggerCompletion
876
916
  };
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export type { TqlToken, TqlTokenType, TqlExpression, TqlBinaryExpression, TqlUnaryExpression, TqlComparisonExpression, TqlCollectionExpression, TqlMutatorExpression, TqlAggregationExpression, TqlStatsExpression, TqlGroupExpression, TqlLiteral, TqlFieldReference, TqlComparisonOperator, TqlLogicalOperator, TqlCollectionOperator, TqlMutator, TqlAggregationFunction, TqlTypeHint, TqlVisualizationType, TqlVizParams, TqlVizHint, TqlParseResult, TqlParseError, TqlParseWarning, TqlErrorCode, TqlWarningCode, TqlValidationResult, TqlValidationOptions, TqlFieldType, CaseSensitiveSupport, TqlCompletionItem, TqlCompletionKind, TqlCompletionContext, TqlCompletionOptions, TqlFieldSchema, TqlSnippet, TqlInputProps, TqlInputEmits, TqlInputExpose } from './types';
10
- export { TqlTokenizer, tokenizeTql, tokenizeTqlNoWhitespace, findTokenAtPosition, findTokensInRange, findTokenBefore, findPreviousToken, COMPARISON_OPERATORS, SYMBOL_OPERATORS, NEGATION_SYMBOL_OPERATORS, LOGICAL_OPERATORS, COLLECTION_OPERATORS, MUTATORS, BOOLEAN_PREDICATE_MUTATORS, BOOLEAN_PREDICATE_MUTATOR_SET, AGGREGATION_FUNCTIONS, TYPE_HINTS, VISUALIZATION_TYPES, KEYWORDS } from './tokenizer';
11
- export { TqlParser, parseTql, isValidTql, getTqlErrors, formatParseError } from './parser';
9
+ export type { TqlToken, TqlTokenType, TqlExpression, TqlBinaryExpression, TqlUnaryExpression, TqlComparisonExpression, TqlCollectionExpression, TqlMutatorExpression, TqlAggregationExpression, TqlStatsExpression, TqlGroupByBucket, TqlLatLon, TqlGroupByLevel, TqlGroupByMetadata, TqlRowBucketMeta, TqlStatsRow, TqlGroupExpression, TqlLiteral, TqlFieldReference, TqlComparisonOperator, TqlLogicalOperator, TqlCollectionOperator, TqlMutator, TqlAggregationFunction, TqlTypeHint, TqlVisualizationType, TqlVizParams, TqlVizHint, TqlParseResult, TqlParseError, TqlParseWarning, TqlErrorCode, TqlWarningCode, TqlValidationResult, TqlValidationOptions, TqlFieldType, CaseSensitiveSupport, TqlCompletionItem, TqlCompletionKind, TqlCompletionContext, TqlCompletionOptions, TqlFieldSchema, TqlSnippet, TqlInputProps, TqlInputEmits, TqlInputExpose } from './types';
10
+ export { TqlTokenizer, tokenizeTql, tokenizeTqlNoWhitespace, findTokenAtPosition, findTokensInRange, findTokenBefore, findPreviousToken, COMPARISON_OPERATORS, SYMBOL_OPERATORS, NEGATION_SYMBOL_OPERATORS, LOGICAL_OPERATORS, COLLECTION_OPERATORS, MUTATORS, BOOLEAN_PREDICATE_MUTATORS, BOOLEAN_PREDICATE_MUTATOR_SET, AGGREGATION_FUNCTIONS, GROUP_BY_BUCKET_FUNCTIONS, DATE_HISTOGRAM_CALENDAR_INTERVALS, DATE_HISTOGRAM_FIXED_UNITS, GEO_GRID_PRECISION, TYPE_HINTS, VISUALIZATION_TYPES, KEYWORDS } from './tokenizer';
11
+ export { TqlParser, parseTql, isValidTql, getTqlErrors, formatParseError, dateHistogramIntervalProblem, geoPrecisionProblem, rangeBoundariesProblem } from './parser';
12
12
  export { TqlValidator, validateTql, isValidTqlSyntax, getTqlIssues, formatValidationResult, caseSensitiveSupport, casePreservingForm, CASE_SENSITIVE_OPERATORS, CASE_SENSITIVE_WHOLE_VALUE_OPERATORS, CASE_SENSITIVE_MEMBERSHIP_OPERATORS, MAX_REGEX_PATTERN_LENGTH } from './validator';
13
13
  export { getCompletions, getWordAtPosition, getCompletionTriggerCharacters, shouldTriggerCompletion } from './completionProvider';
14
14
  export { fuzzyMatch, levenshteinDistance, findClosestMatch, fuzzyFilter, highlightMatch, type FuzzyMatchResult, type FuzzyMatchOptions } from './fuzzyMatcher';
@@ -14,6 +14,29 @@ import { TqlCollectionOperator, TqlParseError, TqlParseResult } from './types';
14
14
  * a query the user can paste back.
15
15
  */
16
16
  export declare function collectionOperatorSpelling(operator: TqlCollectionOperator, negated: boolean): string;
17
+ /**
18
+ * The refusal a `date_histogram` interval argument earns, or null — the JS reading of
19
+ * `parse_date_histogram_interval` in `src/tql/stats_buckets.py` / `tql/src/stats_buckets.rs`.
20
+ * `raw` is the argument's source text (null when omitted, which is `auto`).
21
+ */
22
+ export declare function dateHistogramIntervalProblem(raw: string | null): {
23
+ message: string;
24
+ suggestion: string;
25
+ } | null;
26
+ /** The refusal a geotile/geohash precision argument earns, or null (see `parse_geo_precision`). */
27
+ export declare function geoPrecisionProblem(kind: "geotile" | "geohash", raw: string | null): {
28
+ message: string;
29
+ suggestion: string;
30
+ } | null;
31
+ /**
32
+ * The refusal `range(...)` boundaries earn, or null (see `parse_range_boundaries`): each must be
33
+ * a finite number and they must strictly increase. `index` is the offending boundary.
34
+ */
35
+ export declare function rangeBoundariesProblem(raws: readonly string[]): {
36
+ message: string;
37
+ suggestion: string;
38
+ index: number;
39
+ } | null;
17
40
  export declare class TqlParser {
18
41
  private tokens;
19
42
  private allTokens;
@@ -21,6 +44,7 @@ export declare class TqlParser {
21
44
  private errors;
22
45
  private warnings;
23
46
  private depth;
47
+ private input;
24
48
  constructor(input: string);
25
49
  /**
26
50
  * Parse the input and return the result
@@ -263,6 +287,18 @@ export declare class TqlParser {
263
287
  * from `by top` needs the grammar this method is declining to reimplement.
264
288
  */
265
289
  private checkStatsModifiers;
290
+ /**
291
+ * Flag group-by bucket functions whose ARGUMENTS both engines refuse at parse time.
292
+ *
293
+ * Like `checkStatsModifiers`, a targeted scan rather than a stats parser: it reads each
294
+ * `bucketFunction` call's comma-separated arguments and applies the same argument rules as
295
+ * `stats_buckets.parse_date_histogram_interval` (Python) / `parse_date_histogram_interval`
296
+ * (Rust), with the same message text, so the editor reports what the engine will. Shapes the
297
+ * grammars themselves refuse (a missing field, `top N` on a bucket level) are left to the
298
+ * engines' ordinary syntax errors. `tests/statsBucketKinds.spec.ts` replays
299
+ * `validation/stats_bucket_errors.json` against this.
300
+ */
301
+ private checkStatsBucketFunctions;
266
302
  /**
267
303
  * Check if the token stream represents a stats query.
268
304
  * Handles: "| stats ...", "stats ...", or starts with a filter before "| stats".