ember-data-source 3.0.1 → 3.0.2

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: c9d3e6ad6e471af79d00f460b0d4cace8901f1ba
4
- data.tar.gz: 8c8ffa27f05531025ce942da6ebac9dd446bf4fd
3
+ metadata.gz: 597dcc9886fdc5cdbb166c0d4d120bd680b5b75e
4
+ data.tar.gz: a5b9cac4299df0891fc04c08cd88b34ed95fa4d8
5
5
  SHA512:
6
- metadata.gz: 20714926fa0372955b588a45daeef2979a6ee2a60ce1a8271530f06310c806bff5dc58d2e9a553b254c9abbb93b4c7592fc4e58de01e3e40c088c4a0e39259c0
7
- data.tar.gz: 169a20b438b8c1f0880574d040eed63fbbb0080270c4d1c3de16f4289227a52bf2673c21cc0e39579cd0257373655a426aa7e48675862512568d2c703195453b
6
+ metadata.gz: 449da7d60bdb77852138fb0ad3c11fd7faedee99e9703fed1029ecccb61daab8ebf8e3d82bed20bf57b8d39939305bc72a8d2a6adb9b5052f3c0c75bd24cc24f
7
+ data.tar.gz: ff4163f377ffd3beed2fef38a4e9c6fd6a1321a17cc836e2c63042f56f1a9e77d87d0a68c2afa3c30b39297d9307a08077cfa931ba26e865271158e12038cd74
@@ -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 3.0.1
9
+ * @version 3.0.2
10
10
  */
11
11
 
12
12
  var loader, define, requireModule, require, requirejs;
@@ -4754,6 +4754,10 @@ define('ember-data/-private/system/model/model', ['exports', 'ember-data/-privat
4754
4754
  // the computed property.
4755
4755
  var meta = value.meta();
4756
4756
 
4757
+ /*
4758
+ This is buggy because if the parent has never been looked up
4759
+ via `modelFor` it will not have `modelName` set.
4760
+ */
4757
4761
  meta.parentType = proto.constructor;
4758
4762
  }
4759
4763
  }
@@ -7566,7 +7570,7 @@ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflec
7566
7570
  }
7567
7571
 
7568
7572
  function relationshipFromMeta(meta) {
7569
- var result = {
7573
+ return {
7570
7574
  key: meta.key,
7571
7575
  kind: meta.kind,
7572
7576
  type: typeForRelationshipMeta(meta),
@@ -7575,12 +7579,6 @@ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflec
7575
7579
  parentType: meta.parentType,
7576
7580
  isRelationship: true
7577
7581
  };
7578
-
7579
- if (false) {
7580
- result.parentType = meta.parentType;
7581
- }
7582
-
7583
- return result;
7584
7582
  }
7585
7583
  });
7586
7584
  define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember-data/-private/system/normalize-model-name'], function (exports, _normalizeModelName) {
@@ -7982,7 +7980,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
7982
7980
  }
7983
7981
  }
7984
7982
 
7985
- var _get = Ember.get;
7983
+ var get = Ember.get;
7986
7984
 
