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,123 +4,89 @@ 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 _ResourceUtil = _interopRequireDefault(require("./utility/ResourceUtil"));
11
-
12
9
  var _General = _interopRequireDefault(require("./utility/General"));
13
-
14
10
  var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
15
-
16
11
  var _Form = _interopRequireDefault(require("./application/Form"));
17
-
18
12
  var _ChecklistDetail = _interopRequireDefault(require("./ChecklistDetail"));
19
-
20
13
  var _Concept = _interopRequireDefault(require("./Concept"));
21
-
22
14
  var _ChecklistItemStatus = _interopRequireDefault(require("./ChecklistItemStatus"));
23
-
24
15
  var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- 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; }
29
-
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ 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); }
30
20
  class ChecklistItemDetail extends _BaseEntity.default {
31
21
  constructor(that = null) {
32
22
  super(that);
33
23
  }
34
-
35
24
  get concept() {
36
25
  return this.toEntity("concept", _Concept.default);
37
26
  }
38
-
39
27
  set concept(x) {
40
28
  this.that.concept = this.fromObject(x);
41
29
  }
42
-
43
30
  get stateConfig() {
44
31
  return this.toEntityList("stateConfig", _ChecklistItemStatus.default);
45
32
  }
46
-
47
33
  set stateConfig(x) {
48
34
  this.that.stateConfig = this.fromEntityList(x);
49
35
  }
50
-
51
36
  get form() {
52
37
  return this.toEntity("form", _Form.default);
53
38
  }
54
-
55
39
  set form(x) {
56
40
  this.that.form = this.fromObject(x);
57
41
  }
58
-
59
42
  get checklistDetail() {
60
43
  return this.toEntity("checklistDetail", _ChecklistDetail.default);
61
44
  }
62
-
63
45
  set checklistDetail(x) {
64
46
  this.that.checklistDetail = this.fromObject(x);
65
47
  }
66
-
67
48
  get dependentOn() {
68
49
  return this.toEntity("dependentOn", ChecklistItemDetail);
69
50
  }
70
-
71
51
  set dependentOn(x) {
72
52
  this.that.dependentOn = this.fromObject(x);
73
53
  }
74
-
75
54
  get scheduleOnExpiryOfDependency() {
76
55
  return this.that.scheduleOnExpiryOfDependency;
77
56
  }
78
-
79
57
  set scheduleOnExpiryOfDependency(x) {
80
58
  this.that.scheduleOnExpiryOfDependency = x;
81
59
  }
82
-
83
60
  get minDaysFromStartDate() {
84
61
  return this.that.minDaysFromStartDate;
85
62
  }
86
-
87
63
  set minDaysFromStartDate(x) {
88
64
  this.that.minDaysFromStartDate = x;
89
65
  }
90
-
91
66
  get minDaysFromDependent() {
92
67
  return this.that.minDaysFromDependent;
93
68
  }
94
-
95
69
  set minDaysFromDependent(x) {
96
70
  this.that.minDaysFromDependent = x;
97
71
  }
98
-
99
72
  get expiresAfter() {
100
73
  return this.that.expiresAfter;
101
74
  }
102
-
103
75
  set expiresAfter(x) {
104
76
  this.that.expiresAfter = x;
105
77
  }
106
-
107
78
  static fromResource(checklistItemResource, entityService, resourcesInCurrentPage) {
108
79
  const checklistDetail = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(checklistItemResource, "checklistDetailUUID"), _ChecklistDetail.default.schema.name);
109
80
  const form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(checklistItemResource, "formUUID"), _Form.default.schema.name);
110
81
  const concept = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(checklistItemResource, "conceptUUID"), _Concept.default.schema.name);
111
-
112
82
  const checklistItemDetail = _General.default.assignFields(checklistItemResource, new ChecklistItemDetail(), ["uuid", "voided", "scheduleOnExpiryOfDependency", "minDaysFromStartDate", "minDaysFromDependent", "expiresAfter"]);
113
-
114
83
  checklistItemDetail.stateConfig = _lodash.default.get(checklistItemResource, "checklistItemStatus", []).map(itemStatus => _ChecklistItemStatus.default.fromResource(itemStatus, entityService));
115
84
  checklistItemDetail.checklistDetail = checklistDetail;
116
85
  checklistItemDetail.form = form;
117
86
  checklistItemDetail.concept = concept;
118
-
119
87
  const leadDetailUUID = _ResourceUtil.default.getUUIDFor(checklistItemResource, "leadDetailUUID");
