openchs-models 1.30.63 → 1.30.66

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.
@@ -7,14 +7,12 @@ exports.default = void 0;
7
7
 
8
8
  var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
9
9
 
10
+ var _structuredClone = require("@ungap/structured-clone");
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
15
 
14
- const {
15
- parse
16
- } = require('flatted');
17
-
18
16
  class CustomDashboardCache extends _BaseEntity.default {
19
17
  constructor(that = null) {
20
18
  super(that);
@@ -109,21 +107,21 @@ class CustomDashboardCache extends _BaseEntity.default {
109
107
  }
110
108
 
111
109
  getSelectedValues() {
112
- return this.selectedValuesJSON && parse(this.selectedValuesJSON) || {};
110
+ return this.selectedValuesJSON && (0, _structuredClone.deserialize)(JSON.parse(this.selectedValuesJSON)) || {};
113
111
  }
114
112
 
115
113
  getFilterErrors() {
116
- return this.filterErrorsJSON && parse(this.filterErrorsJSON) || {};
114
+ return this.filterErrorsJSON && (0, _structuredClone.deserialize)(JSON.parse(this.filterErrorsJSON)) || {};
117
115
  }
118
116
 
119
117
  getRuleInput() {
120
- return this.ruleInputJSON && parse(this.ruleInputJSON) || {
118
+ return this.ruleInputJSON && (0, _structuredClone.deserialize)(JSON.parse(this.ruleInputJSON)) || {
121
119
  ruleInputArray: null
122
120
  };
123
121
  }
124
122
 
125
123
  getTransformedFilters() {
126
- return this.transformedFiltersJSON && parse(this.transformedFiltersJSON) || {
124
+ return this.transformedFiltersJSON && (0, _structuredClone.deserialize)(JSON.parse(this.transformedFiltersJSON)) || {
127
125
  date: new Date(),
128
126
  applied: false,
129
127
  selectedLocations: [],
@@ -59,7 +59,9 @@ class RealmResultsProxy {
59
59
  }
60
60
 
61
61
  getAt(index) {
62
- return this.createEntity(this.realmCollection[index]);
62
+ const realmCollectionElement = this.realmCollection[index];
63
+ if (_lodash.default.isNil(realmCollectionElement)) return null;
64
+ return this.createEntity(realmCollectionElement);
63
65
  }
64
66
 
65
67
  forEach(callback, thisArg) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.30.63",
4
+ "version": "1.30.66",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "license": "AGPL-3.0",
30
30
  "peerDependencies": {
31
- "flatted": "*",
31
+ "@ungap/structured-clone": "*",
32
32
  "lodash": "*",
33
33
  "moment": "*"
34
34
  },
@@ -39,6 +39,7 @@
39
39
  "@babel/plugin-proposal-object-rest-spread": "^7.4.4",
40
40
  "@babel/preset-env": "^7.4.5",
41
41
  "@babel/preset-typescript": "^7.7.7",
42
+ "@ungap/structured-clone": "1.2.0",
42
43
  "babel-jest": "^24.8.0",
43
44
  "babel-loader": "^8.0.0-beta.4",
44
45
  "babel-plugin-istanbul": "^5.1.0",
@@ -53,7 +54,6 @@
53
54
  "jsdom-global": "3.0.2",
54
55
  "lodash": "^4.17.11",
55
56
  "moment": "^2.22.2",
56
- "flatted": "^3.2.7",
57
57
  "nyc": "^14.1.1",
58
58
  "prettier": "2.0.5",
59
59
  "typedoc": "^0.17.4",
package/yarn.lock CHANGED
@@ -1029,6 +1029,11 @@
1029
1029
  dependencies:
1030
1030
  "@types/yargs-parser" "*"
1031
1031
 
1032
+ "@ungap/structured-clone@1.2.0":
1033
+ version "1.2.0"
1034
+ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
1035
+ integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==
1036
+
1032
1037
  "@webassemblyjs/ast@1.9.0":
1033
1038
  version "1.9.0"
1034
1039
  resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
@@ -2873,11 +2878,6 @@ findup-sync@3.0.0:
2873
2878
  micromatch "^3.0.4"
2874
2879
  resolve-dir "^1.0.1"
2875
2880
 
2876
- flatted@^3.2.7:
2877
- version "3.2.7"
2878
- resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
2879
- integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
2880
-
2881
2881
  flush-write-stream@^1.0.0:
2882
2882
  version "1.1.1"
2883
2883
  resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8"