@northern.tech/testing 0.8.0 → 0.8.1

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 (86) hide show
  1. package/package.json +2 -4
  2. package/dist/baseTestConfig.json +0 -17
  3. package/dist/chunk-5ESUU7GT.js +0 -266
  4. package/dist/chunk-5ESUU7GT.js.map +0 -1
  5. package/dist/chunk-CGSW2XF4.js +0 -318
  6. package/dist/chunk-CGSW2XF4.js.map +0 -1
  7. package/dist/chunk-GPKMKZ6O.js +0 -161
  8. package/dist/chunk-GPKMKZ6O.js.map +0 -1
  9. package/dist/chunk-GQLNLYEI.js +0 -934
  10. package/dist/chunk-GQLNLYEI.js.map +0 -1
  11. package/dist/chunk-HRGVXWMH.js +0 -17
  12. package/dist/chunk-HRGVXWMH.js.map +0 -1
  13. package/dist/chunk-KCLTR6QS.js +0 -34
  14. package/dist/chunk-KCLTR6QS.js.map +0 -1
  15. package/dist/chunk-T3BKBWUF.js +0 -239
  16. package/dist/chunk-T3BKBWUF.js.map +0 -1
  17. package/dist/chunk-TSEGY3EV.js +0 -29
  18. package/dist/chunk-TSEGY3EV.js.map +0 -1
  19. package/dist/chunk-Y4IJBU7U.js +0 -188
  20. package/dist/chunk-Y4IJBU7U.js.map +0 -1
  21. package/dist/mockData.cjs +0 -968
  22. package/dist/mockData.cjs.map +0 -1
  23. package/dist/mockData.d.cts +0 -636
  24. package/dist/mockData.d.ts +0 -636
  25. package/dist/mockData.js +0 -47
  26. package/dist/mockData.js.map +0 -1
  27. package/dist/requestHandlers/deploymentHandlers.cjs +0 -1045
  28. package/dist/requestHandlers/deploymentHandlers.cjs.map +0 -1
  29. package/dist/requestHandlers/deploymentHandlers.d.cts +0 -5
  30. package/dist/requestHandlers/deploymentHandlers.d.ts +0 -5
  31. package/dist/requestHandlers/deploymentHandlers.js +0 -8
  32. package/dist/requestHandlers/deploymentHandlers.js.map +0 -1
  33. package/dist/requestHandlers/deviceHandlers.cjs +0 -1113
  34. package/dist/requestHandlers/deviceHandlers.cjs.map +0 -1
  35. package/dist/requestHandlers/deviceHandlers.d.cts +0 -20
  36. package/dist/requestHandlers/deviceHandlers.d.ts +0 -20
  37. package/dist/requestHandlers/deviceHandlers.js +0 -12
  38. package/dist/requestHandlers/deviceHandlers.js.map +0 -1
  39. package/dist/requestHandlers/monitorHandlers.cjs +0 -835
  40. package/dist/requestHandlers/monitorHandlers.cjs.map +0 -1
  41. package/dist/requestHandlers/monitorHandlers.d.cts +0 -5
  42. package/dist/requestHandlers/monitorHandlers.d.ts +0 -5
  43. package/dist/requestHandlers/monitorHandlers.js +0 -8
  44. package/dist/requestHandlers/monitorHandlers.js.map +0 -1
  45. package/dist/requestHandlers/organizationHandlers.cjs +0 -1130
  46. package/dist/requestHandlers/organizationHandlers.cjs.map +0 -1
  47. package/dist/requestHandlers/organizationHandlers.d.cts +0 -5
  48. package/dist/requestHandlers/organizationHandlers.d.ts +0 -5
  49. package/dist/requestHandlers/organizationHandlers.js +0 -8
  50. package/dist/requestHandlers/organizationHandlers.js.map +0 -1
  51. package/dist/requestHandlers/releaseHandlers.cjs +0 -966
  52. package/dist/requestHandlers/releaseHandlers.cjs.map +0 -1
  53. package/dist/requestHandlers/releaseHandlers.d.cts +0 -5
  54. package/dist/requestHandlers/releaseHandlers.d.ts +0 -5
  55. package/dist/requestHandlers/releaseHandlers.js +0 -8
  56. package/dist/requestHandlers/releaseHandlers.js.map +0 -1
  57. package/dist/requestHandlers/requestHandlers.cjs +0 -2019
  58. package/dist/requestHandlers/requestHandlers.cjs.map +0 -1
  59. package/dist/requestHandlers/requestHandlers.d.cts +0 -5
  60. package/dist/requestHandlers/requestHandlers.d.ts +0 -5
  61. package/dist/requestHandlers/requestHandlers.js +0 -35
  62. package/dist/requestHandlers/requestHandlers.js.map +0 -1
  63. package/dist/requestHandlers/userHandlers.cjs +0 -994
  64. package/dist/requestHandlers/userHandlers.cjs.map +0 -1
  65. package/dist/requestHandlers/userHandlers.d.cts +0 -5
  66. package/dist/requestHandlers/userHandlers.d.ts +0 -5
  67. package/dist/requestHandlers/userHandlers.js +0 -8
  68. package/dist/requestHandlers/userHandlers.js.map +0 -1
  69. package/dist/setupTests.cjs +0 -996
  70. package/dist/setupTests.cjs.map +0 -1
  71. package/dist/setupTests.d.cts +0 -77
  72. package/dist/setupTests.d.ts +0 -77
  73. package/dist/setupTests.js +0 -138
  74. package/dist/setupTests.js.map +0 -1
  75. package/dist/theme/light.cjs +0 -41
  76. package/dist/theme/light.cjs.map +0 -1
  77. package/dist/theme/light.d.cts +0 -12
  78. package/dist/theme/light.d.ts +0 -12
  79. package/dist/theme/light.js +0 -7
  80. package/dist/theme/light.js.map +0 -1
  81. package/dist/utils.cjs +0 -71
  82. package/dist/utils.cjs.map +0 -1
  83. package/dist/utils.d.cts +0 -69
  84. package/dist/utils.d.ts +0 -69
  85. package/dist/utils.js +0 -12
  86. package/dist/utils.js.map +0 -1
