openchs-models 1.32.39 → 1.32.40
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/dist/Concept.js +53 -2
- package/dist/Schema.js +7 -0
- package/dist/SyncTelemetry.js +1 -16
- package/package.json +1 -1
package/dist/Concept.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.MediaType = exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
9
|
|
|
@@ -84,6 +84,22 @@ class Concept extends _BaseEntity.default {
|
|
|
84
84
|
this.that.unit = x;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
get mediaUrl() {
|
|
88
|
+
return this.that.mediaUrl;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
set mediaUrl(x) {
|
|
92
|
+
this.that.mediaUrl = x;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get mediaType() {
|
|
96
|
+
return this.that.mediaType;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
set mediaType(x) {
|
|
100
|
+
this.that.mediaType = x;
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
get name() {
|
|
88
104
|
return this.that.name;
|
|
89
105
|
}
|
|
@@ -129,6 +145,8 @@ class Concept extends _BaseEntity.default {
|
|
|
129
145
|
concept.voided = conceptResource.voided || false; //This change should be independently deployable irrespective of server
|
|
130
146
|
|
|
131
147
|
concept.keyValues = _lodash.default.map(conceptResource.keyValues, _KeyValue.default.fromResource);
|
|
148
|
+
concept.mediaUrl = conceptResource.mediaUrl;
|
|
149
|
+
concept.mediaType = conceptResource.mediaType;
|
|
132
150
|
return concept;
|
|
133
151
|
}
|
|
134
152
|
|
|
@@ -333,6 +351,26 @@ class Concept extends _BaseEntity.default {
|
|
|
333
351
|
return keyValue === _KeyValue.default.ContactYesValue;
|
|
334
352
|
}
|
|
335
353
|
|
|
354
|
+
isMediaTypeImage() {
|
|
355
|
+
return this.mediaType === MediaType.Image;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
hasMediaType() {
|
|
359
|
+
return !_lodash.default.isNil(this.mediaType);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
hasMediaUrl() {
|
|
363
|
+
return !_lodash.default.isNil(this.mediaUrl) && this.mediaUrl !== '';
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
hasAnswersWithMedia() {
|
|
367
|
+
return _lodash.default.some(this.answers, answer => answer.concept.hasMediaUrl() || answer.concept.hasMediaType());
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
hasMedia() {
|
|
371
|
+
return this.hasMediaUrl() || this.hasMediaType() || this.hasAnswersWithMedia();
|
|
372
|
+
}
|
|
373
|
+
|
|
336
374
|
}
|
|
337
375
|
|
|
338
376
|
exports.default = Concept;
|
|
@@ -380,6 +418,14 @@ _defineProperty(Concept, "schema", {
|
|
|
380
418
|
voided: {
|
|
381
419
|
type: "bool",
|
|
382
420
|
default: false
|
|
421
|
+
},
|
|
422
|
+
mediaUrl: {
|
|
423
|
+
type: "string",
|
|
424
|
+
optional: true
|
|
425
|
+
},
|
|
426
|
+
mediaType: {
|
|
427
|
+
type: "string",
|
|
428
|
+
optional: true
|
|
383
429
|
}
|
|
384
430
|
}
|
|
385
431
|
});
|
|
@@ -428,4 +474,9 @@ _defineProperty(Concept, "dataType", {
|
|
|
428
474
|
|
|
429
475
|
});
|
|
430
476
|
|
|
431
|
-
_defineProperty(Concept, "merge", () => _BaseEntity.default.mergeOn("answers"));
|
|
477
|
+
_defineProperty(Concept, "merge", () => _BaseEntity.default.mergeOn("answers"));
|
|
478
|
+
|
|
479
|
+
const MediaType = {
|
|
480
|
+
Image: "Image"
|
|
481
|
+
};
|
|
482
|
+
exports.MediaType = MediaType;
|
package/dist/Schema.js
CHANGED
|
@@ -971,6 +971,13 @@ function createRealmConfig() {
|
|
|
971
971
|
program.showGrowthChart = _lodash.default.toLower(program.name) === "child";
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
|
+
|
|
975
|
+
if (oldDB.schemaVersion < 200) {
|
|
976
|
+
_lodash.default.forEach(newDB.objects("Concept"), concept => {
|
|
977
|
+
concept.mediaType = null;
|
|
978
|
+
concept.mediaUrl = null;
|
|
979
|
+
});
|
|
980
|
+
}
|
|
974
981
|
}
|
|
975
982
|
};
|
|
976
983
|
}
|
package/dist/SyncTelemetry.js
CHANGED
|
@@ -92,14 +92,6 @@ class SyncTelemetry extends _BaseEntity.default {
|
|
|
92
92
|
this.that.deviceInfo = x;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
get appInfo() {
|
|
96
|
-
return this.that.appInfo;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
set appInfo(x) {
|
|
100
|
-
this.that.appInfo = x;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
95
|
static fromResource() {
|
|
104
96
|
throw new Error("This should never be called because server always returns an empty array for this resource");
|
|
105
97
|
}
|
|
@@ -138,16 +130,11 @@ class SyncTelemetry extends _BaseEntity.default {
|
|
|
138
130
|
return this.deviceInfo === '' ? {} : JSON.parse(this.deviceInfo);
|
|
139
131
|
}
|
|
140
132
|
|
|
141
|
-
getAppInfo() {
|
|
142
|
-
return JSON.parse(this.appInfo);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
133
|
get toResource() {
|
|
146
134
|
const resource = _lodash.default.pick(this, ["uuid", "syncStatus", "syncStartTime", "syncEndTime", "appVersion", "androidVersion", "deviceName", "syncSource"]);
|
|
147
135
|
|
|
148
136
|
resource.entityStatus = this.getEntityStatus();
|
|
149
137
|
resource.deviceInfo = this.getDeviceInfo();
|
|
150
|
-
resource.appInfo = this.getAppInfo();
|
|
151
138
|
return resource;
|
|
152
139
|
}
|
|
153
140
|
|
|
@@ -163,7 +150,6 @@ class SyncTelemetry extends _BaseEntity.default {
|
|
|
163
150
|
syncTelemetry.androidVersion = this.androidVersion;
|
|
164
151
|
syncTelemetry.deviceName = this.deviceName;
|
|
165
152
|
syncTelemetry.deviceInfo = this.deviceInfo;
|
|
166
|
-
syncTelemetry.appInfo = this.appInfo;
|
|
167
153
|
syncTelemetry.syncSource = this.syncSource;
|
|
168
154
|
return syncTelemetry;
|
|
169
155
|
}
|
|
@@ -183,8 +169,7 @@ _defineProperty(SyncTelemetry, "schema", {
|
|
|
183
169
|
syncEndTime: "date?",
|
|
184
170
|
entityStatus: "string",
|
|
185
171
|
syncSource: 'string?',
|
|
186
|
-
deviceInfo: "string"
|
|
187
|
-
appInfo: "string"
|
|
172
|
+
deviceInfo: "string"
|
|
188
173
|
}
|
|
189
174
|
});
|
|
190
175
|
|