msw 0.44.2 → 0.46.1

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.
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable */
3
3
 
4
4
  /**
5
- * Mock Service Worker (0.44.2).
5
+ * Mock Service Worker (0.46.1).
6
6
  * @see https://github.com/mswjs/msw
7
7
  * - Please do NOT modify this file.
8
8
  * - Please do NOT serve this file on production.
@@ -200,7 +200,7 @@ async function getResponse(event, client, requestId) {
200
200
 
201
201
  function passthrough() {
202
202
  // Clone the request because it might've been already used
203
- // (i.e. its body has been read and sent to the cilent).
203
+ // (i.e. its body has been read and sent to the client).
204
204
  const headers = Object.fromEntries(clonedRequest.headers.entries())
205
205
 
206
206
  // Remove MSW-specific request headers so the bypassed requests
@@ -1,4 +1,4 @@
1
- import { b as RequestHandler, i as RequestHandlerDefaultInfo, M as MockedRequest, c as DefaultBodyType, I as SetupServerApi } from '../glossary-297d38ba.js';
1
+ import { b as RequestHandler, i as RequestHandlerDefaultInfo, M as MockedRequest, c as DefaultBodyType, I as SetupServerApi } from '../glossary-c690f512.js';
2
2
  import 'type-fest';
3
3
  import '@mswjs/interceptors';
4
4
  import 'headers-polyfill';
@@ -1236,6 +1236,13 @@ function pipeEvents(source, destination) {
1236
1236
  source.emit._isPiped = true;
1237
1237
  }
1238
1238
 
1239
+ // src/utils/internal/toReadonlyArray.ts
1240
+ function toReadonlyArray(source) {
1241
+ const clone = [...source];
1242
+ Object.freeze(clone);
1243
+ return clone;
1244
+ }
1245
+
1239
1246
  // src/node/createSetupServer.ts
1240
1247
  var DEFAULT_LISTEN_OPTIONS = {
1241
1248
  onUnhandledRequest: "warn"
@@ -1307,8 +1314,12 @@ function createSetupServer(...interceptors) {
1307
1314
  resetHandlers(...nextHandlers) {
1308
1315
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1309
1316
  },
1317
+ listHandlers() {
1318
+ return toReadonlyArray(currentHandlers);
1319
+ },
1310
1320
  printHandlers() {
1311
- currentHandlers.forEach((handler) => {
1321
+ const handlers = this.listHandlers();
1322
+ handlers.forEach((handler) => {
1312
1323
  const { header, callFrame } = handler.info;
1313
1324
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1314
1325
  console.log(`${(0, import_chalk.bold)(`${pragma} ${header}`)}
@@ -134,9 +134,7 @@ var devUtils = {
134
134
  import getStringMatchScore from "js-levenshtein";
135
135
 
136
136
  // src/utils/internal/parseGraphQLRequest.ts
137
- import {
138
- parse
139
- } from "graphql";
137
+ import { parse } from "graphql";
140
138
 
141
139
  // src/utils/request/getPublicUrlFromRequest.ts
142
140
  var getPublicUrlFromRequest = (request) => {
@@ -1224,6 +1222,13 @@ function pipeEvents(source, destination) {
1224
1222
  source.emit._isPiped = true;
1225
1223
  }
1226
1224
 
1225
+ // src/utils/internal/toReadonlyArray.ts
1226
+ function toReadonlyArray(source) {
1227
+ const clone = [...source];
1228
+ Object.freeze(clone);
1229
+ return clone;
1230
+ }
1231
+
1227
1232
  // src/node/createSetupServer.ts
1228
1233
  var DEFAULT_LISTEN_OPTIONS = {
1229
1234
  onUnhandledRequest: "warn"
@@ -1295,8 +1300,12 @@ function createSetupServer(...interceptors) {
1295
1300
  resetHandlers(...nextHandlers) {
1296
1301
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1297
1302
  },
1303
+ listHandlers() {
1304
+ return toReadonlyArray(currentHandlers);
1305
+ },
1298
1306
  printHandlers() {
1299
- currentHandlers.forEach((handler) => {
1307
+ const handlers = this.listHandlers();
1308
+ handlers.forEach((handler) => {
1300
1309
  const { header, callFrame } = handler.info;
1301
1310
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1302
1311
  console.log(`${bold(`${pragma} ${header}`)}
@@ -1,5 +1,5 @@
1
- import { b as RequestHandler, i as RequestHandlerDefaultInfo, M as MockedRequest, c as DefaultBodyType, I as SetupServerApi } from '../glossary-297d38ba.js';
2
- export { I as SetupServerApi } from '../glossary-297d38ba.js';
1
+ import { b as RequestHandler, i as RequestHandlerDefaultInfo, M as MockedRequest, c as DefaultBodyType, I as SetupServerApi } from '../glossary-c690f512.js';
2
+ export { I as SetupServerApi } from '../glossary-c690f512.js';
3
3
  import 'type-fest';
4
4
  import '@mswjs/interceptors';
5
5
  import 'headers-polyfill';
package/lib/node/index.js CHANGED
@@ -1243,6 +1243,13 @@ function pipeEvents(source, destination) {
1243
1243
  source.emit._isPiped = true;
1244
1244
  }
1245
1245
 
1246
+ // src/utils/internal/toReadonlyArray.ts
1247
+ function toReadonlyArray(source) {
1248
+ const clone = [...source];
1249
+ Object.freeze(clone);
1250
+ return clone;
1251
+ }
1252
+
1246
1253
  // src/node/createSetupServer.ts
1247
1254
  var DEFAULT_LISTEN_OPTIONS = {
1248
1255
  onUnhandledRequest: "warn"
@@ -1314,8 +1321,12 @@ function createSetupServer(...interceptors) {
1314
1321
  resetHandlers(...nextHandlers) {
1315
1322
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1316
1323
  },
1324
+ listHandlers() {
1325
+ return toReadonlyArray(currentHandlers);
1326
+ },
1317
1327
  printHandlers() {
1318
- currentHandlers.forEach((handler) => {
1328
+ const handlers = this.listHandlers();
1329
+ handlers.forEach((handler) => {
1319
1330
  const { header, callFrame } = handler.info;
1320
1331
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1321
1332
  console.log(`${(0, import_chalk.bold)(`${pragma} ${header}`)}