@depup/msw 2.12.13-depup.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/LICENSE.md +21 -0
- package/README.md +40 -0
- package/browser/package.json +31 -0
- package/changes.json +46 -0
- package/cli/index.js +35 -0
- package/cli/init.js +226 -0
- package/cli/invariant.js +9 -0
- package/cli/package.json +3 -0
- package/config/constants.js +13 -0
- package/config/package.json +3 -0
- package/config/scripts/postinstall.js +36 -0
- package/lib/browser/index.d.mts +102 -0
- package/lib/browser/index.d.ts +102 -0
- package/lib/browser/index.js +2911 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/index.mjs +2888 -0
- package/lib/browser/index.mjs.map +1 -0
- package/lib/core/HttpResponse-Be4eT3x6.d.mts +338 -0
- package/lib/core/HttpResponse-Dj6ibgFJ.d.ts +338 -0
- package/lib/core/HttpResponse.d.mts +6 -0
- package/lib/core/HttpResponse.d.ts +6 -0
- package/lib/core/HttpResponse.js +176 -0
- package/lib/core/HttpResponse.js.map +1 -0
- package/lib/core/HttpResponse.mjs +159 -0
- package/lib/core/HttpResponse.mjs.map +1 -0
- package/lib/core/SetupApi.d.mts +44 -0
- package/lib/core/SetupApi.d.ts +44 -0
- package/lib/core/SetupApi.js +112 -0
- package/lib/core/SetupApi.js.map +1 -0
- package/lib/core/SetupApi.mjs +92 -0
- package/lib/core/SetupApi.mjs.map +1 -0
- package/lib/core/bypass.d.mts +16 -0
- package/lib/core/bypass.d.ts +16 -0
- package/lib/core/bypass.js +42 -0
- package/lib/core/bypass.js.map +1 -0
- package/lib/core/bypass.mjs +22 -0
- package/lib/core/bypass.mjs.map +1 -0
- package/lib/core/delay.d.mts +18 -0
- package/lib/core/delay.d.ts +18 -0
- package/lib/core/delay.js +77 -0
- package/lib/core/delay.js.map +1 -0
- package/lib/core/delay.mjs +57 -0
- package/lib/core/delay.mjs.map +1 -0
- package/lib/core/getResponse.d.mts +18 -0
- package/lib/core/getResponse.d.ts +18 -0
- package/lib/core/getResponse.js +35 -0
- package/lib/core/getResponse.js.map +1 -0
- package/lib/core/getResponse.mjs +17 -0
- package/lib/core/getResponse.mjs.map +1 -0
- package/lib/core/graphql.d.mts +76 -0
- package/lib/core/graphql.d.ts +76 -0
- package/lib/core/graphql.js +90 -0
- package/lib/core/graphql.js.map +1 -0
- package/lib/core/graphql.mjs +72 -0
- package/lib/core/graphql.mjs.map +1 -0
- package/lib/core/handlers/GraphQLHandler.d.mts +6 -0
- package/lib/core/handlers/GraphQLHandler.d.ts +6 -0
- package/lib/core/handlers/GraphQLHandler.js +231 -0
- package/lib/core/handlers/GraphQLHandler.js.map +1 -0
- package/lib/core/handlers/GraphQLHandler.mjs +218 -0
- package/lib/core/handlers/GraphQLHandler.mjs.map +1 -0
- package/lib/core/handlers/HttpHandler.d.mts +75 -0
- package/lib/core/handlers/HttpHandler.d.ts +75 -0
- package/lib/core/handlers/HttpHandler.js +128 -0
- package/lib/core/handlers/HttpHandler.js.map +1 -0
- package/lib/core/handlers/HttpHandler.mjs +112 -0
- package/lib/core/handlers/HttpHandler.mjs.map +1 -0
- package/lib/core/handlers/RequestHandler.d.mts +6 -0
- package/lib/core/handlers/RequestHandler.d.ts +6 -0
- package/lib/core/handlers/RequestHandler.js +173 -0
- package/lib/core/handlers/RequestHandler.js.map +1 -0
- package/lib/core/handlers/RequestHandler.mjs +155 -0
- package/lib/core/handlers/RequestHandler.mjs.map +1 -0
- package/lib/core/handlers/WebSocketHandler.d.mts +42 -0
- package/lib/core/handlers/WebSocketHandler.d.ts +42 -0
- package/lib/core/handlers/WebSocketHandler.js +147 -0
- package/lib/core/handlers/WebSocketHandler.js.map +1 -0
- package/lib/core/handlers/WebSocketHandler.mjs +129 -0
- package/lib/core/handlers/WebSocketHandler.mjs.map +1 -0
- package/lib/core/handlers/common.d.mts +3 -0
- package/lib/core/handlers/common.d.ts +3 -0
- package/lib/core/handlers/common.js +17 -0
- package/lib/core/handlers/common.js.map +1 -0
- package/lib/core/handlers/common.mjs +1 -0
- package/lib/core/handlers/common.mjs.map +1 -0
- package/lib/core/http.d.mts +31 -0
- package/lib/core/http.d.ts +31 -0
- package/lib/core/http.js +40 -0
- package/lib/core/http.js.map +1 -0
- package/lib/core/http.mjs +23 -0
- package/lib/core/http.mjs.map +1 -0
- package/lib/core/index.d.mts +32 -0
- package/lib/core/index.d.ts +32 -0
- package/lib/core/index.js +64 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/index.mjs +52 -0
- package/lib/core/index.mjs.map +1 -0
- package/lib/core/isCommonAssetRequest.d.mts +20 -0
- package/lib/core/isCommonAssetRequest.d.ts +20 -0
- package/lib/core/isCommonAssetRequest.js +42 -0
- package/lib/core/isCommonAssetRequest.js.map +1 -0
- package/lib/core/isCommonAssetRequest.mjs +22 -0
- package/lib/core/isCommonAssetRequest.mjs.map +1 -0
- package/lib/core/passthrough.d.mts +24 -0
- package/lib/core/passthrough.d.ts +24 -0
- package/lib/core/passthrough.js +33 -0
- package/lib/core/passthrough.js.map +1 -0
- package/lib/core/passthrough.mjs +13 -0
- package/lib/core/passthrough.mjs.map +1 -0
- package/lib/core/sharedOptions.d.mts +64 -0
- package/lib/core/sharedOptions.d.ts +64 -0
- package/lib/core/sharedOptions.js +17 -0
- package/lib/core/sharedOptions.js.map +1 -0
- package/lib/core/sharedOptions.mjs +1 -0
- package/lib/core/sharedOptions.mjs.map +1 -0
- package/lib/core/sse.d.mts +116 -0
- package/lib/core/sse.d.ts +116 -0
- package/lib/core/sse.js +607 -0
- package/lib/core/sse.js.map +1 -0
- package/lib/core/sse.mjs +589 -0
- package/lib/core/sse.mjs.map +1 -0
- package/lib/core/typeUtils.d.mts +12 -0
- package/lib/core/typeUtils.d.ts +12 -0
- package/lib/core/typeUtils.js +17 -0
- package/lib/core/typeUtils.js.map +1 -0
- package/lib/core/typeUtils.mjs +1 -0
- package/lib/core/typeUtils.mjs.map +1 -0
- package/lib/core/utils/HttpResponse/decorators.d.mts +17 -0
- package/lib/core/utils/HttpResponse/decorators.d.ts +17 -0
- package/lib/core/utils/HttpResponse/decorators.js +77 -0
- package/lib/core/utils/HttpResponse/decorators.js.map +1 -0
- package/lib/core/utils/HttpResponse/decorators.mjs +47 -0
- package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -0
- package/lib/core/utils/cookieStore.d.mts +13 -0
- package/lib/core/utils/cookieStore.d.ts +13 -0
- package/lib/core/utils/cookieStore.js +90 -0
- package/lib/core/utils/cookieStore.js.map +1 -0
- package/lib/core/utils/cookieStore.mjs +74 -0
- package/lib/core/utils/cookieStore.mjs.map +1 -0
- package/lib/core/utils/executeHandlers.d.mts +6 -0
- package/lib/core/utils/executeHandlers.d.ts +6 -0
- package/lib/core/utils/executeHandlers.js +50 -0
- package/lib/core/utils/executeHandlers.js.map +1 -0
- package/lib/core/utils/executeHandlers.mjs +30 -0
- package/lib/core/utils/executeHandlers.mjs.map +1 -0
- package/lib/core/utils/handleRequest.d.mts +29 -0
- package/lib/core/utils/handleRequest.d.ts +29 -0
- package/lib/core/utils/handleRequest.js +76 -0
- package/lib/core/utils/handleRequest.js.map +1 -0
- package/lib/core/utils/handleRequest.mjs +58 -0
- package/lib/core/utils/handleRequest.mjs.map +1 -0
- package/lib/core/utils/internal/Disposable.d.mts +7 -0
- package/lib/core/utils/internal/Disposable.d.ts +7 -0
- package/lib/core/utils/internal/Disposable.js +33 -0
- package/lib/core/utils/internal/Disposable.js.map +1 -0
- package/lib/core/utils/internal/Disposable.mjs +13 -0
- package/lib/core/utils/internal/Disposable.mjs.map +1 -0
- package/lib/core/utils/internal/checkGlobals.d.mts +3 -0
- package/lib/core/utils/internal/checkGlobals.d.ts +3 -0
- package/lib/core/utils/internal/checkGlobals.js +34 -0
- package/lib/core/utils/internal/checkGlobals.js.map +1 -0
- package/lib/core/utils/internal/checkGlobals.mjs +14 -0
- package/lib/core/utils/internal/checkGlobals.mjs.map +1 -0
- package/lib/core/utils/internal/devUtils.d.mts +28 -0
- package/lib/core/utils/internal/devUtils.d.ts +28 -0
- package/lib/core/utils/internal/devUtils.js +48 -0
- package/lib/core/utils/internal/devUtils.js.map +1 -0
- package/lib/core/utils/internal/devUtils.mjs +28 -0
- package/lib/core/utils/internal/devUtils.mjs.map +1 -0
- package/lib/core/utils/internal/getCallFrame.d.mts +6 -0
- package/lib/core/utils/internal/getCallFrame.d.ts +6 -0
- package/lib/core/utils/internal/getCallFrame.js +41 -0
- package/lib/core/utils/internal/getCallFrame.js.map +1 -0
- package/lib/core/utils/internal/getCallFrame.mjs +21 -0
- package/lib/core/utils/internal/getCallFrame.mjs.map +1 -0
- package/lib/core/utils/internal/hasRefCounted.d.mts +3 -0
- package/lib/core/utils/internal/hasRefCounted.d.ts +3 -0
- package/lib/core/utils/internal/hasRefCounted.js +27 -0
- package/lib/core/utils/internal/hasRefCounted.js.map +1 -0
- package/lib/core/utils/internal/hasRefCounted.mjs +7 -0
- package/lib/core/utils/internal/hasRefCounted.mjs.map +1 -0
- package/lib/core/utils/internal/isHandlerKind.d.mts +19 -0
- package/lib/core/utils/internal/isHandlerKind.d.ts +19 -0
- package/lib/core/utils/internal/isHandlerKind.js +29 -0
- package/lib/core/utils/internal/isHandlerKind.js.map +1 -0
- package/lib/core/utils/internal/isHandlerKind.mjs +9 -0
- package/lib/core/utils/internal/isHandlerKind.mjs.map +1 -0
- package/lib/core/utils/internal/isIterable.d.mts +20 -0
- package/lib/core/utils/internal/isIterable.d.ts +20 -0
- package/lib/core/utils/internal/isIterable.js +30 -0
- package/lib/core/utils/internal/isIterable.js.map +1 -0
- package/lib/core/utils/internal/isIterable.mjs +10 -0
- package/lib/core/utils/internal/isIterable.mjs.map +1 -0
- package/lib/core/utils/internal/isObject.d.mts +6 -0
- package/lib/core/utils/internal/isObject.d.ts +6 -0
- package/lib/core/utils/internal/isObject.js +27 -0
- package/lib/core/utils/internal/isObject.js.map +1 -0
- package/lib/core/utils/internal/isObject.mjs +7 -0
- package/lib/core/utils/internal/isObject.mjs.map +1 -0
- package/lib/core/utils/internal/isStringEqual.d.mts +6 -0
- package/lib/core/utils/internal/isStringEqual.d.ts +6 -0
- package/lib/core/utils/internal/isStringEqual.js +27 -0
- package/lib/core/utils/internal/isStringEqual.js.map +1 -0
- package/lib/core/utils/internal/isStringEqual.mjs +7 -0
- package/lib/core/utils/internal/isStringEqual.mjs.map +1 -0
- package/lib/core/utils/internal/jsonParse.d.mts +7 -0
- package/lib/core/utils/internal/jsonParse.d.ts +7 -0
- package/lib/core/utils/internal/jsonParse.js +31 -0
- package/lib/core/utils/internal/jsonParse.js.map +1 -0
- package/lib/core/utils/internal/jsonParse.mjs +11 -0
- package/lib/core/utils/internal/jsonParse.mjs.map +1 -0
- package/lib/core/utils/internal/mergeRight.d.mts +7 -0
- package/lib/core/utils/internal/mergeRight.d.ts +7 -0
- package/lib/core/utils/internal/mergeRight.js +43 -0
- package/lib/core/utils/internal/mergeRight.js.map +1 -0
- package/lib/core/utils/internal/mergeRight.mjs +23 -0
- package/lib/core/utils/internal/mergeRight.mjs.map +1 -0
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +6 -0
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +6 -0
- package/lib/core/utils/internal/parseGraphQLRequest.js +146 -0
- package/lib/core/utils/internal/parseGraphQLRequest.js.map +1 -0
- package/lib/core/utils/internal/parseGraphQLRequest.mjs +129 -0
- package/lib/core/utils/internal/parseGraphQLRequest.mjs.map +1 -0
- package/lib/core/utils/internal/parseMultipartData.d.mts +14 -0
- package/lib/core/utils/internal/parseMultipartData.d.ts +14 -0
- package/lib/core/utils/internal/parseMultipartData.js +83 -0
- package/lib/core/utils/internal/parseMultipartData.js.map +1 -0
- package/lib/core/utils/internal/parseMultipartData.mjs +63 -0
- package/lib/core/utils/internal/parseMultipartData.mjs.map +1 -0
- package/lib/core/utils/internal/pipeEvents.d.mts +8 -0
- package/lib/core/utils/internal/pipeEvents.d.ts +8 -0
- package/lib/core/utils/internal/pipeEvents.js +36 -0
- package/lib/core/utils/internal/pipeEvents.js.map +1 -0
- package/lib/core/utils/internal/pipeEvents.mjs +16 -0
- package/lib/core/utils/internal/pipeEvents.mjs.map +1 -0
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +12 -0
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +12 -0
- package/lib/core/utils/internal/requestHandlerUtils.js +37 -0
- package/lib/core/utils/internal/requestHandlerUtils.js.map +1 -0
- package/lib/core/utils/internal/requestHandlerUtils.mjs +17 -0
- package/lib/core/utils/internal/requestHandlerUtils.mjs.map +1 -0
- package/lib/core/utils/internal/toReadonlyArray.d.mts +6 -0
- package/lib/core/utils/internal/toReadonlyArray.d.ts +6 -0
- package/lib/core/utils/internal/toReadonlyArray.js +29 -0
- package/lib/core/utils/internal/toReadonlyArray.js.map +1 -0
- package/lib/core/utils/internal/toReadonlyArray.mjs +9 -0
- package/lib/core/utils/internal/toReadonlyArray.mjs.map +1 -0
- package/lib/core/utils/internal/tryCatch.d.mts +3 -0
- package/lib/core/utils/internal/tryCatch.d.ts +3 -0
- package/lib/core/utils/internal/tryCatch.js +32 -0
- package/lib/core/utils/internal/tryCatch.js.map +1 -0
- package/lib/core/utils/internal/tryCatch.mjs +12 -0
- package/lib/core/utils/internal/tryCatch.mjs.map +1 -0
- package/lib/core/utils/logging/getStatusCodeColor.d.mts +11 -0
- package/lib/core/utils/logging/getStatusCodeColor.d.ts +11 -0
- package/lib/core/utils/logging/getStatusCodeColor.js +40 -0
- package/lib/core/utils/logging/getStatusCodeColor.js.map +1 -0
- package/lib/core/utils/logging/getStatusCodeColor.mjs +20 -0
- package/lib/core/utils/logging/getStatusCodeColor.mjs.map +1 -0
- package/lib/core/utils/logging/getTimestamp.d.mts +9 -0
- package/lib/core/utils/logging/getTimestamp.d.ts +9 -0
- package/lib/core/utils/logging/getTimestamp.js +32 -0
- package/lib/core/utils/logging/getTimestamp.js.map +1 -0
- package/lib/core/utils/logging/getTimestamp.mjs +12 -0
- package/lib/core/utils/logging/getTimestamp.mjs.map +1 -0
- package/lib/core/utils/logging/serializeRequest.d.mts +12 -0
- package/lib/core/utils/logging/serializeRequest.d.ts +12 -0
- package/lib/core/utils/logging/serializeRequest.js +34 -0
- package/lib/core/utils/logging/serializeRequest.js.map +1 -0
- package/lib/core/utils/logging/serializeRequest.mjs +14 -0
- package/lib/core/utils/logging/serializeRequest.mjs.map +1 -0
- package/lib/core/utils/logging/serializeResponse.d.mts +9 -0
- package/lib/core/utils/logging/serializeResponse.d.ts +9 -0
- package/lib/core/utils/logging/serializeResponse.js +48 -0
- package/lib/core/utils/logging/serializeResponse.js.map +1 -0
- package/lib/core/utils/logging/serializeResponse.mjs +18 -0
- package/lib/core/utils/logging/serializeResponse.mjs.map +1 -0
- package/lib/core/utils/matching/matchRequestUrl.d.mts +20 -0
- package/lib/core/utils/matching/matchRequestUrl.d.ts +20 -0
- package/lib/core/utils/matching/matchRequestUrl.js +55 -0
- package/lib/core/utils/matching/matchRequestUrl.js.map +1 -0
- package/lib/core/utils/matching/matchRequestUrl.mjs +35 -0
- package/lib/core/utils/matching/matchRequestUrl.mjs.map +1 -0
- package/lib/core/utils/matching/normalizePath.d.mts +13 -0
- package/lib/core/utils/matching/normalizePath.d.ts +13 -0
- package/lib/core/utils/matching/normalizePath.js +33 -0
- package/lib/core/utils/matching/normalizePath.js.map +1 -0
- package/lib/core/utils/matching/normalizePath.mjs +13 -0
- package/lib/core/utils/matching/normalizePath.mjs.map +1 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.d.mts +14 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.d.ts +14 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.js +61 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.js.map +1 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs +41 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs.map +1 -0
- package/lib/core/utils/request/getRequestCookies.d.mts +3 -0
- package/lib/core/utils/request/getRequestCookies.d.ts +3 -0
- package/lib/core/utils/request/getRequestCookies.js +79 -0
- package/lib/core/utils/request/getRequestCookies.js.map +1 -0
- package/lib/core/utils/request/getRequestCookies.mjs +62 -0
- package/lib/core/utils/request/getRequestCookies.mjs.map +1 -0
- package/lib/core/utils/request/onUnhandledRequest.d.mts +9 -0
- package/lib/core/utils/request/onUnhandledRequest.d.ts +9 -0
- package/lib/core/utils/request/onUnhandledRequest.js +76 -0
- package/lib/core/utils/request/onUnhandledRequest.js.map +1 -0
- package/lib/core/utils/request/onUnhandledRequest.mjs +56 -0
- package/lib/core/utils/request/onUnhandledRequest.mjs.map +1 -0
- package/lib/core/utils/request/storeResponseCookies.d.mts +3 -0
- package/lib/core/utils/request/storeResponseCookies.d.ts +3 -0
- package/lib/core/utils/request/storeResponseCookies.js +32 -0
- package/lib/core/utils/request/storeResponseCookies.js.map +1 -0
- package/lib/core/utils/request/storeResponseCookies.mjs +12 -0
- package/lib/core/utils/request/storeResponseCookies.mjs.map +1 -0
- package/lib/core/utils/request/toPublicUrl.d.mts +7 -0
- package/lib/core/utils/request/toPublicUrl.d.ts +7 -0
- package/lib/core/utils/request/toPublicUrl.js +31 -0
- package/lib/core/utils/request/toPublicUrl.js.map +1 -0
- package/lib/core/utils/request/toPublicUrl.mjs +11 -0
- package/lib/core/utils/request/toPublicUrl.mjs.map +1 -0
- package/lib/core/utils/toResponseInit.d.mts +3 -0
- package/lib/core/utils/toResponseInit.d.ts +3 -0
- package/lib/core/utils/toResponseInit.js +31 -0
- package/lib/core/utils/toResponseInit.js.map +1 -0
- package/lib/core/utils/toResponseInit.mjs +11 -0
- package/lib/core/utils/toResponseInit.mjs.map +1 -0
- package/lib/core/utils/url/cleanUrl.d.mts +7 -0
- package/lib/core/utils/url/cleanUrl.d.ts +7 -0
- package/lib/core/utils/url/cleanUrl.js +31 -0
- package/lib/core/utils/url/cleanUrl.js.map +1 -0
- package/lib/core/utils/url/cleanUrl.mjs +11 -0
- package/lib/core/utils/url/cleanUrl.mjs.map +1 -0
- package/lib/core/utils/url/getAbsoluteUrl.d.mts +6 -0
- package/lib/core/utils/url/getAbsoluteUrl.d.ts +6 -0
- package/lib/core/utils/url/getAbsoluteUrl.js +38 -0
- package/lib/core/utils/url/getAbsoluteUrl.js.map +1 -0
- package/lib/core/utils/url/getAbsoluteUrl.mjs +18 -0
- package/lib/core/utils/url/getAbsoluteUrl.mjs.map +1 -0
- package/lib/core/utils/url/isAbsoluteUrl.d.mts +6 -0
- package/lib/core/utils/url/isAbsoluteUrl.d.ts +6 -0
- package/lib/core/utils/url/isAbsoluteUrl.js +27 -0
- package/lib/core/utils/url/isAbsoluteUrl.js.map +1 -0
- package/lib/core/utils/url/isAbsoluteUrl.mjs +7 -0
- package/lib/core/utils/url/isAbsoluteUrl.mjs.map +1 -0
- package/lib/core/ws/WebSocketClientManager.d.mts +65 -0
- package/lib/core/ws/WebSocketClientManager.d.ts +65 -0
- package/lib/core/ws/WebSocketClientManager.js +159 -0
- package/lib/core/ws/WebSocketClientManager.js.map +1 -0
- package/lib/core/ws/WebSocketClientManager.mjs +139 -0
- package/lib/core/ws/WebSocketClientManager.mjs.map +1 -0
- package/lib/core/ws/WebSocketClientStore.d.mts +13 -0
- package/lib/core/ws/WebSocketClientStore.d.ts +13 -0
- package/lib/core/ws/WebSocketClientStore.js +26 -0
- package/lib/core/ws/WebSocketClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketClientStore.mjs +6 -0
- package/lib/core/ws/WebSocketClientStore.mjs.map +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.mts +14 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.ts +14 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.js +130 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs +110 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs.map +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.d.mts +12 -0
- package/lib/core/ws/WebSocketMemoryClientStore.d.ts +12 -0
- package/lib/core/ws/WebSocketMemoryClientStore.js +41 -0
- package/lib/core/ws/WebSocketMemoryClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.mjs +21 -0
- package/lib/core/ws/WebSocketMemoryClientStore.mjs.map +1 -0
- package/lib/core/ws/handleWebSocketEvent.d.mts +20 -0
- package/lib/core/ws/handleWebSocketEvent.d.ts +20 -0
- package/lib/core/ws/handleWebSocketEvent.js +61 -0
- package/lib/core/ws/handleWebSocketEvent.js.map +1 -0
- package/lib/core/ws/handleWebSocketEvent.mjs +43 -0
- package/lib/core/ws/handleWebSocketEvent.mjs.map +1 -0
- package/lib/core/ws/utils/attachWebSocketLogger.d.mts +18 -0
- package/lib/core/ws/utils/attachWebSocketLogger.d.ts +18 -0
- package/lib/core/ws/utils/attachWebSocketLogger.js +199 -0
- package/lib/core/ws/utils/attachWebSocketLogger.js.map +1 -0
- package/lib/core/ws/utils/attachWebSocketLogger.mjs +179 -0
- package/lib/core/ws/utils/attachWebSocketLogger.mjs.map +1 -0
- package/lib/core/ws/utils/getMessageLength.d.mts +11 -0
- package/lib/core/ws/utils/getMessageLength.d.ts +11 -0
- package/lib/core/ws/utils/getMessageLength.js +34 -0
- package/lib/core/ws/utils/getMessageLength.js.map +1 -0
- package/lib/core/ws/utils/getMessageLength.mjs +14 -0
- package/lib/core/ws/utils/getMessageLength.mjs.map +1 -0
- package/lib/core/ws/utils/getPublicData.d.mts +5 -0
- package/lib/core/ws/utils/getPublicData.d.ts +5 -0
- package/lib/core/ws/utils/getPublicData.js +37 -0
- package/lib/core/ws/utils/getPublicData.js.map +1 -0
- package/lib/core/ws/utils/getPublicData.mjs +17 -0
- package/lib/core/ws/utils/getPublicData.mjs.map +1 -0
- package/lib/core/ws/utils/truncateMessage.d.mts +3 -0
- package/lib/core/ws/utils/truncateMessage.d.ts +3 -0
- package/lib/core/ws/utils/truncateMessage.js +31 -0
- package/lib/core/ws/utils/truncateMessage.js.map +1 -0
- package/lib/core/ws/utils/truncateMessage.mjs +11 -0
- package/lib/core/ws/utils/truncateMessage.mjs.map +1 -0
- package/lib/core/ws/webSocketInterceptor.d.mts +5 -0
- package/lib/core/ws/webSocketInterceptor.d.ts +5 -0
- package/lib/core/ws/webSocketInterceptor.js +26 -0
- package/lib/core/ws/webSocketInterceptor.js.map +1 -0
- package/lib/core/ws/webSocketInterceptor.mjs +6 -0
- package/lib/core/ws/webSocketInterceptor.mjs.map +1 -0
- package/lib/core/ws.d.mts +75 -0
- package/lib/core/ws.d.ts +75 -0
- package/lib/core/ws.js +69 -0
- package/lib/core/ws.js.map +1 -0
- package/lib/core/ws.mjs +52 -0
- package/lib/core/ws.mjs.map +1 -0
- package/lib/iife/index.js +23752 -0
- package/lib/iife/index.js.map +1 -0
- package/lib/mockServiceWorker.js +349 -0
- package/lib/native/index.d.mts +74 -0
- package/lib/native/index.d.ts +74 -0
- package/lib/native/index.js +156 -0
- package/lib/native/index.js.map +1 -0
- package/lib/native/index.mjs +134 -0
- package/lib/native/index.mjs.map +1 -0
- package/lib/node/index.d.mts +91 -0
- package/lib/node/index.d.ts +91 -0
- package/lib/node/index.js +209 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/index.mjs +184 -0
- package/lib/node/index.mjs.map +1 -0
- package/lib/shims/cookie.d.mts +7 -0
- package/lib/shims/cookie.d.ts +7 -0
- package/lib/shims/cookie.js +204 -0
- package/lib/shims/cookie.mjs +196 -0
- package/lib/shims/statuses.d.mts +6 -0
- package/lib/shims/statuses.d.ts +6 -0
- package/lib/shims/statuses.js +195 -0
- package/lib/shims/statuses.mjs +187 -0
- package/native/package.json +30 -0
- package/node/package.json +33 -0
- package/package.json +381 -0
- package/src/browser/global.browser.d.ts +1 -0
- package/src/browser/index.ts +3 -0
- package/src/browser/setupWorker/glossary.ts +138 -0
- package/src/browser/setupWorker/setupWorker.node.test.ts +10 -0
- package/src/browser/setupWorker/setupWorker.ts +184 -0
- package/src/browser/setupWorker/start/createFallbackRequestListener.ts +71 -0
- package/src/browser/setupWorker/start/createRequestListener.ts +138 -0
- package/src/browser/setupWorker/start/createResponseListener.ts +57 -0
- package/src/browser/setupWorker/start/createStartHandler.ts +137 -0
- package/src/browser/setupWorker/start/utils/enableMocking.ts +30 -0
- package/src/browser/setupWorker/start/utils/getWorkerByRegistration.ts +25 -0
- package/src/browser/setupWorker/start/utils/getWorkerInstance.ts +97 -0
- package/src/browser/setupWorker/start/utils/prepareStartHandler.test.ts +59 -0
- package/src/browser/setupWorker/start/utils/prepareStartHandler.ts +44 -0
- package/src/browser/setupWorker/start/utils/printStartMessage.test.ts +84 -0
- package/src/browser/setupWorker/start/utils/printStartMessage.ts +51 -0
- package/src/browser/setupWorker/start/utils/validateWorkerScope.ts +18 -0
- package/src/browser/setupWorker/stop/utils/printStopMessage.test.ts +26 -0
- package/src/browser/setupWorker/stop/utils/printStopMessage.ts +13 -0
- package/src/browser/tsconfig.browser.build.json +6 -0
- package/src/browser/tsconfig.browser.json +9 -0
- package/src/browser/utils/checkWorkerIntegrity.ts +42 -0
- package/src/browser/utils/deserializeRequest.ts +15 -0
- package/src/browser/utils/getAbsoluteWorkerUrl.test.ts +29 -0
- package/src/browser/utils/getAbsoluteWorkerUrl.ts +7 -0
- package/src/browser/utils/pruneGetRequestBody.test.ts +53 -0
- package/src/browser/utils/pruneGetRequestBody.ts +21 -0
- package/src/browser/utils/supports.ts +30 -0
- package/src/browser/utils/workerChannel.ts +159 -0
- package/src/core/HttpResponse.test.ts +378 -0
- package/src/core/HttpResponse.ts +248 -0
- package/src/core/SetupApi.ts +127 -0
- package/src/core/bypass.test.ts +80 -0
- package/src/core/bypass.ts +46 -0
- package/src/core/delay.ts +82 -0
- package/src/core/getResponse.test.ts +74 -0
- package/src/core/getResponse.ts +29 -0
- package/src/core/graphql.test.ts +11 -0
- package/src/core/graphql.ts +136 -0
- package/src/core/handlers/GraphQLHandler.test.ts +873 -0
- package/src/core/handlers/GraphQLHandler.ts +437 -0
- package/src/core/handlers/HttpHandler.test.ts +253 -0
- package/src/core/handlers/HttpHandler.ts +214 -0
- package/src/core/handlers/RequestHandler.ts +391 -0
- package/src/core/handlers/WebSocketHandler.test.ts +127 -0
- package/src/core/handlers/WebSocketHandler.ts +209 -0
- package/src/core/handlers/common.ts +1 -0
- package/src/core/http.test.ts +15 -0
- package/src/core/http.ts +64 -0
- package/src/core/index.ts +110 -0
- package/src/core/isCommonAssetRequest.ts +45 -0
- package/src/core/passthrough.test.ts +11 -0
- package/src/core/passthrough.ts +25 -0
- package/src/core/sharedOptions.ts +66 -0
- package/src/core/sse.ts +916 -0
- package/src/core/typeUtils.ts +26 -0
- package/src/core/utils/HttpResponse/decorators.ts +76 -0
- package/src/core/utils/cookieStore.ts +94 -0
- package/src/core/utils/executeHandlers.ts +69 -0
- package/src/core/utils/handleRequest.test.ts +573 -0
- package/src/core/utils/handleRequest.ts +117 -0
- package/src/core/utils/internal/Disposable.ts +12 -0
- package/src/core/utils/internal/checkGlobals.ts +17 -0
- package/src/core/utils/internal/devUtils.test.ts +21 -0
- package/src/core/utils/internal/devUtils.ts +44 -0
- package/src/core/utils/internal/getCallFrame.test.ts +154 -0
- package/src/core/utils/internal/getCallFrame.ts +35 -0
- package/src/core/utils/internal/hasRefCounted.test.ts +16 -0
- package/src/core/utils/internal/hasRefCounted.ts +8 -0
- package/src/core/utils/internal/isHandlerKind.test.ts +64 -0
- package/src/core/utils/internal/isHandlerKind.ts +21 -0
- package/src/core/utils/internal/isIterable.test.ts +23 -0
- package/src/core/utils/internal/isIterable.ts +32 -0
- package/src/core/utils/internal/isObject.test.ts +20 -0
- package/src/core/utils/internal/isObject.ts +6 -0
- package/src/core/utils/internal/isStringEqual.test.ts +45 -0
- package/src/core/utils/internal/isStringEqual.ts +6 -0
- package/src/core/utils/internal/jsonParse.test.ts +13 -0
- package/src/core/utils/internal/jsonParse.ts +13 -0
- package/src/core/utils/internal/mergeRight.test.ts +43 -0
- package/src/core/utils/internal/mergeRight.ts +30 -0
- package/src/core/utils/internal/parseGraphQLRequest.test.ts +99 -0
- package/src/core/utils/internal/parseGraphQLRequest.ts +214 -0
- package/src/core/utils/internal/parseMultipartData.test.ts +76 -0
- package/src/core/utils/internal/parseMultipartData.ts +106 -0
- package/src/core/utils/internal/pipeEvents.test.ts +14 -0
- package/src/core/utils/internal/pipeEvents.ts +25 -0
- package/src/core/utils/internal/requestHandlerUtils.ts +21 -0
- package/src/core/utils/internal/toReadonlyArray.test.ts +30 -0
- package/src/core/utils/internal/toReadonlyArray.ts +8 -0
- package/src/core/utils/internal/tryCatch.test.ts +29 -0
- package/src/core/utils/internal/tryCatch.ts +11 -0
- package/src/core/utils/logging/getStatusCodeColor.test.ts +22 -0
- package/src/core/utils/logging/getStatusCodeColor.ts +20 -0
- package/src/core/utils/logging/getTimestamp.test.ts +32 -0
- package/src/core/utils/logging/getTimestamp.ts +17 -0
- package/src/core/utils/logging/serializeRequest.test.ts +23 -0
- package/src/core/utils/logging/serializeRequest.ts +23 -0
- package/src/core/utils/logging/serializeResponse.test.ts +77 -0
- package/src/core/utils/logging/serializeResponse.ts +31 -0
- package/src/core/utils/matching/matchRequestUrl.test.ts +183 -0
- package/src/core/utils/matching/matchRequestUrl.ts +77 -0
- package/src/core/utils/matching/normalizePath.node.test.ts +44 -0
- package/src/core/utils/matching/normalizePath.test.ts +56 -0
- package/src/core/utils/matching/normalizePath.ts +22 -0
- package/src/core/utils/request/getAllAcceptedMimeTypes.test.ts +86 -0
- package/src/core/utils/request/getAllAcceptedMimeTypes.ts +70 -0
- package/src/core/utils/request/getRequestCookies.ts +88 -0
- package/src/core/utils/request/onUnhandledRequest.node.test.ts +62 -0
- package/src/core/utils/request/onUnhandledRequest.test.ts +228 -0
- package/src/core/utils/request/onUnhandledRequest.ts +81 -0
- package/src/core/utils/request/storeResponseCookies.ts +17 -0
- package/src/core/utils/request/toPublicUrl.node.test.ts +17 -0
- package/src/core/utils/request/toPublicUrl.test.ts +16 -0
- package/src/core/utils/request/toPublicUrl.ts +16 -0
- package/src/core/utils/toResponseInit.ts +7 -0
- package/src/core/utils/url/cleanUrl.test.ts +22 -0
- package/src/core/utils/url/cleanUrl.ts +16 -0
- package/src/core/utils/url/getAbsoluteUrl.node.test.ts +19 -0
- package/src/core/utils/url/getAbsoluteUrl.test.ts +47 -0
- package/src/core/utils/url/getAbsoluteUrl.ts +25 -0
- package/src/core/utils/url/isAbsoluteUrl.test.ts +32 -0
- package/src/core/utils/url/isAbsoluteUrl.ts +6 -0
- package/src/core/ws/WebSocketClientManager.test.ts +164 -0
- package/src/core/ws/WebSocketClientManager.ts +241 -0
- package/src/core/ws/WebSocketClientStore.ts +14 -0
- package/src/core/ws/WebSocketIndexedDBClientStore.ts +140 -0
- package/src/core/ws/WebSocketMemoryClientStore.ts +27 -0
- package/src/core/ws/handleWebSocketEvent.ts +64 -0
- package/src/core/ws/utils/attachWebSocketLogger.ts +245 -0
- package/src/core/ws/utils/getMessageLength.test.ts +16 -0
- package/src/core/ws/utils/getMessageLength.ts +20 -0
- package/src/core/ws/utils/getPublicData.test.ts +38 -0
- package/src/core/ws/utils/getPublicData.ts +18 -0
- package/src/core/ws/utils/truncateMessage.test.ts +12 -0
- package/src/core/ws/utils/truncateMessage.ts +9 -0
- package/src/core/ws/webSocketInterceptor.ts +3 -0
- package/src/core/ws.test.ts +23 -0
- package/src/core/ws.ts +161 -0
- package/src/iife/index.ts +2 -0
- package/src/mockServiceWorker.js +349 -0
- package/src/native/index.ts +21 -0
- package/src/node/SetupServerApi.ts +87 -0
- package/src/node/SetupServerCommonApi.ts +169 -0
- package/src/node/glossary.ts +74 -0
- package/src/node/index.ts +3 -0
- package/src/node/setupServer.ts +15 -0
- package/src/package.json +3 -0
- package/src/shims/cookie.ts +7 -0
- package/src/shims/statuses.ts +6 -0
- package/src/tsconfig.core.build.json +6 -0
- package/src/tsconfig.node.build.json +6 -0
- package/src/tsconfig.node.json +8 -0
- package/src/tsconfig.src.json +10 -0
- package/src/tsconfig.worker.json +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/internal/tryCatch.ts"],"sourcesContent":["export function tryCatch<Fn extends (...args: any[]) => any>(\n fn: Fn,\n onException?: (error: Error) => void,\n): ReturnType<Fn> | undefined {\n try {\n const result = fn()\n return result\n } catch (error) {\n onException?.(error as Error)\n }\n}\n"],"mappings":"AAAO,SAAS,SACd,IACA,aAC4B;AAC5B,MAAI;AACF,UAAM,SAAS,GAAG;AAClB,WAAO;AAAA,EACT,SAAS,OAAO;AACd,kBAAc,KAAc;AAAA,EAC9B;AACF;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare enum StatusCodeColor {
|
|
2
|
+
Success = "#69AB32",
|
|
3
|
+
Warning = "#F0BB4B",
|
|
4
|
+
Danger = "#E95F5D"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns a HEX color for a given response status code number.
|
|
8
|
+
*/
|
|
9
|
+
declare function getStatusCodeColor(status: number): StatusCodeColor;
|
|
10
|
+
|
|
11
|
+
export { StatusCodeColor, getStatusCodeColor };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare enum StatusCodeColor {
|
|
2
|
+
Success = "#69AB32",
|
|
3
|
+
Warning = "#F0BB4B",
|
|
4
|
+
Danger = "#E95F5D"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns a HEX color for a given response status code number.
|
|
8
|
+
*/
|
|
9
|
+
declare function getStatusCodeColor(status: number): StatusCodeColor;
|
|
10
|
+
|
|
11
|
+
export { StatusCodeColor, getStatusCodeColor };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getStatusCodeColor_exports = {};
|
|
20
|
+
__export(getStatusCodeColor_exports, {
|
|
21
|
+
StatusCodeColor: () => StatusCodeColor,
|
|
22
|
+
getStatusCodeColor: () => getStatusCodeColor
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getStatusCodeColor_exports);
|
|
25
|
+
var StatusCodeColor = /* @__PURE__ */ ((StatusCodeColor2) => {
|
|
26
|
+
StatusCodeColor2["Success"] = "#69AB32";
|
|
27
|
+
StatusCodeColor2["Warning"] = "#F0BB4B";
|
|
28
|
+
StatusCodeColor2["Danger"] = "#E95F5D";
|
|
29
|
+
return StatusCodeColor2;
|
|
30
|
+
})(StatusCodeColor || {});
|
|
31
|
+
function getStatusCodeColor(status) {
|
|
32
|
+
if (status < 300) {
|
|
33
|
+
return "#69AB32" /* Success */;
|
|
34
|
+
}
|
|
35
|
+
if (status < 400) {
|
|
36
|
+
return "#F0BB4B" /* Warning */;
|
|
37
|
+
}
|
|
38
|
+
return "#E95F5D" /* Danger */;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=getStatusCodeColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/getStatusCodeColor.ts"],"sourcesContent":["export enum StatusCodeColor {\n Success = '#69AB32',\n Warning = '#F0BB4B',\n Danger = '#E95F5D',\n}\n\n/**\n * Returns a HEX color for a given response status code number.\n */\nexport function getStatusCodeColor(status: number): StatusCodeColor {\n if (status < 300) {\n return StatusCodeColor.Success\n }\n\n if (status < 400) {\n return StatusCodeColor.Warning\n }\n\n return StatusCodeColor.Danger\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AASL,SAAS,mBAAmB,QAAiC;AAClE,MAAI,SAAS,KAAK;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,KAAK;AAChB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["StatusCodeColor"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var StatusCodeColor = /* @__PURE__ */ ((StatusCodeColor2) => {
|
|
2
|
+
StatusCodeColor2["Success"] = "#69AB32";
|
|
3
|
+
StatusCodeColor2["Warning"] = "#F0BB4B";
|
|
4
|
+
StatusCodeColor2["Danger"] = "#E95F5D";
|
|
5
|
+
return StatusCodeColor2;
|
|
6
|
+
})(StatusCodeColor || {});
|
|
7
|
+
function getStatusCodeColor(status) {
|
|
8
|
+
if (status < 300) {
|
|
9
|
+
return "#69AB32" /* Success */;
|
|
10
|
+
}
|
|
11
|
+
if (status < 400) {
|
|
12
|
+
return "#F0BB4B" /* Warning */;
|
|
13
|
+
}
|
|
14
|
+
return "#E95F5D" /* Danger */;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
StatusCodeColor,
|
|
18
|
+
getStatusCodeColor
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=getStatusCodeColor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/getStatusCodeColor.ts"],"sourcesContent":["export enum StatusCodeColor {\n Success = '#69AB32',\n Warning = '#F0BB4B',\n Danger = '#E95F5D',\n}\n\n/**\n * Returns a HEX color for a given response status code number.\n */\nexport function getStatusCodeColor(status: number): StatusCodeColor {\n if (status < 300) {\n return StatusCodeColor.Success\n }\n\n if (status < 400) {\n return StatusCodeColor.Warning\n }\n\n return StatusCodeColor.Danger\n}\n"],"mappings":"AAAO,IAAK,kBAAL,kBAAKA,qBAAL;AACL,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AASL,SAAS,mBAAmB,QAAiC;AAClE,MAAI,SAAS,KAAK;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,KAAK;AAChB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["StatusCodeColor"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getTimestamp_exports = {};
|
|
20
|
+
__export(getTimestamp_exports, {
|
|
21
|
+
getTimestamp: () => getTimestamp
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getTimestamp_exports);
|
|
24
|
+
function getTimestamp(options) {
|
|
25
|
+
const now = /* @__PURE__ */ new Date();
|
|
26
|
+
const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
|
|
27
|
+
if (options?.milliseconds) {
|
|
28
|
+
return `${timestamp}.${now.getMilliseconds().toString().padStart(3, "0")}`;
|
|
29
|
+
}
|
|
30
|
+
return timestamp;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=getTimestamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/getTimestamp.ts"],"sourcesContent":["interface GetTimestampOptions {\n milliseconds?: boolean\n}\n\n/**\n * Returns a timestamp string in a \"HH:MM:SS\" format.\n */\nexport function getTimestamp(options?: GetTimestampOptions): string {\n const now = new Date()\n const timestamp = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`\n\n if (options?.milliseconds) {\n return `${timestamp}.${now.getMilliseconds().toString().padStart(3, '0')}`\n }\n\n return timestamp\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,aAAa,SAAuC;AAClE,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,YAAY,GAAG,IAAI,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAE/J,MAAI,SAAS,cAAc;AACzB,WAAO,GAAG,SAAS,IAAI,IAAI,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,EAC1E;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function getTimestamp(options) {
|
|
2
|
+
const now = /* @__PURE__ */ new Date();
|
|
3
|
+
const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
|
|
4
|
+
if (options?.milliseconds) {
|
|
5
|
+
return `${timestamp}.${now.getMilliseconds().toString().padStart(3, "0")}`;
|
|
6
|
+
}
|
|
7
|
+
return timestamp;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getTimestamp
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=getTimestamp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/getTimestamp.ts"],"sourcesContent":["interface GetTimestampOptions {\n milliseconds?: boolean\n}\n\n/**\n * Returns a timestamp string in a \"HH:MM:SS\" format.\n */\nexport function getTimestamp(options?: GetTimestampOptions): string {\n const now = new Date()\n const timestamp = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`\n\n if (options?.milliseconds) {\n return `${timestamp}.${now.getMilliseconds().toString().padStart(3, '0')}`\n }\n\n return timestamp\n}\n"],"mappings":"AAOO,SAAS,aAAa,SAAuC;AAClE,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,YAAY,GAAG,IAAI,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAE/J,MAAI,SAAS,cAAc;AACzB,WAAO,GAAG,SAAS,IAAI,IAAI,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,EAC1E;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface LoggedRequest {
|
|
2
|
+
url: URL;
|
|
3
|
+
method: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Formats a mocked request for introspection in browser's console.
|
|
9
|
+
*/
|
|
10
|
+
declare function serializeRequest(request: Request): Promise<LoggedRequest>;
|
|
11
|
+
|
|
12
|
+
export { type LoggedRequest, serializeRequest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface LoggedRequest {
|
|
2
|
+
url: URL;
|
|
3
|
+
method: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Formats a mocked request for introspection in browser's console.
|
|
9
|
+
*/
|
|
10
|
+
declare function serializeRequest(request: Request): Promise<LoggedRequest>;
|
|
11
|
+
|
|
12
|
+
export { type LoggedRequest, serializeRequest };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var serializeRequest_exports = {};
|
|
20
|
+
__export(serializeRequest_exports, {
|
|
21
|
+
serializeRequest: () => serializeRequest
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(serializeRequest_exports);
|
|
24
|
+
async function serializeRequest(request) {
|
|
25
|
+
const requestClone = request.clone();
|
|
26
|
+
const requestText = await requestClone.text();
|
|
27
|
+
return {
|
|
28
|
+
url: new URL(request.url),
|
|
29
|
+
method: request.method,
|
|
30
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
31
|
+
body: requestText
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=serializeRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/serializeRequest.ts"],"sourcesContent":["export interface LoggedRequest {\n url: URL\n method: string\n headers: Record<string, string>\n body: string\n}\n\n/**\n * Formats a mocked request for introspection in browser's console.\n */\nexport async function serializeRequest(\n request: Request,\n): Promise<LoggedRequest> {\n const requestClone = request.clone()\n const requestText = await requestClone.text()\n\n return {\n url: new URL(request.url),\n method: request.method,\n headers: Object.fromEntries(request.headers.entries()),\n body: requestText,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,eAAsB,iBACpB,SACwB;AACxB,QAAM,eAAe,QAAQ,MAAM;AACnC,QAAM,cAAc,MAAM,aAAa,KAAK;AAE5C,SAAO;AAAA,IACL,KAAK,IAAI,IAAI,QAAQ,GAAG;AAAA,IACxB,QAAQ,QAAQ;AAAA,IAChB,SAAS,OAAO,YAAY,QAAQ,QAAQ,QAAQ,CAAC;AAAA,IACrD,MAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
async function serializeRequest(request) {
|
|
2
|
+
const requestClone = request.clone();
|
|
3
|
+
const requestText = await requestClone.text();
|
|
4
|
+
return {
|
|
5
|
+
url: new URL(request.url),
|
|
6
|
+
method: request.method,
|
|
7
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
8
|
+
body: requestText
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
serializeRequest
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=serializeRequest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/serializeRequest.ts"],"sourcesContent":["export interface LoggedRequest {\n url: URL\n method: string\n headers: Record<string, string>\n body: string\n}\n\n/**\n * Formats a mocked request for introspection in browser's console.\n */\nexport async function serializeRequest(\n request: Request,\n): Promise<LoggedRequest> {\n const requestClone = request.clone()\n const requestText = await requestClone.text()\n\n return {\n url: new URL(request.url),\n method: request.method,\n headers: Object.fromEntries(request.headers.entries()),\n body: requestText,\n }\n}\n"],"mappings":"AAUA,eAAsB,iBACpB,SACwB;AACxB,QAAM,eAAe,QAAQ,MAAM;AACnC,QAAM,cAAc,MAAM,aAAa,KAAK;AAE5C,SAAO;AAAA,IACL,KAAK,IAAI,IAAI,QAAQ,GAAG;AAAA,IACxB,QAAQ,QAAQ;AAAA,IAChB,SAAS,OAAO,YAAY,QAAQ,QAAQ,QAAQ,CAAC;AAAA,IACrD,MAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface SerializedResponse {
|
|
2
|
+
status: number;
|
|
3
|
+
statusText: string;
|
|
4
|
+
headers: Record<string, any>;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
declare function serializeResponse(response: Response): Promise<SerializedResponse>;
|
|
8
|
+
|
|
9
|
+
export { type SerializedResponse, serializeResponse };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface SerializedResponse {
|
|
2
|
+
status: number;
|
|
3
|
+
statusText: string;
|
|
4
|
+
headers: Record<string, any>;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
declare function serializeResponse(response: Response): Promise<SerializedResponse>;
|
|
8
|
+
|
|
9
|
+
export { type SerializedResponse, serializeResponse };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var serializeResponse_exports = {};
|
|
30
|
+
__export(serializeResponse_exports, {
|
|
31
|
+
serializeResponse: () => serializeResponse
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(serializeResponse_exports);
|
|
34
|
+
var import_statuses = __toESM(require("../../../shims/statuses"), 1);
|
|
35
|
+
const { message } = import_statuses.default;
|
|
36
|
+
async function serializeResponse(response) {
|
|
37
|
+
const responseClone = response.clone();
|
|
38
|
+
const responseText = await responseClone.text();
|
|
39
|
+
const responseStatus = responseClone.status || 200;
|
|
40
|
+
const responseStatusText = responseClone.statusText || message[responseStatus] || "OK";
|
|
41
|
+
return {
|
|
42
|
+
status: responseStatus,
|
|
43
|
+
statusText: responseStatusText,
|
|
44
|
+
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
45
|
+
body: responseText
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=serializeResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/serializeResponse.ts"],"sourcesContent":["import statuses from '../../../shims/statuses'\n\nconst { message } = statuses\n\nexport interface SerializedResponse {\n status: number\n statusText: string\n headers: Record<string, any>\n body: string\n}\n\nexport async function serializeResponse(\n response: Response,\n): Promise<SerializedResponse> {\n const responseClone = response.clone()\n const responseText = await responseClone.text()\n\n // Normalize the response status and status text when logging\n // since the default Response instance doesn't infer status texts\n // from status codes. This has no effect on the actual response instance.\n const responseStatus = responseClone.status || 200\n const responseStatusText =\n responseClone.statusText || message[responseStatus] || 'OK'\n\n return {\n status: responseStatus,\n statusText: responseStatusText,\n headers: Object.fromEntries(responseClone.headers.entries()),\n body: responseText,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AAErB,MAAM,EAAE,QAAQ,IAAI,gBAAAA;AASpB,eAAsB,kBACpB,UAC6B;AAC7B,QAAM,gBAAgB,SAAS,MAAM;AACrC,QAAM,eAAe,MAAM,cAAc,KAAK;AAK9C,QAAM,iBAAiB,cAAc,UAAU;AAC/C,QAAM,qBACJ,cAAc,cAAc,QAAQ,cAAc,KAAK;AAEzD,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS,OAAO,YAAY,cAAc,QAAQ,QAAQ,CAAC;AAAA,IAC3D,MAAM;AAAA,EACR;AACF;","names":["statuses"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import statuses from '../../../shims/statuses.mjs';
|
|
2
|
+
const { message } = statuses;
|
|
3
|
+
async function serializeResponse(response) {
|
|
4
|
+
const responseClone = response.clone();
|
|
5
|
+
const responseText = await responseClone.text();
|
|
6
|
+
const responseStatus = responseClone.status || 200;
|
|
7
|
+
const responseStatusText = responseClone.statusText || message[responseStatus] || "OK";
|
|
8
|
+
return {
|
|
9
|
+
status: responseStatus,
|
|
10
|
+
statusText: responseStatusText,
|
|
11
|
+
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
12
|
+
body: responseText
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
serializeResponse
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=serializeResponse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/logging/serializeResponse.ts"],"sourcesContent":["import statuses from '../../../shims/statuses'\n\nconst { message } = statuses\n\nexport interface SerializedResponse {\n status: number\n statusText: string\n headers: Record<string, any>\n body: string\n}\n\nexport async function serializeResponse(\n response: Response,\n): Promise<SerializedResponse> {\n const responseClone = response.clone()\n const responseText = await responseClone.text()\n\n // Normalize the response status and status text when logging\n // since the default Response instance doesn't infer status texts\n // from status codes. This has no effect on the actual response instance.\n const responseStatus = responseClone.status || 200\n const responseStatusText =\n responseClone.statusText || message[responseStatus] || 'OK'\n\n return {\n status: responseStatus,\n statusText: responseStatusText,\n headers: Object.fromEntries(responseClone.headers.entries()),\n body: responseText,\n }\n}\n"],"mappings":"AAAA,OAAO,cAAc;AAErB,MAAM,EAAE,QAAQ,IAAI;AASpB,eAAsB,kBACpB,UAC6B;AAC7B,QAAM,gBAAgB,SAAS,MAAM;AACrC,QAAM,eAAe,MAAM,cAAc,KAAK;AAK9C,QAAM,iBAAiB,cAAc,UAAU;AAC/C,QAAM,qBACJ,cAAc,cAAc,QAAQ,cAAc,KAAK;AAEzD,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS,OAAO,YAAY,cAAc,QAAQ,QAAQ,CAAC;AAAA,IAC3D,MAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Path = string | RegExp;
|
|
2
|
+
type PathParams<KeyType extends keyof any = string> = {
|
|
3
|
+
[ParamName in KeyType]?: string | ReadonlyArray<string>;
|
|
4
|
+
};
|
|
5
|
+
interface Match {
|
|
6
|
+
matches: boolean;
|
|
7
|
+
params?: PathParams;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Coerce a path supported by MSW into a path
|
|
11
|
+
* supported by "path-to-regexp".
|
|
12
|
+
*/
|
|
13
|
+
declare function coercePath(path: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the result of matching given request URL against a mask.
|
|
16
|
+
*/
|
|
17
|
+
declare function matchRequestUrl(url: URL, path: Path, baseUrl?: string): Match;
|
|
18
|
+
declare function isPath(value: unknown): value is Path;
|
|
19
|
+
|
|
20
|
+
export { type Match, type Path, type PathParams, coercePath, isPath, matchRequestUrl };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Path = string | RegExp;
|
|
2
|
+
type PathParams<KeyType extends keyof any = string> = {
|
|
3
|
+
[ParamName in KeyType]?: string | ReadonlyArray<string>;
|
|
4
|
+
};
|
|
5
|
+
interface Match {
|
|
6
|
+
matches: boolean;
|
|
7
|
+
params?: PathParams;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Coerce a path supported by MSW into a path
|
|
11
|
+
* supported by "path-to-regexp".
|
|
12
|
+
*/
|
|
13
|
+
declare function coercePath(path: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the result of matching given request URL against a mask.
|
|
16
|
+
*/
|
|
17
|
+
declare function matchRequestUrl(url: URL, path: Path, baseUrl?: string): Match;
|
|
18
|
+
declare function isPath(value: unknown): value is Path;
|
|
19
|
+
|
|
20
|
+
export { type Match, type Path, type PathParams, coercePath, isPath, matchRequestUrl };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var matchRequestUrl_exports = {};
|
|
20
|
+
__export(matchRequestUrl_exports, {
|
|
21
|
+
coercePath: () => coercePath,
|
|
22
|
+
isPath: () => isPath,
|
|
23
|
+
matchRequestUrl: () => matchRequestUrl
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(matchRequestUrl_exports);
|
|
26
|
+
var import_path_to_regexp = require("path-to-regexp");
|
|
27
|
+
var import_interceptors = require("@mswjs/interceptors");
|
|
28
|
+
var import_normalizePath = require("./normalizePath");
|
|
29
|
+
function coercePath(path) {
|
|
30
|
+
return path.replace(
|
|
31
|
+
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
|
32
|
+
(_, parameterName, wildcard) => {
|
|
33
|
+
const expression = "(.*)";
|
|
34
|
+
if (!parameterName) {
|
|
35
|
+
return expression;
|
|
36
|
+
}
|
|
37
|
+
return parameterName.startsWith(":") ? `${parameterName}${wildcard}` : `${parameterName}${expression}`;
|
|
38
|
+
}
|
|
39
|
+
).replace(/([^/])(:)(?=\d+)/, "$1\\$2").replace(/^([^/]+)(:)(?=\/\/)/, "$1\\$2");
|
|
40
|
+
}
|
|
41
|
+
function matchRequestUrl(url, path, baseUrl) {
|
|
42
|
+
const normalizedPath = (0, import_normalizePath.normalizePath)(path, baseUrl);
|
|
43
|
+
const cleanPath = typeof normalizedPath === "string" ? coercePath(normalizedPath) : normalizedPath;
|
|
44
|
+
const cleanUrl = (0, import_interceptors.getCleanUrl)(url);
|
|
45
|
+
const result = (0, import_path_to_regexp.match)(cleanPath, { decode: decodeURIComponent })(cleanUrl);
|
|
46
|
+
const params = result && result.params || {};
|
|
47
|
+
return {
|
|
48
|
+
matches: result !== false,
|
|
49
|
+
params
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function isPath(value) {
|
|
53
|
+
return typeof value === "string" || value instanceof RegExp;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=matchRequestUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/matching/matchRequestUrl.ts"],"sourcesContent":["import { match } from 'path-to-regexp'\nimport { getCleanUrl } from '@mswjs/interceptors'\nimport { normalizePath } from './normalizePath'\n\nexport type Path = string | RegExp\nexport type PathParams<KeyType extends keyof any = string> = {\n [ParamName in KeyType]?: string | ReadonlyArray<string>\n}\n\nexport interface Match {\n matches: boolean\n params?: PathParams\n}\n\n/**\n * Coerce a path supported by MSW into a path\n * supported by \"path-to-regexp\".\n */\nexport function coercePath(path: string): string {\n return (\n path\n /**\n * Replace wildcards (\"*\") with unnamed capturing groups\n * because \"path-to-regexp\" doesn't support wildcards.\n * Ignore path parameter' modifiers (i.e. \":name*\").\n */\n .replace(\n /([:a-zA-Z_-]*)(\\*{1,2})+/g,\n (_, parameterName: string | undefined, wildcard: string) => {\n const expression = '(.*)'\n\n if (!parameterName) {\n return expression\n }\n\n return parameterName.startsWith(':')\n ? `${parameterName}${wildcard}`\n : `${parameterName}${expression}`\n },\n )\n /**\n * Escape the port so that \"path-to-regexp\" can match\n * absolute URLs including port numbers.\n */\n .replace(/([^/])(:)(?=\\d+)/, '$1\\\\$2')\n /**\n * Escape the protocol so that \"path-to-regexp\" could match\n * absolute URL.\n * @see https://github.com/pillarjs/path-to-regexp/issues/259\n */\n .replace(/^([^/]+)(:)(?=\\/\\/)/, '$1\\\\$2')\n )\n}\n\n/**\n * Returns the result of matching given request URL against a mask.\n */\nexport function matchRequestUrl(url: URL, path: Path, baseUrl?: string): Match {\n const normalizedPath = normalizePath(path, baseUrl)\n const cleanPath =\n typeof normalizedPath === 'string'\n ? coercePath(normalizedPath)\n : normalizedPath\n\n const cleanUrl = getCleanUrl(url)\n const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl)\n const params = (result && (result.params as PathParams)) || {}\n\n return {\n matches: result !== false,\n params,\n }\n}\n\nexport function isPath(value: unknown): value is Path {\n return typeof value === 'string' || value instanceof RegExp\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAsB;AACtB,0BAA4B;AAC5B,2BAA8B;AAgBvB,SAAS,WAAW,MAAsB;AAC/C,SACE,KAMG;AAAA,IACC;AAAA,IACA,CAAC,GAAG,eAAmC,aAAqB;AAC1D,YAAM,aAAa;AAEnB,UAAI,CAAC,eAAe;AAClB,eAAO;AAAA,MACT;AAEA,aAAO,cAAc,WAAW,GAAG,IAC/B,GAAG,aAAa,GAAG,QAAQ,KAC3B,GAAG,aAAa,GAAG,UAAU;AAAA,IACnC;AAAA,EACF,EAKC,QAAQ,oBAAoB,QAAQ,EAMpC,QAAQ,uBAAuB,QAAQ;AAE9C;AAKO,SAAS,gBAAgB,KAAU,MAAY,SAAyB;AAC7E,QAAM,qBAAiB,oCAAc,MAAM,OAAO;AAClD,QAAM,YACJ,OAAO,mBAAmB,WACtB,WAAW,cAAc,IACzB;AAEN,QAAM,eAAW,iCAAY,GAAG;AAChC,QAAM,aAAS,6BAAM,WAAW,EAAE,QAAQ,mBAAmB,CAAC,EAAE,QAAQ;AACxE,QAAM,SAAU,UAAW,OAAO,UAA0B,CAAC;AAE7D,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,EACF;AACF;AAEO,SAAS,OAAO,OAA+B;AACpD,SAAO,OAAO,UAAU,YAAY,iBAAiB;AACvD;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { match } from "path-to-regexp";
|
|
2
|
+
import { getCleanUrl } from "@mswjs/interceptors";
|
|
3
|
+
import { normalizePath } from './normalizePath.mjs';
|
|
4
|
+
function coercePath(path) {
|
|
5
|
+
return path.replace(
|
|
6
|
+
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
|
7
|
+
(_, parameterName, wildcard) => {
|
|
8
|
+
const expression = "(.*)";
|
|
9
|
+
if (!parameterName) {
|
|
10
|
+
return expression;
|
|
11
|
+
}
|
|
12
|
+
return parameterName.startsWith(":") ? `${parameterName}${wildcard}` : `${parameterName}${expression}`;
|
|
13
|
+
}
|
|
14
|
+
).replace(/([^/])(:)(?=\d+)/, "$1\\$2").replace(/^([^/]+)(:)(?=\/\/)/, "$1\\$2");
|
|
15
|
+
}
|
|
16
|
+
function matchRequestUrl(url, path, baseUrl) {
|
|
17
|
+
const normalizedPath = normalizePath(path, baseUrl);
|
|
18
|
+
const cleanPath = typeof normalizedPath === "string" ? coercePath(normalizedPath) : normalizedPath;
|
|
19
|
+
const cleanUrl = getCleanUrl(url);
|
|
20
|
+
const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl);
|
|
21
|
+
const params = result && result.params || {};
|
|
22
|
+
return {
|
|
23
|
+
matches: result !== false,
|
|
24
|
+
params
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function isPath(value) {
|
|
28
|
+
return typeof value === "string" || value instanceof RegExp;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
coercePath,
|
|
32
|
+
isPath,
|
|
33
|
+
matchRequestUrl
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=matchRequestUrl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/matching/matchRequestUrl.ts"],"sourcesContent":["import { match } from 'path-to-regexp'\nimport { getCleanUrl } from '@mswjs/interceptors'\nimport { normalizePath } from './normalizePath'\n\nexport type Path = string | RegExp\nexport type PathParams<KeyType extends keyof any = string> = {\n [ParamName in KeyType]?: string | ReadonlyArray<string>\n}\n\nexport interface Match {\n matches: boolean\n params?: PathParams\n}\n\n/**\n * Coerce a path supported by MSW into a path\n * supported by \"path-to-regexp\".\n */\nexport function coercePath(path: string): string {\n return (\n path\n /**\n * Replace wildcards (\"*\") with unnamed capturing groups\n * because \"path-to-regexp\" doesn't support wildcards.\n * Ignore path parameter' modifiers (i.e. \":name*\").\n */\n .replace(\n /([:a-zA-Z_-]*)(\\*{1,2})+/g,\n (_, parameterName: string | undefined, wildcard: string) => {\n const expression = '(.*)'\n\n if (!parameterName) {\n return expression\n }\n\n return parameterName.startsWith(':')\n ? `${parameterName}${wildcard}`\n : `${parameterName}${expression}`\n },\n )\n /**\n * Escape the port so that \"path-to-regexp\" can match\n * absolute URLs including port numbers.\n */\n .replace(/([^/])(:)(?=\\d+)/, '$1\\\\$2')\n /**\n * Escape the protocol so that \"path-to-regexp\" could match\n * absolute URL.\n * @see https://github.com/pillarjs/path-to-regexp/issues/259\n */\n .replace(/^([^/]+)(:)(?=\\/\\/)/, '$1\\\\$2')\n )\n}\n\n/**\n * Returns the result of matching given request URL against a mask.\n */\nexport function matchRequestUrl(url: URL, path: Path, baseUrl?: string): Match {\n const normalizedPath = normalizePath(path, baseUrl)\n const cleanPath =\n typeof normalizedPath === 'string'\n ? coercePath(normalizedPath)\n : normalizedPath\n\n const cleanUrl = getCleanUrl(url)\n const result = match(cleanPath, { decode: decodeURIComponent })(cleanUrl)\n const params = (result && (result.params as PathParams)) || {}\n\n return {\n matches: result !== false,\n params,\n }\n}\n\nexport function isPath(value: unknown): value is Path {\n return typeof value === 'string' || value instanceof RegExp\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAgBvB,SAAS,WAAW,MAAsB;AAC/C,SACE,KAMG;AAAA,IACC;AAAA,IACA,CAAC,GAAG,eAAmC,aAAqB;AAC1D,YAAM,aAAa;AAEnB,UAAI,CAAC,eAAe;AAClB,eAAO;AAAA,MACT;AAEA,aAAO,cAAc,WAAW,GAAG,IAC/B,GAAG,aAAa,GAAG,QAAQ,KAC3B,GAAG,aAAa,GAAG,UAAU;AAAA,IACnC;AAAA,EACF,EAKC,QAAQ,oBAAoB,QAAQ,EAMpC,QAAQ,uBAAuB,QAAQ;AAE9C;AAKO,SAAS,gBAAgB,KAAU,MAAY,SAAyB;AAC7E,QAAM,iBAAiB,cAAc,MAAM,OAAO;AAClD,QAAM,YACJ,OAAO,mBAAmB,WACtB,WAAW,cAAc,IACzB;AAEN,QAAM,WAAW,YAAY,GAAG;AAChC,QAAM,SAAS,MAAM,WAAW,EAAE,QAAQ,mBAAmB,CAAC,EAAE,QAAQ;AACxE,QAAM,SAAU,UAAW,OAAO,UAA0B,CAAC;AAE7D,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,EACF;AACF;AAEO,SAAS,OAAO,OAA+B;AACpD,SAAO,OAAO,UAAU,YAAY,iBAAiB;AACvD;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Path } from './matchRequestUrl.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a given request handler path:
|
|
5
|
+
* - Preserves RegExp.
|
|
6
|
+
* - Removes query parameters and hashes.
|
|
7
|
+
* - Rebases relative URLs against the "baseUrl" or the current location.
|
|
8
|
+
* - Preserves relative URLs in Node.js, unless specified otherwise.
|
|
9
|
+
* - Preserves optional path parameters.
|
|
10
|
+
*/
|
|
11
|
+
declare function normalizePath(path: Path, baseUrl?: string): Path;
|
|
12
|
+
|
|
13
|
+
export { normalizePath };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Path } from './matchRequestUrl.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a given request handler path:
|
|
5
|
+
* - Preserves RegExp.
|
|
6
|
+
* - Removes query parameters and hashes.
|
|
7
|
+
* - Rebases relative URLs against the "baseUrl" or the current location.
|
|
8
|
+
* - Preserves relative URLs in Node.js, unless specified otherwise.
|
|
9
|
+
* - Preserves optional path parameters.
|
|
10
|
+
*/
|
|
11
|
+
declare function normalizePath(path: Path, baseUrl?: string): Path;
|
|
12
|
+
|
|
13
|
+
export { normalizePath };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var normalizePath_exports = {};
|
|
20
|
+
__export(normalizePath_exports, {
|
|
21
|
+
normalizePath: () => normalizePath
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(normalizePath_exports);
|
|
24
|
+
var import_cleanUrl = require("../url/cleanUrl");
|
|
25
|
+
var import_getAbsoluteUrl = require("../url/getAbsoluteUrl");
|
|
26
|
+
function normalizePath(path, baseUrl) {
|
|
27
|
+
if (path instanceof RegExp) {
|
|
28
|
+
return path;
|
|
29
|
+
}
|
|
30
|
+
const maybeAbsoluteUrl = (0, import_getAbsoluteUrl.getAbsoluteUrl)(path, baseUrl);
|
|
31
|
+
return (0, import_cleanUrl.cleanUrl)(maybeAbsoluteUrl);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=normalizePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/matching/normalizePath.ts"],"sourcesContent":["import type { Path } from './matchRequestUrl'\nimport { cleanUrl } from '../url/cleanUrl'\nimport { getAbsoluteUrl } from '../url/getAbsoluteUrl'\n\n/**\n * Normalizes a given request handler path:\n * - Preserves RegExp.\n * - Removes query parameters and hashes.\n * - Rebases relative URLs against the \"baseUrl\" or the current location.\n * - Preserves relative URLs in Node.js, unless specified otherwise.\n * - Preserves optional path parameters.\n */\nexport function normalizePath(path: Path, baseUrl?: string): Path {\n // RegExp paths do not need normalization.\n if (path instanceof RegExp) {\n return path\n }\n\n const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl)\n\n return cleanUrl(maybeAbsoluteUrl)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyB;AACzB,4BAA+B;AAUxB,SAAS,cAAc,MAAY,SAAwB;AAEhE,MAAI,gBAAgB,QAAQ;AAC1B,WAAO;AAAA,EACT;AAEA,QAAM,uBAAmB,sCAAe,MAAM,OAAO;AAErD,aAAO,0BAAS,gBAAgB;AAClC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cleanUrl } from '../url/cleanUrl.mjs';
|
|
2
|
+
import { getAbsoluteUrl } from '../url/getAbsoluteUrl.mjs';
|
|
3
|
+
function normalizePath(path, baseUrl) {
|
|
4
|
+
if (path instanceof RegExp) {
|
|
5
|
+
return path;
|
|
6
|
+
}
|
|
7
|
+
const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl);
|
|
8
|
+
return cleanUrl(maybeAbsoluteUrl);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
normalizePath
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=normalizePath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/utils/matching/normalizePath.ts"],"sourcesContent":["import type { Path } from './matchRequestUrl'\nimport { cleanUrl } from '../url/cleanUrl'\nimport { getAbsoluteUrl } from '../url/getAbsoluteUrl'\n\n/**\n * Normalizes a given request handler path:\n * - Preserves RegExp.\n * - Removes query parameters and hashes.\n * - Rebases relative URLs against the \"baseUrl\" or the current location.\n * - Preserves relative URLs in Node.js, unless specified otherwise.\n * - Preserves optional path parameters.\n */\nexport function normalizePath(path: Path, baseUrl?: string): Path {\n // RegExp paths do not need normalization.\n if (path instanceof RegExp) {\n return path\n }\n\n const maybeAbsoluteUrl = getAbsoluteUrl(path, baseUrl)\n\n return cleanUrl(maybeAbsoluteUrl)\n}\n"],"mappings":"AACA,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAUxB,SAAS,cAAc,MAAY,SAAwB;AAEhE,MAAI,gBAAgB,QAAQ;AAC1B,WAAO;AAAA,EACT;AAEA,QAAM,mBAAmB,eAAe,MAAM,OAAO;AAErD,SAAO,SAAS,gBAAgB;AAClC;","names":[]}
|