ember-data-source 2.14.11 → 2.15.0.beta.1
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 +766 -781
- data/dist/globals/ember-data.min.js +6 -6
- data/dist/globals/ember-data.prod.js +961 -475
- data/package.json +8 -8
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abe9bf5fe6b9f3781d497f8ccd72a46c835f2b0d
|
4
|
+
data.tar.gz: 88cfba66211851aba25606400921f74b7fd92177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d5c84618a4ba7119b871e1efdca282c7024dc900f2c612d00bee29017d26679b51df8ec339059676d947de6d5526fab0f1afa1b064516333242706d85111c0
|
7
|
+
data.tar.gz: b08ddc95c492889c859250c97f40cccc34876fac819b64a82d1582dfa0cedc1eb4e6938814cb6165ee2db2f470b6cda578fc76c73802ac1578222d88d013864b
|
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.
|
9
|
+
* @version 2.15.0-beta.1
|
10
10
|
*/
|
11
11
|
|
12
12
|
var loader, define, requireModule, require, requirejs;
|
@@ -14,6 +14,8 @@ var loader, define, requireModule, require, requirejs;
|
|
14
14
|
(function (global) {
|
15
15
|
'use strict';
|
16
16
|
|
17
|
+
var heimdall = global.heimdall;
|
18
|
+
|
17
19
|
function dict() {
|
18
20
|
var obj = Object.create(null);
|
19
21
|
obj['__'] = undefined;
|
@@ -55,9 +57,7 @@ var loader, define, requireModule, require, requirejs;
|
|
55
57
|
}
|
56
58
|
}
|
57
59
|
}
|
58
|
-
}
|
59
|
-
// Option to enable or disable the generation of default exports
|
60
|
-
makeDefaultExport: true
|
60
|
+
}
|
61
61
|
};
|
62
62
|
|
63
63
|
var registry = dict();
|
@@ -107,7 +107,6 @@ var loader, define, requireModule, require, requirejs;
|
|
107
107
|
return this.module.exports;
|
108
108
|
}
|
109
109
|
|
110
|
-
|
111
110
|
if (loader.wrapModules) {
|
112
111
|
this.callback = loader.wrapModules(this.id, this.callback);
|
113
112
|
}
|
@@ -121,9 +120,7 @@ var loader, define, requireModule, require, requirejs;
|
|
121
120
|
if (!(this.hasExportsAsDep && result === undefined)) {
|
122
121
|
this.module.exports = result;
|
123
122
|
}
|
124
|
-
|
125
|
-
this.makeDefaultExport();
|
126
|
-
}
|
123
|
+
this.makeDefaultExport();
|
127
124
|
return this.module.exports;
|
128
125
|
};
|
129
126
|
|
@@ -281,7 +278,6 @@ var loader, define, requireModule, require, requirejs;
|
|
281
278
|
return child;
|
282
279
|
}
|
283
280
|
|
284
|
-
|
285
281
|
var parts = child.split('/');
|
286
282
|
var nameParts = id.split('/');
|
287
283
|
var parentBase = nameParts.slice(0, -1);
|
@@ -349,59 +345,12 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
|
|
349
345
|
'use strict';
|
350
346
|
|
351
347
|
exports.__esModule = true;
|
352
|
-
exports.
|
353
|
-
exports.debug = debug;
|
354
|
-
exports.deprecate = deprecate;
|
355
|
-
exports.info = info;
|
356
|
-
exports.runInDebug = runInDebug;
|
348
|
+
exports.assertPolymorphicType = undefined;
|
357
349
|
exports.instrument = instrument;
|
358
|
-
exports.warn = warn;
|
359
|
-
exports.debugSeal = debugSeal;
|
360
|
-
exports.assertPolymorphicType = assertPolymorphicType;
|
361
|
-
function assert() {
|
362
|
-
return _ember.default.assert.apply(_ember.default, arguments);
|
363
|
-
}
|
364
|
-
|
365
|
-
function debug() {
|
366
|
-
return _ember.default.debug.apply(_ember.default, arguments);
|
367
|
-
}
|
368
|
-
|
369
|
-
function deprecate() {
|
370
|
-
return _ember.default.deprecate.apply(_ember.default, arguments);
|
371
|
-
}
|
372
|
-
|
373
|
-
function info() {
|
374
|
-
return _ember.default.info.apply(_ember.default, arguments);
|
375
|
-
}
|
376
|
-
|
377
|
-
function runInDebug() {
|
378
|
-
return _ember.default.runInDebug.apply(_ember.default, arguments);
|
379
|
-
}
|
380
|
-
|
381
350
|
function instrument(method) {
|
382
351
|
return method();
|
383
352
|
}
|
384
353
|
|
385
|
-
function warn() {
|
386
|
-
return _ember.default.warn.apply(_ember.default, arguments);
|
387
|
-
}
|
388
|
-
|
389
|
-
function debugSeal() {
|
390
|
-
return _ember.default.debugSeal.apply(_ember.default, arguments);
|
391
|
-
}
|
392
|
-
|
393
|
-
function checkPolymorphic(modelClass, addedModelClass) {
|
394
|
-
if (modelClass.__isMixin) {
|
395
|
-
//TODO Need to do this in order to support mixins, should convert to public api
|
396
|
-
//once it exists in Ember
|
397
|
-
return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
|
398
|
-
}
|
399
|
-
if (_ember.default.MODEL_FACTORY_INJECTIONS) {
|
400
|
-
modelClass = modelClass.superclass;
|
401
|
-
}
|
402
|
-
return modelClass.detect(addedModelClass);
|
403
|
-
}
|
404
|
-
|
405
354
|
/*
|
406
355
|
Assert that `addedRecord` has a valid type so it can be added to the
|
407
356
|
relationship of the `record`.
|
@@ -421,18 +370,36 @@ define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) {
|
|
421
370
|
@param {InternalModel} addedRecord record which
|
422
371
|
should be added/set for the relationship
|
423
372
|
*/
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
var
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
373
|
+
var assertPolymorphicType = void 0;
|
374
|
+
|
375
|
+
if (false) {
|
376
|
+
var checkPolymorphic = function checkPolymorphic(modelClass, addedModelClass) {
|
377
|
+
if (modelClass.__isMixin) {
|
378
|
+
//TODO Need to do this in order to support mixins, should convert to public api
|
379
|
+
//once it exists in Ember
|
380
|
+
return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
|
381
|
+
}
|
382
|
+
if (_ember.default.MODEL_FACTORY_INJECTIONS) {
|
383
|
+
modelClass = modelClass.superclass;
|
384
|
+
}
|
385
|
+
return modelClass.detect(addedModelClass);
|
386
|
+
};
|
387
|
+
|
388
|
+
exports.assertPolymorphicType = assertPolymorphicType = function assertPolymorphicType(parentInternalModel, relationshipMeta, addedInternalModel) {
|
389
|
+
var addedModelName = addedInternalModel.modelName;
|
390
|
+
var parentModelName = parentInternalModel.modelName;
|
391
|
+
var key = relationshipMeta.key;
|
392
|
+
var relationshipModelName = relationshipMeta.type;
|
393
|
+
var relationshipClass = parentInternalModel.store.modelFor(relationshipModelName);
|
394
|
+
var assertionMessage = 'You cannot add a record of modelClass \'' + addedModelName + '\' to the \'' + parentModelName + '.' + key + '\' relationship (only \'' + relationshipModelName + '\' allowed)';
|
395
|
+
|
396
|
+
(false && _ember.default.assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass)));
|
397
|
+
};
|
433
398
|
}
|
399
|
+
|
400
|
+
exports.assertPolymorphicType = assertPolymorphicType;
|
434
401
|
});
|
435
|
-
define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember'
|
402
|
+
define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember'], function (exports, _ember) {
|
436
403
|
'use strict';
|
437
404
|
|
438
405
|
exports.__esModule = true;
|
@@ -832,11 +799,10 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
|
|
832
799
|
endpoint of "/line_items/".
|
833
800
|
```app/adapters/application.js
|
834
801
|
import DS from 'ember-data';
|
835
|
-
import { pluralize } from 'ember-inflector';
|
836
802
|
export default DS.RESTAdapter.extend({
|
837
803
|
pathForType: function(modelName) {
|
838
804
|
var decamelized = Ember.String.decamelize(modelName);
|
839
|
-
return pluralize(decamelized);
|
805
|
+
return Ember.String.pluralize(decamelized);
|
840
806
|
}
|
841
807
|
});
|
842
808
|
```
|
@@ -846,11 +812,11 @@ define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'emb
|
|
846
812
|
**/
|
847
813
|
pathForType: function (modelName) {
|
848
814
|
var camelized = _ember.default.String.camelize(modelName);
|
849
|
-
return
|
815
|
+
return _ember.default.String.pluralize(camelized);
|
850
816
|
}
|
851
817
|
});
|
852
818
|
});
|
853
|
-
define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-
|
819
|
+
define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-private/features'], function (exports, _ember, _features) {
|
854
820
|
'use strict';
|
855
821
|
|
856
822
|
exports.__esModule = true;
|
@@ -961,7 +927,8 @@ define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-
|
|
961
927
|
|
962
928
|
function extend(ParentErrorClass, defaultMessage) {
|
963
929
|
var ErrorClass = function (errors, message) {
|
964
|
-
(
|
930
|
+
(false && _ember.default.assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || [])));
|
931
|
+
|
965
932
|
ParentErrorClass.call(this, errors, message || defaultMessage);
|
966
933
|
};
|
967
934
|
ErrorClass.prototype = Object.create(ParentErrorClass.prototype);
|
@@ -1816,8 +1783,8 @@ define("ember-data/-private/system/diff-array", ["exports"], function (exports)
|
|
1816
1783
|
exports.default = diffArray;
|
1817
1784
|
/**
|
1818
1785
|
@namespace
|
1819
|
-
@method
|
1820
|
-
@
|
1786
|
+
@method diffArray
|
1787
|
+
@private
|
1821
1788
|
@param {Array} oldArray the old array
|
1822
1789
|
@param {Array} newArray the new array
|
1823
1790
|
@return {hash} {
|
@@ -1926,7 +1893,7 @@ define('ember-data/-private/system/identity-map', ['exports', 'ember-data/-priva
|
|
1926
1893
|
|
1927
1894
|
exports.default = IdentityMap;
|
1928
1895
|
});
|
1929
|
-
define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/-
|
1896
|
+
define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/-private/system/model/internal-model'], function (exports, _internalModel) {
|
1930
1897
|
'use strict';
|
1931
1898
|
|
1932
1899
|
exports.__esModule = true;
|
@@ -1980,16 +1947,18 @@ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/
|
|
1980
1947
|
};
|
1981
1948
|
|
1982
1949
|
InternalModelMap.prototype.set = function set(id, internalModel) {
|
1983
|
-
(
|
1984
|
-
(
|
1985
|
-
(
|
1986
|
-
(
|
1950
|
+
(false && Ember.assert('You cannot index an internalModel by an empty id\'', id));
|
1951
|
+
(false && Ember.assert('You cannot set an index for an internalModel to something other than an internalModel', internalModel instanceof _internalModel.default));
|
1952
|
+
(false && Ember.assert('You cannot set an index for an internalModel that is not in the InternalModelMap', this.contains(internalModel)));
|
1953
|
+
(false && Ember.assert('You cannot update the id index of an InternalModel once set. Attempted to update ' + id + '.', !this.has(id) || this.get(id) === internalModel));
|
1954
|
+
|
1987
1955
|
|
1988
1956
|
this._idToModel[id] = internalModel;
|
1989
1957
|
};
|
1990
1958
|
|
1991
1959
|
InternalModelMap.prototype.add = function add(internalModel, id) {
|
1992
|
-
(
|
1960
|
+
(false && Ember.assert('You cannot re-add an already present InternalModel to the InternalModelMap.', !this.contains(internalModel)));
|
1961
|
+
|
1993
1962
|
|
1994
1963
|
if (id) {
|
1995
1964
|
this._idToModel[id] = internalModel;
|
@@ -2036,10 +2005,11 @@ define('ember-data/-private/system/internal-model-map', ['exports', 'ember-data/
|
|
2036
2005
|
_createClass(InternalModelMap, [{
|
2037
2006
|
key: 'idToRecord',
|
2038
2007
|
get: function () {
|
2039
|
-
(
|
2008
|
+
(false && !(false) && Ember.deprecate('Use of InternalModelMap.idToRecord is deprecated, use InternalModelMap.get(id) instead.', false, {
|
2040
2009
|
id: 'ds.record-map.idToRecord',
|
2041
2010
|
until: '2.13'
|
2042
|
-
});
|
2011
|
+
}));
|
2012
|
+
|
2043
2013
|
return this._idToModel;
|
2044
2014
|
}
|
2045
2015
|
}, {
|
@@ -2107,7 +2077,7 @@ define('ember-data/-private/system/is-array-like', ['exports', 'ember'], functio
|
|
2107
2077
|
return false;
|
2108
2078
|
}
|
2109
2079
|
});
|
2110
|
-
define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data/-
|
2080
|
+
define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _ember, _promiseProxies, _common, _diffArray) {
|
2111
2081
|
'use strict';
|
2112
2082
|
|
2113
2083
|
exports.__esModule = true;
|
@@ -2328,7 +2298,8 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
|
|
2328
2298
|
var store = get(this, 'store');
|
2329
2299
|
var type = get(this, 'type');
|
2330
2300
|
|
2331
|
-
(
|
2301
|
+
(false && _ember.default.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic')));
|
2302
|
+
|
2332
2303
|
var record = store.createRecord(type.modelName, hash);
|
2333
2304
|
this.pushObject(record);
|
2334
2305
|
|
@@ -2336,7 +2307,7 @@ define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data
|
|
2336
2307
|
}
|
2337
2308
|
});
|
2338
2309
|
});
|
2339
|
-
define('ember-data/-private/system/model/errors', ['exports', 'ember'
|
2310
|
+
define('ember-data/-private/system/model/errors', ['exports', 'ember'], function (exports, _ember) {
|
2340
2311
|
'use strict';
|
2341
2312
|
|
2342
2313
|
exports.__esModule = true;
|
@@ -2438,10 +2409,11 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2438
2409
|
@deprecated
|
2439
2410
|
*/
|
2440
2411
|
registerHandlers: function (target, becameInvalid, becameValid) {
|
2441
|
-
(
|
2412
|
+
(false && !(false) && _ember.default.deprecate('Record errors will no longer be evented.', false, {
|
2442
2413
|
id: 'ds.errors.registerHandlers',
|
2443
2414
|
until: '3.0.0'
|
2444
|
-
});
|
2415
|
+
}));
|
2416
|
+
|
2445
2417
|
|
2446
2418
|
this._registerHandlers(target, becameInvalid, becameValid);
|
2447
2419
|
},
|
@@ -2558,9 +2530,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2558
2530
|
@deprecated
|
2559
2531
|
*/
|
2560
2532
|
add: function (attribute, messages) {
|
2561
|
-
(
|
2533
|
+
(false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2562
2534
|
id: 'ds.errors.add'
|
2563
|
-
});
|
2535
|
+
}));
|
2536
|
+
|
2564
2537
|
|
2565
2538
|
var wasEmpty = get(this, 'isEmpty');
|
2566
2539
|
|
@@ -2642,9 +2615,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2642
2615
|
@deprecated
|
2643
2616
|
*/
|
2644
2617
|
remove: function (attribute) {
|
2645
|
-
(
|
2618
|
+
(false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2646
2619
|
id: 'ds.errors.remove'
|
2647
|
-
});
|
2620
|
+
}));
|
2621
|
+
|
2648
2622
|
|
2649
2623
|
if (get(this, 'isEmpty')) {
|
2650
2624
|
return;
|
@@ -2695,9 +2669,10 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2695
2669
|
@deprecated
|
2696
2670
|
*/
|
2697
2671
|
clear: function () {
|
2698
|
-
(
|
2672
|
+
(false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, {
|
2699
2673
|
id: 'ds.errors.clear'
|
2700
|
-
});
|
2674
|
+
}));
|
2675
|
+
|
2701
2676
|
|
2702
2677
|
if (get(this, 'isEmpty')) {
|
2703
2678
|
return;
|
@@ -2759,7 +2734,7 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2759
2734
|
}
|
2760
2735
|
});
|
2761
2736
|
});
|
2762
|
-
define('ember-data/-private/system/model/internal-model', ['exports', 'ember', 'ember-data/-
|
2737
|
+
define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '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, _ember, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) {
|
2763
2738
|
'use strict';
|
2764
2739
|
|
2765
2740
|
exports.__esModule = true;
|
@@ -2836,14 +2811,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
2836
2811
|
return true;
|
2837
2812
|
}
|
2838
2813
|
|
2839
|
-
function destroyRelationship(rel) {
|
2840
|
-
if (rel._inverseIsAsync()) {
|
2841
|
-
rel.removeInternalModelFromInverse(rel.inverseInternalModel);
|
2842
|
-
rel.removeInverseRelationships();
|
2843
|
-
} else {
|
2844
|
-
rel.removeCompletelyFromInverse();
|
2845
|
-
}
|
2846
|
-
}
|
2847
2814
|
// this (and all heimdall instrumentation) will be stripped by a babel transform
|
2848
2815
|
// https://github.com/heimdalljs/babel5-plugin-strip-heimdall
|
2849
2816
|
|
@@ -3060,9 +3027,17 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3060
3027
|
};
|
3061
3028
|
|
3062
3029
|
InternalModel.prototype._directlyRelatedInternalModels = function _directlyRelatedInternalModels() {
|
3030
|
+
var _this = this;
|
3031
|
+
|
3063
3032
|
var array = [];
|
3064
|
-
this.
|
3065
|
-
|
3033
|
+
this.type.eachRelationship(function (key, relationship) {
|
3034
|
+
if (_this._relationships.has(key)) {
|
3035
|
+
var _relationship = _this._relationships.get(key);
|
3036
|
+
var localRelationships = _relationship.members.toArray();
|
3037
|
+
var serverRelationships = _relationship.canonicalMembers.toArray();
|
3038
|
+
|
3039
|
+
array = array.concat(localRelationships, serverRelationships);
|
3040
|
+
}
|
3066
3041
|
});
|
3067
3042
|
return array;
|
3068
3043
|
};
|
@@ -3079,7 +3054,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3079
3054
|
var related = node._directlyRelatedInternalModels();
|
3080
3055
|
for (var i = 0; i < related.length; ++i) {
|
3081
3056
|
var internalModel = related[i];
|
3082
|
-
(
|
3057
|
+
(false && _ember.default.assert('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId));
|
3058
|
+
|
3083
3059
|
if (internalModel._bfsId < bfsId) {
|
3084
3060
|
queue.push(internalModel);
|
3085
3061
|
internalModel._bfsId = bfsId;
|
@@ -3090,43 +3066,22 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3090
3066
|
};
|
3091
3067
|
|
3092
3068
|
InternalModel.prototype.unloadRecord = function unloadRecord() {
|
3093
|
-
if (this.isDestroyed) {
|
3094
|
-
return;
|
3095
|
-
}
|
3096
3069
|
this.send('unloadRecord');
|
3097
3070
|
this.dematerializeRecord();
|
3098
|
-
|
3099
3071
|
if (this._scheduledDestroy === null) {
|
3100
3072
|
this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
|
3101
3073
|
}
|
3102
3074
|
};
|
3103
3075
|
|
3104
|
-
InternalModel.prototype.hasScheduledDestroy = function hasScheduledDestroy() {
|
3105
|
-
return !!this._scheduledDestroy;
|
3106
|
-
};
|
3107
|
-
|
3108
3076
|
InternalModel.prototype.cancelDestroy = function cancelDestroy() {
|
3109
|
-
(
|
3077
|
+
(false && _ember.default.assert('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed));
|
3078
|
+
|
3110
3079
|
|
3111
3080
|
this._isDematerializing = false;
|
3112
3081
|
run.cancel(this._scheduledDestroy);
|
3113
3082
|
this._scheduledDestroy = null;
|
3114
3083
|
};
|
3115
3084
|
|
3116
|
-
InternalModel.prototype.destroySync = function destroySync() {
|
3117
|
-
if (this._isDematerializing) {
|
3118
|
-
this.cancelDestroy();
|
3119
|
-
}
|
3120
|
-
this._checkForOrphanedInternalModels();
|
3121
|
-
if (this.isDestroyed || this.isDestroying) {
|
3122
|
-
return;
|
3123
|
-
}
|
3124
|
-
|
3125
|
-
// just in-case we are not one of the orphaned, we should still
|
3126
|
-
// still destroy ourselves
|
3127
|
-
this.destroy();
|
3128
|
-
};
|
3129
|
-
|
3130
3085
|
InternalModel.prototype._checkForOrphanedInternalModels = function _checkForOrphanedInternalModels() {
|
3131
3086
|
this._isDematerializing = false;
|
3132
3087
|
this._scheduledDestroy = null;
|
@@ -3154,14 +3109,10 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3154
3109
|
};
|
3155
3110
|
|
3156
3111
|
InternalModel.prototype.destroy = function destroy() {
|
3157
|
-
(
|
3158
|
-
|
3159
|
-
this.store._internalModelDestroyed(this);
|
3112
|
+
(false && _ember.default.assert("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying')));
|
3160
3113
|
|
3161
|
-
this._relationships.forEach(function (name, rel) {
|
3162
|
-
return rel.destroy();
|
3163
|
-
});
|
3164
3114
|
|
3115
|
+
this.store._internalModelDestroyed(this);
|
3165
3116
|
this._isDestroyed = true;
|
3166
3117
|
};
|
3167
3118
|
|
@@ -3290,6 +3241,12 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3290
3241
|
}
|
3291
3242
|
};
|
3292
3243
|
|
3244
|
+
InternalModel.prototype.notifyHasManyRemoved = function notifyHasManyRemoved(key, record, idx) {
|
3245
|
+
if (this.hasRecord) {
|
3246
|
+
this._record.notifyHasManyRemoved(key, record, idx);
|
3247
|
+
}
|
3248
|
+
};
|
3249
|
+
|
3293
3250
|
InternalModel.prototype.notifyBelongsToChanged = function notifyBelongsToChanged(key, record) {
|
3294
3251
|
if (this.hasRecord) {
|
3295
3252
|
this._record.notifyBelongsToChanged(key, record);
|
@@ -3323,7 +3280,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3323
3280
|
}
|
3324
3281
|
|
3325
3282
|
if (this.isNew()) {
|
3326
|
-
this.
|
3283
|
+
this.clearRelationships();
|
3327
3284
|
}
|
3328
3285
|
|
3329
3286
|
if (this.isValid()) {
|
@@ -3439,57 +3396,47 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3439
3396
|
triggers.length = 0;
|
3440
3397
|
};
|
3441
3398
|
|
3442
|
-
InternalModel.prototype.
|
3443
|
-
var
|
3399
|
+
InternalModel.prototype.clearRelationships = function clearRelationships() {
|
3400
|
+
var _this2 = this;
|
3444
3401
|
|
3445
|
-
this.
|
3446
|
-
|
3447
|
-
|
3402
|
+
this.eachRelationship(function (name, relationship) {
|
3403
|
+
if (_this2._relationships.has(name)) {
|
3404
|
+
var rel = _this2._relationships.get(name);
|
3448
3405
|
rel.clear();
|
3406
|
+
rel.removeInverseRelationships();
|
3449
3407
|
}
|
3450
3408
|
});
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
Object.keys(implicitRelationships).forEach(function (key) {
|
3456
|
-
var rel = implicitRelationships[key];
|
3457
|
-
|
3458
|
-
rel.removeCompletelyFromInverse();
|
3459
|
-
if (isNew === true) {
|
3460
|
-
rel.clear();
|
3461
|
-
}
|
3409
|
+
Object.keys(this._implicitRelationships).forEach(function (key) {
|
3410
|
+
_this2._implicitRelationships[key].clear();
|
3411
|
+
_this2._implicitRelationships[key].removeInverseRelationships();
|
3462
3412
|
});
|
3463
3413
|
};
|
3464
3414
|
|
3465
3415
|
InternalModel.prototype.destroyRelationships = function destroyRelationships() {
|
3466
|
-
var
|
3467
|
-
relationships.forEach(function (name, rel) {
|
3468
|
-
return destroyRelationship(rel);
|
3469
|
-
});
|
3470
|
-
|
3471
|
-
var implicitRelationships = this._implicitRelationships;
|
3472
|
-
this.__implicitRelationships = null;
|
3473
|
-
Object.keys(implicitRelationships).forEach(function (key) {
|
3474
|
-
var rel = implicitRelationships[key];
|
3475
|
-
|
3476
|
-
destroyRelationship(rel);
|
3416
|
+
var _this3 = this;
|
3477
3417
|
|
3478
|
-
|
3418
|
+
this.eachRelationship(function (name, relationship) {
|
3419
|
+
if (_this3._relationships.has(name)) {
|
3420
|
+
var rel = _this3._relationships.get(name);
|
3421
|
+
rel.removeInverseRelationships();
|
3422
|
+
}
|
3423
|
+
});
|
3424
|
+
Object.keys(this._implicitRelationships).forEach(function (key) {
|
3425
|
+
_this3._implicitRelationships[key].removeInverseRelationships();
|
3479
3426
|
});
|
3480
3427
|
};
|
3481
3428
|
|
3482
3429
|
InternalModel.prototype.preloadData = function preloadData(preload) {
|
3483
|
-
var
|
3430
|
+
var _this4 = this;
|
3484
3431
|
|
3485
3432
|
//TODO(Igor) consider the polymorphic case
|
3486
3433
|
Object.keys(preload).forEach(function (key) {
|
3487
3434
|
var preloadValue = get(preload, key);
|
3488
|
-
var relationshipMeta =
|
3435
|
+
var relationshipMeta = _this4.modelClass.metaForProperty(key);
|
3489
3436
|
if (relationshipMeta.isRelationship) {
|
3490
|
-
|
3437
|
+
_this4._preloadRelationship(key, preloadValue);
|
3491
3438
|
} else {
|
3492
|
-
|
3439
|
+
_this4._data[key] = preloadValue;
|
3493
3440
|
}
|
3494
3441
|
});
|
3495
3442
|
};
|
@@ -3505,7 +3452,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3505
3452
|
};
|
3506
3453
|
|
3507
3454
|
InternalModel.prototype._preloadHasMany = function _preloadHasMany(key, preloadValue, modelClass) {
|
3508
|
-
(
|
3455
|
+
(false && _ember.default.assert("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue)));
|
3456
|
+
|
3509
3457
|
var recordsToSet = new Array(preloadValue.length);
|
3510
3458
|
|
3511
3459
|
for (var i = 0; i < preloadValue.length; i++) {
|
@@ -3541,7 +3489,8 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3541
3489
|
};
|
3542
3490
|
|
3543
3491
|
InternalModel.prototype.setId = function setId(id) {
|
3544
|
-
(
|
3492
|
+
(false && _ember.default.assert('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew()));
|
3493
|
+
|
3545
3494
|
this.id = id;
|
3546
3495
|
if (this._record.get('id') !== id) {
|
3547
3496
|
this._record.set('id', id);
|
@@ -3695,20 +3644,19 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3695
3644
|
};
|
3696
3645
|
|
3697
3646
|
InternalModel.prototype.referenceFor = function referenceFor(kind, name) {
|
3698
|
-
var _this2 = this;
|
3699
|
-
|
3700
3647
|
var reference = this.references[name];
|
3701
3648
|
|
3702
3649
|
if (!reference) {
|
3703
3650
|
var relationship = this._relationships.get(name);
|
3704
3651
|
|
3705
|
-
|
3706
|
-
var modelName =
|
3707
|
-
(
|
3652
|
+
if (false) {
|
3653
|
+
var modelName = this.modelName;
|
3654
|
+
(false && _ember.default.assert('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship));
|
3655
|
+
|
3708
3656
|
|
3709
3657
|
var actualRelationshipKind = relationship.relationshipMeta.kind;
|
3710
|
-
(
|
3711
|
-
}
|
3658
|
+
(false && _ember.default.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));
|
3659
|
+
}
|
3712
3660
|
|
3713
3661
|
if (kind === "belongsTo") {
|
3714
3662
|
reference = new _references.BelongsToReference(this.store, this, relationship);
|
@@ -3848,7 +3796,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3848
3796
|
};
|
3849
3797
|
}
|
3850
3798
|
});
|
3851
|
-
define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-data/-
|
3799
|
+
define('ember-data/-private/system/model/model', ['exports', 'ember', '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, _ember, _promiseProxies, _errors, _features, _states, _ext) {
|
3852
3800
|
'use strict';
|
3853
3801
|
|
3854
3802
|
exports.__esModule = true;
|
@@ -4344,7 +4292,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4344
4292
|
this._super.apply(this, arguments);
|
4345
4293
|
},
|
4346
4294
|
attr: function () {
|
4347
|
-
(
|
4295
|
+
(false && _ember.default.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));
|
4348
4296
|
},
|
4349
4297
|
belongsTo: function (name) {
|
4350
4298
|
return this._internalModel.referenceFor('belongsTo', name);
|
@@ -4439,7 +4387,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4439
4387
|
}
|
4440
4388
|
});
|
4441
4389
|
|
4442
|
-
|
4390
|
+
if (false) {
|
4443
4391
|
Model.reopen({
|
4444
4392
|
init: function () {
|
4445
4393
|
this._super.apply(this, arguments);
|
@@ -4449,7 +4397,7 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4449
4397
|
}
|
4450
4398
|
}
|
4451
4399
|
});
|
4452
|
-
}
|
4400
|
+
}
|
4453
4401
|
|
4454
4402
|
Model.reopenClass({
|
4455
4403
|
isModel: true,
|
@@ -4544,15 +4492,16 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4544
4492
|
inverseName = options.inverse;
|
4545
4493
|
inverse = _ember.default.get(inverseType, 'relationshipsByName').get(inverseName);
|
4546
4494
|
|
4547
|
-
(
|
4495
|
+
(false && _ember.default.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.", !_ember.default.isNone(inverse)));
|
4496
|
+
|
4548
4497
|
|
4549
4498
|
inverseKind = inverse.kind;
|
4550
4499
|
} else {
|
4551
4500
|
//No inverse was specified manually, we need to use a heuristic to guess one
|
4552
4501
|
if (propertyMeta.parentType && propertyMeta.type === propertyMeta.parentType.modelName) {
|
4553
|
-
(
|
4502
|
+
(false && _ember.default.warn('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at http://emberjs.com/guides/models/defining-models/#toc_reflexive-relation for how to explicitly specify inverses.', false, {
|
4554
4503
|
id: 'ds.model.reflexive-relationship-without-inverse'
|
4555
|
-
});
|
4504
|
+
}));
|
4556
4505
|
}
|
4557
4506
|
|
4558
4507
|
var possibleRelationships = findPossibleInverses(this, inverseType, name);
|
@@ -4566,13 +4515,15 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4566
4515
|
return name === optionsForRelationship.inverse;
|
4567
4516
|
});
|
4568
4517
|
|
4569
|
-
(
|
4518
|
+
(false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2));
|
4519
|
+
|
4570
4520
|
|
4571
4521
|
if (filteredRelationships.length === 1) {
|
4572
4522
|
possibleRelationships = filteredRelationships;
|
4573
4523
|
}
|
4574
4524
|
|
4575
|
-
(
|
4525
|
+
(false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1));
|
4526
|
+
|
4576
4527
|
|
4577
4528
|
inverseName = possibleRelationships[0].name;
|
4578
4529
|
inverseKind = possibleRelationships[0].kind;
|
@@ -4839,7 +4790,8 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4839
4790
|
|
4840
4791
|
this.eachComputedProperty(function (name, meta) {
|
4841
4792
|
if (meta.isAttribute) {
|
4842
|
-
(
|
4793
|
+
(false && _ember.default.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'));
|
4794
|
+
|
4843
4795
|
|
4844
4796
|
meta.name = name;
|
4845
4797
|
map.set(name, meta);
|
@@ -4913,7 +4865,8 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4913
4865
|
configurable: true,
|
4914
4866
|
enumerable: false,
|
4915
4867
|
get: function () {
|
4916
|
-
(
|
4868
|
+
(false && !(false) && _ember.default.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' }));
|
4869
|
+
|
4917
4870
|
|
4918
4871
|
return this.store.container;
|
4919
4872
|
}
|
@@ -4930,12 +4883,12 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4930
4883
|
});
|
4931
4884
|
}
|
4932
4885
|
|
4933
|
-
|
4886
|
+
if (false) {
|
4934
4887
|
Model.reopen({
|
4935
4888
|
willMergeMixin: function (props) {
|
4936
4889
|
var constructor = this.constructor;
|
4937
|
-
(
|
4938
|
-
(
|
4890
|
+
(false && _ember.default.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]));
|
4891
|
+
(false && _ember.default.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));
|
4939
4892
|
},
|
4940
4893
|
didDefineProperty: function (proto, key, value) {
|
4941
4894
|
// Check if the value being set is a computed property.
|
@@ -4950,11 +4903,11 @@ define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-dat
|
|
4950
4903
|
}
|
4951
4904
|
}
|
4952
4905
|
});
|
4953
|
-
}
|
4906
|
+
}
|
4954
4907
|
|
4955
4908
|
exports.default = Model;
|
4956
4909
|
});
|
4957
|
-
define('ember-data/-private/system/model/states', ['exports'
|
4910
|
+
define('ember-data/-private/system/model/states', ['exports'], function (exports) {
|
4958
4911
|
'use strict';
|
4959
4912
|
|
4960
4913
|
exports.__esModule = true;
|
@@ -5371,7 +5324,7 @@ define('ember-data/-private/system/model/states', ['exports', 'ember-data/-debug
|
|
5371
5324
|
createdState.uncommitted.propertyWasReset = function () {};
|
5372
5325
|
|
5373
5326
|
function assertAgainstUnloadRecord(internalModel) {
|
5374
|
-
(
|
5327
|
+
(false && Ember.assert("You can only unload a record which is not inFlight. `" + internalModel + "`", false));
|
5375
5328
|
}
|
5376
5329
|
|
5377
5330
|
updatedState.inFlight.unloadRecord = assertAgainstUnloadRecord;
|
@@ -5578,7 +5531,7 @@ define('ember-data/-private/system/model/states', ['exports', 'ember-data/-debug
|
|
5578
5531
|
isDirty: false,
|
5579
5532
|
|
5580
5533
|
setup: function (internalModel) {
|
5581
|
-
internalModel.
|
5534
|
+
internalModel.clearRelationships();
|
5582
5535
|
},
|
5583
5536
|
invokeLifecycleCallbacks: function (internalModel) {
|
5584
5537
|
internalModel.triggerLater('didDelete', internalModel);
|
@@ -5742,7 +5695,7 @@ define('ember-data/-private/system/ordered-set', ['exports', 'ember'], function
|
|
5742
5695
|
return this;
|
5743
5696
|
};
|
5744
5697
|
});
|
5745
|
-
define('ember-data/-private/system/promise-proxies', ['exports', 'ember'
|
5698
|
+
define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], function (exports, _ember) {
|
5746
5699
|
'use strict';
|
5747
5700
|
|
5748
5701
|
exports.__esModule = true;
|
@@ -5857,7 +5810,8 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember
|
|
5857
5810
|
|
5858
5811
|
var PromiseManyArray = exports.PromiseManyArray = PromiseArray.extend({
|
5859
5812
|
reload: function () {
|
5860
|
-
(
|
5813
|
+
(false && _ember.default.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content')));
|
5814
|
+
|
5861
5815
|
this.set('promise', this.get('content').reload());
|
5862
5816
|
return this;
|
5863
5817
|
},
|
@@ -5882,10 +5836,11 @@ define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember
|
|
5882
5836
|
});
|
5883
5837
|
}
|
5884
5838
|
});
|
5885
|
-
define(
|
5886
|
-
|
5839
|
+
define("ember-data/-private/system/record-array-manager", ["exports", "ember", "ember-data/-private/system/record-arrays", "ember-data/-private/system/clone-null"], function (exports, _ember, _recordArrays, _cloneNull) {
|
5840
|
+
"use strict";
|
5887
5841
|
|
5888
5842
|
exports.__esModule = true;
|
5843
|
+
exports.associateWithRecordArray = associateWithRecordArray;
|
5889
5844
|
|
5890
5845
|
function _classCallCheck(instance, Constructor) {
|
5891
5846
|
if (!(instance instanceof Constructor)) {
|
@@ -5894,6 +5849,7 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
5894
5849
|
}
|
5895
5850
|
|
5896
5851
|
var get = _ember.default.get,
|
5852
|
+
set = _ember.default.set,
|
5897
5853
|
emberRun = _ember.default.run;
|
5898
5854
|
|
5899
5855
|
var RecordArrayManager = function () {
|
@@ -5967,63 +5923,22 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
5967
5923
|
}
|
5968
5924
|
}
|
5969
5925
|
|
5970
|
-
|
5971
|
-
|
5972
|
-
|
5973
|
-
|
5926
|
+
var array = this._liveRecordArrays[modelName];
|
5927
|
+
if (array) {
|
5928
|
+
// TODO: skip if it only changed
|
5929
|
+
// process liveRecordArrays
|
5930
|
+
this.updateLiveRecordArray(array, internalModels);
|
5974
5931
|
}
|
5975
5932
|
|
5976
5933
|
// process adapterPopulatedRecordArrays
|
5977
5934
|
if (modelsToRemove.length > 0) {
|
5978
|
-
|
5979
|
-
}
|
5980
|
-
}
|
5981
|
-
};
|
5982
|
-
|
5983
|
-
RecordArrayManager.prototype.updateLiveRecordArray = function updateLiveRecordArray(modelName, internalModels) {
|
5984
|
-
var array = this.liveRecordArrayFor(modelName);
|
5985
|
-
|
5986
|
-
var modelsToAdd = [];
|
5987
|
-
var modelsToRemove = [];
|
5988
|
-
|
5989
|
-
for (var i = 0; i < internalModels.length; i++) {
|
5990
|
-
var internalModel = internalModels[i];
|
5991
|
-
var isDeleted = internalModel.isHiddenFromRecordArrays();
|
5992
|
-
var recordArrays = internalModel._recordArrays;
|
5993
|
-
|
5994
|
-
if (!isDeleted && !internalModel.isEmpty()) {
|
5995
|
-
if (!recordArrays.has(array)) {
|
5996
|
-
modelsToAdd.push(internalModel);
|
5997
|
-
recordArrays.add(array);
|
5998
|
-
}
|
5999
|
-
}
|
6000
|
-
|
6001
|
-
if (isDeleted) {
|
6002
|
-
modelsToRemove.push(internalModel);
|
6003
|
-
recordArrays.delete(array);
|
5935
|
+
removeFromAdapterPopulatedRecordArrays(modelsToRemove);
|
6004
5936
|
}
|
6005
5937
|
}
|
6006
|
-
|
6007
|
-
if (modelsToAdd.length > 0) {
|
6008
|
-
array._pushInternalModels(modelsToAdd);
|
6009
|
-
}
|
6010
|
-
if (modelsToRemove.length > 0) {
|
6011
|
-
array._removeInternalModels(modelsToRemove);
|
6012
|
-
}
|
6013
5938
|
};
|
6014
5939
|
|
6015
|
-
RecordArrayManager.prototype.
|
6016
|
-
|
6017
|
-
var internalModel = internalModels[i];
|
6018
|
-
var list = internalModel._recordArrays.list;
|
6019
|
-
|
6020
|
-
for (var j = 0; j < list.length; j++) {
|
6021
|
-
// TODO: group by arrays, so we can batch remove
|
6022
|
-
list[j]._removeInternalModels([internalModel]);
|
6023
|
-
}
|
6024
|
-
|
6025
|
-
internalModel._recordArrays.clear();
|
6026
|
-
}
|
5940
|
+
RecordArrayManager.prototype.updateLiveRecordArray = function updateLiveRecordArray(array, internalModels) {
|
5941
|
+
return _updateLiveRecordArray(array, internalModels);
|
6027
5942
|
};
|
6028
5943
|
|
6029
5944
|
RecordArrayManager.prototype.updateFilterRecordArray = function updateFilterRecordArray(array, modelName, internalModels) {
|
@@ -6056,8 +5971,9 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6056
5971
|
}
|
6057
5972
|
};
|
6058
5973
|
|
6059
|
-
RecordArrayManager.prototype.
|
6060
|
-
(
|
5974
|
+
RecordArrayManager.prototype._syncLiveRecordArray = function _syncLiveRecordArray(array, modelName) {
|
5975
|
+
(false && _ember.default.assert("recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param", typeof modelName === 'string'));
|
5976
|
+
|
6061
5977
|
var hasNoPotentialDeletions = Object.keys(this._pending).length === 0;
|
6062
5978
|
var map = this.store._internalModelsFor(modelName);
|
6063
5979
|
var hasNoInsertionsOrRemovals = get(map, 'length') === get(array, 'length');
|
@@ -6067,27 +5983,19 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6067
5983
|
liveRecordArrays, and is capable of strategically flushing those changes and applying
|
6068
5984
|
small diffs if desired. However, until we've refactored recordArrayManager, this dirty
|
6069
5985
|
check prevents us from unnecessarily wiping out live record arrays returned by peekAll.
|
6070
|
-
|
5986
|
+
*/
|
6071
5987
|
if (hasNoPotentialDeletions && hasNoInsertionsOrRemovals) {
|
6072
5988
|
return;
|
6073
5989
|
}
|
6074
5990
|
|
6075
|
-
this.
|
6076
|
-
};
|
6077
|
-
|
6078
|
-
RecordArrayManager.prototype.populateLiveRecordArray = function populateLiveRecordArray(array, internalModels) {
|
6079
|
-
|
5991
|
+
var internalModels = this._visibleInternalModelsByType(modelName);
|
6080
5992
|
var modelsToAdd = [];
|
6081
5993
|
for (var i = 0; i < internalModels.length; i++) {
|
6082
5994
|
var internalModel = internalModels[i];
|
6083
|
-
|
6084
|
-
if (
|
6085
|
-
|
6086
|
-
|
6087
|
-
if (!recordArrays.has(array)) {
|
6088
|
-
modelsToAdd.push(internalModel);
|
6089
|
-
recordArrays.add(array);
|
6090
|
-
}
|
5995
|
+
var recordArrays = internalModel._recordArrays;
|
5996
|
+
if (recordArrays.has(array) === false) {
|
5997
|
+
recordArrays.add(array);
|
5998
|
+
modelsToAdd.push(internalModel);
|
6091
5999
|
}
|
6092
6000
|
}
|
6093
6001
|
|
@@ -6095,7 +6003,7 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6095
6003
|
};
|
6096
6004
|
|
6097
6005
|
RecordArrayManager.prototype.updateFilter = function updateFilter(array, modelName, filter) {
|
6098
|
-
(
|
6006
|
+
(false && _ember.default.assert("recordArrayManger.updateFilter expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string'));
|
6099
6007
|
|
6100
6008
|
var modelMap = this.store._internalModelsFor(modelName);
|
6101
6009
|
var internalModels = modelMap.models;
|
@@ -6103,32 +6011,73 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6103
6011
|
this.updateFilterRecordArray(array, filter, internalModels);
|
6104
6012
|
};
|
6105
6013
|
|
6014
|
+
RecordArrayManager.prototype._didUpdateAll = function _didUpdateAll(modelName) {
|
6015
|
+
var recordArray = this._liveRecordArrays[modelName];
|
6016
|
+
if (recordArray) {
|
6017
|
+
set(recordArray, 'isUpdating', false);
|
6018
|
+
}
|
6019
|
+
};
|
6020
|
+
|
6106
6021
|
RecordArrayManager.prototype.liveRecordArrayFor = function liveRecordArrayFor(modelName) {
|
6107
|
-
(
|
6022
|
+
(false && _ember.default.assert("recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param", typeof modelName === 'string'));
|
6023
|
+
|
6024
|
+
|
6025
|
+
var array = this._liveRecordArrays[modelName];
|
6026
|
+
|
6027
|
+
if (array) {
|
6028
|
+
// if the array already exists, synchronize
|
6029
|
+
this._syncLiveRecordArray(array, modelName);
|
6030
|
+
} else {
|
6031
|
+
// if the array is being newly created merely create it with its initial
|
6032
|
+
// content already set. This prevents unneeded change events.
|
6033
|
+
var internalModels = this._visibleInternalModelsByType(modelName);
|
6034
|
+
array = this.createRecordArray(modelName, internalModels);
|
6035
|
+
this._liveRecordArrays[modelName] = array;
|
6036
|
+
}
|
6037
|
+
|
6038
|
+
return array;
|
6039
|
+
};
|
6108
6040
|
|
6109
|
-
|
6041
|
+
RecordArrayManager.prototype._visibleInternalModelsByType = function _visibleInternalModelsByType(modelName) {
|
6042
|
+
var all = this.store._internalModelsFor(modelName)._models;
|
6043
|
+
var visible = [];
|
6044
|
+
for (var i = 0; i < all.length; i++) {
|
6045
|
+
var model = all[i];
|
6046
|
+
if (model.isHiddenFromRecordArrays() === false) {
|
6047
|
+
visible.push(model);
|
6048
|
+
}
|
6049
|
+
}
|
6050
|
+
return visible;
|
6110
6051
|
};
|
6111
6052
|
|
6112
6053
|
RecordArrayManager.prototype.filteredRecordArraysFor = function filteredRecordArraysFor(modelName) {
|
6113
|
-
(
|
6054
|
+
(false && _ember.default.assert("recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param", typeof modelName === 'string'));
|
6055
|
+
|
6114
6056
|
|
6115
6057
|
return this._filteredRecordArrays[modelName] || (this._filteredRecordArrays[modelName] = []);
|
6116
6058
|
};
|
6117
6059
|
|
6118
|
-
RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName) {
|
6119
|
-
(
|
6060
|
+
RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName, content) {
|
6061
|
+
(false && _ember.default.assert("recordArrayManger.createRecordArray expects modelName not modelClass as the param", typeof modelName === 'string'));
|
6120
6062
|
|
6121
|
-
|
6063
|
+
|
6064
|
+
var array = _recordArrays.RecordArray.create({
|
6122
6065
|
modelName: modelName,
|
6123
|
-
content: _ember.default.A(),
|
6066
|
+
content: _ember.default.A(content || []),
|
6124
6067
|
store: this.store,
|
6125
6068
|
isLoaded: true,
|
6126
6069
|
manager: this
|
6127
6070
|
});
|
6071
|
+
|
6072
|
+
if (Array.isArray(content)) {
|
6073
|
+
associateWithRecordArray(content, array);
|
6074
|
+
}
|
6075
|
+
|
6076
|
+
return array;
|
6128
6077
|
};
|
6129
6078
|
|
6130
6079
|
RecordArrayManager.prototype.createFilteredRecordArray = function createFilteredRecordArray(modelName, filter, query) {
|
6131
|
-
(
|
6080
|
+
(false && _ember.default.assert("recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string'));
|
6132
6081
|
|
6133
6082
|
var array = _recordArrays.FilteredRecordArray.create({
|
6134
6083
|
query: query,
|
@@ -6144,16 +6093,34 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6144
6093
|
return array;
|
6145
6094
|
};
|
6146
6095
|
|
6147
|
-
RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query) {
|
6148
|
-
(
|
6096
|
+
RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query, internalModels, payload) {
|
6097
|
+
(false && _ember.default.assert("recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string'));
|
6149
6098
|
|
6150
|
-
|
6151
|
-
|
6152
|
-
|
6153
|
-
|
6154
|
-
|
6155
|
-
|
6156
|
-
|
6099
|
+
|
6100
|
+
var array = void 0;
|
6101
|
+
if (Array.isArray(internalModels)) {
|
6102
|
+
array = _recordArrays.AdapterPopulatedRecordArray.create({
|
6103
|
+
modelName: modelName,
|
6104
|
+
query: query,
|
6105
|
+
content: _ember.default.A(internalModels),
|
6106
|
+
store: this.store,
|
6107
|
+
manager: this,
|
6108
|
+
isLoaded: true,
|
6109
|
+
isUpdating: false,
|
6110
|
+
meta: (0, _cloneNull.default)(payload.meta),
|
6111
|
+
links: (0, _cloneNull.default)(payload.links)
|
6112
|
+
});
|
6113
|
+
|
6114
|
+
associateWithRecordArray(internalModels, array);
|
6115
|
+
} else {
|
6116
|
+
array = _recordArrays.AdapterPopulatedRecordArray.create({
|
6117
|
+
modelName: modelName,
|
6118
|
+
query: query,
|
6119
|
+
content: _ember.default.A(),
|
6120
|
+
store: this.store,
|
6121
|
+
manager: this
|
6122
|
+
});
|
6123
|
+
}
|
6157
6124
|
|
6158
6125
|
this._adapterPopulatedRecordArrays.push(array);
|
6159
6126
|
|
@@ -6161,7 +6128,8 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6161
6128
|
};
|
6162
6129
|
|
6163
6130
|
RecordArrayManager.prototype.registerFilteredRecordArray = function registerFilteredRecordArray(array, modelName, filter) {
|
6164
|
-
(
|
6131
|
+
(false && _ember.default.assert("recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string'));
|
6132
|
+
|
6165
6133
|
|
6166
6134
|
this.filteredRecordArraysFor(modelName).push(array);
|
6167
6135
|
this.updateFilter(array, modelName, filter);
|
@@ -6239,6 +6207,57 @@ define('ember-data/-private/system/record-array-manager', ['exports', 'ember', '
|
|
6239
6207
|
|
6240
6208
|
return false;
|
6241
6209
|
}
|
6210
|
+
|
6211
|
+
function _updateLiveRecordArray(array, internalModels) {
|
6212
|
+
var modelsToAdd = [];
|
6213
|
+
var modelsToRemove = [];
|
6214
|
+
|
6215
|
+
for (var i = 0; i < internalModels.length; i++) {
|
6216
|
+
var internalModel = internalModels[i];
|
6217
|
+
var isDeleted = internalModel.isHiddenFromRecordArrays();
|
6218
|
+
var recordArrays = internalModel._recordArrays;
|
6219
|
+
|
6220
|
+
if (!isDeleted && !internalModel.isEmpty()) {
|
6221
|
+
if (!recordArrays.has(array)) {
|
6222
|
+
modelsToAdd.push(internalModel);
|
6223
|
+
recordArrays.add(array);
|
6224
|
+
}
|
6225
|
+
}
|
6226
|
+
|
6227
|
+
if (isDeleted) {
|
6228
|
+
modelsToRemove.push(internalModel);
|
6229
|
+
recordArrays.delete(array);
|
6230
|
+
}
|
6231
|
+
}
|
6232
|
+
|
6233
|
+
if (modelsToAdd.length > 0) {
|
6234
|
+
array._pushInternalModels(modelsToAdd);
|
6235
|
+
}
|
6236
|
+
if (modelsToRemove.length > 0) {
|
6237
|
+
array._removeInternalModels(modelsToRemove);
|
6238
|
+
}
|
6239
|
+
}
|
6240
|
+
|
6241
|
+
function removeFromAdapterPopulatedRecordArrays(internalModels) {
|
6242
|
+
for (var i = 0; i < internalModels.length; i++) {
|
6243
|
+
var internalModel = internalModels[i];
|
6244
|
+
var list = internalModel._recordArrays.list;
|
6245
|
+
|
6246
|
+
for (var j = 0; j < list.length; j++) {
|
6247
|
+
// TODO: group by arrays, so we can batch remove
|
6248
|
+
list[j]._removeInternalModels([internalModel]);
|
6249
|
+
}
|
6250
|
+
|
6251
|
+
internalModel._recordArrays.clear();
|
6252
|
+
}
|
6253
|
+
}
|
6254
|
+
|
6255
|
+
function associateWithRecordArray(internalModels, array) {
|
6256
|
+
for (var i = 0, l = internalModels.length; i < l; i++) {
|
6257
|
+
var internalModel = internalModels[i];
|
6258
|
+
internalModel._recordArrays.add(array);
|
6259
|
+
}
|
6260
|
+
}
|
6242
6261
|
});
|
6243
6262
|
define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/record-arrays/filtered-record-array", "ember-data/-private/system/record-arrays/adapter-populated-record-array"], function (exports, _recordArray, _filteredRecordArray, _adapterPopulatedRecordArray) {
|
6244
6263
|
"use strict";
|
@@ -6249,7 +6268,7 @@ define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-priv
|
|
6249
6268
|
exports.FilteredRecordArray = _filteredRecordArray.default;
|
6250
6269
|
exports.AdapterPopulatedRecordArray = _adapterPopulatedRecordArray.default;
|
6251
6270
|
});
|
6252
|
-
define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null"], function (exports, _ember, _recordArray, _cloneNull) {
|
6271
|
+
define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null", "ember-data/-private/system/record-array-manager"], function (exports, _ember, _recordArray, _cloneNull, _recordArrayManager) {
|
6253
6272
|
"use strict";
|
6254
6273
|
|
6255
6274
|
exports.__esModule = true;
|
@@ -6294,11 +6313,7 @@ define("ember-data/-private/system/record-arrays/adapter-populated-record-array"
|
|
6294
6313
|
links: (0, _cloneNull.default)(payload.links)
|
6295
6314
|
});
|
6296
6315
|
|
6297
|
-
|
6298
|
-
var internalModel = internalModels[i];
|
6299
|
-
|
6300
|
-
internalModel._recordArrays.add(this);
|
6301
|
-
}
|
6316
|
+
(0, _recordArrayManager.associateWithRecordArray)(internalModels, this);
|
6302
6317
|
|
6303
6318
|
// TODO: should triggering didLoad event be the last action of the runLoop?
|
6304
6319
|
_ember.default.run.once(this, 'trigger', 'didLoad');
|
@@ -6798,7 +6813,7 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
|
|
6798
6813
|
```
|
6799
6814
|
|
6800
6815
|
@method meta
|
6801
|
-
@return {Object} The meta information for the belongs-
|
6816
|
+
@return {Object} The meta information for the belongs-to relationship.
|
6802
6817
|
*/
|
6803
6818
|
BelongsToReference.prototype.meta = function () {
|
6804
6819
|
return this.belongsToRelationship.meta;
|
@@ -6856,10 +6871,10 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
|
|
6856
6871
|
|
6857
6872
|
if (data instanceof _model.default) {
|
6858
6873
|
if ((0, _features.default)('ds-overhaul-references')) {
|
6859
|
-
(
|
6874
|
+
(false && !(false) && _ember.default.deprecate("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, {
|
6860
6875
|
id: 'ds.references.belongs-to.push-record',
|
6861
6876
|
until: '3.0'
|
6862
|
-
});
|
6877
|
+
}));
|
6863
6878
|
}
|
6864
6879
|
record = data;
|
6865
6880
|
} else {
|
@@ -7168,7 +7183,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7168
7183
|
commentsRef.ids(); // ['1']
|
7169
7184
|
```
|
7170
7185
|
|
7171
|
-
@method
|
7186
|
+
@method ids
|
7172
7187
|
@return {Array} The ids in this has-many relationship
|
7173
7188
|
*/
|
7174
7189
|
HasManyReference.prototype.ids = function () {
|
@@ -7180,8 +7195,7 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7180
7195
|
};
|
7181
7196
|
|
7182
7197
|
/**
|
7183
|
-
The
|
7184
|
-
relationship.
|
7198
|
+
The meta data for the has-many relationship.
|
7185
7199
|
|
7186
7200
|
Example
|
7187
7201
|
|
@@ -7272,10 +7286,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7272
7286
|
var array = payload;
|
7273
7287
|
|
7274
7288
|
if ((0, _features.default)("ds-overhaul-references")) {
|
7275
|
-
(
|
7289
|
+
(false && !(!Array.isArray(payload)) && _ember.default.deprecate("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), {
|
7276
7290
|
id: 'ds.references.has-many.push-array',
|
7277
7291
|
until: '3.0'
|
7278
|
-
});
|
7292
|
+
}));
|
7279
7293
|
}
|
7280
7294
|
|
7281
7295
|
var useLegacyArrayPush = true;
|
@@ -7284,10 +7298,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7284
7298
|
useLegacyArrayPush = array.length && array[0].data;
|
7285
7299
|
|
7286
7300
|
if ((0, _features.default)('ds-overhaul-references')) {
|
7287
|
-
(
|
7301
|
+
(false && !(!useLegacyArrayPush) && _ember.default.deprecate("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, {
|
7288
7302
|
id: 'ds.references.has-many.push-invalid-json-api',
|
7289
7303
|
until: '3.0'
|
7290
|
-
});
|
7304
|
+
}));
|
7291
7305
|
}
|
7292
7306
|
}
|
7293
7307
|
|
@@ -7300,10 +7314,10 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7300
7314
|
internalModels = array.map(function (obj) {
|
7301
7315
|
var record = _this.store.push(obj);
|
7302
7316
|
|
7303
|
-
|
7317
|
+
if (false) {
|
7304
7318
|
var relationshipMeta = _this.hasManyRelationship.relationshipMeta;
|
7305
7319
|
(0, _debug.assertPolymorphicType)(_this.internalModel, relationshipMeta, record._internalModel);
|
7306
|
-
}
|
7320
|
+
}
|
7307
7321
|
|
7308
7322
|
return record._internalModel;
|
7309
7323
|
});
|
@@ -7311,12 +7325,12 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
7311
7325
|
var records = _this.store.push(payload);
|
7312
7326
|
internalModels = _ember.default.A(records).mapBy('_internalModel');
|
7313
7327
|
|
7314
|
-
|
7328
|
+
if (false) {
|
7315
7329
|
internalModels.forEach(function (internalModel) {
|
7316
7330
|
var relationshipMeta = _this.hasManyRelationship.relationshipMeta;
|
7317
7331
|
(0, _debug.assertPolymorphicType)(_this.internalModel, relationshipMeta, internalModel);
|
7318
7332
|
});
|
7319
|
-
}
|
7333
|
+
}
|
7320
7334
|
}
|
7321
7335
|
|
7322
7336
|
_this.hasManyRelationship.computeChanges(internalModels);
|
@@ -7655,7 +7669,7 @@ define("ember-data/-private/system/references/reference", ["exports"], function
|
|
7655
7669
|
|
7656
7670
|
exports.default = Reference;
|
7657
7671
|
});
|
7658
|
-
define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflector', 'ember-data/-private/system/normalize-model-name'
|
7672
|
+
define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflector', 'ember-data/-private/system/normalize-model-name'], function (exports, _emberInflector, _normalizeModelName) {
|
7659
7673
|
'use strict';
|
7660
7674
|
|
7661
7675
|
exports.__esModule = true;
|
@@ -7682,14 +7696,14 @@ define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflec
|
|
7682
7696
|
isRelationship: true
|
7683
7697
|
};
|
7684
7698
|
|
7685
|
-
|
7686
|
-
|
7687
|
-
}
|
7699
|
+
if (false) {
|
7700
|
+
result.parentType = meta.parentType;
|
7701
|
+
}
|
7688
7702
|
|
7689
7703
|
return result;
|
7690
7704
|
}
|
7691
7705
|
});
|
7692
|
-
define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember', 'ember-data/-
|
7706
|
+
define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name'], function (exports, _ember, _normalizeModelName) {
|
7693
7707
|
'use strict';
|
7694
7708
|
|
7695
7709
|
exports.__esModule = true;
|
@@ -7783,7 +7797,8 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7783
7797
|
userEnteredModelName = (0, _normalizeModelName.default)(userEnteredModelName);
|
7784
7798
|
}
|
7785
7799
|
|
7786
|
-
(
|
7800
|
+
(false && _ember.default.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + _ember.default.inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined'));
|
7801
|
+
|
7787
7802
|
|
7788
7803
|
opts = opts || {};
|
7789
7804
|
|
@@ -7799,15 +7814,15 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7799
7814
|
return _ember.default.computed({
|
7800
7815
|
get: function (key) {
|
7801
7816
|
if (opts.hasOwnProperty('serialize')) {
|
7802
|
-
(
|
7817
|
+
(false && _ember.default.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 http://emberjs.com/api/data/classes/DS.Serializer.html', false, {
|
7803
7818
|
id: 'ds.model.serialize-option-in-belongs-to'
|
7804
|
-
});
|
7819
|
+
}));
|
7805
7820
|
}
|
7806
7821
|
|
7807
7822
|
if (opts.hasOwnProperty('embedded')) {
|
7808
|
-
(
|
7823
|
+
(false && _ember.default.warn('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, {
|
7809
7824
|
id: 'ds.model.embedded-option-in-belongs-to'
|
7810
|
-
});
|
7825
|
+
}));
|
7811
7826
|
}
|
7812
7827
|
|
7813
7828
|
return this._internalModel._relationships.get(key).getRecord();
|
@@ -7829,7 +7844,7 @@ define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember
|
|
7829
7844
|
}).meta(meta);
|
7830
7845
|
}
|
7831
7846
|
});
|
7832
|
-
define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'ember-data/-
|
7847
|
+
define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'ember-data/-private/system/relationship-meta'], function (exports, _ember, _relationshipMeta) {
|
7833
7848
|
'use strict';
|
7834
7849
|
|
7835
7850
|
exports.__esModule = true;
|
@@ -7886,10 +7901,12 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7886
7901
|
meta.key = name;
|
7887
7902
|
modelName = (0, _relationshipMeta.typeForRelationshipMeta)(meta);
|
7888
7903
|
|
7889
|
-
(
|
7904
|
+
(false && _ember.default.assert('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName));
|
7905
|
+
|
7890
7906
|
|
7891
7907
|
if (!types.includes(modelName)) {
|
7892
|
-
(
|
7908
|
+
(false && _ember.default.assert('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName));
|
7909
|
+
|
7893
7910
|
types.push(modelName);
|
7894
7911
|
}
|
7895
7912
|
}
|
@@ -7913,7 +7930,7 @@ define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'emb
|
|
7913
7930
|
return map;
|
7914
7931
|
}).readOnly();
|
7915
7932
|
});
|
7916
|
-
define('ember-data/-private/system/relationships/has-many', ['exports', 'ember', 'ember-data/-
|
7933
|
+
define('ember-data/-private/system/relationships/has-many', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _ember, _normalizeModelName, _isArrayLike) {
|
7917
7934
|
'use strict';
|
7918
7935
|
|
7919
7936
|
exports.__esModule = true;
|
@@ -8033,7 +8050,8 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
|
|
8033
8050
|
type = undefined;
|
8034
8051
|
}
|
8035
8052
|
|
8036
|
-
(
|
8053
|
+
(false && _ember.default.assert('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + _ember.default.inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined'));
|
8054
|
+
|
8037
8055
|
|
8038
8056
|
options = options || {};
|
8039
8057
|
|
@@ -8059,12 +8077,13 @@ define('ember-data/-private/system/relationships/has-many', ['exports', 'ember',
|
|
8059
8077
|
return this._internalModel._relationships.get(key).getRecords();
|
8060
8078
|
},
|
8061
8079
|
set: function (key, records) {
|
8062
|
-
(
|
8063
|
-
(
|
8080
|
+
(false && _ember.default.assert('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records)));
|
8081
|
+
(false && _ember.default.assert('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + _ember.default.inspect(records), function () {
|
8064
8082
|
return _ember.default.A(records).every(function (record) {
|
8065
8083
|
return record.hasOwnProperty('_internalModel') === true;
|
8066
8084
|
});
|
8067
|
-
}());
|
8085
|
+
}()));
|
8086
|
+
|
8068
8087
|
|
8069
8088
|
var relationship = this._internalModel._relationships.get(key);
|
8070
8089
|
relationship.clear();
|
@@ -8257,7 +8276,7 @@ define('ember-data/-private/system/relationships/relationship-payloads-manager',
|
|
8257
8276
|
|
8258
8277
|
exports.default = RelationshipPayloadsManager;
|
8259
8278
|
});
|
8260
|
-
define('ember-data/-private/system/relationships/relationship-payloads', ['exports'
|
8279
|
+
define('ember-data/-private/system/relationships/relationship-payloads', ['exports'], function (exports) {
|
8261
8280
|
'use strict';
|
8262
8281
|
|
8263
8282
|
exports.__esModule = true;
|
@@ -8340,7 +8359,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8340
8359
|
if (this._isLHS(modelName, relationshipName)) {
|
8341
8360
|
return this._lhsPayloads[id];
|
8342
8361
|
} else {
|
8343
|
-
(
|
8362
|
+
(false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
|
8363
|
+
|
8344
8364
|
return this._rhsPayloads[id];
|
8345
8365
|
}
|
8346
8366
|
};
|
@@ -8355,7 +8375,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8355
8375
|
if (this._isLHS(modelName, relationshipName)) {
|
8356
8376
|
delete this._lhsPayloads[id];
|
8357
8377
|
} else {
|
8358
|
-
(
|
8378
|
+
(false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
|
8379
|
+
|
8359
8380
|
delete this._rhsPayloads[id];
|
8360
8381
|
}
|
8361
8382
|
};
|
@@ -8401,7 +8422,8 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8401
8422
|
inverseIdToPayloads = this._rhsPayloads;
|
8402
8423
|
inverseIsMany = this._rhsRelationshipIsMany;
|
8403
8424
|
} else {
|
8404
|
-
(
|
8425
|
+
(false && Ember.assert(modelName + ':' + relationshipName + ' is not either side of this relationship, ' + this._lhsModelName + ':' + this._lhsRelationshipName + '<->' + this._rhsModelName + ':' + this._rhsRelationshipName, this._isRHS(modelName, relationshipName)));
|
8426
|
+
|
8405
8427
|
previousPayload = this._rhsPayloads[id];
|
8406
8428
|
idToPayloads = this._rhsPayloads;
|
8407
8429
|
inverseIdToPayloads = this._lhsPayloads;
|
@@ -8443,13 +8465,7 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8443
8465
|
// Then we will initially have set user:2 as having helicopter:1, which we
|
8444
8466
|
// need to remove before adding helicopter:1 to user:4
|
8445
8467
|
//
|
8446
|
-
|
8447
|
-
// * null is considered new information "empty", and it should win
|
8448
|
-
// * undefined is NOT considered new information, we should keep original state
|
8449
|
-
// * anything else is considered new information, and it should win
|
8450
|
-
if (relationshipData.data !== undefined) {
|
8451
|
-
this._removeInverse(id, previousPayload, inverseIdToPayloads);
|
8452
|
-
}
|
8468
|
+
this._removeInverse(id, previousPayload, inverseIdToPayloads);
|
8453
8469
|
idToPayloads[id] = relationshipData;
|
8454
8470
|
this._populateInverse(relationshipData, inverseRelationshipData, inverseIdToPayloads, inverseIsMany);
|
8455
8471
|
}
|
@@ -8662,19 +8678,6 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8662
8678
|
this.notifyBelongsToChanged();
|
8663
8679
|
};
|
8664
8680
|
|
8665
|
-
BelongsToRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
8666
|
-
_Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
|
8667
|
-
|
8668
|
-
if (this.canonicalState === internalModel) {
|
8669
|
-
this.canonicalState = null;
|
8670
|
-
}
|
8671
|
-
|
8672
|
-
if (this.inverseInternalModel === internalModel) {
|
8673
|
-
this.inverseInternalModel = null;
|
8674
|
-
this.notifyBelongsToChanged();
|
8675
|
-
}
|
8676
|
-
};
|
8677
|
-
|
8678
8681
|
BelongsToRelationship.prototype.flushCanonical = function flushCanonical() {
|
8679
8682
|
//temporary fix to not remove newly created records if server returned null.
|
8680
8683
|
//TODO remove once we have proper diffing
|
@@ -8707,7 +8710,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8707
8710
|
|
8708
8711
|
BelongsToRelationship.prototype.setRecordPromise = function setRecordPromise(newPromise) {
|
8709
8712
|
var content = newPromise.get && newPromise.get('content');
|
8710
|
-
(
|
8713
|
+
(false && _ember.default.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));
|
8714
|
+
|
8711
8715
|
this.setInternalModel(content ? content._internalModel : content);
|
8712
8716
|
};
|
8713
8717
|
|
@@ -8778,7 +8782,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8778
8782
|
return null;
|
8779
8783
|
}
|
8780
8784
|
var toReturn = this.inverseInternalModel.getRecord();
|
8781
|
-
(
|
8785
|
+
(false && _ember.default.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')));
|
8786
|
+
|
8782
8787
|
return toReturn;
|
8783
8788
|
}
|
8784
8789
|
};
|
@@ -8799,7 +8804,8 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8799
8804
|
};
|
8800
8805
|
|
8801
8806
|
BelongsToRelationship.prototype.updateData = function updateData(data, initial) {
|
8802
|
-
(
|
8807
|
+
(false && _ember.default.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 ' + _ember.default.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));
|
8808
|
+
|
8803
8809
|
var internalModel = this.store._pushResourceIdentifier(this, data);
|
8804
8810
|
if (initial) {
|
8805
8811
|
this.setInitialCanonicalInternalModel(internalModel);
|
@@ -8813,7 +8819,7 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8813
8819
|
|
8814
8820
|
exports.default = BelongsToRelationship;
|
8815
8821
|
});
|
8816
|
-
define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"
|
8822
|
+
define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"], function (exports, _ember, _hasMany, _belongsTo) {
|
8817
8823
|
"use strict";
|
8818
8824
|
|
8819
8825
|
exports.__esModule = true;
|
@@ -8856,10 +8862,8 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
|
|
8856
8862
|
|
8857
8863
|
if (shouldFindInverse(relationshipMeta)) {
|
8858
8864
|
inverse = internalModel.type.inverseFor(relationshipMeta.key, store);
|
8859
|
-
} else {
|
8860
|
-
(
|
8861
|
-
internalModel.type.typeForRelationship(relationshipMeta.key, store);
|
8862
|
-
});
|
8865
|
+
} else if (false) {
|
8866
|
+
internalModel.type.typeForRelationship(relationshipMeta.key, store);
|
8863
8867
|
}
|
8864
8868
|
|
8865
8869
|
if (inverse) {
|
@@ -8888,13 +8892,6 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
|
|
8888
8892
|
return !!this.initializedRelationships[key];
|
8889
8893
|
};
|
8890
8894
|
|
8891
|
-
Relationships.prototype.forEach = function forEach(cb) {
|
8892
|
-
var rels = this.initializedRelationships;
|
8893
|
-
Object.keys(rels).forEach(function (name) {
|
8894
|
-
cb(name, rels[name]);
|
8895
|
-
});
|
8896
|
-
};
|
8897
|
-
|
8898
8895
|
Relationships.prototype.get = function get(key) {
|
8899
8896
|
var relationships = this.initializedRelationships;
|
8900
8897
|
var relationship = relationships[key];
|
@@ -9081,26 +9078,6 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9081
9078
|
_Relationship.prototype.removeCanonicalInternalModelFromOwn.call(this, internalModel, idx);
|
9082
9079
|
};
|
9083
9080
|
|
9084
|
-
ManyRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
9085
|
-
_Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
|
9086
|
-
|
9087
|
-
var canonicalIndex = this.canonicalState.indexOf(internalModel);
|
9088
|
-
|
9089
|
-
if (canonicalIndex !== -1) {
|
9090
|
-
this.canonicalState.splice(canonicalIndex, 1);
|
9091
|
-
}
|
9092
|
-
|
9093
|
-
var manyArray = this._manyArray;
|
9094
|
-
|
9095
|
-
if (manyArray) {
|
9096
|
-
var idx = manyArray.currentState.indexOf(internalModel);
|
9097
|
-
|
9098
|
-
if (idx !== -1) {
|
9099
|
-
manyArray.internalReplace(idx, 1);
|
9100
|
-
}
|
9101
|
-
}
|
9102
|
-
};
|
9103
|
-
|
9104
9081
|
ManyRelationship.prototype.flushCanonical = function flushCanonical() {
|
9105
9082
|
if (this._manyArray) {
|
9106
9083
|
this._manyArray.flushCanonical();
|
@@ -9177,36 +9154,33 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9177
9154
|
};
|
9178
9155
|
|
9179
9156
|
ManyRelationship.prototype.setInitialInternalModels = function setInitialInternalModels(internalModels) {
|
9180
|
-
|
9181
|
-
return;
|
9182
|
-
}
|
9183
|
-
|
9184
|
-
for (var i = 0; i < internalModels.length; i++) {
|
9185
|
-
var internalModel = internalModels[i];
|
9186
|
-
if (this.canonicalMembers.has(internalModel)) {
|
9187
|
-
continue;
|
9188
|
-
}
|
9157
|
+
var _this2 = this;
|
9189
9158
|
|
9190
|
-
|
9191
|
-
|
9192
|
-
this.setupInverseRelationship(internalModel);
|
9159
|
+
if (!internalModels) {
|
9160
|
+
return;
|
9193
9161
|
}
|
9194
9162
|
|
9195
|
-
|
9163
|
+
var args = [0, this.canonicalState.length].concat(internalModels);
|
9164
|
+
this.canonicalState.splice.apply(this.canonicalState, args);
|
9165
|
+
internalModels.forEach(function (internalModel) {
|
9166
|
+
_this2.canonicalMembers.add(internalModel);
|
9167
|
+
_this2.members.add(internalModel);
|
9168
|
+
_this2.setupInverseRelationship(internalModel);
|
9169
|
+
});
|
9196
9170
|
};
|
9197
9171
|
|
9198
9172
|
ManyRelationship.prototype.fetchLink = function fetchLink() {
|
9199
|
-
var
|
9173
|
+
var _this3 = this;
|
9200
9174
|
|
9201
9175
|
return this.store.findHasMany(this.internalModel, this.link, this.relationshipMeta).then(function (records) {
|
9202
9176
|
if (records.hasOwnProperty('meta')) {
|
9203
|
-
|
9177
|
+
_this3.updateMeta(records.meta);
|
9204
9178
|
}
|
9205
|
-
|
9206
|
-
|
9207
|
-
|
9179
|
+
_this3.store._backburner.join(function () {
|
9180
|
+
_this3.updateInternalModelsFromAdapter(records);
|
9181
|
+
_this3.manyArray.set('isLoaded', true);
|
9208
9182
|
});
|
9209
|
-
return
|
9183
|
+
return _this3.manyArray;
|
9210
9184
|
});
|
9211
9185
|
};
|
9212
9186
|
|
@@ -9229,7 +9203,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9229
9203
|
};
|
9230
9204
|
|
9231
9205
|
ManyRelationship.prototype.getRecords = function getRecords() {
|
9232
|
-
var
|
9206
|
+
var _this4 = this;
|
9233
9207
|
|
9234
9208
|
//TODO(Igor) sync server here, once our syncing is not stupid
|
9235
9209
|
var manyArray = this.manyArray;
|
@@ -9240,7 +9214,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9240
9214
|
promise = this.findRecords();
|
9241
9215
|
} else {
|
9242
9216
|
promise = this.findLink().then(function () {
|
9243
|
-
return
|
9217
|
+
return _this4.findRecords();
|
9244
9218
|
});
|
9245
9219
|
}
|
9246
9220
|
} else {
|
@@ -9248,7 +9222,8 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9248
9222
|
}
|
9249
9223
|
return this._updateLoadingPromise(promise, manyArray);
|
9250
9224
|
} else {
|
9251
|
-
(
|
9225
|
+
(false && Ember.assert('You looked up the \'' + this.key + '\' relationship on a \'' + this.internalModel.type.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.hasMany({ async: true })\')', manyArray.isEvery('isEmpty', false)));
|
9226
|
+
|
9252
9227
|
|
9253
9228
|
//TODO(Igor) WTF DO I DO HERE?
|
9254
9229
|
// TODO @runspired equal WTFs to Igor
|
@@ -9268,20 +9243,6 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9268
9243
|
}
|
9269
9244
|
};
|
9270
9245
|
|
9271
|
-
ManyRelationship.prototype.destroy = function destroy() {
|
9272
|
-
_Relationship.prototype.destroy.call(this);
|
9273
|
-
var manyArray = this._manyArray;
|
9274
|
-
if (manyArray) {
|
9275
|
-
manyArray.destroy();
|
9276
|
-
}
|
9277
|
-
|
9278
|
-
var proxy = this.__loadingPromise;
|
9279
|
-
|
9280
|
-
if (proxy) {
|
9281
|
-
proxy.destroy();
|
9282
|
-
}
|
9283
|
-
};
|
9284
|
-
|
9285
9246
|
_createClass(ManyRelationship, [{
|
9286
9247
|
key: '_loadingPromise',
|
9287
9248
|
get: function () {
|
@@ -9323,7 +9284,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9323
9284
|
return set;
|
9324
9285
|
}
|
9325
9286
|
});
|
9326
|
-
define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-
|
9287
|
+
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) {
|
9327
9288
|
'use strict';
|
9328
9289
|
|
9329
9290
|
exports.__esModule = true;
|
@@ -9352,8 +9313,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9352
9313
|
};
|
9353
9314
|
}();
|
9354
9315
|
|
9355
|
-
var guidFor = _ember.default.guidFor;
|
9356
|
-
|
9357
9316
|
var Relationship = function () {
|
9358
9317
|
function Relationship(store, internalModel, inverseKey, relationshipMeta) {
|
9359
9318
|
_classCallCheck(this, Relationship);
|
@@ -9378,14 +9337,9 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9378
9337
|
this.hasLoaded = false;
|
9379
9338
|
}
|
9380
9339
|
|
9381
|
-
Relationship.prototype._inverseIsAsync = function _inverseIsAsync() {
|
9382
|
-
if (!this.inverseKey || !this.inverseInternalModel) {
|
9383
|
-
return false;
|
9384
|
-
}
|
9385
|
-
return this.inverseInternalModel._relationships.get(this.inverseKey).isAsync;
|
9386
|
-
};
|
9387
|
-
|
9388
9340
|
Relationship.prototype.removeInverseRelationships = function removeInverseRelationships() {
|
9341
|
+
var _this = this;
|
9342
|
+
|
9389
9343
|
if (!this.inverseKey) {
|
9390
9344
|
return;
|
9391
9345
|
}
|
@@ -9393,13 +9347,12 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9393
9347
|
var allMembers =
|
9394
9348
|
// we actually want a union of members and canonicalMembers
|
9395
9349
|
// they should be disjoint but currently are not due to a bug
|
9396
|
-
this.members.
|
9350
|
+
this.members.toArray().concat(this.canonicalMembers.toArray());
|
9397
9351
|
|
9398
|
-
|
9399
|
-
var
|
9400
|
-
var relationship = inverseInternalModel._relationships.get(this.inverseKey);
|
9352
|
+
allMembers.forEach(function (inverseInternalModel) {
|
9353
|
+
var relationship = inverseInternalModel._relationships.get(_this.inverseKey);
|
9401
9354
|
relationship.inverseDidDematerialize();
|
9402
|
-
}
|
9355
|
+
});
|
9403
9356
|
};
|
9404
9357
|
|
9405
9358
|
Relationship.prototype.inverseDidDematerialize = function inverseDidDematerialize() {};
|
@@ -9424,18 +9377,18 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9424
9377
|
};
|
9425
9378
|
|
9426
9379
|
Relationship.prototype.removeInternalModels = function removeInternalModels(internalModels) {
|
9427
|
-
var
|
9380
|
+
var _this2 = this;
|
9428
9381
|
|
9429
9382
|
internalModels.forEach(function (internalModel) {
|
9430
|
-
return
|
9383
|
+
return _this2.removeInternalModel(internalModel);
|
9431
9384
|
});
|
9432
9385
|
};
|
9433
9386
|
|
9434
9387
|
Relationship.prototype.addInternalModels = function addInternalModels(internalModels, idx) {
|
9435
|
-
var
|
9388
|
+
var _this3 = this;
|
9436
9389
|
|
9437
9390
|
internalModels.forEach(function (internalModel) {
|
9438
|
-
|
9391
|
+
_this3.addInternalModel(internalModel, idx);
|
9439
9392
|
if (idx !== undefined) {
|
9440
9393
|
idx++;
|
9441
9394
|
}
|
@@ -9478,7 +9431,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9478
9431
|
var _relationships = internalModel._implicitRelationships;
|
9479
9432
|
var _relationship = _relationships[this.inverseKeyForImplicit];
|
9480
9433
|
if (!_relationship) {
|
9481
|
-
_relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {
|
9434
|
+
_relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
|
9482
9435
|
}
|
9483
9436
|
_relationship.addCanonicalInternalModel(this.internalModel);
|
9484
9437
|
}
|
@@ -9516,7 +9469,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9516
9469
|
internalModel._relationships.get(this.inverseKey).addInternalModel(this.internalModel);
|
9517
9470
|
} else {
|
9518
9471
|
if (!internalModel._implicitRelationships[this.inverseKeyForImplicit]) {
|
9519
|
-
internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {
|
9472
|
+
internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
|
9520
9473
|
}
|
9521
9474
|
internalModel._implicitRelationships[this.inverseKeyForImplicit].addInternalModel(this.internalModel);
|
9522
9475
|
}
|
@@ -9548,6 +9501,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9548
9501
|
|
9549
9502
|
Relationship.prototype.removeInternalModelFromOwn = function removeInternalModelFromOwn(internalModel) {
|
9550
9503
|
this.members.delete(internalModel);
|
9504
|
+
this.notifyRecordRelationshipRemoved(internalModel);
|
9551
9505
|
this.internalModel.updateRecordArrays();
|
9552
9506
|
};
|
9553
9507
|
|
@@ -9564,38 +9518,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9564
9518
|
this.flushCanonicalLater();
|
9565
9519
|
};
|
9566
9520
|
|
9567
|
-
Relationship.prototype.removeCompletelyFromInverse = function removeCompletelyFromInverse() {
|
9568
|
-
var _this3 = this;
|
9569
|
-
|
9570
|
-
if (!this.inverseKey) {
|
9571
|
-
return;
|
9572
|
-
}
|
9573
|
-
|
9574
|
-
// we actually want a union of members and canonicalMembers
|
9575
|
-
// they should be disjoint but currently are not due to a bug
|
9576
|
-
var seen = Object.create(null);
|
9577
|
-
var internalModel = this.internalModel;
|
9578
|
-
|
9579
|
-
var unload = function (inverseInternalModel) {
|
9580
|
-
var id = guidFor(inverseInternalModel);
|
9581
|
-
|
9582
|
-
if (seen[id] === undefined) {
|
9583
|
-
var relationship = inverseInternalModel._relationships.get(_this3.inverseKey);
|
9584
|
-
relationship.removeCompletelyFromOwn(internalModel);
|
9585
|
-
seen[id] = true;
|
9586
|
-
}
|
9587
|
-
};
|
9588
|
-
|
9589
|
-
this.members.forEach(unload);
|
9590
|
-
this.canonicalMembers.forEach(unload);
|
9591
|
-
};
|
9592
|
-
|
9593
|
-
Relationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
9594
|
-
this.canonicalMembers.delete(internalModel);
|
9595
|
-
this.members.delete(internalModel);
|
9596
|
-
this.internalModel.updateRecordArrays();
|
9597
|
-
};
|
9598
|
-
|
9599
9521
|
Relationship.prototype.flushCanonical = function flushCanonical() {
|
9600
9522
|
var list = this.members.list;
|
9601
9523
|
this.willSync = false;
|
@@ -9623,18 +9545,16 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9623
9545
|
this.store._updateRelationshipState(this);
|
9624
9546
|
};
|
9625
9547
|
|
9626
|
-
Relationship.prototype.updateLink = function updateLink(link
|
9627
|
-
(
|
9548
|
+
Relationship.prototype.updateLink = function updateLink(link) {
|
9549
|
+
(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, {
|
9628
9550
|
id: 'ds.store.push-link-for-sync-relationship'
|
9629
|
-
});
|
9630
|
-
(
|
9551
|
+
}));
|
9552
|
+
(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));
|
9553
|
+
|
9631
9554
|
|
9632
9555
|
this.link = link;
|
9633
9556
|
this.linkPromise = null;
|
9634
|
-
|
9635
|
-
if (!initial) {
|
9636
|
-
this.internalModel.notifyPropertyChange(this.key);
|
9637
|
-
}
|
9557
|
+
this.internalModel.notifyPropertyChange(this.key);
|
9638
9558
|
};
|
9639
9559
|
|
9640
9560
|
Relationship.prototype.findLink = function findLink() {
|
@@ -9657,6 +9577,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9657
9577
|
|
9658
9578
|
Relationship.prototype.notifyRecordRelationshipAdded = function notifyRecordRelationshipAdded() {};
|
9659
9579
|
|
9580
|
+
Relationship.prototype.notifyRecordRelationshipRemoved = function notifyRecordRelationshipRemoved() {};
|
9581
|
+
|
9660
9582
|
Relationship.prototype.setHasData = function setHasData(value) {
|
9661
9583
|
this.hasData = value;
|
9662
9584
|
};
|
@@ -9707,8 +9629,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9707
9629
|
|
9708
9630
|
Relationship.prototype.updateData = function updateData() {};
|
9709
9631
|
|
9710
|
-
Relationship.prototype.destroy = function destroy() {};
|
9711
|
-
|
9712
9632
|
_createClass(Relationship, [{
|
9713
9633
|
key: 'parentType',
|
9714
9634
|
get: function () {
|
@@ -10234,7 +10154,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10234
10154
|
|
10235
10155
|
Note: When creating a new record using any of the above methods
|
10236
10156
|
Ember Data will update `DS.RecordArray`s such as those returned by
|
10237
|
-
`store#peekAll()` or `store#
|
10157
|
+
`store#peekAll()`, `store#findAll()` or `store#filter()`. This means any
|
10238
10158
|
data bindings or computed properties that depend on the RecordArray
|
10239
10159
|
will automatically be synced to include the new or updated record
|
10240
10160
|
values.
|
@@ -10317,10 +10237,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10317
10237
|
*/
|
10318
10238
|
serialize: function (record, options) {
|
10319
10239
|
if (true) {
|
10320
|
-
(
|
10240
|
+
(false && !(false) && _ember.default.deprecate('Use of store.serialize is deprecated, use record.serialize instead.', false, {
|
10321
10241
|
id: 'ds.store.serialize',
|
10322
10242
|
until: '3.0'
|
10323
|
-
});
|
10243
|
+
}));
|
10324
10244
|
}
|
10325
10245
|
var snapshot = record._internalModel.createSnapshot();
|
10326
10246
|
return snapshot.serialize(options);
|
@@ -10342,7 +10262,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10342
10262
|
defaultAdapter: computed('adapter', function () {
|
10343
10263
|
var adapter = get(this, 'adapter');
|
10344
10264
|
|
10345
|
-
(
|
10265
|
+
(false && _ember.default.assert('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string'));
|
10266
|
+
|
10346
10267
|
|
10347
10268
|
return this.adapterFor(adapter);
|
10348
10269
|
}),
|
@@ -10375,8 +10296,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10375
10296
|
@return {DS.Model} record
|
10376
10297
|
*/
|
10377
10298
|
createRecord: function (modelName, inputProperties) {
|
10378
|
-
(
|
10379
|
-
(
|
10299
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s createRecord method', isPresent(modelName)));
|
10300
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10301
|
+
|
10380
10302
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
10381
10303
|
var properties = copy(inputProperties) || Object.create(null);
|
10382
10304
|
|
@@ -10398,9 +10320,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10398
10320
|
|
10399
10321
|
// TODO @runspired this should also be coalesced into some form of internalModel.setState()
|
10400
10322
|
internalModel.eachRelationship(function (key, descriptor) {
|
10401
|
-
|
10402
|
-
internalModel._relationships.get(key).setHasData(true);
|
10403
|
-
}
|
10323
|
+
internalModel._relationships.get(key).setHasData(true);
|
10404
10324
|
});
|
10405
10325
|
|
10406
10326
|
return record;
|
@@ -10481,12 +10401,13 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10481
10401
|
// The default `model` hook in Ember.Route calls `find(modelName, id)`,
|
10482
10402
|
// that's why we have to keep this method around even though `findRecord` is
|
10483
10403
|
// the public way to get a record by modelName and id.
|
10484
|
-
(
|
10485
|
-
(
|
10486
|
-
(
|
10487
|
-
(
|
10488
|
-
(
|
10489
|
-
(
|
10404
|
+
(false && _ember.default.assert('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1));
|
10405
|
+
(false && _ember.default.assert('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options));
|
10406
|
+
(false && _ember.default.assert('You need to pass the model name and id to the store\'s find method', arguments.length === 2));
|
10407
|
+
(false && _ember.default.assert('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number'));
|
10408
|
+
(false && _ember.default.assert('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object'));
|
10409
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10410
|
+
|
10490
10411
|
|
10491
10412
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
10492
10413
|
|
@@ -10668,9 +10589,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10668
10589
|
@return {Promise} promise
|
10669
10590
|
*/
|
10670
10591
|
findRecord: function (modelName, id, options) {
|
10671
|
-
(
|
10672
|
-
(
|
10673
|
-
(
|
10592
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s findRecord method', isPresent(modelName)));
|
10593
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10594
|
+
(false && _ember.default.assert(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id)));
|
10595
|
+
|
10674
10596
|
|
10675
10597
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
10676
10598
|
|
@@ -10746,8 +10668,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10746
10668
|
@return {Promise} promise
|
10747
10669
|
*/
|
10748
10670
|
findByIds: function (modelName, ids) {
|
10749
|
-
(
|
10750
|
-
(
|
10671
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s findByIds method', isPresent(modelName)));
|
10672
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10673
|
+
|
10751
10674
|
|
10752
10675
|
var promises = new Array(ids.length);
|
10753
10676
|
|
@@ -10774,8 +10697,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10774
10697
|
var modelName = internalModel.modelName;
|
10775
10698
|
var adapter = this.adapterFor(modelName);
|
10776
10699
|
|
10777
|
-
(
|
10778
|
-
(
|
10700
|
+
(false && _ember.default.assert('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter));
|
10701
|
+
(false && _ember.default.assert('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function'));
|
10702
|
+
|
10779
10703
|
|
10780
10704
|
return (0, _finders._find)(adapter, this, internalModel.type, internalModel.id, internalModel, options);
|
10781
10705
|
},
|
@@ -10869,11 +10793,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10869
10793
|
}
|
10870
10794
|
|
10871
10795
|
if (missingInternalModels.length) {
|
10872
|
-
(
|
10796
|
+
(false && _ember.default.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) {
|
10873
10797
|
return r.id;
|
10874
10798
|
})), false, {
|
10875
10799
|
id: 'ds.store.missing-records-from-adapter'
|
10876
|
-
});
|
10800
|
+
}));
|
10801
|
+
|
10877
10802
|
rejectInternalModels(missingInternalModels);
|
10878
10803
|
}
|
10879
10804
|
}
|
@@ -10932,7 +10857,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10932
10857
|
var pair = seeking[groupedInternalModels[0].id];
|
10933
10858
|
_fetchRecord(pair);
|
10934
10859
|
} else {
|
10935
|
-
(
|
10860
|
+
(false && _ember.default.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false));
|
10936
10861
|
}
|
10937
10862
|
}
|
10938
10863
|
} else {
|
@@ -10996,8 +10921,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
10996
10921
|
@return {DS.Model|null} record
|
10997
10922
|
*/
|
10998
10923
|
peekRecord: function (modelName, id) {
|
10999
|
-
(
|
11000
|
-
(
|
10924
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName)));
|
10925
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10926
|
+
|
11001
10927
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11002
10928
|
|
11003
10929
|
if (this.hasRecordForId(normalizedModelName, id)) {
|
@@ -11024,9 +10950,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11024
10950
|
|
11025
10951
|
var adapter = this.adapterFor(modelName);
|
11026
10952
|
|
11027
|
-
(
|
11028
|
-
(
|
11029
|
-
(
|
10953
|
+
(false && _ember.default.assert('You cannot reload a record without an ID', id));
|
10954
|
+
(false && _ember.default.assert('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter));
|
10955
|
+
(false && _ember.default.assert('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function'));
|
10956
|
+
|
11030
10957
|
|
11031
10958
|
return this._scheduleFetch(internalModel);
|
11032
10959
|
},
|
@@ -11049,8 +10976,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11049
10976
|
@return {Boolean}
|
11050
10977
|
*/
|
11051
10978
|
hasRecordForId: function (modelName, id) {
|
11052
|
-
(
|
11053
|
-
(
|
10979
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName)));
|
10980
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
10981
|
+
|
11054
10982
|
|
11055
10983
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11056
10984
|
|
@@ -11071,8 +10999,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11071
10999
|
@return {DS.Model} record
|
11072
11000
|
*/
|
11073
11001
|
recordForId: function (modelName, id) {
|
11074
|
-
(
|
11075
|
-
(
|
11002
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s recordForId method', isPresent(modelName)));
|
11003
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11004
|
+
|
11076
11005
|
|
11077
11006
|
return this._internalModelForId(modelName, id).getRecord();
|
11078
11007
|
},
|
@@ -11080,16 +11009,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11080
11009
|
var trueId = (0, _coerceId.default)(id);
|
11081
11010
|
var internalModel = this._internalModelsFor(modelName).get(trueId);
|
11082
11011
|
|
11083
|
-
if (internalModel) {
|
11084
|
-
|
11085
|
-
internalModel.destroySync();
|
11086
|
-
return this._buildInternalModel(modelName, trueId);
|
11087
|
-
} else {
|
11088
|
-
return internalModel;
|
11089
|
-
}
|
11012
|
+
if (!internalModel) {
|
11013
|
+
internalModel = this._buildInternalModel(modelName, trueId);
|
11090
11014
|
} else {
|
11091
|
-
|
11015
|
+
// if we already have an internalModel, we need to ensure any async teardown is cancelled
|
11016
|
+
// since we want it again.
|
11017
|
+
internalModel.cancelDestroy();
|
11092
11018
|
}
|
11019
|
+
|
11020
|
+
return internalModel;
|
11093
11021
|
},
|
11094
11022
|
_internalModelDidReceiveRelationshipData: function (modelName, id, relationshipData) {
|
11095
11023
|
this._relationshipsPayloads.push(modelName, id, relationshipData);
|
@@ -11135,8 +11063,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11135
11063
|
findHasMany: function (internalModel, link, relationship) {
|
11136
11064
|
var adapter = this.adapterFor(internalModel.modelName);
|
11137
11065
|
|
11138
|
-
(
|
11139
|
-
(
|
11066
|
+
(false && _ember.default.assert('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
|
11067
|
+
(false && _ember.default.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'));
|
11068
|
+
|
11140
11069
|
|
11141
11070
|
return (0, _finders._findHasMany)(adapter, this, internalModel, link, relationship);
|
11142
11071
|
},
|
@@ -11153,8 +11082,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11153
11082
|
findBelongsTo: function (internalModel, link, relationship) {
|
11154
11083
|
var adapter = this.adapterFor(internalModel.modelName);
|
11155
11084
|
|
11156
|
-
(
|
11157
|
-
(
|
11085
|
+
(false && _ember.default.assert('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter));
|
11086
|
+
(false && _ember.default.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'));
|
11087
|
+
|
11158
11088
|
|
11159
11089
|
return (0, _finders._findBelongsTo)(adapter, this, internalModel, link, relationship);
|
11160
11090
|
},
|
@@ -11199,26 +11129,24 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11199
11129
|
@return {Promise} promise
|
11200
11130
|
*/
|
11201
11131
|
query: function (modelName, query) {
|
11202
|
-
(
|
11203
|
-
(
|
11204
|
-
(
|
11132
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
|
11133
|
+
(false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query));
|
11134
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11135
|
+
|
11205
11136
|
|
11206
11137
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11207
11138
|
return this._query(normalizedModelName, query);
|
11208
11139
|
},
|
11209
11140
|
_query: function (modelName, query, array) {
|
11210
|
-
(
|
11211
|
-
(
|
11212
|
-
(
|
11213
|
-
|
11214
|
-
array = array || this.recordArrayManager.createAdapterPopulatedRecordArray(modelName, query);
|
11141
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName)));
|
11142
|
+
(false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query));
|
11143
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11215
11144
|
|
11216
11145
|
var adapter = this.adapterFor(modelName);
|
11146
|
+
(false && _ember.default.assert('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter));
|
11147
|
+
(false && _ember.default.assert('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function'));
|
11217
11148
|
|
11218
11149
|
|
11219
|
-
(0, _debug.assert)('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter);
|
11220
|
-
(0, _debug.assert)('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function');
|
11221
|
-
|
11222
11150
|
var pA = (0, _promiseProxies.promiseArray)((0, _finders._query)(adapter, this, modelName, query, array));
|
11223
11151
|
|
11224
11152
|
return pA;
|
@@ -11304,16 +11232,18 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11304
11232
|
@return {Promise} promise which resolves with the found record or `null`
|
11305
11233
|
*/
|
11306
11234
|
queryRecord: function (modelName, query) {
|
11307
|
-
(
|
11308
|
-
(
|
11309
|
-
(
|
11235
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName)));
|
11236
|
+
(false && _ember.default.assert('You need to pass a query hash to the store\'s queryRecord method', query));
|
11237
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11238
|
+
|
11310
11239
|
|
11311
11240
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11312
11241
|
|
11313
11242
|
var adapter = this.adapterFor(normalizedModelName);
|
11314
11243
|
|
11315
|
-
(
|
11316
|
-
(
|
11244
|
+
(false && _ember.default.assert('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter));
|
11245
|
+
(false && _ember.default.assert('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function'));
|
11246
|
+
|
11317
11247
|
|
11318
11248
|
return (0, _promiseProxies.promiseObject)((0, _finders._queryRecord)(adapter, this, modelName, query).then(function (internalModel) {
|
11319
11249
|
// the promise returned by store.queryRecord is expected to resolve with
|
@@ -11478,8 +11408,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11478
11408
|
@return {Promise} promise
|
11479
11409
|
*/
|
11480
11410
|
findAll: function (modelName, options) {
|
11481
|
-
(
|
11482
|
-
(
|
11411
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s findAll method', isPresent(modelName)));
|
11412
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11483
11413
|
|
11484
11414
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11485
11415
|
var fetch = this._fetchAll(normalizedModelName, this.peekAll(normalizedModelName), options);
|
@@ -11501,8 +11431,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11501
11431
|
var adapter = this.adapterFor(modelName);
|
11502
11432
|
var sinceToken = this._internalModelsFor(modelName).metadata.since;
|
11503
11433
|
|
11504
|
-
(
|
11505
|
-
(
|
11434
|
+
(false && _ember.default.assert('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter));
|
11435
|
+
(false && _ember.default.assert('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function'));
|
11436
|
+
|
11506
11437
|
|
11507
11438
|
if (options.reload) {
|
11508
11439
|
set(array, 'isUpdating', true);
|
@@ -11535,12 +11466,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11535
11466
|
@private
|
11536
11467
|
*/
|
11537
11468
|
_didUpdateAll: function (modelName) {
|
11538
|
-
|
11539
|
-
|
11540
|
-
set(liveRecordArray, 'isUpdating', false);
|
11469
|
+
this.recordArrayManager._didUpdateAll(modelName);
|
11541
11470
|
},
|
11542
11471
|
didUpdateAll: function (modelName) {
|
11543
|
-
(
|
11472
|
+
(false && !(false) && _ember.default.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' }));
|
11473
|
+
|
11544
11474
|
return this._didUpdateAll(modelName);
|
11545
11475
|
},
|
11546
11476
|
|
@@ -11565,14 +11495,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11565
11495
|
@return {DS.RecordArray}
|
11566
11496
|
*/
|
11567
11497
|
peekAll: function (modelName) {
|
11568
|
-
(
|
11569
|
-
(
|
11570
|
-
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11571
|
-
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(normalizedModelName);
|
11572
|
-
|
11573
|
-
this.recordArrayManager.syncLiveRecordArray(liveRecordArray, normalizedModelName);
|
11498
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s peekAll method', isPresent(modelName)));
|
11499
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11574
11500
|
|
11575
|
-
|
11501
|
+
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11502
|
+
return this.recordArrayManager.liveRecordArrayFor(normalizedModelName);
|
11576
11503
|
},
|
11577
11504
|
|
11578
11505
|
|
@@ -11588,7 +11515,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11588
11515
|
@param {String} modelName
|
11589
11516
|
*/
|
11590
11517
|
unloadAll: function (modelName) {
|
11591
|
-
(
|
11518
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string'));
|
11519
|
+
|
11592
11520
|
|
11593
11521
|
if (arguments.length === 0) {
|
11594
11522
|
this._identityMap.clear();
|
@@ -11644,11 +11572,12 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11644
11572
|
@deprecated
|
11645
11573
|
*/
|
11646
11574
|
filter: function (modelName, query, filter) {
|
11647
|
-
(
|
11648
|
-
(
|
11575
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s filter method', isPresent(modelName)));
|
11576
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11577
|
+
|
11649
11578
|
|
11650
11579
|
if (!ENV.ENABLE_DS_FILTER) {
|
11651
|
-
(
|
11580
|
+
(false && _ember.default.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));
|
11652
11581
|
}
|
11653
11582
|
|
11654
11583
|
var promise = void 0;
|
@@ -11689,10 +11618,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11689
11618
|
@return {boolean}
|
11690
11619
|
*/
|
11691
11620
|
recordIsLoaded: function (modelName, id) {
|
11692
|
-
(
|
11621
|
+
(false && !(false) && _ember.default.deprecate('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, {
|
11693
11622
|
id: 'ds.store.recordIsLoaded',
|
11694
11623
|
until: '3.0'
|
11695
|
-
});
|
11624
|
+
}));
|
11625
|
+
|
11696
11626
|
return this.hasRecordForId(modelName, id);
|
11697
11627
|
},
|
11698
11628
|
|
@@ -11742,8 +11672,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11742
11672
|
var operation = void 0;
|
11743
11673
|
|
11744
11674
|
if (internalModel.currentState.stateName === 'root.deleted.saved') {
|
11745
|
-
resolver.resolve();
|
11746
|
-
continue;
|
11675
|
+
return resolver.resolve();
|
11747
11676
|
} else if (internalModel.isNew()) {
|
11748
11677
|
operation = 'createRecord';
|
11749
11678
|
} else if (internalModel.isDeleted()) {
|
@@ -11778,7 +11707,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11778
11707
|
this.updateId(internalModel, data);
|
11779
11708
|
this._setupRelationshipsForModel(internalModel, data);
|
11780
11709
|
} else {
|
11781
|
-
(
|
11710
|
+
(false && _ember.default.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));
|
11782
11711
|
}
|
11783
11712
|
|
11784
11713
|
//We first make sure the primary data has been updated
|
@@ -11830,22 +11759,21 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11830
11759
|
var id = (0, _coerceId.default)(data.id);
|
11831
11760
|
|
11832
11761
|
// ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)
|
11833
|
-
(
|
11762
|
+
(false && _ember.default.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)));
|
11834
11763
|
|
11835
11764
|
// ID absolutely can't be different than oldID if oldID is not null
|
11836
|
-
|
11765
|
+
|
11766
|
+
(false && _ember.default.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)));
|
11837
11767
|
|
11838
11768
|
// ID can be null if oldID is not null (altered ID in response for a record)
|
11839
11769
|
// however, this is more than likely a developer error.
|
11770
|
+
|
11840
11771
|
if (oldId !== null && id === null) {
|
11841
|
-
(
|
11772
|
+
(false && _ember.default.warn('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null)));
|
11773
|
+
|
11842
11774
|
return;
|
11843
11775
|
}
|
11844
11776
|
|
11845
|
-
var existingInternalModel = this._existingInternalModelForId(modelName, id);
|
11846
|
-
|
11847
|
-
(0, _debug.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);
|
11848
|
-
|
11849
11777
|
this._internalModelsFor(internalModel.modelName).set(id, internalModel);
|
11850
11778
|
|
11851
11779
|
internalModel.setId(id);
|
@@ -11941,8 +11869,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11941
11869
|
@return {DS.Model}
|
11942
11870
|
*/
|
11943
11871
|
modelFor: function (modelName) {
|
11944
|
-
(
|
11945
|
-
(
|
11872
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s modelFor method', isPresent(modelName)));
|
11873
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11874
|
+
|
11946
11875
|
|
11947
11876
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11948
11877
|
|
@@ -11975,9 +11904,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11975
11904
|
// interopt with the future
|
11976
11905
|
var klass = (0, _utils.getOwner)(this).factoryFor ? factory.class : factory;
|
11977
11906
|
|
11978
|
-
(
|
11907
|
+
(false && _ember.default.assert('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel));
|
11979
11908
|
|
11980
11909
|
// TODO: deprecate this
|
11910
|
+
|
11981
11911
|
klass.modelName = klass.modelName || modelName;
|
11982
11912
|
|
11983
11913
|
this._modelFactoryCache[modelName] = factory;
|
@@ -11991,8 +11921,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
11991
11921
|
@private
|
11992
11922
|
*/
|
11993
11923
|
modelFactoryFor: function (modelName) {
|
11994
|
-
(
|
11995
|
-
(
|
11924
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName)));
|
11925
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
11926
|
+
|
11996
11927
|
|
11997
11928
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
11998
11929
|
var owner = (0, _utils.getOwner)(this);
|
@@ -12191,7 +12122,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12191
12122
|
return null;
|
12192
12123
|
}
|
12193
12124
|
|
12194
|
-
(
|
12125
|
+
(false && _ember.default.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'));
|
12126
|
+
|
12195
12127
|
|
12196
12128
|
return _this._pushInternalModel(jsonApiDoc.data);
|
12197
12129
|
});
|
@@ -12209,34 +12141,34 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12209
12141
|
}
|
12210
12142
|
},
|
12211
12143
|
_pushInternalModel: function (data) {
|
12212
|
-
var _this2 = this;
|
12213
|
-
|
12214
12144
|
var modelName = data.type;
|
12215
|
-
(
|
12216
|
-
(
|
12145
|
+
(false && _ember.default.assert('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== ''));
|
12146
|
+
(false && _ember.default.assert('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName)));
|
12147
|
+
|
12217
12148
|
|
12218
|
-
|
12149
|
+
if (false) {
|
12219
12150
|
// If ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload
|
12220
12151
|
// contains unknown attributes or relationships, log a warning.
|
12221
12152
|
|
12222
12153
|
if (ENV.DS_WARN_ON_UNKNOWN_KEYS) {
|
12223
|
-
var modelClass =
|
12154
|
+
var modelClass = this._modelFor(modelName);
|
12224
12155
|
|
12225
12156
|
// Check unknown attributes
|
12226
12157
|
var unknownAttributes = Object.keys(data.attributes || {}).filter(function (key) {
|
12227
12158
|
return !get(modelClass, 'fields').has(key);
|
12228
12159
|
});
|
12229
12160
|
var unknownAttributesMessage = 'The payload for \'' + modelName + '\' contains these unknown attributes: ' + unknownAttributes + '. Make sure they\'ve been defined in your model.';
|
12230
|
-
(
|
12161
|
+
(false && _ember.default.warn(unknownAttributesMessage, unknownAttributes.length === 0, { id: 'ds.store.unknown-keys-in-payload' }));
|
12231
12162
|
|
12232
12163
|
// Check unknown relationships
|
12164
|
+
|
12233
12165
|
var unknownRelationships = Object.keys(data.relationships || {}).filter(function (key) {
|
12234
12166
|
return !get(modelClass, 'fields').has(key);
|
12235
12167
|
});
|
12236
12168
|
var unknownRelationshipsMessage = 'The payload for \'' + modelName + '\' contains these unknown relationships: ' + unknownRelationships + '. Make sure they\'ve been defined in your model.';
|
12237
|
-
(
|
12169
|
+
(false && _ember.default.warn(unknownRelationshipsMessage, unknownRelationships.length === 0, { id: 'ds.store.unknown-keys-in-payload' }));
|
12238
12170
|
}
|
12239
|
-
}
|
12171
|
+
}
|
12240
12172
|
|
12241
12173
|
// Actually load the record into the store.
|
12242
12174
|
var internalModel = this._load(data);
|
@@ -12326,10 +12258,11 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12326
12258
|
if (!inputPayload) {
|
12327
12259
|
payload = modelName;
|
12328
12260
|
serializer = defaultSerializer(this);
|
12329
|
-
(
|
12261
|
+
(false && _ember.default.assert('You cannot use \'store#pushPayload\' without a modelName unless your default serializer defines \'pushPayload\'', typeof serializer.pushPayload === 'function'));
|
12330
12262
|
} else {
|
12331
12263
|
payload = inputPayload;
|
12332
|
-
(
|
12264
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12265
|
+
|
12333
12266
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12334
12267
|
serializer = this.serializerFor(normalizedModelName);
|
12335
12268
|
}
|
@@ -12358,8 +12291,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12358
12291
|
@return {Object} The normalized payload
|
12359
12292
|
*/
|
12360
12293
|
normalize: function (modelName, payload) {
|
12361
|
-
(
|
12362
|
-
(
|
12294
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s normalize method', isPresent(modelName)));
|
12295
|
+
(false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + inspect(modelName), typeof modelName === 'string'));
|
12296
|
+
|
12363
12297
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12364
12298
|
var serializer = this.serializerFor(normalizedModelName);
|
12365
12299
|
var model = this._modelFor(normalizedModelName);
|
@@ -12378,34 +12312,25 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12378
12312
|
@return {InternalModel} internal model
|
12379
12313
|
*/
|
12380
12314
|
_buildInternalModel: function (modelName, id, data) {
|
12315
|
+
(false && _ember.default.assert('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string'));
|
12381
12316
|
|
12382
|
-
(0, _debug.assert)('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string');
|
12383
12317
|
|
12384
|
-
var
|
12318
|
+
var recordMap = this._internalModelsFor(modelName);
|
12385
12319
|
|
12386
|
-
(
|
12320
|
+
(false && _ember.default.assert('The id ' + id + ' has already been used with another record for modelClass \'' + modelName + '\'.', !id || !recordMap.get(id)));
|
12387
12321
|
|
12388
12322
|
// lookupFactory should really return an object that creates
|
12389
12323
|
// instances with the injections applied
|
12390
|
-
var internalModel = new _internalModel5.default(modelName, id, this, data);
|
12391
12324
|
|
12392
|
-
|
12325
|
+
var internalModel = new _internalModel5.default(modelName, id, this, data);
|
12393
12326
|
|
12394
|
-
|
12395
|
-
},
|
12396
|
-
_existingInternalModelForId: function (modelName, id) {
|
12397
|
-
var internalModel = this._internalModelsFor(modelName).get(id);
|
12327
|
+
recordMap.add(internalModel, id);
|
12398
12328
|
|
12399
|
-
if (internalModel && internalModel.hasScheduledDestroy()) {
|
12400
|
-
// unloadRecord is async, if one attempts to unload + then sync create,
|
12401
|
-
// we must ensure the unload is complete before starting the create
|
12402
|
-
internalModel.destroySync();
|
12403
|
-
internalModel = null;
|
12404
|
-
}
|
12405
12329
|
return internalModel;
|
12406
12330
|
},
|
12407
12331
|
buildInternalModel: function (modelName, id, data) {
|
12408
|
-
(
|
12332
|
+
(false && !(false) && _ember.default.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' }));
|
12333
|
+
|
12409
12334
|
return this._buildInternalModel(modelName, id, data);
|
12410
12335
|
},
|
12411
12336
|
|
@@ -12454,8 +12379,9 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12454
12379
|
@return DS.Adapter
|
12455
12380
|
*/
|
12456
12381
|
adapterFor: function (modelName) {
|
12457
|
-
(
|
12458
|
-
(
|
12382
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s adapterFor method', isPresent(modelName)));
|
12383
|
+
(false && _ember.default.assert('Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12384
|
+
|
12459
12385
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12460
12386
|
|
12461
12387
|
return this._instanceCache.get('adapter', normalizedModelName);
|
@@ -12484,24 +12410,27 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12484
12410
|
@return {DS.Serializer}
|
12485
12411
|
*/
|
12486
12412
|
serializerFor: function (modelName) {
|
12487
|
-
(
|
12488
|
-
(
|
12413
|
+
(false && _ember.default.assert('You need to pass a model name to the store\'s serializerFor method', isPresent(modelName)));
|
12414
|
+
(false && _ember.default.assert('Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string'));
|
12415
|
+
|
12489
12416
|
var normalizedModelName = (0, _normalizeModelName.default)(modelName);
|
12490
12417
|
|
12491
12418
|
return this._instanceCache.get('serializer', normalizedModelName);
|
12492
12419
|
},
|
12493
12420
|
lookupAdapter: function (name) {
|
12494
|
-
(
|
12421
|
+
(false && !(false) && _ember.default.deprecate('Use of lookupAdapter is deprecated, use adapterFor instead.', false, {
|
12495
12422
|
id: 'ds.store.lookupAdapter',
|
12496
12423
|
until: '3.0'
|
12497
|
-
});
|
12424
|
+
}));
|
12425
|
+
|
12498
12426
|
return this.adapterFor(name);
|
12499
12427
|
},
|
12500
12428
|
lookupSerializer: function (name) {
|
12501
|
-
(
|
12429
|
+
(false && !(false) && _ember.default.deprecate('Use of lookupSerializer is deprecated, use serializerFor instead.', false, {
|
12502
12430
|
id: 'ds.store.lookupSerializer',
|
12503
12431
|
until: '3.0'
|
12504
|
-
});
|
12432
|
+
}));
|
12433
|
+
|
12505
12434
|
return this.serializerFor(name);
|
12506
12435
|
},
|
12507
12436
|
willDestroy: function () {
|
@@ -12513,14 +12442,14 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12513
12442
|
this.unloadAll();
|
12514
12443
|
},
|
12515
12444
|
_updateRelationshipState: function (relationship) {
|
12516
|
-
var
|
12445
|
+
var _this2 = this;
|
12517
12446
|
|
12518
12447
|
if (this._updatedRelationships.push(relationship) !== 1) {
|
12519
12448
|
return;
|
12520
12449
|
}
|
12521
12450
|
|
12522
12451
|
this._backburner.join(function () {
|
12523
|
-
|
12452
|
+
_this2._backburner.schedule('syncRelationships', _this2, _this2._flushUpdatedRelationships);
|
12524
12453
|
});
|
12525
12454
|
},
|
12526
12455
|
_flushUpdatedRelationships: function () {
|
@@ -12553,9 +12482,10 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12553
12482
|
return;
|
12554
12483
|
}
|
12555
12484
|
|
12556
|
-
(
|
12485
|
+
(false && _ember.default.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)));
|
12557
12486
|
|
12558
12487
|
//TODO:Better asserts
|
12488
|
+
|
12559
12489
|
return this._internalModelForId(resourceIdentifier.type, resourceIdentifier.id);
|
12560
12490
|
},
|
12561
12491
|
_pushResourceIdentifiers: function (relationship, resourceIdentifiers) {
|
@@ -12563,7 +12493,8 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12563
12493
|
return;
|
12564
12494
|
}
|
12565
12495
|
|
12566
|
-
(
|
12496
|
+
(false && _ember.default.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)));
|
12497
|
+
|
12567
12498
|
|
12568
12499
|
var _internalModels = new Array(resourceIdentifiers.length);
|
12569
12500
|
for (var i = 0; i < resourceIdentifiers.length; i++) {
|
@@ -12584,13 +12515,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12584
12515
|
var internalModel = snapshot._internalModel;
|
12585
12516
|
var modelName = snapshot.modelName;
|
12586
12517
|
var modelClass = store._modelFor(modelName);
|
12587
|
-
(
|
12588
|
-
(
|
12518
|
+
(false && _ember.default.assert('You tried to update a record but you have no adapter (for ' + modelName + ')', adapter));
|
12519
|
+
(false && _ember.default.assert('You tried to update a record but your adapter (for ' + modelName + ') does not implement \'' + operation + '\'', typeof adapter[operation] === 'function'));
|
12520
|
+
|
12589
12521
|
var promise = adapter[operation](store, modelClass, snapshot);
|
12590
12522
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12591
12523
|
var label = 'DS: Extract and notify about ' + operation + ' completion of ' + internalModel;
|
12592
12524
|
|
12593
|
-
(
|
12525
|
+
(false && _ember.default.assert('Your adapter\'s \'' + operation + '\' method must return a value, but it returned \'undefined\'', promise !== undefined));
|
12526
|
+
|
12594
12527
|
|
12595
12528
|
promise = Promise.resolve(promise, label);
|
12596
12529
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
@@ -12684,30 +12617,30 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-pri
|
|
12684
12617
|
|
12685
12618
|
if (relationshipRequiresNotification) {
|
12686
12619
|
var relationshipData = data.relationships[relationshipName];
|
12687
|
-
relationships.get(relationshipName).push(relationshipData
|
12620
|
+
relationships.get(relationshipName).push(relationshipData);
|
12688
12621
|
}
|
12689
12622
|
|
12690
12623
|
// in debug, assert payload validity eagerly
|
12691
|
-
|
12624
|
+
if (false) {
|
12692
12625
|
var relationshipMeta = get(internalModel.type, 'relationshipsByName').get(relationshipName);
|
12693
|
-
var
|
12694
|
-
if (!
|
12626
|
+
var _relationshipData = data.relationships[relationshipName];
|
12627
|
+
if (!_relationshipData || !relationshipMeta) {
|
12695
12628
|
return;
|
12696
12629
|
}
|
12697
12630
|
|
12698
|
-
if (
|
12631
|
+
if (_relationshipData.links) {
|
12699
12632
|
var isAsync = relationshipMeta.options && relationshipMeta.options.async !== false;
|
12700
|
-
(
|
12633
|
+
(false && _ember.default.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, {
|
12701
12634
|
id: 'ds.store.push-link-for-sync-relationship'
|
12702
|
-
});
|
12703
|
-
} else if (
|
12635
|
+
}));
|
12636
|
+
} else if (_relationshipData.data) {
|
12704
12637
|
if (relationshipMeta.kind === 'belongsTo') {
|
12705
|
-
(
|
12638
|
+
(false && _ember.default.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)));
|
12706
12639
|
} else if (relationshipMeta.kind === 'hasMany') {
|
12707
|
-
(
|
12640
|
+
(false && _ember.default.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)));
|
12708
12641
|
}
|
12709
12642
|
}
|
12710
|
-
}
|
12643
|
+
}
|
12711
12644
|
});
|
12712
12645
|
}
|
12713
12646
|
|
@@ -12852,7 +12785,7 @@ define('ember-data/-private/system/store/container-instance-cache', ['exports',
|
|
12852
12785
|
|
12853
12786
|
exports.default = ContainerInstanceCache;
|
12854
12787
|
});
|
12855
|
-
define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-data/-
|
12788
|
+
define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers'], function (exports, _ember, _common, _serializerResponse, _serializers) {
|
12856
12789
|
'use strict';
|
12857
12790
|
|
12858
12791
|
exports.__esModule = true;
|
@@ -12885,14 +12818,15 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12885
12818
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12886
12819
|
|
12887
12820
|
return promise.then(function (adapterPayload) {
|
12888
|
-
(
|
12821
|
+
(false && _ember.default.assert('You made a \'findRecord\' request for a \'' + modelName + '\' with id \'' + id + '\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12822
|
+
|
12889
12823
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12890
12824
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, id, 'findRecord');
|
12891
|
-
(
|
12892
|
-
|
12893
|
-
(0, _debug.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 http://emberjs.com/api/data/classes/DS.Store.html#method_queryRecord', payload.data.id === id, {
|
12825
|
+
(false && _ember.default.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)));
|
12826
|
+
(false && _ember.default.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 http://emberjs.com/api/data/classes/DS.Store.html#method_queryRecord', payload.data.id === id, {
|
12894
12827
|
id: 'ds.store.findRecord.id-mismatch'
|
12895
|
-
});
|
12828
|
+
}));
|
12829
|
+
|
12896
12830
|
|
12897
12831
|
return store._push(payload);
|
12898
12832
|
}, function (error) {
|
@@ -12919,7 +12853,8 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12919
12853
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12920
12854
|
|
12921
12855
|
return promise.then(function (adapterPayload) {
|
12922
|
-
(
|
12856
|
+
(false && _ember.default.assert('You made a \'findMany\' request for \'' + modelName + '\' records with ids \'[' + ids + ']\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12857
|
+
|
12923
12858
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12924
12859
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findMany');
|
12925
12860
|
return store._push(payload);
|
@@ -12937,7 +12872,8 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12937
12872
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, internalModel));
|
12938
12873
|
|
12939
12874
|
return promise.then(function (adapterPayload) {
|
12940
|
-
(
|
12875
|
+
(false && _ember.default.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)));
|
12876
|
+
|
12941
12877
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, relationship.type);
|
12942
12878
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findHasMany');
|
12943
12879
|
var internalModelArray = store._push(payload);
|
@@ -12980,7 +12916,8 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12980
12916
|
promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store));
|
12981
12917
|
|
12982
12918
|
return promise.then(function (adapterPayload) {
|
12983
|
-
(
|
12919
|
+
(false && _ember.default.assert('You made a \'findAll\' request for \'' + modelName + '\' records, but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload)));
|
12920
|
+
|
12984
12921
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
12985
12922
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findAll');
|
12986
12923
|
|
@@ -12993,7 +12930,14 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
12993
12930
|
|
12994
12931
|
function _query(adapter, store, modelName, query, recordArray) {
|
12995
12932
|
var modelClass = store.modelFor(modelName); // adapter.query needs the class
|
12996
|
-
|
12933
|
+
|
12934
|
+
var promise = void 0;
|
12935
|
+
if (adapter.query.length > 3) {
|
12936
|
+
recordArray = recordArray || store.recordArrayManager.createAdapterPopulatedRecordArray(modelName, query);
|
12937
|
+
promise = adapter.query(store, modelClass, query, recordArray);
|
12938
|
+
} else {
|
12939
|
+
promise = adapter.query(store, modelClass, query);
|
12940
|
+
}
|
12997
12941
|
|
12998
12942
|
var label = 'DS: Handle Adapter#query of ' + modelClass;
|
12999
12943
|
|
@@ -13007,8 +12951,13 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
13007
12951
|
|
13008
12952
|
var internalModels = store._push(payload);
|
13009
12953
|
|
13010
|
-
(
|
13011
|
-
|
12954
|
+
(false && _ember.default.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)));
|
12955
|
+
|
12956
|
+
if (recordArray) {
|
12957
|
+
recordArray._setInternalModels(internalModels, payload);
|
12958
|
+
} else {
|
12959
|
+
recordArray = store.recordArrayManager.createAdapterPopulatedRecordArray(modelName, query, internalModels, payload);
|
12960
|
+
}
|
13012
12961
|
|
13013
12962
|
return recordArray;
|
13014
12963
|
}, null, 'DS: Extract payload of query ' + modelName);
|
@@ -13026,15 +12975,16 @@ define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-d
|
|
13026
12975
|
var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName);
|
13027
12976
|
var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'queryRecord');
|
13028
12977
|
|
13029
|
-
(
|
12978
|
+
(false && _ember.default.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), {
|
13030
12979
|
id: 'ds.store.queryRecord-array-response'
|
13031
|
-
});
|
12980
|
+
}));
|
12981
|
+
|
13032
12982
|
|
13033
12983
|
return store._push(payload);
|
13034
12984
|
}, null, 'DS: Extract payload of queryRecord ' + modelName);
|
13035
12985
|
}
|
13036
12986
|
});
|
13037
|
-
define('ember-data/-private/system/store/serializer-response', ['exports', 'ember'
|
12987
|
+
define('ember-data/-private/system/store/serializer-response', ['exports', 'ember'], function (exports, _ember) {
|
13038
12988
|
'use strict';
|
13039
12989
|
|
13040
12990
|
exports.__esModule = true;
|
@@ -13114,10 +13064,11 @@ define('ember-data/-private/system/store/serializer-response', ['exports', 'embe
|
|
13114
13064
|
function normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
|
13115
13065
|
var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType);
|
13116
13066
|
var validationErrors = [];
|
13117
|
-
|
13067
|
+
if (false) {
|
13118
13068
|
validationErrors = validateDocumentStructure(normalizedResponse);
|
13119
|
-
}
|
13120
|
-
(
|
13069
|
+
}
|
13070
|
+
(false && _ember.default.assert('normalizeResponse must return a valid JSON API document:\n\t* ' + validationErrors.join('\n\t* '), _ember.default.isEmpty(validationErrors)));
|
13071
|
+
|
13121
13072
|
|
13122
13073
|
return normalizedResponse;
|
13123
13074
|
}
|
@@ -13222,7 +13173,7 @@ define('ember-data/-private/utils/parse-response-headers', ['exports'], function
|
|
13222
13173
|
}
|
13223
13174
|
|
13224
13175
|
if (foundSep === false) {
|
13225
|
-
|
13176
|
+
break;
|
13226
13177
|
}
|
13227
13178
|
|
13228
13179
|
var field = header.substring(0, j).trim();
|
@@ -13833,7 +13784,7 @@ define('ember-data/adapters/errors', ['exports', 'ember-data/-private'], functio
|
|
13833
13784
|
}
|
13834
13785
|
});
|
13835
13786
|
});
|
13836
|
-
define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-
|
13787
|
+
define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters/rest', 'ember-data/-private', 'ember-data/-debug'], function (exports, _ember, _rest, _private, _debug) {
|
13837
13788
|
'use strict';
|
13838
13789
|
|
13839
13790
|
exports.__esModule = true;
|
@@ -13975,6 +13926,11 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
13975
13926
|
@namespace DS
|
13976
13927
|
@extends DS.RESTAdapter
|
13977
13928
|
*/
|
13929
|
+
/* global heimdall */
|
13930
|
+
/**
|
13931
|
+
@module ember-data
|
13932
|
+
*/
|
13933
|
+
|
13978
13934
|
var JSONAPIAdapter = _rest.default.extend({
|
13979
13935
|
defaultSerializer: '-json-api',
|
13980
13936
|
|
@@ -14053,7 +14009,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14053
14009
|
},
|
14054
14010
|
pathForType: function (modelName) {
|
14055
14011
|
var dasherized = _ember.default.String.dasherize(modelName);
|
14056
|
-
return
|
14012
|
+
return _ember.default.String.pluralize(dasherized);
|
14057
14013
|
},
|
14058
14014
|
updateRecord: function (store, type, snapshot) {
|
14059
14015
|
if ((0, _private.isEnabled)('ds-improved-ajax') && !this._hasCustomizedAjax()) {
|
@@ -14071,27 +14027,26 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', '
|
|
14071
14027
|
},
|
14072
14028
|
_hasCustomizedAjax: function () {
|
14073
14029
|
if (this.ajax !== JSONAPIAdapter.prototype.ajax) {
|
14074
|
-
(
|
14030
|
+
(false && !(false) && _ember.default.deprecate('JSONAPIAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14075
14031
|
id: 'ds.json-api-adapter.ajax',
|
14076
14032
|
until: '3.0.0'
|
14077
|
-
});
|
14033
|
+
}));
|
14034
|
+
|
14078
14035
|
return true;
|
14079
14036
|
}
|
14080
14037
|
|
14081
14038
|
if (this.ajaxOptions !== JSONAPIAdapter.prototype.ajaxOptions) {
|
14082
|
-
(
|
14039
|
+
(false && !(false) && _ember.default.deprecate('JSONAPIAdapterr#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14083
14040
|
id: 'ds.json-api-adapter.ajax-options',
|
14084
14041
|
until: '3.0.0'
|
14085
|
-
});
|
14042
|
+
}));
|
14043
|
+
|
14086
14044
|
return true;
|
14087
14045
|
}
|
14088
14046
|
|
14089
14047
|
return false;
|
14090
14048
|
}
|
14091
|
-
});
|
14092
|
-
/**
|
14093
|
-
@module ember-data
|
14094
|
-
*/
|
14049
|
+
});
|
14095
14050
|
|
14096
14051
|
if ((0, _private.isEnabled)('ds-improved-ajax')) {
|
14097
14052
|
|
@@ -14870,18 +14825,20 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
14870
14825
|
},
|
14871
14826
|
_hasCustomizedAjax: function () {
|
14872
14827
|
if (this.ajax !== RESTAdapter.prototype.ajax) {
|
14873
|
-
(
|
14828
|
+
(false && !(false) && _ember.default.deprecate('RESTAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14874
14829
|
id: 'ds.rest-adapter.ajax',
|
14875
14830
|
until: '3.0.0'
|
14876
|
-
});
|
14831
|
+
}));
|
14832
|
+
|
14877
14833
|
return true;
|
14878
14834
|
}
|
14879
14835
|
|
14880
14836
|
if (this.ajaxOptions !== RESTAdapter.prototype.ajaxOptions) {
|
14881
|
-
(
|
14837
|
+
(false && !(false) && _ember.default.deprecate('RESTAdapter#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
14882
14838
|
id: 'ds.rest-adapter.ajax-options',
|
14883
14839
|
until: '3.0.0'
|
14884
|
-
});
|
14840
|
+
}));
|
14841
|
+
|
14885
14842
|
return true;
|
14886
14843
|
}
|
14887
14844
|
|
@@ -15083,13 +15040,13 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
15083
15040
|
}
|
15084
15041
|
|
15085
15042
|
function ajaxError(adapter, jqXHR, requestData, responseData) {
|
15086
|
-
|
15043
|
+
if (false) {
|
15087
15044
|
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 {}.';
|
15088
15045
|
var validJSONString = !(responseData.textStatus === "parsererror" && jqXHR.responseText === "");
|
15089
|
-
(
|
15046
|
+
(false && _ember.default.warn(message, validJSONString, {
|
15090
15047
|
id: 'ds.adapter.returned-empty-string-as-JSON'
|
15091
|
-
});
|
15092
|
-
}
|
15048
|
+
}));
|
15049
|
+
}
|
15093
15050
|
|
15094
15051
|
var error = void 0;
|
15095
15052
|
|
@@ -15121,7 +15078,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
15121
15078
|
|
15122
15079
|
exports.default = RESTAdapter;
|
15123
15080
|
});
|
15124
|
-
define('ember-data/attr', ['exports', 'ember'
|
15081
|
+
define('ember-data/attr', ['exports', 'ember'], function (exports, _ember) {
|
15125
15082
|
'use strict';
|
15126
15083
|
|
15127
15084
|
exports.__esModule = true;
|
@@ -15137,10 +15094,11 @@ define('ember-data/attr', ['exports', 'ember', 'ember-data/-debug'], function (e
|
|
15137
15094
|
return options.defaultValue.apply(null, arguments);
|
15138
15095
|
} else {
|
15139
15096
|
var defaultValue = options.defaultValue;
|
15140
|
-
(
|
15097
|
+
(false && !(typeof defaultValue !== 'object' || defaultValue === null) && _ember.default.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, {
|
15141
15098
|
id: 'ds.defaultValue.complex-object',
|
15142
15099
|
until: '3.0.0'
|
15143
|
-
});
|
15100
|
+
}));
|
15101
|
+
|
15144
15102
|
return defaultValue;
|
15145
15103
|
}
|
15146
15104
|
}
|
@@ -15296,7 +15254,7 @@ define('ember-data/attr', ['exports', 'ember', 'ember-data/-debug'], function (e
|
|
15296
15254
|
}).meta(meta);
|
15297
15255
|
}
|
15298
15256
|
});
|
15299
|
-
define("ember-data", ["exports", "ember", "ember-data/-
|
15257
|
+
define("ember-data", ["exports", "ember", "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, _ember, _private, _setupContainer, _initializeStoreService, _transform, _number, _date, _string, _boolean, _adapter, _jsonApi, _rest, _serializer, _jsonApi2, _json, _rest2, _embeddedRecordsMixin, _attr) {
|
15300
15258
|
"use strict";
|
15301
15259
|
|
15302
15260
|
exports.__esModule = true;
|
@@ -15390,7 +15348,8 @@ define("ember-data", ["exports", "ember", "ember-data/-debug", "ember-data/-priv
|
|
15390
15348
|
Object.defineProperty(_private.global, 'DS', {
|
15391
15349
|
configurable: true,
|
15392
15350
|
get: function () {
|
15393
|
-
(
|
15351
|
+
(false && !(false) && _ember.default.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' }));
|
15352
|
+
|
15394
15353
|
|
15395
15354
|
return _private.DS;
|
15396
15355
|
}
|
@@ -15408,7 +15367,7 @@ define('ember-data/initializers/data-adapter', ['exports'], function (exports) {
|
|
15408
15367
|
initialize: function () {}
|
15409
15368
|
};
|
15410
15369
|
});
|
15411
|
-
define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data'], function (exports, _setupContainer) {
|
15370
|
+
define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data/index'], function (exports, _setupContainer) {
|
15412
15371
|
'use strict';
|
15413
15372
|
|
15414
15373
|
exports.__esModule = true;
|
@@ -15456,13 +15415,15 @@ define("ember-data/instance-initializers/ember-data", ["exports", "ember-data/in
|
|
15456
15415
|
initialize: _initializeStoreService.default
|
15457
15416
|
};
|
15458
15417
|
});
|
15459
|
-
define('ember-data/instance-initializers/initialize-store-service', ['exports'
|
15418
|
+
define('ember-data/instance-initializers/initialize-store-service', ['exports'], function (exports) {
|
15460
15419
|
'use strict';
|
15461
15420
|
|
15462
15421
|
exports.__esModule = true;
|
15463
15422
|
exports.default = initializeStoreService;
|
15464
15423
|
|
15465
15424
|
|
15425
|
+
var deprecateOldEmberDataInitializers = void 0;
|
15426
|
+
|
15466
15427
|
/*
|
15467
15428
|
Configures a registry for use with an Ember-Data
|
15468
15429
|
store.
|
@@ -15478,44 +15439,48 @@ define('ember-data/instance-initializers/initialize-store-service', ['exports',
|
|
15478
15439
|
// Eagerly generate the store so defaultStore is populated.
|
15479
15440
|
container.lookup('service:store');
|
15480
15441
|
|
15481
|
-
|
15482
|
-
|
15483
|
-
|
15484
|
-
|
15442
|
+
if (false) {
|
15443
|
+
// In Ember 2.4+ instance.base is the `Ember.Application` or `Ember.Engine` instance
|
15444
|
+
// In Ember 1.11 - 2.3 we fallback to `instance.application`
|
15445
|
+
var base = instance.base || instance.application;
|
15446
|
+
deprecateOldEmberDataInitializers(base.constructor.initializers);
|
15447
|
+
}
|
15485
15448
|
}
|
15486
15449
|
|
15487
|
-
|
15450
|
+
if (false) {
|
15451
|
+
var DEPRECATED_INITIALIZER_NAMES = ['data-adapter', 'injectStore', 'transforms', 'store'];
|
15488
15452
|
|
15489
|
-
|
15490
|
-
|
15491
|
-
|
15453
|
+
var matchesDeprecatedInititalizer = function matchesDeprecatedInititalizer(name) {
|
15454
|
+
return DEPRECATED_INITIALIZER_NAMES.indexOf(name) !== -1;
|
15455
|
+
};
|
15492
15456
|
|
15493
|
-
|
15494
|
-
|
15495
|
-
|
15457
|
+
var warnForDeprecatedInitializers = function warnForDeprecatedInitializers(initializer) {
|
15458
|
+
var deprecatedBeforeInitializer = matchesDeprecatedInititalizer(initializer.before);
|
15459
|
+
var deprecatedAfterInitializer = matchesDeprecatedInititalizer(initializer.after);
|
15460
|
+
var deprecatedProp = deprecatedBeforeInitializer ? 'before' : 'after';
|
15496
15461
|
|
15497
|
-
|
15498
|
-
|
15462
|
+
(false && !(!(deprecatedBeforeInitializer || deprecatedAfterInitializer)) && Ember.deprecate('The initializer `' + initializer[deprecatedProp] + '` has been deprecated. Please update your `' + initializer.name + '` initializer to use use `' + deprecatedProp + ': \'ember-data\'` instead.', !(deprecatedBeforeInitializer || deprecatedAfterInitializer), {
|
15463
|
+
id: 'ds.deprecated-initializers',
|
15464
|
+
until: '3.0.0'
|
15465
|
+
}));
|
15466
|
+
};
|
15499
15467
|
|
15500
|
-
|
15501
|
-
//
|
15502
|
-
|
15503
|
-
// unintentionally.
|
15504
|
-
if (!matchesDeprecatedInititalizer(name)) {
|
15505
|
-
warnForDeprecatedInitializers(initializers[name]);
|
15506
|
-
}
|
15507
|
-
}
|
15508
|
-
}
|
15468
|
+
deprecateOldEmberDataInitializers = function deprecateOldEmberDataInitializers(initializers) {
|
15469
|
+
// collect all of the initializers
|
15470
|
+
var keys = Object.keys(initializers);
|
15509
15471
|
|
15510
|
-
|
15511
|
-
|
15512
|
-
var deprecatedAfterInitializer = matchesDeprecatedInititalizer(initializer.after);
|
15513
|
-
var deprecatedProp = deprecatedBeforeInitializer ? 'before' : 'after';
|
15472
|
+
for (var i = 0; i < keys.length; i++) {
|
15473
|
+
var name = keys[i];
|
15514
15474
|
|
15515
|
-
|
15516
|
-
|
15517
|
-
|
15518
|
-
|
15475
|
+
// filter out all of the Ember Data initializer. We have some
|
15476
|
+
// deprecated initializers that depend on other deprecated
|
15477
|
+
// initializers which may trigger the deprecation warning
|
15478
|
+
// unintentionally.
|
15479
|
+
if (!matchesDeprecatedInititalizer(name)) {
|
15480
|
+
warnForDeprecatedInitializers(initializers[name]);
|
15481
|
+
}
|
15482
|
+
}
|
15483
|
+
};
|
15519
15484
|
}
|
15520
15485
|
});
|
15521
15486
|
define('ember-data/model', ['exports', 'ember-data/-private'], function (exports, _private) {
|
@@ -15665,7 +15630,7 @@ define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember)
|
|
15665
15630
|
}
|
15666
15631
|
});
|
15667
15632
|
});
|
15668
|
-
define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'
|
15633
|
+
define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], function (exports, _ember) {
|
15669
15634
|
'use strict';
|
15670
15635
|
|
15671
15636
|
exports.__esModule = true;
|
@@ -16067,7 +16032,8 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'em
|
|
16067
16032
|
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
|
16068
16033
|
}
|
16069
16034
|
|
16070
|
-
(
|
16035
|
+
(false && _ember.default.warn('The embedded relationship \'' + serializedKey + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', _ember.default.typeOf(snapshot.hasMany(relationship.key)) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' }));
|
16036
|
+
|
16071
16037
|
|
16072
16038
|
json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
|
16073
16039
|
},
|
@@ -16276,11 +16242,13 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'em
|
|
16276
16242
|
isEmbeddedRecordsMixin: true
|
16277
16243
|
});
|
16278
16244
|
});
|
16279
|
-
define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector', 'ember-data
|
16245
|
+
define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _ember, _emberInflector, _json, _private) {
|
16280
16246
|
'use strict';
|
16281
16247
|
|
16282
16248
|
exports.__esModule = true;
|
16283
|
-
|
16249
|
+
/**
|
16250
|
+
@module ember-data
|
16251
|
+
*/
|
16284
16252
|
|
16285
16253
|
var dasherize = _ember.default.String.dasherize;
|
16286
16254
|
|
@@ -16400,10 +16368,6 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16400
16368
|
@namespace DS
|
16401
16369
|
@extends DS.JSONSerializer
|
16402
16370
|
*/
|
16403
|
-
/**
|
16404
|
-
@module ember-data
|
16405
|
-
*/
|
16406
|
-
|
16407
16371
|
var JSONAPISerializer = _json.default.extend({
|
16408
16372
|
_normalizeDocumentHelper: function (documentHash) {
|
16409
16373
|
|
@@ -16439,10 +16403,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16439
16403
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipDataHash.type);
|
16440
16404
|
|
16441
16405
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16442
|
-
(
|
16406
|
+
(false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16443
16407
|
id: 'ds.json-api-serializer.deprecated-model-name-for-relationship',
|
16444
16408
|
until: '3.0.0'
|
16445
|
-
});
|
16409
|
+
}));
|
16410
|
+
|
16446
16411
|
|
16447
16412
|
modelName = deprecatedModelNameLookup;
|
16448
16413
|
}
|
@@ -16455,9 +16420,10 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16455
16420
|
return relationshipDataHash;
|
16456
16421
|
},
|
16457
16422
|
_normalizeResourceHelper: function (resourceHash) {
|
16458
|
-
(
|
16423
|
+
(false && _ember.default.assert(this.warnMessageForUndefinedType(), !_ember.default.isNone(resourceHash.type), {
|
16459
16424
|
id: 'ds.serializer.type-is-undefined'
|
16460
|
-
});
|
16425
|
+
}));
|
16426
|
+
|
16461
16427
|
|
16462
16428
|
var modelName = void 0,
|
16463
16429
|
usedLookup = void 0;
|
@@ -16469,10 +16435,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16469
16435
|
usedLookup = 'modelNameFromPayloadType';
|
16470
16436
|
|
16471
16437
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16472
|
-
(
|
16438
|
+
(false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a resource. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16473
16439
|
id: 'ds.json-api-serializer.deprecated-model-name-for-resource',
|
16474
16440
|
until: '3.0.0'
|
16475
|
-
});
|
16441
|
+
}));
|
16442
|
+
|
16476
16443
|
|
16477
16444
|
modelName = deprecatedModelNameLookup;
|
16478
16445
|
usedLookup = 'modelNameFromPayloadKey';
|
@@ -16483,9 +16450,10 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16483
16450
|
}
|
16484
16451
|
|
16485
16452
|
if (!this.store._hasModelFor(modelName)) {
|
16486
|
-
(
|
16453
|
+
(false && _ember.default.warn(this.warnMessageNoModelForType(modelName, resourceHash.type, usedLookup), false, {
|
16487
16454
|
id: 'ds.serializer.model-for-type-missing'
|
16488
|
-
});
|
16455
|
+
}));
|
16456
|
+
|
16489
16457
|
return null;
|
16490
16458
|
}
|
16491
16459
|
|
@@ -16512,9 +16480,10 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16512
16480
|
normalizeQueryRecordResponse: function () {
|
16513
16481
|
var normalized = this._super.apply(this, arguments);
|
16514
16482
|
|
16515
|
-
(
|
16483
|
+
(false && _ember.default.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), {
|
16516
16484
|
id: 'ds.serializer.json-api.queryRecord-array-response'
|
16517
|
-
});
|
16485
|
+
}));
|
16486
|
+
|
16518
16487
|
|
16519
16488
|
return normalized;
|
16520
16489
|
},
|
@@ -16529,11 +16498,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16529
16498
|
if (resourceHash.attributes[attributeKey] !== undefined) {
|
16530
16499
|
attributes[key] = resourceHash.attributes[attributeKey];
|
16531
16500
|
}
|
16532
|
-
|
16501
|
+
if (false) {
|
16533
16502
|
if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {
|
16534
|
-
(
|
16503
|
+
(false && _ember.default.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));
|
16535
16504
|
}
|
16536
|
-
}
|
16505
|
+
}
|
16537
16506
|
});
|
16538
16507
|
}
|
16539
16508
|
|
@@ -16571,11 +16540,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16571
16540
|
var relationshipHash = resourceHash.relationships[relationshipKey];
|
16572
16541
|
relationships[key] = _this2.extractRelationship(relationshipHash);
|
16573
16542
|
}
|
16574
|
-
|
16543
|
+
if (false) {
|
16575
16544
|
if (resourceHash.relationships[relationshipKey] === undefined && resourceHash.relationships[key] !== undefined) {
|
16576
|
-
(
|
16545
|
+
(false && _ember.default.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));
|
16577
16546
|
}
|
16578
|
-
}
|
16547
|
+
}
|
16579
16548
|
});
|
16580
16549
|
}
|
16581
16550
|
|
@@ -16587,10 +16556,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16587
16556
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
|
16588
16557
|
|
16589
16558
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
16590
|
-
(
|
16559
|
+
(false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
16591
16560
|
id: 'ds.json-api-serializer.deprecated-model-name-for-polymorphic-type',
|
16592
16561
|
until: '3.0.0'
|
16593
|
-
});
|
16562
|
+
}));
|
16563
|
+
|
16594
16564
|
|
16595
16565
|
modelName = deprecatedModelNameLookup;
|
16596
16566
|
}
|
@@ -16641,10 +16611,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16641
16611
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(snapshot.modelName);
|
16642
16612
|
|
16643
16613
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16644
|
-
(
|
16614
|
+
(false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to customize how a type is serialized. Use payloadTypeFromModelName instead.", false, {
|
16645
16615
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-model',
|
16646
16616
|
until: '3.0.0'
|
16647
|
-
});
|
16617
|
+
}));
|
16618
|
+
|
16648
16619
|
|
16649
16620
|
payloadType = deprecatedPayloadTypeLookup;
|
16650
16621
|
}
|
@@ -16699,10 +16670,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16699
16670
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(belongsTo.modelName);
|
16700
16671
|
|
16701
16672
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16702
|
-
(
|
16673
|
+
(false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
16703
16674
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-belongs-to',
|
16704
16675
|
until: '3.0.0'
|
16705
|
-
});
|
16676
|
+
}));
|
16677
|
+
|
16706
16678
|
|
16707
16679
|
payloadType = deprecatedPayloadTypeLookup;
|
16708
16680
|
}
|
@@ -16750,10 +16722,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16750
16722
|
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(item.modelName);
|
16751
16723
|
|
16752
16724
|
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
16753
|
-
(
|
16725
|
+
(false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
16754
16726
|
id: 'ds.json-api-serializer.deprecated-payload-type-for-has-many',
|
16755
16727
|
until: '3.0.0'
|
16756
|
-
});
|
16728
|
+
}));
|
16729
|
+
|
16757
16730
|
|
16758
16731
|
payloadType = deprecatedPayloadTypeLookup;
|
16759
16732
|
}
|
@@ -16791,16 +16764,16 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16791
16764
|
});
|
16792
16765
|
}
|
16793
16766
|
|
16794
|
-
|
16767
|
+
if (false) {
|
16795
16768
|
JSONAPISerializer.reopen({
|
16796
16769
|
willMergeMixin: function (props) {
|
16797
16770
|
var constructor = this.constructor;
|
16798
|
-
(
|
16771
|
+
(false && _ember.default.warn('You\'ve defined \'extractMeta\' in ' + constructor.toString() + ' which is not used for serializers extending JSONAPISerializer. Read more at http://emberjs.com/api/data/classes/DS.JSONAPISerializer.html#toc_customizing-meta on how to customize meta when using JSON API.', _ember.default.isNone(props.extractMeta) || props.extractMeta === _json.default.prototype.extractMeta, {
|
16799
16772
|
id: 'ds.serializer.json-api.extractMeta'
|
16800
|
-
});
|
16801
|
-
(
|
16773
|
+
}));
|
16774
|
+
(false && _ember.default.warn('The JSONAPISerializer does not work with the EmbeddedRecordsMixin because the JSON API spec does not describe how to format embedded resources.', !props.isEmbeddedRecordsMixin, {
|
16802
16775
|
id: 'ds.serializer.embedded-records-mixin-not-supported'
|
16803
|
-
});
|
16776
|
+
}));
|
16804
16777
|
},
|
16805
16778
|
warnMessageForUndefinedType: function () {
|
16806
16779
|
return 'Encountered a resource object with an undefined type (resolved resource using ' + this.constructor.toString() + ')';
|
@@ -16809,11 +16782,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector'
|
|
16809
16782
|
return 'Encountered a resource object with type "' + originalType + '", but no model was found for model name "' + modelName + '" (resolved model name using \'' + this.constructor.toString() + '.' + usedLookup + '("' + originalType + '")\').';
|
16810
16783
|
}
|
16811
16784
|
});
|
16812
|
-
}
|
16785
|
+
}
|
16813
16786
|
|
16814
16787
|
exports.default = JSONAPISerializer;
|
16815
16788
|
});
|
16816
|
-
define('ember-data/serializers/json', ['exports', 'ember', 'ember-data
|
16789
|
+
define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serializer', 'ember-data/-private'], function (exports, _ember, _serializer, _private) {
|
16817
16790
|
'use strict';
|
16818
16791
|
|
16819
16792
|
exports.__esModule = true;
|
@@ -16890,7 +16863,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
16890
16863
|
- `normalizeResponse` - entry method to the serializer.
|
16891
16864
|
- `normalizeCreateRecordResponse` - a `normalizeResponse` for a specific operation is called.
|
16892
16865
|
- `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect
|
16893
|
-
a single record back, while for methods like `findAll` we expect multiple
|
16866
|
+
a single record back, while for methods like `findAll` we expect multiple records back.
|
16894
16867
|
- `normalize` - `normalizeArray` iterates and calls `normalize` for each of its records while `normalizeSingle`
|
16895
16868
|
calls it once. This is the method you most likely want to subclass.
|
16896
16869
|
- `extractId` | `extractAttributes` | `extractRelationships` - `normalize` delegates to these methods to
|
@@ -17061,7 +17034,8 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17061
17034
|
|
17062
17035
|
var meta = this.extractMeta(store, primaryModelClass, payload);
|
17063
17036
|
if (meta) {
|
17064
|
-
(
|
17037
|
+
(false && _ember.default.assert('The `meta` returned from `extractMeta` has to be an object, not "' + _ember.default.typeOf(meta) + '".', _ember.default.typeOf(meta) === 'object'));
|
17038
|
+
|
17065
17039
|
documentHash.meta = meta;
|
17066
17040
|
}
|
17067
17041
|
|
@@ -17159,10 +17133,11 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17159
17133
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipHash.type);
|
17160
17134
|
|
17161
17135
|
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
17162
|
-
(
|
17136
|
+
(false && !(false) && _ember.default.deprecate("You used modelNameFromPayloadKey to customize how a type is normalized. Use modelNameFromPayloadType instead", false, {
|
17163
17137
|
id: 'ds.json-serializer.deprecated-type-for-polymorphic-relationship',
|
17164
17138
|
until: '3.0.0'
|
17165
|
-
});
|
17139
|
+
}));
|
17140
|
+
|
17166
17141
|
|
17167
17142
|
modelName = deprecatedModelNameLookup;
|
17168
17143
|
}
|
@@ -17278,9 +17253,10 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17278
17253
|
}
|
17279
17254
|
},
|
17280
17255
|
_getMappedKey: function (key, modelClass) {
|
17281
|
-
(
|
17256
|
+
(false && _ember.default.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), {
|
17282
17257
|
id: 'ds.serializer.no-mapped-attrs-key'
|
17283
|
-
});
|
17258
|
+
}));
|
17259
|
+
|
17284
17260
|
|
17285
17261
|
var attrs = get(this, 'attrs');
|
17286
17262
|
var mappedKey = void 0;
|
@@ -17310,10 +17286,10 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17310
17286
|
},
|
17311
17287
|
shouldSerializeHasMany: function (snapshot, key, relationship) {
|
17312
17288
|
if (this._shouldSerializeHasMany !== JSONSerializer.prototype._shouldSerializeHasMany) {
|
17313
|
-
(
|
17289
|
+
(false && !(false) && _ember.default.deprecate('The private method _shouldSerializeHasMany has been promoted to the public API. Please remove the underscore to use the public shouldSerializeHasMany method.', false, {
|
17314
17290
|
id: 'ds.serializer.private-should-serialize-has-many',
|
17315
17291
|
until: '3.0.0'
|
17316
|
-
});
|
17292
|
+
}));
|
17317
17293
|
}
|
17318
17294
|
|
17319
17295
|
return this._shouldSerializeHasMany(snapshot, key, relationship);
|
@@ -17473,7 +17449,8 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17473
17449
|
transformFor: function (attributeType, skipAssertion) {
|
17474
17450
|
var transform = (0, _private.getOwner)(this).lookup('transform:' + attributeType);
|
17475
17451
|
|
17476
|
-
(
|
17452
|
+
(false && _ember.default.assert("Unable to find transform for '" + attributeType + "'", skipAssertion || !!transform));
|
17453
|
+
|
17477
17454
|
|
17478
17455
|
return transform;
|
17479
17456
|
}
|
@@ -17506,7 +17483,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-debug',
|
|
17506
17483
|
|
17507
17484
|
exports.default = JSONSerializer;
|
17508
17485
|
});
|
17509
|
-
define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'ember-data
|
17486
|
+
define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _ember, _emberInflector, _json, _private) {
|
17510
17487
|
'use strict';
|
17511
17488
|
|
17512
17489
|
exports.__esModule = true;
|
@@ -17575,10 +17552,11 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17575
17552
|
},
|
17576
17553
|
normalize: function (modelClass, resourceHash, prop) {
|
17577
17554
|
if (this.normalizeHash && this.normalizeHash[prop]) {
|
17578
|
-
(
|
17555
|
+
(false && !(false) && _ember.default.deprecate('`RESTSerializer.normalizeHash` has been deprecated. Please use `serializer.normalize` to modify the payload of single resources.', false, {
|
17579
17556
|
id: 'ds.serializer.normalize-hash-deprecated',
|
17580
17557
|
until: '3.0.0'
|
17581
|
-
});
|
17558
|
+
}));
|
17559
|
+
|
17582
17560
|
this.normalizeHash[prop](resourceHash);
|
17583
17561
|
}
|
17584
17562
|
return this._super(modelClass, resourceHash);
|
@@ -17623,10 +17601,11 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17623
17601
|
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(hash.type);
|
17624
17602
|
|
17625
17603
|
if (modelName !== deprecatedModelNameLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
17626
|
-
(
|
17604
|
+
(false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This is has been deprecated in favor of modelNameFromPayloadType", false, {
|
17627
17605
|
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
17628
17606
|
until: '3.0.0'
|
17629
|
-
});
|
17607
|
+
}));
|
17608
|
+
|
17630
17609
|
|
17631
17610
|
modelName = deprecatedModelNameLookup;
|
17632
17611
|
}
|
@@ -17650,7 +17629,8 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17650
17629
|
|
17651
17630
|
var meta = this.extractMeta(store, primaryModelClass, payload);
|
17652
17631
|
if (meta) {
|
17653
|
-
(
|
17632
|
+
(false && _ember.default.assert('The `meta` returned from `extractMeta` has to be an object, not "' + _ember.default.typeOf(meta) + '".', _ember.default.typeOf(meta) === 'object'));
|
17633
|
+
|
17654
17634
|
documentHash.meta = meta;
|
17655
17635
|
}
|
17656
17636
|
|
@@ -17685,9 +17665,10 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17685
17665
|
|
17686
17666
|
var typeName = this.modelNameFromPayloadKey(modelName);
|
17687
17667
|
if (!store.modelFactoryFor(typeName)) {
|
17688
|
-
(
|
17668
|
+
(false && _ember.default.warn(this.warnMessageNoModelForKey(modelName, typeName), false, {
|
17689
17669
|
id: 'ds.serializer.model-for-key-missing'
|
17690
|
-
});
|
17670
|
+
}));
|
17671
|
+
|
17691
17672
|
continue;
|
17692
17673
|
}
|
17693
17674
|
|
@@ -17698,15 +17679,15 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17698
17679
|
continue;
|
17699
17680
|
}
|
17700
17681
|
|
17701
|
-
|
17682
|
+
if (false) {
|
17702
17683
|
var isQueryRecordAnArray = requestType === 'queryRecord' && isPrimary && Array.isArray(value);
|
17703
17684
|
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.";
|
17704
17685
|
|
17705
|
-
(
|
17686
|
+
(false && !(!isQueryRecordAnArray) && _ember.default.deprecate(message, !isQueryRecordAnArray, {
|
17706
17687
|
id: 'ds.serializer.rest.queryRecord-array-response',
|
17707
17688
|
until: '3.0'
|
17708
|
-
});
|
17709
|
-
}
|
17689
|
+
}));
|
17690
|
+
}
|
17710
17691
|
|
17711
17692
|
/*
|
17712
17693
|
Support primary data as an object instead of an array.
|
@@ -17787,9 +17768,10 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17787
17768
|
for (var prop in payload) {
|
17788
17769
|
var modelName = this.modelNameFromPayloadKey(prop);
|
17789
17770
|
if (!store.modelFactoryFor(modelName)) {
|
17790
|
-
(
|
17771
|
+
(false && _ember.default.warn(this.warnMessageNoModelForKey(prop, modelName), false, {
|
17791
17772
|
id: 'ds.serializer.model-for-key-missing'
|
17792
|
-
});
|
17773
|
+
}));
|
17774
|
+
|
17793
17775
|
continue;
|
17794
17776
|
}
|
17795
17777
|
var type = store.modelFor(modelName);
|
@@ -17843,10 +17825,11 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17843
17825
|
// `keyForPolymorphicType`. If this is the case, a deprecation warning is
|
17844
17826
|
// logged and the old way is restored (so nothing breaks).
|
17845
17827
|
if (key !== typeKey && this.keyForPolymorphicType === RESTSerializer.prototype.keyForPolymorphicType) {
|
17846
|
-
(
|
17828
|
+
(false && !(false) && _ember.default.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, {
|
17847
17829
|
id: 'ds.rest-serializer.deprecated-key-for-polymorphic-type',
|
17848
17830
|
until: '3.0.0'
|
17849
|
-
});
|
17831
|
+
}));
|
17832
|
+
|
17850
17833
|
|
17851
17834
|
typeKey = key;
|
17852
17835
|
}
|
@@ -17896,10 +17879,11 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17896
17879
|
var deprecatedTypeLookup = this.modelNameFromPayloadKey(payloadType);
|
17897
17880
|
|
17898
17881
|
if (payloadType !== deprecatedTypeLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
17899
|
-
(
|
17882
|
+
(false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
17900
17883
|
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
17901
17884
|
until: '3.0.0'
|
17902
|
-
});
|
17885
|
+
}));
|
17886
|
+
|
17903
17887
|
|
17904
17888
|
type = deprecatedTypeLookup;
|
17905
17889
|
}
|
@@ -17946,13 +17930,13 @@ define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'e
|
|
17946
17930
|
});
|
17947
17931
|
}
|
17948
17932
|
|
17949
|
-
|
17933
|
+
if (false) {
|
17950
17934
|
RESTSerializer.reopen({
|
17951
17935
|
warnMessageNoModelForKey: function (prop, typeKey) {
|
17952
17936
|
return 'Encountered "' + prop + '" in payload, but no model was found for model name "' + typeKey + '" (resolved model name using ' + this.constructor.toString() + '.modelNameFromPayloadKey("' + prop + '"))';
|
17953
17937
|
}
|
17954
17938
|
});
|
17955
|
-
}
|
17939
|
+
}
|
17956
17940
|
|
17957
17941
|
exports.default = RESTSerializer;
|
17958
17942
|
});
|
@@ -18101,7 +18085,7 @@ define('ember-data/transforms/boolean', ['exports', 'ember', 'ember-data/transfo
|
|
18101
18085
|
}
|
18102
18086
|
});
|
18103
18087
|
});
|
18104
|
-
define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform', 'ember'
|
18088
|
+
define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform', 'ember'], function (exports, _transform, _ember) {
|
18105
18089
|
'use strict';
|
18106
18090
|
|
18107
18091
|
exports.__esModule = true;
|
@@ -18122,11 +18106,11 @@ define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transfor
|
|
18122
18106
|
@deprecated
|
18123
18107
|
*/
|
18124
18108
|
_ember.default.Date.parse = function (date) {
|
18125
|
-
|
18126
|
-
(0, _debug.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, {
|
18109
|
+
(false && !(false) && _ember.default.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, {
|
18127
18110
|
id: 'ds.ember.date.parse-deprecate',
|
18128
18111
|
until: '3.0.0'
|
18129
|
-
});
|
18112
|
+
}));
|
18113
|
+
|
18130
18114
|
|
18131
18115
|
return Date.parse(date);
|
18132
18116
|
};
|
@@ -18161,10 +18145,11 @@ define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transfor
|
|
18161
18145
|
var offset = serialized.indexOf('+');
|
18162
18146
|
|
18163
18147
|
if (offset !== -1 && serialized.length - 3 === offset) {
|
18164
|
-
(
|
18148
|
+
(false && !(false) && _ember.default.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, {
|
18165
18149
|
id: 'ds.attr.date.normalize-utc',
|
18166
18150
|
until: '3.0.0'
|
18167
|
-
});
|
18151
|
+
}));
|
18152
|
+
|
18168
18153
|
return new Date(serialized + ':00');
|
18169
18154
|
|
18170
18155
|
// this is a phantom specific bug fix in which +0000 is not supported
|
@@ -18332,7 +18317,7 @@ define("ember-data/version", ["exports"], function (exports) {
|
|
18332
18317
|
"use strict";
|
18333
18318
|
|
18334
18319
|
exports.__esModule = true;
|
18335
|
-
exports.default = "2.
|
18320
|
+
exports.default = "2.15.0-beta.1";
|
18336
18321
|
});
|
18337
18322
|
define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
|
18338
18323
|
"use strict";
|