@elastic/esql 0.0.1
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/LICENCE.txt +93 -0
- package/NOTICE.txt +5 -0
- package/README.md +167 -0
- package/lib/__tests__/fixtures.d.ts +4 -0
- package/lib/__tests__/fixtures.d.ts.map +1 -0
- package/lib/ast/builder/builder.d.ts +87 -0
- package/lib/ast/builder/builder.d.ts.map +1 -0
- package/lib/ast/builder/index.d.ts +3 -0
- package/lib/ast/builder/index.d.ts.map +1 -0
- package/lib/ast/builder/types.d.ts +18 -0
- package/lib/ast/builder/types.d.ts.map +1 -0
- package/lib/ast/grouping.d.ts +70 -0
- package/lib/ast/grouping.d.ts.map +1 -0
- package/lib/ast/index.d.ts +9 -0
- package/lib/ast/index.d.ts.map +1 -0
- package/lib/ast/is.d.ts +49 -0
- package/lib/ast/is.d.ts.map +1 -0
- package/lib/ast/location.d.ts +7 -0
- package/lib/ast/location.d.ts.map +1 -0
- package/lib/ast/mutate/commands/from/index.d.ts +4 -0
- package/lib/ast/mutate/commands/from/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/from/metadata.d.ts +63 -0
- package/lib/ast/mutate/commands/from/metadata.d.ts.map +1 -0
- package/lib/ast/mutate/commands/from/sources.d.ts +9 -0
- package/lib/ast/mutate/commands/from/sources.d.ts.map +1 -0
- package/lib/ast/mutate/commands/index.d.ts +9 -0
- package/lib/ast/mutate/commands/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/join/index.d.ts +17 -0
- package/lib/ast/mutate/commands/join/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/limit/index.d.ts +56 -0
- package/lib/ast/mutate/commands/limit/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/rerank/index.d.ts +41 -0
- package/lib/ast/mutate/commands/rerank/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/sort/index.d.ts +117 -0
- package/lib/ast/mutate/commands/sort/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/stats/index.d.ts +17 -0
- package/lib/ast/mutate/commands/stats/index.d.ts.map +1 -0
- package/lib/ast/mutate/commands/where/index.d.ts +48 -0
- package/lib/ast/mutate/commands/where/index.d.ts.map +1 -0
- package/lib/ast/mutate/generic/commands/args/index.d.ts +14 -0
- package/lib/ast/mutate/generic/commands/args/index.d.ts.map +1 -0
- package/lib/ast/mutate/generic/commands/index.d.ts +54 -0
- package/lib/ast/mutate/generic/commands/index.d.ts.map +1 -0
- package/lib/ast/mutate/generic/commands/options/index.d.ts +38 -0
- package/lib/ast/mutate/generic/commands/options/index.d.ts.map +1 -0
- package/lib/ast/mutate/generic/index.d.ts +2 -0
- package/lib/ast/mutate/generic/index.d.ts.map +1 -0
- package/lib/ast/mutate/index.d.ts +5 -0
- package/lib/ast/mutate/index.d.ts.map +1 -0
- package/lib/ast/mutate/types.d.ts +2 -0
- package/lib/ast/mutate/types.d.ts.map +1 -0
- package/lib/ast/mutate/util.d.ts +20 -0
- package/lib/ast/mutate/util.d.ts.map +1 -0
- package/lib/ast/visitor/contexts.d.ts +176 -0
- package/lib/ast/visitor/contexts.d.ts.map +1 -0
- package/lib/ast/visitor/global_visitor_context.d.ts +77 -0
- package/lib/ast/visitor/global_visitor_context.d.ts.map +1 -0
- package/lib/ast/visitor/index.d.ts +5 -0
- package/lib/ast/visitor/index.d.ts.map +1 -0
- package/lib/ast/visitor/types.d.ts +104 -0
- package/lib/ast/visitor/types.d.ts.map +1 -0
- package/lib/ast/visitor/utils.d.ts +26 -0
- package/lib/ast/visitor/utils.d.ts.map +1 -0
- package/lib/ast/visitor/visitor.d.ts +79 -0
- package/lib/ast/visitor/visitor.d.ts.map +1 -0
- package/lib/ast/walker/helpers.d.ts +23 -0
- package/lib/ast/walker/helpers.d.ts.map +1 -0
- package/lib/ast/walker/index.d.ts +2 -0
- package/lib/ast/walker/index.d.ts.map +1 -0
- package/lib/ast/walker/walker.d.ts +266 -0
- package/lib/ast/walker/walker.d.ts.map +1 -0
- package/lib/composer/composer_query.d.ts +684 -0
- package/lib/composer/composer_query.d.ts.map +1 -0
- package/lib/composer/esql.d.ts +25 -0
- package/lib/composer/esql.d.ts.map +1 -0
- package/lib/composer/index.d.ts +8 -0
- package/lib/composer/index.d.ts.map +1 -0
- package/lib/composer/parameter_hole.d.ts +11 -0
- package/lib/composer/parameter_hole.d.ts.map +1 -0
- package/lib/composer/query/index.d.ts +2 -0
- package/lib/composer/query/index.d.ts.map +1 -0
- package/lib/composer/query/query.d.ts +54 -0
- package/lib/composer/query/query.d.ts.map +1 -0
- package/lib/composer/synth/command.d.ts +7 -0
- package/lib/composer/synth/command.d.ts.map +1 -0
- package/lib/composer/synth/expression.d.ts +6 -0
- package/lib/composer/synth/expression.d.ts.map +1 -0
- package/lib/composer/synth/header.d.ts +7 -0
- package/lib/composer/synth/header.d.ts.map +1 -0
- package/lib/composer/synth/holes.d.ts +27 -0
- package/lib/composer/synth/holes.d.ts.map +1 -0
- package/lib/composer/synth/index.d.ts +7 -0
- package/lib/composer/synth/index.d.ts.map +1 -0
- package/lib/composer/synth/nodes.d.ts +104 -0
- package/lib/composer/synth/nodes.d.ts.map +1 -0
- package/lib/composer/synth/query.d.ts +7 -0
- package/lib/composer/synth/query.d.ts.map +1 -0
- package/lib/composer/synth/synth_literal_fragment.d.ts +19 -0
- package/lib/composer/synth/synth_literal_fragment.d.ts.map +1 -0
- package/lib/composer/synth/synth_node.d.ts +19 -0
- package/lib/composer/synth/synth_node.d.ts.map +1 -0
- package/lib/composer/synth/tag.d.ts +4 -0
- package/lib/composer/synth/tag.d.ts.map +1 -0
- package/lib/composer/synth/types.d.ts +65 -0
- package/lib/composer/synth/types.d.ts.map +1 -0
- package/lib/composer/types.d.ts +218 -0
- package/lib/composer/types.d.ts.map +1 -0
- package/lib/composer/util.d.ts +24 -0
- package/lib/composer/util.d.ts.map +1 -0
- package/lib/debug/index.d.ts +2 -0
- package/lib/debug/index.d.ts.map +1 -0
- package/lib/debug/print_ast.d.ts +60 -0
- package/lib/debug/print_ast.d.ts.map +1 -0
- package/lib/embedded_languages/index.d.ts +2 -0
- package/lib/embedded_languages/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/builder/builder.d.ts +52 -0
- package/lib/embedded_languages/promql/ast/builder/builder.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/builder/index.d.ts +3 -0
- package/lib/embedded_languages/promql/ast/builder/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/builder/types.d.ts +12 -0
- package/lib/embedded_languages/promql/ast/builder/types.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/is.d.ts +3 -0
- package/lib/embedded_languages/promql/ast/is.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/traversal.d.ts +3 -0
- package/lib/embedded_languages/promql/ast/traversal.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/walker/index.d.ts +3 -0
- package/lib/embedded_languages/promql/ast/walker/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/walker/types.d.ts +93 -0
- package/lib/embedded_languages/promql/ast/walker/types.d.ts.map +1 -0
- package/lib/embedded_languages/promql/ast/walker/walker.d.ts +43 -0
- package/lib/embedded_languages/promql/ast/walker/walker.d.ts.map +1 -0
- package/lib/embedded_languages/promql/index.d.ts +8 -0
- package/lib/embedded_languages/promql/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/parser/cst_to_ast_converter.d.ts +48 -0
- package/lib/embedded_languages/promql/parser/cst_to_ast_converter.d.ts.map +1 -0
- package/lib/embedded_languages/promql/parser/index.d.ts +4 -0
- package/lib/embedded_languages/promql/parser/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/parser/parser.d.ts +65 -0
- package/lib/embedded_languages/promql/parser/parser.d.ts.map +1 -0
- package/lib/embedded_languages/promql/parser/promql_error_listener.d.ts +11 -0
- package/lib/embedded_languages/promql/parser/promql_error_listener.d.ts.map +1 -0
- package/lib/embedded_languages/promql/pretty_print/basic_pretty_printer.d.ts +65 -0
- package/lib/embedded_languages/promql/pretty_print/basic_pretty_printer.d.ts.map +1 -0
- package/lib/embedded_languages/promql/pretty_print/helpers.d.ts +34 -0
- package/lib/embedded_languages/promql/pretty_print/helpers.d.ts.map +1 -0
- package/lib/embedded_languages/promql/pretty_print/index.d.ts +2 -0
- package/lib/embedded_languages/promql/pretty_print/index.d.ts.map +1 -0
- package/lib/embedded_languages/promql/types.d.ts +355 -0
- package/lib/embedded_languages/promql/types.d.ts.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +63055 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +62941 -0
- package/lib/index.mjs.map +1 -0
- package/lib/parser/antlr/esql_lexer.d.ts +223 -0
- package/lib/parser/antlr/esql_lexer.d.ts.map +1 -0
- package/lib/parser/antlr/esql_parser.d.ts +1847 -0
- package/lib/parser/antlr/esql_parser.d.ts.map +1 -0
- package/lib/parser/antlr/esql_parser_listener.d.ts +1634 -0
- package/lib/parser/antlr/esql_parser_listener.d.ts.map +1 -0
- package/lib/parser/antlr/lexer_config.d.ts +13 -0
- package/lib/parser/antlr/lexer_config.d.ts.map +1 -0
- package/lib/parser/antlr/parser_config.d.ts +7 -0
- package/lib/parser/antlr/parser_config.d.ts.map +1 -0
- package/lib/parser/antlr/promql_lexer.d.ts +71 -0
- package/lib/parser/antlr/promql_lexer.d.ts.map +1 -0
- package/lib/parser/antlr/promql_parser.d.ts +441 -0
- package/lib/parser/antlr/promql_parser.d.ts.map +1 -0
- package/lib/parser/antlr/promql_parser_listener.d.ts +354 -0
- package/lib/parser/antlr/promql_parser_listener.d.ts.map +1 -0
- package/lib/parser/core/constants.d.ts +8 -0
- package/lib/parser/core/constants.d.ts.map +1 -0
- package/lib/parser/core/cst_to_ast_converter.d.ts +262 -0
- package/lib/parser/core/cst_to_ast_converter.d.ts.map +1 -0
- package/lib/parser/core/decorations.d.ts +29 -0
- package/lib/parser/core/decorations.d.ts.map +1 -0
- package/lib/parser/core/esql_error_listener.d.ts +8 -0
- package/lib/parser/core/esql_error_listener.d.ts.map +1 -0
- package/lib/parser/core/helpers.d.ts +9 -0
- package/lib/parser/core/helpers.d.ts.map +1 -0
- package/lib/parser/core/parser.d.ts +136 -0
- package/lib/parser/core/parser.d.ts.map +1 -0
- package/lib/parser/core/tokens.d.ts +45 -0
- package/lib/parser/core/tokens.d.ts.map +1 -0
- package/lib/parser/core/types.d.ts +69 -0
- package/lib/parser/core/types.d.ts.map +1 -0
- package/lib/parser/index.d.ts +4 -0
- package/lib/parser/index.d.ts.map +1 -0
- package/lib/pretty_print/__tests__/fixtures.d.ts +5 -0
- package/lib/pretty_print/__tests__/fixtures.d.ts.map +1 -0
- package/lib/pretty_print/basic_pretty_printer.d.ts +87 -0
- package/lib/pretty_print/basic_pretty_printer.d.ts.map +1 -0
- package/lib/pretty_print/constants.d.ts +47 -0
- package/lib/pretty_print/constants.d.ts.map +1 -0
- package/lib/pretty_print/helpers.d.ts +22 -0
- package/lib/pretty_print/helpers.d.ts.map +1 -0
- package/lib/pretty_print/index.d.ts +4 -0
- package/lib/pretty_print/index.d.ts.map +1 -0
- package/lib/pretty_print/leaf_printer.d.ts +19 -0
- package/lib/pretty_print/leaf_printer.d.ts.map +1 -0
- package/lib/pretty_print/utils.d.ts +7 -0
- package/lib/pretty_print/utils.d.ts.map +1 -0
- package/lib/pretty_print/wrapping_pretty_printer.d.ts +113 -0
- package/lib/pretty_print/wrapping_pretty_printer.d.ts.map +1 -0
- package/lib/types.d.ts +523 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +19 -0
- package/lib/types.js.map +1 -0
- package/lib/types.mjs +1 -0
- package/lib/types.mjs.map +1 -0
- package/package.json +98 -0
package/LICENCE.txt
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/NOTICE.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
esql-js (A set of ts tools to parse, build and transform ES|QL queries programatically).
|
|
2
|
+
Copyright 2026 Elasticsearch B.V.
|
|
3
|
+
|
|
4
|
+
The ANTLR files for the ES|QL language comes from the Elasticsearch repository:
|
|
5
|
+
https://github.com/elastic/elasticsearch/tree/main/x-pack/plugin/esql/src/main/antlr.
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<h1 align="center"> 🚧 Under construction 🚧 </h1>
|
|
2
|
+
|
|
3
|
+
<h1 align="center">
|
|
4
|
+
Elastic ES|QL JS
|
|
5
|
+
</h1>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://buildkite.com/elastic/esql-js-release">
|
|
8
|
+
<img alt="Build Status - main branch" src="https://badge.buildkite.com/79986f76697e661970a3d81057a88b828871b670acfd8d3dec.svg?branch=main">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/@elastic/esql"><img alt="NPM version" src="https://img.shields.io/npm/v/@elastic/esql.svg"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
The purpose of this package is to provide comprehensive ES|QL functionality including low-level parsing,
|
|
14
|
+
building, traversal, pretty-printing and manipulation features on top of a custom compact AST representation.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<th>npm</th>
|
|
21
|
+
<th>yarn</th>
|
|
22
|
+
<th>pnpm</th>
|
|
23
|
+
</tr>
|
|
24
|
+
<tr>
|
|
25
|
+
<td>
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @elastic/esql
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
</td>
|
|
32
|
+
<td>
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
yarn add @elastic/esql
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
</td>
|
|
39
|
+
<td>
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pnpm add @elastic/esql
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
</table>
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- **Node.js** >= 18.0.0
|
|
52
|
+
|
|
53
|
+
## Contents of the package
|
|
54
|
+
|
|
55
|
+
### Creating an ES|QL AST
|
|
56
|
+
This package offers 3 tools that allow creating an AST for a query.
|
|
57
|
+
|
|
58
|
+
The [`parser`](./src/parser/README.md) allows to convert a query in text form into an AST.
|
|
59
|
+
```js
|
|
60
|
+
import { Parser } from '@elastic/esql';
|
|
61
|
+
|
|
62
|
+
const src = 'FROM index | WHERE col0 > 100';
|
|
63
|
+
const { root, errors } = await Parser.parse(src);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The [`composer`](./src/composer/README.md) provides a high-level, secure, and developer-friendly way to build ES|QL queries, allowing to get both an AST or string representation of them.
|
|
67
|
+
```ts
|
|
68
|
+
import { esql } from '@elastic/esql';
|
|
69
|
+
|
|
70
|
+
const param = 123; // Dynamic parameter, e.g. received from the UI.
|
|
71
|
+
|
|
72
|
+
const query = esql`
|
|
73
|
+
FROM index
|
|
74
|
+
| WHERE @timestamp >= ${{ param }}
|
|
75
|
+
| SORT @timestamp DESC
|
|
76
|
+
| KEEP service.name, log.level`;
|
|
77
|
+
|
|
78
|
+
query.pipe`LIMIT 10`;
|
|
79
|
+
```
|
|
80
|
+
Check also the [`synth`](src/composer/synth/README.md) API for building independent nodes.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
The [`builder`](./src/ast/builder/README.md) is a low level API that allows to create AST nodes.
|
|
84
|
+
```ts
|
|
85
|
+
import { Builder } from '@elastic/esql';
|
|
86
|
+
|
|
87
|
+
const limitCommandASTNode = Builder.command({
|
|
88
|
+
name: 'limit',
|
|
89
|
+
args: [Builder.expression.literal.integer(10)],
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Traversing an ES|QL AST
|
|
94
|
+
This package exposes 2 ways of traversing an ES|QL AST.
|
|
95
|
+
|
|
96
|
+
The [`walker`](./src/ast/walker/README.md) class is simpler to use, the developer can provide a set of callbacks which are called when the walker visits a specific type of node.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { Walker } from '@elastic/esql';
|
|
100
|
+
|
|
101
|
+
const walker = new Walker({
|
|
102
|
+
visitCommand: (node: ESQLCommand) => {
|
|
103
|
+
// Called for every command node.
|
|
104
|
+
},
|
|
105
|
+
visitFunction: (fn: ESQLFunction) => {
|
|
106
|
+
// Called every time a function expression is visited.
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
walker.walk(ast);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The [`visitor`](./src/ast/visitor/README.md) API provides a feature-rich way to traverse the ES|QL AST. It is more powerful than the Walker API, as it allows to traverse the AST in a more flexible way.
|
|
114
|
+
Said that, it's also more complicated to use as it does not automatically traverse the entire tree, read its dedicated documentation to get insights on it.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { Visitor } from '@elastic/esql';
|
|
118
|
+
|
|
119
|
+
new Visitor()
|
|
120
|
+
.on('visitExpression', (ctx) => console.log(ctx.node.type))
|
|
121
|
+
.on('visitCommand', (ctx) => [...ctx.visitArguments()])
|
|
122
|
+
.on('visitQuery', (ctx) => [...ctx.visitCommands()])
|
|
123
|
+
.visitQuery(root);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Modifying an ES|QL AST
|
|
127
|
+
The [`mutate`](./src/ast/mutate/README.md) API provides methods to navigate and modify the AST.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { Parser, mutate, BasicPrettyPrinter } from '@elastic/esql';
|
|
131
|
+
|
|
132
|
+
const { root } = Parser.parse('FROM index METADATA _lang');
|
|
133
|
+
|
|
134
|
+
// [ '_lang' ]
|
|
135
|
+
console.log([...mutate.commands.from.metadata.list(root)]);
|
|
136
|
+
|
|
137
|
+
mutate.commands.from.metadata.upsert(root, '_id');
|
|
138
|
+
|
|
139
|
+
// [ '_lang', '_id' ]
|
|
140
|
+
console.log([...mutate.commands.from.metadata.list(root)]);
|
|
141
|
+
|
|
142
|
+
const src = BasicPrettyPrinter.print(root);
|
|
143
|
+
|
|
144
|
+
// FROM index METADATA _lang, _id
|
|
145
|
+
console.log(src);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Pretty printing
|
|
149
|
+
The [`pretty_print`](./src/pretty_print/README.md) API lets you format the AST to text.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import { parse, WrappingPrettyPrinter } from '@elastic/esql';
|
|
153
|
+
|
|
154
|
+
const src = 'FROM index | WHERE x > 100 | LIMIT 100';
|
|
155
|
+
const { root } = parse(src, { withFormatting: true });
|
|
156
|
+
const text = WrappingPrettyPrinter.print(root, { multiline: true });
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
FROM index
|
|
160
|
+
| WHERE x > 100
|
|
161
|
+
| LIMIT 100
|
|
162
|
+
*/
|
|
163
|
+
console.log(text);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Licence
|
|
167
|
+
Licensed under [Elastic License 2.0](./LICENCE.txt).
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const smallest = "FROM a";
|
|
2
|
+
export declare const sortCommandFromDocs = "FROM employees\n| KEEP first_name, last_name, height\n| SORT height";
|
|
3
|
+
export declare const large = "\n// This is a comment, not a \"string\"\nFROM index, metrics:index, \"another_index\", \"\"\"index\"\"\", metrics-metrics-metrics METADATA _id, _index\n /* This is a multiline\n comment */\n// | FORK (WHERE ?param.test == \"asdf\" | LIMIT 123) (LIMIT 123)\n | EVAL kb = bytes / 1024 * -1.23e456 + ?param <= 3, a = 5 WEEKS, foo = \"baasdfr\", ? <= ?asdf\n | WHERE process.name == \"curl.exe /* asdf */\" AND ?42 == 123 OR ?\n | WHERE event_duration > /* very big number */ 5000000\n | WHERE message LIKE \"Connected*\"\n | KEEP kb, destination.address, date, ip, email, num, avg.avg.avg\n // The ten is\n // very sensible number\n | LIMIT 10\n | STATS bytes = (SUM(destination.bytes, true))::INTEGER\n | SORT asdf\n | WHERE MATCH( aws.s3.bucket.name, ?variable, {\n \"minimum_should_match\": ?min_should_match,\n \"fuzziness\": 2,\n \"key\": \"value\",\n \"nil\": NULL,\n \"another_param\": ?param\n })\n | SORT @timestamp DESC, @timestamp ASC\n | SORT kb, date ASC NULLS FIRST, ip DESC NULLS LAST\n | DROP date, ip, `AVG(FALSE, null, { \"this\": \"is\", \"map\": 123 })`\n | RENAME field AS another_field, another_field AS field\n | RENAME unique_queries AS `Unique Queries`\n /**\n * Description, not \"string\"\n * @description This is a description\n * @color #0077ff\n */\n | DISSECT field \"\"\"%{date} - %{msg} - %{ip}\"\"\"\n | GROK dns.question.name \"asdf\"\n | ENRICH languages_policy ON a WITH name = language_name, more\n | MV_EXPAND column\n | INLINESTATS count = COUNT(ROUND(AVG(\n MV_AVG(department.salary_change)), 10))\n BY languages\n | LOOKUP JOIN join_index ON x.foo";
|
|
4
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixtures.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ,WAAW,CAAC;AAEjC,eAAO,MAAM,mBAAmB,wEAElB,CAAC;AAEf,eAAO,MAAM,KAAK,koDAwCkB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ESQLAstComment, ESQLAstCommentMultiLine, ESQLAstCommentSingleLine, ESQLAstExpression, ESQLAstQueryExpression, ESQLColumn, ESQLCommand, ESQLCommandOption, ESQLDecimalLiteral, ESQLIdentifier, ESQLInlineCast, ESQLIntegerLiteral, ESQLList, ESQLLocation, ESQLNamedParamLiteral, ESQLParam, ESQLParens, ESQLPositionalParamLiteral, ESQLOrderExpression, ESQLSource, ESQLParamLiteral, ESQLFunction, ESQLAstItem, ESQLStringLiteral, ESQLBinaryExpression, ESQLUnaryExpression, ESQLBooleanLiteral, ESQLNullLiteral, BinaryExpressionOperator, ESQLMap, ESQLMapEntry, ESQLTimeDurationLiteral, ESQLDatePeriodLiteral, ESQLAstHeaderCommand, ESQLAstSetHeaderCommand } from '../../types';
|
|
2
|
+
import type { AstNodeParserFields, AstNodeTemplate, PartialFields } from './types';
|
|
3
|
+
export declare namespace Builder {
|
|
4
|
+
/**
|
|
5
|
+
* Constructs fields which are only available when the node is minted by
|
|
6
|
+
* the parser.
|
|
7
|
+
*/
|
|
8
|
+
const parserFields: ({ location, text, incomplete, }?: Partial<AstNodeParserFields>) => AstNodeParserFields;
|
|
9
|
+
const command: <Name extends string>(template: PartialFields<AstNodeTemplate<ESQLCommand<Name>>, "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLCommand<Name>;
|
|
10
|
+
const option: (template: PartialFields<AstNodeTemplate<ESQLCommandOption>, "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLCommandOption;
|
|
11
|
+
const comment: <S extends ESQLAstComment["subtype"]>(subtype: S, text: string, location?: ESQLLocation) => S extends "multi-line" ? ESQLAstCommentMultiLine : ESQLAstCommentSingleLine;
|
|
12
|
+
namespace expression {
|
|
13
|
+
const query: (commands?: ESQLAstQueryExpression["commands"], fromParser?: Partial<AstNodeParserFields>, header?: ESQLAstHeaderCommand[]) => ESQLAstQueryExpression;
|
|
14
|
+
namespace source {
|
|
15
|
+
type SourceTemplate = {
|
|
16
|
+
prefix?: string | ESQLSource['prefix'];
|
|
17
|
+
index?: string | ESQLSource['index'];
|
|
18
|
+
selector?: string | ESQLSource['selector'];
|
|
19
|
+
} & Omit<AstNodeTemplate<ESQLSource>, 'name' | 'prefix' | 'index' | 'selector'> & Partial<Pick<ESQLSource, 'name'>>;
|
|
20
|
+
const node: (indexOrTemplate: string | ESQLStringLiteral | SourceTemplate, fromParser?: Partial<AstNodeParserFields>) => ESQLSource;
|
|
21
|
+
const index: (indexName: string, prefix?: string | ESQLSource["prefix"], selector?: string | ESQLSource["selector"], template?: Omit<AstNodeTemplate<ESQLSource>, "name" | "index" | "prefix">, fromParser?: Partial<AstNodeParserFields>) => ESQLSource;
|
|
22
|
+
}
|
|
23
|
+
const parens: (child: ESQLAstExpression, fromParser?: Partial<AstNodeParserFields>) => ESQLParens;
|
|
24
|
+
type ColumnTemplate = Omit<AstNodeTemplate<ESQLColumn>, 'name' | 'quoted' | 'parts'>;
|
|
25
|
+
const column: (nameOrTemplate: string | string[] | ColumnTemplate, qualifier?: string | ESQLIdentifier, fromParser?: Partial<AstNodeParserFields>) => ESQLColumn;
|
|
26
|
+
const order: (operand: ESQLColumn, template: Omit<AstNodeTemplate<ESQLOrderExpression>, "name" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLOrderExpression;
|
|
27
|
+
const inlineCast: (template: Omit<AstNodeTemplate<ESQLInlineCast>, "name">, fromParser?: Partial<AstNodeParserFields>) => ESQLInlineCast;
|
|
28
|
+
namespace func {
|
|
29
|
+
const node: (template: AstNodeTemplate<ESQLFunction>, fromParser?: Partial<AstNodeParserFields>) => ESQLFunction;
|
|
30
|
+
const call: (nameOrOperator: string | ESQLIdentifier | ESQLParamLiteral, args: ESQLAstItem[], template?: Omit<AstNodeTemplate<ESQLFunction>, "subtype" | "name" | "operator" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLFunction;
|
|
31
|
+
const unary: (name: string, arg: ESQLAstItem, template?: Omit<AstNodeTemplate<ESQLFunction>, "subtype" | "name" | "operator" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLUnaryExpression;
|
|
32
|
+
const postfix: (name: string, arg: ESQLAstItem, template?: Omit<AstNodeTemplate<ESQLFunction>, "subtype" | "name" | "operator" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLUnaryExpression;
|
|
33
|
+
const binary: <Name extends BinaryExpressionOperator = BinaryExpressionOperator>(name: Name, args: [left: ESQLAstItem, right: ESQLAstItem], template?: Omit<AstNodeTemplate<ESQLBinaryExpression<Name>>, "subtype" | "name" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLBinaryExpression<Name>;
|
|
34
|
+
}
|
|
35
|
+
const where: (args: [left: ESQLAstItem, right: ESQLAstItem], template?: Omit<AstNodeTemplate<ESQLFunction>, "subtype" | "name" | "operator" | "args">, fromParser?: Partial<AstNodeParserFields>) => ESQLBinaryExpression<BinaryExpressionOperator>;
|
|
36
|
+
namespace list {
|
|
37
|
+
const literal: (template?: Omit<AstNodeTemplate<ESQLList>, "name" | "values"> & Partial<Pick<ESQLList, "values">>, fromParser?: Partial<AstNodeParserFields>) => ESQLList;
|
|
38
|
+
const tuple: (template?: Omit<AstNodeTemplate<ESQLList>, "name" | "values"> & Partial<Pick<ESQLList, "values">>, fromParser?: Partial<AstNodeParserFields>) => ESQLList;
|
|
39
|
+
const bare: (template?: Omit<AstNodeTemplate<ESQLList>, "name" | "values"> & Partial<Pick<ESQLList, "values">>, fromParser?: Partial<AstNodeParserFields>) => ESQLList;
|
|
40
|
+
}
|
|
41
|
+
namespace literal {
|
|
42
|
+
/**
|
|
43
|
+
* Constructs a NULL literal node.
|
|
44
|
+
*/
|
|
45
|
+
const nil: (template?: Omit<AstNodeTemplate<ESQLNullLiteral>, "name" | "literalType">, fromParser?: Partial<AstNodeParserFields>) => ESQLNullLiteral;
|
|
46
|
+
const boolean: (value: boolean, template?: Omit<AstNodeTemplate<ESQLBooleanLiteral>, "name" | "literalType">, fromParser?: Partial<AstNodeParserFields>) => ESQLBooleanLiteral;
|
|
47
|
+
/**
|
|
48
|
+
* Constructs an integer literal node.
|
|
49
|
+
*/
|
|
50
|
+
const numeric: (template: Omit<AstNodeTemplate<ESQLIntegerLiteral | ESQLDecimalLiteral>, "name">, fromParser?: Partial<AstNodeParserFields>) => ESQLIntegerLiteral | ESQLDecimalLiteral;
|
|
51
|
+
/**
|
|
52
|
+
* Creates an integer literal.
|
|
53
|
+
*
|
|
54
|
+
* @example 42
|
|
55
|
+
*/
|
|
56
|
+
const integer: (value: number, template?: Omit<AstNodeTemplate<ESQLIntegerLiteral>, "name">, fromParser?: Partial<AstNodeParserFields>) => ESQLIntegerLiteral;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a floating point number literal.
|
|
59
|
+
*
|
|
60
|
+
* @example 3.14
|
|
61
|
+
*/
|
|
62
|
+
const decimal: (value: number, template?: Omit<AstNodeTemplate<ESQLDecimalLiteral>, "name">, fromParser?: Partial<AstNodeParserFields>) => ESQLDecimalLiteral;
|
|
63
|
+
/**
|
|
64
|
+
* Constructs AST nodes from timespan literals (e.g. 1 day, 2s)
|
|
65
|
+
*/
|
|
66
|
+
const timespan: (quantity: ESQLTimeDurationLiteral["quantity"], unit: ESQLTimeDurationLiteral["unit"], fromParser?: Partial<AstNodeParserFields>) => ESQLTimeDurationLiteral | ESQLDatePeriodLiteral;
|
|
67
|
+
const string: (valueUnquoted: string, template?: Omit<AstNodeTemplate<ESQLStringLiteral>, "name" | "literalType" | "value" | "valueUnquoted"> & Partial<Pick<ESQLStringLiteral, "name">>, fromParser?: Partial<AstNodeParserFields>) => ESQLStringLiteral;
|
|
68
|
+
}
|
|
69
|
+
const map: (template?: Omit<AstNodeTemplate<ESQLMap>, "name" | "entries"> & Partial<Pick<ESQLMap, "entries">>, fromParser?: Partial<AstNodeParserFields>) => ESQLMap;
|
|
70
|
+
const entry: (key: string | ESQLMapEntry["key"], value: ESQLMapEntry["value"], fromParser?: Partial<AstNodeParserFields>, template?: Omit<AstNodeTemplate<ESQLMapEntry>, "key" | "value">) => ESQLMapEntry;
|
|
71
|
+
}
|
|
72
|
+
const identifier: (nameOrTemplate: string | AstNodeTemplate<ESQLIdentifier>, fromParser?: Partial<AstNodeParserFields>) => ESQLIdentifier;
|
|
73
|
+
namespace param {
|
|
74
|
+
const unnamed: (fromParser?: Partial<AstNodeParserFields>, template?: Partial<Pick<ESQLParam, "paramKind">>) => ESQLParam;
|
|
75
|
+
const named: (template: Omit<AstNodeTemplate<ESQLNamedParamLiteral>, "name" | "literalType" | "paramType" | "paramKind"> & Partial<Pick<ESQLNamedParamLiteral, "paramKind">>, fromParser?: Partial<AstNodeParserFields>) => ESQLNamedParamLiteral;
|
|
76
|
+
const positional: (template: Omit<AstNodeTemplate<ESQLPositionalParamLiteral>, "name" | "literalType" | "paramType" | "paramKind"> & Partial<Pick<ESQLPositionalParamLiteral, "paramKind">>, fromParser?: Partial<AstNodeParserFields>) => ESQLPositionalParamLiteral;
|
|
77
|
+
const build: (name: string, options?: Partial<ESQLParamLiteral>, fromParser?: Partial<AstNodeParserFields>) => ESQLParam;
|
|
78
|
+
}
|
|
79
|
+
namespace header {
|
|
80
|
+
interface HeaderCommandBuilder {
|
|
81
|
+
<Name extends string>(template: PartialFields<AstNodeTemplate<ESQLAstHeaderCommand<Name>>, 'args'>, fromParser?: Partial<AstNodeParserFields>): ESQLAstHeaderCommand<Name>;
|
|
82
|
+
set: (args: ESQLAstSetHeaderCommand['args'], template?: Omit<PartialFields<AstNodeTemplate<ESQLAstSetHeaderCommand>, 'args'>, 'name'>, fromParser?: Partial<AstNodeParserFields>) => ESQLAstSetHeaderCommand;
|
|
83
|
+
}
|
|
84
|
+
const command: HeaderCommandBuilder;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/ast/builder/builder.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,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H;IAED,UAAiB,MAAM,CAAC;QACtB,UAAiB,oBAAoB;YACnC,CAAC,IAAI,SAAS,MAAM,EAClB,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,EAC5E,UAAU,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACxC,oBAAoB,CAAC,IAAI,CAAC,CAAC;YAE9B,GAAG,EAAE,CACH,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EACxF,UAAU,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KACtC,uBAAuB,CAAC;SAC9B;QAEM,MAAM,OAAO,EAAE,oBAwBrB,CAAC;KACH;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ast/builder/index.ts"],"names":[],"mappings":"AAOA,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ESQLProperNode, ESQLAstBaseItem } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Node fields which are available only when the node is minted by the parser.
|
|
4
|
+
* When creating nodes manually, these fields are not available.
|
|
5
|
+
*/
|
|
6
|
+
export type AstNodeParserFields = Pick<ESQLAstBaseItem, 'text' | 'location' | 'incomplete'>;
|
|
7
|
+
/**
|
|
8
|
+
* The node *template* transforms ES|QL AST nodes into a permissive shape, with
|
|
9
|
+
* the aim to:
|
|
10
|
+
*
|
|
11
|
+
* - Remove the `type` property, as the builder will set it.
|
|
12
|
+
* - Make properties like `text`, `location`, and `incomplete` optional, as they
|
|
13
|
+
* are a available only when the AST node is minted by the parser.
|
|
14
|
+
* - Make all other properties optional, for easy node creation.
|
|
15
|
+
*/
|
|
16
|
+
export type AstNodeTemplate<Node extends ESQLProperNode> = Omit<Node, 'type' | 'text' | 'location' | 'incomplete'> & Partial<Omit<Node, 'type'>>;
|
|
17
|
+
export type PartialFields<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ast/builder/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,cAAc,IAAI,IAAI,CAC7D,IAAI,EACJ,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAC5C,GACC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9B,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ESQLAstNode } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The group name of a binary expression. Groups are ordered by precedence.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum BinaryExpressionGroup {
|
|
6
|
+
/**
|
|
7
|
+
* No group, not a binary expression.
|
|
8
|
+
*/
|
|
9
|
+
none = 0,
|
|
10
|
+
/**
|
|
11
|
+
* Binary expression, but its group is unknown.
|
|
12
|
+
*/
|
|
13
|
+
unknown = 1,
|
|
14
|
+
/**
|
|
15
|
+
* Logical: `and`, `or`
|
|
16
|
+
*/
|
|
17
|
+
or = 10,
|
|
18
|
+
and = 11,
|
|
19
|
+
/**
|
|
20
|
+
* Regular expression: `like`, `not like`, `rlike`, `not rlike`
|
|
21
|
+
*/
|
|
22
|
+
regex = 20,
|
|
23
|
+
/**
|
|
24
|
+
* Assignment: `=`, `:=`
|
|
25
|
+
*/
|
|
26
|
+
assignment = 30,
|
|
27
|
+
/**
|
|
28
|
+
* Comparison: `==`, `=~`, `!=`, `<`, `<=`, `>`, `>=`
|
|
29
|
+
*/
|
|
30
|
+
comparison = 40,
|
|
31
|
+
/**
|
|
32
|
+
* Additive: `+`, `-`
|
|
33
|
+
*/
|
|
34
|
+
additive = 50,
|
|
35
|
+
/**
|
|
36
|
+
* Multiplicative: `*`, `/`, `%`
|
|
37
|
+
*/
|
|
38
|
+
multiplicative = 60
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the group of a binary expression.
|
|
42
|
+
*
|
|
43
|
+
* @param node Any ES|QL AST node.
|
|
44
|
+
* @returns Binary expression group or undefined if the node is
|
|
45
|
+
* not a binary expression.
|
|
46
|
+
*/
|
|
47
|
+
export declare const binaryExpressionGroup: (node: ESQLAstNode) => BinaryExpressionGroup;
|
|
48
|
+
/**
|
|
49
|
+
* The group name of a unary expression. Groups are ordered by precedence.
|
|
50
|
+
*/
|
|
51
|
+
export declare enum UnaryExpressionGroup {
|
|
52
|
+
/**
|
|
53
|
+
* No group, not a unary expression.
|
|
54
|
+
*/
|
|
55
|
+
none = 0,
|
|
56
|
+
/**
|
|
57
|
+
* Unary expression, but its group is unknown.
|
|
58
|
+
*/
|
|
59
|
+
unknown = 1,
|
|
60
|
+
/**
|
|
61
|
+
* Logical: `not`
|
|
62
|
+
*/
|
|
63
|
+
not = 13,
|
|
64
|
+
/**
|
|
65
|
+
* Additive: `+`, `-`
|
|
66
|
+
*/
|
|
67
|
+
additive = 50
|
|
68
|
+
}
|
|
69
|
+
export declare const unaryExpressionGroup: (node: ESQLAstNode) => UnaryExpressionGroup;
|
|
70
|
+
//# sourceMappingURL=grouping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../src/ast/grouping.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,IAAI,IAAI;IAER;;OAEG;IACH,OAAO,IAAI;IAEX;;OAEG;IACH,EAAE,KAAK;IACP,GAAG,KAAK;IAER;;OAEG;IACH,KAAK,KAAK;IAEV;;OAEG;IACH,UAAU,KAAK;IAEf;;OAEG;IACH,UAAU,KAAK;IAEf;;OAEG;IACH,QAAQ,KAAK;IAEb;;OAEG;IACH,cAAc,KAAK;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,WAAW,KAAG,qBAiCzD,CAAC;AAEF;;GAEG;AACH,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,IAAI,IAAI;IAER;;OAEG;IACH,OAAO,IAAI;IAEX;;OAEG;IACH,GAAG,KAAK;IAER;;OAEG;IACH,QAAQ,KAAK;CACd;AAED,eAAO,MAAM,oBAAoB,GAAI,MAAM,WAAW,KAAG,oBAYxD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './is';
|
|
2
|
+
export * from './location';
|
|
3
|
+
export * from './grouping';
|
|
4
|
+
export { Builder, type AstNodeParserFields, type AstNodeTemplate } from './builder';
|
|
5
|
+
export { singleItems, resolveItem, lastItem, firstItem } from './visitor/utils';
|
|
6
|
+
export { Walker, type WalkerOptions, walk, type WalkerAstNode } from './walker';
|
|
7
|
+
export * as mutate from './mutate';
|
|
8
|
+
export * from './visitor';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ast/index.ts"],"names":[],"mappings":"AAQA,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,IAAI,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,WAAW,CAAC"}
|
package/lib/ast/is.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type * as types from '../types';
|
|
2
|
+
import type { ESQLInlineCast, ESQLProperNode } from '../types';
|
|
3
|
+
export declare const isProperNode: (node: unknown) => node is types.ESQLProperNode;
|
|
4
|
+
export declare const isQuery: (node: unknown) => node is types.ESQLAstQueryExpression;
|
|
5
|
+
export declare const isCommand: (node: unknown) => node is types.ESQLCommand;
|
|
6
|
+
export declare const isHeaderCommand: (node: unknown) => node is types.ESQLAstHeaderCommand;
|
|
7
|
+
export declare const isFunctionExpression: (node: unknown) => node is types.ESQLFunction;
|
|
8
|
+
export declare const isUnaryExpression: (node: unknown) => node is types.ESQLUnaryExpression;
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the given node is a binary expression, i.e. an operator
|
|
11
|
+
* surrounded by two operands:
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* 1 + 1
|
|
15
|
+
* column LIKE "foo"
|
|
16
|
+
* foo = "bar"
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param node Any ES|QL AST node.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isBinaryExpression: (node: unknown) => node is types.ESQLBinaryExpression;
|
|
22
|
+
export declare const isWhereExpression: (node: unknown) => node is types.ESQLBinaryExpression<types.BinaryExpressionWhereOperator>;
|
|
23
|
+
export declare const isAsExpression: (node: unknown) => node is types.ESQLBinaryExpression<types.BinaryExpressionRenameOperator>;
|
|
24
|
+
export declare const isFieldExpression: (node: unknown) => node is types.ESQLBinaryExpression<types.BinaryExpressionWhereOperator>;
|
|
25
|
+
export declare const isLiteral: (node: unknown) => node is types.ESQLLiteral;
|
|
26
|
+
export declare const isStringLiteral: (node: unknown) => node is types.ESQLStringLiteral;
|
|
27
|
+
export declare const isIntegerLiteral: (node: unknown) => node is types.ESQLIntegerLiteral;
|
|
28
|
+
export declare const isDoubleLiteral: (node: unknown) => node is types.ESQLIntegerLiteral;
|
|
29
|
+
export declare const isBooleanLiteral: (node: unknown) => node is types.ESQLBooleanLiteral;
|
|
30
|
+
export declare const isTimeDurationLiteral: (node: unknown) => node is types.ESQLTimeDurationLiteral;
|
|
31
|
+
export declare const isDatePeriodLiteral: (node: unknown) => node is types.ESQLDatePeriodLiteral;
|
|
32
|
+
export declare const isParamLiteral: (node: unknown) => node is types.ESQLParamLiteral;
|
|
33
|
+
export declare const isColumn: (node: unknown) => node is types.ESQLColumn;
|
|
34
|
+
export declare const isSource: (node: unknown) => node is types.ESQLSource;
|
|
35
|
+
export declare const isParens: (node: unknown) => node is types.ESQLParens;
|
|
36
|
+
export declare const isSubQuery: (node: unknown) => node is types.ESQLParens & {
|
|
37
|
+
child: types.ESQLAstQueryExpression;
|
|
38
|
+
};
|
|
39
|
+
export declare const isMap: (node: unknown) => node is types.ESQLMap;
|
|
40
|
+
export declare const isIdentifier: (node: unknown) => node is types.ESQLIdentifier;
|
|
41
|
+
export declare const isList: (node: unknown) => node is types.ESQLList;
|
|
42
|
+
export declare const isOptionNode: (node: types.ESQLAstNode) => node is types.ESQLCommandOption;
|
|
43
|
+
export declare const isUnknownNode: (node: unknown) => node is types.ESQLUnknownItem;
|
|
44
|
+
export declare const isInlineCast: (node: unknown) => node is ESQLInlineCast;
|
|
45
|
+
export declare function isAssignment(node: unknown): node is types.ESQLFunction;
|
|
46
|
+
export declare const isParametrized: (node: ESQLProperNode) => boolean;
|
|
47
|
+
export declare const isESQLFunction: (node: unknown) => node is types.ESQLFunction;
|
|
48
|
+
export declare const isESQLNamedParamLiteral: (node: types.ESQLAstItem) => node is types.ESQLNamedParamLiteral;
|
|
49
|
+
//# sourceMappingURL=is.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../src/ast/is.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/D,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,cAKpB,CAAC;AAExC,eAAO,MAAM,OAAO,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,sBACT,CAAC;AAE9C,eAAO,MAAM,SAAS,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,WACT,CAAC;AAEhD,eAAO,MAAM,eAAe,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,oBACR,CAAC;AAEvD,eAAO,MAAM,oBAAoB,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,YACnB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,mBACG,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,oBACG,CAAC;AAErE,eAAO,MAAM,iBAAiB,GAC5B,MAAM,OAAO,KACZ,IAAI,IAAI,KAAK,CAAC,oBAAoB,CAAC,KA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C,eAAO,MAAM,UAAU,GACrB,MAAM,OAAO,KACZ,IAAI,IAAI,KAAK,CAAC,UAAU,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,sBAAsB,CAAA;CAC5B,CAAC;AAExC,eAAO,MAAM,KAAK,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,OACT,CAAC;AAE5C,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,cACT,CAAC;AAEnD,eAAO,MAAM,MAAM,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,QACT,CAAC;AAE7C,eAAO,MAAM,YAAY,GAAI,MAAM,KAAK,CAAC,WAAW,KAAG,IAAI,IAAI,KAAK,CAAC,iBAEpE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,eACb,CAAC;AAEhD,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,cACH,CAAC;AAEnD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,YAAY,CAEtE;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,cAAc,KAAG,OAAyC,CAAC;AAQhG,eAAO,MAAM,cAAc,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,KAAK,CAAC,YAGX,CAAC;AAEnD,eAAO,MAAM,uBAAuB,GAClC,MAAM,KAAK,CAAC,WAAW,KACtB,IAAI,IAAI,KAAK,CAAC,qBAG4C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ESQLAstComment, ESQLLocation, ESQLSingleAstItem } from '../types';
|
|
2
|
+
export declare const within: (inner: number | {
|
|
3
|
+
location: ESQLLocation;
|
|
4
|
+
}, outer: {
|
|
5
|
+
location?: ESQLLocation;
|
|
6
|
+
} | ESQLSingleAstItem | ESQLAstComment | undefined) => boolean;
|
|
7
|
+
//# sourceMappingURL=location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/ast/location.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEhF,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,GAAG;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,EAC1C,OAAO;IAAE,QAAQ,CAAC,EAAE,YAAY,CAAA;CAAE,GAAG,iBAAiB,GAAG,cAAc,GAAG,SAAS,YAapF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ast/mutate/commands/from/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|