Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* OData says it is up to the client to save entities in the order
* required by referential constraints of the database.
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
// batches.push(null); // empty = save all remaining pending changes
return batches;
/*
/* Aaargh!
* Web API OData doesn't calculate the proper save order
* which means, if we aren't careful on the client,
* we could save a new TodoItem before we saved its parent new TodoList
* or delete the parent TodoList before saving its deleted child TodoItems.
* OData says it is up to the client to save entities in the order
* required by referential constraints of the database.
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
* or delete the parent TodoList before saving its deleted child TodoItems.
* OData says it is up to the client to save entities in the order
* required by referential constraints of the database.
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
// batches.push(null); // empty = save all remaining pending changes
return batches;
* or delete the parent TodoList before saving its deleted child TodoItems.
* OData says it is up to the client to save entities in the order
* required by referential constraints of the database.
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
// batches.push(null); // empty = save all remaining pending changes
return batches;
/* Aaargh!
* Web API OData doesn't calculate the proper save order
* which means, if we aren't careful on the client,
* we could save a new TodoItem before we saved its parent new TodoList
* or delete the parent TodoList before saving its deleted child TodoItems.
* OData says it is up to the client to save entities in the order
* required by referential constraints of the database.
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
* While we could save each time you make a change, that sucks.
* So we'll divvy up the pending changes into 4 batches
* 1. Deleted Todos
* 2. Deleted TodoLists
* 3. Added TodoLists
* 4. Every other change
*/
batches.push(this.getChanges("UserElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementCell", EntityState.Deleted));
batches.push(this.getChanges("ElementItem", EntityState.Deleted));
batches.push(this.getChanges("UserElementField", EntityState.Deleted));
batches.push(this.getChanges("ElementField", EntityState.Deleted));
batches.push(this.getChanges("Element", EntityState.Deleted));
batches.push(this.getChanges("UserResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Deleted));
batches.push(this.getChanges("ResourcePool", EntityState.Added));
batches.push(this.getChanges("UserResourcePool", EntityState.Added));
batches.push(this.getChanges("Element", EntityState.Added));
batches.push(this.getChanges("ElementField", EntityState.Added));
batches.push(this.getChanges("UserElementField", EntityState.Added));
batches.push(this.getChanges("ElementItem", EntityState.Added));
batches.push(this.getChanges("ElementCell", EntityState.Added));
batches.push(this.getChanges("UserElementCell", EntityState.Added));
// batches.push(null); // empty = save all remaining pending changes
return batches;
/*
* No we can't flatten into one request because Web API OData reorders
* arbitrarily, causing the database failure we're trying to avoid.