msw 2.11.2 → 2.11.4
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/lib/browser/index.js +129 -114
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +129 -114
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{HttpResponse-BbwAqLE_.d.ts → HttpResponse-BpT5A_2L.d.ts} +1 -0
- package/lib/core/{HttpResponse-B4YmE-GJ.d.mts → HttpResponse-DGUjNQHG.d.mts} +1 -0
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs.map +1 -1
- package/lib/core/SetupApi.d.mts +1 -1
- package/lib/core/SetupApi.d.ts +1 -1
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +1 -1
- package/lib/core/graphql.d.ts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
- package/lib/core/handlers/HttpHandler.d.mts +1 -1
- package/lib/core/handlers/HttpHandler.d.ts +1 -1
- package/lib/core/handlers/HttpHandler.js +0 -5
- package/lib/core/handlers/HttpHandler.js.map +1 -1
- package/lib/core/handlers/HttpHandler.mjs +1 -6
- package/lib/core/handlers/HttpHandler.mjs.map +1 -1
- package/lib/core/handlers/RequestHandler.d.mts +1 -1
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/index.d.mts +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.js +1 -1
- package/lib/core/utils/HttpResponse/decorators.js.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -1
- package/lib/core/utils/executeHandlers.d.mts +1 -1
- package/lib/core/utils/executeHandlers.d.ts +1 -1
- package/lib/core/utils/handleRequest.d.mts +1 -1
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/handleRequest.js +8 -8
- package/lib/core/utils/handleRequest.js.map +1 -1
- package/lib/core/utils/handleRequest.mjs +8 -8
- package/lib/core/utils/handleRequest.mjs.map +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
- package/lib/core/utils/logging/serializeResponse.js +1 -1
- package/lib/core/utils/logging/serializeResponse.js.map +1 -1
- package/lib/core/utils/logging/serializeResponse.mjs +1 -1
- package/lib/core/utils/logging/serializeResponse.mjs.map +1 -1
- package/lib/core/utils/request/getRequestCookies.js +3 -13
- package/lib/core/utils/request/getRequestCookies.js.map +1 -1
- package/lib/core/utils/request/getRequestCookies.mjs +6 -3
- package/lib/core/utils/request/getRequestCookies.mjs.map +1 -1
- package/lib/core/utils/url/cleanUrl.d.mts +1 -2
- package/lib/core/utils/url/cleanUrl.d.ts +1 -2
- package/lib/core/utils/url/cleanUrl.js +1 -5
- package/lib/core/utils/url/cleanUrl.js.map +1 -1
- package/lib/core/utils/url/cleanUrl.mjs +1 -5
- package/lib/core/utils/url/cleanUrl.mjs.map +1 -1
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.mts +1 -2
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.ts +1 -2
- package/lib/core/ws/WebSocketIndexedDBClientStore.js.map +1 -1
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs.map +1 -1
- package/lib/core/ws/WebSocketMemoryClientStore.d.mts +1 -2
- package/lib/core/ws/WebSocketMemoryClientStore.d.ts +1 -2
- package/lib/core/ws/WebSocketMemoryClientStore.js.map +1 -1
- package/lib/core/ws/WebSocketMemoryClientStore.mjs.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +2 -3
- package/lib/core/ws/handleWebSocketEvent.d.ts +2 -3
- package/lib/core/ws/handleWebSocketEvent.js.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.mjs.map +1 -1
- package/lib/core/ws/utils/getMessageLength.d.mts +1 -1
- package/lib/core/ws/utils/getMessageLength.d.ts +1 -1
- package/lib/core/ws/utils/getMessageLength.js.map +1 -1
- package/lib/core/ws/utils/getMessageLength.mjs.map +1 -1
- package/lib/iife/index.js +595 -636
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +2 -1
- package/lib/shims/cookie.d.mts +7 -0
- package/lib/shims/cookie.d.ts +7 -0
- package/lib/shims/cookie.js +204 -0
- package/lib/shims/cookie.mjs +196 -0
- package/lib/shims/statuses.d.mts +6 -0
- package/lib/shims/statuses.d.ts +6 -0
- package/lib/shims/statuses.js +195 -0
- package/lib/shims/statuses.mjs +187 -0
- package/package.json +7 -8
- package/src/browser/setupWorker/glossary.ts +1 -5
- package/src/browser/setupWorker/setupWorker.ts +4 -9
- package/src/browser/setupWorker/start/createRequestListener.ts +4 -1
- package/src/browser/setupWorker/start/utils/getWorkerInstance.ts +17 -16
- package/src/browser/utils/{supportsReadableStreamTransfer.ts → supports.ts} +13 -0
- package/src/browser/utils/workerChannel.ts +13 -0
- package/src/core/HttpResponse.ts +1 -0
- package/src/core/handlers/HttpHandler.ts +1 -8
- package/src/core/utils/HttpResponse/decorators.ts +1 -1
- package/src/core/utils/handleRequest.ts +8 -8
- package/src/core/utils/logging/serializeResponse.ts +1 -1
- package/src/core/utils/request/getRequestCookies.ts +6 -3
- package/src/core/utils/url/cleanUrl.ts +0 -4
- package/src/core/ws/WebSocketIndexedDBClientStore.ts +1 -1
- package/src/core/ws/WebSocketMemoryClientStore.ts +1 -1
- package/src/core/ws/handleWebSocketEvent.ts +1 -1
- package/src/core/ws/utils/getMessageLength.ts +1 -1
- package/src/mockServiceWorker.js +1 -0
- package/src/shims/cookie.ts +7 -0
- package/src/shims/statuses.ts +6 -0
- package/src/tsconfig.src.json +1 -6
- package/src/browser/utils/deferNetworkRequestsUntil.test.ts +0 -48
- package/src/browser/utils/deferNetworkRequestsUntil.ts +0 -29
package/lib/mockServiceWorker.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const PACKAGE_VERSION = '2.11.
|
|
10
|
+
const PACKAGE_VERSION = '2.11.4'
|
|
11
11
|
const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
|
|
12
12
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
13
|
const activeClientIds = new Set()
|
|
@@ -205,6 +205,7 @@ async function resolveMainClient(event) {
|
|
|
205
205
|
* @param {FetchEvent} event
|
|
206
206
|
* @param {Client | undefined} client
|
|
207
207
|
* @param {string} requestId
|
|
208
|
+
* @param {number} requestInterceptedAt
|
|
208
209
|
* @returns {Promise<Response>}
|
|
209
210
|
*/
|
|
210
211
|
async function getResponse(event, client, requestId, requestInterceptedAt) {
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
34
|
+
var require_dist = __commonJS({
|
|
35
|
+
"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.parse = parse2;
|
|
39
|
+
exports.serialize = serialize2;
|
|
40
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
41
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
42
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
43
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
44
|
+
var __toString = Object.prototype.toString;
|
|
45
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
46
|
+
const C = function() {
|
|
47
|
+
};
|
|
48
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
49
|
+
return C;
|
|
50
|
+
})();
|
|
51
|
+
function parse2(str, options) {
|
|
52
|
+
const obj = new NullObject();
|
|
53
|
+
const len = str.length;
|
|
54
|
+
if (len < 2)
|
|
55
|
+
return obj;
|
|
56
|
+
const dec = options?.decode || decode;
|
|
57
|
+
let index = 0;
|
|
58
|
+
do {
|
|
59
|
+
const eqIdx = str.indexOf("=", index);
|
|
60
|
+
if (eqIdx === -1)
|
|
61
|
+
break;
|
|
62
|
+
const colonIdx = str.indexOf(";", index);
|
|
63
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
64
|
+
if (eqIdx > endIdx) {
|
|
65
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
69
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
70
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
71
|
+
if (obj[key] === void 0) {
|
|
72
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
73
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
74
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
75
|
+
obj[key] = value;
|
|
76
|
+
}
|
|
77
|
+
index = endIdx + 1;
|
|
78
|
+
} while (index < len);
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
function startIndex(str, index, max) {
|
|
82
|
+
do {
|
|
83
|
+
const code = str.charCodeAt(index);
|
|
84
|
+
if (code !== 32 && code !== 9)
|
|
85
|
+
return index;
|
|
86
|
+
} while (++index < max);
|
|
87
|
+
return max;
|
|
88
|
+
}
|
|
89
|
+
function endIndex(str, index, min) {
|
|
90
|
+
while (index > min) {
|
|
91
|
+
const code = str.charCodeAt(--index);
|
|
92
|
+
if (code !== 32 && code !== 9)
|
|
93
|
+
return index + 1;
|
|
94
|
+
}
|
|
95
|
+
return min;
|
|
96
|
+
}
|
|
97
|
+
function serialize2(name, val, options) {
|
|
98
|
+
const enc = options?.encode || encodeURIComponent;
|
|
99
|
+
if (!cookieNameRegExp.test(name)) {
|
|
100
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
101
|
+
}
|
|
102
|
+
const value = enc(val);
|
|
103
|
+
if (!cookieValueRegExp.test(value)) {
|
|
104
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
105
|
+
}
|
|
106
|
+
let str = name + "=" + value;
|
|
107
|
+
if (!options)
|
|
108
|
+
return str;
|
|
109
|
+
if (options.maxAge !== void 0) {
|
|
110
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
111
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
112
|
+
}
|
|
113
|
+
str += "; Max-Age=" + options.maxAge;
|
|
114
|
+
}
|
|
115
|
+
if (options.domain) {
|
|
116
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
117
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Domain=" + options.domain;
|
|
120
|
+
}
|
|
121
|
+
if (options.path) {
|
|
122
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
123
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Path=" + options.path;
|
|
126
|
+
}
|
|
127
|
+
if (options.expires) {
|
|
128
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
129
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
130
|
+
}
|
|
131
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
132
|
+
}
|
|
133
|
+
if (options.httpOnly) {
|
|
134
|
+
str += "; HttpOnly";
|
|
135
|
+
}
|
|
136
|
+
if (options.secure) {
|
|
137
|
+
str += "; Secure";
|
|
138
|
+
}
|
|
139
|
+
if (options.partitioned) {
|
|
140
|
+
str += "; Partitioned";
|
|
141
|
+
}
|
|
142
|
+
if (options.priority) {
|
|
143
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
144
|
+
switch (priority) {
|
|
145
|
+
case "low":
|
|
146
|
+
str += "; Priority=Low";
|
|
147
|
+
break;
|
|
148
|
+
case "medium":
|
|
149
|
+
str += "; Priority=Medium";
|
|
150
|
+
break;
|
|
151
|
+
case "high":
|
|
152
|
+
str += "; Priority=High";
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (options.sameSite) {
|
|
159
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
160
|
+
switch (sameSite) {
|
|
161
|
+
case true:
|
|
162
|
+
case "strict":
|
|
163
|
+
str += "; SameSite=Strict";
|
|
164
|
+
break;
|
|
165
|
+
case "lax":
|
|
166
|
+
str += "; SameSite=Lax";
|
|
167
|
+
break;
|
|
168
|
+
case "none":
|
|
169
|
+
str += "; SameSite=None";
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return str;
|
|
176
|
+
}
|
|
177
|
+
function decode(str) {
|
|
178
|
+
if (str.indexOf("%") === -1)
|
|
179
|
+
return str;
|
|
180
|
+
try {
|
|
181
|
+
return decodeURIComponent(str);
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return str;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function isDate(val) {
|
|
187
|
+
return __toString.call(val) === "[object Date]";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// src/shims/cookie.ts
|
|
193
|
+
var cookie_exports = {};
|
|
194
|
+
__export(cookie_exports, {
|
|
195
|
+
default: () => cookie_default,
|
|
196
|
+
parse: () => parse,
|
|
197
|
+
serialize: () => serialize
|
|
198
|
+
});
|
|
199
|
+
module.exports = __toCommonJS(cookie_exports);
|
|
200
|
+
var allCookie = __toESM(require_dist(), 1);
|
|
201
|
+
var cookie = allCookie.default || allCookie;
|
|
202
|
+
var parse = cookie.parse;
|
|
203
|
+
var serialize = cookie.serialize;
|
|
204
|
+
var cookie_default = cookie;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
28
|
+
var require_dist = __commonJS({
|
|
29
|
+
"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) {
|
|
30
|
+
"use strict";
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.parse = parse2;
|
|
33
|
+
exports.serialize = serialize2;
|
|
34
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
35
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
36
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
37
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
38
|
+
var __toString = Object.prototype.toString;
|
|
39
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
40
|
+
const C = function() {
|
|
41
|
+
};
|
|
42
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
43
|
+
return C;
|
|
44
|
+
})();
|
|
45
|
+
function parse2(str, options) {
|
|
46
|
+
const obj = new NullObject();
|
|
47
|
+
const len = str.length;
|
|
48
|
+
if (len < 2)
|
|
49
|
+
return obj;
|
|
50
|
+
const dec = options?.decode || decode;
|
|
51
|
+
let index = 0;
|
|
52
|
+
do {
|
|
53
|
+
const eqIdx = str.indexOf("=", index);
|
|
54
|
+
if (eqIdx === -1)
|
|
55
|
+
break;
|
|
56
|
+
const colonIdx = str.indexOf(";", index);
|
|
57
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
58
|
+
if (eqIdx > endIdx) {
|
|
59
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
63
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
64
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
65
|
+
if (obj[key] === void 0) {
|
|
66
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
67
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
68
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
69
|
+
obj[key] = value;
|
|
70
|
+
}
|
|
71
|
+
index = endIdx + 1;
|
|
72
|
+
} while (index < len);
|
|
73
|
+
return obj;
|
|
74
|
+
}
|
|
75
|
+
function startIndex(str, index, max) {
|
|
76
|
+
do {
|
|
77
|
+
const code = str.charCodeAt(index);
|
|
78
|
+
if (code !== 32 && code !== 9)
|
|
79
|
+
return index;
|
|
80
|
+
} while (++index < max);
|
|
81
|
+
return max;
|
|
82
|
+
}
|
|
83
|
+
function endIndex(str, index, min) {
|
|
84
|
+
while (index > min) {
|
|
85
|
+
const code = str.charCodeAt(--index);
|
|
86
|
+
if (code !== 32 && code !== 9)
|
|
87
|
+
return index + 1;
|
|
88
|
+
}
|
|
89
|
+
return min;
|
|
90
|
+
}
|
|
91
|
+
function serialize2(name, val, options) {
|
|
92
|
+
const enc = options?.encode || encodeURIComponent;
|
|
93
|
+
if (!cookieNameRegExp.test(name)) {
|
|
94
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
95
|
+
}
|
|
96
|
+
const value = enc(val);
|
|
97
|
+
if (!cookieValueRegExp.test(value)) {
|
|
98
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
99
|
+
}
|
|
100
|
+
let str = name + "=" + value;
|
|
101
|
+
if (!options)
|
|
102
|
+
return str;
|
|
103
|
+
if (options.maxAge !== void 0) {
|
|
104
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
105
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
106
|
+
}
|
|
107
|
+
str += "; Max-Age=" + options.maxAge;
|
|
108
|
+
}
|
|
109
|
+
if (options.domain) {
|
|
110
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
111
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
112
|
+
}
|
|
113
|
+
str += "; Domain=" + options.domain;
|
|
114
|
+
}
|
|
115
|
+
if (options.path) {
|
|
116
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
117
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Path=" + options.path;
|
|
120
|
+
}
|
|
121
|
+
if (options.expires) {
|
|
122
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
123
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
126
|
+
}
|
|
127
|
+
if (options.httpOnly) {
|
|
128
|
+
str += "; HttpOnly";
|
|
129
|
+
}
|
|
130
|
+
if (options.secure) {
|
|
131
|
+
str += "; Secure";
|
|
132
|
+
}
|
|
133
|
+
if (options.partitioned) {
|
|
134
|
+
str += "; Partitioned";
|
|
135
|
+
}
|
|
136
|
+
if (options.priority) {
|
|
137
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
138
|
+
switch (priority) {
|
|
139
|
+
case "low":
|
|
140
|
+
str += "; Priority=Low";
|
|
141
|
+
break;
|
|
142
|
+
case "medium":
|
|
143
|
+
str += "; Priority=Medium";
|
|
144
|
+
break;
|
|
145
|
+
case "high":
|
|
146
|
+
str += "; Priority=High";
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (options.sameSite) {
|
|
153
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
154
|
+
switch (sameSite) {
|
|
155
|
+
case true:
|
|
156
|
+
case "strict":
|
|
157
|
+
str += "; SameSite=Strict";
|
|
158
|
+
break;
|
|
159
|
+
case "lax":
|
|
160
|
+
str += "; SameSite=Lax";
|
|
161
|
+
break;
|
|
162
|
+
case "none":
|
|
163
|
+
str += "; SameSite=None";
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return str;
|
|
170
|
+
}
|
|
171
|
+
function decode(str) {
|
|
172
|
+
if (str.indexOf("%") === -1)
|
|
173
|
+
return str;
|
|
174
|
+
try {
|
|
175
|
+
return decodeURIComponent(str);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
return str;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function isDate(val) {
|
|
181
|
+
return __toString.call(val) === "[object Date]";
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// src/shims/cookie.ts
|
|
187
|
+
var allCookie = __toESM(require_dist(), 1);
|
|
188
|
+
var cookie = allCookie.default || allCookie;
|
|
189
|
+
var parse = cookie.parse;
|
|
190
|
+
var serialize = cookie.serialize;
|
|
191
|
+
var cookie_default = cookie;
|
|
192
|
+
export {
|
|
193
|
+
cookie_default as default,
|
|
194
|
+
parse,
|
|
195
|
+
serialize
|
|
196
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json
|
|
34
|
+
var require_codes = __commonJS({
|
|
35
|
+
"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json"(exports, module2) {
|
|
36
|
+
module2.exports = {
|
|
37
|
+
"100": "Continue",
|
|
38
|
+
"101": "Switching Protocols",
|
|
39
|
+
"102": "Processing",
|
|
40
|
+
"103": "Early Hints",
|
|
41
|
+
"200": "OK",
|
|
42
|
+
"201": "Created",
|
|
43
|
+
"202": "Accepted",
|
|
44
|
+
"203": "Non-Authoritative Information",
|
|
45
|
+
"204": "No Content",
|
|
46
|
+
"205": "Reset Content",
|
|
47
|
+
"206": "Partial Content",
|
|
48
|
+
"207": "Multi-Status",
|
|
49
|
+
"208": "Already Reported",
|
|
50
|
+
"226": "IM Used",
|
|
51
|
+
"300": "Multiple Choices",
|
|
52
|
+
"301": "Moved Permanently",
|
|
53
|
+
"302": "Found",
|
|
54
|
+
"303": "See Other",
|
|
55
|
+
"304": "Not Modified",
|
|
56
|
+
"305": "Use Proxy",
|
|
57
|
+
"307": "Temporary Redirect",
|
|
58
|
+
"308": "Permanent Redirect",
|
|
59
|
+
"400": "Bad Request",
|
|
60
|
+
"401": "Unauthorized",
|
|
61
|
+
"402": "Payment Required",
|
|
62
|
+
"403": "Forbidden",
|
|
63
|
+
"404": "Not Found",
|
|
64
|
+
"405": "Method Not Allowed",
|
|
65
|
+
"406": "Not Acceptable",
|
|
66
|
+
"407": "Proxy Authentication Required",
|
|
67
|
+
"408": "Request Timeout",
|
|
68
|
+
"409": "Conflict",
|
|
69
|
+
"410": "Gone",
|
|
70
|
+
"411": "Length Required",
|
|
71
|
+
"412": "Precondition Failed",
|
|
72
|
+
"413": "Payload Too Large",
|
|
73
|
+
"414": "URI Too Long",
|
|
74
|
+
"415": "Unsupported Media Type",
|
|
75
|
+
"416": "Range Not Satisfiable",
|
|
76
|
+
"417": "Expectation Failed",
|
|
77
|
+
"418": "I'm a Teapot",
|
|
78
|
+
"421": "Misdirected Request",
|
|
79
|
+
"422": "Unprocessable Entity",
|
|
80
|
+
"423": "Locked",
|
|
81
|
+
"424": "Failed Dependency",
|
|
82
|
+
"425": "Too Early",
|
|
83
|
+
"426": "Upgrade Required",
|
|
84
|
+
"428": "Precondition Required",
|
|
85
|
+
"429": "Too Many Requests",
|
|
86
|
+
"431": "Request Header Fields Too Large",
|
|
87
|
+
"451": "Unavailable For Legal Reasons",
|
|
88
|
+
"500": "Internal Server Error",
|
|
89
|
+
"501": "Not Implemented",
|
|
90
|
+
"502": "Bad Gateway",
|
|
91
|
+
"503": "Service Unavailable",
|
|
92
|
+
"504": "Gateway Timeout",
|
|
93
|
+
"505": "HTTP Version Not Supported",
|
|
94
|
+
"506": "Variant Also Negotiates",
|
|
95
|
+
"507": "Insufficient Storage",
|
|
96
|
+
"508": "Loop Detected",
|
|
97
|
+
"509": "Bandwidth Limit Exceeded",
|
|
98
|
+
"510": "Not Extended",
|
|
99
|
+
"511": "Network Authentication Required"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js
|
|
105
|
+
var require_statuses = __commonJS({
|
|
106
|
+
"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"(exports, module2) {
|
|
107
|
+
"use strict";
|
|
108
|
+
var codes = require_codes();
|
|
109
|
+
module2.exports = status;
|
|
110
|
+
status.message = codes;
|
|
111
|
+
status.code = createMessageToStatusCodeMap(codes);
|
|
112
|
+
status.codes = createStatusCodeList(codes);
|
|
113
|
+
status.redirect = {
|
|
114
|
+
300: true,
|
|
115
|
+
301: true,
|
|
116
|
+
302: true,
|
|
117
|
+
303: true,
|
|
118
|
+
305: true,
|
|
119
|
+
307: true,
|
|
120
|
+
308: true
|
|
121
|
+
};
|
|
122
|
+
status.empty = {
|
|
123
|
+
204: true,
|
|
124
|
+
205: true,
|
|
125
|
+
304: true
|
|
126
|
+
};
|
|
127
|
+
status.retry = {
|
|
128
|
+
502: true,
|
|
129
|
+
503: true,
|
|
130
|
+
504: true
|
|
131
|
+
};
|
|
132
|
+
function createMessageToStatusCodeMap(codes2) {
|
|
133
|
+
var map = {};
|
|
134
|
+
Object.keys(codes2).forEach(function forEachCode(code) {
|
|
135
|
+
var message2 = codes2[code];
|
|
136
|
+
var status2 = Number(code);
|
|
137
|
+
map[message2.toLowerCase()] = status2;
|
|
138
|
+
});
|
|
139
|
+
return map;
|
|
140
|
+
}
|
|
141
|
+
function createStatusCodeList(codes2) {
|
|
142
|
+
return Object.keys(codes2).map(function mapCode(code) {
|
|
143
|
+
return Number(code);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function getStatusCode(message2) {
|
|
147
|
+
var msg = message2.toLowerCase();
|
|
148
|
+
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
|
149
|
+
throw new Error('invalid status message: "' + message2 + '"');
|
|
150
|
+
}
|
|
151
|
+
return status.code[msg];
|
|
152
|
+
}
|
|
153
|
+
function getStatusMessage(code) {
|
|
154
|
+
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
|
155
|
+
throw new Error("invalid status code: " + code);
|
|
156
|
+
}
|
|
157
|
+
return status.message[code];
|
|
158
|
+
}
|
|
159
|
+
function status(code) {
|
|
160
|
+
if (typeof code === "number") {
|
|
161
|
+
return getStatusMessage(code);
|
|
162
|
+
}
|
|
163
|
+
if (typeof code !== "string") {
|
|
164
|
+
throw new TypeError("code must be a number or string");
|
|
165
|
+
}
|
|
166
|
+
var n = parseInt(code, 10);
|
|
167
|
+
if (!isNaN(n)) {
|
|
168
|
+
return getStatusMessage(n);
|
|
169
|
+
}
|
|
170
|
+
return getStatusCode(code);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// src/shims/statuses.ts
|
|
176
|
+
var statuses_exports = {};
|
|
177
|
+
__export(statuses_exports, {
|
|
178
|
+
default: () => statuses_default,
|
|
179
|
+
message: () => message
|
|
180
|
+
});
|
|
181
|
+
module.exports = __toCommonJS(statuses_exports);
|
|
182
|
+
var allStatuses = __toESM(require_statuses(), 1);
|
|
183
|
+
var statuses = allStatuses.default || allStatuses;
|
|
184
|
+
var message = statuses.message;
|
|
185
|
+
var statuses_default = statuses;
|
|
186
|
+
/*! Bundled license information:
|
|
187
|
+
|
|
188
|
+
statuses/index.js:
|
|
189
|
+
(*!
|
|
190
|
+
* statuses
|
|
191
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
192
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
193
|
+
* MIT Licensed
|
|
194
|
+
*)
|
|
195
|
+
*/
|