msw 2.14.6 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +5 -5
  2. package/lib/browser/index.js +233 -93
  3. package/lib/browser/index.js.map +1 -1
  4. package/lib/browser/index.mjs +233 -93
  5. package/lib/browser/index.mjs.map +1 -1
  6. package/lib/core/{HttpResponse-CQwYpuKo.d.mts → HttpResponse-BE_Y2Ak9.d.mts} +19 -1
  7. package/lib/core/{HttpResponse-BFS34nkx.d.ts → HttpResponse-DL-P1EeG.d.ts} +19 -1
  8. package/lib/core/HttpResponse.d.mts +1 -1
  9. package/lib/core/HttpResponse.d.ts +1 -1
  10. package/lib/core/HttpResponse.js +2 -2
  11. package/lib/core/HttpResponse.js.map +1 -1
  12. package/lib/core/HttpResponse.mjs +2 -2
  13. package/lib/core/HttpResponse.mjs.map +1 -1
  14. package/lib/core/experimental/compat.d.mts +2 -2
  15. package/lib/core/experimental/compat.d.ts +2 -2
  16. package/lib/core/experimental/define-network.d.mts +2 -2
  17. package/lib/core/experimental/define-network.d.ts +2 -2
  18. package/lib/core/experimental/frames/http-frame.d.mts +2 -2
  19. package/lib/core/experimental/frames/http-frame.d.ts +2 -2
  20. package/lib/core/experimental/frames/network-frame.d.mts +2 -2
  21. package/lib/core/experimental/frames/network-frame.d.ts +2 -2
  22. package/lib/core/experimental/frames/network-frame.js +2 -0
  23. package/lib/core/experimental/frames/network-frame.js.map +1 -1
  24. package/lib/core/experimental/frames/network-frame.mjs +2 -0
  25. package/lib/core/experimental/frames/network-frame.mjs.map +1 -1
  26. package/lib/core/experimental/frames/websocket-frame.d.mts +2 -2
  27. package/lib/core/experimental/frames/websocket-frame.d.ts +2 -2
  28. package/lib/core/experimental/handlers-controller.d.mts +1 -1
  29. package/lib/core/experimental/handlers-controller.d.ts +1 -1
  30. package/lib/core/experimental/index.d.mts +2 -2
  31. package/lib/core/experimental/index.d.ts +2 -2
  32. package/lib/core/experimental/on-unhandled-frame.d.mts +2 -2
  33. package/lib/core/experimental/on-unhandled-frame.d.ts +2 -2
  34. package/lib/core/experimental/setup-api.d.mts +1 -1
  35. package/lib/core/experimental/setup-api.d.ts +1 -1
  36. package/lib/core/experimental/sources/interceptor-source.d.mts +2 -2
  37. package/lib/core/experimental/sources/interceptor-source.d.ts +2 -2
  38. package/lib/core/experimental/sources/network-source.d.mts +2 -2
  39. package/lib/core/experimental/sources/network-source.d.ts +2 -2
  40. package/lib/core/getResponse.d.mts +1 -1
  41. package/lib/core/getResponse.d.ts +1 -1
  42. package/lib/core/graphql.d.mts +1 -1
  43. package/lib/core/graphql.d.ts +1 -1
  44. package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
  45. package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
  46. package/lib/core/handlers/HttpHandler.d.mts +1 -1
  47. package/lib/core/handlers/HttpHandler.d.ts +1 -1
  48. package/lib/core/handlers/RequestHandler.d.mts +1 -1
  49. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  50. package/lib/core/handlers/RequestHandler.js +88 -23
  51. package/lib/core/handlers/RequestHandler.js.map +1 -1
  52. package/lib/core/handlers/RequestHandler.mjs +88 -23
  53. package/lib/core/handlers/RequestHandler.mjs.map +1 -1
  54. package/lib/core/handlers/WebSocketHandler.js +7 -6
  55. package/lib/core/handlers/WebSocketHandler.js.map +1 -1
  56. package/lib/core/handlers/WebSocketHandler.mjs +7 -6
  57. package/lib/core/handlers/WebSocketHandler.mjs.map +1 -1
  58. package/lib/core/http.d.mts +1 -1
  59. package/lib/core/http.d.ts +1 -1
  60. package/lib/core/index.d.mts +1 -1
  61. package/lib/core/index.d.ts +1 -1
  62. package/lib/core/{on-unhandled-frame-BBR-P3kV.d.ts → on-unhandled-frame-0KmwUmeV.d.ts} +1 -1
  63. package/lib/core/{on-unhandled-frame-Cr1KOZ0I.d.mts → on-unhandled-frame-gkokW4Rr.d.mts} +1 -1
  64. package/lib/core/passthrough.d.mts +1 -1
  65. package/lib/core/passthrough.d.ts +1 -1
  66. package/lib/core/sse.d.mts +2 -2
  67. package/lib/core/sse.d.ts +2 -2
  68. package/lib/core/sse.js +83 -60
  69. package/lib/core/sse.js.map +1 -1
  70. package/lib/core/sse.mjs +83 -60
  71. package/lib/core/sse.mjs.map +1 -1
  72. package/lib/core/utils/HttpResponse/decorators.d.mts +8 -3
  73. package/lib/core/utils/HttpResponse/decorators.d.ts +8 -3
  74. package/lib/core/utils/HttpResponse/decorators.js +14 -1
  75. package/lib/core/utils/HttpResponse/decorators.js.map +1 -1
  76. package/lib/core/utils/HttpResponse/decorators.mjs +14 -1
  77. package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -1
  78. package/lib/core/utils/executeHandlers.d.mts +1 -1
  79. package/lib/core/utils/executeHandlers.d.ts +1 -1
  80. package/lib/core/utils/handleRequest.d.mts +1 -1
  81. package/lib/core/utils/handleRequest.d.ts +1 -1
  82. package/lib/core/utils/internal/attachSiblingHandlers.d.mts +1 -1
  83. package/lib/core/utils/internal/attachSiblingHandlers.d.ts +1 -1
  84. package/lib/core/utils/internal/attachSiblingHandlers.js +1 -1
  85. package/lib/core/utils/internal/attachSiblingHandlers.js.map +1 -1
  86. package/lib/core/utils/internal/attachSiblingHandlers.mjs +1 -1
  87. package/lib/core/utils/internal/attachSiblingHandlers.mjs.map +1 -1
  88. package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
  89. package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
  90. package/lib/core/utils/internal/observe-response-body-stream.d.mts +18 -0
  91. package/lib/core/utils/internal/observe-response-body-stream.d.ts +18 -0
  92. package/lib/core/utils/internal/observe-response-body-stream.js +64 -0
  93. package/lib/core/utils/internal/observe-response-body-stream.js.map +1 -0
  94. package/lib/core/utils/internal/observe-response-body-stream.mjs +44 -0
  95. package/lib/core/utils/internal/observe-response-body-stream.mjs.map +1 -0
  96. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
  97. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
  98. package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
  99. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  100. package/lib/core/ws/WebSocketClientManager.js +4 -0
  101. package/lib/core/ws/WebSocketClientManager.js.map +1 -1
  102. package/lib/core/ws/WebSocketClientManager.mjs +4 -0
  103. package/lib/core/ws/WebSocketClientManager.mjs.map +1 -1
  104. package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
  105. package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
  106. package/lib/iife/index.js +4668 -1105
  107. package/lib/iife/index.js.map +1 -1
  108. package/lib/mockServiceWorker.js +21 -9
  109. package/package.json +4 -5
  110. package/src/core/handlers/HttpHandler.test.ts +89 -0
  111. package/src/core/handlers/RequestHandler.ts +142 -32
  112. package/src/core/sse.ts +100 -57
  113. package/src/core/utils/HttpResponse/decorators.ts +23 -2
  114. package/src/core/utils/internal/observe-response-body-stream.test.ts +64 -0
  115. package/src/core/utils/internal/observe-response-body-stream.ts +77 -0
  116. package/src/mockServiceWorker.js +19 -7
