ember-data-source 2.14.11 → 2.15.0.beta.1

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: 0f80be6c0608e1fcbe988954f03250b6b31e250f
4
- data.tar.gz: c0e11980c2876b23cfd87f607038d3f2419aaa78
3
+ metadata.gz: abe9bf5fe6b9f3781d497f8ccd72a46c835f2b0d
4
+ data.tar.gz: 88cfba66211851aba25606400921f74b7fd92177
5
5
  SHA512:
6
- metadata.gz: d577228b58a47bc06ad1490560e0efbce9d9929dde1979010fdf5cfc381e5bcffa7faa948ac7c8604b5519194e0724e5e47edc9a597f90f8750f2244fe9e2660
7
- data.tar.gz: 6b462df59696d37ba0d298ebc9dce3ca50b96666ba7fc4a802865954416e3ecef5b1c64f549639394d6d30b36f2b49817444a30c2f8dc114e97812cf1b155f6f
6
+ metadata.gz: 06d5c84618a4ba7119b871e1efdca282c7024dc900f2c612d00bee29017d26679b51df8ec339059676d947de6d5526fab0f1afa1b064516333242706d85111c0
7
+ data.tar.gz: b08ddc95c492889c859250c97f40cccc34876fac819b64a82d1582dfa0cedc1eb4e6938814cb6165ee2db2f470b6cda578fc76c73802ac1578222d88d013864b
@@ -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.14.11
9
+ * @version 2.15.0-beta.1
10
10
  */
11
11
 
12
12
  var loader, define, requireModule, require, requirejs;
@@ -14,6 +14,8 @@ var loader, define, requireModule, require, requirejs;
14
14
  (function (global) {
15
15
  'use strict';
16
16
 
17
+ var heimdall = global.heimdall;
18
+
17
19
  function dict() {
18
20
  var obj = Object.create(null);
19
21
  obj['__'] = undefined;
@@ -55,9 +57,7 @@ var loader, define, requireModule, require, requirejs;
55
57
  }
56
58
  }
57
59
  }
58
- },
59
- // Option to enable or disable the generation of default exports
60
- makeDefaultExport: true
60
+ }
61
61
  };
62
62
 
63
63
  var registry = dict();
@@ -107,7 +107,6 @@ var loader, define, requireModule, require, requirejs;
107
107
  return this.module.exports;
108
108
  }
109
109
 
110
-
111
110
  if (loader.wrapModules) {
112
111
  this.callback = loader.wrapModules(this.id, this.callback);
113
112
  }
@@ -121,9 +120,7 @@ var loader, define, requireModule, require, requirejs;
121
120
  if (!(this.hasExportsAsDep && result === undefined)) {
122
121
  this.module.exports = result;
123
122
  }
124
- if (loader.makeDefaultExport) {
125
- this.makeDefaultExport();
126
- }
123
+ this.makeDefaultExport();
127
124
  return this.module.exports;
128
125
  };
129
126
 
@@ -281,7 +278,6 @@ var loader, define, requireModule, require, requirejs;
281
278
  return child;
282
279
  }
283
280
 
284
-
285
281
  var parts = child.split('/');
286
282
  var nameParts = id.split('/');
287
283
  var parentBase = nameParts.slice(0, -1);
@@ -349,59 +345,12 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
349
345
  'use strict';
350
346
 
351
347
  exports.__esModule = true;
352
- exports.assert = assert;
353
- exports.debug = debug;
354
- exports.deprecate = deprecate;
355
- exports.info = info;
356
- exports.runInDebug = runInDebug;
348
+ exports.assertPolymorphicType = undefined;
357
349
  exports.instrument = instrument;
358
- exports.warn = warn;
359
- exports.debugSeal = debugSeal;
360
- exports.assertPolymorphicType = assertPolymorphicType;
361
- function assert() {
362
- return _ember.default.assert.apply(_ember.default, arguments);
363
- }
364
-
365
- function debug() {
366
- return _ember.default.debug.apply(_ember.default, arguments);
367
- }
368
-
369
- function deprecate() {
370
- return _ember.default.deprecate.apply(_ember.default, arguments);
371
- }
372
-
373
- function info() {
374
- return _ember.default.info.apply(_ember.default, arguments);
375
- }
376
-
377
- function runInDebug() {
378
- return _ember.default.runInDebug.apply(_ember.default, arguments);
379
- }
380
-
381
350
  function instrument(method) {
382
351
  return method();
383
352
  }
384
353
 
385
- function warn() {
386
- return _ember.default.warn.apply(_ember.default, arguments);
387
- }
388
-
389
- function debugSeal() {
390
- return _ember.default.debugSeal.apply(_ember.default, arguments);
391
- }
392
-
393
- function checkPolymorphic(modelClass, addedModelClass) {
394
- if (modelClass.__isMixin) {
395
- //TODO Need to do this in order to support mixins, should convert to public api
396
- //once it exists in Ember
397
- return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
398
- }
399
- if (_ember.default.MODEL_FACTORY_INJECTIONS) {
400
- modelClass = modelClass.superclass;
401
- }
402
- return modelClass.detect(addedModelClass);
403
- }
404
-
405
354
  /*
406
355
  Assert that `addedRecord` has a valid type so it can be added to the
407
356
  relationship of the `record`.
@@ -421,18 +370,36 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
421
370
  @param {InternalModel} addedRecord record which
422
371
  should be added/set for the relationship
423
372
  */
424
- function assertPolymorphicType(parentInternalModel, relationshipMeta, addedInternalModel) {
425
- var addedModelName = addedInternalModel.modelName;
426
- var parentModelName = parentInternalModel.modelName;
427
- var key = relationshipMeta.key;
428
- var relationshipModelName = relationshipMeta.type;
429
- var relationshipClass = parentInternalModel.store.modelFor(relationshipModelName);
430
- var assertionMessage = 'You cannot add a record of modelClass \'' + addedModelName + '\' to the \'' + parentModelName + '.' + key + '\' relationship (only \'' + relationshipModelName + '\' allowed)';
431
-
432
- assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass));
373
+ var assertPolymorphicType = void 0;
374
+
375
+ if (false) {
376
+ var checkPolymorphic = function checkPolymorphic(modelClass, addedModelClass) {
377
+ if (modelClass.__isMixin) {
378
+ //TODO Need to do this in order to support mixins, should convert to public api
379
+ //once it exists in Ember
380
+ return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
381
+ }
382
+ if (_ember.default.MODEL_FACTORY_INJECTIONS) {
383
+ modelClass = modelClass.superclass;
384
+ }
385
+ return modelClass.detect(addedModelClass);
386
+ };
387
+
388
+ exports.assertPolymorphicType = assertPolymorphicType = function assertPolymorphicType(parentInternalModel, relationshipMeta, addedInternalModel) {
389
+ var addedModelName = addedInternalModel.modelName;
390
+ var parentModelName = parentInternalModel.modelName;
391
+ var key = relationshipMeta.key;
392
+ var relationshipModelName = relationshipMeta.type;
393
+ var relationshipClass = parentInternalModel.store.modelFor(relationshipModelName);
394
+ var assertionMessage = 'You cannot add a record of modelClass \'' + addedModelName + '\' to the \'' + parentModelName + '.' + key + '\' relationship (only \'' + relationshipModelName + '\' allowed)';
395
+
396
+ (false && _ember.default.assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass)));
397
+ };
433
398
  }
399
+
400
+ exports.assertPolymorphicType = assertPolymorphicType;
434
401
  });
435
- define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'ember-inflector'], function (exports, _ember, _emberInflector) {
402
+ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember'], function (exports, _ember) {
436
403
  'use strict';
437
404
 
438
405
  exports.__esModule = true;
@@ -832,11 +799,10 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
832
799
  endpoint of "/line_items/".
833
800
  ```app/adapters/application.js
834
801
  import DS from 'ember-data';
835
- import { pluralize } from 'ember-inflector';
836
802
  export default DS.RESTAdapter.extend({
837
803
  pathForType: function(modelName) {
838
804
  var decamelized = Ember.String.decamelize(modelName);
839
- return pluralize(decamelized);
805
+ return Ember.String.pluralize(decamelized);
840
806
  }
841
807
  });
842
808
  ```
@@ -846,11 +812,11 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
846
812
  **/
847
813
  pathForType: function (modelName) {
848
814
  var camelized = _ember.default.String.camelize(modelName);
849
- return (0, _emberInflector.pluralize)(camelized);
815
+ return _ember.default.String.pluralize(camelized);
850
816
  }
851
817
  });
852
818
  });
853
- define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/features'], function (exports, _ember, _debug, _features) {
819
+ define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-private/features'], function (exports, _ember, _features) {
854
820
  'use strict';
855
821
 
856
822
  exports.__esModule = true;
@@ -961,7 +927,8 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-
961
927
 
962
928
  function extend(ParentErrorClass, defaultMessage) {
963
929
  var ErrorClass = function (errors, message) {
964
- (0, _debug.assert)('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || []));
930
+ (false && _ember.default.assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || [])));
931
+
965
932
  ParentErrorClass.call(this, errors, message || defaultMessage);
966
933
  };
967
934
  ErrorClass.prototype = Object.create(ParentErrorClass.prototype);
@@ -1816,8 +1783,8 @@ define("ember-data/-private/system/diff-array", ["exports"], function (exports)
1816
1783
  exports.default = diffArray;
1817
1784
  /**
1818
1785
  @namespace
1819
- @method diff-array
1820
- @for DS
1786
+ @method diffArray
1787
+ @private
1821
1788
  @param {Array} oldArray the old array
1822
1789
  @param {Array} newArray the new array
1823
1790
  @return {hash} {
@@ -1926,7 +1893,7 @@ define('ember-data/-private/system/identity-map', ['exports', 'ember-data/-priva
1926
1893
 
1927
1894
  exports.default = IdentityMap;
1928
1895
  });
1929
- define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/-debug', 'ember-data/-private/system/model/internal-model'], function (exports, _debug, _internalModel) {
1896
+ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/-private/system/model/internal-model'], function (exports, _internalModel) {
1930
1897
  'use strict';
1931
1898
 
1932
1899
  exports.__esModule = true;
@@ -1980,16 +1947,18 @@ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/
1980
1947
  };
1981
1948
 
1982
1949
  InternalModelMap.prototype.set = function set(id, internalModel) {
1983
- (0, _debug.assert)('You cannot index an internalModel by an empty id\'', id);
1984
- (0, _debug.assert)('You cannot set an index for an internalModel to something other than an internalModel', internalModel instanceof _internalModel.default);
1985
- (0, _debug.assert)('You cannot set an index for an internalModel that is not in the InternalModelMap', this.contains(internalModel));
1986
- (0, _debug.assert)('You cannot update the id index of an InternalModel once set. Attempted to update ' + id + '.', !this.has(id) || this.get(id) === internalModel);
1950
+ (false && Ember.assert('You cannot index an internalModel by an empty id\'', id));
1951
+ (false && Ember.assert('You cannot set an index for an internalModel to something other than an internalModel', internalModel instanceof _internalModel.default));
1952
+ (false && Ember.assert('You cannot set an index for an internalModel that is not in the InternalModelMap', this.contains(internalModel)));
1953
+ (false && Ember.assert('You cannot update the id index of an InternalModel once set. Attempted to update ' + id + '.', !this.has(id) || this.get(id) === internalModel));
1954
+
1987
1955
 
1988
1956
  this._idToModel[id] = internalModel;
1989
1957
  };
1990
1958
 
1991
1959
  InternalModelMap.prototype.add = function add(internalModel, id) {
1992
- (0, _debug.assert)('You cannot re-add an already present InternalModel to the InternalModelMap.', !this.contains(internalModel));
1960
+ (false && Ember.assert('You cannot re-add an already present InternalModel to the InternalModelMap.', !this.contains(internalModel)));
1961
+
1993
1962
 
1994
1963
  if (id) {
1995
1964
  this._idToModel[id] = internalModel;
@@ -2036,10 +2005,11 @@ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/
2036
2005
  _createClass(InternalModelMap, [{
2037
2006
  key: 'idToRecord',
2038
2007
  get: function () {
2039
- (0, _debug.deprecate)('Use of InternalModelMap.idToRecord is deprecated, use InternalModelMap.get(id) instead.', false, {
2008
+ (false && !(false) && Ember.deprecate('Use of InternalModelMap.idToRecord is deprecated, use InternalModelMap.get(id) instead.', false, {
2040
2009
  id: 'ds.record-map.idToRecord',
2041
2010
  until: '2.13'
2042
- });
2011
+ }));
2012
+
2043
2013
  return this._idToModel;
2044
2014
  }
2045
2015
  }, {
@@ -2107,7 +2077,7 @@ define('ember-data/-private/system/is-array-like', ['exports', 'ember'], functio
2107
2077
  return false;
2108
2078
  }
2109
2079
  });
2110
- define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _ember, _debug, _promiseProxies, _common, _diffArray) {
2080
+ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _ember, _promiseProxies, _common, _diffArray) {
2111
2081
  'use strict';
2112
2082
 
2113
2083
  exports.__esModule = true;
@@ -2328,7 +2298,8 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
2328
2298
  var store = get(this, 'store');
2329
2299
  var type = get(this, 'type');
2330
2300
 
2331
- (0, _debug.assert)('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic'));
2301
+ (false && _ember.default.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic')));
2302
+
2332
2303
  var record = store.createRecord(type.modelName, hash);
2333
2304
  this.pushObject(record);
2334
2305
 
@@ -2336,7 +2307,7 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
2336
2307
  }
2337
2308
  });
2338
2309
  });
2339
- define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-data/-debug'], function (exports, _ember, _debug) {
2310
+ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function (exports, _ember) {
2340
2311
  'use strict';
2341
2312
 
2342
2313
  exports.__esModule = true;
@@ -2438,10 +2409,11 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2438
2409
  @deprecated
2439
2410
  */
2440
2411
  registerHandlers: function (target, becameInvalid, becameValid) {
2441
- (0, _debug.deprecate)('Record errors will no longer be evented.', false, {
2412
+ (false && !(false) && _ember.default.deprecate('Record errors will no longer be evented.', false, {
2442
2413
  id: 'ds.errors.registerHandlers',
2443
2414
  until: '3.0.0'
2444
- });
2415
+ }));
2416
+
2445
2417
 
2446
2418
  this._registerHandlers(target, becameInvalid, becameValid);
2447
2419
  },
@@ -2558,9 +2530,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2558
2530
  @deprecated
2559
2531
  */
2560
2532
  add: function (attribute, messages) {
2561
- (0, _debug.warn)('Interacting with a record errors object will no longer change the record state.', false, {
2533
+ (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
2562
2534
  id: 'ds.errors.add'
2563
- });
2535
+ }));
2536
+
2564
2537
 
