ember-data-source 2.0.1 → 2.1.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -340,7 +340,10 @@
340
340
  */
341
341
 
342
342
  function ember$data$lib$adapters$errors$$InvalidError(errors) {
343
- Ember.assert('`InvalidError` expects json-api formatted errors array.', Ember.isArray(errors || []));
343
+ if (!Ember.isArray(errors)) {
344
+ Ember.deprecate('`InvalidError` expects json-api formatted errors.', false, { id: 'ds.errors.invalid-error-expects-json-api-format', until: '2.0.0' });
345
+ errors = ember$data$lib$adapters$errors$$errorsHashToArray(errors);
346
+ }
344
347
  ember$data$lib$adapters$errors$$AdapterError.call(this, errors, 'The adapter rejected the commit because it was invalid');
345
348
  }
346
349
 
@@ -577,8 +580,7 @@
577
580
  }
578
581
  });
579
582
  ```
580
- @private
581
- @method query
583
+ @method query
582
584
  @param {DS.Store} store
583
585
  @param {DS.Model} type
584
586
  @param {Object} query
@@ -1217,6 +1219,24 @@
1217
1219
  var ember$data$lib$system$map$$MapWithDefault = Ember.MapWithDefault;
1218
1220
 
1219
1221
  var ember$data$lib$system$map$$default = ember$data$lib$system$map$$Map;
1222
+ var ember$data$lib$system$empty$object$$default = ember$data$lib$system$empty$object$$EmptyObject;
1223
+ // This exists because `Object.create(null)` is absurdly slow compared
1224
+ // to `new EmptyObject()`. In either case, you want a null prototype
1225
+ // when you're treating the object instances as arbitrary dictionaries
1226
+ // and don't want your keys colliding with build-in methods on the
1227
+ // default object prototype.
1228
+ var ember$data$lib$system$empty$object$$proto = Object.create(null, {
1229
+ // without this, we will always still end up with (new
1230
+ // EmptyObject()).constructor === Object
1231
+ constructor: {
1232
+ value: undefined,
1233
+ enumerable: false,
1234
+ writable: true
1235
+ }
1236
+ });
1237
+ function ember$data$lib$system$empty$object$$EmptyObject() {}
1238
+
1239
+ ember$data$lib$system$empty$object$$EmptyObject.prototype = ember$data$lib$system$empty$object$$proto;
1220
1240
 
1221
1241
  /**
1222
1242
  The REST adapter allows your store to communicate with an HTTP server by
@@ -1541,7 +1561,8 @@
1541
1561
  of the records for a given type.
1542
1562
  The `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
1543
1563
  promise for the resulting payload.
1544
- @method findAll
1564
+ @private
1565
+ @method findAll
1545
1566
  @param {DS.Store} store
1546
1567
  @param {DS.Model} type
1547
1568
  @param {String} sinceToken
@@ -1567,7 +1588,8 @@
1567
1588
  payload.
1568
1589
  The `query` argument is a simple JavaScript object that will be passed directly
1569
1590
  to the server as parameters.
1570
- @method query
1591
+ @private
1592
+ @method query
1571
1593
  @param {DS.Store} store
1572
1594
  @param {DS.Model} type
1573
1595
  @param {Object} query
@@ -1591,7 +1613,8 @@
1591
1613
  payload.
1592
1614
  The `query` argument is a simple JavaScript object that will be passed directly
1593
1615
  to the server as parameters.
1594
- @method queryRecord
1616
+ @private
1617
+ @method queryRecord
1595
1618
  @param {DS.Store} store
1596
1619
  @param {DS.Model} type
1597
1620
  @param {Object} query
@@ -2038,7 +2061,7 @@
2038
2061
  });
2039
2062
 
2040
2063
  function ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(headerStr) {
2041
- var headers = Object.create(null);
2064
+ var headers = new ember$data$lib$system$empty$object$$default();
2042
2065
  if (!headerStr) {
2043
2066
  return headers;
2044
2067
  }
@@ -2099,44 +2122,6 @@
2099
2122
  return hash;
2100
2123
  },