120
-
121
88
  if (!_lodash.default.isNil(leadDetailUUID)) {
122
89
  const createdLeadChecklistItemDetail = entityService.findByKey("uuid", leadDetailUUID, ChecklistItemDetail.schema.name);
123
-
124
90
  if (_lodash.default.isNil(createdLeadChecklistItemDetail)) {
125
91
  let leadDetail = resourcesInCurrentPage.find(entity => entity.uuid === leadDetailUUID);
126
92
  checklistItemDetail.dependentOn = ChecklistItemDetail.fromResource(leadDetail, entityService, resourcesInCurrentPage);
@@ -130,16 +96,12 @@ class ChecklistItemDetail extends _BaseEntity.default {
130
96
  } else {
131
97
  checklistItemDetail.dependentOn = null;
132
98
  }
133
-
134
99
  return checklistItemDetail;
135
100
  }
136
-
137
101
  get isDependent() {
138
102
  return !_lodash.default.isNil(this.dependentOn);
139
103
  }
140
-
141
104
  }
142
-
143
105
  _defineProperty(ChecklistItemDetail, "schema", {
144
106
  name: _SchemaNames.default.ChecklistItemDetail,
145
107
  primaryKey: "uuid",
@@ -189,6 +151,5 @@ _defineProperty(ChecklistItemDetail, "schema", {
189
151
  }
190
152
  }
191
153
  });
192
-
193
154
  var _default = ChecklistItemDetail;
194
155
  exports.default = _default;
@@ -4,106 +4,81 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _General = _interopRequireDefault(require("./utility/General"));
9
-
10
8
  var _StringKeyNumericValue = _interopRequireDefault(require("./application/StringKeyNumericValue"));
11
-
12
9
  var _moment = _interopRequireDefault(require("moment"));
13
-
14
10
  var _PersistedObject = _interopRequireDefault(require("./PersistedObject"));
15
-
16
11
  var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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; }
