webpipe-js 2.0.31 → 2.0.33

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/dist/index.cjs CHANGED
@@ -358,6 +358,7 @@ var Parser = class {
358
358
  throw new ParseFailure("step-config", this.pos);
359
359
  }
360
360
  parseTag() {
361
+ const start = this.pos;
361
362
  this.expect("@");
362
363
  const negated = this.cur() === "!";
363
364
  if (negated) this.pos++;
@@ -366,7 +367,8 @@ var Parser = class {
366
367
  if (this.cur() === "(") {
367
368
  args = this.parseTagArgs();
368
369
  }
369
- return { name, negated, args };
370
+ const end = this.pos;
371
+ return { name, negated, args, start, end };
370
372
  }
371
373
  parseTagArgs() {
372
374
  this.expect("(");
@@ -441,14 +443,17 @@ var Parser = class {
441
443
  }
442
444
  parseConfigProperty() {
443
445
  this.skipSpaces();
446
+ const start = this.pos;
444
447
  const key = this.parseIdentifier();
445
448
  this.skipInlineSpaces();
446
449
  this.expect(":");
447
450
  this.skipInlineSpaces();
448
451
  const value = this.parseConfigValue();
449
- return { key, value };
452
+ const end = this.pos;
453
+ return { key, value, start, end };
450
454
  }
451
455
  parseConfig() {
456
+ const start = this.pos;
452
457
  this.expect("config");
453
458
  this.skipInlineSpaces();
454
459
  const name = this.parseIdentifier();
@@ -466,7 +471,8 @@ var Parser = class {
466
471
  this.skipSpaces();
467
472
  this.expect("}");
468
473
  this.skipWhitespaceOnly();
469
- return { name, properties, inlineComment: inlineComment || void 0 };
474
+ const end = this.pos;
475
+ return { name, properties, inlineComment: inlineComment || void 0, start, end };
470
476
  }
471
477
  parsePipelineStep() {
472
478
  const result = this.tryParse(() => this.parseResultStep());
@@ -481,6 +487,7 @@ var Parser = class {
481
487
  }
482
488
  parseForeachStep() {
483
489
  this.skipWhitespaceOnly();
490
+ const start = this.pos;
484
491
  this.expect("|>");
485
492
  this.skipInlineSpaces();
486
493
  this.expect("foreach");
@@ -496,20 +503,25 @@ var Parser = class {
496
503
  const pipeline = this.parseIfPipeline("end");
497
504
  this.skipSpaces();
498
505
  this.expect("end");
499
- return { kind: "Foreach", selector, pipeline };
506
+ const end = this.pos;
507
+ return { kind: "Foreach", selector, pipeline, start, end };
500
508
  }
501
509
  parseRegularStep() {
502
510
  this.skipWhitespaceOnly();
511
+ const start = this.pos;
503
512
  this.expect("|>");
504
513
  this.skipInlineSpaces();
505
514
  const name = this.parseIdentifier();
515
+ const args = this.parseInlineArgs();
516
+ this.skipInlineSpaces();
506
517
  this.expect(":");
507
518
  this.skipInlineSpaces();
508
519
  const { config, configType } = this.parseStepConfig();
509
520
  const condition = this.parseStepCondition();
510
521
  const parsedJoinTargets = name === "join" ? this.parseJoinTaskNames(config) : void 0;
511
522
  this.skipWhitespaceOnly();
512
- return { kind: "Regular", name, config, configType, condition, parsedJoinTargets };
523
+ const end = this.pos;
524
+ return { kind: "Regular", name, args, config, configType, condition, parsedJoinTargets, start, end };
513
525
  }
514
526
  /**
515
527
  * Parse optional step condition (tag expression after the config)
@@ -563,8 +575,132 @@ var Parser = class {
563
575
  }
564
576
  return names;
565
577
  }
578
+ /**
579
+ * Split argument content by commas while respecting nesting depth and strings
580
+ * Example: `"url", {a:1, b:2}` -> [`"url"`, `{a:1, b:2}`]
581
+ */
582
+ splitBalancedArgs(content) {
583
+ const args = [];
584
+ let current = "";
585
+ let depth = 0;
586
+ let inString = false;
587
+ let stringChar = "";
588
+ let escapeNext = false;
589
+ for (let i = 0; i < content.length; i++) {
590
+ const ch = content[i];
591
+ if (escapeNext) {
592
+ current += ch;
593
+ escapeNext = false;
594
+ continue;
595
+ }
596
+ if (ch === "\\" && inString) {
597
+ current += ch;
598
+ escapeNext = true;
599
+ continue;
600
+ }
601
+ if ((ch === '"' || ch === "`") && !inString) {
602
+ inString = true;
603
+ stringChar = ch;
604
+ current += ch;
605
+ continue;
606
+ }
607
+ if (ch === stringChar && inString) {
608
+ inString = false;
609
+ stringChar = "";
610
+ current += ch;
611
+ continue;
612
+ }
613
+ if (inString) {
614
+ current += ch;
615
+ continue;
616
+ }
617
+ if (ch === "(" || ch === "[" || ch === "{") {
618
+ depth++;
619
+ current += ch;
620
+ } else if (ch === ")" || ch === "]" || ch === "}") {
621
+ depth--;
622
+ current += ch;
623
+ } else if (ch === "," && depth === 0) {
624
+ args.push(current.trim());
625
+ current = "";
626
+ } else {
627
+ current += ch;
628
+ }
629
+ }
630
+ if (current.trim().length > 0) {
631
+ args.push(current.trim());
632
+ }
633
+ return args;
634
+ }
635
+ /**
636
+ * Parse inline arguments: middleware(arg1, arg2) or middleware[arg1, arg2]
637
+ * Returns the array of argument strings and advances position past the closing bracket
638
+ */
639
+ parseInlineArgs() {
640
+ const trimmedStart = this.pos;
641
+ this.skipInlineSpaces();
642
+ const ch = this.cur();
643
+ if (ch !== "(" && ch !== "[") {
644
+ this.pos = trimmedStart;
645
+ return [];
646
+ }
647
+ const openChar = ch;
648
+ const closeChar = openChar === "(" ? ")" : "]";
649
+ this.pos++;
650
+ let depth = 1;
651
+ let inString = false;
652
+ let stringChar = "";
653
+ let escapeNext = false;
654
+ const contentStart = this.pos;
655
+ while (!this.eof() && depth > 0) {
656
+ const c = this.cur();
657
+ if (escapeNext) {
658
+ this.pos++;
659
+ escapeNext = false;
660
+ continue;
661
+ }
662
+ if (c === "\\" && inString) {
663
+ this.pos++;
664
+ escapeNext = true;
665
+ continue;
666
+ }
667
+ if ((c === '"' || c === "`") && !inString) {
668
+ inString = true;
669
+ stringChar = c;
670
+ this.pos++;
671
+ continue;
672
+ }
673
+ if (c === stringChar && inString) {
674
+ inString = false;
675
+ stringChar = "";
676
+ this.pos++;
677
+ continue;
678
+ }
679
+ if (!inString) {
680
+ if (c === openChar) {
681
+ depth++;
682
+ } else if (c === closeChar) {
683
+ depth--;
684
+ if (depth === 0) {
685
+ break;
686
+ }
687
+ }
688
+ }
689
+ this.pos++;
690
+ }
691
+ if (depth !== 0) {
692
+ throw new ParseFailure(`unclosed ${openChar}`, contentStart);
693
+ }
694
+ const argsContent = this.text.slice(contentStart, this.pos);
695
+ this.pos++;
696
+ if (argsContent.trim().length === 0) {
697
+ return [];
698
+ }
699
+ return this.splitBalancedArgs(argsContent);
700
+ }
566
701
  parseResultStep() {
567
702
  this.skipWhitespaceOnly();
703
+ const start = this.pos;
568
704
  this.expect("|>");
569
705
  this.skipInlineSpaces();
570
706
  this.expect("result");
@@ -575,10 +711,12 @@ var Parser = class {
575
711
  if (!br) break;
576
712
  branches.push(br);
577
713
  }
578
- return { kind: "Result", branches };
714
+ const end = this.pos;
715
+ return { kind: "Result", branches, start, end };
579
716
  }
580
717
  parseResultBranch() {
581
718
  this.skipSpaces();
719
+ const start = this.pos;
582
720
  const branchIdent = this.parseIdentifier();
583
721
  let branchType;
584
722
  if (branchIdent === "ok") branchType = { kind: "Ok" };
@@ -598,10 +736,12 @@ var Parser = class {
598
736
  this.expect(":");
599
737
  this.skipSpaces();
600
738
  const pipeline = this.parsePipeline();
601
- return { branchType, statusCode, pipeline };
739
+ const end = this.pos;
740
+ return { branchType, statusCode, pipeline, start, end };
602
741
  }
603
742
  parseIfStep() {
604
743
  this.skipWhitespaceOnly();
744
+ const start = this.pos;
605
745
  this.expect("|>");
606
746
  this.skipInlineSpaces();
607
747
  this.expect("if");
@@ -622,10 +762,12 @@ var Parser = class {
622
762
  this.expect("end");
623
763
  return true;
624
764
  });
625
- return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0 };
765
+ const end = this.pos;
766
+ return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0, start, end };
626
767
  }
627
768
  parseDispatchStep() {
628
769
  this.skipWhitespaceOnly();
770
+ const start = this.pos;
629
771
  this.expect("|>");
630
772
  this.skipInlineSpaces();
631
773
  this.expect("dispatch");
@@ -647,10 +789,12 @@ var Parser = class {
647
789
  this.expect("end");
648
790
  return true;
649
791
  });
650
- return { kind: "Dispatch", branches, default: defaultBranch || void 0 };
792
+ const end = this.pos;
793
+ return { kind: "Dispatch", branches, default: defaultBranch || void 0, start, end };
651
794
  }
652
795
  parseDispatchBranch() {
653
796
  this.skipSpaces();
797
+ const start = this.pos;
654
798
  this.expect("case");
655
799
  this.skipInlineSpaces();
656
800
  const condition = this.parseTagExpr();
@@ -658,7 +802,8 @@ var Parser = class {
658
802
  this.expect(":");
659
803
  this.skipSpaces();
660
804
  const pipeline = this.parseIfPipeline("case", "default:", "end");
661
- return { condition, pipeline };
805
+ const end = this.pos;
806
+ return { condition, pipeline, start, end };
662
807
  }
663
808
  /**
664
809
  * Parse a tag expression with boolean operators (and, or) and grouping
@@ -718,6 +863,7 @@ var Parser = class {
718
863
  return { kind: "Tag", tag };
719
864
  }
720
865
  parseIfPipeline(...stopKeywords) {
866
+ const start = this.pos;
721
867
  const steps = [];
722
868
  while (true) {
723
869
  const save = this.pos;
@@ -725,7 +871,8 @@ var Parser = class {
725
871
  for (const keyword of stopKeywords) {
726
872
  if (this.text.startsWith(keyword, this.pos)) {
727
873
  this.pos = save;
728
- return { steps };
874
+ const end2 = this.pos;
875
+ return { steps, start, end: end2 };
729
876
  }
730
877
  }
731
878
  if (!this.text.startsWith("|>", this.pos)) {
@@ -735,9 +882,11 @@ var Parser = class {
735
882
  const step = this.parsePipelineStep();
736
883
  steps.push(step);
737
884
  }
738
- return { steps };
885
+ const end = this.pos;
886
+ return { steps, start, end };
739
887
  }
740
888
  parsePipeline() {
889
+ const start = this.pos;
741
890
  const steps = [];
742
891
  while (true) {
743
892
  const save = this.pos;
@@ -749,7 +898,8 @@ var Parser = class {
749
898
  const step = this.parsePipelineStep();
750
899
  steps.push(step);
751
900
  }
752
- return { steps };
901
+ const end = this.pos;
902
+ return { steps, start, end };
753
903
  }
754
904
  parseNamedPipeline() {
755
905
  const start = this.pos;
@@ -760,24 +910,27 @@ var Parser = class {
760
910
  this.expect("=");
761
911
  const inlineComment = this.parseInlineComment();
762
912
  this.skipInlineSpaces();
763
- const beforePipeline = this.pos;
764
913
  const pipeline = this.parsePipeline();
765
914
  const end = this.pos;
766
915
  this.pipelineRanges.set(name, { start, end });
767
916
  this.skipWhitespaceOnly();
768
- return { name, pipeline, inlineComment: inlineComment || void 0 };
917
+ return { name, pipeline, inlineComment: inlineComment || void 0, start, end };
769
918
  }
770
919
  parsePipelineRef() {
771
920
  const inline = this.tryParse(() => this.parsePipeline());
772
- if (inline && inline.steps.length > 0) return { kind: "Inline", pipeline: inline };
921
+ if (inline && inline.steps.length > 0) {
922
+ return { kind: "Inline", pipeline: inline, start: inline.start, end: inline.end };
923
+ }
773
924
  const named = this.tryParse(() => {
774
925
  this.skipWhitespaceOnly();
926
+ const start = this.pos;
775
927
  this.expect("|>");
776
928
  this.skipInlineSpaces();
777
929
  this.expect("pipeline:");
778
930
  this.skipInlineSpaces();
779
931
  const name = this.parseIdentifier();
780
- return { kind: "Named", name };
932
+ const end = this.pos;
933
+ return { kind: "Named", name, start, end };
781
934
  });
782
935
  if (named) return named;
783
936
  throw new Error("pipeline-ref");
@@ -795,19 +948,22 @@ var Parser = class {
795
948
  const end = this.pos;
796
949
  this.variableRanges.set(`${varType}::${name}`, { start, end });
797
950
  this.skipWhitespaceOnly();
798
- return { varType, name, value, inlineComment: inlineComment || void 0 };
951
+ return { varType, name, value, inlineComment: inlineComment || void 0, start, end };
799
952
  }
800
953
  parseGraphQLSchema() {
954
+ const start = this.pos;
801
955
  this.expect("graphqlSchema");
802
956
  this.skipInlineSpaces();
803
957
  this.expect("=");
804
958
  const inlineComment = this.parseInlineComment();
805
959
  this.skipInlineSpaces();
806
960
  const sdl = this.parseBacktickString();
961
+ const end = this.pos;
807
962
  this.skipWhitespaceOnly();
808
- return { sdl, inlineComment: inlineComment || void 0 };
963
+ return { sdl, inlineComment: inlineComment || void 0, start, end };
809
964
  }
810
965
  parseQueryResolver() {
966
+ const start = this.pos;
811
967
  this.expect("query");
812
968
  this.skipInlineSpaces();
813
969
  const name = this.parseIdentifier();
@@ -816,10 +972,12 @@ var Parser = class {
816
972
  const inlineComment = this.parseInlineComment();
817
973
  this.skipWhitespaceOnly();
818
974
  const pipeline = this.parsePipeline();
975
+ const end = this.pos;
819
976
  this.skipWhitespaceOnly();
820
- return { name, pipeline, inlineComment: inlineComment || void 0 };
977
+ return { name, pipeline, inlineComment: inlineComment || void 0, start, end };
821
978
  }
822
979
  parseMutationResolver() {
980
+ const start = this.pos;
823
981
  this.expect("mutation");
824
982
  this.skipInlineSpaces();
825
983
  const name = this.parseIdentifier();
@@ -828,8 +986,9 @@ var Parser = class {
828
986
  const inlineComment = this.parseInlineComment();
829
987
  this.skipWhitespaceOnly();
830
988
  const pipeline = this.parsePipeline();
989
+ const end = this.pos;
831
990
  this.skipWhitespaceOnly();
832
- return { name, pipeline, inlineComment: inlineComment || void 0 };
991
+ return { name, pipeline, inlineComment: inlineComment || void 0, start, end };
833
992
  }
834
993
  parseFeatureFlags() {
835
994
  this.expect("featureFlags");
@@ -841,35 +1000,42 @@ var Parser = class {
841
1000
  return pipeline;
842
1001
  }
843
1002
  parseRoute() {
1003
+ const start = this.pos;
844
1004
  const method = this.parseMethod();
845
1005
  this.skipInlineSpaces();
846
1006
  const path = this.consumeWhile((c) => c !== " " && c !== "\n" && c !== "#");
847
1007
  const inlineComment = this.parseInlineComment();
848
1008
  this.skipSpaces();
849
1009
  const pipeline = this.parsePipelineRef();
1010
+ const end = this.pos;
850
1011
  this.skipWhitespaceOnly();
851
- return { method, path, pipeline, inlineComment: inlineComment || void 0 };
1012
+ return { method, path, pipeline, inlineComment: inlineComment || void 0, start, end };
852
1013
  }
853
1014
  parseWhen() {
854
1015
  const calling = this.tryParse(() => {
1016
+ const start = this.pos;
855
1017
  this.expect("calling");
856
1018
  this.skipInlineSpaces();
857
1019
  const method = this.parseMethod();
858
1020
  this.skipInlineSpaces();
859
1021
  const path = this.consumeWhile((c) => c !== "\n");
860
- return { kind: "CallingRoute", method, path };
1022
+ const end = this.pos;
1023
+ return { kind: "CallingRoute", method, path, start, end };
861
1024
  });
862
1025
  if (calling) return calling;
863
1026
  const executingPipeline = this.tryParse(() => {
1027
+ const start = this.pos;
864
1028
  this.expect("executing");
865
1029
  this.skipInlineSpaces();
866
1030
  this.expect("pipeline");
867
1031
  this.skipInlineSpaces();
868
1032
  const name = this.parseIdentifier();
869
- return { kind: "ExecutingPipeline", name };
1033
+ const end = this.pos;
1034
+ return { kind: "ExecutingPipeline", name, start, end };
870
1035
  });
871
1036
  if (executingPipeline) return executingPipeline;
872
1037
  const executingVariable = this.tryParse(() => {
1038
+ const start = this.pos;
873
1039
  this.expect("executing");
874
1040
  this.skipInlineSpaces();
875
1041
  this.expect("variable");
@@ -877,13 +1043,15 @@ var Parser = class {
877
1043
  const varType = this.parseIdentifier();
878
1044
  this.skipInlineSpaces();
879
1045
  const name = this.parseIdentifier();
880
- return { kind: "ExecutingVariable", varType, name };
1046
+ const end = this.pos;
1047
+ return { kind: "ExecutingVariable", varType, name, start, end };
881
1048
  });
882
1049
  if (executingVariable) return executingVariable;
883
1050
  throw new ParseFailure("when", this.pos);
884
1051
  }
885
1052
  parseCondition() {
886
1053
  this.skipSpaces();
1054
+ const start = this.pos;
887
1055
  const ct = (() => {
888
1056
  if (this.match("then")) return "Then";
889
1057
  if (this.match("and")) return "And";
@@ -916,13 +1084,16 @@ var Parser = class {
916
1084
  if (v2 !== null) return v2;
917
1085
  return this.consumeWhile((c) => c !== "\n");
918
1086
  })();
1087
+ const end2 = this.pos;
919
1088
  return {
920
1089
  conditionType: ct,
921
1090
  field: "call",
922
1091
  comparison: comparison2,
923
1092
  value: value2,
924
1093
  isCallAssertion: true,
925
- callTarget
1094
+ callTarget,
1095
+ start,
1096
+ end: end2
926
1097
  };
927
1098
  }
928
1099
  if (field === "selector") {
@@ -995,13 +1166,16 @@ var Parser = class {
995
1166
  } else {
996
1167
  throw new Error(`Unknown selector operation: ${operation}`);
997
1168
  }
1169
+ const end2 = this.pos;
998
1170
  return {
999
1171
  conditionType: ct,
1000
1172
  field: "selector",
1001
1173
  comparison: comparison2,
1002
1174
  value: value2,
1003
1175
  selector: selectorStr,
1004
- domAssert
1176
+ domAssert,
1177
+ start,
1178
+ end: end2
1005
1179
  };
1006
1180
  }
1007
1181
  let headerName;
@@ -1028,10 +1202,12 @@ var Parser = class {
1028
1202
  if (v2 !== null) return v2;
1029
1203
  return this.consumeWhile((c) => c !== "\n");
1030
1204
  })();
1031
- return { conditionType: ct, field, headerName: headerName ?? void 0, jqExpr: jqExpr ?? void 0, comparison, value };
1205
+ const end = this.pos;
1206
+ return { conditionType: ct, field, headerName: headerName ?? void 0, jqExpr: jqExpr ?? void 0, comparison, value, start, end };
1032
1207
  }
1033
1208
  parseMockHead(prefixWord) {
1034
1209
  this.skipSpaces();
1210
+ const start = this.pos;
1035
1211
  this.expect(prefixWord);
1036
1212
  this.skipInlineSpaces();
1037
1213
  this.expect("mock");
@@ -1050,7 +1226,8 @@ var Parser = class {
1050
1226
  this.skipInlineSpaces();
1051
1227
  const returnValue = this.parseBacktickString();
1052
1228
  this.skipSpaces();
1053
- return { target, returnValue };
1229
+ const end = this.pos;
1230
+ return { target, returnValue, start, end };
1054
1231
  }
1055
1232
  parseMock() {
1056
1233
  return this.parseMockHead("with");
@@ -1589,9 +1766,10 @@ function formatConfigValue(value) {
1589
1766
  }
1590
1767
  function formatPipelineStep(step, indent = " ") {
1591
1768
  if (step.kind === "Regular") {
1769
+ const argsPart = step.args.length > 0 ? `(${step.args.join(", ")})` : "";
1592
1770
  const configPart = formatStepConfig(step.config, step.configType);
1593
1771
  const conditionPart = step.condition ? " " + formatTagExpr(step.condition) : "";
1594
- return `${indent}|> ${step.name}: ${configPart}${conditionPart}`;
1772
+ return `${indent}|> ${step.name}${argsPart}: ${configPart}${conditionPart}`;
1595
1773
  } else if (step.kind === "Result") {
1596
1774
  const lines = [`${indent}|> result`];
1597
1775
  step.branches.forEach((branch) => {
package/dist/index.d.cts CHANGED
@@ -21,10 +21,14 @@ interface Config {
21
21
  properties: ConfigProperty[];
22
22
  lineNumber?: number;
23
23
  inlineComment?: Comment;
24
+ start: number;
25
+ end: number;
24
26
  }
25
27
  interface ConfigProperty {
26
28
  key: string;
27
29
  value: ConfigValue;
30
+ start: number;
31
+ end: number;
28
32
  }
29
33
  type ConfigValue = {
30
34
  kind: 'String';
@@ -45,6 +49,8 @@ interface NamedPipeline {
45
49
  pipeline: Pipeline;
46
50
  lineNumber?: number;
47
51
  inlineComment?: Comment;
52
+ start: number;
53
+ end: number;
48
54
  }
49
55
  interface Variable {
50
56
  varType: string;
@@ -52,23 +58,31 @@ interface Variable {
52
58
  value: string;
53
59
  lineNumber?: number;
54
60
  inlineComment?: Comment;
61
+ start: number;
62
+ end: number;
55
63
  }
56
64
  interface GraphQLSchema {
57
65
  sdl: string;
58
66
  lineNumber?: number;
59
67
  inlineComment?: Comment;
68
+ start: number;
69
+ end: number;
60
70
  }
61
71
  interface QueryResolver {
62
72
  name: string;
63
73
  pipeline: Pipeline;
64
74
  lineNumber?: number;
65
75
  inlineComment?: Comment;
76
+ start: number;
77
+ end: number;
66
78
  }
67
79
  interface MutationResolver {
68
80
  name: string;
69
81
  pipeline: Pipeline;
70
82
  lineNumber?: number;
71
83
  inlineComment?: Comment;
84
+ start: number;
85
+ end: number;
72
86
  }
73
87
  interface Route {
74
88
  method: string;
@@ -76,16 +90,24 @@ interface Route {
76
90
  pipeline: PipelineRef;
77
91
  lineNumber?: number;
78
92
  inlineComment?: Comment;
93
+ start: number;
94
+ end: number;
79
95
  }
80
96
  type PipelineRef = {
81
97
  kind: 'Inline';
82
98
  pipeline: Pipeline;
99
+ start: number;
100
+ end: number;
83
101
  } | {
84
102
  kind: 'Named';
85
103
  name: string;
104
+ start: number;
105
+ end: number;
86
106
  };
87
107
  interface Pipeline {
88
108
  steps: PipelineStep[];
109
+ start: number;
110
+ end: number;
89
111
  }
90
112
  type ConfigType = 'backtick' | 'quoted' | 'identifier';
91
113
  type LetValueFormat = 'quoted' | 'backtick' | 'bare';
@@ -102,6 +124,8 @@ interface Tag {
102
124
  name: string;
103
125
  negated: boolean;
104
126
  args: string[];
127
+ start: number;
128
+ end: number;
105
129
  }
106
130
  /** A boolean expression of tags for dispatch routing */
107
131
  type TagExpr = {
@@ -119,35 +143,50 @@ type TagExpr = {
119
143
  type PipelineStep = {
120
144
  kind: 'Regular';
121
145
  name: string;
146
+ args: string[];
122
147
  config: string;
123
148
  configType: ConfigType;
124
149
  condition?: TagExpr;
125
150
  parsedJoinTargets?: string[];
151
+ start: number;
152
+ end: number;
126
153
  } | {
127
154
  kind: 'Result';
128
155
  branches: ResultBranch[];
156
+ start: number;
157
+ end: number;
129
158
  } | {
130
159
  kind: 'If';
131
160
  condition: Pipeline;
132
161
  thenBranch: Pipeline;
133
162
  elseBranch?: Pipeline;
163
+ start: number;
164
+ end: number;
134
165
  } | {
135
166
  kind: 'Dispatch';
136
167
  branches: DispatchBranch[];
137
168
  default?: Pipeline;
169
+ start: number;
170
+ end: number;
138
171
  } | {
139
172
  kind: 'Foreach';
140
173
  selector: string;
141
174
  pipeline: Pipeline;
175
+ start: number;
176
+ end: number;
142
177
  };
143
178
  interface DispatchBranch {
144
179
  condition: TagExpr;
145
180
  pipeline: Pipeline;
181
+ start: number;
182
+ end: number;
146
183
  }
147
184
  interface ResultBranch {
148
185
  branchType: ResultBranchType;
149
186
  statusCode: number;
150
187
  pipeline: Pipeline;
188
+ start: number;
189
+ end: number;
151
190
  }
152
191
  type ResultBranchType = {
153
192
  kind: 'Ok';
@@ -170,6 +209,8 @@ interface Describe {
170
209
  interface Mock {
171
210
  target: string;
172
211
  returnValue: string;
212
+ start: number;
213
+ end: number;
173
214
  }
174
215
  interface It {
175
216
  name: string;
@@ -188,13 +229,19 @@ type When = {
188
229
  kind: 'CallingRoute';
189
230
  method: string;
190
231
  path: string;
232
+ start: number;
233
+ end: number;
191
234
  } | {
192
235
  kind: 'ExecutingPipeline';
193
236
  name: string;
237
+ start: number;
238
+ end: number;
194
239
  } | {
195
240
  kind: 'ExecutingVariable';
196
241
  varType: string;
197
242
  name: string;
243
+ start: number;
244
+ end: number;
198
245
  };
199
246
  type DomAssertType = {
200
247
  kind: 'Exists';
@@ -217,6 +264,8 @@ interface Condition {
217
264
  callTarget?: string;
218
265
  selector?: string;
219
266
  domAssert?: DomAssertType;
267
+ start: number;
268
+ end: number;
220
269
  }
221
270
  type DiagnosticSeverity = 'error' | 'warning' | 'info';
222
271
  interface ParseDiagnostic {