@@ -172,6 +172,10 @@ type ResponseResolverInfo<ResolverExtraInfo extends Record<string, unknown>, Req
172
172
  /**
173
173
  * Schedule a callback to run after this response resolver completes.
174
174
  * Handy for cleaning up the side effects introduced in the resolver.
175
+ *
176
+ * For responses with a `ReadableStream` body (including `sse()` handlers),
177
+ * the callback runs once the response stream settles: it is read to
178
+ * completion, errored, or canceled, or the request is aborted.
175
179
  * @example
176
180
  * sse('/', ({ client, finalize }) => {
177
181
  * const interval = setInterval(() => client.send({ data: 'ping' }))
@@ -279,7 +283,21 @@ declare abstract class RequestHandler<HandlerInfo extends RequestHandlerDefaultI
279
283
  private createExecutionResult;
280
284
  private scheduleCleanup;
281
285
  private exhaustCleanups;
286
+ /**
287
+ * Remove and return the cleanups scheduled for the given request
288
+ * (or the pending iterator cleanups for generator resolvers).
289
+ */
290
+ private takeScheduledCleanups;
282
291
  private runScheduledCleanups;
292
+ /**
293
+ * Conclude the response resolution for the given request.
294
+ * Runs the scheduled cleanups immediately for responses without a
295
+ * `ReadableStream` body. For streamed responses, returns an observed
296
+ * copy of the response and defers the cleanups until its body settles
297
+ * (is read to completion, errored, or canceled) or the request is
298
+ * aborted, whichever comes first.
299
+ */
300
+ private complete;
283
301
  }
284
302
  /**
285
303
  * Forwards the cookies from the given response to `document.cookie`.
@@ -368,4 +386,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
368
386
  static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
369
387
  }
370
388
 
371
- export { type AsyncResponseResolverReturnType as A, type GraphQLHandlerNameSelector as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLRequestParsedResult as E, type GraphQLCustomPredicateResult as F, GraphQLHandler as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerInternalInfo as K, type RequestHandlerArgs as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerExecutionResult as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, bodyType as Q, RequestHandler as R, type StrictRequest as S, type DefaultUnsafeFetchResponse as T, kDefaultContentType as U, 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, type HttpResponseInit as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type ParsedGraphQLQuery as u, parseDocumentNode as v, type GraphQLParsedOperationsMap as w, type GraphQLMultipartRequestBody as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
389
+ export { type AsyncResponseResolverReturnType as A, type GraphQLCustomPredicateResult as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLHandlerNameSelector as E, type GraphQLRequestParsedResult as F, type GraphQLCustomPredicate as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerArgs as K, type RequestHandlerExecutionResult as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerInternalInfo as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, type DefaultUnsafeFetchResponse as Q, RequestHandler as R, type StrictRequest as S, bodyType as T, kDefaultContentType as U, type DefaultRequestMultipartBody as a, GraphQLHandler as b, type GraphQLJsonRequestBody as c, type GraphQLOperationType as d, type GraphQLQuery as e, type GraphQLRequestBody as f, type GraphQLResponseBody as g, type GraphQLVariables as h, type HttpResponseInit as i, type RequestHandlerOptions as j, type ResponseResolutionContext as k, type ResponseResolver as l, type ResponseResolverInfo as m, type ResponseResolverReturnType as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type GraphQLMultipartRequestBody as u, type GraphQLParsedOperationsMap as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
@@ -172,6 +172,10 @@ type ResponseResolverInfo<ResolverExtraInfo extends Record<string, unknown>, Req
172
172
  /**
173
173
  * Schedule a callback to run after this response resolver completes.
174
174
  * Handy for cleaning up the side effects introduced in the resolver.
175
+ *
176
+ * For responses with a `ReadableStream` body (including `sse()` handlers),
177
+ * the callback runs once the response stream settles: it is read to
178
+ * completion, errored, or canceled, or the request is aborted.
175
179
  * @example
176
180
  * sse('/', ({ client, finalize }) => {
177
181
  * const interval = setInterval(() => client.send({ data: 'ping' }))
@@ -279,7 +283,21 @@ declare abstract class RequestHandler<HandlerInfo extends RequestHandlerDefaultI
279
283
  private createExecutionResult;
280
284
  private scheduleCleanup;
281
285
  private exhaustCleanups;
286
+ /**
287
+ * Remove and return the cleanups scheduled for the given request
288
+ * (or the pending iterator cleanups for generator resolvers).
289
+ */
290
+ private takeScheduledCleanups;
282
291
  private runScheduledCleanups;
