ember-data-source 1.0.0.beta.15 → 1.0.0.beta.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,5 @@
1
1
  (function() {
2
2
  "use strict";
3
- /**
4
- @module ember-data
5
- */
6
3
 
7
4
  var ember$data$lib$system$adapter$$get = Ember.get;
8
5
 
@@ -25,9 +22,39 @@
25
22
  transition to the `invalid` state and the errors will be set to the
26
23
  `errors` property on the record.
27
24
 
28
- This function should return the entire payload as received from the
29
- server. Error object extraction and normalization of model errors
30
- should be performed by `extractErrors` on the serializer.
25
+ For Ember Data to correctly map errors to their corresponding
26
+ properties on the model, Ember Data expects each error to be
27
+ namespaced under a key that matches the property name. For example
28
+ if you had a Post model that looked like this.
29
+
30
+ ```js
31
+ App.Post = DS.Model.extend({
32
+ title: DS.attr('string'),
33
+ content: DS.attr('string')
34
+ });
35
+ ```
36
+
37
+ To show an error from the server related to the `title` and
38
+ `content` properties your adapter could return a promise that
39
+ rejects with a `DS.InvalidError` object that looks like this:
40
+
41
+ ```js
42
+ App.PostAdapter = DS.RESTAdapter.extend({
43
+ updateRecord: function() {
44
+ // Fictional adapter that always rejects
45
+ return Ember.RSVP.reject(new DS.InvalidError({
46
+ title: ['Must be unique'],
47
+ content: ['Must not be blank'],
48
+ }));
49
+ }
50
+ });
51
+ ```
52
+
53
+ Your backend may use different property names for your records the
54
+ store will attempt extract and normalize the errors using the
55
+ serializer's `extractErrors` method before the errors get added to
56
+ the the model. As a result, it is safe for the `InvalidError` to
57
+ wrap the error payload unaltered.
31
58
 
32
59
  Example
33
60
 
@@ -36,27 +63,20 @@
36
63
  ajaxError: function(jqXHR) {
37
64
  var error = this._super(jqXHR);
38
65
 
66
+ // 422 is used by this fictional server to signal a validation error
39
67
  if (jqXHR && jqXHR.status === 422) {
40
68
  var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
41
69
  return new DS.InvalidError(jsonErrors);
42
70
  } else {
71
+ // The ajax request failed however it is not a result of this
72
+ // record being in an invalid state so we do not return a
73
+ // `InvalidError` object.
43
74
  return error;
44
75
  }
45
76
  }
46
77
  });
47
78
  ```
48
79
 
49
- The `DS.InvalidError` must be constructed with a single object whose
50
- keys are the invalid model properties, and whose values contain
51
- arrays of the corresponding error messages. For example:
52
-
53
- ```javascript
54
- return new DS.InvalidError({
55
- length: ['Must be less than 15'],
56
- name: ['Must not be blank']
57
- });
58
- ```
59
-
60
80
  @class InvalidError
61
81
  @namespace DS
62
82
  */
@@ -160,7 +180,7 @@
160
180
 
161
181
  ```javascript
