@northern.tech/store 0.41.3 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/actions.d.cts +10 -11
  2. package/dist/actions.d.ts +10 -11
  3. package/dist/api/general-api.cjs +1 -1
  4. package/dist/api/general-api.cjs.map +1 -1
  5. package/dist/api/general-api.d.cts +0 -1
  6. package/dist/api/general-api.d.ts +0 -1
  7. package/dist/api/general-api.js +1 -1
  8. package/dist/api/users-api.cjs +1 -1
  9. package/dist/api/users-api.d.cts +1 -6
  10. package/dist/api/users-api.d.ts +1 -6
  11. package/dist/appSlice/constants.cjs +0 -5
  12. package/dist/appSlice/constants.cjs.map +1 -1
  13. package/dist/appSlice/constants.d.cts +1 -1
  14. package/dist/appSlice/constants.d.ts +1 -1
  15. package/dist/appSlice/constants.js +0 -5
  16. package/dist/appSlice/constants.js.map +1 -1
  17. package/dist/appSlice/index.cjs.map +1 -1
  18. package/dist/appSlice/index.d.cts +1 -1
  19. package/dist/appSlice/index.d.ts +1 -1
  20. package/dist/appSlice/index.js +1 -1
  21. package/dist/appSlice/mocks.d.cts +1 -2
  22. package/dist/appSlice/mocks.d.ts +1 -2
  23. package/dist/appSlice/selectors.cjs.map +1 -1
  24. package/dist/appSlice/selectors.d.cts +9 -10
  25. package/dist/appSlice/selectors.d.ts +9 -10
  26. package/dist/appSlice/thunks.d.cts +2 -3
  27. package/dist/appSlice/thunks.d.ts +2 -3
  28. package/dist/auth.cjs +1 -1
  29. package/dist/auth.d.cts +3 -10
  30. package/dist/auth.d.ts +3 -10
  31. package/dist/auth.js +1 -1
  32. package/dist/commonConstants.d.cts +1 -1
  33. package/dist/commonConstants.d.ts +1 -1
  34. package/dist/commonConstants.js +1 -1
  35. package/dist/commonSelectors.cjs +4 -3
  36. package/dist/commonSelectors.cjs.map +1 -1
  37. package/dist/commonSelectors.d.cts +20 -21
  38. package/dist/commonSelectors.d.ts +20 -21
  39. package/dist/commonSelectors.js +4 -3
  40. package/dist/commonSelectors.js.map +1 -1
  41. package/dist/{constants-Sn4gnNA3.d.ts → constants-B3Jdkn2b.d.cts} +2 -5
  42. package/dist/{constants-Sn4gnNA3.d.cts → constants-B3Jdkn2b.d.ts} +2 -5
  43. package/dist/{constants-CzjK2gV-.d.ts → constants-B_H4squx.d.ts} +4 -4
  44. package/dist/{constants-D9o0Cnk_.d.ts → constants-C6TIYaY4.d.cts} +1 -2
  45. package/dist/{constants-D9o0Cnk_.d.cts → constants-C6TIYaY4.d.ts} +1 -2
  46. package/dist/{constants-6kYRTdox.d.ts → constants-CEwun8TL.d.cts} +3 -2
  47. package/dist/{constants-6kYRTdox.d.cts → constants-CEwun8TL.d.ts} +3 -2
  48. package/dist/constants-C_SC_VKE.cjs.map +1 -1
  49. package/dist/{constants-xpheFFkA.js → constants-CerzXHnQ.js} +3 -3
  50. package/dist/{constants-xpheFFkA.js.map → constants-CerzXHnQ.js.map} +1 -1
  51. package/dist/{constants-DAi2zOZN.d.cts → constants-Rl3FJzFf.d.cts} +4 -4
  52. package/dist/{constants-B_7FCJQX.d.ts → constants-nKSWZ8oD.d.cts} +3 -8
  53. package/dist/{constants-B_7FCJQX.d.cts → constants-nKSWZ8oD.d.ts} +3 -8
  54. package/dist/constants.cjs +2 -0
  55. package/dist/constants.d.cts +6 -6
  56. package/dist/constants.d.ts +6 -6
  57. package/dist/constants.js +3 -3
  58. package/dist/deploymentsSlice/constants.d.cts +1 -1
  59. package/dist/deploymentsSlice/constants.d.ts +1 -1
  60. package/dist/deploymentsSlice/constants.js +1 -1
  61. package/dist/deploymentsSlice/index.cjs.map +1 -1
  62. package/dist/deploymentsSlice/index.d.cts +1 -1
  63. package/dist/deploymentsSlice/index.d.ts +1 -1
  64. package/dist/deploymentsSlice/index.js +1 -1
  65. package/dist/deploymentsSlice/mocks.d.cts +1 -2
  66. package/dist/deploymentsSlice/mocks.d.ts +1 -2
  67. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  68. package/dist/deploymentsSlice/selectors.d.cts +9 -10
  69. package/dist/deploymentsSlice/selectors.d.ts +9 -10
  70. package/dist/deploymentsSlice/selectors.js +1 -1
  71. package/dist/deploymentsSlice/thunks.d.cts +7 -13
  72. package/dist/deploymentsSlice/thunks.d.ts +7 -13
  73. package/dist/devicesSlice/constants.d.cts +1 -1
  74. package/dist/devicesSlice/constants.d.ts +1 -1
  75. package/dist/devicesSlice/constants.js +1 -1
  76. package/dist/devicesSlice/index.cjs +5 -2
  77. package/dist/devicesSlice/index.cjs.map +1 -1
  78. package/dist/devicesSlice/index.d.cts +2 -2
  79. package/dist/devicesSlice/index.d.ts +2 -2
  80. package/dist/devicesSlice/index.js +6 -3
  81. package/dist/devicesSlice/index.js.map +1 -1
  82. package/dist/devicesSlice/mocks.d.cts +1 -0
  83. package/dist/devicesSlice/mocks.d.ts +1 -0
  84. package/dist/devicesSlice/mocks.js +1 -1
  85. package/dist/devicesSlice/selectors.cjs +2 -0
  86. package/dist/devicesSlice/selectors.cjs.map +1 -1
  87. package/dist/devicesSlice/selectors.d.cts +41 -41
  88. package/dist/devicesSlice/selectors.d.ts +41 -41
  89. package/dist/devicesSlice/selectors.js +3 -2
  90. package/dist/devicesSlice/selectors.js.map +1 -1
  91. package/dist/devicesSlice/thunks.cjs +1 -2
  92. package/dist/devicesSlice/thunks.d.cts +13 -25
  93. package/dist/devicesSlice/thunks.d.ts +13 -25
  94. package/dist/devicesSlice/thunks.js +2 -2
  95. package/dist/{index-Bb4yvvgG.d.ts → index-B8td4-rY.d.ts} +1 -2
  96. package/dist/{index-C5oQrJGU.d.ts → index-BAGyeC-q.d.ts} +2 -3
  97. package/dist/{index-CgPgKMve.d.cts → index-BgF6rhXn.d.cts} +3 -4
  98. package/dist/{index-BtGhTFBc.d.ts → index-BpamudGf.d.ts} +15 -17
  99. package/dist/{index-CnH51JfB.d.ts → index-Bs0c1-WY.d.ts} +4 -9
  100. package/dist/{index-m1c0qk2s.d.ts → index-C8uiyxnb.d.ts} +2 -3
  101. package/dist/{index-CSOj22xK.d.cts → index-C_LGDJN2.d.cts} +2 -3
  102. package/dist/{index-H9zg_3UV.d.ts → index-ChKTa1aL.d.ts} +2 -3
  103. package/dist/{index-DBUt8xVc.d.ts → index-CoObjWL4.d.cts} +1 -2
  104. package/dist/{index-DBUt8xVc.d.cts → index-CoObjWL4.d.ts} +1 -2
  105. package/dist/{index-BCErsO5h.d.ts → index-CpfhQHfg.d.ts} +3 -4
  106. package/dist/{index-BQCnJ5gh.d.cts → index-Ctj2r57a.d.cts} +2 -3
  107. package/dist/{index-Dn1SqQYh.d.cts → index-DeOpb2oK.d.cts} +4 -9
  108. package/dist/{index-VEayiYkv.d.cts → index-DiAjzARZ.d.cts} +2 -3
  109. package/dist/{index-vXsWdis1.d.cts → index-DnKVKM0G.d.cts} +15 -17
  110. package/dist/{index-EPmsL6Lb.d.cts → index-mvxjivTJ.d.cts} +1 -2
  111. package/dist/liststatehook.cjs.map +1 -1
  112. package/dist/liststatehook.d.cts +0 -1
  113. package/dist/liststatehook.d.ts +0 -1
  114. package/dist/locationutils.cjs.map +1 -1
  115. package/dist/locationutils.d.cts +14 -67
  116. package/dist/locationutils.d.ts +14 -67
  117. package/dist/locationutils.js +1 -1
  118. package/dist/monitorSlice/constants.d.cts +1 -1
  119. package/dist/monitorSlice/constants.d.ts +1 -1
  120. package/dist/monitorSlice/index.cjs.map +1 -1
  121. package/dist/monitorSlice/index.d.cts +1 -1
  122. package/dist/monitorSlice/index.d.ts +1 -1
  123. package/dist/monitorSlice/index.js +1 -1
  124. package/dist/monitorSlice/mocks.d.cts +1 -2
  125. package/dist/monitorSlice/mocks.d.ts +1 -2
  126. package/dist/monitorSlice/mocks.js +1 -1
  127. package/dist/monitorSlice/selectors.d.cts +1 -2
  128. package/dist/monitorSlice/selectors.d.ts +1 -2
  129. package/dist/monitorSlice/thunks.d.cts +4 -5
  130. package/dist/monitorSlice/thunks.d.ts +4 -5
  131. package/dist/monitorSlice/thunks.js +1 -1
  132. package/dist/onboardingSlice/index.cjs.map +1 -1
  133. package/dist/onboardingSlice/index.d.cts +1 -1
  134. package/dist/onboardingSlice/index.d.ts +1 -1
  135. package/dist/onboardingSlice/mocks.d.cts +1 -2
  136. package/dist/onboardingSlice/mocks.d.ts +1 -2
  137. package/dist/onboardingSlice/selectors.d.cts +2 -3
  138. package/dist/onboardingSlice/selectors.d.ts +2 -3
  139. package/dist/onboardingSlice/thunks.d.cts +4 -4
  140. package/dist/onboardingSlice/thunks.d.ts +4 -4
  141. package/dist/organizationSlice/constants.js +1 -1
  142. package/dist/organizationSlice/index.cjs.map +1 -1
  143. package/dist/organizationSlice/index.d.cts +1 -1
  144. package/dist/organizationSlice/index.d.ts +1 -1
  145. package/dist/organizationSlice/index.js +1 -1
  146. package/dist/organizationSlice/mocks.d.cts +3 -3
  147. package/dist/organizationSlice/mocks.d.ts +3 -3
  148. package/dist/organizationSlice/mocks.js +1 -1
  149. package/dist/organizationSlice/selectors.cjs.map +1 -1
  150. package/dist/organizationSlice/selectors.d.cts +11 -16
  151. package/dist/organizationSlice/selectors.d.ts +11 -16
  152. package/dist/organizationSlice/selectors.js +1 -1
  153. package/dist/organizationSlice/thunks.d.cts +6 -7
  154. package/dist/organizationSlice/thunks.d.ts +6 -7
  155. package/dist/organizationSlice/types.d.cts +1 -1
  156. package/dist/organizationSlice/types.d.ts +1 -1
  157. package/dist/releasesSlice/constants.cjs +2 -0
  158. package/dist/releasesSlice/constants.cjs.map +1 -1
  159. package/dist/releasesSlice/constants.d.cts +2 -2
  160. package/dist/releasesSlice/constants.d.ts +2 -2
  161. package/dist/releasesSlice/constants.js +2 -1
  162. package/dist/releasesSlice/constants.js.map +1 -1
  163. package/dist/releasesSlice/index.cjs.map +1 -1
  164. package/dist/releasesSlice/index.d.cts +1 -1
  165. package/dist/releasesSlice/index.d.ts +1 -1
  166. package/dist/releasesSlice/index.js +1 -1
  167. package/dist/releasesSlice/mocks.js +1 -1
  168. package/dist/releasesSlice/selectors.cjs.map +1 -1
  169. package/dist/releasesSlice/selectors.d.cts +9 -10
  170. package/dist/releasesSlice/selectors.d.ts +9 -10
  171. package/dist/releasesSlice/thunks.cjs +1 -1
  172. package/dist/releasesSlice/thunks.cjs.map +1 -1
  173. package/dist/releasesSlice/thunks.d.cts +4 -5
  174. package/dist/releasesSlice/thunks.d.ts +4 -5
  175. package/dist/releasesSlice/thunks.js +1 -1
  176. package/dist/{rolldown-runtime-D6vf50IK.cjs → rolldown-runtime-VH7oDXx4.cjs} +1 -1
  177. package/dist/selectors.cjs +1 -0
  178. package/dist/selectors.d.cts +2 -2
  179. package/dist/selectors.d.ts +2 -2
  180. package/dist/selectors.js +2 -2
  181. package/dist/sockethook.cjs +1 -2
  182. package/dist/sockethook.cjs.map +1 -1
  183. package/dist/sockethook.d.cts +1 -8
  184. package/dist/sockethook.d.ts +1 -8
  185. package/dist/sockethook.js +1 -2
  186. package/dist/sockethook.js.map +1 -1
  187. package/dist/{store-CkgokFlk.d.ts → store-B2_hrsgP.d.ts} +27 -48
  188. package/dist/{store-CGP5pCH8.d.cts → store-DquBGT7j.d.cts} +27 -48
  189. package/dist/store.cjs.map +1 -1
  190. package/dist/store.d.cts +1 -1
  191. package/dist/store.d.ts +1 -1
  192. package/dist/store.js +1 -1
  193. package/dist/storehooks.cjs +31 -20
  194. package/dist/storehooks.cjs.map +1 -1
  195. package/dist/storehooks.d.cts +13 -4
  196. package/dist/storehooks.d.ts +13 -4
  197. package/dist/storehooks.js +32 -22
  198. package/dist/storehooks.js.map +1 -1
  199. package/dist/thunks.cjs +16 -107
  200. package/dist/thunks.cjs.map +1 -1
  201. package/dist/thunks.d.cts +2 -2
  202. package/dist/thunks.d.ts +2 -2
  203. package/dist/thunks.js +16 -106
  204. package/dist/thunks.js.map +1 -1
  205. package/dist/{types-uHmaedGU.d.ts → types-B3qGQoMx.d.ts} +3 -4
  206. package/dist/{types-yQ0ypHMZ.d.cts → types-B80ckxiy.d.cts} +3 -4
  207. package/dist/useDeploymentDevice.cjs +1 -1
  208. package/dist/useDeploymentDevice.cjs.map +1 -1
  209. package/dist/usersSlice/constants.d.cts +1 -1
  210. package/dist/usersSlice/constants.d.ts +1 -1
  211. package/dist/usersSlice/constants.js +1 -1
  212. package/dist/usersSlice/index.cjs.map +1 -1
  213. package/dist/usersSlice/index.d.cts +1 -1
  214. package/dist/usersSlice/index.d.ts +1 -1
  215. package/dist/usersSlice/index.js +1 -1
  216. package/dist/usersSlice/mocks.d.cts +2 -3
  217. package/dist/usersSlice/mocks.d.ts +2 -3
  218. package/dist/usersSlice/mocks.js +1 -1
  219. package/dist/usersSlice/selectors.cjs.map +1 -1
  220. package/dist/usersSlice/selectors.d.cts +10 -11
  221. package/dist/usersSlice/selectors.d.ts +10 -11
  222. package/dist/usersSlice/selectors.js +1 -1
  223. package/dist/usersSlice/thunks.d.cts +5 -6
  224. package/dist/usersSlice/thunks.d.ts +5 -6
  225. package/dist/utils.cjs +2 -2
  226. package/dist/utils.cjs.map +1 -1
  227. package/dist/utils.d.cts +1 -1
  228. package/dist/utils.d.ts +1 -1
  229. package/dist/utils.js +3 -3
  230. package/dist/utils.js.map +1 -1
  231. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type {\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: string[];\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => (accu += tieredCount), 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAkCA,MAAa,YAAY;AA+FzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GA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nG,OAAO,OAAO,aAAa,CAAC,CAAc,SAAS,OAAO,MAAM,GAAG;IAC9F,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,CAAC,UAAU,QAAO,OAAM,OAAO,QAAQ;IACtF,MAAM,aAAc,OAAO,WAAW,QAAmB;IACzD,MAAM,SAAS,OAAO,UAAU;KAC9B;KACA,QAAQ;MACN,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n DeviceTierLimits as BackendDeviceTierLimits,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceTierLimits = Omit<BackendDeviceTierLimits, 'test'>;\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n testDeviceLimit: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n testDeviceLimit: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<BackendDeviceTierLimits>) => {\n const { test, ...tiers } = action.payload;\n state.limits = tiers;\n // The test device limit is returned by the tiers endpoint, but we handle it separately.\n state.testDeviceLimit = test || 0;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAmCA,MAAa,YAAY;AAmGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,W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AO,YAAW,QAAQ,OAAO,MAAM,CAAC,CAAC,SAAS,IAAI,UACnG,OAAO,OAAO,aAAa,CAAC,CAAc,SAAS,OAAO,MAAM,GAAG;IAC9F,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,CAAC,UAAU,QAAO,OAAM,OAAO,QAAQ;IACtF,MAAM,aAAc,OAAO,WAAW,QAAmB;IACzD,MAAM,SAAS,OAAO,UAAU;KAC9B;KACA,QAAQ;MACN,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
@@ -162,6 +162,7 @@ declare const mockState: {
162
162
  total: number;
163
163
  }[];
164
164
  testDeviceCount: number;
165
+ testDeviceLimit: number;
165
166
  total: number;
166
167
  };
