openchs-models 1.33.2 → 1.33.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.circleci/config.yml +15 -5
  2. package/.commit-message.txt +21 -0
  3. package/.nvmrc +1 -1
  4. package/Makefile +32 -10
  5. package/REALM_V12_NOTES.md +46 -0
  6. package/dist/AbstractEncounter.js +4 -105
  7. package/dist/AddressLevel.js +5 -62
  8. package/dist/ApprovalStatus.js +4 -17
  9. package/dist/BaseEntity.js +5 -42
  10. package/dist/BeneficiaryModePin.js +4 -13
  11. package/dist/Checklist.js +6 -52
  12. package/dist/ChecklistDetail.js +4 -22
  13. package/dist/ChecklistItem.js +16 -96
  14. package/dist/ChecklistItemDetail.js +4 -43
  15. package/dist/ChecklistItemStatus.js +4 -33
  16. package/dist/Comment.js +6 -51
  17. package/dist/CommentThread.js +4 -26
  18. package/dist/CompositeDuration.js +1 -18
  19. package/dist/Concept.js +5 -107
  20. package/dist/ConceptAnswer.js +4 -21
  21. package/dist/CustomDashboardCache.js +4 -38
  22. package/dist/CustomFilter.js +5 -15
  23. package/dist/Dashboard.js +4 -23
  24. package/dist/DashboardCache.js +4 -23
  25. package/dist/DashboardSection.js +4 -24
  26. package/dist/DashboardSectionCardMapping.js +4 -21
  27. package/dist/Displayable.js +3 -11
  28. package/dist/Documentation.js +4 -21
  29. package/dist/DocumentationItem.js +4 -20
  30. package/dist/Duration.js +4 -39
  31. package/dist/Encounter.js +6 -41
  32. package/dist/EncounterType.js +4 -26
  33. package/dist/EntityApprovalStatus.js +6 -56
  34. package/dist/EntityMetaData.js +7 -105
  35. package/dist/EntityQueue.js +4 -15
  36. package/dist/EntityRule.js +1 -29
  37. package/dist/EntitySyncStatus.js +4 -19
  38. package/dist/Extension.js +4 -18
  39. package/dist/Family.js +4 -56
  40. package/dist/FileFormat.js +0 -7
  41. package/dist/Gender.js +4 -17
  42. package/dist/GroupDashboard.js +4 -23
  43. package/dist/GroupPrivileges.js +4 -28
  44. package/dist/GroupRole.js +4 -34
  45. package/dist/GroupSubject.js +6 -59
  46. package/dist/Groups.js +4 -14
  47. package/dist/Identifier.js +4 -20
  48. package/dist/IdentifierAssignment.js +6 -45
  49. package/dist/IdentifierSource.js +4 -15
  50. package/dist/Individual.js +17 -265
  51. package/dist/LocaleMapping.js +4 -13
  52. package/dist/LocationHierarchy.js +4 -25
  53. package/dist/Media.js +35 -35
  54. package/dist/MediaQueue.js +4 -26
  55. package/dist/MigrationsHelper.js +15 -22
  56. package/dist/MyGroups.js +4 -14
  57. package/dist/News.js +4 -31
  58. package/dist/Observation.js +4 -54
  59. package/dist/ObservationsHolder.js +104 -216
  60. package/dist/OrganisationConfig.js +4 -19
  61. package/dist/PersistedObject.js +1 -19
  62. package/dist/PhoneNumber.js +0 -11
  63. package/dist/PlatformTranslation.js +4 -17
  64. package/dist/Privilege.js +5 -22
  65. package/dist/Program.js +4 -39
  66. package/dist/ProgramEncounter.js +6 -48
  67. package/dist/ProgramEnrolment.js +8 -162
  68. package/dist/ReferenceEntity.js +1 -10
  69. package/dist/ReportCard.js +5 -60
  70. package/dist/ResetSync.js +4 -17
  71. package/dist/Rule.js +4 -28
  72. package/dist/RuleDependency.js +4 -17
  73. package/dist/RuleFailureTelemetry.js +4 -36
  74. package/dist/Schema.js +16 -268
  75. package/dist/SchemaNames.js +3 -46
  76. package/dist/Settings.js +4 -53
  77. package/dist/StandardReportCardType.js +4 -39
  78. package/dist/SubjectMigration.js +6 -45
  79. package/dist/SubjectType.js +6 -72
  80. package/dist/SyncTelemetry.js +4 -40
  81. package/dist/Translation.js +4 -17
  82. package/dist/UserInfo.js +4 -33
  83. package/dist/application/DashboardCacheFilter.js +4 -24
  84. package/dist/application/Filter.js +3 -16
  85. package/dist/application/Form.js +6 -93
  86. package/dist/application/FormElement.js +5 -100
  87. package/dist/application/FormElementGroup.js +4 -75
  88. package/dist/application/FormElementStatus.js +1 -11
  89. package/dist/application/FormMapping.js +6 -44
  90. package/dist/application/Format.js +4 -20
  91. package/dist/application/KeyValue.js +4 -19
  92. package/dist/application/MenuItem.js +4 -35
  93. package/dist/application/MultiSelectFilter.js +1 -11
  94. package/dist/application/NullProgramEnrolment.js +0 -8
  95. package/dist/application/SingleSelectFilter.js +1 -12
  96. package/dist/application/StaticFormElementGroup.js +0 -11
  97. package/dist/application/StringKeyNumericValue.js +4 -17
  98. package/dist/application/ValidationResult.js +6 -20
  99. package/dist/application/ValidationResults.js +1 -14
  100. package/dist/application/WorkItem.js +4 -20
  101. package/dist/application/WorkList.js +1 -24
  102. package/dist/application/WorkLists.js +1 -13
  103. package/dist/assignment/UserSubjectAssignment.js +6 -26
  104. package/dist/draft/DraftEncounter.js +4 -40
  105. package/dist/draft/DraftSubject.js +4 -46
  106. package/dist/error/IgnorableSyncError.js +1 -6
  107. package/dist/error/SyncError.js +1 -6
  108. package/dist/framework/ArrayHelper.js +3 -11
  109. package/dist/framework/DefinedObjectSchema.js +4 -12
  110. package/dist/framework/RealmCollectionHelper.js +1 -9
  111. package/dist/framework/RealmListProxy.js +1 -10
  112. package/dist/framework/RealmObjectSchema.js +1 -11
  113. package/dist/framework/RealmProxy.js +2 -31
  114. package/dist/framework/RealmResultsProxy.js +3 -37
  115. package/dist/framework/RealmResultsProxyHandler.js +2 -5
  116. package/dist/geo/Point.js +4 -17
  117. package/dist/index.js +2 -137
  118. package/dist/location/Locations.js +1 -6
  119. package/dist/observation/MultipleCodedValues.js +1 -21
  120. package/dist/observation/PrimitiveValue.js +1 -17
  121. package/dist/observation/QuestionGroup.js +1 -36
  122. package/dist/observation/RepeatableQuestionGroup.js +4 -27
  123. package/dist/observation/SingleCodedValue.js +1 -15
  124. package/dist/program/SubjectProgramEligibility.js +6 -56
  125. package/dist/relationship/IndividualRelation.js +6 -18
  126. package/dist/relationship/IndividualRelationGenderMapping.js +4 -22
  127. package/dist/relationship/IndividualRelationship.js +6 -51
  128. package/dist/relationship/IndividualRelationshipType.js +4 -24
  129. package/dist/relationship/IndividualRelative.js +4 -31
  130. package/dist/reports/DashboardFilter.js +4 -20
  131. package/dist/reports/DashboardFilterConfig.js +5 -85
  132. package/dist/reports/NestedReportCardResult.js +5 -35
  133. package/dist/reports/Range.js +4 -13
  134. package/dist/reports/ReportCardResult.js +5 -24
  135. package/dist/service/MetaDataService.js +1 -30
  136. package/dist/task/Task.js +6 -62
  137. package/dist/task/TaskStatus.js +4 -21
  138. package/dist/task/TaskType.js +4 -23
  139. package/dist/task/TaskUnAssignment.js +6 -30
  140. package/dist/utility/AgeUtil.js +1 -15
  141. package/dist/utility/ArrayUtil.js +1 -6
  142. package/dist/utility/AuditUtil.js +1 -8
  143. package/dist/utility/DateTimeUtil.js +1 -8
  144. package/dist/utility/General.js +4 -71
  145. package/dist/utility/JsonStringify.js +15 -28
  146. package/dist/utility/MergeUtil.js +1 -10
  147. package/dist/utility/ResourceUtil.js +1 -7
  148. package/dist/videos/Video.js +4 -23
  149. package/dist/videos/VideoTelemetric.js +6 -37
  150. package/package.json +6 -3
  151. package/scripts/validateSchemas.js +40 -0
  152. package/tsconfig.json +1 -1
  153. package/yarn.lock +0 -6744
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
9
  class ArrayUtil {
13
10
  static toggle(list, toggledItem, iteratee) {
14
11
  if (_lodash.default.remove(list, x => iteratee(x, toggledItem)).length !== 1) list.push(toggledItem);
15
12
  }
16
-
17
13
  }
