msw 0.45.0 → 0.46.0

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.45.0).
5
+ * Mock Service Worker (0.46.0).
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';
@@ -1234,6 +1234,13 @@ function pipeEvents(source, destination) {
1234
1234
  source.emit._isPiped = true;
1235
1235
  }
1236
1236
 
1237
+ // src/utils/internal/toReadonlyArray.ts
1238
+ function toReadonlyArray(source) {
1239
+ const clone = [...source];
1240
+ Object.freeze(clone);
1241
+ return clone;
1242
+ }
1243
+
1237
1244
  // src/node/createSetupServer.ts
1238
1245
  var DEFAULT_LISTEN_OPTIONS = {
1239
1246
  onUnhandledRequest: "warn"
@@ -1305,8 +1312,12 @@ function createSetupServer(...interceptors) {
1305
1312
  resetHandlers(...nextHandlers) {
1306
1313
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1307
1314
  },
1315
+ listHandlers() {
1316
+ return toReadonlyArray(currentHandlers);
1317
+ },
1308
1318
  printHandlers() {
1309
- currentHandlers.forEach((handler) => {
1319
+ const handlers = this.listHandlers();
1320
+ handlers.forEach((handler) => {
1310
1321
  const { header, callFrame } = handler.info;
1311
1322
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1312
1323
  console.log(`${(0, import_chalk.bold)(`${pragma} ${header}`)}
@@ -1220,6 +1220,13 @@ function pipeEvents(source, destination) {
1220
1220
  source.emit._isPiped = true;
1221
1221
  }
1222
1222
 
1223
+ // src/utils/internal/toReadonlyArray.ts
1224
+ function toReadonlyArray(source) {
1225
+ const clone = [...source];
1226
+ Object.freeze(clone);
1227
+ return clone;
1228
+ }
1229
+
1223
1230
  // src/node/createSetupServer.ts
1224
1231
  var DEFAULT_LISTEN_OPTIONS = {
1225
1232
  onUnhandledRequest: "warn"
@@ -1291,8 +1298,12 @@ function createSetupServer(...interceptors) {
1291
1298
  resetHandlers(...nextHandlers) {
1292
1299
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1293
1300
  },
1301
+ listHandlers() {
1302
+ return toReadonlyArray(currentHandlers);
1303
+ },
1294
1304
  printHandlers() {
1295
- currentHandlers.forEach((handler) => {
1305
+ const handlers = this.listHandlers();
1306
+ handlers.forEach((handler) => {
1296
1307
  const { header, callFrame } = handler.info;
1297
1308
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1298
1309
  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
@@ -1241,6 +1241,13 @@ function pipeEvents(source, destination) {
1241
1241
  source.emit._isPiped = true;
1242
1242
  }
1243
1243
 
1244
+ // src/utils/internal/toReadonlyArray.ts
1245
+ function toReadonlyArray(source) {
1246
+ const clone = [...source];
1247
+ Object.freeze(clone);
1248
+ return clone;
1249
+ }
1250
+
1244
1251
  // src/node/createSetupServer.ts
1245
1252
  var DEFAULT_LISTEN_OPTIONS = {
1246
1253
  onUnhandledRequest: "warn"
@@ -1312,8 +1319,12 @@ function createSetupServer(...interceptors) {
1312
1319
  resetHandlers(...nextHandlers) {
1313
1320
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1314
1321
  },
1322
+ listHandlers() {
1323
+ return toReadonlyArray(currentHandlers);
1324
+ },
1315
1325
  printHandlers() {
1316
- currentHandlers.forEach((handler) => {
1326
+ const handlers = this.listHandlers();
1327
+ handlers.forEach((handler) => {
1317
1328
  const { header, callFrame } = handler.info;
1318
1329
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1319
1330
  console.log(`${(0, import_chalk.bold)(`${pragma} ${header}`)}