292
+ /**
293
+ * Conclude the response resolution for the given request.
294
+ * Runs the scheduled cleanups immediately for responses without a
295
+ * `ReadableStream` body. For streamed responses, returns an observed
296
+ * copy of the response and defers the cleanups until its body settles
297
+ * (is read to completion, errored, or canceled) or the request is
298
+ * aborted, whichever comes first.
299
+ */
300
+ private complete;
283
301
  }
284
302
  /**
285
303
  * Forwards the cookies from the given response to `document.cookie`.
@@ -368,4 +386,4 @@ declare class HttpResponse<BodyType extends DefaultBodyType> extends FetchRespon
368
386
  static formData(body?: FormData, init?: HttpResponseInit): HttpResponse<FormData>;
369
387
  }
370
388
 
371
- export { type AsyncResponseResolverReturnType as A, type GraphQLHandlerNameSelector as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLRequestParsedResult as E, type GraphQLCustomPredicateResult as F, GraphQLHandler as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerInternalInfo as K, type RequestHandlerArgs as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerExecutionResult as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, bodyType as Q, RequestHandler as R, type StrictRequest as S, type DefaultUnsafeFetchResponse as T, kDefaultContentType as U, 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, type HttpResponseInit as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type ParsedGraphQLQuery as u, parseDocumentNode as v, type GraphQLParsedOperationsMap as w, type GraphQLMultipartRequestBody as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
389
+ export { type AsyncResponseResolverReturnType as A, type GraphQLCustomPredicateResult as B, type GraphQLHandlerInfo as C, type DefaultBodyType as D, type GraphQLHandlerNameSelector as E, type GraphQLRequestParsedResult as F, type GraphQLCustomPredicate as G, HttpResponse as H, isDocumentNode as I, type JsonBodyType as J, type RequestHandlerArgs as K, type RequestHandlerExecutionResult as L, type MaybeAsyncResponseResolverReturnType as M, type RequestHandlerInternalInfo as N, forwardResponseCookies as O, type ParsedGraphQLRequest as P, type DefaultUnsafeFetchResponse as Q, RequestHandler as R, type StrictRequest as S, bodyType as T, kDefaultContentType as U, type DefaultRequestMultipartBody as a, GraphQLHandler as b, type GraphQLJsonRequestBody as c, type GraphQLOperationType as d, type GraphQLQuery as e, type GraphQLRequestBody as f, type GraphQLResponseBody as g, type GraphQLVariables as h, type HttpResponseInit as i, type RequestHandlerOptions as j, type ResponseResolutionContext as k, type ResponseResolver as l, type ResponseResolverInfo as m, type ResponseResolverReturnType as n, type StrictResponse as o, type GraphQLPredicate as p, type GraphQLResolverExtras as q, type RequestHandlerDefaultInfo as r, type HandlersExecutionResult as s, executeHandlers as t, type GraphQLMultipartRequestBody as u, type GraphQLParsedOperationsMap as v, type ParsedGraphQLQuery as w, parseDocumentNode as x, parseGraphQLRequest as y, type DocumentTypeDecoration as z };
@@ -1,5 +1,5 @@
1
1
  import '@mswjs/interceptors';
2
- export { T as DefaultUnsafeFetchResponse, H as HttpResponse, n as HttpResponseInit, S as StrictRequest, o as StrictResponse, Q as bodyType, U as kDefaultContentType } from './HttpResponse-CQwYpuKo.mjs';
2
+ export { Q as DefaultUnsafeFetchResponse, H as HttpResponse, i as HttpResponseInit, S as StrictRequest, o as StrictResponse, T as bodyType, U as kDefaultContentType } from './HttpResponse-BE_Y2Ak9.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 { T as DefaultUnsafeFetchResponse, H as HttpResponse, n as HttpResponseInit, S as StrictRequest, o as StrictResponse, Q as bodyType, U as kDefaultContentType } from './HttpResponse-BFS34nkx.js';
2
+ export { Q as DefaultUnsafeFetchResponse, H as HttpResponse, i as HttpResponseInit, S as StrictRequest, o as StrictResponse, T as bodyType, U as kDefaultContentType } from './HttpResponse-DL-P1EeG.js';
3
3
  import './typeUtils.js';
4
4
  import './utils/internal/isIterable.js';
5
5
  import 'graphql';
@@ -25,8 +25,8 @@ __export(HttpResponse_exports, {
25
25
  module.exports = __toCommonJS(HttpResponse_exports);
26
26
  var import_interceptors = require("@mswjs/interceptors");
27
27
  var import_decorators = require("./utils/HttpResponse/decorators");
28
- const bodyType = Symbol("bodyType");
29
- const kDefaultContentType = Symbol.for("kDefaultContentType");
28
+ const bodyType = /* @__PURE__ */ Symbol("bodyType");
29
+ const kDefaultContentType = /* @__PURE__ */ Symbol.for("kDefaultContentType");
30
30
  class HttpResponse extends import_interceptors.FetchResponse {
31
31
  [bodyType] = null;
32
32
  constructor(body, init) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA8B;AAG9B,wBAGO;AAMA,MAAM,WAA0B,OAAO,UAAU;AAkBjD,MAAM,sBAAsB,OAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,kCAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,4CAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA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AAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,UAAM,yCAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA8B;AAG9B,wBAGO;AAMA,MAAM,WAA0B,uBAAO,UAAU;AAkBjD,MAAM,sBAAsB,uBAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,kCAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,4CAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,mBAAe,yCAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,YAAY;AAAA,IACvD;AAKA,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,S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
  decorateResponse,
4
4
  normalizeResponseInit
5
5
  } from './utils/HttpResponse/decorators.mjs';
