msw 0.48.2 → 0.48.3
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.
- package/lib/{SetupApi-75fbec12.d.ts → SetupApi-8ab693f7.d.ts} +1 -1
- package/lib/{SetupServerApi-49722346.d.ts → SetupServerApi-544775c7.d.ts} +2 -2
- package/lib/{glossary-a22f5c13.d.ts → glossary-afbab737.d.ts} +1 -1
- package/lib/iife/index.js +6 -6
- package/lib/iife/index.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +137 -8
- package/lib/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.d.ts +2 -2
- package/lib/native/index.js +137 -8
- package/lib/native/index.mjs +137 -8
- package/lib/node/index.d.ts +4 -4
- package/lib/node/index.js +137 -8
- package/lib/node/index.js.map +1 -1
- package/lib/node/index.mjs +137 -8
- package/lib/node/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -329,7 +329,7 @@ declare abstract class SetupApi<EventsMap extends EventMapType> {
|
|
|
329
329
|
protected readonly emitter: StrictEventEmitter<EventsMap>;
|
|
330
330
|
protected readonly publicEmitter: StrictEventEmitter<EventsMap>;
|
|
331
331
|
readonly events: LifeCycleEventEmitter<EventsMap>;
|
|
332
|
-
constructor(initialHandlers: Array<RequestHandler>);
|
|
332
|
+
constructor(...initialHandlers: Array<RequestHandler>);
|
|
333
333
|
private validateHandlers;
|
|
334
334
|
protected dispose(): void;
|
|
335
335
|
use(...runtimeHandlers: Array<RequestHandler>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IsomorphicResponse, BatchInterceptor, Interceptor, HttpRequestEventMap } from '@mswjs/interceptors';
|
|
2
|
-
import { J as LifeCycleEventsMap, S as SetupApi, b as RequestHandler, n as SharedOptions } from './SetupApi-
|
|
2
|
+
import { J as LifeCycleEventsMap, S as SetupApi, b as RequestHandler, n as SharedOptions } from './SetupApi-8ab693f7.js';
|
|
3
3
|
|
|
4
4
|
declare type ServerLifecycleEventsMap = LifeCycleEventsMap<IsomorphicResponse>;
|
|
5
5
|
declare class SetupServerApi extends SetupApi<ServerLifecycleEventsMap> {
|
|
@@ -7,7 +7,7 @@ declare class SetupServerApi extends SetupApi<ServerLifecycleEventsMap> {
|
|
|
7
7
|
private resolvedOptions;
|
|
8
8
|
constructor(interceptors: Array<{
|
|
9
9
|
new (): Interceptor<HttpRequestEventMap>;
|
|
10
|
-
}>, handlers: Array<RequestHandler>);
|
|
10
|
+
}>, ...handlers: Array<RequestHandler>);
|
|
11
11
|
/**
|
|
12
12
|
* Subscribe to all requests that are using the interceptor object
|
|
13
13
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PartialDeep } from 'type-fest';
|
|
2
2
|
import { IsomorphicResponse } from '@mswjs/interceptors';
|
|
3
|
-
import { n as SharedOptions, b as RequestHandler, k as RequestHandlerDefaultInfo, M as MockedRequest, g as DefaultBodyType, L as LifeCycleEventEmitter, J as LifeCycleEventsMap } from './SetupApi-
|
|
3
|
+
import { n as SharedOptions, b as RequestHandler, k as RequestHandlerDefaultInfo, M as MockedRequest, g as DefaultBodyType, L as LifeCycleEventEmitter, J as LifeCycleEventsMap } from './SetupApi-8ab693f7.js';
|
|
4
4
|
|
|
5
5
|
declare type ServerLifecycleEventsMap = LifeCycleEventsMap<IsomorphicResponse>;
|
|
6
6
|
interface SetupServerApi {
|
package/lib/iife/index.js
CHANGED
|
@@ -13111,8 +13111,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
13111
13111
|
|
|
13112
13112
|
// src/SetupApi.ts
|
|
13113
13113
|
var SetupApi = class {
|
|
13114
|
-
constructor(initialHandlers) {
|
|
13115
|
-
this.validateHandlers(initialHandlers);
|
|
13114
|
+
constructor(...initialHandlers) {
|
|
13115
|
+
this.validateHandlers(...initialHandlers);
|
|
13116
13116
|
this.initialHandlers = toReadonlyArray(initialHandlers);
|
|
13117
13117
|
this.currentHandlers = [...initialHandlers];
|
|
13118
13118
|
this.emitter = new import_strict_event_emitter.StrictEventEmitter();
|
|
@@ -13120,7 +13120,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
13120
13120
|
pipeEvents(this.emitter, this.publicEmitter);
|
|
13121
13121
|
this.events = this.createLifeCycleEvents();
|
|
13122
13122
|
}
|
|
13123
|
-
validateHandlers(handlers) {
|
|
13123
|
+
validateHandlers(...handlers) {
|
|
13124
13124
|
for (const handler of handlers) {
|
|
13125
13125
|
(0, import_outvariant3.invariant)(!Array.isArray(handler), devUtils.formatMessage('Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.'), this.constructor.name);
|
|
13126
13126
|
}
|
|
@@ -13160,8 +13160,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
13160
13160
|
|
|
13161
13161
|
// src/setupWorker/setupWorker.ts
|
|
13162
13162
|
var SetupWorkerApi = class extends SetupApi {
|
|
13163
|
-
constructor(handlers) {
|
|
13164
|
-
super(handlers);
|
|
13163
|
+
constructor(...handlers) {
|
|
13164
|
+
super(...handlers);
|
|
13165
13165
|
this.startHandler = null;
|
|
13166
13166
|
this.stopHandler = null;
|
|
13167
13167
|
(0, import_outvariant4.invariant)(!(0, import_is_node_process3.isNodeProcess)(), devUtils.formatMessage("Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead."));
|
|
@@ -13265,7 +13265,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
13265
13265
|
}
|
|
13266
13266
|
};
|
|
13267
13267
|
function setupWorker(...handlers) {
|
|
13268
|
-
return new SetupWorkerApi(handlers);
|
|
13268
|
+
return new SetupWorkerApi(...handlers);
|
|
13269
13269
|
}
|
|
13270
13270
|
|
|
13271
13271
|
// src/rest.ts
|