@northern.tech/store 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDeviceById
3
- } from "./chunk-DA6QVCOG.js";
3
+ } from "./chunk-FQW72QFK.js";
4
4
  import "./chunk-YWHRAPDQ.js";
5
5
  import "./chunk-ZIUUV35J.js";
6
6
  import {
@@ -41,7 +41,8 @@ import "./chunk-HFOTAPIJ.js";
41
41
  // src/useDeploymentDevice.ts
42
42
  import { useEffect, useRef } from "react";
43
43
  import { useSelector } from "react-redux";
44
- import { isUUID } from "validator";
44
+ import validator from "validator";
45
+ var { isUUID } = validator;
45
46
  var useDeploymentDevice = (deploymentName) => {
46
47
  const isLoading = useRef(false);
47
48
  const dispatch = useAppDispatch();
@@ -1 +1 @@
1
- {"version":3,"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';\nimport { useSelector } from 'react-redux';\n\nimport { isUUID } from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch } from './store';\nimport { getDeviceById } from './thunks';\n\nexport const useDeploymentDevice = deploymentName => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useSelector(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)).then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,WAAW,cAAc;AAClC,SAAS,mBAAmB;AAE5B,SAAS,cAAc;AAMhB,IAAM,sBAAsB,oBAAkB;AACnD,QAAM,YAAY,OAAO,KAAK;AAC9B,QAAM,WAAW,eAAe;AAChC,QAAM,cAAc,YAAY,cAAc;AAC9C,QAAM,gBAAgB,CAAC,CAAC,YAAY,cAAc;AAElD,YAAU,MAAM;AACd,QAAI,UAAU,SAAS;AACrB;AAAA,IACF;AACA,cAAU,UAAU;AACpB,QAAI,OAAO,cAAc,KAAK,CAAC,eAAe;AAC5C,eAAS,cAAc,cAAc,CAAC,EAAE,KAAK,MAAO,UAAU,UAAU,KAAM;AAAA,IAChF;AAAA,EACF,GAAG,CAAC,gBAAgB,UAAU,aAAa,CAAC;AAC9C;","names":[]}
1
+ {"version":3,"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';\nimport { useSelector } from 'react-redux';\n\nimport validator from 'validator';\n\nimport { getDevicesById } from './selectors';\nimport { useAppDispatch } from './store';\nimport { getDeviceById } from './thunks';\n\nconst { isUUID } = validator\n\nexport const useDeploymentDevice = deploymentName => {\n const isLoading = useRef(false);\n const dispatch = useAppDispatch();\n const devicesById = useSelector(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)).then(() => (isLoading.current = false));\n }\n }, [deploymentName, dispatch, hasDeviceInfo]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,WAAW,cAAc;AAClC,SAAS,mBAAmB;AAE5B,OAAO,eAAe;AAMtB,IAAM,EAAE,OAAO,IAAI;AAEZ,IAAM,sBAAsB,oBAAkB;AACnD,QAAM,YAAY,OAAO,KAAK;AAC9B,QAAM,WAAW,eAAe;AAChC,QAAM,cAAc,YAAY,cAAc;AAC9C,QAAM,gBAAgB,CAAC,CAAC,YAAY,cAAc;AAElD,YAAU,MAAM;AACd,QAAI,UAAU,SAAS;AACrB;AAAA,IACF;AACA,cAAU,UAAU;AACpB,QAAI,OAAO,cAAc,KAAK,CAAC,eAAe;AAC5C,eAAS,cAAc,cAAc,CAAC,EAAE,KAAK,MAAO,UAAU,UAAU,KAAM;AAAA,IAChF;AAAA,EACF,GAAG,CAAC,gBAAgB,UAAU,aAAa,CAAC;AAC9C;","names":[]}
@@ -2557,10 +2557,11 @@ var setSearchState = createAppAsyncThunk(`${sliceName2}/setSearchState`, (search
2557
2557
  // src/deploymentsSlice/thunks.ts
2558
2558
  var import_helpers8 = require("@northern.tech/utils/helpers");
2559
2559
  var import_tracking = __toESM(require("@northern.tech/utils/tracking"), 1);
2560
- var import_validator = require("validator");
2560
+ var import_validator = __toESM(require("validator"), 1);
2561
+ var { isUUID } = import_validator.default;
2561
2562
  var { receivedDevice, setSnackbar: setSnackbar2 } = actions_default;
2562
2563
  var { page: defaultPage, perPage: defaultPerPage } = import_constants5.DEVICE_LIST_DEFAULTS;
2563
- var deriveDeploymentGroup = ({ filter, group, groups = [], name }) => group || groups.length === 1 && !(0, import_validator.isUUID)(name) ? groups[0] : filter?.name;
2564
+ var deriveDeploymentGroup = ({ filter, group, groups = [], name }) => group || groups.length === 1 && !isUUID(name) ? groups[0] : filter?.name;
2564
2565
  var transformDeployments = (deployments, deploymentsById) => deployments.sort((0, import_helpers8.customSort)(true, "created")).reduce(
2565
2566
  (accu, item) => {
2566
2567
  const filter = item.filter;