6
- const bodyType = Symbol("bodyType");
7
- const kDefaultContentType = Symbol.for("kDefaultContentType");
6
+ const bodyType = /* @__PURE__ */ Symbol("bodyType");
7
+ const kDefaultContentType = /* @__PURE__ */ Symbol.for("kDefaultContentType");
8
8
  class HttpResponse extends FetchResponse {
9
9
  [bodyType] = null;
10
10
  constructor(body, init) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAMA,MAAM,WAA0B,OAAO,UAAU;AAkBjD,MAAM,sBAAsB,OAAO,IAAI,qBAAqB;AAa5D,MAAM,qBAEH,cAAc;AAAA,EACtB,CAAU,QAAQ,IAAc;AAAA,EAEhC,YAAY,MAAiC,MAAyB;AACpE,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,MAAkB,YAAY;AACpC,qBAAiB,MAAM,YAAY;AAAA,EACrC;AAAA,EAEA,OAAO,QAA2B;AAChC,WAAO,MAAM,MAAM;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,YAAY;AAAA,IACvD;AAKA,QAAI,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AAC/C,mBAAa,QAAQ;AAAA,QACnB;AAAA,QACA,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,Y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AA;AAAA;AAAA;AAAA,EAQA,OAAO,KACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,WAAW;AAAA,IACtD;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,0BAA0B;AAAA,IACrE;AAEA,QAAI,QAAQ,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AACvD,mBAAa,QAAQ,IAAI,kBAAkB,KAAK,WAAW,SAAS,CAAC;AAAA,IACvE;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,MAAM,sBAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/core/HttpResponse.ts"],"sourcesContent":["import { FetchResponse } from '@mswjs/interceptors'\nimport type { DefaultBodyType, JsonBodyType } from './handlers/RequestHandler'\nimport type { NoInfer } from './typeUtils'\nimport {\n decorateResponse,\n normalizeResponseInit,\n} from './utils/HttpResponse/decorators'\n\nexport interface HttpResponseInit extends ResponseInit {\n type?: ResponseType\n}\n\nexport const bodyType: unique symbol = Symbol('bodyType')\nexport type DefaultUnsafeFetchResponse = Response & {\n [bodyType]?: never\n}\n\nexport interface StrictRequest<BodyType extends JsonBodyType> extends Request {\n json(): Promise<BodyType>\n clone(): StrictRequest<BodyType>\n}\n\n/**\n * Opaque `Response` type that supports strict body type.\n *\n * @deprecated Please use {@link HttpResponse} instead.\n */\nexport type StrictResponse<BodyType extends DefaultBodyType> =\n HttpResponse<BodyType>\n\nexport const kDefaultContentType = Symbol.for('kDefaultContentType')\n\n/**\n * A drop-in replacement for the standard `Response` class\n * to allow additional features, like mocking the response `Set-Cookie` header.\n *\n * @example\n * new HttpResponse('Hello world', { status: 201 })\n * HttpResponse.json({ name: 'John' })\n * HttpResponse.formData(form)\n *\n * @see {@link https://mswjs.io/docs/api/http-response `HttpResponse` API reference}\n */\nexport class HttpResponse<\n BodyType extends DefaultBodyType,\n> extends FetchResponse {\n readonly [bodyType]: BodyType = null as any\n\n constructor(body?: NoInfer<BodyType> | null, init?: HttpResponseInit) {\n const responseInit = normalizeResponseInit(init)\n super(body as BodyInit, responseInit)\n decorateResponse(this, responseInit)\n }\n\n static error(): HttpResponse<any> {\n return super.error() as HttpResponse<any>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/plain\"` body.\n * @example\n * HttpResponse.text('hello world')\n * HttpResponse.text('Error', { status: 500 })\n */\n static text<BodyType extends string>(\n body?: NoInfer<BodyType> | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/plain')\n }\n\n // Automatically set the \"Content-Length\" response header\n // for non-empty text responses. This enforces consistency and\n // brings mocked responses closer to production.\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n body ? new Blob([body]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/json\"` body.\n * @example\n * HttpResponse.json({ firstName: 'John' })\n * HttpResponse.json({ error: 'Not Authorized' }, { status: 401 })\n */\n static json<BodyType extends JsonBodyType>(\n body?: NoInfer<BodyType> | null | undefined,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/json')\n }\n\n /**\n * @note TypeScript is incorrect here.\n * Stringifying undefined will return undefined.\n */\n const responseText = JSON.stringify(body) as string | undefined\n\n if (!responseInit.headers.has('Content-Length')) {\n responseInit.headers.set(\n 'Content-Length',\n responseText ? new Blob([responseText]).size.toString() : '0',\n )\n }\n\n const response = new HttpResponse(responseText, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"application/xml\"` body.\n * @example\n * HttpResponse.xml(`<user name=\"John\" />`)\n * HttpResponse.xml(`<article id=\"abc-123\" />`, { status: 201 })\n */\n static xml<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/xml')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `Content-Type: \"text/html\"` body.\n * @example\n * HttpResponse.html(`<p class=\"author\">Jane Doe</p>`)\n * HttpResponse.html(`<main id=\"abc-123\">Main text</main>`, { status: 201 })\n */\n static html<BodyType extends string>(\n body?: BodyType | null,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'text/html')\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with an `ArrayBuffer` body.\n * @example\n * const buffer = new ArrayBuffer(3)\n * const view = new Uint8Array(buffer)\n * view.set([1, 2, 3])\n *\n * HttpResponse.arrayBuffer(buffer)\n */\n static arrayBuffer<BodyType extends ArrayBuffer | SharedArrayBuffer>(\n body?: BodyType,\n init?: HttpResponseInit,\n ): HttpResponse<BodyType> {\n const responseInit = normalizeResponseInit(init)\n const hasExplicitContentType = responseInit.headers.has('Content-Type')\n\n if (!hasExplicitContentType) {\n responseInit.headers.set('Content-Type', 'application/octet-stream')\n }\n\n if (body && !responseInit.headers.has('Content-Length')) {\n responseInit.headers.set('Content-Length', body.byteLength.toString())\n }\n\n const response = new HttpResponse(body, responseInit)\n\n if (!hasExplicitContentType) {\n Object.defineProperty(response, kDefaultContentType, {\n value: true,\n enumerable: false,\n })\n }\n\n return response as HttpResponse<BodyType>\n }\n\n /**\n * Create a `Response` with a `FormData` body.\n * @example\n * const data = new FormData()\n * data.set('name', 'Alice')\n *\n * HttpResponse.formData(data)\n */\n static formData(\n body?: FormData,\n init?: HttpResponseInit,\n ): HttpResponse<FormData> {\n return new HttpResponse(body, normalizeResponseInit(init))\n }\n}\n"],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AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,YACL,MACA,MACwB;AACxB,UAAM,eAAe,sBAAsB,IAAI;AAC/C,UAAM,yBAAyB,aAAa,QAAQ,IAAI,cAAc;AAEtE,QAAI,CAAC,wBAAwB;AAC3B,mBAAa,QAAQ,IAAI,gBAAgB,0BAA0B;AAAA,IACrE;AAEA,QAAI,QAAQ,CAAC,aAAa,QAAQ,IAAI,gBAAgB,GAAG;AACvD,mBAAa,QAAQ,IAAI,kBAAkB,KAAK,WAAW,SAAS,CAAC;AAAA,IACvE;AAEA,UAAM,WAAW,IAAI,aAAa,MAAM,YAAY;AAEpD,QAAI,CAAC,wBAAwB;AAC3B,aAAO,eAAe,UAAU,qBAAqB;AAAA,QACnD,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,SACL,MACA,MACwB;AACxB,WAAO,IAAI,aAAa,MAAM,sBAAsB,IAAI,CAAC;AAAA,EAC3D;AACF;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.mjs';
2
- import { U as UnhandledFrameCallback } from '../on-unhandled-frame-Cr1KOZ0I.mjs';
2
+ import { U as UnhandledFrameCallback } from '../on-unhandled-frame-gkokW4Rr.mjs';
3
3
  import 'rettime';
4
4
  import './handlers-controller.mjs';
5
- import '../HttpResponse-CQwYpuKo.mjs';
5
+ import '../HttpResponse-BE_Y2Ak9.mjs';
6
6
  import '@mswjs/interceptors';
7
7
  import '../utils/internal/isIterable.mjs';
8
8
  import '../typeUtils.mjs';
@@ -1,8 +1,8 @@
1
1
  import { UnhandledRequestStrategy } from '../utils/request/onUnhandledRequest.js';
2
- import { U as UnhandledFrameCallback } from '../on-unhandled-frame-BBR-P3kV.js';
2
+ import { U as UnhandledFrameCallback } from '../on-unhandled-frame-0KmwUmeV.js';
3
3
  import 'rettime';
4
4
  import './handlers-controller.js';
5
- import '../HttpResponse-BFS34nkx.js';
5
+ import '../HttpResponse-DL-P1EeG.js';
6
6
  import '@mswjs/interceptors';
7
7
  import '../utils/internal/isIterable.js';
8
8
  import '../typeUtils.js';
@@ -1,8 +1,8 @@
1
1
  import { Emitter, DefaultEventMap } from 'rettime';
2
2
  import { NetworkSource, ExtractSourceEvents } from './sources/network-source.mjs';
3
- import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-Cr1KOZ0I.mjs';
3
+ import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-gkokW4Rr.mjs';
4
4
  import { AnyHandler, HandlersController } from './handlers-controller.mjs';
5
- import '../HttpResponse-CQwYpuKo.mjs';
5
+ import '../HttpResponse-BE_Y2Ak9.mjs';
6
6
  import '@mswjs/interceptors';
7
7
  import '../utils/internal/isIterable.mjs';
8
8
  import '../typeUtils.mjs';
@@ -1,8 +1,8 @@
1
1
  import { Emitter, DefaultEventMap } from 'rettime';
2
2
  import { NetworkSource, ExtractSourceEvents } from './sources/network-source.js';
3
- import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-BBR-P3kV.js';
3
+ import { a as NetworkFrameResolutionContext, b as UnhandledFrameHandle } from '../on-unhandled-frame-0KmwUmeV.js';
4
4
  import { AnyHandler, HandlersController } from './handlers-controller.js';
5
- import '../HttpResponse-BFS34nkx.js';
5
+ import '../HttpResponse-DL-P1EeG.js';
6
6
  import '@mswjs/interceptors';
7
7
  import '../utils/internal/isIterable.js';
8
8
  import '../typeUtils.js';
@@ -1,7 +1,7 @@
1
1
  import { TypedEvent } from 'rettime';
2
- import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-Cr1KOZ0I.mjs';
2
+ import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
3
3
  import { HandlersController, AnyHandler } from '../handlers-controller.mjs';
4
- import { R as RequestHandler } from '../../HttpResponse-CQwYpuKo.mjs';
4
+ import { R as RequestHandler } from '../../HttpResponse-BE_Y2Ak9.mjs';
5
5
  import '../../handlers/WebSocketHandler.mjs';
6
6
  import 'strict-event-emitter';
7
7
  import '@mswjs/interceptors/WebSocket';
@@ -1,7 +1,7 @@
1
1
  import { TypedEvent } from 'rettime';
2
- import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-BBR-P3kV.js';
2
+ import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
3
3
  import { HandlersController, AnyHandler } from '../handlers-controller.js';
4
- import { R as RequestHandler } from '../../HttpResponse-BFS34nkx.js';
4
+ import { R as RequestHandler } from '../../HttpResponse-DL-P1EeG.js';
5
5
  import '../../handlers/WebSocketHandler.js';
6
6
  import 'strict-event-emitter';
7
7
  import '@mswjs/interceptors/WebSocket';
@@ -1,7 +1,7 @@
1
1
  import 'rettime';
2
2
  import '../handlers-controller.mjs';
3
- export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-Cr1KOZ0I.mjs';
4
- import '../../HttpResponse-CQwYpuKo.mjs';
3
+ export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
4
+ import '../../HttpResponse-BE_Y2Ak9.mjs';
5
5
  import '@mswjs/interceptors';
6
6
  import '../../utils/internal/isIterable.mjs';
7
7
  import '../../typeUtils.mjs';
@@ -1,7 +1,7 @@
1
1
  import 'rettime';
2
2
  import '../handlers-controller.js';
3
- export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-BBR-P3kV.js';
4
- import '../../HttpResponse-BFS34nkx.js';
3
+ export { A as AnyNetworkFrame, E as ExtractFrameEvents, N as NetworkFrame, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
4
+ import '../../HttpResponse-DL-P1EeG.js';
5
5
  import '@mswjs/interceptors';
6
6
  import '../../utils/internal/isIterable.js';
7
7
  import '../../typeUtils.js';
@@ -28,6 +28,8 @@ class NetworkFrame {
28
28
  this.data = data;
29
29
  this.events = new import_rettime.Emitter();
30
30
  }
31
+ protocol;
32
+ data;
31
33
  events;
32
34
  }
33
35
  //# sourceMappingURL=network-frame.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8C;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,uBAAQ;AAAA,EAC5B;AAAA,EAPO;AAwCT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8C;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,uBAAQ;AAAA,EAC5B;AAAA,EAJkB;AAAA,EACA;AAAA,EAJX;AAwCT;","names":[]}
@@ -5,6 +5,8 @@ class NetworkFrame {
5
5
  this.data = data;
6
6
  this.events = new Emitter();
7
7
  }
8
+ protocol;
9
+ data;
8
10
  events;
9
11
  }
10
12
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":"AAAA,SAAS,eAAqC;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,QAAQ;AAAA,EAC5B;AAAA,EAPO;AAwCT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/experimental/frames/network-frame.ts"],"sourcesContent":["import { Emitter, type DefaultEventMap } from 'rettime'\nimport type { AnyHandler, HandlersController } from '../handlers-controller'\nimport type { UnhandledFrameHandle } from '../on-unhandled-frame'\n\nexport type AnyNetworkFrame = NetworkFrame<string, unknown, any>\n\nexport type ExtractFrameEvents<Frame> =\n Frame extends NetworkFrame<any, any, infer Events> ? Events : never\n\nexport interface NetworkFrameResolutionContext {\n baseUrl?: string | URL\n quiet?: boolean\n}\n\n/**\n * The base for the network frames. Extend this abstract class\n * to implement custom network frames.\n */\nexport abstract class NetworkFrame<\n Protocol extends string,\n Data,\n Events extends DefaultEventMap,\n> {\n public events: Emitter<Events>\n\n constructor(\n public readonly protocol: Protocol,\n public readonly data: Data,\n ) {\n this.events = new Emitter()\n }\n\n public abstract getHandlers(controller: HandlersController): Array<AnyHandler>\n\n /**\n * Resolve the current frame against the given list of handlers.\n * Optionally, use a custom resolution context to control behaviors\n * like `baseUrl`.\n *\n * Returns `true` if the frame was handled, `false` if it wasn't, and `null`\n * if its handling was skipped (e.g. the frame was bypassed).\n */\n public abstract resolve(\n handlers: Array<AnyHandler>,\n onUnhandledFrame: UnhandledFrameHandle,\n resolutionContext?: NetworkFrameResolutionContext,\n ): Promise<boolean | null>\n\n /**\n * Perform this network frame as-is.\n */\n public abstract passthrough(): void\n\n /**\n * Error the underling network frame.\n * @param reason The reason for the error.\n */\n public abstract errorWith(reason?: unknown): void\n\n /**\n * Get a message to be used when this frame is unhandled.\n */\n public abstract getUnhandledMessage(): Promise<string>\n}\n"],"mappings":"AAAA,SAAS,eAAqC;AAkBvC,MAAe,aAIpB;AAAA,EAGA,YACkB,UACA,MAChB;AAFgB;AACA;AAEhB,SAAK,SAAS,IAAI,QAAQ;AAAA,EAC5B;AAAA,EAJkB;AAAA,EACA;AAAA,EAJX;AAwCT;","names":[]}
@@ -1,11 +1,11 @@
1
1
  import { TypedEvent } from 'rettime';
2
2
  import { WebSocketConnectionData } from '@mswjs/interceptors/WebSocket';
3
3
  import { WebSocketHandler } from '../../handlers/WebSocketHandler.mjs';
4
- import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-Cr1KOZ0I.mjs';
4
+ import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-gkokW4Rr.mjs';
5
5
  import { HandlersController, AnyHandler } from '../handlers-controller.mjs';
6
6
  import 'strict-event-emitter';
7
7
  import '../../utils/matching/matchRequestUrl.mjs';
8
- import '../../HttpResponse-CQwYpuKo.mjs';
8
+ import '../../HttpResponse-BE_Y2Ak9.mjs';
9
9
  import '@mswjs/interceptors';
10
10
  import '../../utils/internal/isIterable.mjs';
11
11
  import '../../typeUtils.mjs';
@@ -1,11 +1,11 @@
1
1
  import { TypedEvent } from 'rettime';
2
2
  import { WebSocketConnectionData } from '@mswjs/interceptors/WebSocket';
3
3
  import { WebSocketHandler } from '../../handlers/WebSocketHandler.js';
4
- import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-BBR-P3kV.js';
4
+ import { N as NetworkFrame, b as UnhandledFrameHandle, a as NetworkFrameResolutionContext } from '../../on-unhandled-frame-0KmwUmeV.js';
5
5
  import { HandlersController, AnyHandler } from '../handlers-controller.js';
6
6
  import 'strict-event-emitter';
7
7
  import '../../utils/matching/matchRequestUrl.js';
8
- import '../../HttpResponse-BFS34nkx.js';
8
+ import '../../HttpResponse-DL-P1EeG.js';
9
9
  import '@mswjs/interceptors';
10
10
  import '../../utils/internal/isIterable.js';
11
11
  import '../../typeUtils.js';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler } from '../HttpResponse-CQwYpuKo.mjs';