2101
2124
 
2102
- /**
2103
- By default the JSONAPIAdapter will send each find request coming from a `store.find`
2104
- or from accessing a relationship separately to the server. If your server supports passing
2105
- ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
2106
- within a single runloop.
2107
- For example, if you have an initial payload of:
2108
- ```javascript
2109
- {
2110
- post: {
2111
- id: 1,
2112
- comments: [1, 2]
2113
- }
2114
- }
2115
- ```
2116
- By default calling `post.get('comments')` will trigger the following requests(assuming the
2117
- comments haven't been loaded before):
2118
- ```
2119
- GET /comments/1
2120
- GET /comments/2
2121
- ```
2122
- If you set coalesceFindRequests to `true` it will instead trigger the following request:
2123
- ```
2124
- GET /comments?filter[id]=1,2
2125
- ```
2126
- Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
2127
- relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
2128
- ```javascript
2129
- store.findRecord('comment', 1);
2130
- store.findRecord('comment', 2);
2131
- ```
2132
- will also send a request to: `GET /comments?filter[id]=1,2`
2133
- Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
2134
- `groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
2135
- @property coalesceFindRequests
2136
- @type {boolean}
2137
- */
2138
- coalesceFindRequests: false,
2139
-
2140
2125
  /**
2141
2126
  @method findMany
2142
2127
  @param {DS.Store} store
@@ -2182,7 +2167,7 @@
2182
2167
  });
2183
2168
 
2184
2169
  var ember$data$lib$core$$DS = Ember.Namespace.create({
2185
- VERSION: '2.0.1'
2170
+ VERSION: '2.1.0-beta.1'
2186
2171
  });
2187
2172
 
2188
2173
  if (Ember.libraries) {
@@ -3235,7 +3220,7 @@
3235
3220
  var currentData = ember$data$lib$system$model$model$$get(this._internalModel, '_attributes');
3236
3221
  var inFlightData = ember$data$lib$system$model$model$$get(this._internalModel, '_inFlightAttributes');
3237
3222
  var newData = ember$data$lib$system$model$model$$merge(ember$data$lib$system$model$model$$copy(inFlightData), currentData);
3238
- var diffData = Object.create(null);
3223
+ var diffData = new ember$data$lib$system$empty$object$$default();
3239
3224
 
3240
3225
  var newDataKeys = Object.keys(newData);
3241
3226
 
@@ -3454,7 +3439,7 @@
3454
3439
 
3455
3440
  var ember$data$lib$system$store$serializer$response$$get = Ember.get;
3456
3441
 
3457
- /*
3442
+ /**
3458
3443
  This is a helper method that validates a JSON API top-level document
3459
3444
 
3460
3445
  The format of a document is described here:
@@ -3512,7 +3497,7 @@
3512
3497
  return errors;
3513
3498
  }
3514
3499
 
3515
- /*
3500
+ /**
3516
3501
  This is a helper method that always returns a JSON-API Document.
3517
3502
 
3518
3503
  @method normalizeResponseHelper
@@ -3540,7 +3525,7 @@
3540
3525
  return normalizedResponse;
3541
3526
  }
3542
3527
 
3543
- /*
3528
+ /**
3544
3529
  Convert the payload from `serializer.extract` to a JSON-API Document.
3545
3530
 
3546
3531
  @method _normalizeSerializerPayload
@@ -3566,7 +3551,7 @@
3566
3551
  return { data: data };
3567
3552
  }
3568
3553
 
3569
- /*
3554
+ /**
3570
3555
  Convert the payload representing a single record from `serializer.extract` to
3571
3556
  a JSON-API Resource Object.
3572
3557
 
@@ -3652,7 +3637,7 @@
3652
3637
  return { id: '' + value, type: relationshipMeta.type };
3653
3638
  }
3654
3639
 
3655
- /*
3640
+ /**
3656
3641
  This method converts a JSON-API Resource Object to a format that DS.Store
3657
3642
  understands.
3658
3643
 
@@ -4190,9 +4175,8 @@
4190
4175
  });
4191
4176
 
4192
4177
  var ember$data$lib$system$clone$null$$default = ember$data$lib$system$clone$null$$cloneNull;
4193
-
4194
4178
  function ember$data$lib$system$clone$null$$cloneNull(source) {
4195
- var clone = Object.create(null);
4179
+ var clone = new ember$data$lib$system$empty$object$$default();
4196
4180
  for (var key in source) {
4197
4181
  clone[key] = source[key];
4198
4182
  }
@@ -4621,10 +4605,10 @@
4621
4605
  */