167
168
  //#endregion
@@ -162,6 +162,7 @@ declare const mockState: {
162
162
  total: number;
163
163
  }[];
164
164
  testDeviceCount: number;
165
+ testDeviceLimit: number;
165
166
  total: number;
166
167
  };
167
168
  //#endregion
@@ -1,4 +1,4 @@
1
- import { f as SORTING_OPTIONS, u as DEVICE_STATES } from "../constants-xpheFFkA.js";
1
+ import { f as SORTING_OPTIONS, u as DEVICE_STATES } from "../constants-CerzXHnQ.js";
2
2
  import { initialState } from "./index.js";
3
3
  //#region src/devicesSlice/mocks.ts
4
4
  const deviceTypes = { qemu: "qemux86-64" };
@@ -14,6 +14,7 @@ const getDeviceListState = (state) => state.devices.deviceList;
14
14
  const getListedDevices = (state) => state.devices.deviceList.deviceIds;
15
15
  const getFilteringAttributes = (state) => state.devices.filteringAttributes;
16
16
  const getDeviceFilters = (state) => state.devices.filters || [];
17
+ const getTestDeviceLimit = (state) => state.devices.testDeviceLimit;
17
18
  const getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
18
19
  const getSortedFilteringAttributes = (0, _reduxjs_toolkit.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
19
20
  ...filteringAttributes,
@@ -148,5 +149,6 @@ exports.getSelectedGroup = getSelectedGroup;
148
149
  exports.getSelectedGroupInfo = getSelectedGroupInfo;
149
150
  exports.getSortedFilteringAttributes = getSortedFilteringAttributes;
150
151
  exports.getTestDeviceCount = getTestDeviceCount;
152
+ exports.getTestDeviceLimit = getTestDeviceLimit;
151
153
 
152
154
  //# sourceMappingURL=selectors.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.cjs","names":["DEVICE_STATES","UNGROUPED_GROUP","duplicateFilter"],"sources":["../../src/devicesSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { DeviceFilter, DeviceGroup } from '.';\nimport type { DeviceAuthState } from '../constants';\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '../constants';\nimport type { RootState } from '../store';\n\nexport const getAcceptedDevices = (state: RootState) => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = (state: RootState) => state.devices.byStatus;\nexport const getDevicesById = (state: RootState) => state.devices.byId;\nexport const getDeviceReports = (state: RootState) => state.devices.reports;\nexport const getGroupsById = (state: RootState) => state.devices.groups.byId;\nexport const getSelectedGroup = (state: RootState) => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = (state: RootState) => state.devices.deviceList;\nexport const getListedDevices = (state: RootState) => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = (state: RootState) => state.devices.filteringAttributes;\nexport const getDeviceFilters = (state: RootState) => state.devices.filters || [];\nconst getFilteringAttributesFromConfig = (state: RootState) => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimits = (state: RootState) => state.devices.limits;\nexport const getTestDeviceCount = (state: RootState) => state.devices.testDeviceCount;\nconst getFilteringAttributesLimit = (state: RootState) => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce<Record<DeviceAuthState, number>>(\n (accu, deviceState) => {\n const { counts } = byStatus[deviceState];\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { total, ...tieredCounts } = counts;\n const count = Object.values(tieredCounts).reduce((accu, countPerTier) => accu + countPerTier, 0);\n accu[deviceState] = count;\n accu.total = accu.total + count;\n return accu;\n },\n { total: 0 }\n )\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],\n ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters: DeviceFilter[] = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total || 0;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getCombinedLimit = createSelector(\n [getDeviceLimits],\n deviceLimits => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0) // limit might be -1 for unlimited devices\n);\n\nexport const getLimitMaxed = createSelector(\n [getDeviceCountsByStatus, getCombinedLimit],\n ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroupData = createSelector([getGroupsByIdWithoutUngrouped], groups => {\n const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : undefined;\n const hasDynamicGroups = Object.values(groups).some(group => !!group.id);\n return { createdGroup, hasDynamicGroups, groups };\n});\n\ntype SelectorGroup = DeviceGroup & { groupId: string };\ntype SelectorGroups = { dynamic: SelectorGroup[]; static: SelectorGroup[]; ungrouped: SelectorGroup[] };\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce<SelectorGroups>(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if ((group.filters ?? []).length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\nconst getEnabledTierLimits = createSelector([getDeviceLimits], limits => Object.entries(limits).filter(([, limit]) => limit !== 0));\n\nexport const getEnabledTiers = createSelector([getEnabledTierLimits], enabledTierLimits => enabledTierLimits.map(([type]) => type));\n\nexport const getDeviceLimitStats = createSelector([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {\n const { counts } = accepted;\n return enabledTierLimits.map(([type, limit]) => ({\n type,\n limit,\n total: counts[type] || 0\n }));\n});\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":";;;;;;AAqBA,MAAa,sBAAsB,UAAqB,MAAM,QAAQ,SAAS;AAC/E,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAa,kBAAkB,UAAqB,MAAM,QAAQ;AAClE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ;AACpE,MAAa,iBAAiB,UAAqB,MAAM,QAAQ,OAAO;AACxE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ,OAAO;AAE3E,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ,WAAW;AAC/E,MAAa,0BAA0B,U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AAO,OAAO,SAAS;CACzB,EAAE;AACJ,CAAC;AAED,MAAa,kBAAA,GAAA,iBAAA,eAAA,CAAgC,CAAC,oBAAoB,cAAc,IAAI,EAAE,YAAY,CAAC,KAAK,gBACtG,OAAO,KACL,UAAU,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,MAAM,SAAS;CAC7C,MAAM,EAAE,aAAa,cAAc,CAAC,MAAM,YAAY,QAAQ,YAAY,KAAK,CAAC,aAAa,CAAC;CAC9F,OAAO,YAAY,QAAQ,gBAAgB,eAAe;EACxD,IAAI,WAAW,SAAS,GACtB,eAAe,cAAc,eAAe,cAAc,eAAe,cAAc,IAAI;EAE7F,OAAO;CACT,GAAG,IAAI;CACP,OAAO;AACT,GAAG,CAAC,CAAC,CACP,CACF"}
1
+ {"version":3,"file":"selectors.cjs","names":["createSelector","DEVICE_STATES","UNGROUPED_GROUP","duplicateFilter"],"sources":["../../src/devicesSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { DeviceFilter, DeviceGroup } from '.';\nimport type { DeviceAuthState } from '../constants';\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '../constants';\nimport type { RootState } from '../store';\n\nexport const getAcceptedDevices = (state: RootState) => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = (state: RootState) => state.devices.byStatus;\nexport const getDevicesById = (state: RootState) => state.devices.byId;\nexport const getDeviceReports = (state: RootState) => state.devices.reports;\nexport const getGroupsById = (state: RootState) => state.devices.groups.byId;\nexport const getSelectedGroup = (state: RootState) => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = (state: RootState) => state.devices.deviceList;\nexport const getListedDevices = (state: RootState) => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = (state: RootState) => state.devices.filteringAttributes;\nexport const getDeviceFilters = (state: RootState) => state.devices.filters || [];\nexport const getTestDeviceLimit = (state: RootState) => state.devices.testDeviceLimit;\nconst getFilteringAttributesFromConfig = (state: RootState) => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimits = (state: RootState) => state.devices.limits;\nexport const getTestDeviceCount = (state: RootState) => state.devices.testDeviceCount;\nconst getFilteringAttributesLimit = (state: RootState) => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce<Record<DeviceAuthState, number>>(\n (accu, deviceState) => {\n const { counts } = byStatus[deviceState];\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { total, ...tieredCounts } = counts;\n const count = Object.values(tieredCounts).reduce((accu, countPerTier) => accu + countPerTier, 0);\n accu[deviceState] = count;\n accu.total = accu.total + count;\n return accu;\n },\n { total: 0 }\n )\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],\n ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters: DeviceFilter[] = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total || 0;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getCombinedLimit = createSelector(\n [getDeviceLimits],\n deviceLimits => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0) // limit might be -1 for unlimited devices\n);\n\nexport const getLimitMaxed = createSelector(\n [getDeviceCountsByStatus, getCombinedLimit],\n ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroupData = createSelector([getGroupsByIdWithoutUngrouped], groups => {\n const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : undefined;\n const hasDynamicGroups = Object.values(groups).some(group => !!group.id);\n return { createdGroup, hasDynamicGroups, groups };\n});\n\ntype SelectorGroup = DeviceGroup & { groupId: string };\ntype SelectorGroups = { dynamic: SelectorGroup[]; static: SelectorGroup[]; ungrouped: SelectorGroup[] };\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce<SelectorGroups>(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if ((group.filters ?? []).length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\nconst getEnabledTierLimits = createSelector([getDeviceLimits], limits => Object.entries(limits).filter(([, limit]) => limit !== 0));\n\nexport const getEnabledTiers = createSelector([getEnabledTierLimits], enabledTierLimits => enabledTierLimits.map(([type]) => type));\n\nexport const getDeviceLimitStats = createSelector([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {\n const { counts } = accepted;\n return enabledTierLimits.map(([type, limit]) => ({\n type,\n limit,\n total: counts[type] || 0\n }));\n});\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":";;;;;;AAqBA,MAAa,sBAAsB,UAAqB,MAAM,QAAQ,SAAS;AAC/E,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAa,kBAAkB,UAAqB,MAAM,QAAQ;AAClE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ;AACpE,MAAa,iBAAiB,UAAqB,MAAM,QAAQ,OAAO;AACxE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ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AAqB,kBAAkB,KAAK,CAAC,UAAU,IAAI,CAAC;AAElI,MAAa,uBAAA,GAAsBA,iBAAAA,eAAAA,CAAe,CAAC,sBAAsB,kBAAkB,IAAI,mBAAmB,aAAa;CAC7H,MAAM,EAAE,WAAW;CACnB,OAAO,kBAAkB,KAAK,CAAC,MAAM,YAAY;EAC/C;EACA;EACA,OAAO,OAAO,SAAS;CACzB,EAAE;AACJ,CAAC;AAED,MAAa,kBAAA,GAAiBA,iBAAAA,eAAAA,CAAe,CAAC,oBAAoB,cAAc,IAAI,EAAE,YAAY,CAAC,KAAK,gBACtG,OAAO,KACL,UAAU,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,MAAM,SAAS;CAC7C,MAAM,EAAE,aAAa,cAAc,CAAC,MAAM,YAAY,QAAQ,YAAY,KAAK,CAAC,aAAa,CAAC;CAC9F,OAAO,YAAY,QAAQ,gBAAgB,eAAe;EACxD,IAAI,WAAW,SAAS,GACtB,eAAe,cAAc,eAAe,cAAc,eAAe,cAAc,IAAI;EAE7F,OAAO;CACT,GAAG,IAAI;CACP,OAAO;AACT,GAAG,CAAC,CAAC,CACP,CACF"}
@@ -1,22 +1,21 @@
1
- import { o as UserSliceType } from "../index-CgPgKMve.cjs";
2
- import { i as ReleaseSliceType } from "../index-VEayiYkv.cjs";
3
- import { n as OnboardingSliceType } from "../index-DBUt8xVc.cjs";
4
- import { o as DeploymentsSliceType } from "../index-EPmsL6Lb.cjs";
5
- import { a as DeviceListState, n as DeviceFilter, r as DeviceGroup, s as DeviceSliceType, t as Device } from "../index-vXsWdis1.cjs";
6
- import { t as AppSliceType } from "../index-Dn1SqQYh.cjs";
7
- import { t as MonitorSliceType } from "../index-BQCnJ5gh.cjs";
8
- import { t as OrganizationSliceType } from "../index-CSOj22xK.cjs";
9
- import { r as RootState } from "../store-CGP5pCH8.cjs";
10
-
1
+ import { o as UserSliceType } from "../index-BgF6rhXn.cjs";
2
+ import { i as ReleaseSliceType } from "../index-DiAjzARZ.cjs";
3
+ import { n as OnboardingSliceType } from "../index-CoObjWL4.cjs";
4
+ import { o as DeploymentsSliceType } from "../index-mvxjivTJ.cjs";
5
+ import { c as DeviceSliceType, i as DeviceGroup, l as DeviceTierLimits, o as DeviceListState, r as DeviceFilter, t as Device } from "../index-DnKVKM0G.cjs";
6
+ import { t as AppSliceType } from "../index-DeOpb2oK.cjs";
7
+ import { t as MonitorSliceType } from "../index-Ctj2r57a.cjs";
8
+ import { t as OrganizationSliceType } from "../index-C_LGDJN2.cjs";
9
+ import { r as RootState } from "../store-DquBGT7j.cjs";
11
10
  //#region src/devicesSlice/selectors.d.ts
12
11
  declare const getAcceptedDevices: (state: RootState) => {
13
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
12
+ counts: DeviceTierLimits & {
14
13
  total: number;
15
14
  };
16
15
  deviceIds: string[];
17
16
  };
18
17
  declare const getDevicesByStatus: (state: RootState) => Record<string, {
19
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
18
+ counts: DeviceTierLimits & {
20
19
  total: number;
21
20
  };
22
21
  deviceIds: string[];
@@ -41,6 +40,7 @@ declare const getFilteringAttributes: (state: RootState) => {
41
40
  tagAttributes: string[];
42
41
  };
43
42
  declare const getDeviceFilters: (state: RootState) => DeviceFilter[];
43
+ declare const getTestDeviceLimit: (state: RootState) => number;
44
44
  declare const getSortedFilteringAttributes: ((state: {
45
45
  app: AppSliceType;
46
46
  devices: DeviceSliceType;
@@ -106,7 +106,7 @@ declare const getSortedFilteringAttributes: ((state: {
106
106
  memoize: typeof import("reselect").weakMapMemoize;
107
107
  argsMemoize: typeof import("reselect").weakMapMemoize;
108
108
  };
109
- declare const getDeviceLimits: (state: RootState) => import("@northern.tech/types/types.gen").DeviceTierLimits;
109
+ declare const getDeviceLimits: (state: RootState) => DeviceTierLimits;
110
110
  declare const getTestDeviceCount: (state: RootState) => number;
111
111
  declare const getDeviceIdentityAttributes: ((state: {
112
112
  app: AppSliceType;
@@ -184,13 +184,13 @@ declare const getDeviceCountsByStatus: ((state: {
184
184
  resetResultsCount: () => void;
185
185
  } & {
186
186
  resultFunc: (resultFuncArgs_0: Record<string, {
187
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
187
+ counts: DeviceTierLimits & {
188
188
  total: number;
189
189
  };
190
190
  deviceIds: string[];
191
191
  }>) => Record<string, number>;
192
192
  memoizedResultFunc: ((resultFuncArgs_0: Record<string, {
193
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
193
+ counts: DeviceTierLimits & {
194
194
  total: number;
195
195
  };
196
196
  deviceIds: string[];
@@ -201,7 +201,7 @@ declare const getDeviceCountsByStatus: ((state: {
201
201
  };
202
202
  lastResult: () => Record<string, number>;
203
203
  dependencies: [(state: RootState) => Record<string, {
204
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
204
+ counts: DeviceTierLimits & {
205
205
  total: number;
206
206
  };
207
207
  deviceIds: string[];
@@ -287,13 +287,13 @@ declare const getSelectedGroupInfo: ((state: {
287
287
  resetResultsCount: () => void;
288
288
  } & {
289
289
  resultFunc: (resultFuncArgs_0: Record<string, {
290
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
290
+ counts: DeviceTierLimits & {
291
291
  total: number;
292
292
  };
293
293
  deviceIds: string[];
294
294
  }>) => Record<string, number>;
295
295
  memoizedResultFunc: ((resultFuncArgs_0: Record<string, {
296
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
296
+ counts: DeviceTierLimits & {
297
297
  total: number;
298
298
  };
299
299
  deviceIds: string[];
@@ -304,7 +304,7 @@ declare const getSelectedGroupInfo: ((state: {
304
304
  };
305
305
  lastResult: () => Record<string, number>;
306
306
  dependencies: [(state: RootState) => Record<string, {
307
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
307
+ counts: DeviceTierLimits & {
308
308
  total: number;
309
309
  };
310
310
  deviceIds: string[];
@@ -339,14 +339,14 @@ declare const getCombinedLimit: ((state: {
339
339
  resultsCount: () => number;
340
340
  resetResultsCount: () => void;
341
341
  } & {
342
- resultFunc: (resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => number;
343
- memoizedResultFunc: ((resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => number) & {
342
+ resultFunc: (resultFuncArgs_0: DeviceTierLimits) => number;
343
+ memoizedResultFunc: ((resultFuncArgs_0: DeviceTierLimits) => number) & {
344
344
  clearCache: () => void;
345
345
  resultsCount: () => number;
346
346
  resetResultsCount: () => void;
347
347
  };
348
348
  lastResult: () => number;
349
- dependencies: [(state: RootState) => import("@northern.tech/types/types.gen").DeviceTierLimits];
349
+ dependencies: [(state: RootState) => DeviceTierLimits];
350
350
  recomputations: () => number;
351
351
  resetRecomputations: () => void;
352
352
  dependencyRecomputations: () => number;
@@ -391,13 +391,13 @@ declare const getLimitMaxed: ((state: {
391
391
  resetResultsCount: () => void;
392
392
  } & {
393
393
  resultFunc: (resultFuncArgs_0: Record<string, {
394
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
394
+ counts: DeviceTierLimits & {
395
395
  total: number;
396
396
  };
397
397
  deviceIds: string[];
398
398
  }>) => Record<string, number>;
399
399
  memoizedResultFunc: ((resultFuncArgs_0: Record<string, {
400
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
400
+ counts: DeviceTierLimits & {
401
401
  total: number;
402
402
  };
403
403
  deviceIds: string[];
@@ -408,7 +408,7 @@ declare const getLimitMaxed: ((state: {
408
408
  };
409
409
  lastResult: () => Record<string, number>;
410
410
  dependencies: [(state: RootState) => Record<string, {
411
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
411
+ counts: DeviceTierLimits & {
412
412
  total: number;
413
413
  };
414
414
  deviceIds: string[];
@@ -434,14 +434,14 @@ declare const getLimitMaxed: ((state: {
434
434
  resultsCount: () => number;
435
435
  resetResultsCount: () => void;
436
436
  } & {
437
- resultFunc: (resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => number;
438
- memoizedResultFunc: ((resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => number) & {
437
+ resultFunc: (resultFuncArgs_0: DeviceTierLimits) => number;
438
+ memoizedResultFunc: ((resultFuncArgs_0: DeviceTierLimits) => number) & {
439
439
  clearCache: () => void;
440
440
  resultsCount: () => number;
441
441
  resetResultsCount: () => void;
442
442
  };
443
443
  lastResult: () => number;
444
- dependencies: [(state: RootState) => import("@northern.tech/types/types.gen").DeviceTierLimits];
444
+ dependencies: [(state: RootState) => DeviceTierLimits];
445
445
  recomputations: () => number;
446
446
  resetRecomputations: () => void;
447
447
  dependencyRecomputations: () => number;
@@ -724,14 +724,14 @@ declare const getEnabledTiers: ((state: {
724
724
  resultsCount: () => number;
725
725
  resetResultsCount: () => void;
726
726
  } & {
727
- resultFunc: (resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => [string, number][];
728
- memoizedResultFunc: ((resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => [string, number][]) & {
727
+ resultFunc: (resultFuncArgs_0: DeviceTierLimits) => [string, number][];
728
+ memoizedResultFunc: ((resultFuncArgs_0: DeviceTierLimits) => [string, number][]) & {
729
729
  clearCache: () => void;
730
730
  resultsCount: () => number;
731
731
  resetResultsCount: () => void;
732
732
  };
733
733
  lastResult: () => [string, number][];
734
- dependencies: [(state: RootState) => import("@northern.tech/types/types.gen").DeviceTierLimits];
734
+ dependencies: [(state: RootState) => DeviceTierLimits];
735
735
  recomputations: () => number;
736
736
  resetRecomputations: () => void;
737
737
  dependencyRecomputations: () => number;
@@ -767,7 +767,7 @@ declare const getDeviceLimitStats: ((state: {
767
767
  resetResultsCount: () => void;
768
768
  } & {
769
769
  resultFunc: (resultFuncArgs_0: [string, number][], resultFuncArgs_1: {
770
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
770
+ counts: DeviceTierLimits & {
771
771
  total: number;
772
772
  };
773
773
  deviceIds: string[];
@@ -777,7 +777,7 @@ declare const getDeviceLimitStats: ((state: {
777
777
  total: any;
778
778
  }[];
779
779
  memoizedResultFunc: ((resultFuncArgs_0: [string, number][], resultFuncArgs_1: {
780
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
780
+ counts: DeviceTierLimits & {
781
781
  total: number;
782
782
  };
783
783
  deviceIds: string[];
@@ -809,14 +809,14 @@ declare const getDeviceLimitStats: ((state: {
809
809
  resultsCount: () => number;
810
810
  resetResultsCount: () => void;
811
811
  } & {
812
- resultFunc: (resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => [string, number][];
813
- memoizedResultFunc: ((resultFuncArgs_0: import("@northern.tech/types/types.gen").DeviceTierLimits) => [string, number][]) & {
812
+ resultFunc: (resultFuncArgs_0: DeviceTierLimits) => [string, number][];
813
+ memoizedResultFunc: ((resultFuncArgs_0: DeviceTierLimits) => [string, number][]) & {
814
814
  clearCache: () => void;
815
815
  resultsCount: () => number;
816
816
  resetResultsCount: () => void;
817
817
  };
818
818
  lastResult: () => [string, number][];
819
- dependencies: [(state: RootState) => import("@northern.tech/types/types.gen").DeviceTierLimits];
819
+ dependencies: [(state: RootState) => DeviceTierLimits];
820
820
  recomputations: () => number;
821
821
  resetRecomputations: () => void;
822
822
  dependencyRecomputations: () => number;
@@ -825,7 +825,7 @@ declare const getDeviceLimitStats: ((state: {
825
825
  memoize: typeof import("reselect").weakMapMemoize;
826
826
  argsMemoize: typeof import("reselect").weakMapMemoize;
827
827
  }, (state: RootState) => {
828
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
828
+ counts: DeviceTierLimits & {
829
829
  total: number;
830
830
  };
831
831
  deviceIds: string[];
@@ -853,13 +853,13 @@ declare const getDeviceTypes: ((state: {
853
853
  resetResultsCount: () => void;
854
854
  } & {
855
855
  resultFunc: (resultFuncArgs_0: {
856
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
856
+ counts: DeviceTierLimits & {
857
857
  total: number;
858
858
  };
859
859
  deviceIds: string[];
860
860
  }, resultFuncArgs_1: Record<string, Device>) => string[];
861
861
  memoizedResultFunc: ((resultFuncArgs_0: {
862
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
862
+ counts: DeviceTierLimits & {
863
863
  total: number;
864
864
  };
865
865
  deviceIds: string[];
@@ -870,7 +870,7 @@ declare const getDeviceTypes: ((state: {
870
870
  };
871
871
  lastResult: () => string[];
872
872
  dependencies: [(state: RootState) => {
873
- counts: import("@northern.tech/types/types.gen").DeviceTierLimits & {
873
+ counts: DeviceTierLimits & {
874
874
  total: number;
875
875
  };
876
876
  deviceIds: string[];
@@ -884,5 +884,5 @@ declare const getDeviceTypes: ((state: {
884
884
  argsMemoize: typeof import("reselect").weakMapMemoize;
885
885
  };
886
886
  //#endregion
887
- export { getAcceptedDevices, getAttributesList, getCombinedLimit, getDeviceById, getDeviceCountsByStatus, getDeviceFilters, getDeviceIdentityAttributes, getDeviceLimitStats, getDeviceLimits, getDeviceListState, getDeviceReports, getDeviceTypes, getDevicesById, getDevicesByStatus, getEnabledTiers, getFilteringAttributes, getGroupData, getGroups, getGroupsById, getGroupsByIdWithoutUngrouped, getLimitMaxed, getListedDevices, getSelectedGroup, getSelectedGroupInfo, getSortedFilteringAttributes, getTestDeviceCount };
887
+ export { getAcceptedDevices, getAttributesList, getCombinedLimit, getDeviceById, getDeviceCountsByStatus, getDeviceFilters, getDeviceIdentityAttributes, getDeviceLimitStats, getDeviceLimits, getDeviceListState, getDeviceReports, getDeviceTypes, getDevicesById, getDevicesByStatus, getEnabledTiers, getFilteringAttributes, getGroupData, getGroups, getGroupsById, getGroupsByIdWithoutUngrouped, getLimitMaxed, getListedDevices, getSelectedGroup, getSelectedGroupInfo, getSortedFilteringAttributes, getTestDeviceCount, getTestDeviceLimit };
888
888
  //# sourceMappingURL=selectors.d.cts.map