msw-dev-tool 1.0.17 → 1.0.19

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.
Files changed (55) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/cjs/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/cjs/_virtual/lodash.js +6 -0
  4. package/dist/cjs/_virtual/lodash.js.map +1 -0
  5. package/dist/cjs/hook/useFlattenHandlersTable.js +41 -0
  6. package/dist/cjs/hook/useFlattenHandlersTable.js.map +1 -0
  7. package/dist/cjs/index.js +0 -1
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/lib/handlerStore.js +31 -31
  10. package/dist/cjs/lib/handlerStore.js.map +1 -1
  11. package/dist/cjs/lib/util.js +15 -16
  12. package/dist/cjs/lib/util.js.map +1 -1
  13. package/dist/cjs/msw-dev-tool.css +1 -1
  14. package/dist/cjs/node_modules/@tanstack/react-table/build/lib/index.js +137 -0
  15. package/dist/cjs/node_modules/@tanstack/react-table/build/lib/index.js.map +1 -0
  16. package/dist/cjs/node_modules/@tanstack/table-core/build/lib/index.js +3012 -0
  17. package/dist/cjs/node_modules/@tanstack/table-core/build/lib/index.js.map +1 -0
  18. package/dist/cjs/node_modules/lodash/lodash.js +17209 -0
  19. package/dist/cjs/node_modules/lodash/lodash.js.map +1 -0
  20. package/dist/cjs/ui/DevToolContent/HttpControl.js +8 -18
  21. package/dist/cjs/ui/DevToolContent/HttpControl.js.map +1 -1
  22. package/dist/esm/_virtual/_commonjsHelpers.js +4 -0
  23. package/dist/esm/_virtual/_commonjsHelpers.js.map +1 -0
  24. package/dist/esm/_virtual/lodash.js +4 -0
  25. package/dist/esm/_virtual/lodash.js.map +1 -0
  26. package/dist/esm/hook/useFlattenHandlersTable.js +39 -0
  27. package/dist/esm/hook/useFlattenHandlersTable.js.map +1 -0
  28. package/dist/esm/index.js +1 -1
  29. package/dist/esm/lib/handlerStore.js +32 -32
  30. package/dist/esm/lib/handlerStore.js.map +1 -1
  31. package/dist/esm/lib/util.js +15 -16
  32. package/dist/esm/lib/util.js.map +1 -1
  33. package/dist/esm/msw-dev-tool.css +1 -1
  34. package/dist/esm/node_modules/@tanstack/react-table/build/lib/index.js +75 -0
  35. package/dist/esm/node_modules/@tanstack/react-table/build/lib/index.js.map +1 -0
  36. package/dist/esm/node_modules/@tanstack/table-core/build/lib/index.js +2970 -0
  37. package/dist/esm/node_modules/@tanstack/table-core/build/lib/index.js.map +1 -0
  38. package/dist/esm/node_modules/lodash/lodash.js +17207 -0
  39. package/dist/esm/node_modules/lodash/lodash.js.map +1 -0
  40. package/dist/esm/ui/DevToolContent/DevToolContentContainer.js +6 -6
  41. package/dist/esm/ui/DevToolContent/DevToolContentContainer.js.map +1 -1
  42. package/dist/esm/ui/DevToolContent/HttpControl.js +10 -20
  43. package/dist/esm/ui/DevToolContent/HttpControl.js.map +1 -1
  44. package/dist/esm/ui/MSWDevTool.js +4 -4
  45. package/dist/esm/ui/MSWDevTool.js.map +1 -1
  46. package/dist/types/index.d.ts +8 -34
  47. package/package.json +4 -2
  48. package/dist/cjs/node_modules/immer/dist/immer.js +0 -717
  49. package/dist/cjs/node_modules/immer/dist/immer.js.map +0 -1
  50. package/dist/cjs/utils/handlerMap.js +0 -13
  51. package/dist/cjs/utils/handlerMap.js.map +0 -1
  52. package/dist/esm/node_modules/immer/dist/immer.js +0 -708
  53. package/dist/esm/node_modules/immer/dist/immer.js.map +0 -1
  54. package/dist/esm/utils/handlerMap.js +0 -11
  55. package/dist/esm/utils/handlerMap.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
