msw 0.44.2 → 0.45.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.
- package/lib/iife/index.js +14358 -5492
- package/lib/iife/index.js.map +1 -1
- package/lib/index.js +6 -9
- package/lib/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.js +2 -4
- package/lib/native/index.mjs +2 -6
- package/lib/node/index.js +2 -4
- package/lib/node/index.js.map +1 -1
- package/lib/node/index.mjs +2 -6
- package/lib/node/index.mjs.map +1 -1
- package/package.json +6 -2
package/lib/index.js
CHANGED
|
@@ -675,9 +675,6 @@ var getResponse = async (request, handlers, resolutionContext) => {
|
|
|
675
675
|
// src/utils/request/onUnhandledRequest.ts
|
|
676
676
|
var import_js_levenshtein = __toESM(require("js-levenshtein"));
|
|
677
677
|
|
|
678
|
-
// src/utils/internal/parseGraphQLRequest.ts
|
|
679
|
-
var import_graphql = require("graphql");
|
|
680
|
-
|
|
681
678
|
// src/utils/request/getPublicUrlFromRequest.ts
|
|
682
679
|
var getPublicUrlFromRequest = (request) => {
|
|
683
680
|
return request.referrer.startsWith(request.url.origin) ? request.url.pathname : new URL(request.url.pathname, `${request.url.protocol}//${request.url.host}`).href;
|
|
@@ -696,7 +693,8 @@ function parseDocumentNode(node) {
|
|
|
696
693
|
}
|
|
697
694
|
function parseQuery(query) {
|
|
698
695
|
try {
|
|
699
|
-
const
|
|
696
|
+
const { parse: parse3 } = require("graphql");
|
|
697
|
+
const ast = parse3(query);
|
|
700
698
|
return parseDocumentNode(ast);
|
|
701
699
|
} catch (error2) {
|
|
702
700
|
return error2;
|
|
@@ -1836,7 +1834,6 @@ var rest = {
|
|
|
1836
1834
|
};
|
|
1837
1835
|
|
|
1838
1836
|
// src/graphql.ts
|
|
1839
|
-
var import_graphql2 = require("graphql");
|
|
1840
1837
|
function createScopedGraphQLHandler(operationType, url) {
|
|
1841
1838
|
return (operationName, resolver) => {
|
|
1842
1839
|
return new GraphQLHandler(operationType, operationName, url, resolver);
|
|
@@ -1849,14 +1846,14 @@ function createGraphQLOperationHandler(url) {
|
|
|
1849
1846
|
}
|
|
1850
1847
|
var standardGraphQLHandlers = {
|
|
1851
1848
|
operation: createGraphQLOperationHandler("*"),
|
|
1852
|
-
query: createScopedGraphQLHandler(
|
|
1853
|
-
mutation: createScopedGraphQLHandler(
|
|
1849
|
+
query: createScopedGraphQLHandler("query", "*"),
|
|
1850
|
+
mutation: createScopedGraphQLHandler("mutation", "*")
|
|
1854
1851
|
};
|
|
1855
1852
|
function createGraphQLLink(url) {
|
|
1856
1853
|
return {
|
|
1857
1854
|
operation: createGraphQLOperationHandler(url),
|
|
1858
|
-
query: createScopedGraphQLHandler(
|
|
1859
|
-
mutation: createScopedGraphQLHandler(
|
|
1855
|
+
query: createScopedGraphQLHandler("query", url),
|
|
1856
|
+
mutation: createScopedGraphQLHandler("mutation", url)
|
|
1860
1857
|
};
|
|
1861
1858
|
}
|
|
1862
1859
|
var graphql = __spreadProps(__spreadValues({}, standardGraphQLHandlers), {
|