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