msw 2.12.2 → 2.12.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.
Files changed (64) hide show
  1. package/lib/core/{HttpResponse-BpT5A_2L.d.ts → HttpResponse-DC89RDb7.d.ts} +1 -1
  2. package/lib/core/{HttpResponse-DGUjNQHG.d.mts → HttpResponse-U6SfxBlj.d.mts} +1 -1
  3. package/lib/core/HttpResponse.d.mts +1 -1
  4. package/lib/core/HttpResponse.d.ts +1 -1
  5. package/lib/core/SetupApi.d.mts +1 -1
  6. package/lib/core/SetupApi.d.ts +1 -1
  7. package/lib/core/getResponse.d.mts +1 -1
  8. package/lib/core/getResponse.d.ts +1 -1
  9. package/lib/core/graphql.d.mts +1 -1
  10. package/lib/core/graphql.d.ts +1 -1
  11. package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
  12. package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
  13. package/lib/core/handlers/HttpHandler.d.mts +2 -2
  14. package/lib/core/handlers/HttpHandler.d.ts +2 -2
  15. package/lib/core/handlers/HttpHandler.js.map +1 -1
  16. package/lib/core/handlers/HttpHandler.mjs.map +1 -1
  17. package/lib/core/handlers/RequestHandler.d.mts +1 -1
  18. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  19. package/lib/core/http.d.mts +1 -1
  20. package/lib/core/http.d.ts +1 -1
  21. package/lib/core/index.d.mts +2 -2
  22. package/lib/core/index.d.ts +2 -2
  23. package/lib/core/index.js.map +1 -1
  24. package/lib/core/index.mjs.map +1 -1
  25. package/lib/core/passthrough.d.mts +1 -1
  26. package/lib/core/passthrough.d.ts +1 -1
  27. package/lib/core/sse.d.mts +1 -1
  28. package/lib/core/sse.d.ts +1 -1
  29. package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
  30. package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
  31. package/lib/core/utils/cookieStore.js +2 -2
  32. package/lib/core/utils/cookieStore.js.map +1 -1
  33. package/lib/core/utils/cookieStore.mjs +2 -2
  34. package/lib/core/utils/cookieStore.mjs.map +1 -1
  35. package/lib/core/utils/executeHandlers.d.mts +1 -1
  36. package/lib/core/utils/executeHandlers.d.ts +1 -1
  37. package/lib/core/utils/handleRequest.d.mts +1 -1
  38. package/lib/core/utils/handleRequest.d.ts +1 -1
  39. package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
  40. package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
  41. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
  42. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
  43. package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
  44. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  45. package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
  46. package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
  47. package/lib/core/utils/request/toPublicUrl.js +4 -4
  48. package/lib/core/utils/request/toPublicUrl.js.map +1 -1
  49. package/lib/core/utils/request/toPublicUrl.mjs +4 -4
  50. package/lib/core/utils/request/toPublicUrl.mjs.map +1 -1
  51. package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
  52. package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
  53. package/lib/iife/index.js +987 -339
  54. package/lib/iife/index.js.map +1 -1
  55. package/lib/mockServiceWorker.js +1 -1
  56. package/lib/node/index.mjs +1 -1
  57. package/package.json +34 -37
  58. package/src/core/handlers/HttpHandler.ts +1 -1
  59. package/src/core/index.ts +5 -0
  60. package/src/core/utils/cookieStore.ts +8 -2
  61. package/src/core/utils/request/onUnhandledRequest.node.test.ts +62 -0
  62. package/src/core/utils/request/toPublicUrl.node.test.ts +17 -0
  63. package/src/core/utils/request/toPublicUrl.test.ts +1 -3
  64. package/src/core/utils/request/toPublicUrl.ts +8 -7
@@ -313,4 +313,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
313
313
  static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
314
314
  }
315
315
 
316
- export { type AsyncResponseResolverReturnType as A, type GraphQLHandlerInfo as B, type GraphQLRequestParsedResult as C, type DefaultBodyType as D, type GraphQLCustomPredicateResult as E, type GraphQLPredicate as F, GraphQLHandler as G, type HttpResponseInit as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerInternalInfo as K, type ResponseResolverInfo as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerArgs as N, type RequestHandlerExecutionResult as O, type ParsedGraphQLRequest as P, RequestHandler as R, type StrictRequest as S, type ResponseResolver as a, type ResponseResolverReturnType as b, type RequestHandlerOptions as c, type DefaultRequestMultipartBody as d, type GraphQLQuery as e, type GraphQLVariables as f, type GraphQLRequestBody as g, type GraphQLResponseBody as h, type GraphQLJsonRequestBody as i, type GraphQLOperationType as j, type GraphQLCustomPredicate as k, bodyType as l, type DefaultUnsafeFetchResponse as m, type StrictResponse as n, HttpResponse as o, type ResponseResolutionContext as p, type GraphQLHandlerNameSelector as q, type GraphQLResolverExtras as r, type RequestHandlerDefaultInfo as s, type HandlersExecutionResult as t, executeHandlers as u, type ParsedGraphQLQuery as v, parseDocumentNode as w, type GraphQLParsedOperationsMap as x, type GraphQLMultipartRequestBody as y, parseGraphQLRequest as z };
316
+ export { type AsyncResponseResolverReturnType as A, parseGraphQLRequest as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLRequestParsedResult as E, type GraphQLCustomPredicateResult as F, GraphQLHandler as G, type HttpResponseInit as H, type GraphQLPredicate as I, type JsonBodyType as J, isDocumentNode as K, type RequestHandlerInternalInfo as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerArgs as N, type RequestHandlerExecutionResult as O, type ParsedGraphQLRequest as P, RequestHandler as R, type StrictRequest as S, type ResponseResolver as a, type ResponseResolverReturnType as b, type RequestHandlerOptions as c, type DefaultRequestMultipartBody as d, type ResponseResolverInfo as e, type GraphQLQuery as f, type GraphQLVariables as g, type GraphQLRequestBody as h, type GraphQLResponseBody as i, type GraphQLJsonRequestBody as j, type GraphQLOperationType as k, type GraphQLCustomPredicate as l, type ResponseResolutionContext as m, bodyType as n, type DefaultUnsafeFetchResponse as o, type StrictResponse as p, HttpResponse as q, type GraphQLHandlerNameSelector as r, type GraphQLResolverExtras as s, type RequestHandlerDefaultInfo as t, type HandlersExecutionResult as u, executeHandlers as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, type GraphQLParsedOperationsMap as y, type GraphQLMultipartRequestBody as z };
@@ -313,4 +313,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
313
313
  static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
314
314
  }
315
315
 
316
- export { type AsyncResponseResolverReturnType as A, type GraphQLHandlerInfo as B, type GraphQLRequestParsedResult as C, type DefaultBodyType as D, type GraphQLCustomPredicateResult as E, type GraphQLPredicate as F, GraphQLHandler as G, type HttpResponseInit as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerInternalInfo as K, type ResponseResolverInfo as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerArgs as N, type RequestHandlerExecutionResult as O, type ParsedGraphQLRequest as P, RequestHandler as R, type StrictRequest as S, type ResponseResolver as a, type ResponseResolverReturnType as b, type RequestHandlerOptions as c, type DefaultRequestMultipartBody as d, type GraphQLQuery as e, type GraphQLVariables as f, type GraphQLRequestBody as g, type GraphQLResponseBody as h, type GraphQLJsonRequestBody as i, type GraphQLOperationType as j, type GraphQLCustomPredicate as k, bodyType as l, type DefaultUnsafeFetchResponse as m, type StrictResponse as n, HttpResponse as o, type ResponseResolutionContext as p, type GraphQLHandlerNameSelector as q, type GraphQLResolverExtras as r, type RequestHandlerDefaultInfo as s, type HandlersExecutionResult as t, executeHandlers as u, type ParsedGraphQLQuery as v, parseDocumentNode as w, type GraphQLParsedOperationsMap as x, type GraphQLMultipartRequestBody as y, parseGraphQLRequest as z };
316
+ export { type AsyncResponseResolverReturnType as A, parseGraphQLRequest as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLRequestParsedResult as E, type GraphQLCustomPredicateResult as F, GraphQLHandler as G, type HttpResponseInit as H, type GraphQLPredicate as I, type JsonBodyType as J, isDocumentNode as K, type RequestHandlerInternalInfo as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerArgs as N, type RequestHandlerExecutionResult as O, type ParsedGraphQLRequest as P, RequestHandler as R, type StrictRequest as S, type ResponseResolver as a, type ResponseResolverReturnType as b, type RequestHandlerOptions as c, type DefaultRequestMultipartBody as d, type ResponseResolverInfo as e, type GraphQLQuery as f, type GraphQLVariables as g, type GraphQLRequestBody as h, type GraphQLResponseBody as i, type GraphQLJsonRequestBody as j, type GraphQLOperationType as k, type GraphQLCustomPredicate as l, type ResponseResolutionContext as m, bodyType as n, type DefaultUnsafeFetchResponse as o, type StrictResponse as p, HttpResponse as q, type GraphQLHandlerNameSelector as r, type GraphQLResolverExtras as s, type RequestHandlerDefaultInfo as t, type HandlersExecutionResult as u, executeHandlers as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, type GraphQLParsedOperationsMap as y, type GraphQLMultipartRequestBody as z };
@@ -1,5 +1,5 @@
1
1
  import '@mswjs/interceptors';
2
- export { m as DefaultUnsafeFetchResponse, o as HttpResponse, H as HttpResponseInit, S as StrictRequest, n as StrictResponse, l as bodyType } from './HttpResponse-DGUjNQHG.mjs';
2
+ export { o as DefaultUnsafeFetchResponse, q as HttpResponse, H as HttpResponseInit, S as StrictRequest, p as StrictResponse, n as bodyType } from './HttpResponse-U6SfxBlj.mjs';
3
3
  import './typeUtils.mjs';
4
4
  import './utils/internal/isIterable.mjs';
5
5
  import 'graphql';
@@ -1,5 +1,5 @@
1
1
  import '@mswjs/interceptors';
2
- export { m as DefaultUnsafeFetchResponse, o as HttpResponse, H as HttpResponseInit, S as StrictRequest, n as StrictResponse, l as bodyType } from './HttpResponse-BpT5A_2L.js';
2
+ export { o as DefaultUnsafeFetchResponse, q as HttpResponse, H as HttpResponseInit, S as StrictRequest, p as StrictResponse, n as bodyType } from './HttpResponse-DC89RDb7.js';
3
3
  import './typeUtils.js';
4
4
  import './utils/internal/isIterable.js';
5
5
  import 'graphql';
@@ -1,5 +1,5 @@
1
1
  import { EventMap, Emitter } from 'strict-event-emitter';
2
- import { R as RequestHandler } from './HttpResponse-DGUjNQHG.mjs';
2
+ import { R as RequestHandler } from './HttpResponse-U6SfxBlj.mjs';
3
3
  import { LifeCycleEventEmitter } from './sharedOptions.mjs';
