@northern.tech/testing 0.1.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.
Files changed (84) hide show
  1. package/dist/baseTestConfig.json +24 -0
  2. package/dist/chunk-3KEPLFEG.js +64 -0
  3. package/dist/chunk-3KEPLFEG.js.map +1 -0
  4. package/dist/chunk-4ZCNCVNV.js +309 -0
  5. package/dist/chunk-4ZCNCVNV.js.map +1 -0
  6. package/dist/chunk-5MREOBVU.js +833 -0
  7. package/dist/chunk-5MREOBVU.js.map +1 -0
  8. package/dist/chunk-A7LWVKMZ.js +209 -0
  9. package/dist/chunk-A7LWVKMZ.js.map +1 -0
  10. package/dist/chunk-ERCKCRE4.js +179 -0
  11. package/dist/chunk-ERCKCRE4.js.map +1 -0
  12. package/dist/chunk-HRGVXWMH.js +17 -0
  13. package/dist/chunk-HRGVXWMH.js.map +1 -0
  14. package/dist/chunk-MH5OGHNU.js +29 -0
  15. package/dist/chunk-MH5OGHNU.js.map +1 -0
  16. package/dist/chunk-QSR5PAZ3.js +207 -0
  17. package/dist/chunk-QSR5PAZ3.js.map +1 -0
  18. package/dist/mockData.cjs +866 -0
  19. package/dist/mockData.cjs.map +1 -0
  20. package/dist/mockData.d.cts +558 -0
  21. package/dist/mockData.d.ts +558 -0
  22. package/dist/mockData.js +45 -0
  23. package/dist/mockData.js.map +1 -0
  24. package/dist/requestHandlers/deploymentHandlers.cjs +955 -0
  25. package/dist/requestHandlers/deploymentHandlers.cjs.map +1 -0
  26. package/dist/requestHandlers/deploymentHandlers.d.cts +5 -0
  27. package/dist/requestHandlers/deploymentHandlers.d.ts +5 -0
  28. package/dist/requestHandlers/deploymentHandlers.js +8 -0
  29. package/dist/requestHandlers/deploymentHandlers.js.map +1 -0
  30. package/dist/requestHandlers/deviceHandlers.cjs +1044 -0
  31. package/dist/requestHandlers/deviceHandlers.cjs.map +1 -0
  32. package/dist/requestHandlers/deviceHandlers.d.cts +20 -0
  33. package/dist/requestHandlers/deviceHandlers.d.ts +20 -0
  34. package/dist/requestHandlers/deviceHandlers.js +12 -0
  35. package/dist/requestHandlers/deviceHandlers.js.map +1 -0
  36. package/dist/requestHandlers/monitorHandlers.cjs +775 -0
  37. package/dist/requestHandlers/monitorHandlers.cjs.map +1 -0
  38. package/dist/requestHandlers/monitorHandlers.d.cts +5 -0
  39. package/dist/requestHandlers/monitorHandlers.d.ts +5 -0
  40. package/dist/requestHandlers/monitorHandlers.js +8 -0
  41. package/dist/requestHandlers/monitorHandlers.js.map +1 -0
  42. package/dist/requestHandlers/organizationHandlers.cjs +968 -0
  43. package/dist/requestHandlers/organizationHandlers.cjs.map +1 -0
  44. package/dist/requestHandlers/organizationHandlers.d.cts +5 -0
  45. package/dist/requestHandlers/organizationHandlers.d.ts +5 -0
  46. package/dist/requestHandlers/organizationHandlers.js +8 -0
  47. package/dist/requestHandlers/organizationHandlers.js.map +1 -0
  48. package/dist/requestHandlers/releaseHandlers.cjs +809 -0
  49. package/dist/requestHandlers/releaseHandlers.cjs.map +1 -0
  50. package/dist/requestHandlers/releaseHandlers.d.cts +5 -0
  51. package/dist/requestHandlers/releaseHandlers.d.ts +5 -0
  52. package/dist/requestHandlers/releaseHandlers.js +8 -0
  53. package/dist/requestHandlers/releaseHandlers.js.map +1 -0
  54. package/dist/requestHandlers/requestHandlers.cjs +1712 -0
  55. package/dist/requestHandlers/requestHandlers.cjs.map +1 -0
  56. package/dist/requestHandlers/requestHandlers.d.cts +5 -0
  57. package/dist/requestHandlers/requestHandlers.d.ts +5 -0
  58. package/dist/requestHandlers/requestHandlers.js +35 -0
  59. package/dist/requestHandlers/requestHandlers.js.map +1 -0
  60. package/dist/requestHandlers/userHandlers.cjs +925 -0
  61. package/dist/requestHandlers/userHandlers.cjs.map +1 -0
  62. package/dist/requestHandlers/userHandlers.d.cts +5 -0
  63. package/dist/requestHandlers/userHandlers.d.ts +5 -0
  64. package/dist/requestHandlers/userHandlers.js +8 -0
  65. package/dist/requestHandlers/userHandlers.js.map +1 -0
  66. package/dist/setupTests.cjs +905 -0
  67. package/dist/setupTests.cjs.map +1 -0
  68. package/dist/setupTests.d.cts +75 -0
  69. package/dist/setupTests.d.ts +75 -0
  70. package/dist/setupTests.js +119 -0
  71. package/dist/setupTests.js.map +1 -0
  72. package/dist/theme/light.cjs +41 -0
  73. package/dist/theme/light.cjs.map +1 -0
  74. package/dist/theme/light.d.cts +12 -0
  75. package/dist/theme/light.d.ts +12 -0
  76. package/dist/theme/light.js +7 -0
  77. package/dist/theme/light.js.map +1 -0
  78. package/dist/utils.cjs +41 -0
  79. package/dist/utils.cjs.map +1 -0
  80. package/dist/utils.d.cts +3 -0
  81. package/dist/utils.d.ts +3 -0
  82. package/dist/utils.js +16 -0
  83. package/dist/utils.js.map +1 -0
  84. package/package.json +55 -0
