jetstream
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -770,2 +770,6 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
ModelObject.prototype.hasParents = function() { | ||
return this._parentRelationships.length > 0; | ||
}; | ||
ModelObject.prototype.getParentRelationships = function() { | ||
@@ -772,0 +776,0 @@ // Return a shallow copy to preserve integrity |
@@ -442,9 +442,19 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
orphanedModelObjects.forEach(function(modelObject) { | ||
orphanedModelObjects.forEach(function unparentFromChildren(modelObject) { | ||
modelObject.getProperties().forEach(function(property) { | ||
if (property.isModelObjectType) { | ||
if (property.isCollectionType) { | ||
var children = modelObject[property.name].slice(0); | ||
modelObject[property.name] = []; | ||
children.forEach(function(child) { | ||
if (!child.hasParents()) { | ||
return unparentFromChildren(child); | ||
} | ||
}); | ||
} else { | ||
var child = modelObject[property.name]; | ||
modelObject[property.name] = null; | ||
if (child && !child.hasParents()) { | ||
return unparentFromChildren(child); | ||
} | ||
} | ||
@@ -451,0 +461,0 @@ } |
{ | ||
"name": "jetstream", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Jetstream Sync server framework to sync local and remote models", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
509182
11398