21
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ 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; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
15
+ 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); }
22
16
  class ChecklistItemStatus extends _PersistedObject.default {
23
17
  constructor(that = null) {
24
18
  super(that);
25
19
  }
26
-
27
20
  get state() {
28
21
  return this.that.state;
29
22
  }
30
-
31
23
  set state(x) {
32
24
  this.that.state = x;
33
25
  }
34
-
35
26
  get from() {
36
27
  return this.toEntity("from", _StringKeyNumericValue.default);
37
28
  }
38
-
39
29
  set from(x) {
40
30
  this.that.from = this.fromObject(x);
41
31
  }
42
-
43
32
  get to() {
44
33
  return this.toEntity("to", _StringKeyNumericValue.default);
45
34
  }
46
-
47
35
  set to(x) {
48
36
  this.that.to = this.fromObject(x);
49
37
  }
50
-
51
38
  get color() {
52
39
  return this.that.color;
53
40
  }
54
-
55
41
  set color(x) {
56
42
  this.that.color = x;
57
43
  }
58
-
59
44
  get displayOrder() {
60
45
  return this.that.displayOrder;
61
46
  }
62
-
63
47
  set displayOrder(x) {
64
48
  this.that.displayOrder = x;
65
49
  }
66
-
67
50
  get start() {
68
51
  return this.that.start;
69
52
  }
70
-
71
53
  set start(x) {
72
54
  this.that.start = x;
73
55
  }
74
-
75
56
  get end() {
76
57
  return this.that.end;
77
58
  }
78
-
79
59
  set end(x) {
80
60
  this.that.end = x;
81
61
  }
82
-
83
62
  static fromResource(resource, entityService) {
84
63
  const checklistItemStatus = _General.default.assignFields(resource, new ChecklistItemStatus(), ["state", "color", "displayOrder", "start", "end"]);
85
-
86
64
  const [toK, toV] = Object.entries(resource["to"])[0];
87
65
  const [fromK, fromV] = Object.entries(resource["from"])[0];
88
66
  checklistItemStatus.to = _StringKeyNumericValue.default.fromResource(toK, toV);
89
67
  checklistItemStatus.from = _StringKeyNumericValue.default.fromResource(fromK, fromV);
90
68
  return checklistItemStatus;
91
69
  }
92
-
93
70
  static get completed() {
94
71
  const completed = new ChecklistItemStatus();
95
72
  completed.color = "green";
96
73
  completed.state = "Completed";
97
74
  return completed;
98
75
  }
99
-
100
76
  static get expired() {
101
77
  const expired = new ChecklistItemStatus();
102
78
  expired.color = "grey";
103
79
  expired.state = "Expired";
104
80
  return expired;
105
81
  }
106
-
107
82
  static na(years) {
108
83
  const na = new ChecklistItemStatus();
109
84
  na.to = {};
@@ -117,13 +92,10 @@ class ChecklistItemStatus extends _PersistedObject.default {
117
92
  na.state = "Past Expiry";
118
93
  return na;
119
94
  }
120
-
121
95
  fromDate(baseDate) {
122
96
  return (0, _moment.default)(baseDate).add(this.from.value, this.from.key).toDate();
123
97
  }
124
-
125
98
  }
126
-
127
99
  _defineProperty(ChecklistItemStatus, "schema", {
128
100
  name: _SchemaNames.default.ChecklistItemStatus,
129
101
  embedded: true,
@@ -146,6 +118,5 @@ _defineProperty(ChecklistItemStatus, "schema", {
146
118
  end: "int"
147
119
  }
148
120
  });
149
-
150
121
  var _default = ChecklistItemStatus;
151
122
  exports.default = _default;
package/dist/Comment.js CHANGED
@@ -4,142 +4,104 @@ 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 _General = _interopRequireDefault(require("./utility/General"));
11
-
12
9
  var _Individual = _interopRequireDefault(require("./Individual"));
13
-
14
10
  var _lodash = _interopRequireDefault(require("lodash"));
15
-
16
11
  var _ResourceUtil = _interopRequireDefault(require("./utility/ResourceUtil"));
17
-
18
12
  var _CommentThread = _interopRequireDefault(require("./CommentThread"));
19
-
20
13
  var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
21
-
22
14
  var _AuditUtil = require("./utility/AuditUtil");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
27
-
28
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
-
30
- 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; }
31
-
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ 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; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
+ 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); }
32
21
  class Comment extends _BaseEntity.default {
33
22
  constructor(that = null) {
34
23
  super(that);
35
24
  }
36
-
37
25
  get text() {
38
26
  return this.that.text;
39
27
  }
40
-
41
28
  set text(x) {
42
29
  this.that.text = x;
43
30
  }
44
-
45
31
  get subject() {
46
32
  return this.toEntity("subject", _Individual.default);
47
33
  }
48
-
49
34
  set subject(x) {
50
35
  this.that.subject = this.fromObject(x);
51
36
  }
52
-
53
37
  get displayUsername() {
54
38
  return this.that.displayUsername;
55
39
  }
56
-
57
40
  set displayUsername(x) {
58
41
  this.that.displayUsername = x;
59
42
  }
60
-
61
43
  get createdByUsername() {
62
44
  return this.that.createdByUsername;
63
45
  }
64
-
65
46
  set createdByUsername(x) {
66
47
  this.that.createdByUsername = x;
67
48
  }
68
-
69
49
  get createdDateTime() {
70
50
  return this.that.createdDateTime;
71
51
  }
72
-
73
52
  set createdDateTime(x) {
74
53
  this.that.createdDateTime = x;
75
54
  }
76
-
77
55
  get lastModifiedDateTime() {
78
56
  return this.that.lastModifiedDateTime;
79
57
  }
80
-
81
58
  set lastModifiedDateTime(x) {
82
59
  this.that.lastModifiedDateTime = x;
83
60
  }
84
-
85
61
  get commentThread() {
86
62
  return this.toEntity("commentThread", _CommentThread.default);
87
63
  }
88
-
89
64
  set commentThread(x) {
90
65
  this.that.commentThread = this.fromObject(x);
91
66
  }
92
-
93
67
  get createdBy() {
94
68
  return this.that.createdBy;
95
69
  }
96
-
97
70
  set createdBy(x) {
98
71
  this.that.createdBy = x;
99
72
  }
100
-
101
73
  get lastModifiedBy() {
102
74
  return this.that.lastModifiedBy;
103
75
  }
104
-
105
76
  set lastModifiedBy(x) {
106
77
  this.that.lastModifiedBy = x;
107
78
  }
108
-
109
79
  get createdByUUID() {
110
80
  return this.that.createdByUUID;
111
81
  }
112
-
113
82
  set createdByUUID(x) {
114
83
  this.that.createdByUUID = x;
115
84
  }
116
-
117
85
  get lastModifiedByUUID() {
118
86
  return this.that.lastModifiedByUUID;
119
87
  }
120
-
121
88
  set lastModifiedByUUID(x) {
122
89
  this.that.lastModifiedByUUID = x;
123
90
  }
124
-
125
91
  get toResource() {
126
92
  const resource = _lodash.default.pick(this, ["uuid", "text", "voided"]);
127
-
128
93
  resource["subjectUUID"] = this.subject.uuid;
129
94
  resource["commentThreadUUID"] = this.commentThread.uuid;
130
95
  return resource;
131
96
  }
132
-
133
97
  static fromResource(resource, entityService) {
134
98
  const comment = _General.default.assignFields(resource, new Comment(), ["uuid", "text", "displayUsername", "voided"], ["createdDateTime", "lastModifiedDateTime"]);
135
-
136
99
  comment.createdByUsername = resource["createdBy"];
137
100
  comment.subject = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "individualUUID"), _Individual.default.schema.name);
