@northern.tech/store 0.30.2 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.cts +16 -7
- package/dist/actions.d.ts +16 -7
- package/dist/api/general-api.cjs +2 -2
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/users-api.cjs +1 -1
- package/dist/api/users-api.cjs.map +1 -1
- package/dist/api/users-api.js.map +1 -1
- package/dist/appSlice/constants.cjs +6 -1
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +1 -1
- package/dist/appSlice/constants.d.ts +1 -1
- package/dist/appSlice/constants.js +7 -2
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.d.cts +1 -1
- package/dist/appSlice/index.d.ts +1 -1
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/mocks.d.cts +1 -1
- package/dist/appSlice/mocks.d.ts +1 -1
- package/dist/appSlice/selectors.d.cts +7 -7
- package/dist/appSlice/selectors.d.ts +7 -7
- package/dist/appSlice/thunks.d.cts +2 -2
- package/dist/appSlice/thunks.d.ts +2 -2
- package/dist/auth.cjs +1 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/commonConstants.d.cts +1 -1
- package/dist/commonConstants.d.ts +1 -1
- package/dist/commonSelectors.cjs +1 -1
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +10 -10
- package/dist/commonSelectors.d.ts +10 -10
- package/dist/commonSelectors.js.map +1 -1
- package/dist/{constants-DPLHhjVN.d.cts → constants-BFTS6mge.d.cts} +6 -1
- package/dist/{constants-C5AU0mCY.d.ts → constants-BIIEMVoG.d.ts} +6 -1
- package/dist/{constants-MPLfugsi.d.cts → constants-BrGIx40B.d.cts} +3 -3
- package/dist/{constants-DrwXHsJ1.d.ts → constants-CjO3_FOH.d.ts} +3 -3
- package/dist/constants.cjs +1 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.d.cts +7 -7
- package/dist/deploymentsSlice/selectors.d.ts +7 -7
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/thunks.d.cts +4 -4
- package/dist/deploymentsSlice/thunks.d.ts +4 -4
- package/dist/devicesSlice/constants.d.cts +1 -1
- package/dist/devicesSlice/constants.d.ts +1 -1
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.d.cts +1 -1
- package/dist/devicesSlice/index.d.ts +1 -1
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +7 -7
- package/dist/devicesSlice/selectors.d.ts +7 -7
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +4 -4
- package/dist/devicesSlice/thunks.d.ts +4 -4
- package/dist/{index-Lz5JsJ6O.d.cts → index-B64X5ozM.d.cts} +2 -2
- package/dist/{index-4eaLEXy_.d.cts → index-BFlHWzjv.d.cts} +2 -2
- package/dist/{index-DqyY6oZ3.d.ts → index-BI9O8JWe.d.ts} +2 -2
- package/dist/{index-Bwx9jEiL.d.cts → index-BbaS7MzW.d.cts} +2 -2
- package/dist/{index-Dv3Hfxk_.d.ts → index-Bp1WpATs.d.ts} +2 -2
- package/dist/{index-FyYBBeN-.d.cts → index-C-q632wO.d.cts} +41 -8
- package/dist/{index-DJSlDPRX.d.ts → index-C6wNUfiV.d.ts} +2 -2
- package/dist/{index-BEVkIiNa.d.cts → index-CT5hgXm9.d.cts} +2 -2
- package/dist/{index-Cvkvcz4r.d.ts → index-CyokFK2e.d.ts} +41 -8
- package/dist/{index-CO-py5d4.d.ts → index-DUvrw_Ed.d.ts} +2 -2
- package/dist/{index-CTt-eIY8.d.cts → index-DwACbyUg.d.cts} +2 -2
- package/dist/{index-DtePEQPT.d.ts → index-ez3oxfRo.d.ts} +2 -2
- package/dist/liststatehook.cjs +5 -3
- package/dist/liststatehook.cjs.map +1 -1
- package/dist/liststatehook.js +5 -3
- package/dist/liststatehook.js.map +1 -1
- package/dist/locationutils.cjs +3 -0
- package/dist/locationutils.cjs.map +1 -1
- package/dist/locationutils.d.cts +3 -2
- package/dist/locationutils.d.ts +3 -2
- package/dist/locationutils.js +3 -0
- package/dist/locationutils.js.map +1 -1
- package/dist/monitorSlice/constants.d.cts +1 -1
- package/dist/monitorSlice/constants.d.ts +1 -1
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.d.cts +1 -1
- package/dist/monitorSlice/index.d.ts +1 -1
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/mocks.cjs.map +1 -1
- package/dist/monitorSlice/mocks.d.cts +1 -1
- package/dist/monitorSlice/mocks.d.ts +1 -1
- package/dist/monitorSlice/mocks.js.map +1 -1
- package/dist/monitorSlice/selectors.d.cts +1 -1
- package/dist/monitorSlice/selectors.d.ts +1 -1
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.d.cts +4 -4
- package/dist/monitorSlice/thunks.d.ts +4 -4
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/mocks.cjs.map +1 -1
- package/dist/onboardingSlice/selectors.d.cts +1 -1
- package/dist/onboardingSlice/selectors.d.ts +1 -1
- package/dist/onboardingSlice/thunks.d.cts +2 -2
- package/dist/onboardingSlice/thunks.d.ts +2 -2
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +1 -1
- package/dist/organizationSlice/index.d.ts +1 -1
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/mocks.d.cts +2 -2
- package/dist/organizationSlice/mocks.d.ts +2 -2
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +8 -8
- package/dist/organizationSlice/selectors.d.ts +8 -8
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +5 -5
- package/dist/organizationSlice/thunks.d.ts +5 -5
- package/dist/organizationSlice/types.d.cts +1 -1
- package/dist/organizationSlice/types.d.ts +1 -1
- package/dist/releasesSlice/index.cjs +63 -2
- package/dist/releasesSlice/index.cjs.map +1 -1
- package/dist/releasesSlice/index.d.cts +2 -2
- package/dist/releasesSlice/index.d.ts +2 -2
- package/dist/releasesSlice/index.js +63 -2
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/mocks.cjs +34 -0
- package/dist/releasesSlice/mocks.cjs.map +1 -1
- package/dist/releasesSlice/mocks.d.cts +44 -1
- package/dist/releasesSlice/mocks.d.ts +44 -1
- package/dist/releasesSlice/mocks.js +34 -0
- package/dist/releasesSlice/mocks.js.map +1 -1
- package/dist/releasesSlice/selectors.cjs +37 -5
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.d.cts +403 -15
- package/dist/releasesSlice/selectors.d.ts +403 -15
- package/dist/releasesSlice/selectors.js +27 -6
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/thunks.cjs +210 -2
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +144 -10
- package/dist/releasesSlice/thunks.d.ts +144 -10
- package/dist/releasesSlice/thunks.js +201 -4
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/selectors.cjs +11 -0
- package/dist/selectors.d.cts +2 -2
- package/dist/selectors.d.ts +2 -2
- package/dist/selectors.js +2 -2
- package/dist/sockethook.cjs +2 -2
- package/dist/sockethook.cjs.map +1 -1
- package/dist/sockethook.js.map +1 -1
- package/dist/{store-BQxOSRC1.d.ts → store-D-xvZXiY.d.ts} +7 -7
- package/dist/{store-BiIA0r0A.d.cts → store-b5cF2WB5.d.cts} +7 -7
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +2 -2
- package/dist/store.d.ts +2 -2
- package/dist/store.js.map +1 -1
- package/dist/storehooks.cjs +3 -3
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.d.cts +2 -2
- package/dist/storehooks.d.ts +2 -2
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +22 -10
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +2 -2
- package/dist/thunks.d.ts +2 -2
- package/dist/thunks.js +8 -6
- package/dist/thunks.js.map +1 -1
- package/dist/{types-B2NRQLFw.d.ts → types-BPyM8Inu.d.ts} +3 -3
- package/dist/{types-ClEfo0dK.d.cts → types-COdPU2QQ.d.cts} +3 -3
- package/dist/useDeploymentDevice.cjs +1 -1
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/useDeploymentDevice.js.map +1 -1
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.d.cts +1 -1
- package/dist/usersSlice/index.d.ts +1 -1
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/mocks.d.cts +1 -1
- package/dist/usersSlice/mocks.d.ts +1 -1
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.d.cts +7 -7
- package/dist/usersSlice/selectors.d.ts +7 -7
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/thunks.d.cts +4 -4
- package/dist/usersSlice/thunks.d.ts +4 -4
- package/dist/{utils-CO_CpGFP.d.ts → utils-CHBWS_tH.d.ts} +4 -4
- package/dist/{utils-CpPfqW0Q.d.cts → utils-Do9z5TL1.d.cts} +4 -4
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Addon } from "./constants-
|
|
2
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { n as Addon } from "./constants-BIIEMVoG.js";
|
|
2
|
+
import { T as SortOptions } from "./constants-CjO3_FOH.js";
|
|
3
3
|
import { a as SSO_TYPES } from "./constants-y2XVLQWf.js";
|
|
4
4
|
import { AuditLog, BillingInfo, BillingProfile, ConstraintsInfo, Event, SamlMetadata, Tenant } from "@northern.tech/types/MenderTypes";
|
|
5
5
|
|
|
@@ -85,4 +85,4 @@ type PricePreview = {
|
|
|
85
85
|
};
|
|
86
86
|
//#endregion
|
|
87
87
|
export { PricePreview as a, ProductTier as c, TenantList as d, Webhook as f, Organization as i, SSOConfig as l, AuditLogSelectionState as n, ProductConfig as o, Card as r, ProductPlan as s, AuditLog$1 as t, Tenant$1 as u };
|
|
88
|
-
//# sourceMappingURL=types-
|
|
88
|
+
//# sourceMappingURL=types-BPyM8Inu.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Addon } from "./constants-
|
|
2
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { n as Addon } from "./constants-BFTS6mge.cjs";
|
|
2
|
+
import { T as SortOptions } from "./constants-BrGIx40B.cjs";
|
|
3
3
|
import { a as SSO_TYPES } from "./constants-CNhpIMME.cjs";
|
|
4
4
|
import { AuditLog, BillingInfo, BillingProfile, ConstraintsInfo, Event, SamlMetadata, Tenant } from "@northern.tech/types/MenderTypes";
|
|
5
5
|
|
|
@@ -85,4 +85,4 @@ type PricePreview = {
|
|
|
85
85
|
};
|
|
86
86
|
//#endregion
|
|
87
87
|
export { PricePreview as a, ProductTier as c, TenantList as d, Webhook as f, Organization as i, SSOConfig as l, AuditLogSelectionState as n, ProductConfig as o, Card as r, ProductPlan as s, AuditLog$1 as t, Tenant$1 as u };
|
|
88
|
-
//# sourceMappingURL=types-
|
|
88
|
+
//# sourceMappingURL=types-COdPU2QQ.d.cts.map
|
|
@@ -5,7 +5,7 @@ const require_store = require("./store.cjs");
|
|
|
5
5
|
const require_thunks = require("./thunks.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let validator = require("validator");
|
|
8
|
-
validator = require_chunk.__toESM(validator);
|
|
8
|
+
validator = require_chunk.__toESM(validator, 1);
|
|
9
9
|
//#region src/useDeploymentDevice.ts
|
|
10
10
|
const { isUUID } = validator.default;
|
|
11
11
|
const useDeploymentDevice = (deploymentName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeploymentDevice.cjs","names":["useAppDispatch","useAppSelector","getDevicesById","getDeviceById"],"sources":["../src/useDeploymentDevice.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 { useEffect, useRef } from 'react';\n\nimport validator from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch, useAppSelector } from './store';\nimport { getDeviceById } from './thunks';\n\nconst { isUUID } = validator;\n\nexport const useDeploymentDevice = (deploymentName: string) => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useAppSelector(getDevicesById);\n const hasDeviceInfo = !!devicesById[deploymentName];\n\n useEffect(() => {\n if (isLoading.current) {\n return;\n }\n isLoading.current = true;\n if (isUUID(deploymentName) && !hasDeviceInfo) {\n dispatch(getDeviceById(deploymentName))\n .unwrap()\n .then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,EAAE,WAAW,UAAA;AAEnB,MAAa,uBAAuB,mBAA2B;CAC7D,MAAM,aAAA,GAAA,MAAA,QAAmB,MAAM;CAC/B,MAAM,WAAWA,cAAAA,gBAAgB;CAEjC,MAAM,gBAAgB,CAAC,CADHC,cAAAA,eAAeC,+BAAAA,
|
|
1
|
+
{"version":3,"file":"useDeploymentDevice.cjs","names":["useAppDispatch","useAppSelector","getDevicesById","getDeviceById"],"sources":["../src/useDeploymentDevice.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 { useEffect, useRef } from 'react';\n\nimport validator from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch, useAppSelector } from './store';\nimport { getDeviceById } from './thunks';\n\nconst { isUUID } = validator;\n\nexport const useDeploymentDevice = (deploymentName: string) => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useAppSelector(getDevicesById);\n const hasDeviceInfo = !!devicesById[deploymentName];\n\n useEffect(() => {\n if (isLoading.current) {\n return;\n }\n isLoading.current = true;\n if (isUUID(deploymentName) && !hasDeviceInfo) {\n dispatch(getDeviceById(deploymentName))\n .unwrap()\n .then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,EAAE,WAAW,UAAA;AAEnB,MAAa,uBAAuB,mBAA2B;CAC7D,MAAM,aAAA,GAAA,MAAA,QAAmB,MAAM;CAC/B,MAAM,WAAWA,cAAAA,gBAAgB;CAEjC,MAAM,gBAAgB,CAAC,CADHC,cAAAA,eAAeC,+BAAAA,eACA,CAAC;CAEpC,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,UAAU,SACZ;EAEF,UAAU,UAAU;EACpB,IAAI,OAAO,eAAe,IAAI,CAAC,eAC7B,SAASC,eAAAA,cAAc,eAAe,CAAC,CACpC,QAAQ,CACR,WAAY,UAAU,UAAU,MAAO;IAE3C;EAAC;EAAgB;EAAU;EAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeploymentDevice.js","names":[],"sources":["../src/useDeploymentDevice.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 { useEffect, useRef } from 'react';\n\nimport validator from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch, useAppSelector } from './store';\nimport { getDeviceById } from './thunks';\n\nconst { isUUID } = validator;\n\nexport const useDeploymentDevice = (deploymentName: string) => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useAppSelector(getDevicesById);\n const hasDeviceInfo = !!devicesById[deploymentName];\n\n useEffect(() => {\n if (isLoading.current) {\n return;\n }\n isLoading.current = true;\n if (isUUID(deploymentName) && !hasDeviceInfo) {\n dispatch(getDeviceById(deploymentName))\n .unwrap()\n .then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;AAqBA,MAAM,EAAE,WAAW;AAEnB,MAAa,uBAAuB,mBAA2B;CAC7D,MAAM,YAAY,OAAO,MAAM;CAC/B,MAAM,WAAW,gBAAgB;CAEjC,MAAM,gBAAgB,CAAC,CADH,eAAe,
|
|
1
|
+
{"version":3,"file":"useDeploymentDevice.js","names":[],"sources":["../src/useDeploymentDevice.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 { useEffect, useRef } from 'react';\n\nimport validator from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch, useAppSelector } from './store';\nimport { getDeviceById } from './thunks';\n\nconst { isUUID } = validator;\n\nexport const useDeploymentDevice = (deploymentName: string) => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useAppSelector(getDevicesById);\n const hasDeviceInfo = !!devicesById[deploymentName];\n\n useEffect(() => {\n if (isLoading.current) {\n return;\n }\n isLoading.current = true;\n if (isUUID(deploymentName) && !hasDeviceInfo) {\n dispatch(getDeviceById(deploymentName))\n .unwrap()\n .then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;AAqBA,MAAM,EAAE,WAAW;AAEnB,MAAa,uBAAuB,mBAA2B;CAC7D,MAAM,YAAY,OAAO,MAAM;CAC/B,MAAM,WAAW,gBAAgB;CAEjC,MAAM,gBAAgB,CAAC,CADH,eAAe,eACA,CAAC;CAEpC,gBAAgB;EACd,IAAI,UAAU,SACZ;EAEF,UAAU,UAAU;EACpB,IAAI,OAAO,eAAe,IAAI,CAAC,eAC7B,SAAS,cAAc,eAAe,CAAC,CACpC,QAAQ,CACR,WAAY,UAAU,UAAU,MAAO;IAE3C;EAAC;EAAgB;EAAU;EAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["defaultPermissionSets","rolesById","READ_STATES"],"sources":["../../src/usersSlice/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 { User as BackendUser, DeploymentPhase, TenantInfo, TenantsIdName } from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { FilterOperator, PermissionSet, Role } from '../constants';\nimport { defaultPermissionSets, rolesById } from '../constants';\nimport type { ReadState } from './constants';\nimport { READ_STATES } from './constants';\n\nexport const sliceName = 'users';\nexport type User = BackendUser & TenantInfo & { tenants?: TenantsIdName };\nexport type UserSession = {\n expiresAt?: string;\n token: string;\n};\nexport type CustomColumn = {\n attribute: {\n name: string;\n scope: string;\n };\n size: number;\n};\n\ntype FilterOption = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string;\n};\nexport type GlobalSettings = {\n [x: string]: any;\n id_attribute?: {\n attribute: string;\n scope: string;\n };\n previousFilters: FilterOption[];\n previousPhases: DeploymentPhase[][];\n retries: number;\n};\ntype Column = {\n id: string;\n key: string;\n name: string;\n scope: string;\n title: string;\n};\nexport type UserSettings = {\n [x: string]: any;\n columnSelection: Column[];\n feedbackCollectedAt?: string;\n firstLoginTimestamp: null | string;\n mode?: 'light' | 'dark';\n onboarding: Partial<{\n address: string;\n approach: 'physical' | 'virtual' | 'mcu' | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceType: string[] | string | null;\n progress: string | null;\n showTips: null | boolean;\n showTipsDialog: boolean;\n }>;\n securityAlertDismissedTimestamp: null | string;\n tooltips?: object;\n trackingConsentGiven?: boolean;\n};\n\nexport type UserSliceType = {\n byId: Record<string, User>;\n currentSession?: UserSession | object;\n currentUser: string | null;\n customColumns: CustomColumn[];\n globalSettings: GlobalSettings;\n permissionSetsById: Record<string, PermissionSet>;\n qrCode: string | null;\n rolesById: Record<string, Role>;\n rolesInitialized: boolean;\n settingsInitialized: boolean;\n showConnectDeviceDialog: boolean;\n showFeedbackDialog: boolean;\n showStartupNotification: boolean;\n tooltips: {\n byId: Record<string, { readState: ReadState }>;\n };\n userSettings: UserSettings;\n userSettingsInitialized: boolean;\n};\n\nexport const initialState: UserSliceType = {\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n rolesInitialized: false,\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {},\n firstLoginTimestamp: null,\n securityAlertDismissedTimestamp: null\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action: PayloadAction<string | null>) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action: PayloadAction<UserSession>) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action: PayloadAction<Record<string, User>>) => {\n state.byId = action.payload;\n },\n receivedUser: (state, action: PayloadAction<User>) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n removedUser: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action: PayloadAction<Partial<User> & { id: string }>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action: PayloadAction<Record<string, PermissionSet>>) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action: PayloadAction<Record<string, Role>>) => {\n state.rolesById = action.payload;\n state.rolesInitialized = true;\n },\n finishedRoleInitialization: (state, action) => {\n state.rolesInitialized = action.payload;\n },\n createdRole: (state, action: PayloadAction<Role>) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action: PayloadAction<CustomColumn[]>) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action: PayloadAction<GlobalSettings>) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action: PayloadAction<UserSettings>) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action: PayloadAction<{ id: string; readState: ReadState }>) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };\n },\n setTooltipsState: (state, action: PayloadAction<UserSliceType['tooltips']['byId']>) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action: PayloadAction<boolean>) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action: PayloadAction<boolean>) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action: PayloadAction<boolean>) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":";;;;;;;;;AAsBA,MAAa,YAAY;AA+EzB,MAAa,eAA8B;CACzC,MAAM,EAAE;CACR,aAAa;CACb,gBAAgB,EAEf;CACD,eAAe,EAAE;CACjB,QAAQ;CACR,gBAAgB;EACd,cAAc,KAAA;EACd,iBAAiB,EAAE;EACnB,gBAAgB,EAAE;EAClB,SAAS;EACV;CACD,oBAAoB,EAClB,GAAGA,+BAAAA,uBACJ;CACD,WAAW,EACT,GAAGC,+BAAAA,WACJ;CACD,kBAAkB;CAClB,qBAAqB;CACrB,yBAAyB;CACzB,oBAAoB;CACpB,yBAAyB;CACzB,UAAU,EACR,MAAM,EAEL,EACF;CACD,cAAc;EACZ,iBAAiB,EAAE;EACnB,YAAY,EAAE;EACd,qBAAqB;EACrB,iCAAiC;EAClC;CACD,yBAAyB;CAC1B;AAED,MAAa,cAAA,GAAA,iBAAA,aAAyB;CACpC,MAAM;CACN;CACA,UAAU;EACR,iBAAiB,OAAO,WAAyC;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["defaultPermissionSets","rolesById","READ_STATES"],"sources":["../../src/usersSlice/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 { User as BackendUser, DeploymentPhase, TenantInfo, TenantsIdName } from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { FilterOperator, PermissionSet, Role } from '../constants';\nimport { defaultPermissionSets, rolesById } from '../constants';\nimport type { ReadState } from './constants';\nimport { READ_STATES } from './constants';\n\nexport const sliceName = 'users';\nexport type User = BackendUser & TenantInfo & { tenants?: TenantsIdName };\nexport type UserSession = {\n expiresAt?: string;\n token: string;\n};\nexport type CustomColumn = {\n attribute: {\n name: string;\n scope: string;\n };\n size: number;\n};\n\ntype FilterOption = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string;\n};\nexport type GlobalSettings = {\n [x: string]: any;\n id_attribute?: {\n attribute: string;\n scope: string;\n };\n previousFilters: FilterOption[];\n previousPhases: DeploymentPhase[][];\n retries: number;\n};\ntype Column = {\n id: string;\n key: string;\n name: string;\n scope: string;\n title: string;\n};\nexport type UserSettings = {\n [x: string]: any;\n columnSelection: Column[];\n feedbackCollectedAt?: string;\n firstLoginTimestamp: null | string;\n mode?: 'light' | 'dark';\n onboarding: Partial<{\n address: string;\n approach: 'physical' | 'virtual' | 'mcu' | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceType: string[] | string | null;\n progress: string | null;\n showTips: null | boolean;\n showTipsDialog: boolean;\n }>;\n securityAlertDismissedTimestamp: null | string;\n tooltips?: object;\n trackingConsentGiven?: boolean;\n};\n\nexport type UserSliceType = {\n byId: Record<string, User>;\n currentSession?: UserSession | object;\n currentUser: string | null;\n customColumns: CustomColumn[];\n globalSettings: GlobalSettings;\n permissionSetsById: Record<string, PermissionSet>;\n qrCode: string | null;\n rolesById: Record<string, Role>;\n rolesInitialized: boolean;\n settingsInitialized: boolean;\n showConnectDeviceDialog: boolean;\n showFeedbackDialog: boolean;\n showStartupNotification: boolean;\n tooltips: {\n byId: Record<string, { readState: ReadState }>;\n };\n userSettings: UserSettings;\n userSettingsInitialized: boolean;\n};\n\nexport const initialState: UserSliceType = {\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n rolesInitialized: false,\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {},\n firstLoginTimestamp: null,\n securityAlertDismissedTimestamp: null\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action: PayloadAction<string | null>) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action: PayloadAction<UserSession>) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action: PayloadAction<Record<string, User>>) => {\n state.byId = action.payload;\n },\n receivedUser: (state, action: PayloadAction<User>) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n removedUser: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action: PayloadAction<Partial<User> & { id: string }>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action: PayloadAction<Record<string, PermissionSet>>) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action: PayloadAction<Record<string, Role>>) => {\n state.rolesById = action.payload;\n state.rolesInitialized = true;\n },\n finishedRoleInitialization: (state, action) => {\n state.rolesInitialized = action.payload;\n },\n createdRole: (state, action: PayloadAction<Role>) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action: PayloadAction<CustomColumn[]>) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action: PayloadAction<GlobalSettings>) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action: PayloadAction<UserSettings>) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action: PayloadAction<{ id: string; readState: ReadState }>) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };\n },\n setTooltipsState: (state, action: PayloadAction<UserSliceType['tooltips']['byId']>) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action: PayloadAction<boolean>) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action: PayloadAction<boolean>) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action: PayloadAction<boolean>) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":";;;;;;;;;AAsBA,MAAa,YAAY;AA+EzB,MAAa,eAA8B;CACzC,MAAM,EAAE;CACR,aAAa;CACb,gBAAgB,EAEf;CACD,eAAe,EAAE;CACjB,QAAQ;CACR,gBAAgB;EACd,cAAc,KAAA;EACd,iBAAiB,EAAE;EACnB,gBAAgB,EAAE;EAClB,SAAS;EACV;CACD,oBAAoB,EAClB,GAAGA,+BAA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AU,aAAa,GAAG,cAAc,MAAM;GAC9D,MAAM,YAAY;;EAEpB,mBAAmB,OAAO,WAA0C;GAClE,MAAM,gBAAgB,OAAO;;EAE/B,oBAAoB,OAAO,WAA0C;GACnE,MAAM,sBAAsB;GAC5B,MAAM,iBAAiB;IACrB,GAAG,MAAM;IACT,GAAG,OAAO;IACX;;EAEH,kBAAkB,OAAO,WAAwC;GAC/D,MAAM,0BAA0B;GAChC,MAAM,eAAe;IACnB,GAAG,MAAM;IACT,GAAG,OAAO;IACX;;EAEH,kBAAkB,OAAO,WAAgE;GACvF,MAAM,EAAE,IAAI,YAAYC,kBAAAA,YAAY,SAAS,OAAO;GACpD,MAAM,SAAS,KAAK,MAAM;IAAE,GAAG,MAAM,SAAS,KAAK;IAAK;IAAW;;EAErE,mBAAmB,OAAO,WAA6D;GACrF,MAAM,SAAS,OAAO;IACpB,GAAG,MAAM,SAAS;IAClB,GAAG,OAAO;IACX;;EAEH,wBAAwB,OAAO,WAAmC;GAChE,MAAM,qBAAqB,OAAO;;EAEpC,0BAA0B,OAAO,WAAmC;GAClE,MAAM,0BAA0B,OAAO;;EAEzC,6BAA6B,OAAO,WAAmC;GACrE,MAAM,0BAA0B,OAAO;;EAE1C;CACF,CAAC;AAEF,MAAa,UAAU,WAAW;AAClC,IAAA,qBAAe,WAAW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UserSettings, c as actions, d as usersSlice, i as UserSession, l as initialState, n as GlobalSettings, o as UserSliceType, r as User, s as _default, t as CustomColumn, u as sliceName } from "../index-
|
|
1
|
+
import { a as UserSettings, c as actions, d as usersSlice, i as UserSession, l as initialState, n as GlobalSettings, o as UserSliceType, r as User, s as _default, t as CustomColumn, u as sliceName } from "../index-BFlHWzjv.cjs";
|
|
2
2
|
export { CustomColumn, GlobalSettings, User, UserSession, UserSettings, UserSliceType, actions, _default as default, initialState, sliceName, usersSlice };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UserSettings, c as actions, d as usersSlice, i as UserSession, l as initialState, n as GlobalSettings, o as UserSliceType, r as User, s as _default, t as CustomColumn, u as sliceName } from "../index-
|
|
1
|
+
import { a as UserSettings, c as actions, d as usersSlice, i as UserSession, l as initialState, n as GlobalSettings, o as UserSliceType, r as User, s as _default, t as CustomColumn, u as sliceName } from "../index-ez3oxfRo.js";
|
|
2
2
|
export { CustomColumn, GlobalSettings, User, UserSession, UserSettings, UserSliceType, actions, _default as default, initialState, sliceName, usersSlice };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/usersSlice/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 { User as BackendUser, DeploymentPhase, TenantInfo, TenantsIdName } from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { FilterOperator, PermissionSet, Role } from '../constants';\nimport { defaultPermissionSets, rolesById } from '../constants';\nimport type { ReadState } from './constants';\nimport { READ_STATES } from './constants';\n\nexport const sliceName = 'users';\nexport type User = BackendUser & TenantInfo & { tenants?: TenantsIdName };\nexport type UserSession = {\n expiresAt?: string;\n token: string;\n};\nexport type CustomColumn = {\n attribute: {\n name: string;\n scope: string;\n };\n size: number;\n};\n\ntype FilterOption = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string;\n};\nexport type GlobalSettings = {\n [x: string]: any;\n id_attribute?: {\n attribute: string;\n scope: string;\n };\n previousFilters: FilterOption[];\n previousPhases: DeploymentPhase[][];\n retries: number;\n};\ntype Column = {\n id: string;\n key: string;\n name: string;\n scope: string;\n title: string;\n};\nexport type UserSettings = {\n [x: string]: any;\n columnSelection: Column[];\n feedbackCollectedAt?: string;\n firstLoginTimestamp: null | string;\n mode?: 'light' | 'dark';\n onboarding: Partial<{\n address: string;\n approach: 'physical' | 'virtual' | 'mcu' | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceType: string[] | string | null;\n progress: string | null;\n showTips: null | boolean;\n showTipsDialog: boolean;\n }>;\n securityAlertDismissedTimestamp: null | string;\n tooltips?: object;\n trackingConsentGiven?: boolean;\n};\n\nexport type UserSliceType = {\n byId: Record<string, User>;\n currentSession?: UserSession | object;\n currentUser: string | null;\n customColumns: CustomColumn[];\n globalSettings: GlobalSettings;\n permissionSetsById: Record<string, PermissionSet>;\n qrCode: string | null;\n rolesById: Record<string, Role>;\n rolesInitialized: boolean;\n settingsInitialized: boolean;\n showConnectDeviceDialog: boolean;\n showFeedbackDialog: boolean;\n showStartupNotification: boolean;\n tooltips: {\n byId: Record<string, { readState: ReadState }>;\n };\n userSettings: UserSettings;\n userSettingsInitialized: boolean;\n};\n\nexport const initialState: UserSliceType = {\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n rolesInitialized: false,\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {},\n firstLoginTimestamp: null,\n securityAlertDismissedTimestamp: null\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action: PayloadAction<string | null>) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action: PayloadAction<UserSession>) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action: PayloadAction<Record<string, User>>) => {\n state.byId = action.payload;\n },\n receivedUser: (state, action: PayloadAction<User>) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n removedUser: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action: PayloadAction<Partial<User> & { id: string }>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action: PayloadAction<Record<string, PermissionSet>>) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action: PayloadAction<Record<string, Role>>) => {\n state.rolesById = action.payload;\n state.rolesInitialized = true;\n },\n finishedRoleInitialization: (state, action) => {\n state.rolesInitialized = action.payload;\n },\n createdRole: (state, action: PayloadAction<Role>) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action: PayloadAction<CustomColumn[]>) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action: PayloadAction<GlobalSettings>) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action: PayloadAction<UserSettings>) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action: PayloadAction<{ id: string; readState: ReadState }>) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };\n },\n setTooltipsState: (state, action: PayloadAction<UserSliceType['tooltips']['byId']>) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action: PayloadAction<boolean>) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action: PayloadAction<boolean>) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action: PayloadAction<boolean>) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":";;;AAsBA,MAAa,YAAY;AA+EzB,MAAa,eAA8B;CACzC,MAAM,EAAE;CACR,aAAa;CACb,gBAAgB,EAEf;CACD,eAAe,EAAE;CACjB,QAAQ;CACR,gBAAgB;EACd,cAAc,KAAA;EACd,iBAAiB,EAAE;EACnB,gBAAgB,EAAE;EAClB,SAAS;EACV;CACD,oBAAoB,EAClB,GAAG,uBACJ;CACD,WAAW,EACT,GAAG,WACJ;CACD,kBAAkB;CAClB,qBAAqB;CACrB,yBAAyB;CACzB,oBAAoB;CACpB,yBAAyB;CACzB,UAAU,EACR,MAAM,EAEL,EACF;CACD,cAAc;EACZ,iBAAiB,EAAE;EACnB,YAAY,EAAE;EACd,qBAAqB;EACrB,iCAAiC;EAClC;CACD,yBAAyB;CAC1B;AAED,MAAa,aAAa,YAAY;CACpC,MAAM;CACN;CACA,UAAU;EACR,iBAAiB,OAAO,WAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/usersSlice/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 { User as BackendUser, DeploymentPhase, TenantInfo, TenantsIdName } from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { FilterOperator, PermissionSet, Role } from '../constants';\nimport { defaultPermissionSets, rolesById } from '../constants';\nimport type { ReadState } from './constants';\nimport { READ_STATES } from './constants';\n\nexport const sliceName = 'users';\nexport type User = BackendUser & TenantInfo & { tenants?: TenantsIdName };\nexport type UserSession = {\n expiresAt?: string;\n token: string;\n};\nexport type CustomColumn = {\n attribute: {\n name: string;\n scope: string;\n };\n size: number;\n};\n\ntype FilterOption = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string;\n};\nexport type GlobalSettings = {\n [x: string]: any;\n id_attribute?: {\n attribute: string;\n scope: string;\n };\n previousFilters: FilterOption[];\n previousPhases: DeploymentPhase[][];\n retries: number;\n};\ntype Column = {\n id: string;\n key: string;\n name: string;\n scope: string;\n title: string;\n};\nexport type UserSettings = {\n [x: string]: any;\n columnSelection: Column[];\n feedbackCollectedAt?: string;\n firstLoginTimestamp: null | string;\n mode?: 'light' | 'dark';\n onboarding: Partial<{\n address: string;\n approach: 'physical' | 'virtual' | 'mcu' | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceType: string[] | string | null;\n progress: string | null;\n showTips: null | boolean;\n showTipsDialog: boolean;\n }>;\n securityAlertDismissedTimestamp: null | string;\n tooltips?: object;\n trackingConsentGiven?: boolean;\n};\n\nexport type UserSliceType = {\n byId: Record<string, User>;\n currentSession?: UserSession | object;\n currentUser: string | null;\n customColumns: CustomColumn[];\n globalSettings: GlobalSettings;\n permissionSetsById: Record<string, PermissionSet>;\n qrCode: string | null;\n rolesById: Record<string, Role>;\n rolesInitialized: boolean;\n settingsInitialized: boolean;\n showConnectDeviceDialog: boolean;\n showFeedbackDialog: boolean;\n showStartupNotification: boolean;\n tooltips: {\n byId: Record<string, { readState: ReadState }>;\n };\n userSettings: UserSettings;\n userSettingsInitialized: boolean;\n};\n\nexport const initialState: UserSliceType = {\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n rolesInitialized: false,\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {},\n firstLoginTimestamp: null,\n securityAlertDismissedTimestamp: null\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action: PayloadAction<string | null>) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action: PayloadAction<UserSession>) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action: PayloadAction<Record<string, User>>) => {\n state.byId = action.payload;\n },\n receivedUser: (state, action: PayloadAction<User>) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n removedUser: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action: PayloadAction<Partial<User> & { id: string }>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action: PayloadAction<Record<string, PermissionSet>>) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action: PayloadAction<Record<string, Role>>) => {\n state.rolesById = action.payload;\n state.rolesInitialized = true;\n },\n finishedRoleInitialization: (state, action) => {\n state.rolesInitialized = action.payload;\n },\n createdRole: (state, action: PayloadAction<Role>) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action: PayloadAction<CustomColumn[]>) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action: PayloadAction<GlobalSettings>) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action: PayloadAction<UserSettings>) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action: PayloadAction<{ id: string; readState: ReadState }>) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };\n },\n setTooltipsState: (state, action: PayloadAction<UserSliceType['tooltips']['byId']>) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action: PayloadAction<boolean>) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action: PayloadAction<boolean>) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action: PayloadAction<boolean>) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":";;;AAsBA,MAAa,YAAY;AA+EzB,MAAa,eAA8B;CACzC,MAAM,EAAE;CACR,aAAa;CACb,gBAAgB,EAEf;CACD,eAAe,EAAE;CACjB,QAA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AAO,QAAQ;IAClC,GAAG,OAAO;IACX;;EAEH,cAAc,OAAO,WAAkC;GAErD,MAAM,GAAG,OAAO,UAAU,aAAa,GAAG,cAAc,MAAM;GAC9D,MAAM,YAAY;;EAEpB,mBAAmB,OAAO,WAA0C;GAClE,MAAM,gBAAgB,OAAO;;EAE/B,oBAAoB,OAAO,WAA0C;GACnE,MAAM,sBAAsB;GAC5B,MAAM,iBAAiB;IACrB,GAAG,MAAM;IACT,GAAG,OAAO;IACX;;EAEH,kBAAkB,OAAO,WAAwC;GAC/D,MAAM,0BAA0B;GAChC,MAAM,eAAe;IACnB,GAAG,MAAM;IACT,GAAG,OAAO;IACX;;EAEH,kBAAkB,OAAO,WAAgE;GACvF,MAAM,EAAE,IAAI,YAAY,YAAY,SAAS,OAAO;GACpD,MAAM,SAAS,KAAK,MAAM;IAAE,GAAG,MAAM,SAAS,KAAK;IAAK;IAAW;;EAErE,mBAAmB,OAAO,WAA6D;GACrF,MAAM,SAAS,OAAO;IACpB,GAAG,MAAM,SAAS;IAClB,GAAG,OAAO;IACX;;EAEH,wBAAwB,OAAO,WAAmC;GAChE,MAAM,qBAAqB,OAAO;;EAEpC,0BAA0B,OAAO,WAAmC;GAClE,MAAM,0BAA0B,OAAO;;EAEzC,6BAA6B,OAAO,WAAmC;GACrE,MAAM,0BAA0B,OAAO;;EAE1C;CACF,CAAC;AAEF,MAAa,UAAU,WAAW;AAClC,IAAA,qBAAe,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ReadState } from "../constants-G3wymKIl.cjs";
|
|
2
|
-
import { i as UserSession, t as CustomColumn } from "../index-
|
|
2
|
+
import { i as UserSession, t as CustomColumn } from "../index-BFlHWzjv.cjs";
|
|
3
3
|
import * as _$_northern_tech_utils_constants0 from "@northern.tech/utils/constants";
|
|
4
4
|
import * as _$_northern_tech_types_types_gen0 from "@northern.tech/types/types.gen";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ReadState } from "../constants-Cpgyuy_r.js";
|
|
2
|
-
import { i as UserSession, t as CustomColumn } from "../index-
|
|
2
|
+
import { i as UserSession, t as CustomColumn } from "../index-ez3oxfRo.js";
|
|
3
3
|
import * as _$_northern_tech_utils_constants0 from "@northern.tech/utils/constants";
|
|
4
4
|
import * as _$_northern_tech_types_types_gen0 from "@northern.tech/types/types.gen";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.cjs","names":["isDarkMode","READ_STATES","twoFAStates","defaultIdAttribute","DEVICE_ONLINE_CUTOFF"],"sources":["../../src/usersSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport { DEVICE_ONLINE_CUTOFF, defaultIdAttribute } from '../constants';\nimport { twoFAStates } from '../constants';\nimport type { RootState } from '../store';\nimport { isDarkMode } from '../utils';\nimport { READ_STATES } from './constants';\nimport type { User } from './index';\n\nconst emptyObject = {} as User;\n\nexport const getRolesById = (state: RootState) => state.users.rolesById;\nexport const getTooltipsById = (state: RootState) => state.users.tooltips.byId;\nexport const getGlobalSettings = (state: RootState) => state.users.globalSettings;\nexport const getGlobalSettingsInitialized = (state: RootState) => state.users.settingsInitialized;\nexport const getUserSettingsInitialized = (state: RootState) => state.users.userSettingsInitialized;\nconst getCurrentUserId = (state: RootState) => state.users.currentUser;\nexport const getUsersById = (state: RootState) => state.users.byId;\n\nexport const getUsersList = createSelector([getUsersById], usersById => Object.values(usersById));\nexport const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) =>\n userId ? (usersById[userId] ?? emptyObject) : emptyObject\n);\nexport const getUserSettings = (state: RootState) => state.users.userSettings;\nexport const getSelectedDeviceAttribute = createSelector([getUserSettings], ({ columnSelection }) =>\n columnSelection.map(attribute => ({ attribute: attribute.key, scope: attribute.scope }))\n);\nexport const getIsDarkMode = createSelector([getUserSettings], ({ mode }) => isDarkMode(mode ?? ''));\n\nexport const getReadAllHelptips = createSelector([getTooltipsById], tooltips =>\n Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)\n);\n\nexport const getTooltipsState = createSelector([getTooltipsById, getUserSettings], (byId, { tooltips = {} }) =>\n Object.entries(byId).reduce(\n (accu, [id, value]) => {\n accu[id] = { ...accu[id], ...value };\n return accu;\n },\n { ...tooltips }\n )\n);\n\nexport const getHas2FA = createSelector(\n [getCurrentUser],\n currentUser => currentUser.hasOwnProperty('tfa_status') && (currentUser as User).tfa_status === twoFAStates.enabled\n);\n\nexport const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);\n\nexport const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({\n interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,\n intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName\n}));\n\nexport const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([value, role]) => ({ value, ...role })));\n\nexport const getCurrentSession = (state: RootState) => state.users.currentSession;\nexport const getRolesInitialized = (state: RootState) => state.users.rolesInitialized;\n\nexport const getSecurityAlertDismissedTimestamp = (state: RootState) => state.users.userSettings.securityAlertDismissedTimestamp;\n"],"mappings":";;;;;;;AAsBA,MAAM,cAAc,EAAE;AAEtB,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,MAAM,SAAS;AAC1E,MAAa,qBAAqB,UAAqB,MAAM,MAAM;AACnE,MAAa,gCAAgC,UAAqB,MAAM,MAAM;AAC9E,MAAa,8BAA8B,UAAqB,MAAM,MAAM;AAC5E,MAAM,oBAAoB,UAAqB,MAAM,MAAM;AAC3D,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAE9D,MAAa,gBAAA,GAAA,iBAAA,gBAA8B,CAAC,aAAa,GAAE,cAAa,OAAO,OAAO,UAAU,CAAC;AACjG,MAAa,kBAAA,GAAA,iBAAA,gBAAgC,CAAC,cAAc,iBAAiB,GAAG,WAAW,WACzF,SAAU,UAAU,WAAW,cAAe,YAC/C;AACD,MAAa,mBAAmB,UAAqB,MAAM,MAAM;AACjE,MAAa,8BAAA,GAAA,iBAAA,gBAA4C,CAAC,gBAAgB,GAAG,EAAE,sBAC7E,gBAAgB,KAAI,eAAc;CAAE,WAAW,UAAU;CAAK,OAAO,UAAU;CAAO,EAAE,CACzF;AACD,MAAa,iBAAA,GAAA,iBAAA,gBAA+B,CAAC,gBAAgB,GAAG,EAAE,WAAWA,cAAAA,WAAW,QAAQ,GAAG,CAAC;AAEpG,MAAa,sBAAA,GAAA,iBAAA,gBAAoC,CAAC,gBAAgB,GAAE,aAClE,OAAO,OAAO,SAAS,CAAC,OAAO,EAAE,gBAAgB,cAAcC,kBAAAA,YAAY,KAAK,CACjF;AAED,MAAa,oBAAA,GAAA,iBAAA,gBAAkC,CAAC,iBAAiB,gBAAgB,GAAG,MAAM,EAAE,WAAW,EAAE,OACvG,OAAO,QAAQ,KAAK,CAAC,QAClB,MAAM,CAAC,IAAI,WAAW;
|
|
1
|
+
{"version":3,"file":"selectors.cjs","names":["isDarkMode","READ_STATES","twoFAStates","defaultIdAttribute","DEVICE_ONLINE_CUTOFF"],"sources":["../../src/usersSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport { DEVICE_ONLINE_CUTOFF, defaultIdAttribute } from '../constants';\nimport { twoFAStates } from '../constants';\nimport type { RootState } from '../store';\nimport { isDarkMode } from '../utils';\nimport { READ_STATES } from './constants';\nimport type { User } from './index';\n\nconst emptyObject = {} as User;\n\nexport const getRolesById = (state: RootState) => state.users.rolesById;\nexport const getTooltipsById = (state: RootState) => state.users.tooltips.byId;\nexport const getGlobalSettings = (state: RootState) => state.users.globalSettings;\nexport const getGlobalSettingsInitialized = (state: RootState) => state.users.settingsInitialized;\nexport const getUserSettingsInitialized = (state: RootState) => state.users.userSettingsInitialized;\nconst getCurrentUserId = (state: RootState) => state.users.currentUser;\nexport const getUsersById = (state: RootState) => state.users.byId;\n\nexport const getUsersList = createSelector([getUsersById], usersById => Object.values(usersById));\nexport const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) =>\n userId ? (usersById[userId] ?? emptyObject) : emptyObject\n);\nexport const getUserSettings = (state: RootState) => state.users.userSettings;\nexport const getSelectedDeviceAttribute = createSelector([getUserSettings], ({ columnSelection }) =>\n columnSelection.map(attribute => ({ attribute: attribute.key, scope: attribute.scope }))\n);\nexport const getIsDarkMode = createSelector([getUserSettings], ({ mode }) => isDarkMode(mode ?? ''));\n\nexport const getReadAllHelptips = createSelector([getTooltipsById], tooltips =>\n Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)\n);\n\nexport const getTooltipsState = createSelector([getTooltipsById, getUserSettings], (byId, { tooltips = {} }) =>\n Object.entries(byId).reduce(\n (accu, [id, value]) => {\n accu[id] = { ...accu[id], ...value };\n return accu;\n },\n { ...tooltips }\n )\n);\n\nexport const getHas2FA = createSelector(\n [getCurrentUser],\n currentUser => currentUser.hasOwnProperty('tfa_status') && (currentUser as User).tfa_status === twoFAStates.enabled\n);\n\nexport const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);\n\nexport const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({\n interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,\n intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName\n}));\n\nexport const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([value, role]) => ({ value, ...role })));\n\nexport const getCurrentSession = (state: RootState) => state.users.currentSession;\nexport const getRolesInitialized = (state: RootState) => state.users.rolesInitialized;\n\nexport const getSecurityAlertDismissedTimestamp = (state: RootState) => state.users.userSettings.securityAlertDismissedTimestamp;\n"],"mappings":";;;;;;;AAsBA,MAAM,cAAc,EAAE;AAEtB,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,MAAM,SAAS;AAC1E,MAAa,qBAAqB,UAAqB,MAAM,MAAM;AACnE,MAAa,gCAAgC,UAAqB,MAAM,MAAM;AAC9E,MAAa,8BAA8B,UAAqB,MAAM,MAAM;AAC5E,MAAM,oBAAoB,UAAqB,MAAM,MAAM;AAC3D,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAE9D,MAAa,gBAAA,GAAA,iBAAA,gBAA8B,CAAC,aAAa,GAAE,cAAa,OAAO,OAAO,UAAU,CAAC;AACjG,MAAa,kBAAA,GAAA,iBAAA,gBAAgC,CAAC,cAAc,iBAAiB,GAAG,WAAW,WACzF,SAAU,UAAU,WAAW,cAAe,YAC/C;AACD,MAAa,mBAAmB,UAAqB,MAAM,MAAM;AACjE,MAAa,8BAAA,GAAA,iBAAA,gBAA4C,CAAC,gBAAgB,GAAG,EAAE,sBAC7E,gBAAgB,KAAI,eAAc;CAAE,WAAW,UAAU;CAAK,OAAO,UAAU;CAAO,EAAE,CACzF;AACD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
1
|
import { i as ReadState } from "../constants-G3wymKIl.cjs";
|
|
2
|
-
import { a as UserSettings, i as UserSession, n as GlobalSettings, o as UserSliceType, r as User } from "../index-
|
|
3
|
-
import {
|
|
2
|
+
import { a as UserSettings, i as UserSession, n as GlobalSettings, o as UserSliceType, r as User } from "../index-BFlHWzjv.cjs";
|
|
3
|
+
import { i as ReleaseSliceType } from "../index-C-q632wO.cjs";
|
|
4
4
|
import { n as OnboardingSliceType } from "../index-UPc3wvVd.cjs";
|
|
5
5
|
import { o as DeploymentsSliceType } from "../index-BP0uAq36.cjs";
|
|
6
|
-
import { s as DeviceSliceType } from "../index-
|
|
7
|
-
import { t as AppSliceType } from "../index-
|
|
8
|
-
import { t as MonitorSliceType } from "../index-
|
|
9
|
-
import { t as OrganizationSliceType } from "../index-
|
|
10
|
-
import { r as RootState } from "../store-
|
|
6
|
+
import { s as DeviceSliceType } from "../index-B64X5ozM.cjs";
|
|
7
|
+
import { t as AppSliceType } from "../index-DwACbyUg.cjs";
|
|
8
|
+
import { t as MonitorSliceType } from "../index-CT5hgXm9.cjs";
|
|
9
|
+
import { t as OrganizationSliceType } from "../index-BbaS7MzW.cjs";
|
|
10
|
+
import { r as RootState } from "../store-b5cF2WB5.cjs";
|
|
11
11
|
import * as _$_northern_tech_utils_constants0 from "@northern.tech/utils/constants";
|
|
12
12
|
import * as _$_northern_tech_types_types_gen0 from "@northern.tech/types/types.gen";
|
|
13
13
|
import * as _$reselect from "reselect";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { i as ReadState } from "../constants-Cpgyuy_r.js";
|
|
2
|
-
import { a as UserSettings, i as UserSession, n as GlobalSettings, o as UserSliceType, r as User } from "../index-
|
|
3
|
-
import {
|
|
2
|
+
import { a as UserSettings, i as UserSession, n as GlobalSettings, o as UserSliceType, r as User } from "../index-ez3oxfRo.js";
|
|
3
|
+
import { i as ReleaseSliceType } from "../index-CyokFK2e.js";
|
|
4
4
|
import { n as OnboardingSliceType } from "../index-CJkrL0oA.js";
|
|
5
5
|
import { o as DeploymentsSliceType } from "../index-CkwVnIqd.js";
|
|
6
|
-
import { s as DeviceSliceType } from "../index-
|
|
7
|
-
import { t as AppSliceType } from "../index-
|
|
8
|
-
import { t as MonitorSliceType } from "../index-
|
|
9
|
-
import { t as OrganizationSliceType } from "../index-
|
|
10
|
-
import { r as RootState } from "../store-
|
|
6
|
+
import { s as DeviceSliceType } from "../index-BI9O8JWe.js";
|
|
7
|
+
import { t as AppSliceType } from "../index-Bp1WpATs.js";
|
|
8
|
+
import { t as MonitorSliceType } from "../index-DUvrw_Ed.js";
|
|
9
|
+
import { t as OrganizationSliceType } from "../index-C6wNUfiV.js";
|
|
10
|
+
import { r as RootState } from "../store-D-xvZXiY.js";
|
|
11
11
|
import * as _$_northern_tech_utils_constants0 from "@northern.tech/utils/constants";
|
|
12
12
|
import * as _$_northern_tech_types_types_gen0 from "@northern.tech/types/types.gen";
|
|
13
13
|
import * as _$reselect from "reselect";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","names":[],"sources":["../../src/usersSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport { DEVICE_ONLINE_CUTOFF, defaultIdAttribute } from '../constants';\nimport { twoFAStates } from '../constants';\nimport type { RootState } from '../store';\nimport { isDarkMode } from '../utils';\nimport { READ_STATES } from './constants';\nimport type { User } from './index';\n\nconst emptyObject = {} as User;\n\nexport const getRolesById = (state: RootState) => state.users.rolesById;\nexport const getTooltipsById = (state: RootState) => state.users.tooltips.byId;\nexport const getGlobalSettings = (state: RootState) => state.users.globalSettings;\nexport const getGlobalSettingsInitialized = (state: RootState) => state.users.settingsInitialized;\nexport const getUserSettingsInitialized = (state: RootState) => state.users.userSettingsInitialized;\nconst getCurrentUserId = (state: RootState) => state.users.currentUser;\nexport const getUsersById = (state: RootState) => state.users.byId;\n\nexport const getUsersList = createSelector([getUsersById], usersById => Object.values(usersById));\nexport const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) =>\n userId ? (usersById[userId] ?? emptyObject) : emptyObject\n);\nexport const getUserSettings = (state: RootState) => state.users.userSettings;\nexport const getSelectedDeviceAttribute = createSelector([getUserSettings], ({ columnSelection }) =>\n columnSelection.map(attribute => ({ attribute: attribute.key, scope: attribute.scope }))\n);\nexport const getIsDarkMode = createSelector([getUserSettings], ({ mode }) => isDarkMode(mode ?? ''));\n\nexport const getReadAllHelptips = createSelector([getTooltipsById], tooltips =>\n Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)\n);\n\nexport const getTooltipsState = createSelector([getTooltipsById, getUserSettings], (byId, { tooltips = {} }) =>\n Object.entries(byId).reduce(\n (accu, [id, value]) => {\n accu[id] = { ...accu[id], ...value };\n return accu;\n },\n { ...tooltips }\n )\n);\n\nexport const getHas2FA = createSelector(\n [getCurrentUser],\n currentUser => currentUser.hasOwnProperty('tfa_status') && (currentUser as User).tfa_status === twoFAStates.enabled\n);\n\nexport const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);\n\nexport const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({\n interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,\n intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName\n}));\n\nexport const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([value, role]) => ({ value, ...role })));\n\nexport const getCurrentSession = (state: RootState) => state.users.currentSession;\nexport const getRolesInitialized = (state: RootState) => state.users.rolesInitialized;\n\nexport const getSecurityAlertDismissedTimestamp = (state: RootState) => state.users.userSettings.securityAlertDismissedTimestamp;\n"],"mappings":";;;;AAsBA,MAAM,cAAc,EAAE;AAEtB,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,MAAM,SAAS;AAC1E,MAAa,qBAAqB,UAAqB,MAAM,MAAM;AACnE,MAAa,gCAAgC,UAAqB,MAAM,MAAM;AAC9E,MAAa,8BAA8B,UAAqB,MAAM,MAAM;AAC5E,MAAM,oBAAoB,UAAqB,MAAM,MAAM;AAC3D,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAE9D,MAAa,eAAe,eAAe,CAAC,aAAa,GAAE,cAAa,OAAO,OAAO,UAAU,CAAC;AACjG,MAAa,iBAAiB,eAAe,CAAC,cAAc,iBAAiB,GAAG,WAAW,WACzF,SAAU,UAAU,WAAW,cAAe,YAC/C;AACD,MAAa,mBAAmB,UAAqB,MAAM,MAAM;AACjE,MAAa,6BAA6B,eAAe,CAAC,gBAAgB,GAAG,EAAE,sBAC7E,gBAAgB,KAAI,eAAc;CAAE,WAAW,UAAU;CAAK,OAAO,UAAU;CAAO,EAAE,CACzF;AACD,MAAa,gBAAgB,eAAe,CAAC,gBAAgB,GAAG,EAAE,WAAW,WAAW,QAAQ,GAAG,CAAC;AAEpG,MAAa,qBAAqB,eAAe,CAAC,gBAAgB,GAAE,aAClE,OAAO,OAAO,SAAS,CAAC,OAAO,EAAE,gBAAgB,cAAc,YAAY,KAAK,CACjF;AAED,MAAa,mBAAmB,eAAe,CAAC,iBAAiB,gBAAgB,GAAG,MAAM,EAAE,WAAW,EAAE,OACvG,OAAO,QAAQ,KAAK,CAAC,QAClB,MAAM,CAAC,IAAI,WAAW;
|
|
1
|
+
{"version":3,"file":"selectors.js","names":[],"sources":["../../src/usersSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport { DEVICE_ONLINE_CUTOFF, defaultIdAttribute } from '../constants';\nimport { twoFAStates } from '../constants';\nimport type { RootState } from '../store';\nimport { isDarkMode } from '../utils';\nimport { READ_STATES } from './constants';\nimport type { User } from './index';\n\nconst emptyObject = {} as User;\n\nexport const getRolesById = (state: RootState) => state.users.rolesById;\nexport const getTooltipsById = (state: RootState) => state.users.tooltips.byId;\nexport const getGlobalSettings = (state: RootState) => state.users.globalSettings;\nexport const getGlobalSettingsInitialized = (state: RootState) => state.users.settingsInitialized;\nexport const getUserSettingsInitialized = (state: RootState) => state.users.userSettingsInitialized;\nconst getCurrentUserId = (state: RootState) => state.users.currentUser;\nexport const getUsersById = (state: RootState) => state.users.byId;\n\nexport const getUsersList = createSelector([getUsersById], usersById => Object.values(usersById));\nexport const getCurrentUser = createSelector([getUsersById, getCurrentUserId], (usersById, userId) =>\n userId ? (usersById[userId] ?? emptyObject) : emptyObject\n);\nexport const getUserSettings = (state: RootState) => state.users.userSettings;\nexport const getSelectedDeviceAttribute = createSelector([getUserSettings], ({ columnSelection }) =>\n columnSelection.map(attribute => ({ attribute: attribute.key, scope: attribute.scope }))\n);\nexport const getIsDarkMode = createSelector([getUserSettings], ({ mode }) => isDarkMode(mode ?? ''));\n\nexport const getReadAllHelptips = createSelector([getTooltipsById], tooltips =>\n Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)\n);\n\nexport const getTooltipsState = createSelector([getTooltipsById, getUserSettings], (byId, { tooltips = {} }) =>\n Object.entries(byId).reduce(\n (accu, [id, value]) => {\n accu[id] = { ...accu[id], ...value };\n return accu;\n },\n { ...tooltips }\n )\n);\n\nexport const getHas2FA = createSelector(\n [getCurrentUser],\n currentUser => currentUser.hasOwnProperty('tfa_status') && (currentUser as User).tfa_status === twoFAStates.enabled\n);\n\nexport const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);\n\nexport const getOfflineThresholdSettings = createSelector([getGlobalSettings], ({ offlineThreshold }) => ({\n interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,\n intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName\n}));\n\nexport const getRolesList = createSelector([getRolesById], rolesById => Object.entries(rolesById).map(([value, role]) => ({ value, ...role })));\n\nexport const getCurrentSession = (state: RootState) => state.users.currentSession;\nexport const getRolesInitialized = (state: RootState) => state.users.rolesInitialized;\n\nexport const getSecurityAlertDismissedTimestamp = (state: RootState) => state.users.userSettings.securityAlertDismissedTimestamp;\n"],"mappings":";;;;AAsBA,MAAM,cAAc,EAAE;AAEtB,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,MAAM,SAAS;AAC1E,MAAa,qBAAqB,UAAqB,MAAM,MAAM;AACnE,MAAa,gCAAgC,UAAqB,MAAM,MAAM;AAC9E,MAAa,8BAA8B,UAAqB,MAAM,MAAM;AAC5E,MAAM,oBAAoB,UAAqB,MAAM,MAAM;AAC3D,MAAa,gBAAgB,UAAqB,MAAM,MAAM;AAE9D,MAAa,eAAe,eAAe,CAAC,aAAa,GAAE,cAAa,OAAO,OAAO,UAAU,CAAC;AACjG,MAAa,iBAAiB,eAAe,CAAC,cAAc,iBAAiB,GAAG,WAAW,WACzF,SAAU,UAAU,WAAW,cAAe,YAC/C;AACD,MAAa,mBAAmB,UAAqB,MAAM,MAAM;AACjE,MAAa,6BAA6B,eAAe,CAAC,gBAAgB,GAAG,EAAE,sBAC7E,gBAAgB,KAAI,eAAc;CAAE,WAAW,UAAU;CAAK,OAAO,UAAU;CAAO,EAAE,CACzF;AACD,MAAa,gBAAgB,eAAe,CAAC,gBAAgB,GAAG,EAAE,WAAW,WAAW,QAAQ,GAAG,CAAC;AAEpG,MAAa,qBAAqB,eAAe,CAAC,gBAAgB,GAAE,aAClE,OAAO,OAAO,SAAS,CAAC,OAAO,EAAE,gBAAgB,cAAc,YAAY,KAAK,CACjF;AAED,MAAa,mBAAmB,eAAe,CAAC,iBAAiB,gBAAgB,GAAG,MAAM,EAAE,WAAW,EAAE,OACvG,OAAO,QAAQ,KAAK,CAAC,QAClB,MAAM,CAAC,IAAI,WAAW;CACrB,KAAK,MAAM;EAAE,GAAG,KAAK;EAAK,GAAG;EAAO;CACpC,OAAO;GAET,EAAE,GAAG,UAAU,CAChB,CACF;AAED,MAAa,YAAY,eACvB,CAAC,eAAe,GAChB,gBAAe,YAAY,eAAe,aAAa,IAAK,YAAqB,eAAe,YAAY,QAC7G;AAED,MAAa,iBAAiB,eAAe,CAAC,kBAAkB,GAAG,EAAE,eAAe,EAAE,GAAG,oBAAoB,OAAO,aAAa;AAEjI,MAAa,8BAA8B,eAAe,CAAC,kBAAkB,GAAG,EAAE,wBAAwB;CACxG,UAAU,kBAAkB,YAAY,qBAAqB;CAC7D,cAAc,kBAAkB,gBAAgB,qBAAqB;CACtE,EAAE;AAEH,MAAa,eAAe,eAAe,CAAC,aAAa,GAAE,cAAa,OAAO,QAAQ,UAAU,CAAC,KAAK,CAAC,OAAO,WAAW;CAAE;CAAO,GAAG;CAAM,EAAE,CAAC;AAE/I,MAAa,qBAAqB,UAAqB,MAAM,MAAM;AACnE,MAAa,uBAAuB,UAAqB,MAAM,MAAM;AAErE,MAAa,sCAAsC,UAAqB,MAAM,MAAM,aAAa"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as Role, c as AuditLogPermission, h as GroupsPermission, k as UserManagementPermission, p as DeploymentPermission, v as PermissionSet, x as ReleasesPermission } from "../constants-
|
|
1
|
+
import { S as Role, c as AuditLogPermission, h as GroupsPermission, k as UserManagementPermission, p as DeploymentPermission, v as PermissionSet, x as ReleasesPermission } from "../constants-BrGIx40B.cjs";
|
|
2
2
|
import { i as ReadState } from "../constants-G3wymKIl.cjs";
|
|
3
|
-
import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User$1, t as CustomColumn } from "../index-
|
|
4
|
-
import { s as SnackbarContent } from "../index-
|
|
5
|
-
import { r as RootState, t as AppDispatch } from "../store-
|
|
3
|
+
import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User$1, t as CustomColumn } from "../index-BFlHWzjv.cjs";
|
|
4
|
+
import { s as SnackbarContent } from "../index-DwACbyUg.cjs";
|
|
5
|
+
import { r as RootState, t as AppDispatch } from "../store-b5cF2WB5.cjs";
|
|
6
6
|
import * as _$_reduxjs_toolkit0 from "@reduxjs/toolkit";
|
|
7
7
|
import * as _$redux from "redux";
|
|
8
8
|
import { PersonalAccessToken } from "@northern.tech/types/MenderTypes";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as Role, c as AuditLogPermission, h as GroupsPermission, k as UserManagementPermission, p as DeploymentPermission, v as PermissionSet, x as ReleasesPermission } from "../constants-
|
|
1
|
+
import { S as Role, c as AuditLogPermission, h as GroupsPermission, k as UserManagementPermission, p as DeploymentPermission, v as PermissionSet, x as ReleasesPermission } from "../constants-CjO3_FOH.js";
|
|
2
2
|
import { i as ReadState } from "../constants-Cpgyuy_r.js";
|
|
3
|
-
import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User$1, t as CustomColumn } from "../index-
|
|
4
|
-
import { s as SnackbarContent } from "../index-
|
|
5
|
-
import { r as RootState, t as AppDispatch } from "../store-
|
|
3
|
+
import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User$1, t as CustomColumn } from "../index-ez3oxfRo.js";
|
|
4
|
+
import { s as SnackbarContent } from "../index-Bp1WpATs.js";
|
|
5
|
+
import { r as RootState, t as AppDispatch } from "../store-D-xvZXiY.js";
|
|
6
6
|
import * as _$_reduxjs_toolkit0 from "@reduxjs/toolkit";
|
|
7
7
|
import * as _$axios from "axios";
|
|
8
8
|
import * as _$redux from "redux";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as PricePreview } from "./types-
|
|
1
|
+
import { H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey, xt as FilterOperator } from "./constants-CjO3_FOH.js";
|
|
2
|
+
import { a as PricePreview } from "./types-BPyM8Inu.js";
|
|
3
3
|
import { t as Deployment } from "./index-CkwVnIqd.js";
|
|
4
|
-
import { c as InventoryAttributes, n as DeviceFilter, r as DeviceGroup } from "./index-
|
|
4
|
+
import { c as InventoryAttributes, n as DeviceFilter, r as DeviceGroup } from "./index-BI9O8JWe.js";
|
|
5
5
|
import { AxiosError } from "axios";
|
|
6
6
|
import { AttributeFilterPredicate, AttributeV2, FilterV2, InvoiceLineItem, Scope } from "@northern.tech/types/MenderTypes";
|
|
7
7
|
|
|
@@ -102,4 +102,4 @@ declare const convertToBackendSPLimits: (limits: Record<string, number | string>
|
|
|
102
102
|
}>;
|
|
103
103
|
//#endregion
|
|
104
104
|
export { statCollector as C, progress as S, stripUndefined as T, mapFiltersToTerms as _, convertToBackendSPLimits as a, mergePermissions as b, filtersFilter as c, getDeploymentState as d, groupDeploymentDevicesStats as f, mapDeviceAttributes as g, listItemMapper as h, convertDeviceListStateToFilters as i, generateDeploymentGroupDetails as l, isDarkMode as m, ErrorWithResponse as n, ensureVersionString as o, groupDeploymentStats as p, FilterTerm as r, extractErrorMessage as s, DeploymentStats as t, getComparisonCompatibleVersion as u, mapTermsToFilters as v, stringToBoolean as w, parseSubscriptionPreview as x, mapUserRolesToUiPermissions as y };
|
|
105
|
-
//# sourceMappingURL=utils-
|
|
105
|
+
//# sourceMappingURL=utils-CHBWS_tH.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as PricePreview } from "./types-
|
|
1
|
+
import { H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey, xt as FilterOperator } from "./constants-BrGIx40B.cjs";
|
|
2
|
+
import { a as PricePreview } from "./types-COdPU2QQ.cjs";
|
|
3
3
|
import { t as Deployment } from "./index-BP0uAq36.cjs";
|
|
4
|
-
import { c as InventoryAttributes, n as DeviceFilter, r as DeviceGroup } from "./index-
|
|
4
|
+
import { c as InventoryAttributes, n as DeviceFilter, r as DeviceGroup } from "./index-B64X5ozM.cjs";
|
|
5
5
|
import { AttributeFilterPredicate, AttributeV2, FilterV2, InvoiceLineItem, Scope } from "@northern.tech/types/MenderTypes";
|
|
6
6
|
import { AxiosError } from "axios";
|
|
7
7
|
|
|
@@ -102,4 +102,4 @@ declare const convertToBackendSPLimits: (limits: Record<string, number | string>
|
|
|
102
102
|
}>;
|
|
103
103
|
//#endregion
|
|
104
104
|
export { statCollector as C, progress as S, stripUndefined as T, mapFiltersToTerms as _, convertToBackendSPLimits as a, mergePermissions as b, filtersFilter as c, getDeploymentState as d, groupDeploymentDevicesStats as f, mapDeviceAttributes as g, listItemMapper as h, convertDeviceListStateToFilters as i, generateDeploymentGroupDetails as l, isDarkMode as m, ErrorWithResponse as n, ensureVersionString as o, groupDeploymentStats as p, FilterTerm as r, extractErrorMessage as s, DeploymentStats as t, getComparisonCompatibleVersion as u, mapTermsToFilters as v, stringToBoolean as w, parseSubscriptionPreview as x, mapUserRolesToUiPermissions as y };
|
|
105
|
-
//# sourceMappingURL=utils-
|
|
105
|
+
//# sourceMappingURL=utils-Do9z5TL1.d.cts.map
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["DEVICE_FILTERING_OPTIONS","yes","DEVICE_ISSUE_OPTIONS","ATTRIBUTE_SCOPES","emptyFilter","emptyUiPermissions","duplicateFilter","softwareIndicator","deploymentStatesToSubstates","defaultStats","deploymentStatesToSubstatesWithSkipped","DEPLOYMENT_STATES","deploymentDisplayStates","DARK_MODE"],"sources":["../src/utils.ts"],"sourcesContent":["// Copyright 2024 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 { AttributeFilterPredicate, AttributeV2, DeviceWithImage, FilterV2, InvoiceLineItem, Scope } from '@northern.tech/types/MenderTypes';\nimport { duplicateFilter, yes } from '@northern.tech/utils/helpers';\nimport type { AxiosError } from 'axios';\n\nimport type { DeviceIssueOptionKey, FilterOperator, Role } from './constants';\nimport {\n ATTRIBUTE_SCOPES,\n DARK_MODE,\n DEPLOYMENT_STATES,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_MAXIMUM_LENGTH,\n defaultStats,\n deploymentDisplayStates,\n deploymentStatesToSubstates,\n deploymentStatesToSubstatesWithSkipped,\n emptyFilter,\n emptyUiPermissions,\n softwareIndicator\n} from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport type { DeviceFilter, DeviceGroup, InventoryAttributes } from './devicesSlice';\nimport type { PricePreview } from './organizationSlice/types';\n\ntype FilterProcessorValue = string | string[] | number | boolean; // this aligns with a API compatible `FilterPredicate.value`\ntype FilterProcessor = (val: string) => FilterProcessorValue;\n\n// for some reason these functions can not be stored in the deviceConstants...\nconst filterProcessors: Record<string, FilterProcessor> = {\n [DEVICE_FILTERING_OPTIONS.$gt.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$gte.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lt.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lte.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$ltne.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$in.key]: (val: string) => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$nin.key]: (val: string) => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$exists.key]: yes,\n [DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false\n};\n\ntype FilterAlias = { alias: FilterOperator; value: boolean };\nconst filterAliases: Record<string, FilterAlias> = {\n $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }\n};\n\nexport type FilterTerm = {\n attribute: string;\n scope: Scope;\n type: FilterOperator;\n value: FilterProcessorValue;\n};\n\nexport const mapFiltersToTerms = (filters: DeviceFilter[]): FilterTerm[] =>\n filters.map(filter => ({\n scope: filter.scope,\n attribute: filter.key,\n type: filterAliases[filter.operator]?.alias || filter.operator,\n value: Object.hasOwn(filterProcessors, filter.operator) ? filterProcessors[filter.operator](filter.value as string) : filter.value\n }));\nexport const mapTermsToFilters = (terms: FilterTerm[]): DeviceFilter[] =>\n terms.map(term => {\n const aliasedFilter = Object.entries(filterAliases).find(\n aliasDefinition => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value\n );\n const operator = (aliasedFilter ? aliasedFilter[0] : term.type) as FilterOperator;\n return { scope: term.scope as Scope, key: term.attribute, operator, value: term.value } as DeviceFilter;\n });\n\ntype IssueFilterState = { offlineThreshold?: string };\n\ntype IssueFilterRule = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[] | ((state: IssueFilterState) => string);\n};\n\nconst convertIssueOptionsToFilters = (issuesSelection: DeviceIssueOptionKey[], filtersState: IssueFilterState = {}): DeviceFilter[] =>\n issuesSelection.map(item => {\n const filterRule = DEVICE_ISSUE_OPTIONS[item].filterRule as IssueFilterRule;\n const value = typeof filterRule.value === 'function' ? filterRule.value(filtersState) : filterRule.value;\n return { key: filterRule.key, operator: filterRule.operator, scope: filterRule.scope, value } as DeviceFilter;\n });\n\nexport const convertDeviceListStateToFilters = ({\n filters = [],\n group,\n groups = { byId: {} },\n offlineThreshold,\n selectedIssues = [],\n status\n}: {\n filters?: DeviceFilter[];\n group?: string;\n groups?: { byId: Record<string, DeviceGroup> };\n offlineThreshold?: string;\n selectedIssues?: DeviceIssueOptionKey[];\n status?: string;\n}) => {\n let applicableFilters = [...filters];\n if (typeof group === 'string' && !(groups.byId[group]?.filters || applicableFilters).length) {\n applicableFilters.push({ key: 'group', value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'system' });\n }\n const nonMonitorFilters = applicableFilters.filter(\n filter =>\n !Object.values(DEVICE_ISSUE_OPTIONS).some(({ filterRule }) => {\n const { key = '', scope = '' } = filterRule as IssueFilterRule;\n return filter.scope !== 'inventory' && scope === filter.scope && key === filter.key;\n })\n );\n const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });\n applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];\n const effectiveFilters = status\n ? [...applicableFilters, { key: 'status', value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: ATTRIBUTE_SCOPES.identity }]\n : applicableFilters;\n return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };\n};\n\nconst filterCompare = (filter: DeviceFilter, item: DeviceFilter): boolean =>\n Object.keys(emptyFilter).every(key => item[key as keyof DeviceFilter]?.toString() === filter[key as keyof DeviceFilter]?.toString());\n\nexport const filtersFilter = (item: DeviceFilter, index: number, array: DeviceFilter[]): boolean => {\n const firstIndex = array.findIndex(filter => filterCompare(filter, item));\n return firstIndex === index;\n};\n\nexport const stripUndefined = <T extends Record<string, unknown>>(obj: T): Partial<T> =>\n Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n\nexport const listItemMapper = <T extends object>(\n byId: Record<string, T>,\n ids: string[],\n { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} as Partial<T> }: { cutOffSize?: number; defaultObject?: Partial<T> }\n): T[] =>\n ids.slice(0, cutOffSize).reduce<T[]>((accu, id) => {\n if (id && byId[id]) {\n accu.push({ ...defaultObject, ...byId[id] });\n }\n return accu;\n }, []);\n\ntype UiPermissions = typeof emptyUiPermissions;\ntype PermissionValue = string[] | Record<string, string[]>; // this would ideally be `PermissionValue = string[] | Record<string, PermissionValue>`\n\nexport const mergePermissions = (existingPermissions: UiPermissions = { ...emptyUiPermissions }, addedPermissions: UiPermissions): UiPermissions =>\n Object.entries(existingPermissions).reduce<UiPermissions>(\n (accu, [key, value]) => {\n let values;\n if (!accu[key]) {\n accu[key] = value;\n return accu;\n }\n if (Array.isArray(value)) {\n values = [...value, ...(accu[key] as string[])].filter(duplicateFilter);\n } else {\n values = mergePermissions(accu[key], { ...value } as unknown as UiPermissions) as unknown as PermissionValue;\n }\n accu[key] = values;\n return accu;\n },\n { ...addedPermissions }\n );\n\nexport const mapUserRolesToUiPermissions = (userRoles: string[], roles: Record<string, Role>): UiPermissions =>\n userRoles.reduce(\n (accu, roleId) => {\n if (!(roleId && roles[roleId])) {\n return accu;\n }\n return mergePermissions(accu, roles[roleId].uiPermissions);\n },\n { ...emptyUiPermissions }\n );\n\nexport const progress = ({ loaded, total }: { loaded: number; total?: number }): number => {\n if (!total) return 0;\n let uploadProgress = (loaded / total) * 100;\n return (uploadProgress = uploadProgress < 50 ? Math.ceil(uploadProgress) : Math.round(uploadProgress));\n};\n\nexport type ErrorWithResponse = AxiosError<{ error?: { message?: string } | string }> & { error?: string };\n\nexport const extractErrorMessage = (err: ErrorWithResponse, fallback = ''): string =>\n (typeof err.response?.data?.error === 'object' ? err.response?.data?.error?.message : err.response?.data?.error) || err.error || err.message || fallback;\n\nexport const ensureVersionString = (software: string, fallback: string): string =>\n software.length && software !== 'artifact_name' ? (software.endsWith(softwareIndicator) ? software : `${software}${softwareIndicator}`) : fallback;\n\nexport const getComparisonCompatibleVersion = (version: string): string => (isNaN(parseInt(version.charAt(0))) && version !== 'next' ? 'master' : version);\n\nexport const stringToBoolean = (content: string | number | undefined): boolean => {\n if (!content) {\n return false;\n }\n const string = content + '';\n switch (string.trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case '1':\n return true;\n case 'false':\n case 'no':\n case '0':\n case null:\n return false;\n default:\n return Boolean(string);\n }\n};\n\nexport type DeploymentStats = {\n failures: number;\n inprogress: number;\n paused: number;\n pending: number;\n skipped?: number;\n successes: number;\n};\n\nexport const groupDeploymentDevicesStats = (deployment: Pick<Deployment, 'devices'>): DeploymentStats => {\n const deviceStatCollector = (deploymentStates: string[], devices: Record<string, DeviceWithImage>): number =>\n Object.values(devices).reduce<number>((accu, device) => (deploymentStates.includes(device.status ?? '') ? accu + 1 : accu), 0);\n\n const inprogress = deviceStatCollector(deploymentStatesToSubstates.inprogress, deployment.devices);\n const pending = deviceStatCollector(deploymentStatesToSubstates.pending, deployment.devices);\n const successes = deviceStatCollector(deploymentStatesToSubstates.successes, deployment.devices);\n const failures = deviceStatCollector(deploymentStatesToSubstates.failures, deployment.devices);\n const paused = deviceStatCollector(deploymentStatesToSubstates.paused, deployment.devices);\n return { inprogress, paused, pending, successes, failures };\n};\n\nexport const statCollector = (items: string[], statistics: Record<string, number>): number =>\n items.reduce((accu, property) => accu + Number(statistics[property] || 0), 0);\n\nexport const groupDeploymentStats = (deployment: Partial<Deployment>, withSkipped?: boolean): DeploymentStats => {\n const { statistics = {} } = deployment;\n const { status = {} } = statistics;\n const stats = { ...defaultStats, ...status };\n let result: DeploymentStats = { inprogress: 0, paused: 0, pending: 0, successes: 0, failures: 0 };\n let groupStates = deploymentStatesToSubstates;\n if (withSkipped) {\n groupStates = deploymentStatesToSubstatesWithSkipped;\n result.skipped = statCollector(groupStates.skipped!, stats);\n }\n result = {\n ...result,\n // don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership\n inprogress: statCollector(groupStates.inprogress, stats),\n pending: statCollector(groupStates.pending, stats),\n successes: statCollector(groupStates.successes, stats),\n failures: statCollector(groupStates.failures, stats),\n paused: statCollector(groupStates.paused, stats)\n };\n return result;\n};\n\nexport const getDeploymentState = (deployment: Partial<Deployment>): string => {\n const { status: deploymentStatus = DEPLOYMENT_STATES.pending } = deployment;\n const { inprogress: currentProgressCount, paused } = groupDeploymentStats(deployment);\n\n let status = deploymentDisplayStates[deploymentStatus];\n if (deploymentStatus === DEPLOYMENT_STATES.pending && currentProgressCount === 0) {\n status = 'queued';\n } else if (paused > 0) {\n status = deploymentDisplayStates.paused;\n }\n return status;\n};\n\ntype DeploymentFilter =\n | FilterV2\n | {\n terms?: Array<AttributeFilterPredicate | { key: string }>;\n };\n\nexport const generateDeploymentGroupDetails = (filter: DeploymentFilter | undefined, groupName: string): string =>\n filter && filter.terms?.length\n ? `${groupName} (${filter.terms\n .map(\n filter =>\n `${filter.attribute || filter.key} ${DEVICE_FILTERING_OPTIONS[filter.type || filter.operator || DEVICE_FILTERING_OPTIONS.$eq.key].shortform} ${filter.value}`\n )\n .join(', ')})`\n : groupName;\n\ntype DeviceAttributeMap = {\n identity: Record<string, string>;\n inventory: InventoryAttributes;\n monitor: Record<string, string>;\n system: Record<string, string>;\n tags: Record<string, string>;\n};\n\nexport const mapDeviceAttributes = (attributes: AttributeV2[] = []): DeviceAttributeMap =>\n attributes.reduce<DeviceAttributeMap>(\n (accu, attribute) => {\n if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n return accu;\n }\n const scope = (attribute.scope || ATTRIBUTE_SCOPES.inventory) as keyof DeviceAttributeMap;\n (accu[scope] as Record<string, unknown>) = {\n ...accu[scope],\n [attribute.name]: attribute.value\n };\n if (attribute.name === 'device_type' && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n accu.inventory.device_type = ([] as string[]).concat(attribute.value as string | string[]);\n }\n return accu;\n },\n { inventory: { device_type: [] as string[], artifact_name: '' }, identity: {}, monitor: {}, system: {}, tags: {} }\n );\n\nexport const isDarkMode = (mode: string): boolean => mode === DARK_MODE;\n\ntype Line = InvoiceLineItem & { product: 'mender_standard' | 'mender_micro' };\nexport const parseSubscriptionPreview = (lines: Line[]): PricePreview['items'] =>\n lines.reduce((acc, { addon, amount, product }) => {\n const tier = product.replace('mender_', '');\n if (!acc[tier]) {\n acc[tier] = {\n amount: 0,\n addons: {}\n };\n }\n if (!addon) {\n acc[tier].amount += amount;\n } else {\n acc[tier].addons[addon] = (acc[tier].addons[addon] ?? 0) + amount;\n }\n return acc;\n }, {});\n\nexport const convertToBackendSPLimits = (\n limits: Record<string, number | string>,\n spLimits: Record<string, object>\n): Record<string, { Name: string; value: number }> =>\n Object.fromEntries(\n Object.entries(limits)\n .filter(([key]) => !!spLimits[key])\n .map(([key, limit]) => {\n const backendId = (spLimits[key] as { backendId: string }).backendId;\n return [backendId, { Name: backendId, value: Number(limit) || 0 }];\n })\n );\n"],"mappings":";;;;;;;;AAyCA,MAAM,mBAAoD;EACvDA,+BAAAA,yBAAyB,IAAI,OAAO,QAAgB,OAAO,IAAI,IAAI;EACnEA,+BAAAA,yBAAyB,KAAK,OAAO,QAAgB,OAAO,IAAI,IAAI;EACpEA,+BAAAA,yBAAyB,IAAI,OAAO,QAAgB,OAAO,IAAI,IAAI;EACnEA,+BAAAA,yBAAyB,KAAK,OAAO,QAAgB,OAAO,IAAI,IAAI;EACpEA,+BAAAA,yBAAyB,MAAM,OAAO,QAAgB,OAAO,IAAI,IAAI;EACrEA,+BAAAA,yBAAyB,IAAI,OAAO,SAAiB,KAAK,KAAK,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAC5FA,+BAAAA,yBAAyB,KAAK,OAAO,SAAiB,KAAK,KAAK,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAC7FA,+BAAAA,yBAAyB,QAAQ,MAAMC,6BAAAA;EACvCD,+BAAAA,yBAAyB,SAAS,YAAY;CAChD;AAGD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,KAAK,EAAE,OAAO,QAAQ,cAAc;CAChD,MAAM,OAAO,QAAQ,QAAQ,WAAW,GAAG;AAC3C,KAAI,CAAC,IAAI,MACP,KAAI,QAAQ;EACV,QAAQ;EACR,QAAQ,EAAE;EACX;AAEH,KAAI,CAAC,MACH,KAAI,MAAM,UAAU;KAEpB,KAAI,MAAM,OAAO,UAAU,IAAI,MAAM,OAAO,UAAU,KAAK;AAE7D,QAAO;GACN,EAAE,CAAC;AAER,MAAa,4BACX,QACA,aAEA,OAAO,YACL,OAAO,QAAQ,OAAO,CACnB,QAAQ,CAAC,SAAS,CAAC,CAAC,SAAS,KAAK,CAClC,KAAK,CAAC,KAAK,WAAW;CACrB,MAAM,YAAa,SAAS,KAA+B;AAC3D,QAAO,CAAC,WAAW;EAAE,MAAM;EAAW,OAAO,OAAO,MAAM,IAAI;EAAG,CAAC;EAClE,CACL"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["DEVICE_FILTERING_OPTIONS","yes","DEVICE_ISSUE_OPTIONS","ATTRIBUTE_SCOPES","emptyFilter","emptyUiPermissions","duplicateFilter","softwareIndicator","deploymentStatesToSubstates","defaultStats","deploymentStatesToSubstatesWithSkipped","DEPLOYMENT_STATES","deploymentDisplayStates","DARK_MODE"],"sources":["../src/utils.ts"],"sourcesContent":["// Copyright 2024 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 { AttributeFilterPredicate, AttributeV2, DeviceWithImage, FilterV2, InvoiceLineItem, Scope } from '@northern.tech/types/MenderTypes';\nimport { duplicateFilter, yes } from '@northern.tech/utils/helpers';\nimport type { AxiosError } from 'axios';\n\nimport type { DeviceIssueOptionKey, FilterOperator, Role } from './constants';\nimport {\n ATTRIBUTE_SCOPES,\n DARK_MODE,\n DEPLOYMENT_STATES,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_MAXIMUM_LENGTH,\n defaultStats,\n deploymentDisplayStates,\n deploymentStatesToSubstates,\n deploymentStatesToSubstatesWithSkipped,\n emptyFilter,\n emptyUiPermissions,\n softwareIndicator\n} from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport type { DeviceFilter, DeviceGroup, InventoryAttributes } from './devicesSlice';\nimport type { PricePreview } from './organizationSlice/types';\n\ntype FilterProcessorValue = string | string[] | number | boolean; // this aligns with a API compatible `FilterPredicate.value`\ntype FilterProcessor = (val: string) => FilterProcessorValue;\n\n// for some reason these functions can not be stored in the deviceConstants...\nconst filterProcessors: Record<string, FilterProcessor> = {\n [DEVICE_FILTERING_OPTIONS.$gt.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$gte.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lt.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lte.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$ltne.key]: (val: string) => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$in.key]: (val: string) => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$nin.key]: (val: string) => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$exists.key]: yes,\n [DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false\n};\n\ntype FilterAlias = { alias: FilterOperator; value: boolean };\nconst filterAliases: Record<string, FilterAlias> = {\n $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }\n};\n\nexport type FilterTerm = {\n attribute: string;\n scope: Scope;\n type: FilterOperator;\n value: FilterProcessorValue;\n};\n\nexport const mapFiltersToTerms = (filters: DeviceFilter[]): FilterTerm[] =>\n filters.map(filter => ({\n scope: filter.scope,\n attribute: filter.key,\n type: filterAliases[filter.operator]?.alias || filter.operator,\n value: Object.hasOwn(filterProcessors, filter.operator) ? filterProcessors[filter.operator](filter.value as string) : filter.value\n }));\nexport const mapTermsToFilters = (terms: FilterTerm[]): DeviceFilter[] =>\n terms.map(term => {\n const aliasedFilter = Object.entries(filterAliases).find(\n aliasDefinition => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value\n );\n const operator = (aliasedFilter ? aliasedFilter[0] : term.type) as FilterOperator;\n return { scope: term.scope as Scope, key: term.attribute, operator, value: term.value } as DeviceFilter;\n });\n\ntype IssueFilterState = { offlineThreshold?: string };\n\ntype IssueFilterRule = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[] | ((state: IssueFilterState) => string);\n};\n\nconst convertIssueOptionsToFilters = (issuesSelection: DeviceIssueOptionKey[], filtersState: IssueFilterState = {}): DeviceFilter[] =>\n issuesSelection.map(item => {\n const filterRule = DEVICE_ISSUE_OPTIONS[item].filterRule as IssueFilterRule;\n const value = typeof filterRule.value === 'function' ? filterRule.value(filtersState) : filterRule.value;\n return { key: filterRule.key, operator: filterRule.operator, scope: filterRule.scope, value } as DeviceFilter;\n });\n\nexport const convertDeviceListStateToFilters = ({\n filters = [],\n group,\n groups = { byId: {} },\n offlineThreshold,\n selectedIssues = [],\n status\n}: {\n filters?: DeviceFilter[];\n group?: string;\n groups?: { byId: Record<string, DeviceGroup> };\n offlineThreshold?: string;\n selectedIssues?: DeviceIssueOptionKey[];\n status?: string;\n}) => {\n let applicableFilters = [...filters];\n if (typeof group === 'string' && !(groups.byId[group]?.filters || applicableFilters).length) {\n applicableFilters.push({ key: 'group', value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'system' });\n }\n const nonMonitorFilters = applicableFilters.filter(\n filter =>\n !Object.values(DEVICE_ISSUE_OPTIONS).some(({ filterRule }) => {\n const { key = '', scope = '' } = filterRule as IssueFilterRule;\n return filter.scope !== 'inventory' && scope === filter.scope && key === filter.key;\n })\n );\n const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });\n applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];\n const effectiveFilters = status\n ? [...applicableFilters, { key: 'status', value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: ATTRIBUTE_SCOPES.identity }]\n : applicableFilters;\n return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };\n};\n\nconst filterCompare = (filter: DeviceFilter, item: DeviceFilter): boolean =>\n Object.keys(emptyFilter).every(key => item[key as keyof DeviceFilter]?.toString() === filter[key as keyof DeviceFilter]?.toString());\n\nexport const filtersFilter = (item: DeviceFilter, index: number, array: DeviceFilter[]): boolean => {\n const firstIndex = array.findIndex(filter => filterCompare(filter, item));\n return firstIndex === index;\n};\n\nexport const stripUndefined = <T extends Record<string, unknown>>(obj: T): Partial<T> =>\n Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n\nexport const listItemMapper = <T extends object>(\n byId: Record<string, T>,\n ids: string[],\n { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} as Partial<T> }: { cutOffSize?: number; defaultObject?: Partial<T> }\n): T[] =>\n ids.slice(0, cutOffSize).reduce<T[]>((accu, id) => {\n if (id && byId[id]) {\n accu.push({ ...defaultObject, ...byId[id] });\n }\n return accu;\n }, []);\n\ntype UiPermissions = typeof emptyUiPermissions;\ntype PermissionValue = string[] | Record<string, string[]>; // this would ideally be `PermissionValue = string[] | Record<string, PermissionValue>`\n\nexport const mergePermissions = (existingPermissions: UiPermissions = { ...emptyUiPermissions }, addedPermissions: UiPermissions): UiPermissions =>\n Object.entries(existingPermissions).reduce<UiPermissions>(\n (accu, [key, value]) => {\n let values;\n if (!accu[key]) {\n accu[key] = value;\n return accu;\n }\n if (Array.isArray(value)) {\n values = [...value, ...(accu[key] as string[])].filter(duplicateFilter);\n } else {\n values = mergePermissions(accu[key], { ...value } as unknown as UiPermissions) as unknown as PermissionValue;\n }\n accu[key] = values;\n return accu;\n },\n { ...addedPermissions }\n );\n\nexport const mapUserRolesToUiPermissions = (userRoles: string[], roles: Record<string, Role>): UiPermissions =>\n userRoles.reduce(\n (accu, roleId) => {\n if (!(roleId && roles[roleId])) {\n return accu;\n }\n return mergePermissions(accu, roles[roleId].uiPermissions);\n },\n { ...emptyUiPermissions }\n );\n\nexport const progress = ({ loaded, total }: { loaded: number; total?: number }): number => {\n if (!total) return 0;\n let uploadProgress = (loaded / total) * 100;\n return (uploadProgress = uploadProgress < 50 ? Math.ceil(uploadProgress) : Math.round(uploadProgress));\n};\n\nexport type ErrorWithResponse = AxiosError<{ error?: { message?: string } | string }> & { error?: string };\n\nexport const extractErrorMessage = (err: ErrorWithResponse, fallback = ''): string =>\n (typeof err.response?.data?.error === 'object' ? err.response?.data?.error?.message : err.response?.data?.error) || err.error || err.message || fallback;\n\nexport const ensureVersionString = (software: string, fallback: string): string =>\n software.length && software !== 'artifact_name' ? (software.endsWith(softwareIndicator) ? software : `${software}${softwareIndicator}`) : fallback;\n\nexport const getComparisonCompatibleVersion = (version: string): string => (isNaN(parseInt(version.charAt(0))) && version !== 'next' ? 'master' : version);\n\nexport const stringToBoolean = (content: string | number | undefined): boolean => {\n if (!content) {\n return false;\n }\n const string = content + '';\n switch (string.trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case '1':\n return true;\n case 'false':\n case 'no':\n case '0':\n case null:\n return false;\n default:\n return Boolean(string);\n }\n};\n\nexport type DeploymentStats = {\n failures: number;\n inprogress: number;\n paused: number;\n pending: number;\n skipped?: number;\n successes: number;\n};\n\nexport const groupDeploymentDevicesStats = (deployment: Pick<Deployment, 'devices'>): DeploymentStats => {\n const deviceStatCollector = (deploymentStates: string[], devices: Record<string, DeviceWithImage>): number =>\n Object.values(devices).reduce<number>((accu, device) => (deploymentStates.includes(device.status ?? '') ? accu + 1 : accu), 0);\n\n const inprogress = deviceStatCollector(deploymentStatesToSubstates.inprogress, deployment.devices);\n const pending = deviceStatCollector(deploymentStatesToSubstates.pending, deployment.devices);\n const successes = deviceStatCollector(deploymentStatesToSubstates.successes, deployment.devices);\n const failures = deviceStatCollector(deploymentStatesToSubstates.failures, deployment.devices);\n const paused = deviceStatCollector(deploymentStatesToSubstates.paused, deployment.devices);\n return { inprogress, paused, pending, successes, failures };\n};\n\nexport const statCollector = (items: string[], statistics: Record<string, number>): number =>\n items.reduce((accu, property) => accu + Number(statistics[property] || 0), 0);\n\nexport const groupDeploymentStats = (deployment: Partial<Deployment>, withSkipped?: boolean): DeploymentStats => {\n const { statistics = {} } = deployment;\n const { status = {} } = statistics;\n const stats = { ...defaultStats, ...status };\n let result: DeploymentStats = { inprogress: 0, paused: 0, pending: 0, successes: 0, failures: 0 };\n let groupStates = deploymentStatesToSubstates;\n if (withSkipped) {\n groupStates = deploymentStatesToSubstatesWithSkipped;\n result.skipped = statCollector(groupStates.skipped!, stats);\n }\n result = {\n ...result,\n // don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership\n inprogress: statCollector(groupStates.inprogress, stats),\n pending: statCollector(groupStates.pending, stats),\n successes: statCollector(groupStates.successes, stats),\n failures: statCollector(groupStates.failures, stats),\n paused: statCollector(groupStates.paused, stats)\n };\n return result;\n};\n\nexport const getDeploymentState = (deployment: Partial<Deployment>): string => {\n const { status: deploymentStatus = DEPLOYMENT_STATES.pending } = deployment;\n const { inprogress: currentProgressCount, paused } = groupDeploymentStats(deployment);\n\n let status = deploymentDisplayStates[deploymentStatus];\n if (deploymentStatus === DEPLOYMENT_STATES.pending && currentProgressCount === 0) {\n status = 'queued';\n } else if (paused > 0) {\n status = deploymentDisplayStates.paused;\n }\n return status;\n};\n\ntype DeploymentFilter =\n | FilterV2\n | {\n terms?: Array<AttributeFilterPredicate | { key: string }>;\n };\n\nexport const generateDeploymentGroupDetails = (filter: DeploymentFilter | undefined, groupName: string): string =>\n filter && filter.terms?.length\n ? `${groupName} (${filter.terms\n .map(\n filter =>\n `${filter.attribute || filter.key} ${DEVICE_FILTERING_OPTIONS[filter.type || filter.operator || DEVICE_FILTERING_OPTIONS.$eq.key].shortform} ${filter.value}`\n )\n .join(', ')})`\n : groupName;\n\ntype DeviceAttributeMap = {\n identity: Record<string, string>;\n inventory: InventoryAttributes;\n monitor: Record<string, string>;\n system: Record<string, string>;\n tags: Record<string, string>;\n};\n\nexport const mapDeviceAttributes = (attributes: AttributeV2[] = []): DeviceAttributeMap =>\n attributes.reduce<DeviceAttributeMap>(\n (accu, attribute) => {\n if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n return accu;\n }\n const scope = (attribute.scope || ATTRIBUTE_SCOPES.inventory) as keyof DeviceAttributeMap;\n (accu[scope] as Record<string, unknown>) = {\n ...accu[scope],\n [attribute.name]: attribute.value\n };\n if (attribute.name === 'device_type' && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n accu.inventory.device_type = ([] as string[]).concat(attribute.value as string | string[]);\n }\n return accu;\n },\n { inventory: { device_type: [] as string[], artifact_name: '' }, identity: {}, monitor: {}, system: {}, tags: {} }\n );\n\nexport const isDarkMode = (mode: string): boolean => mode === DARK_MODE;\n\ntype Line = InvoiceLineItem & { product: 'mender_standard' | 'mender_micro' };\nexport const parseSubscriptionPreview = (lines: Line[]): PricePreview['items'] =>\n lines.reduce((acc, { addon, amount, product }) => {\n const tier = product.replace('mender_', '');\n if (!acc[tier]) {\n acc[tier] = {\n amount: 0,\n addons: {}\n };\n }\n if (!addon) {\n acc[tier].amount += amount;\n } else {\n acc[tier].addons[addon] = (acc[tier].addons[addon] ?? 0) + amount;\n }\n return acc;\n }, {});\n\nexport const convertToBackendSPLimits = (\n limits: Record<string, number | string>,\n spLimits: Record<string, object>\n): Record<string, { Name: string; value: number }> =>\n Object.fromEntries(\n Object.entries(limits)\n .filter(([key]) => !!spLimits[key])\n .map(([key, limit]) => {\n const backendId = (spLimits[key] as { backendId: string }).backendId;\n return [backendId, { Name: backendId, value: Number(limit) || 0 }];\n })\n );\n"],"mappings":";;;;;;;;AAyCA,MAAM,mBAAoD;EACvDA,+BAAAA,yBAAyB,IAAI,OAAO,QAAgB,OAAO,IAAI,IAAI;EACnEA,+BAAAA,yBAAyB,KAAK,OAAO,QAAgB,OAAO,IAAI,IAAI;EACpEA,+BAAAA,yBAAyB,IAAI,OAAO,QAAgB,OAAO,IAAI,IAAI;EACnEA,+BAAAA,yBAAyB,KAAK,OAAO,QAAgB,OAAO,IAAI,IAAI;EACpEA,+BAAAA,yBAAyB,MAAM,OAAO,QAAgB,OAAO,IAAI,IAAI;EACrEA,+BAAAA,yBAAyB,IAAI,OAAO,SAAiB,KAAK,KAAK,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAC5FA,+BAAAA,yBAAyB,KAAK,OAAO,SAAiB,KAAK,KAAK,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAC7FA,+BAAAA,yBAAyB,QAAQ,MAAMC,6BAAAA;EACvCD,+BAAAA,yBAAyB,SAAS,YAAY;CAChD;AAGD,MAAM,gBAA6C,EACjD,UAAU;CAAE,OAAOA,+BAAAA,yBAAyB,QAAQ;CAAK,OAAO;CAAO,EACxE;AASD,MAAa,qBAAqB,YAChC,QAAQ,KAAI,YAAW;CACrB,OAAO,OAAO;CACd,WAAW,OAAO;CAClB,MAAM,cAAc,OAAO,WAAW,SAAS,OAAO;CACtD,OAAO,OAAO,OAAO,kBAAkB,OAAO,SAAS,GAAG,iBAAiB,OAAO,UAAU,OAAO,MAAgB,GAAG,OAAO;CAC9H,EAAE;AACL,MAAa,qBAAqB,UAChC,MAAM,KAAI,SAAQ;CAChB,MAAM,gBAAgB,OAAO,QAAQ,cAAc,CAAC,MAClD,oBAAmB,gBAAgB,GAAG,UAAU,KAAK,QAAQ,gBAAgB,GAAG,UAAU,KAAK,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EAAE,MAAM;EAAW,OAAO,OAAO,MAAM,IAAI;EAAG,CAAC;EAClE,CACL"}
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as statCollector, S as progress, T as stripUndefined, _ as mapFiltersToTerms, a as convertToBackendSPLimits, b as mergePermissions, c as filtersFilter, d as getDeploymentState, f as groupDeploymentDevicesStats, g as mapDeviceAttributes, h as listItemMapper, i as convertDeviceListStateToFilters, l as generateDeploymentGroupDetails, m as isDarkMode, n as ErrorWithResponse, o as ensureVersionString, p as groupDeploymentStats, r as FilterTerm, s as extractErrorMessage, t as DeploymentStats, u as getComparisonCompatibleVersion, v as mapTermsToFilters, w as stringToBoolean, x as parseSubscriptionPreview, y as mapUserRolesToUiPermissions } from "./utils-
|
|
1
|
+
import { C as statCollector, S as progress, T as stripUndefined, _ as mapFiltersToTerms, a as convertToBackendSPLimits, b as mergePermissions, c as filtersFilter, d as getDeploymentState, f as groupDeploymentDevicesStats, g as mapDeviceAttributes, h as listItemMapper, i as convertDeviceListStateToFilters, l as generateDeploymentGroupDetails, m as isDarkMode, n as ErrorWithResponse, o as ensureVersionString, p as groupDeploymentStats, r as FilterTerm, s as extractErrorMessage, t as DeploymentStats, u as getComparisonCompatibleVersion, v as mapTermsToFilters, w as stringToBoolean, x as parseSubscriptionPreview, y as mapUserRolesToUiPermissions } from "./utils-Do9z5TL1.cjs";
|
|
2
2
|
export { DeploymentStats, ErrorWithResponse, FilterTerm, convertDeviceListStateToFilters, convertToBackendSPLimits, ensureVersionString, extractErrorMessage, filtersFilter, generateDeploymentGroupDetails, getComparisonCompatibleVersion, getDeploymentState, groupDeploymentDevicesStats, groupDeploymentStats, isDarkMode, listItemMapper, mapDeviceAttributes, mapFiltersToTerms, mapTermsToFilters, mapUserRolesToUiPermissions, mergePermissions, parseSubscriptionPreview, progress, statCollector, stringToBoolean, stripUndefined };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as statCollector, S as progress, T as stripUndefined, _ as mapFiltersToTerms, a as convertToBackendSPLimits, b as mergePermissions, c as filtersFilter, d as getDeploymentState, f as groupDeploymentDevicesStats, g as mapDeviceAttributes, h as listItemMapper, i as convertDeviceListStateToFilters, l as generateDeploymentGroupDetails, m as isDarkMode, n as ErrorWithResponse, o as ensureVersionString, p as groupDeploymentStats, r as FilterTerm, s as extractErrorMessage, t as DeploymentStats, u as getComparisonCompatibleVersion, v as mapTermsToFilters, w as stringToBoolean, x as parseSubscriptionPreview, y as mapUserRolesToUiPermissions } from "./utils-
|
|
1
|
+
import { C as statCollector, S as progress, T as stripUndefined, _ as mapFiltersToTerms, a as convertToBackendSPLimits, b as mergePermissions, c as filtersFilter, d as getDeploymentState, f as groupDeploymentDevicesStats, g as mapDeviceAttributes, h as listItemMapper, i as convertDeviceListStateToFilters, l as generateDeploymentGroupDetails, m as isDarkMode, n as ErrorWithResponse, o as ensureVersionString, p as groupDeploymentStats, r as FilterTerm, s as extractErrorMessage, t as DeploymentStats, u as getComparisonCompatibleVersion, v as mapTermsToFilters, w as stringToBoolean, x as parseSubscriptionPreview, y as mapUserRolesToUiPermissions } from "./utils-CHBWS_tH.js";
|
|
2
2
|
export { DeploymentStats, ErrorWithResponse, FilterTerm, convertDeviceListStateToFilters, convertToBackendSPLimits, ensureVersionString, extractErrorMessage, filtersFilter, generateDeploymentGroupDetails, getComparisonCompatibleVersion, getDeploymentState, groupDeploymentDevicesStats, groupDeploymentStats, isDarkMode, listItemMapper, mapDeviceAttributes, mapFiltersToTerms, mapTermsToFilters, mapUserRolesToUiPermissions, mergePermissions, parseSubscriptionPreview, progress, statCollector, stringToBoolean, stripUndefined };
|