@@ -0,0 +1,24 @@
1
+ {
2
+ "server": {
3
+ "port": 80,
4
+ "middlewareMode": false
5
+ },
6
+ "test": {
7
+ "env": {
8
+ "BABEL_ENV": "test",
9
+ "NODE_ENV": "test",
10
+ "PUBLIC_URL": "",
11
+ "TZ": "UTC"
12
+ },
13
+ "retry": 0,
14
+ "environment": "jsdom",
15
+ "globals": true,
16
+ "fakeTimers": {
17
+ "toFake": [
18
+ "setTimeout",
19
+ "clearTimeout",
20
+ "Date"
21
+ ]
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,64 @@
1
+ import {
2
+ mockApiResponses,
3
+ releasesList
4
+ } from "./chunk-5MREOBVU.js";
5
+
6
+ // src/requestHandlers/releaseHandlers.ts
7
+ import { SORTING_OPTIONS, deploymentsApiUrl, deploymentsApiUrlV2, headerNames } from "@northern.tech/utils/constants";
8
+ import { customSort } from "@northern.tech/utils/helpers";
9
+ import { HttpResponse, http } from "msw";
10
+ var releaseHandlers = [
11
+ http.get(`${deploymentsApiUrl}/artifacts/:id/download`, () => HttpResponse.json({ uri: "https://testlocation.com/artifact.mender" })),
12
+ http.delete(
13
+ `${deploymentsApiUrl}/artifacts/:id`,
14
+ ({ params: { id } }) => new HttpResponse(null, { status: id === mockApiResponses.releases.byId.r1.artifacts[0].id ? 200 : 591 })
15
+ ),
16
+ http.put(`${deploymentsApiUrl}/artifacts/:id`, async ({ params: { id }, request }) => {
17
+ const { description } = await request.json();
18
+ return new HttpResponse(null, { status: id === mockApiResponses.releases.byId.r1.artifacts[0].id && description ? 200 : 592 });
19
+ }),
20
+ http.post(`${deploymentsApiUrl}/artifacts/generate`, () => new HttpResponse(null, { status: 200 })),
21
+ http.post(`${deploymentsApiUrl}/artifacts`, () => new HttpResponse(null, { status: 200 })),
22
+ http.get(`${deploymentsApiUrlV2}/deployments/releases`, async ({ request }) => {
23
+ const { searchParams } = new URL(request.url);
24
+ const page = Number(searchParams.get("page"));
25
+ const perPage = Number(searchParams.get("per_page"));
26
+ if (!page || ![1, 10, 20, 50, 100, 250, 500].includes(perPage)) {
27
+ return new HttpResponse(null, { status: 593 });
28
+ }
29
+ if (searchParams.get("device_type")) {
30
+ return HttpResponse.json([]);
31
+ }
32
+ if (page == 42) {
33
+ return new HttpResponse(JSON.stringify([mockApiResponses.releases.byId.r1]), { headers: { [headerNames.total]: 1 } });
34
+ }
35
+ const sort = searchParams.get("sort");
36
+ const releaseListSection = releasesList.sort(customSort(sort.includes(SORTING_OPTIONS.desc), "name")).slice((page - 1) * perPage, page * perPage);
37
+ if (page === 1 && perPage === 1 && searchParams.get("name")) {
38
+ return HttpResponse.json([mockApiResponses.releases.byId.r1]);
39
+ }
40
+ if (searchParams.get("name")) {
41
+ return new HttpResponse(JSON.stringify(releaseListSection), { headers: { [headerNames.total]: 1234 } });
42
+ }
43
+ return new HttpResponse(JSON.stringify(releaseListSection), { headers: { [headerNames.total]: releasesList.length } });
44
+ }),
45
+ http.get(`${deploymentsApiUrlV2}/deployments/releases/:name`, () => HttpResponse.json(mockApiResponses.releases.byId.r1)),
46
+ http.get(`${deploymentsApiUrlV2}/releases/all/tags`, () => HttpResponse.json(["foo", "bar"])),
47
+ http.get(`${deploymentsApiUrlV2}/releases/all/types`, () => HttpResponse.json(["single-file", "not-this"])),
48
+ http.put(`${deploymentsApiUrlV2}/deployments/releases/:name/tags`, async ({ params: { name }, request }) => {
49
+ const tags = await request.json();
50
+ if (name && tags.every((i) => i && i.toString() === i)) {
51
+ return new HttpResponse(null, { status: 200 });
52
+ }
53
+ return new HttpResponse(null, { status: 593 });
54
+ }),
55
+ http.patch(`${deploymentsApiUrlV2}/deployments/releases/:name`, async ({ params: { name }, request }) => {
56
+ const { notes } = await request.json();
57
+ return new HttpResponse(null, { status: name && notes.length ? 200 : 594 });
58
+ })
59
+ ];
60
+
61
+ export {
62
+ releaseHandlers
63
+ };
64
+ //# sourceMappingURL=chunk-3KEPLFEG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/requestHandlers/releaseHandlers.ts"],"sourcesContent":["// Copyright 2020 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//@ts-nocheck\nimport { SORTING_OPTIONS, deploymentsApiUrl, deploymentsApiUrlV2, headerNames } from '@northern.tech/utils/constants';\nimport { customSort } from '@northern.tech/utils/helpers';\nimport { HttpResponse, http } from 'msw';\n\nimport { mockApiResponses, releasesList } from '../mockData';\n\nexport const releaseHandlers = [\n http.get(`${deploymentsApiUrl}/artifacts/:id/download`, () => HttpResponse.json({ uri: 'https://testlocation.com/artifact.mender' })),\n http.delete(\n `${deploymentsApiUrl}/artifacts/:id`,\n ({ params: { id } }) => new HttpResponse(null, { status: id === mockApiResponses.releases.byId.r1.artifacts[0].id ? 200 : 591 })\n ),\n http.put(`${deploymentsApiUrl}/artifacts/:id`, async ({ params: { id }, request }) => {\n const { description } = await request.json();\n return new HttpResponse(null, { status: id === mockApiResponses.releases.byId.r1.artifacts[0].id && description ? 200 : 592 });\n }),\n http.post(`${deploymentsApiUrl}/artifacts/generate`, () => new HttpResponse(null, { status: 200 })),\n http.post(`${deploymentsApiUrl}/artifacts`, () => new HttpResponse(null, { status: 200 })),\n http.get(`${deploymentsApiUrlV2}/deployments/releases`, async ({ request }) => {\n const { searchParams } = new URL(request.url);\n const page = Number(searchParams.get('page'));\n const perPage = Number(searchParams.get('per_page'));\n if (!page || ![1, 10, 20, 50, 100, 250, 500].includes(perPage)) {\n return new HttpResponse(null, { status: 593 });\n }\n if (searchParams.get('device_type')) {\n return HttpResponse.json([]);\n }\n if (page == 42) {\n return new HttpResponse(JSON.stringify([mockApiResponses.releases.byId.r1]), { headers: { [headerNames.total]: 1 } });\n }\n const sort = searchParams.get('sort');\n const releaseListSection = releasesList.sort(customSort(sort.includes(SORTING_OPTIONS.desc), 'name')).slice((page - 1) * perPage, page * perPage);\n if (page === 1 && perPage === 1 && searchParams.get('name')) {\n return HttpResponse.json([mockApiResponses.releases.byId.r1]);\n }\n if (searchParams.get('name')) {\n return new HttpResponse(JSON.stringify(releaseListSection), { headers: { [headerNames.total]: 1234 } });\n }\n return new HttpResponse(JSON.stringify(releaseListSection), { headers: { [headerNames.total]: releasesList.length } });\n }),\n http.get(`${deploymentsApiUrlV2}/deployments/releases/:name`, () => HttpResponse.json(mockApiResponses.releases.byId.r1)),\n http.get(`${deploymentsApiUrlV2}/releases/all/tags`, () => HttpResponse.json(['foo', 'bar'])),\n http.get(`${deploymentsApiUrlV2}/releases/all/types`, () => HttpResponse.json(['single-file', 'not-this'])),\n http.put(`${deploymentsApiUrlV2}/deployments/releases/:name/tags`, async ({ params: { name }, request }) => {\n const tags = await request.json();\n if (name && tags.every(i => i && i.toString() === i)) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 593 });\n }),\n http.patch(`${deploymentsApiUrlV2}/deployments/releases/:name`, async ({ params: { name }, request }) => {\n const { notes } = await request.json();\n return new HttpResponse(null, { status: name && notes.length ? 200 : 594 });\n })\n];\n"],"mappings":";;;;;;AAcA,SAAS,iBAAiB,mBAAmB,qBAAqB,mBAAmB;AACrF,SAAS,kBAAkB;AAC3B,SAAS,cAAc,YAAY;AAI5B,IAAM,kBAAkB;AAAA,EAC7B,KAAK,IAAI,GAAG,iBAAiB,2BAA2B,MAAM,aAAa,KAAK,EAAE,KAAK,2CAA2C,CAAC,CAAC;AAAA,EACpI,KAAK;AAAA,IACH,GAAG,iBAAiB;AAAA,IACpB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,IAAI,aAAa,MAAM,EAAE,QAAQ,OAAO,iBAAiB,SAAS,KAAK,GAAG,UAAU,CAAC,EAAE,KAAK,MAAM,IAAI,CAAC;AAAA,EACjI;AAAA,EACA,KAAK,IAAI,GAAG,iBAAiB,kBAAkB,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,QAAQ,MAAM;AACpF,UAAM,EAAE,YAAY,IAAI,MAAM,QAAQ,KAAK;AAC3C,WAAO,IAAI,aAAa,MAAM,EAAE,QAAQ,OAAO,iBAAiB,SAAS,KAAK,GAAG,UAAU,CAAC,EAAE,MAAM,cAAc,MAAM,IAAI,CAAC;AAAA,EAC/H,CAAC;AAAA,EACD,KAAK,KAAK,GAAG,iBAAiB,uBAAuB,MAAM,IAAI,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;AAAA,EAClG,KAAK,KAAK,GAAG,iBAAiB,cAAc,MAAM,IAAI,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;AAAA,EACzF,KAAK,IAAI,GAAG,mBAAmB,yBAAyB,OAAO,EAAE,QAAQ,MAAM;AAC7E,UAAM,EAAE,aAAa,IAAI,IAAI,IAAI,QAAQ,GAAG;AAC5C,UAAM,OAAO,OAAO,aAAa,IAAI,MAAM,CAAC;AAC5C,UAAM,UAAU,OAAO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C,CAAC;AAAA,EAC5F,KAAK,IAAI,GAAG,mBAAmB,uBAAuB,MAAM,aAAa,KAAK,CAAC,eAAe,UAAU,CAAC,CAAC;AAAA,EAC1G,KAAK,IAAI,GAAG,mBAAmB,oCAAoC,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,QAAQ,MAAM;AAC1G,UAAM,OAAO,MAAM,QAAQ,KAAK;AAChC,QAAI,QAAQ,KAAK,MAAM,OAAK,KAAK,EAAE,SAAS,MAAM,CAAC,GAAG;AACpD,aAAO,IAAI,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC/C;AACA,WAAO,IAAI,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC/C,CAAC;AAAA,EACD,KAAK,MAAM,GAAG,mBAAmB,+BAA+B,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,QAAQ,MAAM;AACvG,UAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,KAAK;AACrC,WAAO,IAAI,aAAa,MAAM,EAAE,QAAQ,QAAQ,MAAM,SAAS,MAAM,IAAI,CAAC;AAAA,EAC5E,CAAC;AACH;","names":[]}
@@ -0,0 +1,309 @@
1
+ import {
2
+ defaultCreationDate,
3
+ defaultMacAddress,
4
+ mockApiResponses
5
+ } from "./chunk-5MREOBVU.js";
6
+
7
+ // src/requestHandlers/deviceHandlers.ts
8
+ import {
9
+ DEVICE_FILTERING_OPTIONS,
10
+ DEVICE_STATES,
11
+ deviceAuthV2,
12
+ deviceConfig,
13
+ deviceConnect,
14
+ headerNames,
15
+ inventoryApiUrl,
16
+ inventoryApiUrlV2,
17
+ iotManagerBaseURL,
18
+ reportingApiUrl
19
+ } from "@northern.tech/utils/constants";
20
+ import { HttpResponse, http } from "msw";
21
+ var defaultDeviceId = "a1";
22
+ var deviceAuthDevice = {
23
+ id: defaultDeviceId,
24
+ identity_data: { mac: defaultMacAddress },
25
+ status: "accepted",
26
+ decommissioning: false,
27
+ created_ts: defaultCreationDate,
28
+ updated_ts: "2019-01-01T09:25:00.000Z",
29
+ auth_sets: [
30
+ {
31
+ id: "auth1",
32
+ identity_data: { mac: defaultMacAddress },
33
+ pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
34
+ ts: defaultCreationDate,
35
+ status: "accepted"
36
+ }
37
+ ]
38
+ };
39
+ var checkInTimeExact = "2019-01-01T10:25:00.000Z";
40
+ var updatedTime = "2019-01-01T09:25:00.000Z";
41
+ var inventoryDevice = {
42
+ id: defaultDeviceId,
43
+ attributes: [
44
+ { name: "network_interfaces", value: ["eth0", "wlan0"], scope: "inventory" },
45
+ { name: "kernel", value: "Linux version 4.19.75-v7l+", scope: "inventory" },
46
+ { name: "artifact_name", value: "raspotifyInstaller", scope: "inventory" },
47
+ { name: "ipv6_wlan0", value: "fe80::68d9:8453:3e9c:7c80/64", scope: "inventory" },
48
+ { name: "mac_eth0", value: defaultMacAddress, scope: "inventory" },
49
+ { name: "rootfs_type", value: "ext4", scope: "inventory" },
50
+ { name: "mender_bootloader_integration", value: "unknown", scope: "inventory" },
51
+ { name: "cpu_model", value: "ARMv7 Processor rev 3 (v7l)", scope: "inventory" },
52
+ { name: "hostname", value: "raspberrypi", scope: "inventory" },
53
+ { name: "mender_client_version", value: "2.1.0", scope: "inventory" },
54
+ { name: "ipv4_wlan0", value: "192.168.10.141/24", scope: "inventory" },
55
+ { name: "device_type", value: "raspberrypi4", scope: "inventory" },
56
+ { name: "mem_total_kB", value: "1986024", scope: "inventory" },
57
+ { name: "mac_wlan0", value: "dc:a6:32:12:ad:c0", scope: "inventory" },
58
+ { name: "os", value: "Raspbian GNU/Linux 10 (buster)", scope: "inventory" },
59
+ { name: "created_ts", value: defaultCreationDate, scope: "system" },
60
+ { name: "updated_ts", value: updatedTime, scope: "system" },
61
+ { name: "status", value: "accepted", scope: "identity" },
62
+ { name: "mac", value: defaultMacAddress, scope: "identity" },
63
+ { name: "group", value: "test", scope: "system" }
64
+ ],
65
+ check_in_time: checkInTimeExact,
66
+ updated_ts: updatedTime
67
+ };
68
+ var deviceAttributes = [
69
+ { name: "status", scope: "identity", count: 5 },
70
+ { name: "created_ts", scope: "system", count: 5 },
71
+ { name: "updated_ts", scope: "system", count: 5 },
72
+ { name: "mac", scope: "identity", count: 1 },
73
+ { name: "artifact_name", scope: "inventory", count: 1 },
74
+ { name: "cpu_model", scope: "inventory", count: 1 },
75
+ { name: "device_type", scope: "inventory", count: 1 },
76
+ { name: "hostname", scope: "inventory", count: 1 },
77
+ { name: "ipv4_wlan0", scope: "inventory", count: 1 },
78
+ { name: "ipv6_wlan0", scope: "inventory", count: 1 },
79
+ { name: "kernel", scope: "inventory", count: 1 },
80
+ { name: "mac_eth0", scope: "inventory", count: 1 },
81
+ { name: "mac_wlan0", scope: "inventory", count: 1 },
82
+ { name: "mem_total_kB", scope: "inventory", count: 1 },
83
+ { name: "mender_bootloader_integration", scope: "inventory", count: 1 },
84
+ { name: "mender_client_version", scope: "inventory", count: 1 },
85
+ { name: "network_interfaces", scope: "inventory", count: 1 },
86
+ { name: "os", scope: "inventory", count: 1 },
87
+ { name: "rootfs_type", scope: "inventory", count: 1 },
88
+ { name: "group", scope: "system", count: 1 }
89
+ ];
90
+ var searchHandler = async ({ request }) => {
91
+ const { page, per_page, filters } = await request.json();
92
+ if ([page, per_page, filters].some((item) => !item)) {
93
+ return new HttpResponse(null, { status: 509 });
94
+ }
95
+ const filter = filters.find((filter2) => filter2.scope === "identity" && filter2.attribute === "status" && Object.values(DEVICE_STATES).includes(filter2.value));
96
+ const status = filter?.value || "";
97
+ if (!status || filters.length > 1) {
98
+ if (filters.find((filter2) => filter2.attribute === "group" && filter2.value.includes(Object.keys(mockApiResponses.devices.groups.byId)[0]))) {
99
+ return new HttpResponse(JSON.stringify([inventoryDevice, { ...inventoryDevice, id: "b1" }]), {
100
+ headers: { [headerNames.total]: 2 }
101
+ });
102
+ }
103
+ if (filters.find((filter2) => filter2.scope === "monitor" && ["failed_last_update", "alerts", "auth_request"].includes(filter2.attribute))) {
104
+ return new HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [headerNames.total]: 4 } });
105
+ }
106
+ return new HttpResponse(JSON.stringify([]), { headers: { [headerNames.total]: 0 } });
107
+ }
108
+ let deviceList = Array.from({ length: mockApiResponses.devices.byStatus[status].total }, (_, index) => ({
109
+ ...inventoryDevice,
110
+ attributes: [...inventoryDevice.attributes, { name: "test-count", value: index, scope: "system" }],
111
+ id: `${String.fromCharCode("a".charCodeAt(0) + index)}1`
112
+ }));
113
+ deviceList = deviceList.slice((page - 1) * per_page, page * per_page);
114
+ return new HttpResponse(JSON.stringify(deviceList), { headers: { [headerNames.total]: mockApiResponses.devices.byStatus[status].total } });
115
+ };
116
+ var deviceHandlers = [
117
+ http.delete(`${deviceAuthV2}/devices/:deviceId/auth/:authId`, ({ params: { authId, deviceId } }) => {
118
+ if (mockApiResponses.devices.byId[deviceId].auth_sets.find((authSet) => authSet.id === authId)) {
119
+ return new HttpResponse(null, { status: 200 });
120
+ }
121
+ return new HttpResponse(null, { status: 501 });
122
+ }),
123
+ http.delete(`${deviceAuthV2}/devices/:deviceId`, ({ params: { deviceId } }) => {
124
+ if (mockApiResponses.devices.byId[deviceId]) {
125
+ return new HttpResponse(null, { status: 200 });
126
+ }
127
+ return new HttpResponse(null, { status: 502 });
128
+ }),
129
+ http.delete(`${inventoryApiUrl}/groups/:group`, ({ params: { group } }) => {
130
+ if (mockApiResponses.devices.groups.byId[group]) {
131
+ return new HttpResponse(null, { status: 200 });
132
+ }
133
+ return new HttpResponse(null, { status: 515 });
134
+ }),
135
+ http.delete(`${inventoryApiUrl}/groups/:group/devices`, async ({ params: { group }, request }) => {
136
+ const deviceIds = await request.json();
137
+ if (mockApiResponses.devices.groups.byId[group] && deviceIds.every((id) => !!mockApiResponses.devices.byId[id])) {
138
+ return new HttpResponse(null, { status: 200 });
139
+ }
140
+ return new HttpResponse(null, { status: 503 });
141
+ }),
142
+ http.delete(`${inventoryApiUrlV2}/filters/:filterId`, ({ params: { filterId } }) => {
143
+ if (Object.values(mockApiResponses.devices.groups.byId).find((group) => group.id === filterId)) {
144
+ return new HttpResponse(null, { status: 200 });
145
+ }
146
+ return new HttpResponse(null, { status: 504 });
147
+ }),
148
+ http.get(`${deviceAuthV2}/devices`, ({ request }) => {
149
+ const { searchParams } = new URL(request.url);
150
+ const deviceIds = searchParams.getAll("id");
151
+ if (deviceIds.every((id) => !!mockApiResponses.devices.byId[id])) {
152
+ return HttpResponse.json(deviceIds.map((id) => ({ ...deviceAuthDevice, id })));
153
+ }
154
+ return new HttpResponse(null, { status: 505 });
155
+ }),
156
+ http.get(`${deviceAuthV2}/limits/max_devices`, () => HttpResponse.json({ limit: mockApiResponses.devices.limit })),
157
+ http.get(`${inventoryApiUrl}/devices/:deviceId`, ({ params: { deviceId } }) => {
158
+ if (mockApiResponses.devices.byId[deviceId]) {
159
+ return HttpResponse.json(inventoryDevice);
160
+ }
161
+ return new HttpResponse(null, { status: 506 });
162
+ }),
163
+ http.put(`${inventoryApiUrl}/devices/:deviceId/tags`, async ({ params: { deviceId }, request }) => {
164
+ const tags = await request.json();
165
+ if (!mockApiResponses.devices.byId[deviceId] && !Array.isArray(tags) && !tags.every((item) => item.name && item.value)) {
166
+ return new HttpResponse(null, { status: 506 });
167
+ }
168
+ return HttpResponse.json(tags);
169
+ }),
170
+ http.get(`${inventoryApiUrl}/groups`, () => {
171
+ const groups = Object.entries(mockApiResponses.devices.groups.byId).reduce((accu, [groupName, group]) => {
172
+ if (!group.id) {
173
+ accu.push(groupName);
174
+ }
175
+ return accu;
176
+ }, []);
177
+ return HttpResponse.json(groups);
178
+ }),
179
+ http.get(`${inventoryApiUrlV2}/filters/attributes`, () => HttpResponse.json(deviceAttributes)),
180
+ http.get(`${reportingApiUrl}/devices/attributes`, () => HttpResponse.json({ attributes: deviceAttributes, count: deviceAttributes.length, limit: 100 })),
181
+ http.get(`${reportingApiUrl}/devices/search/attributes`, () => HttpResponse.json(deviceAttributes)),
182
+ http.post(
183
+ `${reportingApiUrl}/devices/aggregate`,
184
+ () => HttpResponse.json([
185
+ {
186
+ name: "*",
187
+ items: [
188
+ { key: "test", count: 6 },
189
+ { key: "original", count: 1 }
190
+ ],
191
+ other_count: 42
192
+ }
193
+ ])
194
+ ),
195
+ http.get(
196
+ `${inventoryApiUrlV2}/filters`,
197
+ () => HttpResponse.json([
198
+ {
199
+ id: "filter1",
200
+ name: "testGroupDynamic",
201
+ terms: [
202
+ { scope: "identity", attribute: "id", type: "$in", value: [defaultDeviceId] },
203
+ { scope: "identity", attribute: "mac", type: "$exists", value: false },
204
+ { scope: "identity", attribute: "kernel", type: "$exists", value: true }
205
+ ]
206
+ }
207
+ ])
208
+ ),
209
+ http.patch(`${inventoryApiUrl}/groups/:group/devices`, async ({ params: { group }, request }) => {
210
+ const deviceIds = await request.json();
211
+ if (!!group && deviceIds.every((id) => !!mockApiResponses.devices.byId[id])) {
212
+ return new HttpResponse(null, { status: 200 });
213
+ }
214
+ return new HttpResponse(null, { status: 508 });
215
+ }),
216
+ http.post(`${deviceAuthV2}/devices`, async ({ request }) => {
217
+ const authset = await request.json();
218
+ if (Object.values(mockApiResponses.devices.byId).some(
219
+ (device) => device.auth_sets.some((deviceAuthSet) => deviceAuthSet.pubkey == authset.pubkey || deviceAuthSet.identity_data == authset.identity_data)
220
+ )) {
221
+ return new HttpResponse(null, { status: 409 });
222
+ }
223
+ return new HttpResponse(null, { status: 200 });
224
+ }),
225
+ http.post(`${inventoryApiUrlV2}/filters/search`, searchHandler),
226
+ http.post(`${reportingApiUrl}/filters/search`, searchHandler),
227
+ http.post(`${inventoryApiUrlV2}/filters`, async ({ request }) => {
228
+ const { name, terms } = await request.json();
229
+ if ([name, terms].some((item) => !item) || mockApiResponses.devices.groups[name] || !terms.every((term) => DEVICE_FILTERING_OPTIONS[term.type] && ["identity", "inventory", "system"].includes(term.scope) && !!term.value && !!term.attribute)) {
230
+ return new HttpResponse(null, { status: 510 });
231
+ }
232
+ return new HttpResponse(JSON.stringify({}), { headers: { location: "find/me/here/createdFilterId" } });
233
+ }),
234
+ http.put(`${deviceAuthV2}/devices/:deviceId/auth/:authId/status`, async ({ params: { authId, deviceId }, request }) => {
235
+ const { status } = await request.json();
236
+ if (mockApiResponses.devices.byId[deviceId].auth_sets.find((authSet) => authSet.id === authId) && DEVICE_STATES[status]) {
237
+ return new HttpResponse(null, { status: 200 });
238
+ }
239
+ return new HttpResponse(null, { status: 511 });
240
+ }),
241
+ http.get(`${deviceConfig}/:deviceId`, ({ params: { deviceId } }) => {
242
+ if (deviceId === "testId") {
243
+ return new HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });
244
+ }
245
+ if (mockApiResponses.devices.byId[deviceId]) {
246
+ return HttpResponse.json({
247
+ configured: { test: true, something: "else", aNumber: 42 },
248
+ deployment_id: "config1",
249
+ reported: { test: true, something: "else", aNumber: 42 },
250
+ updated_ts: updatedTime,
251
+ reported_ts: "2019-01-01T09:25:01.000Z"
252
+ });
253
+ }
254
+ return new HttpResponse(null, { status: 512 });
255
+ }),
256
+ http.put(`${deviceConfig}/:deviceId`, async ({ params: { deviceId }, request }) => {
257
+ const body = await request.text();
258
+ if (body.includes("evilValue")) {
259
+ return new HttpResponse(null, { status: 418 });
260
+ }
261
+ return new HttpResponse(null, { status: mockApiResponses.devices.byId[deviceId] ? 201 : 513 });
262
+ }),
263
+ http.post(`${deviceConfig}/:deviceId/deploy`, ({ params: { deviceId } }) => {
264
+ if (mockApiResponses.devices.byId[deviceId]) {
265
+ return HttpResponse.json({ deployment_id: "config1" });
266
+ }
267
+ return new HttpResponse(null, { status: 514 });
268
+ }),
269
+ http.get(`${deviceConnect}/devices/:deviceId`, ({ params: { deviceId } }) => {
270
+ if (deviceId === "testId") {
271
+ return new HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });
272
+ }
273
+ if (mockApiResponses.devices.byId[deviceId]) {
274
+ return HttpResponse.json({ status: "connected", updated_ts: mockApiResponses.devices.byId[deviceId].updated_ts });
275
+ }
276
+ return new HttpResponse(null, { status: 512 });
277
+ }),
278
+ http.post(`${deviceConnect}/devices/:deviceId/:action`, ({ params: { deviceId, action } }) => {
279
+ if (["check-update", "send-inventory"].includes(action) && mockApiResponses.devices.byId[deviceId]) {
280
+ return new HttpResponse(null, { status: 202 });
281
+ }
282
+ return new HttpResponse(null, { status: 518 });
283
+ }),
284
+ http.get(`${iotManagerBaseURL}/devices/:deviceId/state`, ({ params: { deviceId } }) => {
285
+ if (mockApiResponses.devices.byId[deviceId]) {
286
+ return HttpResponse.json({ deployment_id: mockApiResponses.deployments.byId.d1.id });
287
+ }
288
+ return new HttpResponse(null, { status: 515 });
289
+ }),
290
+ http.put(`${iotManagerBaseURL}/devices/:deviceId/state/:integrationId`, async ({ params: { deviceId }, request }) => {
291
+ const body = await request.json();
292
+ if (mockApiResponses.devices.byId[deviceId] && body) {
293
+ return HttpResponse.json({ deployment_id: mockApiResponses.deployments.byId.d1.id });
294
+ }
295
+ return new HttpResponse(null, { status: 516 });
296
+ }),
297
+ http.put(
298
+ `${deviceConnect}/devices/:deviceId/upload`,
299
+ ({ params: { deviceId } }) => new HttpResponse(null, { status: mockApiResponses.devices.byId[deviceId] ? 200 : 517 })
300
+ ),
301
+ http.get(`${deviceAuthV2}/reports/devices`, () => HttpResponse.text("test,report"))
302
+ ];
303
+
304
+ export {
305
+ defaultDeviceId,
306
+ inventoryDevice,
307
+ deviceHandlers
308
+ };
309
+ //# sourceMappingURL=chunk-4ZCNCVNV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/requestHandlers/deviceHandlers.ts"],"sourcesContent":["// Copyright 2020 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//@ts-nocheck\nimport {\n DEVICE_FILTERING_OPTIONS,\n DEVICE_STATES,\n deviceAuthV2,\n deviceConfig,\n deviceConnect,\n headerNames,\n inventoryApiUrl,\n inventoryApiUrlV2,\n iotManagerBaseURL,\n reportingApiUrl\n} from '@northern.tech/utils/constants';\nimport { HttpResponse, http } from 'msw';\n\nimport { defaultCreationDate, defaultMacAddress, mockApiResponses } from '../mockData';\n\nexport const defaultDeviceId = 'a1';\n\nconst deviceAuthDevice = {\n id: defaultDeviceId,\n identity_data: { mac: defaultMacAddress },\n status: 'accepted',\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: 'accepted'\n }\n ]\n};\n\nconst checkInTimeExact = '2019-01-01T10:25:00.000Z';\nconst updatedTime = '2019-01-01T09:25:00.000Z';\n\nexport const inventoryDevice = {\n id: defaultDeviceId,\n attributes: [\n { name: 'network_interfaces', value: ['eth0', 'wlan0'], scope: 'inventory' },\n { name: 'kernel', value: 'Linux version 4.19.75-v7l+', scope: 'inventory' },\n { name: 'artifact_name', value: 'raspotifyInstaller', scope: 'inventory' },\n { name: 'ipv6_wlan0', value: 'fe80::68d9:8453:3e9c:7c80/64', scope: 'inventory' },\n { name: 'mac_eth0', value: defaultMacAddress, scope: 'inventory' },\n { name: 'rootfs_type', value: 'ext4', scope: 'inventory' },\n { name: 'mender_bootloader_integration', value: 'unknown', scope: 'inventory' },\n { name: 'cpu_model', value: 'ARMv7 Processor rev 3 (v7l)', scope: 'inventory' },\n { name: 'hostname', value: 'raspberrypi', scope: 'inventory' },\n { name: 'mender_client_version', value: '2.1.0', scope: 'inventory' },\n { name: 'ipv4_wlan0', value: '192.168.10.141/24', scope: 'inventory' },\n { name: 'device_type', value: 'raspberrypi4', scope: 'inventory' },\n { name: 'mem_total_kB', value: '1986024', scope: 'inventory' },\n { name: 'mac_wlan0', value: 'dc:a6:32:12:ad:c0', scope: 'inventory' },\n { name: 'os', value: 'Raspbian GNU/Linux 10 (buster)', scope: 'inventory' },\n { name: 'created_ts', value: defaultCreationDate, scope: 'system' },\n { name: 'updated_ts', value: updatedTime, scope: 'system' },\n { name: 'status', value: 'accepted', scope: 'identity' },\n { name: 'mac', value: defaultMacAddress, scope: 'identity' },\n { name: 'group', value: 'test', scope: 'system' }\n ],\n check_in_time: checkInTimeExact,\n updated_ts: updatedTime\n};\n\nconst deviceAttributes = [\n { name: 'status', scope: 'identity', count: 5 },\n { name: 'created_ts', scope: 'system', count: 5 },\n { name: 'updated_ts', scope: 'system', count: 5 },\n { name: 'mac', scope: 'identity', count: 1 },\n { name: 'artifact_name', scope: 'inventory', count: 1 },\n { name: 'cpu_model', scope: 'inventory', count: 1 },\n { name: 'device_type', scope: 'inventory', count: 1 },\n { name: 'hostname', scope: 'inventory', count: 1 },\n { name: 'ipv4_wlan0', scope: 'inventory', count: 1 },\n { name: 'ipv6_wlan0', scope: 'inventory', count: 1 },\n { name: 'kernel', scope: 'inventory', count: 1 },\n { name: 'mac_eth0', scope: 'inventory', count: 1 },\n { name: 'mac_wlan0', scope: 'inventory', count: 1 },\n { name: 'mem_total_kB', scope: 'inventory', count: 1 },\n { name: 'mender_bootloader_integration', scope: 'inventory', count: 1 },\n { name: 'mender_client_version', scope: 'inventory', count: 1 },\n { name: 'network_interfaces', scope: 'inventory', count: 1 },\n { name: 'os', scope: 'inventory', count: 1 },\n { name: 'rootfs_type', scope: 'inventory', count: 1 },\n { name: 'group', scope: 'system', count: 1 }\n];\n\nconst searchHandler = async ({ request }) => {\n const { page, per_page, filters } = await request.json();\n if ([page, per_page, filters].some(item => !item)) {\n return new HttpResponse(null, { status: 509 });\n }\n const filter = filters.find(filter => filter.scope === 'identity' && filter.attribute === 'status' && Object.values(DEVICE_STATES).includes(filter.value));\n const status = filter?.value || '';\n if (!status || filters.length > 1) {\n if (filters.find(filter => filter.attribute === 'group' && filter.value.includes(Object.keys(mockApiResponses.devices.groups.byId)[0]))) {\n return new HttpResponse(JSON.stringify([inventoryDevice, { ...inventoryDevice, id: 'b1' }]), {\n headers: { [headerNames.total]: 2 }\n });\n }\n if (filters.find(filter => filter.scope === 'monitor' && ['failed_last_update', 'alerts', 'auth_request'].includes(filter.attribute))) {\n return new HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [headerNames.total]: 4 } });\n }\n return new HttpResponse(JSON.stringify([]), { headers: { [headerNames.total]: 0 } });\n }\n let deviceList = Array.from({ length: mockApiResponses.devices.byStatus[status].total }, (_, index) => ({\n ...inventoryDevice,\n attributes: [...inventoryDevice.attributes, { name: 'test-count', value: index, scope: 'system' }],\n id: `${String.fromCharCode('a'.charCodeAt(0) + index)}1`\n }));\n deviceList = deviceList.slice((page - 1) * per_page, page * per_page);\n return new HttpResponse(JSON.stringify(deviceList), { headers: { [headerNames.total]: mockApiResponses.devices.byStatus[status].total } });\n};\n\nexport const deviceHandlers = [\n http.delete(`${deviceAuthV2}/devices/:deviceId/auth/:authId`, ({ params: { authId, deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId].auth_sets.find(authSet => authSet.id === authId)) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 501 });\n }),\n http.delete(`${deviceAuthV2}/devices/:deviceId`, ({ params: { deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId]) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 502 });\n }),\n http.delete(`${inventoryApiUrl}/groups/:group`, ({ params: { group } }) => {\n if (mockApiResponses.devices.groups.byId[group]) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 515 });\n }),\n http.delete(`${inventoryApiUrl}/groups/:group/devices`, async ({ params: { group }, request }) => {\n const deviceIds = await request.json();\n if (mockApiResponses.devices.groups.byId[group] && deviceIds.every(id => !!mockApiResponses.devices.byId[id])) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 503 });\n }),\n http.delete(`${inventoryApiUrlV2}/filters/:filterId`, ({ params: { filterId } }) => {\n if (Object.values(mockApiResponses.devices.groups.byId).find(group => group.id === filterId)) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 504 });\n }),\n http.get(`${deviceAuthV2}/devices`, ({ request }) => {\n const { searchParams } = new URL(request.url);\n const deviceIds = searchParams.getAll('id');\n if (deviceIds.every(id => !!mockApiResponses.devices.byId[id])) {\n return HttpResponse.json(deviceIds.map(id => ({ ...deviceAuthDevice, id })));\n }\n return new HttpResponse(null, { status: 505 });\n }),\n http.get(`${deviceAuthV2}/limits/max_devices`, () => HttpResponse.json({ limit: mockApiResponses.devices.limit })),\n http.get(`${inventoryApiUrl}/devices/:deviceId`, ({ params: { deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json(inventoryDevice);\n }\n return new HttpResponse(null, { status: 506 });\n }),\n http.put(`${inventoryApiUrl}/devices/:deviceId/tags`, async ({ params: { deviceId }, request }) => {\n const tags = await request.json();\n if (!mockApiResponses.devices.byId[deviceId] && !Array.isArray(tags) && !tags.every(item => item.name && item.value)) {\n return new HttpResponse(null, { status: 506 });\n }\n return HttpResponse.json(tags);\n }),\n http.get(`${inventoryApiUrl}/groups`, () => {\n const groups = Object.entries(mockApiResponses.devices.groups.byId).reduce((accu, [groupName, group]) => {\n if (!group.id) {\n accu.push(groupName);\n }\n return accu;\n }, []);\n return HttpResponse.json(groups);\n }),\n http.get(`${inventoryApiUrlV2}/filters/attributes`, () => HttpResponse.json(deviceAttributes)),\n http.get(`${reportingApiUrl}/devices/attributes`, () => HttpResponse.json({ attributes: deviceAttributes, count: deviceAttributes.length, limit: 100 })),\n http.get(`${reportingApiUrl}/devices/search/attributes`, () => HttpResponse.json(deviceAttributes)),\n http.post(`${reportingApiUrl}/devices/aggregate`, () =>\n HttpResponse.json([\n {\n name: '*',\n items: [\n { key: 'test', count: 6 },\n { key: 'original', count: 1 }\n ],\n other_count: 42\n }\n ])\n ),\n http.get(`${inventoryApiUrlV2}/filters`, () =>\n HttpResponse.json([\n {\n id: 'filter1',\n name: 'testGroupDynamic',\n terms: [\n { scope: 'identity', attribute: 'id', type: '$in', value: [defaultDeviceId] },\n { scope: 'identity', attribute: 'mac', type: '$exists', value: false },\n { scope: 'identity', attribute: 'kernel', type: '$exists', value: true }\n ]\n }\n ])\n ),\n http.patch(`${inventoryApiUrl}/groups/:group/devices`, async ({ params: { group }, request }) => {\n const deviceIds = await request.json();\n if (!!group && deviceIds.every(id => !!mockApiResponses.devices.byId[id])) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 508 });\n }),\n http.post(`${deviceAuthV2}/devices`, async ({ request }) => {\n const authset = await request.json();\n if (\n Object.values(mockApiResponses.devices.byId).some(device =>\n device.auth_sets.some(deviceAuthSet => deviceAuthSet.pubkey == authset.pubkey || deviceAuthSet.identity_data == authset.identity_data)\n )\n ) {\n return new HttpResponse(null, { status: 409 });\n }\n return new HttpResponse(null, { status: 200 });\n }),\n http.post(`${inventoryApiUrlV2}/filters/search`, searchHandler),\n http.post(`${reportingApiUrl}/filters/search`, searchHandler),\n http.post(`${inventoryApiUrlV2}/filters`, async ({ request }) => {\n const { name, terms } = await request.json();\n if (\n [name, terms].some(item => !item) ||\n mockApiResponses.devices.groups[name] ||\n !terms.every(term => DEVICE_FILTERING_OPTIONS[term.type] && ['identity', 'inventory', 'system'].includes(term.scope) && !!term.value && !!term.attribute)\n ) {\n return new HttpResponse(null, { status: 510 });\n }\n return new HttpResponse(JSON.stringify({}), { headers: { location: 'find/me/here/createdFilterId' } });\n }),\n http.put(`${deviceAuthV2}/devices/:deviceId/auth/:authId/status`, async ({ params: { authId, deviceId }, request }) => {\n const { status } = await request.json();\n if (mockApiResponses.devices.byId[deviceId].auth_sets.find(authSet => authSet.id === authId) && DEVICE_STATES[status]) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 511 });\n }),\n http.get(`${deviceConfig}/:deviceId`, ({ params: { deviceId } }) => {\n if (deviceId === 'testId') {\n return new HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });\n }\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json({\n configured: { test: true, something: 'else', aNumber: 42 },\n deployment_id: 'config1',\n reported: { test: true, something: 'else', aNumber: 42 },\n updated_ts: updatedTime,\n reported_ts: '2019-01-01T09:25:01.000Z'\n });\n }\n return new HttpResponse(null, { status: 512 });\n }),\n http.put(`${deviceConfig}/:deviceId`, async ({ params: { deviceId }, request }) => {\n const body = await request.text();\n if (body.includes('evilValue')) {\n return new HttpResponse(null, { status: 418 });\n }\n return new HttpResponse(null, { status: mockApiResponses.devices.byId[deviceId] ? 201 : 513 });\n }),\n http.post(`${deviceConfig}/:deviceId/deploy`, ({ params: { deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json({ deployment_id: 'config1' });\n }\n return new HttpResponse(null, { status: 514 });\n }),\n http.get(`${deviceConnect}/devices/:deviceId`, ({ params: { deviceId } }) => {\n if (deviceId === 'testId') {\n return new HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });\n }\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json({ status: 'connected', updated_ts: mockApiResponses.devices.byId[deviceId].updated_ts });\n }\n return new HttpResponse(null, { status: 512 });\n }),\n http.post(`${deviceConnect}/devices/:deviceId/:action`, ({ params: { deviceId, action } }) => {\n if (['check-update', 'send-inventory'].includes(action) && mockApiResponses.devices.byId[deviceId]) {\n return new HttpResponse(null, { status: 202 });\n }\n return new HttpResponse(null, { status: 518 });\n }),\n http.get(`${iotManagerBaseURL}/devices/:deviceId/state`, ({ params: { deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json({ deployment_id: mockApiResponses.deployments.byId.d1.id });\n }\n return new HttpResponse(null, { status: 515 });\n }),\n http.put(`${iotManagerBaseURL}/devices/:deviceId/state/:integrationId`, async ({ params: { deviceId }, request }) => {\n const body = await request.json();\n if (mockApiResponses.devices.byId[deviceId] && body) {\n return HttpResponse.json({ deployment_id: mockApiResponses.deployments.byId.d1.id });\n }\n return new HttpResponse(null, { status: 516 });\n }),\n http.put(\n `${deviceConnect}/devices/:deviceId/upload`,\n ({ params: { deviceId } }) => new HttpResponse(null, { status: mockApiResponses.devices.byId[deviceId] ? 200 : 517 })\n ),\n http.get(`${deviceAuthV2}/reports/devices`, () => HttpResponse.text('test,report'))\n];\n"],"mappings":";;;;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,YAAY;AAI5B,IAAM,kBAAkB;AAE/B,IAAM,mBAAmB;AAAA,EACvB,IAAI;AAAA,EACJ,eAAe,EAAE,KAAK,kBAAkB;AAAA,EACxC,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,IACT;AAAA,MACE,IAAI;AAAA,MACJ,eAAe,EAAE,KAAK,kBAAkB;AAAA,MACxC,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,IAAM,mBAAmB;AACzB,IAAM,cAAc;AAEb,IAAM,kBAAkB;AAAA,EAC7B,IAAI;AAAA,EACJ,YAAY;AAAA,IACV,EAAE,MAAM,sBAAsB,OAAO,CAAC,Q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