+
5
+ exports.commonjsGlobal = commonjsGlobal;
6
+ //# sourceMappingURL=_commonjsHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var lodash = {exports: {}};
4
+
5
+ exports.__module = lodash;
6
+ //# sourceMappingURL=lodash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodash.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var index = require('../node_modules/@tanstack/react-table/build/lib/index.js');
4
+ var handlerStore = require('../lib/handlerStore.js');
5
+ var React = require('react');
6
+ var index$1 = require('../node_modules/@tanstack/table-core/build/lib/index.js');
7
+
8
+ const useFlattenHandlersTable = () => {
9
+ const { flattenHandlers, handlerRowSelection, handleHandlerRowSelectionChange, } = handlerStore.useHandlerStore();
10
+ const columnHelper = index$1.createColumnHelper();
11
+ const columns = React.useMemo(() => {
12
+ return [
13
+ columnHelper.accessor("enabled", {
14
+ header: ({ table }) => (React.createElement("input", { type: "checkbox", checked: table.getIsAllRowsSelected(), onChange: (e) => table.toggleAllRowsSelected(e.target.checked) })),
15
+ cell: ({ row }) => (React.createElement("input", { type: "checkbox", checked: row.getIsSelected(), onChange: (e) => row.toggleSelected(e.target.checked) })),
16
+ }),
17
+ columnHelper.accessor("path", {
18
+ header: "End point",
19
+ }),
20
+ columnHelper.accessor("method", {
21
+ header: "Method",
22
+ cell: ({ row }) => (React.createElement("div", { className: "msw-dev-tool-center" }, row.original.method)),
23
+ }),
24
+ ];
25
+ }, []);
26
+ const table = index.useReactTable({
27
+ columns,
28
+ data: flattenHandlers,
29
+ getCoreRowModel: index$1.getCoreRowModel(),
30
+ state: {
31
+ rowSelection: handlerRowSelection,
32
+ },
33
+ onRowSelectionChange: handleHandlerRowSelectionChange,
34
+ getRowId: (row) => row.id,
35
+ enableRowSelection: true,
36
+ });
37
+ return table;
38
+ };
39
+
40
+ exports.useFlattenHandlersTable = useFlattenHandlersTable;
41
+ //# sourceMappingURL=useFlattenHandlersTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFlattenHandlersTable.js","sources":["../../../src/hook/useFlattenHandlersTable.tsx"],"sourcesContent":["import {\n ColumnDef,\n createColumnHelper,\n getCoreRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useHandlerStore } from \"../lib/handlerStore\";\nimport { FlattenHandler } from \"../lib\";\nimport React, { useMemo } from \"react\";\n\nexport const useFlattenHandlersTable = () => {\n const {\n flattenHandlers,\n handlerRowSelection,\n handleHandlerRowSelectionChange,\n } = useHandlerStore();\n\n const columnHelper = createColumnHelper<FlattenHandler>();\n const columns: ColumnDef<FlattenHandler, any>[] = useMemo(() => {\n return [\n columnHelper.accessor(\"enabled\", {\n header: ({ table }) => (\n <input\n type=\"checkbox\"\n checked={table.getIsAllRowsSelected()}\n onChange={(e) => table.toggleAllRowsSelected(e.target.checked)}\n />\n ),\n cell: ({ row }) => (\n <input\n type=\"checkbox\"\n checked={row.getIsSelected()}\n onChange={(e) => row.toggleSelected(e.target.checked)}\n />\n ),\n }),\n columnHelper.accessor(\"path\", {\n header: \"End point\",\n }),\n columnHelper.accessor(\"method\", {\n header: \"Method\",\n cell: ({ row }) => (\n <div className=\"msw-dev-tool-center\">{row.original.method}</div>\n ),\n }),\n ];\n }, []);\n\n const table = useReactTable({\n columns,\n data: flattenHandlers,\n getCoreRowModel: getCoreRowModel(),\n state: {\n rowSelection: handlerRowSelection,\n },\n onRowSelectionChange: handleHandlerRowSelectionChange,\n getRowId: (row) => row.id,\n enableRowSelection: true,\n });\n\n return table;\n};\n"],"names":["useHandlerStore","createColumnHelper","useMemo","useReactTable","getCoreRowModel"],"mappings":";;;;;;;AAUO,MAAM,uBAAuB,GAAG,MAAK;IAC1C,MAAM,EACJ,eAAe,EACf,mBAAmB,EACnB,+BAA+B,GAChC,GAAGA,4BAAe,EAAE,CAAC;AAEtB,IAAA,MAAM,YAAY,GAAGC,0BAAkB,EAAkB,C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ACD,QAAA,oBAAoB,EAAE,+BAA+B;QACrD,QAAQ,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE;AACzB,QAAA,kBAAkB,EAAE,IAAI;AACzB,KAAA,CAAC,CAAC;AAEH,IAAA,OAAO,KAAK,CAAC;AACf;;;;"}
package/dist/cjs/index.js CHANGED
@@ -7,5 +7,4 @@ var handlerStore = require('./lib/handlerStore.js');
7
7
 
8
8
  exports.MSWDevTool = MSWDevTool.MSWDevTool;
9
9
  exports.initMSWDevTool = handlerStore.initMSWDevTool;
10
- exports.useHandlerStore = handlerStore.useHandlerStore;
11
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,46 +1,47 @@
1
1
  'use strict';
2
2
 
3
3
  var zustand = require('zustand');
