msw 2.2.10 → 2.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/lib/browser/index.js +22 -19
  2. package/lib/browser/index.js.map +1 -1
  3. package/lib/browser/index.mjs +22 -19
  4. package/lib/browser/index.mjs.map +1 -1
  5. package/lib/core/{GraphQLHandler-jOzqbxSK.d.ts → GraphQLHandler-bom2Dn82.d.ts} +3 -3
  6. package/lib/core/{GraphQLHandler-AenIUdwE.d.mts → GraphQLHandler-yJ_I6j54.d.mts} +3 -3
  7. package/lib/core/{HttpResponse-wcp03c7-.d.mts → HttpResponse-3-NyzyF7.d.mts} +3 -3
  8. package/lib/core/{HttpResponse-_514VQ9z.d.ts → HttpResponse-vQNlixkj.d.ts} +3 -3
  9. package/lib/core/HttpResponse.d.mts +1 -1
  10. package/lib/core/HttpResponse.d.ts +1 -1
  11. package/lib/core/HttpResponse.js.map +1 -1
  12. package/lib/core/HttpResponse.mjs.map +1 -1
  13. package/lib/core/SetupApi.d.mts +1 -1
  14. package/lib/core/SetupApi.d.ts +1 -1
  15. package/lib/core/getResponse.d.mts +1 -1
  16. package/lib/core/getResponse.d.ts +1 -1
  17. package/lib/core/graphql.d.mts +8 -6
  18. package/lib/core/graphql.d.ts +8 -6
  19. package/lib/core/graphql.js.map +1 -1
  20. package/lib/core/graphql.mjs.map +1 -1
  21. package/lib/core/handlers/GraphQLHandler.d.mts +2 -2
  22. package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
  23. package/lib/core/handlers/GraphQLHandler.js.map +1 -1
  24. package/lib/core/handlers/GraphQLHandler.mjs.map +1 -1
  25. package/lib/core/handlers/HttpHandler.d.mts +1 -1
  26. package/lib/core/handlers/HttpHandler.d.ts +1 -1
  27. package/lib/core/handlers/RequestHandler.d.mts +1 -1
  28. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  29. package/lib/core/http.d.mts +1 -1
  30. package/lib/core/http.d.ts +1 -1
  31. package/lib/core/index.d.mts +2 -2
  32. package/lib/core/index.d.ts +2 -2
  33. package/lib/core/passthrough.d.mts +1 -1
  34. package/lib/core/passthrough.d.ts +1 -1
  35. package/lib/core/typeUtils.d.mts +6 -1
  36. package/lib/core/typeUtils.d.ts +6 -1
  37. package/lib/core/typeUtils.js.map +1 -1
  38. package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
  39. package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
  40. package/lib/core/utils/executeHandlers.d.mts +1 -1
  41. package/lib/core/utils/executeHandlers.d.ts +1 -1
  42. package/lib/core/utils/handleRequest.d.mts +1 -1
  43. package/lib/core/utils/handleRequest.d.ts +1 -1
  44. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +2 -2
  45. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
  46. package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
  47. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  48. package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
  49. package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
  50. package/lib/iife/index.js +22 -19
  51. package/lib/iife/index.js.map +1 -1
  52. package/lib/mockServiceWorker.js +1 -1
  53. package/package.json +2 -2
  54. package/src/core/HttpResponse.ts +3 -2
  55. package/src/core/graphql.ts +6 -3
  56. package/src/core/handlers/GraphQLHandler.ts +7 -4
  57. package/src/core/typeUtils.ts +6 -0
@@ -370,7 +370,7 @@ You can also automate this process and make the worker script update automatical
370
370
  }
371
371
  }
372
372
 
373
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
373
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
374
374
  var encoder = new TextEncoder();