4622
4606
  function ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache(container) {
4623
4607
  this._container = container;
4624
- this._cache = Object.create(null);
4608
+ this._cache = new ember$data$lib$system$empty$object$$default();
4625
4609
  }
4626
4610
 
4627
- ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype = Object.create(null);
4611
+ ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype = new ember$data$lib$system$empty$object$$default();
4628
4612
 
4629
4613
  ember$lib$main$$default.merge(ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype, {
4630
4614
  get: function (type, preferredKey, fallbacks) {
@@ -4701,7 +4685,6 @@
4701
4685
 
4702
4686
  return original;
4703
4687
  }
4704
-
4705
4688
  var ember$data$lib$system$model$states$$get = Ember.get;
4706
4689
  /*
4707
4690
  This file encapsulates the various states that a record can transition
@@ -5056,7 +5039,7 @@
5056
5039
  },
5057
5040
 
5058
5041
  exit: function (internalModel) {
5059
- internalModel._inFlightAttributes = Object.create(null);
5042
+ internalModel._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
5060
5043
  }
5061
5044
  }
5062
5045
  };
@@ -5474,7 +5457,6 @@
5474
5457
  this.linkPromise = null;
5475
5458
  this.meta = null;
5476
5459
  this.hasData = false;
5477
- this.hasLoaded = false;
5478
5460
  }
5479
5461
 
5480
5462
  ember$data$lib$system$relationships$state$relationship$$Relationship.prototype = {
@@ -5659,7 +5641,6 @@
5659
5641
  if (link !== this.link) {
5660
5642
  this.link = link;
5661
5643
  this.linkPromise = null;
5662
- this.setHasLoaded(false);
5663
5644
  this.record.notifyPropertyChange(this.key);
5664
5645
  }
5665
5646
  },
@@ -5681,35 +5662,13 @@
5681
5662
  //TODO Once we have adapter support, we need to handle updated and canonical changes
5682
5663
  this.computeChanges(records);
5683
5664
  this.setHasData(true);
5684
- this.setHasLoaded(true);
5685
5665
  },
5686
5666
 
5687
5667
  notifyRecordRelationshipAdded: Ember.K,
5688
5668
  notifyRecordRelationshipRemoved: Ember.K,
5689
5669
 
5690
- /*
5691
- `hasData` for a relationship is a flag to indicate if we consider the
5692
- content of this relationship "known". Snapshots uses this to tell the
5693
- difference between unknown (`undefined`) or empty (`null`). The reason for
5694
- this is that we wouldn't want to serialize unknown relationships as `null`
5695
- as that might overwrite remote state.
5696
- All relationships for a newly created (`store.createRecord()`) are
5697
- considered known (`hasData === true`).
5698
- */
5699
5670
  setHasData: function (value) {
5700
5671
  this.hasData = value;
5701
- },
5702
-
5703
- /*
5704
- `hasLoaded` is a flag to indicate if we have gotten data from the adapter or
5705
- not when the relationship has a link.
5706
- This is used to be able to tell when to fetch the link and when to return
5707
- the local data in scenarios where the local state is considered known
5708
- (`hasData === true`).
5709
- Updating the link will automatically set `hasLoaded` to `false`.
5710
- */
5711
- setHasLoaded: function (value) {
5712
- this.hasLoaded = value;
5713
5672
  }
5714
5673
  };
5715
5674
 
@@ -6156,13 +6115,9 @@
6156
6115
  if (this.isAsync) {
6157
6116
  var promise;
6158
6117
  if (this.link) {
6159
- if (this.hasLoaded) {
6160
- promise = this.findRecords();
6161
- } else {
6162
- promise = this.findLink().then(function () {
6163
- return _this3.findRecords();
6164
- });
6165
- }
6118
+ promise = this.findLink().then(function () {
6119
+ return _this3.findRecords();
6120
+ });
6166
6121
  } else {
6167
6122
  promise = this.findRecords();
6168
6123
  }
@@ -6212,7 +6167,6 @@
6212
6167
  this.removeRecord(this.inverseRecord);
6213
6168
  }
6214
6169
  this.setHasData(true);
6215
- this.setHasLoaded(true);
6216
6170
  };