7987
7985
  var RelationshipPayloadsManager = function () {
7988
7986
  function RelationshipPayloadsManager(store) {
@@ -7991,6 +7989,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
7991
7989
  this._store = store;
7992
7990
  // cache of `RelationshipPayload`s
7993
7991
  this._cache = Object.create(null);
7992
+ this._inverseLookupCache = new _relationshipPayloads.TypeCache();
7994
7993
  }
7995
7994
 
7996
7995
  /**
@@ -8011,9 +8010,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
8011
8010
 
8012
8011
 
8013
8012
  RelationshipPayloadsManager.prototype.get = function get(modelName, id, relationshipName) {
8014
- var modelClass = this._store._modelFor(modelName);
8015
- var relationshipsByName = _get(modelClass, 'relationshipsByName');
8016
- var relationshipPayloads = this._getRelationshipPayloads(modelName, relationshipName, modelClass, relationshipsByName, false);
8013
+ var relationshipPayloads = this._getRelationshipPayloads(modelName, relationshipName, false);
8017
8014
  return relationshipPayloads && relationshipPayloads.get(modelName, id, relationshipName);
8018
8015
  };
8019
8016
 
@@ -8024,10 +8021,8 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
8024
8021
  return;
8025
8022
  }
8026
8023
 
8027
- var modelClass = this._store._modelFor(modelName);
8028
- var relationshipsByName = _get(modelClass, 'relationshipsByName');
8029
8024
  Object.keys(relationshipsData).forEach(function (key) {
8030
- var relationshipPayloads = _this._getRelationshipPayloads(modelName, key, modelClass, relationshipsByName, true);
8025
+ var relationshipPayloads = _this._getRelationshipPayloads(modelName, key, true);
8031
8026
  if (relationshipPayloads) {
8032
8027
  relationshipPayloads.push(modelName, id, key, relationshipsData[key]);
8033
8028
  }
@@ -8038,51 +8033,153 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
8038
8033
  var _this2 = this;
8039
8034
 
8040
8035
  var modelClass = this._store._modelFor(modelName);
8041
- var relationshipsByName = _get(modelClass, 'relationshipsByName');
8036
+ var relationshipsByName = get(modelClass, 'relationshipsByName');
8042
8037
  relationshipsByName.forEach(function (_, relationshipName) {
8043
- var relationshipPayloads = _this2._getRelationshipPayloads(modelName, relationshipName, modelClass, relationshipsByName, false);
8038
+ var relationshipPayloads = _this2._getRelationshipPayloads(modelName, relationshipName, false);
8044
8039
  if (relationshipPayloads) {
8045
8040
  relationshipPayloads.unload(modelName, id, relationshipName);
8046
8041
  }
8047
8042
  });
8048
8043
  };
8049
8044
 
8050
- RelationshipPayloadsManager.prototype._getRelationshipPayloads = function _getRelationshipPayloads(modelName, relationshipName, modelClass, relationshipsByName, init) {
8051
- if (!relationshipsByName.has(relationshipName)) {
8045
+ RelationshipPayloadsManager.prototype._getRelationshipPayloads = function _getRelationshipPayloads(modelName, relationshipName, init) {
8046
+ var relInfo = this.getRelationshipInfo(modelName, relationshipName);
8047
+
8048
+ if (relInfo === null) {
8052
8049
  return;
8053
8050
  }
8054
8051
 
8055
- var key = modelName + ':' + relationshipName;
8056
- if (!this._cache[key] && init) {
8057
- return this._initializeRelationshipPayloads(modelName, relationshipName, modelClass, relationshipsByName);
8052
+ var cache = this._cache[relInfo.lhs_key];
8053
+
8054
+ if (!cache && init) {
8055
+ return this._initializeRelationshipPayloads(relInfo);
8058
8056
  }
8059
8057
 
8060
- return this._cache[key];
8058
+ return cache;
8061
8059
  };
8062
8060
 
8063
- RelationshipPayloadsManager.prototype._initializeRelationshipPayloads = function _initializeRelationshipPayloads(modelName, relationshipName, modelClass, relationshipsByName) {
8061
+ RelationshipPayloadsManager.prototype.getRelationshipInfo = function getRelationshipInfo(modelName, relationshipName) {
8062
+ var inverseCache = this._inverseLookupCache;
8063
+ var store = this._store;
8064
+ var cached = inverseCache.get(modelName, relationshipName);
8065
+
8066
+ // CASE: We have a cached resolution (null if no relationship exists)
8067
+ if (cached !== undefined) {
8068
+ return cached;
8069
+ }
8070
+
8071
+ var modelClass = store._modelFor(modelName);
8072
+ var relationshipsByName = get(modelClass, 'relationshipsByName');
8073
+
8074
+ // CASE: We don't have a relationship at all
8075
+ if (!relationshipsByName.has(relationshipName)) {
8076
+ inverseCache.set(modelName, relationshipName, null);
8077
+ return null;
8078
+ }
8079
+
8080
+ var inverseMeta = modelClass.inverseFor(relationshipName, store);
8064
8081
  var relationshipMeta = relationshipsByName.get(relationshipName);
8065
- var inverseMeta = modelClass.inverseFor(relationshipName, this._store);
8066
-
8067
- var inverseModelName = void 0;
8068
- var inverseRelationshipName = void 0;
8069
- var inverseRelationshipMeta = void 0;
8070
-
8071
- // figure out the inverse relationship; we need two things
8072
- // a) the inverse model name
8073
- //- b) the name of the inverse relationship
8074
- if (inverseMeta) {
8075
- inverseRelationshipName = inverseMeta.name;
8076
- inverseModelName = relationshipMeta.type;
8077
- inverseRelationshipMeta = _get(inverseMeta.type, 'relationshipsByName').get(inverseRelationshipName);
8078
- } else {
8079
- // relationship has no inverse
8080
- inverseModelName = inverseRelationshipName = '';
8081
- inverseRelationshipMeta = null;
8082
+ var selfIsPolymorphic = relationshipMeta.options !== undefined && relationshipMeta.options.polymorphic === true;
8083
+ var inverseBaseModelName = relationshipMeta.type;
8084
+
8085
+ // CASE: We have no inverse
8086
+ if (!inverseMeta) {
8087
+ var _info = {
8088
+ lhs_key: modelName + ':' + relationshipName,
8089
+ lhs_modelNames: [modelName],
8090
+ lhs_baseModelName: modelName,
8091
+ lhs_relationshipName: relationshipName,
8092
+ lhs_relationshipMeta: relationshipMeta,
8093
+ lhs_isPolymorphic: selfIsPolymorphic,
8094
+ rhs_key: '',
8095
+ rhs_modelNames: [],
8096
+ rhs_baseModelName: inverseBaseModelName,
8097
+ rhs_relationshipName: '',
8098
+ rhs_relationshipMeta: null,
8099
+ rhs_isPolymorphic: false,
8100
+ hasInverse: false,
8101
+ isSelfReferential: false, // modelName === inverseBaseModelName,
8102
+ isReflexive: false
8103
+ };
8104
+
8105
+ inverseCache.set(modelName, relationshipName, _info);
8106
+
8107
+ return _info;
8082
8108
  }
8083
8109
 
8084
- var lhsKey = modelName + ':' + relationshipName;
8085
- var rhsKey = inverseModelName + ':' + inverseRelationshipName;
8110
+ // CASE: We do have an inverse
8111
+
8112
+ var inverseRelationshipName = inverseMeta.name;
8113
+ var inverseRelationshipMeta = get(inverseMeta.type, 'relationshipsByName').get(inverseRelationshipName);
8114
+ var baseModelName = inverseRelationshipMeta.type;
8115
+ var isSelfReferential = baseModelName === inverseBaseModelName;
8116
+
8117
+ // TODO we want to assert this but this breaks all of our shoddily written tests
8118
+ /*
8119
+ if (DEBUG) {
8120
+ let inverseDoubleCheck = inverseMeta.type.inverseFor(inverseRelationshipName, store);
8121
+ assert(`The ${inverseBaseModelName}:${inverseRelationshipName} relationship declares 'inverse: null', but it was resolved as the inverse for ${baseModelName}:${relationshipName}.`, inverseDoubleCheck);
8122
+ }
8123
+ */
8124
+
8125
+ // CASE: We may have already discovered the inverse for the baseModelName
8126
+ // CASE: We have already discovered the inverse
8127
+ cached = inverseCache.get(baseModelName, relationshipName) || inverseCache.get(inverseBaseModelName, inverseRelationshipName);
8128
+ if (cached) {
8129
+ (false && Ember.assert('The ' + inverseBaseModelName + ':' + inverseRelationshipName + ' relationship declares \'inverse: null\', but it was resolved as the inverse for ' + baseModelName + ':' + relationshipName + '.', cached.hasInverse !== false));
8130
+
8131
+
8132
+ var isLHS = cached.lhs_baseModelName === baseModelName;
8133
+ var modelNames = isLHS ? cached.lhs_modelNames : cached.rhs_modelNames;
8134
+ // make this lookup easier in the future by caching the key
8135
+ modelNames.push(modelName);
8136
+ inverseCache.set(modelName, relationshipName, cached);
8137
+
8138
+ return cached;
8139
+ }
8140
+
8141
+ var info = {
8142
+ lhs_key: baseModelName + ':' + relationshipName,
8143
+ lhs_modelNames: [modelName],
8144
+ lhs_baseModelName: baseModelName,
8145
+ lhs_relationshipName: relationshipName,
8146
+ lhs_relationshipMeta: relationshipMeta,
8147
+ lhs_isPolymorphic: selfIsPolymorphic,
8148
+ rhs_key: inverseBaseModelName + ':' + inverseRelationshipName,
8149
+ rhs_modelNames: [],
8150
+ rhs_baseModelName: inverseBaseModelName,
8151
+ rhs_relationshipName: inverseRelationshipName,
8152
+ rhs_relationshipMeta: inverseRelationshipMeta,
8153
+ rhs_isPolymorphic: inverseRelationshipMeta.options !== undefined && inverseRelationshipMeta.options.polymorphic === true,
8154
+ hasInverse: true,
8155
+ isSelfReferential: isSelfReferential,
8156
+ isReflexive: isSelfReferential && relationshipName === inverseRelationshipName
8157
+ };
8158
+
8159
+ // Create entries for the baseModelName as well as modelName to speed up
8160
+ // inverse lookups
8161
+ inverseCache.set(baseModelName, relationshipName, info);
8162
+ inverseCache.set(modelName, relationshipName, info);
8163
+
8164
+ // Greedily populate the inverse
8165
+ inverseCache.set(inverseBaseModelName, inverseRelationshipName, info);
8166
+
8167
+ return info;
8168
+ };
8169
+
8170
+ RelationshipPayloadsManager.prototype._initializeRelationshipPayloads = function _initializeRelationshipPayloads(relInfo) {
8171
+ var lhsKey = relInfo.lhs_key;
8172
+ var rhsKey = relInfo.rhs_key;
8173
+ var existingPayloads = this._cache[lhsKey];
8174
+
8175
+ if (relInfo.hasInverse === true && relInfo.rhs_isPolymorphic === true) {
8176
+ existingPayloads = this._cache[rhsKey];
8177
+
8178
+ if (existingPayloads !== undefined) {
8179
+ this._cache[lhsKey] = existingPayloads;
8180
+ return existingPayloads;
8181
+ }
8182
+ }
8086
8183
 
8087
8184
  // populate the cache for both sides of the relationship, as they both use
8088
8185
  // the same `RelationshipPayloads`.
@@ -8090,7 +8187,13 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
8090
8187
  // This works out better than creating a single common key, because to
8091
8188
  // compute that key we would need to do work to look up the inverse
8092
8189
  //
8093
- return this._cache[lhsKey] = this._cache[rhsKey] = new _relationshipPayloads.default(this._store, modelName, relationshipName, relationshipMeta, inverseModelName, inverseRelationshipName, inverseRelationshipMeta);
8190
+ var cache = this._cache[lhsKey] = new _relationshipPayloads.default(relInfo);
8191
+
8192
+ if (relInfo.hasInverse === true) {
8193
+ this._cache[rhsKey] = cache;
8194
+ }
8195
+
8196
+ return cache;
8094
8197
  };