4
4
  import { Disposable } from './utils/internal/Disposable.mjs';
5
5
  import { WebSocketHandler } from './handlers/WebSocketHandler.mjs';
@@ -1,5 +1,5 @@
1
1
  import { EventMap, Emitter } from 'strict-event-emitter';
2
- import { R as RequestHandler } from './HttpResponse-BpT5A_2L.js';
2
+ import { R as RequestHandler } from './HttpResponse-DC89RDb7.js';
3
3
  import { LifeCycleEventEmitter } from './sharedOptions.js';
4
4
  import { Disposable } from './utils/internal/Disposable.js';
5
5
  import { WebSocketHandler } from './handlers/WebSocketHandler.js';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, p as ResponseResolutionContext } from './HttpResponse-DGUjNQHG.mjs';
1
+ import { R as RequestHandler, m as ResponseResolutionContext } from './HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import './utils/internal/isIterable.mjs';
4
4
  import './typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, p as ResponseResolutionContext } from './HttpResponse-BpT5A_2L.js';
1
+ import { R as RequestHandler, m as ResponseResolutionContext } from './HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './utils/internal/isIterable.js';
4
4
  import './typeUtils.js';
@@ -1,5 +1,5 @@
1
1
  import { DocumentNode } from 'graphql';
2
- import { e as GraphQLQuery, f as GraphQLVariables, q as GraphQLHandlerNameSelector, k as GraphQLCustomPredicate, a as ResponseResolver, r as GraphQLResolverExtras, h as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-DGUjNQHG.mjs';
2
+ import { f as GraphQLQuery, g as GraphQLVariables, r as GraphQLHandlerNameSelector, l as GraphQLCustomPredicate, a as ResponseResolver, s as GraphQLResolverExtras, i as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-U6SfxBlj.mjs';
3
3
  import { Path } from './utils/matching/matchRequestUrl.mjs';
4
4
  import '@mswjs/interceptors';
5
5
  import './utils/internal/isIterable.mjs';
@@ -1,5 +1,5 @@
1
1
  import { DocumentNode } from 'graphql';
2
- import { e as GraphQLQuery, f as GraphQLVariables, q as GraphQLHandlerNameSelector, k as GraphQLCustomPredicate, a as ResponseResolver, r as GraphQLResolverExtras, h as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-BpT5A_2L.js';
2
+ import { f as GraphQLQuery, g as GraphQLVariables, r as GraphQLHandlerNameSelector, l as GraphQLCustomPredicate, a as ResponseResolver, s as GraphQLResolverExtras, i as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-DC89RDb7.js';
3
3
  import { Path } from './utils/matching/matchRequestUrl.js';
4
4
  import '@mswjs/interceptors';
5
5
  import './utils/internal/isIterable.js';
@@ -1,5 +1,5 @@
1
1
  import 'graphql';
2
- export { k as GraphQLCustomPredicate, E as GraphQLCustomPredicateResult, G as GraphQLHandler, B as GraphQLHandlerInfo, q as GraphQLHandlerNameSelector, i as GraphQLJsonRequestBody, j as GraphQLOperationType, F as GraphQLPredicate, e as GraphQLQuery, g as GraphQLRequestBody, C as GraphQLRequestParsedResult, r as GraphQLResolverExtras, h as GraphQLResponseBody, f as GraphQLVariables, I as isDocumentNode } from '../HttpResponse-DGUjNQHG.mjs';
2
+ export { l as GraphQLCustomPredicate, F as GraphQLCustomPredicateResult, G as GraphQLHandler, C as GraphQLHandlerInfo, r as GraphQLHandlerNameSelector, j as GraphQLJsonRequestBody, k as GraphQLOperationType, I as GraphQLPredicate, f as GraphQLQuery, h as GraphQLRequestBody, E as GraphQLRequestParsedResult, s as GraphQLResolverExtras, i as GraphQLResponseBody, g as GraphQLVariables, K as isDocumentNode } from '../HttpResponse-U6SfxBlj.mjs';
3
3
  import '../utils/matching/matchRequestUrl.mjs';
4
4
  import '@mswjs/interceptors';
5
5
  import '../utils/internal/isIterable.mjs';
@@ -1,5 +1,5 @@
1
1
  import 'graphql';
2
- export { k as GraphQLCustomPredicate, E as GraphQLCustomPredicateResult, G as GraphQLHandler, B as GraphQLHandlerInfo, q as GraphQLHandlerNameSelector, i as GraphQLJsonRequestBody, j as GraphQLOperationType, F as GraphQLPredicate, e as GraphQLQuery, g as GraphQLRequestBody, C as GraphQLRequestParsedResult, r as GraphQLResolverExtras, h as GraphQLResponseBody, f as GraphQLVariables, I as isDocumentNode } from '../HttpResponse-BpT5A_2L.js';
2
+ export { l as GraphQLCustomPredicate, F as GraphQLCustomPredicateResult, G as GraphQLHandler, C as GraphQLHandlerInfo, r as GraphQLHandlerNameSelector, j as GraphQLJsonRequestBody, k as GraphQLOperationType, I as GraphQLPredicate, f as GraphQLQuery, h as GraphQLRequestBody, E as GraphQLRequestParsedResult, s as GraphQLResolverExtras, i as GraphQLResponseBody, g as GraphQLVariables, K as isDocumentNode } from '../HttpResponse-DC89RDb7.js';
3
3
  import '../utils/matching/matchRequestUrl.js';
4
4
  import '@mswjs/interceptors';
5
5
  import '../utils/internal/isIterable.js';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, s as RequestHandlerDefaultInfo, a as ResponseResolver, c as RequestHandlerOptions, p as ResponseResolutionContext } from '../HttpResponse-DGUjNQHG.mjs';
1
+ import { R as RequestHandler, t as RequestHandlerDefaultInfo, a as ResponseResolver, c as RequestHandlerOptions, m as ResponseResolutionContext } from '../HttpResponse-U6SfxBlj.mjs';
2
2
  import { PathParams, Path, Match } from '../utils/matching/matchRequestUrl.mjs';
3
3
  import '@mswjs/interceptors';
4
4
  import '../utils/internal/isIterable.mjs';
@@ -72,4 +72,4 @@ declare class HttpHandler extends RequestHandler<HttpHandlerInfo, HttpRequestPar
72
72
  }): Promise<void>;
73
73
  }
74
74
 
75
- export { type HttpCustomPredicate, type HttpCustomPredicateResult, HttpHandler, type HttpHandlerInfo, HttpMethods, type HttpRequestParsedResult, type HttpRequestPredicate, type HttpRequestResolverExtras, type RequestQuery };
75
+ export { type HttpCustomPredicate, type HttpCustomPredicateResult, HttpHandler, type HttpHandlerInfo, type HttpHandlerMethod, HttpMethods, type HttpRequestParsedResult, type HttpRequestPredicate, type HttpRequestResolverExtras, type RequestQuery };
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, s as RequestHandlerDefaultInfo, a as ResponseResolver, c as RequestHandlerOptions, p as ResponseResolutionContext } from '../HttpResponse-BpT5A_2L.js';
1
+ import { R as RequestHandler, t as RequestHandlerDefaultInfo, a as ResponseResolver, c as RequestHandlerOptions, m as ResponseResolutionContext } from '../HttpResponse-DC89RDb7.js';
2
2
  import { PathParams, Path, Match } from '../utils/matching/matchRequestUrl.js';
3
3
  import '@mswjs/interceptors';
4
4
  import '../utils/internal/isIterable.js';
@@ -72,4 +72,4 @@ declare class HttpHandler extends RequestHandler<HttpHandlerInfo, HttpRequestPar
72
72
  }): Promise<void>;
73
73
  }
74
74
 
