@tellaro/tql 0.3.1 → 1.4.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.
Files changed (35) hide show
  1. package/dist/index.js +44 -41
  2. package/dist/node_modules/@kurkle/color/dist/color.esm.js +442 -0
  3. package/dist/node_modules/chart.js/dist/chart.js +6149 -0
  4. package/dist/node_modules/chart.js/dist/chunks/helpers.dataset.js +1685 -0
  5. package/dist/node_modules/chartjs-adapter-luxon/dist/chartjs-adapter-luxon.esm.js +56 -0
  6. package/dist/node_modules/chartjs-plugin-annotation/dist/chartjs-plugin-annotation.esm.js +1655 -0
  7. package/dist/node_modules/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.esm.js +607 -0
  8. package/dist/node_modules/luxon/build/es6/luxon.js +5524 -0
  9. package/dist/src/builder.d.ts +62 -0
  10. package/dist/src/builder.js +56 -0
  11. package/dist/src/chart/colors.d.ts +23 -0
  12. package/dist/src/chart/colors.js +101 -0
  13. package/dist/src/chart/formatters.d.ts +17 -0
  14. package/dist/src/chart/formatters.js +49 -0
  15. package/dist/src/chart/index.d.ts +9 -0
  16. package/dist/src/chart/index.js +31 -0
  17. package/dist/src/chart/mappers.d.ts +849 -0
  18. package/dist/src/chart/mappers.js +613 -0
  19. package/dist/src/completionProvider.js +294 -165
  20. package/dist/src/index.d.ts +2 -1
  21. package/dist/src/parser.d.ts +10 -0
  22. package/dist/src/parser.js +41 -9
  23. package/dist/src/tokenizer.js +124 -103
  24. package/dist/src/types.d.ts +27 -3
  25. package/dist/src/validator.js +10 -9
  26. package/dist/tql.css +1 -1
  27. package/dist/vue/TqlAutocomplete.vue.js +2 -2
  28. package/dist/vue/TqlChart.vue.d.ts +2 -0
  29. package/dist/vue/TqlChart.vue.js +7 -0
  30. package/dist/vue/TqlChart.vue2.js +212 -0
  31. package/dist/vue/TqlInput.vue.js +2 -2
  32. package/dist/vue/index.d.ts +1 -0
  33. package/dist/vue/index.js +12 -10
  34. package/dist/vue/useTqlInput.js +80 -80
  35. package/package.json +126 -90
@@ -1,158 +1,158 @@
1
1
  import { useDebounceFn as E } from "@vueuse/core";