375
375
  function encodeBuffer(text) {
376
376
  return encoder.encode(text);
@@ -396,6 +396,9 @@ function isResponseWithoutBody(status) {
396
396
  return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
397
397
  }
398
398
 
399
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-HAGW22AN.mjs
400
+ var IS_PATCHED_MODULE = Symbol("isPatchedModule");
401
+
399
402
  // node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
400
403
  var __defProp = Object.defineProperty;
401
404
  var __export = (target, all) => {
@@ -833,8 +836,8 @@ var _Emitter = class {
833
836
  var Emitter = _Emitter;
834
837
  Emitter.defaultMaxListeners = 10;
835
838
 
836
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-WZQN3FMY.mjs
837
- var IS_PATCHED_MODULE = Symbol("isPatchedModule");
839
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-KHZ3VYHS.mjs
840
+ var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
838
841
  function getGlobalSymbol(symbol) {
839
842
  return (
840
843
  // @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
@@ -978,7 +981,7 @@ var Interceptor = class {
978
981
  }
979
982
  };
980
983
 
981
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/index.mjs
984
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/index.mjs
982
985
  var BatchInterceptor = class extends Interceptor {
983
986
  constructor(options) {
984
987
  BatchInterceptor.symbol = Symbol(options.name);
@@ -1262,14 +1265,7 @@ var DeferredPromise = class extends Promise {
1262
1265
  }
1263
1266
  };
1264
1267
 
1265
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-72HT65NX.mjs
1266
- function uuidv4() {
1267
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
1268
- const r = Math.random() * 16 | 0;
1269
- const v = c == "x" ? r : r & 3 | 8;
1270
- return v.toString(16);
1271
- });
1272
- }
1268
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
1273
1269
  var RequestController = class {
1274
1270
  constructor(request) {
1275
1271
  this.request = request;
@@ -1307,7 +1303,7 @@ async function emitAsync(emitter, eventName, ...data) {
1307
1303
  }
1308
1304
  }
1309
1305
 
1310
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-XQZ6GVNB.mjs
1306
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-5E3BR6QC.mjs
1311
1307
  function isPropertyAccessible(obj, key) {
1312
1308
  try {
1313
1309
  obj[key];
@@ -1331,7 +1327,7 @@ var _FetchInterceptor = class extends Interceptor {
1331
1327
  checkEnvironment() {
1332
1328
  return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
1333
1329
  }
1334
- setup() {
1330
+ async setup() {
1335
1331
  const pureFetch = globalThis.fetch;
1336
1332
  invariant(
1337
1333
  !pureFetch[IS_PATCHED_MODULE],
@@ -1339,7 +1335,7 @@ var _FetchInterceptor = class extends Interceptor {
1339
1335
  );
1340
1336
  globalThis.fetch = async (input, init) => {
1341
1337
  var _a;
1342
- const requestId = uuidv4();
1338
+ const requestId = crypto.randomUUID();
1343
1339
  const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
1344
1340
  const request = new Request(resolvedInput, init);
1345
1341
  this.logger.info("[%s] %s", request.method, request.url);
@@ -1454,7 +1450,7 @@ function createNetworkError(cause) {
1454
1450
  });
1455
1451
  }
1456
1452
 
1457
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-DZVB7JEV.mjs
1453
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-WVYFUFZR.mjs
1458
1454
  function concatArrayBuffer(left, right) {
1459
1455
  const result = new Uint8Array(left.byteLength + right.byteLength);
1460
1456
  result.set(left, 0);
@@ -1648,7 +1644,7 @@ var XMLHttpRequestController = class {
1648
1644
  this.method = "GET";
1649
1645
  this.url = null;
1650
1646
  this.events = /* @__PURE__ */ new Map();
1651
- this.requestId = uuidv4();
1647
+ this.requestId = crypto.randomUUID();
1652
1648
  this.requestHeaders = new Headers();
1653
1649
  this.responseBuffer = new Uint8Array();
1654
1650
  this.request = createProxy(initialRequest, {
@@ -1730,7 +1726,10 @@ var XMLHttpRequestController = class {
1730
1726
  this.request.readyState
1731
1727
  );
1732
1728
  if (IS_NODE2) {
1733
- this.request.setRequestHeader("X-Request-Id", this.requestId);
1729
+ this.request.setRequestHeader(
1730
+ INTERNAL_REQUEST_ID_HEADER_NAME,
1731
+ this.requestId
1732
+ );
1734
1733
  }
1735
1734
  return invoke();
1736
1735
  }
@@ -2053,7 +2052,11 @@ function createXMLHttpRequestProxy({
2053
2052
  const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {
2054
2053
  construct(target, args, newTarget) {
2055
2054
  logger.info("constructed new XMLHttpRequest");
2056
- const originalRequest = Reflect.construct(target, args, newTarget);
2055
+ const originalRequest = Reflect.construct(
2056
+ target,
2057
+ args,
2058
+ newTarget
2059
+ );
2057
2060
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(
2058
2061
  target.prototype
2059
2062
  );