@northern.tech/store 0.29.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/dist/actions.cjs +21 -1131
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +212 -221
  4. package/dist/actions.d.ts +212 -220
  5. package/dist/actions.js +21 -18
  6. package/dist/actions.js.map +1 -1
  7. package/dist/api/general-api.cjs +61 -459
  8. package/dist/api/general-api.cjs.map +1 -1
  9. package/dist/api/general-api.d.cts +15 -17
  10. package/dist/api/general-api.d.ts +15 -17
  11. package/dist/api/general-api.js +56 -15
  12. package/dist/api/general-api.js.map +1 -1
  13. package/dist/api/users-api.cjs +32 -469
  14. package/dist/api/users-api.cjs.map +1 -1
  15. package/dist/api/users-api.d.cts +19 -14
  16. package/dist/api/users-api.d.ts +19 -13
  17. package/dist/api/users-api.js +30 -12
  18. package/dist/api/users-api.js.map +1 -1
  19. package/dist/appSlice/constants.cjs +190 -144
  20. package/dist/appSlice/constants.cjs.map +1 -1
  21. package/dist/appSlice/constants.d.cts +2 -159
  22. package/dist/appSlice/constants.d.ts +2 -159
  23. package/dist/appSlice/constants.js +181 -29
  24. package/dist/appSlice/constants.js.map +1 -1
  25. package/dist/appSlice/index.cjs +147 -179
  26. package/dist/appSlice/index.cjs.map +1 -1
  27. package/dist/appSlice/index.d.cts +2 -148
  28. package/dist/appSlice/index.d.ts +2 -148
  29. package/dist/appSlice/index.js +142 -18
  30. package/dist/appSlice/index.js.map +1 -1
  31. package/dist/appSlice/mocks.cjs +17 -192
  32. package/dist/appSlice/mocks.cjs.map +1 -1
  33. package/dist/appSlice/mocks.d.cts +33 -36
  34. package/dist/appSlice/mocks.d.ts +33 -36
  35. package/dist/appSlice/mocks.js +17 -25
  36. package/dist/appSlice/mocks.js.map +1 -1
  37. package/dist/appSlice/selectors.cjs +49 -91
  38. package/dist/appSlice/selectors.cjs.map +1 -1
  39. package/dist/appSlice/selectors.d.cts +216 -230
  40. package/dist/appSlice/selectors.d.ts +216 -230
  41. package/dist/appSlice/selectors.js +29 -44
  42. package/dist/appSlice/selectors.js.map +1 -1
  43. package/dist/appSlice/thunks.cjs +6 -4642
  44. package/dist/appSlice/thunks.d.cts +59 -62
  45. package/dist/appSlice/thunks.d.ts +59 -62
  46. package/dist/appSlice/thunks.js +2 -45
  47. package/dist/auth.cjs +68 -433
  48. package/dist/auth.cjs.map +1 -1
  49. package/dist/auth.d.cts +14 -14
  50. package/dist/auth.d.ts +14 -14
  51. package/dist/auth.js +65 -18
  52. package/dist/auth.js.map +1 -1
  53. package/dist/chunk-CKQMccvm.cjs +28 -0
  54. package/dist/commonConstants.cjs +14 -393
  55. package/dist/commonConstants.d.cts +2 -83
  56. package/dist/commonConstants.d.ts +2 -83
  57. package/dist/commonConstants.js +2 -33
  58. package/dist/commonSelectors.cjs +284 -1281
  59. package/dist/commonSelectors.cjs.map +1 -1
  60. package/dist/commonSelectors.d.cts +1607 -1460
  61. package/dist/commonSelectors.d.ts +1607 -1460
  62. package/dist/commonSelectors.js +277 -55
  63. package/dist/commonSelectors.js.map +1 -1
  64. package/dist/constants-5cdwz1iH.d.ts +160 -0
  65. package/dist/constants-BWEsNG5c.d.ts +28 -0
  66. package/dist/constants-BciiayPt.d.ts +17 -0
  67. package/dist/constants-C5AU0mCY.d.ts +157 -0
  68. package/dist/constants-CIx3fnBv.d.cts +17 -0
  69. package/dist/constants-CNhpIMME.d.cts +93 -0
  70. package/dist/constants-Cpgyuy_r.d.ts +57 -0
  71. package/dist/constants-D41U_jbR.d.cts +160 -0
  72. package/dist/constants-DK7fI3Rh.d.cts +28 -0
  73. package/dist/constants-DPLHhjVN.d.cts +157 -0
  74. package/dist/constants-DrwXHsJ1.d.ts +120 -0
  75. package/dist/constants-G3wymKIl.d.cts +57 -0
  76. package/dist/constants-MPLfugsi.d.cts +120 -0
  77. package/dist/constants-y2XVLQWf.d.ts +93 -0
  78. package/dist/constants.cjs +784 -974
  79. package/dist/constants.cjs.map +1 -1
  80. package/dist/constants.d.cts +8 -14
  81. package/dist/constants.d.ts +8 -14
  82. package/dist/constants.js +674 -234
  83. package/dist/constants.js.map +1 -1
  84. package/dist/deploymentsSlice/constants.cjs +15 -214
  85. package/dist/deploymentsSlice/constants.d.cts +2 -163
  86. package/dist/deploymentsSlice/constants.d.ts +2 -163
  87. package/dist/deploymentsSlice/constants.js +2 -35
  88. package/dist/deploymentsSlice/index.cjs +168 -302
  89. package/dist/deploymentsSlice/index.cjs.map +1 -1
  90. package/dist/deploymentsSlice/index.d.cts +2 -157
  91. package/dist/deploymentsSlice/index.d.ts +2 -157
  92. package/dist/deploymentsSlice/index.js +161 -18
  93. package/dist/deploymentsSlice/index.js.map +1 -1
  94. package/dist/deploymentsSlice/mocks.cjs +178 -433
  95. package/dist/deploymentsSlice/mocks.cjs.map +1 -1
  96. package/dist/deploymentsSlice/mocks.d.cts +176 -178
  97. package/dist/deploymentsSlice/mocks.d.ts +176 -178
  98. package/dist/deploymentsSlice/mocks.js +178 -144
  99. package/dist/deploymentsSlice/mocks.js.map +1 -1
  100. package/dist/deploymentsSlice/selectors.cjs +44 -223
  101. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  102. package/dist/deploymentsSlice/selectors.d.cts +73 -87
  103. package/dist/deploymentsSlice/selectors.d.ts +73 -87
  104. package/dist/deploymentsSlice/selectors.js +37 -25
  105. package/dist/deploymentsSlice/selectors.js.map +1 -1
  106. package/dist/deploymentsSlice/thunks.cjs +16 -4660
  107. package/dist/deploymentsSlice/thunks.d.cts +222 -235
  108. package/dist/deploymentsSlice/thunks.d.ts +222 -235
  109. package/dist/deploymentsSlice/thunks.js +2 -65
  110. package/dist/devicesSlice/constants.cjs +9 -68
  111. package/dist/devicesSlice/constants.d.cts +2 -37
  112. package/dist/devicesSlice/constants.d.ts +2 -37
  113. package/dist/devicesSlice/constants.js +2 -23
  114. package/dist/devicesSlice/index.cjs +215 -225
  115. package/dist/devicesSlice/index.cjs.map +1 -1
  116. package/dist/devicesSlice/index.d.cts +2 -202
  117. package/dist/devicesSlice/index.d.ts +2 -202
  118. package/dist/devicesSlice/index.js +209 -18
  119. package/dist/devicesSlice/index.js.map +1 -1
  120. package/dist/devicesSlice/mocks.cjs +146 -339
  121. package/dist/devicesSlice/mocks.cjs.map +1 -1
  122. package/dist/devicesSlice/mocks.d.cts +150 -148
  123. package/dist/devicesSlice/mocks.d.ts +150 -148
  124. package/dist/devicesSlice/mocks.js +145 -132
  125. package/dist/devicesSlice/mocks.js.map +1 -1
  126. package/dist/devicesSlice/selectors.cjs +145 -539
  127. package/dist/devicesSlice/selectors.cjs.map +1 -1
  128. package/dist/devicesSlice/selectors.d.cts +685 -699
  129. package/dist/devicesSlice/selectors.d.ts +685 -699
  130. package/dist/devicesSlice/selectors.js +123 -59
  131. package/dist/devicesSlice/selectors.js.map +1 -1
  132. package/dist/devicesSlice/thunks.cjs +48 -4724
  133. package/dist/devicesSlice/thunks.d.cts +800 -752
  134. package/dist/devicesSlice/thunks.d.ts +800 -752
  135. package/dist/devicesSlice/thunks.js +2 -129
  136. package/dist/index-4eaLEXy_.d.cts +152 -0
  137. package/dist/index-BEVkIiNa.d.cts +95 -0
  138. package/dist/index-BP0uAq36.d.cts +159 -0
  139. package/dist/index-Bwx9jEiL.d.cts +71 -0
  140. package/dist/index-CJkrL0oA.d.ts +64 -0
  141. package/dist/index-CO-py5d4.d.ts +95 -0
  142. package/dist/index-CTt-eIY8.d.cts +154 -0
  143. package/dist/index-CkwVnIqd.d.ts +159 -0
  144. package/dist/index-Cvkvcz4r.d.ts +115 -0
  145. package/dist/index-DJSlDPRX.d.ts +71 -0
  146. package/dist/index-DqyY6oZ3.d.ts +205 -0
  147. package/dist/index-DtePEQPT.d.ts +152 -0
  148. package/dist/index-Dv3Hfxk_.d.ts +154 -0
  149. package/dist/index-FyYBBeN-.d.cts +115 -0
  150. package/dist/index-Lz5JsJ6O.d.cts +205 -0
  151. package/dist/index-UPc3wvVd.d.cts +64 -0
  152. package/dist/liststatehook.cjs +83 -948
  153. package/dist/liststatehook.cjs.map +1 -1
  154. package/dist/liststatehook.d.cts +29 -239
  155. package/dist/liststatehook.d.ts +29 -239
  156. package/dist/liststatehook.js +77 -85
  157. package/dist/liststatehook.js.map +1 -1
  158. package/dist/locationutils.cjs +459 -916
  159. package/dist/locationutils.cjs.map +1 -1
  160. package/dist/locationutils.d.cts +244 -110
  161. package/dist/locationutils.d.ts +244 -110
  162. package/dist/locationutils.js +440 -44
  163. package/dist/locationutils.js.map +1 -1
  164. package/dist/monitorSlice/constants.cjs +0 -19
  165. package/dist/monitorSlice/constants.d.cts +2 -5
  166. package/dist/monitorSlice/constants.d.ts +2 -5
  167. package/dist/monitorSlice/constants.js +1 -2
  168. package/dist/monitorSlice/index.cjs +65 -82
  169. package/dist/monitorSlice/index.cjs.map +1 -1
  170. package/dist/monitorSlice/index.d.cts +2 -94
  171. package/dist/monitorSlice/index.d.ts +2 -94
  172. package/dist/monitorSlice/index.js +59 -18
  173. package/dist/monitorSlice/index.js.map +1 -1
  174. package/dist/monitorSlice/mocks.cjs +50 -127
  175. package/dist/monitorSlice/mocks.cjs.map +1 -1
  176. package/dist/monitorSlice/mocks.d.cts +49 -49
  177. package/dist/monitorSlice/mocks.d.ts +49 -49
  178. package/dist/monitorSlice/mocks.js +49 -63
  179. package/dist/monitorSlice/mocks.js.map +1 -1
  180. package/dist/monitorSlice/selectors.cjs +5 -29
  181. package/dist/monitorSlice/selectors.cjs.map +1 -1
  182. package/dist/monitorSlice/selectors.d.cts +10 -1
  183. package/dist/monitorSlice/selectors.d.ts +10 -1
  184. package/dist/monitorSlice/selectors.js +5 -6
  185. package/dist/monitorSlice/selectors.js.map +1 -1
  186. package/dist/monitorSlice/thunks.cjs +83 -2513
  187. package/dist/monitorSlice/thunks.cjs.map +1 -1
  188. package/dist/monitorSlice/thunks.d.cts +112 -120
  189. package/dist/monitorSlice/thunks.d.ts +112 -120
  190. package/dist/monitorSlice/thunks.js +78 -42
  191. package/dist/monitorSlice/thunks.js.map +1 -1
  192. package/dist/onboardingSlice/constants.cjs +44 -69
  193. package/dist/onboardingSlice/constants.cjs.map +1 -1
  194. package/dist/onboardingSlice/constants.d.cts +2 -26
  195. package/dist/onboardingSlice/constants.d.ts +2 -26
  196. package/dist/onboardingSlice/constants.js +43 -7
  197. package/dist/onboardingSlice/constants.js.map +1 -1
  198. package/dist/onboardingSlice/index.cjs +53 -73
  199. package/dist/onboardingSlice/index.cjs.map +1 -1
  200. package/dist/onboardingSlice/index.d.cts +2 -62
  201. package/dist/onboardingSlice/index.d.ts +2 -62
  202. package/dist/onboardingSlice/index.js +47 -13
  203. package/dist/onboardingSlice/index.js.map +1 -1
  204. package/dist/onboardingSlice/mocks.cjs +12 -81
  205. package/dist/onboardingSlice/mocks.cjs.map +1 -1
  206. package/dist/onboardingSlice/mocks.d.cts +14 -15
  207. package/dist/onboardingSlice/mocks.d.ts +14 -15
  208. package/dist/onboardingSlice/mocks.js +12 -15
  209. package/dist/onboardingSlice/mocks.js.map +1 -1
  210. package/dist/onboardingSlice/selectors.cjs +5 -29
  211. package/dist/onboardingSlice/selectors.cjs.map +1 -1
  212. package/dist/onboardingSlice/selectors.d.cts +6 -1
  213. package/dist/onboardingSlice/selectors.d.ts +6 -1
  214. package/dist/onboardingSlice/selectors.js +5 -6
  215. package/dist/onboardingSlice/selectors.js.map +1 -1
  216. package/dist/onboardingSlice/thunks.cjs +8 -4752
  217. package/dist/onboardingSlice/thunks.d.cts +124 -143
  218. package/dist/onboardingSlice/thunks.d.ts +124 -143
  219. package/dist/onboardingSlice/thunks.js +2 -49
  220. package/dist/organizationSlice/constants.cjs +11 -95
  221. package/dist/organizationSlice/constants.d.cts +2 -91
  222. package/dist/organizationSlice/constants.d.ts +2 -91
  223. package/dist/organizationSlice/constants.js +2 -27
  224. package/dist/organizationSlice/index.cjs +113 -152
  225. package/dist/organizationSlice/index.cjs.map +1 -1
  226. package/dist/organizationSlice/index.d.cts +2 -74
  227. package/dist/organizationSlice/index.d.ts +2 -74
  228. package/dist/organizationSlice/index.js +106 -18
  229. package/dist/organizationSlice/index.js.map +1 -1
  230. package/dist/organizationSlice/mocks.cjs +215 -406
  231. package/dist/organizationSlice/mocks.cjs.map +1 -1
  232. package/dist/organizationSlice/mocks.d.cts +209 -212
  233. package/dist/organizationSlice/mocks.d.ts +209 -212
  234. package/dist/organizationSlice/mocks.js +214 -184
  235. package/dist/organizationSlice/mocks.js.map +1 -1
  236. package/dist/organizationSlice/selectors.cjs +97 -474
  237. package/dist/organizationSlice/selectors.cjs.map +1 -1
  238. package/dist/organizationSlice/selectors.d.cts +381 -389
  239. package/dist/organizationSlice/selectors.d.ts +381 -389
  240. package/dist/organizationSlice/selectors.js +78 -50
  241. package/dist/organizationSlice/selectors.js.map +1 -1
  242. package/dist/organizationSlice/thunks.cjs +43 -5156
  243. package/dist/organizationSlice/thunks.d.cts +638 -649
  244. package/dist/organizationSlice/thunks.d.ts +638 -649
  245. package/dist/organizationSlice/thunks.js +2 -119
  246. package/dist/organizationSlice/types.cjs +0 -19
  247. package/dist/organizationSlice/types.d.cts +2 -88
  248. package/dist/organizationSlice/types.d.ts +2 -88
  249. package/dist/organizationSlice/types.js +1 -1
  250. package/dist/releasesSlice/constants.cjs +17 -41
  251. package/dist/releasesSlice/constants.cjs.map +1 -1
  252. package/dist/releasesSlice/constants.d.cts +2 -15
  253. package/dist/releasesSlice/constants.d.ts +2 -15
  254. package/dist/releasesSlice/constants.js +13 -14
  255. package/dist/releasesSlice/constants.js.map +1 -1
  256. package/dist/releasesSlice/index.cjs +106 -179
  257. package/dist/releasesSlice/index.cjs.map +1 -1
  258. package/dist/releasesSlice/index.d.cts +2 -113
  259. package/dist/releasesSlice/index.d.ts +2 -113
  260. package/dist/releasesSlice/index.js +100 -18
  261. package/dist/releasesSlice/index.js.map +1 -1
  262. package/dist/releasesSlice/mocks.cjs +44 -220
  263. package/dist/releasesSlice/mocks.cjs.map +1 -1
  264. package/dist/releasesSlice/mocks.d.cts +63 -61
  265. package/dist/releasesSlice/mocks.d.ts +63 -61
  266. package/dist/releasesSlice/mocks.js +43 -59
  267. package/dist/releasesSlice/mocks.js.map +1 -1
  268. package/dist/releasesSlice/selectors.cjs +44 -439
  269. package/dist/releasesSlice/selectors.cjs.map +1 -1
  270. package/dist/releasesSlice/selectors.d.cts +268 -280
  271. package/dist/releasesSlice/selectors.d.ts +268 -280
  272. package/dist/releasesSlice/selectors.js +31 -36
  273. package/dist/releasesSlice/selectors.js.map +1 -1
  274. package/dist/releasesSlice/thunks.cjs +436 -2885
  275. package/dist/releasesSlice/thunks.cjs.map +1 -1
  276. package/dist/releasesSlice/thunks.d.cts +305 -307
  277. package/dist/releasesSlice/thunks.d.ts +305 -307
  278. package/dist/releasesSlice/thunks.js +413 -74
  279. package/dist/releasesSlice/thunks.js.map +1 -1
  280. package/dist/selectors.cjs +136 -1542
  281. package/dist/selectors.d.cts +10 -36
  282. package/dist/selectors.d.ts +10 -36
  283. package/dist/selectors.js +10 -284
  284. package/dist/sockethook.cjs +140 -515
  285. package/dist/sockethook.cjs.map +1 -1
  286. package/dist/sockethook.d.cts +25 -9
  287. package/dist/sockethook.d.ts +25 -9
  288. package/dist/sockethook.js +134 -135
  289. package/dist/sockethook.js.map +1 -1
  290. package/dist/store-BQxOSRC1.d.ts +234 -0
  291. package/dist/store-BiIA0r0A.d.cts +234 -0
  292. package/dist/store.cjs +117 -1291
  293. package/dist/store.cjs.map +1 -1
  294. package/dist/store.d.cts +3 -206
  295. package/dist/store.d.ts +3 -206
  296. package/dist/store.js +110 -32
  297. package/dist/store.js.map +1 -1
  298. package/dist/storehooks.cjs +240 -5790
  299. package/dist/storehooks.cjs.map +1 -1
  300. package/dist/storehooks.d.cts +76 -4
  301. package/dist/storehooks.d.ts +76 -4
  302. package/dist/storehooks.js +229 -266
  303. package/dist/storehooks.js.map +1 -1
  304. package/dist/thunks.cjs +2614 -5924
  305. package/dist/thunks.cjs.map +1 -1
  306. package/dist/thunks.d.cts +9 -36
  307. package/dist/thunks.d.ts +9 -36
  308. package/dist/thunks.js +2439 -385
  309. package/dist/thunks.js.map +1 -1
  310. package/dist/types-B2NRQLFw.d.ts +88 -0
  311. package/dist/types-ClEfo0dK.d.cts +88 -0
  312. package/dist/useDeploymentDevice.cjs +26 -4656
  313. package/dist/useDeploymentDevice.cjs.map +1 -1
  314. package/dist/useDeploymentDevice.d.cts +4 -2
  315. package/dist/useDeploymentDevice.d.ts +4 -2
  316. package/dist/useDeploymentDevice.js +21 -60
  317. package/dist/useDeploymentDevice.js.map +1 -1
  318. package/dist/usersSlice/constants.cjs +8 -55
  319. package/dist/usersSlice/constants.d.cts +2 -52
  320. package/dist/usersSlice/constants.d.ts +2 -52
  321. package/dist/usersSlice/constants.js +2 -21
  322. package/dist/usersSlice/index.cjs +132 -172
  323. package/dist/usersSlice/index.cjs.map +1 -1
  324. package/dist/usersSlice/index.d.cts +2 -152
  325. package/dist/usersSlice/index.d.ts +2 -152
  326. package/dist/usersSlice/index.js +125 -18
  327. package/dist/usersSlice/index.js.map +1 -1
  328. package/dist/usersSlice/mocks.cjs +55 -196
  329. package/dist/usersSlice/mocks.cjs.map +1 -1
  330. package/dist/usersSlice/mocks.d.cts +68 -72
  331. package/dist/usersSlice/mocks.d.ts +68 -72
  332. package/dist/usersSlice/mocks.js +54 -46
  333. package/dist/usersSlice/mocks.js.map +1 -1
  334. package/dist/usersSlice/selectors.cjs +65 -567
  335. package/dist/usersSlice/selectors.cjs.map +1 -1
  336. package/dist/usersSlice/selectors.d.cts +364 -376
  337. package/dist/usersSlice/selectors.d.ts +364 -376
  338. package/dist/usersSlice/selectors.js +44 -50
  339. package/dist/usersSlice/selectors.js.map +1 -1
  340. package/dist/usersSlice/thunks.cjs +39 -4704
  341. package/dist/usersSlice/thunks.d.cts +807 -843
  342. package/dist/usersSlice/thunks.d.ts +807 -843
  343. package/dist/usersSlice/thunks.js +2 -111
  344. package/dist/utils-B4I595rf.d.cts +104 -0
  345. package/dist/utils-DNnSR4S_.d.ts +104 -0
  346. package/dist/utils.cjs +229 -850
  347. package/dist/utils.cjs.map +1 -1
  348. package/dist/utils.d.cts +2 -80
  349. package/dist/utils.d.ts +2 -80
  350. package/dist/utils.js +210 -50
  351. package/dist/utils.js.map +1 -1
  352. package/package.json +11 -13
  353. package/dist/appSlice/thunks.cjs.map +0 -1
  354. package/dist/appSlice/thunks.js.map +0 -1
  355. package/dist/chunk-2DYA3X77.js +0 -15
  356. package/dist/chunk-2DYA3X77.js.map +0 -1
  357. package/dist/chunk-2QIGK5IU.js +0 -143
  358. package/dist/chunk-2QIGK5IU.js.map +0 -1
  359. package/dist/chunk-4573DUCR.js +0 -396
  360. package/dist/chunk-4573DUCR.js.map +0 -1
  361. package/dist/chunk-4BHM6WVX.js +0 -50
  362. package/dist/chunk-4BHM6WVX.js.map +0 -1
  363. package/dist/chunk-4BUO44SS.js +0 -316
  364. package/dist/chunk-4BUO44SS.js.map +0 -1
  365. package/dist/chunk-4YLOOOZH.js +0 -144
  366. package/dist/chunk-4YLOOOZH.js.map +0 -1
  367. package/dist/chunk-525LX7VL.js +0 -157
  368. package/dist/chunk-525LX7VL.js.map +0 -1
  369. package/dist/chunk-5OLM3HEG.js +0 -41
  370. package/dist/chunk-5OLM3HEG.js.map +0 -1
  371. package/dist/chunk-66LI4BJO.js +0 -162
  372. package/dist/chunk-66LI4BJO.js.map +0 -1
  373. package/dist/chunk-CMXRPUOF.js +0 -723
  374. package/dist/chunk-CMXRPUOF.js.map +0 -1
  375. package/dist/chunk-CQXDAXQF.js +0 -51
  376. package/dist/chunk-CQXDAXQF.js.map +0 -1
  377. package/dist/chunk-DBBE6D36.js +0 -115
  378. package/dist/chunk-DBBE6D36.js.map +0 -1
  379. package/dist/chunk-FAJ3I2UQ.js +0 -47
  380. package/dist/chunk-FAJ3I2UQ.js.map +0 -1
  381. package/dist/chunk-FAKWYYOB.js +0 -59
  382. package/dist/chunk-FAKWYYOB.js.map +0 -1
  383. package/dist/chunk-FXPRG4WH.js +0 -2875
  384. package/dist/chunk-FXPRG4WH.js.map +0 -1
  385. package/dist/chunk-GX3X2E57.js +0 -157
  386. package/dist/chunk-GX3X2E57.js.map +0 -1
  387. package/dist/chunk-HVZ5BOM6.js +0 -61
  388. package/dist/chunk-HVZ5BOM6.js.map +0 -1
  389. package/dist/chunk-JIS4PA3R.js +0 -7
  390. package/dist/chunk-JIS4PA3R.js.map +0 -1
  391. package/dist/chunk-KEQAPMP6.js +0 -110
  392. package/dist/chunk-KEQAPMP6.js.map +0 -1
  393. package/dist/chunk-LSAJE3IU.js +0 -115
  394. package/dist/chunk-LSAJE3IU.js.map +0 -1
  395. package/dist/chunk-NMAXZ3ZY.js +0 -1
  396. package/dist/chunk-NMAXZ3ZY.js.map +0 -1
  397. package/dist/chunk-QX67O5A2.js +0 -82
  398. package/dist/chunk-QX67O5A2.js.map +0 -1
  399. package/dist/chunk-SDHCQ62K.js +0 -246
  400. package/dist/chunk-SDHCQ62K.js.map +0 -1
  401. package/dist/chunk-SDWPOLHM.js +0 -25
  402. package/dist/chunk-SDWPOLHM.js.map +0 -1
  403. package/dist/chunk-UBFFGYQ4.js +0 -204
  404. package/dist/chunk-UBFFGYQ4.js.map +0 -1
  405. package/dist/chunk-UE2EPKRU.js +0 -142
  406. package/dist/chunk-UE2EPKRU.js.map +0 -1
  407. package/dist/chunk-VK6FVQ5K.js +0 -58
  408. package/dist/chunk-VK6FVQ5K.js.map +0 -1
  409. package/dist/chunk-VLII64V6.js +0 -44
  410. package/dist/chunk-VLII64V6.js.map +0 -1
  411. package/dist/chunk-WXRYJOL3.js +0 -68
  412. package/dist/chunk-WXRYJOL3.js.map +0 -1
  413. package/dist/chunk-XHLNGIAP.js +0 -100
  414. package/dist/chunk-XHLNGIAP.js.map +0 -1
  415. package/dist/chunk-YO22XLHI.js +0 -7
  416. package/dist/chunk-YO22XLHI.js.map +0 -1
  417. package/dist/chunk-Z4QLZNAN.js +0 -448
  418. package/dist/chunk-Z4QLZNAN.js.map +0 -1
  419. package/dist/chunk-ZKAH3APE.js +0 -1
  420. package/dist/chunk-ZKAH3APE.js.map +0 -1
  421. package/dist/commonConstants.cjs.map +0 -1
  422. package/dist/commonConstants.js.map +0 -1
  423. package/dist/deploymentsSlice/constants.cjs.map +0 -1
  424. package/dist/deploymentsSlice/constants.js.map +0 -1
  425. package/dist/deploymentsSlice/thunks.cjs.map +0 -1
  426. package/dist/deploymentsSlice/thunks.js.map +0 -1
  427. package/dist/devicesSlice/constants.cjs.map +0 -1
  428. package/dist/devicesSlice/constants.js.map +0 -1
  429. package/dist/devicesSlice/thunks.cjs.map +0 -1
  430. package/dist/devicesSlice/thunks.js.map +0 -1
  431. package/dist/monitorSlice/constants.cjs.map +0 -1
  432. package/dist/monitorSlice/constants.js.map +0 -1
  433. package/dist/onboardingSlice/thunks.cjs.map +0 -1
  434. package/dist/onboardingSlice/thunks.js.map +0 -1
  435. package/dist/organizationSlice/constants.cjs.map +0 -1
  436. package/dist/organizationSlice/constants.js.map +0 -1
  437. package/dist/organizationSlice/thunks.cjs.map +0 -1
  438. package/dist/organizationSlice/thunks.js.map +0 -1
  439. package/dist/organizationSlice/types.cjs.map +0 -1
  440. package/dist/organizationSlice/types.js.map +0 -1
  441. package/dist/selectors.cjs.map +0 -1
  442. package/dist/selectors.js.map +0 -1
  443. package/dist/usersSlice/constants.cjs.map +0 -1
  444. package/dist/usersSlice/constants.js.map +0 -1
  445. package/dist/usersSlice/thunks.cjs.map +0 -1
  446. package/dist/usersSlice/thunks.js.map +0 -1