1
+ import { R as RequestHandler } from '../HttpResponse-BE_Y2Ak9.mjs';
2
2
  import { WebSocketHandler } from '../handlers/WebSocketHandler.mjs';
3
3
  import '@mswjs/interceptors';
4
4
  import '../utils/internal/isIterable.mjs';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler } from '../HttpResponse-BFS34nkx.js';
1
+ import { R as RequestHandler } from '../HttpResponse-DL-P1EeG.js';
2
2
  import { WebSocketHandler } from '../handlers/WebSocketHandler.js';
3
3
  import '@mswjs/interceptors';
4
4
  import '../utils/internal/isIterable.js';
@@ -1,14 +1,14 @@
1
1
  export { DefineNetworkOptions, NetworkApi, defineNetwork } from './define-network.mjs';
2
2
  export { NetworkSource } from './sources/network-source.mjs';
3
3
  export { InterceptorSource } from './sources/interceptor-source.mjs';
4
- export { N as NetworkFrame } from '../on-unhandled-frame-Cr1KOZ0I.mjs';
4
+ export { N as NetworkFrame } from '../on-unhandled-frame-gkokW4Rr.mjs';
5
5
  export { HttpNetworkFrame, HttpNetworkFrameEventMap } from './frames/http-frame.mjs';