8095
8198
 
8096
8199
  return RelationshipPayloadsManager;
@@ -8103,12 +8206,6 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8103
8206
 
8104
8207
  exports.__esModule = true;
8105
8208
 
8106
- function _classCallCheck(instance, Constructor) {
8107
- if (!(instance instanceof Constructor)) {
8108
- throw new TypeError("Cannot call a class as a function");
8109
- }
8110
- }
8111
-
8112
8209
  var _createClass = function () {
8113
8210
  function defineProperties(target, props) {
8114
8211
  for (var i = 0; i < props.length; i++) {
@@ -8127,37 +8224,61 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8127
8224
  };
8128
8225
  }();
8129
8226
 
8130
- var RelationshipPayloads = function () {
8131
- function RelationshipPayloads(store, modelName, relationshipName, relationshipMeta, inverseModelName, inverseRelationshipName, inverseRelationshipMeta) {
8132
- _classCallCheck(this, RelationshipPayloads);
8227
+ function _classCallCheck(instance, Constructor) {
8228
+ if (!(instance instanceof Constructor)) {
8229
+ throw new TypeError("Cannot call a class as a function");
8230
+ }
8231
+ }
8133
8232
 
8134
- this._store = store;
8233
+ var TypeCache = exports.TypeCache = function () {
8234
+ function TypeCache() {
8235
+ _classCallCheck(this, TypeCache);
8135
8236
 
8136
- this._lhsModelName = modelName;
8137
- this._lhsRelationshipName = relationshipName;
8138
- this._lhsRelationshipMeta = relationshipMeta;
8237
+ this.types = Object.create(null);
8238
+ }
8139
8239
 
8140
- this._rhsModelName = inverseModelName;
8141
- this._rhsRelationshipName = inverseRelationshipName;
8142
- this._rhsRelationshipMeta = inverseRelationshipMeta;
8240
+ TypeCache.prototype.get = function get(modelName, id) {
8241
+ var types = this.types;
8143
8242
 
8144
- // a map of id -> payloads for the left hand side of the relationship.
8145
- this._lhsPayloads = Object.create(null);
8146
- if (modelName !== inverseModelName || relationshipName !== inverseRelationshipName) {
8147
- // The common case of a non-reflexive relationship, or a reflexive
8148
- // relationship whose inverse is not itself
8149
- this._rhsPayloads = Object.create(null);
8150
- this._isReflexive = false;
8151
- } else {
8152
- // Edge case when we have a reflexive relationship to itself
8153
- // eg user hasMany friends inverse friends
8154
- //
8155
- // In this case there aren't really two sides to the relationship, but
8156
- // we set `_rhsPayloads = _lhsPayloads` to make things easier to reason
8157
- // about
8158
- this._rhsPayloads = this._lhsPayloads;
8159
- this._isReflexive = true;
8243
+
8244
+ if (types[modelName] !== undefined) {
8245
+ return types[modelName][id];
8160
8246
  }
8247
+ };
8248
+
8249
+ TypeCache.prototype.set = function set(modelName, id, payload) {
8250
+ var types = this.types;
8251
+
8252
+ var typeMap = types[modelName];
8253
+
8254
+ if (typeMap === undefined) {
8255
+ typeMap = types[modelName] = Object.create(null);
8256
+ }
8257
+
8258
+ typeMap[id] = payload;
8259
+ };
8260
+
8261
+ TypeCache.prototype.delete = function _delete(modelName, id) {
8262
+ var types = this.types;
8263
+
8264
+
8265
+ if (types[modelName] !== undefined) {
8266
+ delete types[modelName][id];
8267
+ }
8268
+ };
8269
+
8270
+ return TypeCache;
8271
+ }();
8272
+
8273
+ var RelationshipPayloads = function () {
8274
+ function RelationshipPayloads(relInfo) {
8275
+ _classCallCheck(this, RelationshipPayloads);
8276
+
8277
+ this._relInfo = relInfo;
8278
+
8279
+ // a map of id -> payloads for the left hand side of the relationship.
8280
+ this.lhs_payloads = new TypeCache();
8281
+ this.rhs_payloads = relInfo.isReflexive ? this.lhs_payloads : new TypeCache();
8161
8282
 
8162
8283
  // When we push relationship payloads, just stash them in a queue until
8163
8284
  // somebody actually asks for one of them.
@@ -8168,22 +8289,22 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8168
8289
  }
8169
8290
 
8170
8291
  /**
8171
- Get the payload for the relationship of an individual record.
8172
- This might return the raw payload as pushed into the store, or one computed
8173
- from the payload of the inverse relationship.
8174
- @method
8175
- */
8292
+ Get the payload for the relationship of an individual record.
8293
+ This might return the raw payload as pushed into the store, or one computed
8294
+ from the payload of the inverse relationship.
8295
+ @method
8296
+ */
8176
8297
 
8177
8298
 
8178
8299
  RelationshipPayloads.prototype.get = function get(modelName, id, relationshipName) {
8179
8300
  this._flushPending();
8180
8301
 
8181
8302
  if (this._isLHS(modelName, relationshipName)) {
8182
- return this._lhsPayloads[id];
8303
+ return this.lhs_payloads.get(modelName, id);
8183
8304
  } else {
8184
- (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8305
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._relInfo.lhs_key + '<->' + this._relInfo.rhs_key, this._isRHS(modelName, relationshipName)));
8185
8306
 
8186
- return this._rhsPayloads[id];
8307
+ return this.rhs_payloads.get(modelName, id);
8187
8308
  }
8188
8309
  };
8189
8310
 
@@ -8195,20 +8316,40 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8195
8316
  this._flushPending();
8196
8317
 
8197
8318
  if (this._isLHS(modelName, relationshipName)) {
8198
- delete this._lhsPayloads[id];
8319
+ delete this.lhs_payloads.delete(modelName, id);
8199
8320
  } else {
8200
- (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8321
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._relInfo.lhs_baseModelName + ':' + this._relInfo.lhs_relationshipName + '<->' + this._relInfo.rhs_baseModelName + ':' + this._relInfo.rhs_relationshipName, this._isRHS(modelName, relationshipName)));
8201
8322
 
8202
- delete this._rhsPayloads[id];
8323
+ delete this.rhs_payloads.delete(modelName, id);
8203
8324
  }
8204
8325
  };
8205
8326
 
8206
8327
  RelationshipPayloads.prototype._isLHS = function _isLHS(modelName, relationshipName) {
8207
- return modelName === this._lhsModelName && relationshipName === this._lhsRelationshipName;
8328
+ var relInfo = this._relInfo;
8329
+ var isSelfReferential = relInfo.isSelfReferential;
8330
+ var isRelationship = relationshipName === relInfo.lhs_relationshipName;
8331
+
8332
+ if (isRelationship === true) {
8333
+ return isSelfReferential === true || // itself
8334
+ modelName === relInfo.lhs_baseModelName || // base or non-polymorphic
8335
+ relInfo.lhs_modelNames.indexOf(modelName) !== -1; // polymorphic
8336
+ }
8337
+
8338
+ return false;
8208
8339
  };
8209
8340
 
8210
8341
  RelationshipPayloads.prototype._isRHS = function _isRHS(modelName, relationshipName) {
8211
- return modelName === this._rhsModelName && relationshipName === this._rhsRelationshipName;
8342
+ var relInfo = this._relInfo;
8343
+ var isSelfReferential = relInfo.isSelfReferential;
8344
+ var isRelationship = relationshipName === relInfo.rhs_relationshipName;
8345
+
8346
+ if (isRelationship === true) {
8347
+ return isSelfReferential === true || // itself
8348
+ modelName === relInfo.rhs_baseModelName || // base or non-polymorphic
8349
+ relInfo.rhs_modelNames.indexOf(modelName) !== -1; // polymorphic
8350
+ }
8351
+
8352
+ return false;
8212
8353
  };
8213
8354
 
8214
8355
  RelationshipPayloads.prototype._flushPending = function _flushPending() {
@@ -8229,26 +8370,28 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8229
8370
  id: id,
8230
8371
  type: modelName
8231
8372
  }
8373
+ };
8232
8374
 
8233
- // start flushing this individual payload. The logic is the same whether
8234
- // it's for the left hand side of the relationship or the right hand side,
8235
- // except the role of primary and inverse idToPayloads is reversed
8236
- //
8237
- };var previousPayload = void 0;
8238
- var idToPayloads = void 0;
8239
- var inverseIdToPayloads = void 0;
8375
+ // start flushing this individual payload. The logic is the same whether
8376
+ // it's for the left hand side of the relationship or the right hand side,
8377
+ // except the role of primary and inverse idToPayloads is reversed
8378
+ //
8379
+ var previousPayload = void 0;
8380
+ var payloadMap = void 0;
8381
+ var inversePayloadMap = void 0;
8240
8382
  var inverseIsMany = void 0;
