@elastic/esql 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.mjs CHANGED
@@ -27034,6 +27034,8 @@ var TsInfoCommandVisitorContext = class extends CommandVisitorContext {
27034
27034
  };
27035
27035
  var MetricsInfoCommandVisitorContext = class extends CommandVisitorContext {
27036
27036
  };
27037
+ var DedupCommandVisitorContext = class extends CommandVisitorContext {
27038
+ };
27037
27039
  var UserAgentCommandVisitorContext = class extends CommandVisitorContext {
27038
27040
  };
27039
27041
  var ExpressionVisitorContext = class extends VisitorContext {
@@ -27313,6 +27315,10 @@ var GlobalVisitorContext = class {
27313
27315
  input
27314
27316
  );
27315
27317
  }
27318
+ case "dedup": {
27319
+ if (!this.methods.visitDedupCommand) break;
27320
+ return this.visitDedupCommand(parent, commandNode, input);
27321
+ }
27316
27322
  }
27317
27323
  return this.visitCommandGeneric(parent, commandNode, input);
27318
27324
  }
@@ -27455,6 +27461,10 @@ var GlobalVisitorContext = class {
27455
27461
  const context = new UserAgentCommandVisitorContext(this, node, parent);
27456
27462
  return this.visitWithSpecificContext("visitUserAgentCommand", context, input);
27457
27463
  }
27464
+ visitDedupCommand(parent, node, input) {
27465
+ const context = new DedupCommandVisitorContext(this, node, parent);
27466
+ return this.visitWithSpecificContext("visitDedupCommand", context, input);
27467
+ }
27458
27468
  // #endregion
27459
27469
  // #region Expression visiting -------------------------------------------------------
27460
27470
  visitExpressionGeneric(parent, node, input) {
@@ -28085,7 +28095,8 @@ var BasicPrettyPrinter = class _BasicPrettyPrinter {
28085
28095
  const formatOperand = (operand, index) => {
28086
28096
  const operandGroup = binaryExpressionGroup(operand);
28087
28097
  let formatted2 = ctx.visitArgument(index);
28088
- const shouldGroup = operandGroup && (operandGroup === 1 /* unknown */ || operandGroup < group2);
28098
+ const shouldGroup = operandGroup && (operandGroup === 1 /* unknown */ || operandGroup < group2 || // Right operand at same precedence needs parens for /, -, %
28099
+ index === 1 && operandGroup === group2 && (node.name === "/" || node.name === "-" || node.name === "%"));
28089
28100
  if (shouldGroup) {
28090
28101
  formatted2 = `(${formatted2})`;
28091
28102
  }
@@ -28294,7 +28305,8 @@ var WrappingPrettyPrinter = class _WrappingPrettyPrinter {
28294
28305
  const groupLeft = binaryExpressionGroup(left);
28295
28306
  const groupRight = binaryExpressionGroup(right);
28296
28307
  const doGroupLeft = groupLeft && groupLeft < group2;
28297
- const doGroupRight = groupRight && groupRight < group2;
28308
+ const doGroupRight = groupRight && (groupRight < group2 || // Right operand at same precedence needs parens for /, -, %
28309
+ groupRight === group2 && (node.name === "/" || node.name === "-" || node.name === "%"));
28298
28310
  const continueVerticalFlattening = group2 && inp.flattenBinExpOfType === group2;
28299
28311
  const suffix = inp.suffix ?? "";
28300
28312
  const oneArgumentPerLine = getPrettyPrintStats(left).hasLineBreakingDecorations || getPrettyPrintStats(right).hasLineBreakingDecorations;
@@ -62509,6 +62521,10 @@ var CstToAstConverter = class {
62509
62521
  if (userAgentCommandCtx) {
62510
62522
  return this.fromUserAgentCommand(userAgentCommandCtx);
62511
62523
  }
62524
+ const dedupCommandCtx = ctx.dedupCommand();
62525
+ if (dedupCommandCtx) {
62526
+ return this.fromDedupCommand(dedupCommandCtx);
62527
+ }
62512
62528
  }
62513
62529
  createCommand(name, ctx, partial) {
62514
62530
  const parserFields = this.getParserFields(ctx);
@@ -63792,6 +63808,10 @@ var CstToAstConverter = class {
63792
63808
  limitOption.location.max = limitValueCtx.stop?.stop ?? limitToken.symbol.stop;
63793
63809
  return limitOption;
63794
63810
  }
63811
+ // ---------------------------------------------------------------- DEDUP
63812
+ fromDedupCommand(ctx) {
63813
+ return this.createCommand("dedup", ctx);
63814
+ }
63795
63815
  // --------------------------------------------------------------- URI_PARTS
63796
63816
  fromUriPartsCommand(ctx) {
63797
63817
  return this.fromQualifiedNameAssignmentCommand("uri_parts", ctx);
@@ -67816,6 +67836,7 @@ export {
67816
67836
  CompletionCommandVisitorContext,
67817
67837
  ComposerQuery,
67818
67838
  DATE_PERIOD_UNITS,
67839
+ DedupCommandVisitorContext,
67819
67840
  DissectCommandVisitorContext,
67820
67841
  DropCommandVisitorContext,
67821
67842
  ESQLErrorListener,