@ruiapp/rapid-core 0.1.16 → 0.1.18

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/index.js CHANGED
@@ -1643,8 +1643,13 @@ function mapDbRowToEntity(model, row, keepNonPropertyFields) {
1643
1643
  }
1644
1644
  }
1645
1645
  if (isRelationProp) {
1646
- if (row[propertyName] && !result[propertyName]) {
1647
- result[propertyName] = row[propertyName];
1646
+ if (row[propertyName]) {
1647
+ if (!result[propertyName]) {
1648
+ result[propertyName] = row[propertyName];
1649
+ }
1650
+ }
1651
+ else if (keepNonPropertyFields) {
1652
+ result[columnName] = row[columnName];
1648
1653
  }
1649
1654
  }
1650
1655
  else {
@@ -2262,7 +2267,7 @@ class EntityManager {
2262
2267
  return await findEntity(this.#server, this.#dataAccessor, options);
2263
2268
  }
2264
2269
  async findById(id, keepNonPropertyFields = false) {
2265
- return await findById(this.#server, this.#dataAccessor, id);
2270
+ return await findById(this.#server, this.#dataAccessor, id, keepNonPropertyFields);
2266
2271
  }
2267
2272
  async createEntity(options, plugin) {
2268
2273
  const model = this.getModel();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
@@ -719,7 +719,7 @@ export default class EntityManager<TEntity=any> {
719
719
  }
720
720
 
721
721
  async findById(id: any, keepNonPropertyFields: boolean = false): Promise<TEntity | null> {
722
- return await findById(this.#server, this.#dataAccessor, id);
722
+ return await findById(this.#server, this.#dataAccessor, id, keepNonPropertyFields);
723
723
  }
724
724
 
725
725
  async createEntity(options: CreateEntityOptions, plugin: RapidPlugin): Promise<TEntity> {
@@ -31,8 +31,12 @@ export function mapDbRowToEntity(model: RpdDataModel, row: any, keepNonPropertyF
31
31
  }
32
32
 
33
33
  if (isRelationProp) {
34
- if (row[propertyName] && !result[propertyName]) {
35
- result[propertyName] = row[propertyName];
34
+ if (row[propertyName]) {
35
+ if (!result[propertyName]) {
36
+ result[propertyName] = row[propertyName];
37
+ }
38
+ } else if (keepNonPropertyFields) {
39
+ result[columnName] = row[columnName];
36
40
  }
37
41
  } else {
38
42
  if (!result[propertyName]) {