ember-data-source 2.1.0 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 727101b227d3db097ffa369152182fc4196baf16
4
- data.tar.gz: 21ba24679969ed1db06f5c308e8c492a286d7feb
3
+ metadata.gz: 4b0d9026f83ded0e4079534260c2348ec0e75bb1
4
+ data.tar.gz: 5f797710c8eeb1f0705a4d349b5c3830f39b1ada
5
5
  SHA512:
6
- metadata.gz: 87970d22f45fd8c390c8fa280b4f2ba29839519ea3d5388dc3742b84e45cfc4c035b882054b997740d75087150fdc227ee69775ee7ad2ecd9ddb2ce7eec4e227
7
- data.tar.gz: eb573e937023d0075c6a77e131a44814dd5485b0f3ca120f2c7958fa2d34e5c37c03e76f299ba1678b577e039c87331e092b2ed171134ff85fb7163fb8b75b74
6
+ metadata.gz: a56fb9757405c7a8d1783774627ca30d0e417f1d3055836d02d8782297b31e2e46a907a6aab76208f11538128f52548d37d2e23b9d1882e626102bd80085cdc3
7
+ data.tar.gz: 25eea0b246c05bb969dc44b5bd0461b412ec55d575f8acb2bdec3891364ce8e535815b06cb5c4e6b76c7861fe666a99ea54441ddfb9ff1f50409b23b978d67f8
@@ -7610,6 +7610,157 @@ define(
7610
7610
  );
7611
7611
 
7612
7612
 
7613
+ define(
7614
+ "ember-data/tests/integration/polymorphic-belongs-to-test",
7615
+ ["exports"],
7616
+ function(__exports__) {
7617
+ "use strict";
7618
+
7619
+ function __es6_export__(name, value) {
7620
+ __exports__[name] = value;
7621
+ }
7622
+
7623
+ var _DS = DS;
7624
+ var attr = _DS.attr;
7625
+ var belongsTo = _DS.belongsTo;
7626
+ var _Ember = Ember;
7627
+ var run = _Ember.run;
7628
+
7629
+ var store = undefined;
7630
+
7631
+ var Book = DS.Model.extend({
7632
+ title: attr(),
7633
+ author: belongsTo('person', { polymorphic: true, async: false })
7634
+ });
7635
+
7636
+ var Author = DS.Model.extend({
7637
+ name: attr()
7638
+ });
7639
+
7640
+ var AsyncBook = DS.Model.extend({
7641
+ author: belongsTo('person', { polymorphic: true })
7642
+ });
7643
+
7644
+ module('integration/polymorphic-belongs-to - Polymorphic BelongsTo', {
7645
+ setup: function () {
7646
+ var env = setupStore({
7647
+ book: Book,
7648
+ author: Author,
7649
+ 'async-book': AsyncBook,
7650
+ person: DS.Model.extend()
7651
+ });
7652
+ store = env.store;
7653
+ },
7654
+
7655
+ teardown: function () {
7656
+ run(store, 'destroy');
7657
+ }
7658
+ });
7659
+
7660
+ test('using store.push with a null value for a payload in relationships sets the Models relationship to null - sync relationship', function () {
7661
+ var payload = {
7662
+ data: {
7663
+ type: 'book',
7664
+ id: 1,
7665
+ title: 'Yes, Please',
7666
+ relationships: {
7667
+ author: {
7668
+ data: {
7669
+ type: 'author',
7670
+ id: 1
7671
+ }
7672
+ }
7673
+ }
7674
+ },
7675
+ included: [{
7676
+ id: 1,
7677
+ name: 'Amy Poehler',
7678
+ type: 'author'
7679
+ }]
7680
+ };
7681
+
7682
+ var book = run(function () {
7683
+ store.push(payload);
7684
+ return store.peekRecord('book', 1);
7685
+ });
7686
+
7687
+ equal(book.get('author.id'), 1);
7688
+
7689
+ var payloadThatResetsBelongToRelationship = {
7690
+ data: {
7691
+ type: 'book',
7692
+ id: 1,
7693
+ title: 'Yes, Please',
7694
+ relationships: {
7695
+ author: {
7696
+ data: null
7697
+ }
7698
+ }
7699
+ }
7700
+ };
7701
+
7702
+ run(function () {
7703
+ return store.push(payloadThatResetsBelongToRelationship);
7704
+ });
7705
+ equal(book.get('author'), null);
7706
+ });
7707
+
7708
+ test('using store.push with a null value for a payload in relationships sets the Models relationship to null - async relationship', function () {
7709
+ var payload = {
7710
+ data: {
7711
+ type: 'async-book',
7712
+ id: 1,
7713
+ title: 'Yes, Please',
7714
+ relationships: {
7715
+ author: {
7716
+ data: {
7717
+ type: 'author',
7718
+ id: 1
7719
+ }
7720
+ }
7721
+ }
7722
+ },
7723
+ included: [{
7724
+ id: 1,
7725
+ name: 'Amy Poehler',
7726
+ type: 'author'
7727
+ }]
7728
+ };
7729
+
7730
+ var book = run(function () {
7731
+ store.push(payload);
7732
+ return store.peekRecord('async-book', 1);
7733
+ });
7734
+
7735
+ var payloadThatResetsBelongToRelationship = {
7736
+ data: {
7737
+ type: 'async-book',
7738
+ id: 1,
7739
+ title: 'Yes, Please',
7740
+ relationships: {
7741
+ author: {
7742
+ data: null
7743
+ }
7744
+ }
7745
+ }
7746
+ };
7747
+
7748
+ stop();
7749
+ book.get('author').then(function (author) {
7750
+ equal(author.get('id'), 1);
7751
+ run(function () {
7752
+ return store.push(payloadThatResetsBelongToRelationship);
7753
+ });
7754
+ return book.get('author');
7755
+ }).then(function (author) {
7756
+ start();
7757
+ equal(author, null);
7758
+ });
7759
+ });
7760
+ }
7761
+ );
7762
+
7763
+
7613
7764
  define(
7614
7765
  "ember-data/tests/integration/record-array-manager-test",
7615
7766
  ["exports"],
@@ -17395,6 +17546,41 @@ define(
17395
17546
  });
