@elastic/esql 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ast/visitor/contexts.d.ts +3 -1
- package/lib/ast/visitor/contexts.d.ts.map +1 -1
- package/lib/ast/visitor/global_visitor_context.d.ts +2 -1
- package/lib/ast/visitor/global_visitor_context.d.ts.map +1 -1
- package/lib/ast/visitor/types.d.ts +3 -2
- package/lib/ast/visitor/types.d.ts.map +1 -1
- package/lib/index.js +91 -12
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +90 -12
- package/lib/index.mjs.map +1 -1
- package/lib/parser/core/cst_to_ast_converter.d.ts +7 -1
- package/lib/parser/core/cst_to_ast_converter.d.ts.map +1 -1
- package/lib/types.d.ts +6 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +8 -8
package/lib/index.mjs
CHANGED
|
@@ -25888,6 +25888,8 @@ var TsInfoCommandVisitorContext = class extends CommandVisitorContext {
|
|
|
25888
25888
|
};
|
|
25889
25889
|
var MetricsInfoCommandVisitorContext = class extends CommandVisitorContext {
|
|
25890
25890
|
};
|
|
25891
|
+
var UserAgentCommandVisitorContext = class extends CommandVisitorContext {
|
|
25892
|
+
};
|
|
25891
25893
|
var ExpressionVisitorContext = class extends VisitorContext {
|
|
25892
25894
|
};
|
|
25893
25895
|
var ColumnExpressionVisitorContext = class extends VisitorContext {
|
|
@@ -26157,6 +26159,14 @@ var GlobalVisitorContext = class {
|
|
|
26157
26159
|
input
|
|
26158
26160
|
);
|
|
26159
26161
|
}
|
|
26162
|
+
case "user_agent": {
|
|
26163
|
+
if (!this.methods.visitUserAgentCommand) break;
|
|
26164
|
+
return this.visitUserAgentCommand(
|
|
26165
|
+
parent,
|
|
26166
|
+
commandNode,
|
|
26167
|
+
input
|
|
26168
|
+
);
|
|
26169
|
+
}
|
|
26160
26170
|
}
|
|
26161
26171
|
return this.visitCommandGeneric(parent, commandNode, input);
|
|
26162
26172
|
}
|
|
@@ -26295,6 +26305,10 @@ var GlobalVisitorContext = class {
|
|
|
26295
26305
|
const context = new MetricsInfoCommandVisitorContext(this, node, parent);
|
|
26296
26306
|
return this.visitWithSpecificContext("visitMetricsInfoCommand", context, input);
|
|
26297
26307
|
}
|
|
26308
|
+
visitUserAgentCommand(parent, node, input) {
|
|
26309
|
+
const context = new UserAgentCommandVisitorContext(this, node, parent);
|
|
26310
|
+
return this.visitWithSpecificContext("visitUserAgentCommand", context, input);
|
|
26311
|
+
}
|
|
26298
26312
|
// #endregion
|
|
26299
26313
|
// #region Expression visiting -------------------------------------------------------
|
|
26300
26314
|
visitExpressionGeneric(parent, node, input) {
|
|
@@ -60499,6 +60513,10 @@ var CstToAstConverter = class {
|
|
|
60499
60513
|
if (metricsInfoCommandCtx) {
|
|
60500
60514
|
return this.fromMetricsInfoCommand(metricsInfoCommandCtx);
|
|
60501
60515
|
}
|
|
60516
|
+
const userAgentCommandCtx = ctx.userAgentCommand();
|
|
60517
|
+
if (userAgentCommandCtx) {
|
|
60518
|
+
return this.fromUserAgentCommand(userAgentCommandCtx);
|
|
60519
|
+
}
|
|
60502
60520
|
}
|
|
60503
60521
|
createCommand(name, ctx, partial) {
|
|
60504
60522
|
const parserFields = this.getParserFields(ctx);
|
|
@@ -61704,7 +61722,7 @@ var CstToAstConverter = class {
|
|
|
61704
61722
|
const limitOption = this.fromMmrLimitOption(ctx);
|
|
61705
61723
|
if (limitOption) args.push(limitOption);
|
|
61706
61724
|
const limit = limitOption ? limitOption.args[0] : void 0;
|
|
61707
|
-
const withOption = this.
|
|
61725
|
+
const withOption = this.fromOptionalNamedParametersWithOption(ctx.commandNamedParameters());
|
|
61708
61726
|
if (withOption) args.push(withOption);
|
|
61709
61727
|
const namedParameters = withOption ? withOption.args[0] : void 0;
|
|
61710
61728
|
const command2 = this.createCommand("mmr", ctx, {
|
|
@@ -61760,17 +61778,6 @@ var CstToAstConverter = class {
|
|
|
61760
61778
|
limitOption.location.max = limitValueCtx.stop?.stop ?? limitToken.symbol.stop;
|
|
61761
61779
|
return limitOption;
|
|
61762
61780
|
}
|
|
61763
|
-
fromMmrWithOption(namedParametersCtx) {
|
|
61764
|
-
if (!namedParametersCtx) return;
|
|
61765
|
-
const withOption = this.fromCommandNamedParameters(namedParametersCtx);
|
|
61766
|
-
const mapArg = withOption.args[0];
|
|
61767
|
-
if (mapArg) {
|
|
61768
|
-
const incomplete = mapArg.entries.some((entry) => entry.incomplete) || mapArg.entries.length === 0;
|
|
61769
|
-
mapArg.incomplete = incomplete;
|
|
61770
|
-
withOption.incomplete = incomplete;
|
|
61771
|
-
return withOption;
|
|
61772
|
-
}
|
|
61773
|
-
}
|
|
61774
61781
|
// --------------------------------------------------------------- URI_PARTS
|
|
61775
61782
|
fromUriPartsCommand(ctx) {
|
|
61776
61783
|
return this.fromQualifiedNameAssignmentCommand("uri_parts", ctx);
|
|
@@ -61811,6 +61818,58 @@ var CstToAstConverter = class {
|
|
|
61811
61818
|
fromMetricsInfoCommand(ctx) {
|
|
61812
61819
|
return this.createCommand("metrics_info", ctx);
|
|
61813
61820
|
}
|
|
61821
|
+
// --------------------------------------------------------------- USER_AGENT
|
|
61822
|
+
fromUserAgentCommand(ctx) {
|
|
61823
|
+
const args = [];
|
|
61824
|
+
const qualifiedNameCtx = ctx.qualifiedName();
|
|
61825
|
+
let targetField;
|
|
61826
|
+
let expression2;
|
|
61827
|
+
if (qualifiedNameCtx && ctx.ASSIGN()) {
|
|
61828
|
+
targetField = this.toColumn(qualifiedNameCtx);
|
|
61829
|
+
expression2 = this.fromPrimaryExpressionStrict(ctx.primaryExpression());
|
|
61830
|
+
const assignment = this.toFunction(
|
|
61831
|
+
ctx.ASSIGN().getText(),
|
|
61832
|
+
ctx,
|
|
61833
|
+
void 0,
|
|
61834
|
+
"binary-expression"
|
|
61835
|
+
);
|
|
61836
|
+
assignment.args.push(targetField, expression2);
|
|
61837
|
+
assignment.location = this.extendLocationToArgs(assignment);
|
|
61838
|
+
args.push(assignment);
|
|
61839
|
+
} else if (qualifiedNameCtx) {
|
|
61840
|
+
targetField = this.toColumn(qualifiedNameCtx);
|
|
61841
|
+
args.push(targetField);
|
|
61842
|
+
}
|
|
61843
|
+
const withOption = this.fromOptionalNamedParametersWithOption(ctx.commandNamedParameters());
|
|
61844
|
+
if (withOption) {
|
|
61845
|
+
args.push(withOption);
|
|
61846
|
+
}
|
|
61847
|
+
const namedParameters = withOption?.args[0];
|
|
61848
|
+
const command2 = this.createCommand(
|
|
61849
|
+
"user_agent",
|
|
61850
|
+
ctx,
|
|
61851
|
+
{
|
|
61852
|
+
args,
|
|
61853
|
+
...namedParameters ? { namedParameters } : {}
|
|
61854
|
+
}
|
|
61855
|
+
);
|
|
61856
|
+
if (targetField) {
|
|
61857
|
+
command2.targetField = targetField;
|
|
61858
|
+
}
|
|
61859
|
+
if (expression2) {
|
|
61860
|
+
command2.expression = expression2;
|
|
61861
|
+
}
|
|
61862
|
+
if (qualifiedNameCtx && ctx.ASSIGN()) {
|
|
61863
|
+
if (expression2 && (expression2.incomplete || expression2.type === "unknown")) {
|
|
61864
|
+
expression2.incomplete = true;
|
|
61865
|
+
command2.incomplete = true;
|
|
61866
|
+
}
|
|
61867
|
+
} else if (qualifiedNameCtx) {
|
|
61868
|
+
command2.incomplete = true;
|
|
61869
|
+
}
|
|
61870
|
+
command2.incomplete ||= withOption?.incomplete ?? false;
|
|
61871
|
+
return command2;
|
|
61872
|
+
}
|
|
61814
61873
|
// -------------------------------------------------------------- expressions
|
|
61815
61874
|
toColumnsFromCommand(ctx) {
|
|
61816
61875
|
if (ctx instanceof MetadataContext) {
|
|
@@ -61970,6 +62029,24 @@ var CstToAstConverter = class {
|
|
|
61970
62029
|
withOption.incomplete = map.incomplete;
|
|
61971
62030
|
return withOption;
|
|
61972
62031
|
}
|
|
62032
|
+
/**
|
|
62033
|
+
* Optional `WITH { ... }` from the `commandNamedParameters` rule. Returns undefined when
|
|
62034
|
+
* there is no map (e.g. missing `WITH`). When a map is present, propagates incomplete
|
|
62035
|
+
* state if any entry is incomplete or the map has no entries.
|
|
62036
|
+
*/
|
|
62037
|
+
fromOptionalNamedParametersWithOption(namedParametersCtx) {
|
|
62038
|
+
if (!namedParametersCtx) {
|
|
62039
|
+
return;
|
|
62040
|
+
}
|
|
62041
|
+
const withOption = this.fromCommandNamedParameters(namedParametersCtx);
|
|
62042
|
+
const mapArg = withOption.args[0];
|
|
62043
|
+
if (mapArg) {
|
|
62044
|
+
const incomplete = mapArg.entries.some((entry) => entry.incomplete) || mapArg.entries.length === 0;
|
|
62045
|
+
mapArg.incomplete = incomplete;
|
|
62046
|
+
withOption.incomplete = incomplete;
|
|
62047
|
+
return withOption;
|
|
62048
|
+
}
|
|
62049
|
+
}
|
|
61973
62050
|
collectInlineCast(ctx) {
|
|
61974
62051
|
const value = this.fromPrimaryExpressionStrict(ctx.primaryExpression());
|
|
61975
62052
|
return Builder.expression.inlineCast(
|
|
@@ -65569,6 +65646,7 @@ export {
|
|
|
65569
65646
|
TsInfoCommandVisitorContext,
|
|
65570
65647
|
UnaryExpressionGroup,
|
|
65571
65648
|
UriPartsCommandVisitorContext,
|
|
65649
|
+
UserAgentCommandVisitorContext,
|
|
65572
65650
|
Visitor,
|
|
65573
65651
|
VisitorContext,
|
|
65574
65652
|
Walker,
|