msw 0.0.0-fetch.rc-19 → 0.0.0-fetch.rc-20

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.
Files changed (42) hide show
  1. package/lib/browser/index.js +2 -2
  2. package/lib/browser/index.mjs +2 -2
  3. package/lib/core/{GraphQLHandler-2e60cda6.d.ts → GraphQLHandler-ef45ae39.d.ts} +2 -2
  4. package/lib/core/HttpResponse.d.ts +1 -1
  5. package/lib/core/{RequestHandler-e964183f.d.ts → RequestHandler-7c716cf7.d.ts} +8 -7
  6. package/lib/core/SetupApi.d.ts +1 -1
  7. package/lib/core/bypass.d.ts +5 -7
  8. package/lib/core/bypass.js +10 -68
  9. package/lib/core/bypass.mjs +10 -68
  10. package/lib/core/graphql.d.ts +6 -6
  11. package/lib/core/graphql.js +8 -2
  12. package/lib/core/graphql.mjs +8 -2
  13. package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
  14. package/lib/core/handlers/GraphQLHandler.js +3 -2
  15. package/lib/core/handlers/GraphQLHandler.mjs +3 -2
  16. package/lib/core/handlers/HttpHandler.d.ts +2 -2
  17. package/lib/core/handlers/HttpHandler.js +1 -1
  18. package/lib/core/handlers/HttpHandler.mjs +1 -1
  19. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  20. package/lib/core/handlers/RequestHandler.js +6 -5
  21. package/lib/core/handlers/RequestHandler.mjs +6 -5
  22. package/lib/core/http.d.ts +9 -9
  23. package/lib/core/index.d.ts +2 -2
  24. package/lib/core/sharedOptions.d.ts +1 -1
  25. package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
  26. package/lib/core/utils/getResponse.d.ts +1 -1
  27. package/lib/core/utils/handleRequest.d.ts +1 -1
  28. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
  29. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  30. package/lib/core/utils/internal/requestHandlerUtils.d.ts +2 -2
  31. package/lib/core/utils/logging/serializeRequest.d.ts +1 -3
  32. package/lib/core/utils/logging/serializeRequest.js +1 -2
  33. package/lib/core/utils/logging/serializeRequest.mjs +1 -2
  34. package/lib/core/utils/logging/serializeResponse.d.ts +1 -3
  35. package/lib/core/utils/logging/serializeResponse.js +1 -2
  36. package/lib/core/utils/logging/serializeResponse.mjs +1 -2
  37. package/lib/core/utils/request/onUnhandledRequest.d.ts +1 -1
  38. package/lib/core/utils/toResponseInit.js +1 -2
  39. package/lib/core/utils/toResponseInit.mjs +1 -2
  40. package/lib/iife/index.js +818 -871
  41. package/lib/mockServiceWorker.js +3 -16
  42. package/package.json +4 -4
