webpipe-js 2.0.17 → 2.0.18

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
@@ -879,6 +879,39 @@ var Parser = class {
879
879
  this.skipInlineSpaces();
880
880
  const field = this.consumeWhile((c) => c !== " " && c !== "\n" && c !== "`");
881
881
  this.skipInlineSpaces();
882
+ if (field === "call") {
883
+ const callType = this.consumeWhile((c) => c !== " ");
884
+ this.skipInlineSpaces();
885
+ const callName = this.consumeWhile((c) => c !== " " && c !== "\n");
886
+ const callTarget = `${callType}.${callName}`;
887
+ this.skipInlineSpaces();
888
+ let comparison2;
889
+ if (this.text.startsWith("with arguments", this.pos)) {
890
+ this.pos += 14;
891
+ comparison2 = "with arguments";
892
+ } else if (this.text.startsWith("with", this.pos)) {
893
+ this.pos += 4;
894
+ comparison2 = "with";
895
+ } else {
896
+ throw new Error('expected "with" or "with arguments"');
897
+ }
898
+ this.skipInlineSpaces();
899
+ const value2 = (() => {
900
+ const v1 = this.tryParse(() => this.parseBacktickString());
901
+ if (v1 !== null) return v1;
902
+ const v2 = this.tryParse(() => this.parseQuotedString());
903
+ if (v2 !== null) return v2;
904
+ return this.consumeWhile((c) => c !== "\n");
905
+ })();
906
+ return {
907
+ conditionType: ct,
908
+ field: "call",
909
+ comparison: comparison2,
910
+ value: value2,
911
+ isCallAssertion: true,
912
+ callTarget
913
+ };
914
+ }
882
915
  let headerName;
883
916
  if (field === "header") {
884
917
  const h1 = this.tryParse(() => this.parseBacktickString());
@@ -911,7 +944,15 @@ var Parser = class {
911
944
  this.skipInlineSpaces();
912
945
  this.expect("mock");
913
946
  this.skipInlineSpaces();
914
- const target = this.consumeWhile((c) => c !== " " && c !== "\n");
947
+ let target;
948
+ if (this.text.startsWith("query ", this.pos) || this.text.startsWith("mutation ", this.pos)) {
949
+ const type = this.consumeWhile((c) => c !== " ");
950
+ this.skipInlineSpaces();
951
+ const name = this.consumeWhile((c) => c !== " " && c !== "\n");
952
+ target = `${type}.${name}`;
953
+ } else {
954
+ target = this.consumeWhile((c) => c !== " " && c !== "\n");
955
+ }
915
956
  this.skipInlineSpaces();
916
957
  this.expect("returning");
917
958
  this.skipInlineSpaces();
package/dist/index.d.cts CHANGED
@@ -187,6 +187,8 @@ interface Condition {
187
187
  jqExpr?: string;
188
188
  comparison: string;
189
189
  value: string;
190
+ isCallAssertion?: boolean;
191
+ callTarget?: string;
190
192
  }
191
193
  type DiagnosticSeverity = 'error' | 'warning' | 'info';
192
194
  interface ParseDiagnostic {
package/dist/index.d.ts CHANGED
@@ -187,6 +187,8 @@ interface Condition {
187
187
  jqExpr?: string;
188
188
  comparison: string;
189
189
  value: string;
190
+ isCallAssertion?: boolean;
191
+ callTarget?: string;
190
192
  }
191
193
  type DiagnosticSeverity = 'error' | 'warning' | 'info';
192
194
  interface ParseDiagnostic {
package/dist/index.mjs CHANGED
@@ -829,6 +829,39 @@ var Parser = class {
829
829
  this.skipInlineSpaces();
830
830
  const field = this.consumeWhile((c) => c !== " " && c !== "\n" && c !== "`");
831
831
  this.skipInlineSpaces();
832
+ if (field === "call") {
833
+ const callType = this.consumeWhile((c) => c !== " ");
834
+ this.skipInlineSpaces();
835
+ const callName = this.consumeWhile((c) => c !== " " && c !== "\n");
836
+ const callTarget = `${callType}.${callName}`;
837
+ this.skipInlineSpaces();
838
+ let comparison2;
839
+ if (this.text.startsWith("with arguments", this.pos)) {
840
+ this.pos += 14;
841
+ comparison2 = "with arguments";
842
+ } else if (this.text.startsWith("with", this.pos)) {
843
+ this.pos += 4;
844
+ comparison2 = "with";
845
+ } else {
846
+ throw new Error('expected "with" or "with arguments"');
847
+ }
848
+ this.skipInlineSpaces();
849
+ const value2 = (() => {
850
+ const v1 = this.tryParse(() => this.parseBacktickString());
851
+ if (v1 !== null) return v1;
852
+ const v2 = this.tryParse(() => this.parseQuotedString());
853
+ if (v2 !== null) return v2;
854
+ return this.consumeWhile((c) => c !== "\n");
855
+ })();
856
+ return {
857
+ conditionType: ct,
858
+ field: "call",
859
+ comparison: comparison2,
860
+ value: value2,
861
+ isCallAssertion: true,
862
+ callTarget
863
+ };
864
+ }
832
865
  let headerName;
833
866
  if (field === "header") {
834
867
  const h1 = this.tryParse(() => this.parseBacktickString());
@@ -861,7 +894,15 @@ var Parser = class {
861
894
  this.skipInlineSpaces();
862
895
  this.expect("mock");
863
896
  this.skipInlineSpaces();
864
- const target = this.consumeWhile((c) => c !== " " && c !== "\n");
897
+ let target;
898
+ if (this.text.startsWith("query ", this.pos) || this.text.startsWith("mutation ", this.pos)) {
899
+ const type = this.consumeWhile((c) => c !== " ");
900
+ this.skipInlineSpaces();
901
+ const name = this.consumeWhile((c) => c !== " " && c !== "\n");
902
+ target = `${type}.${name}`;
903
+ } else {
904
+ target = this.consumeWhile((c) => c !== " " && c !== "\n");
905
+ }
865
906
  this.skipInlineSpaces();
866
907
  this.expect("returning");
867
908
  this.skipInlineSpaces();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",