162
182
  App.ApplicationAdapter = DS.Adapter.extend({
163
- find: function(store, type, id) {
183
+ find: function(store, type, id, snapshot) {
164
184
  var url = [type.typeKey, id].join('/');
165
185
 
166
186
  return new Ember.RSVP.Promise(function(resolve, reject) {
@@ -179,9 +199,10 @@
179
199
  @param {DS.Store} store
180
200
  @param {subclass of DS.Model} type
181
201
  @param {String} id
202
+ @param {DS.Snapshot} snapshot
182
203
  @return {Promise} promise
183
204
  */
184
- find: Ember.required(Function),
205
+ find: null,
185
206
 
186
207
  /**
187
208
  The `findAll()` method is called when you call `find` on the store
@@ -284,8 +305,8 @@
284
305
 
285
306
  ```javascript
286
307
  App.ApplicationAdapter = DS.Adapter.extend({
287
- createRecord: function(store, type, record) {
288
- var data = this.serialize(record, { includeId: true });
308
+ createRecord: function(store, type, snapshot) {
309
+ var data = this.serialize(snapshot, { includeId: true });
289
310
  var url = type;
290
311
 
291
312
  // ...
@@ -313,8 +334,8 @@
313
334
 
314
335
  ```javascript
315
336
  App.ApplicationAdapter = DS.Adapter.extend({
316
- createRecord: function(store, type, record) {
317
- var data = this.serialize(record, { includeId: true });
337
+ createRecord: function(store, type, snapshot) {
338
+ var data = this.serialize(snapshot, { includeId: true });
318
339
  var url = type;
319
340
 
320
341
  return new Ember.RSVP.Promise(function(resolve, reject) {
@@ -337,10 +358,10 @@
337
358
  @method createRecord
338
359
  @param {DS.Store} store
339
360
  @param {subclass of DS.Model} type the DS.Model class of the record
340
- @param {DS.Model} record
361
+ @param {DS.Snapshot} snapshot
341
362
  @return {Promise} promise
342
363
  */
343
- createRecord: Ember.required(Function),
364
+ createRecord: null,
344
365
 
345
366
  /**
346
367
  Implement this method in a subclass to handle the updating of
@@ -352,9 +373,9 @@
352
373
 
353
374
  ```javascript
354
375
  App.ApplicationAdapter = DS.Adapter.extend({
355
- updateRecord: function(store, type, record) {
356
- var data = this.serialize(record, { includeId: true });
357
- var id = record.get('id');
376
+ updateRecord: function(store, type, snapshot) {
377
+ var data = this.serialize(snapshot, { includeId: true });
378
+ var id = snapshot.id;
358
379
  var url = [type, id].join('/');
359
380
 
360
381
  return new Ember.RSVP.Promise(function(resolve, reject) {
@@ -377,10 +398,10 @@
377
398
  @method updateRecord
378
399
  @param {DS.Store} store
379
400
  @param {subclass of DS.Model} type the DS.Model class of the record
380
- @param {DS.Model} record
401
+ @param {DS.Snapshot} snapshot
381
402
  @return {Promise} promise
382
403
  */
383
- updateRecord: Ember.required(Function),
404
+ updateRecord: null,
384
405
 
385
406
  /**
386
407
  Implement this method in a subclass to handle the deletion of
@@ -392,9 +413,9 @@
392
413
 
393
414
  ```javascript
394
415
  App.ApplicationAdapter = DS.Adapter.extend({
395
- deleteRecord: function(store, type, record) {
396
- var data = this.serialize(record, { includeId: true });
397
- var id = record.get('id');
416
+ deleteRecord: function(store, type, snapshot) {
417
+ var data = this.serialize(snapshot, { includeId: true });
418
+ var id = snapshot.id;
398
419
  var url = [type, id].join('/');
399
420
 
400
421
  return new Ember.RSVP.Promise(function(resolve, reject) {
@@ -417,10 +438,10 @@
417
438
  @method deleteRecord
418
439
  @param {DS.Store} store
419
440
  @param {subclass of DS.Model} type the DS.Model class of the record
420
- @param {DS.Model} record
441
+ @param {DS.Snapshot} snapshot
421
442
  @return {Promise} promise
422
443
  */
423
- deleteRecord: Ember.required(Function),
444
+ deleteRecord: null,
424
445
 
425
446
  /**
426
447
  By default the store will try to coalesce all `fetchRecord` calls within the same runloop
@@ -440,7 +461,7 @@
440
461
  @param {DS.Store} store
441
462
  @param {subclass of DS.Model} type the DS.Model class of the records
442
463
  @param {Array} ids
443
- @param {Array} records
464
+ @param {Array} snapshots
444
465
  @return {Promise} promise
445
466
  */
446
467
 
@@ -455,28 +476,27 @@
455
476
 
456
477
  @method groupRecordsForFindMany
457
478
  @param {DS.Store} store
458
- @param {Array} records
479
+ @param {Array} snapshots
459
480
  @return {Array} an array of arrays of records, each of which is to be
460
481
  loaded separately by `findMany`.
461
482
  */
462
- groupRecordsForFindMany: function (store, records) {
463
- return [records];
483
+ groupRecordsForFindMany: function(store, snapshots) {
484
+ return [snapshots];
464
485
  }
465
486
  });
466
487
 
467
488
  var ember$data$lib$system$adapter$$default = ember$data$lib$system$adapter$$Adapter;
468
- /**
469
- @module ember-data
470
- */
471
- var ember$data$lib$adapters$fixture_adapter$$get = Ember.get;
472
- var ember$data$lib$adapters$fixture_adapter$$fmt = Ember.String.fmt;
473
- var ember$data$lib$adapters$fixture_adapter$$indexOf = Ember.EnumerableUtils.indexOf;
489
+ var ember$data$lib$adapters$fixture$adapter$$get = Ember.get;
490
+ var ember$data$lib$adapters$fixture$adapter$$fmt = Ember.String.fmt;
491
+ var ember$data$lib$adapters$fixture$adapter$$indexOf = Ember.EnumerableUtils.indexOf;
474
492
 
475
- var ember$data$lib$adapters$fixture_adapter$$counter = 0;
493
+ var ember$data$lib$adapters$fixture$adapter$$counter = 0;
476
494
 
477
- var ember$data$lib$adapters$fixture_adapter$$default = ember$data$lib$system$adapter$$default.extend({
495
+ var ember$data$lib$adapters$fixture$adapter$$default = ember$data$lib$system$adapter$$default.extend({
478
496
  // by default, fixtures are already in normalized form
479
497
  serializer: null,
498
+ // The fixture adapter does not support coalesceFindRequests
499
+ coalesceFindRequests: false,
480
500
 
481
501
  /**
482
502
  If `simulateRemoteResponse` is `true` the `FixtureAdapter` will
@@ -515,7 +535,7 @@
515
535
  return fixtures.map(function(fixture) {
516
536
  var fixtureIdType = typeof fixture.id;
517
537
  if (fixtureIdType !== "number" && fixtureIdType !== "string") {
518
- throw new Error(ember$data$lib$adapters$fixture_adapter$$fmt('the id property must be defined as a number or string for fixture %@', [fixture]));
538
+ throw new Error(ember$data$lib$adapters$fixture$adapter$$fmt('the id property must be defined as a number or string for fixture %@', [fixture]));
519
539
  }
520
540
  fixture.id = fixture.id + '';
521
541
  return fixture;
@@ -560,10 +580,9 @@
560
580
  @method mockJSON
561
581
  @param {DS.Store} store
562
582
  @param {Subclass of DS.Model} type
563
- @param {DS.Model} record
583
+ @param {DS.Snapshot} snapshot
564
584
  */
565
- mockJSON: function(store, type, record) {
566
- var snapshot = record._createSnapshot();
585
+ mockJSON: function(store, type, snapshot) {
567
586
  return store.serializerFor(snapshot.typeKey).serialize(snapshot, { includeId: true });
568
587
  },
569
588
 
@@ -574,7 +593,7 @@
574
593
  @return {String} id
575
594
  */
576
595
  generateIdForRecord: function(store) {
577
- return "fixture-" + ember$data$lib$adapters$fixture_adapter$$counter++;
596
+ return "fixture-" + ember$data$lib$adapters$fixture$adapter$$counter++;
578
597
  },
579
598
 
580
599
  /**
@@ -582,9 +601,10 @@
582
601
  @param {DS.Store} store
583
602
  @param {subclass of DS.Model} type
584
603
  @param {String} id
604
+ @param {DS.Snapshot} snapshot
585
605
  @return {Promise} promise
586
606
  */
587
- find: function(store, type, id) {
607
+ find: function(store, type, id, snapshot) {
588
608
  var fixtures = this.fixturesForType(type);
589
609
  var fixture;
590
610
 
@@ -606,16 +626,17 @@
606
626
  @param {DS.Store} store
607
627
  @param {subclass of DS.Model} type
608
628
  @param {Array} ids
629
+ @param {Array} snapshots
609
630
  @return {Promise} promise
610
631
  */
611
- findMany: function(store, type, ids) {
632
+ findMany: function(store, type, ids, snapshots) {
612
633
  var fixtures = this.fixturesForType(type);
613
634
 
614
635
  Ember.assert("Unable to find fixtures for model type "+type.toString(), fixtures);
615
636
 
616
637
  if (fixtures) {
617
638
  fixtures = fixtures.filter(function(item) {
618
- return ember$data$lib$adapters$fixture_adapter$$indexOf(ids, item.id) !== -1;
639
+ return ember$data$lib$adapters$fixture$adapter$$indexOf(ids, item.id) !== -1;
619
640
  });
620
641
  }
621
642
 
@@ -671,11 +692,11 @@
671
692
  @method createRecord
672
693
  @param {DS.Store} store
673
694
  @param {subclass of DS.Model} type
674
- @param {DS.Model} record
695
+ @param {DS.Snapshot} snapshot
675
696
  @return {Promise} promise
676
697
  */
677
- createRecord: function(store, type, record) {
678
- var fixture = this.mockJSON(store, type, record);
698
+ createRecord: function(store, type, snapshot) {
699
+ var fixture = this.mockJSON(store, type, snapshot);
679
700
 
680
701
  this.updateFixtures(type, fixture);
681
702
 
@@ -688,11 +709,11 @@
688
709
  @method updateRecord
689
710
  @param {DS.Store} store
690
711
  @param {subclass of DS.Model} type
691
- @param {DS.Model} record
712
+ @param {DS.Snapshot} snapshot
692
713
  @return {Promise} promise
693
714
  */
694
- updateRecord: function(store, type, record) {
695
- var fixture = this.mockJSON(store, type, record);
715
+ updateRecord: function(store, type, snapshot) {
716
+ var fixture = this.mockJSON(store, type, snapshot);
696
717
 
697
718
  this.updateFixtures(type, fixture);
698
719
 
@@ -705,11 +726,11 @@
705
726
  @method deleteRecord
706
727
  @param {DS.Store} store
707
728
  @param {subclass of DS.Model} type
708
- @param {DS.Model} record
729
+ @param {DS.Snapshot} snapshot
709
730
  @return {Promise} promise
710
731
  */
711
- deleteRecord: function(store, type, record) {
712
- this.deleteLoadedFixture(type, record);
732
+ deleteRecord: function(store, type, snapshot) {
733
+ this.deleteLoadedFixture(type, snapshot);
713
734
 
714
735
  return this.simulateRemoteCall(function() {
715
736
  // no payload in a deletion
@@ -721,13 +742,13 @@
721
742
  @method deleteLoadedFixture
722
743
  @private
723
744
  @param type
724
- @param record
745
+ @param snapshot
725
746
  */
726
- deleteLoadedFixture: function(type, record) {
727
- var existingFixture = this.findExistingFixture(type, record);
747
+ deleteLoadedFixture: function(type, snapshot) {
748
+ var existingFixture = this.findExistingFixture(type, snapshot);
728
749
 
729
750
  if (existingFixture) {
730
- var index = ember$data$lib$adapters$fixture_adapter$$indexOf(type.FIXTURES, existingFixture);
751
+ var index = ember$data$lib$adapters$fixture$adapter$$indexOf(type.FIXTURES, existingFixture);
731
752
  type.FIXTURES.splice(index, 1);
732
753
  return true;
733
754
  }
@@ -737,11 +758,11 @@
737
758
  @method findExistingFixture
738
759
  @private
739
760
  @param type
740
- @param record
761
+ @param snapshot
741
762
  */
742
- findExistingFixture: function(type, record) {
763
+ findExistingFixture: function(type, snapshot) {
743
764
  var fixtures = this.fixturesForType(type);
744
- var id = ember$data$lib$adapters$fixture_adapter$$get(record, 'id');
765
+ var id = snapshot.id;
745
766
 
746
767
  return this.findFixtureById(fixtures, id);
747
768
  },
@@ -754,7 +775,7 @@
754
775
  */
755
776
  findFixtureById: function(fixtures, id) {
756
777
  return Ember.A(fixtures).find(function(r) {
757
- if (''+ember$data$lib$adapters$fixture_adapter$$get(r, 'id') === ''+id) {
778
+ if (''+ember$data$lib$adapters$fixture$adapter$$get(r, 'id') === ''+id) {
758
779
  return true;
759
780
  } else {
760
781
  return false;
@@ -773,11 +794,11 @@
773
794
 
774
795
  return new Ember.RSVP.Promise(function(resolve) {
775
796
  var value = Ember.copy(callback.call(context), true);
776
- if (ember$data$lib$adapters$fixture_adapter$$get(adapter, 'simulateRemoteResponse')) {
797
+ if (ember$data$lib$adapters$fixture$adapter$$get(adapter, 'simulateRemoteResponse')) {
777
798
  // Schedule with setTimeout
778
799
  Ember.run.later(function() {
779
800
  resolve(value);
780
- }, ember$data$lib$adapters$fixture_adapter$$get(adapter, 'latency'));
801
+ }, ember$data$lib$adapters$fixture$adapter$$get(adapter, 'latency'));
781
802
  } else {
782
803
  // Asynchronous, but at the of the runloop with zero latency
783
804
  Ember.run.schedule('actions', null, function() {
@@ -788,23 +809,129 @@
788
809
  }
789
810
  });
790
811
 
791
- /*
792
- The Map/MapWithDefault/OrderedSet code has been in flux as we try
793
- to catch up with ES6. This is difficult as we support multiple
794
- versions of Ember.
795
- This file is currently here in case we have to polyfill ember's code
796
- across a few releases. As ES6 comes to a close we should have a smaller
797
- and smaller gap in implementations between Ember releases.
798
- */
799
812
  var ember$data$lib$system$map$$Map = Ember.Map;
800
813
  var ember$data$lib$system$map$$MapWithDefault = Ember.MapWithDefault;
801
- var ember$data$lib$system$map$$OrderedSet = Ember.OrderedSet;
802
814
 
803
815
  var ember$data$lib$system$map$$default = ember$data$lib$system$map$$Map;
804
- var ember$data$lib$adapters$rest_adapter$$get = Ember.get;
805
- var ember$data$lib$adapters$rest_adapter$$forEach = Ember.ArrayPolyfills.forEach;
816
+ var ember$data$lib$adapters$build$url$mixin$$get = Ember.get;
817
+
818
+ var ember$data$lib$adapters$build$url$mixin$$default = Ember.Mixin.create({
819
+ /**
820
+ Builds a URL for a given type and optional ID.
821
+
822
+ By default, it pluralizes the type's name (for example, 'post'
823
+ becomes 'posts' and 'person' becomes 'people'). To override the
824
+ pluralization see [pathForType](#method_pathForType).
825
+
826
+ If an ID is specified, it adds the ID to the path generated
827
+ for the type, separated by a `/`.
828
+
829
+ When called by RESTAdapter.findMany() the `id` and `snapshot` parameters
830
+ will be arrays of ids and snapshots.
831
+
832
+ @method buildURL
833
+ @param {String} type
834
+ @param {String|Array} id single id or array of ids
835
+ @param {DS.Snapshot|Array} snapshot single snapshot or array of snapshots
836
+ @return {String} url
837
+ */
838
+ buildURL: function(type, id, snapshot) {
839
+ var url = [];
840
+ var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
841
+ var prefix = this.urlPrefix();
842
+
843
+ if (type) { url.push(this.pathForType(type)); }
844
+
845
+ //We might get passed in an array of ids from findMany
846
+ //in which case we don't want to modify the url, as the
847
+ //ids will be passed in through a query param
848
+ if (id && !Ember.isArray(id)) { url.push(encodeURIComponent(id)); }
849
+
850
+ if (prefix) { url.unshift(prefix); }
851
+
852
+ url = url.join('/');
853
+ if (!host && url) { url = '/' + url; }
854
+
855
+ return url;
856
+ },
857
+
858
+ /**
859
+ @method urlPrefix
860
+ @private
861
+ @param {String} path
862
+ @param {String} parentUrl
863
+ @return {String} urlPrefix
864
+ */
865
+ urlPrefix: function(path, parentURL) {
866
+ var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
867
+ var namespace = ember$data$lib$adapters$build$url$mixin$$get(this, 'namespace');
868
+ var url = [];
869
+
870
+ if (path) {
871
+ // Protocol relative url
872
+ //jscs:disable disallowEmptyBlocks
873
+ if (/^\/\//.test(path)) {
874
+ // Do nothing, the full host is already included. This branch
875
+ // avoids the absolute path logic and the relative path logic.
876
+
877
+ // Absolute path
878
+ } else if (path.charAt(0) === '/') {
879
+ //jscs:enable disallowEmptyBlocks
880
+ if (host) {
881
+ path = path.slice(1);
882
+ url.push(host);
883
+ }
884
+ // Relative path
885
+ } else if (!/^http(s)?:\/\//.test(path)) {
886
+ url.push(parentURL);
887
+ }
888
+ } else {
889
+ if (host) { url.push(host); }
890
+ if (namespace) { url.push(namespace); }
891
+ }
892
+
893
+ if (path) {
894
+ url.push(path);
895
+ }
896
+
897
+ return url.join('/');
898
+ },
899
+
900
+
901
+ /**
902
+ Determines the pathname for a given type.
903
+
904
+ By default, it pluralizes the type's name (for example,
905
+ 'post' becomes 'posts' and 'person' becomes 'people').
906
+
907
+ ### Pathname customization
908
+
909
+ For example if you have an object LineItem with an
910
+ endpoint of "/line_items/".
911
+
912
+ ```js
913
+ App.ApplicationAdapter = DS.RESTAdapter.extend({
914
+ pathForType: function(type) {
915
+ var decamelized = Ember.String.decamelize(type);
916
+ return Ember.String.pluralize(decamelized);
917
+ }
918
+ });
919
+ ```
920
+
921
+ @method pathForType
922
+ @param {String} type
923
+ @return {String} path
924
+ **/
925
+ pathForType: function(type) {
926
+ var camelized = Ember.String.camelize(type);
927
+ return Ember.String.pluralize(camelized);
928
+ }
929
+ });
930
+
931
+ var ember$data$lib$adapters$rest$adapter$$get = Ember.get;
932
+ var ember$data$lib$adapters$rest$adapter$$forEach = Ember.ArrayPolyfills.forEach;
806
933
 
807
- var ember$data$lib$adapters$rest_adapter$$default = ember$data$lib$system$adapter$$Adapter.extend({
934
+ var ember$data$lib$adapters$rest$adapter$$default = ember$data$lib$system$adapter$$Adapter.extend(ember$data$lib$adapters$build$url$mixin$$default, {
808
935
  defaultSerializer: '-rest',
809
936
 
810
937
  /**
@@ -974,11 +1101,11 @@
974
1101
  @param {DS.Store} store
975
1102
  @param {subclass of DS.Model} type
976
1103
  @param {String} id
977
- @param {DS.Model} record
1104
+ @param {DS.Snapshot} snapshot
978
1105
  @return {Promise} promise
979
1106
  */
980
- find: function(store, type, id, record) {
981
- return this.ajax(this.buildURL(type.typeKey, id, record), 'GET');
1107
+ find: function(store, type, id, snapshot) {
1108
+ return this.ajax(this.buildURL(type.typeKey, id, snapshot), 'GET');
982
1109
  },
983
1110
 
984
1111
  /**
@@ -1059,11 +1186,11 @@
1059
1186
  @param {DS.Store} store
1060
1187
  @param {subclass of DS.Model} type
1061
1188
  @param {Array} ids
1062
- @param {Array} records
1189
+ @param {Array} snapshots
1063
1190
  @return {Promise} promise
1064
1191
  */
1065
- findMany: function(store, type, ids, records) {
1066
- return this.ajax(this.buildURL(type.typeKey, ids, records), 'GET', { data: { ids: ids } });
1192
+ findMany: function(store, type, ids, snapshots) {
1193
+ return this.ajax(this.buildURL(type.typeKey, ids, snapshots), 'GET', { data: { ids: ids } });
1067
1194
  },
1068
1195
 
1069
1196
  /**
@@ -1091,14 +1218,14 @@
1091
1218
 
1092
1219
  @method findHasMany
1093
1220
  @param {DS.Store} store
1094
- @param {DS.Model} record
1221
+ @param {DS.Snapshot} snapshot
1095
1222
  @param {String} url
1096
1223
  @return {Promise} promise
1097
1224
  */
1098
- findHasMany: function(store, record, url, relationship) {
1099
- var host = ember$data$lib$adapters$rest_adapter$$get(this, 'host');
1100
- var id = ember$data$lib$adapters$rest_adapter$$get(record, 'id');
1101
- var type = record.constructor.typeKey;
1225
+ findHasMany: function(store, snapshot, url, relationship) {
1226
+ var host = ember$data$lib$adapters$rest$adapter$$get(this, 'host');
1227
+ var id = snapshot.id;
1228
+ var type = snapshot.typeKey;
1102
1229
 
1103
1230
  if (host && url.charAt(0) === '/' && url.charAt(1) !== '/') {
1104
1231
  url = host + url;
@@ -1130,13 +1257,13 @@
1130
1257
 
1131
1258
  @method findBelongsTo
1132
1259
  @param {DS.Store} store
1133
- @param {DS.Model} record
1260
+ @param {DS.Snapshot} snapshot
1134
1261
  @param {String} url
1135
1262
  @return {Promise} promise
1136
1263
  */
1137
- findBelongsTo: function(store, record, url, relationship) {
1138
- var id = ember$data$lib$adapters$rest_adapter$$get(record, 'id');
1139
- var type = record.constructor.typeKey;
1264
+ findBelongsTo: function(store, snapshot, url, relationship) {
1265
+ var id = snapshot.id;
1266
+ var type = snapshot.typeKey;
1140
1267
 
1141
1268
  return this.ajax(this.urlPrefix(url, this.buildURL(type, id)), 'GET');
1142
1269
  },
@@ -1154,17 +1281,16 @@
1154
1281
  @method createRecord
1155
1282
  @param {DS.Store} store
1156
1283
  @param {subclass of DS.Model} type
1157
- @param {DS.Model} record
1284
+ @param {DS.Snapshot} snapshot
1158
1285
  @return {Promise} promise
1159
1286
  */
1160
- createRecord: function(store, type, record) {
1287
+ createRecord: function(store, type, snapshot) {
1161
1288
  var data = {};
1162
1289
  var serializer = store.serializerFor(type.typeKey);
1163
1290
 
1164
- var snapshot = record._createSnapshot();
1165
1291
  serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
1166
1292
 
1167
- return this.ajax(this.buildURL(type.typeKey, null, record), "POST", { data: data });
1293
+ return this.ajax(this.buildURL(type.typeKey, null, snapshot), "POST", { data: data });
1168
1294
  },
1169
1295
 
1170
1296
  /**
@@ -1180,19 +1306,18 @@
1180
1306
  @method updateRecord
1181
1307
  @param {DS.Store} store
1182
1308
  @param {subclass of DS.Model} type
1183
- @param {DS.Model} record
1309
+ @param {DS.Snapshot} snapshot
1184
1310
  @return {Promise} promise
1185
1311
  */
1186
- updateRecord: function(store, type, record) {
1312
+ updateRecord: function(store, type, snapshot) {
1187
1313
  var data = {};
1188
1314
  var serializer = store.serializerFor(type.typeKey);
1189
1315
 
1190
- var snapshot = record._createSnapshot();
1191
1316
  serializer.serializeIntoHash(data, type, snapshot);
1192
1317
 
1193
- var id = ember$data$lib$adapters$rest_adapter$$get(record, 'id');
1318
+ var id = snapshot.id;
1194
1319
 
1195
- return this.ajax(this.buildURL(type.typeKey, id, record), "PUT", { data: data });
1320
+ return this.ajax(this.buildURL(type.typeKey, id, snapshot), "PUT", { data: data });
1196
1321
  },
1197
1322
 
1198
1323
  /**
@@ -1203,104 +1328,25 @@
1203
1328
  @method deleteRecord
1204
1329
  @param {DS.Store} store
1205
1330
  @param {subclass of DS.Model} type
1206
- @param {DS.Model} record
1331
+ @param {DS.Snapshot} snapshot
1207
1332
  @return {Promise} promise
1208
1333
  */
1209
- deleteRecord: function(store, type, record) {
1210
- var id = ember$data$lib$adapters$rest_adapter$$get(record, 'id');
1211
-
1212
- return this.ajax(this.buildURL(type.typeKey, id, record), "DELETE");
1213
- },
1214
-
1215
- /**
1216
- Builds a URL for a given type and optional ID.
1217
-
1218
- By default, it pluralizes the type's name (for example, 'post'
1219
- becomes 'posts' and 'person' becomes 'people'). To override the
1220
- pluralization see [pathForType](#method_pathForType).
1221
-
1222
- If an ID is specified, it adds the ID to the path generated
1223
- for the type, separated by a `/`.
1224
-
1225
- @method buildURL
1226
- @param {String} type
1227
- @param {String} id
1228
- @param {DS.Model} record
1229
- @return {String} url
1230
- */
1231
- buildURL: function(type, id, record) {
1232
- var url = [];
1233
- var host = ember$data$lib$adapters$rest_adapter$$get(this, 'host');
1234
- var prefix = this.urlPrefix();
1235
-
1236
- if (type) { url.push(this.pathForType(type)); }
1237
-
1238
- //We might get passed in an array of ids from findMany
1239
- //in which case we don't want to modify the url, as the
1240
- //ids will be passed in through a query param
1241
- if (id && !Ember.isArray(id)) { url.push(encodeURIComponent(id)); }
1242
-
1243
- if (prefix) { url.unshift(prefix); }
1244
-
1245
- url = url.join('/');
1246
- if (!host && url) { url = '/' + url; }
1247
-
1248
- return url;
1249
- },
1250
-
1251
- /**
1252
- @method urlPrefix
1253
- @private
1254
- @param {String} path
1255
- @param {String} parentUrl
1256
- @return {String} urlPrefix
1257
- */
1258
- urlPrefix: function(path, parentURL) {
1259
- var host = ember$data$lib$adapters$rest_adapter$$get(this, 'host');
1260
- var namespace = ember$data$lib$adapters$rest_adapter$$get(this, 'namespace');
1261
- var url = [];
1262
-
1263
- if (path) {
1264
- // Protocol relative url
1265
- //jscs:disable disallowEmptyBlocks
1266
- if (/^\/\//.test(path)) {
1267
- // Do nothing, the full host is already included. This branch
1268
- // avoids the absolute path logic and the relative path logic.
1269
-
1270
- // Absolute path
1271
- } else if (path.charAt(0) === '/') {
1272
- //jscs:enable disallowEmptyBlocks
1273
- if (host) {
1274
- path = path.slice(1);
1275
- url.push(host);
1276
- }
1277
- // Relative path
1278
- } else if (!/^http(s)?:\/\//.test(path)) {
1279
- url.push(parentURL);
1280
- }
1281
- } else {
1282
- if (host) { url.push(host); }
1283
- if (namespace) { url.push(namespace); }
1284
- }
1285
-
1286
- if (path) {
1287
- url.push(path);
1288
- }
1334
+ deleteRecord: function(store, type, snapshot) {
1335
+ var id = snapshot.id;
1289
1336
 
1290
- return url.join('/');
1337
+ return this.ajax(this.buildURL(type.typeKey, id, snapshot), "DELETE");
1291
1338
  },
1292
1339
 
1293
- _stripIDFromURL: function(store, record) {
1294
- var type = record.constructor;
1295
- var url = this.buildURL(type.typeKey, record.get('id'), record);
1340
+ _stripIDFromURL: function(store, snapshot) {
1341
+ var url = this.buildURL(snapshot.typeKey, snapshot.id, snapshot);
1296
1342
 
1297
1343
  var expandedURL = url.split('/');
1298
1344
  //Case when the url is of the format ...something/:id
1299
1345
  var lastSegment = expandedURL[expandedURL.length - 1];
1300
- var id = record.get('id');
1346
+ var id = snapshot.id;
1301
1347
  if (lastSegment === id) {
1302
1348
  expandedURL[expandedURL.length - 1] = "";
1303
- } else if (ember$data$lib$adapters$rest_adapter$$endsWith(lastSegment, '?id=' + id)) {
1349
+ } else if (ember$data$lib$adapters$rest$adapter$$endsWith(lastSegment, '?id=' + id)) {
1304
1350
  //Case when the url is of the format ...something?id=:id
1305
1351
  expandedURL[expandedURL.length - 1] = lastSegment.substring(0, lastSegment.length - id.length - 1);
1306
1352
  }
@@ -1329,18 +1375,18 @@
1329
1375
 
1330
1376
  @method groupRecordsForFindMany
1331
1377
  @param {DS.Store} store
1332
- @param {Array} records
1378
+ @param {Array} snapshots
1333
1379
  @return {Array} an array of arrays of records, each of which is to be
1334
1380
  loaded separately by `findMany`.
1335
1381
  */
1336
- groupRecordsForFindMany: function (store, records) {
1382
+ groupRecordsForFindMany: function (store, snapshots) {
1337
1383
  var groups = ember$data$lib$system$map$$MapWithDefault.create({ defaultValue: function() { return []; } });
1338
1384
  var adapter = this;
1339
1385
  var maxUrlLength = this.maxUrlLength;
1340
1386
 
1341
- ember$data$lib$adapters$rest_adapter$$forEach.call(records, function(record) {
1342
- var baseUrl = adapter._stripIDFromURL(store, record);
1343
- groups.get(baseUrl).push(record);
1387
+ ember$data$lib$adapters$rest$adapter$$forEach.call(snapshots, function(snapshot) {
1388
+ var baseUrl = adapter._stripIDFromURL(store, snapshot);
1389
+ groups.get(baseUrl).push(snapshot);
1344
1390
  });
1345
1391
 
1346
1392
  function splitGroupToFitInUrl(group, maxUrlLength, paramNameLength) {
@@ -1348,8 +1394,8 @@
1348
1394
  var idsSize = 0;
1349
1395
  var splitGroups = [[]];
1350
1396
 
1351
- ember$data$lib$adapters$rest_adapter$$forEach.call(group, function(record) {
1352
- var additionalLength = encodeURIComponent(record.get('id')).length + paramNameLength;
1397
+ ember$data$lib$adapters$rest$adapter$$forEach.call(group, function(snapshot) {
1398
+ var additionalLength = encodeURIComponent(snapshot.id).length + paramNameLength;
1353
1399
  if (baseUrl.length + idsSize + additionalLength >= maxUrlLength) {
1354
1400
  idsSize = 0;
1355
1401
  splitGroups.push([]);
@@ -1358,7 +1404,7 @@
1358
1404
  idsSize += additionalLength;
1359
1405
 
1360
1406
  var lastGroupIndex = splitGroups.length - 1;
1361
- splitGroups[lastGroupIndex].push(record);
1407
+ splitGroups[lastGroupIndex].push(snapshot);
1362
1408
  });
1363
1409
 
1364
1410
  return splitGroups;
@@ -1369,7 +1415,7 @@
1369
1415
  var paramNameLength = '&ids%5B%5D='.length;
1370
1416
  var splitGroups = splitGroupToFitInUrl(group, maxUrlLength, paramNameLength);
1371
1417
 
1372
- ember$data$lib$adapters$rest_adapter$$forEach.call(splitGroups, function(splitGroup) {
1418
+ ember$data$lib$adapters$rest$adapter$$forEach.call(splitGroups, function(splitGroup) {
1373
1419
  groupsArray.push(splitGroup);
1374
1420
  });
1375
1421
  });
@@ -1377,49 +1423,20 @@
1377
1423
  return groupsArray;
1378
1424
  },
1379
1425
 
1380
- /**
1381
- Determines the pathname for a given type.
1382
1426
 
1383
- By default, it pluralizes the type's name (for example,
1384
- 'post' becomes 'posts' and 'person' becomes 'people').
1427
+ /**
1428
+ Takes an ajax response, and returns an error payload.
1385
1429
 
1386
- ### Pathname customization
1430
+ Returning a `DS.InvalidError` from this method will cause the
1431
+ record to transition into the `invalid` state and make the
1432
+ `errors` object available on the record. When returning an
1433
+ `InvalidError` the store will attempt to normalize the error data
1434
+ returned from the server using the serializer's `extractErrors`
1435
+ method.
1387
1436
 
1388
- For example if you have an object LineItem with an
1389
- endpoint of "/line_items/".
1437
+ Example
1390
1438
 
1391
- ```js
1392
- App.ApplicationAdapter = DS.RESTAdapter.extend({
1393
- pathForType: function(type) {
1394
- var decamelized = Ember.String.decamelize(type);
1395
- return Ember.String.pluralize(decamelized);
1396
- }
1397
- });
1398
- ```
1399
-
1400
- @method pathForType
1401
- @param {String} type
1402
- @return {String} path
1403
- **/
1404
- pathForType: function(type) {
1405
- var camelized = Ember.String.camelize(type);
1406
- return Ember.String.pluralize(camelized);
1407
- },
1408
-
1409
- /**
1410
- Takes an ajax response, and returns an error payload.
1411
-
1412
- Returning a `DS.InvalidError` from this method will cause the
1413
- record to transition into the `invalid` state and make the
1414
- `errors` object available on the record.
1415
-
1416
- This function should return the entire payload as received from the
1417
- server. Error object extraction and normalization of model errors
1418
- should be performed by `extractErrors` on the serializer.
1419
-
1420
- Example
1421
-
1422
- ```javascript
1439
+ ```javascript
1423
1440
  App.ApplicationAdapter = DS.RESTAdapter.extend({
1424
1441
  ajaxError: function(jqXHR) {
1425
1442
  var error = this._super(jqXHR);
@@ -1445,6 +1462,7 @@
1445
1462
  @method ajaxError
1446
1463
  @param {Object} jqXHR
1447
1464
  @param {Object} responseText
1465
+ @param {Object} errorThrown
1448
1466
  @return {Object} jqXHR
1449
1467
  */
1450
1468
  ajaxError: function(jqXHR, responseText, errorThrown) {
@@ -1474,7 +1492,6 @@
1474
1492
  If you need to access these, you can override this hook to copy them
1475
1493
  from jqXHR to the payload object so they can be processed in you serializer.
1476
1494
 
1477
-
1478
1495
  2. Your API might return errors as successful responses with status code
1479
1496
  200 and an Errors text or object. You can return a DS.InvalidError from
1480
1497
  this hook and it will automatically reject the promise and put your record
@@ -1557,10 +1574,10 @@
1557
1574
  hash.data = JSON.stringify(hash.data);
1558
1575
  }
1559
1576
 
1560
- var headers = ember$data$lib$adapters$rest_adapter$$get(this, 'headers');
1577
+ var headers = ember$data$lib$adapters$rest$adapter$$get(this, 'headers');
1561
1578
  if (headers !== undefined) {
1562
1579
  hash.beforeSend = function (xhr) {
1563
- ember$data$lib$adapters$rest_adapter$$forEach.call(Ember.keys(headers), function(key) {
1580
+ ember$data$lib$adapters$rest$adapter$$forEach.call(Ember.keys(headers), function(key) {
1564
1581
  xhr.setRequestHeader(key, headers[key]);
1565
1582
  });
1566
1583
  };
@@ -1571,7 +1588,7 @@
1571
1588
  });
1572
1589
 
1573
1590
  //From http://stackoverflow.com/questions/280634/endswith-in-javascript
1574
- function ember$data$lib$adapters$rest_adapter$$endsWith(string, suffix) {
1591
+ function ember$data$lib$adapters$rest$adapter$$endsWith(string, suffix) {
1575
1592
  if (typeof String.prototype.endsWith !== 'function') {
1576
1593
  return string.indexOf(suffix, string.length - suffix.length) !== -1;
1577
1594
  } else {
@@ -1966,51 +1983,105 @@
1966
1983
 
1967
1984
  ember$inflector$lib$system$inflector$$default.inflector = new ember$inflector$lib$system$inflector$$default(ember$inflector$lib$system$inflections$$default);
1968
1985
 
1969
- /**
1970
- *
1971
- * If you have Ember Inflector (such as if Ember Data is present),
1972
- * singularize a word. For example, turn "oxen" into "ox".
1973
- *
1974
- * Example:
1975
- *
1976
- * {{singularize myProperty}}
1977
- * {{singularize "oxen"}}
1978
- *
1979
- * @for Ember.Handlebars.helpers
1980
- * @method singularize
1981
- * @param {String|Property} word word to singularize
1982
- */
1983
- Ember.Handlebars.helper('singularize', ember$inflector$lib$system$string$$singularize);
1984
-
1985
- /**
1986
- *
1987
- * If you have Ember Inflector (such as if Ember Data is present),
1988
- * pluralize a word. For example, turn "ox" into "oxen".
1989
- *
1990
- * Example:
1991
- *
1992
- * {{pluralize count myProperty}}
1993
- * {{pluralize 1 "oxen"}}
1994
- * {{pluralize myProperty}}
1995
- * {{pluralize "ox"}}
1996
- *
1997
- * @for Ember.Handlebars.helpers
1998
- * @method pluralize
1999
- * @param {Number|Property} [count] count of objects
2000
- * @param {String|Property} word word to pluralize
2001
- */
2002
- Ember.Handlebars.helper('pluralize', function(count, word, options) {
2003
- if(arguments.length < 3) {
2004
- return ember$inflector$lib$system$string$$pluralize(count);
2005
- } else {
2006
- /* jshint eqeqeq: false */
2007
- if(count != 1) {
2008
- /* jshint eqeqeq: true */
2009
- word = ember$inflector$lib$system$string$$pluralize(word);
1986
+ if (Ember.HTMLBars) {
1987
+ /**
1988
+ *
1989
+ * If you have Ember Inflector (such as if Ember Data is present),
1990
+ * singularize a word. For example, turn "oxen" into "ox".
1991
+ *
1992
+ * Example:
1993
+ *
1994
+ * {{singularize myProperty}}
1995
+ * {{singularize "oxen"}}
1996
+ *
1997
+ * @for Ember.HTMLBars.helpers
1998
+ * @method singularize
1999
+ * @param {String|Property} word word to singularize
2000
+ */
2001
+ Ember.HTMLBars._registerHelper('singularize', Ember.HTMLBars.makeBoundHelper(function(params){
2002
+ return ember$inflector$lib$system$string$$singularize(params[0]);
2003
+ }));
2004
+
2005
+ /**
2006
+ *
2007
+ * If you have Ember Inflector (such as if Ember Data is present),
2008
+ * pluralize a word. For example, turn "ox" into "oxen".
2009
+ *
2010
+ * Example:
2011
+ *
2012
+ * {{pluralize count myProperty}}
2013
+ * {{pluralize 1 "oxen"}}
2014
+ * {{pluralize myProperty}}
2015
+ * {{pluralize "ox"}}
2016
+ *
2017
+ * @for Ember.HTMLBars.helpers
2018
+ * @method pluralize
2019
+ * @param {Number|Property} [count] count of objects
2020
+ * @param {String|Property} word word to pluralize
2021
+ */
2022
+ Ember.HTMLBars._registerHelper('pluralize', Ember.HTMLBars.makeBoundHelper(function(params) {
2023
+ var count, word;
2024
+
2025
+ if (params.length === 1) {
2026
+ word = params[0];
2027
+ return ember$inflector$lib$system$string$$pluralize(word);
2028
+ } else {
2029
+ count = params[0];
2030
+ word = params[1];
2031
+
2032
+ if (count !== 1) {
2033
+ word = ember$inflector$lib$system$string$$pluralize(word);
2034
+ }
2035
+ return count + " " + word;
2036
+ }
2037
+ }));
2038
+ } else {
2039
+ /**
2040
+ *
2041
+ * If you have Ember Inflector (such as if Ember Data is present),
2042
+ * singularize a word. For example, turn "oxen" into "ox".
2043
+ *
2044
+ * Example:
2045
+ *
2046
+ * {{singularize myProperty}}
2047
+ * {{singularize "oxen"}}
2048
+ *
2049
+ * @for Ember.Handlebars.helpers
2050
+ * @method singularize
2051
+ * @param {String|Property} word word to singularize
2052
+ */
2053
+ Ember.Handlebars.helper('singularize', ember$inflector$lib$system$string$$singularize);
2054
+
2055
+ /**
2056
+ *
2057
+ * If you have Ember Inflector (such as if Ember Data is present),
2058
+ * pluralize a word. For example, turn "ox" into "oxen".
2059
+ *
2060
+ * Example:
2061
+ *
2062
+ * {{pluralize count myProperty}}
2063
+ * {{pluralize 1 "oxen"}}
2064
+ * {{pluralize myProperty}}
2065
+ * {{pluralize "ox"}}
2066
+ *
2067
+ * @for Ember.Handlebars.helpers
2068
+ * @method pluralize
2069
+ * @param {Number|Property} [count] count of objects
2070
+ * @param {String|Property} word word to pluralize
2071
+ */
2072
+ Ember.Handlebars.helper('pluralize', function(count, word, options) {
2073
+ if(arguments.length < 3) {
2074
+ return ember$inflector$lib$system$string$$pluralize(count);
2075
+ } else {
2076
+ /* jshint eqeqeq: false */
2077
+ if(count != 1) {
2078
+ /* jshint eqeqeq: true */
2079
+ word = ember$inflector$lib$system$string$$pluralize(word);
2080
+ }
2081
+ return count + " " + word;
2010
2082
  }
2011
- return count + " " + word;
2012
- }
2013
- });
2083
+ });
2084
+ }
2014
2085
 
2015
2086
  if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
2016
2087
  /**
@@ -2042,12 +2113,21 @@
2042
2113
 
2043
2114
  var ember$inflector$lib$main$$default = ember$inflector$lib$system$inflector$$default;
2044
2115
 
2116
+ if (typeof define !== 'undefined' && define.amd){
2117
+ define('ember-inflector', ['exports'], function(__exports__){
2118
+ __exports__['default'] = ember$inflector$lib$system$inflector$$default;
2119
+ return ember$inflector$lib$system$inflector$$default;
2120
+ });
2121
+ } else if (typeof module !== 'undefined' && module['exports']){
2122
+ module['exports'] = ember$inflector$lib$system$inflector$$default;
2123
+ }
2124
+
2045
2125
  /**
2046
2126
  @module ember-data
2047
2127
  */
2048
2128
 
2049
- var activemodel$adapter$lib$system$active_model_adapter$$decamelize = Ember.String.decamelize;
2050
- var activemodel$adapter$lib$system$active_model_adapter$$underscore = Ember.String.underscore;
2129
+ var activemodel$adapter$lib$system$active$model$adapter$$decamelize = Ember.String.decamelize;
2130
+ var activemodel$adapter$lib$system$active$model$adapter$$underscore = Ember.String.underscore;
2051
2131
 
2052
2132
  /**
2053
2133
  The ActiveModelAdapter is a subclass of the RESTAdapter designed to integrate
@@ -2140,7 +2220,7 @@
2140
2220
  @extends DS.RESTAdapter
2141
2221
  **/
2142
2222
 
2143
- var activemodel$adapter$lib$system$active_model_adapter$$ActiveModelAdapter = ember$data$lib$adapters$rest_adapter$$default.extend({
2223
+ var activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter = ember$data$lib$adapters$rest$adapter$$default.extend({
2144
2224
  defaultSerializer: '-active-model',
2145
2225
  /**
2146
2226
  The ActiveModelAdapter overrides the `pathForType` method to build
@@ -2156,8 +2236,8 @@
2156
2236
  @return String
2157
2237
  */
2158
2238
  pathForType: function(type) {
2159
- var decamelized = activemodel$adapter$lib$system$active_model_adapter$$decamelize(type);
2160
- var underscored = activemodel$adapter$lib$system$active_model_adapter$$underscore(decamelized);
2239
+ var decamelized = activemodel$adapter$lib$system$active$model$adapter$$decamelize(type);
2240
+ var underscored = activemodel$adapter$lib$system$active$model$adapter$$underscore(decamelized);
2161
2241
  return ember$inflector$lib$system$string$$pluralize(underscored);
2162
2242
  },
2163
2243
 
@@ -2188,32 +2268,19 @@
2188
2268
  }
2189
2269
  });
2190
2270
 
2191
- var activemodel$adapter$lib$system$active_model_adapter$$default = activemodel$adapter$lib$system$active_model_adapter$$ActiveModelAdapter;
2192
- /**
2193
- @module ember-data
2194
- */
2195
-
2196
- /**
2197
- `DS.Serializer` is an abstract base class that you should override in your
2198
- application to customize it for your backend. The minimum set of methods
2199
- that you should implement is:
2200
-
2201
- * `extract()`
2202
- * `serialize()`
2203
-
2204
- And you can optionally override the following methods:
2205
-
2206
- * `normalize()`
2207
-
2208
- For an example implementation, see
2209
- [DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
2210
-
2211
- @class Serializer
2212
- @namespace DS
2213
- @extends Ember.Object
2214
- */
2271
+ var activemodel$adapter$lib$system$active$model$adapter$$default = activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter;
2215
2272
 
2216
2273
  var ember$data$lib$system$serializer$$Serializer = Ember.Object.extend({
2274
+ /**
2275
+ The `store` property is the application's `store` that contains all records.
2276
+ It's injected as a service.
2277
+ It can be used to push records from a non flat data structure server
2278
+ response.
2279
+
2280
+ @property store
2281
+ @type {DS.Store}
2282
+ @public
2283
+ */
2217
2284
 
2218
2285
  /**
2219
2286
  The `extract` method is used to deserialize the payload received from your
@@ -2227,7 +2294,7 @@
2227
2294
  @param {String} requestType
2228
2295
  @return {Object}
2229
2296
  */
2230
- extract: Ember.required(Function),
2297
+ extract: null,
2231
2298
 
2232
2299
  /**
2233
2300
  The `serialize` method is used when a record is saved in order to convert
@@ -2243,7 +2310,7 @@
2243
2310
  @param {Object} [options]
2244
2311
  @return {Object}
2245
2312
  */
2246
- serialize: Ember.required(Function),
2313
+ serialize: null,
2247
2314
 
2248
2315
  /**
2249
2316
  The `normalize` method is used to convert a payload received from your
@@ -2264,12 +2331,12 @@
2264
2331
 
2265
2332
  var ember$data$lib$system$serializer$$default = ember$data$lib$system$serializer$$Serializer;
2266
2333
 
2267
- var ember$data$lib$serializers$json_serializer$$get = Ember.get;
2268
- var ember$data$lib$serializers$json_serializer$$isNone = Ember.isNone;
2269
- var ember$data$lib$serializers$json_serializer$$map = Ember.ArrayPolyfills.map;
2270
- var ember$data$lib$serializers$json_serializer$$merge = Ember.merge;
2334
+ var ember$data$lib$serializers$json$serializer$$get = Ember.get;
2335
+ var ember$data$lib$serializers$json$serializer$$isNone = Ember.isNone;
2336
+ var ember$data$lib$serializers$json$serializer$$map = Ember.ArrayPolyfills.map;
2337
+ var ember$data$lib$serializers$json$serializer$$merge = Ember.merge;
2271
2338
 
2272
- var ember$data$lib$serializers$json_serializer$$default = ember$data$lib$system$serializer$$default.extend({
2339
+ var ember$data$lib$serializers$json$serializer$$default = ember$data$lib$system$serializer$$default.extend({
2273
2340
  /**
2274
2341
  The primaryKey is used when serializing and deserializing
2275
2342
  data. Ember Data always uses the `id` property to store the id of
@@ -2483,7 +2550,7 @@
2483
2550
  @private
2484
2551
  */
2485
2552
  normalizeUsingDeclaredMapping: function(type, hash) {
2486
- var attrs = ember$data$lib$serializers$json_serializer$$get(this, 'attrs');
2553
+ var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
2487
2554
  var payloadKey, key;
2488
2555
 
2489
2556
  if (attrs) {
@@ -2504,7 +2571,7 @@
2504
2571
  @private
2505
2572
  */
2506
2573
  normalizeId: function(hash) {
2507
- var primaryKey = ember$data$lib$serializers$json_serializer$$get(this, 'primaryKey');
2574
+ var primaryKey = ember$data$lib$serializers$json$serializer$$get(this, 'primaryKey');
2508
2575
 
2509
2576
  if (primaryKey === 'id') { return; }
2510
2577
 
@@ -2532,7 +2599,7 @@
2532
2599
  @return {String} key
2533
2600
  */
2534
2601
  _getMappedKey: function(key) {
2535
- var attrs = ember$data$lib$serializers$json_serializer$$get(this, 'attrs');
2602
+ var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
2536
2603
  var mappedKey;
2537
2604
  if (attrs && attrs[key]) {
2538
2605
  mappedKey = attrs[key];
@@ -2559,7 +2626,7 @@
2559
2626
  @return {boolean} true if the key can be serialized
2560
2627
  */
2561
2628
  _canSerialize: function(key) {
2562
- var attrs = ember$data$lib$serializers$json_serializer$$get(this, 'attrs');
2629
+ var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
2563
2630
 
2564
2631
  return !attrs || !attrs[key] || attrs[key].serialize !== false;
2565
2632
  },
@@ -2715,7 +2782,7 @@
2715
2782
  var id = snapshot.id;
2716
2783
 
2717
2784
  if (id) {
2718
- json[ember$data$lib$serializers$json_serializer$$get(this, 'primaryKey')] = id;
2785
+ json[ember$data$lib$serializers$json$serializer$$get(this, 'primaryKey')] = id;
2719
2786
  }
2720
2787
  }
2721
2788
 
@@ -2759,7 +2826,7 @@
2759
2826
  @param {Object} options
2760
2827
  */
2761
2828
  serializeIntoHash: function(hash, type, snapshot, options) {
2762
- ember$data$lib$serializers$json_serializer$$merge(hash, this.serialize(snapshot, options));
2829
+ ember$data$lib$serializers$json$serializer$$merge(hash, this.serialize(snapshot, options));
2763
2830
  },
2764
2831
 
2765
2832
  /**
@@ -2846,7 +2913,7 @@
2846
2913
  }
2847
2914
 
2848
2915
  //Need to check whether the id is there for new&async records
2849
- if (ember$data$lib$serializers$json_serializer$$isNone(belongsToId)) {
2916
+ if (ember$data$lib$serializers$json$serializer$$isNone(belongsToId)) {
2850
2917
  json[payloadKey] = null;
2851
2918
  } else {
2852
2919
  json[payloadKey] = belongsToId;
@@ -2948,7 +3015,7 @@
2948
3015
  the `requestType`.
2949
3016
 
2950
3017
  To override this method with a custom one, make sure to call
2951
- `this._super(store, type, payload, id, requestType)` with your
3018
+ `return this._super(store, type, payload, id, requestType)` with your
2952
3019
  pre-processed data.
2953
3020
 
2954
3021
  Here's an example of using `extract` manually:
@@ -3200,7 +3267,7 @@
3200
3267
  var normalizedPayload = this.normalizePayload(arrayPayload);
3201
3268
  var serializer = this;
3202
3269
 
3203
- return ember$data$lib$serializers$json_serializer$$map.call(normalizedPayload, function(singlePayload) {
3270
+ return ember$data$lib$serializers$json$serializer$$map.call(normalizedPayload, function(singlePayload) {
3204
3271
  return serializer.normalize(type, singlePayload);
3205
3272
  });
3206
3273
  },
@@ -3333,11 +3400,11 @@
3333
3400
  }
3334
3401
  });
3335
3402
 
3336
- var ember$data$lib$serializers$rest_serializer$$forEach = Ember.ArrayPolyfills.forEach;
3337
- var ember$data$lib$serializers$rest_serializer$$map = Ember.ArrayPolyfills.map;
3338
- var ember$data$lib$serializers$rest_serializer$$camelize = Ember.String.camelize;
3403
+ var ember$data$lib$serializers$rest$serializer$$forEach = Ember.ArrayPolyfills.forEach;
3404
+ var ember$data$lib$serializers$rest$serializer$$map = Ember.ArrayPolyfills.map;
3405
+ var ember$data$lib$serializers$rest$serializer$$camelize = Ember.String.camelize;
3339
3406
 
3340
- function ember$data$lib$serializers$rest_serializer$$coerceId(id) {
3407
+ function ember$data$lib$serializers$rest$serializer$$coerceId(id) {
3341
3408
  return id == null ? null : id + '';
3342
3409
  }
3343
3410
 
@@ -3381,7 +3448,7 @@
3381
3448
  @namespace DS
3382
3449
  @extends DS.JSONSerializer
3383
3450
  */
3384
- var ember$data$lib$serializers$rest_serializer$$RESTSerializer = ember$data$lib$serializers$json_serializer$$default.extend({
3451
+ var ember$data$lib$serializers$rest$serializer$$RESTSerializer = ember$data$lib$serializers$json$serializer$$default.extend({
3385
3452
  /**
3386
3453
  If you want to do normalizations specific to some part of the payload, you
3387
3454
  can specify those under `normalizeHash`.
@@ -3614,7 +3681,7 @@
3614
3681
  }
3615
3682
 
3616
3683
  /*jshint loopfunc:true*/
3617
- ember$data$lib$serializers$rest_serializer$$forEach.call(value, function(hash) {
3684
+ ember$data$lib$serializers$rest$serializer$$forEach.call(value, function(hash) {
3618
3685
  var typeName = this.typeForRoot(prop);
3619
3686
  var type = store.modelFor(typeName);
3620
3687
  var typeSerializer = store.serializerFor(type);
@@ -3622,7 +3689,7 @@
3622
3689
  hash = typeSerializer.normalize(type, hash, prop);
3623
3690
 
3624
3691
  var isFirstCreatedRecord = isPrimary && !recordId && !primaryRecord;
3625
- var isUpdatedRecord = isPrimary && ember$data$lib$serializers$rest_serializer$$coerceId(hash.id) === recordId;
3692
+ var isUpdatedRecord = isPrimary && ember$data$lib$serializers$rest$serializer$$coerceId(hash.id) === recordId;
3626
3693
 
3627
3694
  // find the primary record.
3628
3695
  //
@@ -3765,7 +3832,7 @@
3765
3832
  var isPrimary = (!forcedSecondary && (type.typeKey === primaryTypeName));
3766
3833
 
3767
3834
  /*jshint loopfunc:true*/
3768
- var normalizedArray = ember$data$lib$serializers$rest_serializer$$map.call(payload[prop], function(hash) {
3835
+ var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(payload[prop], function(hash) {
3769
3836
  return typeSerializer.normalize(type, hash, prop);
3770
3837
  }, this);
3771
3838
 
@@ -3823,7 +3890,7 @@
3823
3890
  var typeSerializer = store.serializerFor(type);
3824
3891
 
3825
3892
  /*jshint loopfunc:true*/
3826
- var normalizedArray = ember$data$lib$serializers$rest_serializer$$map.call(Ember.makeArray(payload[prop]), function(hash) {
3893
+ var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(Ember.makeArray(payload[prop]), function(hash) {
3827
3894
  return typeSerializer.normalize(type, hash, prop);
3828
3895
  }, this);
3829
3896
 
@@ -3875,7 +3942,7 @@
3875
3942
  @return {String} the model's typeKey
3876
3943
  */
3877
3944
  typeForRoot: function(key) {
3878
- return ember$data$lib$serializers$rest_serializer$$camelize(ember$inflector$lib$system$string$$singularize(key));
3945
+ return ember$data$lib$serializers$rest$serializer$$camelize(ember$inflector$lib$system$string$$singularize(key));
3879
3946
  },
3880
3947
 
3881
3948
  // SERIALIZE
@@ -4076,23 +4143,23 @@
4076
4143
  });
4077
4144
 
4078
4145
  Ember.runInDebug(function() {
4079
- ember$data$lib$serializers$rest_serializer$$RESTSerializer.reopen({
4146
+ ember$data$lib$serializers$rest$serializer$$RESTSerializer.reopen({
4080
4147
  warnMessageNoModelForKey: function(prop, typeKey) {
4081
4148
  return 'Encountered "' + prop + '" in payload, but no model was found for model name "' + typeKey + '" (resolved model name using ' + this.constructor.toString() + '.typeForRoot("' + prop + '"))';
4082
4149
  }
4083
4150
  });
4084
4151
  });
4085
4152
 
4086
- var ember$data$lib$serializers$rest_serializer$$default = ember$data$lib$serializers$rest_serializer$$RESTSerializer;
4153
+ var ember$data$lib$serializers$rest$serializer$$default = ember$data$lib$serializers$rest$serializer$$RESTSerializer;
4087
4154
  /**
4088
4155
  @module ember-data
4089
4156
  */
4090
4157
 
4091
- var activemodel$adapter$lib$system$active_model_serializer$$forEach = Ember.EnumerableUtils.forEach;
4092
- var activemodel$adapter$lib$system$active_model_serializer$$camelize = Ember.String.camelize;
4093
- var activemodel$adapter$lib$system$active_model_serializer$$capitalize = Ember.String.capitalize;
4094
- var activemodel$adapter$lib$system$active_model_serializer$$decamelize = Ember.String.decamelize;
4095
- var activemodel$adapter$lib$system$active_model_serializer$$underscore = Ember.String.underscore;
4158
+ var activemodel$adapter$lib$system$active$model$serializer$$forEach = Ember.EnumerableUtils.forEach;
4159
+ var activemodel$adapter$lib$system$active$model$serializer$$camelize = Ember.String.camelize;
4160
+ var activemodel$adapter$lib$system$active$model$serializer$$capitalize = Ember.String.capitalize;
4161
+ var activemodel$adapter$lib$system$active$model$serializer$$decamelize = Ember.String.decamelize;
4162
+ var activemodel$adapter$lib$system$active$model$serializer$$underscore = Ember.String.underscore;
4096
4163
 
4097
4164
  /**
4098
4165
  The ActiveModelSerializer is a subclass of the RESTSerializer designed to integrate
@@ -4181,7 +4248,7 @@
4181
4248
  @namespace DS
4182
4249
  @extends DS.RESTSerializer
4183
4250
  */
4184
- var activemodel$adapter$lib$system$active_model_serializer$$ActiveModelSerializer = ember$data$lib$serializers$rest_serializer$$default.extend({
4251
+ var activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer = ember$data$lib$serializers$rest$serializer$$default.extend({
4185
4252
  // SERIALIZE
4186
4253
 
4187
4254
  /**
@@ -4192,7 +4259,7 @@
4192
4259
  @return String
4193
4260
  */
4194
4261
  keyForAttribute: function(attr) {
4195
- return activemodel$adapter$lib$system$active_model_serializer$$decamelize(attr);
4262
+ return activemodel$adapter$lib$system$active$model$serializer$$decamelize(attr);
4196
4263
  },
4197
4264
 
4198
4265
  /**
@@ -4205,7 +4272,7 @@
4205
4272
  @return String
4206
4273
  */
4207
4274
  keyForRelationship: function(rawKey, kind) {
4208
- var key = activemodel$adapter$lib$system$active_model_serializer$$decamelize(rawKey);
4275
+ var key = activemodel$adapter$lib$system$active$model$serializer$$decamelize(rawKey);
4209
4276
  if (kind === "belongsTo") {
4210
4277
  return key + "_id";
4211
4278
  } else if (kind === "hasMany") {
@@ -4230,7 +4297,7 @@
4230
4297
  @param {Object} options
4231
4298
  */
4232
4299
  serializeIntoHash: function(data, type, snapshot, options) {
4233
- var root = activemodel$adapter$lib$system$active_model_serializer$$underscore(activemodel$adapter$lib$system$active_model_serializer$$decamelize(type.typeKey));
4300
+ var root = activemodel$adapter$lib$system$active$model$serializer$$underscore(activemodel$adapter$lib$system$active$model$serializer$$decamelize(type.typeKey));
4234
4301
  data[root] = this.serialize(snapshot, options);
4235
4302
  },
4236
4303
 
@@ -4245,12 +4312,12 @@
4245
4312
  serializePolymorphicType: function(snapshot, json, relationship) {
4246
4313
  var key = relationship.key;
4247
4314
  var belongsTo = snapshot.belongsTo(key);
4248
- var jsonKey = activemodel$adapter$lib$system$active_model_serializer$$underscore(key + "_type");
4315
+ var jsonKey = activemodel$adapter$lib$system$active$model$serializer$$underscore(key + "_type");
4249
4316
 
4250
4317
  if (Ember.isNone(belongsTo)) {
4251
4318
  json[jsonKey] = null;
4252
4319
  } else {
4253
- json[jsonKey] = activemodel$adapter$lib$system$active_model_serializer$$capitalize(activemodel$adapter$lib$system$active_model_serializer$$camelize(belongsTo.typeKey));
4320
+ json[jsonKey] = activemodel$adapter$lib$system$active$model$serializer$$capitalize(activemodel$adapter$lib$system$active$model$serializer$$camelize(belongsTo.typeKey));
4254
4321
  }
4255
4322
  },
4256
4323
 
@@ -4308,7 +4375,7 @@
4308
4375
  var links = data.links;
4309
4376
 
4310
4377
  for (var link in links) {
4311
- var camelizedLink = activemodel$adapter$lib$system$active_model_serializer$$camelize(link);
4378
+ var camelizedLink = activemodel$adapter$lib$system$active$model$serializer$$camelize(link);
4312
4379
 
4313
4380
  if (camelizedLink !== link) {
4314
4381
  links[camelizedLink] = links[link];
@@ -4352,7 +4419,7 @@
4352
4419
  payload.type = this.typeForRoot(payload.type);
4353
4420
  } else if (payload && relationship.kind === "hasMany") {
4354
4421
  var self = this;
4355
- activemodel$adapter$lib$system$active_model_serializer$$forEach(payload, function(single) {
4422
+ activemodel$adapter$lib$system$active$model$serializer$$forEach(payload, function(single) {
4356
4423
  single.type = self.typeForRoot(single.type);
4357
4424
  });
4358
4425
  }
@@ -4372,20 +4439,12 @@
4372
4439
  }
4373
4440
  });
4374
4441
 
4375
- var activemodel$adapter$lib$system$active_model_serializer$$default = activemodel$adapter$lib$system$active_model_serializer$$ActiveModelSerializer;
4376
- /**
4377
- This is used internally to enable deprecation of container paths and provide
4378
- a decent message to the user indicating how to fix the issue.
4379
-
4380
- @class ContainerProxy
4381
- @namespace DS
4382
- @private
4383
- */
4384
- function ember$data$lib$system$container_proxy$$ContainerProxy(container) {
4442
+ var activemodel$adapter$lib$system$active$model$serializer$$default = activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer;
4443
+ function ember$data$lib$system$container$proxy$$ContainerProxy(container) {
4385
4444
  this.container = container;
4386
4445
  }
4387
4446
 
4388
- ember$data$lib$system$container_proxy$$ContainerProxy.prototype.aliasedFactory = function(path, preLookup) {
4447
+ ember$data$lib$system$container$proxy$$ContainerProxy.prototype.aliasedFactory = function(path, preLookup) {
4389
4448
  var _this = this;
4390
4449
 
4391
4450
  return {
@@ -4397,13 +4456,13 @@
4397
4456
  };
4398
4457
  };
4399
4458
 
4400
- ember$data$lib$system$container_proxy$$ContainerProxy.prototype.registerAlias = function(source, dest, preLookup) {
4459
+ ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerAlias = function(source, dest, preLookup) {
4401
4460
  var factory = this.aliasedFactory(dest, preLookup);
4402
4461
 
4403
4462
  return this.container.register(source, factory);
4404
4463
  };
4405
4464
 
4406
- ember$data$lib$system$container_proxy$$ContainerProxy.prototype.registerDeprecation = function(deprecated, valid) {
4465
+ ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecation = function(deprecated, valid) {
4407
4466
  var preLookupCallback = function() {
4408
4467
  Ember.deprecate("You tried to look up '" + deprecated + "', " +
4409
4468
  "but this has been deprecated in favor of '" + valid + "'.", false);
@@ -4412,7 +4471,7 @@
4412
4471
  return this.registerAlias(deprecated, valid, preLookupCallback);
4413
4472
  };
4414
4473
 
4415
- ember$data$lib$system$container_proxy$$ContainerProxy.prototype.registerDeprecations = function(proxyPairs) {
4474
+ ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecations = function(proxyPairs) {
4416
4475
  var i, proxyPair, deprecated, valid;
4417
4476
 
4418
4477
  for (i = proxyPairs.length; i > 0; i--) {
@@ -4424,38 +4483,20 @@
4424
4483
  }
4425
4484
  };
4426
4485
 
4427
- var ember$data$lib$system$container_proxy$$default = ember$data$lib$system$container_proxy$$ContainerProxy;
4428
- function activemodel$adapter$lib$setup$container$$setupActiveModelAdapter(container, application) {
4429
- var proxy = new ember$data$lib$system$container_proxy$$default(container);
4486
+ var ember$data$lib$system$container$proxy$$default = ember$data$lib$system$container$proxy$$ContainerProxy;
4487
+ function activemodel$adapter$lib$setup$container$$setupActiveModelAdapter(registry, application) {
4488
+ var proxy = new ember$data$lib$system$container$proxy$$default(registry);
4430
4489
  proxy.registerDeprecations([
4431
4490
  { deprecated: 'serializer:_ams', valid: 'serializer:-active-model' },
4432
4491
  { deprecated: 'adapter:_ams', valid: 'adapter:-active-model' }
4433
4492
  ]);
4434
4493
 
4435
- container.register('serializer:-active-model', activemodel$adapter$lib$system$active_model_serializer$$default);
4436
- container.register('adapter:-active-model', activemodel$adapter$lib$system$active_model_adapter$$default);
4494
+ registry.register('serializer:-active-model', activemodel$adapter$lib$system$active$model$serializer$$default);
4495
+ registry.register('adapter:-active-model', activemodel$adapter$lib$system$active$model$adapter$$default);
4437
4496
  }
4438
4497
  var activemodel$adapter$lib$setup$container$$default = activemodel$adapter$lib$setup$container$$setupActiveModelAdapter;
4439
- /**
4440
- @module ember-data
4441
- */
4442
-
4443
- /**
4444
- All Ember Data methods and functions are defined inside of this namespace.
4445
-
4446
- @class DS
4447
- @static
4448
- */
4449
-
4450
- /**
4451
- @property VERSION
4452
- @type String
4453
- @default '1.0.0-beta.15'
4454
- @static
4455
- */
4456
- /*jshint -W079 */
4457
4498
  var ember$data$lib$core$$DS = Ember.Namespace.create({
4458
- VERSION: '1.0.0-beta.15'
4499
+ VERSION: '1.0.0-beta.16'
4459
4500
  });
4460
4501
 
4461
4502
  if (Ember.libraries) {
@@ -4463,8 +4504,8 @@
4463
4504
  }
4464
4505
 
4465
4506
  var ember$data$lib$core$$default = ember$data$lib$core$$DS;
4466
- var ember$data$lib$system$promise_proxies$$Promise = Ember.RSVP.Promise;
4467
- var ember$data$lib$system$promise_proxies$$get = Ember.get;
4507
+ var ember$data$lib$system$promise$proxies$$Promise = Ember.RSVP.Promise;
4508
+ var ember$data$lib$system$promise$proxies$$get = Ember.get;
4468
4509
 
4469
4510
  /**
4470
4511
  A `PromiseArray` is an object that acts like both an `Ember.Array`
@@ -4495,7 +4536,7 @@
4495
4536
  @extends Ember.ArrayProxy
4496
4537
  @uses Ember.PromiseProxyMixin
4497
4538
  */
4498
- var ember$data$lib$system$promise_proxies$$PromiseArray = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);
4539
+ var ember$data$lib$system$promise$proxies$$PromiseArray = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);
4499
4540
 
4500
4541
  /**
4501
4542
  A `PromiseObject` is an object that acts like both an `Ember.Object`
@@ -4526,17 +4567,17 @@
4526
4567
  @extends Ember.ObjectProxy
4527
4568
  @uses Ember.PromiseProxyMixin
4528
4569
  */
4529
- var ember$data$lib$system$promise_proxies$$PromiseObject = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
4570
+ var ember$data$lib$system$promise$proxies$$PromiseObject = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
4530
4571
 
4531
- var ember$data$lib$system$promise_proxies$$promiseObject = function(promise, label) {
4532
- return ember$data$lib$system$promise_proxies$$PromiseObject.create({
4533
- promise: ember$data$lib$system$promise_proxies$$Promise.resolve(promise, label)
4572
+ var ember$data$lib$system$promise$proxies$$promiseObject = function(promise, label) {
4573
+ return ember$data$lib$system$promise$proxies$$PromiseObject.create({
4574
+ promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
4534
4575
  });
4535
4576
  };
4536
4577
 
4537
- var ember$data$lib$system$promise_proxies$$promiseArray = function(promise, label) {
4538
- return ember$data$lib$system$promise_proxies$$PromiseArray.create({
4539
- promise: ember$data$lib$system$promise_proxies$$Promise.resolve(promise, label)
4578
+ var ember$data$lib$system$promise$proxies$$promiseArray = function(promise, label) {
4579
+ return ember$data$lib$system$promise$proxies$$PromiseArray.create({
4580
+ promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
4540
4581
  });
4541
4582
  };
4542
4583
 
@@ -4558,46 +4599,231 @@
4558
4599
  @extends Ember.ArrayProxy
4559
4600
  */
4560
4601
 
4561
- function ember$data$lib$system$promise_proxies$$proxyToContent(method) {
4602
+ function ember$data$lib$system$promise$proxies$$proxyToContent(method) {
4562
4603
  return function() {
4563
- var content = ember$data$lib$system$promise_proxies$$get(this, 'content');
4604
+ var content = ember$data$lib$system$promise$proxies$$get(this, 'content');
4564
4605
  return content[method].apply(content, arguments);
4565
4606
  };
4566
4607
  }
4567
4608
 
4568
- var ember$data$lib$system$promise_proxies$$PromiseManyArray = ember$data$lib$system$promise_proxies$$PromiseArray.extend({
4609
+ var ember$data$lib$system$promise$proxies$$PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseArray.extend({
4569
4610
  reload: function() {
4570
4611
  //I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
4571
- Ember.assert('You are trying to reload an async manyArray before it has been created', ember$data$lib$system$promise_proxies$$get(this, 'content'));
4572
- return ember$data$lib$system$promise_proxies$$PromiseManyArray.create({
4573
- promise: ember$data$lib$system$promise_proxies$$get(this, 'content').reload()
4612
+ Ember.assert('You are trying to reload an async manyArray before it has been created', ember$data$lib$system$promise$proxies$$get(this, 'content'));
4613
+ return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
4614
+ promise: ember$data$lib$system$promise$proxies$$get(this, 'content').reload()
4574
4615
  });
4575
4616
  },
4576
4617
 
4577
- createRecord: ember$data$lib$system$promise_proxies$$proxyToContent('createRecord'),
4618
+ createRecord: ember$data$lib$system$promise$proxies$$proxyToContent('createRecord'),
4578
4619
 
4579
- on: ember$data$lib$system$promise_proxies$$proxyToContent('on'),
4620
+ on: ember$data$lib$system$promise$proxies$$proxyToContent('on'),
4580
4621
 
4581
- one: ember$data$lib$system$promise_proxies$$proxyToContent('one'),
4622
+ one: ember$data$lib$system$promise$proxies$$proxyToContent('one'),
4582
4623
 
4583
- trigger: ember$data$lib$system$promise_proxies$$proxyToContent('trigger'),
4624
+ trigger: ember$data$lib$system$promise$proxies$$proxyToContent('trigger'),
4584
4625
 
4585
- off: ember$data$lib$system$promise_proxies$$proxyToContent('off'),
4626
+ off: ember$data$lib$system$promise$proxies$$proxyToContent('off'),
4586
4627
 
4587
- has: ember$data$lib$system$promise_proxies$$proxyToContent('has')
4628
+ has: ember$data$lib$system$promise$proxies$$proxyToContent('has')
4588
4629
  });
4589
4630
 
4590
- var ember$data$lib$system$promise_proxies$$promiseManyArray = function(promise, label) {
4591
- return ember$data$lib$system$promise_proxies$$PromiseManyArray.create({
4592
- promise: ember$data$lib$system$promise_proxies$$Promise.resolve(promise, label)
4631
+ var ember$data$lib$system$promise$proxies$$promiseManyArray = function(promise, label) {
4632
+ return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
4633
+ promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
4593
4634
  });
4594
4635
  };
4595
4636
 
4596
4637
 
4597
- var ember$data$lib$system$record_arrays$record_array$$get = Ember.get;
4598
- var ember$data$lib$system$record_arrays$record_array$$set = Ember.set;
4638
+ var ember$data$lib$system$store$common$$get = Ember.get;
4639
+
4640
+ function ember$data$lib$system$store$common$$_bind(fn) {
4641
+ var args = Array.prototype.slice.call(arguments, 1);
4642
+
4643
+ return function() {
4644
+ return fn.apply(undefined, args);
4645
+ };
4646
+ }
4647
+
4648
+ function ember$data$lib$system$store$common$$_guard(promise, test) {
4649
+ var guarded = promise['finally'](function() {
4650
+ if (!test()) {
4651
+ guarded._subscribers.length = 0;
4652
+ }
4653
+ });
4654
+
4655
+ return guarded;
4656
+ }
4657
+
4658
+ function ember$data$lib$system$store$common$$_objectIsAlive(object) {
4659
+ return !(ember$data$lib$system$store$common$$get(object, "isDestroyed") || ember$data$lib$system$store$common$$get(object, "isDestroying"));
4660
+ }
4661
+ function ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type) {
4662
+ var serializer = adapter.serializer;
4663
+
4664
+ if (serializer === undefined) {
4665
+ serializer = store.serializerFor(type);
4666
+ }
4667
+
4668
+ if (serializer === null || serializer === undefined) {
4669
+ serializer = {
4670
+ extract: function(store, type, payload) { return payload; }
4671
+ };
4672
+ }
4673
+
4674
+ return serializer;
4675
+ }
4676
+
4677
+
4678
+ var ember$data$lib$system$store$finders$$get = Ember.get;
4679
+ var ember$data$lib$system$store$finders$$Promise = Ember.RSVP.Promise;
4680
+
4681
+ function ember$data$lib$system$store$finders$$_find(adapter, store, type, id, record) {
4682
+ var snapshot = record._createSnapshot();
4683
+ var promise = adapter.find(store, type, id, snapshot);
4684
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type);
4685
+ var label = "DS: Handle Adapter#find of " + type + " with id: " + id;
4686
+
4687
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4688
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4689
+
4690
+ return promise.then(function(adapterPayload) {
4691
+ Ember.assert("You made a request for a " + type.typeKey + " with id " + id + ", but the adapter's response did not have any data", adapterPayload);
4692
+ return store._adapterRun(function() {
4693
+ var payload = serializer.extract(store, type, adapterPayload, id, 'find');
4694
+
4695
+ return store.push(type, payload);
4696
+ });
4697
+ }, function(error) {
4698
+ var record = store.getById(type, id);
4699
+ if (record) {
4700
+ record.notFound();
4701
+ if (ember$data$lib$system$store$finders$$get(record, 'isEmpty')) {
4702
+ store.unloadRecord(record);
4703
+ }
4704
+ }
4705
+ throw error;
4706
+ }, "DS: Extract payload of '" + type + "'");
4707
+ }
4708
+
4709
+
4710
+ function ember$data$lib$system$store$finders$$_findMany(adapter, store, type, ids, records) {
4711
+ var snapshots = Ember.A(records).invoke('_createSnapshot');
4712
+ var promise = adapter.findMany(store, type, ids, snapshots);
4713
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type);
4714
+ var label = "DS: Handle Adapter#findMany of " + type;
4715
+
4716
+ if (promise === undefined) {
4717
+ throw new Error('adapter.findMany returned undefined, this was very likely a mistake');
4718
+ }
4719
+
4720
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4721
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4722
+
4723
+ return promise.then(function(adapterPayload) {
4724
+ return store._adapterRun(function() {
4725
+ var payload = serializer.extract(store, type, adapterPayload, null, 'findMany');
4726
+
4727
+ Ember.assert("The response from a findMany must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
4728
+
4729
+ return store.pushMany(type, payload);
4730
+ });
4731
+ }, null, "DS: Extract payload of " + type);
4732
+ }
4733
+
4734
+ function ember$data$lib$system$store$finders$$_findHasMany(adapter, store, record, link, relationship) {
4735
+ var snapshot = record._createSnapshot();
4736
+ var promise = adapter.findHasMany(store, snapshot, link, relationship);
4737
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
4738
+ var label = "DS: Handle Adapter#findHasMany of " + record + " : " + relationship.type;
4739
+
4740
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4741
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4742
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, record));
4743
+
4744
+ return promise.then(function(adapterPayload) {
4745
+ return store._adapterRun(function() {
4746
+ var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findHasMany');
4747
+
4748
+ Ember.assert("The response from a findHasMany must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
4749
+
4750
+ var records = store.pushMany(relationship.type, payload);
4751
+ return records;
4752
+ });
4753
+ }, null, "DS: Extract payload of " + record + " : hasMany " + relationship.type);
4754
+ }
4755
+
4756
+ function ember$data$lib$system$store$finders$$_findBelongsTo(adapter, store, record, link, relationship) {
4757
+ var snapshot = record._createSnapshot();
4758
+ var promise = adapter.findBelongsTo(store, snapshot, link, relationship);
4759
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
4760
+ var label = "DS: Handle Adapter#findBelongsTo of " + record + " : " + relationship.type;
4761
+
4762
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4763
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4764
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, record));
4765
+
4766
+ return promise.then(function(adapterPayload) {
4767
+ return store._adapterRun(function() {
4768
+ var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findBelongsTo');
4769
+
4770
+ if (!payload) {
4771
+ return null;
4772
+ }
4773
+
4774
+ var record = store.push(relationship.type, payload);
4775
+ return record;
4776
+ });
4777
+ }, null, "DS: Extract payload of " + record + " : " + relationship.type);
4778
+ }
4779
+
4780
+ function ember$data$lib$system$store$finders$$_findAll(adapter, store, type, sinceToken) {
4781
+ var promise = adapter.findAll(store, type, sinceToken);
4782
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type);
4783
+ var label = "DS: Handle Adapter#findAll of " + type;
4784
+
4785
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4786
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4787
+
4788
+ return promise.then(function(adapterPayload) {
4789
+ store._adapterRun(function() {
4790
+ var payload = serializer.extract(store, type, adapterPayload, null, 'findAll');
4791
+
4792
+ Ember.assert("The response from a findAll must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
4793
+
4794
+ store.pushMany(type, payload);
4795
+ });
4796
+
4797
+ store.didUpdateAll(type);
4798
+ return store.all(type);
4799
+ }, null, "DS: Extract payload of findAll " + type);
4800
+ }
4801
+
4802
+ function ember$data$lib$system$store$finders$$_findQuery(adapter, store, type, query, recordArray) {
4803
+ var promise = adapter.findQuery(store, type, query, recordArray);
4804
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type);
4805
+ var label = "DS: Handle Adapter#findQuery of " + type;
4806
+
4807
+ promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
4808
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
4809
+
4810
+ return promise.then(function(adapterPayload) {
4811
+ var payload;
4812
+ store._adapterRun(function() {
4813
+ payload = serializer.extract(store, type, adapterPayload, null, 'findQuery');
4814
+
4815
+ Ember.assert("The response from a findQuery must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
4816
+ });
4599
4817
 
4600
- var ember$data$lib$system$record_arrays$record_array$$default = Ember.ArrayProxy.extend(Ember.Evented, {
4818
+ recordArray.load(payload);
4819
+ return recordArray;
4820
+
4821
+ }, null, "DS: Extract payload of findQuery " + type);
4822
+ }
4823
+ var ember$data$lib$system$record$arrays$record$array$$get = Ember.get;
4824
+ var ember$data$lib$system$record$arrays$record$array$$set = Ember.set;
4825
+
4826
+ var ember$data$lib$system$record$arrays$record$array$$default = Ember.ArrayProxy.extend(Ember.Evented, {
4601
4827
  /**
4602
4828
  The model type contained by this record array.
4603
4829
 
@@ -4667,7 +4893,7 @@
4667
4893
  @return {DS.Model} record
4668
4894
  */
4669
4895
  objectAtContent: function(index) {
4670
- var content = ember$data$lib$system$record_arrays$record_array$$get(this, 'content');
4896
+ var content = ember$data$lib$system$record$arrays$record$array$$get(this, 'content');
4671
4897
 
4672
4898
  return content.objectAt(index);
4673
4899
  },
@@ -4688,10 +4914,10 @@
4688
4914
  @method update
4689
4915
  */
4690
4916
  update: function() {
4691
- if (ember$data$lib$system$record_arrays$record_array$$get(this, 'isUpdating')) { return; }
4917
+ if (ember$data$lib$system$record$arrays$record$array$$get(this, 'isUpdating')) { return; }
4692
4918
 
4693
- var store = ember$data$lib$system$record_arrays$record_array$$get(this, 'store');
4694
- var type = ember$data$lib$system$record_arrays$record_array$$get(this, 'type');
4919
+ var store = ember$data$lib$system$record$arrays$record$array$$get(this, 'store');
4920
+ var type = ember$data$lib$system$record$arrays$record$array$$get(this, 'type');
4695
4921
 
4696
4922
  return store.fetchAll(type, this);
4697
4923
  },
@@ -4705,7 +4931,7 @@
4705
4931
  @param {DS.Model} an optional index to insert at
4706
4932
  */
4707
4933
  addRecord: function(record, idx) {
4708
- var content = ember$data$lib$system$record_arrays$record_array$$get(this, 'content');
4934
+ var content = ember$data$lib$system$record$arrays$record$array$$get(this, 'content');
4709
4935
  if (idx === undefined) {
4710
4936
  content.addObject(record);
4711
4937
  } else if (!content.contains(record)) {
@@ -4714,7 +4940,7 @@
4714
4940
  },
4715
4941
 
4716
4942
  _pushRecord: function(record) {
4717
- ember$data$lib$system$record_arrays$record_array$$get(this, 'content').pushObject(record);
4943
+ ember$data$lib$system$record$arrays$record$array$$get(this, 'content').pushObject(record);
4718
4944
  },
4719
4945
 
4720
4946
  /**
@@ -4737,7 +4963,7 @@
4737
4963
  @param {DS.Model} record
4738
4964
  */
4739
4965
  removeRecord: function(record) {
4740
- ember$data$lib$system$record_arrays$record_array$$get(this, 'content').removeObject(record);
4966
+ ember$data$lib$system$record$arrays$record$array$$get(this, 'content').removeObject(record);
4741
4967
  },
4742
4968
 
4743
4969
  /**
@@ -4758,12 +4984,12 @@
4758
4984
  */
4759
4985
  save: function() {
4760
4986
  var recordArray = this;
4761
- var promiseLabel = "DS: RecordArray#save " + ember$data$lib$system$record_arrays$record_array$$get(this, 'type');
4987
+ var promiseLabel = "DS: RecordArray#save " + ember$data$lib$system$record$arrays$record$array$$get(this, 'type');
4762
4988
  var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function(array) {
4763
4989
  return recordArray;
4764
4990
  }, null, "DS: RecordArray#save return RecordArray");
4765
4991
 
4766
- return ember$data$lib$system$promise_proxies$$PromiseArray.create({ promise: promise });
4992
+ return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
4767
4993
  },
4768
4994
 
4769
4995
  _dissociateFromOwnRecords: function() {
@@ -4783,7 +5009,7 @@
4783
5009
  @private
4784
5010
  */
4785
5011
  _unregisterFromManager: function() {
4786
- var manager = ember$data$lib$system$record_arrays$record_array$$get(this, 'manager');
5012
+ var manager = ember$data$lib$system$record$arrays$record$array$$get(this, 'manager');
4787
5013
  //We will stop needing this stupid if statement soon, once manyArray are refactored to not be RecordArrays
4788
5014
  if (manager) {
4789
5015
  manager.unregisterFilteredRecordArray(this);
@@ -4793,7 +5019,7 @@
4793
5019
  willDestroy: function() {
4794
5020
  this._unregisterFromManager();
4795
5021
  this._dissociateFromOwnRecords();
4796
- ember$data$lib$system$record_arrays$record_array$$set(this, 'content', undefined);
5022
+ ember$data$lib$system$record$arrays$record$array$$set(this, 'content', undefined);
4797
5023
  this._super.apply(this, arguments);
4798
5024
  }
4799
5025
  });
@@ -4802,9 +5028,9 @@
4802
5028
  @module ember-data
4803
5029
  */
4804
5030
 
4805
- var ember$data$lib$system$record_arrays$filtered_record_array$$get = Ember.get;
5031
+ var ember$data$lib$system$record$arrays$filtered$record$array$$get = Ember.get;
4806
5032
 
4807
- var ember$data$lib$system$record_arrays$filtered_record_array$$default = ember$data$lib$system$record_arrays$record_array$$default.extend({
5033
+ var ember$data$lib$system$record$arrays$filtered$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
4808
5034
  /**
4809
5035
  The filterFunction is a function used to test records from the store to
4810
5036
  determine if they should be part of the record array.
@@ -4835,7 +5061,7 @@
4835
5061
  isLoaded: true,
4836
5062
 
4837
5063
  replace: function() {
4838
- var type = ember$data$lib$system$record_arrays$filtered_record_array$$get(this, 'type').toString();
5064
+ var type = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'type').toString();
4839
5065
  throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
4840
5066
  },
4841
5067
 
@@ -4844,8 +5070,8 @@
4844
5070
  @private
4845
5071
  */
4846
5072
  _updateFilter: function() {
4847
- var manager = ember$data$lib$system$record_arrays$filtered_record_array$$get(this, 'manager');
4848
- manager.updateFilter(this, ember$data$lib$system$record_arrays$filtered_record_array$$get(this, 'type'), ember$data$lib$system$record_arrays$filtered_record_array$$get(this, 'filterFunction'));
5073
+ var manager = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'manager');
5074
+ manager.updateFilter(this, ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'type'), ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'filterFunction'));
4849
5075
  },
4850
5076
 
4851
5077
  updateFilter: Ember.observer(function() {
@@ -4857,9 +5083,9 @@
4857
5083
  @module ember-data
4858
5084
  */
4859
5085
 
4860
- var ember$data$lib$system$record_arrays$adapter_populated_record_array$$get = Ember.get;
5086
+ var ember$data$lib$system$record$arrays$adapter$populated$record$array$$get = Ember.get;
4861
5087
 
4862
- function ember$data$lib$system$record_arrays$adapter_populated_record_array$$cloneNull(source) {
5088
+ function ember$data$lib$system$record$arrays$adapter$populated$record$array$$cloneNull(source) {
4863
5089
  var clone = Ember.create(null);
4864
5090
  for (var key in source) {
4865
5091
  clone[key] = source[key];
@@ -4867,11 +5093,11 @@
4867
5093
  return clone;
4868
5094
  }
4869
5095
 
4870
- var ember$data$lib$system$record_arrays$adapter_populated_record_array$$default = ember$data$lib$system$record_arrays$record_array$$default.extend({
5096
+ var ember$data$lib$system$record$arrays$adapter$populated$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
4871
5097
  query: null,
4872
5098
 
4873
5099
  replace: function() {
4874
- var type = ember$data$lib$system$record_arrays$adapter_populated_record_array$$get(this, 'type').toString();
5100
+ var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'type').toString();
4875
5101
  throw new Error("The result of a server query (on " + type + ") is immutable.");
4876
5102
  },
4877
5103
 
@@ -4881,15 +5107,15 @@
4881
5107
  @param {Array} data
4882
5108
  */
4883
5109
  load: function(data) {
4884
- var store = ember$data$lib$system$record_arrays$adapter_populated_record_array$$get(this, 'store');
4885
- var type = ember$data$lib$system$record_arrays$adapter_populated_record_array$$get(this, 'type');
5110
+ var store = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'store');
5111
+ var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'type');
4886
5112
  var records = store.pushMany(type, data);
4887
5113
  var meta = store.metadataFor(type);
4888
5114
 
4889
5115
  this.setProperties({
4890
5116
  content: Ember.A(records),
4891
5117
  isLoaded: true,
4892
- meta: ember$data$lib$system$record_arrays$adapter_populated_record_array$$cloneNull(meta)
5118
+ meta: ember$data$lib$system$record$arrays$adapter$populated$record$array$$cloneNull(meta)
4893
5119
  });
4894
5120
 
4895
5121
  records.forEach(function(record) {
@@ -4901,226 +5127,50 @@
4901
5127
  }
4902
5128
  });
4903
5129
 
4904
- var ember$data$lib$system$record_arrays$many_array$$get = Ember.get;
4905
- var ember$data$lib$system$record_arrays$many_array$$set = Ember.set;
4906
-
4907
- var ember$data$lib$system$record_arrays$many_array$$default = Ember.Object.extend(Ember.MutableArray, Ember.Evented, {
4908
- init: function() {
4909
- this.currentState = Ember.A([]);
4910
- },
4911
-
4912
- record: null,
4913
-
4914
- canonicalState: null,
4915
- currentState: null,
4916
-
4917
- length: 0,
4918
-
4919
- objectAt: function(index) {
4920
- if (this.currentState[index]) {
4921
- return this.currentState[index];
4922
- } else {
4923
- return this.canonicalState[index];
4924
- }
4925
- },
4926
-
4927
- flushCanonical: function() {
4928
- //TODO make this smarter, currently its plenty stupid
4929
- var toSet = this.canonicalState.slice(0);
4930
- //a hack for not removing new records
4931
- //TODO remove once we have proper diffing
4932
- var newRecords = this.currentState.filter(function(record) {
4933
- return record.get('isNew');
4934
- });
4935
- toSet = toSet.concat(newRecords);
4936
- var oldLength = this.length;
4937
- this.arrayContentWillChange(0, this.length, toSet.length);
4938
- this.set('length', toSet.length);
4939
- this.currentState = toSet;
4940
- this.arrayContentDidChange(0, oldLength, this.length);
4941
- //TODO Figure out to notify only on additions and maybe only if unloaded
4942
- this.relationship.notifyHasManyChanged();
4943
- this.record.updateRecordArrays();
4944
- },
4945
- /**
4946
- `true` if the relationship is polymorphic, `false` otherwise.
5130
+ var ember$data$lib$system$ordered$set$$EmberOrderedSet = Ember.OrderedSet;
5131
+ var ember$data$lib$system$ordered$set$$guidFor = Ember.guidFor;
4947
5132
 
4948
- @property {Boolean} isPolymorphic
4949
- @private
4950
- */
4951
- isPolymorphic: false,
4952
-
4953
- /**
4954
- The loading state of this array
4955
-
4956
- @property {Boolean} isLoaded
4957
- */
4958
- isLoaded: false,
4959
-
4960
- /**
4961
- The relationship which manages this array.
4962
-
4963
- @property {ManyRelationship} relationship
4964
- @private
4965
- */
4966
- relationship: null,
4967
-
4968
- internalReplace: function(idx, amt, objects) {
4969
- if (!objects) {
4970
- objects = [];
4971
- }
4972
- this.arrayContentWillChange(idx, amt, objects.length);
4973
- this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
4974
- this.set('length', this.currentState.length);
4975
- this.arrayContentDidChange(idx, amt, objects.length);
4976
- if (objects) {
4977
- //TODO(Igor) probably needed only for unloaded records
4978
- this.relationship.notifyHasManyChanged();
4979
- }
4980
- this.record.updateRecordArrays();
4981
- },
4982
-
4983
- //TODO(Igor) optimize
4984
- internalRemoveRecords: function(records) {
4985
- var index;
4986
- for (var i=0; i < records.length; i++) {
4987
- index = this.currentState.indexOf(records[i]);
4988
- this.internalReplace(index, 1);
4989
- }
4990
- },
4991
-
4992
- //TODO(Igor) optimize
4993
- internalAddRecords: function(records, idx) {
4994
- if (idx === undefined) {
4995
- idx = this.currentState.length;
4996
- }
4997
- this.internalReplace(idx, 0, records);
4998
- },
4999
-
5000
- replace: function(idx, amt, objects) {
5001
- var records;
5002
- if (amt > 0) {
5003
- records = this.currentState.slice(idx, idx+amt);
5004
- this.get('relationship').removeRecords(records);
5005
- }
5006
- if (objects) {
5007
- this.get('relationship').addRecords(objects, idx);
5008
- }
5009
- },
5010
- /**
5011
- Used for async `hasMany` arrays
5012
- to keep track of when they will resolve.
5013
-
5014
- @property {Ember.RSVP.Promise} promise
5015
- @private
5016
- */
5017
- promise: null,
5018
-
5019
- /**
5020
- @method loadingRecordsCount
5021
- @param {Number} count
5022
- @private
5023
- */
5024
- loadingRecordsCount: function(count) {
5025
- this.loadingRecordsCount = count;
5026
- },
5027
-
5028
- /**
5029
- @method loadedRecord
5030
- @private
5031
- */
5032
- loadedRecord: function() {
5033
- this.loadingRecordsCount--;
5034
- if (this.loadingRecordsCount === 0) {
5035
- ember$data$lib$system$record_arrays$many_array$$set(this, 'isLoaded', true);
5036
- this.trigger('didLoad');
5037
- }
5038
- },
5039
-
5040
- /**
5041
- @method reload
5042
- @public
5043
- */
5044
- reload: function() {
5045
- return this.relationship.reload();
5046
- },
5047
-
5048
- /**
5049
- Saves all of the records in the `ManyArray`.
5050
-
5051
- Example
5052
-
5053
- ```javascript
5054
- store.find('inbox', 1).then(function(inbox) {
5055
- inbox.get('messages').then(function(messages) {
5056
- messages.forEach(function(message) {
5057
- message.set('isRead', true);
5058
- });
5059
- messages.save()
5060
- });
5061
- });
5062
- ```
5063
-
5064
- @method save
5065
- @return {DS.PromiseArray} promise
5066
- */
5067
- save: function() {
5068
- var manyArray = this;
5069
- var promiseLabel = "DS: ManyArray#save " + ember$data$lib$system$record_arrays$many_array$$get(this, 'type');
5070
- var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function(array) {
5071
- return manyArray;
5072
- }, null, "DS: ManyArray#save return ManyArray");
5073
-
5074
- return ember$data$lib$system$promise_proxies$$PromiseArray.create({ promise: promise });
5075
- },
5076
-
5077
- /**
5078
- Create a child record within the owner
5079
-
5080
- @method createRecord
5081
- @private
5082
- @param {Object} hash
5083
- @return {DS.Model} record
5084
- */
5085
- createRecord: function(hash) {
5086
- var store = ember$data$lib$system$record_arrays$many_array$$get(this, 'store');
5087
- var type = ember$data$lib$system$record_arrays$many_array$$get(this, 'type');
5088
- var record;
5133
+ var ember$data$lib$system$ordered$set$$OrderedSet = function() {
5134
+ this._super$constructor();
5135
+ };
5089
5136
 
5090
- Ember.assert("You cannot add '" + type.typeKey + "' records to this polymorphic relationship.", !ember$data$lib$system$record_arrays$many_array$$get(this, 'isPolymorphic'));
5137
+ ember$data$lib$system$ordered$set$$OrderedSet.create = function() {
5138
+ var Constructor = this;
5139
+ return new Constructor();
5140
+ };
5091
5141
 
5092
- record = store.createRecord(type, hash);
5093
- this.pushObject(record);
5142
+ ember$data$lib$system$ordered$set$$OrderedSet.prototype = Ember.create(ember$data$lib$system$ordered$set$$EmberOrderedSet.prototype);
5143
+ ember$data$lib$system$ordered$set$$OrderedSet.prototype.constructor = ember$data$lib$system$ordered$set$$OrderedSet;
5144
+ ember$data$lib$system$ordered$set$$OrderedSet.prototype._super$constructor = ember$data$lib$system$ordered$set$$EmberOrderedSet;
5094
5145
 
5095
- return record;
5096
- },
5146
+ ember$data$lib$system$ordered$set$$OrderedSet.prototype.addWithIndex = function(obj, idx) {
5147
+ var guid = ember$data$lib$system$ordered$set$$guidFor(obj);
5148
+ var presenceSet = this.presenceSet;
5149
+ var list = this.list;
5097
5150
 
5098
- /**
5099
- @method addRecord
5100
- @param {DS.Model} record
5101
- @deprecated Use `addObject()` instead
5102
- */
5103
- addRecord: function(record) {
5104
- Ember.deprecate('Using manyArray.addRecord() has been deprecated. You should use manyArray.addObject() instead.');
5105
- this.addObject(record);
5106
- },
5107
-
5108
- /**
5109
- @method removeRecord
5110
- @param {DS.Model} record
5111
- @deprecated Use `removeObject()` instead
5112
- */
5113
- removeRecord: function(record) {
5114
- Ember.deprecate('Using manyArray.removeRecord() has been deprecated. You should use manyArray.removeObject() instead.');
5115
- this.removeObject(record);
5151
+ if (presenceSet[guid] === true) {
5152
+ return;
5116
5153
  }
5117
- });
5118
5154
 
5119
- var ember$data$lib$system$record_array_manager$$get = Ember.get;
5120
- var ember$data$lib$system$record_array_manager$$forEach = Ember.EnumerableUtils.forEach;
5121
- var ember$data$lib$system$record_array_manager$$indexOf = Ember.EnumerableUtils.indexOf;
5155
+ presenceSet[guid] = true;
5156
+
5157
+ if (idx === undefined || idx == null) {
5158
+ list.push(obj);
5159
+ } else {
5160
+ list.splice(idx, 0, obj);
5161
+ }
5162
+
5163
+ this.size += 1;
5164
+
5165
+ return this;
5166
+ };
5167
+
5168
+ var ember$data$lib$system$ordered$set$$default = ember$data$lib$system$ordered$set$$OrderedSet;
5169
+ var ember$data$lib$system$record$array$manager$$get = Ember.get;
5170
+ var ember$data$lib$system$record$array$manager$$forEach = Ember.EnumerableUtils.forEach;
5171
+ var ember$data$lib$system$record$array$manager$$indexOf = Ember.EnumerableUtils.indexOf;
5122
5172
 
5123
- var ember$data$lib$system$record_array_manager$$default = Ember.Object.extend({
5173
+ var ember$data$lib$system$record$array$manager$$default = Ember.Object.extend({
5124
5174
  init: function() {
5125
5175
  this.filteredRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
5126
5176
  defaultValue: function() { return []; }
@@ -5137,7 +5187,7 @@
5137
5187
  },
5138
5188
 
5139
5189
  recordArraysForRecord: function(record) {
5140
- record._recordArrays = record._recordArrays || ember$data$lib$system$map$$OrderedSet.create();
5190
+ record._recordArrays = record._recordArrays || ember$data$lib$system$ordered$set$$default.create();
5141
5191
  return record._recordArrays;
5142
5192
  },
5143
5193
 
@@ -5154,8 +5204,8 @@
5154
5204
  @param {Number|String} clientId
5155
5205
  */
5156
5206
  updateRecordArrays: function() {
5157
- ember$data$lib$system$record_array_manager$$forEach(this.changedRecords, function(record) {
5158
- if (ember$data$lib$system$record_array_manager$$get(record, 'isDeleted')) {
5207
+ ember$data$lib$system$record$array$manager$$forEach(this.changedRecords, function(record) {
5208
+ if (ember$data$lib$system$record$array$manager$$get(record, 'isDeleted')) {
5159
5209
  this._recordWasDeleted(record);
5160
5210
  } else {
5161
5211
  this._recordWasChanged(record);
@@ -5184,8 +5234,8 @@
5184
5234
  var recordArrays = this.filteredRecordArrays.get(type);
5185
5235
  var filter;
5186
5236
 
5187
- ember$data$lib$system$record_array_manager$$forEach(recordArrays, function(array) {
5188
- filter = ember$data$lib$system$record_array_manager$$get(array, 'filterFunction');
5237
+ ember$data$lib$system$record$array$manager$$forEach(recordArrays, function(array) {
5238
+ filter = ember$data$lib$system$record$array$manager$$get(array, 'filterFunction');
5189
5239
  if (filter) {
5190
5240
  this.updateRecordArray(array, filter, type, record);
5191
5241
  }
@@ -5198,8 +5248,8 @@
5198
5248
  var recordArrays = this.filteredRecordArrays.get(type);
5199
5249
  var filter;
5200
5250
 
5201
- ember$data$lib$system$record_array_manager$$forEach(recordArrays, function(array) {
5202
- filter = ember$data$lib$system$record_array_manager$$get(array, 'filterFunction');
5251
+ ember$data$lib$system$record$array$manager$$forEach(recordArrays, function(array) {
5252
+ filter = ember$data$lib$system$record$array$manager$$get(array, 'filterFunction');
5203
5253
  this.updateRecordArray(array, filter, type, record);
5204
5254
  }, this);
5205
5255
  },
@@ -5254,7 +5304,7 @@
5254
5304
  for (var i = 0, l = records.length; i < l; i++) {
5255
5305
  record = records[i];
5256
5306
 
5257
- if (!ember$data$lib$system$record_array_manager$$get(record, 'isDeleted') && !ember$data$lib$system$record_array_manager$$get(record, 'isEmpty')) {
5307
+ if (!ember$data$lib$system$record$array$manager$$get(record, 'isDeleted') && !ember$data$lib$system$record$array$manager$$get(record, 'isEmpty')) {
5258
5308
  this.updateRecordArray(array, filter, type, record);
5259
5309
  }
5260
5310
  }
@@ -5268,7 +5318,7 @@
5268
5318
  @return {DS.RecordArray}
5269
5319
  */
5270
5320
  createRecordArray: function(type) {
5271
- var array = ember$data$lib$system$record_arrays$record_array$$default.create({
5321
+ var array = ember$data$lib$system$record$arrays$record$array$$default.create({
5272
5322
  type: type,
5273
5323
  content: Ember.A(),
5274
5324
  store: this.store,
@@ -5291,7 +5341,7 @@
5291
5341
  @return {DS.FilteredRecordArray}
5292
5342
  */
5293
5343
  createFilteredRecordArray: function(type, filter, query) {
5294
- var array = ember$data$lib$system$record_arrays$filtered_record_array$$default.create({
5344
+ var array = ember$data$lib$system$record$arrays$filtered$record$array$$default.create({
5295
5345
  query: query,
5296
5346
  type: type,
5297
5347
  content: Ember.A(),
@@ -5314,7 +5364,7 @@
5314
5364
  @return {DS.AdapterPopulatedRecordArray}
5315
5365
  */
5316
5366
  createAdapterPopulatedRecordArray: function(type, query) {
5317
- var array = ember$data$lib$system$record_arrays$adapter_populated_record_array$$default.create({
5367
+ var array = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default.create({
5318
5368
  type: type,
5319
5369
  query: query,
5320
5370
  content: Ember.A(),
@@ -5354,7 +5404,7 @@
5354
5404
  */
5355
5405
  unregisterFilteredRecordArray: function(array) {
5356
5406
  var recordArrays = this.filteredRecordArrays.get(array.type);
5357
- var index = ember$data$lib$system$record_array_manager$$indexOf(recordArrays, array);
5407
+ var index = ember$data$lib$system$record$array$manager$$indexOf(recordArrays, array);
5358
5408
  recordArrays.splice(index, 1);
5359
5409
  },
5360
5410
 
@@ -5362,17 +5412,17 @@
5362
5412
  this._super.apply(this, arguments);
5363
5413
 
5364
5414
  this.filteredRecordArrays.forEach(function(value) {
5365
- ember$data$lib$system$record_array_manager$$forEach(ember$data$lib$system$record_array_manager$$flatten(value), ember$data$lib$system$record_array_manager$$destroy);
5415
+ ember$data$lib$system$record$array$manager$$forEach(ember$data$lib$system$record$array$manager$$flatten(value), ember$data$lib$system$record$array$manager$$destroy);
5366
5416
  });
5367
- ember$data$lib$system$record_array_manager$$forEach(this._adapterPopulatedRecordArrays, ember$data$lib$system$record_array_manager$$destroy);
5417
+ ember$data$lib$system$record$array$manager$$forEach(this._adapterPopulatedRecordArrays, ember$data$lib$system$record$array$manager$$destroy);
5368
5418
  }
5369
5419
  });
5370
5420
 
5371
- function ember$data$lib$system$record_array_manager$$destroy(entry) {
5421
+ function ember$data$lib$system$record$array$manager$$destroy(entry) {
5372
5422
  entry.destroy();
5373
5423
  }
5374
5424
 
5375
- function ember$data$lib$system$record_array_manager$$flatten(list) {
5425
+ function ember$data$lib$system$record$array$manager$$flatten(list) {
5376
5426
  var length = list.length;
5377
5427
  var result = Ember.A();
5378
5428
 
@@ -5382,9 +5432,6 @@
5382
5432
 
5383
5433
  return result;
5384
5434
  }
5385
- /**
5386
- @module ember-data
5387
- */
5388
5435
 
5389
5436
  var ember$data$lib$system$model$states$$get = Ember.get;
5390
5437
  var ember$data$lib$system$model$states$$set = Ember.set;
@@ -5794,6 +5841,7 @@
5794
5841
  ember$data$lib$system$model$states$$createdState.uncommitted.deleteRecord = function(record) {
5795
5842
  record.disconnectRelationships();
5796
5843
  record.transitionTo('deleted.saved');
5844
+ record.send('invokeLifecycleCallbacks');
5797
5845
  };
5798
5846
 
5799
5847
  ember$data$lib$system$model$states$$createdState.uncommitted.rollback = function(record) {
@@ -6048,6 +6096,11 @@
6048
6096
  becameError: function(record) {
6049
6097
  record.transitionTo('uncommitted');
6050
6098
  record.triggerLater('becameError', record);
6099
+ },
6100
+
6101
+ becameInvalid: function(record) {
6102
+ record.transitionTo('invalid');
6103
+ record.triggerLater('becameInvalid', record);
6051
6104
  }
6052
6105
  },
6053
6106
 
@@ -6071,6 +6124,32 @@
6071
6124
  willCommit: Ember.K,
6072
6125
 
6073
6126
  didCommit: Ember.K
6127
+ },
6128
+
6129
+ invalid: {
6130
+ isValid: false,
6131
+
6132
+ didSetProperty: function(record, context) {
6133
+ ember$data$lib$system$model$states$$get(record, 'errors').remove(context.name);
6134
+
6135
+ ember$data$lib$system$model$states$$didSetProperty(record, context);
6136
+ },
6137
+
6138
+ deleteRecord: Ember.K,
6139
+ becomeDirty: Ember.K,
6140
+ willCommit: Ember.K,
6141
+
6142
+
6143
+ rolledBack: function(record) {
6144
+ ember$data$lib$system$model$states$$get(record, 'errors').clear();
6145
+ record.transitionTo('loaded.saved');
6146
+ record.triggerLater('ready');
6147
+ },
6148
+
6149
+ becameValid: function(record) {
6150
+ record.transitionTo('uncommitted');
6151
+ }
6152
+
6074
6153
  }
6075
6154
  },
6076
6155
 
@@ -6394,8 +6473,8 @@
6394
6473
  var ember$data$lib$system$relationships$state$relationship$$forEach = Ember.EnumerableUtils.forEach;
6395
6474
 
6396
6475
  var ember$data$lib$system$relationships$state$relationship$$Relationship = function(store, record, inverseKey, relationshipMeta) {
6397
- this.members = new ember$data$lib$system$map$$OrderedSet();
6398
- this.canonicalMembers = new ember$data$lib$system$map$$OrderedSet();
6476
+ this.members = new ember$data$lib$system$ordered$set$$default();
6477
+ this.canonicalMembers = new ember$data$lib$system$ordered$set$$default();
6399
6478
  this.store = store;
6400
6479
  this.key = relationshipMeta.key;
6401
6480
  this.inverseKey = inverseKey;
@@ -6503,7 +6582,7 @@
6503
6582
 
6504
6583
  addRecord: function(record, idx) {
6505
6584
  if (!this.members.has(record)) {
6506
- this.members.add(record);
6585
+ this.members.addWithIndex(record, idx);
6507
6586
  this.notifyRecordRelationshipAdded(record, idx);
6508
6587
  if (this.inverseKey) {
6509
6588
  record._relationships[this.inverseKey].addRecord(this.record);
@@ -6629,11 +6708,230 @@
6629
6708
 
6630
6709
  var ember$data$lib$system$relationships$state$relationship$$default = ember$data$lib$system$relationships$state$relationship$$Relationship;
6631
6710
 
6632
- var ember$data$lib$system$relationships$state$has_many$$ManyRelationship = function(store, record, inverseKey, relationshipMeta) {
6711
+ var ember$data$lib$system$many$array$$get = Ember.get;
6712
+ var ember$data$lib$system$many$array$$set = Ember.set;
6713
+ var ember$data$lib$system$many$array$$filter = Ember.ArrayPolyfills.filter;
6714
+
6715
+ var ember$data$lib$system$many$array$$default = Ember.Object.extend(Ember.MutableArray, Ember.Evented, {
6716
+ init: function() {
6717
+ this.currentState = Ember.A([]);
6718
+ },
6719
+
6720
+ record: null,
6721
+
6722
+ canonicalState: null,
6723
+ currentState: null,
6724
+
6725
+ length: 0,
6726
+
6727
+ objectAt: function(index) {
6728
+ if (this.currentState[index]) {
6729
+ return this.currentState[index];
6730
+ } else {
6731
+ return this.canonicalState[index];
6732
+ }
6733
+ },
6734
+
6735
+ flushCanonical: function() {
6736
+ //TODO make this smarter, currently its plenty stupid
6737
+ var toSet = ember$data$lib$system$many$array$$filter.call(this.canonicalState, function(record) {
6738
+ return !record.get('isDeleted');
6739
+ });
6740
+
6741
+ //a hack for not removing new records
6742
+ //TODO remove once we have proper diffing
6743
+ var newRecords = this.currentState.filter(function(record) {
6744
+ return record.get('isNew');
6745
+ });
6746
+ toSet = toSet.concat(newRecords);
6747
+ var oldLength = this.length;
6748
+ this.arrayContentWillChange(0, this.length, toSet.length);
6749
+ this.set('length', toSet.length);
6750
+ this.currentState = toSet;
6751
+ this.arrayContentDidChange(0, oldLength, this.length);
6752
+ //TODO Figure out to notify only on additions and maybe only if unloaded
6753
+ this.relationship.notifyHasManyChanged();
6754
+ this.record.updateRecordArrays();
6755
+ },
6756
+ /**
6757
+ `true` if the relationship is polymorphic, `false` otherwise.
6758
+
6759
+ @property {Boolean} isPolymorphic
6760
+ @private
6761
+ */
6762
+ isPolymorphic: false,
6763
+
6764
+ /**
6765
+ The loading state of this array
6766
+
6767
+ @property {Boolean} isLoaded
6768
+ */
6769
+ isLoaded: false,
6770
+
6771
+ /**
6772
+ The relationship which manages this array.
6773
+
6774
+ @property {ManyRelationship} relationship
6775
+ @private
6776
+ */
6777
+ relationship: null,
6778
+
6779
+ internalReplace: function(idx, amt, objects) {
6780
+ if (!objects) {
6781
+ objects = [];
6782
+ }
6783
+ this.arrayContentWillChange(idx, amt, objects.length);
6784
+ this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
6785
+ this.set('length', this.currentState.length);
6786
+ this.arrayContentDidChange(idx, amt, objects.length);
6787
+ if (objects) {
6788
+ //TODO(Igor) probably needed only for unloaded records
6789
+ this.relationship.notifyHasManyChanged();
6790
+ }
6791
+ this.record.updateRecordArrays();
6792
+ },
6793
+
6794
+ //TODO(Igor) optimize
6795
+ internalRemoveRecords: function(records) {
6796
+ var index;
6797
+ for (var i=0; i < records.length; i++) {
6798
+ index = this.currentState.indexOf(records[i]);
6799
+ this.internalReplace(index, 1);
6800
+ }
6801
+ },
6802
+
6803
+ //TODO(Igor) optimize
6804
+ internalAddRecords: function(records, idx) {
6805
+ if (idx === undefined) {
6806
+ idx = this.currentState.length;
6807
+ }
6808
+ this.internalReplace(idx, 0, records);
6809
+ },
6810
+
6811
+ replace: function(idx, amt, objects) {
6812
+ var records;
6813
+ if (amt > 0) {
6814
+ records = this.currentState.slice(idx, idx+amt);
6815
+ this.get('relationship').removeRecords(records);
6816
+ }
6817
+ if (objects) {
6818
+ this.get('relationship').addRecords(objects, idx);
6819
+ }
6820
+ },
6821
+ /**
6822
+ Used for async `hasMany` arrays
6823
+ to keep track of when they will resolve.
6824
+
6825
+ @property {Ember.RSVP.Promise} promise
6826
+ @private
6827
+ */
6828
+ promise: null,
6829
+
6830
+ /**
6831
+ @method loadingRecordsCount
6832
+ @param {Number} count
6833
+ @private
6834
+ */
6835
+ loadingRecordsCount: function(count) {
6836
+ this.loadingRecordsCount = count;
6837
+ },
6838
+
6839
+ /**
6840
+ @method loadedRecord
6841
+ @private
6842
+ */
6843
+ loadedRecord: function() {
6844
+ this.loadingRecordsCount--;
6845
+ if (this.loadingRecordsCount === 0) {
6846
+ ember$data$lib$system$many$array$$set(this, 'isLoaded', true);
6847
+ this.trigger('didLoad');
6848
+ }
6849
+ },
6850
+
6851
+ /**
6852
+ @method reload
6853
+ @public
6854
+ */
6855
+ reload: function() {
6856
+ return this.relationship.reload();
6857
+ },
6858
+
6859
+ /**
6860
+ Saves all of the records in the `ManyArray`.
6861
+
6862
+ Example
6863
+
6864
+ ```javascript
6865
+ store.find('inbox', 1).then(function(inbox) {
6866
+ inbox.get('messages').then(function(messages) {
6867
+ messages.forEach(function(message) {
6868
+ message.set('isRead', true);
6869
+ });
6870
+ messages.save()
6871
+ });
6872
+ });
6873
+ ```
6874
+
6875
+ @method save
6876
+ @return {DS.PromiseArray} promise
6877
+ */
6878
+ save: function() {
6879
+ var manyArray = this;
6880
+ var promiseLabel = "DS: ManyArray#save " + ember$data$lib$system$many$array$$get(this, 'type');
6881
+ var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function(array) {
6882
+ return manyArray;
6883
+ }, null, "DS: ManyArray#save return ManyArray");
6884
+
6885
+ return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
6886
+ },
6887
+
6888
+ /**
6889
+ Create a child record within the owner
6890
+
6891
+ @method createRecord
6892
+ @private
6893
+ @param {Object} hash
6894
+ @return {DS.Model} record
6895
+ */
6896
+ createRecord: function(hash) {
6897
+ var store = ember$data$lib$system$many$array$$get(this, 'store');
6898
+ var type = ember$data$lib$system$many$array$$get(this, 'type');
6899
+ var record;
6900
+
6901
+ Ember.assert("You cannot add '" + type.typeKey + "' records to this polymorphic relationship.", !ember$data$lib$system$many$array$$get(this, 'isPolymorphic'));
6902
+
6903
+ record = store.createRecord(type, hash);
6904
+ this.pushObject(record);
6905
+
6906
+ return record;
6907
+ },
6908
+
6909
+ /**
6910
+ @method addRecord
6911
+ @param {DS.Model} record
6912
+ @deprecated Use `addObject()` instead
6913
+ */
6914
+ addRecord: function(record) {
6915
+ Ember.deprecate('Using manyArray.addRecord() has been deprecated. You should use manyArray.addObject() instead.');
6916
+ this.addObject(record);
6917
+ },
6918
+
6919
+ /**
6920
+ @method removeRecord
6921
+ @param {DS.Model} record
6922
+ @deprecated Use `removeObject()` instead
6923
+ */
6924
+ removeRecord: function(record) {
6925
+ Ember.deprecate('Using manyArray.removeRecord() has been deprecated. You should use manyArray.removeObject() instead.');
6926
+ this.removeObject(record);
6927
+ }
6928
+ });
6929
+
6930
+ var ember$data$lib$system$relationships$state$has$many$$ManyRelationship = function(store, record, inverseKey, relationshipMeta) {
6633
6931
  this._super$constructor(store, record, inverseKey, relationshipMeta);
6634
6932
  this.belongsToType = relationshipMeta.type;
6635
6933
  this.canonicalState = [];
6636
- this.manyArray = ember$data$lib$system$record_arrays$many_array$$default.create({
6934
+ this.manyArray = ember$data$lib$system$many$array$$default.create({
6637
6935
  canonicalState: this.canonicalState,
6638
6936
  store: this.store,
6639
6937
  relationship: this,
@@ -6644,16 +6942,16 @@
6644
6942
  this.manyArray.isPolymorphic = this.isPolymorphic;
6645
6943
  };
6646
6944
 
6647
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
6648
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.constructor = ember$data$lib$system$relationships$state$has_many$$ManyRelationship;
6649
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
6945
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
6946
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.constructor = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
6947
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
6650
6948
 
6651
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.destroy = function() {
6949
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.destroy = function() {
6652
6950
  this.manyArray.destroy();
6653
6951
  };
6654
6952
 
6655
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
6656
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.addCanonicalRecord = function(record, idx) {
6953
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
6954
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addCanonicalRecord = function(record, idx) {
6657
6955
  if (this.canonicalMembers.has(record)) {
6658
6956
  return;
6659
6957
  }
@@ -6665,8 +6963,8 @@
6665
6963
  this._super$addCanonicalRecord(record, idx);
6666
6964
  };
6667
6965
 
6668
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
6669
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.addRecord = function(record, idx) {
6966
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
6967
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addRecord = function(record, idx) {
6670
6968
  if (this.members.has(record)) {
6671
6969
  return;
6672
6970
  }
@@ -6674,8 +6972,8 @@
6674
6972
  this.manyArray.internalAddRecords([record], idx);
6675
6973
  };
6676
6974
 
6677
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
6678
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.removeCanonicalRecordFromOwn = function(record, idx) {
6975
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
6976
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeCanonicalRecordFromOwn = function(record, idx) {
6679
6977
  var i = idx;
6680
6978
  if (!this.canonicalMembers.has(record)) {
6681
6979
  return;
@@ -6689,14 +6987,14 @@
6689
6987
  this._super$removeCanonicalRecordFromOwn(record, idx);
6690
6988
  };
6691
6989
 
6692
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
6693
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.flushCanonical = function() {
6990
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
6991
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.flushCanonical = function() {
6694
6992
  this.manyArray.flushCanonical();
6695
6993
  this._super$flushCanonical();
6696
6994
  };
6697
6995
 
6698
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
6699
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.removeRecordFromOwn = function(record, idx) {
6996
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
6997
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeRecordFromOwn = function(record, idx) {
6700
6998
  if (!this.members.has(record)) {
6701
6999
  return;
6702
7000
  }
@@ -6709,22 +7007,22 @@
6709
7007
  }
6710
7008
  };
6711
7009
 
6712
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.notifyRecordRelationshipAdded = function(record, idx) {
7010
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyRecordRelationshipAdded = function(record, idx) {
6713
7011
  var type = this.relationshipMeta.type;
6714
7012
  Ember.assert("You cannot add '" + record.constructor.typeKey + "' records to the " + this.record.constructor.typeKey + "." + this.key + " relationship (only '" + this.belongsToType.typeKey + "' allowed)", (function () {
6715
- if (record instanceof type) {
6716
- return true;
6717
- } else if (Ember.MODEL_FACTORY_INJECTIONS) {
6718
- return record instanceof type.superclass;
7013
+ if (type.__isMixin) {
7014
+ return type.__mixin.detect(record);
6719
7015
  }
6720
-
6721
- return false;
7016
+ if (Ember.MODEL_FACTORY_INJECTIONS) {
7017
+ type = type.superclass;
7018
+ }
7019
+ return record instanceof type;
6722
7020
  })());
6723
7021
 
6724
7022
  this.record.notifyHasManyAdded(this.key, record, idx);
6725
7023
  };
6726
7024
 
6727
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.reload = function() {
7025
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.reload = function() {
6728
7026
  var self = this;
6729
7027
  if (this.link) {
6730
7028
  return this.fetchLink();
@@ -6737,14 +7035,14 @@
6737
7035
  }
6738
7036
  };
6739
7037
 
6740
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.computeChanges = function(records) {
7038
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.computeChanges = function(records) {
6741
7039
  var members = this.canonicalMembers;
6742
7040
  var recordsToRemove = [];
6743
7041
  var length;
6744
7042
  var record;
6745
7043
  var i;
6746
7044
 
6747
- records = ember$data$lib$system$relationships$state$has_many$$setForArray(records);
7045
+ records = ember$data$lib$system$relationships$state$has$many$$setForArray(records);
6748
7046
 
6749
7047
  members.forEach(function(member) {
6750
7048
  if (records.has(member)) { return; }
@@ -6767,15 +7065,17 @@
6767
7065
  }
6768
7066
  };
6769
7067
 
6770
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.fetchLink = function() {
7068
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.fetchLink = function() {
6771
7069
  var self = this;
6772
7070
  return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function(records) {
6773
- self.updateRecordsFromAdapter(records);
7071
+ self.store._backburner.join(function() {
7072
+ self.updateRecordsFromAdapter(records);
7073
+ });
6774
7074
  return self.manyArray;
6775
7075
  });
6776
7076
  };
6777
7077
 
6778
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.findRecords = function() {
7078
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.findRecords = function() {
6779
7079
  var manyArray = this.manyArray;
6780
7080
  return this.store.findMany(manyArray.toArray()).then(function() {
6781
7081
  //Goes away after the manyArray refactor
@@ -6783,11 +7083,11 @@
6783
7083
  return manyArray;
6784
7084
  });
6785
7085
  };
6786
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.notifyHasManyChanged = function() {
7086
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyHasManyChanged = function() {
6787
7087
  this.record.notifyHasManyAdded(this.key);
6788
7088
  };
6789
7089
 
6790
- ember$data$lib$system$relationships$state$has_many$$ManyRelationship.prototype.getRecords = function() {
7090
+ ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.getRecords = function() {
6791
7091
  //TODO(Igor) sync server here, once our syncing is not stupid
6792
7092
  if (this.isAsync) {
6793
7093
  var self = this;
@@ -6799,7 +7099,7 @@
6799
7099
  } else {
6800
7100
  promise = this.findRecords();
6801
7101
  }
6802
- return ember$data$lib$system$promise_proxies$$PromiseManyArray.create({
7102
+ return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
6803
7103
  content: this.manyArray,
6804
7104
  promise: promise
6805
7105
  });
@@ -6814,8 +7114,8 @@
6814
7114
  }
6815
7115
  };
6816
7116
 
6817
- function ember$data$lib$system$relationships$state$has_many$$setForArray(array) {
6818
- var set = new ember$data$lib$system$map$$OrderedSet();
7117
+ function ember$data$lib$system$relationships$state$has$many$$setForArray(array) {
7118
+ var set = new ember$data$lib$system$ordered$set$$default();
6819
7119
 
6820
7120
  if (array) {
6821
7121
  for (var i=0, l=array.length; i<l; i++) {
@@ -6826,9 +7126,9 @@
6826
7126
  return set;
6827
7127
  }
6828
7128
 
6829
- var ember$data$lib$system$relationships$state$has_many$$default = ember$data$lib$system$relationships$state$has_many$$ManyRelationship;
7129
+ var ember$data$lib$system$relationships$state$has$many$$default = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
6830
7130
 
6831
- var ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship = function(store, record, inverseKey, relationshipMeta) {
7131
+ var ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship = function(store, record, inverseKey, relationshipMeta) {
6832
7132
  this._super$constructor(store, record, inverseKey, relationshipMeta);
6833
7133
  this.record = record;
6834
7134
  this.key = relationshipMeta.key;
@@ -6836,11 +7136,11 @@
6836
7136
  this.canonicalState = null;
6837
7137
  };
6838
7138
 
6839
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
6840
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.constructor = ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship;
6841
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
7139
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
7140
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.constructor = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
7141
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
6842
7142
 
6843
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.setRecord = function(newRecord) {
7143
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecord = function(newRecord) {
6844
7144
  if (newRecord) {
6845
7145
  this.addRecord(newRecord);
6846
7146
  } else if (this.inverseRecord) {
@@ -6848,7 +7148,7 @@
6848
7148
  }
6849
7149
  };
6850
7150
 
6851
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.setCanonicalRecord = function(newRecord) {
7151
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setCanonicalRecord = function(newRecord) {
6852
7152
  if (newRecord) {
6853
7153
  this.addCanonicalRecord(newRecord);
6854
7154
  } else if (this.inverseRecord) {
@@ -6856,8 +7156,8 @@
6856
7156
  }
6857
7157
  };
6858
7158
 
6859
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
6860
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.addCanonicalRecord = function(newRecord) {
7159
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
7160
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addCanonicalRecord = function(newRecord) {
6861
7161
  if (this.canonicalMembers.has(newRecord)) { return;}
6862
7162
 
6863
7163
  if (this.canonicalState) {
@@ -6868,8 +7168,8 @@
6868
7168
  this._super$addCanonicalRecord(newRecord);
6869
7169
  };
6870
7170
 
6871
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
6872
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.flushCanonical = function() {
7171
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
7172
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.flushCanonical = function() {
6873
7173
  //temporary fix to not remove newly created records if server returned null.
6874
7174
  //TODO remove once we have proper diffing
6875
7175
  if (this.inverseRecord && this.inverseRecord.get('isNew') && !this.canonicalState) {
@@ -6880,18 +7180,18 @@
6880
7180
  this._super$flushCanonical();
6881
7181
  };
6882
7182
 
6883
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
6884
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.addRecord = function(newRecord) {
7183
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
7184
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addRecord = function(newRecord) {
6885
7185
  if (this.members.has(newRecord)) { return;}
6886
7186
  var type = this.relationshipMeta.type;
6887
- Ember.assert("You can only add a '" + type.typeKey + "' record to this relationship", (function () {
6888
- if (newRecord instanceof type) {
6889
- return true;
6890
- } else if (Ember.MODEL_FACTORY_INJECTIONS) {
6891
- return newRecord instanceof type.superclass;
7187
+ Ember.assert("You cannot add a '" + newRecord.constructor.typeKey + "' record to the '" + this.record.constructor.typeKey + "." + this.key +"'. " + "You can only add a '" + type.typeKey + "' record to this relationship.", (function () {
7188
+ if (type.__isMixin) {
7189
+ return type.__mixin.detect(newRecord);
6892
7190
  }
6893
-
6894
- return false;
7191
+ if (Ember.MODEL_FACTORY_INJECTIONS) {
7192
+ type = type.superclass;
7193
+ }
7194
+ return newRecord instanceof type;
6895
7195
  })());
6896
7196
 
6897
7197
  if (this.inverseRecord) {
@@ -6903,28 +7203,28 @@
6903
7203
  this.record.notifyBelongsToChanged(this.key);
6904
7204
  };
6905
7205
 
6906
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.setRecordPromise = function(newPromise) {
7206
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecordPromise = function(newPromise) {
6907
7207
  var content = newPromise.get && newPromise.get('content');
6908
7208
  Ember.assert("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined);
6909
7209
  this.setRecord(content);
6910
7210
  };
6911
7211
 
6912
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
6913
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
7212
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
7213
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
6914
7214
  if (!this.members.has(record)) { return;}
6915
7215
  this.inverseRecord = null;
6916
7216
  this._super$removeRecordFromOwn(record);
6917
7217
  this.record.notifyBelongsToChanged(this.key);
6918
7218
  };
6919
7219
 
6920
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
6921
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.removeCanonicalRecordFromOwn = function(record) {
7220
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
7221
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeCanonicalRecordFromOwn = function(record) {
6922
7222
  if (!this.canonicalMembers.has(record)) { return;}
6923
7223
  this.canonicalState = null;
6924
7224
  this._super$removeCanonicalRecordFromOwn(record);
6925
7225
  };
6926
7226
 
6927
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.findRecord = function() {
7227
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.findRecord = function() {
6928
7228
  if (this.inverseRecord) {
6929
7229
  return this.store._findByRecord(this.inverseRecord);
6930
7230
  } else {
@@ -6932,7 +7232,7 @@
6932
7232
  }
6933
7233
  };
6934
7234
 
6935
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.fetchLink = function() {
7235
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.fetchLink = function() {
6936
7236
  var self = this;
6937
7237
  return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function(record) {
6938
7238
  if (record) {
@@ -6942,7 +7242,7 @@
6942
7242
  });
6943
7243
  };
6944
7244
 
6945
- ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship.prototype.getRecord = function() {
7245
+ ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.getRecord = function() {
6946
7246
  //TODO(Igor) flushCanonical here once our syncing is not stupid
6947
7247
  if (this.isAsync) {
6948
7248
  var promise;
@@ -6955,7 +7255,7 @@
6955
7255
  promise = this.findRecord();
6956
7256
  }
6957
7257
 
6958
- return ember$data$lib$system$promise_proxies$$PromiseObject.create({
7258
+ return ember$data$lib$system$promise$proxies$$PromiseObject.create({
6959
7259
  promise: promise,
6960
7260
  content: this.inverseRecord
6961
7261
  });
@@ -6965,7 +7265,7 @@
6965
7265
  }
6966
7266
  };
6967
7267
 
6968
- var ember$data$lib$system$relationships$state$belongs_to$$default = ember$data$lib$system$relationships$state$belongs_to$$BelongsToRelationship;
7268
+ var ember$data$lib$system$relationships$state$belongs$to$$default = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
6969
7269
 
6970
7270
  var ember$data$lib$system$relationships$state$create$$createRelationshipFor = function(record, relationshipMeta, store) {
6971
7271
  var inverseKey;
@@ -6976,16 +7276,13 @@
6976
7276
  }
6977
7277
 
6978
7278
  if (relationshipMeta.kind === 'hasMany') {
6979
- return new ember$data$lib$system$relationships$state$has_many$$default(store, record, inverseKey, relationshipMeta);
7279
+ return new ember$data$lib$system$relationships$state$has$many$$default(store, record, inverseKey, relationshipMeta);
6980
7280
  } else {
6981
- return new ember$data$lib$system$relationships$state$belongs_to$$default(store, record, inverseKey, relationshipMeta);
7281
+ return new ember$data$lib$system$relationships$state$belongs$to$$default(store, record, inverseKey, relationshipMeta);
6982
7282
  }
6983
7283
  };
6984
7284
 
6985
7285
  var ember$data$lib$system$relationships$state$create$$default = ember$data$lib$system$relationships$state$create$$createRelationshipFor;
6986
- /**
6987
- @module ember-data
6988
- */
6989
7286
 
6990
7287
  var ember$data$lib$system$snapshot$$get = Ember.get;
6991
7288
 
@@ -7050,10 +7347,9 @@
7050
7347
  Example
7051
7348
 
7052
7349
  ```javascript
7053
- var post = store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
7054
- var snapshot = post._createSnapshot();
7350
+ // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
7055
7351
 
7056
- snapshot.id; // => '1'
7352
+ postSnapshot.id; // => '1'
7057
7353
  ```
7058
7354
 
7059
7355
  @property id
@@ -7098,11 +7394,10 @@
7098
7394
  Example
7099
7395
 
7100
7396
  ```javascript
7101
- var post = store.createRecord('post', { author: 'Tomster', title: 'Ember.js rocks' });
7102
- var snapshot = post._createSnapshot();
7397
+ // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
7103
7398
 
7104
- snapshot.attr('author'); // => 'Tomster'
7105
- snapshot.attr('title'); // => 'Ember.js rocks'
7399
+ postSnapshot.attr('author'); // => 'Tomster'
7400
+ postSnapshot.attr('title'); // => 'Ember.js rocks'
7106
7401
  ```
7107
7402
 
7108
7403
  Note: Values are loaded eagerly and cached when the snapshot is created.
@@ -7124,10 +7419,9 @@
7124
7419
  Example
7125
7420
 
7126
7421
  ```javascript
7127
- var post = store.createRecord('post', { author: 'Tomster', title: 'Ember.js rocks' });
7128
- var snapshot = post._createSnapshot();
7422
+ // store.push('post', { id: 1, author: 'Tomster', title: 'Hello World' });
7129
7423
 
7130
- snapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
7424
+ postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
7131
7425
  ```
7132
7426
 
7133
7427
  @method attributes
@@ -7149,12 +7443,11 @@
7149
7443
  Example
7150
7444
 
7151
7445
  ```javascript
7152
- var post = store.push('post', { id: 1, title: 'Hello World' });
7153
- var comment = store.createRecord('comment', { body: 'Lorem ipsum', post: post });
7154
- var snapshot = comment._createSnapshot();
7446
+ // store.push('post', { id: 1, title: 'Hello World' });
7447
+ // store.createRecord('comment', { body: 'Lorem ipsum', post: post });
7155
7448
 
7156
- snapshot.belongsTo('post'); // => DS.Snapshot of post
7157
- snapshot.belongsTo('post', { id: true }); // => '1'
7449
+ commentSnapshot.belongsTo('post'); // => DS.Snapshot
7450
+ commentSnapshot.belongsTo('post', { id: true }); // => '1'
7158
7451
  ```
7159
7452
 
7160
7453
  Calling `belongsTo` will return a new Snapshot as long as there's any
@@ -7214,11 +7507,10 @@
7214
7507
  Example
7215
7508
 
7216
7509
  ```javascript
7217
- var post = store.createRecord('post', { title: 'Hello World', comments: [2, 3] });
7218
- var snapshot = post._createSnapshot();
7510
+ // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });
7219
7511
 
7220
- snapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]
7221
- snapshot.hasMany('comments', { ids: true }); // => ['2', '3']
7512
+ postSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]
7513
+ postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']
7222
7514
  ```
7223
7515
 
7224
7516
  Note: Relationships are loaded lazily and cached upon first access.
@@ -7340,6 +7632,15 @@
7340
7632
  */
7341
7633
  unknownProperty: function(keyName) {
7342
7634
  return this.get(keyName);
7635
+ },
7636
+
7637
+ /**
7638
+ @method _createSnapshot
7639
+ @private
7640
+ */
7641
+ _createSnapshot: function() {
7642
+ Ember.deprecate("You called _createSnapshot on what's already a DS.Snapshot. You shouldn't manually create snapshots in your adapter since the store passes snapshots to adapters by default.");
7643
+ return this;
7343
7644
  }
7344
7645
  };
7345
7646
 
@@ -7354,6 +7655,12 @@
7354
7655
  var ember$data$lib$system$model$model$$Promise = Ember.RSVP.Promise;
7355
7656
  var ember$data$lib$system$model$model$$forEach = Ember.ArrayPolyfills.forEach;
7356
7657
  var ember$data$lib$system$model$model$$map = Ember.ArrayPolyfills.map;
7658
+ var ember$data$lib$system$model$model$$intersection = Ember.EnumerableUtils.intersection;
7659
+ var ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS = [
7660
+ 'attributes', 'currentState', 'data',
7661
+ 'relatedTypes', 'relationshipNames', 'relationships',
7662
+ 'relationshipsByName', 'transformedAttributes', 'store'
7663
+ ];
7357
7664
 
7358
7665
  var ember$data$lib$system$model$model$$retrieveFromCurrentState = Ember.computed('currentState', function(key, value) {
7359
7666
  return ember$data$lib$system$model$model$$get(ember$data$lib$system$model$model$$get(this, 'currentState'), key);
@@ -7413,6 +7720,9 @@
7413
7720
  var ember$data$lib$system$model$model$$Model = Ember.Object.extend(Ember.Evented, {
7414
7721
  _recordArrays: undefined,
7415
7722
  _relationships: undefined,
7723
+
7724
+ store: null,
7725
+
7416
7726
  /**
7417
7727
  If this property is `true` the record is in the `empty`
7418
7728
  state. Empty is the first state all records enter after they have
@@ -7679,17 +7989,51 @@
7679
7989
  /**
7680
7990
  When the record is in the `invalid` state this object will contain
7681
7991
  any errors returned by the adapter. When present the errors hash
7682
- typically contains keys corresponding to the invalid property names
7683
- and values which are an array of error messages.
7992
+ contains keys corresponding to the invalid property names
7993
+ and values which are arrays of Javascript objects with two keys:
7994
+
7995
+ - `message` A string containing the error message from the backend
7996
+ - `attribute` The name of the property associated with this error message
7684
7997
 
7685
7998
  ```javascript
7686
7999
  record.get('errors.length'); // 0
7687
8000
  record.set('foo', 'invalid value');
7688
- record.save().then(null, function() {
7689
- record.get('errors').get('foo'); // ['foo should be a number.']
8001
+ record.save().catch(function() {
8002
+ record.get('errors').get('foo');
8003
+ // [{message: 'foo should be a number.', attribute: 'foo'}]
7690
8004
  });
7691
8005
  ```
7692
8006
 
8007
+ The `errors` property us useful for displaying error messages to
8008
+ the user.
8009
+
8010
+ ```handlebars
8011
+ <label>Username: {{input value=username}} </label>
8012
+ {{#each error in model.errors.username}}
8013
+ <div class="error">
8014
+ {{error.message}}
8015
+ </div>
8016
+ {{/each}}
8017
+ <label>Email: {{input value=email}} </label>
8018
+ {{#each error in model.errors.email}}
8019
+ <div class="error">
8020
+ {{error.message}}
8021
+ </div>
8022
+ {{/each}}
8023
+ ```
8024
+
8025
+
8026
+ You can also access the special `messages` property on the error
8027
+ object to get an array of all the error strings.
8028
+
8029
+ ```handlebars
8030
+ {{#each message in model.errors.messages}}
8031
+ <div class="error">
8032
+ {{message}}
8033
+ </div>
8034
+ {{/each}}
8035
+ ```
8036
+
7693
8037
  @property errors
7694
8038
  @type {DS.Errors}
7695
8039
  */
@@ -7720,8 +8064,7 @@
7720
8064
  @return {Object} an object whose values are primitive JSON values only
7721
8065
  */
7722
8066
  serialize: function(options) {
7723
- var store = ember$data$lib$system$model$model$$get(this, 'store');
7724
- return store.serialize(this, options);
8067
+ return this.store.serialize(this, options);
7725
8068
  },
7726
8069
 
7727
8070
  /**
@@ -7740,7 +8083,7 @@
7740
8083
  */
7741
8084
  toJSON: function(options) {
7742
8085
  // container is for lazy transform lookups
7743
- var serializer = ember$data$lib$serializers$json_serializer$$default.create({ container: this.container });
8086
+ var serializer = ember$data$lib$serializers$json$serializer$$default.create({ container: this.container });
7744
8087
  var snapshot = this._createSnapshot();
7745
8088
 
7746
8089
  return serializer.serialize(snapshot, options);
@@ -7770,7 +8113,7 @@
7770
8113
  didUpdate: Ember.K,
7771
8114
 
7772
8115
  /**
7773
- Fired when the record is created.
8116
+ Fired when a new record is commited to the server.
7774
8117
 
7775
8118
  @event didCreate
7776
8119
  */
@@ -8039,6 +8382,11 @@
8039
8382
  rel.destroy();
8040
8383
  }
8041
8384
  }, this);
8385
+ var model = this;
8386
+ ember$data$lib$system$model$model$$forEach.call(Ember.keys(this._implicitRelationships), function(key) {
8387
+ model._implicitRelationships[key].clear();
8388
+ model._implicitRelationships[key].destroy();
8389
+ });
8042
8390
  },
8043
8391
 
8044
8392
  disconnectRelationships: function() {
@@ -8068,7 +8416,7 @@
8068
8416
  */
8069
8417
  updateRecordArrays: function() {
8070
8418
  this._updatingRecordArraysLater = false;
8071
- ember$data$lib$system$model$model$$get(this, 'store').dataWasUpdated(this.constructor, this);
8419
+ this.store.dataWasUpdated(this.constructor, this);
8072
8420
  },
8073
8421
 
8074
8422
  /**
@@ -8350,11 +8698,11 @@
8350
8698
  var promiseLabel = "DS: Model#save " + this;
8351
8699
  var resolver = Ember.RSVP.defer(promiseLabel);
8352
8700
 
8353
- this.get('store').scheduleSave(this, resolver);
8701
+ this.store.scheduleSave(this, resolver);
8354
8702
  this._inFlightAttributes = this._attributes;
8355
8703
  this._attributes = Ember.create(null);
8356
8704
 
8357
- return ember$data$lib$system$promise_proxies$$PromiseObject.create({
8705
+ return ember$data$lib$system$promise$proxies$$PromiseObject.create({
8358
8706
  promise: resolver.promise
8359
8707
  });
8360
8708
  },
@@ -8403,7 +8751,7 @@
8403
8751
  record.updateRecordArrays();
8404
8752
  });
8405
8753
 
8406
- return ember$data$lib$system$promise_proxies$$PromiseObject.create({
8754
+ return ember$data$lib$system$promise$proxies$$PromiseObject.create({
8407
8755
  promise: promise
8408
8756
  });
8409
8757
  },
@@ -8496,7 +8844,20 @@
8496
8844
  // This is a temporary solution until we refactor DS.Model to not
8497
8845
  // rely on the data property.
8498
8846
  willMergeMixin: function(props) {
8499
- Ember.assert('`data` is a reserved property name on DS.Model objects. Please choose a different property name for ' + this.constructor.toString(), !props.data);
8847
+ var constructor = this.constructor;
8848
+ Ember.assert('`' + ember$data$lib$system$model$model$$intersection(Ember.keys(props), ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !ember$data$lib$system$model$model$$intersection(Ember.keys(props), ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS)[0]);
8849
+ },
8850
+
8851
+ attr: function() {
8852
+ Ember.assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
8853
+ },
8854
+
8855
+ belongsTo: function() {
8856
+ Ember.assert("The `belongsTo` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
8857
+ },
8858
+
8859
+ hasMany: function() {
8860
+ Ember.assert("The `hasMany` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
8500
8861
  }
8501
8862
  });
8502
8863
 
@@ -8803,6 +9164,7 @@
8803
9164
  }).meta(meta);
8804
9165
  }
8805
9166
  var ember$data$lib$system$model$attributes$$default = ember$data$lib$system$model$attributes$$attr;
9167
+ var ember$data$lib$system$model$$default = ember$data$lib$system$model$model$$default;
8806
9168
  //Stanley told me to do this
8807
9169
  var ember$data$lib$system$store$$Backburner = Ember.__loader.require('backburner')['default'] || Ember.__loader.require('backburner')['Backburner'];
8808
9170
 
@@ -8860,6 +9222,11 @@
8860
9222
 
8861
9223
  var ember$data$lib$system$store$$camelize = Ember.String.camelize;
8862
9224
 
9225
+ var ember$data$lib$system$store$$Service = Ember.Service;
9226
+ if (!ember$data$lib$system$store$$Service) {
9227
+ ember$data$lib$system$store$$Service = Ember.Object;
9228
+ }
9229
+
8863
9230
  // Implementors Note:
8864
9231
  //
8865
9232
  // The variables in this file are consistently named according to the following
@@ -8950,9 +9317,9 @@
8950
9317
 
8951
9318
  @class Store
8952
9319
  @namespace DS
8953
- @extends Ember.Object
9320
+ @extends Ember.Service
8954
9321
  */
8955
- ember$data$lib$system$store$$Store = Ember.Object.extend({
9322
+ ember$data$lib$system$store$$Store = ember$data$lib$system$store$$Service.extend({
8956
9323
 
8957
9324
  /**
8958
9325
  @method init
@@ -8962,10 +9329,11 @@
8962
9329
  this._backburner = new ember$data$lib$system$store$$Backburner(['normalizeRelationships', 'syncRelationships', 'finished']);
8963
9330
  // internal bookkeeping; not observable
8964
9331
  this.typeMaps = {};
8965
- this.recordArrayManager = ember$data$lib$system$record_array_manager$$default.create({
9332
+ this.recordArrayManager = ember$data$lib$system$record$array$manager$$default.create({
8966
9333
  store: this
8967
9334
  });
8968
9335
  this._pendingSave = [];
9336
+ this._containerCache = Ember.create(null);
8969
9337
  //Used to keep track of all the find requests that need to be coalesced
8970
9338
  this._pendingFetch = ember$data$lib$system$map$$Map.create();
8971
9339
  },
@@ -9032,7 +9400,8 @@
9032
9400
 
9033
9401
  if (DS.Adapter.detect(adapter)) {
9034
9402
  adapter = adapter.create({
9035
- container: this.container
9403
+ container: this.container,
9404
+ store: this
9036
9405
  });
9037
9406
  }
9038
9407
 
@@ -9292,7 +9661,7 @@
9292
9661
  ```javascript
9293
9662
  App.PostRoute = Ember.Route.extend({
9294
9663
  model: function(params) {
9295
- return this.store.fetch('post', params.post_id);
9664
+ return this.store.fetchById('post', params.post_id);
9296
9665
  }
9297
9666
  });
9298
9667
  ```
@@ -9370,7 +9739,7 @@
9370
9739
  fetchedRecord = record._loadingPromise;
9371
9740
  }
9372
9741
 
9373
- return ember$data$lib$system$promise_proxies$$promiseObject(fetchedRecord || record, "DS: Store#findByRecord " + record.typeKey + " with id: " + ember$data$lib$system$store$$get(record, 'id'));
9742
+ return ember$data$lib$system$promise$proxies$$promiseObject(fetchedRecord || record, "DS: Store#findByRecord " + record.typeKey + " with id: " + ember$data$lib$system$store$$get(record, 'id'));
9374
9743
  },
9375
9744
 
9376
9745
  /**
@@ -9386,7 +9755,7 @@
9386
9755
  findByIds: function(type, ids) {
9387
9756
  var store = this;
9388
9757
 
9389
- return ember$data$lib$system$promise_proxies$$promiseArray(Ember.RSVP.all(ember$data$lib$system$store$$map(ids, function(id) {
9758
+ return ember$data$lib$system$promise$proxies$$promiseArray(Ember.RSVP.all(ember$data$lib$system$store$$map(ids, function(id) {
9390
9759
  return store.findById(type, id);
9391
9760
  })).then(Ember.A, null, "DS: Store#findByIds of " + type + " complete"));
9392
9761
  },
@@ -9409,7 +9778,7 @@
9409
9778
  Ember.assert("You tried to find a record but you have no adapter (for " + type + ")", adapter);
9410
9779
  Ember.assert("You tried to find a record but your adapter (for " + type + ") does not implement 'find'", typeof adapter.find === 'function');
9411
9780
 
9412
- var promise = ember$data$lib$system$store$$_find(adapter, this, type, id, record);
9781
+ var promise = ember$data$lib$system$store$finders$$_find(adapter, this, type, id, record);
9413
9782
  return promise;
9414
9783
  },
9415
9784
 
@@ -9468,11 +9837,18 @@
9468
9837
  resolver.resolve(record);
9469
9838
  }
9470
9839
  });
9840
+ return records;
9471
9841
  }
9472
9842
 
9473
9843
  function makeMissingRecordsRejector(requestedRecords) {
9474
9844
  return function rejectMissingRecords(resolvedRecords) {
9475
- var missingRecords = requestedRecords.without(resolvedRecords);
9845
+ resolvedRecords = Ember.A(resolvedRecords);
9846
+ var missingRecords = requestedRecords.reject(function(record) {
9847
+ return resolvedRecords.contains(record);
9848
+ });
9849
+ if (missingRecords.length) {
9850
+ Ember.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + Ember.inspect(Ember.A(missingRecords).mapBy('id')), false);
9851
+ }
9476
9852
  rejectRecords(missingRecords);
9477
9853
  };
9478
9854
  }
@@ -9496,12 +9872,26 @@
9496
9872
  if (recordResolverPairs.length === 1) {
9497
9873
  _fetchRecord(recordResolverPairs[0]);
9498
9874
  } else if (shouldCoalesce) {
9499
- var groups = adapter.groupRecordsForFindMany(this, records);
9500
- ember$data$lib$system$store$$forEach(groups, function (groupOfRecords) {
9875
+
9876
+ // TODO: Improve records => snapshots => records => snapshots
9877
+ //
9878
+ // We want to provide records to all store methods and snapshots to all
9879
+ // adapter methods. To make sure we're doing that we're providing an array
9880
+ // of snapshots to adapter.groupRecordsForFindMany(), which in turn will
9881
+ // return grouped snapshots instead of grouped records.
9882
+ //
9883
+ // But since the _findMany() finder is a store method we need to get the
9884
+ // records from the grouped snapshots even though the _findMany() finder
9885
+ // will once again convert the records to snapshots for adapter.findMany()
9886
+
9887
+ var snapshots = Ember.A(records).invoke('_createSnapshot');
9888
+ var groups = adapter.groupRecordsForFindMany(this, snapshots);
9889
+ ember$data$lib$system$store$$forEach(groups, function (groupOfSnapshots) {
9890
+ var groupOfRecords = Ember.A(groupOfSnapshots).mapBy('record');
9501
9891
  var requestedRecords = Ember.A(groupOfRecords);
9502
9892
  var ids = requestedRecords.mapBy('id');
9503
9893
  if (ids.length > 1) {
9504
- ember$data$lib$system$store$$_findMany(adapter, store, type, ids, requestedRecords).
9894
+ ember$data$lib$system$store$finders$$_findMany(adapter, store, type, ids, requestedRecords).
9505
9895
  then(resolveFoundRecords).
9506
9896
  then(makeMissingRecordsRejector(requestedRecords)).
9507
9897
  then(null, makeRecordsRejector(requestedRecords));
@@ -9580,7 +9970,8 @@
9580
9970
  hasRecordForId: function(typeName, inputId) {
9581
9971
  var type = this.modelFor(typeName);
9582
9972
  var id = ember$data$lib$system$store$$coerceId(inputId);
9583
- return !!this.typeMapFor(type).idToRecord[id];
9973
+ var record = this.typeMapFor(type).idToRecord[id];
9974
+ return !!record && ember$data$lib$system$store$$get(record, 'isLoaded');
9584
9975
  },
9585
9976
 
9586
9977
  /**
@@ -9647,7 +10038,7 @@
9647
10038
  Ember.assert("You tried to load a hasMany relationship but you have no adapter (for " + owner.constructor + ")", adapter);
9648
10039
  Ember.assert("You tried to load a hasMany relationship from a specified `link` in the original payload but your adapter does not implement `findHasMany`", typeof adapter.findHasMany === 'function');
9649
10040
 
9650
- return ember$data$lib$system$store$$_findHasMany(adapter, this, owner, link, type);
10041
+ return ember$data$lib$system$store$finders$$_findHasMany(adapter, this, owner, link, type);
9651
10042
  },
9652
10043
 
9653
10044
  /**
@@ -9664,7 +10055,7 @@
9664
10055
  Ember.assert("You tried to load a belongsTo relationship but you have no adapter (for " + owner.constructor + ")", adapter);
9665
10056
  Ember.assert("You tried to load a belongsTo relationship from a specified `link` in the original payload but your adapter does not implement `findBelongsTo`", typeof adapter.findBelongsTo === 'function');
9666
10057
 
9667
- return ember$data$lib$system$store$$_findBelongsTo(adapter, this, owner, link, relationship);
10058
+ return ember$data$lib$system$store$finders$$_findBelongsTo(adapter, this, owner, link, relationship);
9668
10059
  },
9669
10060
 
9670
10061
  /**
@@ -9694,7 +10085,7 @@
9694
10085
  Ember.assert("You tried to load a query but you have no adapter (for " + type + ")", adapter);
9695
10086
  Ember.assert("You tried to load a query but your adapter does not implement `findQuery`", typeof adapter.findQuery === 'function');
9696
10087
 
9697
- return ember$data$lib$system$promise_proxies$$promiseArray(ember$data$lib$system$store$$_findQuery(adapter, this, type, query, array));
10088
+ return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findQuery(adapter, this, type, query, array));
9698
10089
  },
9699
10090
 
9700
10091
  /**
@@ -9727,7 +10118,7 @@
9727
10118
  Ember.assert("You tried to load all records but you have no adapter (for " + type + ")", adapter);
9728
10119
  Ember.assert("You tried to load all records but your adapter does not implement `findAll`", typeof adapter.findAll === 'function');
9729
10120
 
9730
- return ember$data$lib$system$promise_proxies$$promiseArray(ember$data$lib$system$store$$_findAll(adapter, this, type, sinceToken));
10121
+ return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, type, sinceToken));
9731
10122
  },
9732
10123
 
9733
10124
  /**
@@ -9879,7 +10270,7 @@
9879
10270
 
9880
10271
  promise = promise || ember$data$lib$system$store$$Promise.cast(array);
9881
10272
 
9882
- return ember$data$lib$system$promise_proxies$$promiseArray(promise.then(function() {
10273
+ return ember$data$lib$system$promise$proxies$$promiseArray(promise.then(function() {
9883
10274
  return array;
9884
10275
  }, null, "DS: Store#filter of " + type));
9885
10276
  },
@@ -9941,7 +10332,6 @@
9941
10332
  If the adapter updates attributes the record will notify
9942
10333
  the store to update its membership in any filters.
9943
10334
  To avoid thrashing, this method is invoked only once per
9944
-
9945
10335
  run loop per record.
9946
10336
 
9947
10337
  @method dataWasUpdated
@@ -10129,6 +10519,38 @@
10129
10519
  return record;
10130
10520
  },
10131
10521
 
10522
+ /*
10523
+ In case someone defined a relationship to a mixin, for example:
10524
+ ```
10525
+ var Comment = DS.Model.extend({
10526
+ owner: belongsTo('commentable'. { polymorphic: true})
10527
+ });
10528
+ var Commentable = Ember.Mixin.create({
10529
+ comments: hasMany('comment')
10530
+ });
10531
+ ```
10532
+ we want to look up a Commentable class which has all the necessary
10533
+ relationship metadata. Thus, we look up the mixin and create a mock
10534
+ DS.Model, so we can access the relationship CPs of the mixin (`comments`)
10535
+ in this case
10536
+ */
10537
+
10538
+ _modelForMixin: function(key) {
10539
+ var registry = this.container._registry ? this.container._registry : this.container;
10540
+ var mixin = registry.resolve('mixin:' + key);
10541
+ if (mixin) {
10542
+ //Cache the class as a model
10543
+ registry.register('model:' + key, DS.Model.extend(mixin));
10544
+ }
10545
+ var factory = this.modelFactoryFor(key);
10546
+ if (factory) {
10547
+ factory.__isMixin = true;
10548
+ factory.__mixin = mixin;
10549
+ }
10550
+
10551
+ return factory;
10552
+ },
10553
+
10132
10554
  /**
10133
10555
  Returns a model class for a particular key. Used by
10134
10556
  methods that take a type key (like `find`, `createRecord`,
@@ -10143,6 +10565,10 @@
10143
10565
 
10144
10566
  if (typeof key === 'string') {
10145
10567
  factory = this.modelFactoryFor(key);
10568
+ if (!factory) {
10569
+ //Support looking up mixins as base types for polymorphic relationships
10570
+ factory = this._modelForMixin(key);
10571
+ }
10146
10572
  if (!factory) {
10147
10573
  throw new Ember.Error("No model was found for '" + key + "'");
10148
10574
  }
@@ -10335,7 +10761,7 @@
10335
10761
  serializer = this.serializerFor(type);
10336
10762
  }
10337
10763
  var store = this;
10338
- ember$data$lib$system$store$$_adapterRun(this, function() {
10764
+ this._adapterRun(function() {
10339
10765
  serializer.pushPayload(store, payload);
10340
10766
  });
10341
10767
  },
@@ -10498,24 +10924,34 @@
10498
10924
  // ......................
10499
10925
 
10500
10926
  /**
10501
- Returns the adapter for a given type.
10927
+ Returns an instance of the adapter for a given type. For
10928
+ example, `adapterFor('person')` will return an instance of
10929
+ `App.PersonAdapter`.
10930
+
10931
+ If no `App.PersonAdapter` is found, this method will look
10932
+ for an `App.ApplicationAdapter` (the default adapter for
10933
+ your entire application).
10934
+
10935
+ If no `App.ApplicationAdapter` is found, it will return
10936
+ the value of the `defaultAdapter`.
10502
10937
 
10503
10938
  @method adapterFor
10504
10939
  @private
10505
- @param {subclass of DS.Model} type
10940
+ @param {String or subclass of DS.Model} type
10506
10941
  @return DS.Adapter
10507
10942
  */
10508
10943
  adapterFor: function(type) {
10509
- var adapter;
10510
- var container = this.container;
10944
+ type = this.modelFor(type);
10511
10945
 
10512
- if (container) {
10513
- adapter = container.lookup('adapter:' + type.typeKey) || container.lookup('adapter:application');
10514
- }
10946
+ var adapter = this.lookupAdapter(type.typeKey) || this.lookupAdapter('application');
10515
10947
 
10516
10948
  return adapter || ember$data$lib$system$store$$get(this, 'defaultAdapter');
10517
10949
  },
10518
10950
 
10951
+ _adapterRun: function (fn) {
10952
+ return this._backburner.run(fn);
10953
+ },
10954
+
10519
10955
  // ..............................
10520
10956
  // . RECORD CHANGE NOTIFICATION .
10521
10957
  // ..............................
@@ -10529,19 +10965,70 @@
10529
10965
  for an `App.ApplicationSerializer` (the default serializer for
10530
10966
  your entire application).
10531
10967
 
10532
- If no `App.ApplicationSerializer` is found, it will fall back
10968
+ if no `App.ApplicationSerializer` is found, it will attempt
10969
+ to get the `defaultSerializer` from the `PersonAdapter`
10970
+ (`adapterFor('person')`).
10971
+
10972
+ If a serializer cannot be found on the adapter, it will fall back
10533
10973
  to an instance of `DS.JSONSerializer`.
10534
10974
 
10535
10975
  @method serializerFor
10536
10976
  @private
10537
- @param {String} type the record to serialize
10977
+ @param {String or subclass of DS.Model} type the record to serialize
10538
10978
  @return {DS.Serializer}
10539
10979
  */
10540
10980
  serializerFor: function(type) {
10541
10981
  type = this.modelFor(type);
10542
- var adapter = this.adapterFor(type);
10543
10982
 
10544
- return ember$data$lib$system$store$$serializerFor(this.container, type.typeKey, adapter && adapter.defaultSerializer);
10983
+ var serializer = this.lookupSerializer(type.typeKey) || this.lookupSerializer('application');
10984
+
10985
+ if (!serializer) {
10986
+ var adapter = this.adapterFor(type);
10987
+ serializer = this.lookupSerializer(ember$data$lib$system$store$$get(adapter, 'defaultSerializer'));
10988
+ }
10989
+
10990
+ if (!serializer) {
10991
+ serializer = this.lookupSerializer('-default');
10992
+ }
10993
+
10994
+ return serializer;
10995
+ },
10996
+
10997
+ /**
10998
+ Retrieve a particular instance from the
10999
+ container cache. If not found, creates it and
11000
+ placing it in the cache.
11001
+
11002
+ Enabled a store to manage local instances of
11003
+ adapters and serializers.
11004
+
11005
+ @method retrieveManagedInstance
11006
+ @private
11007
+ @param {String} type the object type
11008
+ @param {String} type the object name
11009
+ @return {Ember.Object}
11010
+ */
11011
+ retrieveManagedInstance: function(type, name) {
11012
+ var key = type+":"+name;
11013
+
11014
+ if (!this._containerCache[key]) {
11015
+ var instance = this.container.lookup(key);
11016
+
11017
+ if (instance) {
11018
+ ember$data$lib$system$store$$set(instance, 'store', this);
11019
+ this._containerCache[key] = instance;
11020
+ }
11021
+ }
11022
+
11023
+ return this._containerCache[key];
11024
+ },
11025
+
11026
+ lookupAdapter: function(name) {
11027
+ return this.retrieveManagedInstance('adapter', name);
11028
+ },
11029
+
11030
+ lookupSerializer: function(name) {
11031
+ return this.retrieveManagedInstance('serializer', name);
10545
11032
  },
10546
11033
 
10547
11034
  willDestroy: function() {
@@ -10558,6 +11045,12 @@
10558
11045
  return typeMaps[entry]['type'];
10559
11046
  }
10560
11047
 
11048
+ for (var cacheKey in this._containerCache) {
11049
+ this._containerCache[cacheKey].destroy();
11050
+ delete this._containerCache[cacheKey];
11051
+ }
11052
+
11053
+ delete this._containerCache;
10561
11054
  },
10562
11055
 
10563
11056
  /**
@@ -10590,7 +11083,7 @@
10590
11083
  }
10591
11084
 
10592
11085
  function ember$data$lib$system$store$$deserializeRecordId(store, data, key, relationship, id) {
10593
- if (ember$data$lib$system$store$$isNone(id) || id instanceof ember$data$lib$system$model$model$$default) {
11086
+ if (ember$data$lib$system$store$$isNone(id) || id instanceof ember$data$lib$system$model$$default) {
10594
11087
  return;
10595
11088
  }
10596
11089
  Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being " + Ember.inspect(id) + ", but " + key + " is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.", !Ember.isArray(id));
@@ -10629,217 +11122,29 @@
10629
11122
  // Delegation to the adapter and promise management
10630
11123
 
10631
11124
 
10632
- function ember$data$lib$system$store$$serializerFor(container, type, defaultSerializer) {
10633
- return container.lookup('serializer:'+type) ||
10634
- container.lookup('serializer:application') ||
10635
- container.lookup('serializer:' + defaultSerializer) ||
10636
- container.lookup('serializer:-default');
10637
- }
10638
11125
 
10639
11126
  function ember$data$lib$system$store$$defaultSerializer(container) {
10640
11127
  return container.lookup('serializer:application') ||
10641
11128
  container.lookup('serializer:-default');
10642
11129
  }
10643
11130
 
10644
- function ember$data$lib$system$store$$serializerForAdapter(adapter, type) {
10645
- var serializer = adapter.serializer;
10646
- var defaultSerializer = adapter.defaultSerializer;
10647
- var container = adapter.container;
10648
-
10649
- if (container && serializer === undefined) {
10650
- serializer = ember$data$lib$system$store$$serializerFor(container, type.typeKey, defaultSerializer);
10651
- }
10652
-
10653
- if (serializer === null || serializer === undefined) {
10654
- serializer = {
10655
- extract: function(store, type, payload) { return payload; }
10656
- };
10657
- }
10658
-
10659
- return serializer;
10660
- }
10661
-
10662
- function ember$data$lib$system$store$$_objectIsAlive(object) {
10663
- return !(ember$data$lib$system$store$$get(object, "isDestroyed") || ember$data$lib$system$store$$get(object, "isDestroying"));
10664
- }
10665
-
10666
- function ember$data$lib$system$store$$_guard(promise, test) {
10667
- var guarded = promise['finally'](function() {
10668
- if (!test()) {
10669
- guarded._subscribers.length = 0;
10670
- }
10671
- });
10672
-
10673
- return guarded;
10674
- }
10675
-
10676
- function ember$data$lib$system$store$$_adapterRun(store, fn) {
10677
- return store._backburner.run(fn);
10678
- }
10679
-
10680
- function ember$data$lib$system$store$$_bind(fn) {
10681
- var args = Array.prototype.slice.call(arguments, 1);
10682
-
10683
- return function() {
10684
- return fn.apply(undefined, args);
10685
- };
10686
- }
10687
-
10688
- function ember$data$lib$system$store$$_find(adapter, store, type, id, record) {
10689
- var promise = adapter.find(store, type, id, record);
10690
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, type);
10691
- var label = "DS: Handle Adapter#find of " + type + " with id: " + id;
10692
-
10693
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10694
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10695
-
10696
- return promise.then(function(adapterPayload) {
10697
- Ember.assert("You made a request for a " + type.typeKey + " with id " + id + ", but the adapter's response did not have any data", adapterPayload);
10698
- return ember$data$lib$system$store$$_adapterRun(store, function() {
10699
- var payload = serializer.extract(store, type, adapterPayload, id, 'find');
10700
-
10701
- return store.push(type, payload);
10702
- });
10703
- }, function(error) {
10704
- var record = store.getById(type, id);
10705
- if (record) {
10706
- record.notFound();
10707
- if (ember$data$lib$system$store$$get(record, 'isEmpty')) {
10708
- store.unloadRecord(record);
10709
- }
10710
- }
10711
- throw error;
10712
- }, "DS: Extract payload of '" + type + "'");
10713
- }
10714
-
10715
-
10716
- function ember$data$lib$system$store$$_findMany(adapter, store, type, ids, records) {
10717
- var promise = adapter.findMany(store, type, ids, records);
10718
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, type);
10719
- var label = "DS: Handle Adapter#findMany of " + type;
10720
-
10721
- if (promise === undefined) {
10722
- throw new Error('adapter.findMany returned undefined, this was very likely a mistake');
10723
- }
10724
-
10725
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10726
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10727
-
10728
- return promise.then(function(adapterPayload) {
10729
- return ember$data$lib$system$store$$_adapterRun(store, function() {
10730
- var payload = serializer.extract(store, type, adapterPayload, null, 'findMany');
10731
-
10732
- Ember.assert("The response from a findMany must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
10733
-
10734
- return store.pushMany(type, payload);
10735
- });
10736
- }, null, "DS: Extract payload of " + type);
10737
- }
10738
-
10739
- function ember$data$lib$system$store$$_findHasMany(adapter, store, record, link, relationship) {
10740
- var promise = adapter.findHasMany(store, record, link, relationship);
10741
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, relationship.type);
10742
- var label = "DS: Handle Adapter#findHasMany of " + record + " : " + relationship.type;
10743
-
10744
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10745
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10746
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, record));
10747
-
10748
- return promise.then(function(adapterPayload) {
10749
- return ember$data$lib$system$store$$_adapterRun(store, function() {
10750
- var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findHasMany');
10751
-
10752
- Ember.assert("The response from a findHasMany must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
10753
-
10754
- var records = store.pushMany(relationship.type, payload);
10755
- return records;
10756
- });
10757
- }, null, "DS: Extract payload of " + record + " : hasMany " + relationship.type);
10758
- }
10759
-
10760
- function ember$data$lib$system$store$$_findBelongsTo(adapter, store, record, link, relationship) {
10761
- var promise = adapter.findBelongsTo(store, record, link, relationship);
10762
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, relationship.type);
10763
- var label = "DS: Handle Adapter#findBelongsTo of " + record + " : " + relationship.type;
10764
-
10765
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10766
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10767
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, record));
10768
-
10769
- return promise.then(function(adapterPayload) {
10770
- return ember$data$lib$system$store$$_adapterRun(store, function() {
10771
- var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findBelongsTo');
10772
-
10773
- if (!payload) {
10774
- return null;
10775
- }
10776
-
10777
- var record = store.push(relationship.type, payload);
10778
- return record;
10779
- });
10780
- }, null, "DS: Extract payload of " + record + " : " + relationship.type);
10781
- }
10782
-
10783
- function ember$data$lib$system$store$$_findAll(adapter, store, type, sinceToken) {
10784
- var promise = adapter.findAll(store, type, sinceToken);
10785
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, type);
10786
- var label = "DS: Handle Adapter#findAll of " + type;
10787
-
10788
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10789
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10790
-
10791
- return promise.then(function(adapterPayload) {
10792
- ember$data$lib$system$store$$_adapterRun(store, function() {
10793
- var payload = serializer.extract(store, type, adapterPayload, null, 'findAll');
10794
-
10795
- Ember.assert("The response from a findAll must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
10796
-
10797
- store.pushMany(type, payload);
10798
- });
10799
-
10800
- store.didUpdateAll(type);
10801
- return store.all(type);
10802
- }, null, "DS: Extract payload of findAll " + type);
10803
- }
10804
-
10805
- function ember$data$lib$system$store$$_findQuery(adapter, store, type, query, recordArray) {
10806
- var promise = adapter.findQuery(store, type, query, recordArray);
10807
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, type);
10808
- var label = "DS: Handle Adapter#findQuery of " + type;
10809
-
10810
- promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10811
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10812
-
10813
- return promise.then(function(adapterPayload) {
10814
- var payload;
10815
- ember$data$lib$system$store$$_adapterRun(store, function() {
10816
- payload = serializer.extract(store, type, adapterPayload, null, 'findQuery');
10817
-
10818
- Ember.assert("The response from a findQuery must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
10819
- });
10820
-
10821
- recordArray.load(payload);
10822
- return recordArray;
10823
-
10824
- }, null, "DS: Extract payload of findQuery " + type);
10825
- }
10826
-
10827
11131
  function ember$data$lib$system$store$$_commit(adapter, store, operation, record) {
10828
11132
  var type = record.constructor;
10829
- var promise = adapter[operation](store, type, record);
10830
- var serializer = ember$data$lib$system$store$$serializerForAdapter(adapter, type);
11133
+ var snapshot = record._createSnapshot();
11134
+ var promise = adapter[operation](store, type, snapshot);
11135
+ var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type);
10831
11136
  var label = "DS: Extract and notify about " + operation + " completion of " + record;
10832
11137
 
10833
11138
  Ember.assert("Your adapter's '" + operation + "' method must return a value, but it returned `undefined", promise !==undefined);
10834
11139
 
10835
11140
  promise = ember$data$lib$system$store$$Promise.cast(promise, label);
10836
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, store));
10837
- promise = ember$data$lib$system$store$$_guard(promise, ember$data$lib$system$store$$_bind(ember$data$lib$system$store$$_objectIsAlive, record));
11141
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
11142
+ promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, record));
10838
11143
 
10839
11144
  return promise.then(function(adapterPayload) {
10840
11145
  var payload;
10841
11146
 
10842
- ember$data$lib$system$store$$_adapterRun(store, function() {
11147
+ store._adapterRun(function() {
10843
11148
  if (adapterPayload) {
10844
11149
  payload = serializer.extract(store, type, adapterPayload, ember$data$lib$system$store$$get(record, 'id'), operation);
10845
11150
  } else {
@@ -10886,15 +11191,18 @@
10886
11191
  }
10887
11192
 
10888
11193
  var ember$data$lib$system$store$$default = ember$data$lib$system$store$$Store;
10889
- function ember$data$lib$initializers$store$$initializeStore(container, application) {
11194
+ function ember$data$lib$initializers$store$$initializeStore(registry, application) {
10890
11195
  Ember.deprecate('Specifying a custom Store for Ember Data on your global namespace as `App.Store` ' +
10891
11196
  'has been deprecated. Please use `App.ApplicationStore` instead.', !(application && application.Store));
10892
11197
 
10893
- container.register('store:main', container.lookupFactory('store:application') || (application && application.Store) || ember$data$lib$system$store$$default);
11198
+ registry.optionsForType('serializer', { singleton: false });
11199
+ registry.optionsForType('adapter', { singleton: false });
11200
+
11201
+ registry.register('store:main', registry.lookupFactory('store:application') || (application && application.Store) || ember$data$lib$system$store$$default);
10894
11202
 
10895
11203
  // allow older names to be looked up
10896
11204
 
10897
- var proxy = new ember$data$lib$system$container_proxy$$default(container);
11205
+ var proxy = new ember$data$lib$system$container$proxy$$default(registry);
10898
11206
  proxy.registerDeprecations([
10899
11207
  { deprecated: 'serializer:_default', valid: 'serializer:-default' },
10900
11208
  { deprecated: 'serializer:_rest', valid: 'serializer:-rest' },
@@ -10902,13 +11210,14 @@
10902
11210
  ]);
10903
11211
 
10904
11212
  // new go forward paths
10905
- container.register('serializer:-default', ember$data$lib$serializers$json_serializer$$default);
10906
- container.register('serializer:-rest', ember$data$lib$serializers$rest_serializer$$default);
10907
- container.register('adapter:-rest', ember$data$lib$adapters$rest_adapter$$default);
11213
+ registry.register('serializer:-default', ember$data$lib$serializers$json$serializer$$default);
11214
+ registry.register('serializer:-rest', ember$data$lib$serializers$rest$serializer$$default);
11215
+ registry.register('adapter:-rest', ember$data$lib$adapters$rest$adapter$$default);
10908
11216
 
10909
11217
  // Eagerly generate the store so defaultStore is populated.
10910
11218
  // TODO: Do this in a finisher hook
10911
- container.lookup('store:main');
11219
+ var store = registry.lookup('store:main');
11220
+ registry.register('service:store', store, { instantiate: false });
10912
11221
  }
10913
11222
  var ember$data$lib$initializers$store$$default = ember$data$lib$initializers$store$$initializeStore;
10914
11223
 
@@ -10929,7 +11238,7 @@
10929
11238
  @param {mixed} deserialized The deserialized value
10930
11239
  @return {mixed} The serialized value
10931
11240
  */
10932
- serialize: Ember.required(),
11241
+ serialize: null,
10933
11242
 
10934
11243
  /**
10935
11244
  When given a serialize value from a JSON object this method must
@@ -10947,7 +11256,7 @@
10947
11256
  @param {mixed} serialized The serialized value
10948
11257
  @return {mixed} The deserialized value
10949
11258
  */
10950
- deserialize: Ember.required()
11259
+ deserialize: null
10951
11260
  });
10952
11261
 
10953
11262
  var ember$data$lib$transforms$number$$empty = Ember.isEmpty;
@@ -11065,25 +11374,24 @@
11065
11374
  }
11066
11375
  });
11067
11376
 
11068
- function ember$data$lib$initializers$transforms$$initializeTransforms(container) {
11069
- container.register('transform:boolean', ember$data$lib$transforms$boolean$$default);
11070
- container.register('transform:date', ember$data$lib$transforms$date$$default);
11071
- container.register('transform:number', ember$data$lib$transforms$number$$default);
11072
- container.register('transform:string', ember$data$lib$transforms$string$$default);
11377
+ function ember$data$lib$initializers$transforms$$initializeTransforms(registry) {
11378
+ registry.register('transform:boolean', ember$data$lib$transforms$boolean$$default);
11379
+ registry.register('transform:date', ember$data$lib$transforms$date$$default);
11380
+ registry.register('transform:number', ember$data$lib$transforms$number$$default);
11381
+ registry.register('transform:string', ember$data$lib$transforms$string$$default);
11073
11382
  }
11074
11383
  var ember$data$lib$initializers$transforms$$default = ember$data$lib$initializers$transforms$$initializeTransforms;
11075
- function ember$data$lib$initializers$store_injections$$initializeStoreInjections(container) {
11076
- container.injection('controller', 'store', 'store:main');
11077
- container.injection('route', 'store', 'store:main');
11078
- container.injection('serializer', 'store', 'store:main');
11079
- container.injection('data-adapter', 'store', 'store:main');
11384
+ function ember$data$lib$initializers$store$injections$$initializeStoreInjections(registry) {
11385
+ registry.injection('controller', 'store', 'store:main');
11386
+ registry.injection('route', 'store', 'store:main');
11387
+ registry.injection('data-adapter', 'store', 'store:main');
11080
11388
  }
11081
- var ember$data$lib$initializers$store_injections$$default = ember$data$lib$initializers$store_injections$$initializeStoreInjections;
11082
- var ember$data$lib$system$debug$debug_adapter$$get = Ember.get;
11083
- var ember$data$lib$system$debug$debug_adapter$$capitalize = Ember.String.capitalize;
11084
- var ember$data$lib$system$debug$debug_adapter$$underscore = Ember.String.underscore;
11389
+ var ember$data$lib$initializers$store$injections$$default = ember$data$lib$initializers$store$injections$$initializeStoreInjections;
11390
+ var ember$data$lib$system$debug$debug$adapter$$get = Ember.get;
11391
+ var ember$data$lib$system$debug$debug$adapter$$capitalize = Ember.String.capitalize;
11392
+ var ember$data$lib$system$debug$debug$adapter$$underscore = Ember.String.underscore;
11085
11393
 
11086
- var ember$data$lib$system$debug$debug_adapter$$default = Ember.DataAdapter.extend({
11394
+ var ember$data$lib$system$debug$debug$adapter$$default = Ember.DataAdapter.extend({
11087
11395
  getFilters: function() {
11088
11396
  return [
11089
11397
  { name: 'isNew', desc: 'New' },
@@ -11093,7 +11401,7 @@
11093
11401
  },
11094
11402
 
11095
11403
  detect: function(klass) {
11096
- return klass !== ember$data$lib$system$model$model$$default && ember$data$lib$system$model$model$$default.detect(klass);
11404
+ return klass !== ember$data$lib$system$model$$default && ember$data$lib$system$model$$default.detect(klass);
11097
11405
  },
11098
11406
 
11099
11407
  columnsForType: function(type) {
@@ -11103,9 +11411,9 @@
11103
11411
  }];
11104
11412
  var count = 0;
11105
11413
  var self = this;
11106
- ember$data$lib$system$debug$debug_adapter$$get(type, 'attributes').forEach(function(meta, name) {
11414
+ ember$data$lib$system$debug$debug$adapter$$get(type, 'attributes').forEach(function(meta, name) {
11107
11415
  if (count++ > self.attributeLimit) { return false; }
11108
- var desc = ember$data$lib$system$debug$debug_adapter$$capitalize(ember$data$lib$system$debug$debug_adapter$$underscore(name).replace('_', ' '));
11416
+ var desc = ember$data$lib$system$debug$debug$adapter$$capitalize(ember$data$lib$system$debug$debug$adapter$$underscore(name).replace('_', ' '));
11109
11417
  columns.push({ name: name, desc: desc });
11110
11418
  });
11111
11419
  return columns;
@@ -11118,13 +11426,13 @@
11118
11426
  getRecordColumnValues: function(record) {
11119
11427
  var self = this;
11120
11428
  var count = 0;
11121
- var columnValues = { id: ember$data$lib$system$debug$debug_adapter$$get(record, 'id') };
11429
+ var columnValues = { id: ember$data$lib$system$debug$debug$adapter$$get(record, 'id') };
11122
11430
 
11123
11431
  record.eachAttribute(function(key) {
11124
11432
  if (count++ > self.attributeLimit) {
11125
11433
  return false;
11126
11434
  }
11127
- var value = ember$data$lib$system$debug$debug_adapter$$get(record, key);
11435
+ var value = ember$data$lib$system$debug$debug$adapter$$get(record, key);
11128
11436
  columnValues[key] = value;
11129
11437
  });
11130
11438
  return columnValues;
@@ -11137,7 +11445,7 @@
11137
11445
  keys.push(key);
11138
11446
  });
11139
11447
  keys.forEach(function(key) {
11140
- keywords.push(ember$data$lib$system$debug$debug_adapter$$get(record, key));
11448
+ keywords.push(ember$data$lib$system$debug$debug$adapter$$get(record, key));
11141
11449
  });
11142
11450
  return keywords;
11143
11451
  },
@@ -11188,18 +11496,18 @@
11188
11496
 
11189
11497
  });
11190
11498
 
11191
- function ember$data$lib$initializers$data_adapter$$initializeDebugAdapter(container) {
11192
- container.register('data-adapter:main', ember$data$lib$system$debug$debug_adapter$$default);
11499
+ function ember$data$lib$initializers$data$adapter$$initializeDebugAdapter(registry) {
11500
+ registry.register('data-adapter:main', ember$data$lib$system$debug$debug$adapter$$default);
11193
11501
  }
11194
- var ember$data$lib$initializers$data_adapter$$default = ember$data$lib$initializers$data_adapter$$initializeDebugAdapter;
11502
+ var ember$data$lib$initializers$data$adapter$$default = ember$data$lib$initializers$data$adapter$$initializeDebugAdapter;
11195
11503
  function ember$data$lib$setup$container$$setupContainer(container, application) {
11196
11504
  // application is not a required argument. This ensures
11197
11505
  // testing setups can setup a container without booting an
11198
11506
  // entire ember application.
11199
11507
 
11200
- ember$data$lib$initializers$data_adapter$$default(container, application);
11508
+ ember$data$lib$initializers$data$adapter$$default(container, application);
11201
11509
  ember$data$lib$initializers$transforms$$default(container, application);
11202
- ember$data$lib$initializers$store_injections$$default(container, application);
11510
+ ember$data$lib$initializers$store$injections$$default(container, application);
11203
11511
  ember$data$lib$initializers$store$$default(container, application);
11204
11512
  activemodel$adapter$lib$setup$container$$default(container, application);
11205
11513
  }
@@ -11282,21 +11590,6 @@
11282
11590
  initialize: ember$data$lib$ember$initializer$$K
11283
11591
  });
11284
11592
  });
11285
- /**
11286
- @module ember-data
11287
- */
11288
-
11289
- /**
11290
- Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
11291
-
11292
- © 2011 Colin Snover <http://zetafleet.com>
11293
-
11294
- Released under MIT license.
11295
-
11296
- @class Date
11297
- @namespace Ember
11298
- @static
11299
- */
11300
11593
  Ember.Date = Ember.Date || {};
11301
11594
 
11302
11595
  var origParse = Date.parse;
@@ -11345,7 +11638,7 @@
11345
11638
  Date.parse = Ember.Date.parse;
11346
11639
  }
11347
11640
 
11348
- ember$data$lib$system$model$model$$default.reopen({
11641
+ ember$data$lib$system$model$$default.reopen({
11349
11642
 
11350
11643
  /**
11351
11644
  Provides info about the model for debugging purposes
@@ -11411,11 +11704,11 @@
11411
11704
  }
11412
11705
  });
11413
11706
 
11414
- var ember$data$lib$system$debug$debug_info$$default = ember$data$lib$system$model$model$$default;
11415
- var ember$data$lib$system$debug$$default = ember$data$lib$system$debug$debug_adapter$$default;
11416
- var ember$data$lib$serializers$embedded_records_mixin$$get = Ember.get;
11417
- var ember$data$lib$serializers$embedded_records_mixin$$forEach = Ember.EnumerableUtils.forEach;
11418
- var ember$data$lib$serializers$embedded_records_mixin$$camelize = Ember.String.camelize;
11707
+ var ember$data$lib$system$debug$debug$info$$default = ember$data$lib$system$model$$default;
11708
+ var ember$data$lib$system$debug$$default = ember$data$lib$system$debug$debug$adapter$$default;
11709
+ var ember$data$lib$serializers$embedded$records$mixin$$get = Ember.get;
11710
+ var ember$data$lib$serializers$embedded$records$mixin$$forEach = Ember.EnumerableUtils.forEach;
11711
+ var ember$data$lib$serializers$embedded$records$mixin$$camelize = Ember.String.camelize;
11419
11712
 
11420
11713
  /**
11421
11714
  ## Using Embedded Records
@@ -11504,7 +11797,7 @@
11504
11797
  @class EmbeddedRecordsMixin
11505
11798
  @namespace DS
11506
11799
  */
11507
- var ember$data$lib$serializers$embedded_records_mixin$$EmbeddedRecordsMixin = Ember.Mixin.create({
11800
+ var ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin = Ember.Mixin.create({
11508
11801
 
11509
11802
  /**
11510
11803
  Normalize the record and recursively normalize/extract all the embedded records
@@ -11535,7 +11828,7 @@
11535
11828
  **/
11536
11829
  normalize: function(type, hash, prop) {
11537
11830
  var normalizedHash = this._super(type, hash, prop);
11538
- return ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedRecords(this, this.store, type, normalizedHash);
11831
+ return ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedRecords(this, this.store, type, normalizedHash);
11539
11832
  },
11540
11833
 
11541
11834
  keyForRelationship: function(key, type) {
@@ -11794,29 +12087,29 @@
11794
12087
 
11795
12088
  attrsOption: function(attr) {
11796
12089
  var attrs = this.get('attrs');
11797
- return attrs && (attrs[ember$data$lib$serializers$embedded_records_mixin$$camelize(attr)] || attrs[attr]);
12090
+ return attrs && (attrs[ember$data$lib$serializers$embedded$records$mixin$$camelize(attr)] || attrs[attr]);
11798
12091
  }
11799
12092
  });
11800
12093
 
11801
12094
  // chooses a relationship kind to branch which function is used to update payload
11802
12095
  // does not change payload if attr is not embedded
11803
- function ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedRecords(serializer, store, type, partial) {
12096
+ function ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedRecords(serializer, store, type, partial) {
11804
12097
 
11805
12098
  type.eachRelationship(function(key, relationship) {
11806
12099
  if (serializer.hasDeserializeRecordsOption(key)) {
11807
12100
  var embeddedType = store.modelFor(relationship.type.typeKey);
11808
12101
  if (relationship.kind === "hasMany") {
11809
12102
  if (relationship.options.polymorphic) {
11810
- ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedHasManyPolymorphic(store, key, partial);
12103
+ ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedHasManyPolymorphic(store, key, partial);
11811
12104
  } else {
11812
- ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedHasMany(store, key, embeddedType, partial);
12105
+ ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedHasMany(store, key, embeddedType, partial);
11813
12106
  }
11814
12107
  }
11815
12108
  if (relationship.kind === "belongsTo") {
11816
12109
  if (relationship.options.polymorphic) {
11817
- ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedBelongsToPolymorphic(store, key, partial);
12110
+ ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedBelongsToPolymorphic(store, key, partial);
11818
12111
  } else {
11819
- ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedBelongsTo(store, key, embeddedType, partial);
12112
+ ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedBelongsTo(store, key, embeddedType, partial);
11820
12113
  }
11821
12114
  }
11822
12115
  }
@@ -11826,7 +12119,7 @@
11826
12119
  }
11827
12120
 
11828
12121
  // handles embedding for `hasMany` relationship
11829
- function ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedHasMany(store, key, embeddedType, hash) {
12122
+ function ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedHasMany(store, key, embeddedType, hash) {
11830
12123
  if (!hash[key]) {
11831
12124
  return hash;
11832
12125
  }
@@ -11834,7 +12127,7 @@
11834
12127
  var ids = [];
11835
12128
 
11836
12129
  var embeddedSerializer = store.serializerFor(embeddedType.typeKey);
11837
- ember$data$lib$serializers$embedded_records_mixin$$forEach(hash[key], function(data) {
12130
+ ember$data$lib$serializers$embedded$records$mixin$$forEach(hash[key], function(data) {
11838
12131
  var embeddedRecord = embeddedSerializer.normalize(embeddedType, data, null);
11839
12132
  store.push(embeddedType, embeddedRecord);
11840
12133
  ids.push(embeddedRecord.id);
@@ -11844,18 +12137,18 @@
11844
12137
  return hash;
11845
12138
  }
11846
12139
 
11847
- function ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedHasManyPolymorphic(store, key, hash) {
12140
+ function ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedHasManyPolymorphic(store, key, hash) {
11848
12141
  if (!hash[key]) {
11849
12142
  return hash;
11850
12143
  }
11851
12144
 
11852
12145
  var ids = [];
11853
12146
 
11854
- ember$data$lib$serializers$embedded_records_mixin$$forEach(hash[key], function(data) {
12147
+ ember$data$lib$serializers$embedded$records$mixin$$forEach(hash[key], function(data) {
11855
12148
  var typeKey = data.type;
11856
12149
  var embeddedSerializer = store.serializerFor(typeKey);
11857
12150
  var embeddedType = store.modelFor(typeKey);
11858
- var primaryKey = ember$data$lib$serializers$embedded_records_mixin$$get(embeddedSerializer, 'primaryKey');
12151
+ var primaryKey = ember$data$lib$serializers$embedded$records$mixin$$get(embeddedSerializer, 'primaryKey');
11859
12152
 
11860
12153
  var embeddedRecord = embeddedSerializer.normalize(embeddedType, data, null);
11861
12154
  store.push(embeddedType, embeddedRecord);
@@ -11866,7 +12159,7 @@
11866
12159
  return hash;
11867
12160
  }
11868
12161
 
11869
- function ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedBelongsTo(store, key, embeddedType, hash) {
12162
+ function ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedBelongsTo(store, key, embeddedType, hash) {
11870
12163
  if (!hash[key]) {
11871
12164
  return hash;
11872
12165
  }
@@ -11880,7 +12173,7 @@
11880
12173
  return hash;
11881
12174
  }
11882
12175
 
11883
- function ember$data$lib$serializers$embedded_records_mixin$$extractEmbeddedBelongsToPolymorphic(store, key, hash) {
12176
+ function ember$data$lib$serializers$embedded$records$mixin$$extractEmbeddedBelongsToPolymorphic(store, key, hash) {
11884
12177
  if (!hash[key]) {
11885
12178
  return hash;
11886
12179
  }
@@ -11889,7 +12182,7 @@
11889
12182
  var typeKey = data.type;
11890
12183
  var embeddedSerializer = store.serializerFor(typeKey);
11891
12184
  var embeddedType = store.modelFor(typeKey);
11892
- var primaryKey = ember$data$lib$serializers$embedded_records_mixin$$get(embeddedSerializer, 'primaryKey');
12185
+ var primaryKey = ember$data$lib$serializers$embedded$records$mixin$$get(embeddedSerializer, 'primaryKey');
11893
12186
 
11894
12187
  var embeddedRecord = embeddedSerializer.normalize(embeddedType, data, null);
11895
12188
  store.push(embeddedType, embeddedRecord);
@@ -11899,7 +12192,7 @@
11899
12192
  return hash;
11900
12193
  }
11901
12194
 
11902
- var ember$data$lib$serializers$embedded_records_mixin$$default = ember$data$lib$serializers$embedded_records_mixin$$EmbeddedRecordsMixin;
12195
+ var ember$data$lib$serializers$embedded$records$mixin$$default = ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin;
11903
12196
 
11904
12197
  /**
11905
12198
  `DS.belongsTo` is used to define One-To-One and One-To-Many
@@ -11959,7 +12252,7 @@
11959
12252
  @param {Object} options (optional) a hash of options
11960
12253
  @return {Ember.computed} relationship
11961
12254
  */
11962
- function ember$data$lib$system$relationships$belongs_to$$belongsTo(type, options) {
12255
+ function ember$data$lib$system$relationships$belongs$to$$belongsTo(type, options) {
11963
12256
  if (typeof type === 'object') {
11964
12257
  options = type;
11965
12258
  type = undefined;
@@ -11997,13 +12290,13 @@
11997
12290
  These observers observe all `belongsTo` relationships on the record. See
11998
12291
  `relationships/ext` to see how these observers get their dependencies.
11999
12292
  */
12000
- ember$data$lib$system$model$model$$default.reopen({
12293
+ ember$data$lib$system$model$$default.reopen({
12001
12294
  notifyBelongsToChanged: function(key) {
12002
12295
  this.notifyPropertyChange(key);
12003
12296
  }
12004
12297
  });
12005
12298
 
12006
- var ember$data$lib$system$relationships$belongs_to$$default = ember$data$lib$system$relationships$belongs_to$$belongsTo;
12299
+ var ember$data$lib$system$relationships$belongs$to$$default = ember$data$lib$system$relationships$belongs$to$$belongsTo;
12007
12300
 
12008
12301
  /**
12009
12302
  `DS.hasMany` is used to define One-To-Many and Many-To-Many
@@ -12094,7 +12387,7 @@
12094
12387
  @param {Object} options (optional) a hash of options
12095
12388
  @return {Ember.computed} relationship
12096
12389
  */
12097
- function ember$data$lib$system$relationships$has_many$$hasMany(type, options) {
12390
+ function ember$data$lib$system$relationships$has$many$$hasMany(type, options) {
12098
12391
  if (typeof type === 'object') {
12099
12392
  options = type;
12100
12393
  type = undefined;
@@ -12122,7 +12415,7 @@
12122
12415
  }).meta(meta).readOnly();
12123
12416
  }
12124
12417
 
12125
- ember$data$lib$system$model$model$$default.reopen({
12418
+ ember$data$lib$system$model$$default.reopen({
12126
12419
  notifyHasManyAdded: function(key) {
12127
12420
  //We need to notifyPropertyChange in the adding case because we need to make sure
12128
12421
  //we fetch the newly added record in case it is unloaded
@@ -12134,7 +12427,7 @@
12134
12427
  });
12135
12428
 
12136
12429
 
12137
- var ember$data$lib$system$relationships$has_many$$default = ember$data$lib$system$relationships$has_many$$hasMany;
12430
+ var ember$data$lib$system$relationships$has$many$$default = ember$data$lib$system$relationships$has$many$$hasMany;
12138
12431
  function ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(store, meta) {
12139
12432
  var typeKey, type;
12140
12433
 
@@ -12252,7 +12545,7 @@
12252
12545
  @class Model
12253
12546
  @namespace DS
12254
12547
  */
12255
- ember$data$lib$system$model$model$$default.reopen({
12548
+ ember$data$lib$system$model$$default.reopen({
12256
12549
 
12257
12550
  /**
12258
12551
  This Ember.js hook allows an object to be notified when a property
@@ -12311,7 +12604,7 @@
12311
12604
  extensively.
12312
12605
  */
12313
12606
 
12314
- ember$data$lib$system$model$model$$default.reopenClass({
12607
+ ember$data$lib$system$model$$default.reopenClass({
12315
12608
 
12316
12609
  /**
12317
12610
  For a given relationship name, returns the model type of the relationship.
@@ -12711,7 +13004,7 @@
12711
13004
 
12712
13005
  });
12713
13006
 
12714
- ember$data$lib$system$model$model$$default.reopen({
13007
+ ember$data$lib$system$model$$default.reopen({
12715
13008
  /**
12716
13009
  Given a callback, iterates over each of the relationships in the model,
12717
13010
  invoking the callback with the name of each relationship and its relationship
@@ -12775,13 +13068,6 @@
12775
13068
  }
12776
13069
 
12777
13070
  });
12778
- /**
12779
- Ember Data
12780
- @module ember-data
12781
- @main ember-data
12782
- */
12783
-
12784
- // support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
12785
13071
  Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;
12786
13072
 
12787
13073
  Ember.runInDebug(function() {
@@ -12793,12 +13079,12 @@
12793
13079
  });
12794
13080
 
12795
13081
  ember$data$lib$core$$default.Store = ember$data$lib$system$store$$Store;
12796
- ember$data$lib$core$$default.PromiseArray = ember$data$lib$system$promise_proxies$$PromiseArray;
12797
- ember$data$lib$core$$default.PromiseObject = ember$data$lib$system$promise_proxies$$PromiseObject;
13082
+ ember$data$lib$core$$default.PromiseArray = ember$data$lib$system$promise$proxies$$PromiseArray;
13083
+ ember$data$lib$core$$default.PromiseObject = ember$data$lib$system$promise$proxies$$PromiseObject;
12798
13084
 
12799
- ember$data$lib$core$$default.PromiseManyArray = ember$data$lib$system$promise_proxies$$PromiseManyArray;
13085
+ ember$data$lib$core$$default.PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseManyArray;
12800
13086
 
12801
- ember$data$lib$core$$default.Model = ember$data$lib$system$model$model$$default;
13087
+ ember$data$lib$core$$default.Model = ember$data$lib$system$model$$default;
12802
13088
  ember$data$lib$core$$default.RootState = ember$data$lib$system$model$states$$default;
12803
13089
  ember$data$lib$core$$default.attr = ember$data$lib$system$model$attributes$$default;
12804
13090
  ember$data$lib$core$$default.Errors = ember$data$lib$system$model$errors$$default;
@@ -12812,18 +13098,19 @@
12812
13098
 
12813
13099
  ember$data$lib$core$$default.DebugAdapter = ember$data$lib$system$debug$$default;
12814
13100
 
12815
- ember$data$lib$core$$default.RecordArray = ember$data$lib$system$record_arrays$record_array$$default;
12816
- ember$data$lib$core$$default.FilteredRecordArray = ember$data$lib$system$record_arrays$filtered_record_array$$default;
12817
- ember$data$lib$core$$default.AdapterPopulatedRecordArray = ember$data$lib$system$record_arrays$adapter_populated_record_array$$default;
12818
- ember$data$lib$core$$default.ManyArray = ember$data$lib$system$record_arrays$many_array$$default;
13101
+ ember$data$lib$core$$default.RecordArray = ember$data$lib$system$record$arrays$record$array$$default;
13102
+ ember$data$lib$core$$default.FilteredRecordArray = ember$data$lib$system$record$arrays$filtered$record$array$$default;
13103
+ ember$data$lib$core$$default.AdapterPopulatedRecordArray = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default;
13104
+ ember$data$lib$core$$default.ManyArray = ember$data$lib$system$many$array$$default;
12819
13105
 
12820
- ember$data$lib$core$$default.RecordArrayManager = ember$data$lib$system$record_array_manager$$default;
13106
+ ember$data$lib$core$$default.RecordArrayManager = ember$data$lib$system$record$array$manager$$default;
12821
13107
 
12822
- ember$data$lib$core$$default.RESTAdapter = ember$data$lib$adapters$rest_adapter$$default;
12823
- ember$data$lib$core$$default.FixtureAdapter = ember$data$lib$adapters$fixture_adapter$$default;
13108
+ ember$data$lib$core$$default.RESTAdapter = ember$data$lib$adapters$rest$adapter$$default;
13109
+ ember$data$lib$core$$default.BuildURLMixin = ember$data$lib$adapters$build$url$mixin$$default;
13110
+ ember$data$lib$core$$default.FixtureAdapter = ember$data$lib$adapters$fixture$adapter$$default;
12824
13111
 
12825
- ember$data$lib$core$$default.RESTSerializer = ember$data$lib$serializers$rest_serializer$$default;
12826
- ember$data$lib$core$$default.JSONSerializer = ember$data$lib$serializers$json_serializer$$default;
13112
+ ember$data$lib$core$$default.RESTSerializer = ember$data$lib$serializers$rest$serializer$$default;
13113
+ ember$data$lib$core$$default.JSONSerializer = ember$data$lib$serializers$json$serializer$$default;
12827
13114
 
12828
13115
  ember$data$lib$core$$default.Transform = ember$data$lib$transforms$base$$default;
12829
13116
  ember$data$lib$core$$default.DateTransform = ember$data$lib$transforms$date$$default;
@@ -12831,16 +13118,16 @@
12831
13118
  ember$data$lib$core$$default.NumberTransform = ember$data$lib$transforms$number$$default;
12832
13119
  ember$data$lib$core$$default.BooleanTransform = ember$data$lib$transforms$boolean$$default;
12833
13120
 
12834
- ember$data$lib$core$$default.ActiveModelAdapter = activemodel$adapter$lib$system$active_model_adapter$$default;
12835
- ember$data$lib$core$$default.ActiveModelSerializer = activemodel$adapter$lib$system$active_model_serializer$$default;
12836
- ember$data$lib$core$$default.EmbeddedRecordsMixin = ember$data$lib$serializers$embedded_records_mixin$$default;
13121
+ ember$data$lib$core$$default.ActiveModelAdapter = activemodel$adapter$lib$system$active$model$adapter$$default;
13122
+ ember$data$lib$core$$default.ActiveModelSerializer = activemodel$adapter$lib$system$active$model$serializer$$default;
13123
+ ember$data$lib$core$$default.EmbeddedRecordsMixin = ember$data$lib$serializers$embedded$records$mixin$$default;
12837
13124
 
12838
- ember$data$lib$core$$default.belongsTo = ember$data$lib$system$relationships$belongs_to$$default;
12839
- ember$data$lib$core$$default.hasMany = ember$data$lib$system$relationships$has_many$$default;
13125
+ ember$data$lib$core$$default.belongsTo = ember$data$lib$system$relationships$belongs$to$$default;
13126
+ ember$data$lib$core$$default.hasMany = ember$data$lib$system$relationships$has$many$$default;
12840
13127
 
12841
13128
  ember$data$lib$core$$default.Relationship = ember$data$lib$system$relationships$state$relationship$$default;
12842
13129
 
12843
- ember$data$lib$core$$default.ContainerProxy = ember$data$lib$system$container_proxy$$default;
13130
+ ember$data$lib$core$$default.ContainerProxy = ember$data$lib$system$container$proxy$$default;
12844
13131
 
12845
13132
  ember$data$lib$core$$default._setupContainer = ember$data$lib$setup$container$$default;
12846
13133