8383
+
8241
8384
  if (this._isLHS(modelName, relationshipName)) {
8242
- previousPayload = this._lhsPayloads[id];
8243
- idToPayloads = this._lhsPayloads;
8244
- inverseIdToPayloads = this._rhsPayloads;
8385
+ previousPayload = this.lhs_payloads.get(modelName, id);
8386
+ payloadMap = this.lhs_payloads;
8387
+ inversePayloadMap = this.rhs_payloads;
8245
8388
  inverseIsMany = this._rhsRelationshipIsMany;
8246
8389
  } else {
8247
- (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
8390
+ (false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._relInfo.lhs_key + '<->' + this._relInfo.rhs_key, this._isRHS(modelName, relationshipName)));
8248
8391
 
8249
- previousPayload = this._rhsPayloads[id];
8250
- idToPayloads = this._rhsPayloads;
8251
- inverseIdToPayloads = this._lhsPayloads;
8392
+ previousPayload = this.rhs_payloads.get(modelName, id);
8393
+ payloadMap = this.rhs_payloads;
8394
+ inversePayloadMap = this.lhs_payloads;
8252
8395
  inverseIsMany = this._lhsRelationshipIsMany;
8253
8396
  }
8254
8397
 
@@ -8292,14 +8435,14 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8292
8435
  // * undefined is NOT considered new information, we should keep original state
