ember-data-source 2.15.0.beta.2 → 2.15.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c741982281e05779751fc284aa5cc920bcbd52e
4
- data.tar.gz: bdbc62d05aeb3ed573e76e6a1731b9c5852508a2
3
+ metadata.gz: 89f46fe8435761f8c85c9e6ffd3ea19552acedd4
4
+ data.tar.gz: d9b704812d614b98c36c9251c62550b5362650ff
5
5
  SHA512:
6
- metadata.gz: 8b68740cc21d2ac42f2dc87bfcb1aa100144536299815d0b053bd434b086e13d8e4dc349866743cbfefda973a352d31c6811ad88450edfd8f7027b4a37c18a3d
7
- data.tar.gz: 2e1a584caf3f57896cbd804d2689084d6746b45450e916d74330414a0d5284e04298a07cc9f9756c89592d346d1a8e8dec8bcdff0f5f2acf2651d20ead53cd27
6
+ metadata.gz: 5992d8c95932387e4db709d9a343aedd0e92371fa98176c020856e993ec301a1801edc7eb77429c98acd8bc8888fefc5bb796b9a4ae9498ac5dcbae537df135b
7
+ data.tar.gz: 527a2224fbfca7a23e0bdb4b50ca523874fa205475402ac477687efe48fe7c8625815b39eaac351c1661b16ef0109c92d7b4429af91f9f1dec4a2728f4692201
@@ -6,7 +6,7 @@
6
6
  * @copyright Copyright 2011-2017 Tilde Inc. and contributors.
7
7
  * Portions Copyright 2011 LivingSocial Inc.
8
8
  * @license Licensed under MIT license (see license.js)
9
- * @version 2.15.0-beta.2
9
+ * @version 2.15.0-beta.3
10
10
  */
11
11
 
12
12
  var loader, define, requireModule, require, requirejs;
@@ -14,8 +14,6 @@ var loader, define, requireModule, require, requirejs;
14
14
  (function (global) {
15
15
  'use strict';
16
16
 
17
- var heimdall = global.heimdall;
18
-
19
17
  function dict() {
20
18
  var obj = Object.create(null);
21
19
  obj['__'] = undefined;
@@ -32,9 +30,9 @@ var loader, define, requireModule, require, requirejs;
32
30
  requirejs: requirejs
33
31
  };
34
32
 
35
- requirejs = require = requireModule = function (name) {
33
+ requirejs = require = requireModule = function (id) {
36
34
  var pending = [];
37
- var mod = findModule(name, '(require)', pending);
35
+ var mod = findModule(id, '(require)', pending);
38
36
 
39
37
  for (var i = pending.length - 1; i >= 0; i--) {
40
38
  pending[i].exports();
@@ -57,32 +55,25 @@ var loader, define, requireModule, require, requirejs;
57
55
  }
58
56
  }
59
57
  }
60
- }
58
+ },
59
+ // Option to enable or disable the generation of default exports
60
+ makeDefaultExport: true
61
61
  };
62
62
 
63
- var _isArray;
64
- if (!Array.isArray) {
65
- _isArray = function (x) {
66
- return Object.prototype.toString.call(x) === '[object Array]';
67
- };
68
- } else {
69
- _isArray = Array.isArray;
70
- }
71
-
72
63
  var registry = dict();
73
64
  var seen = dict();
74
65
 
75
66
  var uuid = 0;
76
67
 
77
68
  function unsupportedModule(length) {
78
- throw new Error('an unsupported module was defined, expected `define(name, deps, module)` instead got: `' + length + '` arguments to define`');
69
+ throw new Error('an unsupported module was defined, expected `define(id, deps, module)` instead got: `' + length + '` arguments to define`');
79
70
  }
80
71
 
81
72
  var defaultDeps = ['require', 'exports', 'module'];
82
73
 