6217
6171
 
6218
6172
  ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setCanonicalRecord = function (newRecord) {
@@ -6222,7 +6176,6 @@
6222
6176
  this.removeCanonicalRecord(this.inverseRecord);
6223
6177
  }
6224
6178
  this.setHasData(true);
6225
- this.setHasLoaded(true);
6226
6179
  };
6227
6180
 
6228
6181
  ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
@@ -6319,13 +6272,9 @@
6319
6272
  if (this.isAsync) {
6320
6273
  var promise;
6321
6274
  if (this.link) {
6322
- if (this.hasLoaded) {
6323
- promise = this.findRecord();
6324
- } else {
6325
- promise = this.findLink().then(function () {
6326
- return _this2.findRecord();
6327
- });
6328
- }
6275
+ promise = this.findLink().then(function () {
6276
+ return _this2.findRecord();
6277
+ });
6329
6278
  } else {
6330
6279
  promise = this.findRecord();
6331
6280
  }
@@ -6363,7 +6312,7 @@
6363
6312
  }
6364
6313
  function ember$data$lib$system$relationships$state$create$$Relationships(record) {
6365
6314
  this.record = record;
6366
- this.initializedRelationships = Object.create(null);
6315
+ this.initializedRelationships = new ember$data$lib$system$empty$object$$default();
6367
6316
  }
6368
6317
 
6369
6318
  ember$data$lib$system$relationships$state$create$$Relationships.prototype.has = function (key) {
@@ -6379,11 +6328,6 @@
6379
6328
  return relationships[key];
6380
6329
  };
6381
6330
  var ember$data$lib$system$snapshot$$default = ember$data$lib$system$snapshot$$Snapshot;
6382
-
6383
- /**
6384
- @module ember-data
6385
- */
6386
-
6387
6331
  var ember$data$lib$system$snapshot$$get = Ember.get;
6388
6332
 
6389
6333
  /**
@@ -6396,11 +6340,11 @@
6396
6340
  function ember$data$lib$system$snapshot$$Snapshot(internalModel) {
6397
6341
  var _this = this;
6398
6342
 
6399
- this._attributes = Object.create(null);
6400
- this._belongsToRelationships = Object.create(null);
6401
- this._belongsToIds = Object.create(null);
6402
- this._hasManyRelationships = Object.create(null);
6403
- this._hasManyIds = Object.create(null);
6343
+ this._attributes = new ember$data$lib$system$empty$object$$default();
6344
+ this._belongsToRelationships = new ember$data$lib$system$empty$object$$default();
6345
+ this._belongsToIds = new ember$data$lib$system$empty$object$$default();
6346
+ this._hasManyRelationships = new ember$data$lib$system$empty$object$$default();
6347
+ this._hasManyIds = new ember$data$lib$system$empty$object$$default();
6404
6348
 
6405
6349
  var record = internalModel.getRecord();
6406
6350
  this.record = record;
@@ -6503,7 +6447,7 @@
6503
6447
  @return {Object} All changed attributes of the current snapshot
6504
6448
  */
