openchs-models 1.33.2 → 1.33.5
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/.circleci/config.yml +15 -5
- package/.commit-message.txt +21 -0
- package/.nvmrc +1 -1
- package/Makefile +32 -10
- package/REALM_V12_NOTES.md +46 -0
- package/dist/AbstractEncounter.js +4 -105
- package/dist/AddressLevel.js +5 -62
- package/dist/ApprovalStatus.js +4 -17
- package/dist/BaseEntity.js +5 -42
- package/dist/BeneficiaryModePin.js +4 -13
- package/dist/Checklist.js +6 -52
- package/dist/ChecklistDetail.js +4 -22
- package/dist/ChecklistItem.js +16 -96
- package/dist/ChecklistItemDetail.js +4 -43
- package/dist/ChecklistItemStatus.js +4 -33
- package/dist/Comment.js +6 -51
- package/dist/CommentThread.js +4 -26
- package/dist/CompositeDuration.js +1 -18
- package/dist/Concept.js +5 -107
- package/dist/ConceptAnswer.js +4 -21
- package/dist/CustomDashboardCache.js +4 -38
- package/dist/CustomFilter.js +5 -15
- package/dist/Dashboard.js +4 -23
- package/dist/DashboardCache.js +4 -23
- package/dist/DashboardSection.js +4 -24
- package/dist/DashboardSectionCardMapping.js +4 -21
- package/dist/Displayable.js +3 -11
- package/dist/Documentation.js +4 -21
- package/dist/DocumentationItem.js +4 -20
- package/dist/Duration.js +4 -39
- package/dist/Encounter.js +6 -41
- package/dist/EncounterType.js +4 -26
- package/dist/EntityApprovalStatus.js +6 -56
- package/dist/EntityMetaData.js +7 -105
- package/dist/EntityQueue.js +4 -15
- package/dist/EntityRule.js +1 -29
- package/dist/EntitySyncStatus.js +4 -19
- package/dist/Extension.js +4 -18
- package/dist/Family.js +4 -56
- package/dist/FileFormat.js +0 -7
- package/dist/Gender.js +4 -17
- package/dist/GroupDashboard.js +4 -23
- package/dist/GroupPrivileges.js +4 -28
- package/dist/GroupRole.js +4 -34
- package/dist/GroupSubject.js +6 -59
- package/dist/Groups.js +4 -14
- package/dist/Identifier.js +4 -20
- package/dist/IdentifierAssignment.js +6 -45
- package/dist/IdentifierSource.js +4 -15
- package/dist/Individual.js +17 -265
- package/dist/LocaleMapping.js +4 -13
- package/dist/LocationHierarchy.js +4 -25
- package/dist/Media.js +35 -35
- package/dist/MediaQueue.js +4 -26
- package/dist/MigrationsHelper.js +15 -22
- package/dist/MyGroups.js +4 -14
- package/dist/News.js +4 -31
- package/dist/Observation.js +4 -54
- package/dist/ObservationsHolder.js +104 -216
- package/dist/OrganisationConfig.js +4 -19
- package/dist/PersistedObject.js +1 -19
- package/dist/PhoneNumber.js +0 -11
- package/dist/PlatformTranslation.js +4 -17
- package/dist/Privilege.js +5 -22
- package/dist/Program.js +4 -39
- package/dist/ProgramEncounter.js +6 -48
- package/dist/ProgramEnrolment.js +8 -162
- package/dist/ReferenceEntity.js +1 -10
- package/dist/ReportCard.js +5 -60
- package/dist/ResetSync.js +4 -17
- package/dist/Rule.js +4 -28
- package/dist/RuleDependency.js +4 -17
- package/dist/RuleFailureTelemetry.js +4 -36
- package/dist/Schema.js +16 -268
- package/dist/SchemaNames.js +3 -46
- package/dist/Settings.js +4 -53
- package/dist/StandardReportCardType.js +4 -39
- package/dist/SubjectMigration.js +6 -45
- package/dist/SubjectType.js +6 -72
- package/dist/SyncTelemetry.js +4 -40
- package/dist/Translation.js +4 -17
- package/dist/UserInfo.js +4 -33
- package/dist/application/DashboardCacheFilter.js +4 -24
- package/dist/application/Filter.js +3 -16
- package/dist/application/Form.js +6 -93
- package/dist/application/FormElement.js +5 -100
- package/dist/application/FormElementGroup.js +4 -75
- package/dist/application/FormElementStatus.js +1 -11
- package/dist/application/FormMapping.js +6 -44
- package/dist/application/Format.js +4 -20
- package/dist/application/KeyValue.js +4 -19
- package/dist/application/MenuItem.js +4 -35
- package/dist/application/MultiSelectFilter.js +1 -11
- package/dist/application/NullProgramEnrolment.js +0 -8
- package/dist/application/SingleSelectFilter.js +1 -12
- package/dist/application/StaticFormElementGroup.js +0 -11
- package/dist/application/StringKeyNumericValue.js +4 -17
- package/dist/application/ValidationResult.js +6 -20
- package/dist/application/ValidationResults.js +1 -14
- package/dist/application/WorkItem.js +4 -20
- package/dist/application/WorkList.js +1 -24
- package/dist/application/WorkLists.js +1 -13
- package/dist/assignment/UserSubjectAssignment.js +6 -26
- package/dist/draft/DraftEncounter.js +4 -40
- package/dist/draft/DraftSubject.js +4 -46
- package/dist/error/IgnorableSyncError.js +1 -6
- package/dist/error/SyncError.js +1 -6
- package/dist/framework/ArrayHelper.js +3 -11
- package/dist/framework/DefinedObjectSchema.js +4 -12
- package/dist/framework/RealmCollectionHelper.js +1 -9
- package/dist/framework/RealmEmbeddedObjectHandler.js +126 -0
- package/dist/framework/RealmListProxy.js +1 -10
- package/dist/framework/RealmObjectSchema.js +1 -11
- package/dist/framework/RealmProxy.js +15 -39
- package/dist/framework/RealmResultsProxy.js +3 -37
- package/dist/framework/RealmResultsProxyHandler.js +2 -5
- package/dist/geo/Point.js +4 -17
- package/dist/index.js +9 -137
- package/dist/location/Locations.js +1 -6
- package/dist/observation/MultipleCodedValues.js +1 -21
- package/dist/observation/PrimitiveValue.js +1 -17
- package/dist/observation/QuestionGroup.js +1 -36
- package/dist/observation/RepeatableQuestionGroup.js +4 -27
- package/dist/observation/SingleCodedValue.js +1 -15
- package/dist/program/SubjectProgramEligibility.js +6 -56
- package/dist/relationship/IndividualRelation.js +6 -18
- package/dist/relationship/IndividualRelationGenderMapping.js +4 -22
- package/dist/relationship/IndividualRelationship.js +6 -51
- package/dist/relationship/IndividualRelationshipType.js +4 -24
- package/dist/relationship/IndividualRelative.js +4 -31
- package/dist/reports/DashboardFilter.js +4 -20
- package/dist/reports/DashboardFilterConfig.js +5 -85
- package/dist/reports/NestedReportCardResult.js +5 -35
- package/dist/reports/Range.js +4 -13
- package/dist/reports/ReportCardResult.js +5 -24
- package/dist/service/MetaDataService.js +1 -30
- package/dist/task/Task.js +6 -62
- package/dist/task/TaskStatus.js +4 -21
- package/dist/task/TaskType.js +4 -23
- package/dist/task/TaskUnAssignment.js +6 -30
- package/dist/utility/AgeUtil.js +1 -15
- package/dist/utility/ArrayUtil.js +1 -6
- package/dist/utility/AuditUtil.js +1 -8
- package/dist/utility/DateTimeUtil.js +1 -8
- package/dist/utility/General.js +4 -71
- package/dist/utility/JsonStringify.js +15 -28
- package/dist/utility/MergeUtil.js +1 -10
- package/dist/utility/ResourceUtil.js +1 -7
- package/dist/videos/Video.js +4 -23
- package/dist/videos/VideoTelemetric.js +6 -37
- package/package.json +6 -3
- package/scripts/validateSchemas.js +40 -0
- package/tsconfig.json +1 -1
- package/yarn.lock +0 -6744
|
@@ -4,68 +4,50 @@ 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 _moment = _interopRequireDefault(require("moment"));
|
|
13
|
-
|
|
14
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
|
-
|
|
16
11
|
var _Video = _interopRequireDefault(require("./Video"));
|
|
17
|
-
|
|
18
12
|
var _SchemaNames = _interopRequireDefault(require("../SchemaNames"));
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
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); }
|
|
24
17
|
class VideoTelemetric extends _BaseEntity.default {
|
|
25
18
|
constructor(that = null) {
|
|
26
19
|
super(that);
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
get video() {
|
|
30
22
|
return this.toEntity("video", _Video.default);
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
set video(x) {
|
|
34
25
|
this.that.video = this.fromObject(x);
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
get playerOpenTime() {
|
|
38
28
|
return this.that.playerOpenTime;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
set playerOpenTime(x) {
|
|
42
31
|
this.that.playerOpenTime = x;
|
|
43
32
|
}
|
|
44
|
-
|
|
45
33
|
get playerCloseTime() {
|
|
46
34
|
return this.that.playerCloseTime;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
set playerCloseTime(x) {
|
|
50
37
|
this.that.playerCloseTime = x;
|
|
51
38
|
}
|
|
52
|
-
|
|
53
39
|
get videoStartTime() {
|
|
54
40
|
return this.that.videoStartTime;
|
|
55
41
|
}
|
|
56
|
-
|
|
57
42
|
set videoStartTime(x) {
|
|
58
43
|
this.that.videoStartTime = x;
|
|
59
44
|
}
|
|
60
|
-
|
|
61
45
|
get videoEndTime() {
|
|
62
46
|
return this.that.videoEndTime;
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
set videoEndTime(x) {
|
|
66
49
|
this.that.videoEndTime = x;
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
static create(obj = {}) {
|
|
70
52
|
const {
|
|
71
53
|
uuid = _General.default.randomUUID()
|
|
@@ -74,51 +56,40 @@ class VideoTelemetric extends _BaseEntity.default {
|
|
|
74
56
|
uuid
|
|
75
57
|
});
|
|
76
58
|
}
|
|
77
|
-
|
|
78
59
|
static fromResource() {
|
|
79
60
|
_General.default.logWarn("This should never be called. The server should always return empty array.\n" + "So, no need to create realm entities.");
|
|
80
|
-
|
|
81
61
|
return VideoTelemetric.create({});
|
|
82
62
|
}
|
|
83
|
-
|
|
84
63
|
cloneForReference() {
|
|
85
64
|
return VideoTelemetric.create(_lodash.default.assignIn({}, this));
|
|
86
65
|
}
|
|
87
|
-
|
|
88
66
|
setPlayerOpenTime() {
|
|
89
67
|
this.playerOpenTime = (0, _moment.default)().toDate();
|
|
90
68
|
}
|
|
91
|
-
|
|
92
69
|
setPlayerCloseTime() {
|
|
93
70
|
this.playerCloseTime = (0, _moment.default)().toDate();
|
|
94
71
|
}
|
|
95
|
-
|
|
96
72
|
setOnceVideoStartTime(videoTime) {
|
|
97
73
|
if (_lodash.default.isNil(this.videoStartTime)) {
|
|
98
74
|
this.videoStartTime = this._roundToNearestPoint5(videoTime);
|
|
99
75
|
}
|
|
100
76
|
}
|
|
101
|
-
|
|
102
77
|
setVideoEndTime(videoTime) {
|
|
103
78
|
this.videoEndTime = this._roundToNearestPoint5(videoTime);
|
|
104
79
|
}
|
|
105
|
-
|
|
106
80
|
get toResource() {
|
|
107
81
|
const resource = _lodash.default.pick(this, ["uuid", "videoStartTime", "videoEndTime"]);
|
|
108
|
-
|
|
109
82
|
resource.playerOpenTime = _General.default.isoFormat(this.playerOpenTime);
|
|
110
83
|
resource.playerCloseTime = _General.default.isoFormat(this.playerCloseTime);
|
|
111
84
|
resource.videoUUID = this.video.uuid;
|
|
112
85
|
return resource;
|
|
113
|
-
}
|
|
114
|
-
|
|
86
|
+
}
|
|
115
87
|
|
|
88
|
+
//valid outputs 0,0.5,1,1.5,2,2.5,3,3.5...
|
|
116
89
|
_roundToNearestPoint5(n) {
|
|
117
90
|
return Math.round(n * 2) / 2;
|
|
118
91
|
}
|
|
119
|
-
|
|
120
92
|
}
|
|
121
|
-
|
|
122
93
|
_defineProperty(VideoTelemetric, "schema", {
|
|
123
94
|
name: _SchemaNames.default.VideoTelemetric,
|
|
124
95
|
primaryKey: "uuid",
|
|
@@ -133,9 +104,7 @@ _defineProperty(VideoTelemetric, "schema", {
|
|
|
133
104
|
videoStartTime: "double",
|
|
134
105
|
//in seconds
|
|
135
106
|
videoEndTime: "double" //in seconds
|
|
136
|
-
|
|
137
107
|
}
|
|
138
108
|
});
|
|
139
|
-
|
|
140
109
|
var _default = VideoTelemetric;
|
|
141
110
|
exports.default = _default;
|
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.33.
|
|
4
|
+
"version": "1.33.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"test-ci": "jest --verbose --forceExit --maxWorkers=2 --ci",
|
|
14
|
+
"test:realm-v12": "jest test/framework/RealmV12CompatibilityTest.js",
|
|
14
15
|
"build": "babel src --out-dir dist --extensions '.js','.ts' && tsc",
|
|
15
16
|
"coverage": "istanbul cover --report lcov _mocha --require $(find ./src/test -name '*Test.js')",
|
|
16
17
|
"doc": "yarn doc:html && open docs/index.html",
|
|
17
18
|
"doc:html": "typedoc",
|
|
18
19
|
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d docs",
|
|
19
|
-
"prettier-all": "prettier --write \"src/**/*.ts\" \"src/**/*.js\""
|
|
20
|
+
"prettier-all": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
21
|
+
"validate:schemas": "node scripts/validateSchemas.js"
|
|
20
22
|
},
|
|
21
23
|
"jest": {
|
|
22
24
|
"testMatch": [
|
|
@@ -54,8 +56,9 @@
|
|
|
54
56
|
"moment": "^2.22.2",
|
|
55
57
|
"nyc": "^14.1.1",
|
|
56
58
|
"prettier": "2.0.5",
|
|
59
|
+
"realm": "^12.14.2",
|
|
57
60
|
"typedoc": "^0.17.4",
|
|
58
|
-
"typescript": "^
|
|
61
|
+
"typescript": "^5.0.4",
|
|
59
62
|
"uglifyjs-webpack-plugin": "^2.1.3",
|
|
60
63
|
"webpack": "^4.12.2",
|
|
61
64
|
"webpack-cli": "^3.0.8",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Realm Schema Validator - Validates schema compatibility
|
|
4
|
+
* Critical for Realm v12+: All list properties must have explicit objectType
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const EntityMappingConfig = require('../dist/Schema').default;
|
|
8
|
+
|
|
9
|
+
function validateSchemas() {
|
|
10
|
+
const config = EntityMappingConfig.getInstance().getRealmConfig();
|
|
11
|
+
const issues = [];
|
|
12
|
+
|
|
13
|
+
config.schema.forEach(schema => {
|
|
14
|
+
Object.entries(schema.properties).forEach(([propName, propDef]) => {
|
|
15
|
+
// Critical: Realm v12 requires explicit objectType for list properties
|
|
16
|
+
if (propDef.type === 'list' && !propDef.objectType) {
|
|
17
|
+
issues.push(`${schema.name}.${propName}: Missing objectType`);
|
|
18
|
+
}
|
|
19
|
+
// Critical: No implicit "[]" shorthand allowed in v12
|
|
20
|
+
if (propDef === '[]') {
|
|
21
|
+
issues.push(`${schema.name}.${propName}: Use "mixed[]" instead of "[]"`);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (issues.length > 0) {
|
|
27
|
+
console.error('\n❌ Schema validation failed:\n');
|
|
28
|
+
issues.forEach(issue => console.error(` ${issue}`));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(`✓ All ${config.schema.length} schemas valid (v${config.schemaVersion})`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
validateSchemas();
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Validation failed:', error.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|