83
- function Module(name, deps, callback, alias) {
84
- this.id = uuid++;
85
- this.name = name;
74
+ function Module(id, deps, callback, alias) {
75
+ this.uuid = uuid++;
76
+ this.id = id;
86
77
  this.deps = !deps.length && callback.length ? defaultDeps : deps;
87
78
  this.module = { exports: {} };
88
79
  this.callback = callback;
@@ -116,19 +107,23 @@ var loader, define, requireModule, require, requirejs;
116
107
  return this.module.exports;
117
108
  }
118
109
 
110
+
119
111
  if (loader.wrapModules) {
120
- this.callback = loader.wrapModules(this.name, this.callback);
112
+ this.callback = loader.wrapModules(this.id, this.callback);
121
113
  }
122
114
 
123
115
  this.reify();
124
116
 
125
117
  var result = this.callback.apply(this, this.reified);
118
+ this.reified.length = 0;
126
119
  this.state = 'finalized';
127
120
 
128
121
  if (!(this.hasExportsAsDep && result === undefined)) {
129
122
  this.module.exports = result;
130
123
  }
131
- this.makeDefaultExport();
124
+ if (loader.makeDefaultExport) {
125
+ this.makeDefaultExport();
126
+ }
132
127
  return this.module.exports;
133
128
  };
134
129
 
@@ -181,27 +176,28 @@ var loader, define, requireModule, require, requirejs;
181
176
  } else if (dep === 'module') {
182
177
  entry.exports = this.module;
183
178
  } else {
184
- entry.module = findModule(resolve(dep, this.name), this.name, pending);
179
+ entry.module = findModule(resolve(dep, this.id), this.id, pending);
185
180
  }
186
181
  }
187
182
  };
188
183
 
189
184
  Module.prototype.makeRequire = function () {
190
- var name = this.name;
185
+ var id = this.id;
191
186
  var r = function (dep) {
192
- return require(resolve(dep, name));
187
+ return require(resolve(dep, id));
193
188
  };
194
189
  r['default'] = r;
190
+ r.moduleId = id;
195
191
  r.has = function (dep) {
196
- return has(resolve(dep, name));
192
+ return has(resolve(dep, id));
197
193
  };
198
194
  return r;
199
195
  };
200
196
 
