miolo-model 3.0.0-beta.173 → 3.0.0-beta.174

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo-model",
3
- "version": "3.0.0-beta.173",
3
+ "version": "3.0.0-beta.174",
4
4
  "description": "Data models for miolo world",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -34,7 +34,7 @@ export default class MioloArray extends CacheMixin(Array) {
34
34
  }
35
35
 
36
36
  getData() {
37
- return this.get_data()
37
+ return [...this].map((i) => i.getData())
38
38
  }
39
39
 
40
40
  find_index_by_field(field, value) {
@@ -37,7 +37,15 @@ export default class MioloModel extends CacheMixin() {
37
37
  }
38
38
 
39
39
  getExtraData() {
40
- return this.get_extra_data()
40
+ const data = {}
41
+ for (const [key, value] of Object.entries(this)) {
42
+ if (value instanceof MioloModel || value instanceof MioloArray) {
43
+ data[key] = value.getData()
44
+ } else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
45
+ data[key] = value.map((v) => v.getData())
46
+ }
47
+ }
48
+ return data
41
49
  }
42
50
 
43
51
  get_data() {
@@ -49,7 +57,11 @@ export default class MioloModel extends CacheMixin() {
49
57
  }
50
58
 
51
59
  getData() {
52
- return this.get_data()
60
+ const extra = this.getExtraData() || {}
61
+ return {
62
+ ...this.data,
63
+ ...extra
64
+ }
53
65
  }
54
66
 
55
67
  update(changes) {