@northern.tech/testing 0.19.2 → 0.19.4

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 (79) hide show
  1. package/dist/mockData.d.ts +0 -2
  2. package/dist/mockData.js +1 -2
  3. package/dist/openapi.yaml.d.ts +0 -2
  4. package/dist/public/baseTestConfig.json +3 -0
  5. package/dist/requestHandlers/deploymentHandlers.d.ts +1 -3
  6. package/dist/requestHandlers/deploymentHandlers.js +3 -4
  7. package/dist/requestHandlers/deploymentHandlers.js.map +1 -1
  8. package/dist/requestHandlers/deviceHandlers.d.ts +1 -3
  9. package/dist/requestHandlers/deviceHandlers.js +3 -4
  10. package/dist/requestHandlers/deviceHandlers.js.map +1 -1
  11. package/dist/requestHandlers/monitorHandlers.d.ts +1 -3
  12. package/dist/requestHandlers/monitorHandlers.js +3 -4
  13. package/dist/requestHandlers/monitorHandlers.js.map +1 -1
  14. package/dist/requestHandlers/organizationHandlers.d.ts +1 -3
  15. package/dist/requestHandlers/organizationHandlers.js +3 -4
  16. package/dist/requestHandlers/organizationHandlers.js.map +1 -1
  17. package/dist/requestHandlers/releaseHandlers.d.ts +1 -3
  18. package/dist/requestHandlers/releaseHandlers.js +3 -4
  19. package/dist/requestHandlers/releaseHandlers.js.map +1 -1
  20. package/dist/requestHandlers/requestHandlers.d.ts +1 -3
  21. package/dist/requestHandlers/requestHandlers.js +2 -3
  22. package/dist/requestHandlers/requestHandlers.js.map +1 -1
  23. package/dist/requestHandlers/userHandlers.d.ts +1 -3
  24. package/dist/requestHandlers/userHandlers.js +3 -4
  25. package/dist/requestHandlers/userHandlers.js.map +1 -1
  26. package/dist/requestHandlers/validation.d.ts +0 -2
  27. package/dist/requestHandlers/validation.js +1 -1
  28. package/dist/setupTests.d.ts +9 -12
  29. package/dist/setupTests.js +2 -13
  30. package/dist/setupTests.js.map +1 -1
  31. package/dist/theme/light.d.ts +0 -2
  32. package/dist/theme/light.js +0 -1
  33. package/dist/theme/mui.d.ts +0 -2
  34. package/dist/utils.d.ts +0 -2
  35. package/dist/utils.js +1 -2
  36. package/dist/{validation-DgBXU2ez.js → validation-BwwNVIxo.js} +3 -5
  37. package/dist/{validation-DgBXU2ez.js.map → validation-BwwNVIxo.js.map} +1 -1
  38. package/package.json +7 -8
  39. package/dist/mockData.cjs +0 -1408
  40. package/dist/mockData.cjs.map +0 -1
  41. package/dist/mockData.d.cts +0 -721
  42. package/dist/openapi.yaml.d.cjs +0 -0
  43. package/dist/openapi.yaml.d.cts +0 -4
  44. package/dist/requestHandlers/deploymentHandlers.cjs +0 -193
  45. package/dist/requestHandlers/deploymentHandlers.cjs.map +0 -1
  46. package/dist/requestHandlers/deploymentHandlers.d.cts +0 -4
  47. package/dist/requestHandlers/deviceHandlers.cjs +0 -467
  48. package/dist/requestHandlers/deviceHandlers.cjs.map +0 -1
  49. package/dist/requestHandlers/deviceHandlers.d.cts +0 -31
  50. package/dist/requestHandlers/monitorHandlers.cjs +0 -23
  51. package/dist/requestHandlers/monitorHandlers.cjs.map +0 -1
  52. package/dist/requestHandlers/monitorHandlers.d.cts +0 -4
  53. package/dist/requestHandlers/organizationHandlers.cjs +0 -313
  54. package/dist/requestHandlers/organizationHandlers.cjs.map +0 -1
  55. package/dist/requestHandlers/organizationHandlers.d.cts +0 -4
  56. package/dist/requestHandlers/releaseHandlers.cjs +0 -244
  57. package/dist/requestHandlers/releaseHandlers.cjs.map +0 -1
  58. package/dist/requestHandlers/releaseHandlers.d.cts +0 -4
  59. package/dist/requestHandlers/requestHandlers.cjs +0 -27
  60. package/dist/requestHandlers/requestHandlers.cjs.map +0 -1
  61. package/dist/requestHandlers/requestHandlers.d.cts +0 -4
  62. package/dist/requestHandlers/userHandlers.cjs +0 -164
  63. package/dist/requestHandlers/userHandlers.cjs.map +0 -1
  64. package/dist/requestHandlers/userHandlers.d.cts +0 -4
  65. package/dist/requestHandlers/validation.cjs +0 -4
  66. package/dist/requestHandlers/validation.d.cts +0 -5
  67. package/dist/setupTests.cjs +0 -172
  68. package/dist/setupTests.cjs.map +0 -1
  69. package/dist/setupTests.d.cts +0 -76
  70. package/dist/theme/light.cjs +0 -9
  71. package/dist/theme/light.cjs.map +0 -1
  72. package/dist/theme/light.d.cts +0 -5
  73. package/dist/theme/mui.d.cjs +0 -0
  74. package/dist/theme/mui.d.cts +0 -11
  75. package/dist/utils.cjs +0 -22
  76. package/dist/utils.cjs.map +0 -1
  77. package/dist/utils.d.cts +0 -5
  78. package/dist/validation-DAMYMdv9.cjs +0 -75
  79. package/dist/validation-DAMYMdv9.cjs.map +0 -1