17396
17547
  });
17397
17548
 
17549
+ test("serialize with embedded objects and a custom keyForAttribute (hasMany relationship)", function () {
17550
+ var tom, league;
17551
+ run(function () {
17552
+ league = env.store.createRecord('home-planet', { name: "Villain League", id: "123" });
17553
+ tom = env.store.createRecord('super-villain', { firstName: "Tom", lastName: "Dale", homePlanet: league, id: '1' });
17554
+ });
17555
+
17556
+ env.registry.register('serializer:home-planet', DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
17557
+ keyForAttribute: function (key) {
17558
+ return key + '-custom';
17559
+ },
17560
+ attrs: {
17561
+ villains: { embedded: 'always' }
17562
+ }
17563
+ }));
17564
+
17565
+ var serializer, json;
17566
+ run(function () {
17567
+ serializer = env.store.serializerFor("home-planet");
17568
+
17569
+ json = serializer.serialize(league._createSnapshot());
17570
+ });
17571
+
17572
+ deepEqual(json, {
17573
+ "name-custom": "Villain League",
17574
+ "villains-custom": [{
17575
+ id: get(tom, "id"),
17576
+ firstName: "Tom",
17577
+ lastName: "Dale",
17578
+ homePlanet: get(league, "id"),
17579
+ secretLab: null
17580
+ }]
17581
+ });
17582
+ });
17583
+
17398
17584
  test("serialize with embedded objects (unknown hasMany relationship)", function () {
17399
17585
  var league;
17400
17586
  run(function () {
@@ -21273,37 +21459,34 @@ define(
21273
21459
  };
21274
21460
  }
21275
21461
 
21276
- module("integration/store - findRecord { reload: true }", {
21277
- setup: function () {
21278
- initializeStore(DS.RESTAdapter.extend());
21279
- }
21280
- });
21462
+ module("integration/store - findRecord");
21281
21463
 
21282
- test("Using store#findRecord on non existing record fetches it from the server", function () {
21464
+ test("store#findRecord fetches record from server when cached record is not present", function () {
21283
21465
  expect(2);
21284
21466
 
21467
+ initializeStore(DS.RESTAdapter.extend());
21468
+
21285
21469
  env.registry.register('serializer:application', DS.RESTSerializer);
21286
21470
  ajaxResponse({
21287
21471
  cars: [{
21288
21472
  id: 20,
21289
- make: 'BMCW',
21473
+ make: 'BMC',
21290
21474
  model: 'Mini'
21291
21475
  }]
21292
21476
  });
21293
21477
 
21294
- var car = store.hasRecordForId('car', 20);
21295
- ok(!car, 'Car with id=20 should not exist');
21478
+ var cachedRecordIsPresent = store.hasRecordForId('car', 20);
21479
+ ok(!cachedRecordIsPresent, 'Car with id=20 should not exist');
21296
21480
 
21297
21481
  run(function () {
21298
- store.findRecord('car', 20, { reload: true }).then(function (car) {
21299
- equal(car.get('make'), 'BMCW', 'Car with id=20 is now loaded');
21482
+ store.findRecord('car', 20).then(function (car) {
21483
+ equal(car.get('make'), 'BMC', 'Car with id=20 is now loaded');
21300
21484
  });
21301
21485
  });
21302
21486
  });
21303
21487
 
21304
- test("Using store#findRecord on existing record reloads it", function () {
21488
+ test("store#findRecord returns cached record immediately and reloads record in the background", function () {
21305
21489
  expect(2);
21306
- var car;
21307
21490
 
21308
21491
  run(function () {
21309
21492
  store.push({
@@ -21316,22 +21499,81 @@ define(
21316
21499
  }
21317
21500
  }
21318
21501
  });
21319
- car = store.peekRecord('car', 1);
21320
21502
  });
21321
21503
 
21322
21504
  ajaxResponse({
21323
21505
  cars: [{
21324
21506
  id: 1,
21325
- make: 'BMCW',
21326
- model: 'Mini'
21507
+ make: 'BMC',
21508
+ model: 'Princess'
21509
+ }]
21510
+ });
21511
+
21512
+ run(function () {
21513
+ store.findRecord('car', 1).then(function (car) {
21514
+ equal(car.get('model'), 'Mini', 'cached car record is returned');
21515
+ });
21516
+ });
21517
+
21518
+ run(function () {
21519
+ var car = store.peekRecord('car', 1);
21520
+ equal(car.get('model'), 'Princess', 'car record was reloaded');
21521
+ });
21522
+ });
21523
+
21524
+ test("store#findRecord { reload: true } ignores cached record and reloads record from server", function () {
21525
+ expect(2);
21526
+
21527
+ var testAdapter = DS.RESTAdapter.extend({
21528
+ shouldReloadRecord: function (store, type, id, snapshot) {
21529
+ ok(false, 'shouldReloadRecord should not be called when { reload: true }');
21530
+ }
21531
+ });
21532
+
21533
+ initializeStore(testAdapter);
21534
+
21535
+ run(function () {
21536
+ store.push({
21537
+ data: {
21538
+ type: 'car',
21539
+ id: '1',
21540
+ attributes: {
21541
+ make: 'BMC',
21542
+ model: 'Mini'
21543
+ }
21544
+ }
21545
+ });
21546
+ });
21547
+
21548
+ ajaxResponse({
21549
+ cars: [{
21550
+ id: 1,
21551
+ make: 'BMC',
21552
+ model: 'Princess'
21327
21553
  }]
21328
21554
  });
21329
21555
 
21330
- equal(car.get('make'), 'BMC');
21556
+ var cachedCar = store.peekRecord('car', 1);
21557
+ equal(cachedCar.get('model'), 'Mini', 'cached car has expected model');
21331
21558
 
21332
21559
  run(function () {
21333
21560
  store.findRecord('car', 1, { reload: true }).then(function (car) {
21334
- equal(car.get('make'), 'BMCW');
21561
+ equal(car.get('model'), 'Princess', 'cached record ignored, record reloaded via server');
21562
+ });
21563
+ });
21564
+ });
21565
+
21566
+ test('store#findRecord call with `id` of type different than non-empty string or number should trigger an assertion', function (assert) {
21567
+ var badValues = ['', undefined, null, NaN, false];
21568
+ assert.expect(badValues.length);
21569
+
21570
+ initializeStore(DS.RESTAdapter.extend());
21571
+
21572
+ run(function () {
21573
+ badValues.map(function (item) {
21574
+ expectAssertion(function () {
21575
+ store.findRecord('car', item);
21576
+ }, '`id` has to be non-empty string or number');
21335
21577
  });
21336
21578
  });
21337
21579
  });
@@ -28644,33 +28886,6 @@ define(
28644
28886
  store.adapterFor(Person);
28645
28887
  }, /Passing classes to store.adapterFor has been removed/);
28646
28888
  });
28647
-
28648
- module("unit/store/adapter_interop - find preload deprecations", {
28649
- setup: function () {
28650
- var Person = DS.Model.extend({
28651
- name: DS.attr('string')
28652
- });
28653
-
28654
- var TestAdapter = DS.Adapter.extend({
28655
- findRecord: function (store, type, id, snapshot) {
28656
- equal(snapshot.attr('name'), 'Tom');
28657
- return Ember.RSVP.resolve({ id: id });
28658
- }
28659
- });
28660
-
28661
- store = createStore({
28662
- adapter: TestAdapter,
28663
- person: Person
28664
- });
28665
- },
28666
- teardown: function () {
28667
- run(function () {
28668
- if (store) {
28669
- store.destroy();
28670
- }
28671
- });
28672
- }
28673
- });
28674
28889
  }
28675
28890
  );
28676
28891
 
@@ -30673,13 +30888,6 @@ QUnit.test('ember-data/lib/system/many-array.js should pass jshint', function(as
30673
30888
  assert.ok(true, 'ember-data/lib/system/many-array.js should pass jshint.');
30674
30889
  });
30675
30890
 
30676
- }
30677
- if (!QUnit.urlParams.nojshint) {
30678
- QUnit.module('JSHint - ember-data/lib/system');
30679
- QUnit.test('ember-data/lib/system/map.js should pass jshint', function(assert) {
30680
- assert.ok(true, 'ember-data/lib/system/map.js should pass jshint.');
30681
- });
30682
-
30683
30891
  }
30684
30892
  if (!QUnit.urlParams.nojshint) {
30685
30893
  QUnit.module('JSHint - ember-data/lib/system');
@@ -31107,6 +31315,13 @@ QUnit.test('ember-data/tests/integration/peek-all-test.js should pass jshint', f
31107
31315
  assert.ok(true, 'ember-data/tests/integration/peek-all-test.js should pass jshint.');
31108
31316
  });
31109
31317
 
31318
+ }
31319
+ if (!QUnit.urlParams.nojshint) {
31320
+ QUnit.module('JSHint - ember-data/tests/integration');
31321
+ QUnit.test('ember-data/tests/integration/polymorphic-belongs-to-test.js should pass jshint', function(assert) {
31322
+ assert.ok(true, 'ember-data/tests/integration/polymorphic-belongs-to-test.js should pass jshint.');
31323
+ });
31324
+
31110
31325
  }
31111
31326
  if (!QUnit.urlParams.nojshint) {
31112
31327
  QUnit.module('JSHint - ember-data/tests/integration');
@@ -878,10 +878,6 @@
878
878
  });
