openchs-models 1.30.27 → 1.30.30
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.
- package/Makefile +3 -0
- package/dist/CustomDashboardCache.js +6 -4
- package/dist/EntityMetaData.js +15 -56
- package/dist/index.js +1 -7
- package/dist/utility/ParseUtil.js +27 -0
- package/package.json +1 -1
package/Makefile
CHANGED
|
@@ -15,6 +15,9 @@ release:
|
|
|
15
15
|
git pull --tags
|
|
16
16
|
git pull --rebase
|
|
17
17
|
@echo "Ensure version changes follow semantic versioning - https://classic.yarnpkg.com/en/docs/dependency-versions#toc-semantic-versioning"
|
|
18
|
+
@echo "\033[1mLatest openchs-models version across branches:"
|
|
19
|
+
npm view openchs-models version
|
|
20
|
+
@echo "\033[0m"
|
|
18
21
|
yarn version
|
|
19
22
|
@echo " Now please run \nmake publish"
|
|
20
23
|
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
9
|
|
|
10
|
+
var _ParseUtil = _interopRequireDefault(require("./utility/ParseUtil"));
|
|
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; }
|
|
@@ -105,21 +107,21 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
getSelectedValues() {
|
|
108
|
-
return this.selectedValuesJSON &&
|
|
110
|
+
return this.selectedValuesJSON && _ParseUtil.default.parse(this.selectedValuesJSON) || {};
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
getFilterErrors() {
|
|
112
|
-
return this.filterErrorsJSON &&
|
|
114
|
+
return this.filterErrorsJSON && _ParseUtil.default.parse(this.filterErrorsJSON) || {};
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
getRuleInput() {
|
|
116
|
-
return this.ruleInputJSON &&
|
|
118
|
+
return this.ruleInputJSON && _ParseUtil.default.parse(this.ruleInputJSON) || {
|
|
117
119
|
ruleInputArray: null
|
|
118
120
|
};
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
getTransformedFilters() {
|
|
122
|
-
return this.transformedFiltersJSON &&
|
|
124
|
+
return this.transformedFiltersJSON && _ParseUtil.default.parse(this.transformedFiltersJSON) || {
|
|
123
125
|
date: new Date(),
|
|
124
126
|
applied: false,
|
|
125
127
|
selectedLocations: [],
|
package/dist/EntityMetaData.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _Concept = _interopRequireDefault(require("./Concept"));
|
|
9
9
|
|
|
@@ -186,39 +186,8 @@ const refDataNameTranslated = (clazz, attrs = {}) => refData(clazz, _objectSprea
|
|
|
186
186
|
}));
|
|
187
187
|
|
|
188
188
|
const txData = (clazz, {
|
|
189
|
-
res,
|
|
190
|
-
resUrl,
|
|
191
|
-
parent,
|
|
192
|
-
apiVersion,
|
|
193
|
-
syncWeight,
|
|
194
|
-
privilegeParam,
|
|
195
|
-
privilegeEntity,
|
|
196
|
-
privilegeName,
|
|
197
|
-
queryParam,
|
|
198
|
-
hasMoreThanOneAssociation,
|
|
199
|
-
apiQueryParams
|
|
200
|
-
} = {}) => ({
|
|
201
|
-
schemaName: clazz.schema.name,
|
|
202
|
-
entityName: clazz.schema.name,
|
|
203
|
-
entityClass: clazz,
|
|
204
|
-
resourceName: res || _lodash.default.camelCase(clazz.schema.name),
|
|
205
|
-
resourceUrl: resUrl,
|
|
206
|
-
type: "tx",
|
|
207
|
-
nameTranslated: false,
|
|
208
|
-
parent: parent,
|
|
209
|
-
apiVersion,
|
|
210
|
-
syncWeight: syncWeight,
|
|
211
|
-
privilegeParam,
|
|
212
|
-
privilegeEntity,
|
|
213
|
-
privilegeName,
|
|
214
|
-
queryParam,
|
|
215
|
-
hasMoreThanOneAssociation: !!hasMoreThanOneAssociation,
|
|
216
|
-
apiQueryParams
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
const virtualTxData = (clazz, {
|
|
220
|
-
res,
|
|
221
189
|
entityName,
|
|
190
|
+
res,
|
|
222
191
|
resUrl,
|
|
223
192
|
parent,
|
|
224
193
|
apiVersion,
|
|
@@ -232,11 +201,11 @@ const virtualTxData = (clazz, {
|
|
|
232
201
|
apiQueryParamKey
|
|
233
202
|
} = {}) => ({
|
|
234
203
|
schemaName: clazz.schema.name,
|
|
235
|
-
entityName: entityName,
|
|
204
|
+
entityName: entityName || clazz.schema.name,
|
|
236
205
|
entityClass: clazz,
|
|
237
206
|
resourceName: res || _lodash.default.camelCase(clazz.schema.name),
|
|
238
207
|
resourceUrl: resUrl,
|
|
239
|
-
type: "
|
|
208
|
+
type: "tx",
|
|
240
209
|
nameTranslated: false,
|
|
241
210
|
parent: parent,
|
|
242
211
|
apiVersion,
|
|
@@ -490,12 +459,7 @@ const groupDashboard = refData(_GroupDashboard.default, {
|
|
|
490
459
|
res: "groupDashboard",
|
|
491
460
|
syncWeight: 0
|
|
492
461
|
});
|
|
493
|
-
const
|
|
494
|
-
res: "entityApprovalStatus",
|
|
495
|
-
entityName: "EntityApprovalStatus"
|
|
496
|
-
});
|
|
497
|
-
exports.EntityApprovalStatusMetaData = EntityApprovalStatusMetaData;
|
|
498
|
-
const subjectEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
462
|
+
const subjectEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
499
463
|
res: "entityApprovalStatus",
|
|
500
464
|
resUrl: "entityApprovalStatus",
|
|
501
465
|
entityName: 'SubjectEntityApprovalStatus',
|
|
@@ -509,7 +473,7 @@ const subjectEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default,
|
|
|
509
473
|
parent: individual,
|
|
510
474
|
syncWeight: 2
|
|
511
475
|
});
|
|
512
|
-
const encounterEntityApprovalStatus =
|
|
476
|
+
const encounterEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
513
477
|
res: "entityApprovalStatus",
|
|
514
478
|
resUrl: "entityApprovalStatus",
|
|
515
479
|
entityName: 'EncounterEntityApprovalStatus',
|
|
@@ -523,7 +487,7 @@ const encounterEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.defaul
|
|
|
523
487
|
parent: encounter,
|
|
524
488
|
syncWeight: 2
|
|
525
489
|
});
|
|
526
|
-
const programEncounterEntityApprovalStatus =
|
|
490
|
+
const programEncounterEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
527
491
|
res: "entityApprovalStatus",
|
|
528
492
|
resUrl: "entityApprovalStatus",
|
|
529
493
|
entityName: 'ProgramEncounterEntityApprovalStatus',
|
|
@@ -537,7 +501,7 @@ const programEncounterEntityApprovalStatus = virtualTxData(_EntityApprovalStatus
|
|
|
537
501
|
parent: programEncounter,
|
|
538
502
|
syncWeight: 2
|
|
539
503
|
});
|
|
540
|
-
const programEnrolmentEntityApprovalStatus =
|
|
504
|
+
const programEnrolmentEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
541
505
|
res: "entityApprovalStatus",
|
|
542
506
|
resUrl: "entityApprovalStatus",
|
|
543
507
|
entityName: 'ProgramEnrolmentEntityApprovalStatus',
|
|
@@ -551,7 +515,7 @@ const programEnrolmentEntityApprovalStatus = virtualTxData(_EntityApprovalStatus
|
|
|
551
515
|
parent: programEnrolment,
|
|
552
516
|
syncWeight: 2
|
|
553
517
|
});
|
|
554
|
-
const checklistItemEntityApprovalStatus =
|
|
518
|
+
const checklistItemEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
555
519
|
res: "entityApprovalStatus",
|
|
556
520
|
resUrl: "entityApprovalStatus",
|
|
557
521
|
entityName: 'ChecklistItemEntityApprovalStatus',
|
|
@@ -565,6 +529,10 @@ const checklistItemEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.de
|
|
|
565
529
|
parent: checklistItem,
|
|
566
530
|
syncWeight: 2
|
|
567
531
|
});
|
|
532
|
+
const entityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
533
|
+
res: 'entityApprovalStatus',
|
|
534
|
+
syncWeight: 1
|
|
535
|
+
});
|
|
568
536
|
const news = txData(_News.default, {
|
|
569
537
|
syncWeight: 0
|
|
570
538
|
});
|
|
@@ -645,7 +613,7 @@ class EntityMetaData {
|
|
|
645
613
|
|
|
646
614
|
//order is important. last entity in each (tx and ref) with be executed first. parent should be synced before the child.
|
|
647
615
|
static model() {
|
|
648
|
-
return [groupDashboard, approvalStatus, dashboardSectionCardMapping, dashboardSection, dashboardFilter, dashboard, reportCard, standardReportCardType, menuItem, locationHierarchy, video, checklistItemDetail, checklistDetail, rule, ruleDependency, individualRelationshipType, individualRelationGenderMapping, individualRelation, programConfig, formMapping, formElement, formElementGroup, form, documentationItem, documentation, identifierSource, organisationConfig, platformTranslation, translation, locationMapping, addressLevel, taskStatus, taskType, encounterType, program, programOutcome, gender, groupRole, subjectType, conceptAnswer, concept, myGroups, groupPrivileges, groups, privilege, resetSync, subjectMigration, userSubjectAssignment, task, taskUnAssigment, subjectProgramEligibility, news, videoTelemetric, groupSubject, comment, commentThread, subjectEntityApprovalStatus, encounterEntityApprovalStatus, programEncounterEntityApprovalStatus, programEnrolmentEntityApprovalStatus, checklistItemEntityApprovalStatus, individualRelationship, checklistItem, checklist, encounter, identifierAssignment, programEncounter, programEnrolment, individual, extension, userInfo, syncTelemetry, ruleFailureTelemetry];
|
|
616
|
+
return [groupDashboard, approvalStatus, dashboardSectionCardMapping, dashboardSection, dashboardFilter, dashboard, reportCard, standardReportCardType, menuItem, locationHierarchy, video, checklistItemDetail, checklistDetail, rule, ruleDependency, individualRelationshipType, individualRelationGenderMapping, individualRelation, programConfig, formMapping, formElement, formElementGroup, form, documentationItem, documentation, identifierSource, organisationConfig, platformTranslation, translation, locationMapping, addressLevel, taskStatus, taskType, encounterType, program, programOutcome, gender, groupRole, subjectType, conceptAnswer, concept, myGroups, groupPrivileges, groups, privilege, resetSync, subjectMigration, userSubjectAssignment, task, taskUnAssigment, subjectProgramEligibility, news, videoTelemetric, groupSubject, comment, commentThread, entityApprovalStatus, subjectEntityApprovalStatus, encounterEntityApprovalStatus, programEncounterEntityApprovalStatus, programEnrolmentEntityApprovalStatus, checklistItemEntityApprovalStatus, individualRelationship, checklistItem, checklist, encounter, identifierAssignment, programEncounter, programEnrolment, individual, extension, userInfo, syncTelemetry, ruleFailureTelemetry];
|
|
649
617
|
}
|
|
650
618
|
|
|
651
619
|
static entitiesLoadedFromServer() {
|
|
@@ -653,16 +621,7 @@ class EntityMetaData {
|
|
|
653
621
|
}
|
|
654
622
|
|
|
655
623
|
static findByName(entityName) {
|
|
656
|
-
return
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
static findByNameIn(entityName, modelCollection) {
|
|
660
|
-
return _lodash.default.find(modelCollection, //TODO check if this works
|
|
661
|
-
entityMetadata => entityMetadata.entityName === entityName);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
static allModels() {
|
|
665
|
-
return _lodash.default.concat(EntityApprovalStatusMetaData, EntityMetaData.model());
|
|
624
|
+
return _lodash.default.find(EntityMetaData.model(), entityMetadata => entityMetadata.entityName === entityName);
|
|
666
625
|
}
|
|
667
626
|
|
|
668
627
|
}
|
package/dist/index.js
CHANGED
|
@@ -105,12 +105,6 @@ Object.defineProperty(exports, "EntityMetaData", {
|
|
|
105
105
|
return _EntityMetaData.default;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(exports, "EntityApprovalStatusMetaData", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return _EntityMetaData.EntityApprovalStatusMetaData;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
108
|
Object.defineProperty(exports, "EntityQueue", {
|
|
115
109
|
enumerable: true,
|
|
116
110
|
get: function () {
|
|
@@ -840,7 +834,7 @@ var _Encounter = _interopRequireDefault(require("./Encounter"));
|
|
|
840
834
|
|
|
841
835
|
var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
842
836
|
|
|
843
|
-
var _EntityMetaData =
|
|
837
|
+
var _EntityMetaData = _interopRequireDefault(require("./EntityMetaData"));
|
|
844
838
|
|
|
845
839
|
var _EntityQueue = _interopRequireDefault(require("./EntityQueue"));
|
|
846
840
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
class ParseUtil {
|
|
9
|
+
static parse(jsonValue) {
|
|
10
|
+
const iso8061 = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
|
|
11
|
+
return JSON.parse(jsonValue, function (key, value) {
|
|
12
|
+
if (typeof value != 'string') {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (iso8061 && value.match(iso8061)) {
|
|
17
|
+
return new Date(value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return value;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var _default = ParseUtil;
|
|
27
|
+
exports.default = _default;
|