@adapt-arch/utiliti-es 0.1.0 → 0.2.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/README.md +1 -0
- package/dist/bundle/utiliti-es.cjs +1 -1
- package/dist/bundle/utiliti-es.iife.js +1 -1
- package/dist/bundle/utiliti-es.js +258 -172
- package/dist/bundle/utiliti-es.umd.cjs +1 -1
- package/dist/pubsub/index.d.ts +2 -1
- package/dist/pubsub/index.js +2 -1
- package/dist/pubsub/plugins/broadcastChannelPlugin.d.ts +29 -0
- package/dist/pubsub/plugins/broadcastChannelPlugin.js +55 -0
- package/dist/pubsub/plugins/index.d.ts +2 -0
- package/dist/pubsub/plugins/index.js +2 -0
- package/dist/pubsub/plugins/loggerPlugin.d.ts +18 -0
- package/dist/pubsub/plugins/loggerPlugin.js +25 -0
- package/dist/pubsub/pubsub.d.ts +45 -0
- package/dist/pubsub/pubsub.js +45 -5
- package/package.json +14 -11
- package/dist/bundle/mockServiceWorker.js +0 -284
- package/dist/mocks/logReporterHandlers.d.ts +0 -1
- package/dist/mocks/logReporterHandlers.js +0 -27
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { http, HttpResponse, delay } from "msw";
|
|
2
|
-
// https://mswjs.io/docs/basics/mocking-responses
|
|
3
|
-
export function getLogReporterHandlers(handledRequestsContainer) {
|
|
4
|
-
return [
|
|
5
|
-
http.post("/logs*", async ({ request }) => {
|
|
6
|
-
if (handledRequestsContainer) {
|
|
7
|
-
handledRequestsContainer.push(request.clone());
|
|
8
|
-
}
|
|
9
|
-
// Get the responseCode from the query string
|
|
10
|
-
const responseCode = new URL(request.url).searchParams.get("responseCode");
|
|
11
|
-
let status = responseCode ? Number.parseInt(responseCode) : 200;
|
|
12
|
-
if (Number.isNaN(status)) {
|
|
13
|
-
status = 200;
|
|
14
|
-
}
|
|
15
|
-
if (status < 200 || status < 300) {
|
|
16
|
-
await delay(60); // Simulate network latency
|
|
17
|
-
}
|
|
18
|
-
if (status === 0) {
|
|
19
|
-
// Simulate a network error
|
|
20
|
-
return HttpResponse.error();
|
|
21
|
-
}
|
|
22
|
-
return new HttpResponse(null, {
|
|
23
|
-
status: status,
|
|
24
|
-
});
|
|
25
|
-
}),
|
|
26
|
-
];
|
|
27
|
-
}
|