6505
6449
  changedAttributes: function () {
6506
- var changedAttributes = Object.create(null);
6450
+ var changedAttributes = new ember$data$lib$system$empty$object$$default();
6507
6451
  var changedAttributeKeys = Object.keys(this._changedAttributes);
6508
6452
 
6509
6453
  for (var i = 0, _length = changedAttributeKeys.length; i < _length; i++) {
@@ -6699,8 +6643,8 @@
6699
6643
  var ember$data$lib$system$model$internal$model$$get = Ember.get;
6700
6644
  var ember$data$lib$system$model$internal$model$$set = Ember.set;
6701
6645
 
6702
- var ember$data$lib$system$model$internal$model$$_extractPivotNameCache = Object.create(null);
6703
- var ember$data$lib$system$model$internal$model$$_splitOnDotCache = Object.create(null);
6646
+ var ember$data$lib$system$model$internal$model$$_extractPivotNameCache = new ember$data$lib$system$empty$object$$default();
6647
+ var ember$data$lib$system$model$internal$model$$_splitOnDotCache = new ember$data$lib$system$empty$object$$default();
6704
6648
 
6705
6649
  function ember$data$lib$system$model$internal$model$$splitOnDot(name) {
6706
6650
  return ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] || (ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] = name.split('.'));
@@ -6716,6 +6660,7 @@
6716
6660
  };
6717
6661
  }
6718
6662
 
6663
+ var ember$data$lib$system$model$internal$model$$guid = 0;
6719
6664
  /**
6720
6665
  `InternalModel` is the Model class that we use internally inside Ember Data to represent models.
6721
6666
  Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.
@@ -6736,18 +6681,19 @@
6736
6681
  this.id = id;
6737
6682
  this.store = store;
6738
6683
  this.container = container;
6739
- this._data = data || Object.create(null);
6684
+ this._data = data || new ember$data$lib$system$empty$object$$default();
6740
6685
  this.modelName = type.modelName;
6741
6686
  this.dataHasInitialized = false;
6742
6687
  //Look into making this lazy
6743
6688
  this._deferredTriggers = [];
6744
- this._attributes = Object.create(null);
6745
- this._inFlightAttributes = Object.create(null);
6689
+ this._attributes = new ember$data$lib$system$empty$object$$default();
6690
+ this._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
6746
6691
  this._relationships = new ember$data$lib$system$relationships$state$create$$default(this);
6747
6692
  this.currentState = ember$data$lib$system$model$states$$default.empty;
6748
6693
  this.isReloading = false;
6749
6694
  this.isError = false;
6750
6695
  this.error = null;
6696
+ this[Ember.GUID_KEY] = ember$data$lib$system$model$internal$model$$guid++ + 'internal-model';
6751
6697
  /*
6752
6698
  implicit relationships are relationship which have not been declared but the inverse side exists on
6753
6699
  another record somewhere
@@ -6769,7 +6715,7 @@
6769
6715
  would have a implicit post relationship in order to be do things like remove ourselves from the post
6770
6716
  when we are deleted
6771
6717
  */
6772
- this._implicitRelationships = Object.create(null);
6718
+ this._implicitRelationships = new ember$data$lib$system$empty$object$$default();
6773
6719
  }
6774
6720
 
