@reltio/components 1.4.1623 → 1.4.1625

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.
@@ -43,6 +43,17 @@ var mdm_sdk_1 = require("@reltio/mdm-sdk");
43
43
  var useSafePromise_1 = require("./useSafePromise");
44
44
  var usePrevious_1 = require("./usePrevious");
45
45
  var buildSuggestedIds = (0, ramda_1.when)(ramda_1.identity, (0, ramda_1.pipe)(mdm_sdk_1.wrapInArrayIfNeeded, ramda_1.length, (0, ramda_1.times)(function (n) { return n + 1; })));
46
+ var isValidRequestConfig = function (config) {
47
+ var _a;
48
+ var entry = config;
49
+ while (entry) {
50
+ if (((_a = entry.entityTypes) === null || _a === void 0 ? void 0 : _a.length) === 0) {
51
+ return false;
52
+ }
53
+ entry = entry.nextEntry;
54
+ }
55
+ return true;
56
+ };
46
57
  var useRelationsLoader = function (_a) {
47
58
  var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b;
48
59
  var _c = (0, react_1.useState)(false), isLoading = _c[0], setIsLoading = _c[1];
@@ -77,8 +88,16 @@ var useRelationsLoader = function (_a) {
77
88
  var configs_1 = [requestConfig_1].concat((0, ramda_1.ifElse)(ramda_1.identity, (0, ramda_1.pipe)(mdm_sdk_1.wrapInArrayIfNeeded, function (suggested) {
78
89
  return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
79
90
  }), (0, ramda_1.always)([]))(suggested));
91
+ var emptyResponsePromise_1 = Promise.resolve([{ total: 0 }]);
80
92
  var request = (0, ramda_1.cond)([
81
- [(0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isTempUri), function () { return Promise.resolve([{ total: 0 }]); }],
93
+ [(0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isTempUri), function () { return emptyResponsePromise_1; }],
94
+ [
95
+ (0, ramda_1.always)(!isValidRequestConfig(requestConfig_1)),
96
+ function () {
97
+ console.warn('Connections request config has "entityTypes": []. Request is blocked.');
98
+ return emptyResponsePromise_1;
99
+ }
100
+ ],
82
101
  [
83
102
  mdm_sdk_1.isDataTenantEntity,
84
103
  function (entity) {
@@ -17,6 +17,17 @@ import { ActivityFilter, addGlobalFilterToQuery, getRelationsForDataTenantEntity
17
17
  import { useSafePromise } from './useSafePromise';
18
18
  import { usePrevious } from './usePrevious';
19
19
  var buildSuggestedIds = when(identity, pipe(wrapInArrayIfNeeded, length, times(function (n) { return n + 1; })));
20
+ var isValidRequestConfig = function (config) {
21
+ var _a;
22
+ var entry = config;
23
+ while (entry) {
24
+ if (((_a = entry.entityTypes) === null || _a === void 0 ? void 0 : _a.length) === 0) {
25
+ return false;
26
+ }
27
+ entry = entry.nextEntry;
28
+ }
29
+ return true;
30
+ };
20
31
  export var useRelationsLoader = function (_a) {
21
32
  var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b;
22
33
  var _c = useState(false), isLoading = _c[0], setIsLoading = _c[1];
@@ -51,8 +62,16 @@ export var useRelationsLoader = function (_a) {
51
62
  var configs_1 = [requestConfig_1].concat(ifElse(identity, pipe(wrapInArrayIfNeeded, function (suggested) {
52
63
  return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
53
64
  }), always([]))(suggested));
65
+ var emptyResponsePromise_1 = Promise.resolve([{ total: 0 }]);
54
66
  var request = cond([
55
- [pipe(prop('uri'), isTempUri), function () { return Promise.resolve([{ total: 0 }]); }],
67
+ [pipe(prop('uri'), isTempUri), function () { return emptyResponsePromise_1; }],
68
+ [
69
+ always(!isValidRequestConfig(requestConfig_1)),
70
+ function () {
71
+ console.warn('Connections request config has "entityTypes": []. Request is blocked.');
72
+ return emptyResponsePromise_1;
73
+ }
74
+ ],
56
75
  [
57
76
  isDataTenantEntity,
58
77
  function (entity) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1623",
3
+ "version": "1.4.1625",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "dependencies": {
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-module": "^1.4.1623",
11
- "@reltio/mdm-sdk": "^1.4.1623",
10
+ "@reltio/mdm-module": "^1.4.1625",
11
+ "@reltio/mdm-sdk": "^1.4.1625",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",