18
-
19
14
  var _default = ArrayUtil;
20
15
  exports.default = _default;
@@ -6,13 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.updateAuditFields = updateAuditFields;
7
7
  exports.mapAuditFields = mapAuditFields;
8
8
  exports.AuditFields = void 0;
9
-
10
9
  var _ResourceUtil = _interopRequireDefault(require("./ResourceUtil"));
11
-
12
10
  var _lodash = _interopRequireDefault(require("lodash"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
12
  const AuditFields = {
17
13
  createdBy: {
18
14
  type: "string",
@@ -32,7 +28,6 @@ const AuditFields = {
32
28
  }
33
29
  };
34
30
  exports.AuditFields = AuditFields;
35
-
36
31
  function updateAuditFields(entity, userInfo, isNew = false) {
37
32
  // old entities may have createdByUUID as null if never synced after audit release
38
33
  // isNew must be passed by callers to specify that it is indeed a create scenario
@@ -40,13 +35,11 @@ function updateAuditFields(entity, userInfo, isNew = false) {
40
35
  entity.createdByUUID = userInfo.userUUID;
41
36
  entity.createdBy = userInfo.name;
42
37
  }
43
-
44
38
  if (_lodash.default.isNil(entity.lastModifiedByUUID)) {
45
39
  entity.lastModifiedByUUID = userInfo.userUUID;
46
40
  entity.lastModifiedBy = userInfo.name;
47
41
  }
48
42
  }
49
-
50
43
  function mapAuditFields(txnEntity, txnResource) {
51
44
  txnEntity.createdBy = _ResourceUtil.default.getFieldValue(txnResource, "createdBy");
52
45
  txnEntity.createdByUUID = _ResourceUtil.default.getFieldValue(txnResource, "createdByUUID");
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
8
  var _moment = _interopRequireDefault(require("moment"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
10
  class DateTimeUtil {
15
11
  static validateDateRange(fromDate, toDate) {
16
12
  if (_lodash.default.isNil(toDate) && _lodash.default.isNil(fromDate)) return [true];
@@ -18,15 +14,12 @@ class DateTimeUtil {
18
14
  if (!(0, _moment.default)(fromDate).isSameOrBefore(toDate)) return [false, 'startDateGreaterThanEndError'];
19
15
  return [true];
20
16
  }
21
-
22
17
  static validateTimeRange(fromTime, toTime) {
23
18
  if (_lodash.default.isNil(toTime) && _lodash.default.isNil(fromTime)) return [true];
24
19
  if (_lodash.default.isNil(toTime) || _lodash.default.isNil(fromTime)) return [false, 'bothTimeShouldBeSelectedError'];
25
20
  if (!(0, _moment.default)(fromTime, 'HH:mm').isSameOrBefore((0, _moment.default)(toTime, 'HH:mm'))) return [false, 'startTimeGreaterThanEndError'];
26
21
  return [true];
27
22
  }
28
-
29
23
  }
30
-
31
24
  var _default = DateTimeUtil;
32
25
  exports.default = _default;
@@ -4,59 +4,42 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Duration = _interopRequireDefault(require("../Duration"));
9
-
10
8
  var _lodash = _interopRequireDefault(require("lodash"));
11
-
12
9
  var _moment = _interopRequireDefault(require("moment"));
13
-
14
10
  var _Observation = _interopRequireDefault(require("../Observation"));
15
-
16
11
  var _Concept = _interopRequireDefault(require("../Concept"));
17
-
18
12
  var _QuestionGroup = _interopRequireDefault(require("../observation/QuestionGroup"));
19
-
20
13
  var _RepeatableQuestionGroup = _interopRequireDefault(require("../observation/RepeatableQuestionGroup"));
21
-
22
14
  var _uuid = require("uuid");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- 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; }
27
-
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
18
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
28
19
  var currentLogLevel;
29
-
30
20
  class General {
31
21
  static setCurrentLogLevel(level) {
32
22
  currentLogLevel = level;
33
23
  }
34
-
35
24
  static look(stuffToPrint) {
36
25
  General.logDebug("General", stuffToPrint);
37
26
  return stuffToPrint;
38
27
  }
39
-
40
28
  static getCurrentLogLevel() {
41
29
  return currentLogLevel;
42
30
  }
43
-
44
31
  static canLog(level) {
45
32
  return General.getCurrentLogLevel() <= level;
46
33
  }
47
-
48
34
  static formatDateTime(date) {
49
35
  return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
50
36
  }
51
-
52
37
  static isNilOrEmpty(value) {
53
38
  return _lodash.default.isNil(value) || _lodash.default.isEmpty(_lodash.default.trim(value));
54
39
  }
55
-
56
40
  static getSafeTimeStamp() {
57
41
  return (0, _moment.default)().format("MMM_Do_YYYY_h_mm_ss_a");
58
42
  }
59
-
60
43
  static getTimeStamp() {
61
44
  var date = new Date();
62
45
  var month = date.getMonth() + 1;
@@ -71,51 +54,41 @@ class General {
71
54
  sec = (sec < 10 ? "0" : "") + sec;
72
55
  return `${day}-${month}-${date.getFullYear()} ${hour}:${min}:${sec}`;
73
56
  }
74
-
75
57
  static hoursAndMinutesOfDateAreZero(date) {
76
58
  return date && date.getMinutes() === 0 && date.getHours() === 0;
77
59
  }
78
-
79
60
  static formatDate(date) {
80
61
  return `${General.toTwoChars(date.getDate())}-${General.toTwoChars(date.getMonth() + 1)}-${date.getFullYear()}`;
81
62
  }
82
-
83
63
  static isoFormat(date) {
84
64
  return `${date.getFullYear()}-${General.toTwoChars(date.getMonth() + 1)}-${General.toTwoChars(date.getDate())}`;
85
65
  }
86
-
87
66
  static toISOFormatTime(hour, minute) {
88
67
  return (0, _moment.default)({
89
68
  hour: hour,
90
69
  minute: minute
91
70
  }).format("HH:mm");
92
71
  }
93
-
94
72
  static toDisplayTime(isoFormatTime) {
95
73
  const time = this.toTimeObject(isoFormatTime);
96
74
  return (0, _moment.default)(time).format("LT");
97
75
  }
98
-
99
76
  static toTimeObject(isoFormatTime) {
100
77
  const timeArray = _lodash.default.split(isoFormatTime, ":");
101
-
102
78
  return {
103
79
  hour: _lodash.default.toInteger(timeArray[0]),
104
80
  minute: _lodash.default.toInteger(timeArray[1])
105
81
  };
106
82
  }
107
-
108
83
  static toTwoChars(number) {
109
84
  return `${number}`.length === 1 ? `0${number}` : `${number}`;
110
85
  }
111
-
112
86
  static formatValue(value) {
113
87
  if (value instanceof Date) return General.formatDate(value);
114
88
  if (value instanceof _Duration.default) return value.toString();
115
89
  if (!isNaN(value)) return value;
116
90
  return value;
117
91
  }
118
-
119
92
  static replaceAndroidIncompatibleChars(str) {
120
93
  const illegalCharacters = "|\\?*<\":>+[]/'";
121
94
  const array = illegalCharacters.split("");
@@ -124,11 +97,9 @@ class General {
124
97
  });
125
98
  return str;
126
99
  }
127
-
128
100
  static toDisplayDate(date) {
129
101
  return (0, _moment.default)(date).format("DD-MMM-YYYY");
130
102
  }
131
-
132
103
  static assignDateFields(dateFields, source, dest) {
133
104
  if (!_lodash.default.isNil(dateFields)) {
134
105
  dateFields.forEach(fieldName => {
@@ -136,55 +107,44 @@ class General {
136
107
  });
137
108
  }
138
109
  }
139
-
140
110
  static assignFields(source, dest, directCopyFields, dateFields, observationFields = [], entityService) {
141
111
  if (!_lodash.default.isNil(directCopyFields)) {
142
112
  directCopyFields.forEach(fieldName => {
143
113
  dest[fieldName] = source[fieldName];
144
114
  });
145
115
  }
146
-
147
116
  General.assignDateFields(dateFields, source, dest);
148
117
  General.assignObsFields(source, dest, observationFields, entityService);
149
118
  return dest;
150
119
  }
151
-
152
120
  static assignObsFields(source, dest, observationFields = [], entityService) {
153
121
  if (!entityService) {
154
122
  return dest;
155
123
  }
156
-
157
124
  observationFields.forEach(observationField => {
158
125
  const observations = [];
159
-
160
126
  if (!_lodash.default.isNil(source[observationField])) {
161
127
  _lodash.default.toPairs(source[observationField]).forEach(([conceptUUID, value]) => {
162
128
  const observation = new _Observation.default();
163
129
  const concept = entityService.findByKey("uuid", conceptUUID, _Concept.default.schema.name);
164
130
  observation.concept = concept;
165
-
166
131
  if (concept.isQuestionGroup()) {
167
132
  const valueJson = _lodash.default.isArray(value) ? this.getRepeatableQuestionValue(value, entityService) : this.createQuestionGroupObservations(value, entityService);
168
133
  observation.valueJSON = JSON.stringify(valueJson);
169
134
  } else {
170
135
  observation.valueJSON = JSON.stringify(observation.concept.getValueWrapperFor(value));
171
136
  }
172
-
173
137
  observations.push(observation);
174
138
  });
175
139
  }
176
-
177
140
  dest[observationField] = observations;
178
141
  });
179
142
  return dest;
180
143
  }
181
-
182
144
  static getRepeatableQuestionValue(values, entityService) {
183
145
  const repeatableValues = _lodash.default.map(values, value => this.createQuestionGroupObservations(value, entityService));
184
-
185
146
  return new _RepeatableQuestionGroup.default(repeatableValues);
186
147
  }
187
-
188
148
  static createQuestionGroupObservations(keyValues, entityService) {
189
149
  const questionGroupObservations = _lodash.default.map(_lodash.default.toPairs(keyValues), ([conceptUUID, value]) => {
190
150
  const observation = new _Observation.default();
@@ -192,72 +152,55 @@ class General {
192
152
  observation.valueJSON = observation.concept.getValueWrapperFor(value);
193
153
  return observation;
194
154
  });
195
-
196
155
  return new _QuestionGroup.default(questionGroupObservations);
197
156
  }
198
-
199
157
  static pick(from, attributes, listAttributes) {
200
158
  const picked = _lodash.default.pick(from.that, attributes);
201
-
202
159
  if (!_lodash.default.isNil(listAttributes)) {
203
160
  listAttributes.forEach(listAttribute => {
204
161
  picked[listAttribute] = [...from.that[listAttribute]];
205
162
  });
206
163
  }
207
-
208
164
  return picked;
209
165
  }
210
-
211
166
  static randomUUID() {
212
167
  return (0, _uuid.v4)();
213
168
  }
214
-
215
169
  static areEqualShallow(a, b) {
216
170
  if (_lodash.default.isNil(a) !== _lodash.default.isNil(b)) return false;
217
-
218
171
  for (var key in a) {
219
172
  if (a[key] !== b[key]) {
220
173
  return false;
221
174
  }
222
175
  }
223
-
224
176
  return true;
225
177
  }
226
-
227
178
  static dateWithoutTime(date) {
228
179
  return new Date(date.getFullYear(), date.getMonth(), date.getDate());
229
180
  }
230
-
231
181
  static dateAIsAfterB(a, b) {
232
182
  if (_lodash.default.isNil(a) || _lodash.default.isNil(b)) return false;
233
183
  return (0, _moment.default)(General.dateWithoutTime(a)).isAfter(General.dateWithoutTime(b));
234
184
  }
235
-
236
185
  static dateIsAfterToday(date) {
237
186
  return General.dateAIsAfterB(date, new Date());
238
187
  }
239
-
240
188
  static dateAIsBeforeB(a, b) {
241
189
  if (_lodash.default.isNil(a) || _lodash.default.isNil(b)) return false;
242
190
  return (0, _moment.default)(General.dateWithoutTime(a)).isBefore(General.dateWithoutTime(b));
243
191
  }
244
-
245
192
  static logDebug(source, message) {
246
193
  General.log(source, message, General.LogLevel.Debug);
247
194
  }
248
-
249
195
  static logInfo(source, message) {
250
196
  General.log(source, message, General.LogLevel.Info);
251
197
  }
252
-
253
198
  static logWarn(source, message) {
254
199
  General.log(source, message, General.LogLevel.Warn);
255
200
  }
256
-
257
201
  static logError(source, message) {
258
202
  General.log(source, message, General.LogLevel.Error);
259
203
  }
260
-
261
204
  static log(source, message, level) {
262
205
  if (level >= General.getCurrentLogLevel()) {
263
206
  let levelName = `${_lodash.default.findKey(General.LogLevel, value => value === level)}`;
@@ -265,7 +208,6 @@ class General {
265
208
  if (level >= General.getCurrentLogLevel()) console[levelName.toLowerCase()](logMessage);
266
209
  }
267
210
  }
268
-
269
211
  static getDisplayableMessage(obj) {
270
212
  if (typeof obj === "object") {
271
213
  let s = JSON.stringify(obj);
@@ -273,39 +215,30 @@ class General {
273
215
  if (s === "{}") return obj;
274
216
  return s;
275
217
  }
276
-
277
218
  return obj;
278
219
  }
279
-
280
220
  static isoFormat(date) {
281
221
  if (_lodash.default.isNil(date)) return null;
282
222
  return (0, _moment.default)(date).format();
283
223
  }
284
-
285
224
  static isNumeric(str) {
286
225
  return !isNaN(parseFloat(str)) && isFinite(str);
287
226
  }
288
-
289
227
  static isDeepEmpty(x) {
290
228
  if (_lodash.default.isNil(x)) return true;
291
229
  if (_lodash.default.isDate(x)) return false;
292
230
  if (_lodash.default.isEmpty(x)) return true;
293
-
294
231
  if (!_lodash.default.isArray(x)) {
295
232
  return _lodash.default.reduce(Object.values(x), (isEmpty, v) => _lodash.default.isNil(v) && isEmpty, true);
296
233
  }
297
-
298
234
  return false;
299
235
  }
300
-
301
236
  }
302
-
303
237
  _defineProperty(General, "LogLevel", {
304
238
  Error: 4,
305
239
  Warn: 3,
306
240
  Info: 2,
307
241
  Debug: 1
308
242
  });
309
-
310
243
  var _default = General;
311
244
  exports.default = _default;
@@ -4,61 +4,52 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.JSONStringify = void 0;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
9
  //initial code from : https://javascript.plainenglish.io/create-your-own-implementation-of-json-stringify-simiplied-version-8ab6746cdd1
10
+
13
11
  const isArray = function (value) {
14
12
  return Array.isArray(value) && typeof value === 'object';
15
13
  };
16
-
17
14
  const isObject = function (value) {
18
15
  return typeof value === 'object' && value !== null && !Array.isArray(value);
19
16
  };
20
-
21
17
  const isString = function (value) {
22
18
  return typeof value === 'string';
23
19
  };
24
-
25
20
  const isBoolean = function (value) {
26
21
  return typeof value === 'boolean';
27
22
  };
28
-
29
23
  const isNumber = function (value) {
30
24
  return typeof value === 'number';
31
- }; // Common check for number, string and boolean value
32
-
25
+ };
33
26
 
27
+ // Common check for number, string and boolean value
34
28
  const restOfDataTypes = function (value) {
35
29
  return isNumber(value) || isString(value) || isBoolean(value);
36
- }; // This function will be used to remove extra comma from the arrays and object
37
-
30
+ };
38
31
 
32
+ // This function will be used to remove extra comma from the arrays and object
39
33
  const removeComma = function (str) {
40
34
  const tempArr = str.split('');
41
35
  tempArr.pop();
42
36
  return tempArr.join('');
43
37
  };
44
-
45
38
  const duckCheckNativeRealmCollection = function (obj) {
46
39
  return typeof obj === "object" && !_lodash.default.isNil(_lodash.default.get(obj, "removeAllListeners")) && !_lodash.default.isNil(_lodash.default.get(obj, "snapshot"));
47
40
  };
48
-
49
41
  function duckCheckForError(obj) {
50
42
  return obj.stack && obj.message;
51
43
  }
52
-
53
44
  const JSONStringifyInternal = function (obj, depth, objectMap, arrayWidth, objectKey) {
54
- if (depth === 0) return "BELOW_DEPTH"; // Boolean and Number behave in a same way and String we need to add extra quotes
55
-
45
+ if (depth === 0) return "BELOW_DEPTH";
46
+ // Boolean and Number behave in a same way and String we need to add extra quotes
56
47
  if (restOfDataTypes(obj)) {
57
48
  const passQuotes = isString(obj) ? `"` : '';
58
49
  return `${passQuotes}${obj}${passQuotes}`;
59
- } // Recursive function call for Arrays to handle nested arrays
60
-
50
+ }
61
51
 
52
+ // Recursive function call for Arrays to handle nested arrays
62
53
  if (isArray(obj)) {
63
54
  let arrStr = '';
64
55
  obj.forEach((eachValue, index) => {
@@ -69,12 +60,11 @@ const JSONStringifyInternal = function (obj, depth, objectMap, arrayWidth, objec
69
60
  });
70
61
  return `[` + removeComma(arrStr) + `]`;
71
62
  }
72
-
73
63
  if (duckCheckNativeRealmCollection(obj, objectKey)) {
74
64
  return "<realm-collection>";
75
- } // Recursive function call for Object to handle nested Object
76
-
65
+ }
77
66
 
67
+ // Recursive function call for Object to handle nested Object
78
68
  if (isObject(obj) && _lodash.default.isNil(objectMap.get(obj))) {
79
69
  objectMap.set(obj, true);
80
70
  let objStr = '';
@@ -83,25 +73,22 @@ const JSONStringifyInternal = function (obj, depth, objectMap, arrayWidth, objec
83
73
  const eachValue = obj[eachKey];
84
74
  objStr += `"${eachKey}":${JSONStringifyInternal(eachValue, depth - 1, objectMap, arrayWidth, eachKey)},`;
85
75
  });
86
-
87
76
  if (duckCheckForError(obj)) {
88
77
  objStr += `message:${obj.message},`;
89
78
  objStr += `stack:${obj.stack},`;
90
79
  }
91
-
92
80
  return `{` + removeComma(objStr) + `}`;
93
81
  } else if (!_lodash.default.isNil(objectMap.get(obj))) {
94
82
  return "<object_repeated>";
95
83
  } else {
96
84
  return obj;
97
85
  }
98
- }; // This class is not meant for production purposes, it is to be used for developer assistance like logging.
99
- // It supports recursive object structure, native realm collection, restricting array width (number of elements that can be stringified), and object tree depth
100
-
86
+ };
101
87
 
88
+ // This class is not meant for production purposes, it is to be used for developer assistance like logging.
89
+ // It supports recursive object structure, native realm collection, restricting array width (number of elements that can be stringified), and object tree depth
102
90
  const JSONStringify = function (obj, objectTreeDepth = 3, arrayWidth = 4) {
103
91
  const objectMap = new Map();
104
92
  return JSONStringifyInternal(obj, objectTreeDepth, objectMap, arrayWidth);
105
93
  };
106
-
107
94
  exports.JSONStringify = JSONStringify;
@@ -4,29 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
8
  var _SchemaNames = _interopRequireDefault(require("../SchemaNames"));
11
-
12
9
  var _BaseEntity = _interopRequireDefault(require("../BaseEntity"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
11
  class MergeUtil {
17
12
  static getMergeFunction(childEntityName, mergeMap) {
18
13
  return args => {
19
14
  const entity = _BaseEntity.default.mergeOn(mergeMap.get(childEntityName))(args);
20
-
21
15
  if (childEntityName === _SchemaNames.default.EntityApprovalStatus) {
22
16
  entity.latestEntityApprovalStatus = _lodash.default.maxBy(entity.approvalStatuses, 'statusDateTime');
23
17
  }
24
-
25
18
  return entity;
26
19
  };
27
20
  }
28
-
29
21
  }
30
-
31
22
  var _default = MergeUtil;
32
23
  exports.default = _default;
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
9
  class ResourceUtil {
13
10
  static getUUIDFor(resource, property) {
14
11
  return ResourceUtil.getFieldValue(resource, property);
15
12
  }
16
-
17
13
  static getFieldValue(resource, property) {
18
14
  return _lodash.default.get(resource, ["_links", property, "href"]);
19
15
  }
20
-
21
16
  }
22
-
23
17
  var _default = ResourceUtil;
24
18
  exports.default = _default;
@@ -4,54 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _BaseEntity = _interopRequireDefault(require("../BaseEntity"));
9
-
10
8
  var _lodash = _interopRequireDefault(require("lodash"));
11
-
12
9
  var _SchemaNames = _interopRequireDefault(require("../SchemaNames"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- 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; }
17
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
13
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
14
  class Video extends _BaseEntity.default {
19
15
  constructor(that = null) {
20
16
  super(that);
21
17
  }
22
-
23
18
  get title() {
24
19
  return this.that.title;
25
20
  }
26
-
27
21
  set title(x) {
28
22
  this.that.title = x;
29
23
  }
30
-
31
24
  get filePath() {
32
25
  return this.that.filePath;
33
26
  }
34
-
35
27
  set filePath(x) {
36
28
  this.that.filePath = x;
37
29
  }
38
-
39
30
  get description() {
40
31
  return this.that.description;
41
32
  }
42
-
43
33
  set description(x) {
44
34
  this.that.description = x;
45
35
  }
46
-
47
36
  get duration() {
48
37
  return this.that.duration;
49
38
  }
50
-
51
39
  set duration(x) {
52
40
  this.that.duration = x;
53
41
  }
54
-
55
42
  static create({
56
43
  uuid,
57
44
  title,
@@ -69,23 +56,18 @@ class Video extends _BaseEntity.default {
69
56
  voided
70
57
  });
71
58
  }
72
-
73
59
  static fromResource(resource) {
74
60
  return Video.create(_lodash.default.assignIn({}, resource, {
75
61
  voided: !!resource.voided
76
62
  }));
77
63
  }
78
-
79
64
  cloneForReference() {
80
65
  return Video.create(_lodash.default.assignIn({}, this));
81
66
  }
82
-
83
67
  get translatedFieldValue() {
84
68
  return this.title;
85
69
  }
86
-
87
70
  }
88
-
89
71
  _defineProperty(Video, "schema", {
90
72
  name: _SchemaNames.default.Video,
91
73
  primaryKey: "uuid",
@@ -107,6 +89,5 @@ _defineProperty(Video, "schema", {
107
89
  }
108
90
  }
109
91
  });
110
-
111
92
  var _default = Video;
112
93
  exports.default = _default;