openchs-models 1.33.36 → 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/CustomCardConfig.js +26 -1
- package/dist/Schema.js +11 -1
- package/package.json +1 -1
package/dist/CustomCardConfig.js
CHANGED
|
@@ -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
|
-
|
|
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/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:
|
|
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
|
}
|