2565
2538
  var wasEmpty = get(this, 'isEmpty');
2566
2539
 
@@ -2642,9 +2615,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2642
2615
  @deprecated
2643
2616
  */
2644
2617
  remove: function (attribute) {
2645
- (0, _debug.warn)('Interacting with a record errors object will no longer change the record state.', false, {
2618
+ (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
2646
2619
  id: 'ds.errors.remove'
2647
- });
2620
+ }));
2621
+
2648
2622
 
2649
2623
  if (get(this, 'isEmpty')) {
2650
2624
  return;
@@ -2695,9 +2669,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2695
2669
  @deprecated
2696
2670
  */
2697
2671
  clear: function () {
2698
- (0, _debug.warn)('Interacting with a record errors object will no longer change the record state.', false, {
2672
+ (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
2699
2673
  id: 'ds.errors.clear'
2700
- });
2674
+ }));
2675
+
2701
2676
 
2702
2677
  if (get(this, 'isEmpty')) {
2703
2678
  return;
@@ -2759,7 +2734,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2759
2734
  }
2760
2735
  });
2761
2736
  });
2762
- define('ember-data/-private/system/model/internal-model', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/state/create', 'ember-data/-private/system/snapshot', 'ember-data/-private/features', 'ember-data/-private/system/ordered-set', 'ember-data/-private/utils', 'ember-data/-private/system/references'], function (exports, _ember, _debug, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) {
2737
+ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/state/create', 'ember-data/-private/system/snapshot', 'ember-data/-private/features', 'ember-data/-private/system/ordered-set', 'ember-data/-private/utils', 'ember-data/-private/system/references'], function (exports, _ember, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) {
2763
2738
  'use strict';
2764
2739
 
2765
2740
  exports.__esModule = true;
@@ -2836,14 +2811,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
2836
2811
  return true;
2837
2812
  }
2838
2813
 
2839
- function destroyRelationship(rel) {
2840
- if (rel._inverseIsAsync()) {
2841
- rel.removeInternalModelFromInverse(rel.inverseInternalModel);
2842
- rel.removeInverseRelationships();
2843
- } else {
2844
- rel.removeCompletelyFromInverse();
2845
- }
2846
- }
2847
2814
  // this (and all heimdall instrumentation) will be stripped by a babel transform
2848
2815
  // https://github.com/heimdalljs/babel5-plugin-strip-heimdall
2849
2816
 
@@ -3060,9 +3027,17 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3060
3027
  };
3061
3028
 
3062
3029
  InternalModel.prototype._directlyRelatedInternalModels = function _directlyRelatedInternalModels() {
3030
+ var _this = this;
3031
+
3063
3032
  var array = [];
3064
- this._relationships.forEach(function (name, rel) {
3065
- array = array.concat(rel.members.list, rel.canonicalMembers.list);
3033
+ this.type.eachRelationship(function (key, relationship) {
3034
+ if (_this._relationships.has(key)) {
3035
+ var _relationship = _this._relationships.get(key);
3036
+ var localRelationships = _relationship.members.toArray();
3037
+ var serverRelationships = _relationship.canonicalMembers.toArray();
3038
+
3039
+ array = array.concat(localRelationships, serverRelationships);
3040
+ }
3066
3041
  });
3067
3042
  return array;
3068
3043
  };
@@ -3079,7 +3054,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3079
3054
  var related = node._directlyRelatedInternalModels();
3080
3055
  for (var i = 0; i < related.length; ++i) {
3081
3056
  var internalModel = related[i];
3082
- (0, _debug.assert)('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId);
3057
+ (false && _ember.default.assert('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId));
3058
+
3083
3059
  if (internalModel._bfsId < bfsId) {
3084
3060
  queue.push(internalModel);
3085
3061
  internalModel._bfsId = bfsId;
@@ -3090,43 +3066,22 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3090
3066
  };
3091
3067
 
3092
3068
  InternalModel.prototype.unloadRecord = function unloadRecord() {
3093
- if (this.isDestroyed) {
3094
- return;
3095
- }
3096
3069
  this.send('unloadRecord');
3097
3070
  this.dematerializeRecord();
3098
-
3099
3071
  if (this._scheduledDestroy === null) {
3100
3072
  this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
3101
3073
  }
3102
3074
  };
3103
3075
 
3104
- InternalModel.prototype.hasScheduledDestroy = function hasScheduledDestroy() {
3105
- return !!this._scheduledDestroy;
3106
- };
3107
-
3108
3076
  InternalModel.prototype.cancelDestroy = function cancelDestroy() {
3109
- (0, _debug.assert)('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed);
3077
+ (false && _ember.default.assert('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed));
3078
+
3110
3079
 
3111
3080
  this._isDematerializing = false;
3112
3081
  run.cancel(this._scheduledDestroy);
3113
3082
  this._scheduledDestroy = null;
3114
3083
  };
3115
3084
 
3116
- InternalModel.prototype.destroySync = function destroySync() {
3117
- if (this._isDematerializing) {
3118
- this.cancelDestroy();
3119
- }
3120
- this._checkForOrphanedInternalModels();
3121
- if (this.isDestroyed || this.isDestroying) {
3122
- return;
3123
- }
3124
-
3125
- // just in-case we are not one of the orphaned, we should still
3126
- // still destroy ourselves
3127
- this.destroy();
3128
- };
3129
-
3130
3085
  InternalModel.prototype._checkForOrphanedInternalModels = function _checkForOrphanedInternalModels() {
3131
3086
  this._isDematerializing = false;
3132
3087
  this._scheduledDestroy = null;
@@ -3154,14 +3109,10 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3154
3109
  };
3155
3110
 
3156
3111
  InternalModel.prototype.destroy = function destroy() {
3157
- (0, _debug.assert)("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying'));
3158
-
3159
- this.store._internalModelDestroyed(this);
3112
+ (false && _ember.default.assert("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying')));
3160
3113
 
3161
- this._relationships.forEach(function (name, rel) {
3162
- return rel.destroy();
3163
- });
3164
3114
 
3115
+ this.store._internalModelDestroyed(this);
3165
3116
  this._isDestroyed = true;
3166
3117
  };
3167
3118
 
@@ -3290,6 +3241,12 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3290
3241
  }
3291
3242
  };
3292
3243
 
3244
+ InternalModel.prototype.notifyHasManyRemoved = function notifyHasManyRemoved(key, record, idx) {
3245
+ if (this.hasRecord) {
3246
+ this._record.notifyHasManyRemoved(key, record, idx);
3247
+ }
3248
+ };
3249
+
3293
3250
  InternalModel.prototype.notifyBelongsToChanged = function notifyBelongsToChanged(key, record) {
3294
3251
  if (this.hasRecord) {
3295
3252
  this._record.notifyBelongsToChanged(key, record);
@@ -3323,7 +3280,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3323
3280
  }
3324
3281
 
3325
3282
  if (this.isNew()) {
3326
- this.removeFromInverseRelationships(true);
3283
+ this.clearRelationships();
3327
3284
  }
3328
3285
 
3329
3286
  if (this.isValid()) {
@@ -3439,57 +3396,47 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3439
3396
  triggers.length = 0;
3440
3397
  };
3441
3398
 
3442
- InternalModel.prototype.removeFromInverseRelationships = function removeFromInverseRelationships() {
3443
- var isNew = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3399
+ InternalModel.prototype.clearRelationships = function clearRelationships() {
3400
+ var _this2 = this;
3444
3401
 
3445
- this._relationships.forEach(function (name, rel) {
3446
- rel.removeCompletelyFromInverse();
3447
- if (isNew === true) {
3402
+ this.eachRelationship(function (name, relationship) {
3403
+ if (_this2._relationships.has(name)) {
3404
+ var rel = _this2._relationships.get(name);
3448
3405
  rel.clear();
3406
+ rel.removeInverseRelationships();
3449
3407
  }
3450
3408
  });
3451
-
3452
- var implicitRelationships = this._implicitRelationships;
3453
- this.__implicitRelationships = null;
3454
-
3455
- Object.keys(implicitRelationships).forEach(function (key) {
3456
- var rel = implicitRelationships[key];
3457
-
3458
- rel.removeCompletelyFromInverse();
3459
- if (isNew === true) {
3460
- rel.clear();
3461
- }
3409
+ Object.keys(this._implicitRelationships).forEach(function (key) {
3410
+ _this2._implicitRelationships[key].clear();
3411
+ _this2._implicitRelationships[key].removeInverseRelationships();
3462
3412
  });
3463
3413
  };
3464
3414
 
3465
3415
  InternalModel.prototype.destroyRelationships = function destroyRelationships() {
3466
- var relationships = this._relationships;
3467
- relationships.forEach(function (name, rel) {
3468
- return destroyRelationship(rel);
3469
- });
3470
-
3471
- var implicitRelationships = this._implicitRelationships;
3472
- this.__implicitRelationships = null;
3473
- Object.keys(implicitRelationships).forEach(function (key) {
3474
- var rel = implicitRelationships[key];
3475
-
3476
- destroyRelationship(rel);
3416
+ var _this3 = this;
3477
3417
 
3478
- rel.destroy();
3418
+ this.eachRelationship(function (name, relationship) {
3419
+ if (_this3._relationships.has(name)) {
3420
+ var rel = _this3._relationships.get(name);
3421
+ rel.removeInverseRelationships();
3422
+ }
3423
+ });
3424
+ Object.keys(this._implicitRelationships).forEach(function (key) {
3425
+ _this3._implicitRelationships[key].removeInverseRelationships();
3479
3426
  });
3480
3427
  };
3481
3428
 
3482
3429
  InternalModel.prototype.preloadData = function preloadData(preload) {
3483
- var _this = this;
3430
+ var _this4 = this;
3484
3431
 
3485
3432
  //TODO(Igor) consider the polymorphic case
3486
3433
  Object.keys(preload).forEach(function (key) {
3487
3434
  var preloadValue = get(preload, key);
3488
- var relationshipMeta = _this.modelClass.metaForProperty(key);
3435
+ var relationshipMeta = _this4.modelClass.metaForProperty(key);
3489
3436
  if (relationshipMeta.isRelationship) {
3490
- _this._preloadRelationship(key, preloadValue);
3437
+ _this4._preloadRelationship(key, preloadValue);
3491
3438
  } else {
3492
- _this._data[key] = preloadValue;
3439
+ _this4._data[key] = preloadValue;
3493
3440
  }
3494
3441
  });
3495
3442
  };
@@ -3505,7 +3452,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3505
3452
  };
3506
3453
 
3507
3454
  InternalModel.prototype._preloadHasMany = function _preloadHasMany(key, preloadValue, modelClass) {
3508
- (0, _debug.assert)("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue));
3455
+ (false && _ember.default.assert("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue)));
3456
+
3509
3457
  var recordsToSet = new Array(preloadValue.length);
3510
3458
 
3511
3459
  for (var i = 0; i < preloadValue.length; i++) {
@@ -3541,7 +3489,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3541
3489
  };
3542
3490
 
3543
3491
  InternalModel.prototype.setId = function setId(id) {
3544
- (0, _debug.assert)('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew());
3492
+ (false && _ember.default.assert('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew()));
3493
+
3545
3494
  this.id = id;
3546
3495
  if (this._record.get('id') !== id) {
3547
3496
  this._record.set('id', id);
@@ -3695,20 +3644,19 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3695
3644
  };
3696
3645
 
3697
3646
  InternalModel.prototype.referenceFor = function referenceFor(kind, name) {
3698
- var _this2 = this;
3699
-
3700
3647
  var reference = this.references[name];
3701
3648
 
3702
3649
  if (!reference) {
3703
3650
  var relationship = this._relationships.get(name);
3704
3651
 
3705
- (0, _debug.runInDebug)(function () {
3706
- var modelName = _this2.modelName;
3707
- (0, _debug.assert)('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship);
3652
+ if (false) {
3653
+ var modelName = this.modelName;
3654
+ (false && _ember.default.assert('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship));
3655
+
3708
3656
 
3709
3657
  var actualRelationshipKind = relationship.relationshipMeta.kind;
3710
- (0, _debug.assert)('You tried to get the \'' + name + '\' relationship on a \'' + modelName + '\' via record.' + kind + '(\'' + name + '\'), but the relationship is of kind \'' + actualRelationshipKind + '\'. Use record.' + actualRelationshipKind + '(\'' + name + '\') instead.', actualRelationshipKind === kind);
3711
- });
3658
+ (false && _ember.default.assert('You tried to get the \'' + name + '\' relationship on a \'' + modelName + '\' via record.' + kind + '(\'' + name + '\'), but the relationship is of kind \'' + actualRelationshipKind + '\'. Use record.' + actualRelationshipKind + '(\'' + name + '\') instead.', actualRelationshipKind === kind));
3659
+ }
3712
3660
 
3713
3661
  if (kind === "belongsTo") {
3714
3662
  reference = new _references.BelongsToReference(this.store, this, relationship);
@@ -3848,7 +3796,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3848
3796
  };
3849
3797
  }
3850
3798
  });
3851
- define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/model/errors', 'ember-data/-private/features', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/ext'], function (exports, _ember, _debug, _promiseProxies, _errors, _features, _states, _ext) {
3799
+ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/model/errors', 'ember-data/-private/features', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/ext'], function (exports, _ember, _promiseProxies, _errors, _features, _states, _ext) {
3852
3800
  'use strict';
3853
3801
 
3854
3802
  exports.__esModule = true;
@@ -4344,7 +4292,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4344
4292
  this._super.apply(this, arguments);
4345
4293
  },
4346
4294
  attr: function () {
4347
- (0, _debug.assert)("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
4295
+ (false && _ember.default.assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false));
4348
4296
  },
4349
4297
  belongsTo: function (name) {
4350
4298
  return this._internalModel.referenceFor('belongsTo', name);
@@ -4439,7 +4387,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4439
4387
  }
4440
4388
  });
4441
4389
 
4442
- (0, _debug.runInDebug)(function () {
4390
+ if (false) {
4443
4391
  Model.reopen({
4444
4392
  init: function () {
4445
4393
  this._super.apply(this, arguments);
@@ -4449,7 +4397,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4449
4397
  }
4450
4398
  }
4451
4399
  });
4452
- });
4400
+ }
4453
4401
 
4454
4402
  Model.reopenClass({
4455
4403
  isModel: true,
@@ -4544,15 +4492,16 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4544
4492
  inverseName = options.inverse;
4545
4493
  inverse = _ember.default.get(inverseType, 'relationshipsByName').get(inverseName);
4546
4494
 
4547
- (0, _debug.assert)("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !_ember.default.isNone(inverse));
4495
+ (false && _ember.default.assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !_ember.default.isNone(inverse)));
4496
+
4548
4497
 
4549
4498
  inverseKind = inverse.kind;
4550
4499
  } else {
4551
4500
  //No inverse was specified manually, we need to use a heuristic to guess one
4552
4501
  if (propertyMeta.parentType && propertyMeta.type === propertyMeta.parentType.modelName) {
4553
- (0, _debug.warn)('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at http://emberjs.com/guides/models/defining-models/#toc_reflexive-relation for how to explicitly specify inverses.', false, {
4502
+ (false && _ember.default.warn('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at http://emberjs.com/guides/models/defining-models/#toc_reflexive-relation for how to explicitly specify inverses.', false, {
4554
4503
  id: 'ds.model.reflexive-relationship-without-inverse'
4555
- });
4504
+ }));
4556
4505
  }
4557
4506
 
4558
4507
  var possibleRelationships = findPossibleInverses(this, inverseType, name);
@@ -4566,13 +4515,15 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4566
4515
  return name === optionsForRelationship.inverse;
4567
4516
  });
4568
4517
 
4569
- (0, _debug.assert)("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2);
4518
+ (false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2));
4519
+
4570
4520
 
4571
4521
  if (filteredRelationships.length === 1) {
4572
4522
  possibleRelationships = filteredRelationships;
4573
4523
  }
4574
4524
 
4575
- (0, _debug.assert)("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1);
4525
+ (false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1));
4526
+
4576
4527
 
4577
4528
  inverseName = possibleRelationships[0].name;
4578
4529
  inverseKind = possibleRelationships[0].kind;
@@ -4839,7 +4790,8 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4839
4790
 
4840
4791
  this.eachComputedProperty(function (name, meta) {
4841
4792
  if (meta.isAttribute) {
4842
- (0, _debug.assert)("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this3.toString(), name !== 'id');
4793
+ (false && _ember.default.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this3.toString(), name !== 'id'));
4794
+
4843
4795
 
4844
4796
  meta.name = name;
4845
4797
  map.set(name, meta);
@@ -4913,7 +4865,8 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4913
4865
  configurable: true,
4914
4866
  enumerable: false,
4915
4867
  get: function () {
4916
- (0, _debug.deprecate)('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0' });
4868
+ (false && !(false) && _ember.default.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0' }));
4869
+
4917
4870
 
4918
4871
  return this.store.container;
4919
4872
  }
@@ -4930,12 +4883,12 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4930
4883
  });
4931
4884
  }
4932
4885
 
4933
- (0, _debug.runInDebug)(function () {
4886
+ if (false) {
4934
4887
  Model.reopen({
4935
4888
  willMergeMixin: function (props) {
4936
4889
  var constructor = this.constructor;
4937
- (0, _debug.assert)('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0]);
4938
- (0, _debug.assert)("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + constructor.toString(), Object.keys(props).indexOf('id') === -1);
4890
+ (false && _ember.default.assert('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0]));
4891
+ (false && _ember.default.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + constructor.toString(), Object.keys(props).indexOf('id') === -1));
4939
4892
  },
4940
4893
  didDefineProperty: function (proto, key, value) {
4941
4894
  // Check if the value being set is a computed property.
@@ -4950,11 +4903,11 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
4950
4903
  }
4951
4904
  }
4952
4905
  });
4953
- });
4906
+ }
4954
4907
 
4955
4908
  exports.default = Model;
4956
4909
  });
4957
- define('ember-data/-private/system/model/states', ['exports', 'ember-data/-debug'], function (exports, _debug) {
4910
+ define('ember-data/-private/system/model/states', ['exports'], function (exports) {
4958
4911
  'use strict';
4959
4912
 
4960
4913
  exports.__esModule = true;
@@ -5371,7 +5324,7 @@ define('ember-data/-private/system/model/states', ['exports', 'ember-data/-debug
5371
5324
  createdState.uncommitted.propertyWasReset = function () {};
5372
5325
 
5373
5326
  function assertAgainstUnloadRecord(internalModel) {
5374
- (0, _debug.assert)("You can only unload a record which is not inFlight. `" + internalModel + "`", false);
5327
+ (false && Ember.assert("You can only unload a record which is not inFlight. `" + internalModel + "`", false));
5375
5328
  }
5376
5329
 
5377
5330
  updatedState.inFlight.unloadRecord = assertAgainstUnloadRecord;
@@ -5578,7 +5531,7 @@ define('ember-data/-private/system/model/states', ['exports', 'ember-data/-debug
5578
5531
  isDirty: false,
5579
5532
 
5580
5533
  setup: function (internalModel) {
5581
- internalModel.removeFromInverseRelationships();
5534
+ internalModel.clearRelationships();
5582
5535
  },
5583
5536
  invokeLifecycleCallbacks: function (internalModel) {
5584
5537
  internalModel.triggerLater('didDelete', internalModel);
@@ -5742,7 +5695,7 @@ define('ember-data/-private/system/ordered-set', ['exports', 'ember'], function
5742
5695
  return this;
5743
5696
  };
5744
5697
  });
5745
- define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember-data/-debug'], function (exports, _ember, _debug) {
5698
+ define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], function (exports, _ember) {
5746
5699
  'use strict';
5747
5700
 
5748
5701
  exports.__esModule = true;
@@ -5857,7 +5810,8 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember
5857
5810
 
5858
5811
  var PromiseManyArray = exports.PromiseManyArray = PromiseArray.extend({
5859
5812
  reload: function () {
5860
- (0, _debug.assert)('You are trying to reload an async manyArray before it has been created', get(this, 'content'));
5813
+ (false && _ember.default.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content')));
5814
+
5861
5815
  this.set('promise', this.get('content').reload());
5862
5816
  return this;
5863
5817
  },
@@ -5882,10 +5836,11 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember
5882
5836
  });
5883
5837
  }
5884
5838
  });
5885
- define('ember-data/-private/system/record-array-manager', ['exports', 'ember', 'ember-data/-private/system/record-arrays', 'ember-data/-debug'], function (exports, _ember, _recordArrays, _debug) {
5886
- 'use strict';
5839
+ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "ember-data/-private/system/record-arrays", "ember-data/-private/system/clone-null"], function (exports, _ember, _recordArrays, _cloneNull) {
5840
+ "use strict";
5887
5841
 
5888
5842
  exports.__esModule = true;
5843
+ exports.associateWithRecordArray = associateWithRecordArray;
5889
5844
 
5890
5845
  function _classCallCheck(instance, Constructor) {
5891
5846
  if (!(instance instanceof Constructor)) {
@@ -5894,6 +5849,7 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
5894
5849
  }
5895
5850
 
5896
5851
  var get = _ember.default.get,
5852
+ set = _ember.default.set,
5897
5853
  emberRun = _ember.default.run;
5898
5854
 
5899
5855
  var RecordArrayManager = function () {
@@ -5967,63 +5923,22 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
5967
5923
  }
5968
5924
  }
5969
5925
 
5970
- // TODO: skip if it only changed
5971
- // process liveRecordArrays
5972
- if (this._liveRecordArrays[modelName]) {
5973
- this.updateLiveRecordArray(modelName, internalModels);
5926
+ var array = this._liveRecordArrays[modelName];
5927
+ if (array) {
5928
+ // TODO: skip if it only changed
5929
+ // process liveRecordArrays
5930
+ this.updateLiveRecordArray(array, internalModels);
5974
5931
  }
5975
5932
 
5976
5933
  // process adapterPopulatedRecordArrays
5977
5934
  if (modelsToRemove.length > 0) {
5978
- this.removeFromAdapterPopulatedRecordArrays(modelsToRemove);
5979
- }
5980
- }
5981
- };
5982
-
5983
- RecordArrayManager.prototype.updateLiveRecordArray = function updateLiveRecordArray(modelName, internalModels) {
5984
- var array = this.liveRecordArrayFor(modelName);
5985
-
5986
- var modelsToAdd = [];
5987
- var modelsToRemove = [];
5988
-
5989
- for (var i = 0; i < internalModels.length; i++) {
5990
- var internalModel = internalModels[i];
5991
- var isDeleted = internalModel.isHiddenFromRecordArrays();
5992
- var recordArrays = internalModel._recordArrays;
5993
-
5994
- if (!isDeleted && !internalModel.isEmpty()) {
5995
- if (!recordArrays.has(array)) {
5996
- modelsToAdd.push(internalModel);
5997
- recordArrays.add(array);
5998
- }
5999
- }
6000
-
6001
- if (isDeleted) {
6002
- modelsToRemove.push(internalModel);
6003
- recordArrays.delete(array);
5935
+ removeFromAdapterPopulatedRecordArrays(modelsToRemove);
6004
5936
  }
6005
5937
  }
6006
-
6007
- if (modelsToAdd.length > 0) {
6008
- array._pushInternalModels(modelsToAdd);
6009
- }
6010
- if (modelsToRemove.length > 0) {
6011
- array._removeInternalModels(modelsToRemove);
6012
- }
6013
5938
  };
6014
5939
 
6015
- RecordArrayManager.prototype.removeFromAdapterPopulatedRecordArrays = function removeFromAdapterPopulatedRecordArrays(internalModels) {
6016
- for (var i = 0; i < internalModels.length; i++) {
6017
- var internalModel = internalModels[i];
6018
- var list = internalModel._recordArrays.list;
6019
-
6020
- for (var j = 0; j < list.length; j++) {
6021
- // TODO: group by arrays, so we can batch remove
6022
- list[j]._removeInternalModels([internalModel]);
6023
- }
6024
-
6025
- internalModel._recordArrays.clear();
6026
- }
5940
+ RecordArrayManager.prototype.updateLiveRecordArray = function updateLiveRecordArray(array, internalModels) {
5941
+ return _updateLiveRecordArray(array, internalModels);
6027
5942
  };
6028
5943
 
6029
5944
  RecordArrayManager.prototype.updateFilterRecordArray = function updateFilterRecordArray(array, modelName, internalModels) {
@@ -6056,8 +5971,9 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6056
5971
  }
6057
5972
  };
6058
5973
 
6059
- RecordArrayManager.prototype.syncLiveRecordArray = function syncLiveRecordArray(array, modelName) {
6060
- (0, _debug.assert)('recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param', typeof modelName === 'string');
5974
+ RecordArrayManager.prototype._syncLiveRecordArray = function _syncLiveRecordArray(array, modelName) {
5975
+ (false && _ember.default.assert("recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param", typeof modelName === 'string'));
5976
+
6061
5977
  var hasNoPotentialDeletions = Object.keys(this._pending).length === 0;
6062
5978
  var map = this.store._internalModelsFor(modelName);
6063
5979
  var hasNoInsertionsOrRemovals = get(map, 'length') === get(array, 'length');
@@ -6067,27 +5983,19 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6067
5983
  liveRecordArrays, and is capable of strategically flushing those changes and applying
6068
5984
  small diffs if desired. However, until we've refactored recordArrayManager, this dirty
6069
5985
  check prevents us from unnecessarily wiping out live record arrays returned by peekAll.
6070
- */
5986
+ */
6071
5987
  if (hasNoPotentialDeletions && hasNoInsertionsOrRemovals) {
6072
5988
  return;
6073
5989
  }
6074
5990
 
6075
- this.populateLiveRecordArray(array, map.models);
6076
- };
6077
-
6078
- RecordArrayManager.prototype.populateLiveRecordArray = function populateLiveRecordArray(array, internalModels) {
6079
-
5991
+ var internalModels = this._visibleInternalModelsByType(modelName);
6080
5992
  var modelsToAdd = [];
6081
5993
  for (var i = 0; i < internalModels.length; i++) {
6082
5994
  var internalModel = internalModels[i];
6083
-
6084
- if (!internalModel.isHiddenFromRecordArrays()) {
6085
- var recordArrays = internalModel._recordArrays;
6086
-
6087
- if (!recordArrays.has(array)) {
6088
- modelsToAdd.push(internalModel);
6089
- recordArrays.add(array);
6090
- }
5995
+ var recordArrays = internalModel._recordArrays;
5996
+ if (recordArrays.has(array) === false) {
5997
+ recordArrays.add(array);
5998
+ modelsToAdd.push(internalModel);
6091
5999
  }
6092
6000
  }
6093
6001
 
@@ -6095,7 +6003,7 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6095
6003
  };
6096
6004
 
6097
6005
  RecordArrayManager.prototype.updateFilter = function updateFilter(array, modelName, filter) {
6098
- (0, _debug.assert)('recordArrayManger.updateFilter expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string');
6006
+ (false && _ember.default.assert("recordArrayManger.updateFilter expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string'));
6099
6007
 
6100
6008
  var modelMap = this.store._internalModelsFor(modelName);
6101
6009
  var internalModels = modelMap.models;
@@ -6103,32 +6011,73 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6103
6011
  this.updateFilterRecordArray(array, filter, internalModels);
6104
6012
  };
6105
6013
 
6014
+ RecordArrayManager.prototype._didUpdateAll = function _didUpdateAll(modelName) {
6015
+ var recordArray = this._liveRecordArrays[modelName];
6016
+ if (recordArray) {
6017
+ set(recordArray, 'isUpdating', false);
6018
+ }
6019
+ };
6020
+
6106
6021
  RecordArrayManager.prototype.liveRecordArrayFor = function liveRecordArrayFor(modelName) {
6107
- (0, _debug.assert)('recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param', typeof modelName === 'string');
6022
+ (false && _ember.default.assert("recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param", typeof modelName === 'string'));
6023
+
6024
+
6025
+ var array = this._liveRecordArrays[modelName];
6026
+
6027
+ if (array) {
6028
+ // if the array already exists, synchronize
6029
+ this._syncLiveRecordArray(array, modelName);
6030
+ } else {
6031
+ // if the array is being newly created merely create it with its initial
6032
+ // content already set. This prevents unneeded change events.
6033
+ var internalModels = this._visibleInternalModelsByType(modelName);
6034
+ array = this.createRecordArray(modelName, internalModels);
6035
+ this._liveRecordArrays[modelName] = array;
6036
+ }
6037
+
6038
+ return array;
6039
+ };
6108
6040
 
6109
- return this._liveRecordArrays[modelName] || (this._liveRecordArrays[modelName] = this.createRecordArray(modelName));
6041
+ RecordArrayManager.prototype._visibleInternalModelsByType = function _visibleInternalModelsByType(modelName) {
6042
+ var all = this.store._internalModelsFor(modelName)._models;
6043
+ var visible = [];
6044
+ for (var i = 0; i < all.length; i++) {
6045
+ var model = all[i];
6046
+ if (model.isHiddenFromRecordArrays() === false) {
6047
+ visible.push(model);
6048
+ }
6049
+ }
6050
+ return visible;
6110
6051
  };
6111
6052
 
6112
6053
  RecordArrayManager.prototype.filteredRecordArraysFor = function filteredRecordArraysFor(modelName) {
6113
- (0, _debug.assert)('recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param', typeof modelName === 'string');
6054
+ (false && _ember.default.assert("recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param", typeof modelName === 'string'));
6055
+
6114
6056
 
6115
6057
  return this._filteredRecordArrays[modelName] || (this._filteredRecordArrays[modelName] = []);
6116
6058
  };
6117
6059
 
6118
- RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName) {
6119
- (0, _debug.assert)('recordArrayManger.createRecordArray expects modelName not modelClass as the param', typeof modelName === 'string');
6060
+ RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName, content) {
6061
+ (false && _ember.default.assert("recordArrayManger.createRecordArray expects modelName not modelClass as the param", typeof modelName === 'string'));
6120
6062
 
6121
- return _recordArrays.RecordArray.create({
6063
+
6064
+ var array = _recordArrays.RecordArray.create({
6122
6065
  modelName: modelName,
6123
- content: _ember.default.A(),
6066
+ content: _ember.default.A(content || []),
6124
6067
  store: this.store,
6125
6068
  isLoaded: true,
6126
6069
  manager: this
6127
6070
  });
6071
+
6072
+ if (Array.isArray(content)) {
6073
+ associateWithRecordArray(content, array);
6074
+ }
6075
+
6076
+ return array;
6128
6077
  };
6129
6078
 
6130
6079
  RecordArrayManager.prototype.createFilteredRecordArray = function createFilteredRecordArray(modelName, filter, query) {
6131
- (0, _debug.assert)('recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string');
6080
+ (false && _ember.default.assert("recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string'));
6132
6081
 
6133
6082
  var array = _recordArrays.FilteredRecordArray.create({
6134
6083
  query: query,
@@ -6144,16 +6093,34 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6144
6093
  return array;
6145
6094
  };
6146
6095
 
6147
- RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query) {
6148
- (0, _debug.assert)('recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string');
6096
+ RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query, internalModels, payload) {
6097
+ (false && _ember.default.assert("recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string'));
6149
6098
 
6150
- var array = _recordArrays.AdapterPopulatedRecordArray.create({
6151
- modelName: modelName,
6152
- query: query,
6153
- content: _ember.default.A(),
6154
- store: this.store,
6155
- manager: this
6156
- });
6099
+
6100
+ var array = void 0;
6101
+ if (Array.isArray(internalModels)) {
6102
+ array = _recordArrays.AdapterPopulatedRecordArray.create({
6103
+ modelName: modelName,
6104
+ query: query,
6105
+ content: _ember.default.A(internalModels),
6106
+ store: this.store,
6107
+ manager: this,
6108
+ isLoaded: true,
6109
+ isUpdating: false,
6110
+ meta: (0, _cloneNull.default)(payload.meta),
6111
+ links: (0, _cloneNull.default)(payload.links)
6112
+ });
6113
+
6114
+ associateWithRecordArray(internalModels, array);
6115
+ } else {
6116
+ array = _recordArrays.AdapterPopulatedRecordArray.create({
6117
+ modelName: modelName,
6118
+ query: query,
6119
+ content: _ember.default.A(),
6120
+ store: this.store,
6121
+ manager: this
6122
+ });
6123
+ }
6157
6124
 
6158
6125
  this._adapterPopulatedRecordArrays.push(array);
6159
6126
 
@@ -6161,7 +6128,8 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6161
6128
  };
6162
6129
 
6163
6130
  RecordArrayManager.prototype.registerFilteredRecordArray = function registerFilteredRecordArray(array, modelName, filter) {
6164
- (0, _debug.assert)('recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string');
6131
+ (false && _ember.default.assert("recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string'));
6132
+
6165
6133
 
6166
6134
  this.filteredRecordArraysFor(modelName).push(array);
6167
6135
  this.updateFilter(array, modelName, filter);
@@ -6239,6 +6207,57 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
6239
6207
 
6240
6208
  return false;
6241
6209
  }
6210
+
6211
+ function _updateLiveRecordArray(array, internalModels) {
6212
+ var modelsToAdd = [];
6213
+ var modelsToRemove = [];
6214
+
6215
+ for (var i = 0; i < internalModels.length; i++) {
6216
+ var internalModel = internalModels[i];
6217
+ var isDeleted = internalModel.isHiddenFromRecordArrays();
6218
+ var recordArrays = internalModel._recordArrays;
6219
+
6220
+ if (!isDeleted && !internalModel.isEmpty()) {
6221
+ if (!recordArrays.has(array)) {
6222
+ modelsToAdd.push(internalModel);
6223
+ recordArrays.add(array);
6224
+ }
6225
+ }
6226
+
6227
+ if (isDeleted) {
6228
+ modelsToRemove.push(internalModel);
6229
+ recordArrays.delete(array);
6230
+ }
6231
+ }
6232
+
6233
+ if (modelsToAdd.length > 0) {
6234
+ array._pushInternalModels(modelsToAdd);
6235
+ }
6236
+ if (modelsToRemove.length > 0) {
6237
+ array._removeInternalModels(modelsToRemove);
6238
+ }
6239
+ }
6240
+
6241
+ function removeFromAdapterPopulatedRecordArrays(internalModels) {
6242
+ for (var i = 0; i < internalModels.length; i++) {
6243
+ var internalModel = internalModels[i];
6244
+ var list = internalModel._recordArrays.list;
6245
+
6246
+ for (var j = 0; j < list.length; j++) {
6247
+ // TODO: group by arrays, so we can batch remove
6248
+ list[j]._removeInternalModels([internalModel]);
6249
+ }
6250
+
6251
+ internalModel._recordArrays.clear();
6252
+ }
6253
+ }
6254
+
6255
+ function associateWithRecordArray(internalModels, array) {
6256
+ for (var i = 0, l = internalModels.length; i < l; i++) {
6257
+ var internalModel = internalModels[i];
6258
+ internalModel._recordArrays.add(array);
6259
+ }
6260
+ }
6242
6261
  });
6243
6262
  define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/record-arrays/filtered-record-array", "ember-data/-private/system/record-arrays/adapter-populated-record-array"], function (exports, _recordArray, _filteredRecordArray, _adapterPopulatedRecordArray) {
6244
6263
  "use strict";
@@ -6249,7 +6268,7 @@ define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-priv
6249
6268
  exports.FilteredRecordArray = _filteredRecordArray.default;
6250
6269
  exports.AdapterPopulatedRecordArray = _adapterPopulatedRecordArray.default;
6251
6270
  });
6252
- define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null"], function (exports, _ember, _recordArray, _cloneNull) {
6271
+ define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null", "ember-data/-private/system/record-array-manager"], function (exports, _ember, _recordArray, _cloneNull, _recordArrayManager) {
6253
6272
  "use strict";
6254
6273
 
6255
6274
  exports.__esModule = true;
@@ -6294,11 +6313,7 @@ define("ember-data/-private/system/record-arrays/adapter-populated-record-array"
6294
6313
  links: (0, _cloneNull.default)(payload.links)
6295
6314
  });
6296
6315
 
6297
- for (var i = 0, l = internalModels.length; i < l; i++) {
6298
- var internalModel = internalModels[i];
6299
-
6300
- internalModel._recordArrays.add(this);
6301
- }
6316
+ (0, _recordArrayManager.associateWithRecordArray)(internalModels, this);
6302
6317
 
6303
6318
  // TODO: should triggering didLoad event be the last action of the runLoop?
6304
6319
  _ember.default.run.once(this, 'trigger', 'didLoad');
@@ -6798,7 +6813,7 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
6798
6813
  ```
6799
6814
 
6800
6815
  @method meta
6801
- @return {Object} The meta information for the belongs-oo relationship.
6816
+ @return {Object} The meta information for the belongs-to relationship.
6802
6817
  */
6803
6818
  BelongsToReference.prototype.meta = function () {
6804
6819
  return this.belongsToRelationship.meta;
@@ -6856,10 +6871,10 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
6856
6871
 
6857
6872
  if (data instanceof _model.default) {
6858
6873
  if ((0, _features.default)('ds-overhaul-references')) {
6859
- (0, _debug.deprecate)("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, {
6874
+ (false && !(false) && _ember.default.deprecate("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, {
6860
6875
  id: 'ds.references.belongs-to.push-record',
6861
6876
  until: '3.0'
6862
- });
6877
+ }));
6863
6878
  }
6864
6879
  record = data;
6865
6880
  } else {
@@ -7168,7 +7183,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7168
7183
  commentsRef.ids(); // ['1']
7169
7184
  ```
7170
7185
 
7171
- @method remoteType
7186
+ @method ids
7172
7187
  @return {Array} The ids in this has-many relationship
7173
7188
  */
7174
7189
  HasManyReference.prototype.ids = function () {
@@ -7180,8 +7195,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7180
7195
  };
7181
7196
 
7182
7197
  /**
7183
- The link Ember Data will use to fetch or reload this has-many
7184
- relationship.
7198
+ The meta data for the has-many relationship.
7185
7199
 
7186
7200
  Example
7187
7201
 
@@ -7272,10 +7286,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7272
7286
  var array = payload;
7273
7287
 
7274
7288
  if ((0, _features.default)("ds-overhaul-references")) {
7275
- (0, _debug.deprecate)("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), {
7289
+ (false && !(!Array.isArray(payload)) && _ember.default.deprecate("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), {
7276
7290
  id: 'ds.references.has-many.push-array',
7277
7291
  until: '3.0'
7278
- });
7292
+ }));
7279
7293
  }
7280
7294
 
7281
7295
  var useLegacyArrayPush = true;
@@ -7284,10 +7298,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7284
7298
  useLegacyArrayPush = array.length && array[0].data;
7285
7299
 
7286
7300
  if ((0, _features.default)('ds-overhaul-references')) {
7287
- (0, _debug.deprecate)("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, {
7301
+ (false && !(!useLegacyArrayPush) && _ember.default.deprecate("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, {
7288
7302
  id: 'ds.references.has-many.push-invalid-json-api',
7289
7303
  until: '3.0'
7290
- });
7304
+ }));
7291
7305
  }
7292
7306
  }
7293
7307
 
@@ -7300,10 +7314,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7300
7314
  internalModels = array.map(function (obj) {
7301
7315
  var record = _this.store.push(obj);
7302
7316
 
7303
- (0, _debug.runInDebug)(function () {
7317
+ if (false) {
7304
7318
  var relationshipMeta = _this.hasManyRelationship.relationshipMeta;
7305
7319
  (0, _debug.assertPolymorphicType)(_this.internalModel, relationshipMeta, record._internalModel);
7306
- });
7320
+ }
7307
7321
 
7308
7322
  return record._internalModel;
7309
7323
  });
@@ -7311,12 +7325,12 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
7311
7325
  var records = _this.store.push(payload);
7312
7326
  internalModels = _ember.default.A(records).mapBy('_internalModel');
7313
7327
 
7314
- (0, _debug.runInDebug)(function () {
7328
+ if (false) {
7315
7329
  internalModels.forEach(function (internalModel) {
7316
7330
  var relationshipMeta = _this.hasManyRelationship.relationshipMeta;
7317
7331
  (0, _debug.assertPolymorphicType)(_this.internalModel, relationshipMeta, internalModel);
7318
7332
  });
7319
- });
7333
+ }
7320
7334
  }
7321
7335
 
7322
7336
  _this.hasManyRelationship.computeChanges(internalModels);
@@ -7655,7 +7669,7 @@ define("ember-data/-private/system/references/reference", ["exports"], function
7655
7669
 
7656
7670
  exports.default = Reference;
7657
7671
  });
7658
- define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflector', 'ember-data/-private/system/normalize-model-name', 'ember-data/-debug'], function (exports, _emberInflector, _normalizeModelName, _debug) {
7672
+ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflector', 'ember-data/-private/system/normalize-model-name'], function (exports, _emberInflector, _normalizeModelName) {
7659
7673
  'use strict';
7660
7674
 
7661
7675
  exports.__esModule = true;
@@ -7682,14 +7696,14 @@ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflec
7682
7696
  isRelationship: true
7683
7697
  };
7684
7698
 
7685
- (0, _debug.runInDebug)(function () {
7686
- return result.parentType = meta.parentType;
7687
- });
7699
+ if (false) {
7700
+ result.parentType = meta.parentType;
7701
+ }
7688
7702
 
7689
7703
  return result;
7690
7704
  }
7691
7705
  });
7692
- define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/normalize-model-name'], function (exports, _ember, _debug, _normalizeModelName) {
7706
+ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name'], function (exports, _ember, _normalizeModelName) {
7693
7707
  'use strict';
7694
7708
 
7695
7709
  exports.__esModule = true;
@@ -7783,7 +7797,8 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
7783
7797
  userEnteredModelName = (0, _normalizeModelName.default)(userEnteredModelName);
7784
7798
  }
7785
7799
 
7786
- (0, _debug.assert)("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + _ember.default.inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined');
7800
+ (false && _ember.default.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + _ember.default.inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined'));
7801
+
7787
7802
 
7788
7803
  opts = opts || {};
7789
7804
 
@@ -7799,15 +7814,15 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
7799
7814
  return _ember.default.computed({
7800
7815
  get: function (key) {
7801
7816
  if (opts.hasOwnProperty('serialize')) {
7802
- (0, _debug.warn)('You provided a serialize option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.Serializer and it\'s implementations http://emberjs.com/api/data/classes/DS.Serializer.html', false, {
7817
+ (false && _ember.default.warn('You provided a serialize option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.Serializer and it\'s implementations http://emberjs.com/api/data/classes/DS.Serializer.html', false, {
7803
7818
  id: 'ds.model.serialize-option-in-belongs-to'
7804
- });
7819
+ }));
7805
7820
  }
7806
7821
 
7807
7822
  if (opts.hasOwnProperty('embedded')) {
7808
- (0, _debug.warn)('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, {
7823
+ (false && _ember.default.warn('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, {
7809
7824
  id: 'ds.model.embedded-option-in-belongs-to'
7810
- });
7825
+ }));
7811
7826
  }
7812
7827
 
7813
7828
  return this._internalModel._relationships.get(key).getRecord();
@@ -7829,7 +7844,7 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
7829
7844
  }).meta(meta);
7830
7845
  }
7831
7846
  });
7832
- define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/relationship-meta'], function (exports, _ember, _debug, _relationshipMeta) {
7847
+ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'ember-data/-private/system/relationship-meta'], function (exports, _ember, _relationshipMeta) {
7833
7848
  'use strict';
7834
7849
 
7835
7850
  exports.__esModule = true;
@@ -7886,10 +7901,12 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
7886
7901
  meta.key = name;
7887
7902
  modelName = (0, _relationshipMeta.typeForRelationshipMeta)(meta);
7888
7903
 
7889
- (0, _debug.assert)('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName);
7904
+ (false && _ember.default.assert('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName));
7905
+
7890
7906
 
7891
7907
  if (!types.includes(modelName)) {
7892
- (0, _debug.assert)('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName);
7908
+ (false && _ember.default.assert('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName));
7909
+
7893
7910
  types.push(modelName);
7894
7911
  }
7895
7912
  }
@@ -7913,7 +7930,7 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
7913
7930
  return map;
7914
7931
  }).readOnly();
7915
7932
  });
7916
- define('ember-data/-private/system/relationships/has-many', ['exports', 'ember', 'ember-data/-debug', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _ember, _debug, _normalizeModelName, _isArrayLike) {
7933
+ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _ember, _normalizeModelName, _isArrayLike) {
7917
7934
  'use strict';
7918
7935
 
7919
7936
  exports.__esModule = true;
@@ -8033,7 +8050,8 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
8033
8050
  type = undefined;
8034
8051
  }
8035
8052
 
8036
- (0, _debug.assert)('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + _ember.default.inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined');
8053
+ (false && _ember.default.assert('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + _ember.default.inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined'));
8054
+
8037
8055
 
8038
8056
  options = options || {};
8039
8057
 
@@ -8059,12 +8077,13 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
8059
8077
  return this._internalModel._relationships.get(key).getRecords();
8060
8078
  },
8061
8079
  set: function (key, records) {
8062
- (0, _debug.assert)('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records));
8063
- (0, _debug.assert)('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + _ember.default.inspect(records), function () {
8080
+ (false && _ember.default.assert('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records)));
8081
+ (false && _ember.default.assert('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + _ember.default.inspect(records), function () {
8064
8082
  return _ember.default.A(records).every(function (record) {
8065
8083
  return record.hasOwnProperty('_internalModel') === true;
8066
8084
  });
8067
- }());
8085
+ }()));
8086
+
8068
8087
 
8069
8088
  var relationship = this._internalModel._relationships.get(key);
8070
8089
  relationship.clear();
@@ -8257,7 +8276,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
8257
8276
 
8258
8277
  exports.default = RelationshipPayloadsManager;
8259
8278
  });
8260
- define('ember-data/-private/system/relationships/relationship-payloads', ['exports', 'ember-data/-debug'], function (exports, _debug) {
8279
+ define('ember-data/-private/system/relationships/relationship-payloads', ['exports'], function (exports) {
8261
8280
  'use strict';
8262
8281
 
8263
8282
  exports.__esModule = true;
@@ -8340,7 +8359,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8340
8359
  if (this._isLHS(modelName, relationshipName)) {
8341
8360
  return this._lhsPayloads[id];
8342
8361
  } else {
8343
- (0, _debug.assert)(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName));
8362
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8363
+
8344
8364
  return this._rhsPayloads[id];
8345
8365
  }
8346
8366
  };
@@ -8355,7 +8375,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8355
8375
  if (this._isLHS(modelName, relationshipName)) {
8356
8376
  delete this._lhsPayloads[id];
8357
8377
  } else {
8358
- (0, _debug.assert)(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName));
8378
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8379
+
8359
8380
  delete this._rhsPayloads[id];
8360
8381
  }
8361
8382
  };
@@ -8401,7 +8422,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8401
8422
  inverseIdToPayloads = this._rhsPayloads;
8402
8423
  inverseIsMany = this._rhsRelationshipIsMany;
8403
8424
  } else {
8404
- (0, _debug.assert)(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName));
8425
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8426
+
8405
8427
  previousPayload = this._rhsPayloads[id];
8406
8428
  idToPayloads = this._rhsPayloads;
8407
8429
  inverseIdToPayloads = this._lhsPayloads;
@@ -8443,13 +8465,7 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8443
8465
  // Then we will initially have set user:2 as having helicopter:1, which we
8444
8466
  // need to remove before adding helicopter:1 to user:4
8445
8467
  //
8446
- // only remove relationship information before adding if there is relationshipData.data
8447
- // * null is considered new information "empty", and it should win
8448
- // * undefined is NOT considered new information, we should keep original state
8449
- // * anything else is considered new information, and it should win
8450
- if (relationshipData.data !== undefined) {
8451
- this._removeInverse(id, previousPayload, inverseIdToPayloads);
8452
- }
8468
+ this._removeInverse(id, previousPayload, inverseIdToPayloads);
8453
8469
  idToPayloads[id] = relationshipData;
8454
8470
  this._populateInverse(relationshipData, inverseRelationshipData, inverseIdToPayloads, inverseIsMany);
8455
8471
  }
@@ -8662,19 +8678,6 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8662
8678
  this.notifyBelongsToChanged();
8663
8679
  };
8664
8680
 
8665
- BelongsToRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
8666
- _Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
8667
-
8668
- if (this.canonicalState === internalModel) {
8669
- this.canonicalState = null;
8670
- }
8671
-
8672
- if (this.inverseInternalModel === internalModel) {
8673
- this.inverseInternalModel = null;
8674
- this.notifyBelongsToChanged();
8675
- }
8676
- };
8677
-
8678
8681
  BelongsToRelationship.prototype.flushCanonical = function flushCanonical() {
8679
8682
  //temporary fix to not remove newly created records if server returned null.
8680
8683
  //TODO remove once we have proper diffing
@@ -8707,7 +8710,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8707
8710
 
8708
8711
  BelongsToRelationship.prototype.setRecordPromise = function setRecordPromise(newPromise) {
8709
8712
  var content = newPromise.get && newPromise.get('content');
8710
- (0, _debug.assert)("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined);
8713
+ (false && _ember.default.assert("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined));
8714
+
8711
8715
  this.setInternalModel(content ? content._internalModel : content);
8712
8716
  };
8713
8717
 
@@ -8778,7 +8782,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8778
8782
  return null;
8779
8783
  }
8780
8784
  var toReturn = this.inverseInternalModel.getRecord();
8781
- (0, _debug.assert)("You looked up the '" + this.key + "' relationship on a '" + this.internalModel.modelName + "' with id " + this.internalModel.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.belongsTo({ async: true })`)", toReturn === null || !toReturn.get('isEmpty'));
8785
+ (false && _ember.default.assert("You looked up the '" + this.key + "' relationship on a '" + this.internalModel.modelName + "' with id " + this.internalModel.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.belongsTo({ async: true })`)", toReturn === null || !toReturn.get('isEmpty')));
8786
+
8782
8787
  return toReturn;
8783
8788
  }
8784
8789
  };
@@ -8799,7 +8804,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8799
8804
  };
8800
8805
 
8801
8806
  BelongsToRelationship.prototype.updateData = function updateData(data, initial) {
8802
- (0, _debug.assert)('Ember Data expected the data for the ' + this.key + ' relationship on a ' + this.internalModel.toString() + ' to be in a JSON API format and include an `id` and `type` property but it found ' + _ember.default.inspect(data) + '. Please check your serializer and make sure it is serializing the relationship payload into a JSON API format.', data === null || data.id !== undefined && data.type !== undefined);
8807
+ (false && _ember.default.assert('Ember Data expected the data for the ' + this.key + ' relationship on a ' + this.internalModel.toString() + ' to be in a JSON API format and include an `id` and `type` property but it found ' + _ember.default.inspect(data) + '. Please check your serializer and make sure it is serializing the relationship payload into a JSON API format.', data === null || data.id !== undefined && data.type !== undefined));
8808
+
8803
8809
  var internalModel = this.store._pushResourceIdentifier(this, data);
8804
8810
  if (initial) {
8805
8811
  this.setInitialCanonicalInternalModel(internalModel);
@@ -8813,7 +8819,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
8813
8819
 
8814
8820
  exports.default = BelongsToRelationship;
8815
8821
  });
8816
- define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to", "ember-data/-debug"], function (exports, _ember, _hasMany, _belongsTo, _debug) {
8822
+ define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"], function (exports, _ember, _hasMany, _belongsTo) {
8817
8823
  "use strict";
8818
8824
 
8819
8825
  exports.__esModule = true;
@@ -8856,10 +8862,8 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
8856
8862
 
8857
8863
  if (shouldFindInverse(relationshipMeta)) {
8858
8864
  inverse = internalModel.type.inverseFor(relationshipMeta.key, store);
8859
- } else {
8860
- (0, _debug.runInDebug)(function () {
8861
- internalModel.type.typeForRelationship(relationshipMeta.key, store);
8862
- });
8865
+ } else if (false) {
8866
+ internalModel.type.typeForRelationship(relationshipMeta.key, store);
8863
8867
  }
8864
8868
 
8865
8869
  if (inverse) {
@@ -8888,13 +8892,6 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
8888
8892
  return !!this.initializedRelationships[key];
8889
8893
  };
8890
8894
 
8891
- Relationships.prototype.forEach = function forEach(cb) {
8892
- var rels = this.initializedRelationships;
8893
- Object.keys(rels).forEach(function (name) {
8894
- cb(name, rels[name]);
8895
- });
8896
- };
8897
-
8898
8895
  Relationships.prototype.get = function get(key) {
8899
8896
  var relationships = this.initializedRelationships;
8900
8897
  var relationship = relationships[key];
@@ -9081,26 +9078,6 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9081
9078
  _Relationship.prototype.removeCanonicalInternalModelFromOwn.call(this, internalModel, idx);
9082
9079
  };
9083
9080
 
9084
- ManyRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
9085
- _Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
9086
-
9087
- var canonicalIndex = this.canonicalState.indexOf(internalModel);
9088
-
9089
- if (canonicalIndex !== -1) {
9090
- this.canonicalState.splice(canonicalIndex, 1);
9091
- }
9092
-
9093
- var manyArray = this._manyArray;
9094
-
9095
- if (manyArray) {
9096
- var idx = manyArray.currentState.indexOf(internalModel);
9097
-
9098
- if (idx !== -1) {
9099
- manyArray.internalReplace(idx, 1);
9100
- }
9101
- }
9102
- };
9103
-
9104
9081
  ManyRelationship.prototype.flushCanonical = function flushCanonical() {
9105
9082
  if (this._manyArray) {
9106
9083
  this._manyArray.flushCanonical();
@@ -9177,36 +9154,33 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9177
9154
  };
9178
9155
 
9179
9156
  ManyRelationship.prototype.setInitialInternalModels = function setInitialInternalModels(internalModels) {
9180
- if (Array.isArray(internalModels) === false || internalModels.length === 0) {
9181
- return;
9182
- }
9183
-
9184
- for (var i = 0; i < internalModels.length; i++) {
9185
- var internalModel = internalModels[i];
9186
- if (this.canonicalMembers.has(internalModel)) {
9187
- continue;
9188
- }
9157
+ var _this2 = this;
9189
9158
 
9190
- this.canonicalMembers.add(internalModel);
9191
- this.members.add(internalModel);
9192
- this.setupInverseRelationship(internalModel);
9159
+ if (!internalModels) {
9160
+ return;
9193
9161
  }
9194
9162
 
9195
- this.canonicalState = this.canonicalMembers.toArray();
9163
+ var args = [0, this.canonicalState.length].concat(internalModels);
9164
+ this.canonicalState.splice.apply(this.canonicalState, args);
9165
+ internalModels.forEach(function (internalModel) {
9166
+ _this2.canonicalMembers.add(internalModel);
9167
+ _this2.members.add(internalModel);
9168
+ _this2.setupInverseRelationship(internalModel);
9169
+ });
9196
9170
  };
9197
9171
 
9198
9172
  ManyRelationship.prototype.fetchLink = function fetchLink() {
9199
- var _this2 = this;
9173
+ var _this3 = this;
9200
9174
 
9201
9175
  return this.store.findHasMany(this.internalModel, this.link, this.relationshipMeta).then(function (records) {
9202
9176
  if (records.hasOwnProperty('meta')) {
9203
- _this2.updateMeta(records.meta);
9177
+ _this3.updateMeta(records.meta);
9204
9178
  }
9205
- _this2.store._backburner.join(function () {
9206
- _this2.updateInternalModelsFromAdapter(records);
9207
- _this2.manyArray.set('isLoaded', true);
9179
+ _this3.store._backburner.join(function () {
9180
+ _this3.updateInternalModelsFromAdapter(records);
9181
+ _this3.manyArray.set('isLoaded', true);
9208
9182
  });
9209
- return _this2.manyArray;
9183
+ return _this3.manyArray;
9210
9184
  });
9211
9185
  };
9212
9186
 
@@ -9229,7 +9203,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9229
9203
  };
9230
9204
 
9231
9205
  ManyRelationship.prototype.getRecords = function getRecords() {
9232
- var _this3 = this;
9206
+ var _this4 = this;
9233
9207
 
9234
9208
  //TODO(Igor) sync server here, once our syncing is not stupid
9235
9209
  var manyArray = this.manyArray;
@@ -9240,7 +9214,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9240
9214
  promise = this.findRecords();
9241
9215
  } else {
9242
9216
  promise = this.findLink().then(function () {
9243
- return _this3.findRecords();
9217
+ return _this4.findRecords();
9244
9218
  });
9245
9219
  }
9246
9220
  } else {
@@ -9248,7 +9222,8 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9248
9222
  }
9249
9223
  return this._updateLoadingPromise(promise, manyArray);
9250
9224
  } else {
9251
- (0, _debug.assert)('You looked up the \'' + this.key + '\' relationship on a \'' + this.internalModel.type.modelName + '\' with id ' + this.internalModel.id + ' but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (\'DS.hasMany({ async: true })\')', manyArray.isEvery('isEmpty', false));
9225
+ (false && Ember.assert('You looked up the \'' + this.key + '\' relationship on a \'' + this.internalModel.type.modelName + '\' with id ' + this.internalModel.id + ' but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (\'DS.hasMany({ async: true })\')', manyArray.isEvery('isEmpty', false)));
9226
+
9252
9227
 
9253
9228
  //TODO(Igor) WTF DO I DO HERE?
9254
9229
  // TODO @runspired equal WTFs to Igor
@@ -9268,20 +9243,6 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9268
9243
  }
9269
9244
  };
9270
9245
 
9271
- ManyRelationship.prototype.destroy = function destroy() {
9272
- _Relationship.prototype.destroy.call(this);
9273
- var manyArray = this._manyArray;
9274
- if (manyArray) {
9275
- manyArray.destroy();
9276
- }
9277
-
9278
- var proxy = this.__loadingPromise;
9279
-
9280
- if (proxy) {
9281
- proxy.destroy();
9282
- }
9283
- };
9284
-
9285
9246
  _createClass(ManyRelationship, [{
9286
9247
  key: '_loadingPromise',
9287
9248
  get: function () {
@@ -9323,7 +9284,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9323
9284
  return set;
9324
9285
  }
9325
9286
  });
9326
- define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-debug', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link', 'ember'], function (exports, _debug, _orderedSet, _normalizeLink2, _ember) {
9287
+ 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) {
9327
9288
  'use strict';
9328
9289
 
9329
9290
  exports.__esModule = true;
@@ -9352,8 +9313,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9352
9313
  };
9353
9314
  }();
9354
9315
 
9355
- var guidFor = _ember.default.guidFor;
9356
-
9357
9316
  var Relationship = function () {
9358
9317
  function Relationship(store, internalModel, inverseKey, relationshipMeta) {
9359
9318
  _classCallCheck(this, Relationship);
@@ -9378,14 +9337,9 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9378
9337
  this.hasLoaded = false;
9379
9338
  }
9380
9339
 
9381
- Relationship.prototype._inverseIsAsync = function _inverseIsAsync() {
9382
- if (!this.inverseKey || !this.inverseInternalModel) {
9383
- return false;
9384
- }
9385
- return this.inverseInternalModel._relationships.get(this.inverseKey).isAsync;
9386
- };
9387
-
9388
9340
  Relationship.prototype.removeInverseRelationships = function removeInverseRelationships() {
9341
+ var _this = this;
9342
+
9389
9343
  if (!this.inverseKey) {
9390
9344
  return;
9391
9345
  }
@@ -9393,13 +9347,12 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9393
9347
  var allMembers =
9394
9348
  // we actually want a union of members and canonicalMembers
9395
9349
  // they should be disjoint but currently are not due to a bug
9396
- this.members.list.concat(this.canonicalMembers.list);
9350
+ this.members.toArray().concat(this.canonicalMembers.toArray());
9397
9351
 
9398
- for (var i = 0; i < allMembers.length; i++) {
9399
- var inverseInternalModel = allMembers[i];
9400
- var relationship = inverseInternalModel._relationships.get(this.inverseKey);
9352
+ allMembers.forEach(function (inverseInternalModel) {
9353
+ var relationship = inverseInternalModel._relationships.get(_this.inverseKey);
9401
9354
  relationship.inverseDidDematerialize();
9402
- }
9355
+ });
9403
9356
  };
9404
9357
 
9405
9358
  Relationship.prototype.inverseDidDematerialize = function inverseDidDematerialize() {};
@@ -9424,18 +9377,18 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9424
9377
  };
9425
9378
 
9426
9379
  Relationship.prototype.removeInternalModels = function removeInternalModels(internalModels) {
9427
- var _this = this;
9380
+ var _this2 = this;
9428
9381
 
9429
9382
  internalModels.forEach(function (internalModel) {
9430
- return _this.removeInternalModel(internalModel);
9383
+ return _this2.removeInternalModel(internalModel);
9431
9384
  });
9432
9385
  };
9433
9386
 
9434
9387
  Relationship.prototype.addInternalModels = function addInternalModels(internalModels, idx) {
9435
- var _this2 = this;
9388
+ var _this3 = this;
9436
9389
 
9437
9390
  internalModels.forEach(function (internalModel) {
9438
- _this2.addInternalModel(internalModel, idx);
9391
+ _this3.addInternalModel(internalModel, idx);
9439
9392
  if (idx !== undefined) {
9440
9393
  idx++;
9441
9394
  }
@@ -9478,7 +9431,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9478
9431
  var _relationships = internalModel._implicitRelationships;
9479
9432
  var _relationship = _relationships[this.inverseKeyForImplicit];
9480
9433
  if (!_relationship) {
9481
- _relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
9434
+ _relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
9482
9435
  }
9483
9436
  _relationship.addCanonicalInternalModel(this.internalModel);
9484
9437
  }
@@ -9516,7 +9469,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9516
9469
  internalModel._relationships.get(this.inverseKey).addInternalModel(this.internalModel);
9517
9470
  } else {
9518
9471
  if (!internalModel._implicitRelationships[this.inverseKeyForImplicit]) {
9519
- internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
9472
+ internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
9520
9473
  }
9521
9474
  internalModel._implicitRelationships[this.inverseKeyForImplicit].addInternalModel(this.internalModel);
9522
9475
  }
@@ -9548,6 +9501,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9548
9501
 
9549
9502
  Relationship.prototype.removeInternalModelFromOwn = function removeInternalModelFromOwn(internalModel) {
9550
9503
  this.members.delete(internalModel);
9504
+ this.notifyRecordRelationshipRemoved(internalModel);
9551
9505
  this.internalModel.updateRecordArrays();
9552
9506
  };
9553
9507
 
@@ -9564,38 +9518,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9564
9518
  this.flushCanonicalLater();
9565
9519
  };
9566
9520
 
9567
- Relationship.prototype.removeCompletelyFromInverse = function removeCompletelyFromInverse() {
9568
- var _this3 = this;
9569
-
9570
- if (!this.inverseKey) {
9571
- return;
9572
- }
9573
-
9574
- // we actually want a union of members and canonicalMembers
9575
- // they should be disjoint but currently are not due to a bug
9576
- var seen = Object.create(null);
9577
- var internalModel = this.internalModel;
9578
-
9579
- var unload = function (inverseInternalModel) {
9580
- var id = guidFor(inverseInternalModel);
9581
-
9582
- if (seen[id] === undefined) {
9583
- var relationship = inverseInternalModel._relationships.get(_this3.inverseKey);
9584
- relationship.removeCompletelyFromOwn(internalModel);
9585
- seen[id] = true;
9586
- }
9587
- };
9588
-
9589
- this.members.forEach(unload);
9590
- this.canonicalMembers.forEach(unload);
9591
- };
9592
-
9593
- Relationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
9594
- this.canonicalMembers.delete(internalModel);
9595
- this.members.delete(internalModel);
9596
- this.internalModel.updateRecordArrays();
9597
- };
9598
-
9599
9521
  Relationship.prototype.flushCanonical = function flushCanonical() {
9600
9522
  var list = this.members.list;
9601
9523
  this.willSync = false;
@@ -9623,18 +9545,16 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9623
9545
  this.store._updateRelationshipState(this);
9624
9546
  };
9625
9547
 
9626
- Relationship.prototype.updateLink = function updateLink(link, initial) {
9627
- (0, _debug.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, {
9548
+ Relationship.prototype.updateLink = function updateLink(link) {
9549
+ (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, {
9628
9550
  id: 'ds.store.push-link-for-sync-relationship'
9629
- });
9630
- (0, _debug.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);
9551
+ }));
9552
+ (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));
9553
+
9631
9554
 
9632
9555
  this.link = link;
9633
9556
  this.linkPromise = null;
9634
-
9635
- if (!initial) {
9636
- this.internalModel.notifyPropertyChange(this.key);
9637
- }
9557
+ this.internalModel.notifyPropertyChange(this.key);
9638
9558
  };
9639
9559
 
9640
9560
  Relationship.prototype.findLink = function findLink() {
@@ -9657,6 +9577,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9657
9577
 
9658
9578
  Relationship.prototype.notifyRecordRelationshipAdded = function notifyRecordRelationshipAdded() {};
9659
9579
 
9580
+ Relationship.prototype.notifyRecordRelationshipRemoved = function notifyRecordRelationshipRemoved() {};
9581
+
9660
9582
  Relationship.prototype.setHasData = function setHasData(value) {
9661
9583
  this.hasData = value;
9662
9584
  };
@@ -9707,8 +9629,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9707
9629
 
9708
9630
  Relationship.prototype.updateData = function updateData() {};
9709
9631
 
9710
- Relationship.prototype.destroy = function destroy() {};
9711
-
9712
9632
  _createClass(Relationship, [{
9713
9633
  key: 'parentType',
9714
9634
  get: function () {
@@ -10234,7 +10154,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10234
10154
 
10235
10155
  Note: When creating a new record using any of the above methods
10236
10156
  Ember Data will update `DS.RecordArray`s such as those returned by
10237
- `store#peekAll()` or `store#findAll()`. This means any
10157
+ `store#peekAll()`, `store#findAll()` or `store#filter()`. This means any
10238
10158
  data bindings or computed properties that depend on the RecordArray
10239
10159
  will automatically be synced to include the new or updated record
10240
10160
  values.
@@ -10317,10 +10237,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10317
10237
  */
10318
10238
  serialize: function (record, options) {
10319
10239
  if (true) {
10320
- (0, _debug.deprecate)('Use of store.serialize is deprecated, use record.serialize instead.', false, {
10240
+ (false && !(false) && _ember.default.deprecate('Use of store.serialize is deprecated, use record.serialize instead.', false, {
10321
10241
  id: 'ds.store.serialize',
10322
10242
  until: '3.0'
10323
- });
10243
+ }));
10324
10244
  }
10325
10245
  var snapshot = record._internalModel.createSnapshot();
10326
10246
  return snapshot.serialize(options);
@@ -10342,7 +10262,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10342
10262
  defaultAdapter: computed('adapter', function () {
10343
10263
  var adapter = get(this, 'adapter');
10344
10264
 
10345
- (0, _debug.assert)('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string');
10265
+ (false && _ember.default.assert('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string'));
10266
+
10346
10267
 
10347
10268
  return this.adapterFor(adapter);
10348
10269
  }),
@@ -10375,8 +10296,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10375
10296
  @return {DS.Model} record
10376
10297
  */
10377
10298
  createRecord: function (modelName, inputProperties) {
10378
- (0, _debug.assert)('You need to pass a model name to the store\'s createRecord method', isPresent(modelName));
10379
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10299
+ (false && _ember.default.assert('You need to pass a model name to the store\'s createRecord method', isPresent(modelName)));
10300
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10301
+
10380
10302
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
10381
10303
  var properties = copy(inputProperties) || Object.create(null);
10382
10304
 
@@ -10398,9 +10320,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10398
10320
 
10399
10321
  // TODO @runspired this should also be coalesced into some form of internalModel.setState()
10400
10322
  internalModel.eachRelationship(function (key, descriptor) {
10401
- if (properties[key] !== undefined) {
10402
- internalModel._relationships.get(key).setHasData(true);
10403
- }
10323
+ internalModel._relationships.get(key).setHasData(true);
10404
10324
  });
10405
10325
 
10406
10326
  return record;
@@ -10481,12 +10401,13 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10481
10401
  // The default `model` hook in Ember.Route calls `find(modelName, id)`,
10482
10402
  // that's why we have to keep this method around even though `findRecord` is
10483
10403
  // the public way to get a record by modelName and id.
10484
- (0, _debug.assert)('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1);
10485
- (0, _debug.assert)('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options);
10486
- (0, _debug.assert)('You need to pass the model name and id to the store\'s find method', arguments.length === 2);
10487
- (0, _debug.assert)('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number');
10488
- (0, _debug.assert)('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object');
10489
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10404
+ (false && _ember.default.assert('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1));
10405
+ (false && _ember.default.assert('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options));
10406
+ (false && _ember.default.assert('You need to pass the model name and id to the store\'s find method', arguments.length === 2));
10407
+ (false && _ember.default.assert('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number'));
10408
+ (false && _ember.default.assert('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object'));
10409
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10410
+
10490
10411
 
10491
10412
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
10492
10413
 
@@ -10668,9 +10589,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10668
10589
  @return {Promise} promise
10669
10590
  */
10670
10591
  findRecord: function (modelName, id, options) {
10671
- (0, _debug.assert)('You need to pass a model name to the store\'s findRecord method', isPresent(modelName));
10672
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10673
- (0, _debug.assert)(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id));
10592
+ (false && _ember.default.assert('You need to pass a model name to the store\'s findRecord method', isPresent(modelName)));
10593
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10594
+ (false && _ember.default.assert(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id)));
10595
+
10674
10596
 
10675
10597
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
10676
10598
 
@@ -10746,8 +10668,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10746
10668
  @return {Promise} promise
10747
10669
  */
10748
10670
  findByIds: function (modelName, ids) {
10749
- (0, _debug.assert)('You need to pass a model name to the store\'s findByIds method', isPresent(modelName));
10750
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10671
+ (false && _ember.default.assert('You need to pass a model name to the store\'s findByIds method', isPresent(modelName)));
10672
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10673
+
10751
10674
 
10752
10675
  var promises = new Array(ids.length);
10753
10676
 
@@ -10774,8 +10697,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10774
10697
  var modelName = internalModel.modelName;
10775
10698
  var adapter = this.adapterFor(modelName);
10776
10699
 
10777
- (0, _debug.assert)('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter);
10778
- (0, _debug.assert)('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function');
10700
+ (false && _ember.default.assert('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter));
10701
+ (false && _ember.default.assert('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function'));
10702
+
10779
10703
 
10780
10704
  return (0, _finders._find)(adapter, this, internalModel.type, internalModel.id, internalModel, options);
10781
10705
  },
@@ -10869,11 +10793,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10869
10793
  }
10870
10794
 
10871
10795
  if (missingInternalModels.length) {
10872
- (0, _debug.warn)('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) {
10796
+ (false && _ember.default.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) {
10873
10797
  return r.id;
10874
10798
  })), false, {
10875
10799
  id: 'ds.store.missing-records-from-adapter'
10876
- });
10800
+ }));
10801
+
10877
10802
  rejectInternalModels(missingInternalModels);
10878
10803
  }
10879
10804
  }
@@ -10932,7 +10857,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10932
10857
  var pair = seeking[groupedInternalModels[0].id];
10933
10858
  _fetchRecord(pair);
10934
10859
  } else {
10935
- (0, _debug.assert)("You cannot return an empty array from adapter's method groupRecordsForFindMany", false);
10860
+ (false && _ember.default.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false));
10936
10861
  }
10937
10862
  }
10938
10863
  } else {
@@ -10996,8 +10921,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
10996
10921
  @return {DS.Model|null} record
10997
10922
  */
10998
10923
  peekRecord: function (modelName, id) {
10999
- (0, _debug.assert)('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName));
11000
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10924
+ (false && _ember.default.assert('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName)));
10925
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10926
+
11001
10927
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11002
10928
 
11003
10929
  if (this.hasRecordForId(normalizedModelName, id)) {
@@ -11024,9 +10950,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11024
10950
 
11025
10951
  var adapter = this.adapterFor(modelName);
11026
10952
 
11027
- (0, _debug.assert)('You cannot reload a record without an ID', id);
11028
- (0, _debug.assert)('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter);
11029
- (0, _debug.assert)('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function');
10953
+ (false && _ember.default.assert('You cannot reload a record without an ID', id));
10954
+ (false && _ember.default.assert('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter));
10955
+ (false && _ember.default.assert('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function'));
10956
+
11030
10957
 
11031
10958
  return this._scheduleFetch(internalModel);
11032
10959
  },
@@ -11049,8 +10976,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11049
10976
  @return {Boolean}
11050
10977
  */
11051
10978
  hasRecordForId: function (modelName, id) {
11052
- (0, _debug.assert)('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName));
11053
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
10979
+ (false && _ember.default.assert('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName)));
10980
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
10981
+
11054
10982
 
11055
10983
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11056
10984
 
@@ -11071,8 +10999,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11071
10999
  @return {DS.Model} record
11072
11000
  */
11073
11001
  recordForId: function (modelName, id) {
11074
- (0, _debug.assert)('You need to pass a model name to the store\'s recordForId method', isPresent(modelName));
11075
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11002
+ (false && _ember.default.assert('You need to pass a model name to the store\'s recordForId method', isPresent(modelName)));
11003
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11004
+
11076
11005
 
11077
11006
  return this._internalModelForId(modelName, id).getRecord();
11078
11007
  },
@@ -11080,16 +11009,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11080
11009
  var trueId = (0, _coerceId.default)(id);
11081
11010
  var internalModel = this._internalModelsFor(modelName).get(trueId);
11082
11011
 
11083
- if (internalModel) {
11084
- if (internalModel.hasScheduledDestroy()) {
11085
- internalModel.destroySync();
11086
- return this._buildInternalModel(modelName, trueId);
11087
- } else {
11088
- return internalModel;
11089
- }
11012
+ if (!internalModel) {
11013
+ internalModel = this._buildInternalModel(modelName, trueId);
11090
11014
  } else {
11091
- return this._buildInternalModel(modelName, trueId);
11015
+ // if we already have an internalModel, we need to ensure any async teardown is cancelled
11016
+ // since we want it again.
11017
+ internalModel.cancelDestroy();
11092
11018
  }
11019
+
11020
+ return internalModel;
11093
11021
  },
11094
11022
  _internalModelDidReceiveRelationshipData: function (modelName, id, relationshipData) {
11095
11023
  this._relationshipsPayloads.push(modelName, id, relationshipData);
@@ -11135,8 +11063,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11135
11063
  findHasMany: function (internalModel, link, relationship) {
11136
11064
  var adapter = this.adapterFor(internalModel.modelName);
11137
11065
 
11138
- (0, _debug.assert)('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter);
11139
- (0, _debug.assert)('You tried to load a hasMany relationship from a specified \'link\' in the original payload but your adapter does not implement \'findHasMany\'', typeof adapter.findHasMany === 'function');
11066
+ (false && _ember.default.assert('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
11067
+ (false && _ember.default.assert('You tried to load a hasMany relationship from a specified \'link\' in the original payload but your adapter does not implement \'findHasMany\'', typeof adapter.findHasMany === 'function'));
11068
+
11140
11069
 
11141
11070
  return (0, _finders._findHasMany)(adapter, this, internalModel, link, relationship);
11142
11071
  },
@@ -11153,8 +11082,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11153
11082
  findBelongsTo: function (internalModel, link, relationship) {
11154
11083
  var adapter = this.adapterFor(internalModel.modelName);
11155
11084
 
11156
- (0, _debug.assert)('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter);
11157
- (0, _debug.assert)('You tried to load a belongsTo relationship from a specified \'link\' in the original payload but your adapter does not implement \'findBelongsTo\'', typeof adapter.findBelongsTo === 'function');
11085
+ (false && _ember.default.assert('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
11086
+ (false && _ember.default.assert('You tried to load a belongsTo relationship from a specified \'link\' in the original payload but your adapter does not implement \'findBelongsTo\'', typeof adapter.findBelongsTo === 'function'));
11087
+
11158
11088
 
11159
11089
  return (0, _finders._findBelongsTo)(adapter, this, internalModel, link, relationship);
11160
11090
  },
@@ -11199,26 +11129,24 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11199
11129
  @return {Promise} promise
11200
11130
  */
11201
11131
  query: function (modelName, query) {
11202
- (0, _debug.assert)('You need to pass a model name to the store\'s query method', isPresent(modelName));
11203
- (0, _debug.assert)('You need to pass a query hash to the store\'s query method', query);
11204
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11132
+ (false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
11133
+ (false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query));
11134
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11135
+
11205
11136
 
11206
11137
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11207
11138
  return this._query(normalizedModelName, query);
11208
11139
  },
11209
11140
  _query: function (modelName, query, array) {
11210
- (0, _debug.assert)('You need to pass a model name to the store\'s query method', isPresent(modelName));
11211
- (0, _debug.assert)('You need to pass a query hash to the store\'s query method', query);
11212
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11213
-
11214
- array = array || this.recordArrayManager.createAdapterPopulatedRecordArray(modelName, query);
11141
+ (false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
11142
+ (false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query));
11143
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11215
11144
 
11216
11145
  var adapter = this.adapterFor(modelName);
11146
+ (false && _ember.default.assert('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter));
11147
+ (false && _ember.default.assert('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function'));
11217
11148
 
11218
11149
 
11219
- (0, _debug.assert)('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter);
11220
- (0, _debug.assert)('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function');
11221
-
11222
11150
  var pA = (0, _promiseProxies.promiseArray)((0, _finders._query)(adapter, this, modelName, query, array));
11223
11151
 
11224
11152
  return pA;
@@ -11304,16 +11232,18 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11304
11232
  @return {Promise} promise which resolves with the found record or `null`
11305
11233
  */
11306
11234
  queryRecord: function (modelName, query) {
11307
- (0, _debug.assert)('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName));
11308
- (0, _debug.assert)('You need to pass a query hash to the store\'s queryRecord method', query);
11309
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11235
+ (false && _ember.default.assert('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName)));
11236
+ (false && _ember.default.assert('You need to pass a query hash to the store\'s queryRecord method', query));
11237
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11238
+
11310
11239
 
11311
11240
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11312
11241
 
11313
11242
  var adapter = this.adapterFor(normalizedModelName);
11314
11243
 
11315
- (0, _debug.assert)('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter);
11316
- (0, _debug.assert)('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function');
11244
+ (false && _ember.default.assert('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter));
11245
+ (false && _ember.default.assert('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function'));
11246
+
11317
11247
 
11318
11248
  return (0, _promiseProxies.promiseObject)((0, _finders._queryRecord)(adapter, this, modelName, query).then(function (internalModel) {
11319
11249
  // the promise returned by store.queryRecord is expected to resolve with
@@ -11478,8 +11408,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11478
11408
  @return {Promise} promise
11479
11409
  */
11480
11410
  findAll: function (modelName, options) {
11481
- (0, _debug.assert)('You need to pass a model name to the store\'s findAll method', isPresent(modelName));
11482
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11411
+ (false && _ember.default.assert('You need to pass a model name to the store\'s findAll method', isPresent(modelName)));
11412
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11483
11413
 
11484
11414
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11485
11415
  var fetch = this._fetchAll(normalizedModelName, this.peekAll(normalizedModelName), options);
@@ -11501,8 +11431,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11501
11431
  var adapter = this.adapterFor(modelName);
11502
11432
  var sinceToken = this._internalModelsFor(modelName).metadata.since;
11503
11433
 
11504
- (0, _debug.assert)('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter);
11505
- (0, _debug.assert)('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function');
11434
+ (false && _ember.default.assert('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter));
11435
+ (false && _ember.default.assert('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function'));
11436
+
11506
11437
 
11507
11438
  if (options.reload) {
11508
11439
  set(array, 'isUpdating', true);
@@ -11535,12 +11466,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11535
11466
  @private
11536
11467
  */
11537
11468
  _didUpdateAll: function (modelName) {
11538
- var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(modelName);
11539
-
11540
- set(liveRecordArray, 'isUpdating', false);
11469
+ this.recordArrayManager._didUpdateAll(modelName);
11541
11470
  },
11542
11471
  didUpdateAll: function (modelName) {
11543
- (0, _debug.deprecate)('didUpdateAll was documented as private and will be removed in the next version of Ember Data.');
11472
+ (false && !(false) && _ember.default.deprecate('didUpdateAll was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.didUpdateAll', until: '2.17.0' }));
11473
+
11544
11474
  return this._didUpdateAll(modelName);
11545
11475
  },
11546
11476
 
@@ -11565,14 +11495,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11565
11495
  @return {DS.RecordArray}
11566
11496
  */
11567
11497
  peekAll: function (modelName) {
11568
- (0, _debug.assert)('You need to pass a model name to the store\'s peekAll method', isPresent(modelName));
11569
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11570
- var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11571
- var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(normalizedModelName);
11572
-
11573
- this.recordArrayManager.syncLiveRecordArray(liveRecordArray, normalizedModelName);
11498
+ (false && _ember.default.assert('You need to pass a model name to the store\'s peekAll method', isPresent(modelName)));
11499
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11574
11500
 
11575
- return liveRecordArray;
11501
+ var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11502
+ return this.recordArrayManager.liveRecordArrayFor(normalizedModelName);
11576
11503
  },
11577
11504
 
11578
11505
 
@@ -11588,7 +11515,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11588
11515
  @param {String} modelName
11589
11516
  */
11590
11517
  unloadAll: function (modelName) {
11591
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string');
11518
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string'));
11519
+
11592
11520
 
11593
11521
  if (arguments.length === 0) {
11594
11522
  this._identityMap.clear();
@@ -11644,11 +11572,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11644
11572
  @deprecated
11645
11573
  */
11646
11574
  filter: function (modelName, query, filter) {
11647
- (0, _debug.assert)('You need to pass a model name to the store\'s filter method', isPresent(modelName));
11648
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11575
+ (false && _ember.default.assert('You need to pass a model name to the store\'s filter method', isPresent(modelName)));
11576
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11577
+
11649
11578
 
11650
11579
  if (!ENV.ENABLE_DS_FILTER) {
11651
- (0, _debug.assert)('The filter API has been moved to a plugin. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page. https://github.com/ember-data/ember-data-filter', false);
11580
+ (false && _ember.default.assert('The filter API has been moved to a plugin. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page. https://github.com/ember-data/ember-data-filter', false));
11652
11581
  }
11653
11582
 
11654
11583
  var promise = void 0;
@@ -11689,10 +11618,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11689
11618
  @return {boolean}
11690
11619
  */
11691
11620
  recordIsLoaded: function (modelName, id) {
11692
- (0, _debug.deprecate)('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, {
11621
+ (false && !(false) && _ember.default.deprecate('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, {
11693
11622
  id: 'ds.store.recordIsLoaded',
11694
11623
  until: '3.0'
11695
- });
11624
+ }));
11625
+
11696
11626
  return this.hasRecordForId(modelName, id);
11697
11627
  },
11698
11628
 
@@ -11742,8 +11672,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11742
11672
  var operation = void 0;
11743
11673
 
11744
11674
  if (internalModel.currentState.stateName === 'root.deleted.saved') {
11745
- resolver.resolve();
11746
- continue;
11675
+ return resolver.resolve();
11747
11676
  } else if (internalModel.isNew()) {
11748
11677
  operation = 'createRecord';
11749
11678
  } else if (internalModel.isDeleted()) {
@@ -11778,7 +11707,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11778
11707
  this.updateId(internalModel, data);
11779
11708
  this._setupRelationshipsForModel(internalModel, data);
11780
11709
  } else {
11781
- (0, _debug.assert)('Your ' + internalModel.modelName + ' record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.', internalModel.id);
11710
+ (false && _ember.default.assert('Your ' + internalModel.modelName + ' record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.', internalModel.id));
11782
11711
  }
11783
11712
 
11784
11713
  //We first make sure the primary data has been updated
@@ -11830,22 +11759,21 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11830
11759
  var id = (0, _coerceId.default)(data.id);
11831
11760
 
11832
11761
  // ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)
11833
- (0, _debug.assert)('\'' + modelName + '\' was saved to the server, but the response does not have an id and your record does not either.', !(id === null && oldId === null));
11762
+ (false && _ember.default.assert('\'' + modelName + '\' was saved to the server, but the response does not have an id and your record does not either.', !(id === null && oldId === null)));
11834
11763
 
11835
11764
  // ID absolutely can't be different than oldID if oldID is not null
11836
- (0, _debug.assert)('\'' + modelName + ':' + oldId + '\' was saved to the server, but the response returned the new id \'' + id + '\'. The store cannot assign a new id to a record that already has an id.', !(oldId !== null && id !== oldId));
11765
+
11766
+ (false && _ember.default.assert('\'' + modelName + ':' + oldId + '\' was saved to the server, but the response returned the new id \'' + id + '\'. The store cannot assign a new id to a record that already has an id.', !(oldId !== null && id !== oldId)));
11837
11767
 
11838
11768
  // ID can be null if oldID is not null (altered ID in response for a record)
11839
11769
  // however, this is more than likely a developer error.
11770
+
11840
11771
  if (oldId !== null && id === null) {
11841
- (0, _debug.warn)('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null));
11772
+ (false && _ember.default.warn('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null)));
11773
+
11842
11774
  return;
11843
11775
  }
11844
11776
 
11845
- var existingInternalModel = this._existingInternalModelForId(modelName, id);
11846
-
11847
- (0, _debug.assert)('\'' + modelName + '\' was saved to the server, but the response returned the new id \'' + id + '\', which has already been used with another record.\'', isNone(existingInternalModel) || existingInternalModel === internalModel);
11848
-
11849
11777
  this._internalModelsFor(internalModel.modelName).set(id, internalModel);
11850
11778
 
11851
11779
  internalModel.setId(id);
@@ -11941,8 +11869,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11941
11869
  @return {DS.Model}
11942
11870
  */
11943
11871
  modelFor: function (modelName) {
11944
- (0, _debug.assert)('You need to pass a model name to the store\'s modelFor method', isPresent(modelName));
11945
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11872
+ (false && _ember.default.assert('You need to pass a model name to the store\'s modelFor method', isPresent(modelName)));
11873
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11874
+
11946
11875
 
11947
11876
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11948
11877
 
@@ -11975,9 +11904,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11975
11904
  // interopt with the future
11976
11905
  var klass = (0, _utils.getOwner)(this).factoryFor ? factory.class : factory;
11977
11906
 
11978
- (0, _debug.assert)('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel);
11907
+ (false && _ember.default.assert('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel));
11979
11908
 
11980
11909
  // TODO: deprecate this
11910
+
11981
11911
  klass.modelName = klass.modelName || modelName;
11982
11912
 
11983
11913
  this._modelFactoryCache[modelName] = factory;
@@ -11991,8 +11921,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11991
11921
  @private
11992
11922
  */
11993
11923
  modelFactoryFor: function (modelName) {
11994
- (0, _debug.assert)('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName));
11995
- (0, _debug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string');
11924
+ (false && _ember.default.assert('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName)));
11925
+ (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
11926
+
11996
11927
 
11997
11928
  var normalizedModelName = (0, _normalizeModelName.default)(modelName);
11998
11929
  var owner = (0, _utils.getOwner)(this);
@@ -12191,7 +12122,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
12191
12122
  return null;
12192
12123
  }
12193
12124
 
12194
- (0, _debug.assert)('Expected an object in the \'data\' property in a call to \'push\' for ' + jsonApiDoc.type + ', but was ' + typeOf(jsonApiDoc.data), typeOf(jsonApiDoc.data) === 'object');
12125
+ (false && _ember.default.assert('Expected an object in the \'data\' property in a call to \'push\' for ' + jsonApiDoc.type + ', but was ' + typeOf(jsonApiDoc.data), typeOf(jsonApiDoc.data) === 'object'));
12126
+
12195
12127
 
12196
12128
  return _this._pushInternalModel(jsonApiDoc.data);
12197
12129
  });
@@ -12209,34 +12141,34 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
12209
12141
  }
12210
12142
  },
12211
12143
  _pushInternalModel: function (data) {
12212
- var _this2 = this;
12213
-
12214
12144
  var modelName = data.type;
12215
- (0, _debug.assert)('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== '');
12216
- (0, _debug.assert)('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName));
12145
+ (false && _ember.default.assert('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== ''));
12146
+ (false && _ember.default.assert('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName)));
12147
+
12217
12148
 
12218
- (0, _debug.runInDebug)(function () {
12149
+ if (false) {
12219
12150
  // If ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload
12220
12151
  // contains unknown attributes or relationships, log a warning.
12221
12152
 
12222
12153
  if (ENV.DS_WARN_ON_UNKNOWN_KEYS) {
12223
- var modelClass = _this2._modelFor(modelName);
12154
+ var modelClass = this._modelFor(modelName);
12224
12155
 
12225
12156
  // Check unknown attributes
12226
12157
  var unknownAttributes = Object.keys(data.attributes || {}).filter(function (key) {
12227
12158
  return !get(modelClass, 'fields').has(key);
12228
12159
  });
12229
12160