msw 0.0.0-fetch.rc-19 → 0.0.0-fetch.rc-21
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/README.md +5 -2
- package/lib/browser/index.d.ts +21 -8
- package/lib/browser/index.js +14 -6
- package/lib/browser/index.mjs +14 -6
- package/lib/core/{GraphQLHandler-2e60cda6.d.ts → GraphQLHandler-a441dd03.d.ts} +19 -7
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/{RequestHandler-e964183f.d.ts → RequestHandler-b59044ae.d.ts} +44 -17
- package/lib/core/SetupApi.d.ts +1 -1
- package/lib/core/bypass.d.ts +7 -7
- package/lib/core/bypass.js +10 -68
- package/lib/core/bypass.mjs +10 -68
- package/lib/core/delay.d.ts +3 -0
- package/lib/core/graphql.d.ts +62 -30
- package/lib/core/graphql.js +38 -16
- package/lib/core/graphql.mjs +38 -16
- package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
- package/lib/core/handlers/GraphQLHandler.js +26 -20
- package/lib/core/handlers/GraphQLHandler.mjs +26 -20
- package/lib/core/handlers/HttpHandler.d.ts +18 -6
- package/lib/core/handlers/HttpHandler.js +17 -16
- package/lib/core/handlers/HttpHandler.mjs +17 -16
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/handlers/RequestHandler.js +43 -35
- package/lib/core/handlers/RequestHandler.mjs +43 -35
- package/lib/core/http.d.ts +18 -9
- package/lib/core/index.d.ts +2 -2
- package/lib/core/passthrough.d.ts +3 -1
- package/lib/core/sharedOptions.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/getResponse.d.ts +1 -1
- package/lib/core/utils/getResponse.js +2 -2
- package/lib/core/utils/getResponse.mjs +2 -2
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +2 -2
- package/lib/core/utils/logging/serializeRequest.d.ts +1 -3
- package/lib/core/utils/logging/serializeRequest.js +1 -2
- package/lib/core/utils/logging/serializeRequest.mjs +1 -2
- package/lib/core/utils/logging/serializeResponse.d.ts +1 -3
- package/lib/core/utils/logging/serializeResponse.js +1 -2
- package/lib/core/utils/logging/serializeResponse.mjs +1 -2
- package/lib/core/utils/request/onUnhandledRequest.d.ts +1 -1
- package/lib/core/utils/request/onUnhandledRequest.js +1 -1
- package/lib/core/utils/request/onUnhandledRequest.mjs +1 -1
- package/lib/core/utils/toResponseInit.js +1 -2
- package/lib/core/utils/toResponseInit.mjs +1 -2
- package/lib/iife/index.js +2182 -2094
- package/lib/mockServiceWorker.js +4 -17
- package/lib/native/index.d.ts +20 -7
- package/lib/native/index.js +5 -0
- package/lib/native/index.mjs +5 -0
- package/lib/node/index.d.ts +20 -7
- package/lib/node/index.js +5 -0
- package/lib/node/index.mjs +5 -0
- package/package.json +5 -6
package/lib/iife/index.js
CHANGED
|
@@ -504,20 +504,20 @@ var MockServiceWorker = (() => {
|
|
|
504
504
|
|
|
505
505
|
// src/core/handlers/RequestHandler.ts
|
|
506
506
|
var RequestHandler = class {
|
|
507
|
-
constructor(
|
|
508
|
-
this.resolver =
|
|
509
|
-
this.
|
|
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({},
|
|
511
|
+
this.info = __spreadProps(__spreadValues({}, args.info), {
|
|
512
512
|
callFrame
|
|
513
513
|
});
|
|
514
514
|
this.isUsed = false;
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
|
-
* Parse the
|
|
517
|
+
* Parse the intercepted request to extract additional information from it.
|
|
518
518
|
* Parsed result is then exposed to other methods of this request handler.
|
|
519
519
|
*/
|
|
520
|
-
parse(
|
|
520
|
+
parse(_args) {
|
|
521
521
|
return __async(this, null, function* () {
|
|
522
522
|
return {};
|
|
523
523
|
});
|
|
@@ -525,53 +525,61 @@ var MockServiceWorker = (() => {
|
|
|
525
525
|
/**
|
|
526
526
|
* Test if this handler matches the given request.
|
|
527
527
|
*/
|
|
528
|
-
test(
|
|
528
|
+
test(args) {
|
|
529
529
|
return __async(this, null, function* () {
|
|
530
|
-
|
|
531
|
-
request,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
530
|
+
const parsedResult = yield this.parse({
|
|
531
|
+
request: args.request,
|
|
532
|
+
resolutionContext: args.resolutionContext
|
|
533
|
+
});
|
|
534
|
+
return this.predicate({
|
|
535
|
+
request: args.request,
|
|
536
|
+
parsedResult,
|
|
537
|
+
resolutionContext: args.resolutionContext
|
|
538
|
+
});
|
|
535
539
|
});
|
|
536
540
|
}
|
|
537
|
-
|
|
541
|
+
extendResolverArgs(_args) {
|
|
538
542
|
return {};
|
|
539
543
|
}
|
|
540
544
|
/**
|
|
541
545
|
* Execute this request handler and produce a mocked response
|
|
542
546
|
* using the given resolver function.
|
|
543
547
|
*/
|
|
544
|
-
run(
|
|
548
|
+
run(args) {
|
|
545
549
|
return __async(this, null, function* () {
|
|
546
|
-
|
|
550
|
+
var _a3;
|
|
551
|
+
if (this.isUsed && ((_a3 = this.options) == null ? void 0 : _a3.once)) {
|
|
547
552
|
return null;
|
|
548
553
|
}
|
|
549
|
-
const mainRequestRef = request.clone();
|
|
554
|
+
const mainRequestRef = args.request.clone();
|
|
550
555
|
this.isUsed = true;
|
|
551
|
-
const parsedResult = yield this.parse(
|
|
552
|
-
|
|
553
|
-
resolutionContext
|
|
554
|
-
);
|
|
555
|
-
const shouldInterceptRequest = this.predicate(
|
|
556
|
-
|
|
556
|
+
const parsedResult = yield this.parse({
|
|
557
|
+
request: args.request,
|
|
558
|
+
resolutionContext: args.resolutionContext
|
|
559
|
+
});
|
|
560
|
+
const shouldInterceptRequest = this.predicate({
|
|
561
|
+
request: args.request,
|
|
557
562
|
parsedResult,
|
|
558
|
-
resolutionContext
|
|
559
|
-
);
|
|
563
|
+
resolutionContext: args.resolutionContext
|
|
564
|
+
});
|
|
560
565
|
if (!shouldInterceptRequest) {
|
|
561
566
|
return null;
|
|
562
567
|
}
|
|
563
568
|
const executeResolver = this.wrapResolver(this.resolver);
|
|
564
|
-
const resolverExtras = this.
|
|
569
|
+
const resolverExtras = this.extendResolverArgs({
|
|
570
|
+
request: args.request,
|
|
571
|
+
parsedResult
|
|
572
|
+
});
|
|
565
573
|
const mockedResponse = yield executeResolver(__spreadProps(__spreadValues({}, resolverExtras), {
|
|
566
|
-
request
|
|
574
|
+
request: args.request
|
|
567
575
|
}));
|
|
568
|
-
const executionResult = this.createExecutionResult(
|
|
576
|
+
const executionResult = this.createExecutionResult({
|
|
569
577
|
// Pass the cloned request to the result so that logging
|
|
570
578
|
// and other consumers could read its body once more.
|
|
571
|
-
mainRequestRef,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
);
|
|
579
|
+
request: mainRequestRef,
|
|
580
|
+
response: mockedResponse,
|
|
581
|
+
parsedResult
|
|
582
|
+
});
|
|
575
583
|
return executionResult;
|
|
576
584
|
});
|
|
577
585
|
}
|
|
@@ -603,12 +611,12 @@ var MockServiceWorker = (() => {
|
|
|
603
611
|
return result;
|
|
604
612
|
});
|
|
605
613
|
}
|
|
606
|
-
createExecutionResult(
|
|
614
|
+
createExecutionResult(args) {
|
|
607
615
|
return {
|
|
608
616
|
handler: this,
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
617
|
+
request: args.request,
|
|
618
|
+
response: args.response,
|
|
619
|
+
parsedResult: args.parsedResult
|
|
612
620
|
};
|
|
613
621
|
}
|
|
614
622
|
};
|
|
@@ -635,7 +643,21 @@ var MockServiceWorker = (() => {
|
|
|
635
643
|
return [now.getHours(), now.getMinutes(), now.getSeconds()].map(String).map((chunk) => chunk.slice(0, 2)).map((chunk) => chunk.padStart(2, "0")).join(":");
|
|
636
644
|
}
|
|
637
645
|
|
|
638
|
-
//
|
|
646
|
+
// src/core/utils/logging/serializeRequest.ts
|
|
647
|
+
function serializeRequest(request) {
|
|
648
|
+
return __async(this, null, function* () {
|
|
649
|
+
const requestClone = request.clone();
|
|
650
|
+
const requestText = yield requestClone.text();
|
|
651
|
+
return {
|
|
652
|
+
url: new URL(request.url),
|
|
653
|
+
method: request.method,
|
|
654
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
655
|
+
body: requestText
|
|
656
|
+
};
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// node_modules/.pnpm/@bundled-es-modules+statuses@1.0.1/node_modules/@bundled-es-modules/statuses/index-esm.js
|
|
639
661
|
var __create = Object.create;
|
|
640
662
|
var __defProp2 = Object.defineProperty;
|
|
641
663
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -654,1476 +676,1286 @@ var MockServiceWorker = (() => {
|
|
|
654
676
|
return to;
|
|
655
677
|
};
|
|
656
678
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
679
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
680
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
681
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
682
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
657
683
|
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
658
684
|
mod
|
|
659
685
|
));
|
|
660
|
-
var
|
|
661
|
-
"node_modules/
|
|
686
|
+
var require_codes = __commonJS({
|
|
687
|
+
"node_modules/statuses/codes.json"(exports, module) {
|
|
688
|
+
module.exports = {
|
|
689
|
+
"100": "Continue",
|
|
690
|
+
"101": "Switching Protocols",
|
|
691
|
+
"102": "Processing",
|
|
692
|
+
"103": "Early Hints",
|
|
693
|
+
"200": "OK",
|
|
694
|
+
"201": "Created",
|
|
695
|
+
"202": "Accepted",
|
|
696
|
+
"203": "Non-Authoritative Information",
|
|
697
|
+
"204": "No Content",
|
|
698
|
+
"205": "Reset Content",
|
|
699
|
+
"206": "Partial Content",
|
|
700
|
+
"207": "Multi-Status",
|
|
701
|
+
"208": "Already Reported",
|
|
702
|
+
"226": "IM Used",
|
|
703
|
+
"300": "Multiple Choices",
|
|
704
|
+
"301": "Moved Permanently",
|
|
705
|
+
"302": "Found",
|
|
706
|
+
"303": "See Other",
|
|
707
|
+
"304": "Not Modified",
|
|
708
|
+
"305": "Use Proxy",
|
|
709
|
+
"307": "Temporary Redirect",
|
|
710
|
+
"308": "Permanent Redirect",
|
|
711
|
+
"400": "Bad Request",
|
|
712
|
+
"401": "Unauthorized",
|
|
713
|
+
"402": "Payment Required",
|
|
714
|
+
"403": "Forbidden",
|
|
715
|
+
"404": "Not Found",
|
|
716
|
+
"405": "Method Not Allowed",
|
|
717
|
+
"406": "Not Acceptable",
|
|
718
|
+
"407": "Proxy Authentication Required",
|
|
719
|
+
"408": "Request Timeout",
|
|
720
|
+
"409": "Conflict",
|
|
721
|
+
"410": "Gone",
|
|
722
|
+
"411": "Length Required",
|
|
723
|
+
"412": "Precondition Failed",
|
|
724
|
+
"413": "Payload Too Large",
|
|
725
|
+
"414": "URI Too Long",
|
|
726
|
+
"415": "Unsupported Media Type",
|
|
727
|
+
"416": "Range Not Satisfiable",
|
|
728
|
+
"417": "Expectation Failed",
|
|
729
|
+
"418": "I'm a Teapot",
|
|
730
|
+
"421": "Misdirected Request",
|
|
731
|
+
"422": "Unprocessable Entity",
|
|
732
|
+
"423": "Locked",
|
|
733
|
+
"424": "Failed Dependency",
|
|
734
|
+
"425": "Too Early",
|
|
735
|
+
"426": "Upgrade Required",
|
|
736
|
+
"428": "Precondition Required",
|
|
737
|
+
"429": "Too Many Requests",
|
|
738
|
+
"431": "Request Header Fields Too Large",
|
|
739
|
+
"451": "Unavailable For Legal Reasons",
|
|
740
|
+
"500": "Internal Server Error",
|
|
741
|
+
"501": "Not Implemented",
|
|
742
|
+
"502": "Bad Gateway",
|
|
743
|
+
"503": "Service Unavailable",
|
|
744
|
+
"504": "Gateway Timeout",
|
|
745
|
+
"505": "HTTP Version Not Supported",
|
|
746
|
+
"506": "Variant Also Negotiates",
|
|
747
|
+
"507": "Insufficient Storage",
|
|
748
|
+
"508": "Loop Detected",
|
|
749
|
+
"509": "Bandwidth Limit Exceeded",
|
|
750
|
+
"510": "Not Extended",
|
|
751
|
+
"511": "Network Authentication Required"
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
var require_statuses = __commonJS({
|
|
756
|
+
"node_modules/statuses/index.js"(exports, module) {
|
|
662
757
|
"use strict";
|
|
663
|
-
var
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
758
|
+
var codes = require_codes();
|
|
759
|
+
module.exports = status2;
|
|
760
|
+
status2.message = codes;
|
|
761
|
+
status2.code = createMessageToStatusCodeMap(codes);
|
|
762
|
+
status2.codes = createStatusCodeList(codes);
|
|
763
|
+
status2.redirect = {
|
|
764
|
+
300: true,
|
|
765
|
+
301: true,
|
|
766
|
+
302: true,
|
|
767
|
+
303: true,
|
|
768
|
+
305: true,
|
|
769
|
+
307: true,
|
|
770
|
+
308: true
|
|
667
771
|
};
|
|
668
|
-
|
|
669
|
-
|
|
772
|
+
status2.empty = {
|
|
773
|
+
204: true,
|
|
774
|
+
205: true,
|
|
775
|
+
304: true
|
|
776
|
+
};
|
|
777
|
+
status2.retry = {
|
|
778
|
+
502: true,
|
|
779
|
+
503: true,
|
|
780
|
+
504: true
|
|
781
|
+
};
|
|
782
|
+
function createMessageToStatusCodeMap(codes2) {
|
|
783
|
+
var map = {};
|
|
784
|
+
Object.keys(codes2).forEach(function forEachCode(code) {
|
|
785
|
+
var message3 = codes2[code];
|
|
786
|
+
var status3 = Number(code);
|
|
787
|
+
map[message3.toLowerCase()] = status3;
|
|
788
|
+
});
|
|
789
|
+
return map;
|
|
670
790
|
}
|
|
671
|
-
function
|
|
672
|
-
|
|
673
|
-
|
|
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
|
-
}
|
|
791
|
+
function createStatusCodeList(codes2) {
|
|
792
|
+
return Object.keys(codes2).map(function mapCode(code) {
|
|
793
|
+
return Number(code);
|
|
707
794
|
});
|
|
708
|
-
return cookie;
|
|
709
795
|
}
|
|
710
|
-
function
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
if (nameValueArr.length > 1) {
|
|
715
|
-
name = nameValueArr.shift();
|
|
716
|
-
value = nameValueArr.join("=");
|
|
717
|
-
} else {
|
|
718
|
-
value = nameValuePairStr;
|
|
796
|
+
function getStatusCode(message3) {
|
|
797
|
+
var msg = message3.toLowerCase();
|
|
798
|
+
if (!Object.prototype.hasOwnProperty.call(status2.code, msg)) {
|
|
799
|
+
throw new Error('invalid status message: "' + message3 + '"');
|
|
719
800
|
}
|
|
720
|
-
return
|
|
801
|
+
return status2.code[msg];
|
|
721
802
|
}
|
|
722
|
-
function
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
if (!options.map) {
|
|
726
|
-
return [];
|
|
727
|
-
} else {
|
|
728
|
-
return {};
|
|
729
|
-
}
|
|
803
|
+
function getStatusMessage(code) {
|
|
804
|
+
if (!Object.prototype.hasOwnProperty.call(status2.message, code)) {
|
|
805
|
+
throw new Error("invalid status code: " + code);
|
|
730
806
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
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
|
-
}
|
|
807
|
+
return status2.message[code];
|
|
808
|
+
}
|
|
809
|
+
function status2(code) {
|
|
810
|
+
if (typeof code === "number") {
|
|
811
|
+
return getStatusMessage(code);
|
|
747
812
|
}
|
|
748
|
-
if (
|
|
749
|
-
|
|
813
|
+
if (typeof code !== "string") {
|
|
814
|
+
throw new TypeError("code must be a number or string");
|
|
750
815
|
}
|
|
751
|
-
|
|
752
|
-
if (!
|
|
753
|
-
return
|
|
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);
|
|
816
|
+
var n = parseInt(code, 10);
|
|
817
|
+
if (!isNaN(n)) {
|
|
818
|
+
return getStatusMessage(n);
|
|
763
819
|
}
|
|
820
|
+
return getStatusCode(code);
|
|
764
821
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
var import_statuses = __toESM(require_statuses(), 1);
|
|
825
|
+
var source_default = import_statuses.default;
|
|
826
|
+
|
|
827
|
+
// src/core/utils/logging/serializeResponse.ts
|
|
828
|
+
var { message } = source_default;
|
|
829
|
+
function serializeResponse(response) {
|
|
830
|
+
return __async(this, null, function* () {
|
|
831
|
+
const responseClone = response.clone();
|
|
832
|
+
const responseText = yield responseClone.text();
|
|
833
|
+
const responseStatus = responseClone.status || 200;
|
|
834
|
+
const responseStatusText = responseClone.statusText || message[responseStatus] || "OK";
|
|
835
|
+
return {
|
|
836
|
+
status: responseStatus,
|
|
837
|
+
statusText: responseStatusText,
|
|
838
|
+
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
839
|
+
body: responseText
|
|
840
|
+
};
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist.es2015/index.js
|
|
845
|
+
function lexer(str) {
|
|
846
|
+
var tokens = [];
|
|
847
|
+
var i = 0;
|
|
848
|
+
while (i < str.length) {
|
|
849
|
+
var char = str[i];
|
|
850
|
+
if (char === "*" || char === "+" || char === "?") {
|
|
851
|
+
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
if (char === "\\") {
|
|
855
|
+
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
if (char === "{") {
|
|
859
|
+
tokens.push({ type: "OPEN", index: i, value: str[i++] });
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
if (char === "}") {
|
|
863
|
+
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
if (char === ":") {
|
|
867
|
+
var name = "";
|
|
868
|
+
var j = i + 1;
|
|
869
|
+
while (j < str.length) {
|
|
870
|
+
var code = str.charCodeAt(j);
|
|
871
|
+
if (
|
|
872
|
+
// `0-9`
|
|
873
|
+
code >= 48 && code <= 57 || // `A-Z`
|
|
874
|
+
code >= 65 && code <= 90 || // `a-z`
|
|
875
|
+
code >= 97 && code <= 122 || // `_`
|
|
876
|
+
code === 95
|
|
877
|
+
) {
|
|
878
|
+
name += str[j++];
|
|
879
|
+
continue;
|
|
782
880
|
}
|
|
783
|
-
|
|
881
|
+
break;
|
|
784
882
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
883
|
+
if (!name)
|
|
884
|
+
throw new TypeError("Missing parameter name at ".concat(i));
|
|
885
|
+
tokens.push({ type: "NAME", index: i, value: name });
|
|
886
|
+
i = j;
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
if (char === "(") {
|
|
890
|
+
var count = 1;
|
|
891
|
+
var pattern = "";
|
|
892
|
+
var j = i + 1;
|
|
893
|
+
if (str[j] === "?") {
|
|
894
|
+
throw new TypeError('Pattern cannot start with "?" at '.concat(j));
|
|
788
895
|
}
|
|
789
|
-
while (
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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
|
-
}
|
|
896
|
+
while (j < str.length) {
|
|
897
|
+
if (str[j] === "\\") {
|
|
898
|
+
pattern += str[j++] + str[j++];
|
|
899
|
+
continue;
|
|
813
900
|
}
|
|
814
|
-
if (
|
|
815
|
-
|
|
901
|
+
if (str[j] === ")") {
|
|
902
|
+
count--;
|
|
903
|
+
if (count === 0) {
|
|
904
|
+
j++;
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
} else if (str[j] === "(") {
|
|
908
|
+
count++;
|
|
909
|
+
if (str[j + 1] !== "?") {
|
|
910
|
+
throw new TypeError("Capturing groups are not allowed at ".concat(j));
|
|
911
|
+
}
|
|
816
912
|
}
|
|
913
|
+
pattern += str[j++];
|
|
817
914
|
}
|
|
818
|
-
|
|
915
|
+
if (count)
|
|
916
|
+
throw new TypeError("Unbalanced pattern at ".concat(i));
|
|
917
|
+
if (!pattern)
|
|
918
|
+
throw new TypeError("Missing pattern at ".concat(i));
|
|
919
|
+
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
|
920
|
+
i = j;
|
|
921
|
+
continue;
|
|
819
922
|
}
|
|
820
|
-
|
|
821
|
-
module.exports.parse = parse3;
|
|
822
|
-
module.exports.parseString = parseString;
|
|
823
|
-
module.exports.splitCookiesString = splitCookiesString2;
|
|
824
|
-
}
|
|
825
|
-
});
|
|
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");
|
|
923
|
+
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
|
834
924
|
}
|
|
835
|
-
|
|
925
|
+
tokens.push({ type: "END", index: i, value: "" });
|
|
926
|
+
return tokens;
|
|
836
927
|
}
|
|
837
|
-
function
|
|
838
|
-
if (
|
|
839
|
-
|
|
928
|
+
function parse(str, options) {
|
|
929
|
+
if (options === void 0) {
|
|
930
|
+
options = {};
|
|
840
931
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
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
|
-
});
|
|
932
|
+
var tokens = lexer(str);
|
|
933
|
+
var _a3 = options.prefixes, prefixes = _a3 === void 0 ? "./" : _a3;
|
|
934
|
+
var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
|
|
935
|
+
var result = [];
|
|
936
|
+
var key = 0;
|
|
937
|
+
var i = 0;
|
|
938
|
+
var path = "";
|
|
939
|
+
var tryConsume = function(type) {
|
|
940
|
+
if (i < tokens.length && tokens[i].type === type)
|
|
941
|
+
return tokens[i++].value;
|
|
942
|
+
};
|
|
943
|
+
var mustConsume = function(type) {
|
|
944
|
+
var value2 = tryConsume(type);
|
|
945
|
+
if (value2 !== void 0)
|
|
946
|
+
return value2;
|
|
947
|
+
var _a4 = tokens[i], nextType = _a4.type, index = _a4.index;
|
|
948
|
+
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
|
|
949
|
+
};
|
|
950
|
+
var consumeText = function() {
|
|
951
|
+
var result2 = "";
|
|
952
|
+
var value2;
|
|
953
|
+
while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
|
|
954
|
+
result2 += value2;
|
|
872
955
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
956
|
+
return result2;
|
|
957
|
+
};
|
|
958
|
+
while (i < tokens.length) {
|
|
959
|
+
var char = tryConsume("CHAR");
|
|
960
|
+
var name = tryConsume("NAME");
|
|
961
|
+
var pattern = tryConsume("PATTERN");
|
|
962
|
+
if (name || pattern) {
|
|
963
|
+
var prefix = char || "";
|
|
964
|
+
if (prefixes.indexOf(prefix) === -1) {
|
|
965
|
+
path += prefix;
|
|
966
|
+
prefix = "";
|
|
967
|
+
}
|
|
968
|
+
if (path) {
|
|
969
|
+
result.push(path);
|
|
970
|
+
path = "";
|
|
971
|
+
}
|
|
972
|
+
result.push({
|
|
973
|
+
name: name || key++,
|
|
974
|
+
prefix,
|
|
975
|
+
suffix: "",
|
|
976
|
+
pattern: pattern || defaultPattern,
|
|
977
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
978
|
+
});
|
|
979
|
+
continue;
|
|
880
980
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
981
|
+
var value = char || tryConsume("ESCAPED_CHAR");
|
|
982
|
+
if (value) {
|
|
983
|
+
path += value;
|
|
984
|
+
continue;
|
|
885
985
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
yield [name, this.get(name)];
|
|
986
|
+
if (path) {
|
|
987
|
+
result.push(path);
|
|
988
|
+
path = "";
|
|
890
989
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
delete(name) {
|
|
907
|
-
if (!this.has(name)) {
|
|
908
|
-
return;
|
|
990
|
+
var open = tryConsume("OPEN");
|
|
991
|
+
if (open) {
|
|
992
|
+
var prefix = consumeText();
|
|
993
|
+
var name_1 = tryConsume("NAME") || "";
|
|
994
|
+
var pattern_1 = tryConsume("PATTERN") || "";
|
|
995
|
+
var suffix = consumeText();
|
|
996
|
+
mustConsume("CLOSE");
|
|
997
|
+
result.push({
|
|
998
|
+
name: name_1 || (pattern_1 ? key++ : ""),
|
|
999
|
+
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
|
|
1000
|
+
prefix,
|
|
1001
|
+
suffix,
|
|
1002
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
1003
|
+
});
|
|
1004
|
+
continue;
|
|
909
1005
|
}
|
|
910
|
-
|
|
911
|
-
delete this[NORMALIZED_HEADERS][normalizedName];
|
|
912
|
-
this[RAW_HEADER_NAMES].delete(normalizedName);
|
|
1006
|
+
mustConsume("END");
|
|
913
1007
|
}
|
|
914
|
-
|
|
915
|
-
|
|
1008
|
+
return result;
|
|
1009
|
+
}
|
|
1010
|
+
function match(str, options) {
|
|
1011
|
+
var keys = [];
|
|
1012
|
+
var re = pathToRegexp(str, keys, options);
|
|
1013
|
+
return regexpToFunction(re, keys, options);
|
|
1014
|
+
}
|
|
1015
|
+
function regexpToFunction(re, keys, options) {
|
|
1016
|
+
if (options === void 0) {
|
|
1017
|
+
options = {};
|
|
916
1018
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1019
|
+
var _a3 = options.decode, decode = _a3 === void 0 ? function(x) {
|
|
1020
|
+
return x;
|
|
1021
|
+
} : _a3;
|
|
1022
|
+
return function(pathname) {
|
|
1023
|
+
var m = re.exec(pathname);
|
|
1024
|
+
if (!m)
|
|
1025
|
+
return false;
|
|
1026
|
+
var path = m[0], index = m.index;
|
|
1027
|
+
var params = /* @__PURE__ */ Object.create(null);
|
|
1028
|
+
var _loop_1 = function(i2) {
|
|
1029
|
+
if (m[i2] === void 0)
|
|
1030
|
+
return "continue";
|
|
1031
|
+
var key = keys[i2 - 1];
|
|
1032
|
+
if (key.modifier === "*" || key.modifier === "+") {
|
|
1033
|
+
params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
|
|
1034
|
+
return decode(value, key);
|
|
1035
|
+
});
|
|
1036
|
+
} else {
|
|
1037
|
+
params[key.name] = decode(m[i2], key);
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
for (var i = 1; i < m.length; i++) {
|
|
1041
|
+
_loop_1(i);
|
|
921
1042
|
}
|
|
922
|
-
return
|
|
1043
|
+
return { path, index, params };
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function escapeString(str) {
|
|
1047
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
1048
|
+
}
|
|
1049
|
+
function flags(options) {
|
|
1050
|
+
return options && options.sensitive ? "" : "i";
|
|
1051
|
+
}
|
|
1052
|
+
function regexpToRegexp(path, keys) {
|
|
1053
|
+
if (!keys)
|
|
1054
|
+
return path;
|
|
1055
|
+
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
1056
|
+
var index = 0;
|
|
1057
|
+
var execResult = groupsRegex.exec(path.source);
|
|
1058
|
+
while (execResult) {
|
|
1059
|
+
keys.push({
|
|
1060
|
+
// Use parenthesized substring match if available, index otherwise
|
|
1061
|
+
name: execResult[1] || index++,
|
|
1062
|
+
prefix: "",
|
|
1063
|
+
suffix: "",
|
|
1064
|
+
modifier: "",
|
|
1065
|
+
pattern: ""
|
|
1066
|
+
});
|
|
1067
|
+
execResult = groupsRegex.exec(path.source);
|
|
923
1068
|
}
|
|
924
|
-
|
|
925
|
-
|
|
1069
|
+
return path;
|
|
1070
|
+
}
|
|
1071
|
+
function arrayToRegexp(paths, keys, options) {
|
|
1072
|
+
var parts = paths.map(function(path) {
|
|
1073
|
+
return pathToRegexp(path, keys, options).source;
|
|
1074
|
+
});
|
|
1075
|
+
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
|
|
1076
|
+
}
|
|
1077
|
+
function stringToRegexp(path, keys, options) {
|
|
1078
|
+
return tokensToRegexp(parse(path, options), keys, options);
|
|
1079
|
+
}
|
|
1080
|
+
function tokensToRegexp(tokens, keys, options) {
|
|
1081
|
+
if (options === void 0) {
|
|
1082
|
+
options = {};
|
|
926
1083
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1084
|
+
var _a3 = options.strict, strict = _a3 === void 0 ? false : _a3, _b2 = options.start, start = _b2 === void 0 ? true : _b2, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
|
|
1085
|
+
return x;
|
|
1086
|
+
} : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
|
|
1087
|
+
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
|
|
1088
|
+
var delimiterRe = "[".concat(escapeString(delimiter), "]");
|
|
1089
|
+
var route = start ? "^" : "";
|
|
1090
|
+
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
1091
|
+
var token = tokens_1[_i];
|
|
1092
|
+
if (typeof token === "string") {
|
|
1093
|
+
route += escapeString(encode(token));
|
|
1094
|
+
} else {
|
|
1095
|
+
var prefix = escapeString(encode(token.prefix));
|
|
1096
|
+
var suffix = escapeString(encode(token.suffix));
|
|
1097
|
+
if (token.pattern) {
|
|
1098
|
+
if (keys)
|
|
1099
|
+
keys.push(token);
|
|
1100
|
+
if (prefix || suffix) {
|
|
1101
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
1102
|
+
var mod = token.modifier === "*" ? "?" : "";
|
|
1103
|
+
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
|
1104
|
+
} else {
|
|
1105
|
+
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
|
1106
|
+
}
|
|
1107
|
+
} else {
|
|
1108
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
1109
|
+
route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
|
|
1110
|
+
} else {
|
|
1111
|
+
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
|
931
1116
|
}
|
|
932
1117
|
}
|
|
933
1118
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
1119
|
+
if (end) {
|
|
1120
|
+
if (!strict)
|
|
1121
|
+
route += "".concat(delimiterRe, "?");
|
|
1122
|
+
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
|
|
1123
|
+
} else {
|
|
1124
|
+
var endToken = tokens[tokens.length - 1];
|
|
1125
|
+
var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
|
|
1126
|
+
if (!strict) {
|
|
1127
|
+
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
|
938
1128
|
}
|
|
939
|
-
if (
|
|
940
|
-
|
|
1129
|
+
if (!isEndDelimited) {
|
|
1130
|
+
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
|
|
941
1131
|
}
|
|
942
|
-
return (0, import_set_cookie_parser.splitCookiesString)(setCookieHeader);
|
|
943
1132
|
}
|
|
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;
|
|
1133
|
+
return new RegExp(route, flags(options));
|
|
953
1134
|
}
|
|
954
|
-
function
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
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
|
-
);
|
|
1135
|
+
function pathToRegexp(path, keys, options) {
|
|
1136
|
+
if (path instanceof RegExp)
|
|
1137
|
+
return regexpToRegexp(path, keys);
|
|
1138
|
+
if (Array.isArray(path))
|
|
1139
|
+
return arrayToRegexp(path, keys, options);
|
|
1140
|
+
return stringToRegexp(path, keys, options);
|
|
981
1141
|
}
|
|
982
1142
|
|
|
983
|
-
//
|
|
984
|
-
function
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
1143
|
+
// node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/lib/index.mjs
|
|
1144
|
+
function isNodeProcess() {
|
|
1145
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
1146
|
+
return true;
|
|
1147
|
+
}
|
|
1148
|
+
if (typeof process !== "undefined") {
|
|
1149
|
+
const type = process.type;
|
|
1150
|
+
if (type === "renderer" || type === "worker") {
|
|
1151
|
+
return false;
|
|
1152
|
+
}
|
|
1153
|
+
return !!(process.versions && process.versions.node);
|
|
1154
|
+
}
|
|
1155
|
+
return false;
|
|
995
1156
|
}
|
|
996
1157
|
|
|
997
|
-
// node_modules/.pnpm/@
|
|
998
|
-
var __create2 = Object.create;
|
|
1158
|
+
// node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
|
|
999
1159
|
var __defProp3 = Object.defineProperty;
|
|
1000
|
-
var
|
|
1001
|
-
|
|
1002
|
-
|
|
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;
|
|
1160
|
+
var __export2 = (target, all) => {
|
|
1161
|
+
for (var name in all)
|
|
1162
|
+
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
1014
1163
|
};
|
|
1015
|
-
var
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
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
|
-
};
|
|
1090
|
-
}
|
|
1164
|
+
var colors_exports = {};
|
|
1165
|
+
__export2(colors_exports, {
|
|
1166
|
+
blue: () => blue,
|
|
1167
|
+
gray: () => gray,
|
|
1168
|
+
green: () => green,
|
|
1169
|
+
red: () => red,
|
|
1170
|
+
yellow: () => yellow
|
|
1091
1171
|
});
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
function createStatusCodeList(codes2) {
|
|
1129
|
-
return Object.keys(codes2).map(function mapCode(code) {
|
|
1130
|
-
return Number(code);
|
|
1131
|
-
});
|
|
1172
|
+
function yellow(text) {
|
|
1173
|
+
return `\x1B[33m${text}\x1B[0m`;
|
|
1174
|
+
}
|
|
1175
|
+
function blue(text) {
|
|
1176
|
+
return `\x1B[34m${text}\x1B[0m`;
|
|
1177
|
+
}
|
|
1178
|
+
function gray(text) {
|
|
1179
|
+
return `\x1B[90m${text}\x1B[0m`;
|
|
1180
|
+
}
|
|
1181
|
+
function red(text) {
|
|
1182
|
+
return `\x1B[31m${text}\x1B[0m`;
|
|
1183
|
+
}
|
|
1184
|
+
function green(text) {
|
|
1185
|
+
return `\x1B[32m${text}\x1B[0m`;
|
|
1186
|
+
}
|
|
1187
|
+
var IS_NODE = isNodeProcess();
|
|
1188
|
+
var Logger = class {
|
|
1189
|
+
constructor(name) {
|
|
1190
|
+
__publicField(this, "prefix");
|
|
1191
|
+
this.name = name;
|
|
1192
|
+
this.prefix = `[${this.name}]`;
|
|
1193
|
+
const LOGGER_NAME = getVariable("DEBUG");
|
|
1194
|
+
const LOGGER_LEVEL = getVariable("LOG_LEVEL");
|
|
1195
|
+
const isLoggingEnabled = LOGGER_NAME === "1" || LOGGER_NAME === "true" || typeof LOGGER_NAME !== "undefined" && this.name.startsWith(LOGGER_NAME);
|
|
1196
|
+
if (isLoggingEnabled) {
|
|
1197
|
+
this.debug = isDefinedAndNotEquals(LOGGER_LEVEL, "debug") ? noop : this.debug;
|
|
1198
|
+
this.info = isDefinedAndNotEquals(LOGGER_LEVEL, "info") ? noop : this.info;
|
|
1199
|
+
this.success = isDefinedAndNotEquals(LOGGER_LEVEL, "success") ? noop : this.success;
|
|
1200
|
+
this.warning = isDefinedAndNotEquals(LOGGER_LEVEL, "warning") ? noop : this.warning;
|
|
1201
|
+
this.error = isDefinedAndNotEquals(LOGGER_LEVEL, "error") ? noop : this.error;
|
|
1202
|
+
} else {
|
|
1203
|
+
this.info = noop;
|
|
1204
|
+
this.success = noop;
|
|
1205
|
+
this.warning = noop;
|
|
1206
|
+
this.error = noop;
|
|
1207
|
+
this.only = noop;
|
|
1132
1208
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1209
|
+
}
|
|
1210
|
+
extend(domain) {
|
|
1211
|
+
return new Logger(`${this.name}:${domain}`);
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Print a debug message.
|
|
1215
|
+
* @example
|
|
1216
|
+
* logger.debug('no duplicates found, creating a document...')
|
|
1217
|
+
*/
|
|
1218
|
+
debug(message3, ...positionals) {
|
|
1219
|
+
this.logEntry({
|
|
1220
|
+
level: "debug",
|
|
1221
|
+
message: gray(message3),
|
|
1222
|
+
positionals,
|
|
1223
|
+
prefix: this.prefix,
|
|
1224
|
+
colors: {
|
|
1225
|
+
prefix: "gray"
|
|
1137
1226
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Print an info message.
|
|
1231
|
+
* @example
|
|
1232
|
+
* logger.info('start parsing...')
|
|
1233
|
+
*/
|
|
1234
|
+
info(message3, ...positionals) {
|
|
1235
|
+
this.logEntry({
|
|
1236
|
+
level: "info",
|
|
1237
|
+
message: message3,
|
|
1238
|
+
positionals,
|
|
1239
|
+
prefix: this.prefix,
|
|
1240
|
+
colors: {
|
|
1241
|
+
prefix: "blue"
|
|
1143
1242
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1243
|
+
});
|
|
1244
|
+
const performance2 = new PerformanceEntry();
|
|
1245
|
+
return (message22, ...positionals2) => {
|
|
1246
|
+
performance2.measure();
|
|
1247
|
+
this.logEntry({
|
|
1248
|
+
level: "info",
|
|
1249
|
+
message: `${message22} ${gray(`${performance2.deltaTime}ms`)}`,
|
|
1250
|
+
positionals: positionals2,
|
|
1251
|
+
prefix: this.prefix,
|
|
1252
|
+
colors: {
|
|
1253
|
+
prefix: "blue"
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Print a success message.
|
|
1260
|
+
* @example
|
|
1261
|
+
* logger.success('successfully created document')
|
|
1262
|
+
*/
|
|
1263
|
+
success(message3, ...positionals) {
|
|
1264
|
+
this.logEntry({
|
|
1265
|
+
level: "info",
|
|
1266
|
+
message: message3,
|
|
1267
|
+
positionals,
|
|
1268
|
+
prefix: `\u2714 ${this.prefix}`,
|
|
1269
|
+
colors: {
|
|
1270
|
+
timestamp: "green",
|
|
1271
|
+
prefix: "green"
|
|
1149
1272
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Print a warning.
|
|
1277
|
+
* @example
|
|
1278
|
+
* logger.warning('found legacy document format')
|
|
1279
|
+
*/
|
|
1280
|
+
warning(message3, ...positionals) {
|
|
1281
|
+
this.logEntry({
|
|
1282
|
+
level: "warning",
|
|
1283
|
+
message: message3,
|
|
1284
|
+
positionals,
|
|
1285
|
+
prefix: `\u26A0 ${this.prefix}`,
|
|
1286
|
+
colors: {
|
|
1287
|
+
timestamp: "yellow",
|
|
1288
|
+
prefix: "yellow"
|
|
1152
1289
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Print an error message.
|
|
1294
|
+
* @example
|
|
1295
|
+
* logger.error('something went wrong')
|
|
1296
|
+
*/
|
|
1297
|
+
error(message3, ...positionals) {
|
|
1298
|
+
this.logEntry({
|
|
1299
|
+
level: "error",
|
|
1300
|
+
message: message3,
|
|
1301
|
+
positionals,
|
|
1302
|
+
prefix: `\u2716 ${this.prefix}`,
|
|
1303
|
+
colors: {
|
|
1304
|
+
timestamp: "red",
|
|
1305
|
+
prefix: "red"
|
|
1156
1306
|
}
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1307
|
+
});
|
|
1159
1308
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1309
|
+
/**
|
|
1310
|
+
* Execute the given callback only when the logging is enabled.
|
|
1311
|
+
* This is skipped in its entirety and has no runtime cost otherwise.
|
|
1312
|
+
* This executes regardless of the log level.
|
|
1313
|
+
* @example
|
|
1314
|
+
* logger.only(() => {
|
|
1315
|
+
* logger.info('additional info')
|
|
1316
|
+
* })
|
|
1317
|
+
*/
|
|
1318
|
+
only(callback) {
|
|
1319
|
+
callback();
|
|
1320
|
+
}
|
|
1321
|
+
createEntry(level, message3) {
|
|
1172
1322
|
return {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
body: responseText
|
|
1323
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1324
|
+
level,
|
|
1325
|
+
message: message3
|
|
1177
1326
|
};
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
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;
|
|
1327
|
+
}
|
|
1328
|
+
logEntry(args) {
|
|
1329
|
+
const {
|
|
1330
|
+
level,
|
|
1331
|
+
message: message3,
|
|
1332
|
+
prefix,
|
|
1333
|
+
colors: customColors,
|
|
1334
|
+
positionals = []
|
|
1335
|
+
} = args;
|
|
1336
|
+
const entry = this.createEntry(level, message3);
|
|
1337
|
+
const timestampColor = (customColors == null ? void 0 : customColors.timestamp) || "gray";
|
|
1338
|
+
const prefixColor = (customColors == null ? void 0 : customColors.prefix) || "gray";
|
|
1339
|
+
const colorize = {
|
|
1340
|
+
timestamp: colors_exports[timestampColor],
|
|
1341
|
+
prefix: colors_exports[prefixColor]
|
|
1342
|
+
};
|
|
1343
|
+
const write = this.getWriter(level);
|
|
1344
|
+
write(
|
|
1345
|
+
[colorize.timestamp(this.formatTimestamp(entry.timestamp))].concat(prefix != null ? colorize.prefix(prefix) : []).concat(serializeInput(message3)).join(" "),
|
|
1346
|
+
...positionals.map(serializeInput)
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
formatTimestamp(timestamp) {
|
|
1350
|
+
return `${timestamp.toLocaleTimeString(
|
|
1351
|
+
"en-GB"
|
|
1352
|
+
)}:${timestamp.getMilliseconds()}`;
|
|
1353
|
+
}
|
|
1354
|
+
getWriter(level) {
|
|
1355
|
+
switch (level) {
|
|
1356
|
+
case "debug":
|
|
1357
|
+
case "success":
|
|
1358
|
+
case "info": {
|
|
1359
|
+
return log;
|
|
1219
1360
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
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));
|
|
1361
|
+
case "warning": {
|
|
1362
|
+
return warn2;
|
|
1232
1363
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
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++];
|
|
1364
|
+
case "error": {
|
|
1365
|
+
return error2;
|
|
1251
1366
|
}
|
|
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
1367
|
}
|
|
1260
|
-
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
|
1261
1368
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1369
|
+
};
|
|
1370
|
+
var PerformanceEntry = class {
|
|
1371
|
+
constructor() {
|
|
1372
|
+
__publicField(this, "startTime");
|
|
1373
|
+
__publicField(this, "endTime");
|
|
1374
|
+
__publicField(this, "deltaTime");
|
|
1375
|
+
this.startTime = performance.now();
|
|
1376
|
+
}
|
|
1377
|
+
measure() {
|
|
1378
|
+
this.endTime = performance.now();
|
|
1379
|
+
const deltaTime = this.endTime - this.startTime;
|
|
1380
|
+
this.deltaTime = deltaTime.toFixed(2);
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
var noop = () => void 0;
|
|
1384
|
+
function log(message3, ...positionals) {
|
|
1385
|
+
if (IS_NODE) {
|
|
1386
|
+
process.stdout.write(format(message3, ...positionals) + "\n");
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
console.log(message3, ...positionals);
|
|
1264
1390
|
}
|
|
1265
|
-
function
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1391
|
+
function warn2(message3, ...positionals) {
|
|
1392
|
+
if (IS_NODE) {
|
|
1393
|
+
process.stderr.write(format(message3, ...positionals) + "\n");
|
|
1394
|
+
return;
|
|
1268
1395
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
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 = "";
|
|
1326
|
-
}
|
|
1327
|
-
var open = tryConsume("OPEN");
|
|
1328
|
-
if (open) {
|
|
1329
|
-
var prefix = consumeText();
|
|
1330
|
-
var name_1 = tryConsume("NAME") || "";
|
|
1331
|
-
var pattern_1 = tryConsume("PATTERN") || "";
|
|
1332
|
-
var suffix = consumeText();
|
|
1333
|
-
mustConsume("CLOSE");
|
|
1334
|
-
result.push({
|
|
1335
|
-
name: name_1 || (pattern_1 ? key++ : ""),
|
|
1336
|
-
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
|
|
1337
|
-
prefix,
|
|
1338
|
-
suffix,
|
|
1339
|
-
modifier: tryConsume("MODIFIER") || ""
|
|
1340
|
-
});
|
|
1341
|
-
continue;
|
|
1342
|
-
}
|
|
1343
|
-
mustConsume("END");
|
|
1396
|
+
console.warn(message3, ...positionals);
|
|
1397
|
+
}
|
|
1398
|
+
function error2(message3, ...positionals) {
|
|
1399
|
+
if (IS_NODE) {
|
|
1400
|
+
process.stderr.write(format(message3, ...positionals) + "\n");
|
|
1401
|
+
return;
|
|
1344
1402
|
}
|
|
1345
|
-
|
|
1403
|
+
console.error(message3, ...positionals);
|
|
1346
1404
|
}
|
|
1347
|
-
function
|
|
1348
|
-
var
|
|
1349
|
-
|
|
1350
|
-
|
|
1405
|
+
function getVariable(variableName) {
|
|
1406
|
+
var _a3;
|
|
1407
|
+
if (IS_NODE) {
|
|
1408
|
+
return process.env[variableName];
|
|
1409
|
+
}
|
|
1410
|
+
return (_a3 = globalThis[variableName]) == null ? void 0 : _a3.toString();
|
|
1351
1411
|
}
|
|
1352
|
-
function
|
|
1353
|
-
|
|
1354
|
-
|
|
1412
|
+
function isDefinedAndNotEquals(value, expected) {
|
|
1413
|
+
return value !== void 0 && value !== expected;
|
|
1414
|
+
}
|
|
1415
|
+
function serializeInput(message3) {
|
|
1416
|
+
if (typeof message3 === "undefined") {
|
|
1417
|
+
return "undefined";
|
|
1355
1418
|
}
|
|
1356
|
-
|
|
1357
|
-
return
|
|
1358
|
-
} : _a3;
|
|
1359
|
-
return function(pathname) {
|
|
1360
|
-
var m = re.exec(pathname);
|
|
1361
|
-
if (!m)
|
|
1362
|
-
return false;
|
|
1363
|
-
var path = m[0], index = m.index;
|
|
1364
|
-
var params = /* @__PURE__ */ Object.create(null);
|
|
1365
|
-
var _loop_1 = function(i2) {
|
|
1366
|
-
if (m[i2] === void 0)
|
|
1367
|
-
return "continue";
|
|
1368
|
-
var key = keys[i2 - 1];
|
|
1369
|
-
if (key.modifier === "*" || key.modifier === "+") {
|
|
1370
|
-
params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
|
|
1371
|
-
return decode(value, key);
|
|
1372
|
-
});
|
|
1373
|
-
} else {
|
|
1374
|
-
params[key.name] = decode(m[i2], key);
|
|
1375
|
-
}
|
|
1376
|
-
};
|
|
1377
|
-
for (var i = 1; i < m.length; i++) {
|
|
1378
|
-
_loop_1(i);
|
|
1379
|
-
}
|
|
1380
|
-
return { path, index, params };
|
|
1381
|
-
};
|
|
1382
|
-
}
|
|
1383
|
-
function escapeString(str) {
|
|
1384
|
-
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
1385
|
-
}
|
|
1386
|
-
function flags(options) {
|
|
1387
|
-
return options && options.sensitive ? "" : "i";
|
|
1388
|
-
}
|
|
1389
|
-
function regexpToRegexp(path, keys) {
|
|
1390
|
-
if (!keys)
|
|
1391
|
-
return path;
|
|
1392
|
-
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
1393
|
-
var index = 0;
|
|
1394
|
-
var execResult = groupsRegex.exec(path.source);
|
|
1395
|
-
while (execResult) {
|
|
1396
|
-
keys.push({
|
|
1397
|
-
// Use parenthesized substring match if available, index otherwise
|
|
1398
|
-
name: execResult[1] || index++,
|
|
1399
|
-
prefix: "",
|
|
1400
|
-
suffix: "",
|
|
1401
|
-
modifier: "",
|
|
1402
|
-
pattern: ""
|
|
1403
|
-
});
|
|
1404
|
-
execResult = groupsRegex.exec(path.source);
|
|
1419
|
+
if (message3 === null) {
|
|
1420
|
+
return "null";
|
|
1405
1421
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
return
|
|
1411
|
-
}
|
|
1412
|
-
return
|
|
1422
|
+
if (typeof message3 === "string") {
|
|
1423
|
+
return message3;
|
|
1424
|
+
}
|
|
1425
|
+
if (typeof message3 === "object") {
|
|
1426
|
+
return JSON.stringify(message3);
|
|
1427
|
+
}
|
|
1428
|
+
return message3.toString();
|
|
1413
1429
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1430
|
+
|
|
1431
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-RGYCLCLK.mjs
|
|
1432
|
+
function nextTick(callback) {
|
|
1433
|
+
setTimeout(callback, 0);
|
|
1416
1434
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1435
|
+
var AsyncEventEmitter = class extends Emitter {
|
|
1436
|
+
constructor() {
|
|
1437
|
+
super();
|
|
1438
|
+
this.logger = new Logger("async-event-emitter");
|
|
1439
|
+
this.queue = /* @__PURE__ */ new Map();
|
|
1440
|
+
this.readyState = "ACTIVE";
|
|
1420
1441
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
1428
|
-
var token = tokens_1[_i];
|
|
1429
|
-
if (typeof token === "string") {
|
|
1430
|
-
route += escapeString(encode(token));
|
|
1431
|
-
} else {
|
|
1432
|
-
var prefix = escapeString(encode(token.prefix));
|
|
1433
|
-
var suffix = escapeString(encode(token.suffix));
|
|
1434
|
-
if (token.pattern) {
|
|
1435
|
-
if (keys)
|
|
1436
|
-
keys.push(token);
|
|
1437
|
-
if (prefix || suffix) {
|
|
1438
|
-
if (token.modifier === "+" || token.modifier === "*") {
|
|
1439
|
-
var mod = token.modifier === "*" ? "?" : "";
|
|
1440
|
-
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
|
1441
|
-
} else {
|
|
1442
|
-
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
|
1443
|
-
}
|
|
1444
|
-
} else {
|
|
1445
|
-
if (token.modifier === "+" || token.modifier === "*") {
|
|
1446
|
-
route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
|
|
1447
|
-
} else {
|
|
1448
|
-
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
} else {
|
|
1452
|
-
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
|
1453
|
-
}
|
|
1442
|
+
on(eventName, listener) {
|
|
1443
|
+
const logger = this.logger.extend("on");
|
|
1444
|
+
logger.info('adding "%s" listener...', eventName);
|
|
1445
|
+
if (this.readyState === "DEACTIVATED") {
|
|
1446
|
+
logger.info("the emitter is destroyed, skipping!");
|
|
1447
|
+
return this;
|
|
1454
1448
|
}
|
|
1449
|
+
return super.on(eventName, (...args) => __async(this, null, function* () {
|
|
1450
|
+
const queue = this.openListenerQueue(eventName);
|
|
1451
|
+
logger.info('awaiting the "%s" listener...', eventName);
|
|
1452
|
+
queue.push({
|
|
1453
|
+
args,
|
|
1454
|
+
done: new Promise((resolve, reject) => __async(this, null, function* () {
|
|
1455
|
+
try {
|
|
1456
|
+
yield listener(...args);
|
|
1457
|
+
resolve();
|
|
1458
|
+
logger.info('"%s" listener has resolved!', eventName);
|
|
1459
|
+
} catch (error3) {
|
|
1460
|
+
logger.info('"%s" listener has rejected!', error3);
|
|
1461
|
+
reject(error3);
|
|
1462
|
+
}
|
|
1463
|
+
}))
|
|
1464
|
+
});
|
|
1465
|
+
}));
|
|
1455
1466
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
|
|
1463
|
-
if (!strict) {
|
|
1464
|
-
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
|
1467
|
+
emit(eventName, ...data) {
|
|
1468
|
+
const logger = this.logger.extend("emit");
|
|
1469
|
+
logger.info('emitting "%s" event...', eventName);
|
|
1470
|
+
if (this.readyState === "DEACTIVATED") {
|
|
1471
|
+
logger.info("the emitter is destroyed, skipping!");
|
|
1472
|
+
return false;
|
|
1465
1473
|
}
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1474
|
+
if (this.isInternalEventName(eventName)) {
|
|
1475
|
+
return super.emit(eventName, ...data);
|
|
1468
1476
|
}
|
|
1477
|
+
this.openListenerQueue(eventName);
|
|
1478
|
+
logger.info('appending a one-time cleanup "%s" listener...', eventName);
|
|
1479
|
+
this.once(eventName, () => {
|
|
1480
|
+
nextTick(() => {
|
|
1481
|
+
this.queue.delete(eventName);
|
|
1482
|
+
logger.info('cleaned up "%s" listeners queue!', eventName);
|
|
1483
|
+
});
|
|
1484
|
+
});
|
|
1485
|
+
return super.emit(eventName, ...data);
|
|
1469
1486
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
return
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1487
|
+
/**
|
|
1488
|
+
* Returns a promise that resolves when all the listeners for the given event
|
|
1489
|
+
* has been called. Awaits asynchronous listeners.
|
|
1490
|
+
* If the event has no listeners, resolves immediately.
|
|
1491
|
+
*/
|
|
1492
|
+
untilIdle(eventName, filter = () => true) {
|
|
1493
|
+
return __async(this, null, function* () {
|
|
1494
|
+
const listenersQueue = this.queue.get(eventName) || [];
|
|
1495
|
+
yield Promise.all(
|
|
1496
|
+
listenersQueue.filter(filter).map(({ done }) => done)
|
|
1497
|
+
).finally(() => {
|
|
1498
|
+
this.queue.delete(eventName);
|
|
1499
|
+
});
|
|
1500
|
+
});
|
|
1484
1501
|
}
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
|
|
1502
|
+
openListenerQueue(eventName) {
|
|
1503
|
+
const logger = this.logger.extend("openListenerQueue");
|
|
1504
|
+
logger.info('opening "%s" listeners queue...', eventName);
|
|
1505
|
+
const queue = this.queue.get(eventName);
|
|
1506
|
+
if (!queue) {
|
|
1507
|
+
logger.info("no queue found, creating one...");
|
|
1508
|
+
this.queue.set(eventName, []);
|
|
1509
|
+
return [];
|
|
1489
1510
|
}
|
|
1490
|
-
|
|
1511
|
+
logger.info("returning an exising queue:", queue);
|
|
1512
|
+
return queue;
|
|
1513
|
+
}
|
|
1514
|
+
removeAllListeners(eventName) {
|
|
1515
|
+
const logger = this.logger.extend("removeAllListeners");
|
|
1516
|
+
logger.info("event:", eventName);
|
|
1517
|
+
if (eventName) {
|
|
1518
|
+
this.queue.delete(eventName);
|
|
1519
|
+
logger.info(
|
|
1520
|
+
'cleared the "%s" listeners queue!',
|
|
1521
|
+
eventName,
|
|
1522
|
+
this.queue.get(eventName)
|
|
1523
|
+
);
|
|
1524
|
+
} else {
|
|
1525
|
+
this.queue.clear();
|
|
1526
|
+
logger.info("cleared the listeners queue!", this.queue);
|
|
1527
|
+
}
|
|
1528
|
+
return super.removeAllListeners(eventName);
|
|
1529
|
+
}
|
|
1530
|
+
activate() {
|
|
1531
|
+
const logger = this.logger.extend("activate");
|
|
1532
|
+
this.readyState = "ACTIVE";
|
|
1533
|
+
logger.info("set state to:", this.readyState);
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Deactivate this event emitter.
|
|
1537
|
+
* Deactivated emitter can no longer emit and listen to events
|
|
1538
|
+
* and needs to be activated again in order to do so.
|
|
1539
|
+
*/
|
|
1540
|
+
deactivate() {
|
|
1541
|
+
const logger = this.logger.extend("deactivate");
|
|
1542
|
+
logger.info("removing all listeners...");
|
|
1543
|
+
this.removeAllListeners();
|
|
1544
|
+
this.readyState = "DEACTIVATED";
|
|
1545
|
+
logger.info("set state to:", this.readyState);
|
|
1546
|
+
}
|
|
1547
|
+
isInternalEventName(eventName) {
|
|
1548
|
+
return eventName === "newListener" || eventName === "removeListener";
|
|
1491
1549
|
}
|
|
1492
|
-
return false;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
// node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
|
|
1496
|
-
var __defProp4 = Object.defineProperty;
|
|
1497
|
-
var __export2 = (target, all) => {
|
|
1498
|
-
for (var name in all)
|
|
1499
|
-
__defProp4(target, name, { get: all[name], enumerable: true });
|
|
1500
1550
|
};
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
red: () => red,
|
|
1507
|
-
yellow: () => yellow
|
|
1508
|
-
});
|
|
1509
|
-
function yellow(text) {
|
|
1510
|
-
return `\x1B[33m${text}\x1B[0m`;
|
|
1511
|
-
}
|
|
1512
|
-
function blue(text) {
|
|
1513
|
-
return `\x1B[34m${text}\x1B[0m`;
|
|
1514
|
-
}
|
|
1515
|
-
function gray(text) {
|
|
1516
|
-
return `\x1B[90m${text}\x1B[0m`;
|
|
1551
|
+
function getGlobalSymbol(symbol) {
|
|
1552
|
+
return (
|
|
1553
|
+
// @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
|
|
1554
|
+
globalThis[symbol] || void 0
|
|
1555
|
+
);
|
|
1517
1556
|
}
|
|
1518
|
-
function
|
|
1519
|
-
|
|
1557
|
+
function setGlobalSymbol(symbol, value) {
|
|
1558
|
+
globalThis[symbol] = value;
|
|
1520
1559
|
}
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1560
|
+
function deleteGlobalSymbol(symbol) {
|
|
1561
|
+
delete globalThis[symbol];
|
|
1523
1562
|
}
|
|
1524
|
-
var
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
this.
|
|
1529
|
-
this.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
if (isLoggingEnabled) {
|
|
1534
|
-
this.debug = isDefinedAndNotEquals(LOGGER_LEVEL, "debug") ? noop : this.debug;
|
|
1535
|
-
this.info = isDefinedAndNotEquals(LOGGER_LEVEL, "info") ? noop : this.info;
|
|
1536
|
-
this.success = isDefinedAndNotEquals(LOGGER_LEVEL, "success") ? noop : this.success;
|
|
1537
|
-
this.warning = isDefinedAndNotEquals(LOGGER_LEVEL, "warning") ? noop : this.warning;
|
|
1538
|
-
this.error = isDefinedAndNotEquals(LOGGER_LEVEL, "error") ? noop : this.error;
|
|
1539
|
-
} else {
|
|
1540
|
-
this.info = noop;
|
|
1541
|
-
this.success = noop;
|
|
1542
|
-
this.warning = noop;
|
|
1543
|
-
this.error = noop;
|
|
1544
|
-
this.only = noop;
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
extend(domain) {
|
|
1548
|
-
return new Logger(`${this.name}:${domain}`);
|
|
1563
|
+
var Interceptor = class {
|
|
1564
|
+
constructor(symbol) {
|
|
1565
|
+
this.symbol = symbol;
|
|
1566
|
+
this.readyState = "INACTIVE";
|
|
1567
|
+
this.emitter = new AsyncEventEmitter();
|
|
1568
|
+
this.subscriptions = [];
|
|
1569
|
+
this.logger = new Logger(symbol.description);
|
|
1570
|
+
this.emitter.setMaxListeners(0);
|
|
1571
|
+
this.logger.info("constructing the interceptor...");
|
|
1549
1572
|
}
|
|
1550
1573
|
/**
|
|
1551
|
-
*
|
|
1552
|
-
*
|
|
1553
|
-
* logger.debug('no duplicates found, creating a document...')
|
|
1574
|
+
* Determine if this interceptor can be applied
|
|
1575
|
+
* in the current environment.
|
|
1554
1576
|
*/
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
level: "debug",
|
|
1558
|
-
message: gray(message3),
|
|
1559
|
-
positionals,
|
|
1560
|
-
prefix: this.prefix,
|
|
1561
|
-
colors: {
|
|
1562
|
-
prefix: "gray"
|
|
1563
|
-
}
|
|
1564
|
-
});
|
|
1577
|
+
checkEnvironment() {
|
|
1578
|
+
return true;
|
|
1565
1579
|
}
|
|
1566
1580
|
/**
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1569
|
-
* logger.info('start parsing...')
|
|
1581
|
+
* Apply this interceptor to the current process.
|
|
1582
|
+
* Returns an already running interceptor instance if it's present.
|
|
1570
1583
|
*/
|
|
1571
|
-
|
|
1572
|
-
this.
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1584
|
+
apply() {
|
|
1585
|
+
const logger = this.logger.extend("apply");
|
|
1586
|
+
logger.info("applying the interceptor...");
|
|
1587
|
+
if (this.readyState === "APPLIED") {
|
|
1588
|
+
logger.info("intercepted already applied!");
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
const shouldApply = this.checkEnvironment();
|
|
1592
|
+
if (!shouldApply) {
|
|
1593
|
+
logger.info("the interceptor cannot be applied in this environment!");
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
this.readyState = "APPLYING";
|
|
1597
|
+
this.emitter.activate();
|
|
1598
|
+
logger.info("activated the emiter!", this.emitter.readyState);
|
|
1599
|
+
const runningInstance = this.getInstance();
|
|
1600
|
+
if (runningInstance) {
|
|
1601
|
+
logger.info("found a running instance, reusing...");
|
|
1602
|
+
this.on = (event, listener) => {
|
|
1603
|
+
logger.info('proxying the "%s" listener', event);
|
|
1604
|
+
runningInstance.emitter.addListener(event, listener);
|
|
1605
|
+
this.subscriptions.push(() => {
|
|
1606
|
+
runningInstance.emitter.removeListener(event, listener);
|
|
1607
|
+
logger.info('removed proxied "%s" listener!', event);
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1610
|
+
this.readyState = "APPLIED";
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
logger.info("no running instance found, setting up a new instance...");
|
|
1614
|
+
this.setup();
|
|
1615
|
+
this.setInstance();
|
|
1616
|
+
this.readyState = "APPLIED";
|
|
1594
1617
|
}
|
|
1595
1618
|
/**
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1619
|
+
* Setup the module augments and stubs necessary for this interceptor.
|
|
1620
|
+
* This method is not run if there's a running interceptor instance
|
|
1621
|
+
* to prevent instantiating an interceptor multiple times.
|
|
1599
1622
|
*/
|
|
1600
|
-
|
|
1601
|
-
this.logEntry({
|
|
1602
|
-
level: "info",
|
|
1603
|
-
message: message3,
|
|
1604
|
-
positionals,
|
|
1605
|
-
prefix: `\u2714 ${this.prefix}`,
|
|
1606
|
-
colors: {
|
|
1607
|
-
timestamp: "green",
|
|
1608
|
-
prefix: "green"
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1623
|
+
setup() {
|
|
1611
1624
|
}
|
|
1612
1625
|
/**
|
|
1613
|
-
*
|
|
1614
|
-
* @example
|
|
1615
|
-
* logger.warning('found legacy document format')
|
|
1626
|
+
* Listen to the interceptor's public events.
|
|
1616
1627
|
*/
|
|
1617
|
-
|
|
1618
|
-
this.
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
prefix: "yellow"
|
|
1626
|
-
}
|
|
1627
|
-
});
|
|
1628
|
+
on(eventName, listener) {
|
|
1629
|
+
const logger = this.logger.extend("on");
|
|
1630
|
+
if (this.readyState === "DISPOSING" || this.readyState === "DISPOSED") {
|
|
1631
|
+
logger.info("cannot listen to events, already disposed!");
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1634
|
+
logger.info('adding "%s" event listener:', eventName, listener.name);
|
|
1635
|
+
this.emitter.on(eventName, listener);
|
|
1628
1636
|
}
|
|
1629
1637
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
* @example
|
|
1632
|
-
* logger.error('something went wrong')
|
|
1638
|
+
* Disposes of any side-effects this interceptor has introduced.
|
|
1633
1639
|
*/
|
|
1634
|
-
|
|
1635
|
-
this.
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1640
|
+
dispose() {
|
|
1641
|
+
const logger = this.logger.extend("dispose");
|
|
1642
|
+
if (this.readyState === "DISPOSED") {
|
|
1643
|
+
logger.info("cannot dispose, already disposed!");
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
logger.info("disposing the interceptor...");
|
|
1647
|
+
this.readyState = "DISPOSING";
|
|
1648
|
+
if (!this.getInstance()) {
|
|
1649
|
+
logger.info("no interceptors running, skipping dispose...");
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
this.clearInstance();
|
|
1653
|
+
logger.info("global symbol deleted:", getGlobalSymbol(this.symbol));
|
|
1654
|
+
if (this.subscriptions.length > 0) {
|
|
1655
|
+
logger.info("disposing of %d subscriptions...", this.subscriptions.length);
|
|
1656
|
+
for (const dispose of this.subscriptions) {
|
|
1657
|
+
dispose();
|
|
1643
1658
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
* @example
|
|
1651
|
-
* logger.only(() => {
|
|
1652
|
-
* logger.info('additional info')
|
|
1653
|
-
* })
|
|
1654
|
-
*/
|
|
1655
|
-
only(callback) {
|
|
1656
|
-
callback();
|
|
1659
|
+
this.subscriptions = [];
|
|
1660
|
+
logger.info("disposed of all subscriptions!", this.subscriptions.length);
|
|
1661
|
+
}
|
|
1662
|
+
this.emitter.deactivate();
|
|
1663
|
+
logger.info("destroyed the listener!");
|
|
1664
|
+
this.readyState = "DISPOSED";
|
|
1657
1665
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
};
|
|
1666
|
+
getInstance() {
|
|
1667
|
+
var _a3;
|
|
1668
|
+
const instance = getGlobalSymbol(this.symbol);
|
|
1669
|
+
this.logger.info("retrieved global instance:", (_a3 = instance == null ? void 0 : instance.constructor) == null ? void 0 : _a3.name);
|
|
1670
|
+
return instance;
|
|
1664
1671
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
message: message3,
|
|
1669
|
-
prefix,
|
|
1670
|
-
colors: customColors,
|
|
1671
|
-
positionals = []
|
|
1672
|
-
} = args;
|
|
1673
|
-
const entry = this.createEntry(level, message3);
|
|
1674
|
-
const timestampColor = (customColors == null ? void 0 : customColors.timestamp) || "gray";
|
|
1675
|
-
const prefixColor = (customColors == null ? void 0 : customColors.prefix) || "gray";
|
|
1676
|
-
const colorize = {
|
|
1677
|
-
timestamp: colors_exports[timestampColor],
|
|
1678
|
-
prefix: colors_exports[prefixColor]
|
|
1679
|
-
};
|
|
1680
|
-
const write = this.getWriter(level);
|
|
1681
|
-
write(
|
|
1682
|
-
[colorize.timestamp(this.formatTimestamp(entry.timestamp))].concat(prefix != null ? colorize.prefix(prefix) : []).concat(serializeInput(message3)).join(" "),
|
|
1683
|
-
...positionals.map(serializeInput)
|
|
1684
|
-
);
|
|
1672
|
+
setInstance() {
|
|
1673
|
+
setGlobalSymbol(this.symbol, this);
|
|
1674
|
+
this.logger.info("set global instance!", this.symbol.description);
|
|
1685
1675
|
}
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
)}:${timestamp.getMilliseconds()}`;
|
|
1690
|
-
}
|
|
1691
|
-
getWriter(level) {
|
|
1692
|
-
switch (level) {
|
|
1693
|
-
case "debug":
|
|
1694
|
-
case "success":
|
|
1695
|
-
case "info": {
|
|
1696
|
-
return log;
|
|
1697
|
-
}
|
|
1698
|
-
case "warning": {
|
|
1699
|
-
return warn2;
|
|
1700
|
-
}
|
|
1701
|
-
case "error": {
|
|
1702
|
-
return error2;
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1676
|
+
clearInstance() {
|
|
1677
|
+
deleteGlobalSymbol(this.symbol);
|
|
1678
|
+
this.logger.info("cleared global instance!", this.symbol.description);
|
|
1705
1679
|
}
|
|
1706
1680
|
};
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
measure() {
|
|
1715
|
-
this.endTime = performance.now();
|
|
1716
|
-
const deltaTime = this.endTime - this.startTime;
|
|
1717
|
-
this.deltaTime = deltaTime.toFixed(2);
|
|
1681
|
+
|
|
1682
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-VS3GJPUE.mjs
|
|
1683
|
+
var BatchInterceptor = class extends Interceptor {
|
|
1684
|
+
constructor(options) {
|
|
1685
|
+
BatchInterceptor.symbol = Symbol(options.name);
|
|
1686
|
+
super(BatchInterceptor.symbol);
|
|
1687
|
+
this.interceptors = options.interceptors;
|
|
1718
1688
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1689
|
+
setup() {
|
|
1690
|
+
const logger = this.logger.extend("setup");
|
|
1691
|
+
logger.info("applying all %d interceptors...", this.interceptors.length);
|
|
1692
|
+
for (const interceptor of this.interceptors) {
|
|
1693
|
+
logger.info('applying "%s" interceptor...', interceptor.constructor.name);
|
|
1694
|
+
interceptor.apply();
|
|
1695
|
+
logger.info("adding interceptor dispose subscription");
|
|
1696
|
+
this.subscriptions.push(() => interceptor.dispose());
|
|
1697
|
+
}
|
|
1725
1698
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
process.stderr.write(format(message3, ...positionals) + "\n");
|
|
1731
|
-
return;
|
|
1699
|
+
on(event, listener) {
|
|
1700
|
+
this.interceptors.forEach((interceptor) => {
|
|
1701
|
+
interceptor.on(event, listener);
|
|
1702
|
+
});
|
|
1732
1703
|
}
|
|
1733
|
-
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-7II4SWKS.mjs
|
|
1707
|
+
var encoder = new TextEncoder();
|
|
1708
|
+
|
|
1709
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-GFH37L5D.mjs
|
|
1710
|
+
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
1711
|
+
|
|
1712
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/index.mjs
|
|
1713
|
+
function getCleanUrl(url, isAbsolute = true) {
|
|
1714
|
+
return [isAbsolute && url.origin, url.pathname].filter(Boolean).join("");
|
|
1734
1715
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
console.error(message3, ...positionals);
|
|
1716
|
+
|
|
1717
|
+
// src/core/utils/url/cleanUrl.ts
|
|
1718
|
+
var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g;
|
|
1719
|
+
function getSearchParams(path) {
|
|
1720
|
+
return new URL(`/${path}`, "http://localhost").searchParams;
|
|
1741
1721
|
}
|
|
1742
|
-
function
|
|
1743
|
-
|
|
1744
|
-
if (IS_NODE) {
|
|
1745
|
-
return process.env[variableName];
|
|
1746
|
-
}
|
|
1747
|
-
return (_a3 = globalThis[variableName]) == null ? void 0 : _a3.toString();
|
|
1722
|
+
function cleanUrl(path) {
|
|
1723
|
+
return path.replace(REDUNDANT_CHARACTERS_EXP, "");
|
|
1748
1724
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1725
|
+
|
|
1726
|
+
// src/core/utils/url/isAbsoluteUrl.ts
|
|
1727
|
+
function isAbsoluteUrl(url) {
|
|
1728
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
1751
1729
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
return "null";
|
|
1758
|
-
}
|
|
1759
|
-
if (typeof message3 === "string") {
|
|
1760
|
-
return message3;
|
|
1730
|
+
|
|
1731
|
+
// src/core/utils/url/getAbsoluteUrl.ts
|
|
1732
|
+
function getAbsoluteUrl(path, baseUrl) {
|
|
1733
|
+
if (isAbsoluteUrl(path)) {
|
|
1734
|
+
return path;
|
|
1761
1735
|
}
|
|
1762
|
-
if (
|
|
1763
|
-
return
|
|
1736
|
+
if (path.startsWith("*")) {
|
|
1737
|
+
return path;
|
|
1764
1738
|
}
|
|
1765
|
-
|
|
1739
|
+
const origin = baseUrl || typeof document !== "undefined" && document.baseURI;
|
|
1740
|
+
return origin ? (
|
|
1741
|
+
// Encode and decode the path to preserve escaped characters.
|
|
1742
|
+
decodeURI(new URL(encodeURI(path), origin).href)
|
|
1743
|
+
) : path;
|
|
1766
1744
|
}
|
|
1767
1745
|
|
|
1768
|
-
//
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
var AsyncEventEmitter = class extends Emitter {
|
|
1773
|
-
constructor() {
|
|
1774
|
-
super();
|
|
1775
|
-
this.logger = new Logger("async-event-emitter");
|
|
1776
|
-
this.queue = /* @__PURE__ */ new Map();
|
|
1777
|
-
this.readyState = "ACTIVE";
|
|
1778
|
-
}
|
|
1779
|
-
on(eventName, listener) {
|
|
1780
|
-
const logger = this.logger.extend("on");
|
|
1781
|
-
logger.info('adding "%s" listener...', eventName);
|
|
1782
|
-
if (this.readyState === "DEACTIVATED") {
|
|
1783
|
-
logger.info("the emitter is destroyed, skipping!");
|
|
1784
|
-
return this;
|
|
1785
|
-
}
|
|
1786
|
-
return super.on(eventName, (...args) => __async(this, null, function* () {
|
|
1787
|
-
const queue = this.openListenerQueue(eventName);
|
|
1788
|
-
logger.info('awaiting the "%s" listener...', eventName);
|
|
1789
|
-
queue.push({
|
|
1790
|
-
args,
|
|
1791
|
-
done: new Promise((resolve, reject) => __async(this, null, function* () {
|
|
1792
|
-
try {
|
|
1793
|
-
yield listener(...args);
|
|
1794
|
-
resolve();
|
|
1795
|
-
logger.info('"%s" listener has resolved!', eventName);
|
|
1796
|
-
} catch (error3) {
|
|
1797
|
-
logger.info('"%s" listener has rejected!', error3);
|
|
1798
|
-
reject(error3);
|
|
1799
|
-
}
|
|
1800
|
-
}))
|
|
1801
|
-
});
|
|
1802
|
-
}));
|
|
1746
|
+
// src/core/utils/matching/normalizePath.ts
|
|
1747
|
+
function normalizePath(path, baseUrl) {
|
|
1748
|
+
if (path instanceof RegExp) {
|
|
1749
|
+
return path;
|
|
1803
1750
|
}
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1751
|
+
const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl);
|
|
1752
|
+
return cleanUrl(maybeAbsoluteUrl);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
// src/core/utils/matching/matchRequestUrl.ts
|
|
1756
|
+
function coercePath(path) {
|
|
1757
|
+
return path.replace(
|
|
1758
|
+
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
|
1759
|
+
(_, parameterName, wildcard) => {
|
|
1760
|
+
const expression = "(.*)";
|
|
1761
|
+
if (!parameterName) {
|
|
1762
|
+
return expression;
|
|
1763
|
+
}
|
|
1764
|
+
return parameterName.startsWith(":") ? `${parameterName}${wildcard}` : `${parameterName}${expression}`;
|
|
1813
1765
|
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1766
|
+
).replace(/([^\/])(:)(?=\d+)/, "$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/, "$1\\$2");
|
|
1767
|
+
}
|
|
1768
|
+
function matchRequestUrl(url, path, baseUrl) {
|
|
1769
|
+
const normalizedPath = normalizePath(path, baseUrl);
|
|
1770
|
+
const cleanPath = typeof normalizedPath === "string" ? coercePath(normalizedPath) : normalizedPath;
|
|
1771
|
+
const cleanUrl2 = getCleanUrl(url);
|
|
1772
|
+
const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl2);
|
|
1773
|
+
const params = result && result.params || {};
|
|
1774
|
+
return {
|
|
1775
|
+
matches: result !== false,
|
|
1776
|
+
params
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
// src/core/utils/request/getPublicUrlFromRequest.ts
|
|
1781
|
+
function getPublicUrlFromRequest(request) {
|
|
1782
|
+
if (typeof location === "undefined") {
|
|
1783
|
+
return request.url;
|
|
1823
1784
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (!queue) {
|
|
1844
|
-
logger.info("no queue found, creating one...");
|
|
1845
|
-
this.queue.set(eventName, []);
|
|
1846
|
-
return [];
|
|
1847
|
-
}
|
|
1848
|
-
logger.info("returning an exising queue:", queue);
|
|
1849
|
-
return queue;
|
|
1850
|
-
}
|
|
1851
|
-
removeAllListeners(eventName) {
|
|
1852
|
-
const logger = this.logger.extend("removeAllListeners");
|
|
1853
|
-
logger.info("event:", eventName);
|
|
1854
|
-
if (eventName) {
|
|
1855
|
-
this.queue.delete(eventName);
|
|
1856
|
-
logger.info(
|
|
1857
|
-
'cleared the "%s" listeners queue!',
|
|
1858
|
-
eventName,
|
|
1859
|
-
this.queue.get(eventName)
|
|
1860
|
-
);
|
|
1861
|
-
} else {
|
|
1862
|
-
this.queue.clear();
|
|
1863
|
-
logger.info("cleared the listeners queue!", this.queue);
|
|
1864
|
-
}
|
|
1865
|
-
return super.removeAllListeners(eventName);
|
|
1866
|
-
}
|
|
1867
|
-
activate() {
|
|
1868
|
-
const logger = this.logger.extend("activate");
|
|
1869
|
-
this.readyState = "ACTIVE";
|
|
1870
|
-
logger.info("set state to:", this.readyState);
|
|
1871
|
-
}
|
|
1872
|
-
/**
|
|
1873
|
-
* Deactivate this event emitter.
|
|
1874
|
-
* Deactivated emitter can no longer emit and listen to events
|
|
1875
|
-
* and needs to be activated again in order to do so.
|
|
1876
|
-
*/
|
|
1877
|
-
deactivate() {
|
|
1878
|
-
const logger = this.logger.extend("deactivate");
|
|
1879
|
-
logger.info("removing all listeners...");
|
|
1880
|
-
this.removeAllListeners();
|
|
1881
|
-
this.readyState = "DEACTIVATED";
|
|
1882
|
-
logger.info("set state to:", this.readyState);
|
|
1883
|
-
}
|
|
1884
|
-
isInternalEventName(eventName) {
|
|
1885
|
-
return eventName === "newListener" || eventName === "removeListener";
|
|
1785
|
+
const url = new URL(request.url);
|
|
1786
|
+
return url.origin === location.origin ? url.pathname : url.origin + url.pathname;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
// node_modules/.pnpm/@bundled-es-modules+cookie@2.0.0/node_modules/@bundled-es-modules/cookie/index-esm.js
|
|
1790
|
+
var __create2 = Object.create;
|
|
1791
|
+
var __defProp4 = Object.defineProperty;
|
|
1792
|
+
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
|
1793
|
+
var __getOwnPropNames3 = Object.getOwnPropertyNames;
|
|
1794
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
1795
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
1796
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
1797
|
+
return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
1798
|
+
};
|
|
1799
|
+
var __copyProps3 = (to, from, except, desc) => {
|
|
1800
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1801
|
+
for (let key of __getOwnPropNames3(from))
|
|
1802
|
+
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
1803
|
+
__defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
|
|
1886
1804
|
}
|
|
1805
|
+
return to;
|
|
1887
1806
|
};
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1807
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps3(
|
|
1808
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
1809
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
1810
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
1811
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
1812
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp4(target, "default", { value: mod, enumerable: true }) : target,
|
|
1813
|
+
mod
|
|
1814
|
+
));
|
|
1815
|
+
var require_cookie = __commonJS2({
|
|
1816
|
+
"node_modules/cookie/index.js"(exports) {
|
|
1817
|
+
"use strict";
|
|
1818
|
+
exports.parse = parse3;
|
|
1819
|
+
exports.serialize = serialize;
|
|
1820
|
+
var __toString = Object.prototype.toString;
|
|
1821
|
+
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1822
|
+
function parse3(str, options) {
|
|
1823
|
+
if (typeof str !== "string") {
|
|
1824
|
+
throw new TypeError("argument str must be a string");
|
|
1825
|
+
}
|
|
1826
|
+
var obj = {};
|
|
1827
|
+
var opt = options || {};
|
|
1828
|
+
var dec = opt.decode || decode;
|
|
1829
|
+
var index = 0;
|
|
1830
|
+
while (index < str.length) {
|
|
1831
|
+
var eqIdx = str.indexOf("=", index);
|
|
1832
|
+
if (eqIdx === -1) {
|
|
1833
|
+
break;
|
|
1834
|
+
}
|
|
1835
|
+
var endIdx = str.indexOf(";", index);
|
|
1836
|
+
if (endIdx === -1) {
|
|
1837
|
+
endIdx = str.length;
|
|
1838
|
+
} else if (endIdx < eqIdx) {
|
|
1839
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
1840
|
+
continue;
|
|
1841
|
+
}
|
|
1842
|
+
var key = str.slice(index, eqIdx).trim();
|
|
1843
|
+
if (void 0 === obj[key]) {
|
|
1844
|
+
var val = str.slice(eqIdx + 1, endIdx).trim();
|
|
1845
|
+
if (val.charCodeAt(0) === 34) {
|
|
1846
|
+
val = val.slice(1, -1);
|
|
1847
|
+
}
|
|
1848
|
+
obj[key] = tryDecode(val, dec);
|
|
1849
|
+
}
|
|
1850
|
+
index = endIdx + 1;
|
|
1851
|
+
}
|
|
1852
|
+
return obj;
|
|
1927
1853
|
}
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1854
|
+
function serialize(name, val, options) {
|
|
1855
|
+
var opt = options || {};
|
|
1856
|
+
var enc = opt.encode || encode;
|
|
1857
|
+
if (typeof enc !== "function") {
|
|
1858
|
+
throw new TypeError("option encode is invalid");
|
|
1859
|
+
}
|
|
1860
|
+
if (!fieldContentRegExp.test(name)) {
|
|
1861
|
+
throw new TypeError("argument name is invalid");
|
|
1862
|
+
}
|
|
1863
|
+
var value = enc(val);
|
|
1864
|
+
if (value && !fieldContentRegExp.test(value)) {
|
|
1865
|
+
throw new TypeError("argument val is invalid");
|
|
1866
|
+
}
|
|
1867
|
+
var str = name + "=" + value;
|
|
1868
|
+
if (null != opt.maxAge) {
|
|
1869
|
+
var maxAge = opt.maxAge - 0;
|
|
1870
|
+
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
1871
|
+
throw new TypeError("option maxAge is invalid");
|
|
1872
|
+
}
|
|
1873
|
+
str += "; Max-Age=" + Math.floor(maxAge);
|
|
1874
|
+
}
|
|
1875
|
+
if (opt.domain) {
|
|
1876
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1877
|
+
throw new TypeError("option domain is invalid");
|
|
1878
|
+
}
|
|
1879
|
+
str += "; Domain=" + opt.domain;
|
|
1880
|
+
}
|
|
1881
|
+
if (opt.path) {
|
|
1882
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
1883
|
+
throw new TypeError("option path is invalid");
|
|
1884
|
+
}
|
|
1885
|
+
str += "; Path=" + opt.path;
|
|
1886
|
+
}
|
|
1887
|
+
if (opt.expires) {
|
|
1888
|
+
var expires = opt.expires;
|
|
1889
|
+
if (!isDate(expires) || isNaN(expires.valueOf())) {
|
|
1890
|
+
throw new TypeError("option expires is invalid");
|
|
1891
|
+
}
|
|
1892
|
+
str += "; Expires=" + expires.toUTCString();
|
|
1893
|
+
}
|
|
1894
|
+
if (opt.httpOnly) {
|
|
1895
|
+
str += "; HttpOnly";
|
|
1896
|
+
}
|
|
1897
|
+
if (opt.secure) {
|
|
1898
|
+
str += "; Secure";
|
|
1899
|
+
}
|
|
1900
|
+
if (opt.priority) {
|
|
1901
|
+
var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
|
|
1902
|
+
switch (priority) {
|
|
1903
|
+
case "low":
|
|
1904
|
+
str += "; Priority=Low";
|
|
1905
|
+
break;
|
|
1906
|
+
case "medium":
|
|
1907
|
+
str += "; Priority=Medium";
|
|
1908
|
+
break;
|
|
1909
|
+
case "high":
|
|
1910
|
+
str += "; Priority=High";
|
|
1911
|
+
break;
|
|
1912
|
+
default:
|
|
1913
|
+
throw new TypeError("option priority is invalid");
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
if (opt.sameSite) {
|
|
1917
|
+
var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1918
|
+
switch (sameSite) {
|
|
1919
|
+
case true:
|
|
1920
|
+
str += "; SameSite=Strict";
|
|
1921
|
+
break;
|
|
1922
|
+
case "lax":
|
|
1923
|
+
str += "; SameSite=Lax";
|
|
1924
|
+
break;
|
|
1925
|
+
case "strict":
|
|
1926
|
+
str += "; SameSite=Strict";
|
|
1927
|
+
break;
|
|
1928
|
+
case "none":
|
|
1929
|
+
str += "; SameSite=None";
|
|
1930
|
+
break;
|
|
1931
|
+
default:
|
|
1932
|
+
throw new TypeError("option sameSite is invalid");
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return str;
|
|
1932
1936
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
logger.info("activated the emiter!", this.emitter.readyState);
|
|
1936
|
-
const runningInstance = this.getInstance();
|
|
1937
|
-
if (runningInstance) {
|
|
1938
|
-
logger.info("found a running instance, reusing...");
|
|
1939
|
-
this.on = (event, listener) => {
|
|
1940
|
-
logger.info('proxying the "%s" listener', event);
|
|
1941
|
-
runningInstance.emitter.addListener(event, listener);
|
|
1942
|
-
this.subscriptions.push(() => {
|
|
1943
|
-
runningInstance.emitter.removeListener(event, listener);
|
|
1944
|
-
logger.info('removed proxied "%s" listener!', event);
|
|
1945
|
-
});
|
|
1946
|
-
};
|
|
1947
|
-
this.readyState = "APPLIED";
|
|
1948
|
-
return;
|
|
1937
|
+
function decode(str) {
|
|
1938
|
+
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
1949
1939
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
this.setInstance();
|
|
1953
|
-
this.readyState = "APPLIED";
|
|
1954
|
-
}
|
|
1955
|
-
/**
|
|
1956
|
-
* Setup the module augments and stubs necessary for this interceptor.
|
|
1957
|
-
* This method is not run if there's a running interceptor instance
|
|
1958
|
-
* to prevent instantiating an interceptor multiple times.
|
|
1959
|
-
*/
|
|
1960
|
-
setup() {
|
|
1961
|
-
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Listen to the interceptor's public events.
|
|
1964
|
-
*/
|
|
1965
|
-
on(eventName, listener) {
|
|
1966
|
-
const logger = this.logger.extend("on");
|
|
1967
|
-
if (this.readyState === "DISPOSING" || this.readyState === "DISPOSED") {
|
|
1968
|
-
logger.info("cannot listen to events, already disposed!");
|
|
1969
|
-
return;
|
|
1940
|
+
function encode(val) {
|
|
1941
|
+
return encodeURIComponent(val);
|
|
1970
1942
|
}
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
}
|
|
1974
|
-
/**
|
|
1975
|
-
* Disposes of any side-effects this interceptor has introduced.
|
|
1976
|
-
*/
|
|
1977
|
-
dispose() {
|
|
1978
|
-
const logger = this.logger.extend("dispose");
|
|
1979
|
-
if (this.readyState === "DISPOSED") {
|
|
1980
|
-
logger.info("cannot dispose, already disposed!");
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
logger.info("disposing the interceptor...");
|
|
1984
|
-
this.readyState = "DISPOSING";
|
|
1985
|
-
if (!this.getInstance()) {
|
|
1986
|
-
logger.info("no interceptors running, skipping dispose...");
|
|
1987
|
-
return;
|
|
1988
|
-
}
|
|
1989
|
-
this.clearInstance();
|
|
1990
|
-
logger.info("global symbol deleted:", getGlobalSymbol(this.symbol));
|
|
1991
|
-
if (this.subscriptions.length > 0) {
|
|
1992
|
-
logger.info("disposing of %d subscriptions...", this.subscriptions.length);
|
|
1993
|
-
for (const dispose of this.subscriptions) {
|
|
1994
|
-
dispose();
|
|
1995
|
-
}
|
|
1996
|
-
this.subscriptions = [];
|
|
1997
|
-
logger.info("disposed of all subscriptions!", this.subscriptions.length);
|
|
1998
|
-
}
|
|
1999
|
-
this.emitter.deactivate();
|
|
2000
|
-
logger.info("destroyed the listener!");
|
|
2001
|
-
this.readyState = "DISPOSED";
|
|
2002
|
-
}
|
|
2003
|
-
getInstance() {
|
|
2004
|
-
var _a3;
|
|
2005
|
-
const instance = getGlobalSymbol(this.symbol);
|
|
2006
|
-
this.logger.info("retrieved global instance:", (_a3 = instance == null ? void 0 : instance.constructor) == null ? void 0 : _a3.name);
|
|
2007
|
-
return instance;
|
|
2008
|
-
}
|
|
2009
|
-
setInstance() {
|
|
2010
|
-
setGlobalSymbol(this.symbol, this);
|
|
2011
|
-
this.logger.info("set global instance!", this.symbol.description);
|
|
2012
|
-
}
|
|
2013
|
-
clearInstance() {
|
|
2014
|
-
deleteGlobalSymbol(this.symbol);
|
|
2015
|
-
this.logger.info("cleared global instance!", this.symbol.description);
|
|
2016
|
-
}
|
|
2017
|
-
};
|
|
2018
|
-
|
|
2019
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-VS3GJPUE.mjs
|
|
2020
|
-
var BatchInterceptor = class extends Interceptor {
|
|
2021
|
-
constructor(options) {
|
|
2022
|
-
BatchInterceptor.symbol = Symbol(options.name);
|
|
2023
|
-
super(BatchInterceptor.symbol);
|
|
2024
|
-
this.interceptors = options.interceptors;
|
|
2025
|
-
}
|
|
2026
|
-
setup() {
|
|
2027
|
-
const logger = this.logger.extend("setup");
|
|
2028
|
-
logger.info("applying all %d interceptors...", this.interceptors.length);
|
|
2029
|
-
for (const interceptor of this.interceptors) {
|
|
2030
|
-
logger.info('applying "%s" interceptor...', interceptor.constructor.name);
|
|
2031
|
-
interceptor.apply();
|
|
2032
|
-
logger.info("adding interceptor dispose subscription");
|
|
2033
|
-
this.subscriptions.push(() => interceptor.dispose());
|
|
1943
|
+
function isDate(val) {
|
|
1944
|
+
return __toString.call(val) === "[object Date]" || val instanceof Date;
|
|
2034
1945
|
}
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
}
|
|
2041
|
-
};
|
|
2042
|
-
|
|
2043
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-7II4SWKS.mjs
|
|
2044
|
-
var encoder = new TextEncoder();
|
|
2045
|
-
|
|
2046
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/chunk-GFH37L5D.mjs
|
|
2047
|
-
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
2048
|
-
|
|
2049
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.25.1/node_modules/@mswjs/interceptors/lib/node/index.mjs
|
|
2050
|
-
function getCleanUrl(url, isAbsolute = true) {
|
|
2051
|
-
return [isAbsolute && url.origin, url.pathname].filter(Boolean).join("");
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
// src/core/utils/url/cleanUrl.ts
|
|
2055
|
-
var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g;
|
|
2056
|
-
function getSearchParams(path) {
|
|
2057
|
-
return new URL(`/${path}`, "http://localhost").searchParams;
|
|
2058
|
-
}
|
|
2059
|
-
function cleanUrl(path) {
|
|
2060
|
-
return path.replace(REDUNDANT_CHARACTERS_EXP, "");
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
// src/core/utils/url/isAbsoluteUrl.ts
|
|
2064
|
-
function isAbsoluteUrl(url) {
|
|
2065
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
// src/core/utils/url/getAbsoluteUrl.ts
|
|
2069
|
-
function getAbsoluteUrl(path, baseUrl) {
|
|
2070
|
-
if (isAbsoluteUrl(path)) {
|
|
2071
|
-
return path;
|
|
2072
|
-
}
|
|
2073
|
-
if (path.startsWith("*")) {
|
|
2074
|
-
return path;
|
|
2075
|
-
}
|
|
2076
|
-
const origin = baseUrl || typeof document !== "undefined" && document.baseURI;
|
|
2077
|
-
return origin ? (
|
|
2078
|
-
// Encode and decode the path to preserve escaped characters.
|
|
2079
|
-
decodeURI(new URL(encodeURI(path), origin).href)
|
|
2080
|
-
) : path;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
// src/core/utils/matching/normalizePath.ts
|
|
2084
|
-
function normalizePath(path, baseUrl) {
|
|
2085
|
-
if (path instanceof RegExp) {
|
|
2086
|
-
return path;
|
|
2087
|
-
}
|
|
2088
|
-
const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl);
|
|
2089
|
-
return cleanUrl(maybeAbsoluteUrl);
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
// src/core/utils/matching/matchRequestUrl.ts
|
|
2093
|
-
function coercePath(path) {
|
|
2094
|
-
return path.replace(
|
|
2095
|
-
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
|
2096
|
-
(_, parameterName, wildcard) => {
|
|
2097
|
-
const expression = "(.*)";
|
|
2098
|
-
if (!parameterName) {
|
|
2099
|
-
return expression;
|
|
1946
|
+
function tryDecode(str, decode2) {
|
|
1947
|
+
try {
|
|
1948
|
+
return decode2(str);
|
|
1949
|
+
} catch (e) {
|
|
1950
|
+
return str;
|
|
2100
1951
|
}
|
|
2101
|
-
return parameterName.startsWith(":") ? `${parameterName}${wildcard}` : `${parameterName}${expression}`;
|
|
2102
1952
|
}
|
|
2103
|
-
).replace(/([^\/])(:)(?=\d+)/, "$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/, "$1\\$2");
|
|
2104
|
-
}
|
|
2105
|
-
function matchRequestUrl(url, path, baseUrl) {
|
|
2106
|
-
const normalizedPath = normalizePath(path, baseUrl);
|
|
2107
|
-
const cleanPath = typeof normalizedPath === "string" ? coercePath(normalizedPath) : normalizedPath;
|
|
2108
|
-
const cleanUrl2 = getCleanUrl(url);
|
|
2109
|
-
const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl2);
|
|
2110
|
-
const params = result && result.params || {};
|
|
2111
|
-
return {
|
|
2112
|
-
matches: result !== false,
|
|
2113
|
-
params
|
|
2114
|
-
};
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
// src/core/utils/request/getPublicUrlFromRequest.ts
|
|
2118
|
-
function getPublicUrlFromRequest(request) {
|
|
2119
|
-
if (typeof location === "undefined") {
|
|
2120
|
-
return request.url;
|
|
2121
1953
|
}
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
1954
|
+
});
|
|
1955
|
+
var import_cookie = __toESM2(require_cookie(), 1);
|
|
1956
|
+
var source_default2 = import_cookie.default;
|
|
2125
1957
|
|
|
2126
|
-
// node_modules/.pnpm/@
|
|
1958
|
+
// node_modules/.pnpm/@mswjs+cookies@1.0.0/node_modules/@mswjs/cookies/lib/index.mjs
|
|
2127
1959
|
var __create3 = Object.create;
|
|
2128
1960
|
var __defProp5 = Object.defineProperty;
|
|
2129
1961
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -2142,243 +1974,74 @@ var MockServiceWorker = (() => {
|
|
|
2142
1974
|
return to;
|
|
2143
1975
|
};
|
|
2144
1976
|
var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps4(
|
|
2145
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
2146
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
2147
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
2148
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
2149
1977
|
isNodeMode || !mod || !mod.__esModule ? __defProp5(target, "default", { value: mod, enumerable: true }) : target,
|
|
2150
1978
|
mod
|
|
2151
1979
|
));
|
|
2152
|
-
var
|
|
2153
|
-
"node_modules/cookie/
|
|
1980
|
+
var require_set_cookie = __commonJS3({
|
|
1981
|
+
"node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
|
|
2154
1982
|
"use strict";
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2166
|
-
var
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
1983
|
+
var defaultParseOptions = {
|
|
1984
|
+
decodeValues: true,
|
|
1985
|
+
map: false,
|
|
1986
|
+
silent: false
|
|
1987
|
+
};
|
|
1988
|
+
function isNonEmptyString(str) {
|
|
1989
|
+
return typeof str === "string" && !!str.trim();
|
|
1990
|
+
}
|
|
1991
|
+
function parseString(setCookieValue, options) {
|
|
1992
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
1993
|
+
var nameValue = parts.shift().split("=");
|
|
1994
|
+
var name = nameValue.shift();
|
|
1995
|
+
var value = nameValue.join("=");
|
|
1996
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
1997
|
+
var cookie = {
|
|
1998
|
+
name,
|
|
1999
|
+
value: options.decodeValues ? decodeURIComponent(value) : value
|
|
2000
|
+
};
|
|
2001
|
+
parts.forEach(function(part) {
|
|
2002
|
+
var sides = part.split("=");
|
|
2003
|
+
var key = sides.shift().trimLeft().toLowerCase();
|
|
2004
|
+
var value2 = sides.join("=");
|
|
2005
|
+
if (key === "expires") {
|
|
2006
|
+
cookie.expires = new Date(value2);
|
|
2007
|
+
} else if (key === "max-age") {
|
|
2008
|
+
cookie.maxAge = parseInt(value2, 10);
|
|
2009
|
+
} else if (key === "secure") {
|
|
2010
|
+
cookie.secure = true;
|
|
2011
|
+
} else if (key === "httponly") {
|
|
2012
|
+
cookie.httpOnly = true;
|
|
2013
|
+
} else if (key === "samesite") {
|
|
2014
|
+
cookie.sameSite = value2;
|
|
2015
|
+
} else {
|
|
2016
|
+
cookie[key] = value2;
|
|
2171
2017
|
}
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2018
|
+
});
|
|
2019
|
+
return cookie;
|
|
2020
|
+
}
|
|
2021
|
+
function parse3(input, options) {
|
|
2022
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
2023
|
+
if (!input) {
|
|
2024
|
+
if (!options.map) {
|
|
2025
|
+
return [];
|
|
2026
|
+
} else {
|
|
2027
|
+
return {};
|
|
2178
2028
|
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2029
|
+
}
|
|
2030
|
+
if (input.headers && input.headers["set-cookie"]) {
|
|
2031
|
+
input = input.headers["set-cookie"];
|
|
2032
|
+
} else if (input.headers) {
|
|
2033
|
+
var sch = input.headers[Object.keys(input.headers).find(function(key) {
|
|
2034
|
+
return key.toLowerCase() === "set-cookie";
|
|
2035
|
+
})];
|
|
2036
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
2037
|
+
console.warn(
|
|
2038
|
+
"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."
|
|
2039
|
+
);
|
|
2186
2040
|
}
|
|
2187
|
-
|
|
2041
|
+
input = sch;
|
|
2188
2042
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
function serialize(name, val, options) {
|
|
2192
|
-
var opt = options || {};
|
|
2193
|
-
var enc = opt.encode || encode;
|
|
2194
|
-
if (typeof enc !== "function") {
|
|
2195
|
-
throw new TypeError("option encode is invalid");
|
|
2196
|
-
}
|
|
2197
|
-
if (!fieldContentRegExp.test(name)) {
|
|
2198
|
-
throw new TypeError("argument name is invalid");
|
|
2199
|
-
}
|
|
2200
|
-
var value = enc(val);
|
|
2201
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
2202
|
-
throw new TypeError("argument val is invalid");
|
|
2203
|
-
}
|
|
2204
|
-
var str = name + "=" + value;
|
|
2205
|
-
if (null != opt.maxAge) {
|
|
2206
|
-
var maxAge = opt.maxAge - 0;
|
|
2207
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
2208
|
-
throw new TypeError("option maxAge is invalid");
|
|
2209
|
-
}
|
|
2210
|
-
str += "; Max-Age=" + Math.floor(maxAge);
|
|
2211
|
-
}
|
|
2212
|
-
if (opt.domain) {
|
|
2213
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
2214
|
-
throw new TypeError("option domain is invalid");
|
|
2215
|
-
}
|
|
2216
|
-
str += "; Domain=" + opt.domain;
|
|
2217
|
-
}
|
|
2218
|
-
if (opt.path) {
|
|
2219
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
2220
|
-
throw new TypeError("option path is invalid");
|
|
2221
|
-
}
|
|
2222
|
-
str += "; Path=" + opt.path;
|
|
2223
|
-
}
|
|
2224
|
-
if (opt.expires) {
|
|
2225
|
-
var expires = opt.expires;
|
|
2226
|
-
if (!isDate(expires) || isNaN(expires.valueOf())) {
|
|
2227
|
-
throw new TypeError("option expires is invalid");
|
|
2228
|
-
}
|
|
2229
|
-
str += "; Expires=" + expires.toUTCString();
|
|
2230
|
-
}
|
|
2231
|
-
if (opt.httpOnly) {
|
|
2232
|
-
str += "; HttpOnly";
|
|
2233
|
-
}
|
|
2234
|
-
if (opt.secure) {
|
|
2235
|
-
str += "; Secure";
|
|
2236
|
-
}
|
|
2237
|
-
if (opt.priority) {
|
|
2238
|
-
var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
|
|
2239
|
-
switch (priority) {
|
|
2240
|
-
case "low":
|
|
2241
|
-
str += "; Priority=Low";
|
|
2242
|
-
break;
|
|
2243
|
-
case "medium":
|
|
2244
|
-
str += "; Priority=Medium";
|
|
2245
|
-
break;
|
|
2246
|
-
case "high":
|
|
2247
|
-
str += "; Priority=High";
|
|
2248
|
-
break;
|
|
2249
|
-
default:
|
|
2250
|
-
throw new TypeError("option priority is invalid");
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
if (opt.sameSite) {
|
|
2254
|
-
var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
2255
|
-
switch (sameSite) {
|
|
2256
|
-
case true:
|
|
2257
|
-
str += "; SameSite=Strict";
|
|
2258
|
-
break;
|
|
2259
|
-
case "lax":
|
|
2260
|
-
str += "; SameSite=Lax";
|
|
2261
|
-
break;
|
|
2262
|
-
case "strict":
|
|
2263
|
-
str += "; SameSite=Strict";
|
|
2264
|
-
break;
|
|
2265
|
-
case "none":
|
|
2266
|
-
str += "; SameSite=None";
|
|
2267
|
-
break;
|
|
2268
|
-
default:
|
|
2269
|
-
throw new TypeError("option sameSite is invalid");
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
return str;
|
|
2273
|
-
}
|
|
2274
|
-
function decode(str) {
|
|
2275
|
-
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
2276
|
-
}
|
|
2277
|
-
function encode(val) {
|
|
2278
|
-
return encodeURIComponent(val);
|
|
2279
|
-
}
|
|
2280
|
-
function isDate(val) {
|
|
2281
|
-
return __toString.call(val) === "[object Date]" || val instanceof Date;
|
|
2282
|
-
}
|
|
2283
|
-
function tryDecode(str, decode2) {
|
|
2284
|
-
try {
|
|
2285
|
-
return decode2(str);
|
|
2286
|
-
} catch (e) {
|
|
2287
|
-
return str;
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
});
|
|
2292
|
-
var import_cookie = __toESM3(require_cookie(), 1);
|
|
2293
|
-
var source_default2 = import_cookie.default;
|
|
2294
|
-
|
|
2295
|
-
// 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;
|
|
2304
|
-
};
|
|
2305
|
-
var __copyProps5 = (to, from, except, desc) => {
|
|
2306
|
-
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 });
|
|
2310
|
-
}
|
|
2311
|
-
return to;
|
|
2312
|
-
};
|
|
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,
|
|
2315
|
-
mod
|
|
2316
|
-
));
|
|
2317
|
-
var require_set_cookie2 = __commonJS4({
|
|
2318
|
-
"node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
|
|
2319
|
-
"use strict";
|
|
2320
|
-
var defaultParseOptions = {
|
|
2321
|
-
decodeValues: true,
|
|
2322
|
-
map: false,
|
|
2323
|
-
silent: false
|
|
2324
|
-
};
|
|
2325
|
-
function isNonEmptyString(str) {
|
|
2326
|
-
return typeof str === "string" && !!str.trim();
|
|
2327
|
-
}
|
|
2328
|
-
function parseString(setCookieValue, options) {
|
|
2329
|
-
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
2330
|
-
var nameValue = parts.shift().split("=");
|
|
2331
|
-
var name = nameValue.shift();
|
|
2332
|
-
var value = nameValue.join("=");
|
|
2333
|
-
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
2334
|
-
var cookie = {
|
|
2335
|
-
name,
|
|
2336
|
-
value: options.decodeValues ? decodeURIComponent(value) : value
|
|
2337
|
-
};
|
|
2338
|
-
parts.forEach(function(part) {
|
|
2339
|
-
var sides = part.split("=");
|
|
2340
|
-
var key = sides.shift().trimLeft().toLowerCase();
|
|
2341
|
-
var value2 = sides.join("=");
|
|
2342
|
-
if (key === "expires") {
|
|
2343
|
-
cookie.expires = new Date(value2);
|
|
2344
|
-
} else if (key === "max-age") {
|
|
2345
|
-
cookie.maxAge = parseInt(value2, 10);
|
|
2346
|
-
} else if (key === "secure") {
|
|
2347
|
-
cookie.secure = true;
|
|
2348
|
-
} else if (key === "httponly") {
|
|
2349
|
-
cookie.httpOnly = true;
|
|
2350
|
-
} else if (key === "samesite") {
|
|
2351
|
-
cookie.sameSite = value2;
|
|
2352
|
-
} else {
|
|
2353
|
-
cookie[key] = value2;
|
|
2354
|
-
}
|
|
2355
|
-
});
|
|
2356
|
-
return cookie;
|
|
2357
|
-
}
|
|
2358
|
-
function parse3(input, options) {
|
|
2359
|
-
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
2360
|
-
if (!input) {
|
|
2361
|
-
if (!options.map) {
|
|
2362
|
-
return [];
|
|
2363
|
-
} else {
|
|
2364
|
-
return {};
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
if (input.headers && input.headers["set-cookie"]) {
|
|
2368
|
-
input = input.headers["set-cookie"];
|
|
2369
|
-
} else if (input.headers) {
|
|
2370
|
-
var sch = input.headers[Object.keys(input.headers).find(function(key) {
|
|
2371
|
-
return key.toLowerCase() === "set-cookie";
|
|
2372
|
-
})];
|
|
2373
|
-
if (!sch && input.headers.cookie && !options.silent) {
|
|
2374
|
-
console.warn(
|
|
2375
|
-
"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."
|
|
2376
|
-
);
|
|
2377
|
-
}
|
|
2378
|
-
input = sch;
|
|
2379
|
-
}
|
|
2380
|
-
if (!Array.isArray(input)) {
|
|
2381
|
-
input = [input];
|
|
2043
|
+
if (!Array.isArray(input)) {
|
|
2044
|
+
input = [input];
|
|
2382
2045
|
}
|
|
2383
2046
|
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
2384
2047
|
if (!options.map) {
|
|
@@ -2455,7 +2118,7 @@ var MockServiceWorker = (() => {
|
|
|
2455
2118
|
module.exports.splitCookiesString = splitCookiesString;
|
|
2456
2119
|
}
|
|
2457
2120
|
});
|
|
2458
|
-
var
|
|
2121
|
+
var import_set_cookie_parser = __toESM3(require_set_cookie());
|
|
2459
2122
|
var PERSISTENCY_KEY = "MSW_COOKIE_STORE";
|
|
2460
2123
|
function supportsLocalStorage() {
|
|
2461
2124
|
try {
|
|
@@ -2485,7 +2148,7 @@ var MockServiceWorker = (() => {
|
|
|
2485
2148
|
return;
|
|
2486
2149
|
}
|
|
2487
2150
|
const now = Date.now();
|
|
2488
|
-
const parsedResponseCookies = (0,
|
|
2151
|
+
const parsedResponseCookies = (0, import_set_cookie_parser.parse)(responseCookies).map(
|
|
2489
2152
|
(_a3) => {
|
|
2490
2153
|
var _b2 = _a3, { maxAge } = _b2, cookie = __objRest(_b2, ["maxAge"]);
|
|
2491
2154
|
return __spreadProps(__spreadValues({}, cookie), {
|
|
@@ -2508,7 +2171,7 @@ var MockServiceWorker = (() => {
|
|
|
2508
2171
|
if (typeof document === "undefined") {
|
|
2509
2172
|
return originCookies;
|
|
2510
2173
|
}
|
|
2511
|
-
const documentCookies = (0,
|
|
2174
|
+
const documentCookies = (0, import_set_cookie_parser.parse)(document.cookie);
|
|
2512
2175
|
documentCookies.forEach((cookie) => {
|
|
2513
2176
|
originCookies.set(cookie.name, cookie);
|
|
2514
2177
|
});
|
|
@@ -2657,7 +2320,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2657
2320
|
method
|
|
2658
2321
|
},
|
|
2659
2322
|
resolver,
|
|
2660
|
-
|
|
2323
|
+
options
|
|
2661
2324
|
});
|
|
2662
2325
|
this.checkRedundantQueryParameters();
|
|
2663
2326
|
}
|
|
@@ -2679,46 +2342,47 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2679
2342
|
`Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead and access query parameters in the response resolver function using "req.url.searchParams".`
|
|
2680
2343
|
);
|
|
2681
2344
|
}
|
|
2682
|
-
parse(
|
|
2345
|
+
parse(args) {
|
|
2683
2346
|
return __async(this, null, function* () {
|
|
2684
|
-
|
|
2347
|
+
var _a3;
|
|
2348
|
+
const url = new URL(args.request.url);
|
|
2685
2349
|
const match2 = matchRequestUrl(
|
|
2686
2350
|
url,
|
|
2687
2351
|
this.info.path,
|
|
2688
|
-
resolutionContext == null ? void 0 :
|
|
2352
|
+
(_a3 = args.resolutionContext) == null ? void 0 : _a3.baseUrl
|
|
2689
2353
|
);
|
|
2690
|
-
const cookies = getAllRequestCookies(request);
|
|
2354
|
+
const cookies = getAllRequestCookies(args.request);
|
|
2691
2355
|
return {
|
|
2692
2356
|
match: match2,
|
|
2693
2357
|
cookies
|
|
2694
2358
|
};
|
|
2695
2359
|
});
|
|
2696
2360
|
}
|
|
2697
|
-
predicate(
|
|
2698
|
-
const hasMatchingMethod = this.matchMethod(request.method);
|
|
2699
|
-
const hasMatchingUrl = parsedResult.match.matches;
|
|
2361
|
+
predicate(args) {
|
|
2362
|
+
const hasMatchingMethod = this.matchMethod(args.request.method);
|
|
2363
|
+
const hasMatchingUrl = args.parsedResult.match.matches;
|
|
2700
2364
|
return hasMatchingMethod && hasMatchingUrl;
|
|
2701
2365
|
}
|
|
2702
2366
|
matchMethod(actualMethod) {
|
|
2703
2367
|
return this.info.method instanceof RegExp ? this.info.method.test(actualMethod) : isStringEqual(this.info.method, actualMethod);
|
|
2704
2368
|
}
|
|
2705
|
-
|
|
2369
|
+
extendResolverArgs(args) {
|
|
2706
2370
|
var _a3;
|
|
2707
2371
|
return {
|
|
2708
|
-
params: ((_a3 = parsedResult.match) == null ? void 0 : _a3.params) || {},
|
|
2709
|
-
cookies: parsedResult.cookies
|
|
2372
|
+
params: ((_a3 = args.parsedResult.match) == null ? void 0 : _a3.params) || {},
|
|
2373
|
+
cookies: args.parsedResult.cookies
|
|
2710
2374
|
};
|
|
2711
2375
|
}
|
|
2712
|
-
log(
|
|
2376
|
+
log(args) {
|
|
2713
2377
|
return __async(this, null, function* () {
|
|
2714
|
-
const publicUrl = getPublicUrlFromRequest(request);
|
|
2715
|
-
const loggedRequest = yield serializeRequest(request);
|
|
2716
|
-
const loggedResponse = yield serializeResponse(response);
|
|
2378
|
+
const publicUrl = getPublicUrlFromRequest(args.request);
|
|
2379
|
+
const loggedRequest = yield serializeRequest(args.request);
|
|
2380
|
+
const loggedResponse = yield serializeResponse(args.response);
|
|
2717
2381
|
const statusColor = getStatusCodeColor(loggedResponse.status);
|
|
2718
2382
|
console.groupCollapsed(
|
|
2719
2383
|
devUtils.formatMessage("%s %s %s (%c%s%c)"),
|
|
2720
2384
|
getTimestamp(),
|
|
2721
|
-
request.method,
|
|
2385
|
+
args.request.method,
|
|
2722
2386
|
publicUrl,
|
|
2723
2387
|
`color:${statusColor}`,
|
|
2724
2388
|
`${loggedResponse.status} ${loggedResponse.statusText}`,
|
|
@@ -2749,7 +2413,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2749
2413
|
options: createHttpHandler("OPTIONS" /* OPTIONS */)
|
|
2750
2414
|
};
|
|
2751
2415
|
|
|
2752
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2416
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/devAssert.mjs
|
|
2753
2417
|
function devAssert(condition, message3) {
|
|
2754
2418
|
const booleanCondition = Boolean(condition);
|
|
2755
2419
|
if (!booleanCondition) {
|
|
@@ -2757,12 +2421,12 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2757
2421
|
}
|
|
2758
2422
|
}
|
|
2759
2423
|
|
|
2760
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2424
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/isObjectLike.mjs
|
|
2761
2425
|
function isObjectLike(value) {
|
|
2762
2426
|
return typeof value == "object" && value !== null;
|
|
2763
2427
|
}
|
|
2764
2428
|
|
|
2765
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2429
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/invariant.mjs
|
|
2766
2430
|
function invariant2(condition, message3) {
|
|
2767
2431
|
const booleanCondition = Boolean(condition);
|
|
2768
2432
|
if (!booleanCondition) {
|
|
@@ -2772,7 +2436,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2772
2436
|
}
|
|
2773
2437
|
}
|
|
2774
2438
|
|
|
2775
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2439
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/location.mjs
|
|
2776
2440
|
var LineRegExp = /\r\n|[\n\r]/g;
|
|
2777
2441
|
function getLocation(source, position) {
|
|
2778
2442
|
let lastLineStart = 0;
|
|
@@ -2791,7 +2455,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2791
2455
|
};
|
|
2792
2456
|
}
|
|
2793
2457
|
|
|
2794
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2458
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/printLocation.mjs
|
|
2795
2459
|
function printLocation(location2) {
|
|
2796
2460
|
return printSourceLocation(
|
|
2797
2461
|
location2.source,
|
|
@@ -2838,7 +2502,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2838
2502
|
return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n");
|
|
2839
2503
|
}
|
|
2840
2504
|
|
|
2841
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2505
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/GraphQLError.mjs
|
|
2842
2506
|
function toNormalizedOptions(args) {
|
|
2843
2507
|
const firstArg = args[0];
|
|
2844
2508
|
if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
|
|
@@ -2987,7 +2651,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2987
2651
|
return array === void 0 || array.length === 0 ? void 0 : array;
|
|
2988
2652
|
}
|
|
2989
2653
|
|
|
2990
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2654
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/error/syntaxError.mjs
|
|
2991
2655
|
function syntaxError(source, position, description) {
|
|
2992
2656
|
return new GraphQLError(`Syntax Error: ${description}`, {
|
|
2993
2657
|
source,
|
|
@@ -2995,7 +2659,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2995
2659
|
});
|
|
2996
2660
|
}
|
|
2997
2661
|
|
|
2998
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2662
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/ast.mjs
|
|
2999
2663
|
var Location = class {
|
|
3000
2664
|
/**
|
|
3001
2665
|
* The character offset at which this Node begins.
|
|
@@ -3161,7 +2825,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3161
2825
|
OperationTypeNode2["SUBSCRIPTION"] = "subscription";
|
|
3162
2826
|
})(OperationTypeNode || (OperationTypeNode = {}));
|
|
3163
2827
|
|
|
3164
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2828
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/directiveLocation.mjs
|
|
3165
2829
|
var DirectiveLocation;
|
|
3166
2830
|
(function(DirectiveLocation2) {
|
|
3167
2831
|
DirectiveLocation2["QUERY"] = "QUERY";
|
|
@@ -3185,7 +2849,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3185
2849
|
DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
3186
2850
|
})(DirectiveLocation || (DirectiveLocation = {}));
|
|
3187
2851
|
|
|
3188
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2852
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/kinds.mjs
|
|
3189
2853
|
var Kind;
|
|
3190
2854
|
(function(Kind2) {
|
|
3191
2855
|
Kind2["NAME"] = "Name";
|
|
@@ -3233,7 +2897,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3233
2897
|
Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
|
|
3234
2898
|
})(Kind || (Kind = {}));
|
|
3235
2899
|
|
|
3236
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2900
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/characterClasses.mjs
|
|
3237
2901
|
function isWhiteSpace(code) {
|
|
3238
2902
|
return code === 9 || code === 32;
|
|
3239
2903
|
}
|
|
@@ -3251,7 +2915,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3251
2915
|
return isLetter(code) || isDigit(code) || code === 95;
|
|
3252
2916
|
}
|
|
3253
2917
|
|
|
3254
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2918
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/blockString.mjs
|
|
3255
2919
|
function dedentBlockStringLines(lines) {
|
|
3256
2920
|
var _firstNonEmptyLine2;
|
|
3257
2921
|
let commonIndent = Number.MAX_SAFE_INTEGER;
|
|
@@ -3283,7 +2947,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3283
2947
|
return i;
|
|
3284
2948
|
}
|
|
3285
2949
|
|
|
3286
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2950
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/tokenKind.mjs
|
|
3287
2951
|
var TokenKind;
|
|
3288
2952
|
(function(TokenKind2) {
|
|
3289
2953
|
TokenKind2["SOF"] = "<SOF>";
|
|
@@ -3310,7 +2974,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3310
2974
|
TokenKind2["COMMENT"] = "Comment";
|
|
3311
2975
|
})(TokenKind || (TokenKind = {}));
|
|
3312
2976
|
|
|
3313
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
2977
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/lexer.mjs
|
|
3314
2978
|
var Lexer = class {
|
|
3315
2979
|
/**
|
|
3316
2980
|
* The previously focused non-ignored token.
|
|
@@ -3811,7 +3475,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3811
3475
|
);
|
|
3812
3476
|
}
|
|
3813
3477
|
|
|
3814
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
3478
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/inspect.mjs
|
|
3815
3479
|
var MAX_ARRAY_LENGTH = 10;
|
|
3816
3480
|
var MAX_RECURSIVE_DEPTH = 2;
|
|
3817
3481
|
function inspect(value) {
|
|
@@ -3894,7 +3558,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3894
3558
|
return tag;
|
|
3895
3559
|
}
|
|
3896
3560
|
|
|
3897
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
3561
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/jsutils/instanceOf.mjs
|
|
3898
3562
|
var instanceOf = (
|
|
3899
3563
|
/* c8 ignore next 6 */
|
|
3900
3564
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
@@ -3931,7 +3595,7 @@ spurious results.`);
|
|
|
3931
3595
|
}
|
|
3932
3596
|
);
|
|
3933
3597
|
|
|
3934
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
3598
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/source.mjs
|
|
3935
3599
|
var Source = class {
|
|
3936
3600
|
constructor(body, name = "GraphQL request", locationOffset = {
|
|
3937
3601
|
line: 1,
|
|
@@ -3958,7 +3622,7 @@ spurious results.`);
|
|
|
3958
3622
|
return instanceOf(source, Source);
|
|
3959
3623
|
}
|
|
3960
3624
|
|
|
3961
|
-
// node_modules/.pnpm/graphql@16.8.
|
|
3625
|
+
// node_modules/.pnpm/graphql@16.8.1/node_modules/graphql/language/parser.mjs
|
|
3962
3626
|
function parse2(source, options) {
|
|
3963
3627
|
const parser = new Parser(source, options);
|
|
3964
3628
|
return parser.parseDocument();
|
|
@@ -4809,411 +4473,836 @@ spurious results.`);
|
|
|
4809
4473
|
return this.parseInputObjectTypeExtension();
|
|
4810
4474
|
}
|
|
4811
4475
|
}
|
|
4812
|
-
throw this.unexpected(keywordToken);
|
|
4476
|
+
throw this.unexpected(keywordToken);
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* ```
|
|
4480
|
+
* SchemaExtension :
|
|
4481
|
+
* - extend schema Directives[Const]? { OperationTypeDefinition+ }
|
|
4482
|
+
* - extend schema Directives[Const]
|
|
4483
|
+
* ```
|
|
4484
|
+
*/
|
|
4485
|
+
parseSchemaExtension() {
|
|
4486
|
+
const start = this._lexer.token;
|
|
4487
|
+
this.expectKeyword("extend");
|
|
4488
|
+
this.expectKeyword("schema");
|
|
4489
|
+
const directives = this.parseConstDirectives();
|
|
4490
|
+
const operationTypes = this.optionalMany(
|
|
4491
|
+
TokenKind.BRACE_L,
|
|
4492
|
+
this.parseOperationTypeDefinition,
|
|
4493
|
+
TokenKind.BRACE_R
|
|
4494
|
+
);
|
|
4495
|
+
if (directives.length === 0 && operationTypes.length === 0) {
|
|
4496
|
+
throw this.unexpected();
|
|
4497
|
+
}
|
|
4498
|
+
return this.node(start, {
|
|
4499
|
+
kind: Kind.SCHEMA_EXTENSION,
|
|
4500
|
+
directives,
|
|
4501
|
+
operationTypes
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
/**
|
|
4505
|
+
* ScalarTypeExtension :
|
|
4506
|
+
* - extend scalar Name Directives[Const]
|
|
4507
|
+
*/
|
|
4508
|
+
parseScalarTypeExtension() {
|
|
4509
|
+
const start = this._lexer.token;
|
|
4510
|
+
this.expectKeyword("extend");
|
|
4511
|
+
this.expectKeyword("scalar");
|
|
4512
|
+
const name = this.parseName();
|
|
4513
|
+
const directives = this.parseConstDirectives();
|
|
4514
|
+
if (directives.length === 0) {
|
|
4515
|
+
throw this.unexpected();
|
|
4516
|
+
}
|
|
4517
|
+
return this.node(start, {
|
|
4518
|
+
kind: Kind.SCALAR_TYPE_EXTENSION,
|
|
4519
|
+
name,
|
|
4520
|
+
directives
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
/**
|
|
4524
|
+
* ObjectTypeExtension :
|
|
4525
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
4526
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
4527
|
+
* - extend type Name ImplementsInterfaces
|
|
4528
|
+
*/
|
|
4529
|
+
parseObjectTypeExtension() {
|
|
4530
|
+
const start = this._lexer.token;
|
|
4531
|
+
this.expectKeyword("extend");
|
|
4532
|
+
this.expectKeyword("type");
|
|
4533
|
+
const name = this.parseName();
|
|
4534
|
+
const interfaces = this.parseImplementsInterfaces();
|
|
4535
|
+
const directives = this.parseConstDirectives();
|
|
4536
|
+
const fields = this.parseFieldsDefinition();
|
|
4537
|
+
if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
4538
|
+
throw this.unexpected();
|
|
4539
|
+
}
|
|
4540
|
+
return this.node(start, {
|
|
4541
|
+
kind: Kind.OBJECT_TYPE_EXTENSION,
|
|
4542
|
+
name,
|
|
4543
|
+
interfaces,
|
|
4544
|
+
directives,
|
|
4545
|
+
fields
|
|
4546
|
+
});
|
|
4547
|
+
}
|
|
4548
|
+
/**
|
|
4549
|
+
* InterfaceTypeExtension :
|
|
4550
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
4551
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]
|
|
4552
|
+
* - extend interface Name ImplementsInterfaces
|
|
4553
|
+
*/
|
|
4554
|
+
parseInterfaceTypeExtension() {
|
|
4555
|
+
const start = this._lexer.token;
|
|
4556
|
+
this.expectKeyword("extend");
|
|
4557
|
+
this.expectKeyword("interface");
|
|
4558
|
+
const name = this.parseName();
|
|
4559
|
+
const interfaces = this.parseImplementsInterfaces();
|
|
4560
|
+
const directives = this.parseConstDirectives();
|
|
4561
|
+
const fields = this.parseFieldsDefinition();
|
|
4562
|
+
if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
4563
|
+
throw this.unexpected();
|
|
4564
|
+
}
|
|
4565
|
+
return this.node(start, {
|
|
4566
|
+
kind: Kind.INTERFACE_TYPE_EXTENSION,
|
|
4567
|
+
name,
|
|
4568
|
+
interfaces,
|
|
4569
|
+
directives,
|
|
4570
|
+
fields
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4573
|
+
/**
|
|
4574
|
+
* UnionTypeExtension :
|
|
4575
|
+
* - extend union Name Directives[Const]? UnionMemberTypes
|
|
4576
|
+
* - extend union Name Directives[Const]
|
|
4577
|
+
*/
|
|
4578
|
+
parseUnionTypeExtension() {
|
|
4579
|
+
const start = this._lexer.token;
|
|
4580
|
+
this.expectKeyword("extend");
|
|
4581
|
+
this.expectKeyword("union");
|
|
4582
|
+
const name = this.parseName();
|
|
4583
|
+
const directives = this.parseConstDirectives();
|
|
4584
|
+
const types = this.parseUnionMemberTypes();
|
|
4585
|
+
if (directives.length === 0 && types.length === 0) {
|
|
4586
|
+
throw this.unexpected();
|
|
4587
|
+
}
|
|
4588
|
+
return this.node(start, {
|
|
4589
|
+
kind: Kind.UNION_TYPE_EXTENSION,
|
|
4590
|
+
name,
|
|
4591
|
+
directives,
|
|
4592
|
+
types
|
|
4593
|
+
});
|
|
4594
|
+
}
|
|
4595
|
+
/**
|
|
4596
|
+
* EnumTypeExtension :
|
|
4597
|
+
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
4598
|
+
* - extend enum Name Directives[Const]
|
|
4599
|
+
*/
|
|
4600
|
+
parseEnumTypeExtension() {
|
|
4601
|
+
const start = this._lexer.token;
|
|
4602
|
+
this.expectKeyword("extend");
|
|
4603
|
+
this.expectKeyword("enum");
|
|
4604
|
+
const name = this.parseName();
|
|
4605
|
+
const directives = this.parseConstDirectives();
|
|
4606
|
+
const values = this.parseEnumValuesDefinition();
|
|
4607
|
+
if (directives.length === 0 && values.length === 0) {
|
|
4608
|
+
throw this.unexpected();
|
|
4609
|
+
}
|
|
4610
|
+
return this.node(start, {
|
|
4611
|
+
kind: Kind.ENUM_TYPE_EXTENSION,
|
|
4612
|
+
name,
|
|
4613
|
+
directives,
|
|
4614
|
+
values
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4617
|
+
/**
|
|
4618
|
+
* InputObjectTypeExtension :
|
|
4619
|
+
* - extend input Name Directives[Const]? InputFieldsDefinition
|
|
4620
|
+
* - extend input Name Directives[Const]
|
|
4621
|
+
*/
|
|
4622
|
+
parseInputObjectTypeExtension() {
|
|
4623
|
+
const start = this._lexer.token;
|
|
4624
|
+
this.expectKeyword("extend");
|
|
4625
|
+
this.expectKeyword("input");
|
|
4626
|
+
const name = this.parseName();
|
|
4627
|
+
const directives = this.parseConstDirectives();
|
|
4628
|
+
const fields = this.parseInputFieldsDefinition();
|
|
4629
|
+
if (directives.length === 0 && fields.length === 0) {
|
|
4630
|
+
throw this.unexpected();
|
|
4631
|
+
}
|
|
4632
|
+
return this.node(start, {
|
|
4633
|
+
kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
|
|
4634
|
+
name,
|
|
4635
|
+
directives,
|
|
4636
|
+
fields
|
|
4637
|
+
});
|
|
4638
|
+
}
|
|
4639
|
+
/**
|
|
4640
|
+
* ```
|
|
4641
|
+
* DirectiveDefinition :
|
|
4642
|
+
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
4643
|
+
* ```
|
|
4644
|
+
*/
|
|
4645
|
+
parseDirectiveDefinition() {
|
|
4646
|
+
const start = this._lexer.token;
|
|
4647
|
+
const description = this.parseDescription();
|
|
4648
|
+
this.expectKeyword("directive");
|
|
4649
|
+
this.expectToken(TokenKind.AT);
|
|
4650
|
+
const name = this.parseName();
|
|
4651
|
+
const args = this.parseArgumentDefs();
|
|
4652
|
+
const repeatable = this.expectOptionalKeyword("repeatable");
|
|
4653
|
+
this.expectKeyword("on");
|
|
4654
|
+
const locations = this.parseDirectiveLocations();
|
|
4655
|
+
return this.node(start, {
|
|
4656
|
+
kind: Kind.DIRECTIVE_DEFINITION,
|
|
4657
|
+
description,
|
|
4658
|
+
name,
|
|
4659
|
+
arguments: args,
|
|
4660
|
+
repeatable,
|
|
4661
|
+
locations
|
|
4662
|
+
});
|
|
4663
|
+
}
|
|
4664
|
+
/**
|
|
4665
|
+
* DirectiveLocations :
|
|
4666
|
+
* - `|`? DirectiveLocation
|
|
4667
|
+
* - DirectiveLocations | DirectiveLocation
|
|
4668
|
+
*/
|
|
4669
|
+
parseDirectiveLocations() {
|
|
4670
|
+
return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
|
|
4671
|
+
}
|
|
4672
|
+
/*
|
|
4673
|
+
* DirectiveLocation :
|
|
4674
|
+
* - ExecutableDirectiveLocation
|
|
4675
|
+
* - TypeSystemDirectiveLocation
|
|
4676
|
+
*
|
|
4677
|
+
* ExecutableDirectiveLocation : one of
|
|
4678
|
+
* `QUERY`
|
|
4679
|
+
* `MUTATION`
|
|
4680
|
+
* `SUBSCRIPTION`
|
|
4681
|
+
* `FIELD`
|
|
4682
|
+
* `FRAGMENT_DEFINITION`
|
|
4683
|
+
* `FRAGMENT_SPREAD`
|
|
4684
|
+
* `INLINE_FRAGMENT`
|
|
4685
|
+
*
|
|
4686
|
+
* TypeSystemDirectiveLocation : one of
|
|
4687
|
+
* `SCHEMA`
|
|
4688
|
+
* `SCALAR`
|
|
4689
|
+
* `OBJECT`
|
|
4690
|
+
* `FIELD_DEFINITION`
|
|
4691
|
+
* `ARGUMENT_DEFINITION`
|
|
4692
|
+
* `INTERFACE`
|
|
4693
|
+
* `UNION`
|
|
4694
|
+
* `ENUM`
|
|
4695
|
+
* `ENUM_VALUE`
|
|
4696
|
+
* `INPUT_OBJECT`
|
|
4697
|
+
* `INPUT_FIELD_DEFINITION`
|
|
4698
|
+
*/
|
|
4699
|
+
parseDirectiveLocation() {
|
|
4700
|
+
const start = this._lexer.token;
|
|
4701
|
+
const name = this.parseName();
|
|
4702
|
+
if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {
|
|
4703
|
+
return name;
|
|
4704
|
+
}
|
|
4705
|
+
throw this.unexpected(start);
|
|
4706
|
+
}
|
|
4707
|
+
// Core parsing utility functions
|
|
4708
|
+
/**
|
|
4709
|
+
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
4710
|
+
* location object, used to identify the place in the source that created a
|
|
4711
|
+
* given parsed object.
|
|
4712
|
+
*/
|
|
4713
|
+
node(startToken, node) {
|
|
4714
|
+
if (this._options.noLocation !== true) {
|
|
4715
|
+
node.loc = new Location(
|
|
4716
|
+
startToken,
|
|
4717
|
+
this._lexer.lastToken,
|
|
4718
|
+
this._lexer.source
|
|
4719
|
+
);
|
|
4720
|
+
}
|
|
4721
|
+
return node;
|
|
4722
|
+
}
|
|
4723
|
+
/**
|
|
4724
|
+
* Determines if the next token is of a given kind
|
|
4725
|
+
*/
|
|
4726
|
+
peek(kind) {
|
|
4727
|
+
return this._lexer.token.kind === kind;
|
|
4728
|
+
}
|
|
4729
|
+
/**
|
|
4730
|
+
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
4731
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
4732
|
+
*/
|
|
4733
|
+
expectToken(kind) {
|
|
4734
|
+
const token = this._lexer.token;
|
|
4735
|
+
if (token.kind === kind) {
|
|
4736
|
+
this.advanceLexer();
|
|
4737
|
+
return token;
|
|
4738
|
+
}
|
|
4739
|
+
throw syntaxError(
|
|
4740
|
+
this._lexer.source,
|
|
4741
|
+
token.start,
|
|
4742
|
+
`Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
|
|
4743
|
+
);
|
|
4744
|
+
}
|
|
4745
|
+
/**
|
|
4746
|
+
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
4747
|
+
* Otherwise, do not change the parser state and return "false".
|
|
4748
|
+
*/
|
|
4749
|
+
expectOptionalToken(kind) {
|
|
4750
|
+
const token = this._lexer.token;
|
|
4751
|
+
if (token.kind === kind) {
|
|
4752
|
+
this.advanceLexer();
|
|
4753
|
+
return true;
|
|
4754
|
+
}
|
|
4755
|
+
return false;
|
|
4756
|
+
}
|
|
4757
|
+
/**
|
|
4758
|
+
* If the next token is a given keyword, advance the lexer.
|
|
4759
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
4760
|
+
*/
|
|
4761
|
+
expectKeyword(value) {
|
|
4762
|
+
const token = this._lexer.token;
|
|
4763
|
+
if (token.kind === TokenKind.NAME && token.value === value) {
|
|
4764
|
+
this.advanceLexer();
|
|
4765
|
+
} else {
|
|
4766
|
+
throw syntaxError(
|
|
4767
|
+
this._lexer.source,
|
|
4768
|
+
token.start,
|
|
4769
|
+
`Expected "${value}", found ${getTokenDesc(token)}.`
|
|
4770
|
+
);
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
/**
|
|
4774
|
+
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
4775
|
+
* Otherwise, do not change the parser state and return "false".
|
|
4776
|
+
*/
|
|
4777
|
+
expectOptionalKeyword(value) {
|
|
4778
|
+
const token = this._lexer.token;
|
|
4779
|
+
if (token.kind === TokenKind.NAME && token.value === value) {
|
|
4780
|
+
this.advanceLexer();
|
|
4781
|
+
return true;
|
|
4782
|
+
}
|
|
4783
|
+
return false;
|
|
4784
|
+
}
|
|
4785
|
+
/**
|
|
4786
|
+
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
4787
|
+
*/
|
|
4788
|
+
unexpected(atToken) {
|
|
4789
|
+
const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
|
|
4790
|
+
return syntaxError(
|
|
4791
|
+
this._lexer.source,
|
|
4792
|
+
token.start,
|
|
4793
|
+
`Unexpected ${getTokenDesc(token)}.`
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4796
|
+
/**
|
|
4797
|
+
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
4798
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
4799
|
+
* Advances the parser to the next lex token after the closing token.
|
|
4800
|
+
*/
|
|
4801
|
+
any(openKind, parseFn, closeKind) {
|
|
4802
|
+
this.expectToken(openKind);
|
|
4803
|
+
const nodes = [];
|
|
4804
|
+
while (!this.expectOptionalToken(closeKind)) {
|
|
4805
|
+
nodes.push(parseFn.call(this));
|
|
4806
|
+
}
|
|
4807
|
+
return nodes;
|
|
4808
|
+
}
|
|
4809
|
+
/**
|
|
4810
|
+
* Returns a list of parse nodes, determined by the parseFn.
|
|
4811
|
+
* It can be empty only if open token is missing otherwise it will always return non-empty list
|
|
4812
|
+
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
4813
|
+
* Advances the parser to the next lex token after the closing token.
|
|
4814
|
+
*/
|
|
4815
|
+
optionalMany(openKind, parseFn, closeKind) {
|
|
4816
|
+
if (this.expectOptionalToken(openKind)) {
|
|
4817
|
+
const nodes = [];
|
|
4818
|
+
do {
|
|
4819
|
+
nodes.push(parseFn.call(this));
|
|
4820
|
+
} while (!this.expectOptionalToken(closeKind));
|
|
4821
|
+
return nodes;
|
|
4822
|
+
}
|
|
4823
|
+
return [];
|
|
4824
|
+
}
|
|
4825
|
+
/**
|
|
4826
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
4827
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
4828
|
+
* Advances the parser to the next lex token after the closing token.
|
|
4829
|
+
*/
|
|
4830
|
+
many(openKind, parseFn, closeKind) {
|
|
4831
|
+
this.expectToken(openKind);
|
|
4832
|
+
const nodes = [];
|
|
4833
|
+
do {
|
|
4834
|
+
nodes.push(parseFn.call(this));
|
|
4835
|
+
} while (!this.expectOptionalToken(closeKind));
|
|
4836
|
+
return nodes;
|
|
4837
|
+
}
|
|
4838
|
+
/**
|
|
4839
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
4840
|
+
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
4841
|
+
* Advances the parser to the next lex token after last item in the list.
|
|
4842
|
+
*/
|
|
4843
|
+
delimitedMany(delimiterKind, parseFn) {
|
|
4844
|
+
this.expectOptionalToken(delimiterKind);
|
|
4845
|
+
const nodes = [];
|
|
4846
|
+
do {
|
|
4847
|
+
nodes.push(parseFn.call(this));
|
|
4848
|
+
} while (this.expectOptionalToken(delimiterKind));
|
|
4849
|
+
return nodes;
|
|
4850
|
+
}
|
|
4851
|
+
advanceLexer() {
|
|
4852
|
+
const { maxTokens } = this._options;
|
|
4853
|
+
const token = this._lexer.advance();
|
|
4854
|
+
if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) {
|
|
4855
|
+
++this._tokenCounter;
|
|
4856
|
+
if (this._tokenCounter > maxTokens) {
|
|
4857
|
+
throw syntaxError(
|
|
4858
|
+
this._lexer.source,
|
|
4859
|
+
token.start,
|
|
4860
|
+
`Document contains more that ${maxTokens} tokens. Parsing aborted.`
|
|
4861
|
+
);
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
};
|
|
4866
|
+
function getTokenDesc(token) {
|
|
4867
|
+
const value = token.value;
|
|
4868
|
+
return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
|
|
4869
|
+
}
|
|
4870
|
+
function getTokenKindDesc(kind) {
|
|
4871
|
+
return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4874
|
+
// src/core/utils/internal/jsonParse.ts
|
|
4875
|
+
function jsonParse(value) {
|
|
4876
|
+
try {
|
|
4877
|
+
return JSON.parse(value);
|
|
4878
|
+
} catch (error3) {
|
|
4879
|
+
return void 0;
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
// node_modules/.pnpm/headers-polyfill@4.0.1/node_modules/headers-polyfill/lib/index.mjs
|
|
4884
|
+
var __create4 = Object.create;
|
|
4885
|
+
var __defProp6 = Object.defineProperty;
|
|
4886
|
+
var __getOwnPropDesc5 = Object.getOwnPropertyDescriptor;
|
|
4887
|
+
var __getOwnPropNames5 = Object.getOwnPropertyNames;
|
|
4888
|
+
var __getProtoOf4 = Object.getPrototypeOf;
|
|
4889
|
+
var __hasOwnProp5 = Object.prototype.hasOwnProperty;
|
|
4890
|
+
var __commonJS4 = (cb, mod) => function __require() {
|
|
4891
|
+
return mod || (0, cb[__getOwnPropNames5(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4892
|
+
};
|
|
4893
|
+
var __copyProps5 = (to, from, except, desc) => {
|
|
4894
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
4895
|
+
for (let key of __getOwnPropNames5(from))
|
|
4896
|
+
if (!__hasOwnProp5.call(to, key) && key !== except)
|
|
4897
|
+
__defProp6(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc5(from, key)) || desc.enumerable });
|
|
4898
|
+
}
|
|
4899
|
+
return to;
|
|
4900
|
+
};
|
|
4901
|
+
var __toESM4 = (mod, isNodeMode, target) => (target = mod != null ? __create4(__getProtoOf4(mod)) : {}, __copyProps5(
|
|
4902
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
4903
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
4904
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
4905
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
4906
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target,
|
|
4907
|
+
mod
|
|
4908
|
+
));
|
|
4909
|
+
var require_set_cookie2 = __commonJS4({
|
|
4910
|
+
"node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
|
|
4911
|
+
"use strict";
|
|
4912
|
+
var defaultParseOptions = {
|
|
4913
|
+
decodeValues: true,
|
|
4914
|
+
map: false,
|
|
4915
|
+
silent: false
|
|
4916
|
+
};
|
|
4917
|
+
function isNonEmptyString(str) {
|
|
4918
|
+
return typeof str === "string" && !!str.trim();
|
|
4919
|
+
}
|
|
4920
|
+
function parseString(setCookieValue, options) {
|
|
4921
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
4922
|
+
var nameValuePairStr = parts.shift();
|
|
4923
|
+
var parsed = parseNameValuePair(nameValuePairStr);
|
|
4924
|
+
var name = parsed.name;
|
|
4925
|
+
var value = parsed.value;
|
|
4926
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
4927
|
+
try {
|
|
4928
|
+
value = options.decodeValues ? decodeURIComponent(value) : value;
|
|
4929
|
+
} catch (e) {
|
|
4930
|
+
console.error(
|
|
4931
|
+
"set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.",
|
|
4932
|
+
e
|
|
4933
|
+
);
|
|
4934
|
+
}
|
|
4935
|
+
var cookie = {
|
|
4936
|
+
name,
|
|
4937
|
+
value
|
|
4938
|
+
};
|
|
4939
|
+
parts.forEach(function(part) {
|
|
4940
|
+
var sides = part.split("=");
|
|
4941
|
+
var key = sides.shift().trimLeft().toLowerCase();
|
|
4942
|
+
var value2 = sides.join("=");
|
|
4943
|
+
if (key === "expires") {
|
|
4944
|
+
cookie.expires = new Date(value2);
|
|
4945
|
+
} else if (key === "max-age") {
|
|
4946
|
+
cookie.maxAge = parseInt(value2, 10);
|
|
4947
|
+
} else if (key === "secure") {
|
|
4948
|
+
cookie.secure = true;
|
|
4949
|
+
} else if (key === "httponly") {
|
|
4950
|
+
cookie.httpOnly = true;
|
|
4951
|
+
} else if (key === "samesite") {
|
|
4952
|
+
cookie.sameSite = value2;
|
|
4953
|
+
} else {
|
|
4954
|
+
cookie[key] = value2;
|
|
4955
|
+
}
|
|
4956
|
+
});
|
|
4957
|
+
return cookie;
|
|
4958
|
+
}
|
|
4959
|
+
function parseNameValuePair(nameValuePairStr) {
|
|
4960
|
+
var name = "";
|
|
4961
|
+
var value = "";
|
|
4962
|
+
var nameValueArr = nameValuePairStr.split("=");
|
|
4963
|
+
if (nameValueArr.length > 1) {
|
|
4964
|
+
name = nameValueArr.shift();
|
|
4965
|
+
value = nameValueArr.join("=");
|
|
4966
|
+
} else {
|
|
4967
|
+
value = nameValuePairStr;
|
|
4968
|
+
}
|
|
4969
|
+
return { name, value };
|
|
4970
|
+
}
|
|
4971
|
+
function parse3(input, options) {
|
|
4972
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
4973
|
+
if (!input) {
|
|
4974
|
+
if (!options.map) {
|
|
4975
|
+
return [];
|
|
4976
|
+
} else {
|
|
4977
|
+
return {};
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
if (input.headers) {
|
|
4981
|
+
if (typeof input.headers.getSetCookie === "function") {
|
|
4982
|
+
input = input.headers.getSetCookie();
|
|
4983
|
+
} else if (input.headers["set-cookie"]) {
|
|
4984
|
+
input = input.headers["set-cookie"];
|
|
4985
|
+
} else {
|
|
4986
|
+
var sch = input.headers[Object.keys(input.headers).find(function(key) {
|
|
4987
|
+
return key.toLowerCase() === "set-cookie";
|
|
4988
|
+
})];
|
|
4989
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
4990
|
+
console.warn(
|
|
4991
|
+
"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."
|
|
4992
|
+
);
|
|
4993
|
+
}
|
|
4994
|
+
input = sch;
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
if (!Array.isArray(input)) {
|
|
4998
|
+
input = [input];
|
|
4999
|
+
}
|
|
5000
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
5001
|
+
if (!options.map) {
|
|
5002
|
+
return input.filter(isNonEmptyString).map(function(str) {
|
|
5003
|
+
return parseString(str, options);
|
|
5004
|
+
});
|
|
5005
|
+
} else {
|
|
5006
|
+
var cookies = {};
|
|
5007
|
+
return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
|
|
5008
|
+
var cookie = parseString(str, options);
|
|
5009
|
+
cookies2[cookie.name] = cookie;
|
|
5010
|
+
return cookies2;
|
|
5011
|
+
}, cookies);
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
function splitCookiesString2(cookiesString) {
|
|
5015
|
+
if (Array.isArray(cookiesString)) {
|
|
5016
|
+
return cookiesString;
|
|
5017
|
+
}
|
|
5018
|
+
if (typeof cookiesString !== "string") {
|
|
5019
|
+
return [];
|
|
5020
|
+
}
|
|
5021
|
+
var cookiesStrings = [];
|
|
5022
|
+
var pos = 0;
|
|
5023
|
+
var start;
|
|
5024
|
+
var ch;
|
|
5025
|
+
var lastComma;
|
|
5026
|
+
var nextStart;
|
|
5027
|
+
var cookiesSeparatorFound;
|
|
5028
|
+
function skipWhitespace() {
|
|
5029
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
5030
|
+
pos += 1;
|
|
5031
|
+
}
|
|
5032
|
+
return pos < cookiesString.length;
|
|
5033
|
+
}
|
|
5034
|
+
function notSpecialChar() {
|
|
5035
|
+
ch = cookiesString.charAt(pos);
|
|
5036
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
5037
|
+
}
|
|
5038
|
+
while (pos < cookiesString.length) {
|
|
5039
|
+
start = pos;
|
|
5040
|
+
cookiesSeparatorFound = false;
|
|
5041
|
+
while (skipWhitespace()) {
|
|
5042
|
+
ch = cookiesString.charAt(pos);
|
|
5043
|
+
if (ch === ",") {
|
|
5044
|
+
lastComma = pos;
|
|
5045
|
+
pos += 1;
|
|
5046
|
+
skipWhitespace();
|
|
5047
|
+
nextStart = pos;
|
|
5048
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
5049
|
+
pos += 1;
|
|
5050
|
+
}
|
|
5051
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
5052
|
+
cookiesSeparatorFound = true;
|
|
5053
|
+
pos = nextStart;
|
|
5054
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
5055
|
+
start = pos;
|
|
5056
|
+
} else {
|
|
5057
|
+
pos = lastComma + 1;
|
|
5058
|
+
}
|
|
5059
|
+
} else {
|
|
5060
|
+
pos += 1;
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
5064
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
return cookiesStrings;
|
|
5068
|
+
}
|
|
5069
|
+
module.exports = parse3;
|
|
5070
|
+
module.exports.parse = parse3;
|
|
5071
|
+
module.exports.parseString = parseString;
|
|
5072
|
+
module.exports.splitCookiesString = splitCookiesString2;
|
|
4813
5073
|
}
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
*/
|
|
4821
|
-
parseSchemaExtension() {
|
|
4822
|
-
const start = this._lexer.token;
|
|
4823
|
-
this.expectKeyword("extend");
|
|
4824
|
-
this.expectKeyword("schema");
|
|
4825
|
-
const directives = this.parseConstDirectives();
|
|
4826
|
-
const operationTypes = this.optionalMany(
|
|
4827
|
-
TokenKind.BRACE_L,
|
|
4828
|
-
this.parseOperationTypeDefinition,
|
|
4829
|
-
TokenKind.BRACE_R
|
|
4830
|
-
);
|
|
4831
|
-
if (directives.length === 0 && operationTypes.length === 0) {
|
|
4832
|
-
throw this.unexpected();
|
|
4833
|
-
}
|
|
4834
|
-
return this.node(start, {
|
|
4835
|
-
kind: Kind.SCHEMA_EXTENSION,
|
|
4836
|
-
directives,
|
|
4837
|
-
operationTypes
|
|
4838
|
-
});
|
|
5074
|
+
});
|
|
5075
|
+
var import_set_cookie_parser2 = __toESM4(require_set_cookie2());
|
|
5076
|
+
var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i;
|
|
5077
|
+
function normalizeHeaderName(name) {
|
|
5078
|
+
if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === "") {
|
|
5079
|
+
throw new TypeError("Invalid character in header field name");
|
|
4839
5080
|
}
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
5081
|
+
return name.trim().toLowerCase();
|
|
5082
|
+
}
|
|
5083
|
+
var charCodesToRemove = [
|
|
5084
|
+
String.fromCharCode(10),
|
|
5085
|
+
String.fromCharCode(13),
|
|
5086
|
+
String.fromCharCode(9),
|
|
5087
|
+
String.fromCharCode(32)
|
|
5088
|
+
];
|
|
5089
|
+
var HEADER_VALUE_REMOVE_REGEXP = new RegExp(
|
|
5090
|
+
`(^[${charCodesToRemove.join("")}]|$[${charCodesToRemove.join("")}])`,
|
|
5091
|
+
"g"
|
|
5092
|
+
);
|
|
5093
|
+
function normalizeHeaderValue(value) {
|
|
5094
|
+
const nextValue = value.replace(HEADER_VALUE_REMOVE_REGEXP, "");
|
|
5095
|
+
return nextValue;
|
|
5096
|
+
}
|
|
5097
|
+
function isValidHeaderName(value) {
|
|
5098
|
+
if (typeof value !== "string") {
|
|
5099
|
+
return false;
|
|
4858
5100
|
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
4862
|
-
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
4863
|
-
* - extend type Name ImplementsInterfaces
|
|
4864
|
-
*/
|
|
4865
|
-
parseObjectTypeExtension() {
|
|
4866
|
-
const start = this._lexer.token;
|
|
4867
|
-
this.expectKeyword("extend");
|
|
4868
|
-
this.expectKeyword("type");
|
|
4869
|
-
const name = this.parseName();
|
|
4870
|
-
const interfaces = this.parseImplementsInterfaces();
|
|
4871
|
-
const directives = this.parseConstDirectives();
|
|
4872
|
-
const fields = this.parseFieldsDefinition();
|
|
4873
|
-
if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
4874
|
-
throw this.unexpected();
|
|
4875
|
-
}
|
|
4876
|
-
return this.node(start, {
|
|
4877
|
-
kind: Kind.OBJECT_TYPE_EXTENSION,
|
|
4878
|
-
name,
|
|
4879
|
-
interfaces,
|
|
4880
|
-
directives,
|
|
4881
|
-
fields
|
|
4882
|
-
});
|
|
5101
|
+
if (value.length === 0) {
|
|
5102
|
+
return false;
|
|
4883
5103
|
}
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
* - extend interface Name ImplementsInterfaces
|
|
4889
|
-
*/
|
|
4890
|
-
parseInterfaceTypeExtension() {
|
|
4891
|
-
const start = this._lexer.token;
|
|
4892
|
-
this.expectKeyword("extend");
|
|
4893
|
-
this.expectKeyword("interface");
|
|
4894
|
-
const name = this.parseName();
|
|
4895
|
-
const interfaces = this.parseImplementsInterfaces();
|
|
4896
|
-
const directives = this.parseConstDirectives();
|
|
4897
|
-
const fields = this.parseFieldsDefinition();
|
|
4898
|
-
if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
4899
|
-
throw this.unexpected();
|
|
5104
|
+
for (let i = 0; i < value.length; i++) {
|
|
5105
|
+
const character = value.charCodeAt(i);
|
|
5106
|
+
if (character > 127 || !isToken(character)) {
|
|
5107
|
+
return false;
|
|
4900
5108
|
}
|
|
4901
|
-
return this.node(start, {
|
|
4902
|
-
kind: Kind.INTERFACE_TYPE_EXTENSION,
|
|
4903
|
-
name,
|
|
4904
|
-
interfaces,
|
|
4905
|
-
directives,
|
|
4906
|
-
fields
|
|
4907
|
-
});
|
|
4908
5109
|
}
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
5110
|
+
return true;
|
|
5111
|
+
}
|
|
5112
|
+
function isToken(value) {
|
|
5113
|
+
return ![
|
|
5114
|
+
127,
|
|
5115
|
+
32,
|
|
5116
|
+
"(",
|
|
5117
|
+
")",
|
|
5118
|
+
"<",
|
|
5119
|
+
">",
|
|
5120
|
+
"@",
|
|
5121
|
+
",",
|
|
5122
|
+
";",
|
|
5123
|
+
":",
|
|
5124
|
+
"\\",
|
|
5125
|
+
'"',
|
|
5126
|
+
"/",
|
|
5127
|
+
"[",
|
|
5128
|
+
"]",
|
|
5129
|
+
"?",
|
|
5130
|
+
"=",
|
|
5131
|
+
"{",
|
|
5132
|
+
"}"
|
|
5133
|
+
].includes(value);
|
|
5134
|
+
}
|
|
5135
|
+
function isValidHeaderValue(value) {
|
|
5136
|
+
if (typeof value !== "string") {
|
|
5137
|
+
return false;
|
|
4930
5138
|
}
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
4934
|
-
* - extend enum Name Directives[Const]
|
|
4935
|
-
*/
|
|
4936
|
-
parseEnumTypeExtension() {
|
|
4937
|
-
const start = this._lexer.token;
|
|
4938
|
-
this.expectKeyword("extend");
|
|
4939
|
-
this.expectKeyword("enum");
|
|
4940
|
-
const name = this.parseName();
|
|
4941
|
-
const directives = this.parseConstDirectives();
|
|
4942
|
-
const values = this.parseEnumValuesDefinition();
|
|
4943
|
-
if (directives.length === 0 && values.length === 0) {
|
|
4944
|
-
throw this.unexpected();
|
|
4945
|
-
}
|
|
4946
|
-
return this.node(start, {
|
|
4947
|
-
kind: Kind.ENUM_TYPE_EXTENSION,
|
|
4948
|
-
name,
|
|
4949
|
-
directives,
|
|
4950
|
-
values
|
|
4951
|
-
});
|
|
5139
|
+
if (value.trim() !== value) {
|
|
5140
|
+
return false;
|
|
4952
5141
|
}
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
this.expectKeyword("input");
|
|
4962
|
-
const name = this.parseName();
|
|
4963
|
-
const directives = this.parseConstDirectives();
|
|
4964
|
-
const fields = this.parseInputFieldsDefinition();
|
|
4965
|
-
if (directives.length === 0 && fields.length === 0) {
|
|
4966
|
-
throw this.unexpected();
|
|
5142
|
+
for (let i = 0; i < value.length; i++) {
|
|
5143
|
+
const character = value.charCodeAt(i);
|
|
5144
|
+
if (
|
|
5145
|
+
// NUL.
|
|
5146
|
+
character === 0 || // HTTP newline bytes.
|
|
5147
|
+
character === 10 || character === 13
|
|
5148
|
+
) {
|
|
5149
|
+
return false;
|
|
4967
5150
|
}
|
|
4968
|
-
return this.node(start, {
|
|
4969
|
-
kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
|
|
4970
|
-
name,
|
|
4971
|
-
directives,
|
|
4972
|
-
fields
|
|
4973
|
-
});
|
|
4974
|
-
}
|
|
4975
|
-
/**
|
|
4976
|
-
* ```
|
|
4977
|
-
* DirectiveDefinition :
|
|
4978
|
-
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
4979
|
-
* ```
|
|
4980
|
-
*/
|
|
4981
|
-
parseDirectiveDefinition() {
|
|
4982
|
-
const start = this._lexer.token;
|
|
4983
|
-
const description = this.parseDescription();
|
|
4984
|
-
this.expectKeyword("directive");
|
|
4985
|
-
this.expectToken(TokenKind.AT);
|
|
4986
|
-
const name = this.parseName();
|
|
4987
|
-
const args = this.parseArgumentDefs();
|
|
4988
|
-
const repeatable = this.expectOptionalKeyword("repeatable");
|
|
4989
|
-
this.expectKeyword("on");
|
|
4990
|
-
const locations = this.parseDirectiveLocations();
|
|
4991
|
-
return this.node(start, {
|
|
4992
|
-
kind: Kind.DIRECTIVE_DEFINITION,
|
|
4993
|
-
description,
|
|
4994
|
-
name,
|
|
4995
|
-
arguments: args,
|
|
4996
|
-
repeatable,
|
|
4997
|
-
locations
|
|
4998
|
-
});
|
|
4999
|
-
}
|
|
5000
|
-
/**
|
|
5001
|
-
* DirectiveLocations :
|
|
5002
|
-
* - `|`? DirectiveLocation
|
|
5003
|
-
* - DirectiveLocations | DirectiveLocation
|
|
5004
|
-
*/
|
|
5005
|
-
parseDirectiveLocations() {
|
|
5006
|
-
return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
|
|
5007
5151
|
}
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
return name;
|
|
5152
|
+
return true;
|
|
5153
|
+
}
|
|
5154
|
+
var NORMALIZED_HEADERS = Symbol("normalizedHeaders");
|
|
5155
|
+
var RAW_HEADER_NAMES = Symbol("rawHeaderNames");
|
|
5156
|
+
var HEADER_VALUE_DELIMITER = ", ";
|
|
5157
|
+
var _a;
|
|
5158
|
+
var _b;
|
|
5159
|
+
var Headers2 = class _Headers {
|
|
5160
|
+
constructor(init) {
|
|
5161
|
+
this[_a] = {};
|
|
5162
|
+
this[_b] = /* @__PURE__ */ new Map();
|
|
5163
|
+
if (["Headers", "HeadersPolyfill"].includes(init == null ? void 0 : init.constructor.name) || init instanceof _Headers) {
|
|
5164
|
+
const initialHeaders = init;
|
|
5165
|
+
initialHeaders.forEach((value, name) => {
|
|
5166
|
+
this.append(name, value);
|
|
5167
|
+
}, this);
|
|
5168
|
+
} else if (Array.isArray(init)) {
|
|
5169
|
+
init.forEach(([name, value]) => {
|
|
5170
|
+
this.append(
|
|
5171
|
+
name,
|
|
5172
|
+
Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
|
|
5173
|
+
);
|
|
5174
|
+
});
|
|
5175
|
+
} else if (init) {
|
|
5176
|
+
Object.getOwnPropertyNames(init).forEach((name) => {
|
|
5177
|
+
const value = init[name];
|
|
5178
|
+
this.append(
|
|
5179
|
+
name,
|
|
5180
|
+
Array.isArray(value) ? value.join(HEADER_VALUE_DELIMITER) : value
|
|
5181
|
+
);
|
|
5182
|
+
});
|
|
5040
5183
|
}
|
|
5041
|
-
throw this.unexpected(start);
|
|
5042
5184
|
}
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
5046
|
-
* location object, used to identify the place in the source that created a
|
|
5047
|
-
* given parsed object.
|
|
5048
|
-
*/
|
|
5049
|
-
node(startToken, node) {
|
|
5050
|
-
if (this._options.noLocation !== true) {
|
|
5051
|
-
node.loc = new Location(
|
|
5052
|
-
startToken,
|
|
5053
|
-
this._lexer.lastToken,
|
|
5054
|
-
this._lexer.source
|
|
5055
|
-
);
|
|
5056
|
-
}
|
|
5057
|
-
return node;
|
|
5185
|
+
[(_a = NORMALIZED_HEADERS, _b = RAW_HEADER_NAMES, Symbol.iterator)]() {
|
|
5186
|
+
return this.entries();
|
|
5058
5187
|
}
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
return this._lexer.token.kind === kind;
|
|
5188
|
+
*keys() {
|
|
5189
|
+
for (const [name] of this.entries()) {
|
|
5190
|
+
yield name;
|
|
5191
|
+
}
|
|
5064
5192
|
}
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
*/
|
|
5069
|
-
expectToken(kind) {
|
|
5070
|
-
const token = this._lexer.token;
|
|
5071
|
-
if (token.kind === kind) {
|
|
5072
|
-
this.advanceLexer();
|
|
5073
|
-
return token;
|
|
5193
|
+
*values() {
|
|
5194
|
+
for (const [, value] of this.entries()) {
|
|
5195
|
+
yield value;
|
|
5074
5196
|
}
|
|
5075
|
-
throw syntaxError(
|
|
5076
|
-
this._lexer.source,
|
|
5077
|
-
token.start,
|
|
5078
|
-
`Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
|
|
5079
|
-
);
|
|
5080
5197
|
}
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5198
|
+
*entries() {
|
|
5199
|
+
let sortedKeys = Object.keys(this[NORMALIZED_HEADERS]).sort(
|
|
5200
|
+
(a, b) => a.localeCompare(b)
|
|
5201
|
+
);
|
|
5202
|
+
for (const name of sortedKeys) {
|
|
5203
|
+
if (name === "set-cookie") {
|
|
5204
|
+
for (const value of this.getSetCookie()) {
|
|
5205
|
+
yield [name, value];
|
|
5206
|
+
}
|
|
5207
|
+
} else {
|
|
5208
|
+
yield [name, this.get(name)];
|
|
5209
|
+
}
|
|
5090
5210
|
}
|
|
5091
|
-
return false;
|
|
5092
5211
|
}
|
|
5093
5212
|
/**
|
|
5094
|
-
*
|
|
5095
|
-
* Otherwise, do not change the parser state and throw an error.
|
|
5213
|
+
* Returns a boolean stating whether a `Headers` object contains a certain header.
|
|
5096
5214
|
*/
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
this.advanceLexer();
|
|
5101
|
-
} else {
|
|
5102
|
-
throw syntaxError(
|
|
5103
|
-
this._lexer.source,
|
|
5104
|
-
token.start,
|
|
5105
|
-
`Expected "${value}", found ${getTokenDesc(token)}.`
|
|
5106
|
-
);
|
|
5215
|
+
has(name) {
|
|
5216
|
+
if (!isValidHeaderName(name)) {
|
|
5217
|
+
throw new TypeError(`Invalid header name "${name}"`);
|
|
5107
5218
|
}
|
|
5219
|
+
return this[NORMALIZED_HEADERS].hasOwnProperty(normalizeHeaderName(name));
|
|
5108
5220
|
}
|
|
5109
5221
|
/**
|
|
5110
|
-
*
|
|
5111
|
-
* Otherwise, do not change the parser state and return "false".
|
|
5222
|
+
* Returns a `ByteString` sequence of all the values of a header with a given name.
|
|
5112
5223
|
*/
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
if (
|
|
5116
|
-
|
|
5117
|
-
return true;
|
|
5224
|
+
get(name) {
|
|
5225
|
+
var _a3;
|
|
5226
|
+
if (!isValidHeaderName(name)) {
|
|
5227
|
+
throw TypeError(`Invalid header name "${name}"`);
|
|
5118
5228
|
}
|
|
5119
|
-
return
|
|
5229
|
+
return (_a3 = this[NORMALIZED_HEADERS][normalizeHeaderName(name)]) != null ? _a3 : null;
|
|
5120
5230
|
}
|
|
5121
5231
|
/**
|
|
5122
|
-
*
|
|
5232
|
+
* Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
5123
5233
|
*/
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
);
|
|
5234
|
+
set(name, value) {
|
|
5235
|
+
if (!isValidHeaderName(name) || !isValidHeaderValue(value)) {
|
|
5236
|
+
return;
|
|
5237
|
+
}
|
|
5238
|
+
const normalizedName = normalizeHeaderName(name);
|
|
5239
|
+
const normalizedValue = normalizeHeaderValue(value);
|
|
5240
|
+
this[NORMALIZED_HEADERS][normalizedName] = normalizeHeaderValue(normalizedValue);
|
|
5241
|
+
this[RAW_HEADER_NAMES].set(normalizedName, name);
|
|
5131
5242
|
}
|
|
5132
5243
|
/**
|
|
5133
|
-
*
|
|
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.
|
|
5244
|
+
* Appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
5136
5245
|
*/
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
while (!this.expectOptionalToken(closeKind)) {
|
|
5141
|
-
nodes.push(parseFn.call(this));
|
|
5246
|
+
append(name, value) {
|
|
5247
|
+
if (!isValidHeaderName(name) || !isValidHeaderValue(value)) {
|
|
5248
|
+
return;
|
|
5142
5249
|
}
|
|
5143
|
-
|
|
5250
|
+
const normalizedName = normalizeHeaderName(name);
|
|
5251
|
+
const normalizedValue = normalizeHeaderValue(value);
|
|
5252
|
+
let resolvedValue = this.has(normalizedName) ? `${this.get(normalizedName)}, ${normalizedValue}` : normalizedValue;
|
|
5253
|
+
this.set(name, resolvedValue);
|
|
5144
5254
|
}
|
|
5145
5255
|
/**
|
|
5146
|
-
*
|
|
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.
|
|
5256
|
+
* Deletes a header from the `Headers` object.
|
|
5150
5257
|
*/
|
|
5151
|
-
|
|
5152
|
-
if (
|
|
5153
|
-
|
|
5154
|
-
do {
|
|
5155
|
-
nodes.push(parseFn.call(this));
|
|
5156
|
-
} while (!this.expectOptionalToken(closeKind));
|
|
5157
|
-
return nodes;
|
|
5258
|
+
delete(name) {
|
|
5259
|
+
if (!isValidHeaderName(name)) {
|
|
5260
|
+
return;
|
|
5158
5261
|
}
|
|
5159
|
-
|
|
5262
|
+
if (!this.has(name)) {
|
|
5263
|
+
return;
|
|
5264
|
+
}
|
|
5265
|
+
const normalizedName = normalizeHeaderName(name);
|
|
5266
|
+
delete this[NORMALIZED_HEADERS][normalizedName];
|
|
5267
|
+
this[RAW_HEADER_NAMES].delete(normalizedName);
|
|
5160
5268
|
}
|
|
5161
5269
|
/**
|
|
5162
|
-
*
|
|
5163
|
-
*
|
|
5164
|
-
* Advances the parser to the next lex token after the closing token.
|
|
5270
|
+
* Traverses the `Headers` object,
|
|
5271
|
+
* calling the given callback for each header.
|
|
5165
5272
|
*/
|
|
5166
|
-
|
|
5167
|
-
this.
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
nodes.push(parseFn.call(this));
|
|
5171
|
-
} while (!this.expectOptionalToken(closeKind));
|
|
5172
|
-
return nodes;
|
|
5273
|
+
forEach(callback, thisArg) {
|
|
5274
|
+
for (const [name, value] of this.entries()) {
|
|
5275
|
+
callback.call(thisArg, value, name, this);
|
|
5276
|
+
}
|
|
5173
5277
|
}
|
|
5174
5278
|
/**
|
|
5175
|
-
* Returns
|
|
5176
|
-
*
|
|
5177
|
-
*
|
|
5279
|
+
* Returns an array containing the values
|
|
5280
|
+
* of all Set-Cookie headers associated
|
|
5281
|
+
* with a response
|
|
5178
5282
|
*/
|
|
5179
|
-
|
|
5180
|
-
this.
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
nodes.push(parseFn.call(this));
|
|
5184
|
-
} while (this.expectOptionalToken(delimiterKind));
|
|
5185
|
-
return nodes;
|
|
5186
|
-
}
|
|
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
|
-
);
|
|
5198
|
-
}
|
|
5283
|
+
getSetCookie() {
|
|
5284
|
+
const setCookieHeader = this.get("set-cookie");
|
|
5285
|
+
if (setCookieHeader === null) {
|
|
5286
|
+
return [];
|
|
5199
5287
|
}
|
|
5288
|
+
if (setCookieHeader === "") {
|
|
5289
|
+
return [""];
|
|
5290
|
+
}
|
|
5291
|
+
return (0, import_set_cookie_parser2.splitCookiesString)(setCookieHeader);
|
|
5200
5292
|
}
|
|
5201
5293
|
};
|
|
5202
|
-
function
|
|
5203
|
-
const
|
|
5204
|
-
return
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
} catch (error3) {
|
|
5215
|
-
return void 0;
|
|
5216
|
-
}
|
|
5294
|
+
function stringToHeaders(str) {
|
|
5295
|
+
const lines = str.trim().split(/[\r\n]+/);
|
|
5296
|
+
return lines.reduce((headers, line) => {
|
|
5297
|
+
if (line.trim() === "") {
|
|
5298
|
+
return headers;
|
|
5299
|
+
}
|
|
5300
|
+
const parts = line.split(": ");
|
|
5301
|
+
const name = parts.shift();
|
|
5302
|
+
const value = parts.join(": ");
|
|
5303
|
+
headers.append(name, value);
|
|
5304
|
+
return headers;
|
|
5305
|
+
}, new Headers2());
|
|
5217
5306
|
}
|
|
5218
5307
|
|
|
5219
5308
|
// src/core/utils/internal/parseMultipartData.ts
|
|
@@ -5406,7 +5495,7 @@ spurious results.`);
|
|
|
5406
5495
|
return typeof value === "object" && "kind" in value && "definitions" in value;
|
|
5407
5496
|
}
|
|
5408
5497
|
var GraphQLHandler = class extends RequestHandler {
|
|
5409
|
-
constructor(operationType, operationName, endpoint, resolver) {
|
|
5498
|
+
constructor(operationType, operationName, endpoint, resolver, options) {
|
|
5410
5499
|
let resolvedOperationName = operationName;
|
|
5411
5500
|
if (isDocumentNode(operationName)) {
|
|
5412
5501
|
const parsedNode = parseDocumentNode(operationName);
|
|
@@ -5429,47 +5518,53 @@ spurious results.`);
|
|
|
5429
5518
|
operationType,
|
|
5430
5519
|
operationName: resolvedOperationName
|
|
5431
5520
|
},
|
|
5432
|
-
resolver
|
|
5521
|
+
resolver,
|
|
5522
|
+
options
|
|
5433
5523
|
});
|
|
5434
5524
|
this.endpoint = endpoint;
|
|
5435
5525
|
}
|
|
5436
|
-
parse(
|
|
5526
|
+
parse(args) {
|
|
5437
5527
|
return __async(this, null, function* () {
|
|
5438
|
-
return parseGraphQLRequest(request).catch((error3) => {
|
|
5528
|
+
return parseGraphQLRequest(args.request).catch((error3) => {
|
|
5439
5529
|
console.error(error3);
|
|
5440
5530
|
return void 0;
|
|
5441
5531
|
});
|
|
5442
5532
|
});
|
|
5443
5533
|
}
|
|
5444
|
-
predicate(
|
|
5445
|
-
if (!parsedResult) {
|
|
5534
|
+
predicate(args) {
|
|
5535
|
+
if (!args.parsedResult) {
|
|
5446
5536
|
return false;
|
|
5447
5537
|
}
|
|
5448
|
-
if (!parsedResult.operationName && this.info.operationType !== "all") {
|
|
5449
|
-
const publicUrl = getPublicUrlFromRequest(request);
|
|
5450
|
-
devUtils.warn(`Failed to intercept a GraphQL request at "${request.method} ${publicUrl}": anonymous GraphQL operations are not supported.
|
|
5538
|
+
if (!args.parsedResult.operationName && this.info.operationType !== "all") {
|
|
5539
|
+
const publicUrl = getPublicUrlFromRequest(args.request);
|
|
5540
|
+
devUtils.warn(`Failed to intercept a GraphQL request at "${args.request.method} ${publicUrl}": anonymous GraphQL operations are not supported.
|
|
5451
5541
|
|
|
5452
5542
|
Consider naming this operation or using "graphql.operation()" request handler to intercept GraphQL requests regardless of their operation name/type. Read more: https://mswjs.io/docs/api/graphql/operation`);
|
|
5453
5543
|
return false;
|
|
5454
5544
|
}
|
|
5455
|
-
const hasMatchingUrl = matchRequestUrl(
|
|
5456
|
-
|
|
5457
|
-
|
|
5545
|
+
const hasMatchingUrl = matchRequestUrl(
|
|
5546
|
+
new URL(args.request.url),
|
|
5547
|
+
this.endpoint
|
|
5548
|
+
);
|
|
5549
|
+
const hasMatchingOperationType = this.info.operationType === "all" || args.parsedResult.operationType === this.info.operationType;
|
|
5550
|
+
const hasMatchingOperationName = this.info.operationName instanceof RegExp ? this.info.operationName.test(args.parsedResult.operationName || "") : args.parsedResult.operationName === this.info.operationName;
|
|
5458
5551
|
return hasMatchingUrl.matches && hasMatchingOperationType && hasMatchingOperationName;
|
|
5459
5552
|
}
|
|
5460
|
-
|
|
5553
|
+
extendResolverArgs(args) {
|
|
5554
|
+
var _a3, _b2, _c;
|
|
5461
5555
|
return {
|
|
5462
|
-
query: (parsedResult == null ? void 0 :
|
|
5463
|
-
operationName: (parsedResult == null ? void 0 :
|
|
5464
|
-
variables: (parsedResult == null ? void 0 :
|
|
5556
|
+
query: ((_a3 = args.parsedResult) == null ? void 0 : _a3.query) || "",
|
|
5557
|
+
operationName: ((_b2 = args.parsedResult) == null ? void 0 : _b2.operationName) || "",
|
|
5558
|
+
variables: ((_c = args.parsedResult) == null ? void 0 : _c.variables) || {}
|
|
5465
5559
|
};
|
|
5466
5560
|
}
|
|
5467
|
-
log(
|
|
5561
|
+
log(args) {
|
|
5468
5562
|
return __async(this, null, function* () {
|
|
5469
|
-
|
|
5470
|
-
const
|
|
5563
|
+
var _a3, _b2, _c, _d;
|
|
5564
|
+
const loggedRequest = yield serializeRequest(args.request);
|
|
5565
|
+
const loggedResponse = yield serializeResponse(args.response);
|
|
5471
5566
|
const statusColor = getStatusCodeColor(loggedResponse.status);
|
|
5472
|
-
const requestInfo = (
|
|
5567
|
+
const requestInfo = ((_a3 = args.parsedResult) == null ? void 0 : _a3.operationName) ? `${(_b2 = args.parsedResult) == null ? void 0 : _b2.operationType} ${(_c = args.parsedResult) == null ? void 0 : _c.operationName}` : `anonymous ${(_d = args.parsedResult) == null ? void 0 : _d.operationType}`;
|
|
5473
5568
|
console.groupCollapsed(
|
|
5474
5569
|
devUtils.formatMessage("%s %s (%c%s%c)"),
|
|
5475
5570
|
getTimestamp(),
|
|
@@ -5488,8 +5583,14 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
5488
5583
|
|
|
5489
5584
|
// src/core/graphql.ts
|
|
5490
5585
|
function createScopedGraphQLHandler(operationType, url) {
|
|
5491
|
-
return (operationName, resolver) => {
|
|
5492
|
-
return new GraphQLHandler(
|
|
5586
|
+
return (operationName, resolver, options = {}) => {
|
|
5587
|
+
return new GraphQLHandler(
|
|
5588
|
+
operationType,
|
|
5589
|
+
operationName,
|
|
5590
|
+
url,
|
|
5591
|
+
resolver,
|
|
5592
|
+
options
|
|
5593
|
+
);
|
|
5493
5594
|
};
|
|
5494
5595
|
}
|
|
5495
5596
|
function createGraphQLOperationHandler(url) {
|
|
@@ -5499,32 +5600,39 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
5499
5600
|
}
|
|
5500
5601
|
var standardGraphQLHandlers = {
|
|
5501
5602
|
/**
|
|
5502
|
-
*
|
|
5503
|
-
*
|
|
5504
|
-
* graphql.operation(() => {
|
|
5505
|
-
* return HttpResponse.json({ data: { name: 'John' } })
|
|
5506
|
-
* })
|
|
5507
|
-
* @see {@link https://mswjs.io/docs/api/graphql/operation `graphql.operation()`}
|
|
5508
|
-
*/
|
|
5509
|
-
operation: createGraphQLOperationHandler("*"),
|
|
5510
|
-
/**
|
|
5511
|
-
* Captures a GraphQL query by a given name.
|
|
5603
|
+
* Intercepts a GraphQL query by a given name.
|
|
5604
|
+
*
|
|
5512
5605
|
* @example
|
|
5513
5606
|
* graphql.query('GetUser', () => {
|
|
5514
5607
|
* return HttpResponse.json({ data: { user: { name: 'John' } } })
|
|
5515
5608
|
* })
|
|
5516
|
-
*
|
|
5609
|
+
*
|
|
5610
|
+
* @see {@link https://mswjs.io/docs/api/graphql#graphqlqueryqueryname-resolver `graphql.query()` API reference}
|
|
5517
5611
|
*/
|
|
5518
5612
|
query: createScopedGraphQLHandler("query", "*"),
|
|
5519
5613
|
/**
|
|
5520
|
-
*
|
|
5614
|
+
* Intercepts a GraphQL mutation by its name.
|
|
5615
|
+
*
|
|
5521
5616
|
* @example
|
|
5522
5617
|
* graphql.mutation('SavePost', () => {
|
|
5523
5618
|
* return HttpResponse.json({ data: { post: { id: 'abc-123 } } })
|
|
5524
5619
|
* })
|
|
5525
|
-
*
|
|
5620
|
+
*
|
|
5621
|
+
* @see {@link https://mswjs.io/docs/api/graphql#graphqlmutationmutationname-resolver `graphql.query()` API reference}
|
|
5622
|
+
*
|
|
5623
|
+
*/
|
|
5624
|
+
mutation: createScopedGraphQLHandler("mutation", "*"),
|
|
5625
|
+
/**
|
|
5626
|
+
* Intercepts any GraphQL operation, regardless of its type or name.
|
|
5627
|
+
*
|
|
5628
|
+
* @example
|
|
5629
|
+
* graphql.operation(() => {
|
|
5630
|
+
* return HttpResponse.json({ data: { name: 'John' } })
|
|
5631
|
+
* })
|
|
5632
|
+
*
|
|
5633
|
+
* @see {@link https://mswjs.io/docs/api/graphql#graphloperationresolver `graphql.operation()` API reference}
|
|
5526
5634
|
*/
|
|
5527
|
-
|
|
5635
|
+
operation: createGraphQLOperationHandler("*")
|
|
5528
5636
|
};
|
|
5529
5637
|
function createGraphQLLink(url) {
|
|
5530
5638
|
return {
|
|
@@ -5534,6 +5642,15 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
5534
5642
|
};
|
|
5535
5643
|
}
|
|
5536
5644
|
var graphql = __spreadProps(__spreadValues({}, standardGraphQLHandlers), {
|
|
5645
|
+
/**
|
|
5646
|
+
* Intercepts GraphQL operations scoped by the given URL.
|
|
5647
|
+
*
|
|
5648
|
+
* @example
|
|
5649
|
+
* const github = graphql.link('https://api.github.com/graphql')
|
|
5650
|
+
* github.query('GetRepo', resolver)
|
|
5651
|
+
*
|
|
5652
|
+
* @see {@link https://mswjs.io/docs/api/graphql#graphqllinkurl `graphql.link()` API reference}
|
|
5653
|
+
*/
|
|
5537
5654
|
link: createGraphQLLink
|
|
5538
5655
|
});
|
|
5539
5656
|
|
|
@@ -5554,7 +5671,7 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
5554
5671
|
let matchingHandler = null;
|
|
5555
5672
|
let result = null;
|
|
5556
5673
|
for (const handler of handlers) {
|
|
5557
|
-
result = yield handler.run(request, resolutionContext);
|
|
5674
|
+
result = yield handler.run({ request, resolutionContext });
|
|
5558
5675
|
if (result !== null) {
|
|
5559
5676
|
matchingHandler = handler;
|
|
5560
5677
|
}
|
|
@@ -5565,7 +5682,7 @@ Consider naming this operation or using "graphql.operation()" request handler to
|
|
|
5565
5682
|
if (matchingHandler) {
|
|
5566
5683
|
return {
|
|
5567
5684
|
handler: matchingHandler,
|
|
5568
|
-
|
|
5685
|
+
parsedResult: result == null ? void 0 : result.parsedResult,
|
|
5569
5686
|
response: result == null ? void 0 : result.response
|
|
5570
5687
|
};
|
|
5571
5688
|
}
|
|
@@ -5776,7 +5893,7 @@ ${handlers.map((handler) => ` \u2022 ${handler.info.header}`).join("\n")}`;
|
|
|
5776
5893
|
const requestHeader = parsedGraphQLQuery ? getGraphQLRequestHeader(parsedGraphQLQuery) : `${request.method} ${publicUrl}`;
|
|
5777
5894
|
const handlerSuggestion = generateHandlerSuggestion();
|
|
5778
5895
|
const messageTemplate = [
|
|
5779
|
-
`
|
|
5896
|
+
`intercepted a request without a matching request handler:`,
|
|
5780
5897
|
` \u2022 ${requestHeader}`,
|
|
5781
5898
|
handlerSuggestion,
|
|
5782
5899
|
`If you still wish to intercept this unhandled request, please create a request handler for it.
|
|
@@ -6034,53 +6151,16 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
|
|
|
6034
6151
|
|
|
6035
6152
|
// src/core/bypass.ts
|
|
6036
6153
|
function bypass(input, init) {
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
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
|
-
});
|
|
6154
|
+
const request = input instanceof Request ? input : new Request(input, init);
|
|
6155
|
+
invariant(
|
|
6156
|
+
!request.bodyUsed,
|
|
6157
|
+
'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.',
|
|
6158
|
+
request.method,
|
|
6159
|
+
request.url
|
|
6160
|
+
);
|
|
6161
|
+
const requestClone = request.clone();
|
|
6162
|
+
requestClone.headers.set("x-msw-intention", "bypass");
|
|
6163
|
+
return requestClone;
|
|
6084
6164
|
}
|
|
6085
6165
|
|
|
6086
6166
|
// src/core/passthrough.ts
|
|
@@ -6259,7 +6339,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
6259
6339
|
return {
|
|
6260
6340
|
status: response.status,
|
|
6261
6341
|
statusText: response.statusText,
|
|
6262
|
-
headers:
|
|
6342
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
6263
6343
|
};
|
|
6264
6344
|
}
|
|
6265
6345
|
|
|
@@ -6284,7 +6364,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
6284
6364
|
messageChannel.postMessage("NOT_FOUND");
|
|
6285
6365
|
},
|
|
6286
6366
|
onMockedResponse(_0, _1) {
|
|
6287
|
-
return __async(this, arguments, function* (response, { handler,
|
|
6367
|
+
return __async(this, arguments, function* (response, { handler, parsedResult }) {
|
|
6288
6368
|
const responseClone = response.clone();
|
|
6289
6369
|
const responseInit = toResponseInit(response);
|
|
6290
6370
|
const responseStream = responseClone.body;
|
|
@@ -6299,7 +6379,11 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
6299
6379
|
);
|
|
6300
6380
|
if (!options.quiet) {
|
|
6301
6381
|
context.emitter.once("response:mocked", ({ response: response2 }) => {
|
|
6302
|
-
handler.log(
|
|
6382
|
+
handler.log({
|
|
6383
|
+
request: requestCloneForLogs,
|
|
6384
|
+
response: response2,
|
|
6385
|
+
parsedResult
|
|
6386
|
+
});
|
|
6303
6387
|
});
|
|
6304
6388
|
}
|
|
6305
6389
|
});
|
|
@@ -6342,9 +6426,9 @@ This exception has been gracefully handled as a 500 response, however, it's stro
|
|
|
6342
6426
|
const { payload: actualChecksum } = yield context.events.once(
|
|
6343
6427
|
"INTEGRITY_CHECK_RESPONSE"
|
|
6344
6428
|
);
|
|
6345
|
-
if (actualChecksum !== "
|
|
6429
|
+
if (actualChecksum !== "0877fcdc026242810f5bfde0d7178db4") {
|
|
6346
6430
|
throw new Error(
|
|
6347
|
-
`Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"
|
|
6431
|
+
`Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"0877fcdc026242810f5bfde0d7178db4"}).`
|
|
6348
6432
|
);
|
|
6349
6433
|
}
|
|
6350
6434
|
return serviceWorker;
|
|
@@ -7813,10 +7897,14 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
7813
7897
|
options,
|
|
7814
7898
|
context.emitter,
|
|
7815
7899
|
{
|
|
7816
|
-
onMockedResponse(_, { handler,
|
|
7900
|
+
onMockedResponse(_, { handler, parsedResult }) {
|
|
7817
7901
|
if (!options.quiet) {
|
|
7818
7902
|
context.emitter.once("response:mocked", ({ response: response2 }) => {
|
|
7819
|
-
handler.log(
|
|
7903
|
+
handler.log({
|
|
7904
|
+
request: requestCloneForLogs,
|
|
7905
|
+
response: response2,
|
|
7906
|
+
parsedResult
|
|
7907
|
+
});
|
|
7820
7908
|
});
|
|
7821
7909
|
}
|
|
7822
7910
|
}
|