@@ -1,467 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mockData = require("../mockData.cjs");
3
- const require_validation = require("../validation-DAMYMdv9.cjs");
4
- let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
5
- let msw = require("msw");
6
- //#region src/requestHandlers/deviceHandlers.ts
7
- const defaultDeviceId = "a1";
8
- const deviceAuthDevice = {
9
- id: "a1",
10
- identity_data: { mac: require_mockData.defaultMacAddress },
11
- status: "accepted",
12
- decommissioning: false,
13
- created_ts: require_mockData.defaultCreationDate,
14
- updated_ts: "2019-01-01T09:25:00.000Z",
15
- auth_sets: [{
16
- id: "auth1",
17
- identity_data: { mac: require_mockData.defaultMacAddress },
18
- pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
19
- ts: require_mockData.defaultCreationDate,
20
- status: "accepted"
21
- }]
22
- };
23
- const checkInTimeExact = "2019-01-01T10:25:00.000Z";
24
- const updatedTime = "2019-01-01T09:25:00.000Z";
25
- const inventoryDevice = {
26
- id: "a1",
27
- attributes: [
28
- {
29
- name: "network_interfaces",
30
- value: ["eth0", "wlan0"],
31
- scope: "inventory"
32
- },
33
- {
34
- name: "kernel",
35
- value: "Linux version 4.19.75-v7l+",
36
- scope: "inventory"
37
- },
38
- {
39
- name: "artifact_name",
40
- value: "raspotifyInstaller",
41
- scope: "inventory"
42
- },
43
- {
44
- name: "ipv6_wlan0",
45
- value: "fe80::68d9:8453:3e9c:7c80/64",
46
- scope: "inventory"
47
- },
48
- {
49
- name: "mac_eth0",
50
- value: require_mockData.defaultMacAddress,
51
- scope: "inventory"
52
- },
53
- {
54
- name: "rootfs_type",
55
- value: "ext4",
56
- scope: "inventory"
57
- },
58
- {
59
- name: "mender_bootloader_integration",
60
- value: "unknown",
61
- scope: "inventory"
62
- },
63
- {
64
- name: "cpu_model",
65
- value: "ARMv7 Processor rev 3 (v7l)",
66
- scope: "inventory"
67
- },
68
- {
69
- name: "hostname",
70
- value: "raspberrypi",
71
- scope: "inventory"
72
- },
73
- {
74
- name: "mender_client_version",
75
- value: "2.1.0",
76
- scope: "inventory"
77
- },
78
- {
79
- name: "ipv4_wlan0",
80
- value: "192.168.10.141/24",
81
- scope: "inventory"
82
- },
83
- {
84
- name: "device_type",
85
- value: "raspberrypi4",
86
- scope: "inventory"
87
- },
88
- {
89
- name: "mem_total_kB",
90
- value: "1986024",
91
- scope: "inventory"
92
- },
93
- {
94
- name: "mac_wlan0",
95
- value: "dc:a6:32:12:ad:c0",
96
- scope: "inventory"
97
- },
98
- {
99
- name: "os",
100
- value: "Raspbian GNU/Linux 10 (buster)",
101
- scope: "inventory"
102
- },
103
- {
104
- name: "created_ts",
105
- value: require_mockData.defaultCreationDate,
106
- scope: "system"
107
- },
108
- {
109
- name: "updated_ts",
110
- value: updatedTime,
111
- scope: "system"
112
- },
113
- {
114
- name: "status",
115
- value: "accepted",
116
- scope: "identity"
117
- },
118
- {
119
- name: "mac",
120
- value: require_mockData.defaultMacAddress,
121
- scope: "identity"
122
- },
123
- {
124
- name: "group",
125
- value: "test",
126
- scope: "system"
127
- }
128
- ],
129
- check_in_time: checkInTimeExact,
130
- updated_ts: updatedTime
131
- };
132
- const deviceComponents = {
133
- R123: [{
134
- name: "component_type",
135
- value: "rtos",
136
- scope: "inventory"
137
- }, {
138
- name: "version",
139
- value: "v1",
140
- scope: "inventory"
141
- }],
142
- R456: [{
143
- name: "component_type",
144
- value: "rtos",
145
- scope: "inventory"
146
- }, {
147
- name: "version",
148
- value: "v2",
149
- scope: "inventory"
150
- }]
151
- };
152
- const deviceAttributes = [
153
- {
154
- name: "status",
155
- scope: "identity",
156
- count: 5
157
- },
158
- {
159
- name: "created_ts",
160
- scope: "system",
161
- count: 5
162
- },
163
- {
164
- name: "updated_ts",
165
- scope: "system",
166
- count: 5
167
- },
168
- {
169
- name: "mac",
170
- scope: "identity",
171
- count: 1
172
- },
173
- {
174
- name: "artifact_name",
175
- scope: "inventory",
176
- count: 1
177
- },
178
- {
179
- name: "cpu_model",
180
- scope: "inventory",
181
- count: 1
182
- },
183
- {
184
- name: "device_type",
185
- scope: "inventory",
186
- count: 1
187
- },
188
- {
189
- name: "hostname",
190
- scope: "inventory",
191
- count: 1
192
- },
193
- {
194
- name: "ipv4_wlan0",
195
- scope: "inventory",
196
- count: 1
197
- },
198
- {
199
- name: "ipv6_wlan0",
200
- scope: "inventory",
201
- count: 1
202
- },
203
- {
204
- name: "kernel",
205
- scope: "inventory",
206
- count: 1
207
- },
208
- {
209
- name: "mac_eth0",
210
- scope: "inventory",
211
- count: 1
212
- },
213
- {
214
- name: "mac_wlan0",
215
- scope: "inventory",
216
- count: 1
217
- },
218
- {
219
- name: "mem_total_kB",
220
- scope: "inventory",
221
- count: 1
222
- },
223
- {
224
- name: "mender_bootloader_integration",
225
- scope: "inventory",
226
- count: 1
227
- },
228
- {
229
- name: "mender_client_version",
230
- scope: "inventory",
231
- count: 1
232
- },
233
- {
234
- name: "network_interfaces",
235
- scope: "inventory",
236
- count: 1
237
- },
238
- {
239
- name: "os",
240
- scope: "inventory",
241
- count: 1
242
- },
243
- {
244
- name: "rootfs_type",
245
- scope: "inventory",
246
- count: 1
247
- },
248
- {
249
- name: "group",
250
- scope: "system",
251
- count: 1
252
- }
253
- ];
254
- const searchHandler = require_validation.validated(async ({ request }) => {
255
- const { page, per_page, filters } = await request.json();
256
- if ([
257
- page,
258
- per_page,
259
- filters
260
- ].some((item) => !item)) return new msw.HttpResponse(null, { status: 509 });
261
- const status = filters.find((filter) => filter.scope === "identity" && filter.attribute === "status" && Object.values(_northern_tech_utils_constants.DEVICE_STATES).includes(filter.value))?.value || "";
262
- if (!status || filters.length > 1) {
263
- if (filters.find((filter) => filter.attribute === "group" && filter.value.includes(Object.keys(require_mockData.mockApiResponses.devices.groups.byId)[0]))) return new msw.HttpResponse(JSON.stringify([inventoryDevice, {
264
- ...inventoryDevice,
265
- id: "b1"
266
- }]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 2 } });
267
- if (filters.find((filter) => filter.scope === "monitor" && [
268
- "failed_last_update",
269
- "alerts",
270
- "auth_request"
271
- ].includes(filter.attribute))) return new msw.HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 4 } });
272
- if (filters.find((filter) => filter.scope === "system" && filter.attribute === "test_device")) return new msw.HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 3 } });
273
- return new msw.HttpResponse(JSON.stringify([]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 0 } });
274
- }
275
- let deviceList = Array.from({ length: require_mockData.mockApiResponses.devices.byStatus[status].total }, (_, index) => ({
276
- ...inventoryDevice,
277
- attributes: [...inventoryDevice.attributes, {
278
- name: "test-count",
279
- value: index,
280
- scope: "system"
281
- }],
282
- id: `${String.fromCharCode("a".charCodeAt(0) + index)}1`
283
- }));
284
- deviceList = deviceList.slice((page - 1) * per_page, page * per_page);
285
- return new msw.HttpResponse(JSON.stringify(deviceList), { headers: { [_northern_tech_utils_constants.headerNames.total]: require_mockData.mockApiResponses.devices.byStatus[status].total } });
286
- });
287
- const deviceHandlers = [
288
- msw.http.delete(`${_northern_tech_utils_constants.deviceAuthV2}/devices/:deviceId/auth/:authId`, ({ params: { authId, deviceId } }) => {
289
- if (require_mockData.mockApiResponses.devices.byId[deviceId].auth_sets.find((authSet) => authSet.id === authId)) return new msw.HttpResponse(null, { status: 200 });
290
- return new msw.HttpResponse(null, { status: 501 });
291
- }),
292
- msw.http.delete(`${_northern_tech_utils_constants.deviceAuthV2}/devices/:deviceId`, ({ params: { deviceId } }) => {
293
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return new msw.HttpResponse(null, { status: 200 });
294
- return new msw.HttpResponse(null, { status: 502 });
295
- }),
296
- msw.http.delete(`${_northern_tech_utils_constants.inventoryApiUrl}/groups/:group`, ({ params: { group } }) => {
297
- if (require_mockData.mockApiResponses.devices.groups.byId[group]) return new msw.HttpResponse(null, { status: 200 });
298
- return new msw.HttpResponse(null, { status: 515 });
299
- }),
300
- msw.http.delete(`${_northern_tech_utils_constants.inventoryApiUrl}/groups/:group/devices`, require_validation.validated(async ({ params: { group }, request }) => {
301
- const deviceIds = await request.json();
302
- if (require_mockData.mockApiResponses.devices.groups.byId[group] && deviceIds.every((id) => !!require_mockData.mockApiResponses.devices.byId[id])) return new msw.HttpResponse(null, { status: 200 });
303
- return new msw.HttpResponse(null, { status: 503 });
304
- })),
305
- msw.http.delete(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/:filterId`, ({ params: { filterId } }) => {
306
- if (Object.values(require_mockData.mockApiResponses.devices.groups.byId).find((group) => group.id === filterId)) return new msw.HttpResponse(null, { status: 200 });
307
- return new msw.HttpResponse(null, { status: 504 });
308
- }),
309
- msw.http.get(`${_northern_tech_utils_constants.deviceAuthV2}/devices`, ({ request }) => {
310
- const { searchParams } = new URL(request.url);
311
- const deviceIds = searchParams.getAll("id");
312
- if (deviceIds.every((id) => !!require_mockData.mockApiResponses.devices.byId[id])) return msw.HttpResponse.json(deviceIds.map((id) => ({
313
- ...deviceAuthDevice,
314
- id
315
- })));
316
- return new msw.HttpResponse(null, { status: 505 });
317
- }),
318
- msw.http.get(`${_northern_tech_utils_constants.deviceAuthV2}/limits/devices`, () => msw.HttpResponse.json(require_mockData.mockApiResponses.devices.limits)),
319
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrl}/devices/:deviceId`, ({ params: { deviceId } }) => {
320
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json(inventoryDevice);
321
- return new msw.HttpResponse(null, { status: 506 });
322
- }),
323
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrlV2}/devices/:deviceId/components`, require_validation.validated(({ params: { deviceId } }) => {
324
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json(deviceComponents);
325
- return new msw.HttpResponse(null, { status: 507 });
326
- })),
327
- msw.http.put(`${_northern_tech_utils_constants.inventoryApiUrl}/devices/:deviceId/tags`, require_validation.validated(async ({ params: { deviceId }, request }) => {
328
- const tags = await request.json();
329
- if (!require_mockData.mockApiResponses.devices.byId[deviceId] && !Array.isArray(tags) && !tags.every((item) => item.name && item.value)) return new msw.HttpResponse(null, { status: 506 });
330
- return msw.HttpResponse.json(tags);
331
- })),
332
- msw.http.put(`${_northern_tech_utils_constants.deviceAuthV2}/devices/:deviceId/flags`, ({ params: { deviceId } }) => {
333
- if (!require_mockData.mockApiResponses.devices.byId[deviceId]) return new msw.HttpResponse(null, { status: 506 });
334
- return new msw.HttpResponse(null, { status: 204 });
335
- }),
336
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrl}/groups`, () => {
337
- const groups = Object.entries(require_mockData.mockApiResponses.devices.groups.byId).reduce((accu, [groupName, group]) => {
338
- if (!group.id) accu.push(groupName);
339
- return accu;
340
- }, []);
341
- return msw.HttpResponse.json(groups);
342
- }),
343
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/attributes`, () => msw.HttpResponse.json(deviceAttributes)),
344
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters`, () => msw.HttpResponse.json([{
345
- id: "filter1",
346
- name: "testGroupDynamic",
347
- terms: [
348
- {
349
- scope: "identity",
350
- attribute: "id",
351
- type: "$in",
352
- value: ["a1"]
353
- },
354
- {
355
- scope: "identity",
356
- attribute: "mac",
357
- type: "$exists",
358
- value: false
359
- },
360
- {
361
- scope: "identity",
362
- attribute: "kernel",
363
- type: "$exists",
364
- value: true
365
- }
366
- ]
367
- }])),
368
- msw.http.patch(`${_northern_tech_utils_constants.inventoryApiUrl}/groups/:group/devices`, require_validation.validated(async ({ params: { group }, request }) => {
369
- const deviceIds = await request.json();
370
- if (!!group && deviceIds.every((id) => !!require_mockData.mockApiResponses.devices.byId[id])) return new msw.HttpResponse(null, { status: 200 });
371
- return new msw.HttpResponse(null, { status: 508 });
372
- })),
373
- msw.http.post(`${_northern_tech_utils_constants.deviceAuthV2}/devices`, require_validation.validated(async ({ request }) => {
374
- const authset = await request.json();
375
- if (Object.values(require_mockData.mockApiResponses.devices.byId).some((device) => device.auth_sets.some((deviceAuthSet) => deviceAuthSet.pubkey == authset.pubkey || deviceAuthSet.identity_data == authset.identity_data))) return new msw.HttpResponse(null, { status: 409 });
376
- return new msw.HttpResponse(null, { status: 200 });
377
- })),
378
- msw.http.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/search`, searchHandler),
379
- msw.http.post(`${_northern_tech_utils_constants.inventoryApiUrlV2alpha1}/identities/search`, require_validation.validated(async ({ request }) => {
380
- const { attribute, value_prefix } = await request.json();
381
- if (!value_prefix || attribute && [attribute.name, attribute.scope].some((item) => !item)) return new msw.HttpResponse(null, { status: 519 });
382
- return new msw.HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 1 } });
383
- })),
384
- msw.http.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters`, require_validation.validated(async ({ request }) => {
385
- const { name, terms } = await request.json();
386
- if ([name, terms].some((item) => !item) || require_mockData.mockApiResponses.devices.groups[name] || !terms.every((term) => _northern_tech_utils_constants.DEVICE_FILTERING_OPTIONS[term.type] && [
387
- "identity",
388
- "inventory",
389
- "system"
390
- ].includes(term.scope) && !!term.value && !!term.attribute)) return new msw.HttpResponse(null, { status: 510 });
391
- return new msw.HttpResponse(JSON.stringify({}), { headers: { location: "find/me/here/createdFilterId" } });
392
- })),
393
- msw.http.get(`${_northern_tech_utils_constants.inventoryApiUrlV2}/statistics`, async () => msw.HttpResponse.json({ devices_by_status: {
394
- accepted: {
395
- standard: require_mockData.mockApiResponses.devices.byStatus.accepted.total,
396
- micro: 0,
397
- system: 0
398
- },
399
- pending: {
400
- standard: require_mockData.mockApiResponses.devices.byStatus.pending.total,
401
- micro: 0,
402
- system: 0
403
- }
404
- } })),
405
- msw.http.put(`${_northern_tech_utils_constants.deviceAuthV2}/devices/:deviceId/auth/:authId/status`, require_validation.validated(async ({ params: { authId, deviceId }, request }) => {
406
- const { status } = await request.json();
407
- if (require_mockData.mockApiResponses.devices.byId[deviceId].auth_sets.find((authSet) => authSet.id === authId) && _northern_tech_utils_constants.DEVICE_STATES[status]) return new msw.HttpResponse(null, { status: 200 });
408
- return new msw.HttpResponse(null, { status: 511 });
409
- })),
410
- msw.http.get(`${_northern_tech_utils_constants.deviceConfig}/:deviceId`, ({ params: { deviceId } }) => {
411
- if (deviceId === "testId") return new msw.HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });
412
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json({
413
- configured: {
414
- test: true,
415
- something: "else",
416
- aNumber: 42
417
- },
418
- deployment_id: "config1",
419
- reported: {
420
- test: true,
421
- something: "else",
422
- aNumber: 42
423
- },
424
- updated_ts: updatedTime,
425
- reported_ts: "2019-01-01T09:25:01.000Z"
426
- });
427
- return new msw.HttpResponse(null, { status: 512 });
428
- }),
429
- msw.http.put(`${_northern_tech_utils_constants.deviceConfig}/:deviceId`, require_validation.validated(async ({ params: { deviceId }, request }) => {
430
- if ((await request.text()).includes("evilValue")) return new msw.HttpResponse(null, { status: 418 });
431
- return new msw.HttpResponse(null, { status: require_mockData.mockApiResponses.devices.byId[deviceId] ? 201 : 513 });
432
- })),
433
- msw.http.post(`${_northern_tech_utils_constants.deviceConfig}/:deviceId/deploy`, require_validation.validated(({ params: { deviceId } }) => {
434
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json({ deployment_id: "config1" });
435
- return new msw.HttpResponse(null, { status: 514 });
436
- })),
437
- msw.http.get(`${_northern_tech_utils_constants.deviceConnect}/devices/:deviceId`, ({ params: { deviceId } }) => {
438
- if (deviceId === "testId") return new msw.HttpResponse(JSON.stringify({ error: { status_code: 404 } }), { status: 404 });
439
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json({
440
- status: "connected",
441
- updated_ts: require_mockData.mockApiResponses.devices.byId[deviceId].updated_ts
442
- });
443
- return new msw.HttpResponse(null, { status: 512 });
444
- }),
445
- msw.http.post(`${_northern_tech_utils_constants.deviceConnect}/devices/:deviceId/:action`, require_validation.validated(({ params: { deviceId, action } }) => {
446
- if (["check-update", "send-inventory"].includes(action) && require_mockData.mockApiResponses.devices.byId[deviceId]) return new msw.HttpResponse(null, { status: 202 });
447
- return new msw.HttpResponse(null, { status: 518 });
448
- })),
449
- msw.http.get(`${_northern_tech_utils_constants.iotManagerBaseURL}/devices/:deviceId/state`, ({ params: { deviceId } }) => {
450
- if (require_mockData.mockApiResponses.devices.byId[deviceId]) return msw.HttpResponse.json({ deployment_id: require_mockData.mockApiResponses.deployments.byId.d1.id });
451
- return new msw.HttpResponse(null, { status: 515 });
452
- }),
453
- msw.http.put(`${_northern_tech_utils_constants.iotManagerBaseURL}/devices/:deviceId/state/:integrationId`, require_validation.validated(async ({ params: { deviceId }, request }) => {
454
- const body = await request.json();
455
- if (require_mockData.mockApiResponses.devices.byId[deviceId] && body) return msw.HttpResponse.json({ deployment_id: require_mockData.mockApiResponses.deployments.byId.d1.id });
456
- return new msw.HttpResponse(null, { status: 516 });
457
- })),
458
- msw.http.put(`${_northern_tech_utils_constants.deviceConnect}/devices/:deviceId/upload`, require_validation.validated(({ params: { deviceId } }) => new msw.HttpResponse(null, { status: require_mockData.mockApiResponses.devices.byId[deviceId] ? 200 : 517 }))),
459
- msw.http.get(`${_northern_tech_utils_constants.deviceAuthV2}/license`, () => msw.HttpResponse.text("test,report"))
460
- ];
461
- //#endregion
462
- exports.defaultDeviceId = defaultDeviceId;
463
- exports.deviceComponents = deviceComponents;
464
- exports.deviceHandlers = deviceHandlers;
465
- exports.inventoryDevice = inventoryDevice;
466
-
467
- //# sourceMappingURL=deviceHandlers.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deviceHandlers.cjs","names":["defaultMacAddress","defaultCreationDate","validated","HttpResponse","DEVICE_STATES","mockApiResponses","headerNames","http","deviceAuthV2","inventoryApiUrl","inventoryApiUrlV2","inventoryApiUrlV2alpha1","DEVICE_FILTERING_OPTIONS","deviceConfig","deviceConnect","iotManagerBaseURL"],"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 inventoryApiUrlV2alpha1,\n iotManagerBaseURL\n} from '@northern.tech/utils/constants';\nimport { HttpResponse, http } from 'msw';\n\nimport { defaultCreationDate, defaultMacAddress, mockApiResponses } from '../mockData';\nimport { validated } from './validation';\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\nexport const deviceComponents = {\n R123: [\n { name: 'component_type', value: 'rtos', scope: 'inventory' },\n { name: 'version', value: 'v1', scope: 'inventory' }\n ],\n R456: [\n { name: 'component_type', value: 'rtos', scope: 'inventory' },\n { name: 'version', value: 'v2', scope: 'inventory' }\n ]\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 = validated(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 if (filters.find(filter => filter.scope === 'system' && filter.attribute === 'test_device')) {\n return new HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [headerNames.total]: 3 } });\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(\n `${inventoryApiUrl}/groups/:group/devices`,\n validated(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 ),\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/devices`, () => HttpResponse.json(mockApiResponses.devices.limits)),\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.get(\n `${inventoryApiUrlV2}/devices/:deviceId/components`,\n validated(({ params: { deviceId } }) => {\n if (mockApiResponses.devices.byId[deviceId]) {\n return HttpResponse.json(deviceComponents);\n }\n return new HttpResponse(null, { status: 507 });\n })\n ),\n http.put(\n `${inventoryApiUrl}/devices/:deviceId/tags`,\n validated(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 ),\n http.put(`${deviceAuthV2}/devices/:deviceId/flags`, ({ params: { deviceId } }) => {\n if (!mockApiResponses.devices.byId[deviceId]) {\n return new HttpResponse(null, { status: 506 });\n }\n return new HttpResponse(null, { status: 204 });\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(`${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(\n `${inventoryApiUrl}/groups/:group/devices`,\n validated(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 ),\n http.post(\n `${deviceAuthV2}/devices`,\n validated(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 ),\n http.post(`${inventoryApiUrlV2}/filters/search`, searchHandler),\n http.post(\n `${inventoryApiUrlV2alpha1}/identities/search`,\n validated(async ({ request }) => {\n const { attribute, value_prefix } = await request.json();\n if (!value_prefix || (attribute && [attribute.name, attribute.scope].some(item => !item))) {\n return new HttpResponse(null, { status: 519 });\n }\n return new HttpResponse(JSON.stringify([inventoryDevice]), { headers: { [headerNames.total]: 1 } });\n })\n ),\n http.post(\n `${inventoryApiUrlV2}/filters`,\n validated(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(\n term => DEVICE_FILTERING_OPTIONS[term.type] && ['identity', 'inventory', 'system'].includes(term.scope) && !!term.value && !!term.attribute\n )\n ) {\n return new HttpResponse(null, { status: 510 });\n }\n return new HttpResponse(JSON.stringify({}), { headers: { location: 'find/me/here/createdFilterId' } });\n })\n ),\n http.get(`${inventoryApiUrlV2}/statistics`, async () =>\n HttpResponse.json({\n devices_by_status: {\n accepted: { standard: mockApiResponses.devices.byStatus.accepted.total, micro: 0, system: 0 },\n pending: { standard: mockApiResponses.devices.byStatus.pending.total, micro: 0, system: 0 }\n }\n })\n ),\n http.put(\n `${deviceAuthV2}/devices/:deviceId/auth/:authId/status`,\n validated(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 ),\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(\n `${deviceConfig}/:deviceId`,\n validated(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 ),\n http.post(\n `${deviceConfig}/:deviceId/deploy`,\n validated(({ 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 ),\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(\n `${deviceConnect}/devices/:deviceId/:action`,\n validated(({ 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 ),\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(\n `${iotManagerBaseURL}/devices/:deviceId/state/:integrationId`,\n validated(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 ),\n http.put(\n `${deviceConnect}/devices/:deviceId/upload`,\n validated(({ params: { deviceId } }) => new HttpResponse(null, { status: mockApiResponses.devices.byId[deviceId] ? 200 : 517 }))\n ),\n http.get(`${deviceAuthV2}/license`, () => HttpResponse.text('test,report'))\n];\n"],"mappings":";;;;;;AA+BA,MAAa,kBAAkB;AAE/B,MAAM,mBAAmB;CACvB,IAAA;CACA,eAAe,EAAE,KAAKA,iBAAAA,kBAAkB;CACxC,QAAQ;CACR,iBAAiB;CACjB,YAAYC,iBAAAA;CACZ,YAAY;CACZ,WAAW,CACT;EACE,IAAI;EACJ,eAAe,EAAE,KAAKD,iBAAAA,kBAAkB;EACxC,QAAQ;EACR,IAAIC,iBAAAA;EACJ,QAAQ;CACV,CACF;AACF;AAEA,M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IAAAA,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC;CAC/C,CAAC,CACH;CACAI,IAAAA,KAAK,IACH,GAAGO,+BAAAA,cAAc,4BACjBZ,mBAAAA,WAAW,EAAE,QAAQ,EAAE,iBAAiB,IAAIC,IAAAA,aAAa,MAAM,EAAE,QAAQE,iBAAAA,iBAAiB,QAAQ,KAAK,YAAY,MAAM,IAAI,CAAC,CAAC,CACjI;CACAE,IAAAA,KAAK,IAAI,GAAGC,+BAAAA,aAAa,iBAAiBL,IAAAA,aAAa,KAAK,aAAa,CAAC;AAC5E"}
@@ -1,31 +0,0 @@
1
- //#region src/requestHandlers/deviceHandlers.d.ts
2
- export declare const defaultDeviceId = "a1";
3
- export declare const inventoryDevice: {
4
- id: string;
5
- attributes: ({
6
- name: string;
7
- value: string[];
8
- scope: string;
9
- } | {
10
- name: string;
11
- value: string;
12
- scope: string;
13
- })[];
14
- check_in_time: string;
15
- updated_ts: string;
16
- };
17
- export declare const deviceComponents: {
18
- R123: {
19
- name: string;
20
- value: string;
21
- scope: string;
22
- }[];
23
- R456: {
24
- name: string;
25
- value: string;
26
- scope: string;
27
- }[];
28
- };
29
- export declare const deviceHandlers: import("msw").HttpHandler[];
30
- //#endregion
31
- //# sourceMappingURL=deviceHandlers.d.cts.map
@@ -1,23 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mockData = require("../mockData.cjs");
3
- const require_validation = require("../validation-DAMYMdv9.cjs");
4
- let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
5
- let msw = require("msw");
6
- //#region src/requestHandlers/monitorHandlers.ts
7
- const monitorHandlers = [
8
- msw.http.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/:id/alerts`, () => new msw.HttpResponse(JSON.stringify([]), { headers: { [_northern_tech_utils_constants.headerNames.total]: 1 } })),
9
- msw.http.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/:id/alerts/latest`, () => msw.HttpResponse.json([])),
10
- msw.http.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/:id/config`, ({ params: { id } }) => {
11
- if (id === require_mockData.mockApiResponses.devices.byId.a1.id) return msw.HttpResponse.json([{ something: "here" }]);
12
- return msw.HttpResponse.json([]);
13
- }),
14
- msw.http.put(`${_northern_tech_utils_constants.monitorApiUrlv1}/settings/global/channel/alerts/:channel/status`, require_validation.validated(async ({ params: { channel }, request }) => {
15
- const { enabled } = await request.json();
16
- if (Object.keys(_northern_tech_utils_constants.alertChannels).includes(channel) && enabled !== void 0) return new msw.HttpResponse(null, { status: 200 });
17
- return new msw.HttpResponse(null, { status: 590 });
18
- }))
19
- ];
20
- //#endregion
21
- exports.monitorHandlers = monitorHandlers;
22
-
23
- //# sourceMappingURL=monitorHandlers.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"monitorHandlers.cjs","names":["http","monitorApiUrlv1","HttpResponse","headerNames","mockApiResponses","validated","alertChannels"],"sources":["../../src/requestHandlers/monitorHandlers.ts"],"sourcesContent":["// Copyright 2021 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 { alertChannels, headerNames, monitorApiUrlv1 } from '@northern.tech/utils/constants';\nimport { HttpResponse, http } from 'msw';\n\nimport { mockApiResponses } from '../mockData';\nimport { validated } from './validation';\n\nexport const monitorHandlers = [\n http.get(`${monitorApiUrlv1}/devices/:id/alerts`, () => new HttpResponse(JSON.stringify([]), { headers: { [headerNames.total]: 1 } })),\n http.get(`${monitorApiUrlv1}/devices/:id/alerts/latest`, () => HttpResponse.json([])),\n http.get(`${monitorApiUrlv1}/devices/:id/config`, ({ params: { id } }) => {\n if (id === mockApiResponses.devices.byId.a1.id) {\n return HttpResponse.json([{ something: 'here' }]);\n }\n return HttpResponse.json([]);\n }),\n http.put(\n `${monitorApiUrlv1}/settings/global/channel/alerts/:channel/status`,\n validated(async ({ params: { channel }, request }) => {\n const { enabled } = await request.json();\n if (Object.keys(alertChannels).includes(channel) && enabled !== undefined) {\n return new HttpResponse(null, { status: 200 });\n }\n return new HttpResponse(null, { status: 590 });\n })\n )\n];\n"],"mappings":";;;;;;AAoBA,MAAa,kBAAkB;CAC7BA,IAAAA,KAAK,IAAI,GAAGC,+BAAAA,gBAAgB,4BAA4B,IAAIC,IAAAA,aAAa,KAAK,UAAU,CAAC,CAAC,GAAG,EAAE,SAAS,GAAGC,+BAAAA,YAAY,QAAQ,EAAE,EAAE,CAAC,CAAC;CACrIH,IAAAA,KAAK,IAAI,GAAGC,+BAAAA,gBAAgB,mCAAmCC,IAAAA,aAAa,KAAK,CAAC,CAAC,CAAC;CACpFF,IAAAA,KAAK,IAAI,GAAGC,+BAAAA,gBAAgB,uBAAuB,EAAE,QAAQ,EAAE,WAAW;EACxE,IAAI,OAAOG,iBAAAA,iBAAiB,QAAQ,KAAK,GAAG,IAC1C,OAAOF,IAAAA,aAAa,KAAK,CAAC,EAAE,WAAW,OAAO,CAAC,CAAC;EAElD,OAAOA,IAAAA,aAAa,KAAK,CAAC,CAAC;CAC7B,CAAC;CACDF,IAAAA,KAAK,IACH,GAAGC,+BAAAA,gBAAgB,kDACnBI,mBAAAA,UAAU,OAAO,EAAE,QAAQ,EAAE,WAAW,cAAc;EACpD,MAAM,EAAE,YAAY,MAAM,QAAQ,KAAK;EACvC,IAAI,OAAO,KAAKC,+BAAAA,aAAa,CAAC,CAAC,SAAS,OAAO,KAAK,YAAY,KAAA,GAC9D,OAAO,IAAIJ,IAAAA,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC;EAE/C,OAAO,IAAIA,IAAAA,aAAa,MAAM,EAAE,QAAQ,IAAI,CAAC;CAC/C,CAAC,CACH;AACF"}
@@ -1,4 +0,0 @@
1
- //#region src/requestHandlers/monitorHandlers.d.ts
2
- export declare const monitorHandlers: import("msw").HttpHandler[];
3
- //#endregion
4
- //# sourceMappingURL=monitorHandlers.d.cts.map