6775
6721
  ember$data$lib$system$model$internal$model$$InternalModel.prototype = {
@@ -6945,7 +6891,7 @@
6945
6891
 
6946
6892
  flushChangedAttributes: function () {
6947
6893
  this._inFlightAttributes = this._attributes;
6948
- this._attributes = Object.create(null);
6894
+ this._attributes = new ember$data$lib$system$empty$object$$default();
6949
6895
  },
6950
6896
 
6951
6897
  /**
@@ -7008,10 +6954,10 @@
7008
6954
  rollbackAttributes: function () {
7009
6955
  var dirtyKeys = Object.keys(this._attributes);
7010
6956
 
7011
- this._attributes = Object.create(null);
6957
+ this._attributes = new ember$data$lib$system$empty$object$$default();
7012
6958
 
7013
6959
  if (ember$data$lib$system$model$internal$model$$get(this, 'isError')) {
7014
- this._inFlightAttributes = Object.create(null);
6960
+ this._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
7015
6961
  this.didCleanError();
7016
6962
  }
7017
6963
 
@@ -7028,7 +6974,7 @@
7028
6974
  }
7029
6975
 
7030
6976
  if (this.isValid()) {
7031
- this._inFlightAttributes = Object.create(null);
6977
+ this._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
7032
6978
  }
7033
6979
 
7034
6980
  this.send('rolledBack');
@@ -7272,7 +7218,7 @@
7272
7218
  ember$data$lib$system$merge$$default(this._data, data);
7273
7219
  }
7274
7220
 
7275
- this._inFlightAttributes = Object.create(null);
7221
+ this._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
7276
7222
 
7277
7223
  this.send('didCommit');
7278
7224
  this.updateRecordArraysLater();
@@ -7347,7 +7293,7 @@
7347
7293
  this._attributes[keys[i]] = this._inFlightAttributes[keys[i]];
7348
7294
  }
7349
7295
  }
7350
- this._inFlightAttributes = Object.create(null);
7296
+ this._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
7351
7297
  },
7352
7298
 
7353
7299
  /**
@@ -7390,7 +7336,7 @@
7390
7336
  var keys = Object.keys(updates);
7391
7337
  var length = keys.length;
7392
7338
 
7393
- original = ember$data$lib$system$merge$$default(Object.create(null), this._data);
7339
+ original = ember$data$lib$system$merge$$default(new ember$data$lib$system$empty$object$$default(), this._data);
7394
7340
  original = ember$data$lib$system$merge$$default(original, this._inFlightAttributes);
7395
7341
 
7396
7342
  for (i = 0; i < length; i++) {
@@ -7677,7 +7623,7 @@
7677
7623
  createRecord: function (modelName, inputProperties) {
7678
7624
  Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === 'string');
7679
7625
  var typeClass = this.modelFor(modelName);
7680
- var properties = ember$data$lib$system$store$$copy(inputProperties) || Object.create(null);
7626
+ var properties = ember$data$lib$system$store$$copy(inputProperties) || new ember$data$lib$system$empty$object$$default();
7681
7627
 
7682
7628
  // If the passed properties do not include a primary key,
7683
7629
  // give the adapter an opportunity to generate one. Typically,
@@ -8408,7 +8354,7 @@
8408
8354
  record.destroy(); // maybe within unloadRecord
8409
8355
  }
8410
8356
 
8411
- typeMap.metadata = Object.create(null);
8357
+ typeMap.metadata = new ember$data$lib$system$empty$object$$default();
8412
8358
  }
8413
8359
 
8414
8360
  function byType(entry) {
@@ -8462,7 +8408,11 @@
8462
8408
  Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + Ember.inspect(modelName), typeof modelName === 'string');
8463
8409
 
8464
8410
  if (!Ember.ENV.ENABLE_DS_FILTER) {
8465
- Ember.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);
8411
+ Ember.deprecate('The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page', false, {
8412
+ url: 'https://github.com/ember-data/ember-data-filter',
8413
+ id: 'ds.store.filter-deprecated',
8414
+ until: '2.0.0'
8415
+ });
8466
8416
  }
8467
8417
 
8468
8418
  var promise;
@@ -8703,9 +8653,9 @@
8703
8653
  }
8704
8654
 
8705
8655
  typeMap = {
8706
- idToRecord: Object.create(null),
8656
+ idToRecord: new ember$data$lib$system$empty$object$$default(),
8707
8657
  records: [],
8708
- metadata: Object.create(null),
8658
+ metadata: new ember$data$lib$system$empty$object$$default(),
8709
8659
  type: typeClass
8710
8660
  };
8711
8661
 
@@ -8954,6 +8904,9 @@
8954
8904
  serializer (the application serializer if it exists).
8955
8905
  Alternatively, `pushPayload` will accept a model type which
8956
8906
  will determine which serializer will process the payload.
8907
+ However, the serializer itself (processing this data via
8908
+ `normalizePayload`) will not know which model it is
8909
+ deserializing.
8957
8910
  ```app/serializers/application.js
8958
8911
  import DS from 'ember-data';
8959
8912
  export default DS.ActiveModelSerializer;
@@ -9093,9 +9046,15 @@
9093
9046
  @param {String} modelName
9094
9047
  @return DS.Adapter
9095
9048
  */
9096
- adapterFor: function (modelName) {
9049
+ adapterFor: function (modelOrClass) {
9050
+ var modelName;
9097
9051
 
9098
- Ember.assert("Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === 'string');
9052
+ if (typeof modelOrClass === 'string') {
9053
+ modelName = modelOrClass;
9054
+ } else {
9055
+ Ember.deprecate("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), false, { id: 'ds.store.passing-classes-deprecated', until: '2.0.0' });
9056
+ modelName = modelOrClass.modelName;
9057
+ }
9099
9058
 
9100
9059
  return this.lookupAdapter(modelName);
9101
9060
  },
@@ -9125,9 +9084,15 @@
9125
9084
  @param {String} modelName the record to serialize
9126
9085
  @return {DS.Serializer}
9127
9086
  */
9128
- serializerFor: function (modelName) {
9087
+ serializerFor: function (modelOrClass) {
9088
+ var modelName;
9129
9089
 
9130
- Ember.assert("Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === 'string');
9090
+ if (typeof modelOrClass === 'string') {
9091
+ modelName = modelOrClass;
9092
+ } else {
9093
+ Ember.deprecate("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), false, { id: 'ds.store.passing-classes-deprecated', until: '2.0.0' });
9094
+ modelName = modelOrClass.modelName;
9095
+ }
9131
9096
 
9132
9097
  var fallbacks = ['application', this.adapterFor(modelName).get('defaultSerializer'), '-default'];
9133
9098
 
@@ -9973,6 +9938,28 @@
9973
9938
  return ember$data$lib$system$normalize$model$name$$default(key);
9974
9939
  },
9975
9940
 
9941
+ /**
9942
+ You can use this method to normalize all payloads, regardless of whether they
9943
+ represent single records or an array.
9944
+ For example, you might want to remove some extraneous data from the payload:
9945
+ ```app/serializers/application.js
9946
+ import DS from 'ember-data';
9947
+ export default DS.JSONSerializer.extend({
9948
+ normalizePayload: function(payload) {
9949
+ delete payload.version;
9950
+ delete payload.status;
9951
+ return payload;
9952
+ }
9953
+ });
9954
+ ```
9955
+ @method normalizePayload
9956
+ @param {Object} payload
9957
+ @return {Object} the normalized payload
9958
+ */
9959
+ normalizePayload: function (payload) {
9960
+ return payload;
9961
+ },
9962
+
9976
9963
  /**
9977
9964
  @method normalizeAttributes
9978
9965
  @private
@@ -10616,8 +10603,8 @@
10616
10603
  var ember$inflector$lib$lib$system$inflector$$capitalize = ember$lib$main$$default.String.capitalize;
10617
10604
 
10618
10605
  var ember$inflector$lib$lib$system$inflector$$BLANK_REGEX = /^\s*$/;
10619
- var ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
10620
- var ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
10606
+ var ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /([\w/-]+[_/-\s])([a-z\d]+$)/;
10607
+ var ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /([\w/-\s]+)([A-Z][a-z\d]*$)/;
10621
10608
  var ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
10622
10609
 
10623
10610
  function ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, uncountable) {
@@ -13791,7 +13778,7 @@
13791
13778
  },
13792
13779
 
13793
13780
  inverseMap: Ember.computed(function () {
13794
- return Object.create(null);
13781
+ return new ember$data$lib$system$empty$object$$default();
13795
13782
  }),
13796
13783
 
13797
13784
  /**