@@ -1,2887 +1,438 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/releasesSlice/thunks.ts
31
- var thunks_exports = {};
32
- __export(thunks_exports, {
33
- cancelFileUpload: () => cancelFileUpload,
34
- createArtifact: () => createArtifact,
35
- editArtifact: () => editArtifact,
36
- getArtifactInstallCount: () => getArtifactInstallCount,
37
- getArtifactUrl: () => getArtifactUrl,
38
- getDeltaGenerationJobDetails: () => getDeltaGenerationJobDetails,
39
- getDeltaGenerationJobs: () => getDeltaGenerationJobs,
40
- getExistingReleaseTags: () => getExistingReleaseTags,
41
- getRelease: () => getRelease,
42
- getReleases: () => getReleases,
43
- getUpdateTypes: () => getUpdateTypes,
44
- removeArtifact: () => removeArtifact,
45
- removeRelease: () => removeRelease,
46
- removeReleases: () => removeReleases,
47
- selectRelease: () => selectRelease,
48
- setReleaseTags: () => setReleaseTags,
49
- setReleasesListState: () => setReleasesListState,
50
- setReleasesTags: () => setReleasesTags,
51
- setSingleReleaseTags: () => setSingleReleaseTags,
52
- updateReleaseInfo: () => updateReleaseInfo,
53
- uploadArtifact: () => uploadArtifact
54
- });
55
- module.exports = __toCommonJS(thunks_exports);
56
- var import_helpers8 = require("@northern.tech/utils/helpers");
57
- var import_axios2 = require("axios");
58
- var import_uuid = require("uuid");
59
-
60
- // src/releasesSlice/index.ts
61
- var import_toolkit = require("@reduxjs/toolkit");
62
-
63
- // src/constants.ts
64
- var import_constants4 = require("@northern.tech/utils/constants");
65
-
66
- // src/appSlice/constants.ts
67
- var import_icons_material = require("@mui/icons-material");
68
- var import_utils = require("@northern.tech/utils");
69
- var chartTypes = {
70
- bar: { key: "bar", Icon: import_icons_material.BarChart },
71
- pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
72
- };
73
- var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
74
- var defaultReportType = "distribution";
75
- var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
76
- var PLANS = {
77
- os: {
78
- id: "os",
79
- name: "Basic",
80
- description: "The core features of Mender. To continue using Enterprise Trial features\u2014like Delta updates, scheduled deployments, phased rollouts, device filtering, dynamic groups, RBAC, audit logs, and more\u2014please upgrade to a higher plan."
81
- },
82
- professional: {
83
- id: "professional",
84
- name: "Professional",
85
- description: "Everything in Basic, plus enhanced update management and automation features."
86
- },
87
- enterprise: {
88
- id: "enterprise",
89
- name: "Enterprise",
90
- description: "Every advanced feature of Mender, tailored for complex and large-scale deployments. Not available as a monthly subscription \u2014 ask us for a quote."
91
- }
92
- };
93
- var ADDONS = {
94
- configure: {
95
- id: "configure",
96
- title: "Configure",
97
- description: "Seamlessly configure applications and devices remotely \u2013 configure each device to its environment.",
98
- needs: ["hasDeviceConfig"],
99
- eligible: ["os", "professional", "enterprise"]
100
- },
101
- monitor: {
102
- id: "monitor",
103
- title: "Monitor",
104
- description: "Detect and analyze health issues of devices, services and applications. Set up alerts so you can act quickly.",
105
- needs: ["hasMonitor"],
106
- eligible: ["professional", "enterprise"]
107
- },
108
- troubleshoot: {
109
- id: "troubleshoot",
110
- title: "Troubleshoot",
111
- description: "Secure, remote access to your devices \u2013 quickly diagnose and fix issues in real time.",
112
- needs: ["hasDeviceConnect"],
113
- eligible: ["os", "professional", "enterprise"]
114
- }
115
- };
116
- var BENEFITS = {
117
- auditlog: {
118
- id: "auditlog",
119
- benefit: "gain access to logs for important events such as changes to devices, deployments and user management, as well as remote terminal session replays",
120
- requiredPlan: PLANS.enterprise.id
121
- },
122
- dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
123
- deltaGeneration: {
124
- id: "deltaGeneration",
125
- benefit: "automatic delta artifacts generation to minimize data transfer and improve the update delivery",
126
- requiredPlan: PLANS.enterprise.id
127
- },
128
- deviceConfiguration: { id: "deviceConfiguration", benefit: "device configuration features", requiredAddon: ADDONS.configure.id },
129
- deviceMonitor: { id: "deviceMonitor", benefit: "device monitoring features", requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },
130
- deviceTroubleshoot: { id: "deviceTroubleshoot", benefit: "device troubleshooting features", requiredAddon: ADDONS.troubleshoot.id },
131
- dynamicGroups: { id: "dynamicGroups", benefit: "create dynamic groups to ease device management", requiredPlan: PLANS.enterprise.id },
132
- fullFiltering: { id: "fullFiltering", benefit: "filtering by multiple attributes to improve the device overview", requiredPlan: PLANS.professional.id },
133
- gateway: { id: "gateway", benefit: "see devices connected to your gateway device for easy access", requiredPlans: PLANS.professional.id },
134
- pausedDeployments: {
135
- id: "pausedDeployments",
136
- benefit: "granular control about update rollout to allow synchronization across your fleet",
137
- requiredPlan: PLANS.enterprise.id
138
- },
139
- phasedDeployments: { id: "phasedDeployments", benefit: "choose to roll out deployments in multiple phases", requiredPlan: PLANS.enterprise.id },
140
- rbac: { id: "rbac", benefit: "granular role based access control", requiredPlan: PLANS.enterprise.id },
141
- retryDeployments: { id: "retryDeployments", benefit: "optional retries for failed rollout attempts", requiredPlan: PLANS.professional.id },
142
- scheduledDeployments: {
143
- id: "scheduledDeployments",
144
- benefit: "scheduled deployments to steer the distribution of your updates.",
145
- requiredPlan: PLANS.professional.id
146
- },
147
- webhookEvents: {
148
- id: "webhookEvents",
149
- benefit: "receive inventory events and select which type(s) of events the webhook will receive",
150
- requiredPlan: PLANS.professional.id
151
- },
152
- default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
153
- };
154
- var DARK_MODE = "dark";
155
-
156
- // src/commonConstants.tsx
157
- var import_js = require("@mdi/js");
158
- var import_jsx_runtime = require("react/jsx-runtime");
159
- var timeUnits = {
160
- days: "days",
161
- minutes: "minutes",
162
- hours: "hours"
163
- };
164
- var UNGROUPED_GROUP = { id: "*|=ungrouped=|*", name: "Unassigned" };
165
- var DEVICE_LIST_MAXIMUM_LENGTH = 50;
166
- var oneSecond = 1e3;
167
- var TIMEOUTS = {
168
- debounceDefault: 700,
169
- debounceShort: 300,
170
- halfASecond: 0.5 * oneSecond,
171
- oneSecond,
172
- twoSeconds: 2 * oneSecond,
173
- threeSeconds: 3 * oneSecond,
174
- fiveSeconds: 5 * oneSecond,
175
- refreshDefault: 10 * oneSecond,
176
- refreshLong: 60 * oneSecond
177
- };
178
- var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
179
- var defaultIdAttribute = Object.freeze({ attribute: "id", scope: import_constants4.ATTRIBUTE_SCOPES.identity });
180
- var productOrder = ["micro", "standard", "system"];
181
- var credentialTypes = {
182
- aws: "aws",
183
- http: "http",
184
- sas: "sas",
185
- x509: "x509"
186
- };
187
- var EXTERNAL_PROVIDER = {
188
- "iot-core": {
189
- credentialsType: credentialTypes.aws,
190
- icon: import_js.mdiAws,
191
- title: "AWS IoT Core",
192
- twinTitle: "Device Shadow",
193
- provider: "iot-core",
194
- enabled: true,
195
- deviceTwin: true,
196
- configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "For help finding your AWS IoT Core connection string, check the AWS IoT documentation." })
197
- },
198
- "iot-hub": {
199
- credentialsType: credentialTypes.sas,
200
- icon: import_js.mdiMicrosoftAzure,
201
- title: "Azure IoT Hub",
202
- twinTitle: "Device Twin",
203
- provider: "iot-hub",
204
- enabled: true,
205
- deviceTwin: true,
206
- configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
207
- "For help finding your Azure IoT Hub connection string, look under 'Shared access policies' in the Microsoft Azure UI as described",
208
- " ",
209
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
210
- "a",
211
- {
212
- href: "https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn",
213
- target: "_blank",
214
- rel: "noopener noreferrer",
215
- children: "here"
216
- }
217
- ),
218
- "."
219
- ] })
220
- },
221
- webhook: {
222
- credentialsType: credentialTypes.http,
223
- deviceTwin: false,
224
- twinTitle: "",
225
- // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
226
- enabled: false,
227
- provider: "webhook"
228
- }
229
- };
230
- var emptyWebhook = {
231
- description: "",
232
- provider: "webhook",
233
- credentials: {
234
- type: EXTERNAL_PROVIDER.webhook.credentialsType,
235
- [EXTERNAL_PROVIDER.webhook.credentialsType]: {
236
- secret: "",
237
- url: ""
238
- }
239
- }
240
- };
241
- var regionNames = new Intl.DisplayNames(["en"], { type: "region" });
242
- var countries = [
243
- "AD",
244
- "AE",
245
- "AF",
246
- "AG",
247
- "AI",
248
- "AL",
249
- "AM",
250
- "AO",
251
- "AQ",
252
- "AR",
253
- "AS",
254
- "AT",
255
- "AU",
256
- "AW",
257
- "AX",
258
- "AZ",
259
- "BA",
260
- "BB",
261
- "BD",
262
- "BE",
263
- "BF",
264
- "BG",
265
- "BH",
266
- "BI",
267
- "BJ",
268
- "BL",
269
- "BM",
270
- "BN",
271
- "BO",
272
- "BR",
273
- "BS",
274
- "BT",
275
- "BV",
276
- "BW",
277
- "BY",
278
- "BZ",
279
- "CA",
280
- "CC",
281
- "CD",
282
- "CF",
283
- "CG",
284
- "CH",
285
- "CI",
286
- "CK",
287
- "CL",
288
- "CM",
289
- "CN",
290
- "CO",
291
- "CR",
292
- "CU",
293
- "CV",
294
- "CW",
295
- "CX",
296
- "CY",
297
- "CZ",
298
- "DE",
299
- "DJ",
300
- "DK",
301
- "DM",
302
- "DO",
303
- "DZ",
304
- "EC",
305
- "EE",
306
- "EG",
307
- "EH",
308
- "ER",
309
- "ES",
310
- "ET",
311
- "FI",
312
- "FJ",
313
- "FK",
314
- "FM",
315
- "FO",
316
- "FR",
317
- "GA",
318
- "GB",
319
- "GD",
320
- "GE",
321
- "GF",
322
- "GG",
323
- "GH",
324
- "GI",
325
- "GL",
326
- "GM",
327
- "GN",
328
- "GP",
329
- "GQ",
330
- "GR",
331
- "GS",
332
- "GT",
333
- "GU",
334
- "GW",
335
- "GY",
336
- "HK",
337
- "HM",
338
- "HN",
339
- "HR",
340
- "HT",
341
- "HU",
342
- "ID",
343
- "IE",
344
- "IL",
345
- "IM",
346
- "IN",
347
- "IO",
348
- "IQ",
349
- "IR",
350
- "IS",
351
- "IT",
352
- "JE",
353
- "JM",
354
- "JO",
355
- "JP",
356
- "KE",
357
- "KG",
358
- "KH",
359
- "KI",
360
- "KM",
361
- "KN",
362
- "KP",
363
- "KR",
364
- "KW",
365
- "KY",
366
- "KZ",
367
- "LA",
368
- "LB",
369
- "LC",
370
- "LI",
371
- "LK",
372
- "LR",
373
- "LS",
374
- "LT",
375
- "LU",
376
- "LV",
377
- "LY",
378
- "MA",
379
- "MC",
380
- "MD",
381
- "ME",
382
- "MF",
383
- "MG",
384
- "MH",
385
- "MK",
386
- "ML",
387
- "MM",
388
- "MN",
389
- "MO",
390
- "MP",
391
- "MQ",
392
- "MR",
393
- "MS",
394
- "MT",
395
- "MU",
396
- "MV",
397
- "MW",
398
- "MX",
399
- "MY",
400
- "MZ",
401
- "NA",
402
- "NC",
403
- "NE",
404
- "NF",
405
- "NG",
406
- "NI",
407
- "NL",
408
- "NO",
409
- "NP",
410
- "NR",
411
- "NU",
412
- "NZ",
413
- "OM",
414
- "PA",
415
- "PE",
416
- "PF",
417
- "PG",
418
- "PH",
419
- "PK",
420
- "PL",
421
- "PM",
422
- "PN",
423
- "PR",
424
- "PS",
425
- "PT",
426
- "PW",
427
- "PY",
428
- "QA",
429
- "RE",
430
- "RO",
431
- "RS",
432
- "RU",
433
- "RW",
434
- "SA",
435
- "SB",
436
- "SC",
437
- "SD",
438
- "SE",
439
- "SG",
440
- "SH",
441
- "SI",
442
- "SJ",
443
- "SK",
444
- "SL",
445
- "SM",
446
- "SN",
447
- "SO",
448
- "SR",
449
- "SS",
450
- "ST",
451
- "SV",
452
- "SX",
453
- "SY",
454
- "SZ",
455
- "TC",
456
- "TD",
457
- "TF",
458
- "TG",
459
- "TH",
460
- "TJ",
461
- "TK",
462
- "TL",
463
- "TM",
464
- "TN",
465
- "TO",
466
- "TR",
467
- "TT",
468
- "TV",
469
- "TW",
470
- "TZ",
471
- "UA",
472
- "UG",
473
- "US",
474
- "UY",
475
- "UZ",
476
- "VA",
477
- "VC",
478
- "VE",
479
- "VG",
480
- "VI",
481
- "VN",
482
- "VU",
483
- "WF",
484
- "WS",
485
- "XK",
486
- "YE",
487
- "YT",
488
- "ZA",
489
- "ZM",
490
- "ZW"
491
- ].map((code) => ({ code, label: regionNames.of(code) })).sort((a, b) => a.label.localeCompare(b.label));
492
-
493
- // src/deploymentsSlice/constants.ts
494
- var alreadyInstalled = "already-installed";
495
- var deploymentSubstates = {
496
- aborted: "aborted",
497
- alreadyInstalled,
498
- decommissioned: "decommissioned",
499
- downloading: "downloading",
500
- failure: "failure",
501
- installing: "installing",
502
- noartifact: "noartifact",
503
- artifact_too_big: "artifact_too_big",
504
- pause_before_committing: "pause_before_committing",
505
- pause_before_installing: "pause_before_installing",
506
- pause_before_rebooting: "pause_before_rebooting",
507
- pending: "pending",
508
- rebooting: "rebooting",
509
- success: "success"
510
- };
511
- var deploymentStatesToSubstates = {
512
- failures: [deploymentSubstates.failure, deploymentSubstates.aborted, deploymentSubstates.decommissioned],
513
- inprogress: [deploymentSubstates.downloading, deploymentSubstates.installing, deploymentSubstates.rebooting],
514
- paused: [deploymentSubstates.pause_before_installing, deploymentSubstates.pause_before_rebooting, deploymentSubstates.pause_before_committing],
515
- pending: [deploymentSubstates.pending],
516
- successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact, deploymentSubstates.artifact_too_big]
517
- };
518
- var deploymentStatesToSubstatesWithSkipped = {
519
- ...deploymentStatesToSubstates,
520
- failures: [deploymentSubstates.failure],
521
- skipped: [
522
- deploymentSubstates.aborted,
523
- deploymentSubstates.noartifact,
524
- deploymentSubstates.artifact_too_big,
525
- deploymentSubstates.alreadyInstalled,
526
- deploymentSubstates.decommissioned
527
- ],
528
- successes: [deploymentSubstates.success]
529
- };
530
- var installationSubstatesMap = {
531
- download: {
532
- title: "download",
533
- done: "downloaded",
534
- successIndicators: [deploymentSubstates.installing, deploymentSubstates.rebooting, ...deploymentStatesToSubstates.paused, deploymentSubstates.success],
535
- failureIndicators: deploymentStatesToSubstates.failures,
536
- pauseConfigurationIndicator: "ArtifactInstall_Enter"
537
- },
538
- install: {
539
- title: "install",
540
- done: "installed",
541
- successIndicators: [
542
- deploymentSubstates.rebooting,
543
- deploymentSubstates.pause_before_rebooting,
544
- deploymentSubstates.pause_before_committing,
545
- deploymentSubstates.success
546
- ],
547
- failureIndicators: deploymentStatesToSubstates.failures,
548
- pauseConfigurationIndicator: "ArtifactReboot_Enter"
549
- },
550
- reboot: {
551
- title: "reboot",
552
- done: "rebooted",
553
- successIndicators: [deploymentSubstates.pause_before_committing, deploymentSubstates.success],
554
- failureIndicators: deploymentStatesToSubstates.failures,
555
- pauseConfigurationIndicator: "ArtifactCommit_Enter"
556
- },
557
- commit: {
558
- title: "commit",
559
- done: "committed",
560
- successIndicators: deploymentStatesToSubstates.successes,
561
- failureIndicators: deploymentStatesToSubstates.failures,
562
- pauseConfigurationIndicator: void 0
563
- }
564
- };
565
- var DEPLOYMENT_STATES = {
566
- finished: "finished",
567
- inprogress: "inprogress",
568
- pending: "pending",
569
- scheduled: "scheduled"
570
- };
571
- var listDefaultsByState = {
572
- [DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
573
- [DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
574
- [DEPLOYMENT_STATES.scheduled]: { ...import_constants4.DEVICE_LIST_DEFAULTS },
575
- [DEPLOYMENT_STATES.finished]: { ...import_constants4.DEVICE_LIST_DEFAULTS },
576
- sort: { direction: import_constants4.SORTING_OPTIONS.desc }
577
- };
578
- var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
579
- var DEPLOYMENT_ROUTES = {
580
- active: {
581
- key: "active",
582
- route: "/deployments/active",
583
- states: [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress],
584
- title: "Active"
585
- },
586
- finished: {
587
- key: "finished",
588
- route: "/deployments/finished",
589
- states: [DEPLOYMENT_STATES.finished],
590
- title: "Finished"
591
- },
592
- scheduled: {
593
- key: "scheduled",
594
- route: "/deployments/scheduled",
595
- states: [DEPLOYMENT_STATES.scheduled],
596
- title: "Scheduled"
597
- }
598
- };
599
- var defaultStats = {
600
- [deploymentSubstates.aborted]: 0,
601
- [deploymentSubstates.alreadyInstalled]: 0,
602
- [deploymentSubstates.decommissioned]: 0,
603
- [deploymentSubstates.downloading]: 0,
604
- [deploymentSubstates.failure]: 0,
605
- [deploymentSubstates.installing]: 0,
606
- [deploymentSubstates.noartifact]: 0,
607
- [deploymentSubstates.pause_before_committing]: 0,
608
- [deploymentSubstates.pause_before_installing]: 0,
609
- [deploymentSubstates.pause_before_rebooting]: 0,
610
- [deploymentSubstates.pending]: 0,
611
- [deploymentSubstates.rebooting]: 0,
612
- [deploymentSubstates.success]: 0
613
- };
614
- var deploymentPrototype = {
615
- devices: {},
616
- name: void 0,
617
- statistics: { status: {} }
618
- };
619
- var pauseMap = {
620
- [deploymentSubstates.pause_before_installing]: {
621
- title: installationSubstatesMap.download.done,
622
- followUp: installationSubstatesMap.download.pauseConfigurationIndicator
623
- },
624
- [deploymentSubstates.pause_before_rebooting]: {
625
- title: installationSubstatesMap.install.done,
626
- followUp: installationSubstatesMap.install.pauseConfigurationIndicator
627
- },
628
- [deploymentSubstates.pause_before_committing]: {
629
- title: installationSubstatesMap.reboot.done,
630
- followUp: installationSubstatesMap.reboot.pauseConfigurationIndicator
631
- }
632
- };
633
-
634
- // src/devicesSlice/constants.ts
635
- var emptyFilter = { key: null, value: "", operator: import_constants4.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
636
- var geoAttributes = ["geo-lat", "geo-lon"].map((attribute) => ({ attribute, scope: "inventory" }));
637
-
638
- // src/onboardingSlice/constants.ts
639
- var onboardingSteps = {
640
- ONBOARDING_START: "onboarding-start",
641
- DEVICES_PENDING_ONBOARDING_START: "devices-pending-onboarding-start",
642
- DASHBOARD_ONBOARDING_START: "dashboard-onboarding-start",
643
- DASHBOARD_ONBOARDING_PENDINGS: "dashboard-onboarding-pendings",
644
- DEVICES_DELAYED_ONBOARDING: "devices-delayed-onboarding",
645
- DEVICES_PENDING_ONBOARDING: "devices-pending-onboarding",
646
- DEVICES_ACCEPTED_ONBOARDING: "devices-accepted-onboarding",
647
- DEVICES_PENDING_ACCEPTING_ONBOARDING: "devices-pending-accepting-onboarding",
648
- DEVICES_DEPLOY_RELEASE_ONBOARDING: "devices-deploy-release-onboarding",
649
- SCHEDULING_ARTIFACT_SELECTION: "scheduling-artifact-selection",
650
- SCHEDULING_ALL_DEVICES_SELECTION: "scheduling-all-devices-selection",
651
- SCHEDULING_GROUP_SELECTION: "scheduling-group-selection",
652
- SCHEDULING_RELEASE_TO_DEVICES: "scheduling-release-to-devices",
653
- DEPLOYMENTS_INPROGRESS: "deployments-inprogress",
654
- DEPLOYMENTS_COMPLETED: "deployments-completed",
655
- DEPLOYMENTS_PAST: "deployments-past",
656
- DEPLOYMENTS_PAST_COMPLETED: "deployments-past-completed",
657
- DEPLOYMENTS_PAST_COMPLETED_FAILURE: "deployments-past-completed-failure",
658
- ONBOARDING_CANCELED: "onboarding-canceled"
659
- };
660
- var orderedOnboardingSteps = [
661
- onboardingSteps.DASHBOARD_ONBOARDING_START,
662
- onboardingSteps.DEVICES_PENDING_ONBOARDING_START,
663
- onboardingSteps.DEVICES_DELAYED_ONBOARDING,
664
- onboardingSteps.DEVICES_PENDING_ONBOARDING,
665
- onboardingSteps.DEVICES_PENDING_ACCEPTING_ONBOARDING,
666
- onboardingSteps.DASHBOARD_ONBOARDING_PENDINGS,
667
- onboardingSteps.DEVICES_ACCEPTED_ONBOARDING,
668
- onboardingSteps.DEVICES_DEPLOY_RELEASE_ONBOARDING,
669
- onboardingSteps.SCHEDULING_ALL_DEVICES_SELECTION,
670
- onboardingSteps.SCHEDULING_GROUP_SELECTION,
671
- onboardingSteps.SCHEDULING_ARTIFACT_SELECTION,
672
- onboardingSteps.SCHEDULING_RELEASE_TO_DEVICES,
673
- onboardingSteps.DEPLOYMENTS_INPROGRESS,
674
- onboardingSteps.DEPLOYMENTS_PAST,
675
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED,
676
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE,
677
- onboardingSteps.ONBOARDING_CANCELED
678
- ];
679
-
680
- // src/organizationSlice/constants.ts
681
- var auditlogTypes = {
682
- artifact: { title: "Artifact", queryParameter: "object_type", value: "artifact" },
683
- deployment: { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
684
- device: { title: "Device", queryParameter: "object_id", value: "device" },
685
- user_access_token: { title: "Personal Access Token", queryParameter: "user_access_token", value: "user_access_token" },
686
- user: { title: "User", queryParameter: "object_id", value: "user" },
687
- tenant: { title: "Tenant", queryParameter: "object_id", value: "tenant" }
688
- };
689
- var AUDIT_LOGS_TYPES = [auditlogTypes.artifact, auditlogTypes.deployment, auditlogTypes.device, auditlogTypes.user_access_token, auditlogTypes.user];
690
- var SP_AUDIT_LOGS_TYPES = [auditlogTypes.user, auditlogTypes.tenant];
691
- var TENANT_LIST_DEFAULT = {
692
- page: 1,
693
- perPage: 20
694
- };
695
-
696
- // src/releasesSlice/constants.ts
697
- var ARTIFACT_GENERATION_TYPE = { SINGLE_FILE: "single_file" };
698
- var rootfsImageVersion = "rootfs-image.version";
699
- var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
700
-
701
- // src/usersSlice/constants.ts
702
- var USER_LOGOUT = "USER_LOGOUT";
703
- var settingsKeys = { initialized: "settings-initialized" };
704
- var READ_STATES = {
705
- read: "read",
706
- seen: "seen",
707
- unread: "unread"
708
- };
709
-
710
- // src/releasesSlice/index.ts
711
- var sliceName = "releases";
712
- var initialState = {
713
- /*
714
- * Return list of saved artifacts objects
715
- */
716
- /*
717
- * return list of artifacts where duplicate names are collated with device compatibility lists combined
718
- */
719
- // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),
720
- artifacts: [],
721
- /*
722
- * Return list of saved release objects
723
- */
724
- byId: {
725
- /*
726
- [releaseName]: {
727
- artifacts: [
728
- {
729
- id: '',
730
- name: '',
731
- description: '',
732
- device_types_compatible: [],
733
- ...
734
- updates: [{
735
- files: [
736
- { size: 123, name: '' }
737
- ],
738
- type_info: { type: '' }
739
- }],
740
- url: '' // optional
741
- }
742
- ],
743
- modified: ''
744
- device_types_compatible,
745
- name: '',
746
- tags: ['something'],
747
- notes: ''
748
- }
749
- */
750
- },
751
- deltaJobs: {
752
- /*
753
- [jobId]: {
754
- id: '',
755
- ...
756
- }
757
- */
758
- },
759
- deltaJobsList: {
760
- ...import_constants4.DEVICE_LIST_DEFAULTS,
761
- jobIds: [],
762
- total: 0,
763
- sort: {
764
- direction: import_constants4.SORTING_OPTIONS.desc,
765
- key: "started"
766
- }
767
- },
768
- releasesList: {
769
- ...import_constants4.DEVICE_LIST_DEFAULTS,
770
- searchedIds: [],
771
- releaseIds: [],
772
- selection: [],
773
- sort: {
774
- direction: import_constants4.SORTING_OPTIONS.desc,
775
- key: "modified"
776
- },
777
- isLoading: void 0,
778
- searchTerm: "",
779
- searchTotal: 0,
780
- selectedTags: [],
781
- total: 0,
782
- type: ""
783
- },
784
- tags: [],
785
- updateTypes: [],
786
- selectedJob: null,
787
- /*
788
- * Return single release with corresponding Artifacts
789
- */
790
- selectedRelease: null
791
- };
792
- var releaseSlice = (0, import_toolkit.createSlice)({
793
- name: sliceName,
794
- initialState,
795
- reducers: {
796
- receiveRelease: (state, action) => {
797
- const { name } = action.payload;
798
- state.byId[name] = action.payload;
799
- },
800
- receiveReleases: (state, action) => {
801
- state.byId = action.payload;
802
- },
803
- receiveReleaseTags: (state, action) => {
804
- state.tags = action.payload;
805
- },
806
- receiveReleaseTypes: (state, action) => {
807
- state.updateTypes = action.payload;
808
- },
809
- removeRelease: (state, action) => {
810
- const { [action.payload]: toBeRemoved, ...byId } = state.byId;
811
- state.byId = byId;
812
- state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
813
- },
814
- selectedRelease: (state, action) => {
815
- state.selectedRelease = action.payload;
816
- },
817
- setReleaseListState: (state, action) => {
818
- state.releasesList = action.payload;
819
- },
820
- receivedDeltaJobs: (state, action) => {
821
- const { jobs, total } = action.payload;
822
- state.deltaJobs = jobs.reduce(
823
- (accu, job) => {
824
- accu[job.id] = {
825
- ...accu[job.id],
826
- ...job
827
- };
828
- return accu;
829
- },
830
- { ...state.deltaJobs }
831
- );
832
- state.deltaJobsList.jobIds = jobs.map((job) => job.id);
833
- state.deltaJobsList.total = total;
834
- },
835
- receivedDeltaJobDetails: (state, action) => {
836
- const job = action.payload;
837
- state.deltaJobs[job.id] = {
838
- ...state.deltaJobs[job.id],
839
- ...job
840
- };
841
- },
842
- setDeltaJobsListState: (state, action) => {
843
- state.deltaJobsList = { ...state.deltaJobsList, ...action.payload };
844
- },
845
- setSelectedJob: (state, action) => {
846
- state.selectedJob = action.payload;
847
- }
848
- }
849
- });
850
- var actions = releaseSlice.actions;
851
- var releasesSlice_default = releaseSlice.reducer;
852
-
853
- // src/appSlice/index.ts
854
- var import_toolkit2 = require("@reduxjs/toolkit");
855
- var sliceName2 = "app";
856
- var getYesterday = () => {
857
- const today = /* @__PURE__ */ new Date();
858
- today.setDate(today.getDate() - 1);
859
- return today.toISOString();
860
- };
861
- var initialState2 = {
862
- appInitDone: false,
863
- cancelSource: void 0,
864
- commit: "",
865
- demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
866
- hostAddress: null,
867
- snackbar: {
868
- action: void 0,
869
- autoHideDuration: void 0,
870
- message: "",
871
- open: false,
872
- preventClickToCopy: false
873
- },
874
- // return boolean rather than organization details
875
- features: {
876
- hasAiEnabled: false,
877
- hasAuditlogs: false,
878
- hasDeltaProgress: false,
879
- hasMultitenancy: false,
880
- hasDeviceConfig: false,
881
- hasDeviceConnect: false,
882
- hasFeedbackEnabled: false,
883
- hasManifestsEnabled: false,
884
- hasMonitor: false,
885
- hasMCUEnabled: false,
886
- hasReporting: false,
887
- isHosted: true,
888
- isEnterprise: false
889
- },
890
- feedbackProbability: 0.3,
891
- firstLoginAfterSignup: false,
892
- hostedAnnouncement: "",
893
- docsVersion: "",
894
- recaptchaSiteKey: "",
895
- searchState: {
896
- deviceIds: [],
897
- searchTerm: "",
898
- searchTotal: 0,
899
- isSearching: false,
900
- sort: {
901
- direction: import_constants4.SORTING_OPTIONS.desc
902
- // key: null,
903
- // scope: null
904
- }
905
- },
906
- sentry: {
907
- location: "",
908
- replaysSessionSampleRate: 0.1,
909
- tracesSampleRate: 1
910
- },
911
- stripeAPIKey: "",
912
- trackerCode: "",
913
- uploadsById: {
914
- // id: { progress: 0, cancelSource: undefined }
915
- },
916
- newThreshold: getYesterday(),
917
- offlineThreshold: getYesterday(),
918
- versionInformation: {
919
- Integration: "",
920
- "Mender-Artifact": "",
921
- "Meta-Mender": ""
922
- },
923
- yesterday: void 0
924
- };
925
- var appSlice = (0, import_toolkit2.createSlice)({
926
- name: sliceName2,
927
- initialState: initialState2,
928
- reducers: {
929
- setFeatures: (state, action) => {
930
- state.features = {
931
- ...state.features,
932
- ...action.payload
933
- };
934
- },
935
- setSnackbar: (state, { payload }) => {
936
- if (typeof payload === "string" || payload instanceof String) {
937
- state.snackbar = {
938
- ...initialState2.snackbar,
939
- message: payload,
940
- open: !!payload
941
- };
942
- return;
943
- }
944
- const { message, autoHideDuration, action, preventClickToCopy = false } = payload;
945
- state.snackbar = {
946
- message,
947
- autoHideDuration,
948
- action,
949
- preventClickToCopy,
950
- open: !!message
951
- };
952
- },
953
- setFirstLoginAfterSignup: (state, action) => {
954
- state.firstLoginAfterSignup = action.payload;
955
- },
956
- setAnnouncement: (state, action) => {
957
- state.hostedAnnouncement = action.payload;
958
- },
959
- setSearchState: (state, action) => {
960
- state.searchState = {
961
- ...state.searchState,
962
- ...action.payload
963
- };
964
- },
965
- setOfflineThreshold: (state, action) => {
966
- state.offlineThreshold = action.payload;
967
- },
968
- initUpload: (state, action) => {
969
- const { id, upload } = action.payload;
970
- state.uploadsById[id] = upload;
971
- },
972
- uploadProgress: (state, action) => {
973
- const { id, progress: progress2 } = action.payload;
974
- state.uploadsById[id] = {
975
- ...state.uploadsById[id],
976
- progress: progress2
977
- };
978
- },
979
- cleanUpUpload: (state, action) => {
980
- const { [action.payload]: current, ...remainder } = state.uploadsById;
981
- state.uploadsById = remainder;
982
- },
983
- setVersionInformation: (state, action) => {
984
- state.versionInformation = {
985
- ...state.versionInformation,
986
- ...action.payload
987
- };
988
- },
989
- setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),
990
- setAppInitDone: (state) => {
991
- state.appInitDone = true;
992
- }
993
- }
994
- });
995
- var actions2 = appSlice.actions;
996
- var appSlice_default = appSlice.reducer;
997
-
998
- // src/deploymentsSlice/index.ts
999
- var import_toolkit3 = require("@reduxjs/toolkit");
1000
- var sliceName3 = "deployments";
1001
- var initialState3 = {
1002
- byId: {
1003
- // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
1004
- },
1005
- byStatus: {
1006
- finished: { deploymentIds: [], total: 0 },
1007
- inprogress: { deploymentIds: [], total: 0 },
1008
- pending: { deploymentIds: [], total: 0 },
1009
- scheduled: { deploymentIds: [], total: 0 }
1010
- },
1011
- config: {
1012
- binaryDelta: {
1013
- timeout: -1,
1014
- duplicatesWindow: -1,
1015
- compressionLevel: -1,
1016
- disableChecksum: false,
1017
- disableDecompression: false,
1018
- inputWindow: -1,
1019
- instructionBuffer: -1,
1020
- sourceWindow: -1
1021
- },
1022
- binaryDeltaLimits: {
1023
- timeout: { ...import_constants4.limitDefault, default: 60, max: 3600, min: 60 },
1024
- sourceWindow: import_constants4.limitDefault,
1025
- inputWindow: import_constants4.limitDefault,
1026
- duplicatesWindow: import_constants4.limitDefault,
1027
- instructionBuffer: import_constants4.limitDefault
1028
- }
1029
- },
1030
- deploymentDeviceLimit: 5e3,
1031
- selectedDeviceIds: [],
1032
- selectionState: {
1033
- finished: { ...import_constants4.DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
1034
- inprogress: { ...import_constants4.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1035
- pending: { ...import_constants4.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1036
- scheduled: { ...import_constants4.DEVICE_LIST_DEFAULTS, selection: [] },
1037
- general: {
1038
- state: DEPLOYMENT_ROUTES.active.key,
1039
- showCreationDialog: false,
1040
- showReportDialog: false,
1041
- reportType: null
1042
- // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
1043
- },
1044
- selectedId: void 0
1045
- }
1046
- };
1047
- var deploymentsSlice = (0, import_toolkit3.createSlice)({
1048
- name: sliceName3,
1049
- initialState: initialState3,
1050
- reducers: {
1051
- createdDeployment: (state, action) => {
1052
- state.byId[action.payload.id] = {
1053
- ...deploymentPrototype,
1054
- ...action.payload
1055
- };
1056
- state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
1057
- state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
1058
- state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection];
1059
- state.selectionState[DEPLOYMENT_STATES.pending].total = (state.selectionState[DEPLOYMENT_STATES.pending].total || 0) + 1;
1060
- },
1061
- removedDeployment: (state, action) => {
1062
- const { [action.payload]: removedDeployment, ...remainder } = state.byId;
1063
- state.byId = remainder;
1064
- },
1065
- receivedDeployment: (state, action) => {
1066
- state.byId[action.payload.id] = {
1067
- ...state.byId[action.payload.id] || {},
1068
- ...action.payload
1069
- };
1070
- },
1071
- receivedDeploymentDeviceLog: (state, action) => {
1072
- const { id, deviceId, log } = action.payload;
1073
- const deployment = {
1074
- ...deploymentPrototype,
1075
- ...state.byId[id]
1076
- };
1077
- state.byId[id] = {
1078
- ...deployment,
1079
- devices: {
1080
- ...deployment.devices,
1081
- [deviceId]: {
1082
- ...deployment.devices[deviceId],
1083
- log
1084
- }
1085
- }
1086
- };
1087
- },
1088
- receivedDeploymentDevices: (state, action) => {
1089
- const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
1090
- state.byId[id] = {
1091
- ...state.byId[id],
1092
- devices,
1093
- totalDeviceCount
1094
- };
1095
- state.selectedDeviceIds = selectedDeviceIds;
1096
- },
1097
- receivedDeployments: (state, action) => {
1098
- state.byId = {
1099
- ...state.byId,
1100
- ...action.payload
1101
- };
1102
- },
1103
- receivedDeploymentsForStatus: (state, action) => {
1104
- const { status, deploymentIds, total } = action.payload;
1105
- state.byStatus[status].deploymentIds = deploymentIds;
1106
- state.byStatus[status].total = total;
1107
- },
1108
- selectDeploymentsForStatus: (state, action) => {
1109
- const { status, deploymentIds, total } = action.payload;
1110
- state.selectionState[status].selection = deploymentIds;
1111
- state.selectionState[status].total = total;
1112
- },
1113
- setDeploymentsState: (state, action) => {
1114
- state.selectionState = action.payload;
1115
- },
1116
- setDeploymentsConfig: (state, action) => {
1117
- state.config = action.payload;
1118
- }
1119
- }
1120
- });
1121
- var actions3 = deploymentsSlice.actions;
1122
- var deploymentsSlice_default = deploymentsSlice.reducer;
1123
-
1124
- // src/devicesSlice/index.ts
1125
- var import_helpers = require("@northern.tech/utils/helpers");
1126
- var import_toolkit4 = require("@reduxjs/toolkit");
1127
- var sliceName4 = "devices";
1128
- var initialState4 = {
1129
- byId: {
1130
- // [deviceId]: {
1131
- // ...,
1132
- // twinsByIntegration: { [external.provider.id]: twinData }
1133
- // }
1134
- },
1135
- byStatus: {
1136
- [import_constants4.DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1137
- [import_constants4.DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1138
- [import_constants4.DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1139
- [import_constants4.DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }
1140
- },
1141
- deviceList: {
1142
- deviceIds: [],
1143
- ...import_constants4.DEVICE_LIST_DEFAULTS,
1144
- selectedAttributes: [],
1145
- selectedIssues: [],
1146
- selection: [],
1147
- sort: {
1148
- direction: import_constants4.SORTING_OPTIONS.desc
1149
- // key: null,
1150
- // scope: null
1151
- },
1152
- state: import_constants4.DEVICE_STATES.accepted,
1153
- total: 0,
1154
- refreshTrigger: false,
1155
- isLoading: false,
1156
- detailsTab: "",
1157
- open: false
1158
- },
1159
- filters: [
1160
- // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
1161
- ],
1162
- filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },
1163
- filteringAttributesLimit: 10,
1164
- filteringAttributesConfig: {
1165
- attributes: {
1166
- // inventory: ['some_attribute']
1167
- },
1168
- count: 0,
1169
- limit: 100
1170
- },
1171
- reports: [
1172
- // { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
1173
- ],
1174
- total: 0,
1175
- limits: {
1176
- standard: 0,
1177
- micro: 0,
1178
- system: 0
1179
- },
1180
- groups: {
1181
- byId: {
1182
- // groupName: { deviceIds: [], total: 0, filters: [] },
1183
- // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }
1184
- },
1185
- selectedGroup: void 0
1186
- }
1187
- };
1188
- var devicesSlice = (0, import_toolkit4.createSlice)({
1189
- name: sliceName4,
1190
- initialState: initialState4,
1191
- reducers: {
1192
- receivedGroups: (state, action) => {
1193
- state.groups.byId = action.payload;
1194
- },
1195
- addToGroup: (state, action) => {
1196
- const { group, deviceIds } = action.payload;
1197
- const maybeExistingGroup = {
1198
- filters: [],
1199
- deviceIds: [],
1200
- ...state.groups.byId[group]
1201
- };
1202
- state.groups.byId[group] = {
1203
- ...maybeExistingGroup,
1204
- deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
1205
- total: (maybeExistingGroup.total || 0) + 1
1206
- };
1207
- },
1208
- removeFromGroup: (state, action) => {
1209
- const { group, deviceIds: removedIds } = action.payload;
1210
- const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
1211
- const changedGroup = {
1212
- ...maybeExistingGroup,
1213
- deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
1214
- total: Math.max(total - removedIds.length, 0)
1215
- };
1216
- if (changedGroup.total || changedGroup.deviceIds.length) {
1217
- state.groups.byId[group] = changedGroup;
1218
- return;
1219
- } else if (state.groups.selectedGroup === group) {
1220
- state.groups.selectedGroup = void 0;
1221
- }
1222
- const { [group]: removal, ...remainingById } = state.groups.byId;
1223
- state.groups.byId = remainingById;
1224
- },
1225
- addGroup: (state, action) => {
1226
- const { groupName, group } = action.payload;
1227
- state.groups.byId[groupName] = {
1228
- ...state.groups.byId[groupName],
1229
- ...group
1230
- };
1231
- },
1232
- selectGroup: (state, { payload: group }) => {
1233
- state.deviceList.deviceIds = group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1234
- state.groups.selectedGroup = group;
1235
- },
1236
- removeGroup: (state, action) => {
1237
- const { [action.payload]: removal, ...remainingById } = state.groups.byId;
1238
- state.groups.byId = remainingById;
1239
- state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
1240
- },
1241
- setDeviceListState: (state, action) => {
1242
- state.deviceList = {
1243
- ...state.deviceList,
1244
- ...action.payload,
1245
- sort: {
1246
- ...state.deviceList.sort,
1247
- ...action.payload.sort
1248
- }
1249
- };
1250
- },
1251
- setFilterAttributes: (state, action) => {
1252
- state.filteringAttributes = action.payload;
1253
- },
1254
- setFilterablesConfig: (state, action) => {
1255
- state.filteringAttributesConfig = action.payload;
1256
- },
1257
- receivedDevices: (state, action) => {
1258
- state.byId = {
1259
- ...state.byId,
1260
- ...action.payload
1261
- };
1262
- },
1263
- setDeviceFilters: (state, action) => {
1264
- if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
1265
- return;
1266
- }
1267
- state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
1268
- },
1269
- setDeviceReports: (state, action) => {
1270
- state.reports = action.payload;
1271
- },
1272
- setDevicesByStatus: (state, action) => {
1273
- const { status, total, deviceIds } = action.payload;
1274
- if (total) {
1275
- state.byStatus[status].deviceIds = deviceIds;
1276
- state.byStatus[status].counts.total = total;
1277
- }
1278
- },
1279
- setDevicesCountByStatus: (state, action) => {
1280
- const { countsPerTier, status } = action.payload;
1281
- state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu += tieredCount, 0) };
1282
- },
1283
- setDeviceLimits: (state, action) => {
1284
- state.limits = action.payload;
1285
- },
1286
- receivedDevice: (state, action) => {
1287
- state.byId[action.payload.id] = {
1288
- ...state.byId[action.payload.id],
1289
- ...action.payload
1290
- };
1291
- },
1292
- maybeUpdateDevicesByStatus: (state, action) => {
1293
- const { deviceId, authId } = action.payload;
1294
- const device = state.byId[deviceId];
1295
- const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1296
- if (!hasMultipleAuthSets && Object.values(import_constants4.DEVICE_STATES).includes(device.status)) {
1297
- const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1298
- const deviceTier = device.attributes.tier || "standard";
1299
- state.byStatus[device.status] = {
1300
- deviceIds,
1301
- counts: {
1302
- ...state.byStatus[device.status].counts,
1303
- [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),
1304
- total: Math.max(0, state.byStatus[device.status].counts.total - 1)
1305
- }
1306
- };
1307
- }
1308
- }
1309
- }
1310
- });
1311
- var actions4 = devicesSlice.actions;
1312
- var devicesSlice_default = devicesSlice.reducer;
1313
-
1314
- // src/monitorSlice/index.ts
1315
- var import_toolkit5 = require("@reduxjs/toolkit");
1316
- var sliceName5 = "monitor";
1317
- var initialState5 = {
1318
- alerts: {
1319
- alertList: { ...import_constants4.DEVICE_LIST_DEFAULTS, total: 0 },
1320
- byDeviceId: {}
1321
- },
1322
- issueCounts: {
1323
- byType: Object.keys(import_constants4.DEVICE_ISSUE_OPTIONS).reduce((accu, key) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
1324
- },
1325
- settings: {
1326
- global: {
1327
- channels: {
1328
- ...Object.keys(import_constants4.alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1329
- }
1330
- }
1331
- }
1332
- };
1333
- var monitorSlice = (0, import_toolkit5.createSlice)({
1334
- name: sliceName5,
1335
- initialState: initialState5,
1336
- reducers: {
1337
- changeAlertChannel: (state, action) => {
1338
- const { channel, enabled } = action.payload;
1339
- state.settings.global.channels[channel] = { enabled };
1340
- },
1341
- receiveDeviceAlerts: (state, action) => {
1342
- const { deviceId, alerts } = action.payload;
1343
- state.alerts.byDeviceId[deviceId] = { alerts };
1344
- },
1345
- receiveLatestDeviceAlerts: (state, action) => {
1346
- const { deviceId, alerts } = action.payload;
1347
- state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
1348
- },
1349
- receiveDeviceIssueCounts: (state, action) => {
1350
- const { issueType, counts } = action.payload;
1351
- state.issueCounts.byType[issueType] = counts;
1352
- },
1353
- setAlertListState: (state, action) => {
1354
- state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
1355
- }
1356
- }
1357
- });
1358
- var actions5 = monitorSlice.actions;
1359
- var monitorSlice_default = monitorSlice.reducer;
1360
-
1361
- // src/onboardingSlice/index.ts
1362
- var import_toolkit6 = require("@reduxjs/toolkit");
1363
- var sliceName6 = "onboarding";
1364
- var initialState6 = {
1365
- approach: null,
1366
- complete: false,
1367
- deviceType: null,
1368
- demoArtifactPort: 85,
1369
- progress: null,
1370
- showTips: null,
1371
- showTipsDialog: false
1372
- };
1373
- var onboardingSlice = (0, import_toolkit6.createSlice)({
1374
- name: sliceName6,
1375
- initialState: initialState6,
1376
- reducers: {
1377
- setOnboardingState: (state, action) => ({ ...state, ...action.payload }),
1378
- setDemoArtifactPort: (state, action) => {
1379
- state.demoArtifactPort = action.payload;
1380
- },
1381
- setShowOnboardingHelp: (state, action) => {
1382
- state.showTips = action.payload;
1383
- },
1384
- setShowDismissOnboardingTipsDialog: (state, action) => {
1385
- state.showTipsDialog = action.payload;
1386
- },
1387
- setOnboardingComplete: (state, action) => {
1388
- state.complete = action.payload;
1389
- },
1390
- setOnboardingProgress: (state, action) => {
1391
- state.progress = action.payload;
1392
- },
1393
- setOnboardingDeviceType: (state, action) => {
1394
- state.deviceType = action.payload;
1395
- },
1396
- setOnboardingApproach: (state, action) => {
1397
- state.approach = action.payload;
1398
- }
1399
- }
1400
- });
1401
- var actions6 = onboardingSlice.actions;
1402
- var onboardingSlice_default = onboardingSlice.reducer;
1403
-
1404
- // src/organizationSlice/index.ts
1405
- var import_toolkit7 = require("@reduxjs/toolkit");
1406
- var sliceName7 = "organization";
1407
- var initialState7 = {
1408
- card: {
1409
- last4: "",
1410
- expiration: { month: 1, year: 2020 },
1411
- brand: ""
1412
- },
1413
- intentId: null,
1414
- tenantList: {
1415
- ...TENANT_LIST_DEFAULT,
1416
- total: 0,
1417
- tenants: [],
1418
- selectedTenant: null,
1419
- sort: {
1420
- direction: import_constants4.SORTING_OPTIONS.desc,
1421
- key: "name"
1422
- }
1423
- },
1424
- organization: {
1425
- // id, name, status, tenant_token, plan
1426
- },
1427
- auditlog: {
1428
- events: [],
1429
- selectionState: {
1430
- ...import_constants4.DEVICE_LIST_DEFAULTS,
1431
- detail: void 0,
1432
- endDate: void 0,
1433
- selectedIssue: void 0,
1434
- sort: { direction: import_constants4.SORTING_OPTIONS.desc },
1435
- startDate: void 0,
1436
- total: 0,
1437
- type: void 0,
1438
- user: void 0,
1439
- isLoading: false
1440
- }
1441
- },
1442
- externalDeviceIntegrations: [
1443
- // { <connection_string|x509|...>, id, provider }
1444
- ],
1445
- ssoConfigs: [],
1446
- webhooks: {
1447
- // [id]: { events: [] }
1448
- // for now:
1449
- events: [],
1450
- eventsTotal: 0
1451
- }
1452
- };
1453
- var organizationSlice = (0, import_toolkit7.createSlice)({
1454
- name: sliceName7,
1455
- initialState: initialState7,
1456
- reducers: {
1457
- receiveAuditLogs: (state, action) => {
1458
- const { events, total } = action.payload;
1459
- state.auditlog.events = events;
1460
- state.auditlog.selectionState.total = total;
1461
- },
1462
- setAuditLogState: (state, action) => {
1463
- state.auditlog.selectionState = {
1464
- ...state.auditlog.selectionState,
1465
- ...action.payload
1466
- };
1467
- },
1468
- receiveCurrentCard: (state, action) => {
1469
- state.card = action.payload;
1470
- },
1471
- receiveSetupIntent: (state, action) => {
1472
- state.intentId = action.payload;
1473
- },
1474
- setOrganization: (state, action) => {
1475
- state.organization = { ...state.organization, ...action.payload };
1476
- },
1477
- setSubscription: (state, action) => {
1478
- state.organization.subscription = { ...state.organization.subscription, ...action.payload };
1479
- },
1480
- setProducts: (state, action) => {
1481
- state.products = action.payload;
1482
- },
1483
- setBillingProfile: (state, action) => {
1484
- state.organization.billing_profile = action.payload;
1485
- },
1486
- setTenantListState: (state, action) => {
1487
- state.tenantList = action.payload;
1488
- },
1489
- receiveExternalDeviceIntegrations: (state, action) => {
1490
- state.externalDeviceIntegrations = action.payload;
1491
- },
1492
- receiveSsoConfigs: (state, action) => {
1493
- state.ssoConfigs = action.payload;
1494
- },
1495
- receiveWebhookEvents: (state, action) => {
1496
- const { value, total } = action.payload;
1497
- state.webhooks.events = value;
1498
- state.webhooks.eventsTotal = total;
1499
- }
1500
- }
1501
- });
1502
- var actions7 = organizationSlice.actions;
1503
- var organizationSlice_default = organizationSlice.reducer;
1504
-
1505
- // src/usersSlice/index.ts
1506
- var import_toolkit8 = require("@reduxjs/toolkit");
1507
- var sliceName8 = "users";
1508
- var initialState8 = {
1509
- byId: {},
1510
- currentUser: null,
1511
- currentSession: {
1512
- // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting
1513
- },
1514
- customColumns: [],
1515
- qrCode: null,
1516
- globalSettings: {
1517
- id_attribute: void 0,
1518
- previousFilters: [],
1519
- previousPhases: [],
1520
- retries: 0
1521
- },
1522
- permissionSetsById: {
1523
- ...import_constants4.defaultPermissionSets
1524
- },
1525
- rolesById: {
1526
- ...import_constants4.rolesById
1527
- },
1528
- rolesInitialized: false,
1529
- settingsInitialized: false,
1530
- showConnectDeviceDialog: false,
1531
- showFeedbackDialog: false,
1532
- showStartupNotification: false,
1533
- tooltips: {
1534
- byId: {
1535
- // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants
1536
- }
1537
- },
1538
- userSettings: {
1539
- columnSelection: [],
1540
- onboarding: {},
1541
- firstLoginTimestamp: null,
1542
- securityAlertDismissedTimestamp: null
1543
- },
1544
- userSettingsInitialized: false
1545
- };
1546
- var usersSlice = (0, import_toolkit8.createSlice)({
1547
- name: sliceName8,
1548
- initialState: initialState8,
1549
- reducers: {
1550
- receivedQrCode: (state, action) => {
1551
- state.qrCode = action.payload;
1552
- },
1553
- successfullyLoggedIn: (state, action) => {
1554
- state.currentSession = action.payload;
1555
- },
1556
- receivedUserList: (state, action) => {
1557
- state.byId = action.payload;
1558
- },
1559
- receivedUser: (state, action) => {
1560
- state.byId[action.payload.id] = action.payload;
1561
- state.currentUser = action.payload.id;
1562
- },
1563
- removedUser: (state, action) => {
1564
- const { [action.payload]: removedUser, ...byId } = state.byId;
1565
- state.byId = byId;
1566
- state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
1567
- },
1568
- updatedUser: (state, action) => {
1569
- state.byId[action.payload.id] = {
1570
- ...state.byId[action.payload.id],
1571
- ...action.payload
1572
- };
1573
- },
1574
- receivedPermissionSets: (state, action) => {
1575
- state.permissionSetsById = action.payload;
1576
- },
1577
- receivedRoles: (state, action) => {
1578
- state.rolesById = action.payload;
1579
- state.rolesInitialized = true;
1580
- },
1581
- finishedRoleInitialization: (state, action) => {
1582
- state.rolesInitialized = action.payload;
1583
- },
1584
- createdRole: (state, action) => {
1585
- state.rolesById[action.payload.name] = {
1586
- ...state.rolesById[action.payload.name],
1587
- ...action.payload
1588
- };
1589
- },
1590
- removedRole: (state, action) => {
1591
- const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
1592
- state.rolesById = rolesById2;
1593
- },
1594
- setCustomColumns: (state, action) => {
1595
- state.customColumns = action.payload;
1596
- },
1597
- setGlobalSettings: (state, action) => {
1598
- state.settingsInitialized = true;
1599
- state.globalSettings = {
1600
- ...state.globalSettings,
1601
- ...action.payload
1602
- };
1603
- },
1604
- setUserSettings: (state, action) => {
1605
- state.userSettingsInitialized = true;
1606
- state.userSettings = {
1607
- ...state.userSettings,
1608
- ...action.payload
1609
- };
1610
- },
1611
- setTooltipState: (state, action) => {
1612
- const { id, readState = READ_STATES.read } = action.payload;
1613
- state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };
1614
- },
1615
- setTooltipsState: (state, action) => {
1616
- state.tooltips.byId = {
1617
- ...state.tooltips.byId,
1618
- ...action.payload
1619
- };
1620
- },
1621
- setShowFeedbackDialog: (state, action) => {
1622
- state.showFeedbackDialog = action.payload;
1623
- },
1624
- setShowConnectingDialog: (state, action) => {
1625
- state.showConnectDeviceDialog = action.payload;
1626
- },
1627
- setShowStartupNotification: (state, action) => {
1628
- state.showStartupNotification = action.payload;
1629
- }
1630
- }
1631
- });
1632
- var actions8 = usersSlice.actions;
1633
- var usersSlice_default = usersSlice.reducer;
1634
-
1635
- // src/actions.ts
1636
- var actions_default = {
1637
- ...actions2,
1638
- ...actions3,
1639
- ...actions4,
1640
- ...actions5,
1641
- ...actions6,
1642
- ...actions7,
1643
- ...actions,
1644
- ...actions8
1645
- };
1646
-
1647
- // src/api/general-api.ts
1648
- var import_axios = __toESM(require("axios"), 1);
1649
- var import_universal_cookie2 = __toESM(require("universal-cookie"), 1);
1650
-
1651
- // src/auth.ts
1652
- var import_universal_cookie = __toESM(require("universal-cookie"), 1);
1653
- var cookies = new import_universal_cookie.default();
1654
- var emptySession = Object.freeze({ token: "", expiresAt: void 0 });
1655
- var tokenCache = "";
1656
- var getSessionInfo = () => {
1657
- let sessionInfo = { ...emptySession };
1658
- try {
1659
- sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
1660
- } catch {
1661
- }
1662
- const jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1663
- if (jwtTokenFromCookie) {
1664
- setSessionInfo({ token: jwtTokenFromCookie });
1665
- cookies.remove("JWT");
1666
- cookies.remove("JWT", { path: "/" });
1667
- return { token: jwtTokenFromCookie, expiresAt: void 0 };
1668
- }
1669
- if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
1670
- cleanUp();
1671
- return { ...emptySession };
1672
- }
1673
- sessionInfo.token = sessionInfo.token || "";
1674
- tokenCache = sessionInfo.token;
1675
- return sessionInfo;
1676
- };
1677
- var getToken = () => tokenCache ? tokenCache : getSessionInfo().token;
1678
- var setSessionInfo = ({ token, expiresAt }) => {
1679
- tokenCache = token;
1680
- window.localStorage.setItem("JWT", JSON.stringify({ token, expiresAt }));
1681
- };
1682
- var cleanUp = () => {
1683
- tokenCache = "";
1684
- cookies.remove("JWT");
1685
- cookies.remove("JWT", { path: "/" });
1686
- window.localStorage.removeItem("JWT");
1687
- window.localStorage.removeItem("oauth");
1688
- };
1689
-
1690
- // src/api/general-api.ts
1691
- var cookies2 = new import_universal_cookie2.default();
1692
- var unauthorizedRedirect = (error) => {
1693
- if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken() && !window.location.pathname.endsWith("/subscription")) {
1694
- if (cookies2.get("JWT", { doNotParse: true })) {
1695
- window.location.reload();
1696
- return Promise.reject(error);
1697
- }
1698
- cleanUp();
1699
- window.location.replace("/ui/");
1700
- }
1701
- return Promise.reject(error);
1702
- };
1703
- var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Content-Type": "application/json" } };
1704
- var authenticatedRequest = import_axios.default.create(commonRequestConfig);
1705
- authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
1706
- authenticatedRequest.interceptors.request.use(
1707
- (config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
1708
- (error) => Promise.reject(error)
1709
- );
1710
- var Api = {
1711
- get: authenticatedRequest.get,
1712
- delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
1713
- patch: authenticatedRequest.patch,
1714
- post: authenticatedRequest.post,
1715
- postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
1716
- put: authenticatedRequest.put,
1717
- upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
1718
- headers: { "Content-Type": "multipart/form-data" },
1719
- onUploadProgress: progress2,
1720
- timeout: 0,
1721
- signal: cancelSignal
1722
- }),
1723
- uploadPut: (url, formData, progress2, cancelSignal) => authenticatedRequest.put(url, formData, {
1724
- headers: { "Content-Type": "multipart/form-data" },
1725
- onUploadProgress: progress2,
1726
- timeout: 0,
1727
- signal: cancelSignal
1728
- })
1729
- };
1730
- var general_api_default = Api;
1731
-
1732
- // src/locationutils.ts
1733
- var import_helpers2 = require("@northern.tech/utils/helpers");
1734
- var defaultSelector = (result) => result[0];
1735
- var commonFields = {
1736
- ...Object.keys(import_constants4.DEVICE_LIST_DEFAULTS).reduce((accu, key) => ({ ...accu, [key]: { parse: Number, select: defaultSelector, target: key } }), {}),
1737
- id: { parse: String, select: (i) => i, target: "id" },
1738
- issues: { parse: void 0, select: defaultSelector, target: "selectedIssues" },
1739
- open: { parse: Boolean, select: defaultSelector, target: "open" }
1740
- };
1741
- var formatReleases = ({ pageState: { id, searchTerm, selectedTags = [], tab, type } }) => Object.entries({ name: searchTerm, tab, type, id }).reduce(
1742
- (accu, [key, value]) => value ? [...accu, `${key}=${value}`] : accu,
1743
- selectedTags.map((tag) => `tag=${tag}`)
1744
- ).join("&");
1745
-
1746
- // src/appSlice/selectors.ts
1747
- var import_helpers3 = require("@northern.tech/utils/helpers");
1748
- var import_toolkit9 = require("@reduxjs/toolkit");
1749
- var getFeatures = (state) => state.app.features;
1750
- var getFullVersionInformation = (state) => state.app.versionInformation;
1751
- var getSearchState = (state) => state.app.searchState;
1752
- var getUploads = (state) => state.app.uploadsById;
1753
- var getIsUploading = (0, import_toolkit9.createSelector)([getUploads], (uploadsById) => !!Object.keys(uploadsById).length);
1754
- var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
1755
- var getVersionInformation = (0, import_toolkit9.createSelector)(
1756
- [getFullVersionInformation, getFeatures],
1757
- ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1758
- );
1759
- var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers3.versionCompare)(Integration, "next") > -1);
1760
-
1761
- // src/commonSelectors.ts
1762
- var import_helpers6 = require("@northern.tech/utils/helpers");
1763
- var import_toolkit15 = require("@reduxjs/toolkit");
1764
- var import_dayjs = __toESM(require("dayjs"), 1);
1765
-
1766
- // src/deploymentsSlice/selectors.ts
1767
- var import_toolkit10 = require("@reduxjs/toolkit");
1768
- var getDeploymentsById = (state) => state.deployments.byId;
1769
- var getDeploymentsByStatus = (state) => state.deployments.byStatus;
1770
- var getSelectedDeploymentDeviceIds = (state) => state.deployments.selectedDeviceIds;
1771
- var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
1772
- var getDeploymentById = (0, import_toolkit10.createSelector)(
1773
- [getDeploymentsById, (_, deploymentId) => deploymentId],
1774
- (deploymentsById, deploymentId = "") => deploymentsById[deploymentId]
1775
- );
1776
- var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
1777
- [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
1778
- (selectionState, deploymentsState, deploymentsById) => {
1779
- const { selection = [] } = selectionState[deploymentsState] ?? {};
1780
- return selection.reduce((accu, id) => {
1781
- if (deploymentsById[id]) {
1782
- accu.push(deploymentsById[id]);
1783
- }
1784
- return accu;
1785
- }, []);
1786
- }
1787
- );
1788
- var relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];
1789
- var DEPLOYMENT_CUTOFF = 3;
1790
- var getRecentDeployments = (0, import_toolkit10.createSelector)(
1791
- [getDeploymentsById, getDeploymentsByStatus],
1792
- (deploymentsById, deploymentsByStatus) => Object.entries(deploymentsByStatus).reduce(
1793
- (accu, [state, byStatus]) => {
1794
- if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {
1795
- return accu;
1796
- }
1797
- accu[state] = byStatus.deploymentIds.reduce((accu2, id) => {
1798
- if (deploymentsById[id]) {
1799
- accu2.push(deploymentsById[id]);
1800
- }
1801
- return accu2;
1802
- }, []).slice(0, DEPLOYMENT_CUTOFF);
1803
- accu.total += byStatus.total;
1804
- return accu;
1805
- },
1806
- { total: 0 }
1807
- )
1808
- );
1809
-
1810
- // src/devicesSlice/selectors.ts
1811
- var import_helpers4 = require("@northern.tech/utils/helpers");
1812
- var import_toolkit11 = require("@reduxjs/toolkit");
1813
- var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
1814
- var getDevicesByStatus = (state) => state.devices.byStatus;
1815
- var getDevicesById = (state) => state.devices.byId;
1816
- var getGroupsById = (state) => state.devices.groups.byId;
1817
- var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
1818
- var getListedDevices = (state) => state.devices.deviceList.deviceIds;
1819
- var getFilteringAttributes = (state) => state.devices.filteringAttributes;
1820
- var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
1821
- var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
1822
- ...filteringAttributes,
1823
- identityAttributes: [...filteringAttributes.identityAttributes, "id"]
1824
- }));
1825
- var getDeviceLimits = (state) => state.devices.limits;
1826
- var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
1827
- var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
1828
- [getFilteringAttributes, getFilteringAttributesLimit],
1829
- ({ identityAttributes }, filteringAttributesLimit) => {
1830
- const attributes = identityAttributes.slice(0, filteringAttributesLimit);
1831
- return attributes.reduce(
1832
- (accu, value) => {
1833
- accu.push({ value, label: value, scope: "identity" });
1834
- return accu;
1835
- },
1836
- [
1837
- { value: "name", label: "Name", scope: "tags" },
1838
- { value: "id", label: "Device ID", scope: "identity" }
1839
- ]
1840
- );
1841
- }
1842
- );
1843
- var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
1844
- [getDevicesByStatus],
1845
- (byStatus) => Object.values(import_constants4.DEVICE_STATES).reduce(
1846
- (accu, deviceState) => {
1847
- const { counts } = byStatus[deviceState];
1848
- const { total, ...tieredCounts } = counts;
1849
- const count = Object.values(tieredCounts).reduce((accu2, countPerTier) => accu2 + countPerTier, 0);
1850
- accu[deviceState] = count;
1851
- accu.total = accu.total + count;
1852
- return accu;
1853
- },
1854
- { total: 0 }
1855
- )
1856
- );
1857
- var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
1858
- var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
1859
- [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],
1860
- ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {
1861
- let groupCount = acceptedDeviceTotal;
1862
- let groupFilters = [];
1863
- if (selectedGroup && groupsById[selectedGroup]) {
1864
- groupCount = groupsById[selectedGroup].total || 0;
1865
- groupFilters = groupsById[selectedGroup].filters || [];
1866
- }
1867
- return { groupCount, selectedGroup, groupFilters };
1868
- }
1869
- );
1870
- var getCombinedLimit = (0, import_toolkit11.createSelector)(
1871
- [getDeviceLimits],
1872
- (deviceLimits) => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0)
1873
- // limit might be -1 for unlimited devices
1874
- );
1875
- var getLimitMaxed = (0, import_toolkit11.createSelector)(
1876
- [getDeviceCountsByStatus, getCombinedLimit],
1877
- ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices
1878
- );
1879
- var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
1880
- var getGroupData = (0, import_toolkit11.createSelector)([getGroupsByIdWithoutUngrouped], (groups) => {
1881
- const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : void 0;
1882
- const hasDynamicGroups = Object.values(groups).some((group) => !!group.id);
1883
- return { createdGroup, hasDynamicGroups, groups };
1884
- });
1885
- var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
1886
- const groupNames = Object.keys(groupsById).sort();
1887
- const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
1888
- (accu, [groupname, group]) => {
1889
- const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
1890
- const groupItem = { ...group, groupId: name, name: groupname };
1891
- if ((group.filters ?? []).length > 0) {
1892
- if (groupname !== UNGROUPED_GROUP.id) {
1893
- accu.dynamic.push(groupItem);
1894
- } else {
1895
- accu.ungrouped.push(groupItem);
1896
- }
1897
- } else {
1898
- accu.static.push(groupItem);
1899
- }
1900
- return accu;
1901
- },
1902
- { dynamic: [], static: [], ungrouped: [] }
1903
- );
1904
- return { groupNames, ...groupedGroups };
1905
- });
1906
- var getAttributesList = (0, import_toolkit11.createSelector)(
1907
- [getFilteringAttributes, getFilteringAttributesFromConfig],
1908
- ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers4.duplicateFilter)
1909
- );
1910
- var getEnabledTierLimits = (0, import_toolkit11.createSelector)([getDeviceLimits], (limits) => Object.entries(limits).filter(([, limit]) => limit !== 0));
1911
- var getEnabledTiers = (0, import_toolkit11.createSelector)([getEnabledTierLimits], (enabledTierLimits) => enabledTierLimits.map(([type]) => type));
1912
- var getDeviceLimitStats = (0, import_toolkit11.createSelector)([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {
1913
- const { counts } = accepted;
1914
- return enabledTierLimits.map(([type, limit]) => ({
1915
- type,
1916
- limit,
1917
- total: counts[type] || 0
1918
- }));
1919
- });
1920
- var getDeviceTypes = (0, import_toolkit11.createSelector)(
1921
- [getAcceptedDevices, getDevicesById],
1922
- ({ deviceIds = [] }, devicesById) => Object.keys(
1923
- deviceIds.slice(0, 200).reduce((accu, item) => {
1924
- const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};
1925
- accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {
1926
- if (deviceType.length > 1) {
1927
- deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;
1928
- }
1929
- return deviceTypeAccu;
1930
- }, accu);
1931
- return accu;
1932
- }, {})
1933
- )
1934
- );
1935
-
1936
- // src/monitorSlice/selectors.ts
1937
- var getIssueCountsByType = (state) => state.monitor.issueCounts.byType;
1938
-
1939
- // src/onboardingSlice/selectors.ts
1940
- var getOnboarding = (state) => state.onboarding;
1941
-
1942
- // src/organizationSlice/selectors.ts
1943
- var import_toolkit12 = require("@reduxjs/toolkit");
1944
- var getOrganization = (state) => state.organization.organization;
1945
- var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
1946
- var getAuditLog = (state) => state.organization.auditlog.events;
1947
- var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
1948
- var getTenantsList = (state) => state.organization.tenantList;
1949
- var getWebhookEvents = (state) => state.organization.webhooks.events;
1950
- var getWebhookEventTotal = (state) => state.organization.webhooks.eventsTotal;
1951
- var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
1952
- [getExternalIntegrations],
1953
- (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
1954
- );
1955
- var getIsServiceProvider = (state) => state.organization.organization.service_provider;
1956
- var getWebhooks = (0, import_toolkit12.createSelector)(
1957
- [getExternalIntegrations],
1958
- (integrations) => integrations.filter((integration) => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)
1959
- );
1960
- var getWebhookEventInfo = (0, import_toolkit12.createSelector)(
1961
- [getWebhooks, getWebhookEvents, getWebhookEventTotal],
1962
- (webhooks, events, eventTotal) => webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }
1963
- );
1964
- var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {
1965
- if (!selectedId) {
1966
- return;
1967
- }
1968
- const [eventAction, eventTime] = atob(selectedId).split("|");
1969
- return events.find((item) => item.action === eventAction && item.time === eventTime);
1970
- });
1971
- var toTierName = (key) => key.replace(/max_|_?devices/g, "") || "standard";
1972
- var processDeviceLimits = (deviceLimits, skipFilter = false) => {
1973
- const result = { limits: {}, disabled: [] };
1974
- if (!deviceLimits) return result;
1975
- const tiersByName = Object.fromEntries(Object.entries(deviceLimits).map(([key, limit]) => [toTierName(key), { key, limit }]));
1976
- return productOrder.reduce((accu, tierName) => {
1977
- const entry = tiersByName[tierName];
1978
- if (!entry) return accu;
1979
- const { key, limit } = entry;
1980
- if (limit.value === 0) {
1981
- accu.disabled.push(tierName);
1982
- if (!skipFilter) return accu;
1983
- }
1984
- accu.limits[tierName] = {
1985
- id: tierName,
1986
- backendId: key,
1987
- limit: limit.value,
1988
- current: limit.current_value,
1989
- name: tierName,
1990
- quotaLeft: Math.max(limit.value - limit.current_value, 0),
1991
- limitReached: limit.value !== -1 && limit.value <= limit.current_value
1992
- };
1993
- return accu;
1994
- }, result);
1995
- };
1996
- var getDeviceLimitsInfo = (0, import_toolkit12.createSelector)([getOrganization], ({ device_limits }) => processDeviceLimits(device_limits));
1997
- var getDisabledTiers = (0, import_toolkit12.createSelector)([getDeviceLimitsInfo], ({ disabled }) => disabled);
1998
- var getSpLimits = (0, import_toolkit12.createSelector)([getDeviceLimitsInfo], ({ limits }) => limits);
1999
- var getTenantListWithLimits = (0, import_toolkit12.createSelector)([getTenantsList], (tenantList) => ({
2000
- ...tenantList,
2001
- tenants: tenantList.tenants.map((tenant) => ({
2002
- ...tenant,
2003
- device_limits: processDeviceLimits(tenant.device_limits, true).limits
2004
- }))
2005
- }));
2006
-
2007
- // src/releasesSlice/selectors.ts
2008
- var import_toolkit13 = require("@reduxjs/toolkit");
2009
-
2010
- // src/utils.ts
2011
- var import_helpers5 = require("@northern.tech/utils/helpers");
2012
- var filterProcessors = {
2013
- [import_constants4.DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
2014
- [import_constants4.DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
2015
- [import_constants4.DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
2016
- [import_constants4.DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
2017
- [import_constants4.DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
2018
- [import_constants4.DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2019
- [import_constants4.DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2020
- [import_constants4.DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers5.yes,
2021
- [import_constants4.DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
2022
- };
2023
- var filterAliases = {
2024
- $nexists: { alias: import_constants4.DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
2025
- };
2026
- var mapFiltersToTerms = (filters) => filters.map((filter) => ({
2027
- scope: filter.scope,
2028
- attribute: filter.key,
2029
- type: filterAliases[filter.operator]?.alias || filter.operator,
2030
- value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
2031
- }));
2032
- var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
2033
- if (typeof import_constants4.DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
2034
- return { ...import_constants4.DEVICE_ISSUE_OPTIONS[item].filterRule, value: import_constants4.DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
2035
- }
2036
- return import_constants4.DEVICE_ISSUE_OPTIONS[item].filterRule;
2037
- });
2038
- var convertDeviceListStateToFilters = ({
2039
- filters = [],
2040
- group,
2041
- groups = { byId: {} },
2042
- offlineThreshold,
2043
- selectedIssues = [],
2044
- status
2045
- }) => {
2046
- let applicableFilters = [...filters];
2047
- if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2048
- applicableFilters.push({ key: "group", value: group, operator: import_constants4.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
2049
- }
2050
- const nonMonitorFilters = applicableFilters.filter(
2051
- (filter) => !Object.values(import_constants4.DEVICE_ISSUE_OPTIONS).some(
2052
- ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2053
- )
2054
- );
2055
- const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2056
- applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2057
- const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: import_constants4.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
2058
- return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2059
- };
2060
- var listItemMapper = (byId, ids, { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
2061
- if (id && byId[id]) {
2062
- accu.push({ ...defaultObject, ...byId[id] });
2063
- }
2064
- return accu;
2065
- }, []);
2066
- var mergePermissions = (existingPermissions = { ...import_constants4.emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2067
- (accu, [key, value]) => {
2068
- let values;
2069
- if (!accu[key]) {
2070
- accu[key] = value;
2071
- return accu;
2072
- }
2073
- if (Array.isArray(value)) {
2074
- values = [...value, ...accu[key]].filter(import_helpers5.duplicateFilter);
2075
- } else {
2076
- values = mergePermissions(accu[key], { ...value });
2077
- }
2078
- accu[key] = values;
2079
- return accu;
2080
- },
2081
- { ...addedPermissions }
2082
- );
2083
- var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2084
- (accu, roleId) => {
2085
- if (!(roleId && roles[roleId])) {
2086
- return accu;
2087
- }
2088
- return mergePermissions(accu, roles[roleId].uiPermissions);
2089
- },
2090
- { ...import_constants4.emptyUiPermissions }
2091
- );
2092
- var progress = ({ loaded, total }) => {
2093
- let uploadProgress3 = loaded / total * 100;
2094
- return uploadProgress3 = uploadProgress3 < 50 ? Math.ceil(uploadProgress3) : Math.round(uploadProgress3);
2095
- };
2096
- var isDarkMode = (mode) => mode === DARK_MODE;
2097
-
2098
- // src/releasesSlice/selectors.ts
2099
- var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2100
- var getReleasesById = (state) => state.releases.byId;
2101
- var getReleaseTags = (state) => state.releases.tags;
2102
- var getReleaseListState = (state) => state.releases.releasesList;
2103
- var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2104
- var releaseDefaults = {};
2105
- var getReleaseMappingDefaults = () => releaseDefaults;
2106
- var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2107
- var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2108
- var getHasReleases = (0, import_toolkit13.createSelector)(
2109
- [getReleaseListState, getReleasesById],
2110
- ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2111
- );
2112
- var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id || ""] ?? {});
2113
- var getSelectedReleases = (0, import_toolkit13.createSelector)([getReleaseListState, getReleasesList], ({ selection }, releases) => selection.map((index) => releases[index]));
2114
- var getDeltaJobsById = (state) => state.releases.deltaJobs;
2115
- var getDeltaJobById = (0, import_toolkit13.createSelector)([getDeltaJobsById, (_, jobId) => jobId], (byId, jobId) => byId[jobId]);
2116
- var getSelectedJobId = (state) => state.releases.selectedJob;
2117
- var getSelectedJob = (0, import_toolkit13.createSelector)([getDeltaJobsById, getSelectedJobId], (byId, jobId) => byId[jobId || ""]);
2118
-
2119
- // src/usersSlice/selectors.ts
2120
- var import_toolkit14 = require("@reduxjs/toolkit");
2121
- var emptyObject = {};
2122
- var getRolesById = (state) => state.users.rolesById;
2123
- var getTooltipsById = (state) => state.users.tooltips.byId;
2124
- var getGlobalSettings = (state) => state.users.globalSettings;
2125
- var getUserSettingsInitialized = (state) => state.users.userSettingsInitialized;
2126
- var getCurrentUserId = (state) => state.users.currentUser;
2127
- var getUsersById = (state) => state.users.byId;
2128
- var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
2129
- var getCurrentUser = (0, import_toolkit14.createSelector)(
2130
- [getUsersById, getCurrentUserId],
2131
- (usersById, userId) => userId ? usersById[userId] ?? emptyObject : emptyObject
2132
- );
2133
- var getUserSettings = (state) => state.users.userSettings;
2134
- var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
2135
- [getUserSettings],
2136
- ({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
2137
- );
2138
- var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2139
- var getReadAllHelptips = (0, import_toolkit14.createSelector)(
2140
- [getTooltipsById],
2141
- (tooltips) => Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)
2142
- );
2143
- var getTooltipsState = (0, import_toolkit14.createSelector)(
2144
- [getTooltipsById, getUserSettings],
2145
- (byId, { tooltips = {} }) => Object.entries(byId).reduce(
2146
- (accu, [id, value]) => {
2147
- accu[id] = { ...accu[id], ...value };
2148
- return accu;
2149
- },
2150
- { ...tooltips }
2151
- )
2152
- );
2153
- var getHas2FA = (0, import_toolkit14.createSelector)(
2154
- [getCurrentUser],
2155
- (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === import_constants4.twoFAStates.enabled
2156
- );
2157
- var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2158
- var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
2159
- interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
2160
- intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
2161
- }));
2162
- var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([value, role]) => ({ value, ...role })));
2163
- var getSecurityAlertDismissedTimestamp = (state) => state.users.userSettings.securityAlertDismissedTimestamp;
2164
-
2165
- // src/commonSelectors.ts
2166
- var getIsEnterprise = (0, import_toolkit15.createSelector)(
2167
- [getOrganization, getFeatures],
2168
- ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || isHosted && plan === PLANS.enterprise.id
2169
- );
2170
- var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2171
- [getFeatures],
2172
- ({ hasReporting }) => hasReporting ? `${import_constants4.reportingApiUrl}/devices/search/attributes` : `${import_constants4.inventoryApiUrlV2}/filters/attributes`
2173
- );
2174
- var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2175
- [getFeatures],
2176
- ({ hasReporting }) => hasReporting ? `${import_constants4.reportingApiUrl}/devices/search` : `${import_constants4.inventoryApiUrlV2}/filters/search`
2177
- );
2178
- var getUserRoles = (0, import_toolkit15.createSelector)([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById2, isEnterprise) => {
2179
- const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === import_constants4.rolesByName.admin) : !isEnterprise;
2180
- const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([import_constants4.rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2181
- return { isAdmin, uiPermissions };
2182
- });
2183
- var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2184
- var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2185
- const canManageReleases = hasPermission(uiPermissions.releases, import_constants4.uiPermissionsById.manage.value);
2186
- const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants4.uiPermissionsById.read.value);
2187
- const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants4.uiPermissionsById.upload.value);
2188
- const canAuditlog = uiPermissions.auditlog.includes(import_constants4.uiPermissionsById.read.value);
2189
- const canReadUsers = uiPermissions.userManagement.includes(import_constants4.uiPermissionsById.read.value);
2190
- const canManageUsers = uiPermissions.userManagement.includes(import_constants4.uiPermissionsById.manage.value);
2191
- const canReadDevices = hasPermission(uiPermissions.groups, import_constants4.uiPermissionsById.read.value);
2192
- const canWriteDevices = Object.values(uiPermissions.groups).some(
2193
- (groupPermissions) => groupPermissions.includes(import_constants4.uiPermissionsById.read.value) && groupPermissions.length > 1
2194
- );
2195
- const canTroubleshoot = hasPermission(uiPermissions.groups, import_constants4.uiPermissionsById.connect.value);
2196
- const canManageDevices = hasPermission(uiPermissions.groups, import_constants4.uiPermissionsById.manage.value);
2197
- const canConfigure = hasPermission(uiPermissions.groups, import_constants4.uiPermissionsById.configure.value);
2198
- const canDeploy = uiPermissions.deployments.includes(import_constants4.uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, import_constants4.uiPermissionsById.deploy.value);
2199
- const canReadDeployments = uiPermissions.deployments.includes(import_constants4.uiPermissionsById.read.value);
2200
- return {
2201
- canAuditlog,
2202
- canConfigure,
2203
- canDeploy,
2204
- canManageDevices,
2205
- canManageReleases,
2206
- canManageUsers,
2207
- canReadDeployments,
2208
- canReadDevices,
2209
- canReadReleases,
2210
- canReadUsers,
2211
- canTroubleshoot,
2212
- canUploadReleases,
2213
- canWriteDevices,
2214
- groupsPermissions: uiPermissions.groups,
2215
- releasesPermissions: uiPermissions.releases,
2216
- SPTenant: isServiceProvider
2217
- };
2218
- });
2219
- var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2220
- [getFeatures, getOrganization, getIsEnterprise],
2221
- ({
2222
- hasAuditlogs: isAuditlogEnabled,
2223
- hasDeviceConfig: isDeviceConfigEnabled,
2224
- hasDeviceConnect: isDeviceConnectEnabled,
2225
- hasMonitor: isMonitorEnabled,
2226
- isHosted
2227
- }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2228
- const canDelta = isEnterprise || plan === PLANS.professional.id;
2229
- const hasAuditlogs = isAuditlogEnabled && isEnterprise;
2230
- const hasDeviceConfig = addons.some((addon) => addon.name === ADDONS.configure.id && addon.enabled) || isDeviceConfigEnabled && !isHosted;
2231
- const hasDeviceConnect = addons.some((addon) => addon.name === ADDONS.troubleshoot.id && addon.enabled) || isDeviceConnectEnabled && !isHosted;
2232
- const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === ADDONS.monitor.id && addon.enabled);
2233
- return {
2234
- canDelta,
2235
- canRetry: canDelta,
2236
- canSchedule: canDelta,
2237
- hasAuditlogs,
2238
- hasDeviceConfig,
2239
- hasDeviceConnect,
2240
- hasFullFiltering: canDelta,
2241
- hasMonitor,
2242
- isEnterprise,
2243
- plan
2244
- };
2245
- }
2246
- );
2247
- var getFilterAttributes = (0, import_toolkit15.createSelector)(
2248
- [getGlobalSettings, getFilteringAttributes],
2249
- ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2250
- const deviceNameAttribute = { key: "name", value: "Name", scope: import_constants4.ATTRIBUTE_SCOPES.tags, category: import_constants4.ATTRIBUTE_SCOPES.tags, priority: 1 };
2251
- const deviceIdAttribute = { key: "id", value: "Device ID", scope: import_constants4.ATTRIBUTE_SCOPES.identity, category: import_constants4.ATTRIBUTE_SCOPES.identity, priority: 1 };
2252
- const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: import_constants4.ATTRIBUTE_SCOPES.system, category: import_constants4.ATTRIBUTE_SCOPES.system, priority: 4 };
2253
- const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2254
- const firstRequestAttribute = { key: "created_ts", value: "First request", scope: import_constants4.ATTRIBUTE_SCOPES.system, category: import_constants4.ATTRIBUTE_SCOPES.system, priority: 4 };
2255
- const attributes = [
2256
- ...previousFilters.map((item) => ({
2257
- ...item,
2258
- value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
2259
- category: "recently used",
2260
- priority: 0
2261
- })),
2262
- deviceNameAttribute,
2263
- deviceIdAttribute,
2264
- ...identityAttributes.map((item) => ({ key: item, value: item, scope: import_constants4.ATTRIBUTE_SCOPES.identity, category: import_constants4.ATTRIBUTE_SCOPES.identity, priority: 1 })),
2265
- ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: import_constants4.ATTRIBUTE_SCOPES.inventory, category: import_constants4.ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2266
- ...tagAttributes.map((item) => ({ key: item, value: item, scope: import_constants4.ATTRIBUTE_SCOPES.tags, category: import_constants4.ATTRIBUTE_SCOPES.tags, priority: 3 })),
2267
- checkInAttribute,
2268
- updateAttribute,
2269
- firstRequestAttribute,
2270
- ...systemAttributes.map((item) => ({ key: item, value: item, scope: import_constants4.ATTRIBUTE_SCOPES.system, category: import_constants4.ATTRIBUTE_SCOPES.system, priority: 4 }))
2271
- ];
2272
- return (0, import_helpers6.attributeDuplicateFilter)(attributes, "key");
2273
- }
2274
- );
2275
- var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
2276
- ...remainder,
2277
- ...onboarding,
2278
- complete: onboarding.complete || complete,
2279
- progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
2280
- showTips: !onboarding.showTips ? onboarding.showTips : showTips
2281
- }));
2282
- var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
2283
- const demoDeviceAddress = `http://${(0, import_helpers6.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
2284
- return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
2285
- });
2286
- var getDeviceConfigDeployment = (0, import_toolkit15.createSelector)([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
2287
- const { config = {} } = device;
2288
- const { deployment_id: configDeploymentId } = config;
2289
- const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};
2290
- return { device, deviceConfigDeployment };
2291
- });
2292
- var getDeploymentRelease = (0, import_toolkit15.createSelector)(
2293
- [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],
2294
- (deploymentsById, { selectedId }, releasesById) => {
2295
- const deployment = deploymentsById[selectedId] || {};
2296
- return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };
2297
- }
2298
- );
2299
- var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2300
- [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
2301
- (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
2302
- const deployment = deploymentsById[selectedId] ?? {};
2303
- const { devices = {} } = deployment;
2304
- return {
2305
- deployment,
2306
- selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
2307
- };
2308
- }
2309
- );
2310
- var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2311
- [getFeatures, getTenantCapabilities, getIssueCountsByType],
2312
- ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(import_constants4.DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2313
- if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2314
- return accu;
2315
- }
2316
- accu[key] = { count: issueCounts[key].filtered, key, title };
2317
- return accu;
2318
- }, {})
2319
- );
2320
- var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {
2321
- const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2322
- return Object.keys(
2323
- Object.entries(groups).reduce((accu, [groupName, group]) => {
2324
- if (group.filterId || uiPermissions.groups[import_constants4.ALL_DEVICES]) {
2325
- accu[groupName] = group;
2326
- }
2327
- return accu;
2328
- }, uiPermissions.groups)
2329
- ).sort();
2330
- });
2331
- var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
2332
- [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
2333
- ({ reports }, { id: currentUserId }, globalSettings, devicesById) => reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])
2334
- );
2335
- var listTypeDeviceIdMap = {
2336
- deviceList: getListedDevices,
2337
- search: getSearchedDevices
2338
- };
2339
- var deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };
2340
- var getDeviceMappingDefaults = () => deviceMapDefault;
2341
- var getMappedDevicesList = (0, import_toolkit15.createSelector)(
2342
- [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],
2343
- listItemMapper
2344
- );
2345
- var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {
2346
- let auditlogDevice = {};
2347
- if (auditlogEvent) {
2348
- const { object = {} } = auditlogEvent;
2349
- const { device = {}, id, type } = object;
2350
- auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
2351
- }
2352
- return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
2353
- });
2354
- var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2355
- if (service_provider) {
2356
- return roles.reduce((accu, role) => {
2357
- if (import_constants4.rolesById[role.value]) {
2358
- return accu;
2359
- }
2360
- accu.push(role);
2361
- return accu;
2362
- }, Object.values(import_constants4.serviceProviderRolesById));
2363
- }
2364
- return Object.keys(import_constants4.rolesById).reverse().reduce((accu, key) => {
2365
- const index = accu.findIndex(({ value }) => value === key);
2366
- accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2367
- return accu;
2368
- }, roles);
2369
- });
2370
- var getShowSecurityAlert = (0, import_toolkit15.createSelector)(
2371
- [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],
2372
- (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {
2373
- const isOAuth2 = !!currentUser?.sso?.length;
2374
- const userVerified = !!currentUser.verified;
2375
- const isHosted = features?.isHosted;
2376
- const canHave2FA = isEnterprise || isHosted;
2377
- const secureOAuthUser = isOAuth2 && userVerified;
2378
- if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {
2379
- return false;
2380
- }
2381
- if (dismissedTimestamp === null) {
2382
- return true;
2383
- }
2384
- const today = (0, import_dayjs.default)();
2385
- const dismissedMonthAgo = today.diff(dismissedTimestamp, "months");
2386
- return dismissedMonthAgo > 0;
2387
- }
2388
- );
2389
-
2390
- // src/store.ts
2391
- var import_react_redux = require("react-redux");
2392
- var import_helpers7 = require("@northern.tech/utils/helpers");
2393
- var import_toolkit16 = require("@reduxjs/toolkit");
2394
- var import_react = require("@sentry/react");
2395
- var { setSnackbar, uploadProgress } = actions_default;
2396
- var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2397
- var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
2398
- resetEnvironment();
2399
- var commonErrorFallback = "Please check your connection.";
2400
- var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
2401
- const errMsg = (0, import_helpers7.extractErrorMessage)(err, fallback);
2402
- if (mightBeAuthRelated || getToken()) {
2403
- dispatch(setSnackbar({ message: (0, import_helpers7.preformatWithRequestID)(err.response, `${errorContext} ${errMsg}`), action: "Copy to clipboard" }));
2404
- }
2405
- return Promise.reject(err);
2406
- };
2407
- var rootReducer = (0, import_toolkit16.combineReducers)({
2408
- app: appSlice_default,
2409
- devices: devicesSlice_default,
2410
- deployments: deploymentsSlice_default,
2411
- monitor: monitorSlice_default,
2412
- onboarding: onboardingSlice_default,
2413
- organization: organizationSlice_default,
2414
- releases: releasesSlice_default,
2415
- users: usersSlice_default
2416
- });
2417
- var sessionReducer = (state, action) => {
2418
- if (action.type === USER_LOGOUT) {
2419
- state = void 0;
2420
- }
2421
- return rootReducer(state, action);
2422
- };
2423
- var rejectionLoggerMiddleware = () => (next) => (action) => {
2424
- if (action.type.endsWith("/rejected")) {
2425
- const { error } = action;
2426
- console.error("Rejection in action:", action);
2427
- console.error(error.stack);
2428
- }
2429
- return next(action);
2430
- };
2431
- var tracingActionIgnoreList = [actions8.successfullyLoggedIn.type, "users/loginUser/pending", "users/loginUser/fulfilled", "users/loginUser/rejected"];
2432
- var sentryReduxEnhancer = (0, import_react.createReduxEnhancer)({
2433
- actionTransformer: (action) => {
2434
- if (tracingActionIgnoreList.includes(action.type)) {
2435
- return null;
2436
- }
2437
- return action;
2438
- },
2439
- // Transform the state to remove sensitive information
2440
- stateTransformer: (state) => {
2441
- const transformedState = {
2442
- ...state,
2443
- users: { ...state.users, currentSession: null },
2444
- organization: {
2445
- ...state.organization,
2446
- organization: {
2447
- ...state.organization.organization,
2448
- tenant_token: null
2449
- }
2450
- }
2451
- };
2452
- return transformedState;
2453
- }
2454
- });
2455
- var getConfiguredStore = (options = {}) => {
2456
- const { preloadedState = {}, ...config } = options;
2457
- return (0, import_toolkit16.configureStore)({
2458
- ...config,
2459
- preloadedState,
2460
- enhancers: (getDefaultEnhancers) => {
2461
- if (window.mender_environment?.sentry?.isReduxEnabled) {
2462
- return getDefaultEnhancers().concat(sentryReduxEnhancer);
2463
- }
2464
- return getDefaultEnhancers();
2465
- },
2466
- reducer: sessionReducer,
2467
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2468
- immutableCheck: {
2469
- ignoredPaths: ["app.uploadsById"]
2470
- },
2471
- serializableCheck: {
2472
- ignoredActions: [actions7.receiveExternalDeviceIntegrations.name, uploadProgress.name],
2473
- ignoredActionPaths: ["uploads", /payload\..*$/, "meta.arg.file", "meta.arg.integration.configHint"],
2474
- ignoredPaths: ["app.uploadsById", "organization.externalDeviceIntegrations"]
2475
- }
2476
- }).concat(rejectionLoggerMiddleware)
2477
- });
2478
- };
2479
- var store = getConfiguredStore({
2480
- preloadedState: {}
2481
- });
2482
- var createAppAsyncThunk = import_toolkit16.createAsyncThunk.withTypes();
2483
-
2484
- // src/releasesSlice/thunks.ts
2485
- var { setSnackbar: setSnackbar2, initUpload, uploadProgress: uploadProgress2, cleanUpUpload } = actions_default;
2486
- var { page: defaultPage, perPage: defaultPerPage } = import_constants4.DEVICE_LIST_DEFAULTS;
2487
- var sortingDefaults = { direction: import_constants4.SORTING_OPTIONS.desc, key: "modified" };
2488
- var flattenRelease = (release, stateRelease) => {
2489
- const updatedArtifacts = release.artifacts?.sort((0, import_helpers8.customSort)(true, "modified")) || [];
2490
- const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
2491
- (accu, item) => {
2492
- accu.deviceTypes.push(...item.device_types_compatible);
2493
- const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
2494
- accu.modified = accu.modified ? accu.modified : item.modified;
2495
- accu.artifacts.push({
2496
- ...stateArtifact,
2497
- ...item
2498
- });
2499
- return accu;
2500
- },
2501
- { artifacts: [], deviceTypes: [], modified: void 0 }
2502
- );
2503
- return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers8.duplicateFilter), modified };
2504
- };
2505
- var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
2506
- const name = release.name ?? release.Name;
2507
- const stateRelease = stateReleasesById[name] || {};
2508
- accu[name] = flattenRelease(release, stateRelease);
2509
- return accu;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ const require_releasesSlice_constants = require("./constants.cjs");
4
+ const require_constants = require("../constants.cjs");
5
+ const require_releasesSlice_index = require("./index.cjs");
6
+ const require_actions = require("../actions.cjs");
7
+ const require_utils = require("../utils.cjs");
8
+ const require_releasesSlice_selectors = require("./selectors.cjs");
9
+ const require_locationutils = require("../locationutils.cjs");
10
+ const require_store = require("../store.cjs");
11
+ const require_api_general_api = require("../api/general-api.cjs");
12
+ let _northern_tech_utils_helpers = require("@northern.tech/utils/helpers");
13
+ let axios = require("axios");
14
+ let uuid = require("uuid");
15
+ let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
16
+ //#region src/releasesSlice/thunks.ts
17
+ const { setSnackbar, initUpload, uploadProgress, cleanUpUpload } = require_actions;
18
+ const { page: defaultPage, perPage: defaultPerPage } = _northern_tech_utils_constants.DEVICE_LIST_DEFAULTS;
19
+ const sortingDefaults = {
20
+ direction: _northern_tech_utils_constants.SORTING_OPTIONS.desc,
21
+ key: "modified"
22
+ };
23
+ const flattenRelease = (release, stateRelease) => {
24
+ const { artifacts, deviceTypes, modified } = (release.artifacts?.sort((0, _northern_tech_utils_helpers.customSort)(true, "modified")) || []).reduce((accu, item) => {
25
+ accu.deviceTypes.push(...item.device_types_compatible);
26
+ const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
27
+ accu.modified = accu.modified ? accu.modified : item.modified;
28
+ accu.artifacts.push({
29
+ ...stateArtifact,
30
+ ...item
31
+ });
32
+ return accu;
33
+ }, {
34
+ artifacts: [],
35
+ deviceTypes: [],
36
+ modified: void 0
37
+ });
38
+ return {
39
+ ...stateRelease,
40
+ ...release,
41
+ artifacts,
42
+ device_types_compatible: deviceTypes.filter(_northern_tech_utils_helpers.duplicateFilter),
43
+ modified
44
+ };
45
+ };
46
+ const reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
47
+ const name = release.name ?? release.Name;
48
+ accu[name] = flattenRelease(release, stateReleasesById[name] || {});
49
+ return accu;
2510
50
  }, {});
2511
- var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduce(
2512
- (accu, item) => {
2513
- const index = item.artifacts?.findIndex((releaseArtifact) => releaseArtifact.id === id) ?? -1;
2514
- if (index > -1) {
2515
- accu = { release: item, index };
2516
- }
2517
- return accu;
2518
- },
2519
- { release: null, index: -1 }
2520
- );
2521
- var getArtifactInstallCount = createAppAsyncThunk(`${sliceName}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
2522
- const { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
2523
- if (!release || index === -1) {
2524
- return;
2525
- }
2526
- const releaseArtifacts = [...release.artifacts];
2527
- const artifact = releaseArtifacts[index];
2528
- const { key, name, version } = (0, import_helpers8.extractSoftwareItem)(artifact.artifact_provides) ?? {};
2529
- const attribute = `${key}${name ? `.${name}` : ""}.version`;
2530
- const { filterTerms } = convertDeviceListStateToFilters({
2531
- filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
2532
- });
2533
- return general_api_default.post(getSearchEndpoint(getState()), {
2534
- page: 1,
2535
- per_page: 1,
2536
- filters: filterTerms,
2537
- attributes: [{ scope: "identity", attribute: "status" }]
2538
- }).catch((err) => commonErrorHandler(err, `Retrieving artifact installation count failed:`, dispatch, commonErrorFallback)).then(({ headers }) => {
2539
- const foundRelease = findArtifactIndexInRelease(getReleasesById(getState()), id);
2540
- const index2 = foundRelease.index;
2541
- let release2 = foundRelease.release;
2542
- if (!release2 || index2 === -1) {
2543
- return;
2544
- }
2545
- const installCount = Number(headers[import_constants4.headerNames.total]);
2546
- const releaseArtifacts2 = [...release2.artifacts];
2547
- releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
2548
- release2 = {
2549
- ...release2,
2550
- artifacts: releaseArtifacts2
2551
- };
2552
- return dispatch(actions.receiveRelease(release2));
2553
- });
2554
- });
2555
- var getArtifactUrl = createAppAsyncThunk(
2556
- `${sliceName}/getArtifactUrl`,
2557
- (id, { dispatch, getState }) => general_api_default.get(`${import_constants4.deploymentsApiUrl}/artifacts/${id}/download`).then((response) => {
2558
- const foundRelease = findArtifactIndexInRelease(getReleasesById(getState()), id);
2559
- const index = foundRelease.index;
2560
- let release = foundRelease.release;
2561
- if (!release || index === -1) {
2562
- return dispatch(getReleases());
2563
- }
2564
- const releaseArtifacts = [...release.artifacts];
2565
- releaseArtifacts[index] = {
2566
- ...releaseArtifacts[index],
2567
- url: response.data.uri
2568
- };
2569
- release = {
2570
- ...release,
2571
- artifacts: releaseArtifacts
2572
- };
2573
- return dispatch(actions.receiveRelease(release));
2574
- })
2575
- );
2576
- var pollLocation = async (location, attempt = 1, maxAttempts = 5, delay = TIMEOUTS.oneSecond) => {
2577
- try {
2578
- await general_api_default.get(location);
2579
- return Promise.resolve();
2580
- } catch {
2581
- if (attempt >= maxAttempts) {
2582
- throw new Error(`Couldn't get ${location} after ${maxAttempts} attempts`);
2583
- }
2584
- await new Promise((resolve) => setTimeout(resolve, delay));
2585
- return pollLocation(location, attempt + 1, maxAttempts, delay);
2586
- }
2587
- };
2588
- var createArtifact = createAppAsyncThunk(`${sliceName}/createArtifact`, ({ file, meta }, { dispatch }) => {
2589
- const formData = Object.entries(meta).reduce((accu, [key, value]) => {
2590
- if (Array.isArray(value)) {
2591
- accu.append(key, value.join(","));
2592
- } else if (value instanceof Object) {
2593
- accu.append(key, JSON.stringify(value));
2594
- } else {
2595
- accu.append(key, value);
2596
- }
2597
- return accu;
2598
- }, new FormData());
2599
- formData.append("type", ARTIFACT_GENERATION_TYPE.SINGLE_FILE);
2600
- formData.append("file", file);
2601
- const uploadId = (0, import_uuid.v4)();
2602
- const cancelSource = new AbortController();
2603
- return Promise.all([
2604
- dispatch(setSnackbar2("Generating artifact")),
2605
- dispatch(initUpload({ id: uploadId, upload: { name: file.name, size: file.size, progress: 0, cancelSource } })),
2606
- general_api_default.upload(
2607
- `${import_constants4.deploymentsApiUrl}/artifacts/generate`,
2608
- formData,
2609
- (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
2610
- cancelSource.signal
2611
- )
2612
- ]).then((tasks) => {
2613
- const generateResponse = tasks[tasks.length - 1];
2614
- const generateLocation = generateResponse.headers[import_constants4.headerNames.location];
2615
- const location = generateLocation.replace("/generate", "");
2616
- return pollLocation(location);
2617
- }).then(
2618
- () => Promise.all([
2619
- dispatch(getReleases()),
2620
- dispatch(selectRelease(meta.name)),
2621
- dispatch(setSnackbar2({ message: "Upload successful", autoHideDuration: TIMEOUTS.fiveSeconds }))
2622
- ])
2623
- ).catch((err) => {
2624
- if ((0, import_axios2.isCancel)(err)) {
2625
- return dispatch(setSnackbar2({ message: "The artifact generation has been cancelled", autoHideDuration: TIMEOUTS.fiveSeconds }));
2626
- }
2627
- return commonErrorHandler(err, `Artifact couldn't be generated.`, dispatch);
2628
- }).finally(() => dispatch(cleanUpUpload(uploadId)));
2629
- });
2630
- var uploadArtifact = createAppAsyncThunk(`${sliceName}/uploadArtifact`, ({ file, meta }, { dispatch }) => {
2631
- const formData = new FormData();
2632
- formData.append("size", file.size.toString());
2633
- formData.append("description", meta.description);
2634
- formData.append("artifact", file);
2635
- const uploadId = (0, import_uuid.v4)();
2636
- const cancelSource = new AbortController();
2637
- return Promise.all([
2638
- dispatch(setSnackbar2("Uploading artifact")),
2639
- dispatch(initUpload({ id: uploadId, upload: { name: file.name, size: file.size, progress: 0, cancelSource } })),
2640
- general_api_default.upload(
2641
- `${import_constants4.deploymentsApiUrl}/artifacts`,
2642
- formData,
2643
- (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
2644
- cancelSource.signal
2645
- )
2646
- ]).then(() => {
2647
- const tasks = [
2648
- dispatch(setSnackbar2({ message: "Upload successful", autoHideDuration: TIMEOUTS.fiveSeconds })),
2649
- dispatch(getReleases())
2650
- ];
2651
- if (meta.name) {
2652
- tasks.push(dispatch(selectRelease(meta.name)));
2653
- }
2654
- return Promise.all(tasks);
2655
- }).catch((err) => {
2656
- if ((0, import_axios2.isCancel)(err)) {
2657
- return dispatch(setSnackbar2({ message: "The upload has been cancelled", autoHideDuration: TIMEOUTS.fiveSeconds }));
2658
- }
2659
- return commonErrorHandler(err, `Artifact couldn't be uploaded.`, dispatch);
2660
- }).finally(() => dispatch(cleanUpUpload(uploadId)));
2661
- });
2662
- var cancelFileUpload = createAppAsyncThunk(`${sliceName}/cancelFileUpload`, (id, { dispatch, getState }) => {
2663
- const { [id]: current } = getState().app.uploadsById;
2664
- current.cancelSource.abort();
2665
- return Promise.resolve(dispatch(cleanUpUpload(id)));
2666
- });
2667
- var editArtifact = createAppAsyncThunk(
2668
- `${sliceName}/editArtifact`,
2669
- ({ id, body }, { dispatch, getState }) => general_api_default.put(`${import_constants4.deploymentsApiUrl}/artifacts/${id}`, body).catch((err) => commonErrorHandler(err, `Artifact details couldn't be updated.`, dispatch)).then(() => {
2670
- const state = getState();
2671
- const { release, index } = findArtifactIndexInRelease(getReleasesById(state), id);
2672
- if (!release || index === -1) {
2673
- return dispatch(getReleases());
2674
- }
2675
- const updatedRelease = {
2676
- ...release,
2677
- artifacts: release.artifacts.map((artifact, i) => i === index ? { ...artifact, description: body.description || "" } : artifact)
2678
- };
2679
- return Promise.all([
2680
- dispatch(actions.receiveRelease(updatedRelease)),
2681
- dispatch(setSnackbar2({ message: "Artifact details were updated successfully.", autoHideDuration: TIMEOUTS.fiveSeconds, action: "" })),
2682
- dispatch(getRelease(release.name)),
2683
- dispatch(selectRelease(release.name))
2684
- ]);
2685
- })
2686
- );
2687
- var removeArtifact = createAppAsyncThunk(
2688
- `${sliceName}/removeArtifact`,
2689
- (id, { dispatch, getState }) => general_api_default.delete(`${import_constants4.deploymentsApiUrl}/artifacts/${id}`).then(() => {
2690
- const state = getState();
2691
- const { release, index } = findArtifactIndexInRelease(getReleasesById(state), id);
2692
- if (!release || index === -1) {
2693
- return dispatch(getReleases());
2694
- }
2695
- const releaseArtifacts = [...release.artifacts];
2696
- releaseArtifacts.splice(index, 1);
2697
- if (!releaseArtifacts.length) {
2698
- const { releasesList } = state.releases;
2699
- const releaseIds = releasesList.releaseIds.filter((id2) => release.name !== id2);
2700
- return Promise.all([
2701
- dispatch(actions.removeRelease(release.name)),
2702
- dispatch(
2703
- setReleasesListState({
2704
- releaseIds,
2705
- searchTotal: releasesList.searchTerm ? releasesList.searchTotal - 1 : releasesList.searchTotal,
2706
- total: releasesList.total - 1
2707
- })
2708
- )
2709
- ]);
2710
- }
2711
- return Promise.all([
2712
- dispatch(setSnackbar2({ message: "Artifact was removed", autoHideDuration: TIMEOUTS.fiveSeconds, action: "" })),
2713
- dispatch(actions.receiveRelease(release))
2714
- ]);
2715
- }).catch((err) => commonErrorHandler(err, `Error removing artifact:`, dispatch))
2716
- );
2717
- var removeRelease = createAppAsyncThunk(
2718
- `${sliceName}/removeRelease`,
2719
- (releaseId, { dispatch, getState }) => Promise.all(getReleasesById(getState())[releaseId].artifacts.map(({ id }) => dispatch(removeArtifact(id)))).then(() => dispatch(selectRelease(null)))
2720
- );
2721
- var removeReleases = createAppAsyncThunk(`${sliceName}/removeReleases`, (releaseIds, { dispatch, getState }) => {
2722
- const deleteRequests = releaseIds.reduce((accu, releaseId) => {
2723
- const releaseArtifacts = getReleasesById(getState())[releaseId].artifacts;
2724
- accu.push(releaseArtifacts.map(({ id }) => dispatch(removeArtifact(id))));
2725
- return accu;
2726
- }, []);
2727
- return Promise.all(deleteRequests);
2728
- });
2729
- var selectRelease = createAppAsyncThunk(`${sliceName}/selectRelease`, (release, { dispatch }) => {
2730
- const name = (release && typeof release === "object" ? release.name : release) || null;
2731
- const tasks = [dispatch(actions.selectedRelease(name))];
2732
- if (name) {
2733
- tasks.push(dispatch(getRelease(name)));
2734
- }
2735
- return Promise.all(tasks);
2736
- });
2737
- var setReleasesListState = createAppAsyncThunk(
2738
- `${sliceName}/setReleasesListState`,
2739
- (selectionState, { dispatch, getState }) => {
2740
- const currentState = getState().releases.releasesList;
2741
- const nextState = {
2742
- ...currentState,
2743
- ...selectionState,
2744
- sort: { ...currentState.sort, ...selectionState.sort }
2745
- };
2746
- const tasks = [];
2747
- const { isLoading: currentLoading, ...currentRequestState } = currentState;
2748
- const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
2749
- if (!(0, import_helpers8.deepCompare)(currentRequestState, selectionRequestState)) {
2750
- nextState.isLoading = true;
2751
- tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
2752
- }
2753
- if (!nextState.searchOnly && (currentState.page !== nextState.page || currentState.perPage > nextState.perPage || !(0, import_helpers8.deepCompare)(currentState.sort, nextState.sort))) {
2754
- nextState.selection = [];
2755
- }
2756
- tasks.push(dispatch(actions.setReleaseListState(nextState)));
2757
- return Promise.all(tasks);
2758
- }
2759
- );
2760
- var releaseListRetrieval = (config) => {
2761
- const { searchTerm = "", page = defaultPage, perPage = defaultPerPage, sort = sortingDefaults, selectedTags = [], type = "" } = config;
2762
- const { key: attribute, direction } = sort;
2763
- const filterQuery = formatReleases({ pageState: { searchTerm, selectedTags } });
2764
- const updateType = type ? `update_type=${type}` : "";
2765
- const sorting = attribute ? `sort=${attribute}:${direction}`.toLowerCase() : "";
2766
- return general_api_default.get(
2767
- `${import_constants4.deploymentsApiUrlV2}/deployments/releases?${[`page=${page}`, `per_page=${perPage}`, filterQuery, updateType, sorting].filter((i) => i).join("&")}`
2768
- );
2769
- };
2770
- var deductSearchState = (receivedReleases, config, total, state) => {
2771
- let releaseListState = { ...state.releasesList };
2772
- const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
2773
- const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers8.customSort)(sort.direction === import_constants4.SORTING_OPTIONS.desc, sort.key));
2774
- const releaseIds = flattenedReleases.map((item) => item.name);
2775
- const isFiltering = !!(selectedTags.length || type || searchTerm);
2776
- if (searchOnly) {
2777
- releaseListState = { ...releaseListState, searchedIds: releaseIds };
2778
- } else {
2779
- releaseListState = {
2780
- ...releaseListState,
2781
- releaseIds,
2782
- searchTotal: isFiltering ? total : state.releasesList.searchTotal,
2783
- total: !isFiltering ? total : state.releasesList.total
2784
- };
2785
- }
2786
- return releaseListState;
2787
- };
2788
- var getReleases = createAppAsyncThunk(`${sliceName}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
2789
- const config = { ...getState().releases.releasesList, ...passedConfig };
2790
- return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
2791
- const total = headers[import_constants4.headerNames.total] ? Number(headers[import_constants4.headerNames.total]) : 0;
2792
- const state = getState().releases;
2793
- const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
2794
- const combinedReleases = { ...state.byId, ...flatReleases };
2795
- const tasks = [dispatch(actions.receiveReleases(combinedReleases))];
2796
- const releaseListState = deductSearchState(receivedReleases, config, total, state);
2797
- tasks.push(dispatch(actions.setReleaseListState(releaseListState)));
2798
- return Promise.all(tasks);
2799
- }).catch((err) => commonErrorHandler(err, `Please check your connection`, dispatch));
2800
- });
2801
- var getRelease = createAppAsyncThunk(`${sliceName}/getReleases`, async (name, { dispatch, getState }) => {
2802
- const releaseResponse = await general_api_default.get(`${import_constants4.deploymentsApiUrlV2}/deployments/releases/${name}`);
2803
- const { data: release } = releaseResponse;
2804
- if (release) {
2805
- const stateRelease = getReleasesById(getState())[release.name] || {};
2806
- await dispatch(actions.receiveRelease(flattenRelease(release, stateRelease)));
2807
- }
2808
- return Promise.resolve(null);
2809
- });
2810
- var updateReleaseInfo = createAppAsyncThunk(
2811
- `${sliceName}/updateReleaseInfo`,
2812
- ({ name, info }, { dispatch, getState }) => general_api_default.patch(`${import_constants4.deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(
2813
- () => Promise.all([
2814
- dispatch(actions.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
2815
- dispatch(setSnackbar2({ message: "Release details were updated successfully.", autoHideDuration: TIMEOUTS.fiveSeconds, action: "" }))
2816
- ])
2817
- )
2818
- );
2819
- var setSingleReleaseTags = createAppAsyncThunk(
2820
- `${sliceName}/setSingleReleaseTags`,
2821
- ({ name, tags }, { dispatch, getState }) => general_api_default.put(`${import_constants4.deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).then(
2822
- () => Promise.resolve(dispatch(actions.receiveRelease({ ...getReleasesById(getState())[name], name, tags })))
2823
- )
2824
- );
2825
- var setReleaseTags = createAppAsyncThunk(
2826
- `${sliceName}/setReleaseTags`,
2827
- ({ name, tags = [] }, { dispatch }) => dispatch(setSingleReleaseTags({ name, tags })).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(() => Promise.resolve(dispatch(setSnackbar2({ message: "Release tags were set successfully.", autoHideDuration: TIMEOUTS.fiveSeconds, action: "" }))))
2828
- );
2829
- var setReleasesTags = createAppAsyncThunk(
2830
- `${sliceName}/setReleasesTags`,
2831
- ({ releases, tags = [] }, { dispatch }) => {
2832
- const addRequests = releases.reduce((accu, release) => {
2833
- accu.push(dispatch(setSingleReleaseTags({ name: release.name, tags: [.../* @__PURE__ */ new Set([...release.tags ? release.tags : [], ...tags])] })));
2834
- return accu;
2835
- }, []);
2836
- return Promise.all(addRequests).catch((err) => commonErrorHandler(err, `Releases couldn't be tagged.`, dispatch)).then(
2837
- () => Promise.resolve(dispatch(setSnackbar2({ message: "Releases were tagged successfully.", autoHideDuration: TIMEOUTS.fiveSeconds, action: "" })))
2838
- );
2839
- }
2840
- );
2841
- var getExistingReleaseTags = createAppAsyncThunk(
2842
- `${sliceName}/getReleaseTags`,
2843
- (_, { dispatch }) => general_api_default.get(`${import_constants4.deploymentsApiUrlV2}/releases/all/tags`).catch((err) => commonErrorHandler(err, `Existing release tags couldn't be retrieved.`, dispatch)).then(({ data: tags }) => Promise.resolve(dispatch(actions.receiveReleaseTags(tags))))
2844
- );
2845
- var getUpdateTypes = createAppAsyncThunk(
2846
- `${sliceName}/getReleaseTypes`,
2847
- (_, { dispatch }) => general_api_default.get(`${import_constants4.deploymentsApiUrlV2}/releases/all/types`).catch((err) => commonErrorHandler(err, `Existing update types couldn't be retrieved.`, dispatch)).then(({ data: types }) => Promise.resolve(dispatch(actions.receiveReleaseTypes(types))))
2848
- );
2849
- var getDeltaGenerationJobs = createAppAsyncThunk(`${sliceName}/getDeltaGenerationJobs`, (options = {}, { dispatch }) => {
2850
- const { page = defaultPage, perPage = defaultPerPage, sort = {} } = options;
2851
- const { key: sortKey, direction: sortDirection } = sort;
2852
- const sortParam = sortKey && sortDirection ? `&sort=${sortKey}:${sortDirection}` : "";
2853
- return general_api_default.get(`${import_constants4.deploymentsApiUrlV2}/deployments/releases/delta/jobs?page=${page}&per_page=${perPage}${sortParam}`).then(({ data, headers }) => {
2854
- const total = Number(headers[import_constants4.headerNames.total]) || data.length;
2855
- const result = { jobs: data, total };
2856
- return Promise.all([dispatch(actions.receivedDeltaJobs(result)), result]);
2857
- }).catch((err) => commonErrorHandler(err, "There was an error retrieving delta generation jobs:", dispatch));
2858
- });
2859
- var getDeltaGenerationJobDetails = createAppAsyncThunk(
2860
- `${sliceName}/getDeltaGenerationJobDetails`,
2861
- (jobId, { dispatch }) => general_api_default.get(`${import_constants4.deploymentsApiUrlV2}/deployments/releases/delta/jobs/${jobId}`).then(({ data }) => dispatch(actions.receivedDeltaJobDetails({ ...data, id: jobId }))).catch((err) => commonErrorHandler(err, "There was an error retrieving delta generation job details:", dispatch))
2862
- );
2863
- // Annotate the CommonJS export names for ESM import in node:
2864
- 0 && (module.exports = {
2865
- cancelFileUpload,
2866
- createArtifact,
2867
- editArtifact,
2868
- getArtifactInstallCount,
2869
- getArtifactUrl,
2870
- getDeltaGenerationJobDetails,
2871
- getDeltaGenerationJobs,
2872
- getExistingReleaseTags,
2873
- getRelease,
2874
- getReleases,
2875
- getUpdateTypes,
2876
- removeArtifact,
2877
- removeRelease,
2878
- removeReleases,
2879
- selectRelease,
2880
- setReleaseTags,
2881
- setReleasesListState,
2882
- setReleasesTags,
2883
- setSingleReleaseTags,
2884
- updateReleaseInfo,
2885
- uploadArtifact
2886
- });
51
+ const findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduce((accu, item) => {
52
+ const index = item.artifacts?.findIndex((releaseArtifact) => releaseArtifact.id === id) ?? -1;
53
+ if (index > -1) accu = {
54
+ release: item,
55
+ index
56
+ };
57
+ return accu;
58
+ }, {
59
+ release: null,
60
+ index: -1
61
+ });
62
+ const getArtifactInstallCount = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
63
+ const { release, index } = findArtifactIndexInRelease(require_releasesSlice_selectors.getReleasesById(getState()), id);
64
+ if (!release || index === -1) return;
65
+ const artifact = [...release.artifacts][index];
66
+ const { key, name, version } = (0, _northern_tech_utils_helpers.extractSoftwareItem)(artifact.artifact_provides) ?? {};
67
+ const attribute = `${key}${name ? `.${name}` : ""}.version`;
68
+ const { filterTerms } = require_utils.convertDeviceListStateToFilters({ filters: [{
69
+ ...require_constants.emptyFilter,
70
+ key: attribute,
71
+ value: version,
72
+ scope: "inventory"
73
+ }] });
74
+ return require_api_general_api.default.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/search`, {
75
+ page: 1,
76
+ per_page: 1,
77
+ filters: filterTerms,
78
+ attributes: [{
79
+ scope: "identity",
80
+ attribute: "status"
81
+ }]
82
+ }).catch((err) => require_store.commonErrorHandler(err, `Retrieving artifact installation count failed:`, dispatch, require_store.commonErrorFallback)).then(({ headers }) => {
83
+ const foundRelease = findArtifactIndexInRelease(require_releasesSlice_selectors.getReleasesById(getState()), id);
84
+ const index = foundRelease.index;
85
+ let release = foundRelease.release;
86
+ if (!release || index === -1) return;
87
+ const installCount = Number(headers[_northern_tech_utils_constants.headerNames.total]);
88
+ const releaseArtifacts = [...release.artifacts];
89
+ releaseArtifacts[index] = {
90
+ ...releaseArtifacts[index],
91
+ installCount
92
+ };
93
+ release = {
94
+ ...release,
95
+ artifacts: releaseArtifacts
96
+ };
97
+ return dispatch(require_releasesSlice_index.actions.receiveRelease(release));
98
+ });
99
+ });
100
+ const getArtifactUrl = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getArtifactUrl`, async (id, { dispatch, getState }) => {
101
+ const response = await require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrl}/artifacts/${id}/download`);
102
+ const foundRelease = findArtifactIndexInRelease(require_releasesSlice_selectors.getReleasesById(getState()), id);
103
+ const index = foundRelease.index;
104
+ let release = foundRelease.release;
105
+ if (!release || index === -1) return dispatch(getReleases());
106
+ const releaseArtifacts = [...release.artifacts];
107
+ releaseArtifacts[index] = {
108
+ ...releaseArtifacts[index],
109
+ url: response.data.uri
110
+ };
111
+ release = {
112
+ ...release,
113
+ artifacts: releaseArtifacts
114
+ };
115
+ await dispatch(require_releasesSlice_index.actions.receiveRelease(release));
116
+ return response.data.uri;
117
+ });
118
+ const pollLocation = async (location, attempt = 1, maxAttempts = 5, delay = require_constants.TIMEOUTS.oneSecond) => {
119
+ try {
120
+ await require_api_general_api.default.get(location);
121
+ return Promise.resolve();
122
+ } catch {
123
+ if (attempt >= maxAttempts) throw new Error(`Couldn't get ${location} after ${maxAttempts} attempts`);
124
+ await new Promise((resolve) => setTimeout(resolve, delay));
125
+ return pollLocation(location, attempt + 1, maxAttempts, delay);
126
+ }
127
+ };
128
+ const createArtifact = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/createArtifact`, ({ file, meta }, { dispatch }) => {
129
+ const formData = Object.entries(meta).reduce((accu, [key, value]) => {
130
+ if (Array.isArray(value)) accu.append(key, value.join(","));
131
+ else if (value instanceof Object) accu.append(key, JSON.stringify(value));
132
+ else accu.append(key, value);
133
+ return accu;
134
+ }, new FormData());
135
+ formData.append("type", require_releasesSlice_constants.ARTIFACT_GENERATION_TYPE.SINGLE_FILE);
136
+ formData.append("file", file);
137
+ const uploadId = (0, uuid.v4)();
138
+ const cancelSource = new AbortController();
139
+ return Promise.all([
140
+ dispatch(setSnackbar("Generating artifact")),
141
+ dispatch(initUpload({
142
+ id: uploadId,
143
+ upload: {
144
+ name: file.name,
145
+ size: file.size,
146
+ progress: 0,
147
+ cancelSource
148
+ }
149
+ })),
150
+ require_api_general_api.default.upload(`${_northern_tech_utils_constants.deploymentsApiUrl}/artifacts/generate`, formData, (e) => dispatch(uploadProgress({
151
+ id: uploadId,
152
+ progress: require_utils.progress(e)
153
+ })), cancelSource.signal)
154
+ ]).then((tasks) => {
155
+ return pollLocation(tasks[tasks.length - 1].headers[_northern_tech_utils_constants.headerNames.location].replace("/generate", ""));
156
+ }).then(() => Promise.all([
157
+ dispatch(getReleases()),
158
+ dispatch(selectRelease(meta.name)),
159
+ dispatch(setSnackbar({
160
+ message: "Upload successful",
161
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
162
+ }))
163
+ ])).catch((err) => {
164
+ if ((0, axios.isCancel)(err)) return dispatch(setSnackbar({
165
+ message: "The artifact generation has been cancelled",
166
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
167
+ }));
168
+ return require_store.commonErrorHandler(err, `Artifact couldn't be generated.`, dispatch);
169
+ }).finally(() => dispatch(cleanUpUpload(uploadId)));
170
+ });
171
+ const uploadArtifact = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/uploadArtifact`, ({ file, meta }, { dispatch }) => {
172
+ const formData = new FormData();
173
+ formData.append("size", file.size.toString());
174
+ formData.append("description", meta.description);
175
+ formData.append("artifact", file);
176
+ const uploadId = (0, uuid.v4)();
177
+ const cancelSource = new AbortController();
178
+ return Promise.all([
179
+ dispatch(setSnackbar("Uploading artifact")),
180
+ dispatch(initUpload({
181
+ id: uploadId,
182
+ upload: {
183
+ name: file.name,
184
+ size: file.size,
185
+ progress: 0,
186
+ cancelSource
187
+ }
188
+ })),
189
+ require_api_general_api.default.upload(`${_northern_tech_utils_constants.deploymentsApiUrl}/artifacts`, formData, (e) => dispatch(uploadProgress({
190
+ id: uploadId,
191
+ progress: require_utils.progress(e)
192
+ })), cancelSource.signal)
193
+ ]).then(() => {
194
+ const tasks = [Promise.resolve(dispatch(setSnackbar({
195
+ message: "Upload successful",
196
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
197
+ }))), dispatch(getReleases())];
198
+ if (meta.name) tasks.push(dispatch(selectRelease(meta.name)));
199
+ return Promise.all(tasks);
200
+ }).catch((err) => {
201
+ if ((0, axios.isCancel)(err)) return dispatch(setSnackbar({
202
+ message: "The upload has been cancelled",
203
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
204
+ }));
205
+ return require_store.commonErrorHandler(err, `Artifact couldn't be uploaded.`, dispatch);
206
+ }).finally(() => dispatch(cleanUpUpload(uploadId)));
207
+ });
208
+ const cancelFileUpload = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/cancelFileUpload`, (id, { dispatch, getState }) => {
209
+ const { [id]: current } = getState().app.uploadsById;
210
+ current.cancelSource.abort();
211
+ return Promise.resolve(dispatch(cleanUpUpload(id)));
212
+ });
213
+ const editArtifact = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/editArtifact`, async ({ id, body }, { dispatch, getState }) => {
214
+ await require_api_general_api.default.put(`${_northern_tech_utils_constants.deploymentsApiUrl}/artifacts/${id}`, body).catch((err) => require_store.commonErrorHandler(err, `Artifact details couldn't be updated.`, dispatch));
215
+ const { release, index } = findArtifactIndexInRelease(require_releasesSlice_selectors.getReleasesById(getState()), id);
216
+ if (!release || index === -1) {
217
+ await dispatch(getReleases());
218
+ return;
219
+ }
220
+ const updatedRelease = {
221
+ ...release,
222
+ artifacts: release.artifacts.map((artifact, i) => i === index ? {
223
+ ...artifact,
224
+ description: body.description || ""
225
+ } : artifact)
226
+ };
227
+ await Promise.all([
228
+ dispatch(require_releasesSlice_index.actions.receiveRelease(updatedRelease)),
229
+ dispatch(setSnackbar({
230
+ message: "Artifact details were updated successfully.",
231
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds,
232
+ action: ""
233
+ })),
234
+ dispatch(getRelease(release.name)),
235
+ dispatch(selectRelease(release.name))
236
+ ]);
237
+ });
238
+ const removeArtifact = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/removeArtifact`, async (id, { dispatch, getState }) => {
239
+ await require_api_general_api.default.delete(`${_northern_tech_utils_constants.deploymentsApiUrl}/artifacts/${id}`).catch((err) => require_store.commonErrorHandler(err, `Error removing artifact:`, dispatch));
240
+ const state = getState();
241
+ const { release, index } = findArtifactIndexInRelease(require_releasesSlice_selectors.getReleasesById(state), id);
242
+ if (!release || index === -1) {
243
+ await dispatch(getReleases());
244
+ return;
245
+ }
246
+ const releaseArtifacts = [...release.artifacts];
247
+ releaseArtifacts.splice(index, 1);
248
+ if (!releaseArtifacts.length) {
249
+ const { releasesList } = state.releases;
250
+ const releaseIds = releasesList.releaseIds.filter((id) => release.name !== id);
251
+ await Promise.all([dispatch(require_releasesSlice_index.actions.removeRelease(release.name)), dispatch(setReleasesListState({
252
+ releaseIds,
253
+ searchTotal: releasesList.searchTerm ? releasesList.searchTotal - 1 : releasesList.searchTotal,
254
+ total: releasesList.total - 1
255
+ }))]);
256
+ return;
257
+ }
258
+ await Promise.all([dispatch(setSnackbar({
259
+ message: "Artifact was removed",
260
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds,
261
+ action: ""
262
+ })), dispatch(require_releasesSlice_index.actions.receiveRelease(release))]);
263
+ });
264
+ const removeRelease = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/removeRelease`, (releaseId, { dispatch, getState }) => Promise.all(require_releasesSlice_selectors.getReleasesById(getState())[releaseId].artifacts.map(({ id }) => dispatch(removeArtifact(id)))).then(() => dispatch(selectRelease(null))));
265
+ const removeReleases = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/removeReleases`, (releaseIds, { dispatch, getState }) => {
266
+ const deleteRequests = releaseIds.reduce((accu, releaseId) => {
267
+ const releaseArtifacts = require_releasesSlice_selectors.getReleasesById(getState())[releaseId].artifacts;
268
+ accu.push(...releaseArtifacts.map(({ id }) => dispatch(removeArtifact(id)).unwrap()));
269
+ return accu;
270
+ }, []);
271
+ return Promise.all(deleteRequests);
272
+ });
273
+ const selectRelease = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/selectRelease`, (release, { dispatch }) => {
274
+ const name = (release && typeof release === "object" ? release.name : release) || null;
275
+ const tasks = [Promise.resolve(dispatch(require_releasesSlice_index.actions.selectedRelease(name)))];
276
+ if (name) tasks.push(dispatch(getRelease(name)));
277
+ return Promise.all(tasks);
278
+ });
279
+ const setReleasesListState = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
280
+ const currentState = getState().releases.releasesList;
281
+ const nextState = {
282
+ ...currentState,
283
+ ...selectionState,
284
+ sort: {
285
+ ...currentState.sort,
286
+ ...selectionState.sort
287
+ }
288
+ };
289
+ const tasks = [];
290
+ const { isLoading: currentLoading, ...currentRequestState } = currentState;
291
+ const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
292
+ if (!(0, _northern_tech_utils_helpers.deepCompare)(currentRequestState, selectionRequestState)) {
293
+ nextState.isLoading = true;
294
+ tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
295
+ }
296
+ if (!nextState.searchOnly && (currentState.page !== nextState.page || currentState.perPage > nextState.perPage || !(0, _northern_tech_utils_helpers.deepCompare)(currentState.sort, nextState.sort))) nextState.selection = [];
297
+ tasks.push(Promise.resolve(dispatch(require_releasesSlice_index.actions.setReleaseListState(nextState))));
298
+ return Promise.all(tasks);
299
+ });
300
+ const releaseListRetrieval = (config) => {
301
+ const { searchTerm = "", page = defaultPage, perPage = defaultPerPage, sort = sortingDefaults, selectedTags = [], type = "" } = config;
302
+ const { key: attribute, direction } = sort;
303
+ const filterQuery = require_locationutils.formatReleases({ pageState: {
304
+ searchTerm,
305
+ selectedTags
306
+ } });
307
+ const updateType = type ? `update_type=${type}` : "";
308
+ const sorting = attribute ? `sort=${attribute}:${direction}`.toLowerCase() : "";
309
+ return require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases?${[
310
+ `page=${page}`,
311
+ `per_page=${perPage}`,
312
+ filterQuery,
313
+ updateType,
314
+ sorting
315
+ ].filter((i) => i).join("&")}`);
316
+ };
317
+ const deductSearchState = (receivedReleases, config, total, state) => {
318
+ let releaseListState = { ...state.releasesList };
319
+ const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
320
+ const releaseIds = Object.values(receivedReleases).sort((0, _northern_tech_utils_helpers.customSort)(sort.direction === _northern_tech_utils_constants.SORTING_OPTIONS.desc, sort.key)).map((item) => item.name);
321
+ const isFiltering = !!(selectedTags.length || type || searchTerm);
322
+ if (searchOnly) releaseListState = {
323
+ ...releaseListState,
324
+ searchedIds: releaseIds
325
+ };
326
+ else releaseListState = {
327
+ ...releaseListState,
328
+ releaseIds,
329
+ searchTotal: isFiltering ? total : state.releasesList.searchTotal,
330
+ total: !isFiltering ? total : state.releasesList.total
331
+ };
332
+ return releaseListState;
333
+ };
334
+ const getReleases = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
335
+ const config = {
336
+ ...getState().releases.releasesList,
337
+ ...passedConfig
338
+ };
339
+ return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
340
+ const total = headers[_northern_tech_utils_constants.headerNames.total] ? Number(headers[_northern_tech_utils_constants.headerNames.total]) : 0;
341
+ const state = getState().releases;
342
+ const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
343
+ const combinedReleases = {
344
+ ...state.byId,
345
+ ...flatReleases
346
+ };
347
+ const tasks = [Promise.resolve(dispatch(require_releasesSlice_index.actions.receiveReleases(combinedReleases)))];
348
+ const releaseListState = deductSearchState(receivedReleases, config, total, state);
349
+ tasks.push(Promise.resolve(dispatch(require_releasesSlice_index.actions.setReleaseListState(releaseListState))));
350
+ return Promise.all(tasks);
351
+ }).catch((err) => require_store.commonErrorHandler(err, `Please check your connection`, dispatch));
352
+ });
353
+ const getRelease = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getReleases`, async (name, { dispatch, getState }) => {
354
+ const { data: release } = await require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases/${name}`);
355
+ if (release) {
356
+ const stateRelease = require_releasesSlice_selectors.getReleasesById(getState())[release.name] || {};
357
+ await dispatch(require_releasesSlice_index.actions.receiveRelease(flattenRelease(release, stateRelease)));
358
+ }
359
+ return Promise.resolve(null);
360
+ });
361
+ const updateReleaseInfo = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/updateReleaseInfo`, ({ name, info }, { dispatch, getState }) => require_api_general_api.default.patch(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => require_store.commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(() => Promise.all([dispatch(require_releasesSlice_index.actions.receiveRelease({
362
+ ...require_releasesSlice_selectors.getReleasesById(getState())[name],
363
+ ...info,
364
+ name
365
+ })), dispatch(setSnackbar({
366
+ message: "Release details were updated successfully.",
367
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds,
368
+ action: ""
369
+ }))])));
370
+ const setSingleReleaseTags = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/setSingleReleaseTags`, ({ name, tags }, { dispatch, getState }) => require_api_general_api.default.put(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).then(() => Promise.resolve(dispatch(require_releasesSlice_index.actions.receiveRelease({
371
+ ...require_releasesSlice_selectors.getReleasesById(getState())[name],
372
+ name,
373
+ tags
374
+ })))));
375
+ const setReleaseTags = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/setReleaseTags`, ({ name, tags = [] }, { dispatch }) => dispatch(setSingleReleaseTags({
376
+ name,
377
+ tags
378
+ })).catch((err) => require_store.commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(() => Promise.resolve(dispatch(setSnackbar({
379
+ message: "Release tags were set successfully.",
380
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds,
381
+ action: ""
382
+ })))));
383
+ const setReleasesTags = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/setReleasesTags`, ({ releases, tags = [] }, { dispatch }) => {
384
+ const addRequests = releases.reduce((accu, release) => {
385
+ accu.push(dispatch(setSingleReleaseTags({
386
+ name: release.name,
387
+ tags: [...new Set([...release.tags ? release.tags : [], ...tags])]
388
+ })));
389
+ return accu;
390
+ }, []);
391
+ return Promise.all(addRequests).catch((err) => require_store.commonErrorHandler(err, `Releases couldn't be tagged.`, dispatch)).then(() => Promise.resolve(dispatch(setSnackbar({
392
+ message: "Releases were tagged successfully.",
393
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds,
394
+ action: ""
395
+ }))));
396
+ });
397
+ const getExistingReleaseTags = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getReleaseTags`, (_, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/releases/all/tags`).catch((err) => require_store.commonErrorHandler(err, `Existing release tags couldn't be retrieved.`, dispatch)).then(({ data: tags }) => Promise.resolve(dispatch(require_releasesSlice_index.actions.receiveReleaseTags(tags)))));
398
+ const getUpdateTypes = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getReleaseTypes`, (_, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/releases/all/types`).catch((err) => require_store.commonErrorHandler(err, `Existing update types couldn't be retrieved.`, dispatch)).then(({ data: types }) => Promise.resolve(dispatch(require_releasesSlice_index.actions.receiveReleaseTypes(types)))));
399
+ const getDeltaGenerationJobs = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getDeltaGenerationJobs`, (options = {}, { dispatch }) => {
400
+ const { page = defaultPage, perPage = defaultPerPage, sort = {} } = options;
401
+ const { key: sortKey, direction: sortDirection } = sort;
402
+ const sortParam = sortKey && sortDirection ? `&sort=${sortKey}:${sortDirection}` : "";
403
+ return require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases/delta/jobs?page=${page}&per_page=${perPage}${sortParam}`).then(({ data, headers }) => {
404
+ const result = {
405
+ jobs: data,
406
+ total: Number(headers[_northern_tech_utils_constants.headerNames.total]) || data.length
407
+ };
408
+ return Promise.all([dispatch(require_releasesSlice_index.actions.receivedDeltaJobs(result)), result]);
409
+ }).catch((err) => require_store.commonErrorHandler(err, "There was an error retrieving delta generation jobs:", dispatch));
410
+ });
411
+ const getDeltaGenerationJobDetails = require_store.createAppAsyncThunk(`${require_releasesSlice_index.sliceName}/getDeltaGenerationJobDetails`, (jobId, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments/releases/delta/jobs/${jobId}`).then(({ data }) => dispatch(require_releasesSlice_index.actions.receivedDeltaJobDetails({
412
+ ...data,
413
+ id: jobId
414
+ }))).catch((err) => require_store.commonErrorHandler(err, "There was an error retrieving delta generation job details:", dispatch)));
415
+ //#endregion
416
+ exports.cancelFileUpload = cancelFileUpload;
417
+ exports.createArtifact = createArtifact;
418
+ exports.editArtifact = editArtifact;
419
+ exports.getArtifactInstallCount = getArtifactInstallCount;
420
+ exports.getArtifactUrl = getArtifactUrl;
421
+ exports.getDeltaGenerationJobDetails = getDeltaGenerationJobDetails;
422
+ exports.getDeltaGenerationJobs = getDeltaGenerationJobs;
423
+ exports.getExistingReleaseTags = getExistingReleaseTags;
424
+ exports.getRelease = getRelease;
425
+ exports.getReleases = getReleases;
426
+ exports.getUpdateTypes = getUpdateTypes;
427
+ exports.removeArtifact = removeArtifact;
428
+ exports.removeRelease = removeRelease;
429
+ exports.removeReleases = removeReleases;
430
+ exports.selectRelease = selectRelease;
431
+ exports.setReleaseTags = setReleaseTags;
432
+ exports.setReleasesListState = setReleasesListState;
433
+ exports.setReleasesTags = setReleasesTags;
434
+ exports.setSingleReleaseTags = setSingleReleaseTags;
435
+ exports.updateReleaseInfo = updateReleaseInfo;
436
+ exports.uploadArtifact = uploadArtifact;
437
+
2887
438
  //# sourceMappingURL=thunks.cjs.map