@sankhyalabs/sankhyablocks 1.1.22 → 1.1.23

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.
@@ -123,15 +123,7 @@ export default class DataUnitFetcher {
123
123
  const changes = duChanges.map((change) => {
124
124
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
125
125
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
126
- if (value) {
127
- try {
128
- value = JSON.stringify(value);
129
- }
130
- catch (_a) {
131
- value = value.toString();
132
- }
133
- }
134
- return { fieldName, value };
126
+ return { fieldName, value: this.formatValueToServer(value) };
135
127
  });
136
128
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
137
129
  });
@@ -160,6 +152,21 @@ export default class DataUnitFetcher {
160
152
  });
161
153
  });
162
154
  }
155
+ formatValueToServer(value) {
156
+ if (value === undefined)
157
+ return value;
158
+ try {
159
+ if (value instanceof Date) {
160
+ return value.toString();
161
+ }
162
+ //Any others objects
163
+ value = JSON.stringify(value);
164
+ }
165
+ catch (_a) {
166
+ value = value.toString();
167
+ }
168
+ return value;
169
+ }
163
170
  removeRecords(dataUnit, recordIds) {
164
171
  const changes = recordIds.map((recordId) => {
165
172
  return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };