@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
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type * as synth from './synth';
|
|
2
|
+
import type { ESQLAstCommand, ESQLCommand, ESQLOrderExpression, ESQLSource } from '../types';
|
|
3
|
+
import type { ComposerQuery } from './composer_query';
|
|
4
|
+
import type { ParameterHole, DoubleParameterHole } from './parameter_hole';
|
|
5
|
+
/**
|
|
6
|
+
* Holes are expressions that can be used in the `esql` tagged template function.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* esql `FROM index | WHERE foo > ${ hole } | LIMIT 10`;
|
|
10
|
+
* ^~~~~^
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export type ComposerQueryTagHole =
|
|
14
|
+
/**
|
|
15
|
+
* All Synth API holes are supported.
|
|
16
|
+
*/
|
|
17
|
+
synth.SynthTemplateHole
|
|
18
|
+
/**
|
|
19
|
+
* An ESQL command node can be used as a hole, for example to
|
|
20
|
+
* conditionally add a command to the query.
|
|
21
|
+
*/
|
|
22
|
+
| ESQLAstCommand
|
|
23
|
+
/**
|
|
24
|
+
* A parameter hole is where user provides a runtime value and we automatically
|
|
25
|
+
* create a parameter for that hole in the AST and store the parameter value
|
|
26
|
+
* in the `params` bag.
|
|
27
|
+
*/
|
|
28
|
+
| ParameterHole
|
|
29
|
+
/**
|
|
30
|
+
* Same as {@link ParameterHole}, but a shorthand syntax.
|
|
31
|
+
*/
|
|
32
|
+
| ParameterShorthandHole
|
|
33
|
+
/**
|
|
34
|
+
* A nested ComposerQuery instance can be used as a hole to embed
|
|
35
|
+
* one query into another. For example, to build a `FORK` command
|
|
36
|
+
* out of multiple sub-queries.
|
|
37
|
+
*/
|
|
38
|
+
| ComposerQuery;
|
|
39
|
+
/**
|
|
40
|
+
* A hole shorthand where the user can specify a parametrized hole with an
|
|
41
|
+
* object literal syntax where th
|
|
42
|
+
*/
|
|
43
|
+
export type ParameterShorthandHole = Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* {@link SingleKey} enforces on the type level that an object literal has just
|
|
46
|
+
* one field.
|
|
47
|
+
*/
|
|
48
|
+
export type SingleKey<T> = IsUnion<keyof T> extends true ? never : {} extends T ? never : T;
|
|
49
|
+
export type IsUnion<T> = [T] extends [UnionToIntersection<T>] ? false : true;
|
|
50
|
+
export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
51
|
+
export type ComposerTag<Return> = <T extends ComposerQueryTagHole[]>(template: TemplateStringsArray,
|
|
52
|
+
/**
|
|
53
|
+
* The SingleKey below ensures that the parameter shorthand holes
|
|
54
|
+
* are processed correctly, allowing only one key per object.
|
|
55
|
+
*/
|
|
56
|
+
...holes: {
|
|
57
|
+
[K in keyof T]: T[K] extends ParameterShorthandHole ? SingleKey<T[K]> : T[K];
|
|
58
|
+
}) => Return;
|
|
59
|
+
export type ParametrizedComposerTag<Return> = (paramsValues?: Record<string, unknown>) => ComposerTag<Return> & ComposerQueryGenerator<Return>;
|
|
60
|
+
export type ComposerQueryTag = ComposerTag<ComposerQuery>;
|
|
61
|
+
export type ParametrizedComposerQueryTag = ParametrizedComposerTag<ComposerQuery>;
|
|
62
|
+
export type ComposerQueryGenerator<Return = ComposerQuery> = (query: string, paramsValues?: Record<string, unknown>) => Return;
|
|
63
|
+
type SynthMethods = typeof import('./synth');
|
|
64
|
+
/**
|
|
65
|
+
* Methods available of the `esql` tagged template function.
|
|
66
|
+
* These methods are used to construct AST nodes.
|
|
67
|
+
*/
|
|
68
|
+
export interface ComposerQueryTagMethods extends Omit<SynthMethods, 'par' | 'dpar'> {
|
|
69
|
+
par: (value: unknown, name?: string) => ParameterHole;
|
|
70
|
+
dpar: (value: unknown, name?: string) => DoubleParameterHole;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new {@linkcode ComposerQuery} instance with a `FROM` command with
|
|
73
|
+
* the specified list of sources.
|
|
74
|
+
*
|
|
75
|
+
* Example:
|
|
76
|
+
*
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const query = esql.from('kibana_ecommerce_index', 'kibana_logs_index');
|
|
79
|
+
* // FROM kibana_ecommerce_index, kibana_logs_index
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* or with metadata fields:
|
|
83
|
+
*
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const query = esql.from(
|
|
86
|
+
* ['kibana_ecommerce_index', 'kibana_logs_index'],
|
|
87
|
+
* ['_id', '_index']
|
|
88
|
+
* );
|
|
89
|
+
* // FROM kibana_ecommerce_index, kibana_logs_index WITH METADATA _id, _index
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param source The source to use in the `FROM` command, at least one source
|
|
93
|
+
* is required.
|
|
94
|
+
* @param moreSources Additional sources to include in the `FROM` command.
|
|
95
|
+
*/
|
|
96
|
+
from: FromSourcesQueryStarter & FromSourcesAndMetadataQueryStarter;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new {@linkcode ComposerQuery} instance with a `TS` command with
|
|
99
|
+
* the specified list of sources.
|
|
100
|
+
*
|
|
101
|
+
* Example:
|
|
102
|
+
*
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const query = esql.ts('kibana_ecommerce_index', 'kibana_logs_index');
|
|
105
|
+
* // TS kibana_ecommerce_index, kibana_logs_index
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* or with metadata fields:
|
|
109
|
+
*
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const query = esql.from(
|
|
112
|
+
* ['kibana_ecommerce_index', 'kibana_logs_index'],
|
|
113
|
+
* ['_id', '_index']
|
|
114
|
+
* );
|
|
115
|
+
* // FROM kibana_ecommerce_index, kibana_logs_index WITH METADATA _id, _index
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @param source The source to use in the `TS` command, at least one source
|
|
119
|
+
* is required.
|
|
120
|
+
* @param moreSources Additional sources to include in the `TS` command.
|
|
121
|
+
*/
|
|
122
|
+
ts: FromSourcesQueryStarter & FromSourcesAndMetadataQueryStarter;
|
|
123
|
+
/**
|
|
124
|
+
* An AST no-op command that can be used in the query, for example in
|
|
125
|
+
* conditional expressions.
|
|
126
|
+
*
|
|
127
|
+
* Example:
|
|
128
|
+
*
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const shouldAddNoop = true;
|
|
131
|
+
* const query = esql`FROM index
|
|
132
|
+
* | ${shouldAddNoop ? esql.noop : esql.cmd`WHERE foo > 42`}
|
|
133
|
+
* | LIMIT 10`;
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* No-op command is removed from the final query during synthesis.
|
|
137
|
+
*
|
|
138
|
+
* @returns An ESQLCommand node representing a no-op command.
|
|
139
|
+
*/
|
|
140
|
+
nop: ESQLCommand;
|
|
141
|
+
}
|
|
142
|
+
export type FromSourcesQueryStarter = (source: ComposerSourceShorthand, ...moreSources: ComposerSourceShorthand[]) => ComposerQuery;
|
|
143
|
+
export type FromSourcesAndMetadataQueryStarter = (sources: ComposerSourceShorthand[], metadataFields?: ComposerColumnShorthand[]) => ComposerQuery;
|
|
144
|
+
/**
|
|
145
|
+
* A shorthand for specifying a source with an optional alias.
|
|
146
|
+
*
|
|
147
|
+
* ```
|
|
148
|
+
* { index: 'my_index', alias: 'i' }
|
|
149
|
+
* // Result: my_index AS i
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export interface ComposerSourceWithAlias {
|
|
153
|
+
index: string;
|
|
154
|
+
alias: string;
|
|
155
|
+
}
|
|
156
|
+
export type ComposerSourceShorthand = string | ESQLSource | ComposerSourceWithAlias;
|
|
157
|
+
/**
|
|
158
|
+
* A shorthand for specifying a column in the query.
|
|
159
|
+
* It can be a string a simple column or an array of strings for a nested column.
|
|
160
|
+
*/
|
|
161
|
+
export type ComposerColumnShorthand = string | synth.SynthColumnShorthand | synth.SynthQualifiedColumnShorthand;
|
|
162
|
+
/**
|
|
163
|
+
* A shorthand for specifying a rename expression in the `RENAME` command.
|
|
164
|
+
*
|
|
165
|
+
* ```
|
|
166
|
+
* ... | RENAME <oldName> AS <newName> | ...
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export type ComposerRenameShorthand = [
|
|
170
|
+
newName: ComposerColumnShorthand,
|
|
171
|
+
oldName: ComposerColumnShorthand
|
|
172
|
+
];
|
|
173
|
+
/**
|
|
174
|
+
* A shorthand for specifying a sort condition.
|
|
175
|
+
*/
|
|
176
|
+
export type ComposerSortShorthand =
|
|
177
|
+
/**
|
|
178
|
+
* A single column name, which is not nested, e.g. `@timestamp`.
|
|
179
|
+
* This is equivalent to `['@timestamp']`.
|
|
180
|
+
*/
|
|
181
|
+
string
|
|
182
|
+
/**
|
|
183
|
+
* A column with ASC/DESC order and NULLS FIRST/LAST qualifiers.
|
|
184
|
+
*/
|
|
185
|
+
| [
|
|
186
|
+
/**
|
|
187
|
+
* The column name, which can be either a string, for a non-nested column,
|
|
188
|
+
* or an array of strings for a nested column. For example,
|
|
189
|
+
* `['user', 'name']` is equivalent to `user.name`.
|
|
190
|
+
*/
|
|
191
|
+
column: ComposerColumnShorthand,
|
|
192
|
+
order?: ESQLOrderExpression['order'],
|
|
193
|
+
nulls?: ESQLOrderExpression['nulls']
|
|
194
|
+
];
|
|
195
|
+
/**
|
|
196
|
+
* The Elasticsearch request body as it can be sent to the `POST /_query` endpoint.
|
|
197
|
+
*/
|
|
198
|
+
export interface EsqlRequest {
|
|
199
|
+
query: string;
|
|
200
|
+
params?: EsqlRequestParams;
|
|
201
|
+
filter?: unknown;
|
|
202
|
+
columnar?: boolean;
|
|
203
|
+
locale?: string;
|
|
204
|
+
wait_for_completion_timeout?: string;
|
|
205
|
+
}
|
|
206
|
+
export type EsqlRequestParams = EsqlRequestParamEntry[];
|
|
207
|
+
export type EsqlRequestParamEntry = EsqlRequestParamPositionalEntry | EsqlRequestParamNamedEntry;
|
|
208
|
+
export type EsqlRequestParamPositionalEntry = string | number | boolean | null;
|
|
209
|
+
export type EsqlRequestParamNamedEntry = Record<string, unknown>;
|
|
210
|
+
export interface QueryCommandTag extends QueryCommandTagParametrized {
|
|
211
|
+
(initialParams: Record<string, unknown>): QueryCommandTagParametrized;
|
|
212
|
+
}
|
|
213
|
+
export interface QueryCommandTagParametrized {
|
|
214
|
+
(template: TemplateStringsArray, ...holes: ComposerQueryTagHole[]): ComposerQuery;
|
|
215
|
+
(query: string, paramsValues?: Record<string, unknown>): ComposerQuery;
|
|
216
|
+
}
|
|
217
|
+
export {};
|
|
218
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/composer/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB;AAC9B;;GAEG;AACD,KAAK,CAAC,iBAAiB;AAEzB;;;GAGG;GACD,cAAc;AAEhB;;;;GAIG;GACD,aAAa;AAEf;;GAEG;GACD,sBAAsB;AAExB;;;;GAIG;GACD,aAAa,CAAC;AAElB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,EAAE,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5F,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AAC7E,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,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CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AACD,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,+BAA+B,GAAG,0BAA0B,CAAC;AACjG,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC/E,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjE,MAAM,WAAW,eAAgB,SAAQ,2BAA2B;IAClE,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,2BAA2B,CAAC;CACvE;AAED,MAAM,WAAW,2BAA2B;IAC1C,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,oBAAoB,EAAE,GAAG,aAAa,CAAC;IAClF,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC;CACxE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ESQLCommand } from '../types';
|
|
2
|
+
import type { ComposerQueryTagHole } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Query composer allows only named ES|QL parameters, because you cannot
|
|
5
|
+
* mix named and positional, or named and anonymous parameters in the same query.
|
|
6
|
+
*
|
|
7
|
+
* @param name The name of the parameter to validate.
|
|
8
|
+
*/
|
|
9
|
+
export declare const validateParamName: (name: string) => void;
|
|
10
|
+
export declare const composerQuerySymbol: unique symbol;
|
|
11
|
+
export declare const processTemplateHoles: (holes: ComposerQueryTagHole[], params?: Map<string, unknown>) => {
|
|
12
|
+
params: Map<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* It is possible to insert `... | WHERE TRUE | ...` *nop* commands into the
|
|
16
|
+
* query stream when building it conditionally. The `WHERE TRUE` command does
|
|
17
|
+
* nothing, Elasticsearch simply removes them. However, it is cleaner to remove
|
|
18
|
+
* them in the AST before sending the query to Elasticsearch. This function
|
|
19
|
+
* removes all *nop* commands from the command list.
|
|
20
|
+
*
|
|
21
|
+
* @param commands The list of commands to process.
|
|
22
|
+
*/
|
|
23
|
+
export declare const removeNopCommands: (commands: ESQLCommand[]) => ESQLCommand[];
|
|
24
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/composer/util.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,UAAU,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,SAAS,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,IAUhD,CAAC;AAcF,eAAO,MAAM,mBAAmB,eAA4B,CAAC;AAM7D,eAAO,MAAM,oBAAoB,GAC/B,OAAO,oBAAoB,EAAE,EAC7B,SAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,CAAa;;CAsGzC,CAAC;AAkBF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,WAAW,EAAE,KAAG,WAAW,EAEtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ESQLProperNode } from '../types';
|
|
2
|
+
import type { PromQLAstNode } from '../embedded_languages/promql/types';
|
|
3
|
+
/**
|
|
4
|
+
* Options for printing an AST.
|
|
5
|
+
*/
|
|
6
|
+
export interface PrintAstOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to include location information for each node in the output.
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
location?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to include the contents `.text` property of each node in the output.
|
|
15
|
+
*
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
text?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to print the AST in a compact form - only node types are printed.
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
compact?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The maximum depth to print the AST tree.
|
|
27
|
+
*
|
|
28
|
+
* @default Infinity
|
|
29
|
+
*/
|
|
30
|
+
depth?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Limits the total number of nodes printed.
|
|
33
|
+
*
|
|
34
|
+
* @default Infinity
|
|
35
|
+
*/
|
|
36
|
+
limit?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The source text from which the AST was parsed.
|
|
39
|
+
*/
|
|
40
|
+
src?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to print the source text of each node.
|
|
43
|
+
*/
|
|
44
|
+
printSrc?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prints an AST expression as a tree structure for debugging purposes.
|
|
48
|
+
*
|
|
49
|
+
* @param top - The root AST expression to print
|
|
50
|
+
* @param options - Options for printing the AST
|
|
51
|
+
* @returns A string representation of the AST tree
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const ast = parse('FROM index | WHERE field > 10');
|
|
56
|
+
* console.log(printAst(ast));
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const printAst: (top: ESQLProperNode | PromQLAstNode, options?: PrintAstOptions, tab?: string) => string;
|
|
60
|
+
//# sourceMappingURL=print_ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print_ast.d.ts","sourceRoot":"","sources":["../../src/debug/print_ast.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,GACnB,KAAK,cAAc,GAAG,aAAa,EACnC,UAAU,eAAe,EACzB,MAAK,MAAW,KACf,MA2DF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embedded_languages/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AstNodeParserFields } from '../../../../ast/builder/types';
|
|
2
|
+
import type { PromQLAstQueryExpression, PromQLFunction, PromQLSelector, PromQLBinaryExpression, PromQLUnaryExpression, PromQLSubquery, PromQLParens, PromQLNumericLiteral, PromQLStringLiteral, PromQLTimeValue, PromQLIdentifier, PromQLLabel, PromQLLabelMap, PromQLGrouping, PromQLModifier, PromQLGroupModifier, PromQLEvaluation, PromQLOffset, PromQLAt, PromQLUnknownItem, PromQLBinaryOperator, PromQLLabelMatchOperator, PromQLLabelName, PromQLAstExpression, PromQLAtModifier } from '../../types';
|
|
3
|
+
import type { PromQLAstNodeTemplate } from './types';
|
|
4
|
+
export declare namespace PromQLBuilder {
|
|
5
|
+
/**
|
|
6
|
+
* Constructs fields which are only available when the node is minted by
|
|
7
|
+
* the parser.
|
|
8
|
+
*/
|
|
9
|
+
const parserFields: ({ location, text, incomplete, }?: Partial<AstNodeParserFields>) => AstNodeParserFields;
|
|
10
|
+
namespace expression {
|
|
11
|
+
const query: (expr: PromQLAstExpression | undefined, fromParser?: Partial<AstNodeParserFields>) => PromQLAstQueryExpression;
|
|
12
|
+
const parens: (child: PromQLAstExpression, fromParser?: Partial<AstNodeParserFields>) => PromQLParens;
|
|
13
|
+
namespace func {
|
|
14
|
+
const call: (name: string, args: PromQLAstExpression[], grouping?: PromQLGrouping, groupingPosition?: "before" | "after", fromParser?: Partial<AstNodeParserFields>) => PromQLFunction;
|
|
15
|
+
}
|
|
16
|
+
namespace selector {
|
|
17
|
+
const node: (template: Omit<PromQLAstNodeTemplate<PromQLSelector>, "name" | "args">, fromParser?: Partial<AstNodeParserFields>) => PromQLSelector;
|
|
18
|
+
}
|
|
19
|
+
const binary: <Name extends PromQLBinaryOperator>(operator: Name, left: PromQLAstExpression, right: PromQLAstExpression, options?: {
|
|
20
|
+
bool?: boolean;
|
|
21
|
+
modifier?: PromQLModifier;
|
|
22
|
+
}, fromParser?: Partial<AstNodeParserFields>) => PromQLBinaryExpression<Name>;
|
|
23
|
+
const unary: (operator: "+" | "-", arg: PromQLAstExpression, fromParser?: Partial<AstNodeParserFields>) => PromQLUnaryExpression;
|
|
24
|
+
const subquery: (expr: PromQLAstExpression, range: PromQLAstExpression, resolution?: PromQLAstExpression, evaluation?: PromQLEvaluation, fromParser?: Partial<AstNodeParserFields>) => PromQLSubquery;
|
|
25
|
+
namespace literal {
|
|
26
|
+
const integer: (value: number, fromParser?: Partial<AstNodeParserFields>) => PromQLNumericLiteral;
|
|
27
|
+
const decimal: (value: number, fromParser?: Partial<AstNodeParserFields>) => PromQLNumericLiteral;
|
|
28
|
+
const hexadecimal: (value: number, text: string, fromParser?: Partial<AstNodeParserFields>) => PromQLNumericLiteral;
|
|
29
|
+
/**
|
|
30
|
+
* Create a string literal.
|
|
31
|
+
*
|
|
32
|
+
* @param valueUnquoted - The unquoted string value (e.g., 'hello' not '"hello"')
|
|
33
|
+
* @param rawValue - Optional raw value as it appeared in source (used by parser).
|
|
34
|
+
* If not provided, the printer will handle quoting/escaping.
|
|
35
|
+
* @param fromParser - Optional parser fields
|
|
36
|
+
*/
|
|
37
|
+
const string: (valueUnquoted: string, rawValue?: string, fromParser?: Partial<AstNodeParserFields>) => PromQLStringLiteral;
|
|
38
|
+
const time: (value: string, fromParser?: Partial<AstNodeParserFields>) => PromQLTimeValue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const identifier: (name: string, fromParser?: Partial<AstNodeParserFields>) => PromQLIdentifier;
|
|
42
|
+
const labelMap: (labels: PromQLLabel[], fromParser?: Partial<AstNodeParserFields>) => PromQLLabelMap;
|
|
43
|
+
const label: (labelName: PromQLLabelName, operator: PromQLLabelMatchOperator, value: PromQLStringLiteral | undefined, fromParser?: Partial<AstNodeParserFields>) => PromQLLabel;
|
|
44
|
+
const grouping: (kind: "by" | "without", labels: PromQLLabelName[], fromParser?: Partial<AstNodeParserFields>) => PromQLGrouping;
|
|
45
|
+
const modifier: (kind: "on" | "ignoring", labels: PromQLLabelName[], groupModifier?: PromQLGroupModifier, fromParser?: Partial<AstNodeParserFields>) => PromQLModifier;
|
|
46
|
+
const groupModifier: (kind: "group_left" | "group_right", labels: PromQLLabelName[], fromParser?: Partial<AstNodeParserFields>) => PromQLGroupModifier;
|
|
47
|
+
const evaluation: (offset?: PromQLOffset, at?: PromQLAt, fromParser?: Partial<AstNodeParserFields>) => PromQLEvaluation;
|
|
48
|
+
const offset: (duration: PromQLAstExpression, negative?: boolean, fromParser?: Partial<AstNodeParserFields>) => PromQLOffset;
|
|
49
|
+
const at: (value: PromQLTimeValue | PromQLAtModifier, negative?: boolean, fromParser?: Partial<AstNodeParserFields>) => PromQLAt;
|
|
50
|
+
const unknown: (fromParser?: Partial<AstNodeParserFields>) => PromQLUnknownItem;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../src/embedded_languages/promql/ast/builder/builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIrD,yBAAiB,aAAa,CAAC;IAC7B;;;OAGG;IACI,MAAM,YAAY,GAAI,kCAI1B,OAAO,CAAC,mBAAmB,CAAM,KAAG,mBAIrC,CAAC;IAEH,UAAiB,UAAU,CAAC;QACnB,MAAM,KAAK,GAChB,MAAM,mBAAmB,GAAG,SAAS,EACrC,aAAa,OAAO,CAAC,mBAAmB,CAAC,KACxC,wBAQF,CAAC;QAEK,MAAM,MAAM,GACjB,OAAO,mBAAmB,EAC1B,aAAa,OAAO,CAAC,mBAAmB,CAAC,KACxC,YAQF,CAAC;QAEF,UAAiB,IAAI,CAAC;YACb,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,MAAM,mBAAmB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aAAa,OAAO,CAAC,mBAAmB,CAAC,KACxC,QASF,CAAC;IAEK,MAAM,OAAO,GAAI,aAAa,OAAO,CAAC,mBAAmB,CAAC,KAAG,iBAOnE,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/embedded_languages/promql/ast/builder/index.ts"],"names":[],"mappings":"AAOA,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PromQLAstNode } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* The node *template* transforms PromQL AST nodes into a permissive shape, with
|
|
4
|
+
* the aim to:
|
|
5
|
+
*
|
|
6
|
+
* - Remove the `type` and `dialect` properties, as the builder will set them.
|
|
7
|
+
* - Make properties like `text`, `location`, and `incomplete` optional, as they
|
|
8
|
+
* are available only when the AST node is minted by the parser.
|
|
9
|
+
* - Make all other properties optional, for easy node creation.
|
|
10
|
+
*/
|
|
11
|
+
export type PromQLAstNodeTemplate<Node extends PromQLAstNode> = Omit<Node, 'type' | 'dialect' | 'text' | 'location' | 'incomplete'> & Partial<Omit<Node, 'type' | 'dialect'>>;
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/embedded_languages/promql/ast/builder/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,CAAC,IAAI,SAAS,aAAa,IAAI,IAAI,CAClE,IAAI,EACJ,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CACxD,GACC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../../src/embedded_languages/promql/ast/is.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,aACiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traversal.d.ts","sourceRoot":"","sources":["../../../../src/embedded_languages/promql/ast/traversal.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAiB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,CAmClF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/embedded_languages/promql/ast/walker/index.ts"],"names":[],"mappings":"AAOA,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ESQLProperNode } from '../../../../types';
|
|
2
|
+
import type * as promql from '../../types';
|
|
3
|
+
import type { PromqlWalker } from './walker';
|
|
4
|
+
export type PromqlWalkerVisitorApi = Pick<PromqlWalker, 'abort'>;
|
|
5
|
+
export type PromqlWalkerAstNode = promql.PromQLAstNode;
|
|
6
|
+
export type PromqlWalkerAstParent = ESQLProperNode | promql.PromQLAstNode | undefined;
|
|
7
|
+
export interface PromqlWalkerOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Called when visiting a PromQL query expression node.
|
|
10
|
+
*/
|
|
11
|
+
visitPromqlQuery?: (node: promql.PromQLAstQueryExpression, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Called when visiting a PromQL function node.
|
|
14
|
+
*/
|
|
15
|
+
visitPromqlFunction?: (node: promql.PromQLFunction, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Called when visiting a PromQL selector node (instant or range vector).
|
|
18
|
+
*/
|
|
19
|
+
visitPromqlSelector?: (node: promql.PromQLSelector, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Called when visiting a PromQL binary expression node.
|
|
22
|
+
*/
|
|
23
|
+
visitPromqlBinaryExpression?: (node: promql.PromQLBinaryExpression, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when visiting a PromQL unary expression node.
|
|
26
|
+
*/
|
|
27
|
+
visitPromqlUnaryExpression?: (node: promql.PromQLUnaryExpression, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Called when visiting a PromQL subquery node.
|
|
30
|
+
*/
|
|
31
|
+
visitPromqlSubquery?: (node: promql.PromQLSubquery, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Called when visiting a PromQL parenthesized expression node.
|
|
34
|
+
*/
|
|
35
|
+
visitPromqlParens?: (node: promql.PromQLParens, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when visiting a PromQL literal node (numeric, string, or time).
|
|
38
|
+
*/
|
|
39
|
+
visitPromqlLiteral?: (node: promql.PromQLLiteral, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Called when visiting a PromQL identifier node.
|
|
42
|
+
*/
|
|
43
|
+
visitPromqlIdentifier?: (node: promql.PromQLIdentifier, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when visiting a PromQL label map node.
|
|
46
|
+
*/
|
|
47
|
+
visitPromqlLabelMap?: (node: promql.PromQLLabelMap, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when visiting a PromQL label node.
|
|
50
|
+
*/
|
|
51
|
+
visitPromqlLabel?: (node: promql.PromQLLabel, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Called when visiting a PromQL grouping node (BY or WITHOUT).
|
|
54
|
+
*/
|
|
55
|
+
visitPromqlGrouping?: (node: promql.PromQLGrouping, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Called when visiting a PromQL evaluation modifier node (offset and @).
|
|
58
|
+
*/
|
|
59
|
+
visitPromqlEvaluation?: (node: promql.PromQLEvaluation, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Called when visiting a PromQL offset modifier node.
|
|
62
|
+
*/
|
|
63
|
+
visitPromqlOffset?: (node: promql.PromQLOffset, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Called when visiting a PromQL @ timestamp modifier node.
|
|
66
|
+
*/
|
|
67
|
+
visitPromqlAt?: (node: promql.PromQLAt, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Called when visiting a PromQL vector matching modifier node (on/ignoring).
|
|
70
|
+
*/
|
|
71
|
+
visitPromqlModifier?: (node: promql.PromQLModifier, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Called when visiting a PromQL group modifier node (group_left/group_right).
|
|
74
|
+
*/
|
|
75
|
+
visitPromqlGroupModifier?: (node: promql.PromQLGroupModifier, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Called when visiting a PromQL unknown item node.
|
|
78
|
+
*/
|
|
79
|
+
visitPromqlUnknown?: (node: promql.PromQLUnknownItem, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Called for any PromQL AST node type that does not have a specific visitor.
|
|
82
|
+
*/
|
|
83
|
+
visitPromqlAny?: (node: promql.PromQLAstNode, parent: PromqlWalkerAstParent, walker: PromqlWalkerVisitorApi) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Order in which to traverse child nodes. If set to 'forward', child nodes
|
|
86
|
+
* are traversed in the order they appear in the AST. If set to 'backward',
|
|
87
|
+
* child nodes are traversed in reverse order.
|
|
88
|
+
*
|
|
89
|
+
* @default 'forward'
|
|
90
|
+
*/
|
|
91
|
+
order?: 'forward' | 'backward';
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/embedded_languages/promql/ast/walker/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC;AACvD,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC;AAEtF,MAAM,WAAW,mBAAmB;IAGlC;;OAEG;IACH,gBAAgB,CAAC,EAAE,CACjB,IAAI,EAAE,MAAM,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B,IAAI,CAAC;IAEV;;OAEG;IACH,kBAAkB,CAAC,EAAE,CACnB,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAC9B,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,sBAAsB,KAC3B,IAAI,CAAC;IAIV;;OAEG;IACH,cAAc,CAAC,EAAE,CACf,IAAI,EAAE,MAAM,CAAC,aAAa,EAC1B,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,sBAAsB,KAC3B,IAAI,CAAC;IAEV;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CAChC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type * as promql from '../../types';
|
|
2
|
+
import type { PromqlWalkerAstNode, PromqlWalkerAstParent, PromqlWalkerOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Iterates over all PromQL AST nodes and calls the appropriate visitor
|
|
5
|
+
* functions.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PromqlWalker {
|
|
8
|
+
protected readonly options: PromqlWalkerOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Walks the AST and calls the appropriate visitor functions.
|
|
11
|
+
*/
|
|
12
|
+
static readonly walk: (tree: PromqlWalkerAstNode, options: PromqlWalkerOptions, parent?: PromqlWalkerAstParent) => PromqlWalker;
|
|
13
|
+
aborted: boolean;
|
|
14
|
+
constructor(options: PromqlWalkerOptions);
|
|
15
|
+
abort(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Walks a list of nodes in the order specified by the options.
|
|
18
|
+
*/
|
|
19
|
+
protected walkList<T extends promql.PromQLAstNode>(list: T[], parent: PromqlWalkerAstParent): void;
|
|
20
|
+
/**
|
|
21
|
+
* Walk a PromQL AST node and dispatch to the appropriate walk method.
|
|
22
|
+
*/
|
|
23
|
+
walk(node: promql.PromQLAstNode, parent?: PromqlWalkerAstParent): void;
|
|
24
|
+
walkPromqlQuery(node: promql.PromQLAstQueryExpression, parent: PromqlWalkerAstParent): void;
|
|
25
|
+
walkPromqlFunction(node: promql.PromQLFunction, parent: PromqlWalkerAstParent): void;
|
|
26
|
+
walkPromqlSelector(node: promql.PromQLSelector, parent: PromqlWalkerAstParent): void;
|
|
27
|
+
walkPromqlBinaryExpression(node: promql.PromQLBinaryExpression, parent: PromqlWalkerAstParent): void;
|
|
28
|
+
walkPromqlUnaryExpression(node: promql.PromQLUnaryExpression, parent: PromqlWalkerAstParent): void;
|
|
29
|
+
walkPromqlSubquery(node: promql.PromQLSubquery, parent: PromqlWalkerAstParent): void;
|
|
30
|
+
walkPromqlParens(node: promql.PromQLParens, parent: PromqlWalkerAstParent): void;
|
|
31
|
+
walkPromqlLiteral(node: promql.PromQLLiteral, parent: PromqlWalkerAstParent): void;
|
|
32
|
+
walkPromqlIdentifier(node: promql.PromQLIdentifier, parent: PromqlWalkerAstParent): void;
|
|
33
|
+
walkPromqlLabelMap(node: promql.PromQLLabelMap, parent: PromqlWalkerAstParent): void;
|
|
34
|
+
walkPromqlLabel(node: promql.PromQLLabel, parent: PromqlWalkerAstParent): void;
|
|
35
|
+
walkPromqlGrouping(node: promql.PromQLGrouping, parent: PromqlWalkerAstParent): void;
|
|
36
|
+
walkPromqlEvaluation(node: promql.PromQLEvaluation, parent: PromqlWalkerAstParent): void;
|
|
37
|
+
walkPromqlOffset(node: promql.PromQLOffset, parent: PromqlWalkerAstParent): void;
|
|
38
|
+
walkPromqlAt(node: promql.PromQLAt, parent: PromqlWalkerAstParent): void;
|
|
39
|
+
walkPromqlModifier(node: promql.PromQLModifier, parent: PromqlWalkerAstParent): void;
|
|
40
|
+
walkPromqlGroupModifier(node: promql.PromQLGroupModifier, parent: PromqlWalkerAstParent): void;
|
|
41
|
+
walkPromqlUnknown(node: promql.PromQLUnknownItem, parent: PromqlWalkerAstParent): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walker.d.ts","sour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
|
|
3
|
+
export type { PromQLAstNodeTemplate } from './ast/builder/types';
|
|
4
|
+
export { PromqlWalker, type PromqlWalkerOptions } from './ast/walker';
|
|
5
|
+
export { PromQLParser, type PromQLParseOptions } from './parser';
|
|
6
|
+
export { PromQLErrorListener } from './parser/promql_error_listener';
|
|
7
|
+
export { PromQLCstToAstConverter } from './parser/cst_to_ast_converter';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/embedded_languages/promql/index.ts"],"names":[],"mappings":"AAQA,mBAAmB,SAAS,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC"}
|