ember-data-source 2.17.0.beta.1 → 2.17.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/globals/ember-data.js +687 -705
- data/dist/globals/ember-data.min.js +6 -6
- data/dist/globals/ember-data.prod.js +687 -705
- data/package.json +10 -11
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd07ee80c0a2563b28d9931d5f9d6bcaf7028b31
|
4
|
+
data.tar.gz: 206c673a9ec777bfe33681327623ea9d3ea5faa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 955cf017f808d9b7d5416c54a74842ceb1463ebbcc969f19318079c421425ee909ace2cdd57ba18401ff0f1ccd1c6d89ad9f0c617abdd7e4096166cb1c07fb49
|
7
|
+
data.tar.gz: ad543076383a458cd54c40c43dc760dae946d8f44f9c5da970722626d34dff524d17fb7fc90b52da4fccc0399c033731e325595c7da4820c713a0baa88dbcc28
|
data/dist/globals/ember-data.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* @copyright Copyright 2011-2017 Tilde Inc. and contributors.
|
7
7
|
* Portions Copyright 2011 LivingSocial Inc.
|
8
8
|
* @license Licensed under MIT license (see license.js)
|
9
|
-
* @version 2.17.0-beta.
|
9
|
+
* @version 2.17.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var loader, define, requireModule, require, requirejs;
|
@@ -345,11 +345,10 @@ var loader, define, requireModule, require, requirejs;
|
|
345
345
|
module.exports = { require: require, define: define };
|
346
346
|
}
|
347
347
|
})(this);
|
348
|
-
define('ember-data/-debug', ['exports'
|
348
|
+
define('ember-data/-debug', ['exports'], function (exports) {
|
349
349
|
'use strict';
|
350
350
|
|
351
351
|
exports.__esModule = true;
|
352
|
-
exports.assertPolymorphicType = undefined;
|
353
352
|
exports.instrument = instrument;
|
354
353
|
function instrument(method) {
|
355
354
|
return method();
|
@@ -383,7 +382,7 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
|
|
383
382
|
//once it exists in Ember
|
384
383
|
return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
|
385
384
|
}
|
386
|
-
if (
|
385
|
+
if (Ember.MODEL_FACTORY_INJECTIONS) {
|
387
386
|
modelClass = modelClass.superclass;
|
388
387
|
}
|
389
388
|
return modelClass.detect(addedModelClass);
|
@@ -397,48 +396,20 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
|
|
397
396
|
var relationshipClass = parentInternalModel.store.modelFor(relationshipModelName);
|
398
397
|
var assertionMessage = 'You cannot add a record of modelClass \'' + addedModelName + '\' to the \'' + parentModelName + '.' + key + '\' relationship (only \'' + relationshipModelName + '\' allowed)';
|
399
398
|
|
400
|
-
(false &&
|
399
|
+
(false && Ember.assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass)));
|
401
400
|
};
|
402
401
|
}
|
403
402
|
|
404
403
|
exports.assertPolymorphicType = assertPolymorphicType;
|
405
404
|
});
|
406
|
-
define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember
|
405
|
+
define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember-inflector'], function (exports, _emberInflector) {
|
407
406
|
'use strict';
|
408
407
|
|
409
408
|
exports.__esModule = true;
|
410
|
-
|
411
|
-
|
412
|
-
var get =
|
413
|
-
|
414
|
-
/**
|
415
|
-
|
416
|
-
WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4
|
417
|
-
|
418
|
-
## Using BuildURLMixin
|
419
|
-
|
420
|
-
To use url building, include the mixin when extending an adapter, and call `buildURL` where needed.
|
421
|
-
The default behaviour is designed for RESTAdapter.
|
422
|
-
|
423
|
-
### Example
|
424
|
-
|
425
|
-
```javascript
|
426
|
-
export default DS.Adapter.extend(BuildURLMixin, {
|
427
|
-
findRecord: function(store, type, id, snapshot) {
|
428
|
-
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
|
429
|
-
return this.ajax(url, 'GET');
|
430
|
-
}
|
431
|
-
});
|
432
|
-
```
|
433
|
-
|
434
|
-
### Attributes
|
435
|
-
|
436
|
-
The `host` and `namespace` attributes will be used if defined, and are optional.
|
437
|
-
|
438
|
-
@class BuildURLMixin
|
439
|
-
@namespace DS
|
440
|
-
*/
|
441
|
-
exports.default = _ember.default.Mixin.create({
|
409
|
+
var camelize = Ember.String.camelize;
|
410
|
+
var Mixin = Ember.Mixin;
|
411
|
+
var get = Ember.get;
|
412
|
+
exports.default = Mixin.create({
|
442
413
|
/**
|
443
414
|
Builds a URL for a given type and optional ID.
|
444
415
|
By default, it pluralizes the type's name (for example, 'post'
|
@@ -803,10 +774,11 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
|
|
803
774
|
endpoint of "/line_items/".
|
804
775
|
```app/adapters/application.js
|
805
776
|
import DS from 'ember-data';
|
777
|
+
import { decamelize } from '@ember/string';
|
806
778
|
import { pluralize } from 'ember-inflector';
|
807
779
|
export default DS.RESTAdapter.extend({
|
808
780
|
pathForType: function(modelName) {
|
809
|
-
var decamelized =
|
781
|
+
var decamelized = decamelize(modelName);
|
810
782
|
return pluralize(decamelized);
|
811
783
|
}
|
812
784
|
});
|
@@ -816,23 +788,23 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
|
|
816
788
|
@return {String} path
|
817
789
|
**/
|
818
790
|
pathForType: function (modelName) {
|
819
|
-
var camelized =
|
791
|
+
var camelized = camelize(modelName);
|
820
792
|
return (0, _emberInflector.pluralize)(camelized);
|
821
793
|
}
|
822
794
|
});
|
823
795
|
});
|
824
|
-
define('ember-data/-private/adapters/errors', ['exports'
|
796
|
+
define('ember-data/-private/adapters/errors', ['exports'], function (exports) {
|
825
797
|
'use strict';
|
826
798
|
|
827
799
|
exports.__esModule = true;
|
828
|
-
exports.ServerError = exports.ConflictError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.AbortError = exports.TimeoutError = exports.InvalidError = undefined;
|
829
800
|
exports.AdapterError = AdapterError;
|
830
801
|
exports.errorsHashToArray = errorsHashToArray;
|
831
802
|
exports.errorsArrayToHash = errorsArrayToHash;
|
803
|
+
var makeArray = Ember.makeArray;
|
804
|
+
var isPresent = Ember.isPresent;
|
805
|
+
var EmberError = Ember.Error;
|
832
806
|
|
833
807
|
|
834
|
-
var EmberError = _ember.default.Error;
|
835
|
-
|
836
808
|
var SOURCE_POINTER_REGEXP = /^\/?data\/(attributes|relationships)\/(.*)/;
|
837
809
|
var SOURCE_POINTER_PRIMARY_REGEXP = /^\/?data/;
|
838
810
|
var PRIMARY_ATTRIBUTE_KEY = 'base';
|
@@ -884,10 +856,10 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
884
856
|
`under-maintenance` route:
|
885
857
|
|
886
858
|
```app/routes/application.js
|
887
|
-
import
|
859
|
+
import Route from '@ember/routing/route';
|
888
860
|
import MaintenanceError from '../adapters/maintenance-error';
|
889
861
|
|
890
|
-
export default
|
862
|
+
export default Route.extend({
|
891
863
|
actions: {
|
892
864
|
error(error, transition) {
|
893
865
|
if (error instanceof MaintenanceError) {
|
@@ -927,7 +899,7 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
927
899
|
|
928
900
|
function extend(ParentErrorClass, defaultMessage) {
|
929
901
|
var ErrorClass = function (errors, message) {
|
930
|
-
(false &&
|
902
|
+
(false && Ember.assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || [])));
|
931
903
|
|
932
904
|
ParentErrorClass.call(this, errors, message || defaultMessage);
|
933
905
|
};
|
@@ -970,13 +942,13 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
970
942
|
rejects with a `DS.InvalidError` object that looks like this:
|
971
943
|
|
972
944
|
```app/adapters/post.js
|
973
|
-
import
|
945
|
+
import RSVP from 'RSVP';
|
974
946
|
import DS from 'ember-data';
|
975
947
|
|
976
948
|
export default DS.RESTAdapter.extend({
|
977
949
|
updateRecord() {
|
978
950
|
// Fictional adapter that always rejects
|
979
|
-
return
|
951
|
+
return RSVP.reject(new DS.InvalidError([
|
980
952
|
{
|
981
953
|
detail: 'Must be unique',
|
982
954
|
source: { pointer: '/data/attributes/title' }
|
@@ -1010,12 +982,12 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1010
982
|
connection if an adapter operation has timed out:
|
1011
983
|
|
1012
984
|
```app/routes/application.js
|
1013
|
-
import
|
985
|
+
import Route from '@ember/routing/route';
|
1014
986
|
import DS from 'ember-data';
|
1015
987
|
|
1016
988
|
const { TimeoutError } = DS;
|
1017
989
|
|
1018
|
-
export default
|
990
|
+
export default Route.extend({
|
1019
991
|
actions: {
|
1020
992
|
error(error, transition) {
|
1021
993
|
if (error instanceof TimeoutError) {
|
@@ -1056,12 +1028,12 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1056
1028
|
request is unauthorized:
|
1057
1029
|
|
1058
1030
|
```app/routes/application.js
|
1059
|
-
import
|
1031
|
+
import Route from '@ember/routing/route';
|
1060
1032
|
import DS from 'ember-data';
|
1061
1033
|
|
1062
1034
|
const { UnauthorizedError } = DS;
|
1063
1035
|
|
1064
|
-
export default
|
1036
|
+
export default Route.extend({
|
1065
1037
|
actions: {
|
1066
1038
|
error(error, transition) {
|
1067
1039
|
if (error instanceof UnauthorizedError) {
|
@@ -1102,12 +1074,12 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1102
1074
|
for a specific model that does not exist. For example:
|
1103
1075
|
|
1104
1076
|
```app/routes/post.js
|
1105
|
-
import
|
1077
|
+
import Route from '@ember/routing/route';
|
1106
1078
|
import DS from 'ember-data';
|
1107
1079
|
|
1108
1080
|
const { NotFoundError } = DS;
|
1109
1081
|
|
1110
|
-
export default
|
1082
|
+
export default Route.extend({
|
1111
1083
|
model(params) {
|
1112
1084
|
return this.get('store').findRecord('post', params.post_id);
|
1113
1085
|
},
|
@@ -1202,9 +1174,9 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1202
1174
|
function errorsHashToArray(errors) {
|
1203
1175
|
var out = [];
|
1204
1176
|
|
1205
|
-
if (
|
1177
|
+
if (isPresent(errors)) {
|
1206
1178
|
Object.keys(errors).forEach(function (key) {
|
1207
|
-
var messages =
|
1179
|
+
var messages = makeArray(errors[key]);
|
1208
1180
|
for (var i = 0; i < messages.length; i++) {
|
1209
1181
|
var title = 'Invalid Attribute';
|
1210
1182
|
var pointer = '/data/attributes/' + key;
|
@@ -1269,7 +1241,7 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1269
1241
|
function errorsArrayToHash(errors) {
|
1270
1242
|
var out = {};
|
1271
1243
|
|
1272
|
-
if (
|
1244
|
+
if (isPresent(errors)) {
|
1273
1245
|
errors.forEach(function (error) {
|
1274
1246
|
if (error.source && error.source.pointer) {
|
1275
1247
|
var key = error.source.pointer.match(SOURCE_POINTER_REGEXP);
|
@@ -1291,7 +1263,7 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (ex
|
|
1291
1263
|
return out;
|
1292
1264
|
}
|
1293
1265
|
});
|
1294
|
-
define('ember-data/-private/core', ['exports', 'ember
|
1266
|
+
define('ember-data/-private/core', ['exports', 'ember-data/version'], function (exports, _version) {
|
1295
1267
|
'use strict';
|
1296
1268
|
|
1297
1269
|
exports.__esModule = true;
|
@@ -1313,18 +1285,18 @@ define('ember-data/-private/core', ['exports', 'ember', 'ember-data/version'], f
|
|
1313
1285
|
@type String
|
1314
1286
|
@static
|
1315
1287
|
*/
|
1316
|
-
var DS =
|
1288
|
+
var DS = Ember.Namespace.create({
|
1317
1289
|
VERSION: _version.default,
|
1318
1290
|
name: "DS"
|
1319
1291
|
});
|
1320
1292
|
|
1321
|
-
if (
|
1322
|
-
|
1293
|
+
if (Ember.libraries) {
|
1294
|
+
Ember.libraries.registerCoreLibrary('Ember Data', DS.VERSION);
|
1323
1295
|
}
|
1324
1296
|
|
1325
1297
|
exports.default = DS;
|
1326
1298
|
});
|
1327
|
-
define('ember-data/-private/features', ['exports'
|
1299
|
+
define('ember-data/-private/features', ['exports'], function (exports) {
|
1328
1300
|
'use strict';
|
1329
1301
|
|
1330
1302
|
exports.__esModule = true;
|
@@ -1332,7 +1304,7 @@ define('ember-data/-private/features', ['exports', 'ember'], function (exports,
|
|
1332
1304
|
function isEnabled() {
|
1333
1305
|
var _Ember$FEATURES;
|
1334
1306
|
|
1335
|
-
return (_Ember$FEATURES =
|
1307
|
+
return (_Ember$FEATURES = Ember.FEATURES).isEnabled.apply(_Ember$FEATURES, arguments);
|
1336
1308
|
}
|
1337
1309
|
});
|
1338
1310
|
define('ember-data/-private/global', ['exports'], function (exports) {
|
@@ -1653,18 +1625,18 @@ define('ember-data/-private/system/coerce-id', ['exports'], function (exports) {
|
|
1653
1625
|
return '' + id;
|
1654
1626
|
}
|
1655
1627
|
});
|
1656
|
-
define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember
|
1628
|
+
define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember-data/-private/system/model/model'], function (exports, _model) {
|
1657
1629
|
'use strict';
|
1658
1630
|
|
1659
1631
|
exports.__esModule = true;
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
var
|
1664
|
-
var
|
1665
|
-
var
|
1666
|
-
|
1667
|
-
exports.default =
|
1632
|
+
var addObserver = Ember.addObserver;
|
1633
|
+
var removeObserver = Ember.removeObserver;
|
1634
|
+
var A = Ember.A;
|
1635
|
+
var DataAdapter = Ember.DataAdapter;
|
1636
|
+
var capitalize = Ember.String.capitalize;
|
1637
|
+
var underscore = Ember.String.underscore;
|
1638
|
+
var get = Ember.get;
|
1639
|
+
exports.default = DataAdapter.extend({
|
1668
1640
|
getFilters: function () {
|
1669
1641
|
return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
|
1670
1642
|
},
|
@@ -1698,7 +1670,8 @@ define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'e
|
|
1698
1670
|
}
|
1699
1671
|
}
|
1700
1672
|
}
|
1701
|
-
assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
|
1673
|
+
(false && Ember.assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName));
|
1674
|
+
|
1702
1675
|
return this.get('store').peekAll(modelName);
|
1703
1676
|
},
|
1704
1677
|
getRecordColumnValues: function (record) {
|
@@ -1717,7 +1690,7 @@ define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'e
|
|
1717
1690
|
},
|
1718
1691
|
getRecordKeywords: function (record) {
|
1719
1692
|
var keywords = [];
|
1720
|
-
var keys =
|
1693
|
+
var keys = A(['id']);
|
1721
1694
|
record.eachAttribute(function (key) {
|
1722
1695
|
return keys.push(key);
|
1723
1696
|
});
|
@@ -1743,8 +1716,8 @@ define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'e
|
|
1743
1716
|
return color;
|
1744
1717
|
},
|
1745
1718
|
observeRecord: function (record, recordUpdated) {
|
1746
|
-
var releaseMethods =
|
1747
|
-
var keysToObserve =
|
1719
|
+
var releaseMethods = A();
|
1720
|
+
var keysToObserve = A(['id', 'isNew', 'hasDirtyAttributes']);
|
1748
1721
|
|
1749
1722
|
record.eachAttribute(function (key) {
|
1750
1723
|
return keysToObserve.push(key);
|
@@ -1755,9 +1728,9 @@ define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'e
|
|
1755
1728
|
var handler = function () {
|
1756
1729
|
recordUpdated(adapter.wrapRecord(record));
|
1757
1730
|
};
|
1758
|
-
|
1731
|
+
addObserver(record, key, handler);
|
1759
1732
|
releaseMethods.push(function () {
|
1760
|
-
|
1733
|
+
removeObserver(record, key, handler);
|
1761
1734
|
});
|
1762
1735
|
});
|
1763
1736
|
|
@@ -2016,11 +1989,13 @@ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/
|
|
2016
1989
|
|
2017
1990
|
exports.default = InternalModelMap;
|
2018
1991
|
});
|
2019
|
-
define('ember-data/-private/system/is-array-like', ['exports'
|
1992
|
+
define('ember-data/-private/system/is-array-like', ['exports'], function (exports) {
|
2020
1993
|
'use strict';
|
2021
1994
|
|
2022
1995
|
exports.__esModule = true;
|
2023
1996
|
exports.default = isArrayLike;
|
1997
|
+
var typeOf = Ember.typeOf;
|
1998
|
+
var EmberArray = Ember.Array;
|
2024
1999
|
|
2025
2000
|
|
2026
2001
|
/*
|
@@ -2040,11 +2015,11 @@ define('ember-data/-private/system/is-array-like', ['exports', 'ember'], functio
|
|
2040
2015
|
if (Array.isArray(obj)) {
|
2041
2016
|
return true;
|
2042
2017
|
}
|
2043
|
-
if (
|
2018
|
+
if (EmberArray.detect(obj)) {
|
2044
2019
|
return true;
|
2045
2020
|
}
|
2046
2021
|
|
2047
|
-
var type =
|
2022
|
+
var type = typeOf(obj);
|
2048
2023
|
if ('array' === type) {
|
2049
2024
|
return true;
|
2050
2025
|
}
|
@@ -2054,12 +2029,16 @@ define('ember-data/-private/system/is-array-like', ['exports', 'ember'], functio
|
|
2054
2029
|
return false;
|
2055
2030
|
}
|
2056
2031
|
});
|
2057
|
-
define('ember-data/-private/system/many-array', ['exports', 'ember
|
2032
|
+
define('ember-data/-private/system/many-array', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _promiseProxies, _common, _diffArray) {
|
2058
2033
|
'use strict';
|
2059
2034
|
|
2060
2035
|
exports.__esModule = true;
|
2061
|
-
var
|
2062
|
-
|
2036
|
+
var all = Ember.RSVP.all;
|
2037
|
+
var Evented = Ember.Evented;
|
2038
|
+
var MutableArray = Ember.MutableArray;
|
2039
|
+
var EmberObject = Ember.Object;
|
2040
|
+
var get = Ember.get;
|
2041
|
+
exports.default = EmberObject.extend(MutableArray, Evented, {
|
2063
2042
|
init: function () {
|
2064
2043
|
this._super.apply(this, arguments);
|
2065
2044
|
|
@@ -2256,7 +2235,7 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
|
|
2256
2235
|
save: function () {
|
2257
2236
|
var manyArray = this;
|
2258
2237
|
var promiseLabel = 'DS: ManyArray#save ' + get(this, 'type');
|
2259
|
-
var promise =
|
2238
|
+
var promise = all(this.invoke("save"), promiseLabel).then(function () {
|
2260
2239
|
return manyArray;
|
2261
2240
|
}, null, 'DS: ManyArray#save return ManyArray');
|
2262
2241
|
|
@@ -2275,7 +2254,7 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
|
|
2275
2254
|
var store = get(this, 'store');
|
2276
2255
|
var type = get(this, 'type');
|
2277
2256
|
|
2278
|
-
(false &&
|
2257
|
+
(false && Ember.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic')));
|
2279
2258
|
|
2280
2259
|
var record = store.createRecord(type.modelName, hash);
|
2281
2260
|
this.pushObject(record);
|
@@ -2284,16 +2263,22 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
|
|
2284
2263
|
}
|
2285
2264
|
});
|
2286
2265
|
});
|
2287
|
-
define('ember-data/-private/system/model/errors', ['exports'
|
2266
|
+
define('ember-data/-private/system/model/errors', ['exports'], function (exports) {
|
2288
2267
|
'use strict';
|
2289
2268
|
|
2290
2269
|
exports.__esModule = true;
|
2291
|
-
var
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2270
|
+
var mapBy = Ember.computed.mapBy;
|
2271
|
+
var not = Ember.computed.not;
|
2272
|
+
var Evented = Ember.Evented;
|
2273
|
+
var ArrayProxy = Ember.ArrayProxy;
|
2274
|
+
var set = Ember.set;
|
2275
|
+
var get = Ember.get;
|
2276
|
+
var computed = Ember.computed;
|
2277
|
+
var isEmpty = Ember.isEmpty;
|
2278
|
+
var makeArray = Ember.makeArray;
|
2279
|
+
var A = Ember.A;
|
2280
|
+
var MapWithDefault = Ember.MapWithDefault;
|
2281
|
+
exports.default = ArrayProxy.extend(Evented, {
|
2297
2282
|
/**
|
2298
2283
|
Register with target handler
|
2299
2284
|
@method registerHandlers
|
@@ -2303,7 +2288,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2303
2288
|
@deprecated
|
2304
2289
|
*/
|
2305
2290
|
registerHandlers: function (target, becameInvalid, becameValid) {
|
2306
|
-
(false && !(false) &&
|
2291
|
+
(false && !(false) && Ember.deprecate('Record errors will no longer be evented.', false, {
|
2307
2292
|
id: 'ds.errors.registerHandlers',
|
2308
2293
|
until: '3.0.0'
|
2309
2294
|
}));
|
@@ -2329,10 +2314,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2329
2314
|
@type {Ember.MapWithDefault}
|
2330
2315
|
@private
|
2331
2316
|
*/
|
2332
|
-
errorsByAttributeName:
|
2317
|
+
errorsByAttributeName: computed(function () {
|
2333
2318
|
return MapWithDefault.create({
|
2334
2319
|
defaultValue: function () {
|
2335
|
-
return
|
2320
|
+
return A();
|
2336
2321
|
}
|
2337
2322
|
});
|
2338
2323
|
}),
|
@@ -2371,15 +2356,15 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2371
2356
|
@property messages
|
2372
2357
|
@type {Array}
|
2373
2358
|
*/
|
2374
|
-
messages:
|
2359
|
+
messages: mapBy('content', 'message'),
|
2375
2360
|
|
2376
2361
|
/**
|
2377
2362
|
@property content
|
2378
2363
|
@type {Array}
|
2379
2364
|
@private
|
2380
2365
|
*/
|
2381
|
-
content:
|
2382
|
-
return
|
2366
|
+
content: computed(function () {
|
2367
|
+
return A();
|
2383
2368
|
}),
|
2384
2369
|
|
2385
2370
|
/**
|
@@ -2407,7 +2392,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2407
2392
|
@type {Boolean}
|
2408
2393
|
@readOnly
|
2409
2394
|
*/
|
2410
|
-
isEmpty:
|
2395
|
+
isEmpty: not('length').readOnly(),
|
2411
2396
|
|
2412
2397
|
/**
|
2413
2398
|
Adds error messages to a given attribute and sends
|
@@ -2424,7 +2409,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2424
2409
|
@deprecated
|
2425
2410
|
*/
|
2426
2411
|
add: function (attribute, messages) {
|
2427
|
-
(false &&
|
2412
|
+
(false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2428
2413
|
id: 'ds.errors.add'
|
2429
2414
|
}));
|
2430
2415
|
|
@@ -2492,15 +2477,15 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2492
2477
|
});
|
2493
2478
|
```
|
2494
2479
|
```app/routes/user/edit.js
|
2495
|
-
import
|
2496
|
-
export default
|
2480
|
+
import Route from '@ember/routing/route';
|
2481
|
+
export default Route.extend({
|
2497
2482
|
actions: {
|
2498
2483
|
save: function(user) {
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2484
|
+
if (!user.get('twoFactorAuth')) {
|
2485
|
+
user.get('errors').remove('phone');
|
2486
|
+
}
|
2487
|
+
user.save();
|
2488
|
+
}
|
2504
2489
|
}
|
2505
2490
|
});
|
2506
2491
|
```
|
@@ -2509,7 +2494,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2509
2494
|
@deprecated
|
2510
2495
|
*/
|
2511
2496
|
remove: function (attribute) {
|
2512
|
-
(false &&
|
2497
|
+
(false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2513
2498
|
id: 'ds.errors.remove'
|
2514
2499
|
}));
|
2515
2500
|
|
@@ -2541,6 +2526,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2541
2526
|
get(this, 'errorsByAttributeName').delete(attribute);
|
2542
2527
|
|
2543
2528
|
this.notifyPropertyChange(attribute);
|
2529
|
+
this.notifyPropertyChange('length');
|
2544
2530
|
},
|
2545
2531
|
|
2546
2532
|
|
@@ -2549,13 +2535,13 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2549
2535
|
to the record.
|
2550
2536
|
Example:
|
2551
2537
|
```app/routes/user/edit.js
|
2552
|
-
|
2553
|
-
export default
|
2538
|
+
import Route from '@ember/routing/route';
|
2539
|
+
export default Route.extend({
|
2554
2540
|
actions: {
|
2555
2541
|
retrySave: function(user) {
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2542
|
+
user.get('errors').clear();
|
2543
|
+
user.save();
|
2544
|
+
}
|
2559
2545
|
}
|
2560
2546
|
});
|
2561
2547
|
```
|
@@ -2563,7 +2549,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2563
2549
|
@deprecated
|
2564
2550
|
*/
|
2565
2551
|
clear: function () {
|
2566
|
-
(false &&
|
2552
|
+
(false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2567
2553
|
id: 'ds.errors.clear'
|
2568
2554
|
}));
|
2569
2555
|
|
@@ -2589,7 +2575,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2589
2575
|
}
|
2590
2576
|
|
2591
2577
|
var errorsByAttributeName = get(this, 'errorsByAttributeName');
|
2592
|
-
var attributes =
|
2578
|
+
var attributes = A();
|
2593
2579
|
|
2594
2580
|
errorsByAttributeName.forEach(function (_, attribute) {
|
2595
2581
|
attributes.push(attribute);
|
@@ -2600,22 +2586,22 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2600
2586
|
this.notifyPropertyChange(attribute);
|
2601
2587
|
}, this);
|
2602
2588
|
|
2603
|
-
|
2589
|
+
ArrayProxy.prototype.clear.call(this);
|
2604
2590
|
},
|
2605
2591
|
|
2606
2592
|
|
2607
2593
|
/**
|
2608
2594
|
Checks if there is error messages for the given attribute.
|
2609
2595
|
```app/routes/user/edit.js
|
2610
|
-
import
|
2611
|
-
export default
|
2596
|
+
import Route from '@ember/routing/route';
|
2597
|
+
export default Route.extend({
|
2612
2598
|
actions: {
|
2613
2599
|
save: function(user) {
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2600
|
+
if (user.get('errors').has('email')) {
|
2601
|
+
return alert('Please update your email before attempting to save.');
|
2602
|
+
}
|
2603
|
+
user.save();
|
2604
|
+
}
|
2619
2605
|
}
|
2620
2606
|
});
|
2621
2607
|
```
|
@@ -2628,7 +2614,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember'], function
|
|
2628
2614
|
}
|
2629
2615
|
});
|
2630
2616
|
});
|
2631
|
-
define('ember-data/-private/system/model/internal-model', ['exports', 'ember
|
2617
|
+
define('ember-data/-private/system/model/internal-model', ['exports', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/state/create', 'ember-data/-private/system/snapshot', 'ember-data/-private/features', 'ember-data/-private/system/ordered-set', 'ember-data/-private/utils', 'ember-data/-private/system/references'], function (exports, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) {
|
2632
2618
|
'use strict';
|
2633
2619
|
|
2634
2620
|
exports.__esModule = true;
|
@@ -2657,20 +2643,22 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2657
2643
|
};
|
2658
2644
|
}();
|
2659
2645
|
|
2660
|
-
var
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2646
|
+
var assign = Ember.assign;
|
2647
|
+
var merge = Ember.merge;
|
2648
|
+
var set = Ember.set;
|
2649
|
+
var get = Ember.get;
|
2650
|
+
var copy = Ember.copy;
|
2651
|
+
var EmberError = Ember.Error;
|
2652
|
+
var isEqual = Ember.isEqual;
|
2653
|
+
var isEmpty = Ember.isEmpty;
|
2654
|
+
var setOwner = Ember.setOwner;
|
2655
|
+
var run = Ember.run;
|
2656
|
+
var RSVP = Ember.RSVP;
|
2657
|
+
var Promise = Ember.RSVP.Promise;
|
2658
|
+
var inspect = Ember.inspect;
|
2671
2659
|
|
2672
2660
|
|
2673
|
-
var
|
2661
|
+
var emberAssign = assign || merge;
|
2674
2662
|
|
2675
2663
|
/*
|
2676
2664
|
The TransitionChainMap caches the `state.enters`, `state.setups`, and final state reached
|
@@ -2744,7 +2732,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2744
2732
|
this.id = id;
|
2745
2733
|
|
2746
2734
|
// this ensure ordered set can quickly identify this as unique
|
2747
|
-
this[
|
2735
|
+
this[Ember.GUID_KEY] = InternalModelReferenceId++ + 'internal-model';
|
2748
2736
|
|
2749
2737
|
this.store = store;
|
2750
2738
|
this.modelName = modelName;
|
@@ -2844,7 +2832,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2844
2832
|
};
|
2845
2833
|
|
2846
2834
|
if (typeof properties === 'object' && properties !== null) {
|
2847
|
-
|
2835
|
+
emberAssign(createOptions, properties);
|
2848
2836
|
}
|
2849
2837
|
|
2850
2838
|
if (setOwner) {
|
@@ -2947,7 +2935,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2947
2935
|
var related = node._directlyRelatedInternalModels();
|
2948
2936
|
for (var i = 0; i < related.length; ++i) {
|
2949
2937
|
var internalModel = related[i];
|
2950
|
-
(false &&
|
2938
|
+
(false && Ember.assert('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId));
|
2951
2939
|
|
2952
2940
|
if (internalModel._bfsId < bfsId) {
|
2953
2941
|
queue.push(internalModel);
|
@@ -2967,10 +2955,10 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2967
2955
|
|
2968
2956
|
if (this._scheduledDestroy === null) {
|
2969
2957
|
// TODO: use run.schedule once we drop 1.13
|
2970
|
-
if (!
|
2971
|
-
(false &&
|
2958
|
+
if (!run.currentRunLoop) {
|
2959
|
+
(false && Ember.assert('You have turned on testing mode, which disabled the run-loop\'s autorun.\n You will need to wrap any code with asynchronous side-effects in a run', Ember.testing));
|
2972
2960
|
}
|
2973
|
-
this._scheduledDestroy =
|
2961
|
+
this._scheduledDestroy = run.backburner.schedule('destroy', this, '_checkForOrphanedInternalModels');
|
2974
2962
|
}
|
2975
2963
|
};
|
2976
2964
|
|
@@ -2979,7 +2967,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2979
2967
|
};
|
2980
2968
|
|
2981
2969
|
InternalModel.prototype.cancelDestroy = function cancelDestroy() {
|
2982
|
-
(false &&
|
2970
|
+
(false && Ember.assert('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed));
|
2983
2971
|
|
2984
2972
|
|
2985
2973
|
this._isDematerializing = false;
|
@@ -3028,7 +3016,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3028
3016
|
};
|
3029
3017
|
|
3030
3018
|
InternalModel.prototype.destroy = function destroy() {
|
3031
|
-
(false &&
|
3019
|
+
(false && Ember.assert("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying')));
|
3032
3020
|
|
3033
3021
|
|
3034
3022
|
this.store._internalModelDestroyed(this);
|
@@ -3057,7 +3045,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3057
3045
|
changedKeys = this._changedKeys(data.attributes);
|
3058
3046
|
}
|
3059
3047
|
|
3060
|
-
|
3048
|
+
emberAssign(this._data, data.attributes);
|
3061
3049
|
this.pushedData();
|
3062
3050
|
|
3063
3051
|
if (this.hasRecord) {
|
@@ -3115,7 +3103,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3115
3103
|
var oldData = this._data;
|
3116
3104
|
var currentData = this._attributes;
|
3117
3105
|
var inFlightData = this._inFlightAttributes;
|
3118
|
-
var newData =
|
3106
|
+
var newData = emberAssign(copy(inFlightData), currentData);
|
3119
3107
|
var diffData = Object.create(null);
|
3120
3108
|
var newDataKeys = Object.keys(newData);
|
3121
3109
|
|
@@ -3359,7 +3347,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3359
3347
|
};
|
3360
3348
|
|
3361
3349
|
InternalModel.prototype._preloadHasMany = function _preloadHasMany(key, preloadValue, modelClass) {
|
3362
|
-
(false &&
|
3350
|
+
(false && Ember.assert("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue)));
|
3363
3351
|
|
3364
3352
|
var recordsToSet = new Array(preloadValue.length);
|
3365
3353
|
|
@@ -3396,7 +3384,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3396
3384
|
};
|
3397
3385
|
|
3398
3386
|
InternalModel.prototype.setId = function setId(id) {
|
3399
|
-
(false &&
|
3387
|
+
(false && Ember.assert('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew()));
|
3400
3388
|
|
3401
3389
|
this.id = id;
|
3402
3390
|
if (this._record.get('id') !== id) {
|
@@ -3438,9 +3426,9 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3438
3426
|
this.didCleanError();
|
3439
3427
|
var changedKeys = this._changedKeys(data);
|
3440
3428
|
|
3441
|
-
|
3429
|
+
emberAssign(this._data, this._inFlightAttributes);
|
3442
3430
|
if (data) {
|
3443
|
-
|
3431
|
+
emberAssign(this._data, data);
|
3444
3432
|
}
|
3445
3433
|
|
3446
3434
|
this._inFlightAttributes = null;
|
@@ -3522,8 +3510,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3522
3510
|
attrs = this._attributes;
|
3523
3511
|
}
|
3524
3512
|
|
3525
|
-
original =
|
3526
|
-
original =
|
3513
|
+
original = emberAssign(Object.create(null), this._data);
|
3514
|
+
original = emberAssign(original, this._inFlightAttributes);
|
3527
3515
|
|
3528
3516
|
for (i = 0; i < length; i++) {
|
3529
3517
|
key = keys[i];
|
@@ -3558,11 +3546,11 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3558
3546
|
|
3559
3547
|
if (false) {
|
3560
3548
|
var modelName = this.modelName;
|
3561
|
-
(false &&
|
3549
|
+
(false && Ember.assert('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship));
|
3562
3550
|
|
3563
3551
|
|
3564
3552
|
var actualRelationshipKind = relationship.relationshipMeta.kind;
|
3565
|
-
(false &&
|
3553
|
+
(false && Ember.assert('You tried to get the \'' + name + '\' relationship on a \'' + modelName + '\' via record.' + kind + '(\'' + name + '\'), but the relationship is of kind \'' + actualRelationshipKind + '\'. Use record.' + actualRelationshipKind + '(\'' + name + '\') instead.', actualRelationshipKind === kind));
|
3566
3554
|
}
|
3567
3555
|
|
3568
3556
|
if (kind === "belongsTo") {
|
@@ -3703,13 +3691,20 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3703
3691
|
};
|
3704
3692
|
}
|
3705
3693
|
});
|
3706
|
-
define('ember-data/-private/system/model/model', ['exports', 'ember
|
3694
|
+
define('ember-data/-private/system/model/model', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/model/errors', 'ember-data/-private/features', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/ext'], function (exports, _promiseProxies, _errors, _features, _states, _ext) {
|
3707
3695
|
'use strict';
|
3708
3696
|
|
3709
3697
|
exports.__esModule = true;
|
3710
|
-
var
|
3711
|
-
|
3712
|
-
|
3698
|
+
var ComputedProperty = Ember.ComputedProperty;
|
3699
|
+
var setOwner = Ember.setOwner;
|
3700
|
+
var isNone = Ember.isNone;
|
3701
|
+
var EmberError = Ember.Error;
|
3702
|
+
var Evented = Ember.Evented;
|
3703
|
+
var EmberObject = Ember.Object;
|
3704
|
+
var computed = Ember.computed;
|
3705
|
+
var get = Ember.get;
|
3706
|
+
var observer = Ember.observer;
|
3707
|
+
var Map = Ember.Map;
|
3713
3708
|
|
3714
3709
|
|
3715
3710
|
/**
|
@@ -3776,7 +3771,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
3776
3771
|
@extends Ember.Object
|
3777
3772
|
@uses Ember.Evented
|
3778
3773
|
*/
|
3779
|
-
var Model =
|
3774
|
+
var Model = EmberObject.extend(Evented, {
|
3780
3775
|
_internalModel: null,
|
3781
3776
|
store: null,
|
3782
3777
|
__defineNonEnumerable: function (property) {
|
@@ -4145,13 +4140,13 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4145
4140
|
this._internalModel.unloadRecord();
|
4146
4141
|
},
|
4147
4142
|
_notifyProperties: function (keys) {
|
4148
|
-
|
4143
|
+
Ember.beginPropertyChanges();
|
4149
4144
|
var key = void 0;
|
4150
4145
|
for (var i = 0, length = keys.length; i < length; i++) {
|
4151
4146
|
key = keys[i];
|
4152
4147
|
this.notifyPropertyChange(key);
|
4153
4148
|
}
|
4154
|
-
|
4149
|
+
Ember.endPropertyChanges();
|
4155
4150
|
},
|
4156
4151
|
changedAttributes: function () {
|
4157
4152
|
return this._internalModel.changedAttributes();
|
@@ -4199,7 +4194,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4199
4194
|
this._super.apply(this, arguments);
|
4200
4195
|
},
|
4201
4196
|
attr: function () {
|
4202
|
-
(false &&
|
4197
|
+
(false && 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));
|
4203
4198
|
},
|
4204
4199
|
belongsTo: function (name) {
|
4205
4200
|
return this._internalModel.referenceFor('belongsTo', name);
|
@@ -4209,7 +4204,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4209
4204
|
},
|
4210
4205
|
|
4211
4206
|
|
4212
|
-
setId:
|
4207
|
+
setId: observer('id', function () {
|
4213
4208
|
this._internalModel.setId(this.get('id'));
|
4214
4209
|
}),
|
4215
4210
|
|
@@ -4300,7 +4295,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4300
4295
|
this._super.apply(this, arguments);
|
4301
4296
|
|
4302
4297
|
if (!this._internalModel) {
|
4303
|
-
throw new
|
4298
|
+
throw new EmberError('You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.');
|
4304
4299
|
}
|
4305
4300
|
}
|
4306
4301
|
});
|
@@ -4331,9 +4326,10 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4331
4326
|
The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
|
4332
4327
|
keys to underscore (instead of dasherized), you might use the following code:
|
4333
4328
|
```javascript
|
4334
|
-
|
4335
|
-
|
4336
|
-
|
4329
|
+
import { underscore } from '@ember/string';
|
4330
|
+
export default const PostSerializer = DS.RESTSerializer.extend({
|
4331
|
+
payloadKeyFromModelName(modelName) {
|
4332
|
+
return underscore(modelName);
|
4337
4333
|
}
|
4338
4334
|
});
|
4339
4335
|
```
|
@@ -4350,7 +4346,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4350
4346
|
},
|
4351
4347
|
|
4352
4348
|
|
4353
|
-
inverseMap:
|
4349
|
+
inverseMap: computed(function () {
|
4354
4350
|
return Object.create(null);
|
4355
4351
|
}),
|
4356
4352
|
|
@@ -4397,16 +4393,16 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4397
4393
|
//If inverse is specified manually, return the inverse
|
4398
4394
|
if (options.inverse) {
|
4399
4395
|
inverseName = options.inverse;
|
4400
|
-
inverse =
|
4396
|
+
inverse = get(inverseType, 'relationshipsByName').get(inverseName);
|
4401
4397
|
|
4402
|
-
(false &&
|
4398
|
+
(false && Ember.assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !isNone(inverse)));
|
4403
4399
|
|
4404
4400
|
|
4405
4401
|
inverseKind = inverse.kind;
|
4406
4402
|
} else {
|
4407
4403
|
//No inverse was specified manually, we need to use a heuristic to guess one
|
4408
4404
|
if (propertyMeta.parentType && propertyMeta.type === propertyMeta.parentType.modelName) {
|
4409
|
-
(false &&
|
4405
|
+
(false && Ember.warn('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at https://guides.emberjs.com/current/models/relationships/#toc_reflexive-relations for how to explicitly specify inverses.', false, {
|
4410
4406
|
id: 'ds.model.reflexive-relationship-without-inverse'
|
4411
4407
|
}));
|
4412
4408
|
}
|
@@ -4422,14 +4418,14 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4422
4418
|
return name === optionsForRelationship.inverse;
|
4423
4419
|
});
|
4424
4420
|
|
4425
|
-
(false &&
|
4421
|
+
(false && Ember.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2));
|
4426
4422
|
|
4427
4423
|
|
4428
4424
|
if (filteredRelationships.length === 1) {
|
4429
4425
|
possibleRelationships = filteredRelationships;
|
4430
4426
|
}
|
4431
4427
|
|
4432
|
-
(false &&
|
4428
|
+
(false && Ember.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1));
|
4433
4429
|
|
4434
4430
|
|
4435
4431
|
inverseName = possibleRelationships[0].name;
|
@@ -4507,7 +4503,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4507
4503
|
@type Object
|
4508
4504
|
@readOnly
|
4509
4505
|
*/
|
4510
|
-
relationshipNames:
|
4506
|
+
relationshipNames: computed(function () {
|
4511
4507
|
var names = {
|
4512
4508
|
hasMany: [],
|
4513
4509
|
belongsTo: []
|
@@ -4611,7 +4607,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4611
4607
|
@type Ember.Map
|
4612
4608
|
@readOnly
|
4613
4609
|
*/
|
4614
|
-
fields:
|
4610
|
+
fields: computed(function () {
|
4615
4611
|
var map = Map.create();
|
4616
4612
|
|
4617
4613
|
this.eachComputedProperty(function (name, meta) {
|
@@ -4690,14 +4686,14 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4690
4686
|
@type {Ember.Map}
|
4691
4687
|
@readOnly
|
4692
4688
|
*/
|
4693
|
-
attributes:
|
4689
|
+
attributes: computed(function () {
|
4694
4690
|
var _this3 = this;
|
4695
4691
|
|
4696
4692
|
var map = Map.create();
|
4697
4693
|
|
4698
4694
|
this.eachComputedProperty(function (name, meta) {
|
4699
4695
|
if (meta.isAttribute) {
|
4700
|
-
(false &&
|
4696
|
+
(false && 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 " + _this3.toString(), name !== 'id'));
|
4701
4697
|
|
4702
4698
|
|
4703
4699
|
meta.name = name;
|
@@ -4738,7 +4734,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4738
4734
|
@type {Ember.Map}
|
4739
4735
|
@readOnly
|
4740
4736
|
*/
|
4741
|
-
transformedAttributes:
|
4737
|
+
transformedAttributes: computed(function () {
|
4742
4738
|
var map = Map.create();
|
4743
4739
|
|
4744
4740
|
this.eachAttribute(function (key, meta) {
|
@@ -4767,12 +4763,12 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4767
4763
|
// deprecation is actually created via an `.extend` of the factory
|
4768
4764
|
// inside the container itself, but that only happens on models
|
4769
4765
|
// with MODEL_FACTORY_INJECTIONS enabled :(
|
4770
|
-
if (
|
4766
|
+
if (setOwner) {
|
4771
4767
|
Object.defineProperty(Model.prototype, 'container', {
|
4772
4768
|
configurable: true,
|
4773
4769
|
enumerable: false,
|
4774
4770
|
get: function () {
|
4775
|
-
(false && !(false) &&
|
4771
|
+
(false && !(false) && Ember.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0' }));
|
4776
4772
|
|
4777
4773
|
|
4778
4774
|
return this.store.container;
|
@@ -4794,12 +4790,12 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4794
4790
|
Model.reopen({
|
4795
4791
|
willMergeMixin: function (props) {
|
4796
4792
|
var constructor = this.constructor;
|
4797
|
-
(false &&
|
4798
|
-
(false &&
|
4793
|
+
(false && Ember.assert('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0]));
|
4794
|
+
(false && 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 " + constructor.toString(), Object.keys(props).indexOf('id') === -1));
|
4799
4795
|
},
|
4800
4796
|
didDefineProperty: function (proto, key, value) {
|
4801
4797
|
// Check if the value being set is a computed property.
|
4802
|
-
if (value instanceof
|
4798
|
+
if (value instanceof ComputedProperty) {
|
4803
4799
|
|
4804
4800
|
// If it is, get the metadata for the relationship. This is
|
4805
4801
|
// populated by the `DS.belongsTo` helper when it is creating
|
@@ -5234,6 +5230,13 @@ define('ember-data/-private/system/model/states', ['exports'], function (exports
|
|
5234
5230
|
(false && Ember.assert("You can only unload a record which is not inFlight. `" + internalModel + "`", false));
|
5235
5231
|
}
|
5236
5232
|
|
5233
|
+
updatedState.invalid.becameValid = function (internalModel) {
|
5234
|
+
// we're eagerly transition into the loaded.saved state, even though we could
|
5235
|
+
// be still dirty; but the setup hook of the loaded.saved state checks for
|
5236
|
+
// dirty attributes and transitions into the corresponding dirty state
|
5237
|
+
internalModel.transitionTo('loaded.saved');
|
5238
|
+
};
|
5239
|
+
|
5237
5240
|
updatedState.inFlight.unloadRecord = assertAgainstUnloadRecord;
|
5238
5241
|
|
5239
5242
|
updatedState.uncommitted.deleteRecord = function (internalModel) {
|
@@ -5533,11 +5536,12 @@ define('ember-data/-private/system/normalize-link', ['exports'], function (expor
|
|
5533
5536
|
return null;
|
5534
5537
|
}
|
5535
5538
|
});
|
5536
|
-
define('ember-data/-private/system/normalize-model-name', ['exports'
|
5539
|
+
define('ember-data/-private/system/normalize-model-name', ['exports'], function (exports) {
|
5537
5540
|
'use strict';
|
5538
5541
|
|
5539
5542
|
exports.__esModule = true;
|
5540
5543
|
exports.default = normalizeModelName;
|
5544
|
+
var dasherize = Ember.String.dasherize;
|
5541
5545
|
|
5542
5546
|
|
5543
5547
|
// All modelNames are dasherized internally. Changing this function may
|
@@ -5554,18 +5558,18 @@ define('ember-data/-private/system/normalize-model-name', ['exports', 'ember'],
|
|
5554
5558
|
@for DS
|
5555
5559
|
*/
|
5556
5560
|
function normalizeModelName(modelName) {
|
5557
|
-
return
|
5561
|
+
return dasherize(modelName);
|
5558
5562
|
}
|
5559
5563
|
});
|
5560
|
-
define('ember-data/-private/system/ordered-set', ['exports'
|
5564
|
+
define('ember-data/-private/system/ordered-set', ['exports'], function (exports) {
|
5561
5565
|
'use strict';
|
5562
5566
|
|
5563
5567
|
exports.__esModule = true;
|
5564
5568
|
exports.default = OrderedSet;
|
5569
|
+
var guidFor = Ember.guidFor;
|
5565
5570
|
|
5566
5571
|
|
5567
|
-
var EmberOrderedSet =
|
5568
|
-
var guidFor = _ember.default.guidFor;
|
5572
|
+
var EmberOrderedSet = Ember.OrderedSet;
|
5569
5573
|
|
5570
5574
|
function OrderedSet() {
|
5571
5575
|
this._super$constructor();
|
@@ -5602,17 +5606,20 @@ define('ember-data/-private/system/ordered-set', ['exports', 'ember'], function
|
|
5602
5606
|
return this;
|
5603
5607
|
};
|
5604
5608
|
});
|
5605
|
-
define('ember-data/-private/system/promise-proxies', ['exports'
|
5609
|
+
define('ember-data/-private/system/promise-proxies', ['exports'], function (exports) {
|
5606
5610
|
'use strict';
|
5607
5611
|
|
5608
5612
|
exports.__esModule = true;
|
5609
|
-
exports.PromiseManyArray = exports.PromiseObject = exports.PromiseArray = undefined;
|
5610
5613
|
exports.promiseObject = promiseObject;
|
5611
5614
|
exports.promiseArray = promiseArray;
|
5612
5615
|
exports.proxyToContent = proxyToContent;
|
5613
5616
|
exports.promiseManyArray = promiseManyArray;
|
5614
|
-
var
|
5615
|
-
|
5617
|
+
var ObjectProxy = Ember.ObjectProxy;
|
5618
|
+
var PromiseProxyMixin = Ember.PromiseProxyMixin;
|
5619
|
+
var ArrayProxy = Ember.ArrayProxy;
|
5620
|
+
var get = Ember.get;
|
5621
|
+
var reads = Ember.computed.reads;
|
5622
|
+
var Promise = Ember.RSVP.Promise;
|
5616
5623
|
|
5617
5624
|
|
5618
5625
|
/**
|
@@ -5644,7 +5651,9 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], funct
|
|
5644
5651
|
@extends Ember.ArrayProxy
|
5645
5652
|
@uses Ember.PromiseProxyMixin
|
5646
5653
|
*/
|
5647
|
-
var PromiseArray = exports.PromiseArray =
|
5654
|
+
var PromiseArray = exports.PromiseArray = ArrayProxy.extend(PromiseProxyMixin, {
|
5655
|
+
meta: reads('content.meta')
|
5656
|
+
});
|
5648
5657
|
|
5649
5658
|
/**
|
5650
5659
|
A `PromiseObject` is an object that acts like both an `Ember.Object`
|
@@ -5675,7 +5684,7 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], funct
|
|
5675
5684
|
@extends Ember.ObjectProxy
|
5676
5685
|
@uses Ember.PromiseProxyMixin
|
5677
5686
|
*/
|
5678
|
-
var PromiseObject = exports.PromiseObject =
|
5687
|
+
var PromiseObject = exports.PromiseObject = ObjectProxy.extend(PromiseProxyMixin);
|
5679
5688
|
|
5680
5689
|
function promiseObject(promise, label) {
|
5681
5690
|
return PromiseObject.create({
|
@@ -5717,7 +5726,7 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], funct
|
|
5717
5726
|
|
5718
5727
|
var PromiseManyArray = exports.PromiseManyArray = PromiseArray.extend({
|
5719
5728
|
reload: function () {
|
5720
|
-
(false &&
|
5729
|
+
(false && Ember.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content')));
|
5721
5730
|
|
5722
5731
|
this.set('promise', this.get('content').reload());
|
5723
5732
|
return this;
|
@@ -5743,8 +5752,8 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], funct
|
|
5743
5752
|
});
|
5744
5753
|
}
|
5745
5754
|
});
|
5746
|
-
define(
|
5747
|
-
|
5755
|
+
define('ember-data/-private/system/record-array-manager', ['exports', 'ember-data/-private/system/record-arrays', 'ember-data/-private/system/clone-null'], function (exports, _recordArrays, _cloneNull) {
|
5756
|
+
'use strict';
|
5748
5757
|
|
5749
5758
|
exports.__esModule = true;
|
5750
5759
|
exports.associateWithRecordArray = associateWithRecordArray;
|
@@ -5755,9 +5764,10 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5755
5764
|
}
|
5756
5765
|
}
|
5757
5766
|
|
5758
|
-
var
|
5759
|
-
|
5760
|
-
|
5767
|
+
var A = Ember.A;
|
5768
|
+
var set = Ember.set;
|
5769
|
+
var get = Ember.get;
|
5770
|
+
var emberRun = Ember.run;
|
5761
5771
|
|
5762
5772
|
var RecordArrayManager = function () {
|
5763
5773
|
function RecordArrayManager(options) {
|
@@ -5879,7 +5889,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5879
5889
|
};
|
5880
5890
|
|
5881
5891
|
RecordArrayManager.prototype._syncLiveRecordArray = function _syncLiveRecordArray(array, modelName) {
|
5882
|
-
(false &&
|
5892
|
+
(false && Ember.assert('recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param', typeof modelName === 'string'));
|
5883
5893
|
|
5884
5894
|
var hasNoPotentialDeletions = Object.keys(this._pending).length === 0;
|
5885
5895
|
var map = this.store._internalModelsFor(modelName);
|
@@ -5910,7 +5920,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5910
5920
|
};
|
5911
5921
|
|
5912
5922
|
RecordArrayManager.prototype.updateFilter = function updateFilter(array, modelName, filter) {
|
5913
|
-
(false &&
|
5923
|
+
(false && Ember.assert('recordArrayManger.updateFilter expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string'));
|
5914
5924
|
|
5915
5925
|
var modelMap = this.store._internalModelsFor(modelName);
|
5916
5926
|
var internalModels = modelMap.models;
|
@@ -5926,7 +5936,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5926
5936
|
};
|
5927
5937
|
|
5928
5938
|
RecordArrayManager.prototype.liveRecordArrayFor = function liveRecordArrayFor(modelName) {
|
5929
|
-
(false &&
|
5939
|
+
(false && Ember.assert('recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param', typeof modelName === 'string'));
|
5930
5940
|
|
5931
5941
|
|
5932
5942
|
var array = this._liveRecordArrays[modelName];
|
@@ -5958,19 +5968,19 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5958
5968
|
};
|
5959
5969
|
|
5960
5970
|
RecordArrayManager.prototype.filteredRecordArraysFor = function filteredRecordArraysFor(modelName) {
|
5961
|
-
(false &&
|
5971
|
+
(false && Ember.assert('recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param', typeof modelName === 'string'));
|
5962
5972
|
|
5963
5973
|
|
5964
5974
|
return this._filteredRecordArrays[modelName] || (this._filteredRecordArrays[modelName] = []);
|
5965
5975
|
};
|
5966
5976
|
|
5967
5977
|
RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName, content) {
|
5968
|
-
(false &&
|
5978
|
+
(false && Ember.assert('recordArrayManger.createRecordArray expects modelName not modelClass as the param', typeof modelName === 'string'));
|
5969
5979
|
|
5970
5980
|
|
5971
5981
|
var array = _recordArrays.RecordArray.create({
|
5972
5982
|
modelName: modelName,
|
5973
|
-
content:
|
5983
|
+
content: A(content || []),
|
5974
5984
|
store: this.store,
|
5975
5985
|
isLoaded: true,
|
5976
5986
|
manager: this
|
@@ -5984,12 +5994,12 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
5984
5994
|
};
|
5985
5995
|
|
5986
5996
|
RecordArrayManager.prototype.createFilteredRecordArray = function createFilteredRecordArray(modelName, filter, query) {
|
5987
|
-
(false &&
|
5997
|
+
(false && Ember.assert('recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string'));
|
5988
5998
|
|
5989
5999
|
var array = _recordArrays.FilteredRecordArray.create({
|
5990
6000
|
query: query,
|
5991
6001
|
modelName: modelName,
|
5992
|
-
content:
|
6002
|
+
content: A(),
|
5993
6003
|
store: this.store,
|
5994
6004
|
manager: this,
|
5995
6005
|
filterFunction: filter
|
@@ -6001,7 +6011,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
6001
6011
|
};
|
6002
6012
|
|
6003
6013
|
RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query, internalModels, payload) {
|
6004
|
-
(false &&
|
6014
|
+
(false && Ember.assert('recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string'));
|
6005
6015
|
|
6006
6016
|
|
6007
6017
|
var array = void 0;
|
@@ -6009,7 +6019,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
6009
6019
|
array = _recordArrays.AdapterPopulatedRecordArray.create({
|
6010
6020
|
modelName: modelName,
|
6011
6021
|
query: query,
|
6012
|
-
content:
|
6022
|
+
content: A(internalModels),
|
6013
6023
|
store: this.store,
|
6014
6024
|
manager: this,
|
6015
6025
|
isLoaded: true,
|
@@ -6023,7 +6033,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
6023
6033
|
array = _recordArrays.AdapterPopulatedRecordArray.create({
|
6024
6034
|
modelName: modelName,
|
6025
6035
|
query: query,
|
6026
|
-
content:
|
6036
|
+
content: A(),
|
6027
6037
|
store: this.store,
|
6028
6038
|
manager: this
|
6029
6039
|
});
|
@@ -6035,7 +6045,7 @@ define("ember-data/-private/system/record-array-manager", ["exports", "ember", "
|
|
6035
6045
|
};
|
6036
6046
|
|
6037
6047
|
RecordArrayManager.prototype.registerFilteredRecordArray = function registerFilteredRecordArray(array, modelName, filter) {
|
6038
|
-
(false &&
|
6048
|
+
(false && Ember.assert('recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string'));
|
6039
6049
|
|
6040
6050
|
|
6041
6051
|
this.filteredRecordArraysFor(modelName).push(array);
|
@@ -6175,22 +6185,24 @@ define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-priv
|
|
6175
6185
|
exports.FilteredRecordArray = _filteredRecordArray.default;
|
6176
6186
|
exports.AdapterPopulatedRecordArray = _adapterPopulatedRecordArray.default;
|
6177
6187
|
});
|
6178
|
-
define(
|
6179
|
-
|
6188
|
+
define('ember-data/-private/system/record-arrays/adapter-populated-record-array', ['exports', 'ember-data/-private/system/record-arrays/record-array', 'ember-data/-private/system/clone-null', 'ember-data/-private/system/record-array-manager'], function (exports, _recordArray, _cloneNull, _recordArrayManager) {
|
6189
|
+
'use strict';
|
6180
6190
|
|
6181
6191
|
exports.__esModule = true;
|
6182
|
-
var
|
6192
|
+
var once = Ember.run.once;
|
6193
|
+
var A = Ember.A;
|
6194
|
+
var get = Ember.get;
|
6183
6195
|
exports.default = _recordArray.default.extend({
|
6184
6196
|
init: function () {
|
6185
6197
|
// yes we are touching `this` before super, but ArrayProxy has a bug that requires this.
|
6186
|
-
this.set('content', this.get('content') ||
|
6198
|
+
this.set('content', this.get('content') || A());
|
6187
6199
|
|
6188
6200
|
this._super.apply(this, arguments);
|
6189
6201
|
this.query = this.query || null;
|
6190
6202
|
this.links = null;
|
6191
6203
|
},
|
6192
6204
|
replace: function () {
|
6193
|
-
throw new Error(
|
6205
|
+
throw new Error('The result of a server query (on ' + this.modelName + ') is immutable.');
|
6194
6206
|
},
|
6195
6207
|
_update: function () {
|
6196
6208
|
var store = get(this, 'store');
|
@@ -6223,15 +6235,17 @@ define("ember-data/-private/system/record-arrays/adapter-populated-record-array"
|
|
6223
6235
|
(0, _recordArrayManager.associateWithRecordArray)(internalModels, this);
|
6224
6236
|
|
6225
6237
|
// TODO: should triggering didLoad event be the last action of the runLoop?
|
6226
|
-
|
6238
|
+
once(this, 'trigger', 'didLoad');
|
6227
6239
|
}
|
6228
6240
|
});
|
6229
6241
|
});
|
6230
|
-
define('ember-data/-private/system/record-arrays/filtered-record-array', ['exports', 'ember
|
6242
|
+
define('ember-data/-private/system/record-arrays/filtered-record-array', ['exports', 'ember-data/-private/system/record-arrays/record-array'], function (exports, _recordArray) {
|
6231
6243
|
'use strict';
|
6232
6244
|
|
6233
6245
|
exports.__esModule = true;
|
6234
|
-
var
|
6246
|
+
var once = Ember.run.once;
|
6247
|
+
var get = Ember.get;
|
6248
|
+
var observer = Ember.observer;
|
6235
6249
|
exports.default = _recordArray.default.extend({
|
6236
6250
|
init: function () {
|
6237
6251
|
this._super.apply(this, arguments);
|
@@ -6279,20 +6293,22 @@ define('ember-data/-private/system/record-arrays/filtered-record-array', ['expor
|
|
6279
6293
|
},
|
6280
6294
|
|
6281
6295
|
|
6282
|
-
updateFilter:
|
6283
|
-
|
6296
|
+
updateFilter: observer('filterFunction', function () {
|
6297
|
+
once(this, this._updateFilter);
|
6284
6298
|
})
|
6285
6299
|
});
|
6286
6300
|
});
|
6287
|
-
define(
|
6288
|
-
|
6301
|
+
define('ember-data/-private/system/record-arrays/record-array', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/snapshot-record-array'], function (exports, _promiseProxies, _snapshotRecordArray) {
|
6302
|
+
'use strict';
|
6289
6303
|
|
6290
6304
|
exports.__esModule = true;
|
6291
|
-
var
|
6292
|
-
|
6293
|
-
|
6294
|
-
|
6295
|
-
|
6305
|
+
var Evented = Ember.Evented;
|
6306
|
+
var ArrayProxy = Ember.ArrayProxy;
|
6307
|
+
var set = Ember.set;
|
6308
|
+
var get = Ember.get;
|
6309
|
+
var computed = Ember.computed;
|
6310
|
+
var Promise = Ember.RSVP.Promise;
|
6311
|
+
exports.default = ArrayProxy.extend(Evented, {
|
6296
6312
|
init: function () {
|
6297
6313
|
this._super.apply(this, arguments);
|
6298
6314
|
|
@@ -6342,7 +6358,7 @@ define("ember-data/-private/system/record-arrays/record-array", ["exports", "emb
|
|
6342
6358
|
this._updatingPromise = null;
|
6343
6359
|
},
|
6344
6360
|
replace: function () {
|
6345
|
-
throw new Error(
|
6361
|
+
throw new Error('The result of a server query (for all ' + this.modelName + ' types) is immutable. To modify contents, use toArray()');
|
6346
6362
|
},
|
6347
6363
|
|
6348
6364
|
|
@@ -6458,7 +6474,7 @@ define("ember-data/-private/system/record-arrays/record-array", ["exports", "emb
|
|
6458
6474
|
save: function () {
|
6459
6475
|
var _this2 = this;
|
6460
6476
|
|
6461
|
-
var promiseLabel =
|
6477
|
+
var promiseLabel = 'DS: RecordArray#save ' + this.modelName;
|
6462
6478
|
var promise = Promise.all(this.invoke('save'), promiseLabel).then(function () {
|
6463
6479
|
return _this2;
|
6464
6480
|
}, null, 'DS: RecordArray#save return RecordArray');
|
@@ -6531,10 +6547,11 @@ define('ember-data/-private/system/references', ['exports', 'ember-data/-private
|
|
6531
6547
|
exports.BelongsToReference = _belongsTo.default;
|
6532
6548
|
exports.HasManyReference = _hasMany.default;
|
6533
6549
|
});
|
6534
|
-
define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/-private/system/model/model', 'ember
|
6550
|
+
define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/-private/system/model/model', 'ember-data/-private/system/references/reference', 'ember-data/-private/features', 'ember-data/-debug'], function (exports, _model, _reference, _features, _debug) {
|
6535
6551
|
'use strict';
|
6536
6552
|
|
6537
6553
|
exports.__esModule = true;
|
6554
|
+
var resolve = Ember.RSVP.resolve;
|
6538
6555
|
|
6539
6556
|
|
6540
6557
|
/**
|
@@ -6773,12 +6790,12 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
|
|
6773
6790
|
BelongsToReference.prototype.push = function (objectOrPromise) {
|
6774
6791
|
var _this = this;
|
6775
6792
|
|
6776
|
-
return
|
6793
|
+
return resolve(objectOrPromise).then(function (data) {
|
6777
6794
|
var record = void 0;
|
6778
6795
|
|
6779
6796
|
if (data instanceof _model.default) {
|
6780
6797
|
if ((0, _features.default)('ds-overhaul-references')) {
|
6781
|
-
(false && !(false) &&
|
6798
|
+
(false && !(false) && Ember.deprecate("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, {
|
6782
6799
|
id: 'ds.references.belongs-to.push-record',
|
6783
6800
|
until: '3.0'
|
6784
6801
|
}));
|
@@ -6948,12 +6965,13 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
|
|
6948
6965
|
|
6949
6966
|
exports.default = BelongsToReference;
|
6950
6967
|
});
|
6951
|
-
define('ember-data/-private/system/references/has-many', ['exports', 'ember
|
6968
|
+
define('ember-data/-private/system/references/has-many', ['exports', 'ember-data/-private/system/references/reference', 'ember-data/-debug', 'ember-data/-private/features'], function (exports, _reference, _debug, _features) {
|
6952
6969
|
'use strict';
|
6953
6970
|
|
6954
6971
|
exports.__esModule = true;
|
6955
|
-
var
|
6956
|
-
|
6972
|
+
var A = Ember.A;
|
6973
|
+
var resolve = Ember.RSVP.resolve;
|
6974
|
+
var get = Ember.get;
|
6957
6975
|
|
6958
6976
|
|
6959
6977
|
/**
|
@@ -7194,7 +7212,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7194
7212
|
var array = payload;
|
7195
7213
|
|
7196
7214
|
if ((0, _features.default)("ds-overhaul-references")) {
|
7197
|
-
(false && !(!Array.isArray(payload)) &&
|
7215
|
+
(false && !(!Array.isArray(payload)) && Ember.deprecate("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), {
|
7198
7216
|
id: 'ds.references.has-many.push-array',
|
7199
7217
|
until: '3.0'
|
7200
7218
|
}));
|
@@ -7206,7 +7224,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7206
7224
|
useLegacyArrayPush = array.length && array[0].data;
|
7207
7225
|
|
7208
7226
|
if ((0, _features.default)('ds-overhaul-references')) {
|
7209
|
-
(false && !(!useLegacyArrayPush) &&
|
7227
|
+
(false && !(!useLegacyArrayPush) && Ember.deprecate("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, {
|
7210
7228
|
id: 'ds.references.has-many.push-invalid-json-api',
|
7211
7229
|
until: '3.0'
|
7212
7230
|
}));
|
@@ -7231,7 +7249,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7231
7249
|
});
|
7232
7250
|
} else {
|
7233
7251
|
var records = _this.store.push(payload);
|
7234
|
-
internalModels =
|
7252
|
+
internalModels = A(records).mapBy('_internalModel');
|
7235
7253
|
|
7236
7254
|
if (false) {
|
7237
7255
|
internalModels.forEach(function (internalModel) {
|
@@ -7391,10 +7409,11 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7391
7409
|
|
7392
7410
|
exports.default = HasManyReference;
|
7393
7411
|
});
|
7394
|
-
define('ember-data/-private/system/references/record', ['exports', 'ember
|
7412
|
+
define('ember-data/-private/system/references/record', ['exports', 'ember-data/-private/system/references/reference'], function (exports, _reference) {
|
7395
7413
|
'use strict';
|
7396
7414
|
|
7397
7415
|
exports.__esModule = true;
|
7416
|
+
var resolve = Ember.RSVP.resolve;
|
7398
7417
|
|
7399
7418
|
|
7400
7419
|
/**
|
@@ -7488,7 +7507,7 @@ define('ember-data/-private/system/references/record', ['exports', 'ember', 'emb
|
|
7488
7507
|
RecordReference.prototype.push = function (objectOrPromise) {
|
7489
7508
|
var _this = this;
|
7490
7509
|
|
7491
|
-
return
|
7510
|
+
return resolve(objectOrPromise).then(function (data) {
|
7492
7511
|
return _this.store.push(data);
|
7493
7512
|
});
|
7494
7513
|
};
|
@@ -7513,6 +7532,7 @@ define('ember-data/-private/system/references/record', ['exports', 'ember', 'emb
|
|
7513
7532
|
if (this.internalModel.hasRecord) {
|
7514
7533
|
return this.internalModel.getRecord();
|
7515
7534
|
}
|
7535
|
+
return null;
|
7516
7536
|
};
|
7517
7537
|
|
7518
7538
|
/**
|
@@ -7611,11 +7631,13 @@ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflec
|
|
7611
7631
|
return result;
|
7612
7632
|
}
|
7613
7633
|
});
|
7614
|
-
define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
7634
|
+
define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember-data/-private/system/normalize-model-name'], function (exports, _normalizeModelName) {
|
7615
7635
|
'use strict';
|
7616
7636
|
|
7617
7637
|
exports.__esModule = true;
|
7618
7638
|
exports.default = belongsTo;
|
7639
|
+
var computed = Ember.computed;
|
7640
|
+
var inspect = Ember.inspect;
|
7619
7641
|
|
7620
7642
|
|
7621
7643
|
/**
|
@@ -7705,7 +7727,7 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7705
7727
|
userEnteredModelName = (0, _normalizeModelName.default)(userEnteredModelName);
|
7706
7728
|
}
|
7707
7729
|
|
7708
|
-
(false &&
|
7730
|
+
(false && Ember.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined'));
|
7709
7731
|
|
7710
7732
|
|
7711
7733
|
opts = opts || {};
|
@@ -7719,16 +7741,16 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7719
7741
|
key: null
|
7720
7742
|
};
|
7721
7743
|
|
7722
|
-
return
|
7744
|
+
return computed({
|
7723
7745
|
get: function (key) {
|
7724
7746
|
if (opts.hasOwnProperty('serialize')) {
|
7725
|
-
(false &&
|
7747
|
+
(false && Ember.warn('You provided a serialize option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.Serializer and it\'s implementations https://emberjs.com/api/data/classes/DS.Serializer.html', false, {
|
7726
7748
|
id: 'ds.model.serialize-option-in-belongs-to'
|
7727
7749
|
}));
|
7728
7750
|
}
|
7729
7751
|
|
7730
7752
|
if (opts.hasOwnProperty('embedded')) {
|
7731
|
-
(false &&
|
7753
|
+
(false && Ember.warn('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin https://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, {
|
7732
7754
|
id: 'ds.model.embedded-option-in-belongs-to'
|
7733
7755
|
}));
|
7734
7756
|
}
|
@@ -7752,18 +7774,17 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7752
7774
|
}).meta(meta);
|
7753
7775
|
}
|
7754
7776
|
});
|
7755
|
-
define('ember-data/-private/system/relationships/ext', ['exports', 'ember
|
7777
|
+
define('ember-data/-private/system/relationships/ext', ['exports', 'ember-data/-private/system/relationship-meta'], function (exports, _relationshipMeta) {
|
7756
7778
|
'use strict';
|
7757
7779
|
|
7758
7780
|
exports.__esModule = true;
|
7759
7781
|
exports.relationshipsByNameDescriptor = exports.relatedTypesDescriptor = exports.relationshipsDescriptor = undefined;
|
7760
|
-
|
7761
|
-
|
7762
|
-
var
|
7763
|
-
var
|
7764
|
-
|
7765
|
-
|
7766
|
-
if (_ember.default.testing === true && relationshipsDescriptor._cacheable === true) {
|
7782
|
+
var A = Ember.A;
|
7783
|
+
var computed = Ember.computed;
|
7784
|
+
var MapWithDefault = Ember.MapWithDefault;
|
7785
|
+
var Map = Ember.Map;
|
7786
|
+
var relationshipsDescriptor = exports.relationshipsDescriptor = computed(function () {
|
7787
|
+
if (Ember.testing === true && relationshipsDescriptor._cacheable === true) {
|
7767
7788
|
relationshipsDescriptor._cacheable = false;
|
7768
7789
|
}
|
7769
7790
|
|
@@ -7791,15 +7812,15 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7791
7812
|
return map;
|
7792
7813
|
}).readOnly();
|
7793
7814
|
|
7794
|
-
var relatedTypesDescriptor = exports.relatedTypesDescriptor =
|
7815
|
+
var relatedTypesDescriptor = exports.relatedTypesDescriptor = computed(function () {
|
7795
7816
|
var _this = this;
|
7796
7817
|
|
7797
|
-
if (
|
7818
|
+
if (Ember.testing === true && relatedTypesDescriptor._cacheable === true) {
|
7798
7819
|
relatedTypesDescriptor._cacheable = false;
|
7799
7820
|
}
|
7800
7821
|
|
7801
7822
|
var modelName = void 0;
|
7802
|
-
var types =
|
7823
|
+
var types = A();
|
7803
7824
|
|
7804
7825
|
// Loop through each computed property on the class,
|
7805
7826
|
// and create an array of the unique types involved
|
@@ -7809,11 +7830,11 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7809
7830
|
meta.key = name;
|
7810
7831
|
modelName = (0, _relationshipMeta.typeForRelationshipMeta)(meta);
|
7811
7832
|
|
7812
|
-
(false &&
|
7833
|
+
(false && Ember.assert('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName));
|
7813
7834
|
|
7814
7835
|
|
7815
7836
|
if (!types.includes(modelName)) {
|
7816
|
-
(false &&
|
7837
|
+
(false && Ember.assert('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName));
|
7817
7838
|
|
7818
7839
|
types.push(modelName);
|
7819
7840
|
}
|
@@ -7823,7 +7844,7 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7823
7844
|
return types;
|
7824
7845
|
}).readOnly();
|
7825
7846
|
|
7826
|
-
var relationshipsByNameDescriptor = exports.relationshipsByNameDescriptor =
|
7847
|
+
var relationshipsByNameDescriptor = exports.relationshipsByNameDescriptor = computed(function () {
|
7827
7848
|
var map = Map.create();
|
7828
7849
|
|
7829
7850
|
this.eachComputedProperty(function (name, meta) {
|
@@ -7838,12 +7859,15 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7838
7859
|
return map;
|
7839
7860
|
}).readOnly();
|
7840
7861
|
});
|
7841
|
-
define('ember-data/-private/system/relationships/has-many', ['exports', 'ember
|
7862
|
+
define('ember-data/-private/system/relationships/has-many', ['exports', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _normalizeModelName, _isArrayLike) {
|
7842
7863
|
'use strict';
|
7843
7864
|
|
7844
7865
|
exports.__esModule = true;
|
7845
7866
|
exports.default = hasMany;
|
7846
|
-
var
|
7867
|
+
var A = Ember.A;
|
7868
|
+
var get = Ember.get;
|
7869
|
+
var computed = Ember.computed;
|
7870
|
+
var inspect = Ember.inspect;
|
7847
7871
|
|
7848
7872
|
|
7849
7873
|
/**
|
@@ -7958,7 +7982,7 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
|
|
7958
7982
|
type = undefined;
|
7959
7983
|
}
|
7960
7984
|
|
7961
|
-
(false &&
|
7985
|
+
(false && Ember.assert('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined'));
|
7962
7986
|
|
7963
7987
|
|
7964
7988
|
options = options || {};
|
@@ -7980,14 +8004,14 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
|
|
7980
8004
|
key: null
|
7981
8005
|
};
|
7982
8006
|
|
7983
|
-
return
|
8007
|
+
return computed({
|
7984
8008
|
get: function (key) {
|
7985
8009
|
return this._internalModel._relationships.get(key).getRecords();
|
7986
8010
|
},
|
7987
8011
|
set: function (key, records) {
|
7988
|
-
(false &&
|
7989
|
-
(false &&
|
7990
|
-
return
|
8012
|
+
(false && Ember.assert('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records)));
|
8013
|
+
(false && Ember.assert('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + inspect(records), function () {
|
8014
|
+
return A(records).every(function (record) {
|
7991
8015
|
return record.hasOwnProperty('_internalModel') === true;
|
7992
8016
|
});
|
7993
8017
|
}()));
|
@@ -8003,7 +8027,7 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
|
|
8003
8027
|
}).meta(meta);
|
8004
8028
|
}
|
8005
8029
|
});
|
8006
|
-
define('ember-data/-private/system/relationships/relationship-payloads-manager', ['exports', 'ember
|
8030
|
+
define('ember-data/-private/system/relationships/relationship-payloads-manager', ['exports', 'ember-data/-private/system/relationships/relationship-payloads'], function (exports, _relationshipPayloads) {
|
8007
8031
|
'use strict';
|
8008
8032
|
|
8009
8033
|
exports.__esModule = true;
|
@@ -8014,61 +8038,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
|
|
8014
8038
|
}
|
8015
8039
|
}
|
8016
8040
|
|
8017
|
-
var _get =
|
8018
|
-
|
8019
|
-
/**
|
8020
|
-
Manages relationship payloads for a given store, for uninitialized
|
8021
|
-
relationships. Acts as a single source of truth (of payloads) for both sides
|
8022
|
-
of an uninitialized relationship so they can agree on the most up-to-date
|
8023
|
-
payload received without needing too much eager processing when those payloads
|
8024
|
-
are pushed into the store.
|
8025
|
-
|
8026
|
-
This minimizes the work spent on relationships that are never initialized.
|
8027
|
-
|
8028
|
-
Once relationships are initialized, their state is managed in a relationship
|
8029
|
-
state object (eg BelongsToRelationship or ManyRelationship).
|
8030
|
-
|
8031
|
-
|
8032
|
-
@example
|
8033
|
-
|
8034
|
-
let relationshipPayloadsManager = new RelationshipPayloadsManager(store);
|
8035
|
-
|
8036
|
-
const User = DS.Model.extend({
|
8037
|
-
hobbies: DS.hasMany('hobby')
|
8038
|
-
});
|
8039
|
-
|
8040
|
-
const Hobby = DS.Model.extend({
|
8041
|
-
user: DS.belongsTo('user')
|
8042
|
-
});
|
8043
|
-
|
8044
|
-
let userPayload = {
|
8045
|
-
data: {
|
8046
|
-
id: 1,
|
8047
|
-
type: 'user',
|
8048
|
-
relationships: {
|
8049
|
-
hobbies: {
|
8050
|
-
data: [{
|
8051
|
-
id: 2,
|
8052
|
-
type: 'hobby'
|
8053
|
-
}]
|
8054
|
-
}
|
8055
|
-
}
|
8056
|
-
},
|
8057
|
-
};
|
8058
|
-
relationshipPayloadsManager.push('user', 1, userPayload.data.relationships);
|
8059
|
-
|
8060
|
-
relationshipPayloadsManager.get('hobby', 2, 'user') === {
|
8061
|
-
{
|
8062
|
-
data: {
|
8063
|
-
id: 1,
|
8064
|
-
type: 'user'
|
8065
|
-
}
|
8066
|
-
}
|
8067
|
-
}
|
8068
|
-
|
8069
|
-
@private
|
8070
|
-
@class RelationshipPayloadsManager
|
8071
|
-
*/
|
8041
|
+
var _get = Ember.get;
|
8072
8042
|
|
8073
8043
|
var RelationshipPayloadsManager = function () {
|
8074
8044
|
function RelationshipPayloadsManager(store) {
|
@@ -8492,7 +8462,7 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8492
8462
|
|
8493
8463
|
exports.default = RelationshipPayloads;
|
8494
8464
|
});
|
8495
|
-
define('ember-data/-private/system/relationships/state/belongs-to', ['exports', 'ember
|
8465
|
+
define('ember-data/-private/system/relationships/state/belongs-to', ['exports', 'ember-data/-debug', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/relationships/state/relationship'], function (exports, _debug, _promiseProxies, _relationship) {
|
8496
8466
|
'use strict';
|
8497
8467
|
|
8498
8468
|
exports.__esModule = true;
|
@@ -8527,6 +8497,9 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8527
8497
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
8528
8498
|
}
|
8529
8499
|
|
8500
|
+
var EmberPromise = Ember.RSVP.Promise;
|
8501
|
+
var inspect = Ember.inspect;
|
8502
|
+
|
8530
8503
|
var BelongsToRelationship = function (_Relationship) {
|
8531
8504
|
_inherits(BelongsToRelationship, _Relationship);
|
8532
8505
|
|
@@ -8637,7 +8610,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8637
8610
|
|
8638
8611
|
BelongsToRelationship.prototype.setRecordPromise = function setRecordPromise(newPromise) {
|
8639
8612
|
var content = newPromise.get && newPromise.get('content');
|
8640
|
-
(false &&
|
8613
|
+
(false && 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));
|
8641
8614
|
|
8642
8615
|
this.setInternalModel(content ? content._internalModel : content);
|
8643
8616
|
};
|
@@ -8667,7 +8640,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8667
8640
|
if (this.inverseInternalModel) {
|
8668
8641
|
return this.store._findByInternalModel(this.inverseInternalModel);
|
8669
8642
|
} else {
|
8670
|
-
return
|
8643
|
+
return EmberPromise.resolve(null);
|
8671
8644
|
}
|
8672
8645
|
};
|
8673
8646
|
|
@@ -8709,7 +8682,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8709
8682
|
return null;
|
8710
8683
|
}
|
8711
8684
|
var toReturn = this.inverseInternalModel.getRecord();
|
8712
|
-
(false &&
|
8685
|
+
(false && Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.internalModel.modelName + "' with id " + this.internalModel.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.belongsTo({ async: true })`)", toReturn === null || !toReturn.get('isEmpty')));
|
8713
8686
|
|
8714
8687
|
return toReturn;
|
8715
8688
|
}
|
@@ -8731,7 +8704,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8731
8704
|
};
|
8732
8705
|
|
8733
8706
|
BelongsToRelationship.prototype.updateData = function updateData(data, initial) {
|
8734
|
-
(false &&
|
8707
|
+
(false && Ember.assert('Ember Data expected the data for the ' + this.key + ' relationship on a ' + this.internalModel.toString() + ' to be in a JSON API format and include an `id` and `type` property but it found ' + inspect(data) + '. Please check your serializer and make sure it is serializing the relationship payload into a JSON API format.', data === null || data.id !== undefined && data.type !== undefined));
|
8735
8708
|
|
8736
8709
|
var internalModel = this.store._pushResourceIdentifier(this, data);
|
8737
8710
|
if (initial) {
|
@@ -8746,7 +8719,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8746
8719
|
|
8747
8720
|
exports.default = BelongsToRelationship;
|
8748
8721
|
});
|
8749
|
-
define("ember-data/-private/system/relationships/state/create", ["exports", "ember
|
8722
|
+
define("ember-data/-private/system/relationships/state/create", ["exports", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"], function (exports, _hasMany, _belongsTo) {
|
8750
8723
|
"use strict";
|
8751
8724
|
|
8752
8725
|
exports.__esModule = true;
|
@@ -8775,7 +8748,7 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
|
|
8775
8748
|
};
|
8776
8749
|
}();
|
8777
8750
|
|
8778
|
-
var _get =
|
8751
|
+
var _get = Ember.get;
|
8779
8752
|
|
8780
8753
|
|
8781
8754
|
function shouldFindInverse(relationshipMeta) {
|
@@ -9256,7 +9229,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9256
9229
|
return set;
|
9257
9230
|
}
|
9258
9231
|
});
|
9259
|
-
define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link'
|
9232
|
+
define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link'], function (exports, _orderedSet, _normalizeLink2) {
|
9260
9233
|
'use strict';
|
9261
9234
|
|
9262
9235
|
exports.__esModule = true;
|
@@ -9285,7 +9258,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9285
9258
|
};
|
9286
9259
|
}();
|
9287
9260
|
|
9288
|
-
var guidFor =
|
9261
|
+
var guidFor = Ember.guidFor;
|
9289
9262
|
|
9290
9263
|
var Relationship = function () {
|
9291
9264
|
function Relationship(store, internalModel, inverseKey, relationshipMeta) {
|
@@ -9557,10 +9530,10 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9557
9530
|
};
|
9558
9531
|
|
9559
9532
|
Relationship.prototype.updateLink = function updateLink(link, initial) {
|
9560
|
-
(false &&
|
9533
|
+
(false && Ember.warn('You pushed a record of type \'' + this.internalModel.modelName + '\' with a relationship \'' + this.key + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', this.isAsync || this.hasData, {
|
9561
9534
|
id: 'ds.store.push-link-for-sync-relationship'
|
9562
9535
|
}));
|
9563
|
-
(false &&
|
9536
|
+
(false && Ember.assert('You have pushed a record of type \'' + this.internalModel.modelName + '\' with \'' + this.key + '\' as a link, but the value of that link is not a string.', typeof link === 'string' || link === null));
|
9564
9537
|
|
9565
9538
|
|
9566
9539
|
this.link = link;
|
@@ -9808,8 +9781,8 @@ define('ember-data/-private/system/snapshot-record-array', ['exports'], function
|
|
9808
9781
|
|
9809
9782
|
exports.default = SnapshotRecordArray;
|
9810
9783
|
});
|
9811
|
-
define(
|
9812
|
-
|
9784
|
+
define('ember-data/-private/system/snapshot', ['exports'], function (exports) {
|
9785
|
+
'use strict';
|
9813
9786
|
|
9814
9787
|
exports.__esModule = true;
|
9815
9788
|
|
@@ -9837,7 +9810,10 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
9837
9810
|
};
|
9838
9811
|
}();
|
9839
9812
|
|
9840
|
-
var
|
9813
|
+
var copy = Ember.copy;
|
9814
|
+
var inspect = Ember.inspect;
|
9815
|
+
var EmberError = Ember.Error;
|
9816
|
+
var get = Ember.get;
|
9841
9817
|
|
9842
9818
|
var Snapshot = function () {
|
9843
9819
|
function Snapshot(internalModel) {
|
@@ -9912,11 +9888,11 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
9912
9888
|
if (keyName in this._attributes) {
|
9913
9889
|
return this._attributes[keyName];
|
9914
9890
|
}
|
9915
|
-
throw new
|
9891
|
+
throw new EmberError("Model '" + inspect(this.record) + "' has no attribute named '" + keyName + "' defined.");
|
9916
9892
|
};
|
9917
9893
|
|
9918
9894
|
Snapshot.prototype.attributes = function attributes() {
|
9919
|
-
return
|
9895
|
+
return copy(this._attributes);
|
9920
9896
|
};
|
9921
9897
|
|
9922
9898
|
Snapshot.prototype.changedAttributes = function changedAttributes() {
|
@@ -9925,7 +9901,7 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
9925
9901
|
|
9926
9902
|
for (var i = 0, length = changedAttributeKeys.length; i < length; i++) {
|
9927
9903
|
var key = changedAttributeKeys[i];
|
9928
|
-
changedAttributes[key] =
|
9904
|
+
changedAttributes[key] = copy(this._changedAttributes[key]);
|
9929
9905
|
}
|
9930
9906
|
|
9931
9907
|
return changedAttributes;
|
@@ -9948,7 +9924,7 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
9948
9924
|
|
9949
9925
|
relationship = this._internalModel._relationships.get(keyName);
|
9950
9926
|
if (!(relationship && relationship.relationshipMeta.kind === 'belongsTo')) {
|
9951
|
-
throw new
|
9927
|
+
throw new EmberError("Model '" + inspect(this.record) + "' has no belongsTo relationship named '" + keyName + "' defined.");
|
9952
9928
|
}
|
9953
9929
|
|
9954
9930
|
hasData = get(relationship, 'hasData');
|
@@ -9992,7 +9968,7 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
9992
9968
|
|
9993
9969
|
relationship = this._internalModel._relationships.get(keyName);
|
9994
9970
|
if (!(relationship && relationship.relationshipMeta.kind === 'hasMany')) {
|
9995
|
-
throw new
|
9971
|
+
throw new EmberError("Model '" + inspect(this.record) + "' has no hasMany relationship named '" + keyName + "' defined.");
|
9996
9972
|
}
|
9997
9973
|
|
9998
9974
|
hasData = get(relationship, 'hasData');
|
@@ -10033,7 +10009,7 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
10033
10009
|
};
|
10034
10010
|
|
10035
10011
|
_createClass(Snapshot, [{
|
10036
|
-
key:
|
10012
|
+
key: 'type',
|
10037
10013
|
get: function () {
|
10038
10014
|
// TODO @runspired we should deprecate this in favor of modelClass but only once
|
10039
10015
|
// we've cleaned up the internals enough that a public change to follow suite is
|
@@ -10047,33 +10023,31 @@ define("ember-data/-private/system/snapshot", ["exports", "ember"], function (ex
|
|
10047
10023
|
|
10048
10024
|
exports.default = Snapshot;
|
10049
10025
|
});
|
10050
|
-
define('ember-data/-private/system/store', ['exports', 'ember
|
10026
|
+
define('ember-data/-private/system/store', ['exports', 'ember-data/-private/adapters/errors', 'ember-data/-private/system/model/model', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/identity-map', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers', 'ember-data/-private/system/relationships/relationship-payloads-manager', 'ember-data/-private/system/store/finders', 'ember-data/-private/utils', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/record-array-manager', 'ember-data/-private/system/store/container-instance-cache', 'ember-data/-private/system/model/internal-model', 'ember-data/-private/features'], function (exports, _errors, _model, _normalizeModelName, _identityMap, _promiseProxies, _common, _serializerResponse, _serializers, _relationshipPayloadsManager, _finders, _utils, _coerceId, _recordArrayManager, _containerInstanceCache, _internalModel5, _features) {
|
10051
10027
|
'use strict';
|
10052
10028
|
|
10053
10029
|
exports.__esModule = true;
|
10054
10030
|
exports.Store = undefined;
|
10055
|
-
|
10056
|
-
|
10057
|
-
var
|
10058
|
-
|
10059
|
-
|
10060
|
-
|
10061
|
-
var
|
10062
|
-
|
10063
|
-
|
10064
|
-
|
10065
|
-
|
10066
|
-
|
10067
|
-
|
10068
|
-
|
10069
|
-
|
10070
|
-
|
10071
|
-
|
10072
|
-
|
10073
|
-
|
10074
|
-
|
10075
|
-
Service = _ember.default.Service,
|
10076
|
-
typeOf = _ember.default.typeOf;
|
10031
|
+
var A = Ember.A;
|
10032
|
+
var copy = Ember.copy;
|
10033
|
+
var EmberError = Ember.Error;
|
10034
|
+
var MapWithDefault = Ember.MapWithDefault;
|
10035
|
+
var emberRun = Ember.run;
|
10036
|
+
var set = Ember.set;
|
10037
|
+
var get = Ember.get;
|
10038
|
+
var computed = Ember.computed;
|
10039
|
+
var RSVP = Ember.RSVP;
|
10040
|
+
var Service = Ember.Service;
|
10041
|
+
var typeOf = Ember.typeOf;
|
10042
|
+
var isPresent = Ember.isPresent;
|
10043
|
+
var isNone = Ember.isNone;
|
10044
|
+
var inspect = Ember.inspect;
|
10045
|
+
|
10046
|
+
|
10047
|
+
var badIdFormatAssertion = '`id` passed to `findRecord()` has to be non-empty string or number';
|
10048
|
+
|
10049
|
+
var Backburner = Ember._Backburner,
|
10050
|
+
ENV = Ember.ENV;
|
10077
10051
|
var Promise = RSVP.Promise;
|
10078
10052
|
|
10079
10053
|
|
@@ -10252,7 +10226,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10252
10226
|
*/
|
10253
10227
|
serialize: function (record, options) {
|
10254
10228
|
if (true) {
|
10255
|
-
(false && !(false) &&
|
10229
|
+
(false && !(false) && Ember.deprecate('Use of store.serialize is deprecated, use record.serialize instead.', false, {
|
10256
10230
|
id: 'ds.store.serialize',
|
10257
10231
|
until: '3.0'
|
10258
10232
|
}));
|
@@ -10277,7 +10251,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10277
10251
|
defaultAdapter: computed('adapter', function () {
|
10278
10252
|
var adapter = get(this, 'adapter');
|
10279
10253
|
|
10280
|
-
(false &&
|
10254
|
+
(false && Ember.assert('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string'));
|
10281
10255
|
|
10282
10256
|
|
10283
10257
|
return this.adapterFor(adapter);
|
@@ -10311,8 +10285,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10311
10285
|
@return {DS.Model} record
|
10312
10286
|
*/
|
10313
10287
|
createRecord: function (modelName, inputProperties) {
|
10314
|
-
(false &&
|
10315
|
-
(false &&
|
10288
|
+
(false && Ember.assert('You need to pass a model name to the store\'s createRecord method', isPresent(modelName)));
|
10289
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10316
10290
|
|
10317
10291
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
10318
10292
|
var properties = copy(inputProperties) || Object.create(null);
|
@@ -10415,15 +10389,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10415
10389
|
@private
|
10416
10390
|
*/
|
10417
10391
|
find: function (modelName, id, options) {
|
10418
|
-
// The default `model` hook in
|
10392
|
+
// The default `model` hook in Route calls `find(modelName, id)`,
|
10419
10393
|
// that's why we have to keep this method around even though `findRecord` is
|
10420
10394
|
// the public way to get a record by modelName and id.
|
10421
|
-
(false &&
|
10422
|
-
(false &&
|
10423
|
-
(false &&
|
10424
|
-
(false &&
|
10425
|
-
(false &&
|
10426
|
-
(false &&
|
10395
|
+
(false && Ember.assert('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1));
|
10396
|
+
(false && Ember.assert('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options));
|
10397
|
+
(false && Ember.assert('You need to pass the model name and id to the store\'s find method', arguments.length === 2));
|
10398
|
+
(false && Ember.assert('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number'));
|
10399
|
+
(false && Ember.assert('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object'));
|
10400
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10427
10401
|
|
10428
10402
|
|
10429
10403
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
@@ -10440,8 +10414,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10440
10414
|
resolved with the record.
|
10441
10415
|
Example
|
10442
10416
|
```app/routes/post.js
|
10443
|
-
import
|
10444
|
-
export default
|
10417
|
+
import Route from '@ember/routing/route';
|
10418
|
+
export default Route.extend({
|
10445
10419
|
model(params) {
|
10446
10420
|
return this.store.findRecord('post', params.post_id);
|
10447
10421
|
}
|
@@ -10534,18 +10508,18 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10534
10508
|
boolean value for `backgroundReload` in the options object for
|
10535
10509
|
`findRecord`.
|
10536
10510
|
```app/routes/post/edit.js
|
10537
|
-
import
|
10538
|
-
export default
|
10511
|
+
import Route from '@ember/routing/route';
|
10512
|
+
export default Route.extend({
|
10539
10513
|
model(params) {
|
10540
10514
|
return this.store.findRecord('post', params.post_id, { backgroundReload: false });
|
10541
10515
|
}
|
10542
10516
|
});
|
10543
10517
|
```
|
10544
|
-
|
10545
|
-
|
10518
|
+
If you pass an object on the `adapterOptions` property of the options
|
10519
|
+
argument it will be passed to you adapter via the snapshot
|
10546
10520
|
```app/routes/post/edit.js
|
10547
|
-
import
|
10548
|
-
export default
|
10521
|
+
import Route from '@ember/routing/route';
|
10522
|
+
export default Route.extend({
|
10549
10523
|
model(params) {
|
10550
10524
|
return this.store.findRecord('post', params.post_id, {
|
10551
10525
|
adapterOptions: { subscribe: false }
|
@@ -10577,10 +10551,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10577
10551
|
model, when we retrieve a specific post we can have the server also return that post's
|
10578
10552
|
comments in the same request:
|
10579
10553
|
```app/routes/post.js
|
10580
|
-
import
|
10581
|
-
export default
|
10554
|
+
import Route from '@ember/routing/route';
|
10555
|
+
export default Route.extend({
|
10582
10556
|
model(params) {
|
10583
|
-
|
10557
|
+
return this.store.findRecord('post', params.post_id, { include: 'comments' });
|
10584
10558
|
}
|
10585
10559
|
});
|
10586
10560
|
```
|
@@ -10591,10 +10565,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10591
10565
|
using a dot-separated sequence of relationship names. So to request both the post's
|
10592
10566
|
comments and the authors of those comments the request would look like this:
|
10593
10567
|
```app/routes/post.js
|
10594
|
-
import
|
10595
|
-
export default
|
10568
|
+
import Route from '@ember/routing/route';
|
10569
|
+
export default Route.extend({
|
10596
10570
|
model(params) {
|
10597
|
-
|
10571
|
+
return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });
|
10598
10572
|
}
|
10599
10573
|
});
|
10600
10574
|
```
|
@@ -10606,9 +10580,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10606
10580
|
@return {Promise} promise
|
10607
10581
|
*/
|
10608
10582
|
findRecord: function (modelName, id, options) {
|
10609
|
-
(false &&
|
10610
|
-
(false &&
|
10611
|
-
(false &&
|
10583
|
+
(false && Ember.assert('You need to pass a model name to the store\'s findRecord method', isPresent(modelName)));
|
10584
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10585
|
+
(false && Ember.assert(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id)));
|
10612
10586
|
|
10613
10587
|
|
10614
10588
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
@@ -10685,8 +10659,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10685
10659
|
@return {Promise} promise
|
10686
10660
|
*/
|
10687
10661
|
findByIds: function (modelName, ids) {
|
10688
|
-
(false &&
|
10689
|
-
(false &&
|
10662
|
+
(false && Ember.assert('You need to pass a model name to the store\'s findByIds method', isPresent(modelName)));
|
10663
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10690
10664
|
|
10691
10665
|
|
10692
10666
|
var promises = new Array(ids.length);
|
@@ -10714,8 +10688,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10714
10688
|
var modelName = internalModel.modelName;
|
10715
10689
|
var adapter = this.adapterFor(modelName);
|
10716
10690
|
|
10717
|
-
(false &&
|
10718
|
-
(false &&
|
10691
|
+
(false && Ember.assert('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter));
|
10692
|
+
(false && Ember.assert('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function'));
|
10719
10693
|
|
10720
10694
|
|
10721
10695
|
return (0, _finders._find)(adapter, this, internalModel.type, internalModel.id, internalModel, options);
|
@@ -10810,7 +10784,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10810
10784
|
}
|
10811
10785
|
|
10812
10786
|
if (missingInternalModels.length) {
|
10813
|
-
(false &&
|
10787
|
+
(false && Ember.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) {
|
10814
10788
|
return r.id;
|
10815
10789
|
})), false, {
|
10816
10790
|
id: 'ds.store.missing-records-from-adapter'
|
@@ -10874,7 +10848,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10874
10848
|
var pair = seeking[groupedInternalModels[0].id];
|
10875
10849
|
_fetchRecord(pair);
|
10876
10850
|
} else {
|
10877
|
-
(false &&
|
10851
|
+
(false && Ember.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false));
|
10878
10852
|
}
|
10879
10853
|
}
|
10880
10854
|
} else {
|
@@ -10938,8 +10912,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10938
10912
|
@return {DS.Model|null} record
|
10939
10913
|
*/
|
10940
10914
|
peekRecord: function (modelName, id) {
|
10941
|
-
(false &&
|
10942
|
-
(false &&
|
10915
|
+
(false && Ember.assert('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName)));
|
10916
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10943
10917
|
|
10944
10918
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
10945
10919
|
|
@@ -10967,9 +10941,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10967
10941
|
|
10968
10942
|
var adapter = this.adapterFor(modelName);
|
10969
10943
|
|
10970
|
-
(false &&
|
10971
|
-
(false &&
|
10972
|
-
(false &&
|
10944
|
+
(false && Ember.assert('You cannot reload a record without an ID', id));
|
10945
|
+
(false && Ember.assert('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter));
|
10946
|
+
(false && Ember.assert('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function'));
|
10973
10947
|
|
10974
10948
|
|
10975
10949
|
return this._scheduleFetch(internalModel);
|
@@ -10993,8 +10967,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10993
10967
|
@return {Boolean}
|
10994
10968
|
*/
|
10995
10969
|
hasRecordForId: function (modelName, id) {
|
10996
|
-
(false &&
|
10997
|
-
(false &&
|
10970
|
+
(false && Ember.assert('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName)));
|
10971
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10998
10972
|
|
10999
10973
|
|
11000
10974
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
@@ -11016,8 +10990,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11016
10990
|
@return {DS.Model} record
|
11017
10991
|
*/
|
11018
10992
|
recordForId: function (modelName, id) {
|
11019
|
-
(false &&
|
11020
|
-
(false &&
|
10993
|
+
(false && Ember.assert('You need to pass a model name to the store\'s recordForId method', isPresent(modelName)));
|
10994
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11021
10995
|
|
11022
10996
|
|
11023
10997
|
return this._internalModelForId(modelName, id).getRecord();
|
@@ -11081,8 +11055,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11081
11055
|
findHasMany: function (internalModel, link, relationship) {
|
11082
11056
|
var adapter = this.adapterFor(internalModel.modelName);
|
11083
11057
|
|
11084
|
-
(false &&
|
11085
|
-
(false &&
|
11058
|
+
(false && Ember.assert('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
|
11059
|
+
(false && 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'));
|
11086
11060
|
|
11087
11061
|
|
11088
11062
|
return (0, _finders._findHasMany)(adapter, this, internalModel, link, relationship);
|
@@ -11100,8 +11074,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11100
11074
|
findBelongsTo: function (internalModel, link, relationship) {
|
11101
11075
|
var adapter = this.adapterFor(internalModel.modelName);
|
11102
11076
|
|
11103
|
-
(false &&
|
11104
|
-
(false &&
|
11077
|
+
(false && Ember.assert('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
|
11078
|
+
(false && 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'));
|
11105
11079
|
|
11106
11080
|
|
11107
11081
|
return (0, _finders._findBelongsTo)(adapter, this, internalModel, link, relationship);
|
@@ -11147,22 +11121,22 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11147
11121
|
@return {Promise} promise
|
11148
11122
|
*/
|
11149
11123
|
query: function (modelName, query) {
|
11150
|
-
(false &&
|
11151
|
-
(false &&
|
11152
|
-
(false &&
|
11124
|
+
(false && Ember.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
|
11125
|
+
(false && Ember.assert('You need to pass a query hash to the store\'s query method', query));
|
11126
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11153
11127
|
|
11154
11128
|
|
11155
11129
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11156
11130
|
return this._query(normalizedModelName, query);
|
11157
11131
|
},
|
11158
11132
|
_query: function (modelName, query, array) {
|
11159
|
-
(false &&
|
11160
|
-
(false &&
|
11161
|
-
(false &&
|
11133
|
+
(false && Ember.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
|
11134
|
+
(false && Ember.assert('You need to pass a query hash to the store\'s query method', query));
|
11135
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11162
11136
|
|
11163
11137
|
var adapter = this.adapterFor(modelName);
|
11164
|
-
(false &&
|
11165
|
-
(false &&
|
11138
|
+
(false && Ember.assert('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter));
|
11139
|
+
(false && Ember.assert('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function'));
|
11166
11140
|
|
11167
11141
|
|
11168
11142
|
var pA = (0, _promiseProxies.promiseArray)((0, _finders._query)(adapter, this, modelName, query, array));
|
@@ -11199,10 +11173,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11199
11173
|
```
|
11200
11174
|
The request is made through the adapters' `queryRecord`:
|
11201
11175
|
```app/adapters/user.js
|
11176
|
+
import $ from 'jquery';
|
11202
11177
|
import DS from 'ember-data';
|
11203
11178
|
export default DS.Adapter.extend({
|
11204
11179
|
queryRecord(modelName, query) {
|
11205
|
-
return
|
11180
|
+
return $.getJSON('/api/current_user');
|
11206
11181
|
}
|
11207
11182
|
});
|
11208
11183
|
```
|
@@ -11250,17 +11225,17 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11250
11225
|
@return {Promise} promise which resolves with the found record or `null`
|
11251
11226
|
*/
|
11252
11227
|
queryRecord: function (modelName, query) {
|
11253
|
-
(false &&
|
11254
|
-
(false &&
|
11255
|
-
(false &&
|
11228
|
+
(false && Ember.assert('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName)));
|
11229
|
+
(false && Ember.assert('You need to pass a query hash to the store\'s queryRecord method', query));
|
11230
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11256
11231
|
|
11257
11232
|
|
11258
11233
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11259
11234
|
|
11260
11235
|
var adapter = this.adapterFor(normalizedModelName);
|
11261
11236
|
|
11262
|
-
(false &&
|
11263
|
-
(false &&
|
11237
|
+
(false && Ember.assert('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter));
|
11238
|
+
(false && Ember.assert('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function'));
|
11264
11239
|
|
11265
11240
|
|
11266
11241
|
return (0, _promiseProxies.promiseObject)((0, _finders._queryRecord)(adapter, this, modelName, query).then(function (internalModel) {
|
@@ -11281,8 +11256,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11281
11256
|
this type present in the store, even if the adapter only returns a subset
|
11282
11257
|
of them.
|
11283
11258
|
```app/routes/authors.js
|
11284
|
-
import
|
11285
|
-
export default
|
11259
|
+
import Route from '@ember/routing/route';
|
11260
|
+
export default Route.extend({
|
11286
11261
|
model(params) {
|
11287
11262
|
return this.store.findAll('author');
|
11288
11263
|
}
|
@@ -11320,8 +11295,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11320
11295
|
then a background reload is started. Once this resolves, the array with
|
11321
11296
|
which the promise resolves, is updated automatically so it contains all the
|
11322
11297
|
records in the store:
|
11323
|
-
```js
|
11324
|
-
|
11298
|
+
```app/adapters/application.js
|
11299
|
+
import DS from 'ember-data';
|
11325
11300
|
export default DS.Adapter.extend({
|
11326
11301
|
shouldReloadAll(store, snapshotsArray) {
|
11327
11302
|
return false;
|
@@ -11355,8 +11330,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11355
11330
|
boolean value for `backgroundReload` in the options object for
|
11356
11331
|
`findAll`.
|
11357
11332
|
```app/routes/post/edit.js
|
11358
|
-
import
|
11359
|
-
export default
|
11333
|
+
import Route from '@ember/routing/route';
|
11334
|
+
export default Route.extend({
|
11360
11335
|
model() {
|
11361
11336
|
return this.store.findAll('post', { backgroundReload: false });
|
11362
11337
|
}
|
@@ -11365,8 +11340,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11365
11340
|
If you pass an object on the `adapterOptions` property of the options
|
11366
11341
|
argument it will be passed to you adapter via the `snapshotRecordArray`
|
11367
11342
|
```app/routes/posts.js
|
11368
|
-
import
|
11369
|
-
export default
|
11343
|
+
import Route from '@ember/routing/route';
|
11344
|
+
export default Route.extend({
|
11370
11345
|
model(params) {
|
11371
11346
|
return this.store.findAll('post', {
|
11372
11347
|
adapterOptions: { subscribe: false }
|
@@ -11399,10 +11374,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11399
11374
|
model, when we retrieve all of the post records we can have the server also return
|
11400
11375
|
all of the posts' comments in the same request:
|
11401
11376
|
```app/routes/posts.js
|
11402
|
-
import
|
11403
|
-
export default
|
11377
|
+
import Route from '@ember/routing/route';
|
11378
|
+
export default Route.extend({
|
11404
11379
|
model() {
|
11405
|
-
|
11380
|
+
return this.store.findAll('post', { include: 'comments' });
|
11406
11381
|
}
|
11407
11382
|
});
|
11408
11383
|
```
|
@@ -11411,10 +11386,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11411
11386
|
using a dot-separated sequence of relationship names. So to request both the posts'
|
11412
11387
|
comments and the authors of those comments the request would look like this:
|
11413
11388
|
```app/routes/posts.js
|
11414
|
-
import
|
11415
|
-
export default
|
11389
|
+
import Route from '@ember/routing/route';
|
11390
|
+
export default Route.extend({
|
11416
11391
|
model() {
|
11417
|
-
|
11392
|
+
return this.store.findAll('post', { include: 'comments,comments.author' });
|
11418
11393
|
}
|
11419
11394
|
});
|
11420
11395
|
```
|
@@ -11426,8 +11401,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11426
11401
|
@return {Promise} promise
|
11427
11402
|
*/
|
11428
11403
|
findAll: function (modelName, options) {
|
11429
|
-
(false &&
|
11430
|
-
(false &&
|
11404
|
+
(false && Ember.assert('You need to pass a model name to the store\'s findAll method', isPresent(modelName)));
|
11405
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11431
11406
|
|
11432
11407
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11433
11408
|
var fetch = this._fetchAll(normalizedModelName, this.peekAll(normalizedModelName), options);
|
@@ -11449,8 +11424,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11449
11424
|
var adapter = this.adapterFor(modelName);
|
11450
11425
|
var sinceToken = this._internalModelsFor(modelName).metadata.since;
|
11451
11426
|
|
11452
|
-
(false &&
|
11453
|
-
(false &&
|
11427
|
+
(false && Ember.assert('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter));
|
11428
|
+
(false && Ember.assert('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function'));
|
11454
11429
|
|
11455
11430
|
|
11456
11431
|
if (options.reload) {
|
@@ -11487,7 +11462,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11487
11462
|
this.recordArrayManager._didUpdateAll(modelName);
|
11488
11463
|
},
|
11489
11464
|
didUpdateAll: function (modelName) {
|
11490
|
-
(false && !(false) &&
|
11465
|
+
(false && !(false) && Ember.deprecate('didUpdateAll was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.didUpdateAll', until: '2.17.0' }));
|
11491
11466
|
|
11492
11467
|
return this._didUpdateAll(modelName);
|
11493
11468
|
},
|
@@ -11513,8 +11488,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11513
11488
|
@return {DS.RecordArray}
|
11514
11489
|
*/
|
11515
11490
|
peekAll: function (modelName) {
|
11516
|
-
(false &&
|
11517
|
-
(false &&
|
11491
|
+
(false && Ember.assert('You need to pass a model name to the store\'s peekAll method', isPresent(modelName)));
|
11492
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11518
11493
|
|
11519
11494
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11520
11495
|
return this.recordArrayManager.liveRecordArrayFor(normalizedModelName);
|
@@ -11522,18 +11497,18 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11522
11497
|
|
11523
11498
|
|
11524
11499
|
/**
|
11525
|
-
|
11526
|
-
|
11527
|
-
|
11528
|
-
|
11529
|
-
|
11530
|
-
|
11531
|
-
|
11532
|
-
|
11533
|
-
|
11500
|
+
This method unloads all records in the store.
|
11501
|
+
It schedules unloading to happen during the next run loop.
|
11502
|
+
Optionally you can pass a type which unload all records for a given type.
|
11503
|
+
```javascript
|
11504
|
+
store.unloadAll();
|
11505
|
+
store.unloadAll('post');
|
11506
|
+
```
|
11507
|
+
@method unloadAll
|
11508
|
+
@param {String} modelName
|
11534
11509
|
*/
|
11535
11510
|
unloadAll: function (modelName) {
|
11536
|
-
(false &&
|
11511
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string'));
|
11537
11512
|
|
11538
11513
|
|
11539
11514
|
if (arguments.length === 0) {
|
@@ -11590,12 +11565,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11590
11565
|
@deprecated
|
11591
11566
|
*/
|
11592
11567
|
filter: function (modelName, query, filter) {
|
11593
|
-
(false &&
|
11594
|
-
(false &&
|
11568
|
+
(false && Ember.assert('You need to pass a model name to the store\'s filter method', isPresent(modelName)));
|
11569
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11595
11570
|
|
11596
11571
|
|
11597
11572
|
if (!ENV.ENABLE_DS_FILTER) {
|
11598
|
-
(false &&
|
11573
|
+
(false && Ember.assert('The filter API has been moved to a plugin. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page. https://github.com/ember-data/ember-data-filter', false));
|
11599
11574
|
}
|
11600
11575
|
|
11601
11576
|
var promise = void 0;
|
@@ -11636,7 +11611,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11636
11611
|
@return {boolean}
|
11637
11612
|
*/
|
11638
11613
|
recordIsLoaded: function (modelName, id) {
|
11639
|
-
(false && !(false) &&
|
11614
|
+
(false && !(false) && Ember.deprecate('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, {
|
11640
11615
|
id: 'ds.store.recordIsLoaded',
|
11641
11616
|
until: '3.0'
|
11642
11617
|
}));
|
@@ -11726,7 +11701,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11726
11701
|
this.updateId(internalModel, data);
|
11727
11702
|
this._setupRelationshipsForModel(internalModel, data);
|
11728
11703
|
} else {
|
11729
|
-
(false &&
|
11704
|
+
(false && Ember.assert('Your ' + internalModel.modelName + ' record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.', internalModel.id));
|
11730
11705
|
}
|
11731
11706
|
|
11732
11707
|
//We first make sure the primary data has been updated
|
@@ -11778,24 +11753,24 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11778
11753
|
var id = (0, _coerceId.default)(data.id);
|
11779
11754
|
|
11780
11755
|
// ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)
|
11781
|
-
(false &&
|
11756
|
+
(false && Ember.assert('\'' + modelName + '\' was saved to the server, but the response does not have an id and your record does not either.', !(id === null && oldId === null)));
|
11782
11757
|
|
11783
11758
|
// ID absolutely can't be different than oldID if oldID is not null
|
11784
11759
|
|
11785
|
-
(false &&
|
11760
|
+
(false && Ember.assert('\'' + modelName + ':' + oldId + '\' was saved to the server, but the response returned the new id \'' + id + '\'. The store cannot assign a new id to a record that already has an id.', !(oldId !== null && id !== oldId)));
|
11786
11761
|
|
11787
11762
|
// ID can be null if oldID is not null (altered ID in response for a record)
|
11788
11763
|
// however, this is more than likely a developer error.
|
11789
11764
|
|
11790
11765
|
if (oldId !== null && id === null) {
|
11791
|
-
(false &&
|
11766
|
+
(false && Ember.warn('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null)));
|
11792
11767
|
|
11793
11768
|
return;
|
11794
11769
|
}
|
11795
11770
|
|
11796
11771
|
var existingInternalModel = this._existingInternalModelForId(modelName, id);
|
11797
11772
|
|
11798
|
-
(false &&
|
11773
|
+
(false && Ember.assert('\'' + modelName + '\' was saved to the server, but the response returned the new id \'' + id + '\', which has already been used with another record.\'', isNone(existingInternalModel) || existingInternalModel === internalModel));
|
11799
11774
|
|
11800
11775
|
|
11801
11776
|
this._internalModelsFor(internalModel.modelName).set(id, internalModel);
|
@@ -11827,7 +11802,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11827
11802
|
@param {Object} data
|
11828
11803
|
*/
|
11829
11804
|
_load: function (data) {
|
11830
|
-
var
|
11805
|
+
var modelName = (0, _normalizeModelName.default)(data.type);
|
11806
|
+
var internalModel = this._internalModelForId(modelName, data.id);
|
11831
11807
|
|
11832
11808
|
var isUpdate = internalModel.currentState.isEmpty === false;
|
11833
11809
|
|
@@ -11899,8 +11875,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11899
11875
|
@return {DS.Model}
|
11900
11876
|
*/
|
11901
11877
|
modelFor: function (modelName) {
|
11902
|
-
(false &&
|
11903
|
-
(false &&
|
11878
|
+
(false && Ember.assert('You need to pass a model name to the store\'s modelFor method', isPresent(modelName)));
|
11879
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11904
11880
|
|
11905
11881
|
|
11906
11882
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
@@ -11934,7 +11910,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11934
11910
|
// interopt with the future
|
11935
11911
|
var klass = (0, _utils.getOwner)(this).factoryFor ? factory.class : factory;
|
11936
11912
|
|
11937
|
-
(false &&
|
11913
|
+
(false && Ember.assert('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel));
|
11938
11914
|
|
11939
11915
|
// TODO: deprecate this
|
11940
11916
|
|
@@ -11951,8 +11927,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11951
11927
|
@private
|
11952
11928
|
*/
|
11953
11929
|
modelFactoryFor: function (modelName) {
|
11954
|
-
(false &&
|
11955
|
-
(false &&
|
11930
|
+
(false && Ember.assert('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName)));
|
11931
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11956
11932
|
|
11957
11933
|
|
11958
11934
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
@@ -12152,7 +12128,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12152
12128
|
return null;
|
12153
12129
|
}
|
12154
12130
|
|
12155
|
-
(false &&
|
12131
|
+
(false && Ember.assert('Expected an object in the \'data\' property in a call to \'push\' for ' + jsonApiDoc.type + ', but was ' + typeOf(jsonApiDoc.data), typeOf(jsonApiDoc.data) === 'object'));
|
12156
12132
|
|
12157
12133
|
|
12158
12134
|
return _this._pushInternalModel(jsonApiDoc.data);
|
@@ -12172,8 +12148,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12172
12148
|
},
|
12173
12149
|
_pushInternalModel: function (data) {
|
12174
12150
|
var modelName = data.type;
|
12175
|
-
(false &&
|
12176
|
-
(false &&
|
12151
|
+
(false && Ember.assert('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== ''));
|
12152
|
+
(false && Ember.assert('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName)));
|
12177
12153
|
|
12178
12154
|
|
12179
12155
|
if (false) {
|
@@ -12188,7 +12164,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12188
12164
|
return !get(modelClass, 'fields').has(key);
|
12189
12165
|
});
|
12190
12166
|
var unknownAttributesMessage = 'The payload for \'' + modelName + '\' contains these unknown attributes: ' + unknownAttributes + '. Make sure they\'ve been defined in your model.';
|
12191
|
-
(false &&
|
12167
|
+
(false && Ember.warn(unknownAttributesMessage, unknownAttributes.length === 0, { id: 'ds.store.unknown-keys-in-payload' }));
|
12192
12168
|
|
12193
12169
|
// Check unknown relationships
|
12194
12170
|
|
@@ -12196,7 +12172,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12196
12172
|
return !get(modelClass, 'fields').has(key);
|
12197
12173
|
});
|
12198
12174
|
var unknownRelationshipsMessage = 'The payload for \'' + modelName + '\' contains these unknown relationships: ' + unknownRelationships + '. Make sure they\'ve been defined in your model.';
|
12199
|
-
(false &&
|
12175
|
+
(false && Ember.warn(unknownRelationshipsMessage, unknownRelationships.length === 0, { id: 'ds.store.unknown-keys-in-payload' }));
|
12200
12176
|
}
|
12201
12177
|
}
|
12202
12178
|
|
@@ -12276,7 +12252,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12276
12252
|
export default DS.JSONSerializer;
|
12277
12253
|
```
|
12278
12254
|
```js
|
12279
|
-
store.pushPayload(
|
12255
|
+
store.pushPayload(pushData); // Will use the application serializer
|
12280
12256
|
store.pushPayload('post', pushData); // Will use the post serializer
|
12281
12257
|
```
|
12282
12258
|
@method pushPayload
|
@@ -12289,10 +12265,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12289
12265
|
if (!inputPayload) {
|
12290
12266
|
payload = modelName;
|
12291
12267
|
serializer = defaultSerializer(this);
|
12292
|
-
(false &&
|
12268
|
+
(false && Ember.assert('You cannot use \'store#pushPayload\' without a modelName unless your default serializer defines \'pushPayload\'', typeof serializer.pushPayload === 'function'));
|
12293
12269
|
} else {
|
12294
12270
|
payload = inputPayload;
|
12295
|
-
(false &&
|
12271
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12296
12272
|
|
12297
12273
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12298
12274
|
serializer = this.serializerFor(normalizedModelName);
|
@@ -12322,8 +12298,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12322
12298
|
@return {Object} The normalized payload
|
12323
12299
|
*/
|
12324
12300
|
normalize: function (modelName, payload) {
|
12325
|
-
(false &&
|
12326
|
-
(false &&
|
12301
|
+
(false && Ember.assert('You need to pass a model name to the store\'s normalize method', isPresent(modelName)));
|
12302
|
+
(false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + inspect(modelName), typeof modelName === 'string'));
|
12327
12303
|
|
12328
12304
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12329
12305
|
var serializer = this.serializerFor(normalizedModelName);
|
@@ -12343,12 +12319,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12343
12319
|
@return {InternalModel} internal model
|
12344
12320
|
*/
|
12345
12321
|
_buildInternalModel: function (modelName, id, data) {
|
12346
|
-
(false &&
|
12322
|
+
(false && Ember.assert('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string'));
|
12347
12323
|
|
12348
12324
|
|
12349
12325
|
var existingInternalModel = this._existingInternalModelForId(modelName, id);
|
12350
12326
|
|
12351
|
-
(false &&
|
12327
|
+
(false && Ember.assert('The id ' + id + ' has already been used with another record for modelClass \'' + modelName + '\'.', !existingInternalModel));
|
12352
12328
|
|
12353
12329
|
// lookupFactory should really return an object that creates
|
12354
12330
|
// instances with the injections applied
|
@@ -12371,7 +12347,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12371
12347
|
return internalModel;
|
12372
12348
|
},
|
12373
12349
|
buildInternalModel: function (modelName, id, data) {
|
12374
|
-
(false && !(false) &&
|
12350
|
+
(false && !(false) && Ember.deprecate('buildInternalModel was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.buildInternalModel', until: '2.17.0' }));
|
12375
12351
|
|
12376
12352
|
return this._buildInternalModel(modelName, id, data);
|
12377
12353
|
},
|
@@ -12421,8 +12397,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12421
12397
|
@return DS.Adapter
|
12422
12398
|
*/
|
12423
12399
|
adapterFor: function (modelName) {
|
12424
|
-
(false &&
|
12425
|
-
(false &&
|
12400
|
+
(false && Ember.assert('You need to pass a model name to the store\'s adapterFor method', isPresent(modelName)));
|
12401
|
+
(false && Ember.assert('Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12426
12402
|
|
12427
12403
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12428
12404
|
|
@@ -12452,15 +12428,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12452
12428
|
@return {DS.Serializer}
|
12453
12429
|
*/
|
12454
12430
|
serializerFor: function (modelName) {
|
12455
|
-
(false &&
|
12456
|
-
(false &&
|
12431
|
+
(false && Ember.assert('You need to pass a model name to the store\'s serializerFor method', isPresent(modelName)));
|
12432
|
+
(false && Ember.assert('Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12457
12433
|
|
12458
12434
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12459
12435
|
|
12460
12436
|
return this._instanceCache.get('serializer', normalizedModelName);
|
12461
12437
|
},
|
12462
12438
|
lookupAdapter: function (name) {
|
12463
|
-
(false && !(false) &&
|
12439
|
+
(false && !(false) && Ember.deprecate('Use of lookupAdapter is deprecated, use adapterFor instead.', false, {
|
12464
12440
|
id: 'ds.store.lookupAdapter',
|
12465
12441
|
until: '3.0'
|
12466
12442
|
}));
|
@@ -12468,7 +12444,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12468
12444
|
return this.adapterFor(name);
|
12469
12445
|
},
|
12470
12446
|
lookupSerializer: function (name) {
|
12471
|
-
(false && !(false) &&
|
12447
|
+
(false && !(false) && Ember.deprecate('Use of lookupSerializer is deprecated, use serializerFor instead.', false, {
|
12472
12448
|
id: 'ds.store.lookupSerializer',
|
12473
12449
|
until: '3.0'
|
12474
12450
|
}));
|
@@ -12524,7 +12500,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12524
12500
|
return;
|
12525
12501
|
}
|
12526
12502
|
|
12527
|
-
(false &&
|
12503
|
+
(false && Ember.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being ' + inspect(resourceIdentifier) + ', but ' + relationship.key + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(resourceIdentifier)));
|
12528
12504
|
|
12529
12505
|
//TODO:Better asserts
|
12530
12506
|
|
@@ -12535,7 +12511,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12535
12511
|
return;
|
12536
12512
|
}
|
12537
12513
|
|
12538
|
-
(false &&
|
12514
|
+
(false && Ember.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being \'' + inspect(resourceIdentifiers) + '\', but ' + relationship.key + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(resourceIdentifiers)));
|
12539
12515
|
|
12540
12516
|
|
12541
12517
|
var _internalModels = new Array(resourceIdentifiers.length);
|
@@ -12557,14 +12533,14 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12557
12533
|
var internalModel = snapshot._internalModel;
|
12558
12534
|
var modelName = snapshot.modelName;
|
12559
12535
|
var modelClass = store._modelFor(modelName);
|
12560
|
-
(false &&
|
12561
|
-
(false &&
|
12536
|
+
(false && Ember.assert('You tried to update a record but you have no adapter (for ' + modelName + ')', adapter));
|
12537
|
+
(false && Ember.assert('You tried to update a record but your adapter (for ' + modelName + ') does not implement \'' + operation + '\'', typeof adapter[operation] === 'function'));
|
12562
12538
|
|
12563
12539
|
var promise = adapter[operation](store, modelClass, snapshot);
|
12564
12540
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12565
12541
|
var label = 'DS: Extract and notify about ' + operation + ' completion of ' + internalModel;
|
12566
12542
|
|
12567
|
-
(false &&
|
12543
|
+
(false && Ember.assert('Your adapter\'s \'' + operation + '\' method must return a value, but it returned \'undefined\'', promise !== undefined));
|
12568
12544
|
|
12569
12545
|
|
12570
12546
|
promise = Promise.resolve(promise, label);
|
@@ -12667,14 +12643,14 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12667
12643
|
|
12668
12644
|
if (_relationshipData.links) {
|
12669
12645
|
var isAsync = relationshipMeta.options && relationshipMeta.options.async !== false;
|
12670
|
-
(false &&
|
12646
|
+
(false && Ember.warn('You pushed a record of type \'' + internalModel.type.modelName + '\' with a relationship \'' + relationshipName + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', isAsync || _relationshipData.data, {
|
12671
12647
|
id: 'ds.store.push-link-for-sync-relationship'
|
12672
12648
|
}));
|
12673
12649
|
} else if (_relationshipData.data) {
|
12674
12650
|
if (relationshipMeta.kind === 'belongsTo') {
|
12675
|
-
(false &&
|
12651
|
+
(false && Ember.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being ' + inspect(_relationshipData.data) + ', but ' + relationshipName + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(_relationshipData.data)));
|
12676
12652
|
} else if (relationshipMeta.kind === 'hasMany') {
|
12677
|
-
(false &&
|
12653
|
+
(false && Ember.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being \'' + inspect(_relationshipData.data) + '\', but ' + relationshipName + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(_relationshipData.data)));
|
12678
12654
|
}
|
12679
12655
|
}
|
12680
12656
|
}
|
@@ -12684,14 +12660,14 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12684
12660
|
exports.Store = Store;
|
12685
12661
|
exports.default = Store;
|
12686
12662
|
});
|
12687
|
-
define('ember-data/-private/system/store/common', ['exports'
|
12663
|
+
define('ember-data/-private/system/store/common', ['exports'], function (exports) {
|
12688
12664
|
'use strict';
|
12689
12665
|
|
12690
12666
|
exports.__esModule = true;
|
12691
12667
|
exports._bind = _bind;
|
12692
12668
|
exports._guard = _guard;
|
12693
12669
|
exports._objectIsAlive = _objectIsAlive;
|
12694
|
-
var get =
|
12670
|
+
var get = Ember.get;
|
12695
12671
|
function _bind(fn) {
|
12696
12672
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12697
12673
|
args[_key - 1] = arguments[_key];
|
@@ -12716,7 +12692,7 @@ define('ember-data/-private/system/store/common', ['exports', 'ember'], function
|
|
12716
12692
|
return !(get(object, "isDestroyed") || get(object, "isDestroying"));
|
12717
12693
|
}
|
12718
12694
|
});
|
12719
|
-
define('ember-data/-private/system/store/container-instance-cache', ['exports'
|
12695
|
+
define('ember-data/-private/system/store/container-instance-cache', ['exports'], function (exports) {
|
12720
12696
|
'use strict';
|
12721
12697
|
|
12722
12698
|
exports.__esModule = true;
|
@@ -12727,7 +12703,7 @@ define('ember-data/-private/system/store/container-instance-cache', ['exports',
|
|
12727
12703
|
}
|
12728
12704
|
}
|
12729
12705
|
|
12730
|
-
var set =
|
12706
|
+
var set = Ember.set;
|
12731
12707
|
|
12732
12708
|
var ContainerInstanceCache = function () {
|
12733
12709
|
function ContainerInstanceCache(owner, store) {
|
@@ -12822,7 +12798,7 @@ define('ember-data/-private/system/store/container-instance-cache', ['exports',
|
|
12822
12798
|
|
12823
12799
|
exports.default = ContainerInstanceCache;
|
12824
12800
|
});
|
12825
|
-
define('ember-data/-private/system/store/finders', ['exports', 'ember
|
12801
|
+
define('ember-data/-private/system/store/finders', ['exports', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers'], function (exports, _common, _serializerResponse, _serializers) {
|
12826
12802
|
'use strict';
|
12827
12803
|
|
12828
12804
|
exports.__esModule = true;
|
@@ -12833,7 +12809,8 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12833
12809
|
exports._findAll = _findAll;
|
12834
12810
|
exports._query = _query;
|
12835
12811
|
exports._queryRecord = _queryRecord;
|
12836
|
-
var
|
12812
|
+
var A = Ember.A;
|
12813
|
+
var Promise = Ember.RSVP.Promise;
|
12837
12814
|
|
12838
12815
|
|
12839
12816
|
function payloadIsNotBlank(adapterPayload) {
|
@@ -12855,12 +12832,12 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12855
12832
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12856
12833
|
|
12857
12834
|
return promise.then(function (adapterPayload) {
|
12858
|
-
(false &&
|
12835
|
+
(false && Ember.assert('You made a \'findRecord\' request for a \'' + modelName + '\' with id \'' + id + '\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12859
12836
|
|
12860
12837
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12861
12838
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, id, 'findRecord');
|
12862
|
-
(false &&
|
12863
|
-
(false &&
|
12839
|
+
(false && Ember.assert('Ember Data expected the primary data returned from a \'findRecord\' response to be an object but instead it found an array.', !Array.isArray(payload.data)));
|
12840
|
+
(false && Ember.warn('You requested a record of type \'' + modelName + '\' with id \'' + id + '\' but the adapter returned a payload with primary data having an id of \'' + payload.data.id + '\'. Use \'store.findRecord()\' when the requested id is the same as the one returned by the adapter. In other cases use \'store.queryRecord()\' instead https://emberjs.com/api/data/classes/DS.Store.html#method_queryRecord', payload.data.id === id, {
|
12864
12841
|
id: 'ds.store.findRecord.id-mismatch'
|
12865
12842
|
}));
|
12866
12843
|
|
@@ -12877,7 +12854,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12877
12854
|
}
|
12878
12855
|
|
12879
12856
|
function _findMany(adapter, store, modelName, ids, internalModels) {
|
12880
|
-
var snapshots =
|
12857
|
+
var snapshots = A(internalModels).invoke('createSnapshot');
|
12881
12858
|
var modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still
|
12882
12859
|
var promise = adapter.findMany(store, modelClass, ids, snapshots);
|
12883
12860
|
var label = 'DS: Handle Adapter#findMany of \'' + modelName + '\'';
|
@@ -12890,7 +12867,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12890
12867
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12891
12868
|
|
12892
12869
|
return promise.then(function (adapterPayload) {
|
12893
|
-
(false &&
|
12870
|
+
(false && Ember.assert('You made a \'findMany\' request for \'' + modelName + '\' records with ids \'[' + ids + ']\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12894
12871
|
|
12895
12872
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12896
12873
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findMany');
|
@@ -12909,7 +12886,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12909
12886
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, internalModel));
|
12910
12887
|
|
12911
12888
|
return promise.then(function (adapterPayload) {
|
12912
|
-
(false &&
|
12889
|
+
(false && Ember.assert('You made a \'findHasMany\' request for a ' + internalModel.modelName + '\'s \'' + relationship.key + '\' relationship, using link \'' + link + '\' , but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12913
12890
|
|
12914
12891
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, relationship.type);
|
12915
12892
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findHasMany');
|
@@ -12953,7 +12930,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12953
12930
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12954
12931
|
|
12955
12932
|
return promise.then(function (adapterPayload) {
|
12956
|
-
(false &&
|
12933
|
+
(false && Ember.assert('You made a \'findAll\' request for \'' + modelName + '\' records, but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12957
12934
|
|
12958
12935
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12959
12936
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findAll');
|
@@ -12988,7 +12965,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12988
12965
|
|
12989
12966
|
var internalModels = store._push(payload);
|
12990
12967
|
|
12991
|
-
(false &&
|
12968
|
+
(false && Ember.assert('The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.', Array.isArray(internalModels)));
|
12992
12969
|
|
12993
12970
|
if (recordArray) {
|
12994
12971
|
recordArray._setInternalModels(internalModels, payload);
|
@@ -13012,7 +12989,7 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
13012
12989
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
13013
12990
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'queryRecord');
|
13014
12991
|
|
13015
|
-
(false &&
|
12992
|
+
(false && Ember.assert('Expected the primary data returned by the serializer for a \'queryRecord\' response to be a single object or null but instead it was an array.', !Array.isArray(payload.data), {
|
13016
12993
|
id: 'ds.store.queryRecord-array-response'
|
13017
12994
|
}));
|
13018
12995
|
|
@@ -13021,12 +12998,13 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
13021
12998
|
}, null, 'DS: Extract payload of queryRecord ' + modelName);
|
13022
12999
|
}
|
13023
13000
|
});
|
13024
|
-
define('ember-data/-private/system/store/serializer-response', ['exports'
|
13001
|
+
define('ember-data/-private/system/store/serializer-response', ['exports'], function (exports) {
|
13025
13002
|
'use strict';
|
13026
13003
|
|
13027
13004
|
exports.__esModule = true;
|
13028
13005
|
exports.validateDocumentStructure = validateDocumentStructure;
|
13029
13006
|
exports.normalizeResponseHelper = normalizeResponseHelper;
|
13007
|
+
var isEmpty = Ember.isEmpty;
|
13030
13008
|
|
13031
13009
|
|
13032
13010
|
/*
|
@@ -13104,7 +13082,7 @@ define('ember-data/-private/system/store/serializer-response', ['exports', 'embe
|
|
13104
13082
|
if (false) {
|
13105
13083
|
validationErrors = validateDocumentStructure(normalizedResponse);
|
13106
13084
|
}
|
13107
|
-
(false &&
|
13085
|
+
(false && Ember.assert('normalizeResponse must return a valid JSON API document:\n\t* ' + validationErrors.join('\n\t* '), isEmpty(validationErrors)));
|
13108
13086
|
|
13109
13087
|
|
13110
13088
|
return normalizedResponse;
|
@@ -13133,15 +13111,14 @@ define("ember-data/-private/system/store/serializers", ["exports"], function (ex
|
|
13133
13111
|
return serializer;
|
13134
13112
|
}
|
13135
13113
|
});
|
13136
|
-
define('ember-data/-private/utils', ['exports'
|
13114
|
+
define('ember-data/-private/utils', ['exports'], function (exports) {
|
13137
13115
|
'use strict';
|
13138
13116
|
|
13139
13117
|
exports.__esModule = true;
|
13140
|
-
|
13118
|
+
var emberGetOwner = Ember.getOwner;
|
13119
|
+
var get = Ember.get;
|
13141
13120
|
|
13142
13121
|
|
13143
|
-
var get = _ember.default.get;
|
13144
|
-
|
13145
13122
|
/*
|
13146
13123
|
Check if the passed model has a `type` attribute or a relationship named `type`.
|
13147
13124
|
|
@@ -13160,8 +13137,8 @@ define('ember-data/-private/utils', ['exports', 'ember'], function (exports, _em
|
|
13160
13137
|
function getOwner(context) {
|
13161
13138
|
var owner = void 0;
|
13162
13139
|
|
13163
|
-
if (
|
13164
|
-
owner =
|
13140
|
+
if (emberGetOwner) {
|
13141
|
+
owner = emberGetOwner(context);
|
13165
13142
|
} else if (context.container) {
|
13166
13143
|
owner = context.container;
|
13167
13144
|
}
|
@@ -13229,11 +13206,12 @@ define('ember-data/-private/utils/parse-response-headers', ['exports'], function
|
|
13229
13206
|
return headers;
|
13230
13207
|
}
|
13231
13208
|
});
|
13232
|
-
define('ember-data/adapter', ['exports'
|
13209
|
+
define('ember-data/adapter', ['exports'], function (exports) {
|
13233
13210
|
'use strict';
|
13234
13211
|
|
13235
13212
|
exports.__esModule = true;
|
13236
|
-
|
13213
|
+
var EmberObject = Ember.Object;
|
13214
|
+
exports.default = EmberObject.extend({
|
13237
13215
|
|
13238
13216
|
/**
|
13239
13217
|
If you would like your adapter to use a custom serializer you can
|
@@ -13261,12 +13239,13 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13261
13239
|
normalized by the serializer.
|
13262
13240
|
Here is an example `findRecord` implementation:
|
13263
13241
|
```app/adapters/application.js
|
13264
|
-
import Ember from 'ember';
|
13265
13242
|
import DS from 'ember-data';
|
13243
|
+
import RSVP from 'RSVP';
|
13244
|
+
import $ from 'jquery';
|
13266
13245
|
export default DS.Adapter.extend({
|
13267
13246
|
findRecord(store, type, id, snapshot) {
|
13268
|
-
return new
|
13269
|
-
|
13247
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13248
|
+
$.getJSON(`/${type.modelName}/${id}`).then(function(data) {
|
13270
13249
|
resolve(data);
|
13271
13250
|
}, function(jqXHR) {
|
13272
13251
|
reject(jqXHR);
|
@@ -13288,13 +13267,14 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13288
13267
|
The `findAll()` method is used to retrieve all records for a given type.
|
13289
13268
|
Example
|
13290
13269
|
```app/adapters/application.js
|
13291
|
-
import Ember from 'ember';
|
13292
13270
|
import DS from 'ember-data';
|
13271
|
+
import RSVP from 'RSVP';
|
13272
|
+
import $ from 'jquery';
|
13293
13273
|
export default DS.Adapter.extend({
|
13294
13274
|
findAll(store, type, sinceToken) {
|
13295
13275
|
let query = { since: sinceToken };
|
13296
|
-
return new
|
13297
|
-
|
13276
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13277
|
+
$.getJSON(`/${type.modelName}`, query).then(function(data) {
|
13298
13278
|
resolve(data);
|
13299
13279
|
}, function(jqXHR) {
|
13300
13280
|
reject(jqXHR);
|
@@ -13316,12 +13296,13 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13316
13296
|
This method is called when you call `query` on the store.
|
13317
13297
|
Example
|
13318
13298
|
```app/adapters/application.js
|
13319
|
-
import Ember from 'ember';
|
13320
13299
|
import DS from 'ember-data';
|
13300
|
+
import RSVP from 'RSVP';
|
13301
|
+
import $ from 'jquery';
|
13321
13302
|
export default DS.Adapter.extend({
|
13322
13303
|
query(store, type, query) {
|
13323
|
-
return new
|
13324
|
-
|
13304
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13305
|
+
$.getJSON(`/${type.modelName}`, query).then(function(data) {
|
13325
13306
|
resolve(data);
|
13326
13307
|
}, function(jqXHR) {
|
13327
13308
|
reject(jqXHR);
|
@@ -13348,12 +13329,13 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13348
13329
|
Here is an example `queryRecord` implementation:
|
13349
13330
|
Example
|
13350
13331
|
```app/adapters/application.js
|
13351
|
-
import Ember from 'ember';
|
13352
13332
|
import DS from 'ember-data';
|
13333
|
+
import RSVP from 'RSVP';
|
13334
|
+
import $ from 'jquery';
|
13353
13335
|
export default DS.Adapter.extend(DS.BuildURLMixin, {
|
13354
13336
|
queryRecord(store, type, query) {
|
13355
|
-
return new
|
13356
|
-
|
13337
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13338
|
+
$.getJSON(`/${type.modelName}`, query).then(function(data) {
|
13357
13339
|
resolve(data);
|
13358
13340
|
}, function(jqXHR) {
|
13359
13341
|
reject(jqXHR);
|
@@ -13428,22 +13410,24 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13428
13410
|
Serializes the record and sends it to the server.
|
13429
13411
|
Example
|
13430
13412
|
```app/adapters/application.js
|
13431
|
-
import Ember from 'ember';
|
13432
13413
|
import DS from 'ember-data';
|
13414
|
+
import { run } from '@ember/runloop';
|
13415
|
+
import RSVP from 'RSVP';
|
13416
|
+
import $ from 'jquery';
|
13433
13417
|
export default DS.Adapter.extend({
|
13434
13418
|
createRecord(store, type, snapshot) {
|
13435
13419
|
let data = this.serialize(snapshot, { includeId: true });
|
13436
|
-
return new
|
13437
|
-
|
13420
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13421
|
+
$.ajax({
|
13438
13422
|
type: 'POST',
|
13439
13423
|
url: `/${type.modelName}`,
|
13440
13424
|
dataType: 'json',
|
13441
13425
|
data: data
|
13442
13426
|
}).then(function(data) {
|
13443
|
-
|
13427
|
+
run(null, resolve, data);
|
13444
13428
|
}, function(jqXHR) {
|
13445
13429
|
jqXHR.then = null; // tame jQuery's ill mannered promises
|
13446
|
-
|
13430
|
+
run(null, reject, jqXHR);
|
13447
13431
|
});
|
13448
13432
|
});
|
13449
13433
|
}
|
@@ -13470,23 +13454,25 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13470
13454
|
applied on the backend.
|
13471
13455
|
Example
|
13472
13456
|
```app/adapters/application.js
|
13473
|
-
import Ember from 'ember';
|
13474
13457
|
import DS from 'ember-data';
|
13458
|
+
import { run } from '@ember/runloop';
|
13459
|
+
import RSVP from 'RSVP';
|
13460
|
+
import $ from 'jquery';
|
13475
13461
|
export default DS.Adapter.extend({
|
13476
13462
|
updateRecord(store, type, snapshot) {
|
13477
13463
|
let data = this.serialize(snapshot, { includeId: true });
|
13478
13464
|
let id = snapshot.id;
|
13479
|
-
return new
|
13480
|
-
|
13465
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13466
|
+
$.ajax({
|
13481
13467
|
type: 'PUT',
|
13482
13468
|
url: `/${type.modelName}/${id}`,
|
13483
13469
|
dataType: 'json',
|
13484
13470
|
data: data
|
13485
13471
|
}).then(function(data) {
|
13486
|
-
|
13472
|
+
run(null, resolve, data);
|
13487
13473
|
}, function(jqXHR) {
|
13488
13474
|
jqXHR.then = null; // tame jQuery's ill mannered promises
|
13489
|
-
|
13475
|
+
run(null, reject, jqXHR);
|
13490
13476
|
});
|
13491
13477
|
});
|
13492
13478
|
}
|
@@ -13506,23 +13492,25 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13506
13492
|
Sends a delete request for the record to the server.
|
13507
13493
|
Example
|
13508
13494
|
```app/adapters/application.js
|
13509
|
-
import Ember from 'ember';
|
13510
13495
|
import DS from 'ember-data';
|
13496
|
+
import { run } from '@ember/runloop';
|
13497
|
+
import RSVP from 'RSVP';
|
13498
|
+
import $ from 'jquery';
|
13511
13499
|
export default DS.Adapter.extend({
|
13512
13500
|
deleteRecord(store, type, snapshot) {
|
13513
13501
|
let data = this.serialize(snapshot, { includeId: true });
|
13514
13502
|
let id = snapshot.id;
|
13515
|
-
return new
|
13516
|
-
|
13503
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13504
|
+
$.ajax({
|
13517
13505
|
type: 'DELETE',
|
13518
13506
|
url: `/${type.modelName}/${id}`,
|
13519
13507
|
dataType: 'json',
|
13520
13508
|
data: data
|
13521
13509
|
}).then(function(data) {
|
13522
|
-
|
13510
|
+
run(null, resolve, data);
|
13523
13511
|
}, function(jqXHR) {
|
13524
13512
|
jqXHR.then = null; // tame jQuery's ill mannered promises
|
13525
|
-
|
13513
|
+
run(null, reject, jqXHR);
|
13526
13514
|
});
|
13527
13515
|
});
|
13528
13516
|
}
|
@@ -13551,21 +13539,23 @@ define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
|
13551
13539
|
requests to find multiple records at once if coalesceFindRequests
|
13552
13540
|
is true.
|
13553
13541
|
```app/adapters/application.js
|
13554
|
-
import Ember from 'ember';
|
13555
13542
|
import DS from 'ember-data';
|
13543
|
+
import { run } from '@ember/runloop';
|
13544
|
+
import RSVP from 'RSVP';
|
13545
|
+
import $ from 'jquery';
|
13556
13546
|
export default DS.Adapter.extend({
|
13557
13547
|
findMany(store, type, ids, snapshots) {
|
13558
|
-
return new
|
13559
|
-
|
13548
|
+
return new RSVP.Promise(function(resolve, reject) {
|
13549
|
+
$.ajax({
|
13560
13550
|
type: 'GET',
|
13561
13551
|
url: `/${type.modelName}/`,
|
13562
13552
|
dataType: 'json',
|
13563
13553
|
data: { filter: { id: ids.join(',') } }
|
13564
13554
|
}).then(function(data) {
|
13565
|
-
|
13555
|
+
run(null, resolve, data);
|
13566
13556
|
}, function(jqXHR) {
|
13567
13557
|
jqXHR.then = null; // tame jQuery's ill mannered promises
|
13568
|
-
|
13558
|
+
run(null, reject, jqXHR);
|
13569
13559
|
});
|
13570
13560
|
});
|
13571
13561
|
}
|
@@ -13826,10 +13816,12 @@ define('ember-data/adapters/errors', ['exports', 'ember-data/-private'], functio
|
|
13826
13816
|
}
|
13827
13817
|
});
|
13828
13818
|
});
|
13829
|
-
define('ember-data/adapters/json-api', ['exports', 'ember
|
13819
|
+
define('ember-data/adapters/json-api', ['exports', 'ember-data/adapters/rest', 'ember-data/-private', 'ember-inflector'], function (exports, _rest, _private, _emberInflector) {
|
13830
13820
|
'use strict';
|
13831
13821
|
|
13832
13822
|
exports.__esModule = true;
|
13823
|
+
var dasherize = Ember.String.dasherize;
|
13824
|
+
var $ = Ember.$;
|
13833
13825
|
|
13834
13826
|
|
13835
13827
|
/**
|
@@ -13968,11 +13960,6 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
13968
13960
|
@namespace DS
|
13969
13961
|
@extends DS.RESTAdapter
|
13970
13962
|
*/
|
13971
|
-
/* global heimdall */
|
13972
|
-
/**
|
13973
|
-
@module ember-data
|
13974
|
-
*/
|
13975
|
-
|
13976
13963
|
var JSONAPIAdapter = _rest.default.extend({
|
13977
13964
|
defaultSerializer: '-json-api',
|
13978
13965
|
|
@@ -14050,7 +14037,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14050
14037
|
}
|
14051
14038
|
},
|
14052
14039
|
pathForType: function (modelName) {
|
14053
|
-
var dasherized =
|
14040
|
+
var dasherized = dasherize(modelName);
|
14054
14041
|
return (0, _emberInflector.pluralize)(dasherized);
|
14055
14042
|
},
|
14056
14043
|
updateRecord: function (store, type, snapshot) {
|
@@ -14069,7 +14056,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14069
14056
|
},
|
14070
14057
|
_hasCustomizedAjax: function () {
|
14071
14058
|
if (this.ajax !== JSONAPIAdapter.prototype.ajax) {
|
14072
|
-
(false && !(false) &&
|
14059
|
+
(false && !(false) && Ember.deprecate('JSONAPIAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14073
14060
|
id: 'ds.json-api-adapter.ajax',
|
14074
14061
|
until: '3.0.0'
|
14075
14062
|
}));
|
@@ -14078,7 +14065,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14078
14065
|
}
|
14079
14066
|
|
14080
14067
|
if (this.ajaxOptions !== JSONAPIAdapter.prototype.ajaxOptions) {
|
14081
|
-
(false && !(false) &&
|
14068
|
+
(false && !(false) && Ember.deprecate('JSONAPIAdapterr#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14082
14069
|
id: 'ds.json-api-adapter.ajax-options',
|
14083
14070
|
until: '3.0.0'
|
14084
14071
|
}));
|
@@ -14147,16 +14134,18 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14147
14134
|
|
14148
14135
|
exports.default = JSONAPIAdapter;
|
14149
14136
|
});
|
14150
|
-
define('ember-data/adapters/rest', ['exports', 'ember
|
14137
|
+
define('ember-data/adapters/rest', ['exports', 'ember-data/adapter', 'ember-data/-private'], function (exports, _adapter, _private) {
|
14151
14138
|
'use strict';
|
14152
14139
|
|
14153
14140
|
exports.__esModule = true;
|
14154
|
-
var
|
14155
|
-
|
14156
|
-
|
14141
|
+
var $ = Ember.$;
|
14142
|
+
var EmberPromise = Ember.RSVP.Promise;
|
14143
|
+
var MapWithDefault = Ember.MapWithDefault;
|
14144
|
+
var get = Ember.get;
|
14145
|
+
var run = Ember.run;
|
14157
14146
|
|
14158
14147
|
|
14159
|
-
var Promise =
|
14148
|
+
var Promise = EmberPromise;
|
14160
14149
|
|
14161
14150
|
/**
|
14162
14151
|
The REST adapter allows your store to communicate with an HTTP server by
|
@@ -14376,9 +14365,10 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14376
14365
|
|
14377
14366
|
```app/adapters/application.js
|
14378
14367
|
import DS from 'ember-data';
|
14368
|
+
import { computed } from '@ember/object';
|
14379
14369
|
|
14380
14370
|
export default DS.RESTAdapter.extend({
|
14381
|
-
headers:
|
14371
|
+
headers: computed('session.authToken', function() {
|
14382
14372
|
return {
|
14383
14373
|
'API_KEY': this.get('session.authToken'),
|
14384
14374
|
'ANOTHER_HEADER': 'Some header value'
|
@@ -14396,11 +14386,13 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14396
14386
|
|
14397
14387
|
```app/adapters/application.js
|
14398
14388
|
import DS from 'ember-data';
|
14389
|
+
import { get } from '@ember/object';
|
14390
|
+
import { computed } from '@ember/object';
|
14399
14391
|
|
14400
14392
|
export default DS.RESTAdapter.extend({
|
14401
|
-
headers:
|
14393
|
+
headers: computed(function() {
|
14402
14394
|
return {
|
14403
|
-
'API_KEY':
|
14395
|
+
'API_KEY': get(document.cookie.match(/apiKey\=([^;]*)/), '1'),
|
14404
14396
|
'ANOTHER_HEADER': 'Some header value'
|
14405
14397
|
};
|
14406
14398
|
}).volatile()
|
@@ -14774,7 +14766,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14774
14766
|
}, 'DS: RESTAdapter#ajax ' + type + ' to ' + url);
|
14775
14767
|
},
|
14776
14768
|
_ajaxRequest: function (options) {
|
14777
|
-
|
14769
|
+
$.ajax(options);
|
14778
14770
|
},
|
14779
14771
|
ajaxOptions: function (url, type, options) {
|
14780
14772
|
var hash = options || {};
|
@@ -14803,7 +14795,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14803
14795
|
var json = responseText;
|
14804
14796
|
|
14805
14797
|
try {
|
14806
|
-
json =
|
14798
|
+
json = $.parseJSON(responseText);
|
14807
14799
|
} catch (e) {
|
14808
14800
|
// ignored
|
14809
14801
|
}
|
@@ -14866,7 +14858,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14866
14858
|
},
|
14867
14859
|
_hasCustomizedAjax: function () {
|
14868
14860
|
if (this.ajax !== RESTAdapter.prototype.ajax) {
|
14869
|
-
(false && !(false) &&
|
14861
|
+
(false && !(false) && Ember.deprecate('RESTAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14870
14862
|
id: 'ds.rest-adapter.ajax',
|
14871
14863
|
until: '3.0.0'
|
14872
14864
|
}));
|
@@ -14875,7 +14867,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14875
14867
|
}
|
14876
14868
|
|
14877
14869
|
if (this.ajaxOptions !== RESTAdapter.prototype.ajaxOptions) {
|
14878
|
-
(false && !(false) &&
|
14870
|
+
(false && !(false) && Ember.deprecate('RESTAdapter#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14879
14871
|
id: 'ds.rest-adapter.ajax-options',
|
14880
14872
|
until: '3.0.0'
|
14881
14873
|
}));
|
@@ -15084,7 +15076,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
15084
15076
|
if (false) {
|
15085
15077
|
var message = 'The server returned an empty string for ' + requestData.method + ' ' + requestData.url + ', which cannot be parsed into a valid JSON. Return either null or {}.';
|
15086
15078
|
var validJSONString = !(responseData.textStatus === "parsererror" && jqXHR.responseText === "");
|
15087
|
-
(false &&
|
15079
|
+
(false && Ember.warn(message, validJSONString, {
|
15088
15080
|
id: 'ds.adapter.returned-empty-string-as-JSON'
|
15089
15081
|
}));
|
15090
15082
|
}
|
@@ -15119,11 +15111,12 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
15119
15111
|
|
15120
15112
|
exports.default = RESTAdapter;
|
15121
15113
|
});
|
15122
|
-
define('ember-data/attr', ['exports'
|
15114
|
+
define('ember-data/attr', ['exports'], function (exports) {
|
15123
15115
|
'use strict';
|
15124
15116
|
|
15125
15117
|
exports.__esModule = true;
|
15126
15118
|
exports.default = attr;
|
15119
|
+
var computed = Ember.computed;
|
15127
15120
|
|
15128
15121
|
|
15129
15122
|
/**
|
@@ -15135,7 +15128,7 @@ define('ember-data/attr', ['exports', 'ember'], function (exports, _ember) {
|
|
15135
15128
|
return options.defaultValue.apply(null, arguments);
|
15136
15129
|
} else {
|
15137
15130
|
var defaultValue = options.defaultValue;
|
15138
|
-
(false && !(typeof defaultValue !== 'object' || defaultValue === null) &&
|
15131
|
+
(false && !(typeof defaultValue !== 'object' || defaultValue === null) && Ember.deprecate('Non primitive defaultValues are deprecated because they are shared between all instances. If you would like to use a complex object as a default value please provide a function that returns the complex object.', typeof defaultValue !== 'object' || defaultValue === null, {
|
15139
15132
|
id: 'ds.defaultValue.complex-object',
|
15140
15133
|
until: '3.0.0'
|
15141
15134
|
}));
|
@@ -15257,7 +15250,7 @@ define('ember-data/attr', ['exports', 'ember'], function (exports, _ember) {
|
|
15257
15250
|
options: options
|
15258
15251
|
};
|
15259
15252
|
|
15260
|
-
return
|
15253
|
+
return computed({
|
15261
15254
|
get: function (key) {
|
15262
15255
|
var internalModel = this._internalModel;
|
15263
15256
|
if (hasValue(internalModel, key)) {
|
@@ -15295,10 +15288,11 @@ define('ember-data/attr', ['exports', 'ember'], function (exports, _ember) {
|
|
15295
15288
|
}).meta(meta);
|
15296
15289
|
}
|
15297
15290
|
});
|
15298
|
-
define(
|
15299
|
-
|
15291
|
+
define('ember-data', ['exports', 'ember-data/-private', 'ember-data/setup-container', 'ember-data/instance-initializers/initialize-store-service', 'ember-data/transforms/transform', 'ember-data/transforms/number', 'ember-data/transforms/date', 'ember-data/transforms/string', 'ember-data/transforms/boolean', 'ember-data/adapter', 'ember-data/adapters/json-api', 'ember-data/adapters/rest', 'ember-data/serializer', 'ember-data/serializers/json-api', 'ember-data/serializers/json', 'ember-data/serializers/rest', 'ember-data/serializers/embedded-records-mixin', 'ember-data/attr', 'ember-inflector'], function (exports, _private, _setupContainer, _initializeStoreService, _transform, _number, _date, _string, _boolean, _adapter, _jsonApi, _rest, _serializer, _jsonApi2, _json, _rest2, _embeddedRecordsMixin, _attr) {
|
15292
|
+
'use strict';
|
15300
15293
|
|
15301
15294
|
exports.__esModule = true;
|
15295
|
+
var EmberError = Ember.Error;
|
15302
15296
|
|
15303
15297
|
|
15304
15298
|
/**
|
@@ -15307,8 +15301,8 @@ define("ember-data", ["exports", "ember", "ember-data/-private", "ember-data/set
|
|
15307
15301
|
@main ember-data
|
15308
15302
|
*/
|
15309
15303
|
|
15310
|
-
if (
|
15311
|
-
throw new
|
15304
|
+
if (Ember.VERSION.match(/^1\.([0-9]|1[0-2])\./)) {
|
15305
|
+
throw new EmberError("Ember Data requires at least Ember 1.13.0, but you have " + Ember.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data.");
|
15312
15306
|
}
|
15313
15307
|
|
15314
15308
|
_private.DS.Store = _private.Store;
|
@@ -15387,7 +15381,7 @@ define("ember-data", ["exports", "ember", "ember-data/-private", "ember-data/set
|
|
15387
15381
|
Object.defineProperty(_private.global, 'DS', {
|
15388
15382
|
configurable: true,
|
15389
15383
|
get: function () {
|
15390
|
-
(false && !(false) &&
|
15384
|
+
(false && !(false) && Ember.deprecate('Using the global version of DS is deprecated. Please either import ' + 'the specific modules needed or `import DS from \'ember-data\';`.', false, { id: 'ember-data.global-ds', until: '3.0.0' }));
|
15391
15385
|
|
15392
15386
|
|
15393
15387
|
return _private.DS;
|
@@ -15550,11 +15544,12 @@ define('ember-data/relationships', ['exports', 'ember-data/-private'], function
|
|
15550
15544
|
}
|
15551
15545
|
});
|
15552
15546
|
});
|
15553
|
-
define('ember-data/serializer', ['exports'
|
15547
|
+
define('ember-data/serializer', ['exports'], function (exports) {
|
15554
15548
|
'use strict';
|
15555
15549
|
|
15556
15550
|
exports.__esModule = true;
|
15557
|
-
|
15551
|
+
var EmberObject = Ember.Object;
|
15552
|
+
exports.default = EmberObject.extend({
|
15558
15553
|
|
15559
15554
|
/**
|
15560
15555
|
The `store` property is the application's `store` that contains
|
@@ -15669,7 +15664,7 @@ define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember)
|
|
15669
15664
|
}
|
15670
15665
|
});
|
15671
15666
|
});
|
15672
|
-
define('ember-data/serializers/embedded-records-mixin', ['exports'
|
15667
|
+
define('ember-data/serializers/embedded-records-mixin', ['exports'], function (exports) {
|
15673
15668
|
'use strict';
|
15674
15669
|
|
15675
15670
|
exports.__esModule = true;
|
@@ -15686,10 +15681,13 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], fu
|
|
15686
15681
|
}
|
15687
15682
|
}
|
15688
15683
|
|
15689
|
-
var
|
15690
|
-
|
15691
|
-
var
|
15692
|
-
|
15684
|
+
var typeOf = Ember.typeOf;
|
15685
|
+
var A = Ember.A;
|
15686
|
+
var Mixin = Ember.Mixin;
|
15687
|
+
var camelize = Ember.String.camelize;
|
15688
|
+
var set = Ember.set;
|
15689
|
+
var get = Ember.get;
|
15690
|
+
exports.default = Mixin.create({
|
15693
15691
|
|
15694
15692
|
/**
|
15695
15693
|
Normalize the record and recursively normalize/extract all the embedded records
|
@@ -15964,7 +15962,7 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], fu
|
|
15964
15962
|
var serializedKey = this.keyForAttribute(relationship.key, 'serialize');
|
15965
15963
|
var hasMany = snapshot.hasMany(relationship.key);
|
15966
15964
|
|
15967
|
-
json[serializedKey] =
|
15965
|
+
json[serializedKey] = A(hasMany).map(function (recordSnapshot) {
|
15968
15966
|
//
|
15969
15967
|
// I'm sure I'm being utterly naive here. Propably id is a configurate property and
|
15970
15968
|
// type too, and the modelName has to be normalized somehow.
|
@@ -15978,7 +15976,7 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], fu
|
|
15978
15976
|
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
|
15979
15977
|
}
|
15980
15978
|
|
15981
|
-
(false &&
|
15979
|
+
(false && Ember.warn('The embedded relationship \'' + serializedKey + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', typeOf(snapshot.hasMany(relationship.key)) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' }));
|
15982
15980
|
|
15983
15981
|
|
15984
15982
|
json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
|
@@ -15990,7 +15988,7 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], fu
|
|
15990
15988
|
*/
|
15991
15989
|
_generateSerializedHasMany: function (snapshot, relationship) {
|
15992
15990
|
var hasMany = snapshot.hasMany(relationship.key);
|
15993
|
-
var manyArray =
|
15991
|
+
var manyArray = A(hasMany);
|
15994
15992
|
var ret = new Array(manyArray.length);
|
15995
15993
|
|
15996
15994
|
for (var i = 0; i < manyArray.length; i++) {
|
@@ -16188,15 +16186,14 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], fu
|
|
16188
16186
|
isEmbeddedRecordsMixin: true
|
16189
16187
|
});
|
16190
16188
|
});
|
16191
|
-
define('ember-data/serializers/json-api', ['exports', 'ember
|
16189
|
+
define('ember-data/serializers/json-api', ['exports', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _emberInflector, _json, _private) {
|
16192
16190
|
'use strict';
|
16193
16191
|
|
16194
16192
|
exports.__esModule = true;
|
16195
|
-
|
16196
|
-
|
16197
|
-
|
16193
|
+
var typeOf = Ember.typeOf;
|
16194
|
+
var isNone = Ember.isNone;
|
16195
|
+
var dasherize = Ember.String.dasherize;
|
16198
16196
|
|
16199
|
-
var dasherize = _ember.default.String.dasherize;
|
16200
16197
|
|
16201
16198
|
/**
|
16202
16199
|
Ember Data 2.0 Serializer:
|
@@ -16317,7 +16314,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16317
16314
|
var JSONAPISerializer = _json.default.extend({
|
16318
16315
|
_normalizeDocumentHelper: function (documentHash) {
|
16319
16316
|
|
16320
|
-
if (
|
16317
|
+
if (typeOf(documentHash.data) === 'object') {
|
16321
16318
|
documentHash.data = this._normalizeResourceHelper(documentHash.data);
|
16322
16319
|
} else if (Array.isArray(documentHash.data)) {
|
16323
16320
|
var ret = new Array(documentHash.data.length);
|
@@ -16352,7 +16349,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16352
16349
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipDataHash.type);
|
16353
16350
|
|
16354
16351
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16355
|
-
(false && !(false) &&
|
16352
|
+
(false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16356
16353
|
id: 'ds.json-api-serializer.deprecated-model-name-for-relationship',
|
16357
16354
|
until: '3.0.0'
|
16358
16355
|
}));
|
@@ -16369,7 +16366,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16369
16366
|
return relationshipDataHash;
|
16370
16367
|
},
|
16371
16368
|
_normalizeResourceHelper: function (resourceHash) {
|
16372
|
-
(false &&
|
16369
|
+
(false && Ember.assert(this.warnMessageForUndefinedType(), !isNone(resourceHash.type), {
|
16373
16370
|
id: 'ds.serializer.type-is-undefined'
|
16374
16371
|
}));
|
16375
16372
|
|
@@ -16384,7 +16381,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16384
16381
|
usedLookup = 'modelNameFromPayloadType';
|
16385
16382
|
|
16386
16383
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16387
|
-
(false && !(false) &&
|
16384
|
+
(false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a resource. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16388
16385
|
id: 'ds.json-api-serializer.deprecated-model-name-for-resource',
|
16389
16386
|
until: '3.0.0'
|
16390
16387
|
}));
|
@@ -16399,7 +16396,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16399
16396
|
}
|
16400
16397
|
|
16401
16398
|
if (!this.store._hasModelFor(modelName)) {
|
16402
|
-
(false &&
|
16399
|
+
(false && Ember.warn(this.warnMessageNoModelForType(modelName, resourceHash.type, usedLookup), false, {
|
16403
16400
|
id: 'ds.serializer.model-for-type-missing'
|
16404
16401
|
}));
|
16405
16402
|
|
@@ -16429,7 +16426,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16429
16426
|
normalizeQueryRecordResponse: function () {
|
16430
16427
|
var normalized = this._super.apply(this, arguments);
|
16431
16428
|
|
16432
|
-
(false &&
|
16429
|
+
(false && Ember.assert('Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.', !Array.isArray(normalized.data), {
|
16433
16430
|
id: 'ds.serializer.json-api.queryRecord-array-response'
|
16434
16431
|
}));
|
16435
16432
|
|
@@ -16449,7 +16446,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16449
16446
|
}
|
16450
16447
|
if (false) {
|
16451
16448
|
if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {
|
16452
|
-
(false &&
|
16449
|
+
(false && Ember.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + attributeKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement \'keyForAttribute(key) { return key; }\' to prevent Ember Data from customizing your attribute keys.', false));
|
16453
16450
|
}
|
16454
16451
|
}
|
16455
16452
|
});
|
@@ -16459,7 +16456,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16459
16456
|
},
|
16460
16457
|
extractRelationship: function (relationshipHash) {
|
16461
16458
|
|
16462
|
-
if (
|
16459
|
+
if (typeOf(relationshipHash.data) === 'object') {
|
16463
16460
|
relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);
|
16464
16461
|
}
|
16465
16462
|
|
@@ -16491,7 +16488,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16491
16488
|
}
|
16492
16489
|
if (false) {
|
16493
16490
|
if (resourceHash.relationships[relationshipKey] === undefined && resourceHash.relationships[key] !== undefined) {
|
16494
|
-
(false &&
|
16491
|
+
(false && Ember.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + relationshipKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement \'keyForRelationship(key) { return key; }\' to prevent Ember Data from customizing your relationship keys.', false));
|
16495
16492
|
}
|
16496
16493
|
}
|
16497
16494
|
});
|
@@ -16505,7 +16502,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16505
16502
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
|
16506
16503
|
|
16507
16504
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16508
|
-
(false && !(false) &&
|
16505
|
+
(false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16509
16506
|
id: 'ds.json-api-serializer.deprecated-model-name-for-polymorphic-type',
|
16510
16507
|
until: '3.0.0'
|
16511
16508
|
}));
|
@@ -16560,7 +16557,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16560
16557
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(snapshot.modelName);
|
16561
16558
|
|
16562
16559
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16563
|
-
(false && !(false) &&
|
16560
|
+
(false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to customize how a type is serialized. Use payloadTypeFromModelName instead.", false, {
|
16564
16561
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-model',
|
16565
16562
|
until: '3.0.0'
|
16566
16563
|
}));
|
@@ -16619,7 +16616,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16619
16616
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(belongsTo.modelName);
|
16620
16617
|
|
16621
16618
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16622
|
-
(false && !(false) &&
|
16619
|
+
(false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
16623
16620
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-belongs-to',
|
16624
16621
|
until: '3.0.0'
|
16625
16622
|
}));
|
@@ -16671,7 +16668,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16671
16668
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(item.modelName);
|
16672
16669
|
|
16673
16670
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16674
|
-
(false && !(false) &&
|
16671
|
+
(false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
16675
16672
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-has-many',
|
16676
16673
|
until: '3.0.0'
|
16677
16674
|
}));
|
@@ -16717,10 +16714,10 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16717
16714
|
JSONAPISerializer.reopen({
|
16718
16715
|
willMergeMixin: function (props) {
|
16719
16716
|
var constructor = this.constructor;
|
16720
|
-
(false &&
|
16717
|
+
(false && Ember.warn('You\'ve defined \'extractMeta\' in ' + constructor.toString() + ' which is not used for serializers extending JSONAPISerializer. Read more at https://emberjs.com/api/data/classes/DS.JSONAPISerializer.html#toc_customizing-meta on how to customize meta when using JSON API.', isNone(props.extractMeta) || props.extractMeta === _json.default.prototype.extractMeta, {
|
16721
16718
|
id: 'ds.serializer.json-api.extractMeta'
|
16722
16719
|
}));
|
16723
|
-
(false &&
|
16720
|
+
(false && Ember.warn('The JSONAPISerializer does not work with the EmbeddedRecordsMixin because the JSON API spec does not describe how to format embedded resources.', !props.isEmbeddedRecordsMixin, {
|
16724
16721
|
id: 'ds.serializer.embedded-records-mixin-not-supported'
|
16725
16722
|
}));
|
16726
16723
|
},
|
@@ -16735,7 +16732,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16735
16732
|
|
16736
16733
|
exports.default = JSONAPISerializer;
|
16737
16734
|
});
|
16738
|
-
define('ember-data/serializers/json', ['exports', 'ember
|
16735
|
+
define('ember-data/serializers/json', ['exports', 'ember-data/serializer', 'ember-data/-private'], function (exports, _serializer, _private) {
|
16739
16736
|
'use strict';
|
16740
16737
|
|
16741
16738
|
exports.__esModule = true;
|
@@ -16752,9 +16749,14 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
16752
16749
|
}
|
16753
16750
|
}
|
16754
16751
|
|
16755
|
-
var
|
16756
|
-
var
|
16757
|
-
var
|
16752
|
+
var assign = Ember.assign;
|
16753
|
+
var merge = Ember.merge;
|
16754
|
+
var isNone = Ember.isNone;
|
16755
|
+
var typeOf = Ember.typeOf;
|
16756
|
+
var get = Ember.get;
|
16757
|
+
|
16758
|
+
|
16759
|
+
var emberAssign = assign || merge;
|
16758
16760
|
|
16759
16761
|
/**
|
16760
16762
|
Ember Data 2.0 Serializer:
|
@@ -16983,7 +16985,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
16983
16985
|
|
16984
16986
|
var meta = this.extractMeta(store, primaryModelClass, payload);
|
16985
16987
|
if (meta) {
|
16986
|
-
(false &&
|
16988
|
+
(false && Ember.assert('The `meta` returned from `extractMeta` has to be an object, not "' + typeOf(meta) + '".', typeOf(meta) === 'object'));
|
16987
16989
|
|
16988
16990
|
documentHash.meta = meta;
|
16989
16991
|
}
|
@@ -17024,7 +17026,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17024
17026
|
|
17025
17027
|
if (resourceHash) {
|
17026
17028
|
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
|
17027
|
-
if (
|
17029
|
+
if (typeOf(resourceHash.links) === 'object') {
|
17028
17030
|
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links);
|
17029
17031
|
}
|
17030
17032
|
|
@@ -17061,7 +17063,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17061
17063
|
return attributes;
|
17062
17064
|
},
|
17063
17065
|
extractRelationship: function (relationshipModelName, relationshipHash) {
|
17064
|
-
if (
|
17066
|
+
if (isNone(relationshipHash)) {
|
17065
17067
|
return null;
|
17066
17068
|
}
|
17067
17069
|
/*
|
@@ -17069,7 +17071,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17069
17071
|
is polymorphic. It could however also be embedded resources that the
|
17070
17072
|
EmbeddedRecordsMixin has be able to process.
|
17071
17073
|
*/
|
17072
|
-
if (
|
17074
|
+
if (typeOf(relationshipHash) === 'object') {
|
17073
17075
|
if (relationshipHash.id) {
|
17074
17076
|
relationshipHash.id = (0, _private.coerceId)(relationshipHash.id);
|
17075
17077
|
}
|
@@ -17082,7 +17084,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17082
17084
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipHash.type);
|
17083
17085
|
|
17084
17086
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
17085
|
-
(false && !(false) &&
|
17087
|
+
(false && !(false) && Ember.deprecate("You used modelNameFromPayloadKey to customize how a type is normalized. Use modelNameFromPayloadType instead", false, {
|
17086
17088
|
id: 'ds.json-serializer.deprecated-type-for-polymorphic-relationship',
|
17087
17089
|
until: '3.0.0'
|
17088
17090
|
}));
|
@@ -17125,7 +17127,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17125
17127
|
data = _this3.extractRelationship(relationshipMeta.type, relationshipHash);
|
17126
17128
|
}
|
17127
17129
|
} else if (relationshipMeta.kind === 'hasMany') {
|
17128
|
-
if (!
|
17130
|
+
if (!isNone(relationshipHash)) {
|
17129
17131
|
data = new Array(relationshipHash.length);
|
17130
17132
|
for (var i = 0, l = relationshipHash.length; i < l; i++) {
|
17131
17133
|
var item = relationshipHash[i];
|
@@ -17202,7 +17204,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17202
17204
|
}
|
17203
17205
|
},
|
17204
17206
|
_getMappedKey: function (key, modelClass) {
|
17205
|
-
(false &&
|
17207
|
+
(false && Ember.warn('There is no attribute or relationship with the name `' + key + '` on `' + modelClass.modelName + '`. Check your serializers attrs hash.', get(modelClass, 'attributes').has(key) || get(modelClass, 'relationshipsByName').has(key), {
|
17206
17208
|
id: 'ds.serializer.no-mapped-attrs-key'
|
17207
17209
|
}));
|
17208
17210
|
|
@@ -17235,7 +17237,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17235
17237
|
},
|
17236
17238
|
shouldSerializeHasMany: function (snapshot, key, relationship) {
|
17237
17239
|
if (this._shouldSerializeHasMany !== JSONSerializer.prototype._shouldSerializeHasMany) {
|
17238
|
-
(false && !(false) &&
|
17240
|
+
(false && !(false) && Ember.deprecate('The private method _shouldSerializeHasMany has been promoted to the public API. Please remove the underscore to use the public shouldSerializeHasMany method.', false, {
|
17239
17241
|
id: 'ds.serializer.private-should-serialize-has-many',
|
17240
17242
|
until: '3.0.0'
|
17241
17243
|
}));
|
@@ -17281,7 +17283,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17281
17283
|
return json;
|
17282
17284
|
},
|
17283
17285
|
serializeIntoHash: function (hash, typeClass, snapshot, options) {
|
17284
|
-
|
17286
|
+
emberAssign(hash, this.serialize(snapshot, options));
|
17285
17287
|
},
|
17286
17288
|
serializeAttribute: function (snapshot, json, key, attribute) {
|
17287
17289
|
|
@@ -17398,7 +17400,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17398
17400
|
transformFor: function (attributeType, skipAssertion) {
|
17399
17401
|
var transform = (0, _private.getOwner)(this).lookup('transform:' + attributeType);
|
17400
17402
|
|
17401
|
-
(false &&
|
17403
|
+
(false && Ember.assert("Unable to find transform for '" + attributeType + "'", skipAssertion || !!transform));
|
17402
17404
|
|
17403
17405
|
|
17404
17406
|
return transform;
|
@@ -17432,7 +17434,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serialize
|
|
17432
17434
|
|
17433
17435
|
exports.default = JSONSerializer;
|
17434
17436
|
});
|
17435
|
-
define('ember-data/serializers/rest', ['exports', 'ember
|
17437
|
+
define('ember-data/serializers/rest', ['exports', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _emberInflector, _json, _private) {
|
17436
17438
|
'use strict';
|
17437
17439
|
|
17438
17440
|
exports.__esModule = true;
|
@@ -17449,7 +17451,10 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17449
17451
|
}
|
17450
17452
|
}
|
17451
17453
|
|
17452
|
-
var
|
17454
|
+
var typeOf = Ember.typeOf;
|
17455
|
+
var isNone = Ember.isNone;
|
17456
|
+
var makeArray = Ember.makeArray;
|
17457
|
+
var camelize = Ember.String.camelize;
|
17453
17458
|
|
17454
17459
|
|
17455
17460
|
/**
|
@@ -17477,10 +17482,11 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17477
17482
|
|
17478
17483
|
```app/serializers/application.js
|
17479
17484
|
import DS from 'ember-data';
|
17485
|
+
import { underscore } from '@ember/string';
|
17480
17486
|
|
17481
17487
|
export default DS.RESTSerializer.extend({
|
17482
17488
|
keyForAttribute(attr, method) {
|
17483
|
-
return
|
17489
|
+
return underscore(attr).toUpperCase();
|
17484
17490
|
}
|
17485
17491
|
});
|
17486
17492
|
```
|
@@ -17502,7 +17508,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17502
17508
|
},
|
17503
17509
|
normalize: function (modelClass, resourceHash, prop) {
|
17504
17510
|
if (this.normalizeHash && this.normalizeHash[prop]) {
|
17505
|
-
(false && !(false) &&
|
17511
|
+
(false && !(false) && Ember.deprecate('`RESTSerializer.normalizeHash` has been deprecated. Please use `serializer.normalize` to modify the payload of single resources.', false, {
|
17506
17512
|
id: 'ds.serializer.normalize-hash-deprecated',
|
17507
17513
|
until: '3.0.0'
|
17508
17514
|
}));
|
@@ -17522,7 +17528,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17522
17528
|
var modelClass = store.modelFor(modelName);
|
17523
17529
|
var serializer = store.serializerFor(modelName);
|
17524
17530
|
|
17525
|
-
|
17531
|
+
makeArray(arrayHash).forEach(function (hash) {
|
17526
17532
|
var _normalizePolymorphic = _this._normalizePolymorphicRecord(store, hash, prop, modelClass, serializer),
|
17527
17533
|
data = _normalizePolymorphic.data,
|
17528
17534
|
included = _normalizePolymorphic.included;
|
@@ -17551,7 +17557,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17551
17557
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(hash.type);
|
17552
17558
|
|
17553
17559
|
if (modelName !== deprecatedModelNameLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
17554
|
-
(false && !(false) &&
|
17560
|
+
(false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This is has been deprecated in favor of modelNameFromPayloadType", false, {
|
17555
17561
|
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
17556
17562
|
until: '3.0.0'
|
17557
17563
|
}));
|
@@ -17579,7 +17585,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17579
17585
|
|
17580
17586
|
var meta = this.extractMeta(store, primaryModelClass, payload);
|
17581
17587
|
if (meta) {
|
17582
|
-
(false &&
|
17588
|
+
(false && Ember.assert('The `meta` returned from `extractMeta` has to be an object, not "' + typeOf(meta) + '".', typeOf(meta) === 'object'));
|
17583
17589
|
|
17584
17590
|
documentHash.meta = meta;
|
17585
17591
|
}
|
@@ -17615,7 +17621,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17615
17621
|
|
17616
17622
|
var typeName = this.modelNameFromPayloadKey(modelName);
|
17617
17623
|
if (!store.modelFactoryFor(typeName)) {
|
17618
|
-
(false &&
|
17624
|
+
(false && Ember.warn(this.warnMessageNoModelForKey(modelName, typeName), false, {
|
17619
17625
|
id: 'ds.serializer.model-for-key-missing'
|
17620
17626
|
}));
|
17621
17627
|
|
@@ -17633,7 +17639,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17633
17639
|
var isQueryRecordAnArray = requestType === 'queryRecord' && isPrimary && Array.isArray(value);
|
17634
17640
|
var message = "The adapter returned an array for the primary data of a `queryRecord` response. This is deprecated as `queryRecord` should return a single record.";
|
17635
17641
|
|
17636
|
-
(false && !(!isQueryRecordAnArray) &&
|
17642
|
+
(false && !(!isQueryRecordAnArray) && Ember.deprecate(message, !isQueryRecordAnArray, {
|
17637
17643
|
id: 'ds.serializer.rest.queryRecord-array-response',
|
17638
17644
|
until: '3.0'
|
17639
17645
|
}));
|
@@ -17718,7 +17724,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17718
17724
|
for (var prop in payload) {
|
17719
17725
|
var modelName = this.modelNameFromPayloadKey(prop);
|
17720
17726
|
if (!store.modelFactoryFor(modelName)) {
|
17721
|
-
(false &&
|
17727
|
+
(false && Ember.warn(this.warnMessageNoModelForKey(prop, modelName), false, {
|
17722
17728
|
id: 'ds.serializer.model-for-key-missing'
|
17723
17729
|
}));
|
17724
17730
|
|
@@ -17727,7 +17733,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17727
17733
|
var type = store.modelFor(modelName);
|
17728
17734
|
var typeSerializer = store.serializerFor(type.modelName);
|
17729
17735
|
|
17730
|
-
|
17736
|
+
makeArray(payload[prop]).forEach(function (hash) {
|
17731
17737
|
var _typeSerializer$norma = typeSerializer.normalize(type, hash, prop),
|
17732
17738
|
data = _typeSerializer$norma.data,
|
17733
17739
|
included = _typeSerializer$norma.included;
|
@@ -17775,7 +17781,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17775
17781
|
// `keyForPolymorphicType`. If this is the case, a deprecation warning is
|
17776
17782
|
// logged and the old way is restored (so nothing breaks).
|
17777
17783
|
if (key !== typeKey && this.keyForPolymorphicType === RESTSerializer.prototype.keyForPolymorphicType) {
|
17778
|
-
(false && !(false) &&
|
17784
|
+
(false && !(false) && Ember.deprecate("The key to serialize the type of a polymorphic record is created via keyForAttribute which has been deprecated. Use the keyForPolymorphicType hook instead.", false, {
|
17779
17785
|
id: 'ds.rest-serializer.deprecated-key-for-polymorphic-type',
|
17780
17786
|
until: '3.0.0'
|
17781
17787
|
}));
|
@@ -17784,7 +17790,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17784
17790
|
typeKey = key;
|
17785
17791
|
}
|
17786
17792
|
|
17787
|
-
if (
|
17793
|
+
if (isNone(belongsTo)) {
|
17788
17794
|
json[typeKey] = null;
|
17789
17795
|
} else {
|
17790
17796
|
if ((0, _private.isEnabled)("ds-payload-type-hooks")) {
|
@@ -17829,7 +17835,7 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17829
17835
|
var deprecatedTypeLookup = this.modelNameFromPayloadKey(payloadType);
|
17830
17836
|
|
17831
17837
|
if (payloadType !== deprecatedTypeLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
17832
|
-
(false && !(false) &&
|
17838
|
+
(false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
17833
17839
|
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
17834
17840
|
until: '3.0.0'
|
17835
17841
|
}));
|
@@ -18003,11 +18009,11 @@ define('ember-data/transform', ['exports', 'ember-data/transforms/transform'], f
|
|
18003
18009
|
}
|
18004
18010
|
});
|
18005
18011
|
});
|
18006
|
-
define('ember-data/transforms/boolean', ['exports', 'ember
|
18012
|
+
define('ember-data/transforms/boolean', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) {
|
18007
18013
|
'use strict';
|
18008
18014
|
|
18009
18015
|
exports.__esModule = true;
|
18010
|
-
var isNone =
|
18016
|
+
var isNone = Ember.isNone;
|
18011
18017
|
exports.default = _transform.default.extend({
|
18012
18018
|
deserialize: function (serialized, options) {
|
18013
18019
|
var type = typeof serialized;
|
@@ -18035,13 +18041,13 @@ define('ember-data/transforms/boolean', ['exports', 'ember', 'ember-data/transfo
|
|
18035
18041
|
}
|
18036
18042
|
});
|
18037
18043
|
});
|
18038
|
-
define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform'
|
18044
|
+
define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) {
|
18039
18045
|
'use strict';
|
18040
18046
|
|
18041
18047
|
exports.__esModule = true;
|
18042
18048
|
|
18043
18049
|
|
18044
|
-
|
18050
|
+
Ember.Date = Ember.Date || {};
|
18045
18051
|
|
18046
18052
|
/**
|
18047
18053
|
Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
|
@@ -18055,8 +18061,8 @@ define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transfor
|
|
18055
18061
|
@static
|
18056
18062
|
@deprecated
|
18057
18063
|
*/
|
18058
|
-
|
18059
|
-
(false && !(false) &&
|
18064
|
+
Ember.Date.parse = function (date) {
|
18065
|
+
(false && !(false) && Ember.deprecate('Ember.Date.parse is deprecated because Safari 5-, IE8-, and\n Firefox 3.6- are no longer supported (see\n https://github.com/csnover/js-iso8601 for the history of this issue).\n Please use Date.parse instead', false, {
|
18060
18066
|
id: 'ds.ember.date.parse-deprecate',
|
18061
18067
|
until: '3.0.0'
|
18062
18068
|
}));
|
@@ -18095,7 +18101,7 @@ define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transfor
|
|
18095
18101
|
var offset = serialized.indexOf('+');
|
18096
18102
|
|
18097
18103
|
if (offset !== -1 && serialized.length - 3 === offset) {
|
18098
|
-
(false && !(false) &&
|
18104
|
+
(false && !(false) && Ember.deprecate('The ECMA2015 Spec for ISO 8601 dates does not allow for shorthand timezone offsets such as +00.\n Ember Data\'s normalization of date\'s allowing for this shorthand has been deprecated, please update your API to return\n UTC dates formatted with \xB1hh:mm timezone offsets or implement a custom UTC transform.', false, {
|
18099
18105
|
id: 'ds.attr.date.normalize-utc',
|
18100
18106
|
until: '3.0.0'
|
18101
18107
|
}));
|
@@ -18127,14 +18133,13 @@ define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transfor
|
|
18127
18133
|
}
|
18128
18134
|
});
|
18129
18135
|
});
|
18130
|
-
define('ember-data/transforms/number', ['exports', 'ember
|
18136
|
+
define('ember-data/transforms/number', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) {
|
18131
18137
|
'use strict';
|
18132
18138
|
|
18133
18139
|
exports.__esModule = true;
|
18140
|
+
var empty = Ember.isEmpty;
|
18134
18141
|
|
18135
18142
|
|
18136
|
-
var empty = _ember.default.isEmpty;
|
18137
|
-
|
18138
18143
|
function isNumber(value) {
|
18139
18144
|
return value === value && value !== Infinity && value !== -Infinity;
|
18140
18145
|
}
|
@@ -18186,36 +18191,11 @@ define('ember-data/transforms/number', ['exports', 'ember', 'ember-data/transfor
|
|
18186
18191
|
}
|
18187
18192
|
});
|
18188
18193
|
});
|
18189
|
-
define('ember-data/transforms/string', ['exports', 'ember
|
18194
|
+
define('ember-data/transforms/string', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) {
|
18190
18195
|
'use strict';
|
18191
18196
|
|
18192
18197
|
exports.__esModule = true;
|
18193
|
-
|
18194
|
-
|
18195
|
-
var none = _ember.default.isNone;
|
18196
|
-
|
18197
|
-
/**
|
18198
|
-
The `DS.StringTransform` class is used to serialize and deserialize
|
18199
|
-
string attributes on Ember Data record objects. This transform is
|
18200
|
-
used when `string` is passed as the type parameter to the
|
18201
|
-
[DS.attr](../../data#method_attr) function.
|
18202
|
-
|
18203
|
-
Usage
|
18204
|
-
|
18205
|
-
```app/models/user.js
|
18206
|
-
import DS from 'ember-data';
|
18207
|
-
|
18208
|
-
export default DS.Model.extend({
|
18209
|
-
isAdmin: DS.attr('boolean'),
|
18210
|
-
name: DS.attr('string'),
|
18211
|
-
email: DS.attr('string')
|
18212
|
-
});
|
18213
|
-
```
|
18214
|
-
|
18215
|
-
@class StringTransform
|
18216
|
-
@extends DS.Transform
|
18217
|
-
@namespace DS
|
18218
|
-
*/
|
18198
|
+
var none = Ember.isNone;
|
18219
18199
|
exports.default = _transform.default.extend({
|
18220
18200
|
deserialize: function (serialized) {
|
18221
18201
|
return none(serialized) ? null : String(serialized);
|
@@ -18225,18 +18205,20 @@ define('ember-data/transforms/string', ['exports', 'ember', 'ember-data/transfor
|
|
18225
18205
|
}
|
18226
18206
|
});
|
18227
18207
|
});
|
18228
|
-
define('ember-data/transforms/transform', ['exports'
|
18208
|
+
define('ember-data/transforms/transform', ['exports'], function (exports) {
|
18229
18209
|
'use strict';
|
18230
18210
|
|
18231
18211
|
exports.__esModule = true;
|
18232
|
-
|
18212
|
+
var EmberObject = Ember.Object;
|
18213
|
+
exports.default = EmberObject.extend({
|
18233
18214
|
/**
|
18234
18215
|
When given a deserialized value from a record attribute this
|
18235
18216
|
method must return the serialized value.
|
18236
18217
|
Example
|
18237
18218
|
```javascript
|
18238
|
-
|
18239
|
-
|
18219
|
+
import { isEmpty } from '@ember/utils';
|
18220
|
+
serialize(deserialized, options) {
|
18221
|
+
return isEmpty(deserialized) ? null : Number(deserialized);
|
18240
18222
|
}
|
18241
18223
|
```
|
18242
18224
|
@method serialize
|
@@ -18267,20 +18249,20 @@ define("ember-data/version", ["exports"], function (exports) {
|
|
18267
18249
|
"use strict";
|
18268
18250
|
|
18269
18251
|
exports.__esModule = true;
|
18270
|
-
exports.default = "2.17.0-beta.
|
18252
|
+
exports.default = "2.17.0-beta.2";
|
18271
18253
|
});
|
18272
|
-
define("ember-inflector", ["module", "exports", "ember
|
18254
|
+
define("ember-inflector", ["module", "exports", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _system) {
|
18273
18255
|
"use strict";
|
18274
18256
|
|
18275
18257
|
exports.__esModule = true;
|
18276
18258
|
exports.defaultRules = exports.singularize = exports.pluralize = undefined;
|
18277
|
-
|
18259
|
+
|
18278
18260
|
|
18279
18261
|
_system.Inflector.defaultRules = _system.defaultRules;
|
18280
|
-
|
18262
|
+
Ember.Inflector = _system.Inflector;
|
18281
18263
|
|
18282
|
-
|
18283
|
-
|
18264
|
+
Ember.String.pluralize = _system.pluralize;
|
18265
|
+
Ember.String.singularize = _system.singularize;
|
18284
18266
|
|
18285
18267
|
exports.default = _system.Inflector;
|
18286
18268
|
exports.pluralize = _system.pluralize;
|
@@ -18302,10 +18284,10 @@ define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/sy
|
|
18302
18284
|
_system.Inflector.pluralize = _system.pluralize;
|
18303
18285
|
}
|
18304
18286
|
});
|
18305
|
-
define('ember-inflector/lib/ext/string', ['ember
|
18287
|
+
define('ember-inflector/lib/ext/string', ['ember-inflector/lib/system/string'], function (_string) {
|
18306
18288
|
'use strict';
|
18307
18289
|
|
18308
|
-
if (
|
18290
|
+
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
|
18309
18291
|
/**
|
18310
18292
|
See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}
|
18311
18293
|
@method pluralize
|
@@ -18389,13 +18371,13 @@ define('ember-inflector/lib/system/inflections', ['exports'], function (exports)
|
|
18389
18371
|
uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
|
18390
18372
|
};
|
18391
18373
|
});
|
18392
|
-
define('ember-inflector/lib/system/inflector', ['exports'
|
18374
|
+
define('ember-inflector/lib/system/inflector', ['exports'], function (exports) {
|
18393
18375
|
'use strict';
|
18394
18376
|
|
18395
18377
|
exports.__esModule = true;
|
18396
18378
|
|
18397
18379
|
|
18398
|
-
var capitalize =
|
18380
|
+
var capitalize = Ember.String.capitalize;
|
18399
18381
|
|
18400
18382
|
var BLANK_REGEX = /^\s*$/;
|
18401
18383
|
var LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
|
@@ -18720,19 +18702,19 @@ define('ember-inflector/lib/system/string', ['exports', 'ember-inflector/lib/sys
|
|
18720
18702
|
exports.pluralize = pluralize;
|
18721
18703
|
exports.singularize = singularize;
|
18722
18704
|
});
|
18723
|
-
define('ember-inflector/lib/utils/make-helper', ['exports'
|
18705
|
+
define('ember-inflector/lib/utils/make-helper', ['exports'], function (exports) {
|
18724
18706
|
'use strict';
|
18725
18707
|
|
18726
18708
|
exports.__esModule = true;
|
18727
18709
|
exports.default = makeHelper;
|
18728
18710
|
function makeHelper(helperFunction) {
|
18729
|
-
if (
|
18730
|
-
return
|
18711
|
+
if (Ember.Helper) {
|
18712
|
+
return Ember.Helper.helper(helperFunction);
|
18731
18713
|
}
|
18732
|
-
if (
|
18733
|
-
return
|
18714
|
+
if (Ember.HTMLBars) {
|
18715
|
+
return Ember.HTMLBars.makeBoundHelper(helperFunction);
|
18734
18716
|
}
|
18735
|
-
return
|
18717
|
+
return Ember.Handlebars.makeBoundHelper(helperFunction);
|
18736
18718
|
}
|
18737
18719
|
});
|
18738
18720
|
define('ember-load-initializers', ['exports'], function (exports) {
|