@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,1130 +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/organizationHandlers.ts
21
- var organizationHandlers_exports = {};
22
- __export(organizationHandlers_exports, {
23
- organizationHandlers: () => organizationHandlers
24
- });
25
- module.exports = __toCommonJS(organizationHandlers_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 webhookEvents = [
51
- {
52
- id: "1",
53
- type: "device-status-changed",
54
- data: { id: "1", status: "accepted" },
55
- time: "2020-09-01T12:00:00.000Z",
56
- delivery_statuses: [{ integration_id: "1", success: true, status_code: 200 }]
57
- },
58
- {
59
- id: "2",
60
- type: "device-status-changed",
61
- data: { id: "3", status: "accepted" },
62
- time: "2020-09-01T12:00:05.000Z",
63
- delivery_statuses: [{ integration_id: "1", success: true, status_code: 200 }]
64
- }
65
- ];
66
- var tenants = [
67
- {
68
- id: "671a0f1dd58c813118fe8622",
69
- parent_tenant_id: "6718de64b42e08dea2a2065d",
70
- name: "child2",
71
- tenant_token: "mQDYRCr-tGbDuJhPp7fArbfTA5htVTWE9G204AzhDUM",
72
- status: "active",
73
- additional_info: {
74
- marketing: false,
75
- campaign: ""
76
- },
77
- plan: "enterprise",
78
- trial: false,
79
- trial_expiration: null,
80
- service_provider: false,
81
- created_at: "2024-10-24T09:10:53.281Z",
82
- cancelled_at: null,
83
- children_tenants: null,
84
- max_child_tenants: 0,
85
- device_count: 0,
86
- device_limit: 100,
87
- device_limits: {
88
- max_devices: {
89
- current_value: 0,
90
- name: "max_devices",
91
- tenant_id: "699f07a3e783def54cf6201f",
92
- value: 200
93
- },
94
- max_micro_devices: {
95
- current_value: 0,
96
- name: "max_micro_devices",
97
- tenant_id: "699f07a3e783def54cf6201f",
98
- value: 280
99
- },
100
- max_system_devices: {
101
- current_value: 0,
102
- name: "max_system_devices",
103
- tenant_id: "699f07a3e783def54cf6201f",
104
- value: 20
105
- }
106
- },
107
- binary_delta: true
108
- }
109
- ];
110
- var userId = "a30a780b-b843-5344-80e3-0fd95a4f6fc3";
111
- var defaultUser = {
112
- created_ts: "2019-01-01T10:30:00.000Z",
113
- email: "a@b.com",
114
- id: "a1",
115
- roles: ["RBAC_ROLE_PERMIT_ALL"],
116
- tfa_status: "enabled",
117
- verified: true
118
- };
119
- var deviceTypes = { qemu: "qemux86-64" };
120
- var checkInTimeRounded = "2019-01-01T00:00:00.000Z";
121
- var checkInTimeExact = "2019-01-01T10:25:00.000Z";
122
- var mockApiResponses = {
123
- deployments: {
124
- byId: {
125
- d1: {
126
- id: "d1",
127
- name: "test deployment",
128
- created: "2019-01-01T12:30:00.000Z",
129
- devices: {
130
- a1: {
131
- id: "a1",
132
- status: "installing",
133
- attributes: {},
134
- image: { size: 123 }
135
- }
136
- },
137
- statistics: {
138
- status: {
139
- "already-installed": 0,
140
- decommissioned: 0,
141
- downloading: 0,
142
- failure: 0,
143
- installing: 1,
144
- noartifact: 0,
145
- pending: 0,
146
- rebooting: 0,
147
- success: 0
148
- },
149
- total_size: 1234
150
- }
151
- },
152
- d2: {
153
- id: "d2",
154
- name: "test deployment 2",
155
- artifact_name: "r1",
156
- artifacts: ["123"],
157
- created: "2019-01-01T12:25:00.000Z",
158
- device_count: 1,
159
- devices: {
160
- b1: {
161
- attributes: {},
162
- id: "b1",
163
- status: "pending"
164
- }
165
- },
166
- filter: void 0,
167
- group: void 0,
168
- statistics: {
169
- status: {
170
- downloading: 0,
171
- decommissioned: 0,
172
- failure: 0,
173
- installing: 0,
174
- noartifact: 0,
175
- pending: 1,
176
- rebooting: 0,
177
- success: 0,
178
- "already-installed": 0
179
- }
180
- }
181
- },
182
- d3: {
183
- id: "d3",
184
- name: "Test",
185
- phases: [
186
- { id: "0", batch_size: 2, device_count: 2 },
187
- { id: "1", start_ts: "2019-02-04T11:45:10.002Z", batch_size: 3, device_count: 3 },
188
- { id: "2", start_ts: "2019-02-05T11:45:10.002Z", batch_size: 5, device_count: 5 },
189
- { id: "3", start_ts: "2019-02-06T11:45:10.002Z", batch_size: 5, device_count: 5 },
190
- { id: "4", start_ts: "2019-02-21T11:45:10.002Z", batch_size: 5, device_count: 0 }
191
- ],
192
- max_devices: 0,
193
- created: "2019-01-31T12:59:30.020Z",
194
- devices: {},
195
- filter: void 0,
196
- group: void 0,
197
- stats: {
198
- pending: 3,
199
- decommissioned: 0,
200
- failure: 23,
201
- pause_before_committing: 0,
202
- pause_before_rebooting: 0,
203
- installing: 0,
204
- rebooting: 0,
205
- "already-installed": 0,
206
- pause_before_installing: 0,
207
- downloading: 0,
208
- success: 6,
209
- aborted: 0,
210
- noartifact: 0
211
- },
212
- statistics: { total_size: "1234" },
213
- status: "inprogress",
214
- active: true,
215
- device_count: 100,
216
- retries: "0",
217
- type: "software"
218
- }
219
- },
220
- byStatus: {
221
- pending: { deploymentIds: ["d2"] },
222
- inprogress: { deploymentIds: ["d3"] }
223
- }
224
- },
225
- devices: {
226
- byId: {
227
- a1: {
228
- id: "a1",
229
- auth_sets: [
230
- {
231
- id: "auth1",
232
- identity_data: { mac: defaultMacAddress },
233
- pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
234
- status: "accepted",
235
- ts: defaultCreationDate
236
- }
237
- ],
238
- updated_ts: "2019-01-01T09:25:00.000Z"
239
- },
240
- b1: {
241
- id: "b1",
242
- attributes: {
243
- ipv4_wlan0: "192.168.10.141/24",
244
- device_type: [deviceTypes.qemu]
245
- },
246
- system: {
247
- check_in_time: checkInTimeRounded
248
- },
249
- check_in_time: checkInTimeExact,
250
- check_in_time_exact: checkInTimeExact,
251
- check_in_time_rounded: checkInTimeRounded,
252
- identity_data: { mac: defaultMacAddress },
253
- status: "accepted",
254
- decommissioning: false,
255
- created_ts: defaultCreationDate,
256
- updated_ts: "2019-01-01T09:25:00.000Z",
257
- auth_sets: [
258
- {
259
- id: "auth1",
260
- identity_data: { mac: defaultMacAddress },
261
- pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
262
- ts: defaultCreationDate,
263
- status: "accepted"
264
- }
265
- ]
266
- }
267
- },
268
- groups: {
269
- byId: {
270
- testGroup: {
271
- deviceIds: ["a1", "b1"],
272
- filters: [],
273
- total: 2
274
- },
275
- testGroupDynamic: {
276
- id: "filter1",
277
- name: "filter1",
278
- filters: [{ scope: "system", key: "group", operator: "$eq", value: "things" }]
279
- }
280
- }
281
- },
282
- limits: { standard: 500, micro: 0, system: 0 },
283
- byStatus: {
284
- accepted: { deviceIds: ["a1", "b1"], total: 2 },
285
- active: { deviceIds: [], total: 0 },
286
- inactive: { deviceIds: [], total: 0 },
287
- pending: { deviceIds: ["c1"], total: 1 },
288
- preauthorized: { deviceIds: [], total: 0 },
289
- rejected: { deviceIds: [], total: 0 }
290
- }
291
- },
292
- organization: {
293
- organization: {
294
- id: "1",
295
- addons: [],
296
- name: "test",
297
- plan: "os",
298
- trial: false
299
- },
300
- products: [
301
- {
302
- name: "mender_standard",
303
- billing_unit: "devices",
304
- prices: [
305
- {
306
- plan: "os",
307
- constraints: {
308
- min: 50,
309
- max: 1e3,
310
- div: 50
311
- }
312
- },
313
- {
314
- plan: "professional",
315
- constraints: {
316
- min: 250,
317
- max: 1e4,
318
- div: 50
319
- }
320
- }
321
- ],
322
- addons: [
323
- {
324
- name: "troubleshoot",
325
- prices: [{ plan: "os" }, { plan: "professional" }]
326
- },
327
- {
328
- name: "configure",
329
- prices: [{ plan: "os" }, { plan: "professional" }]
330
- },
331
- {
332
- name: "monitor",
333
- prices: [{ plan: "professional" }]
334
- }
335
- ]
336
- },
337
- {
338
- name: "mender_micro",
339
- billing_unit: "devices",
340
- prices: [
341
- {
342
- plan: "os",
343
- constraints: {
344
- min: 50,
345
- max: 5e3,
346
- div: 50
347
- }
348
- },
349
- {
350
- plan: "professional",
351
- constraints: {
352
- min: 500,
353
- max: 1e5,
354
- div: 50
355
- }
356
- }
357
- ]
358
- }
359
- ],
360
- intentId: "testIntent",
361
- auditlog: {
362
- events: [
363
- {
364
- actor: {
365
- id: "string",
366
- type: "user",
367
- email: "string@example.com"
368
- },
369
- time: "2019-01-01T12:10:22.667Z",
370
- action: "create",
371
- object: {
372
- id: "string",
373
- type: "user",
374
- user: {
375
- email: "user@acme.com"
376
- }
377
- },
378
- change: "change1"
379
- },
380
- {
381
- actor: {
382
- id: "string",
383
- type: "user",
384
- email: "string",
385
- identity_data: "string"
386
- },
387
- time: "2019-01-01T12:16:22.667Z",
388
- action: "create",
389
- object: {
390
- id: "string",
391
- type: "deployment",
392
- deployment: {
393
- name: "production",
394
- artifact_name: "Application 0.0.1"
395
- }
396
- },
397
- change: "change2"
398
- },
399
- {
400
- actor: {
401
- id: "string",
402
- type: "user",
403
- email: "string@example.com"
404
- },
405
- time: "2019-01-01T12:10:22.669Z",
406
- action: "open_terminal",
407
- meta: {
408
- session_id: ["abd313a8-ee88-48ab-9c99-fbcd80048e6e"]
409
- },
410
- object: {
411
- id: "a1",
412
- type: "device"
413
- },
414
- change: "change3"
415
- }
416
- ]
417
- }
418
- },
419
- releases: {
420
- byId: {
421
- r1: {
422
- name: "r1",
423
- artifacts: [
424
- {
425
- id: "art1",
426
- description: "test description",
427
- device_types_compatible: [deviceTypes.qemu],
428
- modified: "2020-09-10T12:16:22.667Z",
429
- updates: [{ type_info: { type: "testtype" } }],
430
- artifact_depends: {
431
- device_type: [deviceTypes.qemu]
432
- },
433
- artifact_provides: {
434
- artifact_name: "myapp",
435
- "data-partition.myapp.version": "v2020.10",
436
- list_of_fancy: [deviceTypes.qemu, "x172"]
437
- },
438
- clears_artifact_provides: ["data-partition.myapp.*"]
439
- }
440
- ],
441
- device_types_compatible: [deviceTypes.qemu],
442
- modified: "2020-09-10T12:16:22.667Z",
443
- metaData: {}
444
- }
445
- }
446
- },
447
- users: {
448
- byId: {
449
- a1: defaultUser,
450
- [userId]: { ...defaultUser, id: userId, email: "a2@b.com", created_ts: "2019-01-01T12:30:00.000Z" }
451
- },
452
- rolesById: {
453
- admin: {
454
- name: "admin",
455
- description: "Administrator role",
456
- permissions: []
457
- },
458
- test: { name: "test", description: "test description", permissions: [] }
459
- },
460
- globalSettings: {
461
- "2fa": "enabled",
462
- id_attribute: void 0,
463
- previousFilters: []
464
- },
465
- userSettings: {
466
- "2fa": "disabled",
467
- columnSelection: [],
468
- onboarding: { something: "here" },
469
- tooltips: {},
470
- previousFilters: []
471
- }
472
- }
473
- };
474
- var releasesList = Array.from({ length: 5e3 }, (x, i) => ({
475
- artifacts: [
476
- {
477
- id: "art1",
478
- description: "test description",
479
- device_types_compatible: [deviceTypes.qemu],
480
- modified: "2020-09-10T12:16:22.667Z",
481
- updates: [{ type_info: { type: "testtype" } }],
482
- artifact_depends: {
483
- device_type: [deviceTypes.qemu]
484
- },
485
- artifact_provides: {
486
- artifact_name: "myapp",
487
- "data-partition.myapp.version": "v2020.10",
488
- list_of_fancy: [deviceTypes.qemu, "x172"]
489
- },
490
- clears_artifact_provides: ["data-partition.myapp.*"]
491
- }
492
- ],
493
- device_types_compatible: [deviceTypes.qemu],
494
- metaData: {},
495
- name: `release-${i + 1}`,
496
- modified: i
497
- }));
498
- var permissionSets = [
499
- {
500
- ...import_constants.defaultPermissionSets.Basic,
501
- object: permissionSetObjectTypes.empty,
502
- description: "Set containing basic permissions.",
503
- permissions: [
504
- { action: "http", object: { type: "any", value: "^/api/management/v1/useradm/settings$" } },
505
- { action: "http", object: { type: "any", value: "^/api/management/v1/useradm/users/me$" } },
506
- { action: "http", object: { type: "any", value: "^/api/management/1.0/auth/verify$" } },
507
- { action: "http", object: { type: "PUT", value: "^/api/management/v1/useradm/2faverify$" } },
508
- { action: "http", object: { type: "POST", value: "^/api/management/v1/useradm/users/me/2fa/(enable|disable)$" } },
509
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/roles" } },
510
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/user/tenant" } }
511
- ]
512
- },
513
- {
514
- ...import_constants.defaultPermissionSets.ManageReleases,
515
- action: import_constants.uiPermissionsById.manage.title,
516
- object: permissionSetObjectTypes.releases,
517
- description: "Set of permissions which allows user to manage releases",
518
- permissions: [
519
- { action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
520
- { action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
521
- { action: "http", object: { type: "PUT", value: commonEndpoints.artifactDetails } },
522
- { action: "http", object: { type: "DELETE", value: commonEndpoints.artifactDetails } },
523
- { action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
524
- ]
525
- },
526
- {
527
- ...import_constants.defaultPermissionSets.ReadUsers,
528
- action: import_constants.uiPermissionsById.read.title,
529
- object: permissionSetObjectTypes.userManagement,
530
- description: "Set of permissions which allows user to view other users",
531
- permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/" } }]
532
- },
533
- {
534
- ...import_constants.defaultPermissionSets.ManageUsers,
535
- action: import_constants.uiPermissionsById.manage.title,
536
- object: permissionSetObjectTypes.userManagement,
537
- description: "Set of permissions which allows user manage other user accounts",
538
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/" } }]
539
- },
540
- {
541
- ...import_constants.defaultPermissionSets.ReadTenants,
542
- action: import_constants.uiPermissionsById.read.title,
543
- object: permissionSetObjectTypes.tenantManagement,
544
- description: "Set of permissions which allows user to list other tenants and their config",
545
- permissions: [
546
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
547
- { action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } }
548
- ]
549
- },
550
- {
551
- ...import_constants.defaultPermissionSets.ManageTenants,
552
- action: import_constants.uiPermissionsById.manage.title,
553
- object: permissionSetObjectTypes.tenantManagement,
554
- description: "Set of permissions which allows user to manage other tenants and their config",
555
- permissions: [
556
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
557
- { action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } },
558
- { action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9])/tenantadm/" } }
559
- ]
560
- },
561
- {
562
- ...import_constants.defaultPermissionSets.ReadAuditLogs,
563
- action: import_constants.uiPermissionsById.read.title,
564
- object: "System Audit Log",
565
- description: "Set of permissions which allows user to view system audit log",
566
- permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/auditlogs/logs" } }]
567
- },
568
- {
569
- ...import_constants.defaultPermissionSets.DeployToDevices,
570
- action: "Deploy",
571
- object: permissionSetObjectTypes.groups,
572
- description: "Set of permissions which allows user to deploy to devices",
573
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/(deployments|deviceconfig)/" } }],
574
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
575
- },
576
- {
577
- ...import_constants.defaultPermissionSets.ConfigureDevices,
578
- action: "Configure",
579
- object: permissionSetObjectTypes.groups,
580
- description: "Set of permissions which allows user to manage configuration of the devices",
581
- permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/" } }],
582
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
583
- },
584
- {
585
- ...import_constants.defaultPermissionSets.ConnectToDevices,
586
- action: "Connect",
587
- object: permissionSetObjectTypes.groups,
588
- description: "Set of permissions which allows user to use remote terminal and file transfer",
589
- permissions: [
590
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/connect$" } },
591
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/download\\?path=[^&]+$" } },
592
- { action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/upload$" } }
593
- ],
594
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
595
- },
596
- {
597
- ...import_constants.defaultPermissionSets.SuperUser,
598
- action: "Any",
599
- object: permissionSetObjectTypes.any,
600
- description: "Set of permissions which allows user to do anything",
601
- permissions: [{ action: "any", object: { type: "any", value: "any" } }]
602
- },
603
- {
604
- ...import_constants.defaultPermissionSets.UploadArtifacts,
605
- action: "Upload",
606
- object: permissionSetObjectTypes.artifacts,
607
- description: "Set of permissions which allows user to upload artifacts",
608
- permissions: [
609
- { action: "http", object: { type: "POST", value: commonEndpoints.artifacts } },
610
- { action: "http", object: { type: "POST", value: "^/api/management/v1/deployments/artifacts/generate" } }
611
- ]
612
- },
613
- {
614
- ...import_constants.defaultPermissionSets.ReadDevices,
615
- action: import_constants.uiPermissionsById.read.title,
616
- object: permissionSetObjectTypes.groups,
617
- description: "Set of permissions which allows user to view devices",
618
- permissions: [
619
- { action: "http", object: { type: "POST", value: "^/api/management/v2/inventory/filters/search" } },
620
- { action: "http", object: { type: "POST", value: "^/api/management/v1/reporting/devices/search" } },
621
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/(deployments|devauth|inventory|deviceconfig|devicemonitor)/" } },
622
- { action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+$" } }
623
- ],
624
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
625
- },
626
- {
627
- ...import_constants.defaultPermissionSets.ManageDevices,
628
- action: import_constants.uiPermissionsById.manage.title,
629
- object: permissionSetObjectTypes.groups,
630
- description: "Set of permissions which allows user to manage devices",
631
- permissions: [
632
- { action: "http", object: { type: "POST", value: commonEndpoints.deviceManagement } },
633
- { action: "http", object: { type: "PUT", value: commonEndpoints.deviceManagement } },
634
- { action: "http", object: { type: "DELETE", value: commonEndpoints.deviceManagement } }
635
- ],
636
- supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
637
- },
638
- {
639
- ...import_constants.defaultPermissionSets.ReadReleases,
640
- action: import_constants.uiPermissionsById.read.title,
641
- object: permissionSetObjectTypes.releases,
642
- description: "Set of permissions which allows user to view releases",
643
- permissions: [
644
- { action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
645
- { action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
646
- { action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
647
- ]
648
- },
649
- {
650
- name: "almostAdmin",
651
- object: permissionSetObjectTypes.empty,
652
- description: "Set containing all the permissions.",
653
- permissions: [
654
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/auditlogs/.*" } },
655
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/.*" } },
656
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/config/.*" } },
657
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/.*" } },
658
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/releases/.*" } },
659
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/devauth/.*" } },
660
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/.*" } },
661
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/.*" } },
662
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/devices" } },
663
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/inventory/.*" } },
664
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/iot-manager/.*" } },
665
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/monitor/.*" } },
666
- { action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/.*" } }
667
- ]
668
- }
669
- ];
670
- var rbacRoles = [
671
- {
672
- name: "dyn",
673
- description: "",
674
- permissions: [
675
- { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: "dyn" } },
676
- { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: "dyn" } }
677
- ]
678
- },
679
- { name: "asdasd", description: "123", permissions: [{ action: "http", object: { type: "any", value: "/api/management/v1/useradm/.*" } }] },
680
- {
681
- name: "141sasd",
682
- description: "1313adg",
683
- permission_sets_with_scope: [
684
- { ...import_constants.defaultPermissionSets.ReadDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
685
- { ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
686
- { ...import_constants.defaultPermissionSets.ManageUsers }
687
- ]
688
- },
689
- {
690
- name: "kljlkk",
691
- description: "lkl",
692
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } }]
693
- },
694
- {
695
- name: "yyyyy",
696
- description: "asd",
697
- permission_sets_with_scope: [
698
- { ...import_constants.defaultPermissionSets.ManageDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["dockerclient"] } },
699
- { ...import_constants.defaultPermissionSets.ManageReleases }
700
- ]
701
- },
702
- {
703
- name: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
704
- description: "Intended for users responsible for managing deployments, this role can create and abort deployments",
705
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.DeployToDevices }]
706
- },
707
- {
708
- name: "RBAC_ROLE_REMOTE_TERMINAL",
709
- description: `Intended for tech support accounts, this role can access the devices' Remote Terminal.`,
710
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices }]
711
- },
712
- { name: "RBAC_ROLE_PERMIT_ALL", description: "", permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.SuperUser }] },
713
- {
714
- name: "RBAC_ROLE_OBSERVER",
715
- 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.",
716
- permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ReadReleases }, { ...import_constants.defaultPermissionSets.ReadDevices }]
717
- },
718
- {
719
- name: "RBAC_ROLE_CI",
720
- 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.",
721
- permission_sets_with_scope: [
722
- { ...import_constants.defaultPermissionSets.ReadReleases },
723
- { ...import_constants.defaultPermissionSets.ManageReleases },
724
- { ...import_constants.defaultPermissionSets.UploadArtifacts }
725
- ]
726
- },
727
- {
728
- name: "almostAdmin",
729
- description: "almost admin rights",
730
- permissions: permissionSets.find((item) => item.name === "almostAdmin")?.permissions
731
- },
732
- {
733
- name: "almostAdminNew",
734
- description: "almost admin rights",
735
- permission_sets_with_scope: Object.values(import_constants.defaultPermissionSets)
736
- }
737
- ];
738
- var expectedParsedRoles = {
739
- "141sasd": {
740
- editable: true,
741
- isCustom: void 0,
742
- uiPermissions: {
743
- ...import_constants.emptyUiPermissions,
744
- groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] },
745
- userManagement: [import_constants.uiPermissionsById.manage.value]
746
- }
747
- },
748
- asdasd: {
749
- editable: false,
750
- isCustom: true,
751
- uiPermissions: { ...import_constants.emptyUiPermissions, userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] }
752
- },
753
- dyn: {
754
- editable: false,
755
- isCustom: true,
756
- uiPermissions: {
757
- ...import_constants.emptyUiPermissions,
758
- deployments: [import_constants.uiPermissionsById.deploy.value],
759
- groups: { dyn: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value] }
760
- }
761
- },
762
- kljlkk: {
763
- editable: true,
764
- isCustom: false,
765
- uiPermissions: { ...import_constants.emptyUiPermissions, groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] } }
766
- },
767
- yyyyy: {
768
- editable: true,
769
- isCustom: void 0,
770
- uiPermissions: {
771
- ...import_constants.emptyUiPermissions,
772
- groups: { dockerclient: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] },
773
- releases: { [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value] }
774
- }
775
- },
776
- almostAdmin: {
777
- editable: false,
778
- isCustom: true,
779
- uiPermissions: {
780
- ...import_constants.emptyUiPermissions,
781
- auditlog: [import_constants.uiPermissionsById.read.value],
782
- deployments: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.read.value],
783
- groups: {
784
- [import_constants.ALL_DEVICES]: [
785
- import_constants.uiPermissionsById.read.value,
786
- // we can't assign deployment permissions to devices here, since the old path based rbac controls don't allow the scoped permissions
787
- // uiPermissionsById.deploy.value,
788
- import_constants.uiPermissionsById.manage.value,
789
- import_constants.uiPermissionsById.connect.value,
790
- import_constants.uiPermissionsById.configure.value
791
- ]
792
- },
793
- releases: {
794
- [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.manage.value]
795
- },
796
- userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
797
- }
798
- },
799
- almostAdminNew: {
800
- editable: true,
801
- isCustom: void 0,
802
- uiPermissions: {
803
- ...import_constants.emptyUiPermissions,
804
- auditlog: [import_constants.uiPermissionsById.read.value],
805
- deployments: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.manage.value],
806
- groups: {
807
- [import_constants.ALL_DEVICES]: [
808
- import_constants.uiPermissionsById.read.value,
809
- import_constants.uiPermissionsById.manage.value,
810
- import_constants.uiPermissionsById.deploy.value,
811
- import_constants.uiPermissionsById.connect.value,
812
- import_constants.uiPermissionsById.configure.value
813
- ]
814
- },
815
- releases: {
816
- [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.read.value]
817
- },
818
- tenantManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value],
819
- userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
820
- }
821
- }
822
- };
823
- var defaultRolesById = {
824
- ...import_constants.rolesById,
825
- test: {
826
- ...import_constants.emptyRole,
827
- name: "test",
828
- description: "test description",
829
- editable: true,
830
- uiPermissions: {
831
- ...import_constants.emptyUiPermissions,
832
- groups: { testGroup: [import_constants.uiPermissionsById.read.value] },
833
- releases: { bar: [import_constants.uiPermissionsById.read.value] }
834
- }
835
- }
836
- };
837
- var receivedRoles = rbacRoles.reduce(
838
- (accu, role) => {
839
- const { name, description, ...roleRemainder } = role;
840
- if (name.startsWith("RBAC")) {
841
- accu[name] = {
842
- ...defaultRolesById[name],
843
- ...roleRemainder,
844
- editable: false,
845
- isCustom: false,
846
- description: defaultRolesById[name].description ? defaultRolesById[name].description : description
847
- };
848
- } else {
849
- const result = expectedParsedRoles[name] ?? {};
850
- accu[name] = {
851
- ...import_constants.emptyRole,
852
- ...role,
853
- ...result,
854
- name
855
- };
856
- }
857
- return accu;
858
- },
859
- { ...defaultRolesById }
860
- );
861
- var receivedPermissionSets = permissionSets.reduce((accu, set) => {
862
- const result = import_constants.defaultPermissionSets[set.name]?.result ?? {};
863
- accu[set.name] = {
864
- ...set,
865
- result: {
866
- ...import_constants.emptyUiPermissions,
867
- ...result
868
- }
869
- };
870
- return accu;
871
- }, {});
872
-
873
- // src/requestHandlers/organizationHandlers.ts
874
- var PLANS = {
875
- os: { id: "os", name: "Basic" },
876
- professional: { id: "professional", name: "Professional" },
877
- enterprise: { id: "enterprise", name: "Enterprise" }
878
- };
879
- var releasesSample = {
880
- lts: ["3.3"],
881
- releases: {
882
- "3.2": {
883
- "3.2.1": {
884
- release_date: "2022-02-02",
885
- release: "3.2.1",
886
- repos: [
887
- { name: "integration", version: "1.2.3" },
888
- { name: "mender", version: "3.2.1" },
889
- { name: "mender-artifact", version: "1.3.7" },
890
- { name: "service", version: "3.0.0" },
891
- { name: "other-service", version: "1.1.0" }
892
- ]
893
- },
894
- "3.2.0": {
895
- release_date: "2022-01-24",
896
- release: "3.2.0",
897
- repos: [
898
- { name: "service", version: "3.0.0" },
899
- { name: "another-service", version: "4.1.0" }
900
- ]
901
- }
902
- },
903
- "2.7": {
904
- "2.7.2": {
905
- release_date: "2021-11-04",
906
- release: "2.7.2",
907
- repos: [
908
- { name: "service", version: "1.1.0" },
909
- { name: "more-service", version: "1.0.2" }
910
- ]
911
- }
912
- },
913
- "1.0": {
914
- supported_until: "2018-02",
915
- "1.0.1": {
916
- release_date: "2017-04-03",
917
- release: "1.0.1",
918
- repos: [{ name: "service", version: "1.0.1" }]
919
- },
920
- "1.0.0": {
921
- release_date: "2017-02-16",
922
- release: "1.0.0",
923
- repos: [{ name: "mono-service", version: "1.0.0" }]
924
- }
925
- }
926
- },
927
- saas: [
928
- { tag: "saas-v2022.03.10", date: "2022-03-09" },
929
- { tag: "saas-v2020.09.25", date: "2020-09-24" },
930
- { tag: "saas-v2020.07.09", date: "2020-07-09" }
931
- ]
932
- };
933
- var tagsSample = [{ name: "saas-v2023.05.02", more: "here" }];
934
- var signupHandler = async ({ request }) => {
935
- const signup = await request.json();
936
- if (["email", "organization", "plan", "tos"].every((item) => !!signup[item])) {
937
- return import_msw.HttpResponse.text("test");
938
- }
939
- return new import_msw.HttpResponse(null, { status: 400 });
940
- };
941
- var invoicePreviewBasic = {
942
- id: "upcoming_in_1RlAkbFlFfXikjZVOHK5VQx0",
943
- period_start: "2025-07-15T15:25:22Z",
944
- period_end: "2025-08-15T15:25:22Z",
945
- total: 3200,
946
- currency: "usd",
947
- lines: [
948
- {
949
- description: "50 device \xD7 Mender Basic (Tier 1 at $0.00 / month)",
950
- amount: 0,
951
- currency: "usd",
952
- product: "mender_standard",
953
- quantity: 50,
954
- price_id: "price_1PYktlFlFfXikjZVh2aNHp7i"
955
- },
956
- {
957
- description: "Mender Basic (Tier 1 at $32.00 / month)",
958
- amount: 3200,
959
- currency: "usd",
960
- product: "mender_standard",
961
- quantity: 0,
962
- price_id: "price_1PYktlFlFfXikjZVh2aNHp7i"
963
- }
964
- ]
965
- };
966
- var subscriptionBasic = {
967
- id: "sub_1RlAjOFlFfXikjZVj5BvpJE4",
968
- status: "active",
969
- plan: "os",
970
- products: [
971
- {
972
- name: "mender_standard",
973
- quantity: 50
974
- }
975
- ]
976
- };
977
- var organizationHandlers = [
978
- import_msw.http.get("/tags.json", () => import_msw.HttpResponse.json(tagsSample)),
979
- import_msw.http.get("/versions.json", () => import_msw.HttpResponse.json(releasesSample)),
980
- import_msw.http.get(`${import_constants2.tenantadmApiUrlv1}/user/tenant`, () => import_msw.HttpResponse.json(mockApiResponses.organization.organization)),
981
- import_msw.http.put(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/child`, () => new import_msw.HttpResponse(null, { status: 200 })),
982
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/cancel`, () => new import_msw.HttpResponse(null, { status: 200 })),
983
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/trial`, signupHandler),
984
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants`, async ({ request }) => {
985
- const { users } = await request.json();
986
- const { email } = users[0];
987
- if (email.includes("bad")) {
988
- return new import_msw.HttpResponse(null, { status: 553 });
989
- }
990
- return new import_msw.HttpResponse(null, { status: 200 });
991
- }),
992
- import_msw.http.post(`https://hosted.mender.io${import_constants2.tenantadmApiUrlv2}/tenants/trial`, signupHandler),
993
- import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/tenants`, () => import_msw.HttpResponse.json(tenants)),
994
- import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing`, () => import_msw.HttpResponse.json({ card: { last4: "7890", exp_month: 1, exp_year: 2024, brand: "testCorp" } })),
995
- import_msw.http.get(
996
- `${import_constants2.tenantadmApiUrlv2}/billing/profile`,
997
- () => import_msw.HttpResponse.json({
998
- name: "company",
999
- email: "test@test.com",
1000
- address: { state: "OSLO", line1: "Blindern", country: "NO", city: "OSLO", postal_code: "0123" },
1001
- shipping: { address: { state: "OSLO", line1: "Blindern", country: "NO", city: "OSLO", postal_code: "0123" } }
1002
- })
1003
- ),
1004
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/card`, () => import_msw.HttpResponse.json({ intent_id: mockApiResponses.organization.intentId, secret: "testSecret" })),
1005
- import_msw.http.post(
1006
- `${import_constants2.tenantadmApiUrlv2}/billing/card/:intentId/confirm`,
1007
- ({ params: { intentId } }) => new import_msw.HttpResponse(null, { status: intentId == mockApiResponses.organization.intentId ? 200 : 540 })
1008
- ),
1009
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/upgrade/:status`, async ({ params: { status, tenantId }, request }) => {
1010
- if (tenantId != mockApiResponses.organization.organization.id || !["cancel", "complete", "start"].includes(status)) {
1011
- return new import_msw.HttpResponse(null, { status: 541 });
1012
- }
1013
- if (status === "start") {
1014
- return import_msw.HttpResponse.json({ secret: "testSecret" });
1015
- }
1016
- let plan;
1017
- try {
1018
- const body = await request.json();
1019
- plan = body.plan;
1020
- } catch {
1021
- }
1022
- if (plan && !Object.keys(PLANS).includes(plan)) {
1023
- return new import_msw.HttpResponse(null, { status: 542 });
1024
- }
1025
- return new import_msw.HttpResponse(null, { status: 200 });
1026
- }),
1027
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/plan`, async ({ params: { tenantId }, request }) => {
1028
- const body = await request.json();
1029
- const expectedKeys = ["current_plan", "requested_plan", "current_addons", "requested_addons", "user_message"];
1030
- if (tenantId != mockApiResponses.organization.organization.id || !Object.keys(body).every((key) => expectedKeys.includes(key))) {
1031
- return new import_msw.HttpResponse(null, { status: 544 });
1032
- }
1033
- if (body.requested_plan && !Object.values(PLANS).some((item) => item.name === body.requested_plan)) {
1034
- return new import_msw.HttpResponse(null, { status: 545 });
1035
- }
1036
- return new import_msw.HttpResponse(null, { status: 200 });
1037
- }),
1038
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/contact/support`, async ({ request }) => {
1039
- const { subject, body } = await request.json();
1040
- if (!(subject && body)) {
1041
- return new import_msw.HttpResponse(null, { status: 543 });
1042
- }
1043
- return new import_msw.HttpResponse(null, { status: 200 });
1044
- }),
1045
- import_msw.http.patch(`${import_constants2.tenantadmApiUrlv2}/billing/profile`, () => new import_msw.HttpResponse(null, { status: 200 })),
1046
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/profile`, () => new import_msw.HttpResponse(null, { status: 200 })),
1047
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/subscription`, () => new import_msw.HttpResponse(null, { status: 202 })),
1048
- import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/subscription/invoices/preview`, () => import_msw.HttpResponse.json(invoicePreviewBasic)),
1049
- import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing/subscription`, () => import_msw.HttpResponse.json(subscriptionBasic)),
1050
- import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing/products`, () => import_msw.HttpResponse.json(mockApiResponses.organization.products)),
1051
- import_msw.http.get(`${import_constants2.auditLogsApiUrl}/logs`, ({ request }) => {
1052
- const { searchParams } = new URL(request.url);
1053
- const perPage = Number(searchParams.get("per_page"));
1054
- if (perPage === 500) {
1055
- return import_msw.HttpResponse.json([
1056
- { meta: mockApiResponses.organization.auditlog.events[2].meta, time: mockApiResponses.organization.auditlog.events[1].time, action: "close_terminal" }
1057
- ]);
1058
- }
1059
- return new import_msw.HttpResponse(JSON.stringify(mockApiResponses.organization.auditlog.events), {
1060
- headers: { [import_constants2.headerNames.total]: mockApiResponses.organization.auditlog.events.length }
1061
- });
1062
- }),
1063
- import_msw.http.get(
1064
- `${import_constants2.auditLogsApiUrl}/logs/export`,
1065
- () => import_msw.HttpResponse.text(`action,actor.id,actor.type,actor.email,actor.identity_data,object.id,object.type,object.user.email,object.deployment.name,object.deployment.artifact_name,change
1066
- update,5c56c2ed-2a9a-5de9-bb86-cf38b3d4a5e1,user,test@example.coim,,067f23a9-76a5-5585-b119-32402a120978,user,test@example.com,,,"Update user 067f23a9-76a5-5585-b119-32402a120978 (test@example.com).
1067
- Diff:
1068
- --- Original
1069
- +++ Current
1070
- @@ -9 +9,2 @@
1071
- - ""RBAC_ROLE_OBSERVER""
1072
- + ""RBAC_ROLE_OBSERVER"",
1073
- + ""RBAC_ROLE_PERMIT_ALL""
1074
- "
1075
- `)
1076
- ),
1077
- import_msw.http.get(
1078
- `${import_constants2.iotManagerBaseURL}/integrations`,
1079
- () => import_msw.HttpResponse.json([
1080
- { connection_string: "something_else", id: 1, provider: "iot-hub" },
1081
- { id: 2, provider: "iot-core", something: "new" }
1082
- ])
1083
- ),
1084
- import_msw.http.post(`${import_constants2.iotManagerBaseURL}/integrations`, () => import_msw.HttpResponse.json([{ connection_string: "something_else", provider: "iot-hub" }])),
1085
- import_msw.http.put(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId`, ({ params: { integrationId } }) => {
1086
- if (!integrationId) {
1087
- return new import_msw.HttpResponse(null, { status: 547 });
1088
- }
1089
- return new import_msw.HttpResponse(null, { status: 200 });
1090
- }),
1091
- import_msw.http.put(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId/credentials`, ({ params: { integrationId } }) => {
1092
- if (!integrationId) {
1093
- return new import_msw.HttpResponse(null, { status: 548 });
1094
- }
1095
- return new import_msw.HttpResponse(null, { status: 200 });
1096
- }),
1097
- import_msw.http.delete(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId`, ({ params: { integrationId } }) => {
1098
- if (!integrationId) {
1099
- return new import_msw.HttpResponse(null, { status: 549 });
1100
- }
1101
- return new import_msw.HttpResponse(null, { status: 200 });
1102
- }),
1103
- import_msw.http.get(`${import_constants2.iotManagerBaseURL}/events`, ({ request }) => {
1104
- const { searchParams } = new URL(request.url);
1105
- const page = Number(searchParams.get("page"));
1106
- const perPage = Number(searchParams.get("per_page"));
1107
- return import_msw.HttpResponse.json(webhookEvents.slice(page - 1, page * perPage));
1108
- }),
1109
- import_msw.http.get(
1110
- import_constants2.ssoIdpApiUrlv1,
1111
- () => import_msw.HttpResponse.json([
1112
- { id: "1", issuer: "https://samltest.id/saml/idp", valid_until: "2038-08-24T21:14:09Z" },
1113
- { id: "2", issuer: "https://samltest2.id/saml/idp", valid_until: "2030-10-24T21:14:09Z" }
1114
- ])
1115
- ),
1116
- import_msw.http.post(import_constants2.ssoIdpApiUrlv1, () => new import_msw.HttpResponse(null, { status: 200 })),
1117
- import_msw.http.get(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => {
1118
- if (!configId) {
1119
- return new import_msw.HttpResponse(null, { status: 550 });
1120
- }
1121
- return import_msw.HttpResponse.json({ email: "user@acme.com", password: "mypass1234", login: { google: "bob@gmail.com" }, config: "<div>not quite right</div>" });
1122
- }),
1123
- import_msw.http.put(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => new import_msw.HttpResponse(null, { status: configId ? 200 : 551 })),
1124
- import_msw.http.delete(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => new import_msw.HttpResponse(null, { status: configId ? 200 : 552 }))
1125
- ];
1126
- // Annotate the CommonJS export names for ESM import in node:
1127
- 0 && (module.exports = {
1128
- organizationHandlers
1129
- });
1130
- //# sourceMappingURL=organizationHandlers.cjs.map