201
- define = function (name, deps, callback) {
202
- var module = registry[name];
197
+ define = function (id, deps, callback) {
198
+ var module = registry[id];
203
199
 
204
- // If a module for this name has already been defined and is in any state
200
+ // If a module for this id has already been defined and is in any state
205
201
  // other than `new` (meaning it has been or is currently being required),
206
202
  // then we return early to avoid redefinition.
207
203
  if (module && module.state !== 'new') {
@@ -212,42 +208,65 @@ var loader, define, requireModule, require, requirejs;
212
208
  unsupportedModule(arguments.length);
213
209
  }
214
210
 
215
- if (!_isArray(deps)) {
211
+ if (!Array.isArray(deps)) {
216
212
  callback = deps;
217
213
  deps = [];
218
214
  }
219
215
 
220
216
  if (callback instanceof Alias) {
221
- registry[name] = new Module(callback.name, deps, callback, true);
217
+ registry[id] = new Module(callback.id, deps, callback, true);
222
218
  } else {
223
- registry[name] = new Module(name, deps, callback, false);
219
+ registry[id] = new Module(id, deps, callback, false);
220
+ }
221
+ };
222
+
223
+ define.exports = function (name, defaultExport) {
224
+ var module = registry[name];
225
+
226
+ // If a module for this name has already been defined and is in any state
227
+ // other than `new` (meaning it has been or is currently being required),
228
+ // then we return early to avoid redefinition.
229
+ if (module && module.state !== 'new') {
230
+ return;
224
231
  }
232
+
233
+ module = new Module(name, [], noop, null);
234
+ module.module.exports = defaultExport;
235
+ module.state = 'finalized';
236
+ registry[name] = module;
237
+
238
+ return module;
225
239
  };
226
240
 
241
+ function noop() {}
227
242
  // we don't support all of AMD
228
243
  // define.amd = {};
229
244
 
230
- function Alias(path) {
231
- this.name = path;
245
+ function Alias(id) {
246
+ this.id = id;
232
247
  }
233
248
 
234
- define.alias = function (path) {
235
- return new Alias(path);
249
+ define.alias = function (id, target) {
250
+ if (arguments.length === 2) {
251
+ return define(target, new Alias(id));
252
+ }
253
+
254
+ return new Alias(id);
236
255
  };
237
256
 
238
- function missingModule(name, referrer) {
239
- throw new Error('Could not find module `' + name + '` imported from `' + referrer + '`');
257
+ function missingModule(id, referrer) {
258
+ throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');
240
259
  }
241
260
 
242
- function findModule(name, referrer, pending) {
243
- var mod = registry[name] || registry[name + '/index'];
261
+ function findModule(id, referrer, pending) {
262
+ var mod = registry[id] || registry[id + '/index'];
244
263
 
245
264
  while (mod && mod.isAlias) {
246
- mod = registry[mod.name];
265
+ mod = registry[mod.id];
247
266
  }
248
267
 
249
268
  if (!mod) {
250
- missingModule(name, referrer);
269
+ missingModule(id, referrer);
251
270
  }
252
271
 
253
272
  if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {
@@ -257,13 +276,14 @@ var loader, define, requireModule, require, requirejs;
257
276
  return mod;
258
277
  }
259
278
 
260
- function resolve(child, name) {
279
+ function resolve(child, id) {
261
280
  if (child.charAt(0) !== '.') {
262
281
  return child;
263
282
  }
264
283
 
284
+
265
285
  var parts = child.split('/');
266
- var nameParts = name.split('/');
286
+ var nameParts = id.split('/');
267
287
  var parentBase = nameParts.slice(0, -1);
268
288
 
269
289
  for (var i = 0, l = parts.length; i < l; i++) {
@@ -284,14 +304,14 @@ var loader, define, requireModule, require, requirejs;
284
304
  return parentBase.join('/');
285
305
  }
286
306
 
287
- function has(name) {
288
- return !!(registry[name] || registry[name + '/index']);
307
+ function has(id) {
308
+ return !!(registry[id] || registry[id + '/index']);
289
309
  }
290
310
 
291
311
  requirejs.entries = requirejs._eak_seen = registry;
292
312
  requirejs.has = has;
293
- requirejs.unsee = function (moduleName) {
294
- findModule(moduleName, '(unsee)', false).unsee();
313
+ requirejs.unsee = function (id) {
314
+ findModule(id, '(unsee)', false).unsee();
295
315
  };
296
316
 
297
317
  requirejs.clear = function () {
@@ -310,9 +330,12 @@ var loader, define, requireModule, require, requirejs;
310
330
  });
311
331
  define('foo/baz', [], define.alias('foo'));
312
332
  define('foo/quz', define.alias('foo'));
333
+ define.alias('foo', 'foo/qux');
313
334
  define('foo/bar', ['foo', './quz', './baz', './asdf', './bar', '../foo'], function () {});
314
335
  define('foo/main', ['foo/bar'], function () {});
336
+ define.exports('foo/exports', {});
315
337
 
338
+ require('foo/exports');
316
339
  require('foo/main');
317
340
  require.unsee('foo/bar');
318
341
 
@@ -3008,17 +3031,11 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3008
3031
  };
3009
3032
 
3010
3033
  InternalModel.prototype._directlyRelatedInternalModels = function _directlyRelatedInternalModels() {
3011
- var _this = this;
3012
-
3013
3034
  var array = [];
3014
- this.type.eachRelationship(function (key, relationship) {
3015
- if (_this._relationships.has(key)) {
3016
- var _relationship = _this._relationships.get(key);
3017
- var localRelationships = _relationship.members.toArray();
3018
- var serverRelationships = _relationship.canonicalMembers.toArray();
3019
-
3020
- array = array.concat(localRelationships, serverRelationships);
3021
- }
3035
+ this._relationships.forEach(function (name, rel) {
3036
+ var local = rel.members.toArray();
3037
+ var server = rel.canonicalMembers.toArray();
3038
+ array = array.concat(local, server);
3022
3039
  });
3023
3040
  return array;
3024
3041
  };
@@ -3049,6 +3066,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3049
3066
  InternalModel.prototype.unloadRecord = function unloadRecord() {
3050
3067
  this.send('unloadRecord');
3051
3068
  this.dematerializeRecord();
3069
+
3052
3070
  if (this._scheduledDestroy === null) {
3053
3071
  this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
3054
3072
  }
@@ -3094,6 +3112,11 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3094
3112
 
3095
3113
 
3096
3114
  this.store._internalModelDestroyed(this);
3115
+
3116
+ this._relationships.forEach(function (name, rel) {
3117
+ return rel.destroy();
3118
+ });
3119
+
3097
3120
  this._isDestroyed = true;
3098
3121
  };
3099
3122
 
@@ -3222,12 +3245,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3222
3245
  }
3223
3246
  };
3224
3247
 
3225
- InternalModel.prototype.notifyHasManyRemoved = function notifyHasManyRemoved(key, record, idx) {
3226
- if (this.hasRecord) {
3227
- this._record.notifyHasManyRemoved(key, record, idx);
3228
- }
3229
- };
3230
-
3231
3248
  InternalModel.prototype.notifyBelongsToChanged = function notifyBelongsToChanged(key, record) {
3232
3249
  if (this.hasRecord) {
3233
3250
  this._record.notifyBelongsToChanged(key, record);
@@ -3261,7 +3278,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3261
3278
  }
3262
3279
 
3263
3280
  if (this.isNew()) {
3264
- this.clearRelationships();
3281
+ this.removeFromInverseRelationships(true);
3265
3282
  }
3266
3283
 
3267
3284
  if (this.isValid()) {
@@ -3377,47 +3394,68 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3377
3394
  triggers.length = 0;
3378
3395
  };
3379
3396
 
3380
- InternalModel.prototype.clearRelationships = function clearRelationships() {
3381
- var _this2 = this;
3397
+ InternalModel.prototype.removeFromInverseRelationships = function removeFromInverseRelationships() {
3398
+ var isNew = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3382
3399
 
3383
- this.eachRelationship(function (name, relationship) {
3384
- if (_this2._relationships.has(name)) {
3385
- var rel = _this2._relationships.get(name);
3400
+ this._relationships.forEach(function (name, rel) {
3401
+ rel.removeCompletelyFromInverse();
3402
+ if (isNew === true) {
3386
3403
  rel.clear();
3387
- rel.removeInverseRelationships();
3388
3404
  }
3389
3405
  });
3390
- Object.keys(this._implicitRelationships).forEach(function (key) {
3391
- _this2._implicitRelationships[key].clear();
3392
- _this2._implicitRelationships[key].removeInverseRelationships();
3406
+
3407
+ var implicitRelationships = this._implicitRelationships;
3408
+ this.__implicitRelationships = null;
3409
+
3410
+ Object.keys(implicitRelationships).forEach(function (key) {
3411
+ var rel = implicitRelationships[key];
3412
+
3413
+ rel.removeCompletelyFromInverse();
3414
+ if (isNew === true) {
3415
+ rel.clear();
3416
+ }
3393
3417
  });
3394
3418
  };
3395
3419
 
3396
3420
  InternalModel.prototype.destroyRelationships = function destroyRelationships() {
3397
- var _this3 = this;
3421
+ var _this = this;
3398
3422
 
3399
- this.eachRelationship(function (name, relationship) {
3400
- if (_this3._relationships.has(name)) {
3401
- var rel = _this3._relationships.get(name);
3423
+ this._relationships.forEach(function (name, rel) {
3424
+ if (rel._inverseIsAsync()) {
3425
+ rel.removeInternalModelFromInverse(_this);
3402
3426
  rel.removeInverseRelationships();
3427
+ } else {
3428
+ rel.removeCompletelyFromInverse();
3403
3429
  }
3404
3430
  });
3405
- Object.keys(this._implicitRelationships).forEach(function (key) {
3406
- _this3._implicitRelationships[key].removeInverseRelationships();
3431
+
3432
+ var implicitRelationships = this._implicitRelationships;
3433
+ this.__implicitRelationships = null;
3434
+ Object.keys(implicitRelationships).forEach(function (key) {
3435
+ var rel = implicitRelationships[key];
3436
+
3437
+ if (rel._inverseIsAsync()) {
3438
+ rel.removeInternalModelFromInverse(_this);
3439
+ rel.removeInverseRelationships();
3440
+ } else {
3441
+ rel.removeCompletelyFromInverse();
3442
+ }
3443
+
3444
+ rel.destroy();
3407
3445
  });
3408
3446
  };
3409
3447
 
3410
3448
  InternalModel.prototype.preloadData = function preloadData(preload) {
3411
- var _this4 = this;
3449
+ var _this2 = this;
3412
3450
 
3413
3451
  //TODO(Igor) consider the polymorphic case
3414
3452
  Object.keys(preload).forEach(function (key) {
3415
3453
  var preloadValue = get(preload, key);
3416
- var relationshipMeta = _this4.modelClass.metaForProperty(key);
3454
+ var relationshipMeta = _this2.modelClass.metaForProperty(key);
3417
3455
  if (relationshipMeta.isRelationship) {
3418
- _this4._preloadRelationship(key, preloadValue);
3456
+ _this2._preloadRelationship(key, preloadValue);
3419
3457
  } else {
3420
- _this4._data[key] = preloadValue;
3458
+ _this2._data[key] = preloadValue;
3421
3459
  }
3422
3460
  });
3423
3461
  };
@@ -5512,7 +5550,7 @@ define('ember-data/-private/system/model/states', ['exports'], function (exports
5512
5550
  isDirty: false,
5513
5551
 
5514
5552
  setup: function (internalModel) {
5515
- internalModel.clearRelationships();
5553
+ internalModel.removeFromInverseRelationships();
5516
5554
  },
5517
5555
  invokeLifecycleCallbacks: function (internalModel) {
5518
5556
  internalModel.triggerLater('didDelete', internalModel);
@@ -8388,13 +8426,12 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8388
8426
  id: id,
8389
8427
  type: modelName
8390
8428
  }
8391
- };
8392
8429
 
8393
- // start flushing this individual payload. The logic is the same whether
8394
- // it's for the left hand side of the relationship or the right hand side,
8395
- // except the role of primary and inverse idToPayloads is reversed
8396
- //
8397
- var previousPayload = void 0;
8430
+ // start flushing this individual payload. The logic is the same whether
8431
+ // it's for the left hand side of the relationship or the right hand side,
8432
+ // except the role of primary and inverse idToPayloads is reversed
8433
+ //
8434
+ };var previousPayload = void 0;
8398
8435
  var idToPayloads = void 0;
8399
8436
  var inverseIdToPayloads = void 0;
8400
8437
  var inverseIsMany = void 0;
@@ -8660,6 +8697,19 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8660
8697
  this.notifyBelongsToChanged();
8661
8698
  };
8662
8699
 
8700
+ BelongsToRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
8701
+ _Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
8702
+
8703
+ if (this.canonicalState === internalModel) {
8704
+ this.canonicalState = null;
8705
+ }
8706
+
8707
+ if (this.inverseInternalModel === internalModel) {
8708
+ this.inverseInternalModel = null;
8709
+ this.notifyBelongsToChanged();
8710
+ }
8711
+ };
8712
+
8663
8713
  BelongsToRelationship.prototype.flushCanonical = function flushCanonical() {
8664
8714
  //temporary fix to not remove newly created records if server returned null.
8665
8715
  //TODO remove once we have proper diffing
@@ -8874,6 +8924,13 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
8874
8924
  return !!this.initializedRelationships[key];
8875
8925
  };
8876
8926
 
8927
+ Relationships.prototype.forEach = function forEach(cb) {
8928
+ var rels = this.initializedRelationships;
8929
+ Object.keys(rels).forEach(function (name) {
8930
+ cb(name, rels[name]);
8931
+ });
8932
+ };
8933
+
8877
8934
  Relationships.prototype.get = function get(key) {
8878
8935
  var relationships = this.initializedRelationships;
8879
8936
  var relationship = relationships[key];
@@ -9060,6 +9117,26 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9060
9117
  _Relationship.prototype.removeCanonicalInternalModelFromOwn.call(this, internalModel, idx);
9061
9118
  };
9062
9119
 
9120
+ ManyRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
9121
+ _Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
9122
+
9123
+ var canonicalIndex = this.canonicalState.indexOf(internalModel);
9124
+
9125
+ if (canonicalIndex !== -1) {
9126
+ this.canonicalState.splice(canonicalIndex, 1);
9127
+ }
9128
+
9129
+ var manyArray = this._manyArray;
9130
+
9131
+ if (manyArray) {
9132
+ var idx = manyArray.currentState.indexOf(internalModel);
9133
+
9134
+ if (idx !== -1) {
9135
+ manyArray.internalReplace(idx, 1);
9136
+ }
9137
+ }
9138
+ };
9139
+
9063
9140
  ManyRelationship.prototype.flushCanonical = function flushCanonical() {
9064
9141
  if (this._manyArray) {
9065
9142
  this._manyArray.flushCanonical();
@@ -9136,33 +9213,41 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9136
9213
  };
9137
9214
 
9138
9215
  ManyRelationship.prototype.setInitialInternalModels = function setInitialInternalModels(internalModels) {
9139
- var _this2 = this;
9216
+ var _canonicalState;
9140
9217
 
9141
- if (!internalModels) {
9218
+ if (Array.isArray(internalModels) === false || internalModels.length === 0) {
9142
9219
  return;
9143
9220
  }
9144
9221
 
9145
- var args = [0, this.canonicalState.length].concat(internalModels);
9146
- this.canonicalState.splice.apply(this.canonicalState, args);
9147
- internalModels.forEach(function (internalModel) {
9148
- _this2.canonicalMembers.add(internalModel);
9149
- _this2.members.add(internalModel);
9150
- _this2.setupInverseRelationship(internalModel);
9151
- });
9222
+ var forCanonical = [];
9223
+
9224
+ for (var i = 0; i < internalModels.length; i++) {
9225
+ var internalModel = internalModels[i];
9226
+ if (this.canonicalMembers.has(internalModel)) {
9227
+ continue;
9228
+ }
9229
+
9230
+ forCanonical.push(internalModel);
9231
+ this.canonicalMembers.add(internalModel);
9232
+ this.members.add(internalModel);
9233
+ this.setupInverseRelationship(internalModel);
9234
+ }
9235
+
9236
+ (_canonicalState = this.canonicalState).splice.apply(_canonicalState, [0, this.canonicalState.length].concat(forCanonical));
9152
9237
  };
9153
9238
 
9154
9239
  ManyRelationship.prototype.fetchLink = function fetchLink() {
9155
- var _this3 = this;
9240
+ var _this2 = this;
9156
9241
 
9157
9242
  return this.store.findHasMany(this.internalModel, this.link, this.relationshipMeta).then(function (records) {
9158
9243
  if (records.hasOwnProperty('meta')) {
9159
- _this3.updateMeta(records.meta);
9244
+ _this2.updateMeta(records.meta);
9160
9245
  }
9161
- _this3.store._backburner.join(function () {
9162
- _this3.updateInternalModelsFromAdapter(records);
9163
- _this3.manyArray.set('isLoaded', true);
9246
+ _this2.store._backburner.join(function () {
9247
+ _this2.updateInternalModelsFromAdapter(records);
9248
+ _this2.manyArray.set('isLoaded', true);
9164
9249
  });
9165
- return _this3.manyArray;
9250
+ return _this2.manyArray;
9166
9251
  });
9167
9252
  };
9168
9253
 
@@ -9185,7 +9270,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9185
9270
  };
9186
9271
 
9187
9272
  ManyRelationship.prototype.getRecords = function getRecords() {
9188
- var _this4 = this;
9273
+ var _this3 = this;
9189
9274
 
9190
9275
  //TODO(Igor) sync server here, once our syncing is not stupid
9191
9276
  var manyArray = this.manyArray;
@@ -9196,7 +9281,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9196
9281
  promise = this.findRecords();
9197
9282
  } else {
9198
9283
  promise = this.findLink().then(function () {
9199
- return _this4.findRecords();
9284
+ return _this3.findRecords();
9200
9285
  });
9201
9286
  }
9202
9287
  } else {
@@ -9225,6 +9310,20 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9225
9310
  }
9226
9311
  };
9227
9312
 
9313
+ ManyRelationship.prototype.destroy = function destroy() {
9314
+ _Relationship.prototype.destroy.call(this);
9315
+ var manyArray = this._manyArray;
9316
+ if (manyArray) {
9317
+ manyArray.destroy();
9318
+ }
9319
+
9320
+ var proxy = this.__loadingPromise;
9321
+
9322
+ if (proxy) {
9323
+ proxy.destroy();
9324
+ }
9325
+ };
9326
+
9228
9327
  _createClass(ManyRelationship, [{
9229
9328
  key: '_loadingPromise',
9230
9329
  get: function () {
@@ -9266,7 +9365,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9266
9365
  return set;
9267
9366
  }
9268
9367
  });
9269
- define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link'], function (exports, _orderedSet, _normalizeLink2) {
9368
+ define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link', 'ember'], function (exports, _orderedSet, _normalizeLink2, _ember) {
9270
9369
  'use strict';
9271
9370
 
9272
9371
  exports.__esModule = true;
@@ -9295,6 +9394,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9295
9394
  };
9296
9395
  }();
9297
9396
 
9397
+ var guidFor = _ember.default.guidFor;
9398
+
9298
9399
  var Relationship = function () {
9299
9400
  function Relationship(store, internalModel, inverseKey, relationshipMeta) {
9300
9401
  _classCallCheck(this, Relationship);
@@ -9319,6 +9420,13 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9319
9420
  this.hasLoaded = false;
9320
9421
  }
9321
9422
 
9423
+ Relationship.prototype._inverseIsAsync = function _inverseIsAsync() {
9424
+ if (!this.inverseKey || !this.inverseInternalModel) {
9425
+ return false;
9426
+ }
9427
+ return this.inverseInternalModel._relationships.get(this.inverseKey).isAsync;
9428
+ };
9429
+
9322
9430
  Relationship.prototype.removeInverseRelationships = function removeInverseRelationships() {
9323
9431
  var _this = this;
9324
9432
 
@@ -9413,7 +9521,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9413
9521
  var _relationships = internalModel._implicitRelationships;
9414
9522
  var _relationship = _relationships[this.inverseKeyForImplicit];
9415
9523
  if (!_relationship) {
9416
- _relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
9524
+ _relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
9417
9525
  }
9418
9526
  _relationship.addCanonicalInternalModel(this.internalModel);
9419
9527
  }
@@ -9451,7 +9559,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9451
9559
  internalModel._relationships.get(this.inverseKey).addInternalModel(this.internalModel);
9452
9560
  } else {
9453
9561
  if (!internalModel._implicitRelationships[this.inverseKeyForImplicit]) {
9454
- internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
9562
+ internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
9455
9563
  }
9456
9564
  internalModel._implicitRelationships[this.inverseKeyForImplicit].addInternalModel(this.internalModel);
9457
9565
  }
@@ -9483,7 +9591,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9483
9591
 
9484
9592
  Relationship.prototype.removeInternalModelFromOwn = function removeInternalModelFromOwn(internalModel) {
9485
9593
  this.members.delete(internalModel);
9486
- this.notifyRecordRelationshipRemoved(internalModel);
9487
9594
  this.internalModel.updateRecordArrays();
9488
9595
  };
9489
9596
 
@@ -9500,6 +9607,38 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9500
9607
  this.flushCanonicalLater();
9501
9608
  };
9502
9609
 
9610
+ Relationship.prototype.removeCompletelyFromInverse = function removeCompletelyFromInverse() {
9611
+ var _this4 = this;
9612
+
9613
+ if (!this.inverseKey) {
9614
+ return;
9615
+ }
9616
+
9617
+ // we actually want a union of members and canonicalMembers
9618
+ // they should be disjoint but currently are not due to a bug
9619
+ var seen = Object.create(null);
9620
+ var internalModel = this.internalModel;
9621
+
9622
+ var unload = function (inverseInternalModel) {
9623
+ var id = guidFor(inverseInternalModel);
9624
+
9625
+ if (seen[id] === undefined) {
9626
+ var relationship = inverseInternalModel._relationships.get(_this4.inverseKey);
9627
+ relationship.removeCompletelyFromOwn(internalModel);
9628
+ seen[id] = true;
9629
+ }
9630
+ };
9631
+
9632
+ this.members.forEach(unload);
9633
+ this.canonicalMembers.forEach(unload);
9634
+ };
9635
+
9636
+ Relationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
9637
+ this.canonicalMembers.delete(internalModel);
9638
+ this.members.delete(internalModel);
9639
+ this.internalModel.updateRecordArrays();
9640
+ };
9641
+
9503
9642
  Relationship.prototype.flushCanonical = function flushCanonical() {
9504
9643
  var list = this.members.list;
9505
9644
  this.willSync = false;
@@ -9528,10 +9667,10 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9528
9667
  };
9529
9668
 
9530
9669
  Relationship.prototype.updateLink = function updateLink(link) {
9531
- (false && Ember.warn('You pushed a record of type \'' + this.internalModel.modelName + '\' with a relationship \'' + this.key + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', this.isAsync || this.hasData, {
9670
+ (false && _ember.default.warn('You pushed a record of type \'' + this.internalModel.modelName + '\' with a relationship \'' + this.key + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', this.isAsync || this.hasData, {
9532
9671
  id: 'ds.store.push-link-for-sync-relationship'
9533
9672
  }));
9534
- (false && Ember.assert('You have pushed a record of type \'' + this.internalModel.modelName + '\' with \'' + this.key + '\' as a link, but the value of that link is not a string.', typeof link === 'string' || link === null));
9673
+ (false && _ember.default.assert('You have pushed a record of type \'' + this.internalModel.modelName + '\' with \'' + this.key + '\' as a link, but the value of that link is not a string.', typeof link === 'string' || link === null));
9535
9674
 
9536
9675
 
9537
9676
  this.link = link;
@@ -9559,8 +9698,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9559
9698
 
9560
9699
  Relationship.prototype.notifyRecordRelationshipAdded = function notifyRecordRelationshipAdded() {};
9561
9700
 
9562
- Relationship.prototype.notifyRecordRelationshipRemoved = function notifyRecordRelationshipRemoved() {};
9563
-
9564
9701
  Relationship.prototype.setHasData = function setHasData(value) {
9565
9702
  this.hasData = value;
9566
9703
  };
@@ -9611,6 +9748,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9611
9748
 
9612
9749
  Relationship.prototype.updateData = function updateData() {};
9613
9750
 
9751
+ Relationship.prototype.destroy = function destroy() {};
9752
+
9614
9753
  _createClass(Relationship, [{
9615
9754
  key: 'parentType',
9616
9755
  get: function () {
@@ -15351,7 +15490,7 @@ define('ember-data/initializers/data-adapter', ['exports'], function (exports) {
15351
15490
  initialize: function () {}
15352
15491
  };
15353
15492
  });
15354
- define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data/index'], function (exports, _setupContainer) {
15493
+ define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data'], function (exports, _setupContainer) {
15355
15494
  'use strict';
15356
15495
 
15357
15496
  exports.__esModule = true;
@@ -18301,7 +18440,7 @@ define("ember-data/version", ["exports"], function (exports) {
18301
18440
  "use strict";
18302
18441
 
18303
18442
  exports.__esModule = true;
18304
- exports.default = "2.15.0-beta.2";
18443
+ exports.default = "2.15.0-beta.3";
18305
18444
  });
18306
18445
  define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
18307
18446
  "use strict";