@tellaro/tql 0.1.17 → 0.2.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.
- package/dist/index.d.ts +1 -0
- package/dist/src/completionProvider.d.ts +0 -1
- package/dist/src/completionProvider.js +195 -534
- package/dist/src/complexityAnalyzer.d.ts +0 -1
- package/dist/src/complexityAnalyzer.js +33 -36
- package/dist/src/parser.d.ts +0 -1
- package/dist/src/parser.js +78 -115
- package/dist/src/schemaCache.d.ts +0 -1
- package/dist/src/schemaCache.js +34 -42
- package/dist/src/semanticPreview.d.ts +0 -1
- package/dist/src/semanticPreview.js +36 -38
- package/dist/src/tokenizer.d.ts +0 -15
- package/dist/src/tokenizer.js +47 -156
- package/dist/src/types.d.ts +14 -0
- package/dist/src/validator.d.ts +0 -1
- package/dist/src/validator.js +31 -148
- package/dist/tql.css +1 -0
- package/dist/vue/TqlAutocomplete.vue2.js +56 -58
- package/dist/vue/TqlInput.vue.js +1 -1
- package/dist/vue/TqlInput.vue2.js +333 -359
- package/dist/vue/components/TqlPreview.vue2.js +58 -62
- package/dist/vue/composables/useQueryHistory.d.ts +0 -1
- package/dist/vue/composables/useQueryHistory.js +1 -4
- package/dist/vue/useTqlInput.js +107 -117
- package/package.json +11 -5
- package/dist/style.css +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { parseTql as
|
|
2
|
-
import { analyzeComplexity as
|
|
1
|
+
import { parseTql as g } from "./parser.js";
|
|
2
|
+
import { analyzeComplexity as m } from "./complexityAnalyzer.js";
|
|
3
3
|
class u {
|
|
4
4
|
/**
|
|
5
5
|
* Generate a complete preview for a TQL query
|
|
6
6
|
*/
|
|
7
7
|
generatePreview(t) {
|
|
8
|
-
const r =
|
|
8
|
+
const r = g(t), i = m(t), n = [], s = {};
|
|
9
9
|
if (!r.ast)
|
|
10
10
|
return {
|
|
11
11
|
fields: [],
|
|
@@ -16,7 +16,7 @@ class u {
|
|
|
16
16
|
operatorSummary: {}
|
|
17
17
|
};
|
|
18
18
|
this.extractFieldUsage(r.ast, n, s);
|
|
19
|
-
const a = this.buildLogicTree(r.ast), c = [...new Set(n.map((
|
|
19
|
+
const a = this.buildLogicTree(r.ast), c = [...new Set(n.map((o) => o.name))];
|
|
20
20
|
return {
|
|
21
21
|
fields: n,
|
|
22
22
|
logicTree: a,
|
|
@@ -173,70 +173,68 @@ class u {
|
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function T(e) {
|
|
177
177
|
return new u().generatePreview(e);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function v(e) {
|
|
180
180
|
return new u().generatePreview(e).fields;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function $(e) {
|
|
183
183
|
return new u().generatePreview(e).logicTree;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function b(e) {
|
|
186
186
|
return new u().generatePreview(e).uniqueFields;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function F(e) {
|
|
189
189
|
return new u().generatePreview(e).operatorSummary;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
var t, r, i;
|
|
191
|
+
function h(e) {
|
|
193
192
|
if (e.type === "comparison") {
|
|
194
|
-
const
|
|
195
|
-
return `${e.field}${
|
|
193
|
+
const t = e.mutators?.length ? ` | ${e.mutators.join(" | ")}` : "", r = f(e.value);
|
|
194
|
+
return `${e.field}${t} ${e.operator} ${r}`;
|
|
196
195
|
}
|
|
197
|
-
return e.type === "NOT" &&
|
|
196
|
+
return e.type === "NOT" && e.children?.length === 1 ? `NOT (${h(e.children[0])})` : e.type === "group" && e.children?.length === 1 ? `(${h(e.children[0])})` : (e.type === "AND" || e.type === "OR") && e.children ? e.children.map(h).join(` ${e.type} `) : "";
|
|
198
197
|
}
|
|
199
|
-
function
|
|
200
|
-
return e === null ? "null" : e === void 0 ? "" : typeof e == "string" ? `"${e}"` : Array.isArray(e) ? `[${e.map(
|
|
198
|
+
function f(e) {
|
|
199
|
+
return e === null ? "null" : e === void 0 ? "" : typeof e == "string" ? `"${e}"` : Array.isArray(e) ? `[${e.map(f).join(", ")}]` : String(e);
|
|
201
200
|
}
|
|
202
|
-
function
|
|
201
|
+
function N(e, t = "") {
|
|
203
202
|
if (!e)
|
|
204
203
|
return "(empty)";
|
|
205
204
|
const r = [];
|
|
206
|
-
return
|
|
205
|
+
return l(e, r, "", !0), r.join(`
|
|
207
206
|
`);
|
|
208
207
|
}
|
|
209
|
-
function
|
|
210
|
-
var a, c, l;
|
|
208
|
+
function l(e, t, r, i) {
|
|
211
209
|
const n = i ? "└── " : "├── ", s = i ? " " : "│ ";
|
|
212
210
|
if (e.type === "comparison") {
|
|
213
|
-
const
|
|
214
|
-
t.push(`${r}${n}${e.field}${
|
|
215
|
-
} else e.type === "NOT" ? (t.push(`${r}${n}NOT`),
|
|
216
|
-
const
|
|
217
|
-
|
|
211
|
+
const a = e.mutators?.length ? ` | ${e.mutators.join(" | ")}` : "", c = f(e.value);
|
|
212
|
+
t.push(`${r}${n}${e.field}${a} ${e.operator} ${c}`);
|
|
213
|
+
} else e.type === "NOT" ? (t.push(`${r}${n}NOT`), e.children?.length && l(e.children[0], t, r + s, !0)) : e.type === "group" ? (t.push(`${r}${n}GROUP`), e.children?.length && l(e.children[0], t, r + s, !0)) : e.children && (t.push(`${r}${n}${e.type}`), e.children.forEach((a, c) => {
|
|
214
|
+
const o = c === e.children.length - 1;
|
|
215
|
+
l(a, t, r + s, o);
|
|
218
216
|
}));
|
|
219
217
|
}
|
|
220
|
-
function
|
|
221
|
-
return e ? e.type === "comparison" ? [e] : e.children ? e.children.flatMap(
|
|
218
|
+
function d(e) {
|
|
219
|
+
return e ? e.type === "comparison" ? [e] : e.children ? e.children.flatMap(d) : [] : [];
|
|
222
220
|
}
|
|
223
|
-
function
|
|
221
|
+
function y(e) {
|
|
224
222
|
if (!e)
|
|
225
223
|
return 0;
|
|
226
224
|
if (!e.children || e.children.length === 0)
|
|
227
225
|
return 1;
|
|
228
|
-
const t = e.children.map(
|
|
226
|
+
const t = e.children.map(y);
|
|
229
227
|
return 1 + Math.max(...t);
|
|
230
228
|
}
|
|
231
229
|
export {
|
|
232
230
|
u as SemanticPreview,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
231
|
+
d as flattenLogicTree,
|
|
232
|
+
N as formatLogicTreeAscii,
|
|
233
|
+
h as formatLogicTreeNode,
|
|
234
|
+
T as generatePreview,
|
|
235
|
+
v as getFieldUsage,
|
|
236
|
+
$ as getLogicTree,
|
|
237
|
+
y as getLogicTreeDepth,
|
|
238
|
+
F as getOperatorSummary,
|
|
239
|
+
b as getUniqueFields
|
|
242
240
|
};
|
package/dist/src/tokenizer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TqlAggregationFunction, TqlCollectionOperator, TqlComparisonOperator, TqlLogicalOperator, TqlMutator, TqlToken, TqlTypeHint, TqlVisualizationType } from './types';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* All comparison operators supported by TQL.
|
|
5
4
|
* Includes negated variants using both `not_` prefix and `!` prefix.
|
|
@@ -20,20 +19,6 @@ export declare const COLLECTION_OPERATORS: TqlCollectionOperator[];
|
|
|
20
19
|
* Synchronized with Python/Rust implementations.
|
|
21
20
|
*/
|
|
22
21
|
export declare const MUTATORS: TqlMutator[];
|
|
23
|
-
/**
|
|
24
|
-
* Enrichment mutators that don't require an operator after them.
|
|
25
|
-
* These mutators transform the field into an enriched object/value that stands alone.
|
|
26
|
-
*/
|
|
27
|
-
export declare const ENRICHMENT_MUTATORS: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Parameters available for mutators that support function call syntax.
|
|
30
|
-
*/
|
|
31
|
-
export interface MutatorParameter {
|
|
32
|
-
name: string;
|
|
33
|
-
type: 'boolean' | 'string' | 'number';
|
|
34
|
-
description: string;
|
|
35
|
-
}
|
|
36
|
-
export declare const MUTATOR_PARAMETERS: Record<string, MutatorParameter[]>;
|
|
37
22
|
/**
|
|
38
23
|
* All aggregation functions supported by TQL.
|
|
39
24
|
* Synchronized with Python/Rust implementations.
|
package/dist/src/tokenizer.js
CHANGED
|
@@ -1,109 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var u = (o, e, n) => e in o ? l(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
|
-
var a = (o, e, n) => u(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
// Enrichment mutators that don't require an operator after them
|
|
5
|
-
// These mutators transform the field into an enriched object/value that stands alone
|
|
6
|
-
const ENRICHMENT_MUTATORS = [
|
|
7
|
-
"geo",
|
|
8
|
-
"geoip",
|
|
9
|
-
"geoip_lookup",
|
|
10
|
-
"nslookup"
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
// Parameters available for mutators that support function call syntax
|
|
14
|
-
// e.g., geo(force=true, save=true)
|
|
15
|
-
// Synced with Python TQL ALLOWED_MUTATORS definition
|
|
16
|
-
const MUTATOR_PARAMETERS = {
|
|
17
|
-
// String transformation mutators
|
|
18
|
-
lowercase: [
|
|
19
|
-
{ name: "field", type: "string", description: "Field name to save the lowercase result. Default: transforms value in-place for comparison only (not persisted)" }
|
|
20
|
-
],
|
|
21
|
-
uppercase: [
|
|
22
|
-
{ name: "field", type: "string", description: "Field name to save the uppercase result. Default: transforms value in-place for comparison only (not persisted)" }
|
|
23
|
-
],
|
|
24
|
-
trim: [
|
|
25
|
-
{ name: "field", type: "string", description: "Field name to save the trimmed result. Default: transforms value in-place for comparison only (not persisted)" }
|
|
26
|
-
],
|
|
27
|
-
split: [
|
|
28
|
-
{ name: "delimiter", type: "string", description: "Character(s) to split on. Default: comma (',')" },
|
|
29
|
-
{ name: "field", type: "string", description: "Field name to save array result. Default: returns array for comparison only (not persisted)" }
|
|
30
|
-
],
|
|
31
|
-
length: [
|
|
32
|
-
{ name: "field", type: "string", description: "Field name to save the length. Default: returns length for comparison only (not persisted)" }
|
|
33
|
-
],
|
|
34
|
-
replace: [
|
|
35
|
-
{ name: "find", type: "string", description: "Text to search for (required)" },
|
|
36
|
-
{ name: "replace", type: "string", description: "Text to replace with (required)" },
|
|
37
|
-
{ name: "field", type: "string", description: "Field name to save result. Default: returns replaced string for comparison only (not persisted)" }
|
|
38
|
-
],
|
|
39
|
-
// Security mutators
|
|
40
|
-
refang: [
|
|
41
|
-
{ name: "field", type: "string", description: "Field name to save the refanged result. Default: returns refanged value for comparison only" }
|
|
42
|
-
],
|
|
43
|
-
defang: [
|
|
44
|
-
{ name: "field", type: "string", description: "Field name to save the defanged result. Default: returns defanged value for comparison only" }
|
|
45
|
-
],
|
|
46
|
-
// Encoding mutators
|
|
47
|
-
b64encode: [
|
|
48
|
-
{ name: "field", type: "string", description: "Field name to save encoded result. Default: returns encoded value for comparison only" }
|
|
49
|
-
],
|
|
50
|
-
b64decode: [
|
|
51
|
-
{ name: "field", type: "string", description: "Field name to save decoded result. Default: returns decoded value for comparison only" }
|
|
52
|
-
],
|
|
53
|
-
urldecode: [
|
|
54
|
-
{ name: "field", type: "string", description: "Field name to save decoded result. Default: returns decoded value for comparison only" }
|
|
55
|
-
],
|
|
56
|
-
hexencode: [
|
|
57
|
-
{ name: "field", type: "string", description: "Field name to save hex-encoded result. Default: returns encoded value for comparison only" }
|
|
58
|
-
],
|
|
59
|
-
hexdecode: [
|
|
60
|
-
{ name: "field", type: "string", description: "Field name to save hex-decoded result. Default: returns decoded value for comparison only" }
|
|
61
|
-
],
|
|
62
|
-
md5: [
|
|
63
|
-
{ name: "field", type: "string", description: "Field name to save the MD5 hash. Default: returns hash for comparison only" }
|
|
64
|
-
],
|
|
65
|
-
sha256: [
|
|
66
|
-
{ name: "field", type: "string", description: "Field name to save the SHA256 hash. Default: returns hash for comparison only" }
|
|
67
|
-
],
|
|
68
|
-
// Network mutators - no parameters, return boolean
|
|
69
|
-
is_private: [], // Returns boolean indicating if IP is in RFC1918 private ranges
|
|
70
|
-
is_global: [], // Returns boolean indicating if IP is globally routable
|
|
71
|
-
// DNS mutator
|
|
72
|
-
nslookup: [
|
|
73
|
-
{ name: "servers", type: "array", description: "DNS servers to query. Default: system DNS servers" },
|
|
74
|
-
{ name: "types", type: "array", description: "DNS record types to query (A, AAAA, MX, TXT, etc.). Default: ['A']" },
|
|
75
|
-
{ name: "append_field", type: "string", description: "Field name to append results to" },
|
|
76
|
-
{ name: "force", type: "boolean", description: "Force lookup even if DNS data already exists. Default: false" },
|
|
77
|
-
{ name: "save", type: "boolean", description: "Save results to the record. Default: true" },
|
|
78
|
-
{ name: "field", type: "string", description: "Field name to save results to. Default: appends .dns to source field" }
|
|
79
|
-
],
|
|
80
|
-
// GeoIP mutators
|
|
81
|
-
geo: [
|
|
82
|
-
{ name: "db_path", type: "string", description: "Path to MaxMind GeoIP database. Default: uses system-configured path" },
|
|
83
|
-
{ name: "force", type: "boolean", description: "Force lookup even if geo data exists. Default: false (skips if data exists)" },
|
|
84
|
-
{ name: "save", type: "boolean", description: "Save enrichment to the record. Default: true" },
|
|
85
|
-
{ name: "field", type: "string", description: "Field name prefix for geo data. Default: appends .geo to source field" },
|
|
86
|
-
{ name: "cache", type: "boolean", description: "Enable caching of lookup results. Default: true" },
|
|
87
|
-
{ name: "cache_ttl", type: "number", description: "Cache TTL in seconds. Default: 3600 (1 hour)" }
|
|
88
|
-
],
|
|
89
|
-
geoip: [
|
|
90
|
-
{ name: "db_path", type: "string", description: "Path to MaxMind GeoIP database. Default: uses system-configured path" },
|
|
91
|
-
{ name: "force", type: "boolean", description: "Force lookup even if geo data exists. Default: false (skips if data exists)" },
|
|
92
|
-
{ name: "save", type: "boolean", description: "Save enrichment to the record. Default: true" },
|
|
93
|
-
{ name: "field", type: "string", description: "Field name prefix for geo data. Default: appends .geo to source field" },
|
|
94
|
-
{ name: "cache", type: "boolean", description: "Enable caching of lookup results. Default: true" },
|
|
95
|
-
{ name: "cache_ttl", type: "number", description: "Cache TTL in seconds. Default: 3600 (1 hour)" }
|
|
96
|
-
],
|
|
97
|
-
geoip_lookup: [
|
|
98
|
-
{ name: "db_path", type: "string", description: "Path to MaxMind GeoIP database. Default: uses system-configured path" },
|
|
99
|
-
{ name: "force", type: "boolean", description: "Force lookup even if geo data exists. Default: false (skips if data exists)" },
|
|
100
|
-
{ name: "save", type: "boolean", description: "Save enrichment to the record. Default: true" },
|
|
101
|
-
{ name: "field", type: "string", description: "Field name prefix for geo data. Default: appends .geo to source field" },
|
|
102
|
-
{ name: "cache", type: "boolean", description: "Enable caching of lookup results. Default: true" },
|
|
103
|
-
{ name: "cache_ttl", type: "number", description: "Cache TTL in seconds. Default: 3600 (1 hour)" }
|
|
104
|
-
]
|
|
105
|
-
};
|
|
106
|
-
const p = [
|
|
1
|
+
const c = [
|
|
107
2
|
// Equality
|
|
108
3
|
"eq",
|
|
109
4
|
"ne",
|
|
@@ -144,7 +39,7 @@ const p = [
|
|
|
144
39
|
"not_any",
|
|
145
40
|
"not_all",
|
|
146
41
|
"not_none"
|
|
147
|
-
],
|
|
42
|
+
], h = {
|
|
148
43
|
"==": "eq",
|
|
149
44
|
"=": "eq",
|
|
150
45
|
"!=": "ne",
|
|
@@ -152,7 +47,7 @@ const p = [
|
|
|
152
47
|
">=": "gte",
|
|
153
48
|
"<": "lt",
|
|
154
49
|
"<=": "lte"
|
|
155
|
-
},
|
|
50
|
+
}, l = {
|
|
156
51
|
"!in": "not_in",
|
|
157
52
|
"!contains": "not_contains",
|
|
158
53
|
"!startswith": "not_startswith",
|
|
@@ -166,7 +61,7 @@ const p = [
|
|
|
166
61
|
"!any": "not_any",
|
|
167
62
|
"!all": "not_all",
|
|
168
63
|
"!none": "not_none"
|
|
169
|
-
},
|
|
64
|
+
}, u = ["AND", "OR", "NOT"], p = ["ANY", "ALL", "NONE"], d = [
|
|
170
65
|
// String mutators
|
|
171
66
|
"lowercase",
|
|
172
67
|
"uppercase",
|
|
@@ -201,7 +96,7 @@ const p = [
|
|
|
201
96
|
"sum",
|
|
202
97
|
"min",
|
|
203
98
|
"max"
|
|
204
|
-
],
|
|
99
|
+
], k = [
|
|
205
100
|
// Counting
|
|
206
101
|
"count",
|
|
207
102
|
"unique_count",
|
|
@@ -230,7 +125,7 @@ const p = [
|
|
|
230
125
|
"values",
|
|
231
126
|
"unique",
|
|
232
127
|
"distinct"
|
|
233
|
-
],
|
|
128
|
+
], f = [
|
|
234
129
|
"string",
|
|
235
130
|
"str",
|
|
236
131
|
"number",
|
|
@@ -245,10 +140,8 @@ const p = [
|
|
|
245
140
|
"array",
|
|
246
141
|
"list",
|
|
247
142
|
"object",
|
|
248
|
-
"geo"
|
|
249
|
-
|
|
250
|
-
"ip"
|
|
251
|
-
], T = [
|
|
143
|
+
"geo"
|
|
144
|
+
], m = [
|
|
252
145
|
"bar",
|
|
253
146
|
"barchart",
|
|
254
147
|
"line",
|
|
@@ -268,14 +161,14 @@ const p = [
|
|
|
268
161
|
"nested_pie",
|
|
269
162
|
"nested_donut",
|
|
270
163
|
"chord"
|
|
271
|
-
],
|
|
272
|
-
class
|
|
164
|
+
], _ = ["by", "as", "null", "true", "false", "stats", "top", "bottom"];
|
|
165
|
+
class g {
|
|
166
|
+
input;
|
|
167
|
+
position;
|
|
168
|
+
line;
|
|
169
|
+
column;
|
|
170
|
+
tokens;
|
|
273
171
|
constructor(e) {
|
|
274
|
-
a(this, "input");
|
|
275
|
-
a(this, "position");
|
|
276
|
-
a(this, "line");
|
|
277
|
-
a(this, "column");
|
|
278
|
-
a(this, "tokens");
|
|
279
172
|
this.input = e, this.position = 0, this.line = 1, this.column = 1, this.tokens = [];
|
|
280
173
|
}
|
|
281
174
|
/**
|
|
@@ -330,8 +223,8 @@ class b {
|
|
|
330
223
|
for (; !this.isAtEnd() && this.peek() !== e; )
|
|
331
224
|
if (this.peek() === "\\") {
|
|
332
225
|
if (this.advance(), !this.isAtEnd()) {
|
|
333
|
-
const
|
|
334
|
-
switch (
|
|
226
|
+
const a = this.advance();
|
|
227
|
+
switch (a) {
|
|
335
228
|
case "n":
|
|
336
229
|
s += `
|
|
337
230
|
`;
|
|
@@ -352,7 +245,7 @@ class b {
|
|
|
352
245
|
s += "'";
|
|
353
246
|
break;
|
|
354
247
|
default:
|
|
355
|
-
s +=
|
|
248
|
+
s += a;
|
|
356
249
|
}
|
|
357
250
|
}
|
|
358
251
|
} else
|
|
@@ -401,7 +294,7 @@ class b {
|
|
|
401
294
|
const s = t + this.peek();
|
|
402
295
|
if (s === "=>")
|
|
403
296
|
return this.advance(), this.makeToken("arrow", "=>", e, n, i);
|
|
404
|
-
(s in
|
|
297
|
+
(s in h || s === "==" || s === "!=") && (t = s, this.advance());
|
|
405
298
|
}
|
|
406
299
|
if (t === "!") {
|
|
407
300
|
const s = this.position;
|
|
@@ -409,12 +302,12 @@ class b {
|
|
|
409
302
|
for (; !this.isAtEnd() && this.isIdentifierChar(this.peek()); )
|
|
410
303
|
r += this.advance();
|
|
411
304
|
if (r) {
|
|
412
|
-
if ("!" + r in
|
|
305
|
+
if ("!" + r in l)
|
|
413
306
|
return this.makeToken("operator", "!" + r, e, n, i);
|
|
414
307
|
this.position = s, this.column = i + 1;
|
|
415
308
|
}
|
|
416
309
|
}
|
|
417
|
-
return t in
|
|
310
|
+
return t in h || t === "==" || t === "=" || t === "!=" || t === ">" || t === ">=" || t === "<" || t === "<=" ? this.makeToken("operator", t, e, n, i) : this.makeToken("unknown", t, e, n, i);
|
|
418
311
|
}
|
|
419
312
|
/**
|
|
420
313
|
* Scan an identifier (field name, operator keyword, etc.)
|
|
@@ -432,7 +325,7 @@ class b {
|
|
|
432
325
|
*/
|
|
433
326
|
classifyIdentifier(e) {
|
|
434
327
|
const n = e.toUpperCase(), i = e.toLowerCase();
|
|
435
|
-
return
|
|
328
|
+
return u.includes(n) ? "logicalOp" : p.includes(n) ? "collectionOp" : i === "true" || i === "false" ? "boolean" : i === "null" ? "null" : i === "stats" ? "keyword" : c.includes(i) ? "operator" : k.includes(i) ? "aggregation" : d.includes(i) ? "mutator" : f.includes(i) ? "typeHint" : m.includes(i) ? "visualization" : _.includes(i) ? "keyword" : "field";
|
|
436
329
|
}
|
|
437
330
|
// ============================================================================
|
|
438
331
|
// Helper Methods
|
|
@@ -479,22 +372,22 @@ class b {
|
|
|
479
372
|
return e === "=" || e === "!" || e === ">" || e === "<";
|
|
480
373
|
}
|
|
481
374
|
}
|
|
482
|
-
function
|
|
483
|
-
return new
|
|
375
|
+
function T(o) {
|
|
376
|
+
return new g(o).tokenize();
|
|
484
377
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
378
|
+
function w(o) {
|
|
379
|
+
return T(o).filter((e) => e.type !== "whitespace");
|
|
487
380
|
}
|
|
488
|
-
function
|
|
381
|
+
function b(o, e) {
|
|
489
382
|
for (const n of o)
|
|
490
383
|
if (e >= n.start && e < n.end)
|
|
491
384
|
return n;
|
|
492
385
|
return null;
|
|
493
386
|
}
|
|
494
|
-
function
|
|
387
|
+
function v(o, e, n) {
|
|
495
388
|
return o.filter((i) => i.start < n && i.end > e);
|
|
496
389
|
}
|
|
497
|
-
function
|
|
390
|
+
function O(o, e) {
|
|
498
391
|
let n = null;
|
|
499
392
|
for (const i of o)
|
|
500
393
|
if (i.end <= e)
|
|
@@ -503,7 +396,7 @@ function I(o, e) {
|
|
|
503
396
|
break;
|
|
504
397
|
return n;
|
|
505
398
|
}
|
|
506
|
-
function
|
|
399
|
+
function A(o, e, n = !0) {
|
|
507
400
|
const i = n ? o.filter((s) => s.type !== "whitespace") : o;
|
|
508
401
|
let t = null;
|
|
509
402
|
for (const s of i)
|
|
@@ -514,23 +407,21 @@ function y(o, e, n = !0) {
|
|
|
514
407
|
return t;
|
|
515
408
|
}
|
|
516
409
|
export {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
v as tokenizeTql,
|
|
535
|
-
A as tokenizeTqlNoWhitespace
|
|
410
|
+
k as AGGREGATION_FUNCTIONS,
|
|
411
|
+
p as COLLECTION_OPERATORS,
|
|
412
|
+
c as COMPARISON_OPERATORS,
|
|
413
|
+
_ as KEYWORDS,
|
|
414
|
+
u as LOGICAL_OPERATORS,
|
|
415
|
+
d as MUTATORS,
|
|
416
|
+
l as NEGATION_SYMBOL_OPERATORS,
|
|
417
|
+
h as SYMBOL_OPERATORS,
|
|
418
|
+
f as TYPE_HINTS,
|
|
419
|
+
g as TqlTokenizer,
|
|
420
|
+
m as VISUALIZATION_TYPES,
|
|
421
|
+
A as findPreviousToken,
|
|
422
|
+
b as findTokenAtPosition,
|
|
423
|
+
O as findTokenBefore,
|
|
424
|
+
v as findTokensInRange,
|
|
425
|
+
T as tokenizeTql,
|
|
426
|
+
w as tokenizeTqlNoWhitespace
|
|
536
427
|
};
|
package/dist/src/types.d.ts
CHANGED
|
@@ -236,6 +236,14 @@ export interface TqlInputEmits {
|
|
|
236
236
|
(e: "parse", result: TqlParseResult): void;
|
|
237
237
|
(e: "submit", value: string): void;
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Reactive reference type for Vue computed properties.
|
|
241
|
+
* This is a simplified type that matches Vue's ComputedRef interface
|
|
242
|
+
* without requiring Vue as a direct dependency.
|
|
243
|
+
*/
|
|
244
|
+
export interface ReactiveRef<T> {
|
|
245
|
+
readonly value: T;
|
|
246
|
+
}
|
|
239
247
|
export interface TqlInputExpose {
|
|
240
248
|
focus(): void;
|
|
241
249
|
blur(): void;
|
|
@@ -245,6 +253,12 @@ export interface TqlInputExpose {
|
|
|
245
253
|
getTokenAtPosition(pos: number): TqlToken | null;
|
|
246
254
|
getCursorPosition(): number;
|
|
247
255
|
setCursorPosition(pos: number): void;
|
|
256
|
+
/** Whether the current query is valid (no syntax errors). Access via .value */
|
|
257
|
+
isValid: ReactiveRef<boolean>;
|
|
258
|
+
/** Whether the current query has validation errors. Access via .value */
|
|
259
|
+
hasErrors: ReactiveRef<boolean>;
|
|
260
|
+
/** Array of current validation errors. Access via .value */
|
|
261
|
+
errors: ReactiveRef<TqlParseError[]>;
|
|
248
262
|
}
|
|
249
263
|
export type ComplexityScore = "low" | "medium" | "high";
|
|
250
264
|
export interface ComplexityWarning {
|