6
6
  export { WebSocketNetworkFrame, WebSocketNetworkFrameEventMap } from './frames/websocket-frame.mjs';
7
7
  export { HandlersController, InMemoryHandlersController } from './handlers-controller.mjs';
8
8
  import 'rettime';
9
9
  import '@mswjs/interceptors';
10
10
  import '@mswjs/interceptors/WebSocket';
11
- import '../HttpResponse-CQwYpuKo.mjs';
11
+ import '../HttpResponse-BE_Y2Ak9.mjs';
12
12
  import '../utils/internal/isIterable.mjs';
13
13
  import '../typeUtils.mjs';
14
14
  import 'graphql';
@@ -1,14 +1,14 @@
1
1
  export { DefineNetworkOptions, NetworkApi, defineNetwork } from './define-network.js';
2
2
  export { NetworkSource } from './sources/network-source.js';
3
3
  export { InterceptorSource } from './sources/interceptor-source.js';
4
- export { N as NetworkFrame } from '../on-unhandled-frame-BBR-P3kV.js';
4
+ export { N as NetworkFrame } from '../on-unhandled-frame-0KmwUmeV.js';
5
5
  export { HttpNetworkFrame, HttpNetworkFrameEventMap } from './frames/http-frame.js';
6
6
  export { WebSocketNetworkFrame, WebSocketNetworkFrameEventMap } from './frames/websocket-frame.js';
