miolo-model 3.0.0-beta.175 → 3.0.0-beta.177

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/MioloModel.mjs +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo-model",
3
- "version": "3.0.0-beta.175",
3
+ "version": "3.0.0-beta.177",
4
4
  "description": "Data models for miolo world",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -27,6 +27,9 @@ export default class MioloModel extends CacheMixin() {
27
27
  get_extra_data() {
28
28
  const data = {}
29
29
  for (const [key, value] of Object.entries(this)) {
30
+ if (key.startsWith("__")) {
31
+ continue
32
+ }
30
33
  if (value instanceof MioloModel || value instanceof MioloArray) {
31
34
  data[key] = value.get_data()
32
35
  } else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
@@ -39,6 +42,9 @@ export default class MioloModel extends CacheMixin() {
39
42
  getExtraData() {
40
43
  const data = {}
41
44
  for (const [key, value] of Object.entries(this)) {
45
+ if (key.startsWith("__")) {
46
+ continue
47
+ }
42
48
  if (value instanceof MioloModel || value instanceof MioloArray) {
43
49
  data[key] = value.getData()
44
50
  } else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
@@ -65,6 +71,8 @@ export default class MioloModel extends CacheMixin() {
65
71
  }
66
72
 
67
73
  update(changes) {
74
+ this.reset_cache()
75
+
68
76
  if (this.data === undefined) {
69
77
  this.data = {}
70
78
  }
@@ -74,6 +82,9 @@ export default class MioloModel extends CacheMixin() {
74
82
  }
75
83
 
76
84
  for (const [key, value] of Object.entries(this)) {
85
+ if (key.startsWith("__")) {
86
+ continue
87
+ }
77
88
  if (value instanceof MioloModel) {
78
89
  if (changes[key] !== undefined) {
79
90
  value.update(changes[key])
@@ -85,6 +96,9 @@ export default class MioloModel extends CacheMixin() {
85
96
  merge(model) {
86
97
  this.update(model.getData())
87
98
  for (const [key, value] of Object.entries(model)) {
99
+ if (key.startsWith("__")) {
100
+ continue
101
+ }
88
102
  if (value instanceof MioloModel || value instanceof MioloArray) {
89
103
  this[key] = value
90
104
  } else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {