ember-data-source 2.15.0.beta.4 → 2.15.0

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: 9a2b173b4eccb50e716f49026a20d33678c0b3f0
4
- data.tar.gz: 8d151639a5c324722493b794420bb6751d29f68d
3
+ metadata.gz: 3acc2ddda8750bb731dfa83dbd675b03ef74339e
4
+ data.tar.gz: 4b45eda3d2d9fecd0a0377db492a9f338bc72512
5
5
  SHA512:
6
- metadata.gz: 72577ecf01d5fadb3a843409c6c6ab1f367e27612a54882080de64c3aafa420cd3046dd90aaf8799669a9b90d4333129336fd2b7384827e2a0e51f2e0f26c0fa
7
- data.tar.gz: 05ea6bdf2f519d3641b91f889af52b75e640b84c10a222a7dbdd8c5776ae09bd80810b4de8bcf72b626ddc9a19d330cfc75b08ac9245247c4292fd135e6ffc28
6
+ metadata.gz: 1095dea7d3b2972d55cbc3fdc8f1829c959c6e36f1d9f2d0fe273702b60b3699bde216a3b64856eed14445ec516c9d7fba7811a8ba1d1c3d4e6cf206526b24bb
7
+ data.tar.gz: b37d9b8a28d87529d87260b7b228e436f68fbc585d351221af45170a96fa073afae0b71906fde60b418571562b3c48bc41c549c37b618c533f68cf4ae5827817
@@ -6,7 +6,7 @@
6
6
  * @copyright Copyright 2011-2017 Tilde Inc. and contributors.
7
7
  * Portions Copyright 2011 LivingSocial Inc.
8
8
  * @license Licensed under MIT license (see license.js)
9
- * @version 2.15.0-beta.4
9
+ * @version 2.15.0
10
10
  */
11
11
 
12
12
  var loader, define, requireModule, require, requirejs;
@@ -14,8 +14,6 @@ var loader, define, requireModule, require, requirejs;
14
14
  (function (global) {
15
15
  'use strict';
16
16
 
17
- var heimdall = global.heimdall;
18
-
19
17
  function dict() {
20
18
  var obj = Object.create(null);
21
19
  obj['__'] = undefined;
@@ -32,9 +30,9 @@ var loader, define, requireModule, require, requirejs;
32
30
  requirejs: requirejs
33
31
  };
34
32
 
35
- requirejs = require = requireModule = function (name) {
33
+ requirejs = require = requireModule = function (id) {
36
34
  var pending = [];
37
- var mod = findModule(name, '(require)', pending);
35
+ var mod = findModule(id, '(require)', pending);
38
36
 
39
37
  for (var i = pending.length - 1; i >= 0; i--) {
40
38
  pending[i].exports();
@@ -57,32 +55,25 @@ var loader, define, requireModule, require, requirejs;
57
55
  }
58
56
  }
59
57
  }
60
- }
58
+ },
59
+ // Option to enable or disable the generation of default exports
60
+ makeDefaultExport: true
61
61
  };
62
62
 
63
- var _isArray;
64
- if (!Array.isArray) {
65
- _isArray = function (x) {
66
- return Object.prototype.toString.call(x) === '[object Array]';
67
- };
68
- } else {
69
- _isArray = Array.isArray;
70
- }
71
-
72
63
  var registry = dict();
73
64
  var seen = dict();
74
65
 
75
66
  var uuid = 0;
76
67
 
77
68
  function unsupportedModule(length) {
78
- throw new Error('an unsupported module was defined, expected `define(name, deps, module)` instead got: `' + length + '` arguments to define`');
69
+ throw new Error('an unsupported module was defined, expected `define(id, deps, module)` instead got: `' + length + '` arguments to define`');
79
70
  }
80
71
 
81
72
  var defaultDeps = ['require', 'exports', 'module'];
82
73
 
83
- function Module(name, deps, callback, alias) {
84
- this.id = uuid++;
85
- this.name = name;
74
+ function Module(id, deps, callback, alias) {
75
+ this.uuid = uuid++;
76
+ this.id = id;
86
77
  this.deps = !deps.length && callback.length ? defaultDeps : deps;
87
78
  this.module = { exports: {} };
88
79
  this.callback = callback;
@@ -116,19 +107,23 @@ var loader, define, requireModule, require, requirejs;
116
107
  return this.module.exports;
117
108
  }
118
109
 
110
+
119
111
  if (loader.wrapModules) {
120
- this.callback = loader.wrapModules(this.name, this.callback);
112
+ this.callback = loader.wrapModules(this.id, this.callback);
121
113
  }
122
114
 
123
115
  this.reify();
124
116
 
125
117
  var result = this.callback.apply(this, this.reified);
118
+ this.reified.length = 0;
126
119
  this.state = 'finalized';
127
120
 
128
121
  if (!(this.hasExportsAsDep && result === undefined)) {
129
122
  this.module.exports = result;
130
123
  }
131
- this.makeDefaultExport();
124
+ if (loader.makeDefaultExport) {
125
+ this.makeDefaultExport();
126
+ }
132
127
  return this.module.exports;
133
128
  };
134
129
 
@@ -181,27 +176,28 @@ var loader, define, requireModule, require, requirejs;
181
176
  } else if (dep === 'module') {
182
177
  entry.exports = this.module;
183
178
  } else {
184
- entry.module = findModule(resolve(dep, this.name), this.name, pending);
179
+ entry.module = findModule(resolve(dep, this.id), this.id, pending);
185
180
  }
186
181
  }
187
182
  };
188
183
 
189
184
  Module.prototype.makeRequire = function () {
190
- var name = this.name;
185
+ var id = this.id;
191
186
  var r = function (dep) {
192
- return require(resolve(dep, name));
187
+ return require(resolve(dep, id));
193
188
  };
194
189
  r['default'] = r;
190
+ r.moduleId = id;
195
191
  r.has = function (dep) {
196
- return has(resolve(dep, name));
192
+ return has(resolve(dep, id));
197
193
  };
198
194
  return r;
199
195
  };
200
196
 
201
- define = function (name, deps, callback) {
202
- var module = registry[name];
197
+ define = function (id, deps, callback) {
198
+ var module = registry[id];
203
199
 
204
- // If a module for this name has already been defined and is in any state
200
+ // If a module for this id has already been defined and is in any state
205
201
  // other than `new` (meaning it has been or is currently being required),
206
202
  // then we return early to avoid redefinition.
207
203
  if (module && module.state !== 'new') {
@@ -212,42 +208,65 @@ var loader, define, requireModule, require, requirejs;
212
208
  unsupportedModule(arguments.length);
213
209
  }
214
210
 
215
- if (!_isArray(deps)) {
211
+ if (!Array.isArray(deps)) {
216
212
  callback = deps;
217
213
  deps = [];
218
214
  }
219
215
 
220
216
  if (callback instanceof Alias) {
221
- registry[name] = new Module(callback.name, deps, callback, true);
217
+ registry[id] = new Module(callback.id, deps, callback, true);
222
218
  } else {
223
- registry[name] = new Module(name, deps, callback, false);
219
+ registry[id] = new Module(id, deps, callback, false);
224
220
  }
225
221
  };
226
222
 
223
+ define.exports = function (name, defaultExport) {
224
+ var module = registry[name];
225
+
226
+ // If a module for this name has already been defined and is in any state
227
+ // other than `new` (meaning it has been or is currently being required),
228
+ // then we return early to avoid redefinition.
229
+ if (module && module.state !== 'new') {
230
+ return;
231
+ }
232
+
233
+ module = new Module(name, [], noop, null);
234
+ module.module.exports = defaultExport;
235
+ module.state = 'finalized';
236
+ registry[name] = module;
237
+
238
+ return module;
239
+ };
240
+
241
+ function noop() {}
227
242
  // we don't support all of AMD
228
243
  // define.amd = {};
229
244
 
230
- function Alias(path) {
231
- this.name = path;
245
+ function Alias(id) {
246
+ this.id = id;
232
247
  }
233
248
 
234
- define.alias = function (path) {
235
- return new Alias(path);
249
+ define.alias = function (id, target) {
250
+ if (arguments.length === 2) {
251
+ return define(target, new Alias(id));
252
+ }
253
+
254
+ return new Alias(id);
236
255
  };
237
256
 
238
- function missingModule(name, referrer) {
239
- throw new Error('Could not find module `' + name + '` imported from `' + referrer + '`');
257
+ function missingModule(id, referrer) {
258
+ throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');
240
259
  }
241
260
 
242
- function findModule(name, referrer, pending) {
243
- var mod = registry[name] || registry[name + '/index'];
261
+ function findModule(id, referrer, pending) {
262
+ var mod = registry[id] || registry[id + '/index'];
244
263
 
245
264
  while (mod && mod.isAlias) {
246
- mod = registry[mod.name];
265
+ mod = registry[mod.id];
247
266
  }
248
267
 
249
268
  if (!mod) {
250
- missingModule(name, referrer);
269
+ missingModule(id, referrer);
251
270
  }
252
271
 
253
272
  if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {
@@ -257,13 +276,14 @@ var loader, define, requireModule, require, requirejs;
257
276
  return mod;
258
277
  }
259
278
 
260
- function resolve(child, name) {
279
+ function resolve(child, id) {
261
280
  if (child.charAt(0) !== '.') {
262
281
  return child;
263
282
  }
264
283
 
284
+
265
285
  var parts = child.split('/');
266
- var nameParts = name.split('/');
286
+ var nameParts = id.split('/');
267
287
  var parentBase = nameParts.slice(0, -1);
268
288
 
269
289
  for (var i = 0, l = parts.length; i < l; i++) {
@@ -284,14 +304,14 @@ var loader, define, requireModule, require, requirejs;
284
304
  return parentBase.join('/');
285
305
  }
286
306
 
287
- function has(name) {
288
- return !!(registry[name] || registry[name + '/index']);
307
+ function has(id) {
308
+ return !!(registry[id] || registry[id + '/index']);
289
309
  }
290
310
 
291
311
  requirejs.entries = requirejs._eak_seen = registry;
292
312
  requirejs.has = has;
293
- requirejs.unsee = function (moduleName) {
294
- findModule(moduleName, '(unsee)', false).unsee();
313
+ requirejs.unsee = function (id) {
314
+ findModule(id, '(unsee)', false).unsee();
295
315
  };
296
316
 
297
317
  requirejs.clear = function () {
@@ -310,9 +330,12 @@ var loader, define, requireModule, require, requirejs;
310
330
  });
311
331
  define('foo/baz', [], define.alias('foo'));
312
332
  define('foo/quz', define.alias('foo'));
333
+ define.alias('foo', 'foo/qux');
313
334
  define('foo/bar', ['foo', './quz', './baz', './asdf', './bar', '../foo'], function () {});
314
335
  define('foo/main', ['foo/bar'], function () {});
336
+ define.exports('foo/exports', {});
315
337
 
338
+ require('foo/exports');
316
339
  require('foo/main');
317
340
  require.unsee('foo/bar');
318
341
 
@@ -2792,6 +2815,14 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
2792
2815
  return true;
2793
2816
  }
2794
2817
 
2818
+ function destroyRelationship(rel) {
2819
+ if (rel._inverseIsAsync()) {
2820
+ rel.removeInternalModelFromInverse(rel.inverseInternalModel);
2821
+ rel.removeInverseRelationships();
2822
+ } else {
2823
+ rel.removeCompletelyFromInverse();
2824
+ }
2825
+ }
2795
2826
  // this (and all heimdall instrumentation) will be stripped by a babel transform
2796
2827
  // https://github.com/heimdalljs/babel5-plugin-strip-heimdall
2797
2828
 
@@ -2943,7 +2974,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
2943
2974
 
2944
2975
  InternalModel.prototype.resetRecord = function resetRecord() {
2945
2976
  this._record = null;
2946
- this.dataHasInitialized = false;
2947
2977
  this.isReloading = false;
2948
2978
  this.error = null;
2949
2979
  this.currentState = _states.default.empty;
@@ -3010,9 +3040,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3010
3040
  InternalModel.prototype._directlyRelatedInternalModels = function _directlyRelatedInternalModels() {
3011
3041
  var array = [];
3012
3042
  this._relationships.forEach(function (name, rel) {
3013
- var local = rel.members.toArray();
3014
- var server = rel.canonicalMembers.toArray();
3015
- array = array.concat(local, server);
3043
+ array = array.concat(rel.members.list, rel.canonicalMembers.list);
3016
3044
  });
3017
3045
  return array;
3018
3046
  };
@@ -3041,6 +3069,9 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3041
3069
  };
3042
3070
 
3043
3071
  InternalModel.prototype.unloadRecord = function unloadRecord() {
3072
+ if (this.isDestroyed) {
3073
+ return;
3074
+ }
3044
3075
  this.send('unloadRecord');
3045
3076
  this.dematerializeRecord();
3046
3077
 
@@ -3138,18 +3169,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3138
3169
  if (this.hasRecord) {
3139
3170
  this._record._notifyProperties(changedKeys);
3140
3171
  }
3141
- this.didInitializeData();
3142
- };
3143
-
3144
- InternalModel.prototype.becameReady = function becameReady() {
3145
- this.store.recordArrayManager.recordWasLoaded(this);
3146
- };
3147
-
3148
- InternalModel.prototype.didInitializeData = function didInitializeData() {
3149
- if (!this.dataHasInitialized) {
3150
- this.becameReady();
3151
- this.dataHasInitialized = true;
3152
- }
3153
3172
  };
3154
3173
 
3155
3174
  InternalModel.prototype.createSnapshot = function createSnapshot(options) {
@@ -3162,7 +3181,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3162
3181
 
3163
3182
  InternalModel.prototype.loadedData = function loadedData() {
3164
3183
  this.send('loadedData');
3165
- this.didInitializeData();
3166
3184
  };
3167
3185
 
3168
3186
  InternalModel.prototype.notFound = function notFound() {
@@ -3264,14 +3282,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3264
3282
  this.didCleanError();
3265
3283
  }
3266
3284
 
3267
- //Eventually rollback will always work for relationships
3268
- //For now we support it only out of deleted state, because we
3269
- //have an explicit way of knowing when the server acked the relationship change
3270
- if (this.isDeleted()) {
3271
- //TODO: Should probably move this to the state machine somehow
3272
- this.becameReady();
3273
- }
3274
-
3275
3285
  if (this.isNew()) {
3276
3286
  this.removeFromInverseRelationships(true);
3277
3287
  }
@@ -3413,15 +3423,9 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3413
3423
  };
3414
3424
 
3415
3425
  InternalModel.prototype.destroyRelationships = function destroyRelationships() {
3416
- var _this = this;
3417
-
3418
- this._relationships.forEach(function (name, rel) {
3419
- if (rel._inverseIsAsync()) {
3420
- rel.removeInternalModelFromInverse(_this);
3421
- rel.removeInverseRelationships();
3422
- } else {
3423
- rel.removeCompletelyFromInverse();
3424
- }
3426
+ var relationships = this._relationships;
3427
+ relationships.forEach(function (name, rel) {
3428
+ return destroyRelationship(rel);
3425
3429
  });
3426
3430
 
3427
3431
  var implicitRelationships = this._implicitRelationships;
@@ -3429,28 +3433,23 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
3429
3433
  Object.keys(implicitRelationships).forEach(function (key) {
3430
3434
  var rel = implicitRelationships[key];
3431
3435
 
3432
- if (rel._inverseIsAsync()) {
3433
- rel.removeInternalModelFromInverse(_this);
3434
- rel.removeInverseRelationships();
3435
- } else {
3436
- rel.removeCompletelyFromInverse();
3437
- }
3436
+ destroyRelationship(rel);
3438
3437
 
3439
3438
  rel.destroy();
3440
3439
  });
3441
3440
  };
3442
3441
 
3443
3442
  InternalModel.prototype.preloadData = function preloadData(preload) {
3444
- var _this2 = this;
3443
+ var _this = this;
3445
3444
 
3446
3445
  //TODO(Igor) consider the polymorphic case
3447
3446
  Object.keys(preload).forEach(function (key) {
3448
3447
  var preloadValue = get(preload, key);
3449
- var relationshipMeta = _this2.modelClass.metaForProperty(key);
3448
+ var relationshipMeta = _this.modelClass.metaForProperty(key);
3450
3449
  if (relationshipMeta.isRelationship) {
3451
- _this2._preloadRelationship(key, preloadValue);
3450
+ _this._preloadRelationship(key, preloadValue);
3452
3451
  } else {
3453
- _this2._data[key] = preloadValue;
3452
+ _this._data[key] = preloadValue;
3454
3453
  }
3455
3454
  });
3456
3455
  };
@@ -8421,13 +8420,12 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8421
8420
  id: id,
8422
8421
  type: modelName
8423
8422
  }
8424
- };
8425
8423
 
8426
- // start flushing this individual payload. The logic is the same whether
8427
- // it's for the left hand side of the relationship or the right hand side,
8428
- // except the role of primary and inverse idToPayloads is reversed
8429
- //
8430
- var previousPayload = void 0;
8424
+ // start flushing this individual payload. The logic is the same whether
8425
+ // it's for the left hand side of the relationship or the right hand side,
8426
+ // except the role of primary and inverse idToPayloads is reversed
8427
+ //
8428
+ };var previousPayload = void 0;
8431
8429
  var idToPayloads = void 0;
8432
8430
  var inverseIdToPayloads = void 0;
8433
8431
  var inverseIsMany = void 0;
@@ -8480,7 +8478,13 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8480
8478
  // Then we will initially have set user:2 as having helicopter:1, which we
8481
8479
  // need to remove before adding helicopter:1 to user:4
8482
8480
  //
8483
- this._removeInverse(id, previousPayload, inverseIdToPayloads);
8481
+ // only remove relationship information before adding if there is relationshipData.data
8482
+ // * null is considered new information "empty", and it should win
8483
+ // * undefined is NOT considered new information, we should keep original state
8484
+ // * anything else is considered new information, and it should win
8485
+ if (relationshipData.data !== undefined) {
8486
+ this._removeInverse(id, previousPayload, inverseIdToPayloads);
8487
+ }
8484
8488
  idToPayloads[id] = relationshipData;
8485
8489
  this._populateInverse(relationshipData, inverseRelationshipData, inverseIdToPayloads, inverseIsMany);
8486
8490
  }
@@ -9209,27 +9213,22 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
9209
9213
  };
9210
9214
 
9211
9215
  ManyRelationship.prototype.setInitialInternalModels = function setInitialInternalModels(internalModels) {
9212
- var _canonicalState;
9213
-
9214
9216
  if (Array.isArray(internalModels) === false || internalModels.length === 0) {
9215
9217
  return;
9216
9218
  }
9217
9219
 
9218
- var forCanonical = [];
9219
-
9220
9220
  for (var i = 0; i < internalModels.length; i++) {
9221
9221
  var internalModel = internalModels[i];
9222
9222
  if (this.canonicalMembers.has(internalModel)) {
9223
9223
  continue;
9224
9224
  }
9225
9225
 
9226
- forCanonical.push(internalModel);
9227
9226
  this.canonicalMembers.add(internalModel);
9228
9227
  this.members.add(internalModel);
9229
9228
  this.setupInverseRelationship(internalModel);
9230
9229
  }
9231
9230
 
9232
- (_canonicalState = this.canonicalState).splice.apply(_canonicalState, [0, this.canonicalState.length].concat(forCanonical));
9231
+ this.canonicalState = this.canonicalMembers.toArray();
9233
9232
  };
9234
9233
 
9235
9234
  ManyRelationship.prototype.fetchLink = function fetchLink() {
@@ -9424,8 +9423,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9424
9423
  };
9425
9424
 
9426
9425
  Relationship.prototype.removeInverseRelationships = function removeInverseRelationships() {
9427
- var _this = this;
9428
-
9429
9426
  if (!this.inverseKey) {
9430
9427
  return;
9431
9428
  }
@@ -9433,12 +9430,13 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9433
9430
  var allMembers =
9434
9431
  // we actually want a union of members and canonicalMembers
9435
9432
  // they should be disjoint but currently are not due to a bug
9436
- this.members.toArray().concat(this.canonicalMembers.toArray());
9433
+ this.members.list.concat(this.canonicalMembers.list);
9437
9434
 
9438
- allMembers.forEach(function (inverseInternalModel) {
9439
- var relationship = inverseInternalModel._relationships.get(_this.inverseKey);
9435
+ for (var i = 0; i < allMembers.length; i++) {
9436
+ var inverseInternalModel = allMembers[i];
9437
+ var relationship = inverseInternalModel._relationships.get(this.inverseKey);
9440
9438
  relationship.inverseDidDematerialize();
9441
- });
9439
+ }
9442
9440
  };
9443
9441
 
9444
9442
  Relationship.prototype.inverseDidDematerialize = function inverseDidDematerialize() {};
@@ -9463,18 +9461,18 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9463
9461
  };
9464
9462
 
9465
9463
  Relationship.prototype.removeInternalModels = function removeInternalModels(internalModels) {
9466
- var _this2 = this;
9464
+ var _this = this;
9467
9465
 
9468
9466
  internalModels.forEach(function (internalModel) {
9469
- return _this2.removeInternalModel(internalModel);
9467
+ return _this.removeInternalModel(internalModel);
9470
9468
  });
9471
9469
  };
9472
9470
 
9473
9471
  Relationship.prototype.addInternalModels = function addInternalModels(internalModels, idx) {
9474
- var _this3 = this;
9472
+ var _this2 = this;
9475
9473
 
9476
9474
  internalModels.forEach(function (internalModel) {
9477
- _this3.addInternalModel(internalModel, idx);
9475
+ _this2.addInternalModel(internalModel, idx);
9478
9476
  if (idx !== undefined) {
9479
9477
  idx++;
9480
9478
  }
@@ -9604,7 +9602,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9604
9602
  };
9605
9603
 
9606
9604
  Relationship.prototype.removeCompletelyFromInverse = function removeCompletelyFromInverse() {
9607
- var _this4 = this;
9605
+ var _this3 = this;
9608
9606
 
9609
9607
  if (!this.inverseKey) {
9610
9608
  return;
@@ -9619,7 +9617,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
9619
9617
  var id = guidFor(inverseInternalModel);
9620
9618
 
9621
9619
  if (seen[id] === undefined) {
9622
- var relationship = inverseInternalModel._relationships.get(_this4.inverseKey);
9620
+ var relationship = inverseInternalModel._relationships.get(_this3.inverseKey);
9623
9621
  relationship.removeCompletelyFromOwn(internalModel);
9624
9622
  seen[id] = true;
9625
9623
  }
@@ -11897,6 +11895,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11897
11895
  return;
11898
11896
  }
11899
11897
 
11898
+ var existingInternalModel = this._existingInternalModelForId(modelName, id);
11899
+
11900
+ (false && _ember.default.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));
11901
+
11902
+
11900
11903
  this._internalModelsFor(internalModel.modelName).set(id, internalModel);
11901
11904
 
11902
11905
  internalModel.setId(id);
@@ -11928,9 +11931,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
11928
11931
  _load: function (data) {
11929
11932
  var internalModel = this._internalModelForId(data.type, data.id);
11930
11933
 
11934
+ var isUpdate = internalModel.currentState.isEmpty === false;
11935
+
11931
11936
  internalModel.setupData(data);
11932
11937
 
11933
- this.recordArrayManager.recordDidChange(internalModel);
11938
+ if (isUpdate) {
11939
+ this.recordArrayManager.recordDidChange(internalModel);
11940
+ } else {
11941
+ this.recordArrayManager.recordWasLoaded(internalModel);
11942
+ }
11934
11943
 
11935
11944
  return internalModel;
11936
11945
  },
@@ -12438,15 +12447,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
12438
12447
  (false && _ember.default.assert('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string'));
12439
12448
 
12440
12449
 
12441
- var internalModels = this._internalModelsFor(modelName);
12442
- var existingInternalModel = internalModels.get(id);
12443
-
12444
- if (existingInternalModel && existingInternalModel.hasScheduledDestroy()) {
12445
- // unloadRecord is async, if one attempts to unload + then sync create,
12446
- // we must ensure the unload is complete before starting the create
12447
- existingInternalModel.destroySync();
12448
- existingInternalModel = null;
12449
- }
12450
+ var existingInternalModel = this._existingInternalModelForId(modelName, id);
12450
12451
 
12451
12452
  (false && _ember.default.assert('The id ' + id + ' has already been used with another record for modelClass \'' + modelName + '\'.', !existingInternalModel));
12452
12453
 
@@ -12455,10 +12456,21 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
12455
12456
 
12456
12457
  var internalModel = new _internalModel5.default(modelName, id, this, data);
12457
12458
 
12458
- internalModels.add(internalModel, id);
12459
+ this._internalModelsFor(modelName).add(internalModel, id);
12459
12460
 
12460
12461
  return internalModel;
12461
12462
  },
12463
+ _existingInternalModelForId: function (modelName, id) {
12464
+ var internalModel = this._internalModelsFor(modelName).get(id);
12465
+
12466
+ if (internalModel && internalModel.hasScheduledDestroy()) {
12467
+ // unloadRecord is async, if one attempts to unload + then sync create,
12468
+ // we must ensure the unload is complete before starting the create
12469
+ internalModel.destroySync();
12470
+ internalModel = null;
12471
+ }
12472
+ return internalModel;
12473
+ },
12462
12474
  buildInternalModel: function (modelName, id, data) {
12463
12475
  (false && !(false) && _ember.default.deprecate('buildInternalModel was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.buildInternalModel', until: '2.17.0' }));
12464
12476
 
@@ -18448,7 +18460,7 @@ define("ember-data/version", ["exports"], function (exports) {
18448
18460
  "use strict";
18449
18461
 
18450
18462
  exports.__esModule = true;
18451
- exports.default = "2.15.0-beta.4";
18463
+ exports.default = "2.15.0";
18452
18464
  });
18453
18465
  define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
18454
18466
  "use strict";