138
101
  comment.commentThread = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "commentThreadUUID"), _CommentThread.default.schema.name);
139
102
  (0, _AuditUtil.mapAuditFields)(comment, resource);
140
103
  return comment;
141
104
  }
142
-
143
105
  static createEmptyInstance(uuid) {
144
106
  const comment = new Comment();
145
107
  comment.uuid = uuid || _General.default.randomUUID();
@@ -150,17 +112,14 @@ class Comment extends _BaseEntity.default {
150
112
  comment.commentThread = _CommentThread.default.createEmptyInstance();
151
113
  return comment;
152
114
  }
153
-
154
115
  editComment(text) {
155
116
  const comment = this.cloneForEdit();
156
117
  comment.text = text;
157
118
  return comment;
158
119
  }
159
-
160
120
  isEmpty() {
161
121
  return _lodash.default.isEmpty(this.text);
162
122
  }
163
-
164
123
  cloneForEdit() {
165
124
  const comment = new Comment();
166
125
  comment.uuid = this.uuid;
@@ -174,7 +133,6 @@ class Comment extends _BaseEntity.default {
174
133
  comment.voided = this.voided;
175
134
  return comment;
176
135
  }
177
-
178
136
  toJSON() {
179
137
  return {
180
138
  uuid: this.uuid,
@@ -187,9 +145,7 @@ class Comment extends _BaseEntity.default {
187
145
  voided: this.voided
188
146
  };
189
147
  }
190
-
191
148
  }
192
-
193
149
  _defineProperty(Comment, "schema", {
194
150
  name: _SchemaNames.default.Comment,
195
151
  primaryKey: "uuid",
@@ -214,6 +170,5 @@ _defineProperty(Comment, "schema", {
214
170
  }
215
171
  }, _AuditUtil.AuditFields)
216
172
  });
217
-
218
173
  var _default = Comment;
219
174
  exports.default = _default;
@@ -4,58 +4,44 @@ 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 _General = _interopRequireDefault(require("./utility/General"));
11
-
12
9
  var _lodash = _interopRequireDefault(require("lodash"));
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 CommentThread extends _BaseEntity.default {
19
15
  constructor(that = null) {
20
16
  super(that);
21
17
  }
22
-
23
18
  get status() {
24
19
  return this.that.status;
25
20
  }
26
-
27
21
  set status(x) {
28
22
  this.that.status = x;
29
23
  }
30
-
31
24
  get openDateTime() {
32
25
  return this.that.openDateTime;
33
26
  }
34
-
35
27
  set openDateTime(x) {
36
28
  this.that.openDateTime = x;
37
29
  }
38
-
39
30
  get resolvedDateTime() {
40
31
  return this.that.resolvedDateTime;
41
32
  }
42
-
43
33
  set resolvedDateTime(x) {
44
34
  this.that.resolvedDateTime = x;
45
35
  }
46
-
47
36
  get toResource() {
48
37
  const resource = _lodash.default.pick(this, ["uuid", "status", "voided"]);
49
-
50
38
  resource.openDateTime = _General.default.isoFormat(this.openDateTime);
51
39
  resource.resolvedDateTime = _General.default.isoFormat(this.resolvedDateTime);
52
40
  return resource;
53
41
  }
54
-
55
42
  static fromResource(resource) {
56
43
  return _General.default.assignFields(resource, new CommentThread(), ["uuid", "status", "voided"], ["openDateTime", "resolvedDateTime"]);
57
44
  }
58
-
59
45
  static createEmptyInstance(uuid) {
60
46
  const commentThread = new CommentThread();
61
47
  commentThread.uuid = uuid || _General.default.randomUUID();
@@ -63,7 +49,6 @@ class CommentThread extends _BaseEntity.default {
63
49
  commentThread.openDateTime = new Date();
64
50
  return commentThread;
65
51
  }
66
-
67
52
  cloneForEdit() {
68
53
  const commentThread = new CommentThread();
69
54
  commentThread.uuid = this.uuid;
@@ -73,27 +58,22 @@ class CommentThread extends _BaseEntity.default {
73
58
  commentThread.voided = this.voided;
74
59
  return commentThread;
75
60
  }
76
-
77
61
  markResolved() {
78
62
  const commentThread = this.cloneForEdit();
79
63
  commentThread.status = CommentThread.threadStatus.Resolved;
80
64
  commentThread.resolvedDateTime = new Date();
81
65
  return commentThread;
82
66
  }
83
-
84
67
  openThread() {
85
68
  const commentThread = this.cloneForEdit();
86
69
  commentThread.status = CommentThread.threadStatus.Open;
87
70
  commentThread.resolvedDateTime = null;
88
71
  return commentThread;
89
72
  }
90
-
91
73
  isResolved() {
92
74
  return this.status === CommentThread.threadStatus.Resolved;
93
75
  }
94
-
95
76
  }
96
-
97
77
  _defineProperty(CommentThread, "schema", {
98
78
  name: "CommentThread",
99
79
  primaryKey: "uuid",
@@ -111,11 +91,9 @@ _defineProperty(CommentThread, "schema", {
111
91
  }
112
92
  }
113
93
  });
114
-
115
94
  _defineProperty(CommentThread, "threadStatus", {
116
95
  Open: "Open",
117
96
  Resolved: "Resolved"
118
97
  });
119
-
120
98
  var _default = CommentThread;
121
99
  exports.default = _default;
@@ -4,67 +4,50 @@ 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
- 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 CompositeDuration {
15
11
  constructor(durations) {
16
12
  this.durations = durations;
17
13
  }
18
-
19
14
  changeValue(duration, value) {
20
15
  return new CompositeDuration(this.durations.map(d => d.durationUnit === duration.durationUnit ? d.changeValue(value) : d));
21
16
  }
22
-
23
17
  findByUnit(durationUnit) {
24
18
  return _lodash.default.find(this.durations, d => d.durationUnit === durationUnit);
25
19
  }
26
-
27
20
  changeValueByUnit(durationUnit, value) {
28
21
  return new CompositeDuration(this.durations.map(d => d.durationUnit === durationUnit ? d.changeValue(value) : d));
29
22
  }
30
-
31
23
  get isEmpty() {
32
24
  return this.durations.every(d => d.isEmpty);
33
25
  }
34
-
35
26
  toString(i18n) {
36
27
  return this.durations.map(d => d.toString(i18n)).join(" ");
37
28
  }
38
-
39
29
  cloneForEdit() {
40
30
  return new CompositeDuration(this.durations.map(d => d.cloneForEdit()));
41
31
  }
42
-
43
32
  getValue() {
44
33
  return this;
45
34
  }
46
-
47
35
  static fromOpts(durationOptions) {
48
36
  return new CompositeDuration(durationOptions.map(opt => new _Duration.default(null, opt)));
49
37
  }
50
-
51
38
  get toResource() {
52
39
  const isoCompositeDuration = this.durations.map(d => d.toISO).join("");
53
40
  const firstOccurrenceIndex = isoCompositeDuration.search("T") + 1;
54
41
  return "P" + isoCompositeDuration.substr(0, firstOccurrenceIndex) + isoCompositeDuration.slice(firstOccurrenceIndex).replace(/T/g, "");
55
42
  }
56
-
57
43
  static fromObs(obs) {
58
44
  if (typeof obs === "string") {
59
45
  return new CompositeDuration(_Duration.default.fromIsoObs(obs));
60
46
  } else if (_lodash.default.isNil(obs.durations)) {
61
47
  return new CompositeDuration(obs.map(_Duration.default.fromObs));
62
48
  }
63
-
64
49
  return new CompositeDuration(obs.durations.map(_Duration.default.fromObs));
65
50
  }
66
-
67
51
  }
68
-
69
52
  var _default = CompositeDuration;
70
53
  exports.default = _default;