package/lib/iife/index.js CHANGED
@@ -504,11 +504,11 @@ var MockServiceWorker = (() => {
504
504
 
505
505
  // src/core/handlers/RequestHandler.ts
506
506
  var RequestHandler = class {
507
- constructor(options) {
508
- this.resolver = options.resolver;
509
- this.once = options.once || false;
507
+ constructor(args) {
508
+ this.resolver = args.resolver;
509
+ this.options = args.options;
510
510
  const callFrame = getCallFrame(new Error());
511
- this.info = __spreadProps(__spreadValues({}, options.info), {
511
+ this.info = __spreadProps(__spreadValues({}, args.info), {
512
512
  callFrame
513
513
  });
514
514
  this.isUsed = false;
@@ -543,7 +543,8 @@ var MockServiceWorker = (() => {
543
543
  */
544
544
  run(request, resolutionContext) {
545
545
  return __async(this, null, function* () {
546
- if (this.isUsed && this.once) {
546
+ var _a3;
547
+ if (this.isUsed && ((_a3 = this.options) == null ? void 0 : _a3.once)) {
547
548
  return null;
548
549
  }
549
550
  const mainRequestRef = request.clone();
@@ -635,7 +636,21 @@ var MockServiceWorker = (() => {
635
636
  return [now.getHours(), now.getMinutes(), now.getSeconds()].map(String).map((chunk) => chunk.slice(0, 2)).map((chunk) => chunk.padStart(2, "0")).join(":");
636
637
  }
637
638
 
638
- // node_modules/.pnpm/headers-polyfill@3.2.3/node_modules/headers-polyfill/lib/index.mjs
639
+ // src/core/utils/logging/serializeRequest.ts
640
+ function serializeRequest(request) {
641
+ return __async(this, null, function* () {
642
+ const requestClone = request.clone();
643
+ const requestText = yield requestClone.text();
644
+ return {
645
+ url: new URL(request.url),
646
+ method: request.method,
647
+ headers: Object.fromEntries(request.headers.entries()),
648
+ body: requestText
649
+ };
650
+ });
651
+ }
652
+
653
+ // node_modules/.pnpm/@bundled-es-modules+statuses@1.0.1/node_modules/@bundled-es-modules/statuses/index-esm.js
639
654
  var __create = Object.create;
640
655
  var __defProp2 = Object.defineProperty;
641
656
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -654,675 +669,316 @@ var MockServiceWorker = (() => {
654
669
  return to;
655
670
  };
656
671
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
672
+ // If the importer is in node compatibility mode or this is not an ESM
673
+ // file that has been converted to a CommonJS file using a Babel-
674
+ // compatible transform (i.e. "__esModule" has not been set), then set
675
+ // "default" to the CommonJS "module.exports" for node compatibility.
657
676
  isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
658
677
  mod
659
678
  ));
660
- var require_set_cookie = __commonJS({
661
- "node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
679
+ var require_codes = __commonJS({
680
+ "node_modules/statuses/codes.json"(exports, module) {
681
+ module.exports = {
682
+ "100": "Continue",
683
+ "101": "Switching Protocols",
684
+ "102": "Processing",
685
+ "103": "Early Hints",
686
+ "200": "OK",
687
+ "201": "Created",
688
+ "202": "Accepted",
689
+ "203": "Non-Authoritative Information",
690
+ "204": "No Content",
691
+ "205": "Reset Content",
692
+ "206": "Partial Content",
693
+ "207": "Multi-Status",
694
+ "208": "Already Reported",
695
+ "226": "IM Used",
696
+ "300": "Multiple Choices",
697
+ "301": "Moved Permanently",
698
+ "302": "Found",
699
+ "303": "See Other",
700
+ "304": "Not Modified",
701
+ "305": "Use Proxy",
702
+ "307": "Temporary Redirect",
703
+ "308": "Permanent Redirect",
704
+ "400": "Bad Request",
705
+ "401": "Unauthorized",
706
+ "402": "Payment Required",
707
+ "403": "Forbidden",
708
+ "404": "Not Found",
709
+ "405": "Method Not Allowed",
710
+ "406": "Not Acceptable",
711
+ "407": "Proxy Authentication Required",
712
+ "408": "Request Timeout",
713
+ "409": "Conflict",
714
+ "410": "Gone",
715
+ "411": "Length Required",
716
+ "412": "Precondition Failed",
717
+ "413": "Payload Too Large",
718
+ "414": "URI Too Long",
719
+ "415": "Unsupported Media Type",
720
+ "416": "Range Not Satisfiable",
721
+ "417": "Expectation Failed",
722
+ "418": "I'm a Teapot",
723
+ "421": "Misdirected Request",
724
+ "422": "Unprocessable Entity",
725
+ "423": "Locked",
726
+ "424": "Failed Dependency",
727
+ "425": "Too Early",
728
+ "426": "Upgrade Required",
729
+ "428": "Precondition Required",
730
+ "429": "Too Many Requests",
731
+ "431": "Request Header Fields Too Large",
732
+ "451": "Unavailable For Legal Reasons",
733
+ "500": "Internal Server Error",
734
+ "501": "Not Implemented",
735
+ "502": "Bad Gateway",
736
+ "503": "Service Unavailable",
737
+ "504": "Gateway Timeout",
738
+ "505": "HTTP Version Not Supported",
739
+ "506": "Variant Also Negotiates",
740
+ "507": "Insufficient Storage",
741
+ "508": "Loop Detected",
742
+ "509": "Bandwidth Limit Exceeded",
743
+ "510": "Not Extended",
744
+ "511": "Network Authentication Required"
745
+ };
746
+ }
747
+ });
748
+ var require_statuses = __commonJS({
749
+ "node_modules/statuses/index.js"(exports, module) {
662
750
  "use strict";
663
- var defaultParseOptions = {
664
- decodeValues: true,
665
- map: false,
666
- silent: false
751
+ var codes = require_codes();
752
+ module.exports = status2;
753
+ status2.message = codes;
754
+ status2.code = createMessageToStatusCodeMap(codes);
755
+ status2.codes = createStatusCodeList(codes);
756
+ status2.redirect = {
757
+ 300: true,
758
+ 301: true,
759
+ 302: true,
760
+ 303: true,
761
+ 305: true,
762
+ 307: true,
763
+ 308: true
667
764
  };
668
- function isNonEmptyString(str) {
669
- return typeof str === "string" && !!str.trim();
765
+ status2.empty = {
766
+ 204: true,
767
+ 205: true,
768
+ 304: true
769
+ };
770
+ status2.retry = {
771
+ 502: true,
772
+ 503: true,
773
+ 504: true
774
+ };
775
+ function createMessageToStatusCodeMap(codes2) {
776
+ var map = {};
777
+ Object.keys(codes2).forEach(function forEachCode(code) {
778
+ var message3 = codes2[code];
779
+ var status3 = Number(code);
780
+ map[message3.toLowerCase()] = status3;
781
+ });
782
+ return map;
670
783
  }
671
- function parseString(setCookieValue, options) {
672
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
673
- var nameValuePairStr = parts.shift();
674
- var parsed = parseNameValuePair(nameValuePairStr);
675
- var name = parsed.name;
676
- var value = parsed.value;
677
- options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
678
- try {
679
- value = options.decodeValues ? decodeURIComponent(value) : value;
680
- } catch (e) {
681
- console.error(
682
- "set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.",
683
- e
684
- );
685
- }
686
- var cookie = {
687
- name,
688
- value
689
- };
690
- parts.forEach(function(part) {
691
- var sides = part.split("=");
692
- var key = sides.shift().trimLeft().toLowerCase();
693
- var value2 = sides.join("=");
694
- if (key === "expires") {
695
- cookie.expires = new Date(value2);
696
- } else if (key === "max-age") {
697
- cookie.maxAge = parseInt(value2, 10);
698
- } else if (key === "secure") {
699
- cookie.secure = true;
700
- } else if (key === "httponly") {
701
- cookie.httpOnly = true;
702
- } else if (key === "samesite") {
703
- cookie.sameSite = value2;
704
- } else {
705
- cookie[key] = value2;
706
- }
784
+ function createStatusCodeList(codes2) {
785
+ return Object.keys(codes2).map(function mapCode(code) {
786
+ return Number(code);
707
787
  });
708
- return cookie;
709
788
  }
710
- function parseNameValuePair(nameValuePairStr) {
711
- var name = "";
712
- var value = "";
713
- var nameValueArr = nameValuePairStr.split("=");
714
- if (nameValueArr.length > 1) {
715
- name = nameValueArr.shift();
716
- value = nameValueArr.join("=");
717
- } else {
718
- value = nameValuePairStr;
789
+ function getStatusCode(message3) {
790
+ var msg = message3.toLowerCase();
791
+ if (!Object.prototype.hasOwnProperty.call(status2.code, msg)) {
792
+ throw new Error('invalid status message: "' + message3 + '"');
719
793
  }
720
- return { name, value };
794
+ return status2.code[msg];
721
795
  }
722
- function parse3(input, options) {
723
- options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
724
- if (!input) {
725
- if (!options.map) {
726
- return [];
727
- } else {
728
- return {};
729
- }
730
- }
731
- if (input.headers) {
732
- if (typeof input.headers.getSetCookie === "function") {
733
- input = input.headers.getSetCookie();
734
- } else if (input.headers["set-cookie"]) {
735
- input = input.headers["set-cookie"];
736
- } else {
737
- var sch = input.headers[Object.keys(input.headers).find(function(key) {
738
- return key.toLowerCase() === "set-cookie";
739
- })];
740
- if (!sch && input.headers.cookie && !options.silent) {
741
- console.warn(
742
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
743
- );
744
- }
745
- input = sch;
746
- }
747
- }
748
- if (!Array.isArray(input)) {
749
- input = [input];
750
- }
751
- options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
752
- if (!options.map) {
753
- return input.filter(isNonEmptyString).map(function(str) {
754
- return parseString(str, options);
755
- });
756
- } else {
757
- var cookies = {};
758
- return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
759
- var cookie = parseString(str, options);
760
- cookies2[cookie.name] = cookie;
761
- return cookies2;
762
- }, cookies);
796
+ function getStatusMessage(code) {
797
+ if (!Object.prototype.hasOwnProperty.call(status2.message, code)) {
798
+ throw new Error("invalid status code: " + code);
763
799
  }
800
+ return status2.message[code];
764
801
  }
765
- function splitCookiesString2(cookiesString) {
766
- if (Array.isArray(cookiesString)) {
767
- return cookiesString;
802
+ function status2(code) {
803
+ if (typeof code === "number") {
804
+ return getStatusMessage(code);
768
805
  }
769
- if (typeof cookiesString !== "string") {
770
- return [];
806
+ if (typeof code !== "string") {
807
+ throw new TypeError("code must be a number or string");
771
808
  }
772
- var cookiesStrings = [];
773
- var pos = 0;
774
- var start;
775
- var ch;
776
- var lastComma;
777
- var nextStart;
778
- var cookiesSeparatorFound;
779
- function skipWhitespace() {
780
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
781
- pos += 1;
782
- }
783
- return pos < cookiesString.length;
809
+ var n = parseInt(code, 10);
810
+ if (!isNaN(n)) {
811
+ return getStatusMessage(n);
784
812
  }
785
- function notSpecialChar() {
786
- ch = cookiesString.charAt(pos);
787
- return ch !== "=" && ch !== ";" && ch !== ",";
788
- }
789
- while (pos < cookiesString.length) {
790
- start = pos;
791
- cookiesSeparatorFound = false;
792
- while (skipWhitespace()) {
793
- ch = cookiesString.charAt(pos);
794
- if (ch === ",") {
795
- lastComma = pos;
796
- pos += 1;
797
- skipWhitespace();
798
- nextStart = pos;
799
- while (pos < cookiesString.length && notSpecialChar()) {
800
- pos += 1;
801
- }
802
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
803
- cookiesSeparatorFound = true;
804
- pos = nextStart;
805
- cookiesStrings.push(cookiesString.substring(start, lastComma));
806
- start = pos;
807
- } else {
808
- pos = lastComma + 1;
809
- }
810
- } else {
811
- pos += 1;
812
- }
813
- }
814
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
815
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
816
- }
817
- }
818
- return cookiesStrings;
813
+ return getStatusCode(code);
819
814
  }
820
- module.exports = parse3;
821
- module.exports.parse = parse3;
822
- module.exports.parseString = parseString;
823
- module.exports.splitCookiesString = splitCookiesString2;
824
815
  }
825
816
  });
826
- var import_set_cookie_parser = __toESM(require_set_cookie());
827
- var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i;
828
- function normalizeHeaderName(name) {
829
- if (typeof name !== "string") {
830
- name = String(name);
831
- }
832
- if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === "") {
833
- throw new TypeError("Invalid character in header field name");
834
- }
835
- return name.toLowerCase();
836
- }
837
- function normalizeHeaderValue(value) {
838
- if (typeof value !== "string") {
839
- value = String(value);
840
- }
841
- return value;
817
+ var import_statuses = __toESM(require_statuses(), 1);
818
+ var source_default = import_statuses.default;
819
+
820
+ // src/core/utils/logging/serializeResponse.ts
821
+ var { message } = source_default;
822
+ function serializeResponse(response) {
823
+ return __async(this, null, function* () {
824
+ const responseClone = response.clone();
825
+ const responseText = yield responseClone.text();
826
+ const responseStatus = responseClone.status || 200;
827
+ const responseStatusText = responseClone.statusText || message[responseStatus] || "OK";
828
+ return {
829
+ status: responseStatus,
830
+ statusText: responseStatusText,
831
+ headers: Object.fromEntries(responseClone.headers.entries()),
832
+ body: responseText
833
+ };
834
+ });
842
835
  }
843
- var NORMALIZED_HEADERS = Symbol("normalizedHeaders");
844
- var RAW_HEADER_NAMES = Symbol("rawHeaderNames");
845
- var HEADER_VALUE_DELIMITER = ", ";
846
- var _a;
847
- var _b;
848
- var HeadersPolyfill = class {
849
- constructor(init) {
850
- this[_a] = {};
851
- this[_b] = /* @__PURE__ */ new Map();
852
- if (["Headers", "HeadersPolyfill"].includes(init == null ? void 0 : init.constructor.name) || init instanceof HeadersPolyfill) {
853
- const initialHeaders = init;
854
- initialHeaders.forEach((value, name) => {
855
- this.append(name, value);
856
- }, this);
857
- } else if (Array.isArray(init)) {
858
- init.forEach(([name, value]) => {
859
- this.append(
860
- name,
861
- Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
862
- );
863
- });
864
- } else if (init) {
865
- Object.getOwnPropertyNames(init).forEach((name) => {
866
- const value = init[name];
867
- this.append(
868
- name,
869
- Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
870
- );
871
- });
872
- }
873
- }
874
- [(_a = NORMALIZED_HEADERS, _b = RAW_HEADER_NAMES, Symbol.iterator)]() {
875
- return this.entries();
876
- }
877
- *keys() {
878
- for (const name of Object.keys(this[NORMALIZED_HEADERS])) {
879
- yield name;
880
- }
881
- }
882
- *values() {
883
- for (const value of Object.values(this[NORMALIZED_HEADERS])) {
884
- yield value;
836
+
837
+ // node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist.es2015/index.js
838
+ function lexer(str) {
839
+ var tokens = [];
840
+ var i = 0;
841
+ while (i < str.length) {
842
+ var char = str[i];
843
+ if (char === "*" || char === "+" || char === "?") {
844
+ tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
845
+ continue;
885
846
  }
886
- }
887
- *entries() {
888
- for (const name of Object.keys(this[NORMALIZED_HEADERS])) {
889
- yield [name, this.get(name)];
847
+ if (char === "\\") {
848
+ tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
849
+ continue;
890
850
  }
891
- }
892
- get(name) {
893
- var _a3;
894
- return (_a3 = this[NORMALIZED_HEADERS][normalizeHeaderName(name)]) != null ? _a3 : null;
895
- }
896
- set(name, value) {
897
- const normalizedName = normalizeHeaderName(name);
898
- this[NORMALIZED_HEADERS][normalizedName] = normalizeHeaderValue(value);
899
- this[RAW_HEADER_NAMES].set(normalizedName, name);
900
- }
901
- append(name, value) {
902
- const normalizedName = normalizeHeaderName(name);
903
- let resolvedValue = this.has(normalizedName) ? `${this.get(normalizedName)}, ${value}` : value;
904
- this.set(name, resolvedValue);
905
- }
906
- delete(name) {
907
- if (!this.has(name)) {
908
- return;
851
+ if (char === "{") {
852
+ tokens.push({ type: "OPEN", index: i, value: str[i++] });
853
+ continue;
909
854
  }
910
- const normalizedName = normalizeHeaderName(name);
911
- delete this[NORMALIZED_HEADERS][normalizedName];
912
- this[RAW_HEADER_NAMES].delete(normalizedName);
913
- }
914
- all() {
915
- return this[NORMALIZED_HEADERS];
916
- }
917
- raw() {
918
- const rawHeaders = {};
919
- for (const [name, value] of this.entries()) {
920
- rawHeaders[this[RAW_HEADER_NAMES].get(name)] = value;
855
+ if (char === "}") {
856
+ tokens.push({ type: "CLOSE", index: i, value: str[i++] });
857
+ continue;
921
858
  }
922
- return rawHeaders;
923
- }
924
- has(name) {
925
- return this[NORMALIZED_HEADERS].hasOwnProperty(normalizeHeaderName(name));
926
- }
927
- forEach(callback, thisArg) {
928
- for (const name in this[NORMALIZED_HEADERS]) {
929
- if (this[NORMALIZED_HEADERS].hasOwnProperty(name)) {
930
- callback.call(thisArg, this[NORMALIZED_HEADERS][name], name, this);
859
+ if (char === ":") {
860
+ var name = "";
861
+ var j = i + 1;
862
+ while (j < str.length) {
863
+ var code = str.charCodeAt(j);
864
+ if (
865
+ // `0-9`
866
+ code >= 48 && code <= 57 || // `A-Z`
867
+ code >= 65 && code <= 90 || // `a-z`
868
+ code >= 97 && code <= 122 || // `_`
869
+ code === 95
870
+ ) {
871
+ name += str[j++];
872
+ continue;
873
+ }
874
+ break;
931
875
  }
876
+ if (!name)
877
+ throw new TypeError("Missing parameter name at ".concat(i));
878
+ tokens.push({ type: "NAME", index: i, value: name });
879
+ i = j;
880
+ continue;
932
881
  }
933
- }
934
- getSetCookie() {
935
- const setCookieHeader = this.get("set-cookie");
936
- if (setCookieHeader === null) {
937
- return [];
938
- }
939
- if (setCookieHeader === "") {
940
- return [""];
882
+ if (char === "(") {
883
+ var count = 1;
884
+ var pattern = "";
885
+ var j = i + 1;
886
+ if (str[j] === "?") {
887
+ throw new TypeError('Pattern cannot start with "?" at '.concat(j));
888
+ }
889
+ while (j < str.length) {
890
+ if (str[j] === "\\") {
891
+ pattern += str[j++] + str[j++];
892
+ continue;
893
+ }
894
+ if (str[j] === ")") {
895
+ count--;
896
+ if (count === 0) {
897
+ j++;
898
+ break;
899
+ }
900
+ } else if (str[j] === "(") {
901
+ count++;
902
+ if (str[j + 1] !== "?") {
903
+ throw new TypeError("Capturing groups are not allowed at ".concat(j));
904
+ }
905
+ }
906
+ pattern += str[j++];
907
+ }
908
+ if (count)
909
+ throw new TypeError("Unbalanced pattern at ".concat(i));
910
+ if (!pattern)
911
+ throw new TypeError("Missing pattern at ".concat(i));
912
+ tokens.push({ type: "PATTERN", index: i, value: pattern });
913
+ i = j;
914
+ continue;
941
915
  }
942
- return (0, import_set_cookie_parser.splitCookiesString)(setCookieHeader);
916
+ tokens.push({ type: "CHAR", index: i, value: str[i++] });
943
917
  }
944
- };
945
- var singleValueHeaders = ["user-agent"];
946
- function headersToObject(headers) {
947
- const headersObject = {};
948
- headers.forEach((value, name) => {
949
- const isMultiValue = !singleValueHeaders.includes(name.toLowerCase()) && value.includes(",");
950
- headersObject[name] = isMultiValue ? value.split(",").map((s) => s.trim()) : value;
951
- });
952
- return headersObject;
953
- }
954
- function stringToHeaders(str) {
955
- const lines = str.trim().split(/[\r\n]+/);
956
- return lines.reduce((headers, line) => {
957
- if (line.trim() === "") {
958
- return headers;
959
- }
960
- const parts = line.split(": ");
961
- const name = parts.shift();
962
- const value = parts.join(": ");
963
- headers.append(name, value);
964
- return headers;
965
- }, new HeadersPolyfill());
966
- }
967
- function reduceHeadersObject(headers, reducer, initialState) {
968
- return Object.keys(headers).reduce((nextHeaders, name) => {
969
- return reducer(nextHeaders, name, headers[name]);
970
- }, initialState);
971
- }
972
- function flattenHeadersObject(headersObject) {
973
- return reduceHeadersObject(
974
- headersObject,
975
- (headers, name, value) => {
976
- headers[name] = [].concat(value).join(", ");
977
- return headers;
978
- },
979
- {}
980
- );
918
+ tokens.push({ type: "END", index: i, value: "" });
919
+ return tokens;
981
920
  }
982
-
983
- // src/core/utils/logging/serializeRequest.ts
984
- function serializeRequest(request) {
985
- return __async(this, null, function* () {
986
- const requestClone = request.clone();
987
- const requestText = yield requestClone.text();
988
- return {
989
- url: new URL(request.url),
990
- method: request.method,
991
- headers: headersToObject(request.headers),
992
- body: requestText
993
- };
994
- });
995
- }
996
-
997
- // node_modules/.pnpm/@bundled-es-modules+statuses@1.0.1/node_modules/@bundled-es-modules/statuses/index-esm.js
998
- var __create2 = Object.create;
999
- var __defProp3 = Object.defineProperty;
1000
- var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
1001
- var __getOwnPropNames3 = Object.getOwnPropertyNames;
1002
- var __getProtoOf2 = Object.getPrototypeOf;
1003
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
1004
- var __commonJS2 = (cb, mod) => function __require() {
1005
- return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
1006
- };
1007
- var __copyProps3 = (to, from, except, desc) => {
1008
- if (from && typeof from === "object" || typeof from === "function") {
1009
- for (let key of __getOwnPropNames3(from))
1010
- if (!__hasOwnProp3.call(to, key) && key !== except)
1011
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
1012
- }
1013
- return to;
1014
- };
1015
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps3(
1016
- // If the importer is in node compatibility mode or this is not an ESM
1017
- // file that has been converted to a CommonJS file using a Babel-
1018
- // compatible transform (i.e. "__esModule" has not been set), then set
1019
- // "default" to the CommonJS "module.exports" for node compatibility.
1020
- isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
1021
- mod
1022
- ));
1023
- var require_codes = __commonJS2({
1024
- "node_modules/statuses/codes.json"(exports, module) {
1025
- module.exports = {
1026
- "100": "Continue",
1027
- "101": "Switching Protocols",
1028
- "102": "Processing",
1029
- "103": "Early Hints",
1030
- "200": "OK",
1031
- "201": "Created",
1032
- "202": "Accepted",
1033
- "203": "Non-Authoritative Information",
1034
- "204": "No Content",
1035
- "205": "Reset Content",
1036
- "206": "Partial Content",
1037
- "207": "Multi-Status",
1038
- "208": "Already Reported",
1039
- "226": "IM Used",
1040
- "300": "Multiple Choices",
1041
- "301": "Moved Permanently",
1042
- "302": "Found",
1043
- "303": "See Other",
1044
- "304": "Not Modified",
1045
- "305": "Use Proxy",
1046
- "307": "Temporary Redirect",
1047
- "308": "Permanent Redirect",
1048
- "400": "Bad Request",
1049
- "401": "Unauthorized",
1050
- "402": "Payment Required",
1051
- "403": "Forbidden",
1052
- "404": "Not Found",
1053
- "405": "Method Not Allowed",
1054
- "406": "Not Acceptable",
1055
- "407": "Proxy Authentication Required",
1056
- "408": "Request Timeout",
1057
- "409": "Conflict",
1058
- "410": "Gone",
1059
- "411": "Length Required",
1060
- "412": "Precondition Failed",
1061
- "413": "Payload Too Large",
1062
- "414": "URI Too Long",
1063
- "415": "Unsupported Media Type",
1064
- "416": "Range Not Satisfiable",
1065
- "417": "Expectation Failed",
1066
- "418": "I'm a Teapot",
1067
- "421": "Misdirected Request",
1068
- "422": "Unprocessable Entity",
1069
- "423": "Locked",
1070
- "424": "Failed Dependency",
1071
- "425": "Too Early",
1072
- "426": "Upgrade Required",
1073
- "428": "Precondition Required",
1074
- "429": "Too Many Requests",
1075
- "431": "Request Header Fields Too Large",
1076
- "451": "Unavailable For Legal Reasons",
1077
- "500": "Internal Server Error",
1078
- "501": "Not Implemented",
1079
- "502": "Bad Gateway",
1080
- "503": "Service Unavailable",
1081
- "504": "Gateway Timeout",
1082
- "505": "HTTP Version Not Supported",
1083
- "506": "Variant Also Negotiates",
1084
- "507": "Insufficient Storage",
1085
- "508": "Loop Detected",
1086
- "509": "Bandwidth Limit Exceeded",
1087
- "510": "Not Extended",
1088
- "511": "Network Authentication Required"
1089
- };
921
+ function parse(str, options) {
922
+ if (options === void 0) {
923
+ options = {};
1090
924
  }
1091
- });
1092
- var require_statuses = __commonJS2({
1093
- "node_modules/statuses/index.js"(exports, module) {
1094
- "use strict";
1095
- var codes = require_codes();
1096
- module.exports = status2;
1097
- status2.message = codes;
1098
- status2.code = createMessageToStatusCodeMap(codes);
1099
- status2.codes = createStatusCodeList(codes);
1100
- status2.redirect = {
1101
- 300: true,
1102
- 301: true,
1103
- 302: true,
1104
- 303: true,
1105
- 305: true,
1106
- 307: true,
1107
- 308: true
1108
- };
1109
- status2.empty = {
1110
- 204: true,
1111
- 205: true,
1112
- 304: true
1113
- };
1114
- status2.retry = {
1115
- 502: true,
1116
- 503: true,
1117
- 504: true
1118
- };
1119
- function createMessageToStatusCodeMap(codes2) {
1120
- var map = {};
1121
- Object.keys(codes2).forEach(function forEachCode(code) {
1122
- var message3 = codes2[code];
1123
- var status3 = Number(code);
1124
- map[message3.toLowerCase()] = status3;
1125
- });
1126
- return map;
1127
- }
1128
- function createStatusCodeList(codes2) {
1129
- return Object.keys(codes2).map(function mapCode(code) {
1130
- return Number(code);
1131
- });
1132
- }
1133
- function getStatusCode(message3) {
1134
- var msg = message3.toLowerCase();
1135
- if (!Object.prototype.hasOwnProperty.call(status2.code, msg)) {
1136
- throw new Error('invalid status message: "' + message3 + '"');
1137
- }
1138
- return status2.code[msg];
1139
- }
1140
- function getStatusMessage(code) {
1141
- if (!Object.prototype.hasOwnProperty.call(status2.message, code)) {
1142
- throw new Error("invalid status code: " + code);
1143
- }
1144
- return status2.message[code];
925
+ var tokens = lexer(str);
926
+ var _a3 = options.prefixes, prefixes = _a3 === void 0 ? "./" : _a3;
927
+ var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
928
+ var result = [];
929
+ var key = 0;
930
+ var i = 0;
931
+ var path = "";
932
+ var tryConsume = function(type) {
933
+ if (i < tokens.length && tokens[i].type === type)
934
+ return tokens[i++].value;
935
+ };
936
+ var mustConsume = function(type) {
937
+ var value2 = tryConsume(type);
938
+ if (value2 !== void 0)
939
+ return value2;
940
+ var _a4 = tokens[i], nextType = _a4.type, index = _a4.index;
941
+ throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
942
+ };
943
+ var consumeText = function() {
944
+ var result2 = "";
945
+ var value2;
946
+ while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
947
+ result2 += value2;
1145
948
  }
1146
- function status2(code) {
1147
- if (typeof code === "number") {
1148
- return getStatusMessage(code);
1149
- }
1150
- if (typeof code !== "string") {
1151
- throw new TypeError("code must be a number or string");
949
+ return result2;
950
+ };
951
+ while (i < tokens.length) {
952
+ var char = tryConsume("CHAR");
953
+ var name = tryConsume("NAME");
954
+ var pattern = tryConsume("PATTERN");
955
+ if (name || pattern) {
956
+ var prefix = char || "";
957
+ if (prefixes.indexOf(prefix) === -1) {
958
+ path += prefix;
959
+ prefix = "";
1152
960
  }
1153
- var n = parseInt(code, 10);
1154
- if (!isNaN(n)) {
1155
- return getStatusMessage(n);
961
+ if (path) {
962
+ result.push(path);
963
+ path = "";
1156
964
  }
1157
- return getStatusCode(code);
1158
- }
1159
- }
1160
- });
1161
- var import_statuses = __toESM2(require_statuses(), 1);
1162
- var source_default = import_statuses.default;
1163
-
1164
- // src/core/utils/logging/serializeResponse.ts
1165
- var { message } = source_default;
1166
- function serializeResponse(response) {
1167
- return __async(this, null, function* () {
1168
- const responseClone = response.clone();
1169
- const responseText = yield responseClone.text();
1170
- const responseStatus = responseClone.status || 200;
1171
- const responseStatusText = responseClone.statusText || message[responseStatus] || "OK";
1172
- return {
1173
- status: responseStatus,
1174
- statusText: responseStatusText,
1175
- headers: headersToObject(responseClone.headers),
1176
- body: responseText
1177
- };
1178
- });
1179
- }
1180
-
1181
- // node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist.es2015/index.js
1182
- function lexer(str) {
1183
- var tokens = [];
1184
- var i = 0;
1185
- while (i < str.length) {
1186
- var char = str[i];
1187
- if (char === "*" || char === "+" || char === "?") {
1188
- tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
965
+ result.push({
966
+ name: name || key++,
967
+ prefix,
968
+ suffix: "",
969
+ pattern: pattern || defaultPattern,
970
+ modifier: tryConsume("MODIFIER") || ""
971
+ });
1189
972
  continue;
1190
973
  }
1191
- if (char === "\\") {
1192
- tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
974
+ var value = char || tryConsume("ESCAPED_CHAR");
975
+ if (value) {
976
+ path += value;
1193
977
  continue;
1194
978
  }
1195
- if (char === "{") {
1196
- tokens.push({ type: "OPEN", index: i, value: str[i++] });
1197
- continue;
1198
- }
1199
- if (char === "}") {
1200
- tokens.push({ type: "CLOSE", index: i, value: str[i++] });
1201
- continue;
1202
- }
1203
- if (char === ":") {
1204
- var name = "";
1205
- var j = i + 1;
1206
- while (j < str.length) {
1207
- var code = str.charCodeAt(j);
1208
- if (
1209
- // `0-9`
1210
- code >= 48 && code <= 57 || // `A-Z`
1211
- code >= 65 && code <= 90 || // `a-z`
1212
- code >= 97 && code <= 122 || // `_`
1213
- code === 95
1214
- ) {
1215
- name += str[j++];
1216
- continue;
1217
- }
1218
- break;
1219
- }
1220
- if (!name)
1221
- throw new TypeError("Missing parameter name at ".concat(i));
1222
- tokens.push({ type: "NAME", index: i, value: name });
1223
- i = j;
1224
- continue;
1225
- }
1226
- if (char === "(") {
1227
- var count = 1;
1228
- var pattern = "";
1229
- var j = i + 1;
1230
- if (str[j] === "?") {
1231
- throw new TypeError('Pattern cannot start with "?" at '.concat(j));
1232
- }
1233
- while (j < str.length) {
1234
- if (str[j] === "\\") {
1235
- pattern += str[j++] + str[j++];
1236
- continue;
1237
- }
1238
- if (str[j] === ")") {
1239
- count--;
1240
- if (count === 0) {
1241
- j++;
1242
- break;
1243
- }
1244
- } else if (str[j] === "(") {
1245
- count++;
1246
- if (str[j + 1] !== "?") {
1247
- throw new TypeError("Capturing groups are not allowed at ".concat(j));
1248
- }
1249
- }
1250
- pattern += str[j++];
1251
- }
1252
- if (count)
1253
- throw new TypeError("Unbalanced pattern at ".concat(i));
1254
- if (!pattern)
1255
- throw new TypeError("Missing pattern at ".concat(i));
1256
- tokens.push({ type: "PATTERN", index: i, value: pattern });
1257
- i = j;
1258
- continue;
1259
- }
1260
- tokens.push({ type: "CHAR", index: i, value: str[i++] });
1261
- }
1262
- tokens.push({ type: "END", index: i, value: "" });
1263
- return tokens;
1264
- }
1265
- function parse(str, options) {
1266
- if (options === void 0) {
1267
- options = {};
1268
- }
1269
- var tokens = lexer(str);
1270
- var _a3 = options.prefixes, prefixes = _a3 === void 0 ? "./" : _a3;
1271
- var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
1272
- var result = [];
1273
- var key = 0;
1274
- var i = 0;
1275
- var path = "";
1276
- var tryConsume = function(type) {
1277
- if (i < tokens.length && tokens[i].type === type)
1278
- return tokens[i++].value;
1279
- };
1280
- var mustConsume = function(type) {
1281
- var value2 = tryConsume(type);
1282
- if (value2 !== void 0)
1283
- return value2;
1284
- var _a4 = tokens[i], nextType = _a4.type, index = _a4.index;
1285
- throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
1286
- };
1287
- var consumeText = function() {
1288
- var result2 = "";
1289
- var value2;
1290
- while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
1291
- result2 += value2;
1292
- }
1293
- return result2;
1294
- };
1295
- while (i < tokens.length) {
1296
- var char = tryConsume("CHAR");
1297
- var name = tryConsume("NAME");
1298
- var pattern = tryConsume("PATTERN");
1299
- if (name || pattern) {
1300
- var prefix = char || "";
1301
- if (prefixes.indexOf(prefix) === -1) {
1302
- path += prefix;
1303
- prefix = "";
1304
- }
1305
- if (path) {
1306
- result.push(path);
1307
- path = "";
1308
- }
1309
- result.push({
1310
- name: name || key++,
1311
- prefix,
1312
- suffix: "",
1313
- pattern: pattern || defaultPattern,
1314
- modifier: tryConsume("MODIFIER") || ""
1315
- });
1316
- continue;
1317
- }
1318
- var value = char || tryConsume("ESCAPED_CHAR");
1319
- if (value) {
1320
- path += value;
1321
- continue;
1322
- }
1323
- if (path) {
1324
- result.push(path);
1325
- path = "";
979
+ if (path) {
980
+ result.push(path);
981
+ path = "";
1326
982
  }
1327
983
  var open = tryConsume("OPEN");
1328
984
  if (open) {
@@ -1493,10 +1149,10 @@ var MockServiceWorker = (() => {
1493
1149
  }
1494
1150
 
1495
1151
  // node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
1496
- var __defProp4 = Object.defineProperty;
1152
+ var __defProp3 = Object.defineProperty;
1497
1153
  var __export2 = (target, all) => {
1498
1154
  for (var name in all)
1499
- __defProp4(target, name, { get: all[name], enumerable: true });
1155
+ __defProp3(target, name, { get: all[name], enumerable: true });
1500
1156
  };
1501
1157
  var colors_exports = {};
1502
1158
  __export2(colors_exports, {
@@ -2124,32 +1780,32 @@ var MockServiceWorker = (() => {
2124
1780
  }
2125
1781
 
2126
1782
  // node_modules/.pnpm/@bundled-es-modules+cookie@2.0.0/node_modules/@bundled-es-modules/cookie/index-esm.js
2127
- var __create3 = Object.create;
2128
- var __defProp5 = Object.defineProperty;
2129
- var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
2130
- var __getOwnPropNames4 = Object.getOwnPropertyNames;
2131
- var __getProtoOf3 = Object.getPrototypeOf;
2132
- var __hasOwnProp4 = Object.prototype.hasOwnProperty;
2133
- var __commonJS3 = (cb, mod) => function __require() {
2134
- return mod || (0, cb[__getOwnPropNames4(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
1783
+ var __create2 = Object.create;
1784
+ var __defProp4 = Object.defineProperty;
1785
+ var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
1786
+ var __getOwnPropNames3 = Object.getOwnPropertyNames;
1787
+ var __getProtoOf2 = Object.getPrototypeOf;
1788
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
1789
+ var __commonJS2 = (cb, mod) => function __require() {
1790
+ return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
2135
1791
  };
2136
- var __copyProps4 = (to, from, except, desc) => {
1792
+ var __copyProps3 = (to, from, except, desc) => {
2137
1793
  if (from && typeof from === "object" || typeof from === "function") {
2138
- for (let key of __getOwnPropNames4(from))
2139
- if (!__hasOwnProp4.call(to, key) && key !== except)
2140
- __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc4(from, key)) || desc.enumerable });
1794
+ for (let key of __getOwnPropNames3(from))
1795
+ if (!__hasOwnProp3.call(to, key) && key !== except)
1796
+ __defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
2141
1797
  }
2142
1798
  return to;
2143
1799
  };
2144
- var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps4(
1800
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps3(
2145
1801
  // If the importer is in node compatibility mode or this is not an ESM
2146
1802
  // file that has been converted to a CommonJS file using a Babel-
2147
1803
  // compatible transform (i.e. "__esModule" has not been set), then set
2148
1804
  // "default" to the CommonJS "module.exports" for node compatibility.
2149
- isNodeMode || !mod || !mod.__esModule ? __defProp5(target, "default", { value: mod, enumerable: true }) : target,
1805
+ isNodeMode || !mod || !mod.__esModule ? __defProp4(target, "default", { value: mod, enumerable: true }) : target,
2150
1806
  mod
2151
1807
  ));
2152
- var require_cookie = __commonJS3({
1808
+ var require_cookie = __commonJS2({
2153
1809
  "node_modules/cookie/index.js"(exports) {
2154
1810
  "use strict";
2155
1811
  exports.parse = parse3;
@@ -2289,32 +1945,32 @@ var MockServiceWorker = (() => {
2289
1945
  }
2290
1946
  }
2291
1947
  });
2292
- var import_cookie = __toESM3(require_cookie(), 1);
1948
+ var import_cookie = __toESM2(require_cookie(), 1);
2293
1949
  var source_default2 = import_cookie.default;
2294
1950
 
2295
1951
  // node_modules/.pnpm/@mswjs+cookies@1.0.0/node_modules/@mswjs/cookies/lib/index.mjs
2296
- var __create4 = Object.create;
2297
- var __defProp6 = Object.defineProperty;
2298
- var __getOwnPropDesc5 = Object.getOwnPropertyDescriptor;
2299
- var __getOwnPropNames5 = Object.getOwnPropertyNames;
2300
- var __getProtoOf4 = Object.getPrototypeOf;
2301
- var __hasOwnProp5 = Object.prototype.hasOwnProperty;
2302
- var __commonJS4 = (cb, mod) => function __require() {
2303
- return mod || (0, cb[__getOwnPropNames5(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
1952
+ var __create3 = Object.create;
1953
+ var __defProp5 = Object.defineProperty;
1954
+ var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
1955
+ var __getOwnPropNames4 = Object.getOwnPropertyNames;
1956
+ var __getProtoOf3 = Object.getPrototypeOf;
1957
+ var __hasOwnProp4 = Object.prototype.hasOwnProperty;
1958
+ var __commonJS3 = (cb, mod) => function __require() {
1959
+ return mod || (0, cb[__getOwnPropNames4(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
2304
1960
  };
2305
- var __copyProps5 = (to, from, except, desc) => {
1961
+ var __copyProps4 = (to, from, except, desc) => {
2306
1962
  if (from && typeof from === "object" || typeof from === "function") {
2307
- for (let key of __getOwnPropNames5(from))
2308
- if (!__hasOwnProp5.call(to, key) && key !== except)
2309
- __defProp6(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc5(from, key)) || desc.enumerable });
1963
+ for (let key of __getOwnPropNames4(from))
1964
+ if (!__hasOwnProp4.call(to, key) && key !== except)
1965
+ __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc4(from, key)) || desc.enumerable });
2310
1966
  }
2311
1967
  return to;
2312
1968
  };
2313
- var __toESM4 = (mod, isNodeMode, target) => (target = mod != null ? __create4(__getProtoOf4(mod)) : {}, __copyProps5(
2314
- isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target,
1969
+ var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps4(
1970
+ isNodeMode || !mod || !mod.__esModule ? __defProp5(target, "default", { value: mod, enumerable: true }) : target,
2315
1971
  mod
2316
1972
  ));
2317
- var require_set_cookie2 = __commonJS4({
1973
+ var require_set_cookie = __commonJS3({
2318
1974
  "node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
2319
1975
  "use strict";
2320
1976
  var defaultParseOptions = {
@@ -2455,7 +2111,7 @@ var MockServiceWorker = (() => {
2455
2111
  module.exports.splitCookiesString = splitCookiesString;
2456
2112
  }
2457
2113
  });
2458
- var import_set_cookie_parser2 = __toESM4(require_set_cookie2());
2114
+ var import_set_cookie_parser = __toESM3(require_set_cookie());
2459
2115
  var PERSISTENCY_KEY = "MSW_COOKIE_STORE";
2460
2116
  function supportsLocalStorage() {
2461
2117
  try {
@@ -2485,7 +2141,7 @@ var MockServiceWorker = (() => {
2485
2141
  return;
2486
2142
  }
2487
2143
  const now = Date.now();
2488
- const parsedResponseCookies = (0, import_set_cookie_parser2.parse)(responseCookies).map(
2144
+ const parsedResponseCookies = (0, import_set_cookie_parser.parse)(responseCookies).map(
2489
2145
  (_a3) => {
2490
2146
  var _b2 = _a3, { maxAge } = _b2, cookie = __objRest(_b2, ["maxAge"]);
2491
2147
  return __spreadProps(__spreadValues({}, cookie), {
@@ -2508,7 +2164,7 @@ var MockServiceWorker = (() => {
2508
2164
  if (typeof document === "undefined") {
2509
2165
  return originCookies;
2510
2166
  }
2511
- const documentCookies = (0, import_set_cookie_parser2.parse)(document.cookie);
2167
+ const documentCookies = (0, import_set_cookie_parser.parse)(document.cookie);
2512
2168
  documentCookies.forEach((cookie) => {
2513
2169
  originCookies.set(cookie.name, cookie);
2514
2170
  });
@@ -2657,7 +2313,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2657
2313
  method
2658
2314
  },
2659
2315
  resolver,
2660
- once: options == null ? void 0 : options.once
2316
+ options
2661
2317
  });
2662
2318
  this.checkRedundantQueryParameters();
2663
2319
  }
@@ -5054,166 +4710,487 @@ spurious results.`);
5054
4710
  this._lexer.source
5055
4711
  );
5056
4712
  }
5057
- return node;
4713
+ return node;
4714
+ }
4715
+ /**
4716
+ * Determines if the next token is of a given kind
4717
+ */
4718
+ peek(kind) {
4719
+ return this._lexer.token.kind === kind;
4720
+ }
4721
+ /**
4722
+ * If the next token is of the given kind, return that token after advancing the lexer.
4723
+ * Otherwise, do not change the parser state and throw an error.
4724
+ */
4725
+ expectToken(kind) {
4726
+ const token = this._lexer.token;
4727
+ if (token.kind === kind) {
4728
+ this.advanceLexer();
4729
+ return token;
4730
+ }
4731
+ throw syntaxError(
4732
+ this._lexer.source,
4733
+ token.start,
4734
+ `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
4735
+ );
4736
+ }
4737
+ /**
4738
+ * If the next token is of the given kind, return "true" after advancing the lexer.
4739
+ * Otherwise, do not change the parser state and return "false".
4740
+ */
4741
+ expectOptionalToken(kind) {
4742
+ const token = this._lexer.token;
4743
+ if (token.kind === kind) {
4744
+ this.advanceLexer();
4745
+ return true;
4746
+ }
4747
+ return false;
4748
+ }
4749
+ /**
4750
+ * If the next token is a given keyword, advance the lexer.
4751
+ * Otherwise, do not change the parser state and throw an error.
4752
+ */
4753
+ expectKeyword(value) {
4754
+ const token = this._lexer.token;
4755
+ if (token.kind === TokenKind.NAME && token.value === value) {
4756
+ this.advanceLexer();
4757
+ } else {
4758
+ throw syntaxError(
4759
+ this._lexer.source,
4760
+ token.start,
4761
+ `Expected "${value}", found ${getTokenDesc(token)}.`
4762
+ );
4763
+ }
4764
+ }
4765
+ /**
4766
+ * If the next token is a given keyword, return "true" after advancing the lexer.
4767
+ * Otherwise, do not change the parser state and return "false".
4768
+ */
4769
+ expectOptionalKeyword(value) {
4770
+ const token = this._lexer.token;
4771
+ if (token.kind === TokenKind.NAME && token.value === value) {
4772
+ this.advanceLexer();
4773
+ return true;
4774
+ }
4775
+ return false;
4776
+ }
4777
+ /**
4778
+ * Helper function for creating an error when an unexpected lexed token is encountered.
4779
+ */
4780
+ unexpected(atToken) {
4781
+ const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
4782
+ return syntaxError(
4783
+ this._lexer.source,
4784
+ token.start,
4785
+ `Unexpected ${getTokenDesc(token)}.`
4786
+ );
4787
+ }
4788
+ /**
4789
+ * Returns a possibly empty list of parse nodes, determined by the parseFn.
4790
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
4791
+ * Advances the parser to the next lex token after the closing token.
4792
+ */
4793
+ any(openKind, parseFn, closeKind) {
4794
+ this.expectToken(openKind);
4795
+ const nodes = [];
4796
+ while (!this.expectOptionalToken(closeKind)) {
4797
+ nodes.push(parseFn.call(this));
4798
+ }
4799
+ return nodes;
4800
+ }
4801
+ /**
4802
+ * Returns a list of parse nodes, determined by the parseFn.
4803
+ * It can be empty only if open token is missing otherwise it will always return non-empty list
4804
+ * that begins with a lex token of openKind and ends with a lex token of closeKind.
4805
+ * Advances the parser to the next lex token after the closing token.
4806
+ */
4807
+ optionalMany(openKind, parseFn, closeKind) {
4808
+ if (this.expectOptionalToken(openKind)) {
4809
+ const nodes = [];
4810
+ do {
4811
+ nodes.push(parseFn.call(this));
4812
+ } while (!this.expectOptionalToken(closeKind));
4813
+ return nodes;
4814
+ }
4815
+ return [];
4816
+ }
4817
+ /**
4818
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
4819
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
4820
+ * Advances the parser to the next lex token after the closing token.
4821
+ */
4822
+ many(openKind, parseFn, closeKind) {
4823
+ this.expectToken(openKind);
4824
+ const nodes = [];
4825
+ do {
4826
+ nodes.push(parseFn.call(this));
4827
+ } while (!this.expectOptionalToken(closeKind));
4828
+ return nodes;
4829
+ }
4830
+ /**
4831
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
4832
+ * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
4833
+ * Advances the parser to the next lex token after last item in the list.
4834
+ */
4835
+ delimitedMany(delimiterKind, parseFn) {
4836
+ this.expectOptionalToken(delimiterKind);
4837
+ const nodes = [];
4838
+ do {
4839
+ nodes.push(parseFn.call(this));
4840
+ } while (this.expectOptionalToken(delimiterKind));
4841
+ return nodes;
4842
+ }
4843
+ advanceLexer() {
4844
+ const { maxTokens } = this._options;
4845
+ const token = this._lexer.advance();
4846
+ if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) {
4847
+ ++this._tokenCounter;
4848
+ if (this._tokenCounter > maxTokens) {
4849
+ throw syntaxError(
4850
+ this._lexer.source,
4851
+ token.start,
4852
+ `Document contains more that ${maxTokens} tokens. Parsing aborted.`
4853
+ );
4854
+ }
4855
+ }
4856
+ }
4857
+ };
4858
+ function getTokenDesc(token) {
4859
+ const value = token.value;
4860
+ return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
4861
+ }
4862
+ function getTokenKindDesc(kind) {
4863
+ return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
4864
+ }
4865
+
4866
+ // src/core/utils/internal/jsonParse.ts
4867
+ function jsonParse(value) {
4868
+ try {
4869
+ return JSON.parse(value);
4870
+ } catch (error3) {
4871
+ return void 0;
4872
+ }
4873
+ }
4874
+
4875
+ // node_modules/.pnpm/headers-polyfill@3.2.3/node_modules/headers-polyfill/lib/index.mjs
4876
+ var __create4 = Object.create;
4877
+ var __defProp6 = Object.defineProperty;
4878
+ var __getOwnPropDesc5 = Object.getOwnPropertyDescriptor;
4879
+ var __getOwnPropNames5 = Object.getOwnPropertyNames;
4880
+ var __getProtoOf4 = Object.getPrototypeOf;
4881
+ var __hasOwnProp5 = Object.prototype.hasOwnProperty;
4882
+ var __commonJS4 = (cb, mod) => function __require() {
4883
+ return mod || (0, cb[__getOwnPropNames5(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4884
+ };
4885
+ var __copyProps5 = (to, from, except, desc) => {
4886
+ if (from && typeof from === "object" || typeof from === "function") {
4887
+ for (let key of __getOwnPropNames5(from))
4888
+ if (!__hasOwnProp5.call(to, key) && key !== except)
4889
+ __defProp6(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc5(from, key)) || desc.enumerable });
4890
+ }
4891
+ return to;
4892
+ };
4893
+ var __toESM4 = (mod, isNodeMode, target) => (target = mod != null ? __create4(__getProtoOf4(mod)) : {}, __copyProps5(
4894
+ isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target,
4895
+ mod
4896
+ ));
4897
+ var require_set_cookie2 = __commonJS4({
4898
+ "node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
4899
+ "use strict";
4900
+ var defaultParseOptions = {
4901
+ decodeValues: true,
4902
+ map: false,
4903
+ silent: false
4904
+ };
4905
+ function isNonEmptyString(str) {
4906
+ return typeof str === "string" && !!str.trim();
4907
+ }
4908
+ function parseString(setCookieValue, options) {
4909
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
4910
+ var nameValuePairStr = parts.shift();
4911
+ var parsed = parseNameValuePair(nameValuePairStr);
4912
+ var name = parsed.name;
4913
+ var value = parsed.value;
4914
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
4915
+ try {
4916
+ value = options.decodeValues ? decodeURIComponent(value) : value;
4917
+ } catch (e) {
4918
+ console.error(
4919
+ "set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.",
4920
+ e
4921
+ );
4922
+ }
4923
+ var cookie = {
4924
+ name,
4925
+ value
4926
+ };
4927
+ parts.forEach(function(part) {
4928
+ var sides = part.split("=");
4929
+ var key = sides.shift().trimLeft().toLowerCase();
4930
+ var value2 = sides.join("=");
4931
+ if (key === "expires") {
4932
+ cookie.expires = new Date(value2);
4933
+ } else if (key === "max-age") {
4934
+ cookie.maxAge = parseInt(value2, 10);
4935
+ } else if (key === "secure") {
4936
+ cookie.secure = true;
4937
+ } else if (key === "httponly") {
4938
+ cookie.httpOnly = true;
4939
+ } else if (key === "samesite") {
4940
+ cookie.sameSite = value2;
4941
+ } else {
4942
+ cookie[key] = value2;
4943
+ }
4944
+ });
4945
+ return cookie;
4946
+ }
4947
+ function parseNameValuePair(nameValuePairStr) {
4948
+ var name = "";
4949
+ var value = "";
4950
+ var nameValueArr = nameValuePairStr.split("=");
4951
+ if (nameValueArr.length > 1) {
4952
+ name = nameValueArr.shift();
4953
+ value = nameValueArr.join("=");
4954
+ } else {
4955
+ value = nameValuePairStr;
4956
+ }
4957
+ return { name, value };
4958
+ }
4959
+ function parse3(input, options) {
4960
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
4961
+ if (!input) {
4962
+ if (!options.map) {
4963
+ return [];
4964
+ } else {
4965
+ return {};
4966
+ }
4967
+ }
4968
+ if (input.headers) {
4969
+ if (typeof input.headers.getSetCookie === "function") {
4970
+ input = input.headers.getSetCookie();
4971
+ } else if (input.headers["set-cookie"]) {
4972
+ input = input.headers["set-cookie"];
4973
+ } else {
4974
+ var sch = input.headers[Object.keys(input.headers).find(function(key) {
4975
+ return key.toLowerCase() === "set-cookie";
4976
+ })];
4977
+ if (!sch && input.headers.cookie && !options.silent) {
4978
+ console.warn(
4979
+ "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
4980
+ );
4981
+ }
4982
+ input = sch;
4983
+ }
4984
+ }
4985
+ if (!Array.isArray(input)) {
4986
+ input = [input];
4987
+ }
4988
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
4989
+ if (!options.map) {
4990
+ return input.filter(isNonEmptyString).map(function(str) {
4991
+ return parseString(str, options);
4992
+ });
4993
+ } else {
4994
+ var cookies = {};
4995
+ return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
4996
+ var cookie = parseString(str, options);
4997
+ cookies2[cookie.name] = cookie;
4998
+ return cookies2;
4999
+ }, cookies);
5000
+ }
5001
+ }
5002
+ function splitCookiesString2(cookiesString) {
5003
+ if (Array.isArray(cookiesString)) {
5004
+ return cookiesString;
5005
+ }
5006
+ if (typeof cookiesString !== "string") {
5007
+ return [];
5008
+ }
5009
+ var cookiesStrings = [];
5010
+ var pos = 0;
5011
+ var start;
5012
+ var ch;
5013
+ var lastComma;
5014
+ var nextStart;
5015
+ var cookiesSeparatorFound;
5016
+ function skipWhitespace() {
5017
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
5018
+ pos += 1;
5019
+ }
5020
+ return pos < cookiesString.length;
5021
+ }
5022
+ function notSpecialChar() {
5023
+ ch = cookiesString.charAt(pos);
5024
+ return ch !== "=" && ch !== ";" && ch !== ",";
5025
+ }
5026
+ while (pos < cookiesString.length) {
5027
+ start = pos;
5028
+ cookiesSeparatorFound = false;
5029
+ while (skipWhitespace()) {
5030
+ ch = cookiesString.charAt(pos);
5031
+ if (ch === ",") {
5032
+ lastComma = pos;
5033
+ pos += 1;
5034
+ skipWhitespace();
5035
+ nextStart = pos;
5036
+ while (pos < cookiesString.length && notSpecialChar()) {
5037
+ pos += 1;
5038
+ }
5039
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
5040
+ cookiesSeparatorFound = true;
5041
+ pos = nextStart;
5042
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
5043
+ start = pos;
5044
+ } else {
5045
+ pos = lastComma + 1;
5046
+ }
5047
+ } else {
5048
+ pos += 1;
5049
+ }
5050
+ }
5051
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) {
5052
+ cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
5053
+ }
5054
+ }
5055
+ return cookiesStrings;
5056
+ }
5057
+ module.exports = parse3;
5058
+ module.exports.parse = parse3;
5059
+ module.exports.parseString = parseString;
5060
+ module.exports.splitCookiesString = splitCookiesString2;
5061
+ }
5062
+ });
5063
+ var import_set_cookie_parser2 = __toESM4(require_set_cookie2());
5064
+ var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i;
5065
+ function normalizeHeaderName(name) {
5066
+ if (typeof name !== "string") {
5067
+ name = String(name);
5068
+ }
5069
+ if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === "") {
5070
+ throw new TypeError("Invalid character in header field name");
5071
+ }
5072
+ return name.toLowerCase();
5073
+ }
5074
+ function normalizeHeaderValue(value) {
5075
+ if (typeof value !== "string") {
5076
+ value = String(value);
5077
+ }
5078
+ return value;
5079
+ }
5080
+ var NORMALIZED_HEADERS = Symbol("normalizedHeaders");
5081
+ var RAW_HEADER_NAMES = Symbol("rawHeaderNames");
5082
+ var HEADER_VALUE_DELIMITER = ", ";
5083
+ var _a;
5084
+ var _b;
5085
+ var HeadersPolyfill = class {
5086
+ constructor(init) {
5087
+ this[_a] = {};
5088
+ this[_b] = /* @__PURE__ */ new Map();
5089
+ if (["Headers", "HeadersPolyfill"].includes(init == null ? void 0 : init.constructor.name) || init instanceof HeadersPolyfill) {
5090
+ const initialHeaders = init;
5091
+ initialHeaders.forEach((value, name) => {
5092
+ this.append(name, value);
5093
+ }, this);
5094
+ } else if (Array.isArray(init)) {
5095
+ init.forEach(([name, value]) => {
5096
+ this.append(
5097
+ name,
5098
+ Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
5099
+ );
5100
+ });
5101
+ } else if (init) {
5102
+ Object.getOwnPropertyNames(init).forEach((name) => {
5103
+ const value = init[name];
5104
+ this.append(
5105
+ name,
5106
+ Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
5107
+ );
5108
+ });
5109
+ }
5058
5110
  }
5059
- /**
5060
- * Determines if the next token is of a given kind
5061
- */
5062
- peek(kind) {
5063
- return this._lexer.token.kind === kind;
5111
+ [(_a = NORMALIZED_HEADERS, _b = RAW_HEADER_NAMES, Symbol.iterator)]() {
5112
+ return this.entries();
5064
5113
  }
5065
- /**
5066
- * If the next token is of the given kind, return that token after advancing the lexer.
5067
- * Otherwise, do not change the parser state and throw an error.
5068
- */
5069
- expectToken(kind) {
5070
- const token = this._lexer.token;
5071
- if (token.kind === kind) {
5072
- this.advanceLexer();
5073
- return token;
5114
+ *keys() {
5115
+ for (const name of Object.keys(this[NORMALIZED_HEADERS])) {
5116
+ yield name;
5074
5117
  }
5075
- throw syntaxError(
5076
- this._lexer.source,
5077
- token.start,
5078
- `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
5079
- );
5080
5118
  }
5081
- /**
5082
- * If the next token is of the given kind, return "true" after advancing the lexer.
5083
- * Otherwise, do not change the parser state and return "false".
5084
- */
5085
- expectOptionalToken(kind) {
5086
- const token = this._lexer.token;
5087
- if (token.kind === kind) {
5088
- this.advanceLexer();
5089
- return true;
5119
+ *values() {
5120
+ for (const value of Object.values(this[NORMALIZED_HEADERS])) {
5121
+ yield value;
5090
5122
  }
5091
- return false;
5092
5123
  }
5093
- /**
5094
- * If the next token is a given keyword, advance the lexer.
5095
- * Otherwise, do not change the parser state and throw an error.
5096
- */
5097
- expectKeyword(value) {
5098
- const token = this._lexer.token;
5099
- if (token.kind === TokenKind.NAME && token.value === value) {
5100
- this.advanceLexer();
5101
- } else {
5102
- throw syntaxError(
5103
- this._lexer.source,
5104
- token.start,
5105
- `Expected "${value}", found ${getTokenDesc(token)}.`
5106
- );
5124
+ *entries() {
5125
+ for (const name of Object.keys(this[NORMALIZED_HEADERS])) {
5126
+ yield [name, this.get(name)];
5107
5127
  }
5108
5128
  }
5109
- /**
5110
- * If the next token is a given keyword, return "true" after advancing the lexer.
5111
- * Otherwise, do not change the parser state and return "false".
5112
- */
5113
- expectOptionalKeyword(value) {
5114
- const token = this._lexer.token;
5115
- if (token.kind === TokenKind.NAME && token.value === value) {
5116
- this.advanceLexer();
5117
- return true;
5118
- }
5119
- return false;
5129
+ get(name) {
5130
+ var _a3;
5131
+ return (_a3 = this[NORMALIZED_HEADERS][normalizeHeaderName(name)]) != null ? _a3 : null;
5120
5132
  }
5121
- /**
5122
- * Helper function for creating an error when an unexpected lexed token is encountered.
5123
- */
5124
- unexpected(atToken) {
5125
- const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
5126
- return syntaxError(
5127
- this._lexer.source,
5128
- token.start,
5129
- `Unexpected ${getTokenDesc(token)}.`
5130
- );
5133
+ set(name, value) {
5134
+ const normalizedName = normalizeHeaderName(name);
5135
+ this[NORMALIZED_HEADERS][normalizedName] = normalizeHeaderValue(value);
5136
+ this[RAW_HEADER_NAMES].set(normalizedName, name);
5131
5137
  }
5132
- /**
5133
- * Returns a possibly empty list of parse nodes, determined by the parseFn.
5134
- * This list begins with a lex token of openKind and ends with a lex token of closeKind.
5135
- * Advances the parser to the next lex token after the closing token.
5136
- */
5137
- any(openKind, parseFn, closeKind) {
5138
- this.expectToken(openKind);
5139
- const nodes = [];
5140
- while (!this.expectOptionalToken(closeKind)) {
5141
- nodes.push(parseFn.call(this));
5142
- }
5143
- return nodes;
5138
+ append(name, value) {
5139
+ const normalizedName = normalizeHeaderName(name);
5140
+ let resolvedValue = this.has(normalizedName) ? `${this.get(normalizedName)}, ${value}` : value;
5141
+ this.set(name, resolvedValue);
5144
5142
  }
5145
- /**
5146
- * Returns a list of parse nodes, determined by the parseFn.
5147
- * It can be empty only if open token is missing otherwise it will always return non-empty list
5148
- * that begins with a lex token of openKind and ends with a lex token of closeKind.
5149
- * Advances the parser to the next lex token after the closing token.
5150
- */
5151
- optionalMany(openKind, parseFn, closeKind) {
5152
- if (this.expectOptionalToken(openKind)) {
5153
- const nodes = [];
5154
- do {
5155
- nodes.push(parseFn.call(this));
5156
- } while (!this.expectOptionalToken(closeKind));
5157
- return nodes;
5143
+ delete(name) {
5144
+ if (!this.has(name)) {
5145
+ return;
5158
5146
  }
5159
- return [];
5147
+ const normalizedName = normalizeHeaderName(name);
5148
+ delete this[NORMALIZED_HEADERS][normalizedName];
5149
+ this[RAW_HEADER_NAMES].delete(normalizedName);
5160
5150
  }
5161
- /**
5162
- * Returns a non-empty list of parse nodes, determined by the parseFn.
5163
- * This list begins with a lex token of openKind and ends with a lex token of closeKind.
5164
- * Advances the parser to the next lex token after the closing token.
5165
- */
5166
- many(openKind, parseFn, closeKind) {
5167
- this.expectToken(openKind);
5168
- const nodes = [];
5169
- do {
5170
- nodes.push(parseFn.call(this));
5171
- } while (!this.expectOptionalToken(closeKind));
5172
- return nodes;
5151
+ all() {
5152
+ return this[NORMALIZED_HEADERS];
5173
5153
  }
5174
- /**
5175
- * Returns a non-empty list of parse nodes, determined by the parseFn.
5176
- * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
5177
- * Advances the parser to the next lex token after last item in the list.
5178
- */
5179
- delimitedMany(delimiterKind, parseFn) {
5180
- this.expectOptionalToken(delimiterKind);
5181
- const nodes = [];
5182
- do {
5183
- nodes.push(parseFn.call(this));
5184
- } while (this.expectOptionalToken(delimiterKind));
5185
- return nodes;
5154
+ raw() {
5155
+ const rawHeaders = {};
5156
+ for (const [name, value] of this.entries()) {
5157
+ rawHeaders[this[RAW_HEADER_NAMES].get(name)] = value;
5158
+ }
5159
+ return rawHeaders;
5186
5160
  }
5187
- advanceLexer() {
5188
- const { maxTokens } = this._options;
5189
- const token = this._lexer.advance();
5190
- if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) {
5191
- ++this._tokenCounter;
5192
- if (this._tokenCounter > maxTokens) {
5193
- throw syntaxError(
5194
- this._lexer.source,
5195
- token.start,
5196
- `Document contains more that ${maxTokens} tokens. Parsing aborted.`
5197
- );
5161
+ has(name) {
5162
+ return this[NORMALIZED_HEADERS].hasOwnProperty(normalizeHeaderName(name));
5163
+ }
5164
+ forEach(callback, thisArg) {
5165
+ for (const name in this[NORMALIZED_HEADERS]) {
5166
+ if (this[NORMALIZED_HEADERS].hasOwnProperty(name)) {
5167
+ callback.call(thisArg, this[NORMALIZED_HEADERS][name], name, this);
5198
5168
  }
5199
5169
  }
5200
5170
  }
5201
- };
5202
- function getTokenDesc(token) {
5203
- const value = token.value;
5204
- return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
5205
- }
5206
- function getTokenKindDesc(kind) {
5207
- return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
5208
- }
5209
-
5210
- // src/core/utils/internal/jsonParse.ts
5211
- function jsonParse(value) {
5212
- try {
5213
- return JSON.parse(value);
5214
- } catch (error3) {
5215
- return void 0;
5171
+ getSetCookie() {
5172
+ const setCookieHeader = this.get("set-cookie");
5173
+ if (setCookieHeader === null) {
5174
+ return [];
5175
+ }
5176
+ if (setCookieHeader === "") {
5177
+ return [""];
5178
+ }
5179
+ return (0, import_set_cookie_parser2.splitCookiesString)(setCookieHeader);
5216
5180
  }
5181
+ };
5182
+ function stringToHeaders(str) {
5183
+ const lines = str.trim().split(/[\r\n]+/);
5184
+ return lines.reduce((headers, line) => {
5185
+ if (line.trim() === "") {
5186
+ return headers;
5187
+ }
5188
+ const parts = line.split(": ");
5189
+ const name = parts.shift();
5190
+ const value = parts.join(": ");
5191
+ headers.append(name, value);
5192
+ return headers;
5193
+ }, new HeadersPolyfill());
5217
5194
  }
5218
5195
 
5219
5196
  // src/core/utils/internal/parseMultipartData.ts
@@ -5406,7 +5383,7 @@ spurious results.`);
5406
5383
  return typeof value === "object" && "kind" in value && "definitions" in value;
5407
5384
  }
5408
5385
  var GraphQLHandler = class extends RequestHandler {
5409
- constructor(operationType, operationName, endpoint, resolver) {
5386
+ constructor(operationType, operationName, endpoint, resolver, options) {
5410
5387
  let resolvedOperationName = operationName;
5411
5388
  if (isDocumentNode(operationName)) {
5412
5389
  const parsedNode = parseDocumentNode(operationName);
@@ -5429,7 +5406,8 @@ spurious results.`);
5429
5406
  operationType,
5430
5407
  operationName: resolvedOperationName
5431
5408
  },
5432
- resolver
5409
+ resolver,
5410
+ options
5433
5411
  });
5434
5412
  this.endpoint = endpoint;
5435
5413
  }
@@ -5488,8 +5466,14 @@ Consider naming this operation or using "graphql.operation()" request handler to
5488
5466
 
5489
5467
  // src/core/graphql.ts
5490
5468
  function createScopedGraphQLHandler(operationType, url) {
5491
- return (operationName, resolver) => {
5492
- return new GraphQLHandler(operationType, operationName, url, resolver);
5469
+ return (operationName, resolver, options = {}) => {
5470
+ return new GraphQLHandler(
5471
+ operationType,
5472
+ operationName,
5473
+ url,
5474
+ resolver,
5475
+ options
5476
+ );
5493
5477
  };
5494
5478
  }
5495
5479
  function createGraphQLOperationHandler(url) {
@@ -6034,53 +6018,16 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
6034
6018
 
6035
6019
  // src/core/bypass.ts
6036
6020
  function bypass(input, init) {
6037
- return __async(this, null, function* () {
6038
- if (isRequest(input)) {
6039
- invariant(
6040
- !input.bodyUsed,
6041
- 'Failed to create a bypassed request to "%s %s": given request instance already has its body read. Make sure to clone the intercepted request if you wish to read its body before bypassing it.',
6042
- input.method,
6043
- input.url
6044
- );
6045
- }
6046
- const url = isRequest(input) ? input.url : input.toString();
6047
- const resolvedInit = typeof init !== "undefined" ? init : yield getRequestInit(input);
6048
- const headers = new HeadersPolyfill(resolvedInit.headers);
6049
- headers.set("x-msw-intention", "bypass");
6050
- resolvedInit.headers = headers;
6051
- return [url, resolvedInit];
6052
- });
6053
- }
6054
- function isRequest(input) {
6055
- return typeof input === "object" && input.constructor.name === "Request" && "clone" in input && typeof input.clone === "function";
6056
- }
6057
- function getRequestInit(input) {
6058
- return __async(this, null, function* () {
6059
- if (!isRequest(input)) {
6060
- return {};
6061
- }
6062
- const init = {
6063
- // Set each request init property explicitly
6064
- // to prevent leaking internal properties of whichever
6065
- // Request polyfill provided as the input.
6066
- mode: input.mode,
6067
- method: input.method,
6068
- cache: input.cache,
6069
- headers: input.headers,
6070
- credentials: input.credentials,
6071
- signal: input.signal,
6072
- referrerPolicy: input.referrerPolicy,
6073
- referrer: input.referrer,
6074
- redirect: input.redirect,
6075
- integrity: input.integrity,
6076
- keepalive: input.keepalive
6077
- };
6078
- if (init.method !== "HEAD" && input.method !== "GET") {
6079
- init.body = yield input.clone().arrayBuffer();
6080
- init.duplex = input.duplex;
6081
- }
6082
- return init;
6083
- });
6021
+ const request = input instanceof Request ? input : new Request(input, init);
6022
+ invariant(
6023
+ !request.bodyUsed,
6024
+ 'Failed to create a bypassed request to "%s %s": given request instance already has its body read. Make sure to clone the intercepted request if you wish to read its body before bypassing it.',
6025
+ request.method,
6026
+ request.url
6027
+ );
6028
+ const requestClone = request.clone();
6029
+ requestClone.headers.set("x-msw-intention", "bypass");
6030
+ return requestClone;
6084
6031
  }
6085
6032
 
6086
6033
  // src/core/passthrough.ts
@@ -6259,7 +6206,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
6259
6206
  return {
6260
6207
  status: response.status,
6261
6208
  statusText: response.statusText,
6262
- headers: flattenHeadersObject(headersToObject(response.headers))
6209
+ headers: Object.fromEntries(response.headers.entries())
6263
6210
  };
6264
6211
  }
6265
6212
 
@@ -6342,9 +6289,9 @@ This exception has been gracefully handled as a 500 response, however, it's stro
6342
6289
  const { payload: actualChecksum } = yield context.events.once(
6343
6290
  "INTEGRITY_CHECK_RESPONSE"
6344
6291
  );
6345
- if (actualChecksum !== "e2d8525b2d1bdadf89a15ae5a2619512") {
6292
+ if (actualChecksum !== "3343a047c60712815551260184217eb5") {
6346
6293
  throw new Error(
6347
- `Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"e2d8525b2d1bdadf89a15ae5a2619512"}).`
6294
+ `Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"3343a047c60712815551260184217eb5"}).`
6348
6295
  );
6349
6296
  }
6350
6297
  return serviceWorker;