4
- var immer = require('../node_modules/immer/dist/immer.js');
5
4
  var util = require('./util.js');
6
5
  var handler = require('../const/handler.js');
6
+ var lodash = require('../node_modules/lodash/lodash.js');
7
7
 
8
8
  const useHandlerStore = zustand.create((set, get) => ({
9
- handlerMap: {},
9
+ flattenHandlers: [],
10
10
  worker: null,
11
11
  restHandlers: [],
12
+ handlerRowSelection: {},
12
13
  initMSWDevTool: (_worker) => {
13
14
  const worker = _worker;
14
- set({ worker });
15
15
  const handlers = worker.listHandlers();
16
- const { handlerMap, unsupportedHandlers } = util.convertHandlers(handlers);
17
- set({ handlerMap });
16
+ const { flattenHandlers, unsupportedHandlers } = util.convertHandlers(handlers);
17
+ const handlerRowSelection = flattenHandlers.reduce((acc, handler) => {
18
+ acc[handler.id] = handler.enabled;
19
+ return acc;
20
+ }, {});
21
+ set({ worker });
22
+ set({ flattenHandlers });
23
+ set({
24
+ handlerRowSelection,
25
+ });
18
26
  set({ restHandlers: unsupportedHandlers });
19
27
  return worker;
20
28
  },
21
- setHandlerMap: (handlerMap) => {
22
- set({ handlerMap });
23
- return handlerMap;
24
- },
25
- getIsChecked: (url, method) => { var _a; return (_a = get().handlerMap[url]) === null || _a === void 0 ? void 0 : _a[method].checked; },
26
- setIsChecked: (url, method, isChecked) => {
27
- set(immer.produce((state) => {
28
- if (!state.handlerMap[url]) {
29
- return;
30
- }
31
- state.handlerMap[url][method].checked = isChecked;
32
- }));
33
- get().updateEnableHandlers();
34
- },
35
- toggleIsChecked: (url, method) => {
36
- set(immer.produce((state) => {
37
- var _a;
38
- if (!((_a = state.handlerMap[url]) === null || _a === void 0 ? void 0 : _a[method])) {
39
- return;
40
- }
41
- state.handlerMap[url][method].checked =
42
- !state.handlerMap[url][method].checked;
43
- }));
29
+ handleHandlerRowSelectionChange: (updater) => {
30
+ if (lodash.lodashExports.isFunction(updater)) {
31
+ set(({ handlerRowSelection }) => {
32
+ const next = updater(handlerRowSelection);
33
+ const current = get().flattenHandlers.map((handler) => next[handler.id]
34
+ ? { ...handler, enabled: true }
35
+ : { ...handler, enabled: false });
36
+ return { handlerRowSelection: next, flattenHandlers: current };
37
+ });
38
+ }
39
+ else {
40
+ const current = get().flattenHandlers.map((handler) => updater[handler.id]
41
+ ? { ...handler, enabled: true }
42
+ : { ...handler, enabled: false });
43
+ set({ handlerRowSelection: updater, flattenHandlers: current });
44
+ }
44
45
  get().updateEnableHandlers();
45
46
  },
46
47
  getWorker: () => {
@@ -50,9 +51,8 @@ const useHandlerStore = zustand.create((set, get) => ({
50
51
  return worker;
51
52
  },
52
53
  getTotalEnableHandlers: () => {
53
- const handlerMapList = util.flatHandlerMap(get().handlerMap);
54
- const checkedHttpHandlers = handlerMapList
55
- .filter((h) => h.checked)
54
+ const checkedHttpHandlers = get()
55
+ .flattenHandlers.filter((h) => h.enabled)
56
56
  .map((h) => h.handler);
57
57
  const otherProtocolHandlers = get().restHandlers;
58
58
  return [...checkedHttpHandlers, ...otherProtocolHandlers];
@@ -1 +1 @@
1
- {"version":3,"file":"handlerStore.js","sources":["../../../src/lib/handlerStore.ts"],"sourcesContent":["import { SetupWorker } from \"msw/browser\";\nimport { create } from \"zustand\";\nimport { produce } from \"immer\";\nimport { Handler, HandlerMap } from \"./type\";\nimport { convertHandlers, flatHandlerMap } from \"./util\";\nimport { dummyHandler } from \"../const/handler\";\nimport { HttpHandler } from \"msw\";\n\nexport interface HandlerStoreState {\n worker: SetupWorker | null;\n /**\n * HTTP handler map\n */\n handlerMap: HandlerMap;\n /**\n * GraphQL or WebSocketHandler\n *\n * **Currently not supported**\n */\n restHandlers: Handler[];\n initMSWDevTool: (worker: SetupWorker) => SetupWorker;\n setHandlerMap: (handlers: HandlerMap) => HandlerMap;\n getIsChecked: (url: string, method: string) => boolean;\n setIsChecked: (url: string, method: string, isChecked: boolean) => void;\n toggleIsChecked: (url: string, method: string) => void;\n getWorker: () => SetupWorker;\n getTotalEnableHandlers: () => (Handler | HttpHandler)[];\n /**\n * This has to do with `msw` internal workings.\n * If I spread an empty array in `resetHandlers`, it will be replaced by `initialHandler`.\n * Therefore, I proposed the `clear` method, but unfortunately it was not accepted!\n */\n updateEnableHandlers: () => void;\n}\nexport const useHandlerStore = create<HandlerStoreState>((set, get) => ({\n handlerMap: {},\n worker: null,\n restHandlers: [],\n initMSWDevTool: (_worker) => {\n const worker = _worker;\n set({ worker });\n const handlers = worker.listHandlers() as Handler[];\n const { handlerMap, unsupportedHandlers } = convertHandlers(handlers);\n set({ handlerMap });\n set({ restHandlers: unsupportedHandlers });\n return worker;\n },\n setHandlerMap: (handlerMap) => {\n set({ handlerMap });\n return handlerMap;\n },\n getIsChecked: (url, method) => get().handlerMap[url]?.[method].checked,\n setIsChecked: (url, method, isChecked) => {\n set(\n produce<HandlerStoreState>((state) => {\n if (!state.handlerMap[url]) {\n return;\n }\n state.handlerMap[url][method].checked = isChecked;\n })\n );\n get().updateEnableHandlers();\n },\n toggleIsChecked: (url, method) => {\n set(\n produce<HandlerStoreState>((state) => {\n if (!state.handlerMap[url]?.[method]) {\n return;\n }\n state.handlerMap[url][method].checked =\n !state.handlerMap[url][method].checked;\n })\n );\n get().updateEnableHandlers();\n },\n getWorker: () => {\n const worker = get().worker;\n if (!worker) throw new Error(\"Worker is not initialized\");\n return worker;\n },\n getTotalEnableHandlers: () => {\n const handlerMapList = flatHandlerMap(get().handlerMap);\n const checkedHttpHandlers = handlerMapList\n .filter((h) => h.checked)\n .map((h) => h.handler);\n const otherProtocolHandlers = get().restHandlers;\n return [...checkedHttpHandlers, ...otherProtocolHandlers];\n },\n updateEnableHandlers: () => {\n const worker = get().getWorker();\n const totalEnableHandlers = get().getTotalEnableHandlers();\n if (totalEnableHandlers.length === 0) {\n worker.resetHandlers(dummyHandler);\n return;\n }\n\n worker.resetHandlers(...totalEnableHandlers);\n },\n}));\n\nexport const initMSWDevTool = useHandlerStore.getState().initMSWDevTool;\n"],"names":["create","convertHandlers","produce","flatHandlerMap","dummyHandler"],"mappings":";;;;;;;AAkCO,MAAM,eAAe,GAAGA,cAAM,CAAoB,CAAC,GAAG,EAAE,GAAG,MAAM;AACtE,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,cAAc,EAAE,CAAC,OAAO,KAAI;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC;AACvB,QAAA,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AAChB,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAe,CAAC;QACpD,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAGC,oBAAe,CAAC,QAAQ,CAAC,CAAC;AACtE,QAAA,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;AACpB,QAAA,GAAG,CAAC,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAC3C,QAAA,OAAO,MAAM,CAAC;KACf;AACD,IAAA,aAAa,EAAE,CAAC,UAAU,KAAI;AAC5B,QA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AG,GAAG,EAAE,CAAC,MAAM,CAAC;AAC5B,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC1D,QAAA,OAAO,MAAM,CAAC;KACf;IACD,sBAAsB,EAAE,MAAK;QAC3B,MAAM,cAAc,GAAGC,mBAAc,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,mBAAmB,GAAG,cAAc;aACvC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;aACxB,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;AACzB,QAAA,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;AACjD,QAAA,OAAO,CAAC,GAAG,mBAAmB,EAAE,GAAG,qBAAqB,CAAC,CAAC;KAC3D;IACD,oBAAoB,EAAE,MAAK;AACzB,QAAA,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;AACjC,QAAA,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;AAC3D,QAAA,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;AACpC,YAAA,MAAM,CAAC,aAAa,CAACC,oBAAY,CAAC,CAAC;YACnC,OAAO;SACR;AAED,QAAA,MAAM,CAAC,aAAa,CAAC,GAAG,mBAAmB,CAAC,CAAC;KAC9C;AACF,CAAA,CAAC,EAAE;AAES,MAAA,cAAc,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;;;;;"}
1
+ {"version":3,"file":"handlerStore.js","sources":["../../../src/lib/handlerStore.ts"],"sourcesContent":["import { SetupWorker } from \"msw/browser\";\nimport { create } from \"zustand\";\nimport { FlattenHandler, Handler } from \"./type\";\nimport { convertHandlers } from \"./util\";\nimport { dummyHandler } from \"../const/handler\";\nimport { HttpHandler } from \"msw\";\nimport { OnChangeFn, RowSelectionState, Updater } from \"@tanstack/react-table\";\nimport { isFunction } from \"lodash\";\n\nexport interface HandlerStoreState {\n worker: SetupWorker | null;\n /**\n * GraphQL or WebSocketHandler\n *\n * **Currently not supported**\n */\n restHandlers: Handler[];\n flattenHandlers: FlattenHandler[];\n handlerRowSelection: RowSelectionState;\n initMSWDevTool: (worker: SetupWorker) => SetupWorker;\n handleHandlerRowSelectionChange: OnChangeFn<RowSelectionState>;\n getWorker: () => SetupWorker;\n getTotalEnableHandlers: () => (Handler | HttpHandler)[];\n /**\n * This has to do with `msw` internal workings.\n * If I spread an empty array in `resetHandlers`, it will be replaced by `initialHandler`.\n * Therefore, I proposed the `clear` method, but unfortunately it was not accepted!\n */\n updateEnableHandlers: () => void;\n}\nexport const useHandlerStore = create<HandlerStoreState>((set, get) => ({\n flattenHandlers: [],\n worker: null,\n restHandlers: [],\n handlerRowSelection: {},\n initMSWDevTool: (_worker) => {\n const worker = _worker;\n const handlers = worker.listHandlers() as Handler[];\n const { flattenHandlers, unsupportedHandlers } = convertHandlers(handlers);\n const handlerRowSelection = flattenHandlers.reduce((acc, handler) => {\n acc[handler.id] = handler.enabled;\n return acc;\n }, {} as RowSelectionState);\n\n set({ worker });\n set({ flattenHandlers });\n set({\n handlerRowSelection,\n });\n set({ restHandlers: unsupportedHandlers });\n \n return worker;\n },\n handleHandlerRowSelectionChange: (updater) => {\n if (isFunction(updater)) {\n set(({ handlerRowSelection }) => {\n const next = updater(handlerRowSelection);\n const current = get().flattenHandlers.map((handler) =>\n next[handler.id]\n ? { ...handler, enabled: true }\n : { ...handler, enabled: false }\n );\n return { handlerRowSelection: next, flattenHandlers: current };\n });\n } else {\n const current = get().flattenHandlers.map((handler) =>\n updater[handler.id]\n ? { ...handler, enabled: true }\n : { ...handler, enabled: false }\n );\n set({ handlerRowSelection: updater, flattenHandlers: current });\n }\n get().updateEnableHandlers();\n },\n getWorker: () => {\n const worker = get().worker;\n if (!worker) throw new Error(\"Worker is not initialized\");\n return worker;\n },\n getTotalEnableHandlers: () => {\n const checkedHttpHandlers = get()\n .flattenHandlers.filter((h) => h.enabled)\n .map((h) => h.handler);\n const otherProtocolHandlers = get().restHandlers;\n return [...checkedHttpHandlers, ...otherProtocolHandlers];\n },\n updateEnableHandlers: () => {\n const worker = get().getWorker();\n const totalEnableHandlers = get().getTotalEnableHandlers();\n if (totalEnableHandlers.length === 0) {\n worker.resetHandlers(dummyHandler);\n return;\n }\n\n worker.resetHandlers(...totalEnableHandlers);\n },\n}));\n\nexport const initMSWDevTool = useHandlerStore.getState().initMSWDevTool;\n"],"names":["create","convertHandlers","isFunction","dummyHandler"],"mappings":";;;;;;;AA8BO,MAAM,eAAe,GAAGA,cAAM,CAAoB,CAAC,GAAG,EAAE,GAAG,MAAM;AACtE,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,mBAAmB,EAAE,EAAE;AACvB,IAAA,cAAc,EAAE,CAAC,OAAO,KAAI;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC;AACvB,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAe,CAAC;QACpD,MAAM,EAAE,eAAe,EAAE,mBAAmB,EAAE,GAAGC,oBAAe,CAAC,QAAQ,CAAC,CAAC;QAC3E,MAAM,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,KAAI;YAClE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;AAClC,YAAA,OAAO,GAAG,CAAC;SACZ,EAAE,EAAuB,CAAC,CAAC;AAE5B,QAAA,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AAChB,QAAA,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;AACzB,QAAA,GAAG,CAAC;YACF,mBAAmB;AACpB,SAAA,CAAC,CAAC;AACH,QAAA,GAAG,CAAC,EAAE,Y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OAAO,MAAM,CAAC;KACf;IACD,sBAAsB,EAAE,MAAK;QAC3B,MAAM,mBAAmB,GAAG,GAAG,EAAE;aAC9B,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;aACxC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;AACzB,QAAA,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;AACjD,QAAA,OAAO,CAAC,GAAG,mBAAmB,EAAE,GAAG,qBAAqB,CAAC,CAAC;KAC3D;IACD,oBAAoB,EAAE,MAAK;AACzB,QAAA,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;AACjC,QAAA,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;AAC3D,QAAA,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;AACpC,YAAA,MAAM,CAAC,aAAa,CAACC,oBAAY,CAAC,CAAC;YACnC,OAAO;SACR;AAED,QAAA,MAAM,CAAC,aAAa,CAAC,GAAG,mBAAmB,CAAC,CAAC;KAC9C;AACF,CAAA,CAAC,EAAE;AAES,MAAA,cAAc,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;;;;;"}
@@ -1,16 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const flatHandlerMap = (handlerMap) => {
4
- return Object.entries(handlerMap).flatMap(([url, methods]) => Object.entries(methods).map(([method, { handler, checked }]) => ({
5
- url,
6
- method,
7
- handler,
8
- checked,
9
- })));
10
- };
3
+ const getRowId = ({ path, method }) => JSON.stringify({
4
+ path,
5
+ method,
6
+ });
11
7
  const convertHandlers = (handlers) => {
12
8
  const unsupportedHandlers = [];
13
- const handlerMap = handlers.reduce((acc, _handler) => {
9
+ const flattenHandlers = handlers.reduce((acc, _handler) => {
14
10
  // Current, GraphQL & WebSocketHandler is not supported.
15
11
  const handler = _handler;
16
12
  if (!("info" in handler && handler.info.method && handler.info.path)) {
@@ -19,15 +15,18 @@ const convertHandlers = (handlers) => {
19
15
  }
20
16
  const { method: _method, path: _path } = handler.info;
21
17
  const [method, path] = [_method.toString(), _path.toString()];
22
- if (!acc[path]) {
23
- acc[path] = {};
24
- }
25
- acc[path][method] = { handler, checked: true };
18
+ acc.push({
19
+ id: getRowId({ path, method }),
20
+ path,
21
+ method,
22
+ enabled: true,
23
+ handler,
24
+ });
26
25
  return acc;
27
- }, {});
28
- return { handlerMap, unsupportedHandlers };
26
+ }, []);
27
+ return { flattenHandlers, unsupportedHandlers };
29
28
  };
30
29
 
31
30
  exports.convertHandlers = convertHandlers;
32
- exports.flatHandlerMap = flatHandlerMap;
31
+ exports.getRowId = getRowId;
33
32
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../src/lib/util.ts"],"sourcesContent":["import { HttpHandler } from \"msw\";\nimport { Handler, HandlerMap } from \"./type\";\n\nexport const flatHandlerMap = (handlerMap: HandlerMap) => {\n return Object.entries(handlerMap).flatMap(([url, methods]) =>\n Object.entries(methods).map(([method, { handler, checked }]) => ({\n url,\n method,\n handler,\n checked,\n }))\n );\n};\n\nexport const convertHandlers = (\n handlers: Handler[]\n) => {\n const unsupportedHandlers: Handler[] = [];\n const handlerMap = handlers.reduce((acc, _handler) => {\n // Current, GraphQL & WebSocketHandler is not supported.\n const handler = _handler as HttpHandler;\n if (!(\"info\" in handler && handler.info.method && handler.info.path)) {\n unsupportedHandlers.push(handler);\n return acc;\n }\n const { method: _method, path: _path } = handler.info;\n const [method, path] = [_method.toString(), _path.toString()];\n if (!acc[path]) {\n acc[path] = {};\n }\n acc[path][method] = { handler, checked: true };\n return acc;\n }, {} as HandlerMap);\n return {handlerMap, unsupportedHandlers};\n};\n"],"names":[],"mappings":";;AAGa,MAAA,cAAc,GAAG,CAAC,UAAsB,KAAI;AACvD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAA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AU,EAAE,mBAAmB,EAAC,CAAC;AAC3C;;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../src/lib/util.ts"],"sourcesContent":["import { HttpHandler } from \"msw\";\nimport { FlattenHandler, Handler } from \"./type\";\n\nexport const getRowId = ({ path, method }: { path: string; method: string }) =>\n JSON.stringify({\n path,\n method,\n });\n\nexport const getObjFromRowId = (rowId: string) =>\n JSON.parse(rowId) as { path: string; method: string };\n\nexport const convertHandlers = (handlers: Handler[]) => {\n const unsupportedHandlers: Handler[] = [];\n const flattenHandlers: FlattenHandler[] = handlers.reduce((acc, _handler) => {\n // Current, GraphQL & WebSocketHandler is not supported.\n const handler = _handler as HttpHandler;\n if (!(\"info\" in handler && handler.info.method && handler.info.path)) {\n unsupportedHandlers.push(handler);\n return acc;\n }\n\n const { method: _method, path: _path } = handler.info;\n const [method, path] = [_method.toString(), _path.toString()];\n acc.push({\n id: getRowId({ path, method }),\n path,\n method,\n enabled: true,\n handler,\n });\n\n return acc;\n }, [] as FlattenHandler[]);\n return { flattenHandlers, unsupportedHandlers };\n};\n"],"names":[],"mappings":";;AAGa,MAAA,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAoC,KACzE,IAAI,CAAC,SAAS,CAAC;IACb,IAAI;IACJ,MAAM;AACP,CAAA,EAAE;AAKQ,MAAA,eAAe,GAAG,CAAC,QAAmB,KAAI;IACrD,MAAM,mBAAmB,GAAc,EAAE,CAAC;IAC1C,MAAM,eAAe,GAAqB,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAI;;QAE1E,MAAM,OAAO,GAAG,QAAuB,CAAC;AACxC,QAAA,IAAI,EAAE,MAAM,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACpE,YAAA,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClC,YAAA,OAAO,GAAG,CAAC;SACZ;AAED,QAAA,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;AACtD,QAAA,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC;YACP,EAAE,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC9B,IAAI;YACJ,MAAM;AACN,YAAA,OAAO,EAAE,IAAI;YACb,OAAO;AACR,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,GAAG,CAAC;KACZ,EAAE,EAAsB,CAAC,CAAC;AAC3B,IAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAClD;;;;;"}
@@ -1 +1 @@
1
- .entry-msw-dev-tool{align-items:center;background-color:#3498db;border:2px solid #3498db;border-radius:5px;color:#fff;cursor:pointer;display:flex;font-size:1rem;font-size:30px;font-weight:700;height:50px;justify-content:center;left:10px;position:absolute;text-align:center;text-decoration:none;text-transform:uppercase;top:10px;transition:all .3s ease;width:50px;z-index:999}.msw-dev-tool-container{background-color:#fff;border:1px solid #000;box-sizing:border-box;color:#000;left:0;padding:1.5rem;position:absolute;top:0;width:100%;z-index:1000}.msw-dev-tool-title-container{display:flex;justify-content:space-between}
1
+ .entry-msw-dev-tool{align-items:center;background-color:#3498db;border:2px solid #3498db;border-radius:5px;color:#fff;cursor:pointer;display:flex;font-size:1rem;font-size:30px;font-weight:700;height:50px;justify-content:center;left:10px;position:absolute;text-align:center;text-decoration:none;text-transform:uppercase;top:10px;transition:all .3s ease;width:50px;z-index:999}.msw-dev-tool-container{background-color:#fff;border:1px solid #000;box-sizing:border-box;color:#000;left:0;padding:1.5rem;position:absolute;top:0;width:100%;z-index:1000}.msw-dev-tool-title-container{display:flex;justify-content:space-between}.msw-dev-tool-center{align-items:center;display:flex;justify-content:center}
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var index = require('../../../table-core/build/lib/index.js');
5
+
6
+ function _interopNamespaceDefault(e) {
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
24
+
25
+ /**
26
+ * react-table
27
+ *
28
+ * Copyright (c) TanStack
29
+ *
30
+ * This source code is licensed under the MIT license found in the
31
+ * LICENSE.md file in the root directory of this source tree.
32
+ *
33
+ * @license MIT
34
+ */
35
+
36
+ //
37
+
38
+ /**
39
+ * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
40
+ */
41
+ function flexRender(Comp, props) {
42
+ return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
43
+ }
44
+ function isReactComponent(component) {
45
+ return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
46
+ }
47
+ function isClassComponent(component) {
48
+ return typeof component === 'function' && (() => {
49
+ const proto = Object.getPrototypeOf(component);
50
+ return proto.prototype && proto.prototype.isReactComponent;
51
+ })();
52
+ }
53
+ function isExoticComponent(component) {
54
+ return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
55
+ }
56
+ function useReactTable(options) {
57
+ // Compose in the generic options to the user options
58
+ const resolvedOptions = {
59
+ state: {},
60
+ // Dummy state
61
+ onStateChange: () => {},
62
+ // noop
63
+ renderFallbackValue: null,
64
+ ...options
65
+ };
66
+
67
+ // Create a new table and store it in state
68
+ const [tableRef] = React__namespace.useState(() => ({
69
+ current: index.createTable(resolvedOptions)
70
+ }));
71
+
72
+ // By default, manage table state here using the table's initial state
73
+ const [state, setState] = React__namespace.useState(() => tableRef.current.initialState);
74
+
75
+ // Compose the default state above with any user state. This will allow the user
76
+ // to only control a subset of the state if desired.
77
+ tableRef.current.setOptions(prev => ({
78
+ ...prev,
79
+ ...options,
80
+ state: {
81
+ ...state,
82
+ ...options.state
83
+ },
84
+ // Similarly, we'll maintain both our internal state and any user-provided
85
+ // state.
86
+ onStateChange: updater => {
87
+ setState(updater);
88
+ options.onStateChange == null || options.onStateChange(updater);
89
+ }
90
+ }));
91
+ return tableRef.current;
92
+ }
93
+
94
+ exports.ColumnFaceting = index.ColumnFaceting;
95
+ exports.ColumnFiltering = index.ColumnFiltering;
96
+ exports.ColumnGrouping = index.ColumnGrouping;
97
+ exports.ColumnOrdering = index.ColumnOrdering;
98
+ exports.ColumnPinning = index.ColumnPinning;
99
+ exports.ColumnSizing = index.ColumnSizing;
100
+ exports.ColumnVisibility = index.ColumnVisibility;
101
+ exports.GlobalFaceting = index.GlobalFaceting;
102
+ exports.GlobalFiltering = index.GlobalFiltering;
103
+ exports.Headers = index.Headers;
104
+ exports.RowExpanding = index.RowExpanding;
105
+ exports.RowPagination = index.RowPagination;
106
+ exports.RowPinning = index.RowPinning;
107
+ exports.RowSelection = index.RowSelection;
108
+ exports.RowSorting = index.RowSorting;
109
+ exports._getVisibleLeafColumns = index._getVisibleLeafColumns;
110
+ exports.aggregationFns = index.aggregationFns;
111
+ exports.buildHeaderGroups = index.buildHeaderGroups;
112
+ exports.createCell = index.createCell;
113
+ exports.createColumn = index.createColumn;
114
+ exports.createColumnHelper = index.createColumnHelper;
115
+ exports.createRow = index.createRow;
116
+ exports.createTable = index.createTable;
117
+ exports.defaultColumnSizing = index.defaultColumnSizing;
118
+ exports.filterFns = index.filterFns;
119
+ exports.flattenBy = index.flattenBy;
120
+ exports.functionalUpdate = index.functionalUpdate;
121
+ exports.getCoreRowModel = index.getCoreRowModel;
122
+ exports.getMemoOptions = index.getMemoOptions;
123
+ exports.isFunction = index.isFunction;
124
+ exports.isNumberArray = index.isNumberArray;
125
+ exports.isRowSelected = index.isRowSelected;
126
+ exports.isSubRowSelected = index.isSubRowSelected;
127
+ exports.makeStateUpdater = index.makeStateUpdater;
128
+ exports.memo = index.memo;
129
+ exports.orderColumns = index.orderColumns;
130
+ exports.passiveEventSupported = index.passiveEventSupported;
131
+ exports.reSplitAlphaNumeric = index.reSplitAlphaNumeric;
132
+ exports.selectRowsFn = index.selectRowsFn;
133
+ exports.shouldAutoRemoveFilter = index.shouldAutoRemoveFilter;
134
+ exports.sortingFns = index.sortingFns;
135
+ exports.flexRender = flexRender;
136
+ exports.useReactTable = useReactTable;
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@tanstack/react-table/build/lib/index.mjs"],"sourcesContent":["/**\n * react-table\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { createTable } from '@tanstack/table-core';\nexport * from '@tanstack/table-core';\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nfunction flexRender(Comp, props) {\n return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, props) : Comp;\n}\nfunction isReactComponent(component) {\n return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);\n}\nfunction isClassComponent(component) {\n return typeof component === 'function' && (() => {\n const proto = Object.getPrototypeOf(component);\n return proto.prototype && proto.prototype.isReactComponent;\n })();\n}\nfunction isExoticComponent(component) {\n return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);\n}\nfunction useReactTable(options) {\n // Compose in the generic options to the user options\n const resolvedOptions = {\n state: {},\n // Dummy state\n onStateChange: () => {},\n // noop\n renderFallbackValue: null,\n ...options\n };\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions)\n }));\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState);\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater);\n options.onStateChange == null || options.onStateChange(updater);\n }\n }));\n return tableRef.current;\n}\n\nexport { flexRender, useReactTable };\n//# sourceMappingURL=index.mjs.map\n"],"names":["React","createTable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE;AACjC,EAAE,OAAO,CAAC,IAAI,GAAG,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,gBAAgBA,gBAAK,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;AACtG,CAAC;AACD,SAAS,gBAAgB,CAAC,SAAS,EAAE;AACrC,EAAE,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,OAAO,SAAS,KAAK,UAAU,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACxG,CAAC;AACD,SAAS,gBAAgB,CAAC,SAAS,EAAE;AACrC,EAAE,OAAO,OAAO,SAAS,KAAK,UAAU,IAAI,CAAC,MAAM;AACnD,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACnD,IAAI,OAAO,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC;AAC/D,GAAG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