webpipe-js 2.0.17 → 2.0.19
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 +53 -9
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +53 -9
- 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();
|
|
@@ -1020,17 +1061,20 @@ var Parser = class {
|
|
|
1020
1061
|
const inlineComment = this.parseInlineComment();
|
|
1021
1062
|
this.skipSpaces();
|
|
1022
1063
|
const mocks = [];
|
|
1023
|
-
while (true) {
|
|
1024
|
-
const m = this.tryParse(() => this.parseMock());
|
|
1025
|
-
if (!m) break;
|
|
1026
|
-
mocks.push(m);
|
|
1027
|
-
this.skipSpaces();
|
|
1028
|
-
}
|
|
1029
1064
|
const tests = [];
|
|
1030
1065
|
while (true) {
|
|
1066
|
+
this.skipSpaces();
|
|
1067
|
+
const m = this.tryParse(() => this.parseMock());
|
|
1068
|
+
if (m) {
|
|
1069
|
+
mocks.push(m);
|
|
1070
|
+
continue;
|
|
1071
|
+
}
|
|
1031
1072
|
const it = this.tryParse(() => this.parseIt());
|
|
1032
|
-
if (
|
|
1033
|
-
|
|
1073
|
+
if (it) {
|
|
1074
|
+
tests.push(it);
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1077
|
+
break;
|
|
1034
1078
|
}
|
|
1035
1079
|
return { name, mocks, tests, inlineComment: inlineComment || void 0 };
|
|
1036
1080
|
}
|
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();
|
|
@@ -970,17 +1011,20 @@ var Parser = class {
|
|
|
970
1011
|
const inlineComment = this.parseInlineComment();
|
|
971
1012
|
this.skipSpaces();
|
|
972
1013
|
const mocks = [];
|
|
973
|
-
while (true) {
|
|
974
|
-
const m = this.tryParse(() => this.parseMock());
|
|
975
|
-
if (!m) break;
|
|
976
|
-
mocks.push(m);
|
|
977
|
-
this.skipSpaces();
|
|
978
|
-
}
|
|
979
1014
|
const tests = [];
|
|
980
1015
|
while (true) {
|
|
1016
|
+
this.skipSpaces();
|
|
1017
|
+
const m = this.tryParse(() => this.parseMock());
|
|
1018
|
+
if (m) {
|
|
1019
|
+
mocks.push(m);
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
981
1022
|
const it = this.tryParse(() => this.parseIt());
|
|
982
|
-
if (
|
|
983
|
-
|
|
1023
|
+
if (it) {
|
|
1024
|
+
tests.push(it);
|
|
1025
|
+
continue;
|
|
1026
|
+
}
|
|
1027
|
+
break;
|
|
984
1028
|
}
|
|
985
1029
|
return { name, mocks, tests, inlineComment: inlineComment || void 0 };
|
|
986
1030
|
}
|