webpipe-js 2.0.16 → 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 +51 -2
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +51 -2
- package/package.json +1 -1
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
|
-
|
|
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();
|
|
@@ -947,9 +988,16 @@ var Parser = class {
|
|
|
947
988
|
let body;
|
|
948
989
|
let headers;
|
|
949
990
|
let cookies;
|
|
991
|
+
let firstWithClause = true;
|
|
950
992
|
while (true) {
|
|
951
993
|
const parsed = this.tryParse(() => {
|
|
952
|
-
|
|
994
|
+
if (firstWithClause) {
|
|
995
|
+
this.expect("with");
|
|
996
|
+
} else {
|
|
997
|
+
this.expect("and");
|
|
998
|
+
this.skipInlineSpaces();
|
|
999
|
+
this.expect("with");
|
|
1000
|
+
}
|
|
953
1001
|
this.skipInlineSpaces();
|
|
954
1002
|
if (this.text.startsWith("input", this.pos)) {
|
|
955
1003
|
this.expect("input");
|
|
@@ -986,6 +1034,7 @@ var Parser = class {
|
|
|
986
1034
|
else if (parsed.type === "body") body = parsed.value;
|
|
987
1035
|
else if (parsed.type === "headers") headers = parsed.value;
|
|
988
1036
|
else if (parsed.type === "cookies") cookies = parsed.value;
|
|
1037
|
+
firstWithClause = false;
|
|
989
1038
|
}
|
|
990
1039
|
const extraMocks = [];
|
|
991
1040
|
while (true) {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
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
|
-
|
|
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();
|
|
@@ -897,9 +938,16 @@ var Parser = class {
|
|
|
897
938
|
let body;
|
|
898
939
|
let headers;
|
|
899
940
|
let cookies;
|
|
941
|
+
let firstWithClause = true;
|
|
900
942
|
while (true) {
|
|
901
943
|
const parsed = this.tryParse(() => {
|
|
902
|
-
|
|
944
|
+
if (firstWithClause) {
|
|
945
|
+
this.expect("with");
|
|
946
|
+
} else {
|
|
947
|
+
this.expect("and");
|
|
948
|
+
this.skipInlineSpaces();
|
|
949
|
+
this.expect("with");
|
|
950
|
+
}
|
|
903
951
|
this.skipInlineSpaces();
|
|
904
952
|
if (this.text.startsWith("input", this.pos)) {
|
|
905
953
|
this.expect("input");
|
|
@@ -936,6 +984,7 @@ var Parser = class {
|
|
|
936
984
|
else if (parsed.type === "body") body = parsed.value;
|
|
937
985
|
else if (parsed.type === "headers") headers = parsed.value;
|
|
938
986
|
else if (parsed.type === "cookies") cookies = parsed.value;
|
|
987
|
+
firstWithClause = false;
|
|
939
988
|
}
|
|
940
989
|
const extraMocks = [];
|
|
941
990
|
while (true) {
|