openchs-models 1.33.37 → 1.33.38

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 CHANGED
@@ -231,10 +231,10 @@ class Concept extends _BaseEntity.default {
231
231
  return this.isType(Concept.dataType.Encounter);
232
232
  }
233
233
  isMediaConcept() {
234
- return _lodash.default.includes(Concept.dataType.Media, this.datatype);
234
+ return _lodash.default.includes([Concept.dataType.Image, Concept.dataType.ImageV2, Concept.dataType.Video, Concept.dataType.File], this.datatype);
235
235
  }
236
236
  isMediaSelectConcept() {
237
- return _lodash.default.includes(Concept.dataType.Media, this.datatype);
237
+ return _lodash.default.includes([Concept.dataType.Image, Concept.dataType.ImageV2, Concept.dataType.Video, Concept.dataType.File], this.datatype);
238
238
  }
239
239
  isSelectConcept() {
240
240
  return this.isCodedConcept() || this.isSubjectConcept() || this.isEncounterConcept() || this.isMediaSelectConcept();
@@ -32,8 +32,29 @@ class CustomCardConfig extends _BaseEntity.default {
32
32
  set dataRule(x) {
33
33
  this.that.dataRule = x;
34
34
  }
35
+ get translations() {
36
+ return this.that.translations;
37
+ }
38
+ set translations(x) {
39
+ this.that.translations = x;
40
+ }
41
+ getTranslations() {
42
+ if (!this.translations) {
43
+ return {};
44
+ }
45
+ try {
46
+ const parsed = JSON.parse(this.translations);
47
+ return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
48
+ } catch (e) {
49
+ return {};
50
+ }
51
+ }
35
52
  static fromResource(resource) {
36
- return _General.default.assignFields(resource, new CustomCardConfig(), ["uuid", "name", "htmlFileS3Key", "dataRule", "voided"]);
53
+ const config = _General.default.assignFields(resource, new CustomCardConfig(), ["uuid", "name", "htmlFileS3Key", "dataRule", "voided"]);
54
+ if (resource && "translations" in resource) {
55
+ config.translations = resource.translations && typeof resource.translations === 'object' ? JSON.stringify(resource.translations) : null;
56
+ }
57
+ return config;
37
58
  }
38
59
  }
39
60
  _defineProperty(CustomCardConfig, "schema", {
@@ -47,6 +68,10 @@ _defineProperty(CustomCardConfig, "schema", {
47
68
  type: "string",
48
69
  optional: true
49
70
  },
71
+ translations: {
72
+ type: "string",
73
+ optional: true
74
+ },
50
75
  voided: {
51
76
  type: "bool",
52
77
  default: false
package/dist/Privilege.js CHANGED
@@ -77,10 +77,7 @@ _defineProperty(Privilege, "privilegeName", {
77
77
  approveEnrolment: "Approve Enrolment",
78
78
  approveEncounter: "Approve Encounter",
79
79
  approveChecklistItem: "Approve ChecklistItem",
80
- viewEditEntitiesOnDataEntryApp: 'View Or Edit Entities On DataEntry App',
81
- shareSubject: "Share subject",
82
- shareEnrolment: "Share enrolment",
83
- shareEncounter: "Share encounter"
80
+ viewEditEntitiesOnDataEntryApp: 'View Or Edit Entities On DataEntry App'
84
81
  });
85
82
  _defineProperty(Privilege, "PrivilegeType", {
86
83
  AddMember: "AddMember",
@@ -142,10 +139,7 @@ _defineProperty(Privilege, "PrivilegeType", {
142
139
  DownloadBundle: "DownloadBundle",
143
140
  EditTaskType: "EditTaskType",
144
141
  ViewEditEntitiesOnDataEntryApp: "ViewEditEntitiesOnDataEntryApp",
145
- DeleteOrganisationConfiguration: "DeleteOrganisationConfiguration",
146
- ShareSubject: "ShareSubject",
147
- ShareEnrolment: "ShareEnrolment",
148
- ShareEncounter: "ShareEncounter"
142
+ DeleteOrganisationConfiguration: "DeleteOrganisationConfiguration"
149
143
  });
150
144
  _defineProperty(Privilege, "privilegeEntityType", {
151
145
  subject: "Subject",
package/dist/Schema.js CHANGED
@@ -181,7 +181,7 @@ function createRealmConfig() {
181
181
  return doCompact;
182
182
  },
183
183
  //order is important, should be arranged according to the dependency
184
- schemaVersion: 209,
184
+ schemaVersion: 210,
185
185
  onMigration: function (oldDB, newDB) {
186
186
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
187
187
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -802,6 +802,16 @@ function createRealmConfig() {
802
802
  }
803
803
  });
804
804
  }
805
+ if (oldDB.schemaVersion < 210) {
806
+ _lodash.default.forEach(newDB.objects(_EntitySyncStatus.default.schema.name), ess => {
807
+ if (ess.entityName === 'CustomCardConfig') {
808
+ ess.loadedSince = _EntitySyncStatus.default.REALLY_OLD_DATE;
809
+ }
810
+ });
811
+ _lodash.default.forEach(newDB.objects("CustomCardConfig"), config => {
812
+ config.translations = null;
813
+ });
814
+ }
805
815
  }
806
816
  };
807
817
  }
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.37",
4
+ "version": "1.33.38",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",