8293
8436
  // * anything else is considered new information, and it should win
8294
8437
  if (relationshipData.data !== undefined) {
8295
- this._removeInverse(id, previousPayload, inverseIdToPayloads);
8438
+ this._removeInverse(id, previousPayload, inversePayloadMap);
8296
8439
  }
8297
- idToPayloads[id] = relationshipData;
8298
- this._populateInverse(relationshipData, inverseRelationshipData, inverseIdToPayloads, inverseIsMany);
8440
+ payloadMap.set(modelName, id, relationshipData);
8441
+ this._populateInverse(relationshipData, inverseRelationshipData, inversePayloadMap, inverseIsMany);
8299
8442
  }
8300
8443
  };
8301
8444
 
8302
- RelationshipPayloads.prototype._populateInverse = function _populateInverse(relationshipData, inversePayload, inverseIdToPayloads, inverseIsMany) {
8445
+ RelationshipPayloads.prototype._populateInverse = function _populateInverse(relationshipData, inversePayload, inversePayloadMap, inverseIsMany) {
8303
8446
  if (!relationshipData.data) {
8304
8447
  // This id doesn't have an inverse, eg a belongsTo with a payload
8305
8448
  // { data: null }, so there's nothing to populate
@@ -8308,22 +8451,24 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8308
8451
 
8309
8452
  if (Array.isArray(relationshipData.data)) {
8310
8453
  for (var i = 0; i < relationshipData.data.length; ++i) {
8311
- var inverseId = relationshipData.data[i].id;
8312
- this._addToInverse(inversePayload, inverseId, inverseIdToPayloads, inverseIsMany);
8454
+ var resourceIdentifier = relationshipData.data[i];
8455
+ this._addToInverse(inversePayload, resourceIdentifier, inversePayloadMap, inverseIsMany);
8313
8456
  }
8314
8457
  } else {
8315
- var _inverseId = relationshipData.data.id;
8316
- this._addToInverse(inversePayload, _inverseId, inverseIdToPayloads, inverseIsMany);
8458
+ var _resourceIdentifier = relationshipData.data;
8459
+ this._addToInverse(inversePayload, _resourceIdentifier, inversePayloadMap, inverseIsMany);
8317
8460
  }
8318
8461
  };
8319
8462
 
8320
- RelationshipPayloads.prototype._addToInverse = function _addToInverse(inversePayload, inverseId, inverseIdToPayloads, inverseIsMany) {
8321
- if (this._isReflexive && inversePayload.data.id === inverseId) {
8463
+ RelationshipPayloads.prototype._addToInverse = function _addToInverse(inversePayload, resourceIdentifier, inversePayloadMap, inverseIsMany) {
8464
+ var relInfo = this._relInfo;
8465
+
8466
+ if (relInfo.isReflexive && inversePayload.data.id === resourceIdentifier.id) {
8322
8467
  // eg <user:1>.friends = [{ id: 1, type: 'user' }]
8323
8468
  return;
8324
8469
  }
8325
8470
 
8326
- var existingPayload = inverseIdToPayloads[inverseId];
8471
+ var existingPayload = inversePayloadMap.get(resourceIdentifier.type, resourceIdentifier.id);
8327
8472
  var existingData = existingPayload && existingPayload.data;
8328
8473
 
8329
8474
  if (existingData) {
@@ -8333,22 +8478,22 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8333
8478
  if (Array.isArray(existingData)) {
8334
8479
  existingData.push(inversePayload.data);
8335
8480
  } else {
8336
- inverseIdToPayloads[inverseId] = inversePayload;
8481
+ inversePayloadMap.set(resourceIdentifier.type, resourceIdentifier.id, inversePayload);
8337
8482
  }
8338
8483
  } else {
8339
8484
  // first time we're populating the inverse side
8340
8485
  //
8341
8486
  if (inverseIsMany) {
8342
- inverseIdToPayloads[inverseId] = {
8487
+ inversePayloadMap.set(resourceIdentifier.type, resourceIdentifier.id, {
8343
8488
  data: [inversePayload.data]
8344
- };
8489
+ });
8345
8490
  } else {
8346
- inverseIdToPayloads[inverseId] = inversePayload;
8491
+ inversePayloadMap.set(resourceIdentifier.type, resourceIdentifier.id, inversePayload);
8347
8492
  }
8348
8493
  }
8349
8494
  };
8350
8495
 
8351
- RelationshipPayloads.prototype._removeInverse = function _removeInverse(id, previousPayload, inverseIdToPayloads) {
8496
+ RelationshipPayloads.prototype._removeInverse = function _removeInverse(id, previousPayload, inversePayloadMap) {
8352
8497
  var data = previousPayload && previousPayload.data;
8353
8498
  if (!data) {
8354
8499
  // either this is the first time we've seen a payload for this id, or its
@@ -8363,15 +8508,16 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8363
8508
  if (Array.isArray(data)) {
8364
8509
  // TODO: diff rather than removeall addall?
8365
8510
  for (var i = 0; i < data.length; ++i) {
8366
- this._removeFromInverse(id, data[i].id, inverseIdToPayloads);
8511
+ var resourceIdentifier = data[i];
8512
+ this._removeFromInverse(id, resourceIdentifier, inversePayloadMap);
8367
8513
  }
8368
8514
  } else {
8369
- this._removeFromInverse(id, data.id, inverseIdToPayloads);
8515
+ this._removeFromInverse(id, data, inversePayloadMap);
8370
8516
  }
8371
8517
  };
8372
8518
 
8373
- RelationshipPayloads.prototype._removeFromInverse = function _removeFromInverse(id, inverseId, inversePayloads) {
8374
- var inversePayload = inversePayloads[inverseId];
8519
+ RelationshipPayloads.prototype._removeFromInverse = function _removeFromInverse(id, resourceIdentifier, inversePayloads) {
8520
+ var inversePayload = inversePayloads.get(resourceIdentifier.type, resourceIdentifier.id);
8375
8521
  var data = inversePayload && inversePayload.data;
8376
8522
 
8377
8523
  if (!data) {
@@ -8383,21 +8529,23 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
8383
8529
  return x.id !== id;
8384
8530
  });
8385
8531
  } else {
8386
- inversePayloads[inverseId] = {
8532
+ inversePayloads.set(resourceIdentifier.type, resourceIdentifier.id, {
8387
8533
  data: null
8388
- };
8534
+ });
8389
8535
  }
8390
8536
  };
8391
8537
 
8392
8538
  _createClass(RelationshipPayloads, [{
8393
8539
  key: '_lhsRelationshipIsMany',
8394
8540
  get: function () {
8395
- return this._lhsRelationshipMeta && this._lhsRelationshipMeta.kind === 'hasMany';
8541
+ var meta = this._relInfo.lhs_relationshipMeta;
8542
+ return meta !== null && meta.kind === 'hasMany';
8396
8543
  }
8397
8544
  }, {
8398
8545
  key: '_rhsRelationshipIsMany',
8399
8546
  get: function () {
8400
- return this._rhsRelationshipMeta && this._rhsRelationshipMeta.kind === 'hasMany';
8547
+ var meta = this._relInfo.rhs_relationshipMeta;
8548
+ return meta !== null && meta.kind === 'hasMany';
8401
8549
  }
8402
8550
  }]);
8403
8551
 
@@ -18113,7 +18261,7 @@ define("ember-data/version", ["exports"], function (exports) {
18113
18261
  "use strict";
18114
18262
 
18115
18263
  exports.__esModule = true;
18116
- exports.default = "3.0.1";
18264
+ exports.default = "3.0.2";
18117
18265
  });
18118
18266
  define("ember-inflector", ["module", "exports", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _system) {
18119
18267
  "use strict";