openchs-models 1.33.70 → 1.33.71

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.
@@ -42,6 +42,12 @@ class AttendanceRecord extends _BaseEntity.default {
42
42
  set reasonConceptUUIDs(x) {
43
43
  this.that.reasonConceptUUIDs = x || [];
44
44
  }
45
+ get otherReasonText() {
46
+ return this.that.otherReasonText;
47
+ }
48
+ set otherReasonText(x) {
49
+ this.that.otherReasonText = x || null;
50
+ }
45
51
  get followUpEncounterUUID() {
46
52
  return this.that.followUpEncounterUUID;
47
53
  }
@@ -91,6 +97,7 @@ class AttendanceRecord extends _BaseEntity.default {
91
97
  record.subjectUUID = resource.subjectUUID;
92
98
  record.status = resource.status;
93
99
  record.reasonConceptUUIDs = Array.isArray(resource.reasonConceptUUIDs) ? resource.reasonConceptUUIDs : resource.reasonConceptUUID ? [resource.reasonConceptUUID] : [];
100
+ record.otherReasonText = resource.otherReasonText || null;
94
101
  record.followUpEncounterUUID = resource.followUpEncounterUUID || null;
95
102
  record.needsFollowUp = !!resource.needsFollowUp;
96
103
  record.voided = !!resource.voided;
@@ -100,6 +107,7 @@ class AttendanceRecord extends _BaseEntity.default {
100
107
  get toResource() {
101
108
  const resource = _lodash.default.pick(this, ["uuid", "sessionUUID", "subjectUUID", "status", "voided"]);
102
109
  resource.reasonConceptUUIDs = this.reasonConceptUUIDs || [];
110
+ resource.otherReasonText = this.otherReasonText || null;
103
111
  resource.followUpEncounterUUID = this.followUpEncounterUUID || null;
104
112
  resource.needsFollowUp = !!this.needsFollowUp;
105
113
  return resource;
@@ -117,6 +125,10 @@ _defineProperty(AttendanceRecord, "schema", {
117
125
  type: "list",
118
126
  objectType: "string"
119
127
  },
128
+ otherReasonText: {
129
+ type: "string",
130
+ optional: true
131
+ },
120
132
  followUpEncounterUUID: {
121
133
  type: "string",
122
134
  optional: true
@@ -11,21 +11,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
11
11
  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; }
12
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
13
13
  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); }
14
- /**
15
- * Client mirror of the server's downloadable-content reference data
16
- * (avniproject/avni-server#1019, avniproject/avni-models#67).
17
- *
18
- * Generic admin-configured metadata that declares a downloadable blob (e.g. an edge model).
19
- * Synced to every device as reference/metadata data. The bytes referenced by {@code contentKey}
20
- * are fetched during sync by the content-download capability (avniproject/avni-client#1948).
21
- *
22
- * The AES key for an encrypted blob is NEVER a field here - it lives in a server-only key
23
- * store served via a device key-delivery endpoint (avniproject/avni-server#1020).
24
- *
25
- * {@code payload} is category-specific non-secret metadata (for the edge model:
26
- * engine / inputShape / labelMap). Stored as a JSON string on Realm (mirrors how
27
- * {@link CustomCardConfig} stores its {@code translations} JSON object).
28
- */
29
14
  class DownloadableContent extends _BaseEntity.default {
30
15
  constructor(that = null) {
31
16
  super(that);
@@ -72,12 +57,6 @@ class DownloadableContent extends _BaseEntity.default {
72
57
  set voided(x) {
73
58
  this.that.voided = x;
74
59
  }
75
-
76
- /**
77
- * Parsed {@code payload} JSON as an object (empty object when absent/invalid).
78
- * Consumers (the edge-model consumer, avniproject/avni-client#1949) read engine /
79
- * inputShape / labelMap from here.
80
- */
81
60
  getPayload() {
82
61
  if (!this.payload) {
83
62
  return {};
@@ -91,13 +70,9 @@ class DownloadableContent extends _BaseEntity.default {
91
70
  }
92
71
  static fromResource(resource) {
93
72
  const content = _General.default.assignFields(resource, new DownloadableContent(), ["uuid", "name", "category", "contentKey", "sha256", "voided"]);
94
- // needsKey is a non-optional Realm bool. The server may omit/null it; a direct field
95
- // copy would write `undefined`, which throws on the Realm write and aborts the entire
96
- // reference-data sync. Coerce explicitly so absent/null -> false, never undefined.
73
+ // Coerce: needsKey is a non-optional Realm bool, so an undefined write would abort the sync.
97
74
  content.needsKey = resource && resource.needsKey === true;
98
- // payload is category-specific metadata. The server normally sends it as a JSON object
99
- // (JsonObject -> Map), but may serialize it as an already-JSON string. Handle both so
100
- // metadata is never silently dropped: object -> stringify; non-empty string -> store as-is.
75
+ // Server sends payload as a JSON object, but tolerate an already-stringified payload too.
101
76
  if (resource && resource.payload && typeof resource.payload === 'object') {
102
77
  content.payload = JSON.stringify(resource.payload);
103
78
  } else if (resource && typeof resource.payload === 'string' && resource.payload.length > 0) {
@@ -351,8 +351,6 @@ const extension = refData(_Extension.default, {
351
351
  syncWeight: 0,
352
352
  filter: ''
353
353
  });
354
- // Mirrors the server endpoint /v2/downloadableContent/search/lastModified
355
- // (avniproject/avni-server#1019). Reference/metadata data synced to every device.
356
354
  const downloadableContent = refData(_DownloadableContent.default, {
357
355
  res: "downloadableContent",
358
356
  syncWeight: 0,
package/dist/Schema.js CHANGED
@@ -187,7 +187,7 @@ function createRealmConfig() {
187
187
  return doCompact;
188
188
  },
189
189
  //order is important, should be arranged according to the dependency
190
- schemaVersion: 217,
190
+ schemaVersion: 218,
191
191
  onMigration: function (oldDB, newDB) {
192
192
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
193
193
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -854,9 +854,10 @@ function createRealmConfig() {
854
854
  // GroupSubject.removalReasonConceptUUID added (additive optional string). No backfill needed.
855
855
  }
856
856
  if (oldDB.schemaVersion < 217) {
857
- // Additive: introduces the DownloadableContent reference-data schema
858
- // (avniproject/avni-models#67). New entity, no pre-existing rows; first
859
- // reference-data sync populates it. Nothing to backfill.
857
+ // DownloadableContent added (new reference-data entity). No backfill needed.
858
+ }
859
+ if (oldDB.schemaVersion < 218) {
860
+ // AttendanceRecord.otherReasonText added (additive optional string). No backfill needed.
860
861
  }
861
862
  }
862
863
  };
package/dist/Session.js CHANGED
@@ -123,6 +123,7 @@ class Session extends _BaseEntity.default {
123
123
  record.subjectUUID = studentUUID;
124
124
  record.status = entry.status;
125
125
  record.reasonConceptUUIDs = entry.reasonConceptUUIDs || [];
126
+ record.otherReasonText = entry.otherReasonText || null;
126
127
  record.needsFollowUp = !!entry.needsFollowUp;
127
128
  record.followUpEncounterUUID = null;
128
129
  record.voided = false;
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.70",
4
+ "version": "1.33.71",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",