75
- export { type HttpCustomPredicate, type HttpCustomPredicateResult, HttpHandler, type HttpHandlerInfo, HttpMethods, type HttpRequestParsedResult, type HttpRequestPredicate, type HttpRequestResolverExtras, type RequestQuery };
75
+ export { type HttpCustomPredicate, type HttpCustomPredicateResult, HttpHandler, type HttpHandlerInfo, type HttpHandlerMethod, HttpMethods, type HttpRequestParsedResult, type HttpRequestPredicate, type HttpRequestResolverExtras, type RequestQuery };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/handlers/HttpHandler.ts"],"sourcesContent":["import { ResponseResolutionContext } from '../utils/executeHandlers'\nimport { devUtils } from '../utils/internal/devUtils'\nimport { isStringEqual } from '../utils/internal/isStringEqual'\nimport { getStatusCodeColor } from '../utils/logging/getStatusCodeColor'\nimport { getTimestamp } from '../utils/logging/getTimestamp'\nimport { serializeRequest } from '../utils/logging/serializeRequest'\nimport { serializeResponse } from '../utils/logging/serializeResponse'\nimport {\n matchRequestUrl,\n Match,\n Path,\n PathParams,\n} from '../utils/matching/matchRequestUrl'\nimport { toPublicUrl } from '../utils/request/toPublicUrl'\nimport { getAllRequestCookies } from '../utils/request/getRequestCookies'\nimport { cleanUrl } from '../utils/url/cleanUrl'\nimport {\n RequestHandler,\n RequestHandlerDefaultInfo,\n RequestHandlerOptions,\n ResponseResolver,\n} from './RequestHandler'\n\ntype HttpHandlerMethod = string | RegExp\n\nexport interface HttpHandlerInfo extends RequestHandlerDefaultInfo {\n method: HttpHandlerMethod\n path: HttpRequestPredicate<PathParams>\n}\n\nexport enum HttpMethods {\n HEAD = 'HEAD',\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n PATCH = 'PATCH',\n OPTIONS = 'OPTIONS',\n DELETE = 'DELETE',\n}\n\nexport type RequestQuery = {\n [queryName: string]: string\n}\n\nexport type HttpRequestParsedResult = {\n match: Match\n cookies: Record<string, string>\n}\n\nexport type HttpRequestResolverExtras<Params extends PathParams> = {\n params: Params\n cookies: Record<string, string>\n}\n\nexport type HttpCustomPredicate<Params extends PathParams> = (args: {\n request: Request\n cookies: Record<string, string>\n}) =>\n | HttpCustomPredicateResult<Params>\n | Promise<HttpCustomPredicateResult<Params>>\n\nexport type HttpCustomPredicateResult<Params extends PathParams> =\n | boolean\n | {\n matches: boolean\n params: Params\n }\n\nexport type HttpRequestPredicate<Params extends PathParams> =\n | Path\n | HttpCustomPredicate<Params>\n\n/**\n * Request handler for HTTP requests.\n * Provides request matching based on method and URL.\n */\nexport class HttpHandler extends RequestHandler<\n HttpHandlerInfo,\n HttpRequestParsedResult,\n HttpRequestResolverExtras<any>\n> {\n constructor(\n method: HttpHandlerMethod,\n predicate: HttpRequestPredicate<PathParams>,\n resolver: ResponseResolver<HttpRequestResolverExtras<any>, any, any>,\n options?: RequestHandlerOptions,\n ) {\n const displayPath =\n typeof predicate === 'function' ? '[custom predicate]' : predicate\n\n super({\n info: {\n header: `${method}${displayPath ? ` ${displayPath}` : ''}`,\n path: predicate,\n method,\n },\n resolver,\n options,\n })\n\n this.checkRedundantQueryParameters()\n }\n\n private checkRedundantQueryParameters() {\n const { method, path } = this.info\n\n if (!path || path instanceof RegExp || typeof path === 'function') {\n return\n }\n\n const url = cleanUrl(path)\n\n // Bypass request handler URLs that have no redundant characters.\n if (url === path) {\n return\n }\n\n devUtils.warn(\n `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 using \"new URL(request.url).searchParams\" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`,\n )\n }\n\n async parse(args: {\n request: Request\n resolutionContext?: ResponseResolutionContext\n }) {\n const url = new URL(args.request.url)\n const cookies = getAllRequestCookies(args.request)\n\n /**\n * Handle custom predicate functions.\n * @note Invoke this during parsing so the user can parse the path parameters\n * manually. Otherwise, `params` is always an empty object, which isn't nice.\n */\n if (typeof this.info.path === 'function') {\n const customPredicateResult = await this.info.path({\n request: args.request,\n cookies,\n })\n\n const match =\n typeof customPredicateResult === 'boolean'\n ? {\n matches: customPredicateResult,\n params: {},\n }\n : customPredicateResult\n\n return {\n match,\n cookies,\n }\n }\n\n const match = this.info.path\n ? matchRequestUrl(url, this.info.path, args.resolutionContext?.baseUrl)\n : { matches: false, params: {} }\n\n return {\n match,\n cookies,\n }\n }\n\n async predicate(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n resolutionContext?: ResponseResolutionContext\n }) {\n const hasMatchingMethod = this.matchMethod(args.request.method)\n const hasMatchingUrl = args.parsedResult.match.matches\n return hasMatchingMethod && hasMatchingUrl\n }\n\n private matchMethod(actualMethod: string): boolean {\n return this.info.method instanceof RegExp\n ? this.info.method.test(actualMethod)\n : isStringEqual(this.info.method, actualMethod)\n }\n\n protected extendResolverArgs(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n }) {\n return {\n params: args.parsedResult.match?.params || {},\n cookies: args.parsedResult.cookies,\n }\n }\n\n async log(args: { request: Request; response: Response }) {\n const publicUrl = toPublicUrl(args.request.url)\n const loggedRequest = await serializeRequest(args.request)\n const loggedResponse = await serializeResponse(args.response)\n const statusColor = getStatusCodeColor(loggedResponse.status)\n\n console.groupCollapsed(\n devUtils.formatMessage(\n `${getTimestamp()} ${args.request.method} ${publicUrl} (%c${\n loggedResponse.status\n } ${loggedResponse.statusText}%c)`,\n ),\n `color:${statusColor}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log('Request', loggedRequest)\n // eslint-disable-next-line no-console\n console.log('Handler:', this)\n // eslint-disable-next-line no-console\n console.log('Response', loggedResponse)\n console.groupEnd()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyB;AACzB,2BAA8B;AAC9B,gCAAmC;AACnC,0BAA6B;AAC7B,8BAAiC;AACjC,+BAAkC;AAClC,6BAKO;AACP,yBAA4B;AAC5B,+BAAqC;AACrC,sBAAyB;AACzB,4BAKO;AASA,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,WAAQ;AACR,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AAPC,SAAAA;AAAA,GAAA;AA8CL,MAAM,oBAAoB,qCAI/B;AAAA,EACA,YACE,QACA,WACA,UACA,SACA;AACA,UAAM,cACJ,OAAO,cAAc,aAAa,uBAAuB;AAE3D,UAAM;AAAA,MACJ,MAAM;AAAA,QACJ,QAAQ,GAAG,MAAM,GAAG,cAAc,IAAI,WAAW,KAAK,EAAE;AAAA,QACxD,MAAM;AAAA,QACN;AAAA,MACF;AAAA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AAK,QAAQ,YAAY;AAAA,EAClD;AAAA,EAEU,mBAAmB,MAG1B;AACD,WAAO;AAAA,MACL,QAAQ,KAAK,aAAa,OAAO,UAAU,CAAC;AAAA,MAC5C,SAAS,KAAK,aAAa;AAAA,IAC7B;AAAA,EACF;AAAA,EAEA,MAAM,IAAI,MAAgD;AACxD,UAAM,gBAAY,gCAAY,KAAK,QAAQ,GAAG;AAC9C,UAAM,gBAAgB,UAAM,0CAAiB,KAAK,OAAO;AACzD,UAAM,iBAAiB,UAAM,4CAAkB,KAAK,QAAQ;AAC5D,UAAM,kBAAc,8CAAmB,eAAe,MAAM;AAE5D,YAAQ;AAAA,MACN,yBAAS;AAAA,QACP,OAAG,kCAAa,CAAC,IAAI,KAAK,QAAQ,MAAM,IAAI,SAAS,OACnD,eAAe,MACjB,IAAI,eAAe,UAAU;AAAA,MAC/B;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,IACF;AAEA,YAAQ,IAAI,WAAW,aAAa;AAEpC,YAAQ,IAAI,YAAY,IAAI;AAE5B,YAAQ,IAAI,YAAY,cAAc;AACtC,YAAQ,SAAS;AAAA,EACnB;AACF;","names":["HttpMethods","match"]}
1
+ {"version":3,"sources":["../../../src/core/handlers/HttpHandler.ts"],"sourcesContent":["import { ResponseResolutionContext } from '../utils/executeHandlers'\nimport { devUtils } from '../utils/internal/devUtils'\nimport { isStringEqual } from '../utils/internal/isStringEqual'\nimport { getStatusCodeColor } from '../utils/logging/getStatusCodeColor'\nimport { getTimestamp } from '../utils/logging/getTimestamp'\nimport { serializeRequest } from '../utils/logging/serializeRequest'\nimport { serializeResponse } from '../utils/logging/serializeResponse'\nimport {\n matchRequestUrl,\n Match,\n Path,\n PathParams,\n} from '../utils/matching/matchRequestUrl'\nimport { toPublicUrl } from '../utils/request/toPublicUrl'\nimport { getAllRequestCookies } from '../utils/request/getRequestCookies'\nimport { cleanUrl } from '../utils/url/cleanUrl'\nimport {\n RequestHandler,\n RequestHandlerDefaultInfo,\n RequestHandlerOptions,\n ResponseResolver,\n} from './RequestHandler'\n\nexport type HttpHandlerMethod = string | RegExp\n\nexport interface HttpHandlerInfo extends RequestHandlerDefaultInfo {\n method: HttpHandlerMethod\n path: HttpRequestPredicate<PathParams>\n}\n\nexport enum HttpMethods {\n HEAD = 'HEAD',\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n PATCH = 'PATCH',\n OPTIONS = 'OPTIONS',\n DELETE = 'DELETE',\n}\n\nexport type RequestQuery = {\n [queryName: string]: string\n}\n\nexport type HttpRequestParsedResult = {\n match: Match\n cookies: Record<string, string>\n}\n\nexport type HttpRequestResolverExtras<Params extends PathParams> = {\n params: Params\n cookies: Record<string, string>\n}\n\nexport type HttpCustomPredicate<Params extends PathParams> = (args: {\n request: Request\n cookies: Record<string, string>\n}) =>\n | HttpCustomPredicateResult<Params>\n | Promise<HttpCustomPredicateResult<Params>>\n\nexport type HttpCustomPredicateResult<Params extends PathParams> =\n | boolean\n | {\n matches: boolean\n params: Params\n }\n\nexport type HttpRequestPredicate<Params extends PathParams> =\n | Path\n | HttpCustomPredicate<Params>\n\n/**\n * Request handler for HTTP requests.\n * Provides request matching based on method and URL.\n */\nexport class HttpHandler extends RequestHandler<\n HttpHandlerInfo,\n HttpRequestParsedResult,\n HttpRequestResolverExtras<any>\n> {\n constructor(\n method: HttpHandlerMethod,\n predicate: HttpRequestPredicate<PathParams>,\n resolver: ResponseResolver<HttpRequestResolverExtras<any>, any, any>,\n options?: RequestHandlerOptions,\n ) {\n const displayPath =\n typeof predicate === 'function' ? '[custom predicate]' : predicate\n\n super({\n info: {\n header: `${method}${displayPath ? ` ${displayPath}` : ''}`,\n path: predicate,\n method,\n },\n resolver,\n options,\n })\n\n this.checkRedundantQueryParameters()\n }\n\n private checkRedundantQueryParameters() {\n const { method, path } = this.info\n\n if (!path || path instanceof RegExp || typeof path === 'function') {\n return\n }\n\n const url = cleanUrl(path)\n\n // Bypass request handler URLs that have no redundant characters.\n if (url === path) {\n return\n }\n\n devUtils.warn(\n `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 using \"new URL(request.url).searchParams\" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`,\n )\n }\n\n async parse(args: {\n request: Request\n resolutionContext?: ResponseResolutionContext\n }) {\n const url = new URL(args.request.url)\n const cookies = getAllRequestCookies(args.request)\n\n /**\n * Handle custom predicate functions.\n * @note Invoke this during parsing so the user can parse the path parameters\n * manually. Otherwise, `params` is always an empty object, which isn't nice.\n */\n if (typeof this.info.path === 'function') {\n const customPredicateResult = await this.info.path({\n request: args.request,\n cookies,\n })\n\n const match =\n typeof customPredicateResult === 'boolean'\n ? {\n matches: customPredicateResult,\n params: {},\n }\n : customPredicateResult\n\n return {\n match,\n cookies,\n }\n }\n\n const match = this.info.path\n ? matchRequestUrl(url, this.info.path, args.resolutionContext?.baseUrl)\n : { matches: false, params: {} }\n\n return {\n match,\n cookies,\n }\n }\n\n async predicate(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n resolutionContext?: ResponseResolutionContext\n }) {\n const hasMatchingMethod = this.matchMethod(args.request.method)\n const hasMatchingUrl = args.parsedResult.match.matches\n return hasMatchingMethod && hasMatchingUrl\n }\n\n private matchMethod(actualMethod: string): boolean {\n return this.info.method instanceof RegExp\n ? this.info.method.test(actualMethod)\n : isStringEqual(this.info.method, actualMethod)\n }\n\n protected extendResolverArgs(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n }) {\n return {\n params: args.parsedResult.match?.params || {},\n cookies: args.parsedResult.cookies,\n }\n }\n\n async log(args: { request: Request; response: Response }) {\n const publicUrl = toPublicUrl(args.request.url)\n const loggedRequest = await serializeRequest(args.request)\n const loggedResponse = await serializeResponse(args.response)\n const statusColor = getStatusCodeColor(loggedResponse.status)\n\n console.groupCollapsed(\n devUtils.formatMessage(\n `${getTimestamp()} ${args.request.method} ${publicUrl} (%c${\n loggedResponse.status\n } ${loggedResponse.statusText}%c)`,\n ),\n `color:${statusColor}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log('Request', loggedRequest)\n // eslint-disable-next-line no-console\n console.log('Handler:', this)\n // eslint-disable-next-line no-console\n console.log('Response', loggedResponse)\n console.groupEnd()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyB;AACzB,2BAA8B;AAC9B,gCAAmC;AACnC,0BAA6B;AAC7B,8BAAiC;AACjC,+BAAkC;AAClC,6BAKO;AACP,yBAA4B;AAC5B,+BAAqC;AACrC,sBAAyB;AACzB,4BAKO;AASA,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,WAAQ;AACR,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AAPC,SAAAA;AAAA,GAAA;AA8CL,MAAM,oBAAoB,qCAI/B;AAAA,EACA,YACE,QACA,WACA,UACA,SACA;AACA,UAAM,cACJ,OAAO,cAAc,aAAa,uBAAuB;AAE3D,UAAM;AAAA,MACJ,MAAM;AAAA,QACJ,QAAQ,GAAG,MAAM,GAAG,cAAc,IAAI,WAAW,KAAK,EAAE;AAAA,QACxD,MAAM;AAAA,QACN;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,SAAK,8BAA8B;AAAA,EACrC;AAAA,EAEQ,gCAAgC;AACtC,UAAM,EAAE,QAAQ,KAAK,IAAI,KAAK;AAE9B,QAAI,CAAC,QAAQ,gBAAgB,UAAU,OAAO,SAAS,YAAY;AACjE;AAAA,IACF;AAEA,UAAM,UAAM,0BAAS,IAAI;AAGzB,QAAI,QAAQ,MAAM;AAChB;AAAA,IACF;AAEA,6BAAS;AAAA,MACP,+EAA+E,MAAM,IAAI,IAAI;AAAA,IAC/F;AAAA,EACF;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AM,kBAAc,8CAAmB,eAAe,MAAM;AAE5D,YAAQ;AAAA,MACN,yBAAS;AAAA,QACP,OAAG,kCAAa,CAAC,IAAI,KAAK,QAAQ,MAAM,IAAI,SAAS,OACnD,eAAe,MACjB,IAAI,eAAe,UAAU;AAAA,MAC/B;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,IACF;AAEA,YAAQ,IAAI,WAAW,aAAa;AAEpC,YAAQ,IAAI,YAAY,IAAI;AAE5B,YAAQ,IAAI,YAAY,cAAc;AACtC,YAAQ,SAAS;AAAA,EACnB;AACF;","names":["HttpMethods","match"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/handlers/HttpHandler.ts"],"sourcesContent":["import { ResponseResolutionContext } from '../utils/executeHandlers'\nimport { devUtils } from '../utils/internal/devUtils'\nimport { isStringEqual } from '../utils/internal/isStringEqual'\nimport { getStatusCodeColor } from '../utils/logging/getStatusCodeColor'\nimport { getTimestamp } from '../utils/logging/getTimestamp'\nimport { serializeRequest } from '../utils/logging/serializeRequest'\nimport { serializeResponse } from '../utils/logging/serializeResponse'\nimport {\n matchRequestUrl,\n Match,\n Path,\n PathParams,\n} from '../utils/matching/matchRequestUrl'\nimport { toPublicUrl } from '../utils/request/toPublicUrl'\nimport { getAllRequestCookies } from '../utils/request/getRequestCookies'\nimport { cleanUrl } from '../utils/url/cleanUrl'\nimport {\n RequestHandler,\n RequestHandlerDefaultInfo,\n RequestHandlerOptions,\n ResponseResolver,\n} from './RequestHandler'\n\ntype HttpHandlerMethod = string | RegExp\n\nexport interface HttpHandlerInfo extends RequestHandlerDefaultInfo {\n method: HttpHandlerMethod\n path: HttpRequestPredicate<PathParams>\n}\n\nexport enum HttpMethods {\n HEAD = 'HEAD',\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n PATCH = 'PATCH',\n OPTIONS = 'OPTIONS',\n DELETE = 'DELETE',\n}\n\nexport type RequestQuery = {\n [queryName: string]: string\n}\n\nexport type HttpRequestParsedResult = {\n match: Match\n cookies: Record<string, string>\n}\n\nexport type HttpRequestResolverExtras<Params extends PathParams> = {\n params: Params\n cookies: Record<string, string>\n}\n\nexport type HttpCustomPredicate<Params extends PathParams> = (args: {\n request: Request\n cookies: Record<string, string>\n}) =>\n | HttpCustomPredicateResult<Params>\n | Promise<HttpCustomPredicateResult<Params>>\n\nexport type HttpCustomPredicateResult<Params extends PathParams> =\n | boolean\n | {\n matches: boolean\n params: Params\n }\n\nexport type HttpRequestPredicate<Params extends PathParams> =\n | Path\n | HttpCustomPredicate<Params>\n\n/**\n * Request handler for HTTP requests.\n * Provides request matching based on method and URL.\n */\nexport class HttpHandler extends RequestHandler<\n HttpHandlerInfo,\n HttpRequestParsedResult,\n HttpRequestResolverExtras<any>\n> {\n constructor(\n method: HttpHandlerMethod,\n predicate: HttpRequestPredicate<PathParams>,\n resolver: ResponseResolver<HttpRequestResolverExtras<any>, any, any>,\n options?: RequestHandlerOptions,\n ) {\n const displayPath =\n typeof predicate === 'function' ? '[custom predicate]' : predicate\n\n super({\n info: {\n header: `${method}${displayPath ? ` ${displayPath}` : ''}`,\n path: predicate,\n method,\n },\n resolver,\n options,\n })\n\n this.checkRedundantQueryParameters()\n }\n\n private checkRedundantQueryParameters() {\n const { method, path } = this.info\n\n if (!path || path instanceof RegExp || typeof path === 'function') {\n return\n }\n\n const url = cleanUrl(path)\n\n // Bypass request handler URLs that have no redundant characters.\n if (url === path) {\n return\n }\n\n devUtils.warn(\n `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 using \"new URL(request.url).searchParams\" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`,\n )\n }\n\n async parse(args: {\n request: Request\n resolutionContext?: ResponseResolutionContext\n }) {\n const url = new URL(args.request.url)\n const cookies = getAllRequestCookies(args.request)\n\n /**\n * Handle custom predicate functions.\n * @note Invoke this during parsing so the user can parse the path parameters\n * manually. Otherwise, `params` is always an empty object, which isn't nice.\n */\n if (typeof this.info.path === 'function') {\n const customPredicateResult = await this.info.path({\n request: args.request,\n cookies,\n })\n\n const match =\n typeof customPredicateResult === 'boolean'\n ? {\n matches: customPredicateResult,\n params: {},\n }\n : customPredicateResult\n\n return {\n match,\n cookies,\n }\n }\n\n const match = this.info.path\n ? matchRequestUrl(url, this.info.path, args.resolutionContext?.baseUrl)\n : { matches: false, params: {} }\n\n return {\n match,\n cookies,\n }\n }\n\n async predicate(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n resolutionContext?: ResponseResolutionContext\n }) {\n const hasMatchingMethod = this.matchMethod(args.request.method)\n const hasMatchingUrl = args.parsedResult.match.matches\n return hasMatchingMethod && hasMatchingUrl\n }\n\n private matchMethod(actualMethod: string): boolean {\n return this.info.method instanceof RegExp\n ? this.info.method.test(actualMethod)\n : isStringEqual(this.info.method, actualMethod)\n }\n\n protected extendResolverArgs(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n }) {\n return {\n params: args.parsedResult.match?.params || {},\n cookies: args.parsedResult.cookies,\n }\n }\n\n async log(args: { request: Request; response: Response }) {\n const publicUrl = toPublicUrl(args.request.url)\n const loggedRequest = await serializeRequest(args.request)\n const loggedResponse = await serializeResponse(args.response)\n const statusColor = getStatusCodeColor(loggedResponse.status)\n\n console.groupCollapsed(\n devUtils.formatMessage(\n `${getTimestamp()} ${args.request.method} ${publicUrl} (%c${\n loggedResponse.status\n } ${loggedResponse.statusText}%c)`,\n ),\n `color:${statusColor}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log('Request', loggedRequest)\n // eslint-disable-next-line no-console\n console.log('Handler:', this)\n // eslint-disable-next-line no-console\n console.log('Response', loggedResponse)\n console.groupEnd()\n }\n}\n"],"mappings":"AACA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,OAIK;AACP,S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tC,YAAQ,SAAS;AAAA,EACnB;AACF;","names":["HttpMethods","match"]}
1
+ {"version":3,"sources":["../../../src/core/handlers/HttpHandler.ts"],"sourcesContent":["import { ResponseResolutionContext } from '../utils/executeHandlers'\nimport { devUtils } from '../utils/internal/devUtils'\nimport { isStringEqual } from '../utils/internal/isStringEqual'\nimport { getStatusCodeColor } from '../utils/logging/getStatusCodeColor'\nimport { getTimestamp } from '../utils/logging/getTimestamp'\nimport { serializeRequest } from '../utils/logging/serializeRequest'\nimport { serializeResponse } from '../utils/logging/serializeResponse'\nimport {\n matchRequestUrl,\n Match,\n Path,\n PathParams,\n} from '../utils/matching/matchRequestUrl'\nimport { toPublicUrl } from '../utils/request/toPublicUrl'\nimport { getAllRequestCookies } from '../utils/request/getRequestCookies'\nimport { cleanUrl } from '../utils/url/cleanUrl'\nimport {\n RequestHandler,\n RequestHandlerDefaultInfo,\n RequestHandlerOptions,\n ResponseResolver,\n} from './RequestHandler'\n\nexport type HttpHandlerMethod = string | RegExp\n\nexport interface HttpHandlerInfo extends RequestHandlerDefaultInfo {\n method: HttpHandlerMethod\n path: HttpRequestPredicate<PathParams>\n}\n\nexport enum HttpMethods {\n HEAD = 'HEAD',\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n PATCH = 'PATCH',\n OPTIONS = 'OPTIONS',\n DELETE = 'DELETE',\n}\n\nexport type RequestQuery = {\n [queryName: string]: string\n}\n\nexport type HttpRequestParsedResult = {\n match: Match\n cookies: Record<string, string>\n}\n\nexport type HttpRequestResolverExtras<Params extends PathParams> = {\n params: Params\n cookies: Record<string, string>\n}\n\nexport type HttpCustomPredicate<Params extends PathParams> = (args: {\n request: Request\n cookies: Record<string, string>\n}) =>\n | HttpCustomPredicateResult<Params>\n | Promise<HttpCustomPredicateResult<Params>>\n\nexport type HttpCustomPredicateResult<Params extends PathParams> =\n | boolean\n | {\n matches: boolean\n params: Params\n }\n\nexport type HttpRequestPredicate<Params extends PathParams> =\n | Path\n | HttpCustomPredicate<Params>\n\n/**\n * Request handler for HTTP requests.\n * Provides request matching based on method and URL.\n */\nexport class HttpHandler extends RequestHandler<\n HttpHandlerInfo,\n HttpRequestParsedResult,\n HttpRequestResolverExtras<any>\n> {\n constructor(\n method: HttpHandlerMethod,\n predicate: HttpRequestPredicate<PathParams>,\n resolver: ResponseResolver<HttpRequestResolverExtras<any>, any, any>,\n options?: RequestHandlerOptions,\n ) {\n const displayPath =\n typeof predicate === 'function' ? '[custom predicate]' : predicate\n\n super({\n info: {\n header: `${method}${displayPath ? ` ${displayPath}` : ''}`,\n path: predicate,\n method,\n },\n resolver,\n options,\n })\n\n this.checkRedundantQueryParameters()\n }\n\n private checkRedundantQueryParameters() {\n const { method, path } = this.info\n\n if (!path || path instanceof RegExp || typeof path === 'function') {\n return\n }\n\n const url = cleanUrl(path)\n\n // Bypass request handler URLs that have no redundant characters.\n if (url === path) {\n return\n }\n\n devUtils.warn(\n `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 using \"new URL(request.url).searchParams\" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`,\n )\n }\n\n async parse(args: {\n request: Request\n resolutionContext?: ResponseResolutionContext\n }) {\n const url = new URL(args.request.url)\n const cookies = getAllRequestCookies(args.request)\n\n /**\n * Handle custom predicate functions.\n * @note Invoke this during parsing so the user can parse the path parameters\n * manually. Otherwise, `params` is always an empty object, which isn't nice.\n */\n if (typeof this.info.path === 'function') {\n const customPredicateResult = await this.info.path({\n request: args.request,\n cookies,\n })\n\n const match =\n typeof customPredicateResult === 'boolean'\n ? {\n matches: customPredicateResult,\n params: {},\n }\n : customPredicateResult\n\n return {\n match,\n cookies,\n }\n }\n\n const match = this.info.path\n ? matchRequestUrl(url, this.info.path, args.resolutionContext?.baseUrl)\n : { matches: false, params: {} }\n\n return {\n match,\n cookies,\n }\n }\n\n async predicate(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n resolutionContext?: ResponseResolutionContext\n }) {\n const hasMatchingMethod = this.matchMethod(args.request.method)\n const hasMatchingUrl = args.parsedResult.match.matches\n return hasMatchingMethod && hasMatchingUrl\n }\n\n private matchMethod(actualMethod: string): boolean {\n return this.info.method instanceof RegExp\n ? this.info.method.test(actualMethod)\n : isStringEqual(this.info.method, actualMethod)\n }\n\n protected extendResolverArgs(args: {\n request: Request\n parsedResult: HttpRequestParsedResult\n }) {\n return {\n params: args.parsedResult.match?.params || {},\n cookies: args.parsedResult.cookies,\n }\n }\n\n async log(args: { request: Request; response: Response }) {\n const publicUrl = toPublicUrl(args.request.url)\n const loggedRequest = await serializeRequest(args.request)\n const loggedResponse = await serializeResponse(args.response)\n const statusColor = getStatusCodeColor(loggedResponse.status)\n\n console.groupCollapsed(\n devUtils.formatMessage(\n `${getTimestamp()} ${args.request.method} ${publicUrl} (%c${\n loggedResponse.status\n } ${loggedResponse.statusText}%c)`,\n ),\n `color:${statusColor}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log('Request', loggedRequest)\n // eslint-disable-next-line no-console\n console.log('Handler:', this)\n // eslint-disable-next-line no-console\n console.log('Response', loggedResponse)\n console.groupEnd()\n }\n}\n"],"mappings":"AACA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,OAIK;AACP,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAIK;AASA,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,SAAM;AACN,EAAAA,aAAA,WAAQ;AACR,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AAPC,SAAAA;AAAA,GAAA;AA8CL,MAAM,oBAAoB,eAI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KAAK,YAAY,KAAK,QAAQ,MAAM;AAC9D,UAAM,iBAAiB,KAAK,aAAa,MAAM;AAC/C,WAAO,qBAAqB;AAAA,EAC9B;AAAA,EAEQ,YAAY,cAA+B;AACjD,WAAO,KAAK,KAAK,kBAAkB,SAC/B,KAAK,KAAK,OAAO,KAAK,YAAY,IAClC,cAAc,KAAK,KAAK,QAAQ,YAAY;AAAA,EAClD;AAAA,EAEU,mBAAmB,MAG1B;AACD,WAAO;AAAA,MACL,QAAQ,KAAK,aAAa,OAAO,UAAU,CAAC;AAAA,MAC5C,SAAS,KAAK,aAAa;AAAA,IAC7B;AAAA,EACF;AAAA,EAEA,MAAM,IAAI,MAAgD;AACxD,UAAM,YAAY,YAAY,KAAK,QAAQ,GAAG;AAC9C,UAAM,gBAAgB,MAAM,iBAAiB,KAAK,OAAO;AACzD,UAAM,iBAAiB,MAAM,kBAAkB,KAAK,QAAQ;AAC5D,UAAM,cAAc,mBAAmB,eAAe,MAAM;AAE5D,YAAQ;AAAA,MACN,SAAS;AAAA,QACP,GAAG,aAAa,CAAC,IAAI,KAAK,QAAQ,MAAM,IAAI,SAAS,OACnD,eAAe,MACjB,IAAI,eAAe,UAAU;AAAA,MAC/B;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,IACF;AAEA,YAAQ,IAAI,WAAW,aAAa;AAEpC,YAAQ,IAAI,YAAY,IAAI;AAE5B,YAAQ,IAAI,YAAY,cAAc;AACtC,YAAQ,SAAS;AAAA,EACnB;AACF;","names":["HttpMethods","match"]}
@@ -1,5 +1,5 @@
1
1
  import '../utils/internal/isIterable.mjs';
2
- export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, N as RequestHandlerArgs, s as RequestHandlerDefaultInfo, O as RequestHandlerExecutionResult, K as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, L as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-DGUjNQHG.mjs';
2
+ export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, N as RequestHandlerArgs, t as RequestHandlerDefaultInfo, O as RequestHandlerExecutionResult, L as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, e as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-U6SfxBlj.mjs';
3
3
  import '../typeUtils.mjs';
4
4
  import '@mswjs/interceptors';
5
5
  import 'graphql';
@@ -1,5 +1,5 @@
1
1
  import '../utils/internal/isIterable.js';
2
- export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, N as RequestHandlerArgs, s as RequestHandlerDefaultInfo, O as RequestHandlerExecutionResult, K as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, L as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-BpT5A_2L.js';
2
+ export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, J as JsonBodyType, M as MaybeAsyncResponseResolverReturnType, R as RequestHandler, N as RequestHandlerArgs, t as RequestHandlerDefaultInfo, O as RequestHandlerExecutionResult, L as RequestHandlerInternalInfo, c as RequestHandlerOptions, a as ResponseResolver, e as ResponseResolverInfo, b as ResponseResolverReturnType } from '../HttpResponse-DC89RDb7.js';
3
3
  import '../typeUtils.js';
4
4
  import '@mswjs/interceptors';
5
5
  import 'graphql';
@@ -1,4 +1,4 @@
1
- import { D as DefaultBodyType, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-DGUjNQHG.mjs';
1
+ import { D as DefaultBodyType, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-U6SfxBlj.mjs';
2
2
  import { HttpRequestPredicate, HttpRequestResolverExtras, HttpHandler } from './handlers/HttpHandler.mjs';
3
3
  import { PathParams } from './utils/matching/matchRequestUrl.mjs';
4
4
  import '@mswjs/interceptors';
@@ -1,4 +1,4 @@
1
- import { D as DefaultBodyType, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-BpT5A_2L.js';
1
+ import { D as DefaultBodyType, a as ResponseResolver, c as RequestHandlerOptions } from './HttpResponse-DC89RDb7.js';
2
2
  import { HttpRequestPredicate, HttpRequestResolverExtras, HttpHandler } from './handlers/HttpHandler.js';
3
3
  import { PathParams } from './utils/matching/matchRequestUrl.js';
4
4
  import '@mswjs/interceptors';
@@ -1,7 +1,7 @@
1
1
  export { SetupApi } from './SetupApi.mjs';
2
- export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, m as DefaultUnsafeFetchResponse, k as GraphQLCustomPredicate, G as GraphQLHandler, i as GraphQLJsonRequestBody, j as GraphQLOperationType, e as GraphQLQuery, g as GraphQLRequestBody, h as GraphQLResponseBody, f as GraphQLVariables, o as HttpResponse, H as HttpResponseInit, J as JsonBodyType, P as ParsedGraphQLRequest, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, n as StrictResponse, l as bodyType } from './HttpResponse-DGUjNQHG.mjs';
2
+ export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, o as DefaultUnsafeFetchResponse, l as GraphQLCustomPredicate, G as GraphQLHandler, j as GraphQLJsonRequestBody, k as GraphQLOperationType, f as GraphQLQuery, h as GraphQLRequestBody, i as GraphQLResponseBody, g as GraphQLVariables, q as HttpResponse, H as HttpResponseInit, J as JsonBodyType, P as ParsedGraphQLRequest, R as RequestHandler, c as RequestHandlerOptions, m as ResponseResolutionContext, a as ResponseResolver, e as ResponseResolverInfo, b as ResponseResolverReturnType, S as StrictRequest, p as StrictResponse, n as bodyType } from './HttpResponse-U6SfxBlj.mjs';
3
3
  export { HttpRequestHandler, HttpResponseResolver, http } from './http.mjs';
4
- export { HttpCustomPredicate, HttpHandler, HttpMethods, HttpRequestParsedResult, RequestQuery } from './handlers/HttpHandler.mjs';
4
+ export { HttpCustomPredicate, HttpHandler, HttpHandlerInfo, HttpHandlerMethod, HttpMethods, HttpRequestParsedResult, HttpRequestResolverExtras, RequestQuery } from './handlers/HttpHandler.mjs';
5
5
  export { GraphQLRequestHandler, GraphQLResponseResolver, graphql } from './graphql.mjs';
6
6
  export { WebSocketEventListener, WebSocketLink, ws } from './ws.mjs';
7
7
  export { WebSocketHandler, WebSocketHandlerConnection, WebSocketHandlerEventMap } from './handlers/WebSocketHandler.mjs';
@@ -1,7 +1,7 @@
1
1
  export { SetupApi } from './SetupApi.js';
2
- export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, m as DefaultUnsafeFetchResponse, k as GraphQLCustomPredicate, G as GraphQLHandler, i as GraphQLJsonRequestBody, j as GraphQLOperationType, e as GraphQLQuery, g as GraphQLRequestBody, h as GraphQLResponseBody, f as GraphQLVariables, o as HttpResponse, H as HttpResponseInit, J as JsonBodyType, P as ParsedGraphQLRequest, R as RequestHandler, c as RequestHandlerOptions, a as ResponseResolver, b as ResponseResolverReturnType, S as StrictRequest, n as StrictResponse, l as bodyType } from './HttpResponse-BpT5A_2L.js';
2
+ export { A as AsyncResponseResolverReturnType, D as DefaultBodyType, d as DefaultRequestMultipartBody, o as DefaultUnsafeFetchResponse, l as GraphQLCustomPredicate, G as GraphQLHandler, j as GraphQLJsonRequestBody, k as GraphQLOperationType, f as GraphQLQuery, h as GraphQLRequestBody, i as GraphQLResponseBody, g as GraphQLVariables, q as HttpResponse, H as HttpResponseInit, J as JsonBodyType, P as ParsedGraphQLRequest, R as RequestHandler, c as RequestHandlerOptions, m as ResponseResolutionContext, a as ResponseResolver, e as ResponseResolverInfo, b as ResponseResolverReturnType, S as StrictRequest, p as StrictResponse, n as bodyType } from './HttpResponse-DC89RDb7.js';
3
3
  export { HttpRequestHandler, HttpResponseResolver, http } from './http.js';
4
- export { HttpCustomPredicate, HttpHandler, HttpMethods, HttpRequestParsedResult, RequestQuery } from './handlers/HttpHandler.js';
4
+ export { HttpCustomPredicate, HttpHandler, HttpHandlerInfo, HttpHandlerMethod, HttpMethods, HttpRequestParsedResult, HttpRequestResolverExtras, RequestQuery } from './handlers/HttpHandler.js';
5
5
  export { GraphQLRequestHandler, GraphQLResponseResolver, graphql } from './graphql.js';
6
6
  export { WebSocketEventListener, WebSocketLink, ws } from './ws.js';
7
7
  export { WebSocketHandler, WebSocketHandlerConnection, WebSocketHandlerEventMap } from './handlers/WebSocketHandler.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Server-Sent Events */\nexport {\n sse,\n type ServerSentEventRequestHandler,\n type ServerSentEventResolver,\n type ServerSentEventResolverExtras,\n type ServerSentEventMessage,\n} from './sse'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport {\n onUnhandledRequest,\n type UnhandledRequestStrategy,\n type UnhandledRequestCallback,\n} from './utils/request/onUnhandledRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n HttpCustomPredicate,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLResponseBody,\n GraphQLJsonRequestBody,\n GraphQLOperationType,\n GraphQLCustomPredicate,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAE7B,sBAAyB;AAGzB,4BAA+B;AAC/B,kBAAqB;AACrB,yBAAyC;AACzC,qBAAwB;AACxB,4BAA+B;AAG/B,gBAAuC;AACvC,8BAIO;AAGP,iBAMO;AAGP,6BAAgC;AAChC,0BAAc,kCA9Bd;AA+BA,gCAIO;AACP,yBAA4B;AAC5B,sBAAyB;AAyCzB,0BAAc,2BA9Ed;AA+EA,0BAAc,oBA/Ed;AAgFA,oBAAuB;AACvB,yBAA4B;AAC5B,kCAAqC;AAAA,IAMrC,kCAAa;","names":[]}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Server-Sent Events */\nexport {\n sse,\n type ServerSentEventRequestHandler,\n type ServerSentEventResolver,\n type ServerSentEventResolverExtras,\n type ServerSentEventMessage,\n} from './sse'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport {\n onUnhandledRequest,\n type UnhandledRequestStrategy,\n type UnhandledRequestCallback,\n} from './utils/request/onUnhandledRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n ResponseResolverInfo,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n HttpHandlerInfo,\n HttpRequestResolverExtras,\n HttpHandlerMethod,\n HttpCustomPredicate,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLResponseBody,\n GraphQLJsonRequestBody,\n GraphQLOperationType,\n GraphQLCustomPredicate,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\nexport type { ResponseResolutionContext } from './utils/executeHandlers'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAE7B,sBAAyB;AAGzB,4BAA+B;AAC/B,kBAAqB;AACrB,yBAAyC;AACzC,qBAAwB;AACxB,4BAA+B;AAG/B,gBAAuC;AACvC,8BAIO;AAGP,iBAMO;AAGP,6BAAgC;AAChC,0BAAc,kCA9Bd;AA+BA,gCAIO;AACP,yBAA4B;AAC5B,sBAAyB;AA8CzB,0BAAc,2BAnFd;AAoFA,0BAAc,oBApFd;AAqFA,oBAAuB;AACvB,yBAA4B;AAC5B,kCAAqC;AAAA,IAMrC,kCAAa;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Server-Sent Events */\nexport {\n sse,\n type ServerSentEventRequestHandler,\n type ServerSentEventResolver,\n type ServerSentEventResolverExtras,\n type ServerSentEventMessage,\n} from './sse'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport {\n onUnhandledRequest,\n type UnhandledRequestStrategy,\n type UnhandledRequestCallback,\n} from './utils/request/onUnhandledRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n HttpCustomPredicate,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLResponseBody,\n GraphQLJsonRequestBody,\n GraphQLOperationType,\n GraphQLCustomPredicate,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,gBAAgB;AAGzB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,aAAa,mBAAmB;AACzC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAG/B,SAAS,UAA8B;AACvC;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAKK;AAGP,SAAS,uBAAuB;AAChC,cAAc;AACd;AAAA,EACE;AAAA,OAGK;AACP,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAyCzB,cAAc;AACd,cAAc;AACd,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAMrC,aAAa;","names":[]}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Server-Sent Events */\nexport {\n sse,\n type ServerSentEventRequestHandler,\n type ServerSentEventResolver,\n type ServerSentEventResolverExtras,\n type ServerSentEventMessage,\n} from './sse'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport {\n onUnhandledRequest,\n type UnhandledRequestStrategy,\n type UnhandledRequestCallback,\n} from './utils/request/onUnhandledRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n ResponseResolverInfo,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n HttpHandlerInfo,\n HttpRequestResolverExtras,\n HttpHandlerMethod,\n HttpCustomPredicate,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLResponseBody,\n GraphQLJsonRequestBody,\n GraphQLOperationType,\n GraphQLCustomPredicate,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\nexport type { ResponseResolutionContext } from './utils/executeHandlers'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,gBAAgB;AAGzB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,aAAa,mBAAmB;AACzC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAG/B,SAAS,UAA8B;AACvC;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAKK;AAGP,SAAS,uBAAuB;AAChC,cAAc;AACd;AAAA,EACE;AAAA,OAGK;AACP,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AA8CzB,cAAc;AACd,cAAc;AACd,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAMrC,aAAa;","names":[]}
@@ -1,4 +1,4 @@
1
- import { o as HttpResponse } from './HttpResponse-DGUjNQHG.mjs';
1
+ import { q as HttpResponse } from './HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import './utils/internal/isIterable.mjs';
4
4
  import './typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- import { o as HttpResponse } from './HttpResponse-BpT5A_2L.js';
1
+ import { q as HttpResponse } from './HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './utils/internal/isIterable.js';
4
4
  import './typeUtils.js';
@@ -1,5 +1,5 @@
1
1
  import { Emitter } from 'strict-event-emitter';
2
- import { a as ResponseResolver } from './HttpResponse-DGUjNQHG.mjs';
2
+ import { a as ResponseResolver } from './HttpResponse-U6SfxBlj.mjs';
3
3
  import { HttpRequestResolverExtras, HttpHandler } from './handlers/HttpHandler.mjs';
4
4
  import { PathParams, Path } from './utils/matching/matchRequestUrl.mjs';
5
5
  import '@mswjs/interceptors';
package/lib/core/sse.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Emitter } from 'strict-event-emitter';
2
- import { a as ResponseResolver } from './HttpResponse-BpT5A_2L.js';
2
+ import { a as ResponseResolver } from './HttpResponse-DC89RDb7.js';
3
3
  import { HttpRequestResolverExtras, HttpHandler } from './handlers/HttpHandler.js';
4
4
  import { PathParams, Path } from './utils/matching/matchRequestUrl.js';
5
5
  import '@mswjs/interceptors';
@@ -1,4 +1,4 @@
1
- import { H as HttpResponseInit } from '../../HttpResponse-DGUjNQHG.mjs';
1
+ import { H as HttpResponseInit } from '../../HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import '../internal/isIterable.mjs';
4
4
  import '../../typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- import { H as HttpResponseInit } from '../../HttpResponse-BpT5A_2L.js';
1
+ import { H as HttpResponseInit } from '../../HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import '../internal/isIterable.js';
4
4
  import '../../typeUtils.js';
@@ -48,7 +48,7 @@ class CookieStore {
48
48
  this.persist();
49
49
  }
50
50
  getCookieStoreIndex() {
51
- if (typeof localStorage === "undefined") {
51
+ if (typeof localStorage === "undefined" || typeof localStorage.getItem !== "function") {
52
52
  return {};
53
53
  }
54
54
  const cookiesString = localStorage.getItem(this.#storageKey);
@@ -71,7 +71,7 @@ class CookieStore {
71
71
  return cookies;
72
72
  }
73
73
  persist() {
74
- if (typeof localStorage === "undefined") {
74
+ if (typeof localStorage === "undefined" || typeof localStorage.setItem !== "function") {
75
75
  return;
76
76
  }
77
77
  const data = [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/utils/cookieStore.ts"],"sourcesContent":["import { isNodeProcess } from 'is-node-process'\nimport { invariant } from 'outvariant'\nimport {\n Cookie,\n CookieJar,\n MemoryCookieStore,\n type MemoryCookieStoreIndex,\n} from 'tough-cookie'\nimport { jsonParse } from './internal/jsonParse'\n\nclass CookieStore {\n #storageKey = '__msw-cookie-store__'\n #jar: CookieJar\n #memoryStore: MemoryCookieStore\n\n constructor() {\n if (!isNodeProcess()) {\n invariant(\n typeof localStorage !== 'undefined',\n 'Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly.',\n )\n }\n\n this.#memoryStore = new MemoryCookieStore()\n this.#memoryStore.idx = this.getCookieStoreIndex()\n this.#jar = new CookieJar(this.#memoryStore)\n }\n\n public getCookies(url: string): Array<Cookie> {\n return this.#jar.getCookiesSync(url)\n }\n\n public async setCookie(cookieName: string, url: string): Promise<void> {\n await this.#jar.setCookie(cookieName, url)\n this.persist()\n }\n\n private getCookieStoreIndex(): MemoryCookieStoreIndex {\n if (typeof localStorage === 'undefined') {\n return {}\n }\n\n const cookiesString = localStorage.getItem(this.#storageKey)\n if (cookiesString == null) {\n return {}\n }\n\n const rawCookies = jsonParse<Array<Record<string, unknown>>>(cookiesString)\n if (rawCookies == null) {\n return {}\n }\n\n const cookies: MemoryCookieStoreIndex = {}\n\n for (const rawCookie of rawCookies) {\n const cookie = Cookie.fromJSON(rawCookie)\n\n if (cookie != null && cookie.domain != null && cookie.path != null) {\n cookies[cookie.domain] ||= {}\n cookies[cookie.domain][cookie.path] ||= {}\n cookies[cookie.domain][cookie.path][cookie.key] = cookie\n }\n }\n\n return cookies\n }\n\n private persist(): void {\n if (typeof localStorage === 'undefined') {\n return\n }\n\n const data = []\n const { idx } = this.#memoryStore\n\n for (const domain in idx) {\n for (const path in idx[domain]) {\n for (const key in idx[domain][path]) {\n data.push(idx[domain][path][key].toJSON())\n }\n }\n }\n\n localStorage.setItem(this.#storageKey, JSON.stringify(data))\n }\n}\n\nexport const cookieStore = new CookieStore()\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA8B;AAC9B,wBAA0B;AAC1B,0BAKO;AACP,uBAA0B;AAE1B,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EAEA,cAAc;AACZ,QAAI,KAAC,sCAAc,GAAG;AACpB;AAAA,QACE,OAAO,iBAAiB;AAAA,QACxB;AAAA,MACF;AAAA,IACF;AAEA,SAAK,eAAe,IAAI,sCAAkB;AAC1C,SAAK,aAAa,MAAM,KAAK,oBAAoB;AACjD,SAAK,OAAO,IAAI,8BAAU,KAAK,YAAY;AAAA,EAC7C;AAAA,EAEO,WAAW,KAA4B;AAC5C,WAAO,KAAK,KAAK,eAAe,GAAG;AAAA,EACrC;AAAA,EAEA,MAAa,UAAU,YAAoB,KAA4B;AACrE,UAAM,KAAK,KAAK,UAAU,YAAY,GAAG;AACzC,SAAK,QAAQ;AAAA,EACf;AAAA,EAEQ,sBAA8C;AACpD,QAAI,OAAO,iBAAiB,aAAa;AACvC,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,gBAAgB,aAAa,QAAQ,KAAK,WAAW;AAC3D,QAAI,iBAAiB,MAAM;AACzB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,iBAAa,4BAA0C,aAAa;AAC1E,QAAI,cAAc,MAAM;AACtB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,UAAkC,CAAC;AAEzC,eAAW,aAAa,YAAY;AAClC,YAAM,SAAS,2BAAO,SAAS,SAAS;AAExC,UAAI,UAAU,QAAQ,OAAO,UAAU,QAAQ,OAAO,QAAQ,MAAM;AAClE,gBAAQ,OAAO,MAAM,MAAM,CAAC;AAC5B,gBAAQ,OAAO,MAAM,EAAE,OAAO,IAAI,MAAM,CAAC;AACzC,gBAAQ,OAAO,MAAM,EAAE,OAAO,IAAI,EAAE,OAAO,GAAG,IAAI;AAAA,MACpD;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEQ,UAAgB;AACtB,QAAI,OAAO,iBAAiB,aAAa;AACvC;AAAA,IACF;AAEA,UAAM,OAAO,CAAC;AACd,UAAM,EAAE,IAAI,IAAI,KAAK;AAErB,eAAW,UAAU,KAAK;AACxB,iBAAW,QAAQ,IAAI,MAAM,GAAG;AAC9B,mBAAW,OAAO,IAAI,MAAM,EAAE,IAAI,GAAG;AACnC,eAAK,KAAK,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAEA,iBAAa,QAAQ,KAAK,aAAa,KAAK,UAAU,IAAI,CAAC;AAAA,EAC7D;AACF;AAEO,MAAM,cAAc,IAAI,YAAY;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/utils/cookieStore.ts"],"sourcesContent":["import { isNodeProcess } from 'is-node-process'\nimport { invariant } from 'outvariant'\nimport {\n Cookie,\n CookieJar,\n MemoryCookieStore,\n type MemoryCookieStoreIndex,\n} from 'tough-cookie'\nimport { jsonParse } from './internal/jsonParse'\n\nclass CookieStore {\n #storageKey = '__msw-cookie-store__'\n #jar: CookieJar\n #memoryStore: MemoryCookieStore\n\n constructor() {\n if (!isNodeProcess()) {\n invariant(\n typeof localStorage !== 'undefined',\n 'Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly.',\n )\n }\n\n this.#memoryStore = new MemoryCookieStore()\n this.#memoryStore.idx = this.getCookieStoreIndex()\n this.#jar = new CookieJar(this.#memoryStore)\n }\n\n public getCookies(url: string): Array<Cookie> {\n return this.#jar.getCookiesSync(url)\n }\n\n public async setCookie(cookieName: string, url: string): Promise<void> {\n await this.#jar.setCookie(cookieName, url)\n this.persist()\n }\n\n private getCookieStoreIndex(): MemoryCookieStoreIndex {\n if (\n typeof localStorage === 'undefined' ||\n typeof localStorage.getItem !== 'function'\n ) {\n return {}\n }\n\n const cookiesString = localStorage.getItem(this.#storageKey)\n if (cookiesString == null) {\n return {}\n }\n\n const rawCookies = jsonParse<Array<Record<string, unknown>>>(cookiesString)\n if (rawCookies == null) {\n return {}\n }\n\n const cookies: MemoryCookieStoreIndex = {}\n\n for (const rawCookie of rawCookies) {\n const cookie = Cookie.fromJSON(rawCookie)\n\n if (cookie != null && cookie.domain != null && cookie.path != null) {\n cookies[cookie.domain] ||= {}\n cookies[cookie.domain][cookie.path] ||= {}\n cookies[cookie.domain][cookie.path][cookie.key] = cookie\n }\n }\n\n return cookies\n }\n\n private persist(): void {\n if (\n typeof localStorage === 'undefined' ||\n typeof localStorage.setItem !== 'function'\n ) {\n return\n }\n\n const data = []\n const { idx } = this.#memoryStore\n\n for (const domain in idx) {\n for (const path in idx[domain]) {\n for (const key in idx[domain][path]) {\n data.push(idx[domain][path][key].toJSON())\n }\n }\n }\n\n localStorage.setItem(this.#storageKey, JSON.stringify(data))\n }\n}\n\nexport const cookieStore = new CookieStore()\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA8B;AAC9B,wBAA0B;AAC1B,0BAKO;AACP,uBAA0B;AAE1B,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EAEA,cAAc;AACZ,QAAI,KAAC,sCAAc,GAAG;AACpB;AAAA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GAAG;AAC9B,mBAAW,OAAO,IAAI,MAAM,EAAE,IAAI,GAAG;AACnC,eAAK,KAAK,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAEA,iBAAa,QAAQ,KAAK,aAAa,KAAK,UAAU,IAAI,CAAC;AAAA,EAC7D;AACF;AAEO,MAAM,cAAc,IAAI,YAAY;","names":[]}
@@ -29,7 +29,7 @@ class CookieStore {
29
29
  this.persist();
30
30
  }
31
31
  getCookieStoreIndex() {
32
- if (typeof localStorage === "undefined") {
32
+ if (typeof localStorage === "undefined" || typeof localStorage.getItem !== "function") {
33
33
  return {};
34
34
  }
35
35
  const cookiesString = localStorage.getItem(this.#storageKey);
@@ -52,7 +52,7 @@ class CookieStore {
52
52
  return cookies;
53
53
  }
54
54
  persist() {
55
- if (typeof localStorage === "undefined") {
55
+ if (typeof localStorage === "undefined" || typeof localStorage.setItem !== "function") {
56
56
  return;
57
57
  }
58
58
  const data = [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/utils/cookieStore.ts"],"sourcesContent":["import { isNodeProcess } from 'is-node-process'\nimport { invariant } from 'outvariant'\nimport {\n Cookie,\n CookieJar,\n MemoryCookieStore,\n type MemoryCookieStoreIndex,\n} from 'tough-cookie'\nimport { jsonParse } from './internal/jsonParse'\n\nclass CookieStore {\n #storageKey = '__msw-cookie-store__'\n #jar: CookieJar\n #memoryStore: MemoryCookieStore\n\n constructor() {\n if (!isNodeProcess()) {\n invariant(\n typeof localStorage !== 'undefined',\n 'Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly.',\n )\n }\n\n this.#memoryStore = new MemoryCookieStore()\n this.#memoryStore.idx = this.getCookieStoreIndex()\n this.#jar = new CookieJar(this.#memoryStore)\n }\n\n public getCookies(url: string): Array<Cookie> {\n return this.#jar.getCookiesSync(url)\n }\n\n public async setCookie(cookieName: string, url: string): Promise<void> {\n await this.#jar.setCookie(cookieName, url)\n this.persist()\n }\n\n private getCookieStoreIndex(): MemoryCookieStoreIndex {\n if (typeof localStorage === 'undefined') {\n return {}\n }\n\n const cookiesString = localStorage.getItem(this.#storageKey)\n if (cookiesString == null) {\n return {}\n }\n\n const rawCookies = jsonParse<Array<Record<string, unknown>>>(cookiesString)\n if (rawCookies == null) {\n return {}\n }\n\n const cookies: MemoryCookieStoreIndex = {}\n\n for (const rawCookie of rawCookies) {\n const cookie = Cookie.fromJSON(rawCookie)\n\n if (cookie != null && cookie.domain != null && cookie.path != null) {\n cookies[cookie.domain] ||= {}\n cookies[cookie.domain][cookie.path] ||= {}\n cookies[cookie.domain][cookie.path][cookie.key] = cookie\n }\n }\n\n return cookies\n }\n\n private persist(): void {\n if (typeof localStorage === 'undefined') {\n return\n }\n\n const data = []\n const { idx } = this.#memoryStore\n\n for (const domain in idx) {\n for (const path in idx[domain]) {\n for (const key in idx[domain][path]) {\n data.push(idx[domain][path][key].toJSON())\n }\n }\n }\n\n localStorage.setItem(this.#storageKey, JSON.stringify(data))\n }\n}\n\nexport const cookieStore = new CookieStore()\n"],"mappings":"AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAE1B,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EAEA,cAAc;AACZ,QAAI,CAAC,cAAc,GAAG;AACpB;AAAA,QACE,OAAO,iBAAiB;AAAA,QACxB;AAAA,MACF;AAAA,IACF;AAEA,SAAK,eAAe,IAAI,kBAAkB;AAC1C,SAAK,aAAa,MAAM,KAAK,oBAAoB;AACjD,SAAK,OAAO,IAAI,UAAU,KAAK,YAAY;AAAA,EAC7C;AAAA,EAEO,WAAW,KAA4B;AAC5C,WAAO,KAAK,KAAK,eAAe,GAAG;AAAA,EACrC;AAAA,EAEA,M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],"sourcesContent":["import { isNodeProcess } from 'is-node-process'\nimport { invariant } from 'outvariant'\nimport {\n Cookie,\n CookieJar,\n MemoryCookieStore,\n type MemoryCookieStoreIndex,\n} from 'tough-cookie'\nimport { jsonParse } from './internal/jsonParse'\n\nclass CookieStore {\n #storageKey = '__msw-cookie-store__'\n #jar: CookieJar\n #memoryStore: MemoryCookieStore\n\n constructor() {\n if (!isNodeProcess()) {\n invariant(\n typeof localStorage !== 'undefined',\n 'Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly.',\n )\n }\n\n this.#memoryStore = new MemoryCookieStore()\n this.#memoryStore.idx = this.getCookieStoreIndex()\n this.#jar = new CookieJar(this.#memoryStore)\n }\n\n public getCookies(url: string): Array<Cookie> {\n return this.#jar.getCookiesSync(url)\n }\n\n public async setCookie(cookieName: string, url: string): Promise<void> {\n await this.#jar.setCookie(cookieName, url)\n this.persist()\n }\n\n private getCookieStoreIndex(): MemoryCookieStoreIndex {\n if (\n typeof localStorage === 'undefined' ||\n typeof localStorage.getItem !== 'function'\n ) {\n return {}\n }\n\n const cookiesString = localStorage.getItem(this.#storageKey)\n if (cookiesString == null) {\n return {}\n }\n\n const rawCookies = jsonParse<Array<Record<string, unknown>>>(cookiesString)\n if (rawCookies == null) {\n return {}\n }\n\n const cookies: MemoryCookieStoreIndex = {}\n\n for (const rawCookie of rawCookies) {\n const cookie = Cookie.fromJSON(rawCookie)\n\n if (cookie != null && cookie.domain != null && cookie.path != null) {\n cookies[cookie.domain] ||= {}\n cookies[cookie.domain][cookie.path] ||= {}\n cookies[cookie.domain][cookie.path][cookie.key] = cookie\n }\n }\n\n return cookies\n }\n\n private persist(): void {\n if (\n typeof localStorage === 'undefined' ||\n typeof localStorage.setItem !== 'function'\n ) {\n return\n }\n\n const data = []\n const { idx } = this.#memoryStore\n\n for (const domain in idx) {\n for (const path in idx[domain]) {\n for (const key in idx[domain][path]) {\n data.push(idx[domain][path][key].toJSON())\n }\n }\n }\n\n localStorage.setItem(this.#storageKey, JSON.stringify(data))\n }\n}\n\nexport const cookieStore = new CookieStore()\n"],"mappings":"AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAE1B,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EAEA,cAAc;AACZ,QAAI,CAAC,cAAc,GAAG;AACpB;AAAA,QACE,OAAO,iBAAiB;AAAA,QACxB;AAAA,MACF;AAAA,IACF;AAEA,SAAK,eAAe,IAAI,kBAAkB;AAC1C,SAAK,aAAa,MAAM,KAAK,oBAAoB;AACjD,SAAK,OAAO,IAAI,UAAU,KAAK,YAAY;AAAA,EAC7C;AAAA,EAEO,WAAW,KAA4B;AAC5C,WAAO,KAAK,KAAK,eAAe,GAAG;AAAA,EACrC;AAAA,EAEA,MAAa,UAAU,YAAoB,KAA4B;AACrE,UAAM,KAAK,KAAK,UAAU,YAAY,GAAG;AACzC,SAAK,QAAQ;AAAA,EACf;AAAA,EAEQ,sBAA8C;AACpD,QACE,OAAO,iBAAiB,eACxB,OAAO,aAAa,YAAY,YAChC;AACA,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,gBAAgB,aAAa,QAAQ,KAAK,WAAW;AAC3D,QAAI,iBAAiB,MAAM;AACzB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,aAAa,UAA0C,aAAa;AAC1E,QAAI,cAAc,MAAM;AACtB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,UAAkC,CAAC;AAEzC,eAAW,aAAa,YAAY;AAClC,YAAM,SAAS,OAAO,SAAS,SAAS;AAExC,UAAI,UAAU,QAAQ,OAAO,UAAU,QAAQ,OAAO,QAAQ,MAAM;AAClE,gBAAQ,OAAO,MAAM,MAAM,CAAC;AAC5B,gBAAQ,OAAO,MAAM,EAAE,OAAO,IAAI,MAAM,CAAC;AACzC,gBAAQ,OAAO,MAAM,EAAE,OAAO,IAAI,EAAE,OAAO,GAAG,IAAI;AAAA,MACpD;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEQ,UAAgB;AACtB,QACE,OAAO,iBAAiB,eACxB,OAAO,aAAa,YAAY,YAChC;AACA;AAAA,IACF;AAEA,UAAM,OAAO,CAAC;AACd,UAAM,EAAE,IAAI,IAAI,KAAK;AAErB,eAAW,UAAU,KAAK;AACxB,iBAAW,QAAQ,IAAI,MAAM,GAAG;AAC9B,mBAAW,OAAO,IAAI,MAAM,EAAE,IAAI,GAAG;AACnC,eAAK,KAAK,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAEA,iBAAa,QAAQ,KAAK,aAAa,KAAK,UAAU,IAAI,CAAC;AAAA,EAC7D;AACF;AAEO,MAAM,cAAc,IAAI,YAAY;","names":[]}
@@ -1,4 +1,4 @@
1
- export { t as HandlersExecutionResult, p as ResponseResolutionContext, u as executeHandlers } from '../HttpResponse-DGUjNQHG.mjs';
1
+ export { u as HandlersExecutionResult, m as ResponseResolutionContext, v as executeHandlers } from '../HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import './internal/isIterable.mjs';
4
4
  import '../typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- export { t as HandlersExecutionResult, p as ResponseResolutionContext, u as executeHandlers } from '../HttpResponse-BpT5A_2L.js';
1
+ export { u as HandlersExecutionResult, m as ResponseResolutionContext, v as executeHandlers } from '../HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './internal/isIterable.js';
4
4
  import '../typeUtils.js';
@@ -1,7 +1,7 @@
1
1
  import { Emitter } from 'strict-event-emitter';
2
2
  import { SharedOptions, LifeCycleEventsMap } from '../sharedOptions.mjs';
3
3
  import { RequiredDeep } from '../typeUtils.mjs';
4
- import { t as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-DGUjNQHG.mjs';
4
+ import { u as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-U6SfxBlj.mjs';
5
5
  import './request/onUnhandledRequest.mjs';
6
6
  import '@mswjs/interceptors';
7
7
  import './internal/isIterable.mjs';
@@ -1,7 +1,7 @@
1
1
  import { Emitter } from 'strict-event-emitter';
2
2
  import { SharedOptions, LifeCycleEventsMap } from '../sharedOptions.js';
3
3
  import { RequiredDeep } from '../typeUtils.js';
4
- import { t as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-BpT5A_2L.js';
4
+ import { u as HandlersExecutionResult, R as RequestHandler } from '../HttpResponse-DC89RDb7.js';
5
5
  import './request/onUnhandledRequest.js';
6
6
  import '@mswjs/interceptors';
7
7
  import './internal/isIterable.js';
@@ -1,5 +1,5 @@
1
1
  import { HandlerKind } from '../../handlers/common.mjs';
2
- import { R as RequestHandler } from '../../HttpResponse-DGUjNQHG.mjs';
2
+ import { R as RequestHandler } from '../../HttpResponse-U6SfxBlj.mjs';
3
3
  import { WebSocketHandler } from '../../handlers/WebSocketHandler.mjs';
4
4
  import '@mswjs/interceptors';
5
5
  import './isIterable.mjs';
@@ -1,5 +1,5 @@
1
1
  import { HandlerKind } from '../../handlers/common.js';
2
- import { R as RequestHandler } from '../../HttpResponse-BpT5A_2L.js';
2
+ import { R as RequestHandler } from '../../HttpResponse-DC89RDb7.js';
3
3
  import { WebSocketHandler } from '../../handlers/WebSocketHandler.js';
4
4
  import '@mswjs/interceptors';
5
5
  import './isIterable.js';
@@ -1,5 +1,5 @@
1
1
  import 'graphql';
2
- export { y as GraphQLMultipartRequestBody, x as GraphQLParsedOperationsMap, v as ParsedGraphQLQuery, P as ParsedGraphQLRequest, w as parseDocumentNode, z as parseGraphQLRequest } from '../../HttpResponse-DGUjNQHG.mjs';
2
+ export { z as GraphQLMultipartRequestBody, y as GraphQLParsedOperationsMap, w as ParsedGraphQLQuery, P as ParsedGraphQLRequest, x as parseDocumentNode, B as parseGraphQLRequest } from '../../HttpResponse-U6SfxBlj.mjs';
3
3
  import '@mswjs/interceptors';
4
4
  import './isIterable.mjs';
5
5
  import '../../typeUtils.mjs';
@@ -1,5 +1,5 @@
1
1
  import 'graphql';
2
- export { y as GraphQLMultipartRequestBody, x as GraphQLParsedOperationsMap, v as ParsedGraphQLQuery, P as ParsedGraphQLRequest, w as parseDocumentNode, z as parseGraphQLRequest } from '../../HttpResponse-BpT5A_2L.js';
2
+ export { z as GraphQLMultipartRequestBody, y as GraphQLParsedOperationsMap, w as ParsedGraphQLQuery, P as ParsedGraphQLRequest, x as parseDocumentNode, B as parseGraphQLRequest } from '../../HttpResponse-DC89RDb7.js';
3
3
  import '@mswjs/interceptors';
4
4
  import './isIterable.js';
5
5
  import '../../typeUtils.js';
@@ -1,4 +1,4 @@
1
- import { d as DefaultRequestMultipartBody } from '../../HttpResponse-DGUjNQHG.mjs';
1
+ import { d as DefaultRequestMultipartBody } from '../../HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import './isIterable.mjs';
4
4
  import '../../typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- import { d as DefaultRequestMultipartBody } from '../../HttpResponse-BpT5A_2L.js';
1
+ import { d as DefaultRequestMultipartBody } from '../../HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './isIterable.js';
4
4
  import '../../typeUtils.js';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, s as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-DGUjNQHG.mjs';
1
+ import { R as RequestHandler, t as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-U6SfxBlj.mjs';
2
2
  import '@mswjs/interceptors';
3
3
  import './isIterable.mjs';
4
4
  import '../../typeUtils.mjs';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, s as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-BpT5A_2L.js';
1
+ import { R as RequestHandler, t as RequestHandlerDefaultInfo, c as RequestHandlerOptions } from '../../HttpResponse-DC89RDb7.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './isIterable.js';
4
4
  import '../../typeUtils.js';