7
7
  export { HandlersController, InMemoryHandlersController } from './handlers-controller.js';
8
8
  import 'rettime';
9
9
  import '@mswjs/interceptors';
10
10
  import '@mswjs/interceptors/WebSocket';
11
- import '../HttpResponse-BFS34nkx.js';
11
+ import '../HttpResponse-DL-P1EeG.js';
12
12
  import '../utils/internal/isIterable.js';
13
13
  import '../typeUtils.js';
14
14
  import 'graphql';
@@ -1,7 +1,7 @@
1
- export { U as UnhandledFrameCallback, d as UnhandledFrameDefaults, b as UnhandledFrameHandle, c as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-Cr1KOZ0I.mjs';
1
+ export { U as UnhandledFrameCallback, c as UnhandledFrameDefaults, b as UnhandledFrameHandle, d as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-gkokW4Rr.mjs';
2
2
  import 'rettime';
3
3
  import './handlers-controller.mjs';
4
- import '../HttpResponse-CQwYpuKo.mjs';
4
+ import '../HttpResponse-BE_Y2Ak9.mjs';
5
5
  import '@mswjs/interceptors';
6
6
  import '../utils/internal/isIterable.mjs';
7
7
  import '../typeUtils.mjs';
@@ -1,7 +1,7 @@
1
- export { U as UnhandledFrameCallback, d as UnhandledFrameDefaults, b as UnhandledFrameHandle, c as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-BBR-P3kV.js';
1
+ export { U as UnhandledFrameCallback, c as UnhandledFrameDefaults, b as UnhandledFrameHandle, d as UnhandledFrameStrategy, e as executeUnhandledFrameHandle } from '../on-unhandled-frame-0KmwUmeV.js';
2
2
  import 'rettime';
3
3
  import './handlers-controller.js';
4
- import '../HttpResponse-BFS34nkx.js';
4
+ import '../HttpResponse-DL-P1EeG.js';
5
5
  import '@mswjs/interceptors';
6
6
  import '../utils/internal/isIterable.js';
7
7
  import '../typeUtils.js';
@@ -3,7 +3,7 @@ import { LifeCycleEventEmitter } from '../sharedOptions.mjs';
3
3
  import { HandlersController, AnyHandler } from './handlers-controller.mjs';
4
4
  import { Disposable } from '../utils/internal/Disposable.mjs';
5
5
  import '../utils/request/onUnhandledRequest.mjs';
6
- import '../HttpResponse-CQwYpuKo.mjs';
6
+ import '../HttpResponse-BE_Y2Ak9.mjs';
7
7
  import '@mswjs/interceptors';
8
8
  import '../utils/internal/isIterable.mjs';
9
9
  import '../typeUtils.mjs';
@@ -3,7 +3,7 @@ import { LifeCycleEventEmitter } from '../sharedOptions.js';
3
3
  import { HandlersController, AnyHandler } from './handlers-controller.js';
4
4
  import { Disposable } from '../utils/internal/Disposable.js';
5
5
  import '../utils/request/onUnhandledRequest.js';
6
- import '../HttpResponse-BFS34nkx.js';
6
+ import '../HttpResponse-DL-P1EeG.js';
7
7
  import '@mswjs/interceptors';
8
8
  import '../utils/internal/isIterable.js';
9
9
  import '../typeUtils.js';
@@ -2,9 +2,9 @@ import { Interceptor, HttpRequestEventMap } from '@mswjs/interceptors';
2
2
  import { WebSocketEventMap } from '@mswjs/interceptors/WebSocket';
3
3
  import { NetworkSource } from './network-source.mjs';
4
4
  import 'rettime';
5
- import '../../on-unhandled-frame-Cr1KOZ0I.mjs';
5
+ import '../../on-unhandled-frame-gkokW4Rr.mjs';
6
6
  import '../handlers-controller.mjs';
7
- import '../../HttpResponse-CQwYpuKo.mjs';
7
+ import '../../HttpResponse-BE_Y2Ak9.mjs';
8
8
  import '../../utils/internal/isIterable.mjs';
9
9
  import '../../typeUtils.mjs';
10
10
  import 'graphql';
@@ -2,9 +2,9 @@ import { Interceptor, HttpRequestEventMap } from '@mswjs/interceptors';
2
2
  import { WebSocketEventMap } from '@mswjs/interceptors/WebSocket';
3
3
  import { NetworkSource } from './network-source.js';
4
4
  import 'rettime';
5
- import '../../on-unhandled-frame-BBR-P3kV.js';
5
+ import '../../on-unhandled-frame-0KmwUmeV.js';
6
6
  import '../handlers-controller.js';
7
- import '../../HttpResponse-BFS34nkx.js';
7
+ import '../../HttpResponse-DL-P1EeG.js';
8
8
  import '../../utils/internal/isIterable.js';
9
9
  import '../../typeUtils.js';
10
10
  import 'graphql';
@@ -1,7 +1,7 @@
1
1
  import { Emitter, TypedEvent, TypedListenerOptions } from 'rettime';
2
- import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-Cr1KOZ0I.mjs';
2
+ import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-gkokW4Rr.mjs';
3
3
  import '../handlers-controller.mjs';
4
- import '../../HttpResponse-CQwYpuKo.mjs';
4
+ import '../../HttpResponse-BE_Y2Ak9.mjs';
5
5
  import '@mswjs/interceptors';
6
6
  import '../../utils/internal/isIterable.mjs';
7
7
  import '../../typeUtils.mjs';
@@ -1,7 +1,7 @@
1
1
  import { Emitter, TypedEvent, TypedListenerOptions } from 'rettime';
2
- import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-BBR-P3kV.js';
2
+ import { A as AnyNetworkFrame, E as ExtractFrameEvents } from '../../on-unhandled-frame-0KmwUmeV.js';
3
3
  import '../handlers-controller.js';
4
- import '../../HttpResponse-BFS34nkx.js';
4
+ import '../../HttpResponse-DL-P1EeG.js';
5
5
  import '@mswjs/interceptors';
6
6
  import '../../utils/internal/isIterable.js';
7
7
  import '../../typeUtils.js';
@@ -1,4 +1,4 @@
1
- import { R as RequestHandler, m as ResponseResolutionContext } from './HttpResponse-CQwYpuKo.mjs';
1
+ import { R as RequestHandler, k as ResponseResolutionContext } from './HttpResponse-BE_Y2Ak9.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, m as ResponseResolutionContext } from './HttpResponse-BFS34nkx.js';
1
+ import { R as RequestHandler, k as ResponseResolutionContext } from './HttpResponse-DL-P1EeG.js';
2
2
  import '@mswjs/interceptors';
3
3
  import './utils/internal/isIterable.js';
4
4
  import './typeUtils.js';
@@ -1,4 +1,4 @@
1
- import { f as GraphQLQuery, g as GraphQLVariables, p as GraphQLPredicate, a as ResponseResolver, q as GraphQLResolverExtras, i as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-CQwYpuKo.mjs';
1
+ import { e as GraphQLQuery, h as GraphQLVariables, p as GraphQLPredicate, l as ResponseResolver, q as GraphQLResolverExtras, g as GraphQLResponseBody, j as RequestHandlerOptions, b as GraphQLHandler } from './HttpResponse-BE_Y2Ak9.mjs';
2
2
  import { Path } from './utils/matching/matchRequestUrl.mjs';
3
3
  import '@mswjs/interceptors';
4
4
  import './utils/internal/isIterable.mjs';
@@ -1,4 +1,4 @@
1
- import { f as GraphQLQuery, g as GraphQLVariables, p as GraphQLPredicate, a as ResponseResolver, q as GraphQLResolverExtras, i as GraphQLResponseBody, c as RequestHandlerOptions, G as GraphQLHandler } from './HttpResponse-BFS34nkx.js';
1
+ import { e as GraphQLQuery, h as GraphQLVariables, p as GraphQLPredicate, l as ResponseResolver, q as GraphQLResolverExtras, g as GraphQLResponseBody, j as RequestHandlerOptions, b as GraphQLHandler } from './HttpResponse-DL-P1EeG.js';
2
2
  import { Path } from './utils/matching/matchRequestUrl.js';
3
3
  import '@mswjs/interceptors';
4
4
  import './utils/internal/isIterable.js';