879
879
 
880
880
  var ember$data$lib$system$adapter$$default = ember$data$lib$system$adapter$$Adapter;
881
- var ember$data$lib$system$map$$Map = Ember.Map;
882
- var ember$data$lib$system$map$$MapWithDefault = Ember.MapWithDefault;
883
-
884
- var ember$data$lib$system$map$$default = ember$data$lib$system$map$$Map;
885
881
  var ember$data$lib$system$empty$object$$default = ember$data$lib$system$empty$object$$EmptyObject;
886
882
  // This exists because `Object.create(null)` is absurdly slow compared
887
883
  // to `new EmptyObject()`. In either case, you want a null prototype
@@ -1075,7 +1071,8 @@
1075
1071
  @extends DS.Adapter
1076
1072
  @uses DS.BuildURLMixin
1077
1073
  */
1078
- var ember$data$lib$adapters$rest$adapter$$get = Ember.get;var ember$data$lib$adapters$rest$adapter$$RESTAdapter = ember$data$lib$system$adapter$$default.extend(ember$data$lib$adapters$build$url$mixin$$default, {
1074
+ var ember$data$lib$adapters$rest$adapter$$get = Ember.get;
1075
+ var ember$data$lib$adapters$rest$adapter$$MapWithDefault = Ember.MapWithDefault;var ember$data$lib$adapters$rest$adapter$$RESTAdapter = ember$data$lib$system$adapter$$default.extend(ember$data$lib$adapters$build$url$mixin$$default, {
1079
1076
  defaultSerializer: '-rest',
1080
1077
 
1081
1078
  /**
@@ -1490,7 +1487,7 @@
1490
1487
  loaded separately by `findMany`.
1491
1488
  */
1492
1489
  groupRecordsForFindMany: function (store, snapshots) {
1493
- var groups = ember$data$lib$system$map$$MapWithDefault.create({ defaultValue: function () {
1490
+ var groups = ember$data$lib$adapters$rest$adapter$$MapWithDefault.create({ defaultValue: function () {
1494
1491
  return [];
1495
1492
  } });
1496
1493
  var adapter = this;
@@ -1871,7 +1868,7 @@
1871
1868
  });
1872
1869
 
1873
1870
  var ember$data$lib$core$$DS = Ember.Namespace.create({
1874
- VERSION: '2.1.0'
1871
+ VERSION: '2.2.0-beta.1'
1875
1872
  });
1876
1873
 
1877
1874
  if (Ember.libraries) {
@@ -2070,99 +2067,13 @@
2070
2067
 
2071
2068
  function ember$data$lib$system$store$common$$_objectIsAlive(object) {
2072
2069
  return !(ember$data$lib$system$store$common$$get(object, "isDestroyed") || ember$data$lib$system$store$common$$get(object, "isDestroying"));
2073
- }
2074
-
2075
- /**
2076
- @module ember-data
2077
- */
2078
-
2079
- /**
2080
- Holds validation errors for a given record organized by attribute names.
2081
-
2082
- Every DS.Model has an `errors` property that is an instance of
2083
- `DS.Errors`. This can be used to display validation error
2084
- messages returned from the server when a `record.save()` rejects.
2085
- This works automatically with `DS.ActiveModelAdapter`, but you
2086
- can implement [ajaxError](/api/data/classes/DS.RESTAdapter.html#method_ajaxError)
2087
- in other adapters as well.
2088
-
2089
- For Example, if you had an `User` model that looked like this:
2090
-
2091
- ```app/models/user.js
2092
- import DS from 'ember-data';
2093
-
2094
- export default DS.Model.extend({
2095
- username: attr('string'),
2096
- email: attr('string')
2097
- });
2098
- ```
2099
- And you attempted to save a record that did not validate on the backend.
2100
-
2101
- ```javascript
2102
- var user = store.createRecord('user', {
2103
- username: 'tomster',
2104
- email: 'invalidEmail'
2105
- });
2106
- user.save();
2107
- ```
2108
-
2109
- Your backend data store might return a response that looks like
2110
- this. This response will be used to populate the error object.
2111
-
2112
- ```javascript
2113
- {
2114
- "errors": {
2115
- "username": ["This username is already taken!"],
2116
- "email": ["Doesn't look like a valid email."]
2117
- }
2118
- }
2119
- ```
2120
-
2121
- Errors can be displayed to the user by accessing their property name
2122
- to get an array of all the error objects for that property. Each
2123
- error object is a JavaScript object with two keys:
2124
-
2125
- - `message` A string containing the error message from the backend
2126
- - `attribute` The name of the property associated with this error message
2127
-
2128
- ```handlebars
2129
- <label>Username: {{input value=username}} </label>
2130
- {{#each model.errors.username as |error|}}
2131
- <div class="error">
2132
- {{error.message}}
2133
- </div>
2134
- {{/each}}
2135
-
2136
- <label>Email: {{input value=email}} </label>
2137
- {{#each model.errors.email as |error|}}
2138
- <div class="error">
2139
- {{error.message}}
2140
- </div>
2141
- {{/each}}
2142
- ```
2143
-
2144
- You can also access the special `messages` property on the error
2145
- object to get an array of all the error strings.
2146
-
2147
- ```handlebars
2148
- {{#each model.errors.messages as |message|}}
2149
- <div class="error">
2150
- {{message}}
2151
- </div>
2152
- {{/each}}
2153
- ```
2154
-
2155
- @class Errors
2156
- @namespace DS
2157
- @extends Ember.Object
2158
- @uses Ember.Enumerable
2159
- @uses Ember.Evented
2160
- */
2161
- var ember$data$lib$system$model$errors$$get = Ember.get;
2070
+ }var ember$data$lib$system$model$errors$$get = Ember.get;
2162
2071
  var ember$data$lib$system$model$errors$$set = Ember.set;
2163
2072
  var ember$data$lib$system$model$errors$$isEmpty = Ember.isEmpty;
2164
2073
  var ember$data$lib$system$model$errors$$makeArray = Ember.makeArray;
2165
2074
 
2075
+ var ember$data$lib$system$model$errors$$MapWithDefault = Ember.MapWithDefault;
2076
+
2166
2077
  var ember$data$lib$system$model$errors$$default = Ember.ArrayProxy.extend(Ember.Evented, {
2167
2078
  /**
2168
2079
  Register with target handler
@@ -2182,7 +2093,7 @@
2182
2093
  @private
2183
2094
  */
2184
2095
  errorsByAttributeName: Ember.computed(function () {
2185
- return ember$data$lib$system$map$$MapWithDefault.create({
2096
+ return ember$data$lib$system$model$errors$$MapWithDefault.create({
2186
2097
  defaultValue: function () {
2187
2098
  return Ember.A();
2188
2099
  }
@@ -4007,19 +3918,19 @@
4007
3918
 
4008
3919
  return this;
4009
3920
  };
4010
- var ember$data$lib$system$record$array$manager$$get = Ember.get;
3921
+ var ember$data$lib$system$record$array$manager$$MapWithDefault = Ember.MapWithDefault;var ember$data$lib$system$record$array$manager$$get = Ember.get;
4011
3922
 
4012
3923
  var ember$data$lib$system$record$array$manager$$default = Ember.Object.extend({
4013
3924
  init: function () {
4014
3925
  var _this = this;
4015
3926
 
4016
- this.filteredRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
3927
+ this.filteredRecordArrays = ember$data$lib$system$record$array$manager$$MapWithDefault.create({
4017
3928
  defaultValue: function () {
4018
3929
  return [];
4019
3930
  }
4020
3931
  });
4021
3932
 
4022
- this.liveRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
3933
+ this.liveRecordArrays = ember$data$lib$system$record$array$manager$$MapWithDefault.create({
4023
3934
  defaultValue: function (typeClass) {
4024
3935
  return _this.createRecordArray(typeClass);
4025
3936
  }
@@ -6456,6 +6367,7 @@
6456
6367
  this.isReloading = false;
6457
6368
  this.isError = false;
6458
6369
  this.error = null;
6370
+ this.__ember_meta__ = null;
6459
6371
  this[Ember.GUID_KEY] = ember$data$lib$system$model$internal$model$$guid++ + 'internal-model';
6460
6372
  /*
6461
6373
  implicit relationships are relationship which have not been declared but the inverse side exists on
@@ -7134,7 +7046,10 @@
7134
7046
  }
7135
7047
  };
7136
7048
 
7049
+ var ember$data$lib$system$store$$badIdFormatAssertion = '`id` has to be non-empty string or number';
7050
+
7137
7051
  var ember$data$lib$system$store$$Backburner = Ember._Backburner || Ember.Backburner || Ember.__loader.require('backburner')['default'] || Ember.__loader.require('backburner')['Backburner'];
7052
+ var ember$data$lib$system$store$$Map = Ember.Map;
7138
7053
 
7139
7054
  //Shim Backburner.join
7140
7055
  if (!ember$data$lib$system$store$$Backburner.prototype.join) {
@@ -7304,7 +7219,7 @@
7304
7219
  this._pendingSave = [];
7305
7220
  this._instanceCache = new ember$data$lib$system$store$container$instance$cache$$default(this.container);
7306
7221
  //Used to keep track of all the find requests that need to be coalesced
7307
- this._pendingFetch = ember$data$lib$system$map$$Map.create();
7222
+ this._pendingFetch = ember$data$lib$system$store$$Map.create();
7308
7223
  },
7309
7224
 
7310
7225
  /**
@@ -7546,6 +7461,8 @@
7546
7461
  */
7547
7462
  findRecord: function (modelName, id, options) {
7548
7463
  Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + Ember.inspect(modelName), typeof modelName === 'string');
7464
+ Ember.assert(ember$data$lib$system$store$$badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id));
7465
+
7549
7466
  var internalModel = this._internalModelForId(modelName, id);
7550
7467
  options = options || {};
7551
7468
 
@@ -7687,7 +7604,7 @@
7687
7604
  }
7688
7605
 
7689
7606
  this._pendingFetch.forEach(this._flushPendingFetchForType, this);
7690
- this._pendingFetch = ember$data$lib$system$map$$Map.create();
7607
+ this._pendingFetch = ember$data$lib$system$store$$Map.create();
7691
7608
  },
7692
7609
 
7693
7610
  _flushPendingFetchForType: function (pendingFetchItems, typeClass) {
@@ -12010,6 +11927,7 @@
12010
11927
  */
12011
11928
 
12012
11929
  var ember$data$lib$system$model$attributes$$get = Ember.get;
11930
+ var ember$data$lib$system$model$attributes$$Map = Ember.Map;
12013
11931
 
12014
11932
  /**
12015
11933
  @class Model
@@ -12049,7 +11967,7 @@
12049
11967
  attributes: Ember.computed(function () {
12050
11968
  var _this = this;
12051
11969
 
12052
- var map = ember$data$lib$system$map$$Map.create();
11970
+ var map = ember$data$lib$system$model$attributes$$Map.create();
12053
11971
 
12054
11972
  this.eachComputedProperty(function (name, meta) {
12055
11973
  if (meta.isAttribute) {
@@ -12094,7 +12012,7 @@
12094
12012
  @readOnly
12095
12013
  */
12096
12014
  transformedAttributes: Ember.computed(function () {
12097
- var map = ember$data$lib$system$map$$Map.create();
12015
+ var map = ember$data$lib$system$model$attributes$$Map.create();
12098
12016
 
12099
12017
  this.eachAttribute(function (key, meta) {
12100
12018
  if (meta.type) {
@@ -12887,13 +12805,18 @@
12887
12805
  json[key] = embeddedSnapshot.id;
12888
12806
  }
12889
12807
  } else if (includeRecords) {
12890
- key = this.keyForAttribute(attr, 'serialize');
12891
- if (!embeddedSnapshot) {
12892
- json[key] = null;
12893
- } else {
12894
- json[key] = embeddedSnapshot.record.serialize({ includeId: true });
12895
- this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[key]);
12896
- }
12808
+ this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
12809
+ }
12810
+ },
12811
+
12812
+ _serializeEmbeddedBelongsTo: function (snapshot, json, relationship) {
12813
+ var embeddedSnapshot = snapshot.belongsTo(relationship.key);
12814
+ var serializedKey = this.keyForAttribute(relationship.key, 'serialize');
12815
+ if (!embeddedSnapshot) {
12816
+ json[serializedKey] = null;
12817
+ } else {
12818
+ json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
12819
+ this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
12897
12820
  }
12898
12821
  },
12899
12822
 
@@ -12968,8 +12891,6 @@
12968
12891
  @param {Object} relationship
12969
12892
  */
12970
12893
  serializeHasMany: function (snapshot, json, relationship) {
12971
- var _this = this;
12972
-
12973
12894
  var attr = relationship.key;
12974
12895
  if (this.noSerializeOptionSpecified(attr)) {
12975
12896
  this._super(snapshot, json, relationship);
@@ -12977,22 +12898,34 @@
12977
12898
  }
12978
12899
  var includeIds = this.hasSerializeIdsOption(attr);
12979
12900
  var includeRecords = this.hasSerializeRecordsOption(attr);
12980
- var key, hasMany;
12981
12901
  if (includeIds) {
12982
- key = this.keyForRelationship(attr, relationship.kind, 'serialize');
12983
- json[key] = snapshot.hasMany(attr, { ids: true });
12902
+ var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
12903
+ json[serializedKey] = snapshot.hasMany(attr, { ids: true });
12984
12904
  } else if (includeRecords) {
12985
- key = this.keyForAttribute(attr, 'serialize');
12986
- hasMany = snapshot.hasMany(attr);
12905
+ this._serializeEmbeddedHasMany(snapshot, json, relationship);
12906
+ }
12907
+ },
12987
12908
 
12988
- Ember.warn('The embedded relationship \'' + key + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', Ember.typeOf(hasMany) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' });
12909
+ _serializeEmbeddedHasMany: function (snapshot, json, relationship) {
12910
+ var serializedKey = this.keyForAttribute(relationship.key, 'serialize');
12989
12911
 
12990
- json[key] = Ember.A(hasMany).map(function (embeddedSnapshot) {
12991
- var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
12992
- _this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
12993
- return embeddedJson;
12994
- });
12995
- }
12912
+ Ember.warn('The embedded relationship \'' + serializedKey + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', Ember.typeOf(snapshot.hasMany(relationship.key)) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' });
12913
+
12914
+ json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
12915
+ },
12916
+
12917
+ /*
12918
+ Returns an array of embedded records serialized to JSON
12919
+ */
12920
+ _generateSerializedHasMany: function (snapshot, relationship) {
12921
+ var _this = this;
12922
+
12923
+ var hasMany = snapshot.hasMany(relationship.key);
12924
+ return Ember.A(hasMany).map(function (embeddedSnapshot) {
12925
+ var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
12926
+ _this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
12927
+ return embeddedJson;
12928
+ });
12996
12929
  },
12997
12930
 
12998
12931
  /**
@@ -13519,13 +13452,15 @@
13519
13452
  }
13520
13453
 
13521
13454
  var ember$data$lib$system$relationships$ext$$get = Ember.get;
13455
+ var ember$data$lib$system$relationships$ext$$Map = Ember.Map;
13456
+ var ember$data$lib$system$relationships$ext$$MapWithDefault = Ember.MapWithDefault;
13522
13457
 
13523
13458
  var ember$data$lib$system$relationships$ext$$relationshipsDescriptor = Ember.computed(function () {
13524
13459
  if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable === true) {
13525
13460
  ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable = false;
13526
13461
  }
13527
13462
 
13528
- var map = new ember$data$lib$system$map$$MapWithDefault({
13463
+ var map = new ember$data$lib$system$relationships$ext$$MapWithDefault({
13529
13464
  defaultValue: function () {
13530
13465
  return [];
13531
13466
  }
@@ -13584,7 +13519,7 @@
13584
13519
  ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor._cacheable = false;
13585
13520
  }
13586
13521
 
13587
- var map = ember$data$lib$system$map$$Map.create();
13522
+ var map = ember$data$lib$system$relationships$ext$$Map.create();
13588
13523
 
13589
13524
  this.eachComputedProperty(function (name, meta) {
13590
13525
  if (meta.isRelationship) {
@@ -13986,7 +13921,7 @@
13986
13921
  @readOnly
13987
13922
  */
13988
13923
  fields: Ember.computed(function () {
13989
- var map = ember$data$lib$system$map$$Map.create();
13924
+ var map = ember$data$lib$system$relationships$ext$$Map.create();
13990
13925
 
13991
13926
  this.eachComputedProperty(function (name, meta) {
13992
13927
  if (meta.isRelationship) {