2
- import { ref as i, computed as m, watch as se } from "vue";
3
- import { getCompletions as le, shouldTriggerCompletion as re } from "../src/completionProvider.js";
4
- import { parseTql as ue } from "../src/parser.js";
5
- import { findTokenAtPosition as W, tokenizeTql as ae } from "../src/tokenizer.js";
6
- import { validateTql as ie } from "../src/validator.js";
7
- function ge(z) {
2
+ import { computed as d, ref as i, watch as le } from "vue";
3
+ import { getCompletions as re, shouldTriggerCompletion as ue } from "../src/completionProvider.js";
4
+ import { parseTql as ae } from "../src/parser.js";
5
+ import { findTokenAtPosition as W, tokenizeTql as ie } from "../src/tokenizer.js";
6
+ import { validateTql as ce } from "../src/validator.js";
7
+ function Te(z) {
8
8
  const {
9
- modelValue: u,
10
- fieldSchema: I,
9
+ modelValue: D,
10
+ fieldSchema: y,
11
11
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
- snippets: ce,
12
+ snippets: pe,
13
13
  // Reserved for future snippet support
14
- fieldValues: D,
15
- validateOnInput: F = !0,
16
- debounceMs: O = 300,
14
+ fieldValues: F,
15
+ validateOnInput: O = !0,
16
+ debounceMs: Q = 300,
17
17
  completionDebounceMs: R = 50,
18
18
  // Faster debounce for completions
19
19
  autocomplete: C = !0,
20
20
  onValidation: j,
21
- onParse: Q
22
- } = z, c = i([]), k = i(null), p = i(null), a = i(0), f = i([]), d = i(!1), x = i(!1), U = m(() => p.value?.valid ?? !0), h = m(() => p.value?.errors ?? []), q = m(() => p.value?.warnings ?? []), _ = m(() => h.value.length > 0), $ = m(() => q.value.length > 0);
23
- function A() {
24
- return c.value = ae(u.value), c.value;
21
+ onParse: U
22
+ } = z, u = d(() => D.value ?? ""), c = i([]), k = i(null), f = i(null), a = i(0), v = i([]), p = i(!1), I = i(!1), _ = d(() => f.value?.valid ?? !0), h = d(() => f.value?.errors ?? []), q = d(() => f.value?.warnings ?? []), $ = d(() => h.value.length > 0), B = d(() => q.value.length > 0);
23
+ function w() {
24
+ return c.value = ie(u.value), c.value;
25
25
  }
26
- function B() {
27
- const e = ue(u.value);
28
- return k.value = e, Q?.(e), e;
26
+ function G() {
27
+ const e = ae(u.value);
28
+ return k.value = e, U?.(e), e;
29
29
  }
30
- function P() {
31
- x.value = !0;
32
- const e = I?.value?.map((t) => t.name), n = I?.value?.reduce(
30
+ function A() {
31
+ I.value = !0;
32
+ const e = y?.value?.map((t) => t.name), n = y?.value?.reduce(
33
33
  (t, l) => (t[l.name] = l.type, t),
34
34
  {}
35
- ), o = ie(u.value, {
35
+ ), s = ce(u.value, {
36
36
  availableFields: e,
37
37
  fieldTypes: n,
38
38
  strictMode: !1
39
39
  });
40
- return p.value = o, x.value = !1, j?.(o), o;
40
+ return f.value = s, I.value = !1, j?.(s), s;
41
41
  }
42
- const G = E(P, O), H = E(g, R);
42
+ const H = E(A, Q), J = E(g, R);
43
43
  function g() {
44
44
  if (!C) {
45
- f.value = [], d.value = !1;
45
+ v.value = [], p.value = !1;
46
46
  return;
47
47
  }
48
- const e = le(
48
+ const e = re(
49
49
  {
50
50
  query: u.value,
51
51
  cursorPosition: a.value
52
52
  },
53
53
  {
54
- fields: I?.value,
55
- fieldValues: D?.value,
54
+ fields: y?.value,
55
+ fieldValues: F?.value,
56
56
  includeSnippets: !0,
57
57
  maxItems: 15
58
58
  }
59
59
  );
60
- f.value = e, d.value = e.length > 0;
60
+ v.value = e, p.value = e.length > 0;
61
61
  }
62
- function J() {
63
- g(), d.value = f.value.length > 0;
62
+ function K() {
63
+ g(), p.value = v.value.length > 0;
64
64
  }
65
- function w() {
66
- d.value = !1;
65
+ function P() {
66
+ p.value = !1;
67
67
  }
68
68
  function V(e) {
69
- A(), F && G(), C && re(e, a.value) && (H(), f.value.length > 0 && (d.value = !0));
69
+ w(), O && H(), C && ue(e, a.value) && (J(), v.value.length > 0 && (p.value = !0));
70
70
  }
71
- function K(e) {
71
+ function L(e) {
72
72
  a.value = e, g();
73
73
  }
74
- function L(e) {
75
- const n = u.value, o = a.value, t = W(c.value, o);
76
- let l = o, T = o;
74
+ function N(e) {
75
+ const n = u.value, s = a.value, t = W(c.value, s);
76
+ let l = s, T = s;
77
77
  if (t && t.type !== "whitespace")
78
78
  l = t.start, T = t.end;
79
79
  else {
80
- const r = c.value.filter((s) => s.end <= o && s.type !== "whitespace");
80
+ const r = c.value.filter((o) => o.end <= s && o.type !== "whitespace");
81
81
  if (r.length > 0) {
82
- const s = r[r.length - 1];
83
- s.end === o && (l = s.start, T = s.end);
82
+ const o = r[r.length - 1];
83
+ o.end === s && (l = o.start, T = o.end);
84
84
  }
85
85
  }
86
- const y = n.substring(0, l), ee = n.substring(T), b = [];
87
- let v = e.insertText;
88
- const te = [...e.insertText.matchAll(/\$(\d+)/g)].sort(
89
- (r, s) => parseInt(r[1]) - parseInt(s[1])
86
+ const x = n.substring(0, l), te = n.substring(T), b = [];
87
+ let m = e.insertText;
88
+ const ne = [...e.insertText.matchAll(/\$(\d+)/g)].sort(
89
+ (r, o) => parseInt(r[1]) - parseInt(o[1])
90
90
  );
91
91
  let S = 0;
92
- for (const r of te) {
93
- const s = v.indexOf(r[0]);
94
- if (s !== -1) {
95
- const M = l + s - S;
92
+ for (const r of ne) {
93
+ const o = m.indexOf(r[0]);
94
+ if (o !== -1) {
95
+ const M = l + o - S;
96
96
  b.push({
97
97
  start: M,
98
98
  end: M
99
99
  // Zero-width cursor position
100
- }), v = v.replace(r[0], ""), S += r[0].length;
100
+ }), m = m.replace(r[0], ""), S += r[0].length;
101
101
  }
102
102
  }
103
- const ne = y + v + ee, oe = b.length > 0 ? b[0].start : l + v.length;
104
- return w(), { query: ne, newCursorPosition: oe, placeholders: b };
103
+ const se = x + m + te, oe = b.length > 0 ? b[0].start : l + m.length;
104
+ return P(), { query: se, newCursorPosition: oe, placeholders: b };
105
105
  }
106
- function N(e) {
107
- const n = u.value, o = a.value, t = n.substring(0, o), l = n.substring(o), y = t.length > 0 && !t.endsWith(" ") && !t.endsWith("(") ? " " : "";
108
- return t + y + e.insertText + l;
106
+ function X(e) {
107
+ const n = u.value, s = a.value, t = n.substring(0, s), l = n.substring(s), x = t.length > 0 && !t.endsWith(" ") && !t.endsWith("(") ? " " : "";
108
+ return t + x + e.insertText + l;
109
109
  }
110
- function X() {
110
+ function Y() {
111
111
  return W(c.value, a.value);
112
112
  }
113
- function Y(e) {
113
+ function Z(e) {
114
114
  return h.value.some((n) => e >= n.start && e < n.end);
115
115
  }
116
- function Z(e) {
116
+ function ee(e) {
117
117
  return h.value.filter((n) => e >= n.start && e < n.end);
118
118
  }
119
- return se(
119
+ return le(
120
120
  u,
121
121
  (e) => {
122
- e !== void 0 && V(e);
122
+ V(e);
123
123
  },
124
124
  { immediate: !0 }
125
125
  ), {
126
126
  // State
127
127
  tokens: c,
128
128
  parseResult: k,
129
- validationResult: p,
129
+ validationResult: f,
130
130
  cursorPosition: a,
131
- completionItems: f,
132
- showAutocomplete: d,
133
- isValidating: x,
131
+ completionItems: v,
132
+ showAutocomplete: p,
133
+ isValidating: I,
134
134
  // Computed
135
- isValid: U,
135
+ isValid: _,
136
136
  errors: h,
137
137
  warnings: q,
138
- hasErrors: _,
139
- hasWarnings: $,
138
+ hasErrors: $,
139
+ hasWarnings: B,
140
140
  // Methods
141
- tokenize: A,
142
- parse: B,
143
- validate: P,
141
+ tokenize: w,
142
+ parse: G,
143
+ validate: A,
144
144
  updateCompletions: g,
145
- triggerAutocomplete: J,
146
- hideAutocomplete: w,
145
+ triggerAutocomplete: K,
146
+ hideAutocomplete: P,
147
147
  handleInput: V,
148
- handleCursorChange: K,
149
- insertCompletion: L,
150
- insertSnippet: N,
151
- getTokenAtCursor: X,
152
- isPositionInError: Y,
153
- getErrorsAtPosition: Z
148
+ handleCursorChange: L,
149
+ insertCompletion: N,
150
+ insertSnippet: X,
151
+ getTokenAtCursor: Y,
152
+ isPositionInError: Z,
153
+ getErrorsAtPosition: ee
154
154
  };
155
155
  }
156
156
  export {
157
- ge as useTqlInput
157
+ Te as useTqlInput
158
158
  };
package/package.json CHANGED
@@ -1,90 +1,126 @@
1
- {
2
- "name": "@tellaro/tql",
3
- "version": "0.3.1",
4
- "description": "Tellaro Query Language (TQL) parser, validator, and autocomplete for JavaScript/TypeScript",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- },
14
- "./vue": {
15
- "import": "./dist/vue/index.js",
16
- "types": "./dist/vue/index.d.ts"
17
- },
18
- "./style.css": "./dist/tql.css",
19
- "./dist/style.css": "./dist/tql.css",
20
- "./dist/tql.css": "./dist/tql.css"
21
- },
22
- "files": [
23
- "dist",
24
- "README.md"
25
- ],
26
- "scripts": {
27
- "build": "vite build",
28
- "test": "vitest run",
29
- "test:watch": "vitest",
30
- "test:shared": "vitest run --grep 'shared-fixtures'",
31
- "test:e2e": "playwright test",
32
- "test:e2e:ui": "playwright test --ui",
33
- "playground:serve": "vite --config vite.playground.config.ts --port 5174",
34
- "playground:dev": "vite --config vite.playground.config.ts",
35
- "lint": "eslint src vue tests --ext .ts,.vue",
36
- "typecheck": "vue-tsc --noEmit",
37
- "prepublishOnly": "npm run build"
38
- },
39
- "repository": {
40
- "type": "git",
41
- "url": "git+https://github.com/h-a-security-solutions-llc/tellaro-query-language.git",
42
- "directory": "js"
43
- },
44
- "keywords": [
45
- "tql",
46
- "tellaro",
47
- "query",
48
- "language",
49
- "parser",
50
- "validator",
51
- "autocomplete",
52
- "vue"
53
- ],
54
- "author": "H&A Security Solutions LLC",
55
- "license": "MIT",
56
- "peerDependencies": {
57
- "@vueuse/core": "^10.0.0",
58
- "vue": "^3.4.0"
59
- },
60
- "peerDependenciesMeta": {
61
- "vue": {
62
- "optional": true
63
- },
64
- "@vueuse/core": {
65
- "optional": true
66
- }
67
- },
68
- "devDependencies": {
69
- "@playwright/test": "^1.40.0",
70
- "@types/js-yaml": "^4.0.9",
71
- "@types/node": "^20.11.0",
72
- "@vitejs/plugin-vue": "^6.0.4",
73
- "@vue/test-utils": "^2.4.0",
74
- "@vue/tsconfig": "^0.5.1",
75
- "@vueuse/core": "^10.0.0",
76
- "ajv": "^8.17.1",
77
- "eslint": "^8.56.0",
78
- "js-yaml": "^4.1.0",
79
- "jsdom": "^24.0.0",
80
- "typescript": "^5.3.0",
81
- "vite": "^7.3.1",
82
- "vite-plugin-dts": "^4.5.4",
83
- "vitest": "^4.0.18",
84
- "vue": "^3.4.0",
85
- "vue-tsc": "^3.2.4"
86
- },
87
- "engines": {
88
- "node": ">=18.0.0"
89
- }
90
- }
1
+ {
2
+ "name": "@tellaro/tql",
3
+ "version": "1.4.0",
4
+ "description": "Tellaro Query Language (TQL) parser, validator, and autocomplete for JavaScript/TypeScript",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./vue": {
15
+ "import": "./dist/vue/index.js",
16
+ "types": "./dist/vue/index.d.ts"
17
+ },
18
+ "./chart": {
19
+ "import": "./dist/src/chart/index.js",
20
+ "types": "./dist/src/chart/index.d.ts"
21
+ },
22
+ "./style.css": "./dist/tql.css",
23
+ "./dist/style.css": "./dist/tql.css",
24
+ "./dist/tql.css": "./dist/tql.css"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "scripts": {
31
+ "build": "vite build",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "test:shared": "vitest run --grep 'shared-fixtures'",
35
+ "test:e2e": "playwright test",
36
+ "test:e2e:ui": "playwright test --ui",
37
+ "playground:serve": "vite --config vite.playground.config.ts --port 5174",
38
+ "playground:dev": "vite --config vite.playground.config.ts",
39
+ "lint": "eslint src vue tests --ext .ts,.vue",
40
+ "typecheck": "vue-tsc --noEmit",
41
+ "prepublishOnly": "npm run build"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/h-a-security-solutions-llc/tellaro-query-language.git",
46
+ "directory": "js"
47
+ },
48
+ "keywords": [
49
+ "tql",
50
+ "tellaro",
51
+ "query",
52
+ "language",
53
+ "parser",
54
+ "validator",
55
+ "autocomplete",
56
+ "vue"
57
+ ],
58
+ "author": "H&A Security Solutions LLC",
59
+ "license": "MIT",
60
+ "peerDependencies": {
61
+ "@vueuse/core": "^10.0.0",
62
+ "chart.js": "^3.9.0 || ^4.0.0",
63
+ "chartjs-adapter-luxon": "^1.3.0",
64
+ "chartjs-plugin-annotation": "^3.0.0",
65
+ "chartjs-plugin-datalabels": "^2.0.0",
66
+ "luxon": "^3.0.0",
67
+ "vue": "^3.4.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "vue": {
71
+ "optional": true
72
+ },
73
+ "@vueuse/core": {
74
+ "optional": true
75
+ },
76
+ "chart.js": {
77
+ "optional": true
78
+ },
79
+ "chartjs-adapter-luxon": {
80
+ "optional": true
81
+ },
82
+ "chartjs-plugin-annotation": {
83
+ "optional": true
84
+ },
85
+ "chartjs-plugin-datalabels": {
86
+ "optional": true
87
+ },
88
+ "luxon": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "devDependencies": {
93
+ "@playwright/test": "^1.40.0",
94
+ "@types/js-yaml": "^4.0.9",
95
+ "@types/node": "^20.11.0",
96
+ "@vitejs/plugin-vue": "^6.0.4",
97
+ "@vue/test-utils": "^2.4.0",
98
+ "@vue/tsconfig": "^0.5.1",
99
+ "@vueuse/core": "^10.0.0",
100
+ "ajv": "^8.17.1",
101
+ "chart.js": "^4.5.1",
102
+ "chartjs-adapter-luxon": "^1.3.1",
103
+ "chartjs-plugin-annotation": "^3.1.0",
104
+ "chartjs-plugin-datalabels": "^2.2.0",
105
+ "eslint": "^8.56.0",
106
+ "js-yaml": "^4.1.0",
107
+ "jsdom": "^24.0.0",
108
+ "luxon": "^3.7.2",
109
+ "typescript": "^5.3.0",
110
+ "vite": "^7.3.2",
111
+ "vite-plugin-dts": "^4.5.4",
112
+ "vitest": "^4.0.18",
113
+ "vue": "^3.4.0",
114
+ "vue-tsc": "^3.2.4"
115
+ },
116
+ "engines": {
117
+ "node": ">=18.0.0"
118
+ },
119
+ "overrides": {
120
+ "@microsoft/api-extractor": {
121
+ "minimatch": ">=10.2.3"
122
+ },
123
+ "flatted": ">=3.4.0",
124
+ "lodash": ">=4.18.0"
125
+ }
126
+ }