msw 2.2.7 → 2.2.8
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/README.md +1 -1
- package/lib/browser/index.js +0 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +0 -1
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/typeUtils.js.map +1 -1
- package/lib/core/utils/internal/mergeRight.js +15 -12
- package/lib/core/utils/internal/mergeRight.js.map +1 -1
- package/lib/core/utils/internal/mergeRight.mjs +15 -12
- package/lib/core/utils/internal/mergeRight.mjs.map +1 -1
- package/lib/iife/index.js +15 -13
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/src/browser/setupWorker/start/createResponseListener.ts +0 -2
- package/src/core/typeUtils.ts +10 -10
- package/src/core/utils/internal/mergeRight.ts +16 -13
package/lib/mockServiceWorker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.2.
|
|
11
|
+
const PACKAGE_VERSION = '2.2.8'
|
|
12
12
|
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
package/package.json
CHANGED
|
@@ -21,8 +21,6 @@ export function createResponseListener(context: SetupWorkerInternalContext) {
|
|
|
21
21
|
const request = context.requests.get(requestId)!
|
|
22
22
|
context.requests.delete(requestId)
|
|
23
23
|
|
|
24
|
-
console.log('RESPONSE LISTENER', responseJson, context.requests)
|
|
25
|
-
|
|
26
24
|
/**
|
|
27
25
|
* CORS requests with `mode: "no-cors"` result in "opaque" responses.
|
|
28
26
|
* That kind of responses cannot be manipulated in JavaScript due
|
package/src/core/typeUtils.ts
CHANGED
|
@@ -8,13 +8,13 @@ export type RequiredDeep<
|
|
|
8
8
|
> = Type extends Fn
|
|
9
9
|
? Type
|
|
10
10
|
: /**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
* @note The "Fn" type satisfies the predicate below.
|
|
12
|
+
* It must always come first, before the Record check.
|
|
13
|
+
*/
|
|
14
|
+
Type extends Record<string, any>
|
|
15
|
+
? {
|
|
16
|
+
[Key in keyof Type]-?: NonNullable<Type[Key]> extends NonNullable<U>
|
|
17
|
+
? NonNullable<Type[Key]>
|
|
18
|
+
: RequiredDeep<NonNullable<Type[Key]>, U>
|
|
19
|
+
}
|
|
20
|
+
: Type
|
|
@@ -8,20 +8,23 @@ export function mergeRight(
|
|
|
8
8
|
left: Record<string, any>,
|
|
9
9
|
right: Record<string, any>,
|
|
10
10
|
) {
|
|
11
|
-
return Object.entries(right).reduce(
|
|
12
|
-
|
|
11
|
+
return Object.entries(right).reduce(
|
|
12
|
+
(result, [key, rightValue]) => {
|
|
13
|
+
const leftValue = result[key]
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (Array.isArray(leftValue) && Array.isArray(rightValue)) {
|
|
16
|
+
result[key] = leftValue.concat(rightValue)
|
|
17
|
+
return result
|
|
18
|
+
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (isObject(leftValue) && isObject(rightValue)) {
|
|
21
|
+
result[key] = mergeRight(leftValue, rightValue)
|
|
22
|
+
return result
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
result[key] = rightValue
|
|
26
|
+
return result
|
|
27
|
+
},
|
|
28
|
+
Object.assign({}, left),
|
|
29
|
+
)
|
|
27
30
|
}
|