@northern.tech/testing 0.1.0

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