@duet3d/objectmodel 3.4.0-b16 → 3.4.0-b17

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.
@@ -43,6 +43,9 @@ class ModelObject {
43
43
  console.warn(`Model object ${key} changed but it could not be set due to missing setter`);
44
44
  }
45
45
  }
46
+ else if (process.env.NODE_ENV !== "production") {
47
+ console.warn(`Model object ${key} changed but it lacks the property descriptor`);
48
+ }
46
49
  }
47
50
  }
48
51
  else if (prop instanceof Array) {
@@ -184,7 +187,24 @@ function initObject(itemType, data) {
184
187
  for (let key in data) {
185
188
  const resultKey = result[key];
186
189
  if (isModelObject(resultKey)) {
187
- resultKey.update(data[key]);
190
+ const updatedObject = resultKey.update(data[key]);
191
+ if (resultKey !== updatedObject) {
192
+ const propDescriptor = Object.getOwnPropertyDescriptor(result, key);
193
+ if (propDescriptor !== undefined) {
194
+ if (propDescriptor.writable) {
195
+ result[key] = updatedObject;
196
+ }
197
+ else if (propDescriptor.set !== undefined) {
198
+ propDescriptor.set(updatedObject);
199
+ }
200
+ else if (process.env.NODE_ENV !== "production") {
201
+ console.warn(`Model object ${key} changed but it could not be set due to missing setter`);
202
+ }
203
+ }
204
+ else if (process.env.NODE_ENV !== "production") {
205
+ console.warn(`Model object ${key} changed but it lacks the property descriptor`);
206
+ }
207
+ }
188
208
  }
189
209
  else {
190
210
  result[key] = data[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duet3d/objectmodel",
3
- "version": "3.4.0-b16",
3
+ "version": "3.4.0-b17",
4
4
  "description": "TypeScript implementation of the Duet3D Object Model",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",