electrodb 2.3.3 → 2.3.4
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/README.md +26 -6046
- package/package.json +1 -1
- package/src/entity.js +2 -2
- package/src/util.js +5 -0
package/package.json
CHANGED
package/src/entity.js
CHANGED
|
@@ -1494,7 +1494,7 @@ class Entity {
|
|
|
1494
1494
|
update.set(this.identifiers.entity, this.getName());
|
|
1495
1495
|
update.set(this.identifiers.version, this.getVersion());
|
|
1496
1496
|
for (const field of [...Object.keys(upsertAttributes), ...Object.keys(updatedKeys)]) {
|
|
1497
|
-
const value = upsertAttributes[field]
|
|
1497
|
+
const value = u.getFirstDefined(upsertAttributes[field], updatedKeys[field]);
|
|
1498
1498
|
if (!keyNames.includes(field)) {
|
|
1499
1499
|
update.set(field, value);
|
|
1500
1500
|
}
|
|
@@ -3023,7 +3023,7 @@ class Entity {
|
|
|
3023
3023
|
if (sk.isCustom) {
|
|
3024
3024
|
definitions[indexName].sk.push({name, label});
|
|
3025
3025
|
} else {
|
|
3026
|
-
definitions[indexName].sk.push({name, label: fromModel[name]
|
|
3026
|
+
definitions[indexName].sk.push({name, label: u.getFirstDefined(fromModel[name], name) });
|
|
3027
3027
|
}
|
|
3028
3028
|
}
|
|
3029
3029
|
}
|
package/src/util.js
CHANGED
|
@@ -233,6 +233,10 @@ function shiftSortOrder(str = '', codePoint) {
|
|
|
233
233
|
return newString;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
function getFirstDefined(...params) {
|
|
237
|
+
return params.find(val => val !== undefined);
|
|
238
|
+
}
|
|
239
|
+
|
|
236
240
|
module.exports = {
|
|
237
241
|
getUnique,
|
|
238
242
|
batchItems,
|
|
@@ -241,6 +245,7 @@ module.exports = {
|
|
|
241
245
|
removeFixings,
|
|
242
246
|
parseJSONPath,
|
|
243
247
|
shiftSortOrder,
|
|
248
|
+
getFirstDefined,
|
|
244
249
|
getInstanceType,
|
|
245
250
|
getModelVersion,
|
|
246
251
|
formatKeyCasing,
|