@@ -1,1045 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/requestHandlers/deploymentHandlers.ts
21
- var deploymentHandlers_exports = {};
22
- __export(deploymentHandlers_exports, {
23
- deploymentHandlers: () => deploymentHandlers
24
- });
25
- module.exports = __toCommonJS(deploymentHandlers_exports);
26
- var import_constants2 = require("@northern.tech/utils/constants");
27
- var import_msw = require("msw");
28
-
29
- // src/mockData.ts
30
- var import_constants = require("@northern.tech/utils/constants");
31
- var TEST_SESSION_DATETIME = "2019-01-13T13:00:00.000Z";
32
- var testDate = new Date(TEST_SESSION_DATETIME);
33
- var mockDate = new Date(testDate.setMilliseconds(testDate.getMilliseconds() + import_constants.maxSessionAge));
34
- var defaultCreationDate = "2019-01-13T06:25:00.000Z";
35
- var defaultMacAddress = "dc:a6:32:12:ad:bf";
36
- var permissionSetObjectTypes = {
37
- any: "Any",
38
- artifacts: "Artifacts",
39
- empty: "",
40
- groups: "Device groups",
41
- releases: "Releases",
42
- tenantManagement: "Tenant management",
43
- userManagement: "User management"
44
- };
45
- var commonEndpoints = {
46
- artifacts: "^/api/management/v1/deployments/artifacts",
47
- artifactDetails: "^/api/management/v1/deployments/artifacts/[^/]+",
48
- deviceManagement: "^/api/management/(v[1-9])/(devauth|inventory)/"
49
- };
50
- var userId = "a30a780b-b843-5344-80e3-0fd95a4f6fc3";
51
- var defaultUser = {
52
- created_ts: "2019-01-01T10:30:00.000Z",
53
- email: "a@b.com",
54
- id: "a1",
55
- roles: ["RBAC_ROLE_PERMIT_ALL"],
56
- tfa_status: "enabled",
57
- verified: true
58
- };
59
- var deviceTypes = { qemu: "qemux86-64" };
60
- var checkInTimeRounded = "2019-01-01T00:00:00.000Z";
61
- var checkInTimeExact = "2019-01-01T10:25:00.000Z";
62
- var mockApiResponses = {
63
- deployments: {
64
- byId: {
65
- d1: {
66
- id: "d1",
67
- name: "test deployment",
68
- created: "2019-01-01T12:30:00.000Z",
69
- devices: {
70
- a1: {
71
- id: "a1",
72
- status: "installing",
73
- attributes: {},
74
- image: { size: 123 }
75
- }
76
- },
77
- statistics: {
78
- status: {
79
- "already-installed": 0,
80
- decommissioned: 0,
81
- downloading: 0,
82
- failure: 0,
83
- installing: 1,
84
- noartifact: 0,
85
- pending: 0,
86
- rebooting: 0,
87
- success: 0
88
- },
89
- total_size: 1234
90
- }
91
- },
92
- d2: {
93
- id: "d2",
94
- name: "test deployment 2",
95
- artifact_name: "r1",
96
- artifacts: ["123"],
97
- created: "2019-01-01T12:25:00.000Z",
98
- device_count: 1,
99
- devices: {
100
- b1: {
101
- attributes: {},
102
- id: "b1",
103
- status: "pending"
104
- }
105
- },
106
- filter: void 0,
107
- group: void 0,
108
- statistics: {
109
- status: {
110
- downloading: 0,
111
- decommissioned: 0,
112
- failure: 0,
113
- installing: 0,
114
- noartifact: 0,
115
- pending: 1,
116
- rebooting: 0,
117
- success: 0,
118
- "already-installed": 0
119
- }
120
- }
121
- },
122
- d3: {
123
- id: "d3",
124
- name: "Test",
125
- phases: [
126
- { id: "0", batch_size: 2, device_count: 2 },
127
- { id: "1", start_ts: "2019-02-04T11:45:10.002Z", batch_size: 3, device_count: 3 },
128
- { id: "2", start_ts: "2019-02-05T11:45:10.002Z", batch_size: 5, device_count: 5 },
129
- { id: "3", start_ts: "2019-02-06T11:45:10.002Z", batch_size: 5, device_count: 5 },
130
- { id: "4", start_ts: "2019-02-21T11:45:10.002Z", batch_size: 5, device_count: 0 }
131
- ],
132
- max_devices: 0,
133
- created: "2019-01-31T12:59:30.020Z",
134
- devices: {},
135
- filter: void 0,
136
- group: void 0,
137
- stats: {
138
- pending: 3,
139
- decommissioned: 0,
140
- failure: 23,
141
- pause_before_committing: 0,
142
- pause_before_rebooting: 0,
143
- installing: 0,
144
- rebooting: 0,
145
- "already-installed": 0,
146
- pause_before_installing: 0,
147
- downloading: 0,
148
- success: 6,
149
- aborted: 0,
150
- noartifact: 0
151
- },
152
- statistics: { total_size: "1234" },
153
- status: "inprogress",
154
- active: true,
155
- device_count: 100,
156
- retries: "0",
157
- type: "software"
158
- }
159
- },
160
- byStatus: {
161
- pending: { deploymentIds: ["d2"] },
162
- inprogress: { deploymentIds: ["d3"] }
163
- }
164
- },
165
- devices: {
166
- byId: {
167
- a1: {
168
- id: "a1",
169
- auth_sets: [
170
- {
171
- id: "auth1",
172
- identity_data: { mac: defaultMacAddress },
173
- pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
174
- status: "accepted",
175
- ts: defaultCreationDate
176
- }
177
- ],
178
- updated_ts: "2019-01-01T09:25:00.000Z"
179
- },
180
- b1: {
181
- id: "b1",
182
- attributes: {
183
- ipv4_wlan0: "192.168.10.141/24",
184
- device_type: [deviceTypes.qemu]
185
- },
186
- system: {
187
- check_in_time: checkInTimeRounded
188
- },
189
- check_in_time: checkInTimeExact,
190
- check_in_time_exact: checkInTimeExact,
191
- check_in_time_rounded: checkInTimeRounded,
192
- identity_data: { mac: defaultMacAddress },
193
- status: "accepted",
194
- decommissioning: false,
195
- created_ts: defaultCreationDate,
196
- updated_ts: "2019-01-01T09:25:00.000Z",
197
- auth_sets: [
198
- {
199
- id: "auth1",
200
- identity_data: { mac: defaultMacAddress },
201
- pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
202
- ts: defaultCreationDate,
203
- status: "accepted"
204
- }
205
- ]
206
- }
207
- },
208
- groups: {
209
- byId: {
210
- testGroup: {
211
- deviceIds: ["a1", "b1"],
212
- filters: [],
213
- total: 2
214
- },
215
- testGroupDynamic: {
216
- id: "filter1",
217
- name: "filter1",
218
- filters: [{ scope: "system", key: "group", operator: "$eq", value: "things" }]
219
- }
220
- }
221
- },
222
- limits: { standard: 500, micro: 0, system: 0 },
223
- byStatus: {
224
- accepted: { deviceIds: ["a1", "b1"], total: 2 },
225
- active: { deviceIds: [], total: 0 },
226
- inactive: { deviceIds: [], total: 0 },
227
- pending: { deviceIds: ["c1"], total: 1 },
228
- preauthorized: { deviceIds: [], total: 0 },
229
- rejected: { deviceIds: [], total: 0 }
230
- }
231
- },
232
- organization: {
233
- organization: {
234
- id: "1",
235
- addons: [],
236
- name: "test",
237
- plan: "os",
238
- trial: false
239
- },
240
- products: [
241
- {
242
- name: "mender_standard",
243
- billing_unit: "devices",
244
- prices: [
245
- {
246
- plan: "os",
247
- constraints: {
248
- min: 50,
249
- max: 1e3,
250
- div: 50
251
- }
252
- },
253
- {
254
- plan: "professional",
255
- constraints: {
256
- min: 250,
257
- max: 1e4,
258
- div: 50
259
- }
260
- }
261
- ],
262
- addons: [
263
- {
264
- name: "troubleshoot",
265
- prices: [{ plan: "os" }, { plan: "professional" }]
266
- },
267
- {
268
- name: "configure",
269
- prices: [{ plan: "os" }, { plan: "professional" }]
270
- },
271
- {
272
- name: "monitor",
273
- prices: [{ plan: "professional" }]
274
- }
275
- ]
276
- },
277
- {
278
- name: "mender_micro",
279
- billing_unit: "devices",
280
- prices: [
281
- {
282
- plan: "os",
283
- constraints: {
284
- min: 50,
285
- max: 5e3,
286
- div: 50
287
- }
288
- },
289
- {
290
- plan: "professional",
291
- constraints: {
292
- min: 500,
293
- max: 1e5,
294
- div: 50
295
- }
296
- }
297
- ]
298
- }
299
- ],
300
- intentId: "testIntent",
301
- auditlog: {
302
- events: [
303
- {
304
- actor: {
305
- id: "string",
306
- type: "user",
307
- email: "string@example.com"
308
- },
309
- time: "2019-01-01T12:10:22.667Z",
310
- action: "create",
311
- object: {
312
- id: "string",
313
- type: "user",
314
- user: {
315
- email: "user@acme.com"
316
- }
317
- },
318
- change: "change1"
319
- },
320
- {
321
- actor: {
322
- id: "string",
323
- type: "user",
324
- email: "string",
325
- identity_data: "string"
326
- },
327
- time: "2019-01-01T12:16:22.667Z",
328
- action: "create",
329
- object: {
330
- id: "string",
331
- type: "deployment",
332
- deployment: {
333
- name: "production",
334
- artifact_name: "Application 0.0.1"
335
- }
336
- },
337
- change: "change2"
338
- },
339
- {
340
- actor: {
341
- id: "string",
342
- type: "user",
343
- email: "string@example.com"
344
- },
345
- time: "2019-01-01T12:10:22.669Z",
346
- action: "open_terminal",
347
- meta: {
348
- session_id: ["abd313a8-ee88-48ab-9c99-fbcd80048e6e"]
349
- },
350
- object: {
351
- id: "a1",
352
- type: "device"
353
- },
354
- change: "change3"
355
- }
356
- ]
357
- }
358
- },
359
- releases: {
360
- byId: {
361
- r1: {
362
- name: "r1",
363
- artifacts: [
364
- {
365
- id: "art1",
366
- description: "test description",
367
- device_types_compatible: [deviceTypes.qemu],
368
- modified: "2020-09-10T12:16:22.667Z",
369
- updates: [{ type_info: { type: "testtype" } }],
370
- artifact_depends: {
371
- device_type: [deviceTypes.qemu]
372
- },
373
- artifact_provides: {
374
- artifact_name: "myapp",
375
- "data-partition.myapp.version": "v2020.10",
376
- list_of_fancy: [deviceTypes.qemu, "x172"]
377
- },
378
- clears_artifact_provides: ["data-partition.myapp.*"]
379
- }
380
- ],
381
- device_types_compatible: [deviceTypes.qemu],
382
- modified: "2020-09-10T12:16:22.667Z",
383
- metaData: {}
384
- }
385
- }
386
- },
387
- users: {
388
- byId: {
389
- a1: defaultUser,
390
- [userId]: { ...defaultUser, id: userId, email: "a2@b.com", created_ts: "2019-01-01T12:30:00.000Z" }
391
- },
392
- rolesById: {
393
- admin: {
394
- name: "admin",
395
- description: "Administrator role",
396
- permissions: []
397
- },
398
- test: { name: "test", description: "test description", permissions: [] }
399
- },
400
- globalSettings: {
401
- "2fa": "enabled",
402
- id_attribute: void 0,
403
- previousFilters: []
404
- },
405
- userSettings: {
406
- "2fa": "disabled",
407
- columnSelection: [],
408
- onboarding: { something: "here" },
409
- tooltips: {},
410
- previousFilters: []
411
- }
412
- }
413
- };
414
- var releasesList = Array.from({ length: 5e3 }, (x, i) => ({
415
- artifacts: [
416
- {
417
- id: "art1",
418
- description: "test description",
419
- device_types_compatible: [deviceTypes.qemu],
420
- modified: "2020-09-10T12:16:22.667Z",
421
- updates: [{ type_info: { type: "testtype" } }],
422
- artifact_depends: {
423
- device_type: [deviceTypes.qemu]
424
- },
425
- artifact_provides: {
426
- artifact_name: "myapp",
427
- "data-partition.myapp.version": "v2020.10",
428
- list_of_fancy: [deviceTypes.qemu, "x172"]
429
- },
430
- clears_artifact_provides: ["data-partition.myapp.*"]
431
- }
432
- ],
433
- device_types_compatible: [deviceTypes.qemu],
434
- metaData: {},
435
- name: `release-${i + 1}`,
436
- modified: i
437
- }));
438
- var permissionSets = [
439
- {
440
- ...import_constants.defaultPermissionSets.Basic,
441
- object: permissionSetObjectTypes.empty,
442
- description: "Set containing basic permissions.",
443
- permissions: [
444
- { action: "http", object: { type: "any", value: "^/api/management/v1/useradm/settings$" } },
445
- { action: "http", object: { type: "any", value: "^/api/management/v1/useradm/users/me$" } },
446
- { action: "http", object: { type: "any", value: "^/api/management/1.0/auth/verify$" } },
447
- { action: "http", object: { type: "PUT", value: "^/api/management/v1/useradm/2faverify$" } },
448
- { action: "http", object: { type: "POST", value: "^/api/management/v1/useradm/users/me/2fa/(enable|disable)$" } },
449
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/roles" } },
450
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/user/tenant" } }
451
- ]
452
- },
453
- {
454
- ...import_constants.defaultPermissionSets.ManageReleases,
455
- action: import_constants.uiPermissionsById.manage.title,
456
- object: permissionSetObjectTypes.releases,
457
- description: "Set of permissions which allows user to manage releases",
458
- permissions: [
459
- { action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
460
- { action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
461
- { action: "http", object: { type: "PUT", value: commonEndpoints.artifactDetails } },
462
- { action: "http", object: { type: "DELETE", value: commonEndpoints.artifactDetails } },
463
- { action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
464
- ]
465
- },
466
- {
467
- ...import_constants.defaultPermissionSets.ReadUsers,
468
- action: import_constants.uiPermissionsById.read.title,
469
- object: permissionSetObjectTypes.userManagement,
470
- description: "Set of permissions which allows user to view other users",
471
- permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/" } }]
472
- },
473
- {
474
- ...import_constants.defaultPermissionSets.ManageUsers,
475
- action: import_constants.uiPermissionsById.manage.title,
476
- object: permissionSetObjectTypes.userManagement,
477
- description: "Set of permissions which allows user manage other user accounts",
478
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/" } }]
479
- },
480
- {
481
- ...import_constants.defaultPermissionSets.ReadTenants,
482
- action: import_constants.uiPermissionsById.read.title,
483
- object: permissionSetObjectTypes.tenantManagement,
484
- description: "Set of permissions which allows user to list other tenants and their config",
485
- permissions: [
486
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
487
- { action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } }
488
- ]
489
- },
490
- {
491
- ...import_constants.defaultPermissionSets.ManageTenants,
492
- action: import_constants.uiPermissionsById.manage.title,
493
- object: permissionSetObjectTypes.tenantManagement,
494
- description: "Set of permissions which allows user to manage other tenants and their config",
495
- permissions: [
496
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
497
- { action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } },
498
- { action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9])/tenantadm/" } }
499
- ]
500
- },
501
- {
502
- ...import_constants.defaultPermissionSets.ReadAuditLogs,
503
- action: import_constants.uiPermissionsById.read.title,
504
- object: "System Audit Log",
505
- description: "Set of permissions which allows user to view system audit log",
506
- permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/auditlogs/logs" } }]
507
- },
508
- {
509
- ...import_constants.defaultPermissionSets.DeployToDevices,
510
- action: "Deploy",
511
- object: permissionSetObjectTypes.groups,
512
- description: "Set of permissions which allows user to deploy to devices",
513
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/(deployments|deviceconfig)/" } }],
514
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
515
- },
516
- {
517
- ...import_constants.defaultPermissionSets.ConfigureDevices,
518
- action: "Configure",
519
- object: permissionSetObjectTypes.groups,
520
- description: "Set of permissions which allows user to manage configuration of the devices",
521
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/" } }],
522
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
523
- },
524
- {
525
- ...import_constants.defaultPermissionSets.ConnectToDevices,
526
- action: "Connect",
527
- object: permissionSetObjectTypes.groups,
528
- description: "Set of permissions which allows user to use remote terminal and file transfer",
529
- permissions: [
530
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/connect$" } },
531
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/download\\?path=[^&]+$" } },
532
- { action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/upload$" } }
533
- ],
534
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
535
- },
536
- {
537
- ...import_constants.defaultPermissionSets.SuperUser,
538
- action: "Any",
539
- object: permissionSetObjectTypes.any,
540
- description: "Set of permissions which allows user to do anything",
541
- permissions: [{ action: "any", object: { type: "any", value: "any" } }]
542
- },
543
- {
544
- ...import_constants.defaultPermissionSets.UploadArtifacts,
545
- action: "Upload",
546
- object: permissionSetObjectTypes.artifacts,
547
- description: "Set of permissions which allows user to upload artifacts",
548
- permissions: [
549
- { action: "http", object: { type: "POST", value: commonEndpoints.artifacts } },
550
- { action: "http", object: { type: "POST", value: "^/api/management/v1/deployments/artifacts/generate" } }
551
- ]
552
- },
553
- {
554
- ...import_constants.defaultPermissionSets.ReadDevices,
555
- action: import_constants.uiPermissionsById.read.title,
556
- object: permissionSetObjectTypes.groups,
557
- description: "Set of permissions which allows user to view devices",
558
- permissions: [
559
- { action: "http", object: { type: "POST", value: "^/api/management/v2/inventory/filters/search" } },
560
- { action: "http", object: { type: "POST", value: "^/api/management/v1/reporting/devices/search" } },
561
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/(deployments|devauth|inventory|deviceconfig|devicemonitor)/" } },
562
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+$" } }
563
- ],
564
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
565
- },
566
- {
567
- ...import_constants.defaultPermissionSets.ManageDevices,
568
- action: import_constants.uiPermissionsById.manage.title,
569
- object: permissionSetObjectTypes.groups,
570
- description: "Set of permissions which allows user to manage devices",
571
- permissions: [
572
- { action: "http", object: { type: "POST", value: commonEndpoints.deviceManagement } },
573
- { action: "http", object: { type: "PUT", value: commonEndpoints.deviceManagement } },
574
- { action: "http", object: { type: "DELETE", value: commonEndpoints.deviceManagement } }
575
- ],
576
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
577
- },
578
- {
579
- ...import_constants.defaultPermissionSets.ReadReleases,
580
- action: import_constants.uiPermissionsById.read.title,
581
- object: permissionSetObjectTypes.releases,
582
- description: "Set of permissions which allows user to view releases",
583
- permissions: [
584
- { action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
585
- { action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
586
- { action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
587
- ]
588
- },
589
- {
590
- name: "almostAdmin",
591
- object: permissionSetObjectTypes.empty,
592
- description: "Set containing all the permissions.",
593
- permissions: [
594
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/auditlogs/.*" } },
595
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/.*" } },
596
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/config/.*" } },
597
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/.*" } },
598
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/releases/.*" } },
599
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/devauth/.*" } },
600
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/.*" } },
601
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/.*" } },
602
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/devices" } },
603
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/inventory/.*" } },
604
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/iot-manager/.*" } },
605
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/monitor/.*" } },
606
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/.*" } }
607
- ]
608
- }
609
- ];
610
- var rbacRoles = [
611
- {
612
- name: "dyn",
613
- description: "",
614
- permissions: [
615
- { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: "dyn" } },
616
- { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: "dyn" } }
617
- ]
618
- },
619
- { name: "asdasd", description: "123", permissions: [{ action: "http", object: { type: "any", value: "/api/management/v1/useradm/.*" } }] },
620
- {
621
- name: "141sasd",
622
- description: "1313adg",
623
- permission_sets_with_scope: [
624
- { ...import_constants.defaultPermissionSets.ReadDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
625
- { ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
626
- { ...import_constants.defaultPermissionSets.ManageUsers }
627
- ]
628
- },
629
- {
630
- name: "kljlkk",
631
- description: "lkl",
632
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } }]
633
- },
634
- {
635
- name: "yyyyy",
636
- description: "asd",
637
- permission_sets_with_scope: [
638
- { ...import_constants.defaultPermissionSets.ManageDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["dockerclient"] } },
639
- { ...import_constants.defaultPermissionSets.ManageReleases }
640
- ]
641
- },
642
- {
643
- name: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
644
- description: "Intended for users responsible for managing deployments, this role can create and abort deployments",
645
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.DeployToDevices }]
646
- },
647
- {
648
- name: "RBAC_ROLE_REMOTE_TERMINAL",
649
- description: `Intended for tech support accounts, this role can access the devices' Remote Terminal.`,
650
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices }]
651
- },
652
- { name: "RBAC_ROLE_PERMIT_ALL", description: "", permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.SuperUser }] },
653
- {
654
- name: "RBAC_ROLE_OBSERVER",
655
- description: "Intended for team leaders or limited tech support accounts, this role can see all Devices, Artifacts and Deployment reports but not make any changes.",
656
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ReadReleases }, { ...import_constants.defaultPermissionSets.ReadDevices }]
657
- },
658
- {
659
- name: "RBAC_ROLE_CI",
660
- description: "Intended for automation accounts building software (e.g. CI/CD systems), this role can only manage Artifacts, including upload new Artifacts and delete Artifacts. It does not have access to Devices or Deployments.",
661
- permission_sets_with_scope: [
662
- { ...import_constants.defaultPermissionSets.ReadReleases },
663
- { ...import_constants.defaultPermissionSets.ManageReleases },
664
- { ...import_constants.defaultPermissionSets.UploadArtifacts }
665
- ]
666
- },
667
- {
668
- name: "almostAdmin",
669
- description: "almost admin rights",
670
- permissions: permissionSets.find((item) => item.name === "almostAdmin")?.permissions
671
- },
672
- {
673
- name: "almostAdminNew",
674
- description: "almost admin rights",
675
- permission_sets_with_scope: Object.values(import_constants.defaultPermissionSets)
676
- }
677
- ];
678
- var expectedParsedRoles = {
679
- "141sasd": {
680
- editable: true,
681
- isCustom: void 0,
682
- uiPermissions: {
683
- ...import_constants.emptyUiPermissions,
684
- groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] },
685
- userManagement: [import_constants.uiPermissionsById.manage.value]
686
- }
687
- },
688
- asdasd: {
689
- editable: false,
690
- isCustom: true,
691
- uiPermissions: { ...import_constants.emptyUiPermissions, userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] }
692
- },
693
- dyn: {
694
- editable: false,
695
- isCustom: true,
696
- uiPermissions: {
697
- ...import_constants.emptyUiPermissions,
698
- deployments: [import_constants.uiPermissionsById.deploy.value],
699
- groups: { dyn: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value] }
700
- }
701
- },
702
- kljlkk: {
703
- editable: true,
704
- isCustom: false,
705
- uiPermissions: { ...import_constants.emptyUiPermissions, groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] } }
706
- },
707
- yyyyy: {
708
- editable: true,
709
- isCustom: void 0,
710
- uiPermissions: {
711
- ...import_constants.emptyUiPermissions,
712
- groups: { dockerclient: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] },
713
- releases: { [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value] }
714
- }
715
- },
716
- almostAdmin: {
717
- editable: false,
718
- isCustom: true,
719
- uiPermissions: {
720
- ...import_constants.emptyUiPermissions,
721
- auditlog: [import_constants.uiPermissionsById.read.value],
722
- deployments: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.read.value],
723
- groups: {
724
- [import_constants.ALL_DEVICES]: [
725
- import_constants.uiPermissionsById.read.value,
726
- // we can't assign deployment permissions to devices here, since the old path based rbac controls don't allow the scoped permissions
727
- // uiPermissionsById.deploy.value,
728
- import_constants.uiPermissionsById.manage.value,
729
- import_constants.uiPermissionsById.connect.value,
730
- import_constants.uiPermissionsById.configure.value
731
- ]
732
- },
733
- releases: {
734
- [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.manage.value]
735
- },
736
- userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
737
- }
738
- },
739
- almostAdminNew: {
740
- editable: true,
741
- isCustom: void 0,
742
- uiPermissions: {
743
- ...import_constants.emptyUiPermissions,
744
- auditlog: [import_constants.uiPermissionsById.read.value],
745
- deployments: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.manage.value],
746
- groups: {
747
- [import_constants.ALL_DEVICES]: [
748
- import_constants.uiPermissionsById.read.value,
749
- import_constants.uiPermissionsById.manage.value,
750
- import_constants.uiPermissionsById.deploy.value,
751
- import_constants.uiPermissionsById.connect.value,
752
- import_constants.uiPermissionsById.configure.value
753
- ]
754
- },
755
- releases: {
756
- [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.read.value]
757
- },
758
- tenantManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value],
759
- userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
760
- }
761
- }
762
- };
763
- var defaultRolesById = {
764
- ...import_constants.rolesById,
765
- test: {
766
- ...import_constants.emptyRole,
767
- name: "test",
768
- description: "test description",
769
- editable: true,
770
- uiPermissions: {
771
- ...import_constants.emptyUiPermissions,
772
- groups: { testGroup: [import_constants.uiPermissionsById.read.value] },
773
- releases: { bar: [import_constants.uiPermissionsById.read.value] }
774
- }
775
- }
776
- };
777
- var receivedRoles = rbacRoles.reduce(
778
- (accu, role) => {
779
- const { name, description, ...roleRemainder } = role;
780
- if (name.startsWith("RBAC")) {
781
- accu[name] = {
782
- ...defaultRolesById[name],
783
- ...roleRemainder,
784
- editable: false,
785
- isCustom: false,
786
- description: defaultRolesById[name].description ? defaultRolesById[name].description : description
787
- };
788
- } else {
789
- const result = expectedParsedRoles[name] ?? {};
790
- accu[name] = {
791
- ...import_constants.emptyRole,
792
- ...role,
793
- ...result,
794
- name
795
- };
796
- }
797
- return accu;
798
- },
799
- { ...defaultRolesById }
800
- );
801
- var receivedPermissionSets = permissionSets.reduce((accu, set) => {
802
- const result = import_constants.defaultPermissionSets[set.name]?.result ?? {};
803
- accu[set.name] = {
804
- ...set,
805
- result: {
806
- ...import_constants.emptyUiPermissions,
807
- ...result
808
- }
809
- };
810
- return accu;
811
- }, {});
812
-
813
- // src/requestHandlers/deploymentHandlers.ts
814
- var createdDeployment = {
815
- id: "created-123",
816
- name: "test deployment",
817
- artifact_name: "r1",
818
- artifacts: ["123"],
819
- created: "2019-01-01T12:30:00.000Z",
820
- device_count: 1,
821
- devices: {
822
- a1: {
823
- attributes: {},
824
- id: "a1",
825
- image: { size: 123 },
826
- status: "installing"
827
- }
828
- },
829
- filter: void 0,
830
- group: void 0,
831
- statistics: {
832
- status: {
833
- downloading: 0,
834
- decommissioned: 0,
835
- failure: 0,
836
- installing: 1,
837
- noartifact: 0,
838
- pending: 0,
839
- rebooting: 0,
840
- success: 0,
841
- "already-installed": 0
842
- },
843
- total_size: 1234
844
- }
845
- };
846
- var defaultDeploymentConfig = {
847
- delta: {
848
- enabled: true,
849
- binary_delta: {
850
- xdelta_args: {
851
- disable_checksum: false,
852
- disable_external_decompression: false,
853
- compression_level: 6,
854
- source_window_size: 0,
855
- input_window_size: 0,
856
- compression_duplicates_window: 0,
857
- instruction_buffer_size: 0
858
- },
859
- timeout: 0
860
- },
861
- binary_delta_limits: {
862
- xdelta_args_limits: {
863
- source_window_size: import_constants2.limitDefault,
864
- input_window_size: import_constants2.limitDefault,
865
- compression_duplicates_window: import_constants2.limitDefault,
866
- instruction_buffer_size: import_constants2.limitDefault
867
- },
868
- timeout: { min: 60, max: 3600, default: 60 },
869
- jobs_in_parallel: import_constants2.limitDefault,
870
- queue_length: import_constants2.limitDefault
871
- }
872
- }
873
- };
874
- var deploymentHandlers = [
875
- import_msw.http.get(
876
- `${import_constants2.deploymentsApiUrlV2}/deployments`,
877
- () => new import_msw.HttpResponse(JSON.stringify(Object.values(mockApiResponses.deployments.byId).reverse()), {
878
- headers: { [import_constants2.headerNames.total]: Object.keys(mockApiResponses.deployments.byId).length }
879
- })
880
- ),
881
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/releases`, ({ request }) => {
882
- const { searchParams } = new URL(request.url);
883
- const releaseName = searchParams.get("name");
884
- const release = mockApiResponses.releases.byId[releaseName] || {};
885
- if (releaseName) {
886
- const { device_types_compatible, ...remainder } = release;
887
- return Object.keys(remainder).length || releaseName === "createdRelease" ? import_msw.HttpResponse.json([remainder]) : new import_msw.HttpResponse(null, { status: 520 });
888
- }
889
- const releases = Object.values(mockApiResponses.releases.byId).map((stateRelease) => {
890
- const { device_types_compatible, ...remainder } = stateRelease;
891
- return remainder;
892
- });
893
- return import_msw.HttpResponse.json(releases);
894
- }),
895
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId`, ({ params: { deploymentId } }) => {
896
- if (deploymentId === createdDeployment.id) {
897
- return import_msw.HttpResponse.json(createdDeployment);
898
- } else if (deploymentId === "config1") {
899
- return import_msw.HttpResponse.json({
900
- ...createdDeployment,
901
- id: "config1",
902
- created: "2019-01-01T09:25:01.000Z",
903
- finished: "2019-01-01T09:25:03.000Z",
904
- status: "finished"
905
- });
906
- }
907
- return import_msw.HttpResponse.json(mockApiResponses.deployments.byId[deploymentId]);
908
- }),
909
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId/devices`, ({ params: { deploymentId } }) => {
910
- if (deploymentId === createdDeployment.id) {
911
- return import_msw.HttpResponse.json(Object.values(createdDeployment.devices));
912
- } else if (mockApiResponses.deployments.byId[deploymentId]) {
913
- return import_msw.HttpResponse.json(Object.values(mockApiResponses.deployments.byId[deploymentId].devices));
914
- }
915
- return new import_msw.HttpResponse(null, { status: 521 });
916
- }),
917
- import_msw.http.post(`${import_constants2.deploymentsApiUrl}/deployments/statistics/list`, async ({ request }) => {
918
- const { deployment_ids = [] } = await request.json();
919
- if (deployment_ids.includes(createdDeployment.id)) {
920
- return import_msw.HttpResponse.json([]);
921
- } else if (deployment_ids.every((id) => mockApiResponses.deployments.byId[id])) {
922
- const stats = deployment_ids.map((id) => ({ id, stats: mockApiResponses.deployments.byId[id].statistics.status }));
923
- return import_msw.HttpResponse.json(stats);
924
- }
925
- return new import_msw.HttpResponse(null, { status: 522 });
926
- }),
927
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId/devices/:deviceId/log`, ({ params: { deploymentId, deviceId } }) => {
928
- if (mockApiResponses.deployments.byId[deploymentId] && mockApiResponses.deployments.byId[deploymentId].devices[deviceId]) {
929
- return import_msw.HttpResponse.text("test");
930
- }
931
- return new import_msw.HttpResponse(null, { status: 523 });
932
- }),
933
- import_msw.http.post(`${import_constants2.deploymentsApiUrl}/deployments`, async ({ request }) => {
934
- const body = await request.json();
935
- if (!Object.keys(body).length) {
936
- return new import_msw.HttpResponse(JSON.stringify({}), { status: 524 });
937
- }
938
- return new import_msw.HttpResponse(JSON.stringify({}), { headers: { location: `find/me/here/${createdDeployment.id}` } });
939
- }),
940
- import_msw.http.post(`${import_constants2.deploymentsApiUrlV2}/deployments`, async ({ request }) => {
941
- const { filter_id, devices = [] } = await request.json();
942
- if (!filter_id || !!devices.length) {
943
- return new import_msw.HttpResponse(JSON.stringify({}), { status: 525 });
944
- }
945
- return new import_msw.HttpResponse(JSON.stringify({}), { headers: { location: `find/me/here/${createdDeployment.id}` } });
946
- }),
947
- import_msw.http.post(`${import_constants2.deploymentsApiUrl}/deployments/group/:deploymentGroup`, async ({ params: { deploymentGroup }, request }) => {
948
- const { filter_id, devices = [] } = await request.json();
949
- if (filter_id || !!devices.length || deploymentGroup !== Object.keys(mockApiResponses.devices.groups.byId)[0]) {
950
- return new import_msw.HttpResponse(JSON.stringify({}), { status: 526 });
951
- }
952
- return new import_msw.HttpResponse(JSON.stringify({}), { headers: { location: `find/me/here/${createdDeployment.id}` } });
953
- }),
954
- import_msw.http.patch(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId`, async ({ params: { deploymentId }, request }) => {
955
- const { update_control_map } = await request.json();
956
- if (deploymentId === createdDeployment.id && Object.keys(update_control_map).length) {
957
- return new import_msw.HttpResponse(null, { status: 204 });
958
- }
959
- return new import_msw.HttpResponse(null, { status: 581 });
960
- }),
961
- import_msw.http.put(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId/status`, async ({ params: { deploymentId }, request }) => {
962
- const { status } = await request.json();
963
- return new import_msw.HttpResponse(JSON.stringify({}), {
964
- status: status === "aborted" && [...mockApiResponses.deployments.byStatus.pending.deploymentIds, ...mockApiResponses.deployments.byStatus.inprogress.deploymentIds].includes(
965
- deploymentId
966
- ) ? 200 : 528
967
- });
968
- }),
969
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/:deploymentId/devices/list`, ({ params: { deploymentId } }) => {
970
- if (deploymentId === createdDeployment.id) {
971
- return new import_msw.HttpResponse(JSON.stringify(Object.values(createdDeployment.devices)), {
972
- headers: { [import_constants2.headerNames.total]: Object.keys(createdDeployment.devices).length }
973
- });
974
- } else if (mockApiResponses.deployments.byId[deploymentId]) {
975
- return new import_msw.HttpResponse(JSON.stringify(Object.values(mockApiResponses.deployments.byId[deploymentId].devices)), {
976
- headers: { [import_constants2.headerNames.total]: Object.keys(mockApiResponses.deployments.byId[deploymentId].devices).length }
977
- });
978
- }
979
- return new import_msw.HttpResponse(null, { status: 529 });
980
- }),
981
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/config`, () => import_msw.HttpResponse.json(defaultDeploymentConfig)),
982
- import_msw.http.put(`${import_constants2.deploymentsApiUrl}/config/binary_delta`, async ({ request }) => {
983
- const { xdelta_args = {} } = await request.json();
984
- if (xdelta_args.source_window_size === 55) {
985
- return new import_msw.HttpResponse(null, { status: 530 });
986
- }
987
- return new import_msw.HttpResponse(null, { status: 200 });
988
- }),
989
- import_msw.http.get(`${import_constants2.deploymentsApiUrl}/deployments/devices/:deviceId`, ({ params: { deviceId } }) => {
990
- if (deviceId === mockApiResponses.devices.byId.a1.id) {
991
- return new import_msw.HttpResponse(
992
- JSON.stringify([
993
- {
994
- id: createdDeployment.id + "something",
995
- deployment: { ...createdDeployment, id: mockApiResponses.deployments.byId.d1.id, status: "inprogress" },
996
- device: {
997
- created: "2019-01-01T12:35:00.000Z",
998
- finished: "2019-01-01T12:40:00.000Z",
999
- status: "noartifact",
1000
- id: "something",
1001
- image: { ...mockApiResponses.releases.byId.r1 }
1002
- },
1003
- log: true,
1004
- attempts: 1,
1005
- delta_job_id: ""
1006
- }
1007
- ]),
1008
- {
1009
- headers: { [import_constants2.headerNames.total]: 34 }
1010
- }
1011
- );
1012
- }
1013
- return new import_msw.HttpResponse(null, { status: 529 });
1014
- }),
1015
- import_msw.http.delete(`${import_constants2.deploymentsApiUrl}/deployments/devices/:deviceId/history`, () => new import_msw.HttpResponse(null, { status: 204 })),
1016
- import_msw.http.get(`/api/management/v1alpha1/deployments/deployments/:deploymentId/devices/:deviceId/log/explain`, ({ params: { deploymentId, deviceId } }) => {
1017
- if (deploymentId === mockApiResponses.deployments.byId.d1.id && deviceId === mockApiResponses.devices.byId.a1.id) {
1018
- const mockAnalysis = `## Summary
1019
- The deployment failed during the artifact download phase. The device was unable to establish a secure connection to the artifact repository.
1020
-
1021
- ## Key Issues
1022
- 1. **Network connectivity issues** - Connection timeout occurred
1023
- 2. **SSL/TLS certificate verification failed** - Invalid certificate chain
1024
- 3. **Artifact verification failed** - Checksum mismatch detected
1025
-
1026
- ## Recommendations
1027
- - Check network connectivity between device and artifact repository
1028
- - Verify SSL certificates are properly configured
1029
- - Ensure artifact integrity before deployment`;
1030
- return import_msw.HttpResponse.text(mockAnalysis);
1031
- }
1032
- if (deploymentId === "rate-limited-deployment") {
1033
- return new import_msw.HttpResponse(JSON.stringify({ error: "Rate limit exceeded" }), { status: 429 });
1034
- }
1035
- if (deploymentId === "error-deployment") {
1036
- return new import_msw.HttpResponse(JSON.stringify({ error: "Analysis failed" }), { status: 500 });
1037
- }
1038
- return new import_msw.HttpResponse(null, { status: 404 });
1039
- })
1040
- ];
1041
- // Annotate the CommonJS export names for ESM import in node:
1042
- 0 && (module.exports = {
1043
- deploymentHandlers
1044
- });
1045
- //# sourceMappingURL=deploymentHandlers.cjs.map