ember-data-source 1.0.0.beta.11 → 1.0.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/ember-data.js +404 -206
- data/dist/ember-data.min.js +3 -3
- data/dist/ember-data.named-amd.js +341 -143
- data/dist/ember-data.named-amd.min.js +3 -3
- data/dist/ember-data.named-amd.prod.js +323 -136
- data/dist/ember-data.prod.js +386 -199
- data/package.json +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ec7886b169bf196e72745d21481d28febfeab00
|
4
|
+
data.tar.gz: 2283e331324037b0a97e223b0bb3b5f8e35d66a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 515a3df184db91da5b80694adbdd224ec79ea552c3aaf427c5b9ca46eb65d90b5b76284c569141698f7da5c4161bee0e8010e84af6ebdc1b6b54281c9fb13acf
|
7
|
+
data.tar.gz: 82f3701fa0b20d55352232f474fe53ece838c5e77e8ebdcd4b6f854bb75209822c3b6517b48d6f76fa5047779c2c0c34decb391a9e66a5262e0e904dab37f26b
|
data/dist/ember-data.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
(function(global){
|
2
|
-
var
|
2
|
+
var enifed, requireModule, eriuqer, requirejs;
|
3
3
|
|
4
4
|
(function() {
|
5
5
|
|
@@ -15,7 +15,7 @@ var define, requireModule, require, requirejs;
|
|
15
15
|
var registry = {}, seen = {}, state = {};
|
16
16
|
var FAILED = false;
|
17
17
|
|
18
|
-
|
18
|
+
enifed = function(name, deps, callback) {
|
19
19
|
|
20
20
|
if (!_isArray(deps)) {
|
21
21
|
callback = deps;
|
@@ -39,7 +39,7 @@ var define, requireModule, require, requirejs;
|
|
39
39
|
if (dep === 'exports') {
|
40
40
|
exports = reified[i] = seen;
|
41
41
|
} else {
|
42
|
-
reified[i] =
|
42
|
+
reified[i] = eriuqer(resolve(dep, name));
|
43
43
|
}
|
44
44
|
}
|
45
45
|
|
@@ -49,7 +49,7 @@ var define, requireModule, require, requirejs;
|
|
49
49
|
};
|
50
50
|
}
|
51
51
|
|
52
|
-
requirejs =
|
52
|
+
requirejs = eriuqer = requireModule = function(name) {
|
53
53
|
if (state[name] !== FAILED &&
|
54
54
|
seen.hasOwnProperty(name)) {
|
55
55
|
return seen[name];
|
@@ -110,7 +110,7 @@ var define, requireModule, require, requirejs;
|
|
110
110
|
};
|
111
111
|
})();
|
112
112
|
|
113
|
-
|
113
|
+
enifed("activemodel-adapter",
|
114
114
|
["activemodel-adapter/system","exports"],
|
115
115
|
function(__dependency1__, __exports__) {
|
116
116
|
"use strict";
|
@@ -120,7 +120,7 @@ define("activemodel-adapter",
|
|
120
120
|
__exports__.ActiveModelAdapter = ActiveModelAdapter;
|
121
121
|
__exports__.ActiveModelSerializer = ActiveModelSerializer;
|
122
122
|
});
|
123
|
-
|
123
|
+
enifed("activemodel-adapter/setup-container",
|
124
124
|
["ember-data/system/container_proxy","activemodel-adapter/system/active_model_serializer","activemodel-adapter/system/active_model_adapter","exports"],
|
125
125
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
126
126
|
"use strict";
|
@@ -139,7 +139,7 @@ define("activemodel-adapter/setup-container",
|
|
139
139
|
container.register('adapter:-active-model', ActiveModelAdapter);
|
140
140
|
};
|
141
141
|
});
|
142
|
-
|
142
|
+
enifed("activemodel-adapter/system",
|
143
143
|
["activemodel-adapter/system/active_model_adapter","activemodel-adapter/system/active_model_serializer","exports"],
|
144
144
|
function(__dependency1__, __dependency2__, __exports__) {
|
145
145
|
"use strict";
|
@@ -149,7 +149,7 @@ define("activemodel-adapter/system",
|
|
149
149
|
__exports__.ActiveModelAdapter = ActiveModelAdapter;
|
150
150
|
__exports__.ActiveModelSerializer = ActiveModelSerializer;
|
151
151
|
});
|
152
|
-
|
152
|
+
enifed("activemodel-adapter/system/active_model_adapter",
|
153
153
|
["ember-data/adapters","ember-data/system/adapter","ember-inflector","exports"],
|
154
154
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
155
155
|
"use strict";
|
@@ -161,7 +161,6 @@ define("activemodel-adapter/system/active_model_adapter",
|
|
161
161
|
@module ember-data
|
162
162
|
*/
|
163
163
|
|
164
|
-
var forEach = Ember.EnumerableUtils.forEach;
|
165
164
|
var decamelize = Ember.String.decamelize,
|
166
165
|
underscore = Ember.String.underscore;
|
167
166
|
|
@@ -171,7 +170,7 @@ define("activemodel-adapter/system/active_model_adapter",
|
|
171
170
|
It has been designed to work out of the box with the
|
172
171
|
[active_model_serializers](http://github.com/rails-api/active_model_serializers)
|
173
172
|
Ruby gem. This Adapter expects specific settings using ActiveModel::Serializers,
|
174
|
-
`embed :ids,
|
173
|
+
`embed :ids, embed_in_root: true` which sideloads the records.
|
175
174
|
|
176
175
|
This adapter extends the DS.RESTAdapter by making consistent use of the camelization,
|
177
176
|
decamelization and pluralization methods to normalize the serialized JSON into a
|
@@ -297,18 +296,7 @@ define("activemodel-adapter/system/active_model_adapter",
|
|
297
296
|
var error = this._super(jqXHR);
|
298
297
|
|
299
298
|
if (jqXHR && jqXHR.status === 422) {
|
300
|
-
|
301
|
-
errors = {};
|
302
|
-
|
303
|
-
if (response.errors !== undefined) {
|
304
|
-
var jsonErrors = response.errors;
|
305
|
-
|
306
|
-
forEach(Ember.keys(jsonErrors), function(key) {
|
307
|
-
errors[Ember.String.camelize(key)] = jsonErrors[key];
|
308
|
-
});
|
309
|
-
}
|
310
|
-
|
311
|
-
return new InvalidError(errors);
|
299
|
+
return new InvalidError(Ember.$.parseJSON(jqXHR.responseText));
|
312
300
|
} else {
|
313
301
|
return error;
|
314
302
|
}
|
@@ -317,7 +305,7 @@ define("activemodel-adapter/system/active_model_adapter",
|
|
317
305
|
|
318
306
|
__exports__["default"] = ActiveModelAdapter;
|
319
307
|
});
|
320
|
-
|
308
|
+
enifed("activemodel-adapter/system/active_model_serializer",
|
321
309
|
["ember-inflector","ember-data/serializers/rest_serializer","exports"],
|
322
310
|
function(__dependency1__, __dependency2__, __exports__) {
|
323
311
|
"use strict";
|
@@ -339,7 +327,7 @@ define("activemodel-adapter/system/active_model_serializer",
|
|
339
327
|
It has been designed to work out of the box with the
|
340
328
|
[active_model_serializers](http://github.com/rails-api/active_model_serializers)
|
341
329
|
Ruby gem. This Serializer expects specific settings using ActiveModel::Serializers,
|
342
|
-
`embed :ids,
|
330
|
+
`embed :ids, embed_in_root: true` which sideloads the records.
|
343
331
|
|
344
332
|
This serializer extends the DS.RESTSerializer by making consistent
|
345
333
|
use of the camelization, decamelization and pluralization methods to
|
@@ -613,9 +601,9 @@ define("activemodel-adapter/system/active_model_serializer",
|
|
613
601
|
|
614
602
|
__exports__["default"] = ActiveModelSerializer;
|
615
603
|
});
|
616
|
-
|
617
|
-
["ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
|
618
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __exports__) {
|
604
|
+
enifed("ember-data",
|
605
|
+
["ember-data/system/create","ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
|
606
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __exports__) {
|
619
607
|
"use strict";
|
620
608
|
/**
|
621
609
|
Ember Data
|
@@ -627,43 +615,43 @@ define("ember-data",
|
|
627
615
|
// support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
|
628
616
|
Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;
|
629
617
|
|
630
|
-
var DS =
|
631
|
-
|
632
|
-
var PromiseArray =
|
633
|
-
var PromiseObject =
|
634
|
-
var Store =
|
635
|
-
var Model =
|
636
|
-
var Errors =
|
637
|
-
var RootState =
|
638
|
-
var attr =
|
639
|
-
var InvalidError =
|
640
|
-
var Adapter =
|
641
|
-
var DebugAdapter =
|
642
|
-
var RecordArray =
|
643
|
-
var FilteredRecordArray =
|
644
|
-
var AdapterPopulatedRecordArray =
|
645
|
-
var ManyArray =
|
646
|
-
var RecordArrayManager =
|
647
|
-
var RESTAdapter =
|
648
|
-
var FixtureAdapter =
|
649
|
-
var JSONSerializer =
|
650
|
-
var RESTSerializer =
|
651
|
-
var EmbeddedRecordsMixin =
|
652
|
-
var ActiveModelAdapter =
|
653
|
-
var ActiveModelSerializer =
|
654
|
-
|
655
|
-
var Transform =
|
656
|
-
var DateTransform =
|
657
|
-
var NumberTransform =
|
658
|
-
var StringTransform =
|
659
|
-
var BooleanTransform =
|
660
|
-
|
661
|
-
var hasMany =
|
662
|
-
var belongsTo =
|
663
|
-
var setupContainer =
|
664
|
-
|
665
|
-
var ContainerProxy =
|
666
|
-
var Relationship =
|
618
|
+
var DS = __dependency2__["default"];
|
619
|
+
|
620
|
+
var PromiseArray = __dependency4__.PromiseArray;
|
621
|
+
var PromiseObject = __dependency4__.PromiseObject;
|
622
|
+
var Store = __dependency5__.Store;
|
623
|
+
var Model = __dependency6__.Model;
|
624
|
+
var Errors = __dependency6__.Errors;
|
625
|
+
var RootState = __dependency6__.RootState;
|
626
|
+
var attr = __dependency6__.attr;
|
627
|
+
var InvalidError = __dependency7__.InvalidError;
|
628
|
+
var Adapter = __dependency7__.Adapter;
|
629
|
+
var DebugAdapter = __dependency8__["default"];
|
630
|
+
var RecordArray = __dependency9__.RecordArray;
|
631
|
+
var FilteredRecordArray = __dependency9__.FilteredRecordArray;
|
632
|
+
var AdapterPopulatedRecordArray = __dependency9__.AdapterPopulatedRecordArray;
|
633
|
+
var ManyArray = __dependency9__.ManyArray;
|
634
|
+
var RecordArrayManager = __dependency10__["default"];
|
635
|
+
var RESTAdapter = __dependency11__.RESTAdapter;
|
636
|
+
var FixtureAdapter = __dependency11__.FixtureAdapter;
|
637
|
+
var JSONSerializer = __dependency12__["default"];
|
638
|
+
var RESTSerializer = __dependency13__["default"];
|
639
|
+
var EmbeddedRecordsMixin = __dependency15__["default"];
|
640
|
+
var ActiveModelAdapter = __dependency16__.ActiveModelAdapter;
|
641
|
+
var ActiveModelSerializer = __dependency16__.ActiveModelSerializer;
|
642
|
+
|
643
|
+
var Transform = __dependency17__.Transform;
|
644
|
+
var DateTransform = __dependency17__.DateTransform;
|
645
|
+
var NumberTransform = __dependency17__.NumberTransform;
|
646
|
+
var StringTransform = __dependency17__.StringTransform;
|
647
|
+
var BooleanTransform = __dependency17__.BooleanTransform;
|
648
|
+
|
649
|
+
var hasMany = __dependency18__.hasMany;
|
650
|
+
var belongsTo = __dependency18__.belongsTo;
|
651
|
+
var setupContainer = __dependency20__["default"];
|
652
|
+
|
653
|
+
var ContainerProxy = __dependency21__["default"];
|
654
|
+
var Relationship = __dependency22__.Relationship;
|
667
655
|
|
668
656
|
DS.Store = Store;
|
669
657
|
DS.PromiseArray = PromiseArray;
|
@@ -715,7 +703,7 @@ define("ember-data",
|
|
715
703
|
|
716
704
|
__exports__["default"] = DS;
|
717
705
|
});
|
718
|
-
|
706
|
+
enifed("ember-data/adapters",
|
719
707
|
["ember-data/adapters/fixture_adapter","ember-data/adapters/rest_adapter","exports"],
|
720
708
|
function(__dependency1__, __dependency2__, __exports__) {
|
721
709
|
"use strict";
|
@@ -729,7 +717,7 @@ define("ember-data/adapters",
|
|
729
717
|
__exports__.RESTAdapter = RESTAdapter;
|
730
718
|
__exports__.FixtureAdapter = FixtureAdapter;
|
731
719
|
});
|
732
|
-
|
720
|
+
enifed("ember-data/adapters/fixture_adapter",
|
733
721
|
["ember-data/system/adapter","exports"],
|
734
722
|
function(__dependency1__, __exports__) {
|
735
723
|
"use strict";
|
@@ -1074,7 +1062,7 @@ define("ember-data/adapters/fixture_adapter",
|
|
1074
1062
|
}
|
1075
1063
|
});
|
1076
1064
|
});
|
1077
|
-
|
1065
|
+
enifed("ember-data/adapters/rest_adapter",
|
1078
1066
|
["ember-data/system/adapter","ember-data/system/map","exports"],
|
1079
1067
|
function(__dependency1__, __dependency2__, __exports__) {
|
1080
1068
|
"use strict";
|
@@ -1661,7 +1649,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1661
1649
|
},
|
1662
1650
|
|
1663
1651
|
_stripIDFromURL: function(store, record) {
|
1664
|
-
var type =
|
1652
|
+
var type = record.constructor;
|
1665
1653
|
var url = this.buildURL(type.typeKey, record.get('id'), record);
|
1666
1654
|
|
1667
1655
|
var expandedURL = url.split('/');
|
@@ -1678,6 +1666,11 @@ define("ember-data/adapters/rest_adapter",
|
|
1678
1666
|
return expandedURL.join('/');
|
1679
1667
|
},
|
1680
1668
|
|
1669
|
+
/**
|
1670
|
+
http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
|
1671
|
+
*/
|
1672
|
+
maxUrlLength: 2048,
|
1673
|
+
|
1681
1674
|
/**
|
1682
1675
|
Organize records into groups, each of which is to be passed to separate
|
1683
1676
|
calls to `findMany`.
|
@@ -1695,6 +1688,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1695
1688
|
and `/posts/2/comments/3`
|
1696
1689
|
|
1697
1690
|
@method groupRecordsForFindMany
|
1691
|
+
@param {DS.Store} store
|
1698
1692
|
@param {Array} records
|
1699
1693
|
@return {Array} an array of arrays of records, each of which is to be
|
1700
1694
|
loaded separately by `findMany`.
|
@@ -1702,19 +1696,20 @@ define("ember-data/adapters/rest_adapter",
|
|
1702
1696
|
groupRecordsForFindMany: function (store, records) {
|
1703
1697
|
var groups = MapWithDefault.create({defaultValue: function(){return [];}});
|
1704
1698
|
var adapter = this;
|
1699
|
+
var maxUrlLength = this.maxUrlLength;
|
1705
1700
|
|
1706
1701
|
forEach.call(records, function(record){
|
1707
1702
|
var baseUrl = adapter._stripIDFromURL(store, record);
|
1708
1703
|
groups.get(baseUrl).push(record);
|
1709
1704
|
});
|
1710
1705
|
|
1711
|
-
function splitGroupToFitInUrl(group, maxUrlLength) {
|
1706
|
+
function splitGroupToFitInUrl(group, maxUrlLength, paramNameLength) {
|
1712
1707
|
var baseUrl = adapter._stripIDFromURL(store, group[0]);
|
1713
1708
|
var idsSize = 0;
|
1714
1709
|
var splitGroups = [[]];
|
1715
1710
|
|
1716
1711
|
forEach.call(group, function(record) {
|
1717
|
-
var additionalLength =
|
1712
|
+
var additionalLength = encodeURIComponent(record.get('id')).length + paramNameLength;
|
1718
1713
|
if (baseUrl.length + idsSize + additionalLength >= maxUrlLength) {
|
1719
1714
|
idsSize = 0;
|
1720
1715
|
splitGroups.push([]);
|
@@ -1731,9 +1726,8 @@ define("ember-data/adapters/rest_adapter",
|
|
1731
1726
|
|
1732
1727
|
var groupsArray = [];
|
1733
1728
|
groups.forEach(function(group, key){
|
1734
|
-
|
1735
|
-
var
|
1736
|
-
var splitGroups = splitGroupToFitInUrl(group, maxUrlLength);
|
1729
|
+
var paramNameLength = '&ids%5B%5D='.length;
|
1730
|
+
var splitGroups = splitGroupToFitInUrl(group, maxUrlLength, paramNameLength);
|
1737
1731
|
|
1738
1732
|
forEach.call(splitGroups, function(splitGroup) {
|
1739
1733
|
groupsArray.push(splitGroup);
|
@@ -1773,19 +1767,25 @@ define("ember-data/adapters/rest_adapter",
|
|
1773
1767
|
},
|
1774
1768
|
|
1775
1769
|
/**
|
1776
|
-
Takes an ajax response, and returns
|
1770
|
+
Takes an ajax response, and returns an error payload.
|
1777
1771
|
|
1778
1772
|
Returning a `DS.InvalidError` from this method will cause the
|
1779
1773
|
record to transition into the `invalid` state and make the
|
1780
1774
|
`errors` object available on the record.
|
1781
1775
|
|
1776
|
+
This function should return the entire payload as received from the
|
1777
|
+
server. Error object extraction and normalization of model errors
|
1778
|
+
should be performed by `extractErrors` on the serializer.
|
1779
|
+
|
1780
|
+
Example
|
1781
|
+
|
1782
1782
|
```javascript
|
1783
1783
|
App.ApplicationAdapter = DS.RESTAdapter.extend({
|
1784
1784
|
ajaxError: function(jqXHR) {
|
1785
1785
|
var error = this._super(jqXHR);
|
1786
1786
|
|
1787
1787
|
if (jqXHR && jqXHR.status === 422) {
|
1788
|
-
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)
|
1788
|
+
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
|
1789
1789
|
|
1790
1790
|
return new DS.InvalidError(jsonErrors);
|
1791
1791
|
} else {
|
@@ -1829,12 +1829,12 @@ define("ember-data/adapters/rest_adapter",
|
|
1829
1829
|
2. Your API might return errors as successful responses with status code
|
1830
1830
|
200 and an Errors text or object. You can return a DS.InvalidError from
|
1831
1831
|
this hook and it will automatically reject the promise and put your record
|
1832
|
-
into the
|
1832
|
+
into the invalid state.
|
1833
1833
|
|
1834
|
-
@method
|
1834
|
+
@method ajaxSuccess
|
1835
1835
|
@param {Object} jqXHR
|
1836
1836
|
@param {Object} jsonPayload
|
1837
|
-
@return {Object}
|
1837
|
+
@return {Object} jsonPayload
|
1838
1838
|
*/
|
1839
1839
|
|
1840
1840
|
ajaxSuccess: function(jqXHR, jsonPayload) {
|
@@ -1930,7 +1930,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1930
1930
|
}
|
1931
1931
|
}
|
1932
1932
|
});
|
1933
|
-
|
1933
|
+
enifed("ember-data/core",
|
1934
1934
|
["exports"],
|
1935
1935
|
function(__exports__) {
|
1936
1936
|
"use strict";
|
@@ -1949,11 +1949,11 @@ define("ember-data/core",
|
|
1949
1949
|
/**
|
1950
1950
|
@property VERSION
|
1951
1951
|
@type String
|
1952
|
-
@default '1.0.0-beta.
|
1952
|
+
@default '1.0.0-beta.12'
|
1953
1953
|
@static
|
1954
1954
|
*/
|
1955
1955
|
DS = Ember.Namespace.create({
|
1956
|
-
VERSION: '1.0.0-beta.
|
1956
|
+
VERSION: '1.0.0-beta.12'
|
1957
1957
|
});
|
1958
1958
|
|
1959
1959
|
if (Ember.libraries) {
|
@@ -1963,7 +1963,7 @@ define("ember-data/core",
|
|
1963
1963
|
|
1964
1964
|
__exports__["default"] = DS;
|
1965
1965
|
});
|
1966
|
-
|
1966
|
+
enifed("ember-data/ember-initializer",
|
1967
1967
|
["ember-data/setup-container"],
|
1968
1968
|
function(__dependency1__) {
|
1969
1969
|
"use strict";
|
@@ -2047,7 +2047,7 @@ define("ember-data/ember-initializer",
|
|
2047
2047
|
});
|
2048
2048
|
});
|
2049
2049
|
});
|
2050
|
-
|
2050
|
+
enifed("ember-data/ext/date",
|
2051
2051
|
[],
|
2052
2052
|
function() {
|
2053
2053
|
"use strict";
|
@@ -2113,7 +2113,7 @@ define("ember-data/ext/date",
|
|
2113
2113
|
Date.parse = Ember.Date.parse;
|
2114
2114
|
}
|
2115
2115
|
});
|
2116
|
-
|
2116
|
+
enifed("ember-data/initializers/data_adapter",
|
2117
2117
|
["ember-data/system/debug/debug_adapter","exports"],
|
2118
2118
|
function(__dependency1__, __exports__) {
|
2119
2119
|
"use strict";
|
@@ -2130,7 +2130,7 @@ define("ember-data/initializers/data_adapter",
|
|
2130
2130
|
container.register('data-adapter:main', DebugAdapter);
|
2131
2131
|
};
|
2132
2132
|
});
|
2133
|
-
|
2133
|
+
enifed("ember-data/initializers/store",
|
2134
2134
|
["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],
|
2135
2135
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
2136
2136
|
"use strict";
|
@@ -2173,7 +2173,7 @@ define("ember-data/initializers/store",
|
|
2173
2173
|
container.lookup('store:main');
|
2174
2174
|
};
|
2175
2175
|
});
|
2176
|
-
|
2176
|
+
enifed("ember-data/initializers/store_injections",
|
2177
2177
|
["exports"],
|
2178
2178
|
function(__exports__) {
|
2179
2179
|
"use strict";
|
@@ -2191,7 +2191,7 @@ define("ember-data/initializers/store_injections",
|
|
2191
2191
|
container.injection('data-adapter', 'store', 'store:main');
|
2192
2192
|
};
|
2193
2193
|
});
|
2194
|
-
|
2194
|
+
enifed("ember-data/initializers/transforms",
|
2195
2195
|
["ember-data/transforms","exports"],
|
2196
2196
|
function(__dependency1__, __exports__) {
|
2197
2197
|
"use strict";
|
@@ -2214,7 +2214,7 @@ define("ember-data/initializers/transforms",
|
|
2214
2214
|
container.register('transform:string', StringTransform);
|
2215
2215
|
};
|
2216
2216
|
});
|
2217
|
-
|
2217
|
+
enifed("ember-data/serializers",
|
2218
2218
|
["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],
|
2219
2219
|
function(__dependency1__, __dependency2__, __exports__) {
|
2220
2220
|
"use strict";
|
@@ -2224,7 +2224,7 @@ define("ember-data/serializers",
|
|
2224
2224
|
__exports__.JSONSerializer = JSONSerializer;
|
2225
2225
|
__exports__.RESTSerializer = RESTSerializer;
|
2226
2226
|
});
|
2227
|
-
|
2227
|
+
enifed("ember-data/serializers/embedded_records_mixin",
|
2228
2228
|
["exports"],
|
2229
2229
|
function(__exports__) {
|
2230
2230
|
"use strict";
|
@@ -2694,7 +2694,7 @@ define("ember-data/serializers/embedded_records_mixin",
|
|
2694
2694
|
|
2695
2695
|
__exports__["default"] = EmbeddedRecordsMixin;
|
2696
2696
|
});
|
2697
|
-
|
2697
|
+
enifed("ember-data/serializers/json_serializer",
|
2698
2698
|
["exports"],
|
2699
2699
|
function(__exports__) {
|
2700
2700
|
"use strict";
|
@@ -2960,6 +2960,16 @@ define("ember-data/serializers/json_serializer",
|
|
2960
2960
|
delete hash[primaryKey];
|
2961
2961
|
},
|
2962
2962
|
|
2963
|
+
/**
|
2964
|
+
@method normalizeErrors
|
2965
|
+
@private
|
2966
|
+
*/
|
2967
|
+
normalizeErrors: function(type, hash) {
|
2968
|
+
this.normalizeId(hash);
|
2969
|
+
this.normalizeAttributes(type, hash);
|
2970
|
+
this.normalizeRelationships(type, hash);
|
2971
|
+
},
|
2972
|
+
|
2963
2973
|
/**
|
2964
2974
|
Looks up the property key that was set by the custom `attr` mapping
|
2965
2975
|
passed to the serializer.
|
@@ -3670,6 +3680,41 @@ define("ember-data/serializers/json_serializer",
|
|
3670
3680
|
}
|
3671
3681
|
},
|
3672
3682
|
|
3683
|
+
/**
|
3684
|
+
`extractErrors` is used to extract model errors when a call is made
|
3685
|
+
to `DS.Model#save` which fails with an InvalidError`. By default
|
3686
|
+
Ember Data expects error information to be located on the `errors`
|
3687
|
+
property of the payload object.
|
3688
|
+
|
3689
|
+
Example
|
3690
|
+
|
3691
|
+
```javascript
|
3692
|
+
App.PostSerializer = DS.JSONSerializer.extend({
|
3693
|
+
extractErrors: function(store, type, payload, id) {
|
3694
|
+
if (payload && typeof payload === 'object' && payload._problems) {
|
3695
|
+
payload = payload._problems;
|
3696
|
+
this.normalizeErrors(type, payload);
|
3697
|
+
}
|
3698
|
+
return payload;
|
3699
|
+
}
|
3700
|
+
});
|
3701
|
+
```
|
3702
|
+
|
3703
|
+
@method extractErrors
|
3704
|
+
@param {DS.Store} store
|
3705
|
+
@param {subclass of DS.Model} type
|
3706
|
+
@param {Object} payload
|
3707
|
+
@param {String or Number} id
|
3708
|
+
@return {Object} json The deserialized errors
|
3709
|
+
*/
|
3710
|
+
extractErrors: function(store, type, payload, id) {
|
3711
|
+
if (payload && typeof payload === 'object' && payload.errors) {
|
3712
|
+
payload = payload.errors;
|
3713
|
+
this.normalizeErrors(type, payload);
|
3714
|
+
}
|
3715
|
+
return payload;
|
3716
|
+
},
|
3717
|
+
|
3673
3718
|
/**
|
3674
3719
|
`keyForAttribute` can be used to define rules for how to convert an
|
3675
3720
|
attribute name in your model to a key in your JSON.
|
@@ -3733,7 +3778,7 @@ define("ember-data/serializers/json_serializer",
|
|
3733
3778
|
}
|
3734
3779
|
});
|
3735
3780
|
});
|
3736
|
-
|
3781
|
+
enifed("ember-data/serializers/rest_serializer",
|
3737
3782
|
["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],
|
3738
3783
|
function(__dependency1__, __dependency2__, __exports__) {
|
3739
3784
|
"use strict";
|
@@ -4006,6 +4051,7 @@ define("ember-data/serializers/rest_serializer",
|
|
4006
4051
|
|
4007
4052
|
for (var prop in payload) {
|
4008
4053
|
var typeName = this.typeForRoot(prop);
|
4054
|
+
|
4009
4055
|
if (!store.modelFactoryFor(typeName)){
|
4010
4056
|
Ember.warn(this.warnMessageNoModelForKey(prop, typeName), false);
|
4011
4057
|
continue;
|
@@ -4014,6 +4060,10 @@ define("ember-data/serializers/rest_serializer",
|
|
4014
4060
|
var isPrimary = type.typeKey === primaryTypeName;
|
4015
4061
|
var value = payload[prop];
|
4016
4062
|
|
4063
|
+
if (value === null) {
|
4064
|
+
continue;
|
4065
|
+
}
|
4066
|
+
|
4017
4067
|
// legacy support for singular resources
|
4018
4068
|
if (isPrimary && Ember.typeOf(value) !== "array" ) {
|
4019
4069
|
primaryRecord = this.normalize(primaryType, value, prop);
|
@@ -4492,7 +4542,7 @@ define("ember-data/serializers/rest_serializer",
|
|
4492
4542
|
|
4493
4543
|
__exports__["default"] = RESTSerializer;
|
4494
4544
|
});
|
4495
|
-
|
4545
|
+
enifed("ember-data/setup-container",
|
4496
4546
|
["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],
|
4497
4547
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
|
4498
4548
|
"use strict";
|
@@ -4514,7 +4564,7 @@ define("ember-data/setup-container",
|
|
4514
4564
|
setupActiveModelContainer(container, application);
|
4515
4565
|
};
|
4516
4566
|
});
|
4517
|
-
|
4567
|
+
enifed("ember-data/system/adapter",
|
4518
4568
|
["exports"],
|
4519
4569
|
function(__exports__) {
|
4520
4570
|
"use strict";
|
@@ -4543,6 +4593,10 @@ define("ember-data/system/adapter",
|
|
4543
4593
|
transition to the `invalid` state and the errors will be set to the
|
4544
4594
|
`errors` property on the record.
|
4545
4595
|
|
4596
|
+
This function should return the entire payload as received from the
|
4597
|
+
server. Error object extraction and normalization of model errors
|
4598
|
+
should be performed by `extractErrors` on the serializer.
|
4599
|
+
|
4546
4600
|
Example
|
4547
4601
|
|
4548
4602
|
```javascript
|
@@ -4551,7 +4605,7 @@ define("ember-data/system/adapter",
|
|
4551
4605
|
var error = this._super(jqXHR);
|
4552
4606
|
|
4553
4607
|
if (jqXHR && jqXHR.status === 422) {
|
4554
|
-
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)
|
4608
|
+
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
|
4555
4609
|
return new DS.InvalidError(jsonErrors);
|
4556
4610
|
} else {
|
4557
4611
|
return error;
|
@@ -4567,7 +4621,7 @@ define("ember-data/system/adapter",
|
|
4567
4621
|
```javascript
|
4568
4622
|
return new DS.InvalidError({
|
4569
4623
|
length: 'Must be less than 15',
|
4570
|
-
name: 'Must not be blank
|
4624
|
+
name: 'Must not be blank'
|
4571
4625
|
});
|
4572
4626
|
```
|
4573
4627
|
|
@@ -4966,6 +5020,7 @@ define("ember-data/system/adapter",
|
|
4966
5020
|
The default implementation returns the records as a single group.
|
4967
5021
|
|
4968
5022
|
@method groupRecordsForFindMany
|
5023
|
+
@param {DS.Store} store
|
4969
5024
|
@param {Array} records
|
4970
5025
|
@return {Array} an array of arrays of records, each of which is to be
|
4971
5026
|
loaded separately by `findMany`.
|
@@ -4979,7 +5034,7 @@ define("ember-data/system/adapter",
|
|
4979
5034
|
__exports__.Adapter = Adapter;
|
4980
5035
|
__exports__["default"] = Adapter;
|
4981
5036
|
});
|
4982
|
-
|
5037
|
+
enifed("ember-data/system/container_proxy",
|
4983
5038
|
["exports"],
|
4984
5039
|
function(__exports__) {
|
4985
5040
|
"use strict";
|
@@ -5034,7 +5089,21 @@ define("ember-data/system/container_proxy",
|
|
5034
5089
|
|
5035
5090
|
__exports__["default"] = ContainerProxy;
|
5036
5091
|
});
|
5037
|
-
|
5092
|
+
enifed("ember-data/system/create",
|
5093
|
+
[],
|
5094
|
+
function() {
|
5095
|
+
"use strict";
|
5096
|
+
/*
|
5097
|
+
Detect if the user has a correct Object.create shim.
|
5098
|
+
Ember has provided this for a long time but has had an incorrect shim before 1.8
|
5099
|
+
TODO: Remove for Ember Data 1.0.
|
5100
|
+
*/
|
5101
|
+
var object = Ember.create(null);
|
5102
|
+
if (object.toString !== undefined && Ember.keys(Ember.create({}))[0] === '__proto__'){
|
5103
|
+
throw new Error("Ember Data requires a correct Object.create shim. You should upgrade to Ember >= 1.8 which provides one for you. If you are using ES5-shim, you should try removing that after upgrading Ember.");
|
5104
|
+
}
|
5105
|
+
});
|
5106
|
+
enifed("ember-data/system/debug",
|
5038
5107
|
["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],
|
5039
5108
|
function(__dependency1__, __dependency2__, __exports__) {
|
5040
5109
|
"use strict";
|
@@ -5046,7 +5115,7 @@ define("ember-data/system/debug",
|
|
5046
5115
|
|
5047
5116
|
__exports__["default"] = DebugAdapter;
|
5048
5117
|
});
|
5049
|
-
|
5118
|
+
enifed("ember-data/system/debug/debug_adapter",
|
5050
5119
|
["ember-data/system/model","exports"],
|
5051
5120
|
function(__dependency1__, __exports__) {
|
5052
5121
|
"use strict";
|
@@ -5169,7 +5238,7 @@ define("ember-data/system/debug/debug_adapter",
|
|
5169
5238
|
|
5170
5239
|
});
|
5171
5240
|
});
|
5172
|
-
|
5241
|
+
enifed("ember-data/system/debug/debug_info",
|
5173
5242
|
["ember-data/system/model","exports"],
|
5174
5243
|
function(__dependency1__, __exports__) {
|
5175
5244
|
"use strict";
|
@@ -5243,7 +5312,7 @@ define("ember-data/system/debug/debug_info",
|
|
5243
5312
|
|
5244
5313
|
__exports__["default"] = Model;
|
5245
5314
|
});
|
5246
|
-
|
5315
|
+
enifed("ember-data/system/map",
|
5247
5316
|
["exports"],
|
5248
5317
|
function(__exports__) {
|
5249
5318
|
"use strict";
|
@@ -5274,9 +5343,9 @@ define("ember-data/system/map",
|
|
5274
5343
|
usesOldBehavior = value === 'key' && key === 'value';
|
5275
5344
|
});
|
5276
5345
|
|
5277
|
-
Map.prototype =
|
5278
|
-
MapWithDefault.prototype =
|
5279
|
-
OrderedSet.prototype =
|
5346
|
+
Map.prototype = Ember.create(Ember.Map.prototype);
|
5347
|
+
MapWithDefault.prototype = Ember.create(Ember.MapWithDefault.prototype);
|
5348
|
+
OrderedSet.prototype = Ember.create(Ember.OrderedSet.prototype);
|
5280
5349
|
|
5281
5350
|
OrderedSet.create = function(){
|
5282
5351
|
return new OrderedSet();
|
@@ -5338,7 +5407,7 @@ define("ember-data/system/map",
|
|
5338
5407
|
__exports__.MapWithDefault = MapWithDefault;
|
5339
5408
|
__exports__.OrderedSet = OrderedSet;
|
5340
5409
|
});
|
5341
|
-
|
5410
|
+
enifed("ember-data/system/model",
|
5342
5411
|
["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],
|
5343
5412
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
5344
5413
|
"use strict";
|
@@ -5356,7 +5425,7 @@ define("ember-data/system/model",
|
|
5356
5425
|
__exports__.attr = attr;
|
5357
5426
|
__exports__.Errors = Errors;
|
5358
5427
|
});
|
5359
|
-
|
5428
|
+
enifed("ember-data/system/model/attributes",
|
5360
5429
|
["ember-data/system/model/model","ember-data/system/map","exports"],
|
5361
5430
|
function(__dependency1__, __dependency2__, __exports__) {
|
5362
5431
|
"use strict";
|
@@ -5636,7 +5705,7 @@ define("ember-data/system/model/attributes",
|
|
5636
5705
|
options: options
|
5637
5706
|
};
|
5638
5707
|
|
5639
|
-
return Ember.computed(
|
5708
|
+
return Ember.computed(function(key, value) {
|
5640
5709
|
if (arguments.length > 1) {
|
5641
5710
|
Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.constructor.toString(), key !== 'id');
|
5642
5711
|
var oldValue = getValue(this, key);
|
@@ -5667,7 +5736,7 @@ define("ember-data/system/model/attributes",
|
|
5667
5736
|
}).meta(meta);
|
5668
5737
|
};
|
5669
5738
|
});
|
5670
|
-
|
5739
|
+
enifed("ember-data/system/model/errors",
|
5671
5740
|
["ember-data/system/map","exports"],
|
5672
5741
|
function(__dependency1__, __exports__) {
|
5673
5742
|
"use strict";
|
@@ -5688,7 +5757,7 @@ define("ember-data/system/model/errors",
|
|
5688
5757
|
`DS.Errors`. This can be used to display validation error
|
5689
5758
|
messages returned from the server when a `record.save()` rejects.
|
5690
5759
|
This works automatically with `DS.ActiveModelAdapter`, but you
|
5691
|
-
can implement [ajaxError](api/data/classes/DS.RESTAdapter.html#method_ajaxError)
|
5760
|
+
can implement [ajaxError](/api/data/classes/DS.RESTAdapter.html#method_ajaxError)
|
5692
5761
|
in other adapters as well.
|
5693
5762
|
|
5694
5763
|
For Example, if you had an `User` model that looked like this:
|
@@ -6014,7 +6083,7 @@ define("ember-data/system/model/errors",
|
|
6014
6083
|
}
|
6015
6084
|
});
|
6016
6085
|
});
|
6017
|
-
|
6086
|
+
enifed("ember-data/system/model/model",
|
6018
6087
|
["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],
|
6019
6088
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
6020
6089
|
"use strict";
|
@@ -6039,8 +6108,8 @@ define("ember-data/system/model/model",
|
|
6039
6108
|
return get(get(this, 'currentState'), key);
|
6040
6109
|
}).readOnly();
|
6041
6110
|
|
6042
|
-
var _extractPivotNameCache =
|
6043
|
-
var _splitOnDotCache =
|
6111
|
+
var _extractPivotNameCache = Ember.create(null);
|
6112
|
+
var _splitOnDotCache = Ember.create(null);
|
6044
6113
|
|
6045
6114
|
function splitOnDot(name) {
|
6046
6115
|
return _splitOnDotCache[name] || (
|
@@ -6485,7 +6554,7 @@ define("ember-data/system/model/model",
|
|
6485
6554
|
would have a implicit post relationship in order to be do things like remove ourselves from the post
|
6486
6555
|
when we are deleted
|
6487
6556
|
*/
|
6488
|
-
this._implicitRelationships =
|
6557
|
+
this._implicitRelationships = Ember.create(null);
|
6489
6558
|
var model = this;
|
6490
6559
|
//TODO Move into a getter for better perf
|
6491
6560
|
this.constructor.eachRelationship(function(key, descriptor) {
|
@@ -6779,6 +6848,20 @@ define("ember-data/system/model/model",
|
|
6779
6848
|
return value;
|
6780
6849
|
},
|
6781
6850
|
|
6851
|
+
/**
|
6852
|
+
@method _notifyProperties
|
6853
|
+
@private
|
6854
|
+
*/
|
6855
|
+
_notifyProperties: function(keys) {
|
6856
|
+
Ember.beginPropertyChanges();
|
6857
|
+
var key;
|
6858
|
+
for (var i = 0, length = keys.length; i < length; i++){
|
6859
|
+
key = keys[i];
|
6860
|
+
this.notifyPropertyChange(key);
|
6861
|
+
}
|
6862
|
+
Ember.endPropertyChanges();
|
6863
|
+
},
|
6864
|
+
|
6782
6865
|
/**
|
6783
6866
|
Returns an object, whose keys are changed properties, and value is
|
6784
6867
|
an [oldProp, newProp] array.
|
@@ -6844,7 +6927,7 @@ define("ember-data/system/model/model",
|
|
6844
6927
|
|
6845
6928
|
if (!data) { return; }
|
6846
6929
|
|
6847
|
-
this.
|
6930
|
+
this._notifyProperties(Ember.keys(data));
|
6848
6931
|
},
|
6849
6932
|
|
6850
6933
|
/**
|
@@ -6877,15 +6960,17 @@ define("ember-data/system/model/model",
|
|
6877
6960
|
the existing data, not replace it.
|
6878
6961
|
*/
|
6879
6962
|
setupData: function(data, partial) {
|
6963
|
+
Ember.assert("Expected an object as `data` in `setupData`", Ember.typeOf(data) === 'object');
|
6964
|
+
|
6880
6965
|
if (partial) {
|
6881
6966
|
Ember.merge(this._data, data);
|
6882
6967
|
} else {
|
6883
6968
|
this._data = data;
|
6884
6969
|
}
|
6885
6970
|
|
6886
|
-
|
6971
|
+
this.pushedData();
|
6887
6972
|
|
6888
|
-
this.
|
6973
|
+
this._notifyProperties(Ember.keys(data));
|
6889
6974
|
},
|
6890
6975
|
|
6891
6976
|
materializeId: function(id) {
|
@@ -6932,13 +7017,18 @@ define("ember-data/system/model/model",
|
|
6932
7017
|
this.reconnectRelationships();
|
6933
7018
|
}
|
6934
7019
|
|
7020
|
+
if (get(this, 'isNew')) {
|
7021
|
+
this.clearRelationships();
|
7022
|
+
}
|
7023
|
+
|
6935
7024
|
if (!get(this, 'isValid')) {
|
6936
7025
|
this._inFlightAttributes = {};
|
6937
7026
|
}
|
6938
7027
|
|
6939
7028
|
this.send('rolledBack');
|
6940
7029
|
|
6941
|
-
this.
|
7030
|
+
this._notifyProperties(Ember.keys(this._data));
|
7031
|
+
|
6942
7032
|
},
|
6943
7033
|
|
6944
7034
|
toStringExtension: function() {
|
@@ -6989,7 +7079,9 @@ define("ember-data/system/model/model",
|
|
6989
7079
|
App.ModelViewRoute = Ember.Route.extend({
|
6990
7080
|
actions: {
|
6991
7081
|
reload: function() {
|
6992
|
-
this.controller.get('model').reload()
|
7082
|
+
this.controller.get('model').reload().then(function(model) {
|
7083
|
+
// do something with the reloaded model
|
7084
|
+
});
|
6993
7085
|
}
|
6994
7086
|
}
|
6995
7087
|
});
|
@@ -7151,7 +7243,7 @@ define("ember-data/system/model/model",
|
|
7151
7243
|
|
7152
7244
|
__exports__["default"] = Model;
|
7153
7245
|
});
|
7154
|
-
|
7246
|
+
enifed("ember-data/system/model/states",
|
7155
7247
|
["exports"],
|
7156
7248
|
function(__exports__) {
|
7157
7249
|
"use strict";
|
@@ -7874,7 +7966,7 @@ define("ember-data/system/model/states",
|
|
7874
7966
|
|
7875
7967
|
__exports__["default"] = RootState;
|
7876
7968
|
});
|
7877
|
-
|
7969
|
+
enifed("ember-data/system/promise_proxies",
|
7878
7970
|
["exports"],
|
7879
7971
|
function(__exports__) {
|
7880
7972
|
"use strict";
|
@@ -7960,14 +8052,39 @@ define("ember-data/system/promise_proxies",
|
|
7960
8052
|
to the underlying manyArray.
|
7961
8053
|
Right now we proxy:
|
7962
8054
|
`reload()`
|
8055
|
+
`createRecord()`
|
8056
|
+
`on()`
|
8057
|
+
`one()`
|
8058
|
+
`trigger()`
|
8059
|
+
`off()`
|
8060
|
+
`has()`
|
7963
8061
|
*/
|
7964
8062
|
|
8063
|
+
function proxyToContent(method) {
|
8064
|
+
return function() {
|
8065
|
+
var content = get(this, 'content');
|
8066
|
+
return content[method].apply(content, arguments);
|
8067
|
+
};
|
8068
|
+
}
|
8069
|
+
|
7965
8070
|
var PromiseManyArray = PromiseArray.extend({
|
7966
8071
|
reload: function() {
|
7967
8072
|
//I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
|
7968
8073
|
Ember.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content'));
|
7969
8074
|
return get(this, 'content').reload();
|
7970
|
-
}
|
8075
|
+
},
|
8076
|
+
|
8077
|
+
createRecord: proxyToContent('createRecord'),
|
8078
|
+
|
8079
|
+
on: proxyToContent('on'),
|
8080
|
+
|
8081
|
+
one: proxyToContent('one'),
|
8082
|
+
|
8083
|
+
trigger: proxyToContent('trigger'),
|
8084
|
+
|
8085
|
+
off: proxyToContent('off'),
|
8086
|
+
|
8087
|
+
has: proxyToContent('has')
|
7971
8088
|
});
|
7972
8089
|
|
7973
8090
|
var promiseManyArray = function(promise, label) {
|
@@ -7984,7 +8101,7 @@ define("ember-data/system/promise_proxies",
|
|
7984
8101
|
__exports__.promiseObject = promiseObject;
|
7985
8102
|
__exports__.promiseManyArray = promiseManyArray;
|
7986
8103
|
});
|
7987
|
-
|
8104
|
+
enifed("ember-data/system/record_array_manager",
|
7988
8105
|
["ember-data/system/record_arrays","ember-data/system/map","exports"],
|
7989
8106
|
function(__dependency1__, __dependency2__, __exports__) {
|
7990
8107
|
"use strict";
|
@@ -8000,6 +8117,7 @@ define("ember-data/system/record_array_manager",
|
|
8000
8117
|
var OrderedSet = __dependency2__.OrderedSet;
|
8001
8118
|
var get = Ember.get;
|
8002
8119
|
var forEach = Ember.EnumerableUtils.forEach;
|
8120
|
+
var indexOf = Ember.EnumerableUtils.indexOf;
|
8003
8121
|
|
8004
8122
|
/**
|
8005
8123
|
@class RecordArrayManager
|
@@ -8252,6 +8370,19 @@ define("ember-data/system/record_array_manager",
|
|
8252
8370
|
this.updateFilter(array, type, filter);
|
8253
8371
|
},
|
8254
8372
|
|
8373
|
+
/**
|
8374
|
+
Unregister a FilteredRecordArray.
|
8375
|
+
So manager will not update this array.
|
8376
|
+
|
8377
|
+
@method unregisterFilteredRecordArray
|
8378
|
+
@param {DS.RecordArray} array
|
8379
|
+
*/
|
8380
|
+
unregisterFilteredRecordArray: function(array) {
|
8381
|
+
var recordArrays = this.filteredRecordArrays.get(array.type);
|
8382
|
+
var index = indexOf(recordArrays, array);
|
8383
|
+
recordArrays.splice(index, 1);
|
8384
|
+
},
|
8385
|
+
|
8255
8386
|
// Internally, we maintain a map of all unloaded IDs requested by
|
8256
8387
|
// a ManyArray. As the adapter loads data into the store, the
|
8257
8388
|
// store notifies any interested ManyArrays. When the ManyArray's
|
@@ -8297,7 +8428,7 @@ define("ember-data/system/record_array_manager",
|
|
8297
8428
|
return result;
|
8298
8429
|
}
|
8299
8430
|
});
|
8300
|
-
|
8431
|
+
enifed("ember-data/system/record_arrays",
|
8301
8432
|
["ember-data/system/record_arrays/record_array","ember-data/system/record_arrays/filtered_record_array","ember-data/system/record_arrays/adapter_populated_record_array","ember-data/system/record_arrays/many_array","exports"],
|
8302
8433
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
8303
8434
|
"use strict";
|
@@ -8315,7 +8446,7 @@ define("ember-data/system/record_arrays",
|
|
8315
8446
|
__exports__.AdapterPopulatedRecordArray = AdapterPopulatedRecordArray;
|
8316
8447
|
__exports__.ManyArray = ManyArray;
|
8317
8448
|
});
|
8318
|
-
|
8449
|
+
enifed("ember-data/system/record_arrays/adapter_populated_record_array",
|
8319
8450
|
["ember-data/system/record_arrays/record_array","exports"],
|
8320
8451
|
function(__dependency1__, __exports__) {
|
8321
8452
|
"use strict";
|
@@ -8327,7 +8458,7 @@ define("ember-data/system/record_arrays/adapter_populated_record_array",
|
|
8327
8458
|
var get = Ember.get;
|
8328
8459
|
|
8329
8460
|
function cloneNull(source) {
|
8330
|
-
var clone =
|
8461
|
+
var clone = Ember.create(null);
|
8331
8462
|
for (var key in source) {
|
8332
8463
|
clone[key] = source[key];
|
8333
8464
|
}
|
@@ -8378,7 +8509,7 @@ define("ember-data/system/record_arrays/adapter_populated_record_array",
|
|
8378
8509
|
}
|
8379
8510
|
});
|
8380
8511
|
});
|
8381
|
-
|
8512
|
+
enifed("ember-data/system/record_arrays/filtered_record_array",
|
8382
8513
|
["ember-data/system/record_arrays/record_array","exports"],
|
8383
8514
|
function(__dependency1__, __exports__) {
|
8384
8515
|
"use strict";
|
@@ -8446,10 +8577,23 @@ define("ember-data/system/record_arrays/filtered_record_array",
|
|
8446
8577
|
|
8447
8578
|
updateFilter: Ember.observer(function() {
|
8448
8579
|
Ember.run.once(this, this._updateFilter);
|
8449
|
-
}, 'filterFunction')
|
8580
|
+
}, 'filterFunction'),
|
8581
|
+
|
8582
|
+
/**
|
8583
|
+
@method _unregisterFromManager
|
8584
|
+
@private
|
8585
|
+
*/
|
8586
|
+
_unregisterFromManager: function(){
|
8587
|
+
this.manager.unregisterFilteredRecordArray(this);
|
8588
|
+
},
|
8589
|
+
|
8590
|
+
willDestroy: function(){
|
8591
|
+
this._unregisterFromManager();
|
8592
|
+
this._super();
|
8593
|
+
}
|
8450
8594
|
});
|
8451
8595
|
});
|
8452
|
-
|
8596
|
+
enifed("ember-data/system/record_arrays/many_array",
|
8453
8597
|
["ember-data/system/record_arrays/record_array","exports"],
|
8454
8598
|
function(__dependency1__, __exports__) {
|
8455
8599
|
"use strict";
|
@@ -8510,17 +8654,19 @@ define("ember-data/system/record_arrays/many_array",
|
|
8510
8654
|
*/
|
8511
8655
|
isPolymorphic: false,
|
8512
8656
|
|
8513
|
-
|
8657
|
+
/**
|
8658
|
+
The loading state of this array
|
8514
8659
|
|
8660
|
+
@property {Boolean} isLoaded
|
8661
|
+
*/
|
8515
8662
|
isLoaded: false,
|
8516
8663
|
|
8517
8664
|
/**
|
8518
8665
|
The relationship which manages this array.
|
8519
8666
|
|
8520
|
-
@property {
|
8667
|
+
@property {ManyRelationship} relationship
|
8521
8668
|
@private
|
8522
8669
|
*/
|
8523
|
-
|
8524
8670
|
relationship: null,
|
8525
8671
|
|
8526
8672
|
|
@@ -8587,14 +8733,14 @@ define("ember-data/system/record_arrays/many_array",
|
|
8587
8733
|
|
8588
8734
|
Ember.assert("You cannot add '" + type.typeKey + "' records to this polymorphic relationship.", !get(this, 'isPolymorphic'));
|
8589
8735
|
|
8590
|
-
record = store.createRecord
|
8736
|
+
record = store.createRecord(type, hash);
|
8591
8737
|
this.pushObject(record);
|
8592
8738
|
|
8593
8739
|
return record;
|
8594
8740
|
}
|
8595
8741
|
});
|
8596
8742
|
});
|
8597
|
-
|
8743
|
+
enifed("ember-data/system/record_arrays/record_array",
|
8598
8744
|
["ember-data/system/promise_proxies","exports"],
|
8599
8745
|
function(__dependency1__, __exports__) {
|
8600
8746
|
"use strict";
|
@@ -8802,7 +8948,7 @@ define("ember-data/system/record_arrays/record_array",
|
|
8802
8948
|
}
|
8803
8949
|
});
|
8804
8950
|
});
|
8805
|
-
|
8951
|
+
enifed("ember-data/system/relationship-meta",
|
8806
8952
|
["ember-inflector/system","exports"],
|
8807
8953
|
function(__dependency1__, __exports__) {
|
8808
8954
|
"use strict";
|
@@ -8837,7 +8983,7 @@ define("ember-data/system/relationship-meta",
|
|
8837
8983
|
|
8838
8984
|
__exports__.relationshipFromMeta = relationshipFromMeta;
|
8839
8985
|
});
|
8840
|
-
|
8986
|
+
enifed("ember-data/system/relationships",
|
8841
8987
|
["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],
|
8842
8988
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
8843
8989
|
"use strict";
|
@@ -8852,7 +8998,7 @@ define("ember-data/system/relationships",
|
|
8852
8998
|
__exports__.belongsTo = belongsTo;
|
8853
8999
|
__exports__.hasMany = hasMany;
|
8854
9000
|
});
|
8855
|
-
|
9001
|
+
enifed("ember-data/system/relationships/belongs_to",
|
8856
9002
|
["ember-data/system/model","exports"],
|
8857
9003
|
function(__dependency1__, __exports__) {
|
8858
9004
|
"use strict";
|
@@ -8959,7 +9105,7 @@ define("ember-data/system/relationships/belongs_to",
|
|
8959
9105
|
|
8960
9106
|
__exports__["default"] = belongsTo;
|
8961
9107
|
});
|
8962
|
-
|
9108
|
+
enifed("ember-data/system/relationships/ext",
|
8963
9109
|
["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],
|
8964
9110
|
function(__dependency1__, __dependency2__, __dependency3__) {
|
8965
9111
|
"use strict";
|
@@ -9070,10 +9216,10 @@ define("ember-data/system/relationships/ext",
|
|
9070
9216
|
},
|
9071
9217
|
|
9072
9218
|
inverseMap: Ember.computed(function() {
|
9073
|
-
return
|
9219
|
+
return Ember.create(null);
|
9074
9220
|
}),
|
9075
9221
|
|
9076
|
-
|
9222
|
+
/**
|
9077
9223
|
Find the relationship which is the inverse of the one asked for.
|
9078
9224
|
|
9079
9225
|
For example, if you define models like this:
|
@@ -9411,7 +9557,7 @@ define("ember-data/system/relationships/ext",
|
|
9411
9557
|
});
|
9412
9558
|
|
9413
9559
|
var fields = Ember.get(App.Blog, 'fields');
|
9414
|
-
fields.forEach(function(
|
9560
|
+
fields.forEach(function(kind, field) {
|
9415
9561
|
console.log(field, kind);
|
9416
9562
|
});
|
9417
9563
|
|
@@ -9520,7 +9666,7 @@ define("ember-data/system/relationships/ext",
|
|
9520
9666
|
|
9521
9667
|
});
|
9522
9668
|
});
|
9523
|
-
|
9669
|
+
enifed("ember-data/system/relationships/has_many",
|
9524
9670
|
["ember-data/system/model","exports"],
|
9525
9671
|
function(__dependency1__, __exports__) {
|
9526
9672
|
"use strict";
|
@@ -9655,7 +9801,7 @@ define("ember-data/system/relationships/has_many",
|
|
9655
9801
|
|
9656
9802
|
__exports__["default"] = hasMany;
|
9657
9803
|
});
|
9658
|
-
|
9804
|
+
enifed("ember-data/system/relationships/relationship",
|
9659
9805
|
["ember-data/system/promise_proxies","ember-data/system/map","exports"],
|
9660
9806
|
function(__dependency1__, __dependency2__, __exports__) {
|
9661
9807
|
"use strict";
|
@@ -9669,7 +9815,6 @@ define("ember-data/system/relationships/relationship",
|
|
9669
9815
|
this.key = relationshipMeta.key;
|
9670
9816
|
this.inverseKey = inverseKey;
|
9671
9817
|
this.record = record;
|
9672
|
-
this.key = relationshipMeta.key;
|
9673
9818
|
this.isAsync = relationshipMeta.options.async;
|
9674
9819
|
this.relationshipMeta = relationshipMeta;
|
9675
9820
|
//This probably breaks for polymorphic relationship in complex scenarios, due to
|
@@ -9703,20 +9848,24 @@ define("ember-data/system/relationships/relationship",
|
|
9703
9848
|
},
|
9704
9849
|
|
9705
9850
|
removeRecords: function(records){
|
9706
|
-
var
|
9707
|
-
|
9708
|
-
|
9709
|
-
|
9851
|
+
var length = Ember.get(records, 'length');
|
9852
|
+
var record;
|
9853
|
+
for (var i = 0; i < length; i++){
|
9854
|
+
record = records[i];
|
9855
|
+
this.removeRecord(record);
|
9856
|
+
}
|
9710
9857
|
},
|
9711
9858
|
|
9712
9859
|
addRecords: function(records, idx){
|
9713
|
-
var
|
9714
|
-
|
9715
|
-
|
9860
|
+
var length = Ember.get(records, 'length');
|
9861
|
+
var record;
|
9862
|
+
for (var i = 0; i < length; i++){
|
9863
|
+
record = records[i];
|
9864
|
+
this.addRecord(record, idx);
|
9716
9865
|
if (idx !== undefined) {
|
9717
9866
|
idx++;
|
9718
9867
|
}
|
9719
|
-
}
|
9868
|
+
}
|
9720
9869
|
},
|
9721
9870
|
|
9722
9871
|
addRecord: function(record, idx) {
|
@@ -9769,6 +9918,7 @@ define("ember-data/system/relationships/relationship",
|
|
9769
9918
|
},
|
9770
9919
|
|
9771
9920
|
updateLink: function(link) {
|
9921
|
+
Ember.assert("You have pushed a record of type '" + this.record.constructor.typeKey + "' with '" + this.key + "' as a link, but the value of that link is not a string.", typeof link === 'string' || link === null);
|
9772
9922
|
if (link !== this.link) {
|
9773
9923
|
this.link = link;
|
9774
9924
|
this.linkPromise = null;
|
@@ -9806,7 +9956,7 @@ define("ember-data/system/relationships/relationship",
|
|
9806
9956
|
this.manyArray.isPolymorphic = this.isPolymorphic;
|
9807
9957
|
};
|
9808
9958
|
|
9809
|
-
ManyRelationship.prototype =
|
9959
|
+
ManyRelationship.prototype = Ember.create(Relationship.prototype);
|
9810
9960
|
ManyRelationship.prototype.constructor = ManyRelationship;
|
9811
9961
|
ManyRelationship.prototype._super$constructor = Relationship;
|
9812
9962
|
|
@@ -9906,7 +10056,9 @@ define("ember-data/system/relationships/relationship",
|
|
9906
10056
|
} else {
|
9907
10057
|
Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.record.constructor.typeKey + "' with id " + this.record.get('id') + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.hasMany({ async: true })`)", this.manyArray.isEvery('isEmpty', false));
|
9908
10058
|
|
9909
|
-
this.manyArray.
|
10059
|
+
if (!this.manyArray.get('isDestroyed')) {
|
10060
|
+
this.manyArray.set('isLoaded', true);
|
10061
|
+
}
|
9910
10062
|
return this.manyArray;
|
9911
10063
|
}
|
9912
10064
|
};
|
@@ -9918,7 +10070,7 @@ define("ember-data/system/relationships/relationship",
|
|
9918
10070
|
this.inverseRecord = null;
|
9919
10071
|
};
|
9920
10072
|
|
9921
|
-
BelongsToRelationship.prototype =
|
10073
|
+
BelongsToRelationship.prototype = Ember.create(Relationship.prototype);
|
9922
10074
|
BelongsToRelationship.prototype.constructor = BelongsToRelationship;
|
9923
10075
|
BelongsToRelationship.prototype._super$constructor = Relationship;
|
9924
10076
|
|
@@ -9960,9 +10112,9 @@ define("ember-data/system/relationships/relationship",
|
|
9960
10112
|
|
9961
10113
|
BelongsToRelationship.prototype._super$removeRecordFromOwn = Relationship.prototype.removeRecordFromOwn;
|
9962
10114
|
BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
|
9963
|
-
if (!this.members.has(record)){ return;}
|
9964
|
-
this._super$removeRecordFromOwn(record);
|
10115
|
+
if (!this.members.has(record)) { return; }
|
9965
10116
|
this.inverseRecord = null;
|
10117
|
+
this._super$removeRecordFromOwn(record);
|
9966
10118
|
};
|
9967
10119
|
|
9968
10120
|
BelongsToRelationship.prototype.findRecord = function() {
|
@@ -9976,7 +10128,9 @@ define("ember-data/system/relationships/relationship",
|
|
9976
10128
|
BelongsToRelationship.prototype.fetchLink = function() {
|
9977
10129
|
var self = this;
|
9978
10130
|
return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function(record){
|
9979
|
-
|
10131
|
+
if (record) {
|
10132
|
+
self.addRecord(record);
|
10133
|
+
}
|
9980
10134
|
return record;
|
9981
10135
|
});
|
9982
10136
|
};
|
@@ -10037,7 +10191,7 @@ define("ember-data/system/relationships/relationship",
|
|
10037
10191
|
__exports__.BelongsToRelationship = BelongsToRelationship;
|
10038
10192
|
__exports__.createRelationshipFor = createRelationshipFor;
|
10039
10193
|
});
|
10040
|
-
|
10194
|
+
enifed("ember-data/system/store",
|
10041
10195
|
["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],
|
10042
10196
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
10043
10197
|
"use strict";
|
@@ -10118,14 +10272,6 @@ define("ember-data/system/store",
|
|
10118
10272
|
});
|
10119
10273
|
```
|
10120
10274
|
|
10121
|
-
If your application has multiple `DS.Store` instances (an unusual case), you can
|
10122
|
-
specify which store should be used:
|
10123
|
-
|
10124
|
-
```javascript
|
10125
|
-
store.find('person', 123).then(function (person) {
|
10126
|
-
});
|
10127
|
-
```
|
10128
|
-
|
10129
10275
|
By default, the store will talk to your backend using a standard
|
10130
10276
|
REST mechanism. You can customize how the store talks to your
|
10131
10277
|
backend by specifying a custom adapter:
|
@@ -10468,6 +10614,25 @@ define("ember-data/system/store",
|
|
10468
10614
|
return this.findById(type, coerceId(id), preload);
|
10469
10615
|
},
|
10470
10616
|
|
10617
|
+
/**
|
10618
|
+
This method returns a fresh record for a given type and id combination.
|
10619
|
+
|
10620
|
+
If a record is available for the given type/id combination, then it will fetch this record from the store then reload it. If there's no record corresponding in the store it will simply call store.find.
|
10621
|
+
|
10622
|
+
@method fetch
|
10623
|
+
@param {String or subclass of DS.Model} type
|
10624
|
+
@param {Object|String|Integer|null} id
|
10625
|
+
@param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
|
10626
|
+
@return {Promise} promise
|
10627
|
+
*/
|
10628
|
+
fetch: function(type, id, preload) {
|
10629
|
+
if (this.hasRecordForId(type, id)) {
|
10630
|
+
return this.getById(type, id).reload();
|
10631
|
+
} else {
|
10632
|
+
return this.find(type, id, preload);
|
10633
|
+
}
|
10634
|
+
},
|
10635
|
+
|
10471
10636
|
/**
|
10472
10637
|
This method returns a record for a given type and id combination.
|
10473
10638
|
|
@@ -10537,14 +10702,14 @@ define("ember-data/system/store",
|
|
10537
10702
|
var adapter = this.adapterFor(type);
|
10538
10703
|
|
10539
10704
|
Ember.assert("You tried to find a record but you have no adapter (for " + type + ")", adapter);
|
10540
|
-
Ember.assert("You tried to find a record but your adapter (for " + type + ") does not implement 'find'", adapter.find);
|
10705
|
+
Ember.assert("You tried to find a record but your adapter (for " + type + ") does not implement 'find'", typeof adapter.find === 'function');
|
10541
10706
|
|
10542
10707
|
var promise = _find(adapter, this, type, id, record);
|
10543
10708
|
return promise;
|
10544
10709
|
},
|
10545
10710
|
|
10546
10711
|
scheduleFetchMany: function(records) {
|
10547
|
-
return
|
10712
|
+
return Promise.all(map(records, this.scheduleFetch, this));
|
10548
10713
|
},
|
10549
10714
|
|
10550
10715
|
scheduleFetch: function(record) {
|
@@ -10694,7 +10859,7 @@ define("ember-data/system/store",
|
|
10694
10859
|
|
10695
10860
|
Ember.assert("You cannot reload a record without an ID", id);
|
10696
10861
|
Ember.assert("You tried to reload a record but you have no adapter (for " + type + ")", adapter);
|
10697
|
-
Ember.assert("You tried to reload a record but your adapter does not implement `find`", adapter.find);
|
10862
|
+
Ember.assert("You tried to reload a record but your adapter does not implement `find`", typeof adapter.find === 'function');
|
10698
10863
|
|
10699
10864
|
return this.scheduleFetch(record);
|
10700
10865
|
},
|
@@ -10747,7 +10912,7 @@ define("ember-data/system/store",
|
|
10747
10912
|
*/
|
10748
10913
|
findMany: function(records) {
|
10749
10914
|
var store = this;
|
10750
|
-
return Promise.all(
|
10915
|
+
return Promise.all(map(records, function(record) {
|
10751
10916
|
return store._findByRecord(record);
|
10752
10917
|
}));
|
10753
10918
|
},
|
@@ -10775,7 +10940,7 @@ define("ember-data/system/store",
|
|
10775
10940
|
var adapter = this.adapterFor(owner.constructor);
|
10776
10941
|
|
10777
10942
|
Ember.assert("You tried to load a hasMany relationship but you have no adapter (for " + owner.constructor + ")", adapter);
|
10778
|
-
Ember.assert("You tried to load a hasMany relationship from a specified `link` in the original payload but your adapter does not implement `findHasMany`", adapter.findHasMany);
|
10943
|
+
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');
|
10779
10944
|
|
10780
10945
|
return _findHasMany(adapter, this, owner, link, type);
|
10781
10946
|
},
|
@@ -10792,7 +10957,7 @@ define("ember-data/system/store",
|
|
10792
10957
|
var adapter = this.adapterFor(owner.constructor);
|
10793
10958
|
|
10794
10959
|
Ember.assert("You tried to load a belongsTo relationship but you have no adapter (for " + owner.constructor + ")", adapter);
|
10795
|
-
Ember.assert("You tried to load a belongsTo relationship from a specified `link` in the original payload but your adapter does not implement `findBelongsTo`", adapter.findBelongsTo);
|
10960
|
+
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');
|
10796
10961
|
|
10797
10962
|
return _findBelongsTo(adapter, this, owner, link, relationship);
|
10798
10963
|
},
|
@@ -10822,7 +10987,7 @@ define("ember-data/system/store",
|
|
10822
10987
|
var adapter = this.adapterFor(type);
|
10823
10988
|
|
10824
10989
|
Ember.assert("You tried to load a query but you have no adapter (for " + type + ")", adapter);
|
10825
|
-
Ember.assert("You tried to load a query but your adapter does not implement `findQuery`", adapter.findQuery);
|
10990
|
+
Ember.assert("You tried to load a query but your adapter does not implement `findQuery`", typeof adapter.findQuery === 'function');
|
10826
10991
|
|
10827
10992
|
return promiseArray(_findQuery(adapter, this, type, query, array));
|
10828
10993
|
},
|
@@ -10857,7 +11022,7 @@ define("ember-data/system/store",
|
|
10857
11022
|
set(array, 'isUpdating', true);
|
10858
11023
|
|
10859
11024
|
Ember.assert("You tried to load all records but you have no adapter (for " + type + ")", adapter);
|
10860
|
-
Ember.assert("You tried to load all records but your adapter does not implement `findAll`", adapter.findAll);
|
11025
|
+
Ember.assert("You tried to load all records but your adapter does not implement `findAll`", typeof adapter.findAll === 'function');
|
10861
11026
|
|
10862
11027
|
return promiseArray(_findAll(adapter, this, type, sinceToken));
|
10863
11028
|
},
|
@@ -10872,14 +11037,17 @@ define("ember-data/system/store",
|
|
10872
11037
|
},
|
10873
11038
|
|
10874
11039
|
/**
|
10875
|
-
This method returns a filtered array that contains all of the
|
10876
|
-
for a given type.
|
11040
|
+
This method returns a filtered array that contains all of the
|
11041
|
+
known records for a given type in the store.
|
10877
11042
|
|
10878
|
-
Note that because it's just a filter,
|
10879
|
-
created records of the type
|
11043
|
+
Note that because it's just a filter, the result will contain any
|
11044
|
+
locally created records of the type, however, it will not make a
|
11045
|
+
request to the backend to retrieve additional records. If you
|
11046
|
+
would like to request all the records from the backend please use
|
11047
|
+
[store.find](#method_find).
|
10880
11048
|
|
10881
11049
|
Also note that multiple calls to `all` for a given type will always
|
10882
|
-
return the same RecordArray
|
11050
|
+
return the same `RecordArray`.
|
10883
11051
|
|
10884
11052
|
Example
|
10885
11053
|
|
@@ -10935,10 +11103,18 @@ define("ember-data/system/store",
|
|
10935
11103
|
remains up to date as new records are loaded into the store or created
|
10936
11104
|
locally.
|
10937
11105
|
|
10938
|
-
The
|
11106
|
+
The filter function takes a materialized record, and returns true
|
10939
11107
|
if the record should be included in the filter and false if it should
|
10940
11108
|
not.
|
10941
11109
|
|
11110
|
+
Example
|
11111
|
+
|
11112
|
+
```javascript
|
11113
|
+
store.filter('post', function(post) {
|
11114
|
+
return post.get('unread');
|
11115
|
+
});
|
11116
|
+
```
|
11117
|
+
|
10942
11118
|
The filter function is called once on all records for the type when
|
10943
11119
|
it is created, and then once on each newly loaded or created record.
|
10944
11120
|
|
@@ -10946,14 +11122,19 @@ define("ember-data/system/store",
|
|
10946
11122
|
filter function will be invoked again to determine whether it should
|
10947
11123
|
still be in the array.
|
10948
11124
|
|
10949
|
-
Optionally you can pass a query which
|
10950
|
-
|
10951
|
-
|
11125
|
+
Optionally you can pass a query, which is the equivalent of calling
|
11126
|
+
[find](#method_find) with that same query, to fetch additional records
|
11127
|
+
from the server. The results returned by the server could then appear
|
11128
|
+
in the filter if they match the filter function.
|
11129
|
+
|
11130
|
+
The query itself is not used to filter records, it's only sent to your
|
11131
|
+
server for you to be able to do server-side filtering. The filter
|
11132
|
+
function will be applied on the returned results regardless.
|
10952
11133
|
|
10953
11134
|
Example
|
10954
11135
|
|
10955
11136
|
```javascript
|
10956
|
-
store.filter('post', {unread: true}, function(post) {
|
11137
|
+
store.filter('post', { unread: true }, function(post) {
|
10957
11138
|
return post.get('unread');
|
10958
11139
|
}).then(function(unreadPosts) {
|
10959
11140
|
unreadPosts.get('length'); // 5
|
@@ -11197,9 +11378,9 @@ define("ember-data/system/store",
|
|
11197
11378
|
if (typeMap) { return typeMap; }
|
11198
11379
|
|
11199
11380
|
typeMap = {
|
11200
|
-
idToRecord:
|
11381
|
+
idToRecord: Ember.create(null),
|
11201
11382
|
records: [],
|
11202
|
-
metadata:
|
11383
|
+
metadata: Ember.create(null),
|
11203
11384
|
type: type
|
11204
11385
|
};
|
11205
11386
|
|
@@ -11331,10 +11512,11 @@ define("ember-data/system/store",
|
|
11331
11512
|
// _partial is an internal param used by `update`.
|
11332
11513
|
// If passed, it means that the data should be
|
11333
11514
|
// merged into the existing data, not replace it.
|
11334
|
-
Ember.assert("Expected an object as `data` in a call to push for " + typeName + " , but was " + data, Ember.typeOf(data) === 'object');
|
11335
|
-
Ember.assert("You must include an `id` for " + typeName + " in an object passed to `push`", data.id != null);
|
11515
|
+
Ember.assert("Expected an object as `data` in a call to `push`/`update` for " + typeName + " , but was " + data, Ember.typeOf(data) === 'object');
|
11516
|
+
Ember.assert("You must include an `id` for " + typeName + " in an object passed to `push`/`update`", data.id != null && data.id !== '');
|
11336
11517
|
|
11337
11518
|
var type = this.modelFor(typeName);
|
11519
|
+
var filter = Ember.EnumerableUtils.filter;
|
11338
11520
|
|
11339
11521
|
// If the payload contains relationships that are specified as
|
11340
11522
|
// IDs, normalizeRelationships will convert them into DS.Model instances
|
@@ -11343,6 +11525,15 @@ define("ember-data/system/store",
|
|
11343
11525
|
|
11344
11526
|
data = normalizeRelationships(this, type, data);
|
11345
11527
|
|
11528
|
+
Ember.warn("The payload for '" + typeName + "' contains these unknown keys: " +
|
11529
|
+
Ember.inspect(filter(Ember.keys(data), function(key) {
|
11530
|
+
return !get(type, 'fields').has(key) && key !== 'id' && key !== 'links';
|
11531
|
+
})) + ". Make sure they've been defined in your model.",
|
11532
|
+
filter(Ember.keys(data), function(key) {
|
11533
|
+
return !get(type, 'fields').has(key) && key !== 'id' && key !== 'links';
|
11534
|
+
}).length === 0
|
11535
|
+
);
|
11536
|
+
|
11346
11537
|
// Actually load the record into the store.
|
11347
11538
|
|
11348
11539
|
this._load(type, data, _partial);
|
@@ -11407,7 +11598,7 @@ define("ember-data/system/store",
|
|
11407
11598
|
if (!inputPayload) {
|
11408
11599
|
payload = type;
|
11409
11600
|
serializer = defaultSerializer(this.container);
|
11410
|
-
Ember.assert("You cannot use `store#pushPayload` without a type unless your default serializer defines `pushPayload`", serializer.pushPayload);
|
11601
|
+
Ember.assert("You cannot use `store#pushPayload` without a type unless your default serializer defines `pushPayload`", typeof serializer.pushPayload === 'function');
|
11411
11602
|
} else {
|
11412
11603
|
payload = inputPayload;
|
11413
11604
|
serializer = this.serializerFor(type);
|
@@ -11473,8 +11664,6 @@ define("ember-data/system/store",
|
|
11473
11664
|
@return {DS.Model} the record that was updated.
|
11474
11665
|
*/
|
11475
11666
|
update: function(type, data) {
|
11476
|
-
Ember.assert("You must include an `id` for " + type + " in a hash passed to `update`", data.id != null);
|
11477
|
-
|
11478
11667
|
return this.push(type, data, true);
|
11479
11668
|
},
|
11480
11669
|
|
@@ -11681,6 +11870,7 @@ define("ember-data/system/store",
|
|
11681
11870
|
if (isNone(id) || id instanceof Model) {
|
11682
11871
|
return;
|
11683
11872
|
}
|
11873
|
+
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));
|
11684
11874
|
|
11685
11875
|
var type;
|
11686
11876
|
|
@@ -11702,9 +11892,11 @@ define("ember-data/system/store",
|
|
11702
11892
|
}
|
11703
11893
|
|
11704
11894
|
function deserializeRecordIds(store, data, key, relationship, ids) {
|
11705
|
-
if (
|
11895
|
+
if (isNone(ids)) {
|
11706
11896
|
return;
|
11707
11897
|
}
|
11898
|
+
|
11899
|
+
Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being '" + Ember.inspect(ids) + "', but " + key + " is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.", Ember.isArray(ids));
|
11708
11900
|
for (var i=0, l=ids.length; i<l; i++) {
|
11709
11901
|
deserializeRecordId(store, ids, i, relationship, ids[i]);
|
11710
11902
|
}
|
@@ -11839,6 +12031,11 @@ define("ember-data/system/store",
|
|
11839
12031
|
|
11840
12032
|
return promise.then(function(adapterPayload) {
|
11841
12033
|
var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findBelongsTo');
|
12034
|
+
|
12035
|
+
if (!payload) {
|
12036
|
+
return null;
|
12037
|
+
}
|
12038
|
+
|
11842
12039
|
var record = store.push(relationship.type, payload);
|
11843
12040
|
return record;
|
11844
12041
|
}, null, "DS: Extract payload of " + record + " : " + relationship.type);
|
@@ -11906,7 +12103,9 @@ define("ember-data/system/store",
|
|
11906
12103
|
return record;
|
11907
12104
|
}, function(reason) {
|
11908
12105
|
if (reason instanceof InvalidError) {
|
11909
|
-
|
12106
|
+
var errors = serializer.extractErrors(store, type, reason.errors, get(record, 'id'));
|
12107
|
+
store.recordWasInvalid(record, errors);
|
12108
|
+
reason = new InvalidError(errors);
|
11910
12109
|
} else {
|
11911
12110
|
store.recordWasError(record, reason);
|
11912
12111
|
}
|
@@ -11941,7 +12140,7 @@ define("ember-data/system/store",
|
|
11941
12140
|
__exports__.Store = Store;
|
11942
12141
|
__exports__["default"] = Store;
|
11943
12142
|
});
|
11944
|
-
|
12143
|
+
enifed("ember-data/transforms",
|
11945
12144
|
["ember-data/transforms/base","ember-data/transforms/number","ember-data/transforms/date","ember-data/transforms/string","ember-data/transforms/boolean","exports"],
|
11946
12145
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
|
11947
12146
|
"use strict";
|
@@ -11957,7 +12156,7 @@ define("ember-data/transforms",
|
|
11957
12156
|
__exports__.StringTransform = StringTransform;
|
11958
12157
|
__exports__.BooleanTransform = BooleanTransform;
|
11959
12158
|
});
|
11960
|
-
|
12159
|
+
enifed("ember-data/transforms/base",
|
11961
12160
|
["exports"],
|
11962
12161
|
function(__exports__) {
|
11963
12162
|
"use strict";
|
@@ -12033,7 +12232,7 @@ define("ember-data/transforms/base",
|
|
12033
12232
|
deserialize: Ember.required()
|
12034
12233
|
});
|
12035
12234
|
});
|
12036
|
-
|
12235
|
+
enifed("ember-data/transforms/boolean",
|
12037
12236
|
["ember-data/transforms/base","exports"],
|
12038
12237
|
function(__dependency1__, __exports__) {
|
12039
12238
|
"use strict";
|
@@ -12080,7 +12279,7 @@ define("ember-data/transforms/boolean",
|
|
12080
12279
|
}
|
12081
12280
|
});
|
12082
12281
|
});
|
12083
|
-
|
12282
|
+
enifed("ember-data/transforms/date",
|
12084
12283
|
["ember-data/transforms/base","exports"],
|
12085
12284
|
function(__dependency1__, __exports__) {
|
12086
12285
|
"use strict";
|
@@ -12132,7 +12331,6 @@ define("ember-data/transforms/date",
|
|
12132
12331
|
}
|
12133
12332
|
|
12134
12333
|
__exports__["default"] = Transform.extend({
|
12135
|
-
|
12136
12334
|
deserialize: function(serialized) {
|
12137
12335
|
var type = typeof serialized;
|
12138
12336
|
|
@@ -12158,7 +12356,7 @@ define("ember-data/transforms/date",
|
|
12158
12356
|
}
|
12159
12357
|
});
|
12160
12358
|
});
|
12161
|
-
|
12359
|
+
enifed("ember-data/transforms/number",
|
12162
12360
|
["ember-data/transforms/base","exports"],
|
12163
12361
|
function(__dependency1__, __exports__) {
|
12164
12362
|
"use strict";
|
@@ -12197,7 +12395,7 @@ define("ember-data/transforms/number",
|
|
12197
12395
|
}
|
12198
12396
|
});
|
12199
12397
|
});
|
12200
|
-
|
12398
|
+
enifed("ember-data/transforms/string",
|
12201
12399
|
["ember-data/transforms/base","exports"],
|
12202
12400
|
function(__dependency1__, __exports__) {
|
12203
12401
|
"use strict";
|
@@ -12234,7 +12432,7 @@ define("ember-data/transforms/string",
|
|
12234
12432
|
}
|
12235
12433
|
});
|
12236
12434
|
});
|
12237
|
-
|
12435
|
+
enifed("ember-inflector",
|
12238
12436
|
["./system","./helpers","./ext/string","exports"],
|
12239
12437
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
12240
12438
|
"use strict";
|
@@ -12255,7 +12453,7 @@ define("ember-inflector",
|
|
12255
12453
|
__exports__.pluralize = pluralize;
|
12256
12454
|
__exports__.singularize = singularize;
|
12257
12455
|
});
|
12258
|
-
|
12456
|
+
enifed("ember-inflector/ext/string",
|
12259
12457
|
["../system/string"],
|
12260
12458
|
function(__dependency1__) {
|
12261
12459
|
"use strict";
|
@@ -12284,7 +12482,7 @@ define("ember-inflector/ext/string",
|
|
12284
12482
|
};
|
12285
12483
|
}
|
12286
12484
|
});
|
12287
|
-
|
12485
|
+
enifed("ember-inflector/helpers",
|
12288
12486
|
["./system/string"],
|
12289
12487
|
function(__dependency1__) {
|
12290
12488
|
"use strict";
|
@@ -12323,7 +12521,7 @@ define("ember-inflector/helpers",
|
|
12323
12521
|
*/
|
12324
12522
|
Ember.Handlebars.helper('pluralize', pluralize);
|
12325
12523
|
});
|
12326
|
-
|
12524
|
+
enifed("ember-inflector/system",
|
12327
12525
|
["./system/inflector","./system/string","./system/inflections","exports"],
|
12328
12526
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
12329
12527
|
"use strict";
|
@@ -12342,7 +12540,7 @@ define("ember-inflector/system",
|
|
12342
12540
|
__exports__.pluralize = pluralize;
|
12343
12541
|
__exports__.defaultRules = defaultRules;
|
12344
12542
|
});
|
12345
|
-
|
12543
|
+
enifed("ember-inflector/system/inflections",
|
12346
12544
|
["exports"],
|
12347
12545
|
function(__exports__) {
|
12348
12546
|
"use strict";
|
@@ -12425,7 +12623,7 @@ define("ember-inflector/system/inflections",
|
|
12425
12623
|
]
|
12426
12624
|
};
|
12427
12625
|
});
|
12428
|
-
|
12626
|
+
enifed("ember-inflector/system/inflector",
|
12429
12627
|
["exports"],
|
12430
12628
|
function(__exports__) {
|
12431
12629
|
"use strict";
|
@@ -12726,7 +12924,7 @@ define("ember-inflector/system/inflector",
|
|
12726
12924
|
|
12727
12925
|
__exports__["default"] = Inflector;
|
12728
12926
|
});
|
12729
|
-
|
12927
|
+
enifed("ember-inflector/system/string",
|
12730
12928
|
["./inflector","exports"],
|
12731
12929
|
function(__dependency1__, __exports__) {
|
12732
12930
|
"use strict";
|