ember-data-source 2.4.0.beta.2 → 2.4.0.beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dist/globals/ember-data.js +1393 -1344
- data/dist/globals/ember-data.min.js +5 -5
- data/dist/globals/ember-data.prod.js +1426 -1377
- data/package.json +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e47c3dfb7d115413d7bf76880c5314088ae5c43
|
4
|
+
data.tar.gz: 7d4fffe9edfd5609464c29ce0406df60490bec6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8d1bcaa42fe0221c879cf3d3aff669db61472622951637159249e9dbc5ae2683e8504c043b3db5e985c0f00ca77a8d20ef0a26b3fed1c5452eb743cf87e1245
|
7
|
+
data.tar.gz: 0d8b42d598ce4593c3b31b0b233c1722e77a2bce5d4bbd9b57abbdef255dad606ce43557a2f78434668ef04366ebe2b9a8e1db152894b5fc8db72def496b6f24
|
data/dist/globals/ember-data.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* @copyright Copyright 2011-2016 Tilde Inc. and contributors.
|
7
7
|
* Portions Copyright 2011 LivingSocial Inc.
|
8
8
|
* @license Licensed under MIT license (see license.js)
|
9
|
-
* @version 2.4.0-beta.
|
9
|
+
* @version 2.4.0-beta.3
|
10
10
|
*/
|
11
11
|
|
12
12
|
var define, requireModule, require, requirejs;
|
@@ -932,1248 +932,747 @@ define("ember-data/-private/serializers", ["exports", "ember-data/serializers/js
|
|
932
932
|
/**
|
933
933
|
@module ember-data
|
934
934
|
*/
|
935
|
-
define(
|
936
|
-
|
935
|
+
define("ember-data/-private/system/clone-null", ["exports", "ember-data/-private/system/empty-object"], function (exports, _emberDataPrivateSystemEmptyObject) {
|
936
|
+
exports.default = cloneNull;
|
937
937
|
|
938
|
-
|
939
|
-
|
940
|
-
|
938
|
+
function cloneNull(source) {
|
939
|
+
var clone = new _emberDataPrivateSystemEmptyObject.default();
|
940
|
+
for (var key in source) {
|
941
|
+
clone[key] = source[key];
|
942
|
+
}
|
943
|
+
return clone;
|
944
|
+
}
|
945
|
+
});
|
946
|
+
define('ember-data/-private/system/coerce-id', ['exports'], function (exports) {
|
947
|
+
exports.default = coerceId;
|
948
|
+
// Used by the store to normalize IDs entering the store. Despite the fact
|
949
|
+
// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
|
950
|
+
// it is important that internally we use strings, since IDs may be serialized
|
951
|
+
// and lose type information. For example, Ember's router may put a record's
|
952
|
+
// ID into the URL, and if we later try to deserialize that URL and find the
|
953
|
+
// corresponding record, we will not know if it is a string or a number.
|
941
954
|
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
```app/serializers/post.js
|
953
|
-
import DS from 'ember-data';
|
955
|
+
function coerceId(id) {
|
956
|
+
return id == null || id === '' ? null : id + '';
|
957
|
+
}
|
958
|
+
});
|
959
|
+
define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
|
960
|
+
exports.default = ContainerProxy;
|
961
|
+
|
962
|
+
/*
|
963
|
+
This is used internally to enable deprecation of container paths and provide
|
964
|
+
a decent message to the user indicating how to fix the issue.
|
954
965
|
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
966
|
+
@class ContainerProxy
|
967
|
+
@namespace DS
|
968
|
+
@private
|
969
|
+
*/
|
970
|
+
|
971
|
+
function ContainerProxy(container) {
|
972
|
+
this.container = container;
|
973
|
+
}
|
974
|
+
|
975
|
+
ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
|
976
|
+
var _this = this;
|
977
|
+
|
978
|
+
return {
|
979
|
+
create: function () {
|
980
|
+
if (preLookup) {
|
981
|
+
preLookup();
|
982
|
+
}
|
983
|
+
|
984
|
+
return _this.container.lookup(path);
|
959
985
|
}
|
960
|
-
}
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
986
|
+
};
|
987
|
+
};
|
988
|
+
|
989
|
+
ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
|
990
|
+
var factory = this.aliasedFactory(dest, preLookup);
|
991
|
+
|
992
|
+
return this.container.register(source, factory);
|
993
|
+
};
|
994
|
+
|
995
|
+
ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
|
996
|
+
var preLookupCallback = function () {
|
997
|
+
(0, _emberDataPrivateDebug.deprecate)('You tried to look up \'' + deprecated + '\', but this has been deprecated in favor of \'' + valid + '\'.', false, {
|
998
|
+
id: 'ds.store.deprecated-lookup',
|
999
|
+
until: '2.0.0'
|
1000
|
+
});
|
1001
|
+
};
|
1002
|
+
|
1003
|
+
return this.registerAlias(deprecated, valid, preLookupCallback);
|
1004
|
+
};
|
1005
|
+
|
1006
|
+
ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
|
1007
|
+
var i, proxyPair, deprecated, valid;
|
1008
|
+
|
1009
|
+
for (i = proxyPairs.length; i > 0; i--) {
|
1010
|
+
proxyPair = proxyPairs[i - 1];
|
1011
|
+
deprecated = proxyPair['deprecated'];
|
1012
|
+
valid = proxyPair['valid'];
|
1013
|
+
|
1014
|
+
this.registerDeprecation(deprecated, valid);
|
974
1015
|
}
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
do not want the relationship sent at all, you can use `serialize: false`.
|
992
|
-
|
993
|
-
|
994
|
-
### EmbeddedRecordsMixin defaults
|
995
|
-
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
|
996
|
-
will behave in the following way:
|
997
|
-
|
998
|
-
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
|
999
|
-
HasMany: `{ serialize: false, deserialize: 'ids' }`
|
1000
|
-
|
1001
|
-
### Model Relationships
|
1002
|
-
|
1003
|
-
Embedded records must have a model defined to be extracted and serialized. Note that
|
1004
|
-
when defining any relationships on your model such as `belongsTo` and `hasMany`, you
|
1005
|
-
should not both specify `async: true` and also indicate through the serializer's
|
1006
|
-
`attrs` attribute that the related model should be embedded for deserialization.
|
1007
|
-
If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
|
1008
|
-
then do not use `async: true`.
|
1009
|
-
|
1010
|
-
To successfully extract and serialize embedded records the model relationships
|
1011
|
-
must be setup correcty. See the
|
1012
|
-
[defining relationships](/guides/models/defining-models/#toc_defining-relationships)
|
1013
|
-
section of the **Defining Models** guide page.
|
1014
|
-
|
1015
|
-
Records without an `id` property are not considered embedded records, model
|
1016
|
-
instances must have an `id` property to be used with Ember Data.
|
1017
|
-
|
1018
|
-
### Example JSON payloads, Models and Serializers
|
1019
|
-
|
1020
|
-
**When customizing a serializer it is important to grok what the customizations
|
1021
|
-
are. Please read the docs for the methods this mixin provides, in case you need
|
1022
|
-
to modify it to fit your specific needs.**
|
1023
|
-
|
1024
|
-
For example review the docs for each method of this mixin:
|
1025
|
-
* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
|
1026
|
-
* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
|
1027
|
-
* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
|
1016
|
+
};
|
1017
|
+
});
|
1018
|
+
define("ember-data/-private/system/debug", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
|
1019
|
+
exports.default = _emberDataPrivateSystemDebugDebugAdapter.default;
|
1020
|
+
});
|
1021
|
+
/**
|
1022
|
+
@module ember-data
|
1023
|
+
*/
|
1024
|
+
define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'ember-data/model'], function (exports, _ember, _emberDataModel) {
|
1025
|
+
var get = _ember.default.get;
|
1026
|
+
var capitalize = _ember.default.String.capitalize;
|
1027
|
+
var underscore = _ember.default.String.underscore;
|
1028
|
+
var assert = _ember.default.assert;
|
1029
|
+
|
1030
|
+
/*
|
1031
|
+
Extend `Ember.DataAdapter` with ED specific code.
|
1028
1032
|
|
1029
|
-
@class
|
1033
|
+
@class DebugAdapter
|
1030
1034
|
@namespace DS
|
1035
|
+
@extends Ember.DataAdapter
|
1036
|
+
@private
|
1031
1037
|
*/
|
1032
|
-
exports.default = _ember.default.
|
1038
|
+
exports.default = _ember.default.DataAdapter.extend({
|
1039
|
+
getFilters: function () {
|
1040
|
+
return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
|
1041
|
+
},
|
1033
1042
|
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
{
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
"body": "Omakase O_o"
|
1049
|
-
}]
|
1043
|
+
detect: function (typeClass) {
|
1044
|
+
return typeClass !== _emberDataModel.default && _emberDataModel.default.detect(typeClass);
|
1045
|
+
},
|
1046
|
+
|
1047
|
+
columnsForType: function (typeClass) {
|
1048
|
+
var columns = [{
|
1049
|
+
name: 'id',
|
1050
|
+
desc: 'Id'
|
1051
|
+
}];
|
1052
|
+
var count = 0;
|
1053
|
+
var self = this;
|
1054
|
+
get(typeClass, 'attributes').forEach(function (meta, name) {
|
1055
|
+
if (count++ > self.attributeLimit) {
|
1056
|
+
return false;
|
1050
1057
|
}
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
@param {Object} hash to be normalized
|
1056
|
-
@param {String} prop the hash has been referenced by
|
1057
|
-
@return {Object} the normalized hash
|
1058
|
-
**/
|
1059
|
-
normalize: function (typeClass, hash, prop) {
|
1060
|
-
var normalizedHash = this._super(typeClass, hash, prop);
|
1061
|
-
return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
|
1058
|
+
var desc = capitalize(underscore(name).replace('_', ' '));
|
1059
|
+
columns.push({ name: name, desc: desc });
|
1060
|
+
});
|
1061
|
+
return columns;
|
1062
1062
|
},
|
1063
1063
|
|
1064
|
-
|
1065
|
-
if (
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1064
|
+
getRecords: function (modelClass, modelName) {
|
1065
|
+
if (arguments.length < 2) {
|
1066
|
+
// Legacy Ember.js < 1.13 support
|
1067
|
+
var containerKey = modelClass._debugContainerKey;
|
1068
|
+
if (containerKey) {
|
1069
|
+
var match = containerKey.match(/model:(.*)/);
|
1070
|
+
if (match) {
|
1071
|
+
modelName = match[1];
|
1072
|
+
}
|
1073
|
+
}
|
1069
1074
|
}
|
1075
|
+
assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
|
1076
|
+
return this.get('store').peekAll(modelName);
|
1070
1077
|
},
|
1071
1078
|
|
1072
|
-
|
1073
|
-
|
1074
|
-
This example of an author model belongs to a post model:
|
1075
|
-
```js
|
1076
|
-
Post = DS.Model.extend({
|
1077
|
-
title: DS.attr('string'),
|
1078
|
-
body: DS.attr('string'),
|
1079
|
-
author: DS.belongsTo('author')
|
1080
|
-
});
|
1081
|
-
Author = DS.Model.extend({
|
1082
|
-
name: DS.attr('string'),
|
1083
|
-
post: DS.belongsTo('post')
|
1084
|
-
});
|
1085
|
-
```
|
1086
|
-
Use a custom (type) serializer for the post model to configure embedded author
|
1087
|
-
```app/serializers/post.js
|
1088
|
-
import DS from 'ember-data;
|
1089
|
-
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
1090
|
-
attrs: {
|
1091
|
-
author: { embedded: 'always' }
|
1092
|
-
}
|
1093
|
-
})
|
1094
|
-
```
|
1095
|
-
A payload with an attribute configured for embedded records can serialize
|
1096
|
-
the records together under the root attribute's payload:
|
1097
|
-
```js
|
1098
|
-
{
|
1099
|
-
"post": {
|
1100
|
-
"id": "1"
|
1101
|
-
"title": "Rails is omakase",
|
1102
|
-
"author": {
|
1103
|
-
"id": "2"
|
1104
|
-
"name": "dhh"
|
1105
|
-
}
|
1106
|
-
}
|
1107
|
-
}
|
1108
|
-
```
|
1109
|
-
@method serializeBelongsTo
|
1110
|
-
@param {DS.Snapshot} snapshot
|
1111
|
-
@param {Object} json
|
1112
|
-
@param {Object} relationship
|
1113
|
-
*/
|
1114
|
-
serializeBelongsTo: function (snapshot, json, relationship) {
|
1115
|
-
var attr = relationship.key;
|
1116
|
-
if (this.noSerializeOptionSpecified(attr)) {
|
1117
|
-
this._super(snapshot, json, relationship);
|
1118
|
-
return;
|
1119
|
-
}
|
1120
|
-
var includeIds = this.hasSerializeIdsOption(attr);
|
1121
|
-
var includeRecords = this.hasSerializeRecordsOption(attr);
|
1122
|
-
var embeddedSnapshot = snapshot.belongsTo(attr);
|
1123
|
-
var key;
|
1124
|
-
if (includeIds) {
|
1125
|
-
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
|
1126
|
-
if (!embeddedSnapshot) {
|
1127
|
-
json[key] = null;
|
1128
|
-
} else {
|
1129
|
-
json[key] = embeddedSnapshot.id;
|
1130
|
-
|
1131
|
-
if (relationship.options.polymorphic) {
|
1132
|
-
this.serializePolymorphicType(snapshot, json, relationship);
|
1133
|
-
}
|
1134
|
-
}
|
1135
|
-
} else if (includeRecords) {
|
1136
|
-
this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
|
1137
|
-
}
|
1138
|
-
},
|
1079
|
+
getRecordColumnValues: function (record) {
|
1080
|
+
var _this = this;
|
1139
1081
|
|
1140
|
-
|
1141
|
-
var
|
1142
|
-
var serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
|
1143
|
-
if (!embeddedSnapshot) {
|
1144
|
-
json[serializedKey] = null;
|
1145
|
-
} else {
|
1146
|
-
json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
|
1147
|
-
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
|
1082
|
+
var count = 0;
|
1083
|
+
var columnValues = { id: get(record, 'id') };
|
1148
1084
|
|
1149
|
-
|
1150
|
-
|
1085
|
+
record.eachAttribute(function (key) {
|
1086
|
+
if (count++ > _this.attributeLimit) {
|
1087
|
+
return false;
|
1151
1088
|
}
|
1152
|
-
|
1089
|
+
var value = get(record, key);
|
1090
|
+
columnValues[key] = value;
|
1091
|
+
});
|
1092
|
+
return columnValues;
|
1153
1093
|
},
|
1154
1094
|
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
title: DS.attr('string'),
|
1161
|
-
body: DS.attr('string'),
|
1162
|
-
comments: DS.hasMany('comment')
|
1095
|
+
getRecordKeywords: function (record) {
|
1096
|
+
var keywords = [];
|
1097
|
+
var keys = _ember.default.A(['id']);
|
1098
|
+
record.eachAttribute(function (key) {
|
1099
|
+
return keys.push(key);
|
1163
1100
|
});
|
1164
|
-
|
1165
|
-
|
1166
|
-
post: DS.belongsTo('post')
|
1101
|
+
keys.forEach(function (key) {
|
1102
|
+
return keywords.push(get(record, key));
|
1167
1103
|
});
|
1168
|
-
|
1169
|
-
Use a custom (type) serializer for the post model to configure embedded comments
|
1170
|
-
```app/serializers/post.js
|
1171
|
-
import DS from 'ember-data;
|
1172
|
-
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
1173
|
-
attrs: {
|
1174
|
-
comments: { embedded: 'always' }
|
1175
|
-
}
|
1176
|
-
})
|
1177
|
-
```
|
1178
|
-
A payload with an attribute configured for embedded records can serialize
|
1179
|
-
the records together under the root attribute's payload:
|
1180
|
-
```js
|
1181
|
-
{
|
1182
|
-
"post": {
|
1183
|
-
"id": "1"
|
1184
|
-
"title": "Rails is omakase",
|
1185
|
-
"body": "I want this for my ORM, I want that for my template language..."
|
1186
|
-
"comments": [{
|
1187
|
-
"id": "1",
|
1188
|
-
"body": "Rails is unagi"
|
1189
|
-
}, {
|
1190
|
-
"id": "2",
|
1191
|
-
"body": "Omakase O_o"
|
1192
|
-
}]
|
1193
|
-
}
|
1194
|
-
}
|
1195
|
-
```
|
1196
|
-
The attrs options object can use more specific instruction for extracting and
|
1197
|
-
serializing. When serializing, an option to embed `ids` or `records` can be set.
|
1198
|
-
When extracting the only option is `records`.
|
1199
|
-
So `{ embedded: 'always' }` is shorthand for:
|
1200
|
-
`{ serialize: 'records', deserialize: 'records' }`
|
1201
|
-
To embed the `ids` for a related object (using a hasMany relationship):
|
1202
|
-
```app/serializers/post.js
|
1203
|
-
import DS from 'ember-data;
|
1204
|
-
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
1205
|
-
attrs: {
|
1206
|
-
comments: { serialize: 'ids', deserialize: 'records' }
|
1207
|
-
}
|
1208
|
-
})
|
1209
|
-
```
|
1210
|
-
```js
|
1211
|
-
{
|
1212
|
-
"post": {
|
1213
|
-
"id": "1"
|
1214
|
-
"title": "Rails is omakase",
|
1215
|
-
"body": "I want this for my ORM, I want that for my template language..."
|
1216
|
-
"comments": ["1", "2"]
|
1217
|
-
}
|
1218
|
-
}
|
1219
|
-
```
|
1220
|
-
@method serializeHasMany
|
1221
|
-
@param {DS.Snapshot} snapshot
|
1222
|
-
@param {Object} json
|
1223
|
-
@param {Object} relationship
|
1224
|
-
*/
|
1225
|
-
serializeHasMany: function (snapshot, json, relationship) {
|
1226
|
-
var attr = relationship.key;
|
1227
|
-
if (this.noSerializeOptionSpecified(attr)) {
|
1228
|
-
this._super(snapshot, json, relationship);
|
1229
|
-
return;
|
1230
|
-
}
|
1231
|
-
var includeIds = this.hasSerializeIdsOption(attr);
|
1232
|
-
var includeRecords = this.hasSerializeRecordsOption(attr);
|
1233
|
-
if (includeIds) {
|
1234
|
-
var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
|
1235
|
-
json[serializedKey] = snapshot.hasMany(attr, { ids: true });
|
1236
|
-
} else if (includeRecords) {
|
1237
|
-
this._serializeEmbeddedHasMany(snapshot, json, relationship);
|
1238
|
-
}
|
1239
|
-
},
|
1240
|
-
|
1241
|
-
_serializeEmbeddedHasMany: function (snapshot, json, relationship) {
|
1242
|
-
var serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
|
1243
|
-
|
1244
|
-
(0, _emberDataPrivateDebug.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' });
|
1245
|
-
|
1246
|
-
json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
|
1104
|
+
return keywords;
|
1247
1105
|
},
|
1248
1106
|
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
var ret = new Array(manyArray.length);
|
1256
|
-
|
1257
|
-
for (var i = 0; i < manyArray.length; i++) {
|
1258
|
-
var embeddedSnapshot = manyArray[i];
|
1259
|
-
var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
|
1260
|
-
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
|
1261
|
-
ret[i] = embeddedJson;
|
1262
|
-
}
|
1263
|
-
|
1264
|
-
return ret;
|
1107
|
+
getRecordFilterValues: function (record) {
|
1108
|
+
return {
|
1109
|
+
isNew: record.get('isNew'),
|
1110
|
+
isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
|
1111
|
+
isClean: !record.get('hasDirtyAttributes')
|
1112
|
+
};
|
1265
1113
|
},
|
1266
1114
|
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
the parent record.
|
1274
|
-
@method removeEmbeddedForeignKey
|
1275
|
-
@param {DS.Snapshot} snapshot
|
1276
|
-
@param {DS.Snapshot} embeddedSnapshot
|
1277
|
-
@param {Object} relationship
|
1278
|
-
@param {Object} json
|
1279
|
-
*/
|
1280
|
-
removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
|
1281
|
-
if (relationship.kind === 'hasMany') {
|
1282
|
-
return;
|
1283
|
-
} else if (relationship.kind === 'belongsTo') {
|
1284
|
-
var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
|
1285
|
-
if (parentRecord) {
|
1286
|
-
var name = parentRecord.name;
|
1287
|
-
var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
|
1288
|
-
var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
|
1289
|
-
if (parentKey) {
|
1290
|
-
delete json[parentKey];
|
1291
|
-
}
|
1292
|
-
}
|
1115
|
+
getRecordColor: function (record) {
|
1116
|
+
var color = 'black';
|
1117
|
+
if (record.get('isNew')) {
|
1118
|
+
color = 'green';
|
1119
|
+
} else if (record.get('hasDirtyAttributes')) {
|
1120
|
+
color = 'blue';
|
1293
1121
|
}
|
1122
|
+
return color;
|
1294
1123
|
},
|
1295
1124
|
|
1296
|
-
|
1297
|
-
|
1298
|
-
var
|
1299
|
-
return option && option.embedded === 'always';
|
1300
|
-
},
|
1125
|
+
observeRecord: function (record, recordUpdated) {
|
1126
|
+
var releaseMethods = _ember.default.A();
|
1127
|
+
var keysToObserve = _ember.default.A(['id', 'isNew', 'hasDirtyAttributes']);
|
1301
1128
|
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
var
|
1306
|
-
return alwaysEmbed || option && option.serialize === 'records';
|
1307
|
-
},
|
1129
|
+
record.eachAttribute(function (key) {
|
1130
|
+
return keysToObserve.push(key);
|
1131
|
+
});
|
1132
|
+
var adapter = this;
|
1308
1133
|
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
return !(option && (option.serialize || option.embedded));
|
1319
|
-
},
|
1134
|
+
keysToObserve.forEach(function (key) {
|
1135
|
+
var handler = function () {
|
1136
|
+
recordUpdated(adapter.wrapRecord(record));
|
1137
|
+
};
|
1138
|
+
_ember.default.addObserver(record, key, handler);
|
1139
|
+
releaseMethods.push(function () {
|
1140
|
+
_ember.default.removeObserver(record, key, handler);
|
1141
|
+
});
|
1142
|
+
});
|
1320
1143
|
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
var option = this.attrsOption(attr);
|
1327
|
-
return alwaysEmbed || option && option.deserialize === 'records';
|
1328
|
-
},
|
1144
|
+
var release = function () {
|
1145
|
+
releaseMethods.forEach(function (fn) {
|
1146
|
+
return fn();
|
1147
|
+
});
|
1148
|
+
};
|
1329
1149
|
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1150
|
+
return release;
|
1151
|
+
}
|
1152
|
+
});
|
1153
|
+
});
|
1154
|
+
/**
|
1155
|
+
@module ember-data
|
1156
|
+
*/
|
1157
|
+
define('ember-data/-private/system/debug/debug-info', ['exports', 'ember'], function (exports, _ember) {
|
1158
|
+
exports.default = _ember.default.Mixin.create({
|
1334
1159
|
|
1335
1160
|
/**
|
1336
|
-
|
1337
|
-
|
1161
|
+
Provides info about the model for debugging purposes
|
1162
|
+
by grouping the properties into more semantic groups.
|
1163
|
+
Meant to be used by debugging tools such as the Chrome Ember Extension.
|
1164
|
+
- Groups all attributes in "Attributes" group.
|
1165
|
+
- Groups all belongsTo relationships in "Belongs To" group.
|
1166
|
+
- Groups all hasMany relationships in "Has Many" group.
|
1167
|
+
- Groups all flags in "Flags" group.
|
1168
|
+
- Flags relationship CPs as expensive properties.
|
1169
|
+
@method _debugInfo
|
1170
|
+
@for DS.Model
|
1171
|
+
@private
|
1338
1172
|
*/
|
1339
|
-
|
1340
|
-
var
|
1173
|
+
_debugInfo: function () {
|
1174
|
+
var attributes = ['id'];
|
1175
|
+
var relationships = { belongsTo: [], hasMany: [] };
|
1176
|
+
var expensiveProperties = [];
|
1341
1177
|
|
1342
|
-
|
1343
|
-
|
1344
|
-
if (relationship.kind === "hasMany") {
|
1345
|
-
_this._extractEmbeddedHasMany(store, key, partial, relationship);
|
1346
|
-
}
|
1347
|
-
if (relationship.kind === "belongsTo") {
|
1348
|
-
_this._extractEmbeddedBelongsTo(store, key, partial, relationship);
|
1349
|
-
}
|
1350
|
-
}
|
1178
|
+
this.eachAttribute(function (name, meta) {
|
1179
|
+
return attributes.push(name);
|
1351
1180
|
});
|
1352
|
-
return partial;
|
1353
|
-
},
|
1354
|
-
|
1355
|
-
/**
|
1356
|
-
@method _extractEmbeddedHasMany
|
1357
|
-
@private
|
1358
|
-
*/
|
1359
|
-
_extractEmbeddedHasMany: function (store, key, hash, relationshipMeta) {
|
1360
|
-
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
|
1361
|
-
|
1362
|
-
if (!relationshipHash) {
|
1363
|
-
return;
|
1364
|
-
}
|
1365
|
-
|
1366
|
-
var hasMany = new Array(relationshipHash.length);
|
1367
|
-
|
1368
|
-
for (var i = 0; i < relationshipHash.length; i++) {
|
1369
|
-
var item = relationshipHash[i];
|
1370
|
-
|
1371
|
-
var _normalizeEmbeddedRelationship = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
|
1372
1181
|
|
1373
|
-
|
1374
|
-
|
1182
|
+
this.eachRelationship(function (name, relationship) {
|
1183
|
+
relationships[relationship.kind].push(name);
|
1184
|
+
expensiveProperties.push(name);
|
1185
|
+
});
|
1375
1186
|
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1187
|
+
var groups = [{
|
1188
|
+
name: 'Attributes',
|
1189
|
+
properties: attributes,
|
1190
|
+
expand: true
|
1191
|
+
}, {
|
1192
|
+
name: 'Belongs To',
|
1193
|
+
properties: relationships.belongsTo,
|
1194
|
+
expand: true
|
1195
|
+
}, {
|
1196
|
+
name: 'Has Many',
|
1197
|
+
properties: relationships.hasMany,
|
1198
|
+
expand: true
|
1199
|
+
}, {
|
1200
|
+
name: 'Flags',
|
1201
|
+
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
|
1202
|
+
}];
|
1380
1203
|
|
1381
|
-
|
1204
|
+
return {
|
1205
|
+
propertyInfo: {
|
1206
|
+
// include all other mixins / properties (not just the grouped ones)
|
1207
|
+
includeOtherProperties: true,
|
1208
|
+
groups: groups,
|
1209
|
+
// don't pre-calculate unless cached
|
1210
|
+
expensiveProperties: expensiveProperties
|
1382
1211
|
}
|
1212
|
+
};
|
1213
|
+
}
|
1214
|
+
});
|
1215
|
+
});
|
1216
|
+
define("ember-data/-private/system/empty-object", ["exports"], function (exports) {
|
1217
|
+
exports.default = EmptyObject;
|
1218
|
+
// This exists because `Object.create(null)` is absurdly slow compared
|
1219
|
+
// to `new EmptyObject()`. In either case, you want a null prototype
|
1220
|
+
// when you're treating the object instances as arbitrary dictionaries
|
1221
|
+
// and don't want your keys colliding with build-in methods on the
|
1222
|
+
// default object prototype.
|
1223
|
+
var proto = Object.create(null, {
|
1224
|
+
// without this, we will always still end up with (new
|
1225
|
+
// EmptyObject()).constructor === Object
|
1226
|
+
constructor: {
|
1227
|
+
value: undefined,
|
1228
|
+
enumerable: false,
|
1229
|
+
writable: true
|
1230
|
+
}
|
1231
|
+
});
|
1383
1232
|
|
1384
|
-
|
1385
|
-
}
|
1386
|
-
|
1387
|
-
var relationship = { data: hasMany };
|
1388
|
-
set(hash, 'data.relationships.' + key, relationship);
|
1389
|
-
},
|
1390
|
-
|
1391
|
-
/**
|
1392
|
-
@method _extractEmbeddedBelongsTo
|
1393
|
-
@private
|
1394
|
-
*/
|
1395
|
-
_extractEmbeddedBelongsTo: function (store, key, hash, relationshipMeta) {
|
1396
|
-
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
|
1397
|
-
if (!relationshipHash) {
|
1398
|
-
return;
|
1399
|
-
}
|
1400
|
-
|
1401
|
-
var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
|
1402
|
-
|
1403
|
-
var data = _normalizeEmbeddedRelationship2.data;
|
1404
|
-
var included = _normalizeEmbeddedRelationship2.included;
|
1405
|
-
|
1406
|
-
hash.included = hash.included || [];
|
1407
|
-
hash.included.push(data);
|
1408
|
-
if (included) {
|
1409
|
-
var _hash$included2;
|
1410
|
-
|
1411
|
-
(_hash$included2 = hash.included).push.apply(_hash$included2, _toConsumableArray(included));
|
1412
|
-
}
|
1413
|
-
|
1414
|
-
var belongsTo = { id: data.id, type: data.type };
|
1415
|
-
var relationship = { data: belongsTo };
|
1233
|
+
function EmptyObject() {}
|
1416
1234
|
|
1417
|
-
|
1418
|
-
|
1235
|
+
EmptyObject.prototype = proto;
|
1236
|
+
});
|
1237
|
+
define('ember-data/-private/system/is-array-like', ['exports', 'ember'], function (exports, _ember) {
|
1238
|
+
exports.default = isArrayLike;
|
1419
1239
|
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
var serializer = store.serializerFor(modelName);
|
1240
|
+
/*
|
1241
|
+
We're using this to detect arrays and "array-like" objects.
|
1242
|
+
|
1243
|
+
This is a copy of the `isArray` method found in `ember-runtime/utils` as we're
|
1244
|
+
currently unable to import non-exposed modules.
|
1245
|
+
|
1246
|
+
This method was previously exposed as `Ember.isArray` but since
|
1247
|
+
https://github.com/emberjs/ember.js/pull/11463 `Ember.isArray` is an alias of
|
1248
|
+
`Array.isArray` hence removing the "array-like" part.
|
1249
|
+
*/
|
1431
1250
|
|
1432
|
-
|
1251
|
+
function isArrayLike(obj) {
|
1252
|
+
if (!obj || obj.setInterval) {
|
1253
|
+
return false;
|
1254
|
+
}
|
1255
|
+
if (Array.isArray(obj)) {
|
1256
|
+
return true;
|
1257
|
+
}
|
1258
|
+
if (_ember.default.Array.detect(obj)) {
|
1259
|
+
return true;
|
1433
1260
|
}
|
1434
|
-
});
|
1435
|
-
});
|
1436
|
-
define("ember-data/-private/system/clone-null", ["exports", "ember-data/-private/system/empty-object"], function (exports, _emberDataPrivateSystemEmptyObject) {
|
1437
|
-
exports.default = cloneNull;
|
1438
1261
|
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
clone[key] = source[key];
|
1262
|
+
var type = _ember.default.typeOf(obj);
|
1263
|
+
if ('array' === type) {
|
1264
|
+
return true;
|
1443
1265
|
}
|
1444
|
-
|
1266
|
+
if (obj.length !== undefined && 'object' === type) {
|
1267
|
+
return true;
|
1268
|
+
}
|
1269
|
+
return false;
|
1445
1270
|
}
|
1446
1271
|
});
|
1447
|
-
define(
|
1448
|
-
exports.default = coerceId;
|
1449
|
-
// Used by the store to normalize IDs entering the store. Despite the fact
|
1450
|
-
// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
|
1451
|
-
// it is important that internally we use strings, since IDs may be serialized
|
1452
|
-
// and lose type information. For example, Ember's router may put a record's
|
1453
|
-
// ID into the URL, and if we later try to deserialize that URL and find the
|
1454
|
-
// corresponding record, we will not know if it is a string or a number.
|
1272
|
+
define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies) {
|
1455
1273
|
|
1456
|
-
|
1457
|
-
|
1458
|
-
}
|
1459
|
-
});
|
1460
|
-
define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
|
1461
|
-
exports.default = ContainerProxy;
|
1274
|
+
var get = _ember.default.get;
|
1275
|
+
var set = _ember.default.set;
|
1462
1276
|
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1277
|
+
/**
|
1278
|
+
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
1279
|
+
relationship.
|
1466
1280
|
|
1467
|
-
|
1281
|
+
The `ManyArray` is instantiated lazily the first time the relationship is
|
1282
|
+
requested.
|
1283
|
+
|
1284
|
+
### Inverses
|
1285
|
+
|
1286
|
+
Often, the relationships in Ember Data applications will have
|
1287
|
+
an inverse. For example, imagine the following models are
|
1288
|
+
defined:
|
1289
|
+
|
1290
|
+
```app/models/post.js
|
1291
|
+
import DS from 'ember-data';
|
1292
|
+
|
1293
|
+
export default DS.Model.extend({
|
1294
|
+
comments: DS.hasMany('comment')
|
1295
|
+
});
|
1296
|
+
```
|
1297
|
+
|
1298
|
+
```app/models/comment.js
|
1299
|
+
import DS from 'ember-data';
|
1300
|
+
|
1301
|
+
export default DS.Model.extend({
|
1302
|
+
post: DS.belongsTo('post')
|
1303
|
+
});
|
1304
|
+
```
|
1305
|
+
|
1306
|
+
If you created a new instance of `App.Post` and added
|
1307
|
+
a `App.Comment` record to its `comments` has-many
|
1308
|
+
relationship, you would expect the comment's `post`
|
1309
|
+
property to be set to the post that contained
|
1310
|
+
the has-many.
|
1311
|
+
|
1312
|
+
We call the record to which a relationship belongs the
|
1313
|
+
relationship's _owner_.
|
1314
|
+
|
1315
|
+
@class ManyArray
|
1468
1316
|
@namespace DS
|
1469
|
-
@
|
1317
|
+
@extends Ember.Object
|
1318
|
+
@uses Ember.MutableArray, Ember.Evented
|
1470
1319
|
*/
|
1320
|
+
exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, {
|
1321
|
+
init: function () {
|
1322
|
+
this._super.apply(this, arguments);
|
1323
|
+
this.currentState = _ember.default.A([]);
|
1324
|
+
},
|
1471
1325
|
|
1472
|
-
|
1473
|
-
this.container = container;
|
1474
|
-
}
|
1326
|
+
record: null,
|
1475
1327
|
|
1476
|
-
|
1477
|
-
|
1328
|
+
canonicalState: null,
|
1329
|
+
currentState: null,
|
1478
1330
|
|
1479
|
-
|
1480
|
-
create: function () {
|
1481
|
-
if (preLookup) {
|
1482
|
-
preLookup();
|
1483
|
-
}
|
1331
|
+
length: 0,
|
1484
1332
|
|
1485
|
-
|
1333
|
+
objectAt: function (index) {
|
1334
|
+
//Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
|
1335
|
+
if (!this.currentState[index]) {
|
1336
|
+
return undefined;
|
1486
1337
|
}
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
|
1491
|
-
var factory = this.aliasedFactory(dest, preLookup);
|
1492
|
-
|
1493
|
-
return this.container.register(source, factory);
|
1494
|
-
};
|
1338
|
+
return this.currentState[index].getRecord();
|
1339
|
+
},
|
1495
1340
|
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
until: '2.0.0'
|
1341
|
+
flushCanonical: function () {
|
1342
|
+
//TODO make this smarter, currently its plenty stupid
|
1343
|
+
var toSet = this.canonicalState.filter(function (internalModel) {
|
1344
|
+
return !internalModel.isDeleted();
|
1501
1345
|
});
|
1502
|
-
};
|
1503
1346
|
|
1504
|
-
|
1505
|
-
|
1347
|
+
//a hack for not removing new records
|
1348
|
+
//TODO remove once we have proper diffing
|
1349
|
+
var newRecords = this.currentState.filter(function (internalModel) {
|
1350
|
+
return internalModel.isNew();
|
1351
|
+
});
|
1352
|
+
toSet = toSet.concat(newRecords);
|
1353
|
+
var oldLength = this.length;
|
1354
|
+
this.arrayContentWillChange(0, this.length, toSet.length);
|
1355
|
+
this.set('length', toSet.length);
|
1356
|
+
this.currentState = toSet;
|
1357
|
+
this.arrayContentDidChange(0, oldLength, this.length);
|
1358
|
+
//TODO Figure out to notify only on additions and maybe only if unloaded
|
1359
|
+
this.relationship.notifyHasManyChanged();
|
1360
|
+
this.record.updateRecordArrays();
|
1361
|
+
},
|
1362
|
+
/**
|
1363
|
+
`true` if the relationship is polymorphic, `false` otherwise.
|
1364
|
+
@property {Boolean} isPolymorphic
|
1365
|
+
@private
|
1366
|
+
*/
|
1367
|
+
isPolymorphic: false,
|
1506
1368
|
|
1507
|
-
|
1508
|
-
|
1369
|
+
/**
|
1370
|
+
The loading state of this array
|
1371
|
+
@property {Boolean} isLoaded
|
1372
|
+
*/
|
1373
|
+
isLoaded: false,
|
1509
1374
|
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1375
|
+
/**
|
1376
|
+
The relationship which manages this array.
|
1377
|
+
@property {ManyRelationship} relationship
|
1378
|
+
@private
|
1379
|
+
*/
|
1380
|
+
relationship: null,
|
1514
1381
|
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1382
|
+
/**
|
1383
|
+
Metadata associated with the request for async hasMany relationships.
|
1384
|
+
Example
|
1385
|
+
Given that the server returns the following JSON payload when fetching a
|
1386
|
+
hasMany relationship:
|
1387
|
+
```js
|
1388
|
+
{
|
1389
|
+
"comments": [{
|
1390
|
+
"id": 1,
|
1391
|
+
"comment": "This is the first comment",
|
1392
|
+
}, {
|
1393
|
+
// ...
|
1394
|
+
}],
|
1395
|
+
"meta": {
|
1396
|
+
"page": 1,
|
1397
|
+
"total": 5
|
1398
|
+
}
|
1399
|
+
}
|
1400
|
+
```
|
1401
|
+
You can then access the metadata via the `meta` property:
|
1402
|
+
```js
|
1403
|
+
post.get('comments').then(function(comments) {
|
1404
|
+
var meta = comments.get('meta');
|
1405
|
+
// meta.page => 1
|
1406
|
+
// meta.total => 5
|
1407
|
+
});
|
1408
|
+
```
|
1409
|
+
@property {Object} meta
|
1410
|
+
@public
|
1411
|
+
*/
|
1412
|
+
meta: null,
|
1530
1413
|
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1414
|
+
internalReplace: function (idx, amt, objects) {
|
1415
|
+
if (!objects) {
|
1416
|
+
objects = [];
|
1417
|
+
}
|
1418
|
+
this.arrayContentWillChange(idx, amt, objects.length);
|
1419
|
+
this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
|
1420
|
+
this.set('length', this.currentState.length);
|
1421
|
+
this.arrayContentDidChange(idx, amt, objects.length);
|
1422
|
+
if (objects) {
|
1423
|
+
//TODO(Igor) probably needed only for unloaded records
|
1424
|
+
this.relationship.notifyHasManyChanged();
|
1425
|
+
}
|
1426
|
+
this.record.updateRecordArrays();
|
1542
1427
|
},
|
1543
1428
|
|
1544
|
-
|
1545
|
-
|
1429
|
+
//TODO(Igor) optimize
|
1430
|
+
internalRemoveRecords: function (records) {
|
1431
|
+
var index;
|
1432
|
+
for (var i = 0; i < records.length; i++) {
|
1433
|
+
index = this.currentState.indexOf(records[i]);
|
1434
|
+
this.internalReplace(index, 1);
|
1435
|
+
}
|
1546
1436
|
},
|
1547
1437
|
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
}
|
1553
|
-
|
1554
|
-
var self = this;
|
1555
|
-
get(typeClass, 'attributes').forEach(function (meta, name) {
|
1556
|
-
if (count++ > self.attributeLimit) {
|
1557
|
-
return false;
|
1558
|
-
}
|
1559
|
-
var desc = capitalize(underscore(name).replace('_', ' '));
|
1560
|
-
columns.push({ name: name, desc: desc });
|
1561
|
-
});
|
1562
|
-
return columns;
|
1438
|
+
//TODO(Igor) optimize
|
1439
|
+
internalAddRecords: function (records, idx) {
|
1440
|
+
if (idx === undefined) {
|
1441
|
+
idx = this.currentState.length;
|
1442
|
+
}
|
1443
|
+
this.internalReplace(idx, 0, records);
|
1563
1444
|
},
|
1564
1445
|
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
}
|
1446
|
+
replace: function (idx, amt, objects) {
|
1447
|
+
var records;
|
1448
|
+
if (amt > 0) {
|
1449
|
+
records = this.currentState.slice(idx, idx + amt);
|
1450
|
+
this.get('relationship').removeRecords(records);
|
1451
|
+
}
|
1452
|
+
if (objects) {
|
1453
|
+
this.get('relationship').addRecords(objects.map(function (obj) {
|
1454
|
+
return obj._internalModel;
|
1455
|
+
}), idx);
|
1575
1456
|
}
|
1576
|
-
assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
|
1577
|
-
return this.get('store').peekAll(modelName);
|
1578
1457
|
},
|
1458
|
+
/**
|
1459
|
+
Used for async `hasMany` arrays
|
1460
|
+
to keep track of when they will resolve.
|
1461
|
+
@property {Ember.RSVP.Promise} promise
|
1462
|
+
@private
|
1463
|
+
*/
|
1464
|
+
promise: null,
|
1579
1465
|
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
if (count++ > _this.attributeLimit) {
|
1588
|
-
return false;
|
1589
|
-
}
|
1590
|
-
var value = get(record, key);
|
1591
|
-
columnValues[key] = value;
|
1592
|
-
});
|
1593
|
-
return columnValues;
|
1594
|
-
},
|
1595
|
-
|
1596
|
-
getRecordKeywords: function (record) {
|
1597
|
-
var keywords = [];
|
1598
|
-
var keys = _ember.default.A(['id']);
|
1599
|
-
record.eachAttribute(function (key) {
|
1600
|
-
return keys.push(key);
|
1601
|
-
});
|
1602
|
-
keys.forEach(function (key) {
|
1603
|
-
return keywords.push(get(record, key));
|
1604
|
-
});
|
1605
|
-
return keywords;
|
1606
|
-
},
|
1607
|
-
|
1608
|
-
getRecordFilterValues: function (record) {
|
1609
|
-
return {
|
1610
|
-
isNew: record.get('isNew'),
|
1611
|
-
isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
|
1612
|
-
isClean: !record.get('hasDirtyAttributes')
|
1613
|
-
};
|
1466
|
+
/**
|
1467
|
+
@method loadingRecordsCount
|
1468
|
+
@param {Number} count
|
1469
|
+
@private
|
1470
|
+
*/
|
1471
|
+
loadingRecordsCount: function (count) {
|
1472
|
+
this.loadingRecordsCount = count;
|
1614
1473
|
},
|
1615
1474
|
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1475
|
+
/**
|
1476
|
+
@method loadedRecord
|
1477
|
+
@private
|
1478
|
+
*/
|
1479
|
+
loadedRecord: function () {
|
1480
|
+
this.loadingRecordsCount--;
|
1481
|
+
if (this.loadingRecordsCount === 0) {
|
1482
|
+
set(this, 'isLoaded', true);
|
1483
|
+
this.trigger('didLoad');
|
1622
1484
|
}
|
1623
|
-
return color;
|
1624
1485
|
},
|
1625
1486
|
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
var adapter = this;
|
1487
|
+
/**
|
1488
|
+
@method reload
|
1489
|
+
@public
|
1490
|
+
*/
|
1491
|
+
reload: function () {
|
1492
|
+
return this.relationship.reload();
|
1493
|
+
},
|
1634
1494
|
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1495
|
+
/**
|
1496
|
+
Saves all of the records in the `ManyArray`.
|
1497
|
+
Example
|
1498
|
+
```javascript
|
1499
|
+
store.findRecord('inbox', 1).then(function(inbox) {
|
1500
|
+
inbox.get('messages').then(function(messages) {
|
1501
|
+
messages.forEach(function(message) {
|
1502
|
+
message.set('isRead', true);
|
1503
|
+
});
|
1504
|
+
messages.save()
|
1642
1505
|
});
|
1643
1506
|
});
|
1507
|
+
```
|
1508
|
+
@method save
|
1509
|
+
@return {DS.PromiseArray} promise
|
1510
|
+
*/
|
1511
|
+
save: function () {
|
1512
|
+
var manyArray = this;
|
1513
|
+
var promiseLabel = "DS: ManyArray#save " + get(this, 'type');
|
1514
|
+
var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
|
1515
|
+
return manyArray;
|
1516
|
+
}, null, "DS: ManyArray#save return ManyArray");
|
1644
1517
|
|
1645
|
-
|
1646
|
-
|
1647
|
-
return fn();
|
1648
|
-
});
|
1649
|
-
};
|
1650
|
-
|
1651
|
-
return release;
|
1652
|
-
}
|
1653
|
-
});
|
1654
|
-
});
|
1655
|
-
/**
|
1656
|
-
@module ember-data
|
1657
|
-
*/
|
1658
|
-
define('ember-data/-private/system/debug/debug-info', ['exports', 'ember'], function (exports, _ember) {
|
1659
|
-
exports.default = _ember.default.Mixin.create({
|
1518
|
+
return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
|
1519
|
+
},
|
1660
1520
|
|
1661
1521
|
/**
|
1662
|
-
|
1663
|
-
|
1664
|
-
Meant to be used by debugging tools such as the Chrome Ember Extension.
|
1665
|
-
- Groups all attributes in "Attributes" group.
|
1666
|
-
- Groups all belongsTo relationships in "Belongs To" group.
|
1667
|
-
- Groups all hasMany relationships in "Has Many" group.
|
1668
|
-
- Groups all flags in "Flags" group.
|
1669
|
-
- Flags relationship CPs as expensive properties.
|
1670
|
-
@method _debugInfo
|
1671
|
-
@for DS.Model
|
1522
|
+
Create a child record within the owner
|
1523
|
+
@method createRecord
|
1672
1524
|
@private
|
1525
|
+
@param {Object} hash
|
1526
|
+
@return {DS.Model} record
|
1673
1527
|
*/
|
1674
|
-
|
1675
|
-
var
|
1676
|
-
var
|
1677
|
-
var
|
1678
|
-
|
1679
|
-
this.eachAttribute(function (name, meta) {
|
1680
|
-
return attributes.push(name);
|
1681
|
-
});
|
1682
|
-
|
1683
|
-
this.eachRelationship(function (name, relationship) {
|
1684
|
-
relationships[relationship.kind].push(name);
|
1685
|
-
expensiveProperties.push(name);
|
1686
|
-
});
|
1528
|
+
createRecord: function (hash) {
|
1529
|
+
var store = get(this, 'store');
|
1530
|
+
var type = get(this, 'type');
|
1531
|
+
var record;
|
1687
1532
|
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
expand: true
|
1692
|
-
}, {
|
1693
|
-
name: 'Belongs To',
|
1694
|
-
properties: relationships.belongsTo,
|
1695
|
-
expand: true
|
1696
|
-
}, {
|
1697
|
-
name: 'Has Many',
|
1698
|
-
properties: relationships.hasMany,
|
1699
|
-
expand: true
|
1700
|
-
}, {
|
1701
|
-
name: 'Flags',
|
1702
|
-
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
|
1703
|
-
}];
|
1533
|
+
(0, _emberDataPrivateDebug.assert)("You cannot add '" + type.modelName + "' records to this polymorphic relationship.", !get(this, 'isPolymorphic'));
|
1534
|
+
record = store.createRecord(type.modelName, hash);
|
1535
|
+
this.pushObject(record);
|
1704
1536
|
|
1705
|
-
return
|
1706
|
-
propertyInfo: {
|
1707
|
-
// include all other mixins / properties (not just the grouped ones)
|
1708
|
-
includeOtherProperties: true,
|
1709
|
-
groups: groups,
|
1710
|
-
// don't pre-calculate unless cached
|
1711
|
-
expensiveProperties: expensiveProperties
|
1712
|
-
}
|
1713
|
-
};
|
1537
|
+
return record;
|
1714
1538
|
}
|
1715
1539
|
});
|
1716
1540
|
});
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
// and don't want your keys colliding with build-in methods on the
|
1723
|
-
// default object prototype.
|
1724
|
-
var proto = Object.create(null, {
|
1725
|
-
// without this, we will always still end up with (new
|
1726
|
-
// EmptyObject()).constructor === Object
|
1727
|
-
constructor: {
|
1728
|
-
value: undefined,
|
1729
|
-
enumerable: false,
|
1730
|
-
writable: true
|
1731
|
-
}
|
1732
|
-
});
|
1733
|
-
|
1734
|
-
function EmptyObject() {}
|
1541
|
+
/**
|
1542
|
+
@module ember-data
|
1543
|
+
*/
|
1544
|
+
define('ember-data/-private/system/merge', ['exports'], function (exports) {
|
1545
|
+
exports.default = merge;
|
1735
1546
|
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1547
|
+
function merge(original, updates) {
|
1548
|
+
if (!updates || typeof updates !== 'object') {
|
1549
|
+
return original;
|
1550
|
+
}
|
1740
1551
|
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
This is a copy of the `isArray` method found in `ember-runtime/utils` as we're
|
1745
|
-
currently unable to import non-exposed modules.
|
1746
|
-
|
1747
|
-
This method was previously exposed as `Ember.isArray` but since
|
1748
|
-
https://github.com/emberjs/ember.js/pull/11463 `Ember.isArray` is an alias of
|
1749
|
-
`Array.isArray` hence removing the "array-like" part.
|
1750
|
-
*/
|
1552
|
+
var props = Object.keys(updates);
|
1553
|
+
var prop;
|
1554
|
+
var length = props.length;
|
1751
1555
|
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
}
|
1756
|
-
if (Array.isArray(obj)) {
|
1757
|
-
return true;
|
1758
|
-
}
|
1759
|
-
if (_ember.default.Array.detect(obj)) {
|
1760
|
-
return true;
|
1556
|
+
for (var i = 0; i < length; i++) {
|
1557
|
+
prop = props[i];
|
1558
|
+
original[prop] = updates[prop];
|
1761
1559
|
}
|
1762
1560
|
|
1763
|
-
|
1764
|
-
if ('array' === type) {
|
1765
|
-
return true;
|
1766
|
-
}
|
1767
|
-
if (obj.length !== undefined && 'object' === type) {
|
1768
|
-
return true;
|
1769
|
-
}
|
1770
|
-
return false;
|
1561
|
+
return original;
|
1771
1562
|
}
|
1772
1563
|
});
|
1773
|
-
define("ember-data/-private/system/
|
1564
|
+
define("ember-data/-private/system/model", ["exports", "ember-data/-private/system/model/model", "ember-data/attr", "ember-data/-private/system/model/states", "ember-data/-private/system/model/errors"], function (exports, _emberDataPrivateSystemModelModel, _emberDataAttr, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemModelErrors) {
|
1565
|
+
exports.RootState = _emberDataPrivateSystemModelStates.default;
|
1566
|
+
exports.attr = _emberDataAttr.default;
|
1567
|
+
exports.Errors = _emberDataPrivateSystemModelErrors.default;
|
1568
|
+
exports.default = _emberDataPrivateSystemModelModel.default;
|
1569
|
+
});
|
1570
|
+
/**
|
1571
|
+
@module ember-data
|
1572
|
+
*/
|
1573
|
+
define("ember-data/-private/system/model/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
|
1774
1574
|
|
1775
1575
|
var get = _ember.default.get;
|
1776
|
-
var
|
1576
|
+
var Map = _ember.default.Map;
|
1777
1577
|
|
1778
1578
|
/**
|
1779
|
-
|
1780
|
-
relationship.
|
1781
|
-
|
1782
|
-
The `ManyArray` is instantiated lazily the first time the relationship is
|
1783
|
-
requested.
|
1784
|
-
|
1785
|
-
### Inverses
|
1786
|
-
|
1787
|
-
Often, the relationships in Ember Data applications will have
|
1788
|
-
an inverse. For example, imagine the following models are
|
1789
|
-
defined:
|
1790
|
-
|
1791
|
-
```app/models/post.js
|
1792
|
-
import DS from 'ember-data';
|
1793
|
-
|
1794
|
-
export default DS.Model.extend({
|
1795
|
-
comments: DS.hasMany('comment')
|
1796
|
-
});
|
1797
|
-
```
|
1798
|
-
|
1799
|
-
```app/models/comment.js
|
1800
|
-
import DS from 'ember-data';
|
1801
|
-
|
1802
|
-
export default DS.Model.extend({
|
1803
|
-
post: DS.belongsTo('post')
|
1804
|
-
});
|
1805
|
-
```
|
1806
|
-
|
1807
|
-
If you created a new instance of `App.Post` and added
|
1808
|
-
a `App.Comment` record to its `comments` has-many
|
1809
|
-
relationship, you would expect the comment's `post`
|
1810
|
-
property to be set to the post that contained
|
1811
|
-
the has-many.
|
1812
|
-
|
1813
|
-
We call the record to which a relationship belongs the
|
1814
|
-
relationship's _owner_.
|
1815
|
-
|
1816
|
-
@class ManyArray
|
1817
|
-
@namespace DS
|
1818
|
-
@extends Ember.Object
|
1819
|
-
@uses Ember.MutableArray, Ember.Evented
|
1579
|
+
@module ember-data
|
1820
1580
|
*/
|
1821
|
-
exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, {
|
1822
|
-
init: function () {
|
1823
|
-
this._super.apply(this, arguments);
|
1824
|
-
this.currentState = _ember.default.A([]);
|
1825
|
-
},
|
1826
1581
|
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
length: 0,
|
1833
|
-
|
1834
|
-
objectAt: function (index) {
|
1835
|
-
//Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
|
1836
|
-
if (!this.currentState[index]) {
|
1837
|
-
return undefined;
|
1838
|
-
}
|
1839
|
-
return this.currentState[index].getRecord();
|
1840
|
-
},
|
1582
|
+
/**
|
1583
|
+
@class Model
|
1584
|
+
@namespace DS
|
1585
|
+
*/
|
1841
1586
|
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1587
|
+
var AttrClassMethodsMixin = _ember.default.Mixin.create({
|
1588
|
+
/**
|
1589
|
+
A map whose keys are the attributes of the model (properties
|
1590
|
+
described by DS.attr) and whose values are the meta object for the
|
1591
|
+
property.
|
1592
|
+
Example
|
1593
|
+
```app/models/person.js
|
1594
|
+
import DS from 'ember-data';
|
1595
|
+
export default DS.Model.extend({
|
1596
|
+
firstName: attr('string'),
|
1597
|
+
lastName: attr('string'),
|
1598
|
+
birthday: attr('date')
|
1846
1599
|
});
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1600
|
+
```
|
1601
|
+
```javascript
|
1602
|
+
import Ember from 'ember';
|
1603
|
+
import Person from 'app/models/person';
|
1604
|
+
var attributes = Ember.get(Person, 'attributes')
|
1605
|
+
attributes.forEach(function(meta, name) {
|
1606
|
+
console.log(name, meta);
|
1852
1607
|
});
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
},
|
1863
|
-
/**
|
1864
|
-
`true` if the relationship is polymorphic, `false` otherwise.
|
1865
|
-
@property {Boolean} isPolymorphic
|
1866
|
-
@private
|
1608
|
+
// prints:
|
1609
|
+
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
|
1610
|
+
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
|
1611
|
+
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
|
1612
|
+
```
|
1613
|
+
@property attributes
|
1614
|
+
@static
|
1615
|
+
@type {Ember.Map}
|
1616
|
+
@readOnly
|
1867
1617
|
*/
|
1868
|
-
|
1618
|
+
attributes: _ember.default.computed(function () {
|
1619
|
+
var _this = this;
|
1869
1620
|
|
1870
|
-
|
1871
|
-
The loading state of this array
|
1872
|
-
@property {Boolean} isLoaded
|
1873
|
-
*/
|
1874
|
-
isLoaded: false,
|
1621
|
+
var map = Map.create();
|
1875
1622
|
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1623
|
+
this.eachComputedProperty(function (name, meta) {
|
1624
|
+
if (meta.isAttribute) {
|
1625
|
+
(0, _emberDataPrivateDebug.assert)("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this.toString(), name !== 'id');
|
1626
|
+
|
1627
|
+
meta.name = name;
|
1628
|
+
map.set(name, meta);
|
1629
|
+
}
|
1630
|
+
});
|
1631
|
+
|
1632
|
+
return map;
|
1633
|
+
}).readOnly(),
|
1882
1634
|
|
1883
1635
|
/**
|
1884
|
-
|
1636
|
+
A map whose keys are the attributes of the model (properties
|
1637
|
+
described by DS.attr) and whose values are type of transformation
|
1638
|
+
applied to each attribute. This map does not include any
|
1639
|
+
attributes that do not have an transformation type.
|
1885
1640
|
Example
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
}, {
|
1894
|
-
// ...
|
1895
|
-
}],
|
1896
|
-
"meta": {
|
1897
|
-
"page": 1,
|
1898
|
-
"total": 5
|
1899
|
-
}
|
1900
|
-
}
|
1641
|
+
```app/models/person.js
|
1642
|
+
import DS from 'ember-data';
|
1643
|
+
export default DS.Model.extend({
|
1644
|
+
firstName: attr(),
|
1645
|
+
lastName: attr('string'),
|
1646
|
+
birthday: attr('date')
|
1647
|
+
});
|
1901
1648
|
```
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1649
|
+
```javascript
|
1650
|
+
import Ember from 'ember';
|
1651
|
+
import Person from 'app/models/person';
|
1652
|
+
var transformedAttributes = Ember.get(Person, 'transformedAttributes')
|
1653
|
+
transformedAttributes.forEach(function(field, type) {
|
1654
|
+
console.log(field, type);
|
1908
1655
|
});
|
1656
|
+
// prints:
|
1657
|
+
// lastName string
|
1658
|
+
// birthday date
|
1909
1659
|
```
|
1910
|
-
@property
|
1911
|
-
@
|
1660
|
+
@property transformedAttributes
|
1661
|
+
@static
|
1662
|
+
@type {Ember.Map}
|
1663
|
+
@readOnly
|
1912
1664
|
*/
|
1913
|
-
|
1914
|
-
|
1915
|
-
internalReplace: function (idx, amt, objects) {
|
1916
|
-
if (!objects) {
|
1917
|
-
objects = [];
|
1918
|
-
}
|
1919
|
-
this.arrayContentWillChange(idx, amt, objects.length);
|
1920
|
-
this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
|
1921
|
-
this.set('length', this.currentState.length);
|
1922
|
-
this.arrayContentDidChange(idx, amt, objects.length);
|
1923
|
-
if (objects) {
|
1924
|
-
//TODO(Igor) probably needed only for unloaded records
|
1925
|
-
this.relationship.notifyHasManyChanged();
|
1926
|
-
}
|
1927
|
-
this.record.updateRecordArrays();
|
1928
|
-
},
|
1929
|
-
|
1930
|
-
//TODO(Igor) optimize
|
1931
|
-
internalRemoveRecords: function (records) {
|
1932
|
-
var index;
|
1933
|
-
for (var i = 0; i < records.length; i++) {
|
1934
|
-
index = this.currentState.indexOf(records[i]);
|
1935
|
-
this.internalReplace(index, 1);
|
1936
|
-
}
|
1937
|
-
},
|
1938
|
-
|
1939
|
-
//TODO(Igor) optimize
|
1940
|
-
internalAddRecords: function (records, idx) {
|
1941
|
-
if (idx === undefined) {
|
1942
|
-
idx = this.currentState.length;
|
1943
|
-
}
|
1944
|
-
this.internalReplace(idx, 0, records);
|
1945
|
-
},
|
1665
|
+
transformedAttributes: _ember.default.computed(function () {
|
1666
|
+
var map = Map.create();
|
1946
1667
|
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
}
|
1953
|
-
if (objects) {
|
1954
|
-
this.get('relationship').addRecords(objects.map(function (obj) {
|
1955
|
-
return obj._internalModel;
|
1956
|
-
}), idx);
|
1957
|
-
}
|
1958
|
-
},
|
1959
|
-
/**
|
1960
|
-
Used for async `hasMany` arrays
|
1961
|
-
to keep track of when they will resolve.
|
1962
|
-
@property {Ember.RSVP.Promise} promise
|
1963
|
-
@private
|
1964
|
-
*/
|
1965
|
-
promise: null,
|
1668
|
+
this.eachAttribute(function (key, meta) {
|
1669
|
+
if (meta.type) {
|
1670
|
+
map.set(key, meta.type);
|
1671
|
+
}
|
1672
|
+
});
|
1966
1673
|
|
1967
|
-
|
1968
|
-
|
1969
|
-
@param {Number} count
|
1970
|
-
@private
|
1971
|
-
*/
|
1972
|
-
loadingRecordsCount: function (count) {
|
1973
|
-
this.loadingRecordsCount = count;
|
1974
|
-
},
|
1975
|
-
|
1976
|
-
/**
|
1977
|
-
@method loadedRecord
|
1978
|
-
@private
|
1979
|
-
*/
|
1980
|
-
loadedRecord: function () {
|
1981
|
-
this.loadingRecordsCount--;
|
1982
|
-
if (this.loadingRecordsCount === 0) {
|
1983
|
-
set(this, 'isLoaded', true);
|
1984
|
-
this.trigger('didLoad');
|
1985
|
-
}
|
1986
|
-
},
|
1987
|
-
|
1988
|
-
/**
|
1989
|
-
@method reload
|
1990
|
-
@public
|
1991
|
-
*/
|
1992
|
-
reload: function () {
|
1993
|
-
return this.relationship.reload();
|
1994
|
-
},
|
1995
|
-
|
1996
|
-
/**
|
1997
|
-
Saves all of the records in the `ManyArray`.
|
1998
|
-
Example
|
1999
|
-
```javascript
|
2000
|
-
store.findRecord('inbox', 1).then(function(inbox) {
|
2001
|
-
inbox.get('messages').then(function(messages) {
|
2002
|
-
messages.forEach(function(message) {
|
2003
|
-
message.set('isRead', true);
|
2004
|
-
});
|
2005
|
-
messages.save()
|
2006
|
-
});
|
2007
|
-
});
|
2008
|
-
```
|
2009
|
-
@method save
|
2010
|
-
@return {DS.PromiseArray} promise
|
2011
|
-
*/
|
2012
|
-
save: function () {
|
2013
|
-
var manyArray = this;
|
2014
|
-
var promiseLabel = "DS: ManyArray#save " + get(this, 'type');
|
2015
|
-
var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
|
2016
|
-
return manyArray;
|
2017
|
-
}, null, "DS: ManyArray#save return ManyArray");
|
2018
|
-
|
2019
|
-
return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
|
2020
|
-
},
|
2021
|
-
|
2022
|
-
/**
|
2023
|
-
Create a child record within the owner
|
2024
|
-
@method createRecord
|
2025
|
-
@private
|
2026
|
-
@param {Object} hash
|
2027
|
-
@return {DS.Model} record
|
2028
|
-
*/
|
2029
|
-
createRecord: function (hash) {
|
2030
|
-
var store = get(this, 'store');
|
2031
|
-
var type = get(this, 'type');
|
2032
|
-
var record;
|
2033
|
-
|
2034
|
-
(0, _emberDataPrivateDebug.assert)("You cannot add '" + type.modelName + "' records to this polymorphic relationship.", !get(this, 'isPolymorphic'));
|
2035
|
-
record = store.createRecord(type.modelName, hash);
|
2036
|
-
this.pushObject(record);
|
2037
|
-
|
2038
|
-
return record;
|
2039
|
-
}
|
2040
|
-
});
|
2041
|
-
});
|
2042
|
-
/**
|
2043
|
-
@module ember-data
|
2044
|
-
*/
|
2045
|
-
define('ember-data/-private/system/merge', ['exports'], function (exports) {
|
2046
|
-
exports.default = merge;
|
2047
|
-
|
2048
|
-
function merge(original, updates) {
|
2049
|
-
if (!updates || typeof updates !== 'object') {
|
2050
|
-
return original;
|
2051
|
-
}
|
2052
|
-
|
2053
|
-
var props = Object.keys(updates);
|
2054
|
-
var prop;
|
2055
|
-
var length = props.length;
|
2056
|
-
|
2057
|
-
for (var i = 0; i < length; i++) {
|
2058
|
-
prop = props[i];
|
2059
|
-
original[prop] = updates[prop];
|
2060
|
-
}
|
2061
|
-
|
2062
|
-
return original;
|
2063
|
-
}
|
2064
|
-
});
|
2065
|
-
define("ember-data/-private/system/model", ["exports", "ember-data/-private/system/model/model", "ember-data/attr", "ember-data/-private/system/model/states", "ember-data/-private/system/model/errors"], function (exports, _emberDataPrivateSystemModelModel, _emberDataAttr, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemModelErrors) {
|
2066
|
-
exports.RootState = _emberDataPrivateSystemModelStates.default;
|
2067
|
-
exports.attr = _emberDataAttr.default;
|
2068
|
-
exports.Errors = _emberDataPrivateSystemModelErrors.default;
|
2069
|
-
exports.default = _emberDataPrivateSystemModelModel.default;
|
2070
|
-
});
|
2071
|
-
/**
|
2072
|
-
@module ember-data
|
2073
|
-
*/
|
2074
|
-
define("ember-data/-private/system/model/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
|
2075
|
-
|
2076
|
-
var get = _ember.default.get;
|
2077
|
-
var Map = _ember.default.Map;
|
2078
|
-
|
2079
|
-
/**
|
2080
|
-
@module ember-data
|
2081
|
-
*/
|
2082
|
-
|
2083
|
-
/**
|
2084
|
-
@class Model
|
2085
|
-
@namespace DS
|
2086
|
-
*/
|
2087
|
-
|
2088
|
-
var AttrClassMethodsMixin = _ember.default.Mixin.create({
|
2089
|
-
/**
|
2090
|
-
A map whose keys are the attributes of the model (properties
|
2091
|
-
described by DS.attr) and whose values are the meta object for the
|
2092
|
-
property.
|
2093
|
-
Example
|
2094
|
-
```app/models/person.js
|
2095
|
-
import DS from 'ember-data';
|
2096
|
-
export default DS.Model.extend({
|
2097
|
-
firstName: attr('string'),
|
2098
|
-
lastName: attr('string'),
|
2099
|
-
birthday: attr('date')
|
2100
|
-
});
|
2101
|
-
```
|
2102
|
-
```javascript
|
2103
|
-
import Ember from 'ember';
|
2104
|
-
import Person from 'app/models/person';
|
2105
|
-
var attributes = Ember.get(Person, 'attributes')
|
2106
|
-
attributes.forEach(function(meta, name) {
|
2107
|
-
console.log(name, meta);
|
2108
|
-
});
|
2109
|
-
// prints:
|
2110
|
-
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
|
2111
|
-
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
|
2112
|
-
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
|
2113
|
-
```
|
2114
|
-
@property attributes
|
2115
|
-
@static
|
2116
|
-
@type {Ember.Map}
|
2117
|
-
@readOnly
|
2118
|
-
*/
|
2119
|
-
attributes: _ember.default.computed(function () {
|
2120
|
-
var _this = this;
|
2121
|
-
|
2122
|
-
var map = Map.create();
|
2123
|
-
|
2124
|
-
this.eachComputedProperty(function (name, meta) {
|
2125
|
-
if (meta.isAttribute) {
|
2126
|
-
(0, _emberDataPrivateDebug.assert)("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this.toString(), name !== 'id');
|
2127
|
-
|
2128
|
-
meta.name = name;
|
2129
|
-
map.set(name, meta);
|
2130
|
-
}
|
2131
|
-
});
|
2132
|
-
|
2133
|
-
return map;
|
2134
|
-
}).readOnly(),
|
2135
|
-
|
2136
|
-
/**
|
2137
|
-
A map whose keys are the attributes of the model (properties
|
2138
|
-
described by DS.attr) and whose values are type of transformation
|
2139
|
-
applied to each attribute. This map does not include any
|
2140
|
-
attributes that do not have an transformation type.
|
2141
|
-
Example
|
2142
|
-
```app/models/person.js
|
2143
|
-
import DS from 'ember-data';
|
2144
|
-
export default DS.Model.extend({
|
2145
|
-
firstName: attr(),
|
2146
|
-
lastName: attr('string'),
|
2147
|
-
birthday: attr('date')
|
2148
|
-
});
|
2149
|
-
```
|
2150
|
-
```javascript
|
2151
|
-
import Ember from 'ember';
|
2152
|
-
import Person from 'app/models/person';
|
2153
|
-
var transformedAttributes = Ember.get(Person, 'transformedAttributes')
|
2154
|
-
transformedAttributes.forEach(function(field, type) {
|
2155
|
-
console.log(field, type);
|
2156
|
-
});
|
2157
|
-
// prints:
|
2158
|
-
// lastName string
|
2159
|
-
// birthday date
|
2160
|
-
```
|
2161
|
-
@property transformedAttributes
|
2162
|
-
@static
|
2163
|
-
@type {Ember.Map}
|
2164
|
-
@readOnly
|
2165
|
-
*/
|
2166
|
-
transformedAttributes: _ember.default.computed(function () {
|
2167
|
-
var map = Map.create();
|
2168
|
-
|
2169
|
-
this.eachAttribute(function (key, meta) {
|
2170
|
-
if (meta.type) {
|
2171
|
-
map.set(key, meta.type);
|
2172
|
-
}
|
2173
|
-
});
|
2174
|
-
|
2175
|
-
return map;
|
2176
|
-
}).readOnly(),
|
1674
|
+
return map;
|
1675
|
+
}).readOnly(),
|
2177
1676
|
|
2178
1677
|
/**
|
2179
1678
|
Iterates through the attributes of the model, calling the passed function on each
|
@@ -2360,6 +1859,33 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
|
|
2360
1859
|
{{/each}}
|
2361
1860
|
```
|
2362
1861
|
|
1862
|
+
The JSON API spec also allows for object level errors to be placed
|
1863
|
+
in an object with pointer `data`.
|
1864
|
+
|
1865
|
+
```javascript
|
1866
|
+
{
|
1867
|
+
"errors": [
|
1868
|
+
{
|
1869
|
+
"detail": "Some generic non property error message",
|
1870
|
+
"source": {
|
1871
|
+
"pointer": "data"
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
]
|
1875
|
+
}
|
1876
|
+
```
|
1877
|
+
|
1878
|
+
You can access these errors by using the `base` property on the errors
|
1879
|
+
object.
|
1880
|
+
|
1881
|
+
```handlebars
|
1882
|
+
{{#each model.errors.base as |error|}}
|
1883
|
+
<div class="error">
|
1884
|
+
{{error.message}}
|
1885
|
+
</div>
|
1886
|
+
{{/each}}
|
1887
|
+
```
|
1888
|
+
|
2363
1889
|
@class Errors
|
2364
1890
|
@namespace DS
|
2365
1891
|
@extends Ember.Object
|
@@ -7271,11 +6797,10 @@ define("ember-data/-private/system/relationships/has-many", ["exports", "ember",
|
|
7271
6797
|
return relationship.getRecords();
|
7272
6798
|
},
|
7273
6799
|
set: function (key, records) {
|
7274
|
-
var Model = require('ember-data/model').default;
|
7275
6800
|
(0, _emberDataPrivateDebug.assert)("You must pass an array of records to set a hasMany relationship", (0, _emberDataPrivateSystemIsArrayLike.default)(records));
|
7276
6801
|
(0, _emberDataPrivateDebug.assert)("All elements of a hasMany relationship must be instances of DS.Model, you passed " + _ember.default.inspect(records), (function () {
|
7277
6802
|
return _ember.default.A(records).every(function (record) {
|
7278
|
-
return
|
6803
|
+
return record.hasOwnProperty('_internalModel') === true;
|
7279
6804
|
});
|
7280
6805
|
})());
|
7281
6806
|
|
@@ -8001,106 +7526,26 @@ define("ember-data/-private/system/relationships/state/relationship", ["exports"
|
|
8001
7526
|
}
|
8002
7527
|
};
|
8003
7528
|
});
|
8004
|
-
define('ember-data/-private/system/
|
7529
|
+
define('ember-data/-private/system/snapshot-record-array', ['exports', 'ember-data/-private/features'], function (exports, _emberDataPrivateFeatures) {
|
7530
|
+
exports.default = SnapshotRecordArray;
|
8005
7531
|
|
8006
7532
|
/**
|
8007
|
-
|
8008
|
-
application to customize it for your backend. The minimum set of methods
|
8009
|
-
that you should implement is:
|
8010
|
-
|
8011
|
-
* `normalizeResponse()`
|
8012
|
-
* `serialize()`
|
8013
|
-
|
8014
|
-
And you can optionally override the following methods:
|
8015
|
-
|
8016
|
-
* `normalize()`
|
8017
|
-
|
8018
|
-
For an example implementation, see
|
8019
|
-
[DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
|
8020
|
-
|
8021
|
-
@class Serializer
|
7533
|
+
@class SnapshotRecordArray
|
8022
7534
|
@namespace DS
|
8023
|
-
@
|
7535
|
+
@private
|
7536
|
+
@constructor
|
7537
|
+
@param {Array} snapshots An array of snapshots
|
7538
|
+
@param {Object} meta
|
8024
7539
|
*/
|
8025
7540
|
|
8026
|
-
|
7541
|
+
function SnapshotRecordArray(recordArray, meta) {
|
7542
|
+
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
8027
7543
|
|
8028
7544
|
/**
|
8029
|
-
|
8030
|
-
|
8031
|
-
|
8032
|
-
|
8033
|
-
@property store
|
8034
|
-
@type {DS.Store}
|
8035
|
-
@public
|
8036
|
-
*/
|
8037
|
-
|
8038
|
-
/**
|
8039
|
-
The `normalizeResponse` method is used to normalize a payload from the
|
8040
|
-
server to a JSON-API Document.
|
8041
|
-
http://jsonapi.org/format/#document-structure
|
8042
|
-
@method normalizeResponse
|
8043
|
-
@param {DS.Store} store
|
8044
|
-
@param {DS.Model} primaryModelClass
|
8045
|
-
@param {Object} payload
|
8046
|
-
@param {String|Number} id
|
8047
|
-
@param {String} requestType
|
8048
|
-
@return {Object} JSON-API Document
|
8049
|
-
*/
|
8050
|
-
normalizeResponse: null,
|
8051
|
-
|
8052
|
-
/**
|
8053
|
-
The `serialize` method is used when a record is saved in order to convert
|
8054
|
-
the record into the form that your external data source expects.
|
8055
|
-
`serialize` takes an optional `options` hash with a single option:
|
8056
|
-
- `includeId`: If this is `true`, `serialize` should include the ID
|
8057
|
-
in the serialized object it builds.
|
8058
|
-
@method serialize
|
8059
|
-
@param {DS.Model} record
|
8060
|
-
@param {Object} [options]
|
8061
|
-
@return {Object}
|
8062
|
-
*/
|
8063
|
-
serialize: null,
|
8064
|
-
|
8065
|
-
/**
|
8066
|
-
The `normalize` method is used to convert a payload received from your
|
8067
|
-
external data source into the normalized form `store.push()` expects. You
|
8068
|
-
should override this method, munge the hash and return the normalized
|
8069
|
-
payload.
|
8070
|
-
@method normalize
|
8071
|
-
@param {DS.Model} typeClass
|
8072
|
-
@param {Object} hash
|
8073
|
-
@return {Object}
|
8074
|
-
*/
|
8075
|
-
normalize: function (typeClass, hash) {
|
8076
|
-
return hash;
|
8077
|
-
}
|
8078
|
-
|
8079
|
-
});
|
8080
|
-
});
|
8081
|
-
/**
|
8082
|
-
@module ember-data
|
8083
|
-
*/
|
8084
|
-
define('ember-data/-private/system/snapshot-record-array', ['exports', 'ember-data/-private/features'], function (exports, _emberDataPrivateFeatures) {
|
8085
|
-
exports.default = SnapshotRecordArray;
|
8086
|
-
|
8087
|
-
/**
|
8088
|
-
@class SnapshotRecordArray
|
8089
|
-
@namespace DS
|
8090
|
-
@private
|
8091
|
-
@constructor
|
8092
|
-
@param {Array} snapshots An array of snapshots
|
8093
|
-
@param {Object} meta
|
8094
|
-
*/
|
8095
|
-
|
8096
|
-
function SnapshotRecordArray(recordArray, meta) {
|
8097
|
-
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
8098
|
-
|
8099
|
-
/**
|
8100
|
-
An array of snapshots
|
8101
|
-
@private
|
8102
|
-
@property _snapshots
|
8103
|
-
@type {Array}
|
7545
|
+
An array of snapshots
|
7546
|
+
@private
|
7547
|
+
@property _snapshots
|
7548
|
+
@type {Array}
|
8104
7549
|
*/
|
8105
7550
|
this._snapshots = null;
|
8106
7551
|
/**
|
@@ -11190,6 +10635,42 @@ define('ember-data/-private/utils', ['exports', 'ember', 'ember-data/-private/de
|
|
11190
10635
|
exports.modelHasAttributeOrRelationshipNamedType = modelHasAttributeOrRelationshipNamedType;
|
11191
10636
|
exports.getOwner = getOwner;
|
11192
10637
|
});
|
10638
|
+
define('ember-data/-private/utils/parse-response-headers', ['exports', 'ember-data/-private/system/empty-object'], function (exports, _emberDataPrivateSystemEmptyObject) {
|
10639
|
+
exports.default = parseResponseHeaders;
|
10640
|
+
|
10641
|
+
function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
|
10642
|
+
|
10643
|
+
var CLRF = '\u000d\u000a';
|
10644
|
+
|
10645
|
+
function parseResponseHeaders(headersString) {
|
10646
|
+
var headers = new _emberDataPrivateSystemEmptyObject.default();
|
10647
|
+
|
10648
|
+
if (!headersString) {
|
10649
|
+
return headers;
|
10650
|
+
}
|
10651
|
+
|
10652
|
+
var headerPairs = headersString.split(CLRF);
|
10653
|
+
|
10654
|
+
headerPairs.forEach(function (header) {
|
10655
|
+
var _header$split = header.split(':');
|
10656
|
+
|
10657
|
+
var _header$split2 = _toArray(_header$split);
|
10658
|
+
|
10659
|
+
var field = _header$split2[0];
|
10660
|
+
|
10661
|
+
var value = _header$split2.slice(1);
|
10662
|
+
|
10663
|
+
field = field.trim();
|
10664
|
+
value = value.join(':').trim();
|
10665
|
+
|
10666
|
+
if (value) {
|
10667
|
+
headers[field] = value;
|
10668
|
+
}
|
10669
|
+
});
|
10670
|
+
|
10671
|
+
return headers;
|
10672
|
+
}
|
10673
|
+
});
|
11193
10674
|
define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
|
11194
10675
|
var get = _ember.default.get;
|
11195
10676
|
|
@@ -11782,7 +11263,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters
|
|
11782
11263
|
/**
|
11783
11264
|
@module ember-data
|
11784
11265
|
*/
|
11785
|
-
define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private/adapters/errors', 'ember-data/-private/
|
11266
|
+
define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private/adapters/errors', 'ember-data/-private/adapters/build-url-mixin', 'ember-data/-private/features', 'ember-data/-private/utils/parse-response-headers'], function (exports, _ember, _emberDataAdapter, _emberDataPrivateAdaptersErrors, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateFeatures, _emberDataPrivateUtilsParseResponseHeaders) {
|
11786
11267
|
var MapWithDefault = _ember.default.MapWithDefault;
|
11787
11268
|
var get = _ember.default.get;
|
11788
11269
|
|
@@ -12526,7 +12007,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12526
12007
|
|
12527
12008
|
hash.success = function (payload, textStatus, jqXHR) {
|
12528
12009
|
|
12529
|
-
var response = adapter.handleResponse(jqXHR.status,
|
12010
|
+
var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
|
12530
12011
|
|
12531
12012
|
if (response && response.isAdapterError) {
|
12532
12013
|
_ember.default.run.join(null, reject, response);
|
@@ -12545,7 +12026,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12545
12026
|
} else if (textStatus === 'abort') {
|
12546
12027
|
error = new _emberDataPrivateAdaptersErrors.AbortError();
|
12547
12028
|
} else {
|
12548
|
-
error = adapter.handleResponse(jqXHR.status,
|
12029
|
+
error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown, requestData);
|
12549
12030
|
}
|
12550
12031
|
|
12551
12032
|
_ember.default.run.join(null, reject, error);
|
@@ -12673,28 +12154,6 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12673
12154
|
}
|
12674
12155
|
});
|
12675
12156
|
|
12676
|
-
function parseResponseHeaders(headerStr) {
|
12677
|
-
var headers = new _emberDataPrivateSystemEmptyObject.default();
|
12678
|
-
if (!headerStr) {
|
12679
|
-
return headers;
|
12680
|
-
}
|
12681
|
-
|
12682
|
-
var headerPairs = headerStr.split('\u000d\u000a');
|
12683
|
-
for (var i = 0; i < headerPairs.length; i++) {
|
12684
|
-
var headerPair = headerPairs[i];
|
12685
|
-
// Can't use split() here because it does the wrong thing
|
12686
|
-
// if the header value has the string ": " in it.
|
12687
|
-
var index = headerPair.indexOf('\u003a\u0020');
|
12688
|
-
if (index > 0) {
|
12689
|
-
var key = headerPair.substring(0, index);
|
12690
|
-
var val = headerPair.substring(index + 2);
|
12691
|
-
headers[key] = val;
|
12692
|
-
}
|
12693
|
-
}
|
12694
|
-
|
12695
|
-
return headers;
|
12696
|
-
}
|
12697
|
-
|
12698
12157
|
//From http://stackoverflow.com/questions/280634/endswith-in-javascript
|
12699
12158
|
function endsWith(string, suffix) {
|
12700
12159
|
if (typeof String.prototype.endsWith !== 'function') {
|
@@ -12806,137 +12265,725 @@ define("ember-data/attr", ["exports", "ember", "ember-data/-private/debug"], fun
|
|
12806
12265
|
options: options
|
12807
12266
|
};
|
12808
12267
|
|
12809
|
-
return _ember.default.computed({
|
12810
|
-
get: function (key) {
|
12811
|
-
var internalModel = this._internalModel;
|
12812
|
-
if (hasValue(internalModel, key)) {
|
12813
|
-
return getValue(internalModel, key);
|
12814
|
-
} else {
|
12815
|
-
return getDefaultValue(this, options, key);
|
12816
|
-
}
|
12817
|
-
},
|
12818
|
-
set: function (key, value) {
|
12819
|
-
var internalModel = this._internalModel;
|
12820
|
-
var oldValue = getValue(internalModel, key);
|
12268
|
+
return _ember.default.computed({
|
12269
|
+
get: function (key) {
|
12270
|
+
var internalModel = this._internalModel;
|
12271
|
+
if (hasValue(internalModel, key)) {
|
12272
|
+
return getValue(internalModel, key);
|
12273
|
+
} else {
|
12274
|
+
return getDefaultValue(this, options, key);
|
12275
|
+
}
|
12276
|
+
},
|
12277
|
+
set: function (key, value) {
|
12278
|
+
var internalModel = this._internalModel;
|
12279
|
+
var oldValue = getValue(internalModel, key);
|
12280
|
+
|
12281
|
+
if (value !== oldValue) {
|
12282
|
+
// Add the new value to the changed attributes hash; it will get deleted by
|
12283
|
+
// the 'didSetProperty' handler if it is no different from the original value
|
12284
|
+
internalModel._attributes[key] = value;
|
12285
|
+
|
12286
|
+
this._internalModel.send('didSetProperty', {
|
12287
|
+
name: key,
|
12288
|
+
oldValue: oldValue,
|
12289
|
+
originalValue: internalModel._data[key],
|
12290
|
+
value: value
|
12291
|
+
});
|
12292
|
+
}
|
12293
|
+
|
12294
|
+
return value;
|
12295
|
+
}
|
12296
|
+
}).meta(meta);
|
12297
|
+
}
|
12298
|
+
});
|
12299
|
+
define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/serializer", "ember-data/-private/system/debug", "ember-data/-private/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataSerializer, _emberDataPrivateSystemDebug, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
|
12300
|
+
/**
|
12301
|
+
Ember Data
|
12302
|
+
@module ember-data
|
12303
|
+
@main ember-data
|
12304
|
+
*/
|
12305
|
+
|
12306
|
+
if (_ember.default.VERSION.match(/^1\.([0-9]|1[0-2])\./)) {
|
12307
|
+
throw new _ember.default.Error("Ember Data requires at least Ember 1.13.0, but you have " + _ember.default.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data.");
|
12308
|
+
}
|
12309
|
+
|
12310
|
+
if (_ember.default.VERSION.match(/^1\.13\./)) {
|
12311
|
+
(0, _emberDataPrivateDebug.warn)("Use of Ember Data 2+ with Ember 1.13 is unsupported. Please upgrade your version of Ember to 2.0 or higher.", false, {
|
12312
|
+
id: 'ds.version.ember-1-13'
|
12313
|
+
});
|
12314
|
+
}
|
12315
|
+
|
12316
|
+
_emberDataPrivateCore.default.Store = _emberDataPrivateSystemStore.Store;
|
12317
|
+
_emberDataPrivateCore.default.PromiseArray = _emberDataPrivateSystemPromiseProxies.PromiseArray;
|
12318
|
+
_emberDataPrivateCore.default.PromiseObject = _emberDataPrivateSystemPromiseProxies.PromiseObject;
|
12319
|
+
|
12320
|
+
_emberDataPrivateCore.default.PromiseManyArray = _emberDataPrivateSystemPromiseProxies.PromiseManyArray;
|
12321
|
+
|
12322
|
+
_emberDataPrivateCore.default.Model = _emberDataModel.default;
|
12323
|
+
_emberDataPrivateCore.default.RootState = _emberDataPrivateSystemModel.RootState;
|
12324
|
+
_emberDataPrivateCore.default.attr = _emberDataPrivateSystemModel.attr;
|
12325
|
+
_emberDataPrivateCore.default.Errors = _emberDataPrivateSystemModel.Errors;
|
12326
|
+
|
12327
|
+
_emberDataPrivateCore.default.InternalModel = _emberDataPrivateSystemModelInternalModel.default;
|
12328
|
+
_emberDataPrivateCore.default.Snapshot = _emberDataPrivateSystemSnapshot.default;
|
12329
|
+
|
12330
|
+
_emberDataPrivateCore.default.Adapter = _emberDataAdapter.default;
|
12331
|
+
|
12332
|
+
_emberDataPrivateCore.default.AdapterError = _emberDataPrivateAdaptersErrors.AdapterError;
|
12333
|
+
_emberDataPrivateCore.default.InvalidError = _emberDataPrivateAdaptersErrors.InvalidError;
|
12334
|
+
_emberDataPrivateCore.default.TimeoutError = _emberDataPrivateAdaptersErrors.TimeoutError;
|
12335
|
+
_emberDataPrivateCore.default.AbortError = _emberDataPrivateAdaptersErrors.AbortError;
|
12336
|
+
|
12337
|
+
_emberDataPrivateCore.default.errorsHashToArray = _emberDataPrivateAdaptersErrors.errorsHashToArray;
|
12338
|
+
_emberDataPrivateCore.default.errorsArrayToHash = _emberDataPrivateAdaptersErrors.errorsArrayToHash;
|
12339
|
+
|
12340
|
+
_emberDataPrivateCore.default.Serializer = _emberDataSerializer.default;
|
12341
|
+
|
12342
|
+
_emberDataPrivateCore.default.DebugAdapter = _emberDataPrivateSystemDebug.default;
|
12343
|
+
|
12344
|
+
_emberDataPrivateCore.default.RecordArray = _emberDataPrivateSystemRecordArrays.RecordArray;
|
12345
|
+
_emberDataPrivateCore.default.FilteredRecordArray = _emberDataPrivateSystemRecordArrays.FilteredRecordArray;
|
12346
|
+
_emberDataPrivateCore.default.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray;
|
12347
|
+
_emberDataPrivateCore.default.ManyArray = _emberDataPrivateSystemManyArray.default;
|
12348
|
+
|
12349
|
+
_emberDataPrivateCore.default.RecordArrayManager = _emberDataPrivateSystemRecordArrayManager.default;
|
12350
|
+
|
12351
|
+
_emberDataPrivateCore.default.RESTAdapter = _emberDataPrivateAdapters.RESTAdapter;
|
12352
|
+
_emberDataPrivateCore.default.BuildURLMixin = _emberDataPrivateAdaptersBuildUrlMixin.default;
|
12353
|
+
|
12354
|
+
_emberDataPrivateCore.default.RESTSerializer = _emberDataPrivateSerializers.RESTSerializer;
|
12355
|
+
_emberDataPrivateCore.default.JSONSerializer = _emberDataPrivateSerializers.JSONSerializer;
|
12356
|
+
|
12357
|
+
_emberDataPrivateCore.default.JSONAPIAdapter = _emberDataPrivateAdapters.JSONAPIAdapter;
|
12358
|
+
_emberDataPrivateCore.default.JSONAPISerializer = _emberDataPrivateSerializers.JSONAPISerializer;
|
12359
|
+
|
12360
|
+
_emberDataPrivateCore.default.Transform = _emberDataPrivateTransforms.Transform;
|
12361
|
+
_emberDataPrivateCore.default.DateTransform = _emberDataPrivateTransforms.DateTransform;
|
12362
|
+
_emberDataPrivateCore.default.StringTransform = _emberDataPrivateTransforms.StringTransform;
|
12363
|
+
_emberDataPrivateCore.default.NumberTransform = _emberDataPrivateTransforms.NumberTransform;
|
12364
|
+
_emberDataPrivateCore.default.BooleanTransform = _emberDataPrivateTransforms.BooleanTransform;
|
12365
|
+
|
12366
|
+
_emberDataPrivateCore.default.EmbeddedRecordsMixin = _emberDataSerializersEmbeddedRecordsMixin.default;
|
12367
|
+
|
12368
|
+
_emberDataPrivateCore.default.belongsTo = _emberDataRelationships.belongsTo;
|
12369
|
+
_emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
|
12370
|
+
|
12371
|
+
_emberDataPrivateCore.default.Relationship = _emberDataPrivateSystemRelationshipsStateRelationship.default;
|
12372
|
+
|
12373
|
+
_emberDataPrivateCore.default.ContainerProxy = _emberDataPrivateSystemContainerProxy.default;
|
12374
|
+
|
12375
|
+
_emberDataPrivateCore.default._setupContainer = _emberDataSetupContainer.default;
|
12376
|
+
_emberDataPrivateCore.default._initializeStoreService = _emberDataPrivateInstanceInitializersInitializeStoreService.default;
|
12377
|
+
|
12378
|
+
Object.defineProperty(_emberDataPrivateCore.default, 'normalizeModelName', {
|
12379
|
+
enumerable: true,
|
12380
|
+
writable: false,
|
12381
|
+
configurable: false,
|
12382
|
+
value: _emberDataPrivateSystemNormalizeModelName.default
|
12383
|
+
});
|
12384
|
+
|
12385
|
+
_ember.default.lookup.DS = _emberDataPrivateCore.default;
|
12386
|
+
|
12387
|
+
exports.default = _emberDataPrivateCore.default;
|
12388
|
+
});
|
12389
|
+
define("ember-data/model", ["exports", "ember-data/-private/system/model"], function (exports, _emberDataPrivateSystemModel) {
|
12390
|
+
exports.default = _emberDataPrivateSystemModel.default;
|
12391
|
+
});
|
12392
|
+
define("ember-data/relationships", ["exports", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many"], function (exports, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany) {
|
12393
|
+
exports.belongsTo = _emberDataPrivateSystemRelationshipsBelongsTo.default;
|
12394
|
+
exports.hasMany = _emberDataPrivateSystemRelationshipsHasMany.default;
|
12395
|
+
});
|
12396
|
+
/**
|
12397
|
+
@module ember-data
|
12398
|
+
*/
|
12399
|
+
define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember) {
|
12400
|
+
|
12401
|
+
/**
|
12402
|
+
`DS.Serializer` is an abstract base class that you should override in your
|
12403
|
+
application to customize it for your backend. The minimum set of methods
|
12404
|
+
that you should implement is:
|
12405
|
+
|
12406
|
+
* `normalizeResponse()`
|
12407
|
+
* `serialize()`
|
12408
|
+
|
12409
|
+
And you can optionally override the following methods:
|
12410
|
+
|
12411
|
+
* `normalize()`
|
12412
|
+
|
12413
|
+
For an example implementation, see
|
12414
|
+
[DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
|
12415
|
+
|
12416
|
+
@class Serializer
|
12417
|
+
@namespace DS
|
12418
|
+
@extends Ember.Object
|
12419
|
+
*/
|
12420
|
+
|
12421
|
+
exports.default = _ember.default.Object.extend({
|
12422
|
+
|
12423
|
+
/**
|
12424
|
+
The `store` property is the application's `store` that contains all records.
|
12425
|
+
It's injected as a service.
|
12426
|
+
It can be used to push records from a non flat data structure server
|
12427
|
+
response.
|
12428
|
+
@property store
|
12429
|
+
@type {DS.Store}
|
12430
|
+
@public
|
12431
|
+
*/
|
12432
|
+
|
12433
|
+
/**
|
12434
|
+
The `normalizeResponse` method is used to normalize a payload from the
|
12435
|
+
server to a JSON-API Document.
|
12436
|
+
http://jsonapi.org/format/#document-structure
|
12437
|
+
@method normalizeResponse
|
12438
|
+
@param {DS.Store} store
|
12439
|
+
@param {DS.Model} primaryModelClass
|
12440
|
+
@param {Object} payload
|
12441
|
+
@param {String|Number} id
|
12442
|
+
@param {String} requestType
|
12443
|
+
@return {Object} JSON-API Document
|
12444
|
+
*/
|
12445
|
+
normalizeResponse: null,
|
12446
|
+
|
12447
|
+
/**
|
12448
|
+
The `serialize` method is used when a record is saved in order to convert
|
12449
|
+
the record into the form that your external data source expects.
|
12450
|
+
`serialize` takes an optional `options` hash with a single option:
|
12451
|
+
- `includeId`: If this is `true`, `serialize` should include the ID
|
12452
|
+
in the serialized object it builds.
|
12453
|
+
@method serialize
|
12454
|
+
@param {DS.Model} record
|
12455
|
+
@param {Object} [options]
|
12456
|
+
@return {Object}
|
12457
|
+
*/
|
12458
|
+
serialize: null,
|
12459
|
+
|
12460
|
+
/**
|
12461
|
+
The `normalize` method is used to convert a payload received from your
|
12462
|
+
external data source into the normalized form `store.push()` expects. You
|
12463
|
+
should override this method, munge the hash and return the normalized
|
12464
|
+
payload.
|
12465
|
+
@method normalize
|
12466
|
+
@param {DS.Model} typeClass
|
12467
|
+
@param {Object} hash
|
12468
|
+
@return {Object}
|
12469
|
+
*/
|
12470
|
+
normalize: function (typeClass, hash) {
|
12471
|
+
return hash;
|
12472
|
+
}
|
12473
|
+
|
12474
|
+
});
|
12475
|
+
});
|
12476
|
+
/**
|
12477
|
+
@module ember-data
|
12478
|
+
*/
|
12479
|
+
define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
|
12480
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
12481
|
+
|
12482
|
+
var get = _ember.default.get;
|
12483
|
+
var set = _ember.default.set;
|
12484
|
+
var camelize = _ember.default.String.camelize;
|
12485
|
+
|
12486
|
+
/**
|
12487
|
+
## Using Embedded Records
|
12488
|
+
|
12489
|
+
`DS.EmbeddedRecordsMixin` supports serializing embedded records.
|
12490
|
+
|
12491
|
+
To set up embedded records, include the mixin when extending a serializer,
|
12492
|
+
then define and configure embedded (model) relationships.
|
12493
|
+
|
12494
|
+
Below is an example of a per-type serializer (`post` type).
|
12495
|
+
|
12496
|
+
```app/serializers/post.js
|
12497
|
+
import DS from 'ember-data';
|
12498
|
+
|
12499
|
+
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
12500
|
+
attrs: {
|
12501
|
+
author: { embedded: 'always' },
|
12502
|
+
comments: { serialize: 'ids' }
|
12503
|
+
}
|
12504
|
+
});
|
12505
|
+
```
|
12506
|
+
Note that this use of `{ embedded: 'always' }` is unrelated to
|
12507
|
+
the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
|
12508
|
+
defining a model while working with the `ActiveModelSerializer`. Nevertheless,
|
12509
|
+
using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup
|
12510
|
+
embedded records.
|
12511
|
+
|
12512
|
+
The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
|
12513
|
+
|
12514
|
+
```js
|
12515
|
+
{
|
12516
|
+
serialize: 'records',
|
12517
|
+
deserialize: 'records'
|
12518
|
+
}
|
12519
|
+
```
|
12520
|
+
|
12521
|
+
### Configuring Attrs
|
12522
|
+
|
12523
|
+
A resource's `attrs` option may be set to use `ids`, `records` or false for the
|
12524
|
+
`serialize` and `deserialize` settings.
|
12525
|
+
|
12526
|
+
The `attrs` property can be set on the `ApplicationSerializer` or a per-type
|
12527
|
+
serializer.
|
12528
|
+
|
12529
|
+
In the case where embedded JSON is expected while extracting a payload (reading)
|
12530
|
+
the setting is `deserialize: 'records'`, there is no need to use `ids` when
|
12531
|
+
extracting as that is the default behavior without this mixin if you are using
|
12532
|
+
the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while
|
12533
|
+
serializing `serialize: 'records'` is the setting to use. There is an option of
|
12534
|
+
not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
|
12535
|
+
do not want the relationship sent at all, you can use `serialize: false`.
|
12536
|
+
|
12537
|
+
|
12538
|
+
### EmbeddedRecordsMixin defaults
|
12539
|
+
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
|
12540
|
+
will behave in the following way:
|
12541
|
+
|
12542
|
+
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
|
12543
|
+
HasMany: `{ serialize: false, deserialize: 'ids' }`
|
12544
|
+
|
12545
|
+
### Model Relationships
|
12546
|
+
|
12547
|
+
Embedded records must have a model defined to be extracted and serialized. Note that
|
12548
|
+
when defining any relationships on your model such as `belongsTo` and `hasMany`, you
|
12549
|
+
should not both specify `async: true` and also indicate through the serializer's
|
12550
|
+
`attrs` attribute that the related model should be embedded for deserialization.
|
12551
|
+
If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
|
12552
|
+
then do not use `async: true`.
|
12553
|
+
|
12554
|
+
To successfully extract and serialize embedded records the model relationships
|
12555
|
+
must be setup correcty. See the
|
12556
|
+
[defining relationships](/guides/models/defining-models/#toc_defining-relationships)
|
12557
|
+
section of the **Defining Models** guide page.
|
12558
|
+
|
12559
|
+
Records without an `id` property are not considered embedded records, model
|
12560
|
+
instances must have an `id` property to be used with Ember Data.
|
12561
|
+
|
12562
|
+
### Example JSON payloads, Models and Serializers
|
12563
|
+
|
12564
|
+
**When customizing a serializer it is important to grok what the customizations
|
12565
|
+
are. Please read the docs for the methods this mixin provides, in case you need
|
12566
|
+
to modify it to fit your specific needs.**
|
12567
|
+
|
12568
|
+
For example review the docs for each method of this mixin:
|
12569
|
+
* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
|
12570
|
+
* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
|
12571
|
+
* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
|
12572
|
+
|
12573
|
+
@class EmbeddedRecordsMixin
|
12574
|
+
@namespace DS
|
12575
|
+
*/
|
12576
|
+
exports.default = _ember.default.Mixin.create({
|
12577
|
+
|
12578
|
+
/**
|
12579
|
+
Normalize the record and recursively normalize/extract all the embedded records
|
12580
|
+
while pushing them into the store as they are encountered
|
12581
|
+
A payload with an attr configured for embedded records needs to be extracted:
|
12582
|
+
```js
|
12583
|
+
{
|
12584
|
+
"post": {
|
12585
|
+
"id": "1"
|
12586
|
+
"title": "Rails is omakase",
|
12587
|
+
"comments": [{
|
12588
|
+
"id": "1",
|
12589
|
+
"body": "Rails is unagi"
|
12590
|
+
}, {
|
12591
|
+
"id": "2",
|
12592
|
+
"body": "Omakase O_o"
|
12593
|
+
}]
|
12594
|
+
}
|
12595
|
+
}
|
12596
|
+
```
|
12597
|
+
@method normalize
|
12598
|
+
@param {DS.Model} typeClass
|
12599
|
+
@param {Object} hash to be normalized
|
12600
|
+
@param {String} prop the hash has been referenced by
|
12601
|
+
@return {Object} the normalized hash
|
12602
|
+
**/
|
12603
|
+
normalize: function (typeClass, hash, prop) {
|
12604
|
+
var normalizedHash = this._super(typeClass, hash, prop);
|
12605
|
+
return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
|
12606
|
+
},
|
12607
|
+
|
12608
|
+
keyForRelationship: function (key, typeClass, method) {
|
12609
|
+
if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
|
12610
|
+
return this.keyForAttribute(key, method);
|
12611
|
+
} else {
|
12612
|
+
return this._super(key, typeClass, method) || key;
|
12613
|
+
}
|
12614
|
+
},
|
12615
|
+
|
12616
|
+
/**
|
12617
|
+
Serialize `belongsTo` relationship when it is configured as an embedded object.
|
12618
|
+
This example of an author model belongs to a post model:
|
12619
|
+
```js
|
12620
|
+
Post = DS.Model.extend({
|
12621
|
+
title: DS.attr('string'),
|
12622
|
+
body: DS.attr('string'),
|
12623
|
+
author: DS.belongsTo('author')
|
12624
|
+
});
|
12625
|
+
Author = DS.Model.extend({
|
12626
|
+
name: DS.attr('string'),
|
12627
|
+
post: DS.belongsTo('post')
|
12628
|
+
});
|
12629
|
+
```
|
12630
|
+
Use a custom (type) serializer for the post model to configure embedded author
|
12631
|
+
```app/serializers/post.js
|
12632
|
+
import DS from 'ember-data;
|
12633
|
+
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
12634
|
+
attrs: {
|
12635
|
+
author: { embedded: 'always' }
|
12636
|
+
}
|
12637
|
+
})
|
12638
|
+
```
|
12639
|
+
A payload with an attribute configured for embedded records can serialize
|
12640
|
+
the records together under the root attribute's payload:
|
12641
|
+
```js
|
12642
|
+
{
|
12643
|
+
"post": {
|
12644
|
+
"id": "1"
|
12645
|
+
"title": "Rails is omakase",
|
12646
|
+
"author": {
|
12647
|
+
"id": "2"
|
12648
|
+
"name": "dhh"
|
12649
|
+
}
|
12650
|
+
}
|
12651
|
+
}
|
12652
|
+
```
|
12653
|
+
@method serializeBelongsTo
|
12654
|
+
@param {DS.Snapshot} snapshot
|
12655
|
+
@param {Object} json
|
12656
|
+
@param {Object} relationship
|
12657
|
+
*/
|
12658
|
+
serializeBelongsTo: function (snapshot, json, relationship) {
|
12659
|
+
var attr = relationship.key;
|
12660
|
+
if (this.noSerializeOptionSpecified(attr)) {
|
12661
|
+
this._super(snapshot, json, relationship);
|
12662
|
+
return;
|
12663
|
+
}
|
12664
|
+
var includeIds = this.hasSerializeIdsOption(attr);
|
12665
|
+
var includeRecords = this.hasSerializeRecordsOption(attr);
|
12666
|
+
var embeddedSnapshot = snapshot.belongsTo(attr);
|
12667
|
+
var key;
|
12668
|
+
if (includeIds) {
|
12669
|
+
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
|
12670
|
+
if (!embeddedSnapshot) {
|
12671
|
+
json[key] = null;
|
12672
|
+
} else {
|
12673
|
+
json[key] = embeddedSnapshot.id;
|
12674
|
+
|
12675
|
+
if (relationship.options.polymorphic) {
|
12676
|
+
this.serializePolymorphicType(snapshot, json, relationship);
|
12677
|
+
}
|
12678
|
+
}
|
12679
|
+
} else if (includeRecords) {
|
12680
|
+
this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
|
12681
|
+
}
|
12682
|
+
},
|
12683
|
+
|
12684
|
+
_serializeEmbeddedBelongsTo: function (snapshot, json, relationship) {
|
12685
|
+
var embeddedSnapshot = snapshot.belongsTo(relationship.key);
|
12686
|
+
var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
|
12687
|
+
if (serializedKey === relationship.key && this.keyForRelationship) {
|
12688
|
+
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
|
12689
|
+
}
|
12690
|
+
|
12691
|
+
if (!embeddedSnapshot) {
|
12692
|
+
json[serializedKey] = null;
|
12693
|
+
} else {
|
12694
|
+
json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
|
12695
|
+
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
|
12696
|
+
|
12697
|
+
if (relationship.options.polymorphic) {
|
12698
|
+
this.serializePolymorphicType(snapshot, json, relationship);
|
12699
|
+
}
|
12700
|
+
}
|
12701
|
+
},
|
12702
|
+
|
12703
|
+
/**
|
12704
|
+
Serialize `hasMany` relationship when it is configured as embedded objects.
|
12705
|
+
This example of a post model has many comments:
|
12706
|
+
```js
|
12707
|
+
Post = DS.Model.extend({
|
12708
|
+
title: DS.attr('string'),
|
12709
|
+
body: DS.attr('string'),
|
12710
|
+
comments: DS.hasMany('comment')
|
12711
|
+
});
|
12712
|
+
Comment = DS.Model.extend({
|
12713
|
+
body: DS.attr('string'),
|
12714
|
+
post: DS.belongsTo('post')
|
12715
|
+
});
|
12716
|
+
```
|
12717
|
+
Use a custom (type) serializer for the post model to configure embedded comments
|
12718
|
+
```app/serializers/post.js
|
12719
|
+
import DS from 'ember-data;
|
12720
|
+
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
12721
|
+
attrs: {
|
12722
|
+
comments: { embedded: 'always' }
|
12723
|
+
}
|
12724
|
+
})
|
12725
|
+
```
|
12726
|
+
A payload with an attribute configured for embedded records can serialize
|
12727
|
+
the records together under the root attribute's payload:
|
12728
|
+
```js
|
12729
|
+
{
|
12730
|
+
"post": {
|
12731
|
+
"id": "1"
|
12732
|
+
"title": "Rails is omakase",
|
12733
|
+
"body": "I want this for my ORM, I want that for my template language..."
|
12734
|
+
"comments": [{
|
12735
|
+
"id": "1",
|
12736
|
+
"body": "Rails is unagi"
|
12737
|
+
}, {
|
12738
|
+
"id": "2",
|
12739
|
+
"body": "Omakase O_o"
|
12740
|
+
}]
|
12741
|
+
}
|
12742
|
+
}
|
12743
|
+
```
|
12744
|
+
The attrs options object can use more specific instruction for extracting and
|
12745
|
+
serializing. When serializing, an option to embed `ids` or `records` can be set.
|
12746
|
+
When extracting the only option is `records`.
|
12747
|
+
So `{ embedded: 'always' }` is shorthand for:
|
12748
|
+
`{ serialize: 'records', deserialize: 'records' }`
|
12749
|
+
To embed the `ids` for a related object (using a hasMany relationship):
|
12750
|
+
```app/serializers/post.js
|
12751
|
+
import DS from 'ember-data;
|
12752
|
+
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
12753
|
+
attrs: {
|
12754
|
+
comments: { serialize: 'ids', deserialize: 'records' }
|
12755
|
+
}
|
12756
|
+
})
|
12757
|
+
```
|
12758
|
+
```js
|
12759
|
+
{
|
12760
|
+
"post": {
|
12761
|
+
"id": "1"
|
12762
|
+
"title": "Rails is omakase",
|
12763
|
+
"body": "I want this for my ORM, I want that for my template language..."
|
12764
|
+
"comments": ["1", "2"]
|
12765
|
+
}
|
12766
|
+
}
|
12767
|
+
```
|
12768
|
+
@method serializeHasMany
|
12769
|
+
@param {DS.Snapshot} snapshot
|
12770
|
+
@param {Object} json
|
12771
|
+
@param {Object} relationship
|
12772
|
+
*/
|
12773
|
+
serializeHasMany: function (snapshot, json, relationship) {
|
12774
|
+
var attr = relationship.key;
|
12775
|
+
if (this.noSerializeOptionSpecified(attr)) {
|
12776
|
+
this._super(snapshot, json, relationship);
|
12777
|
+
return;
|
12778
|
+
}
|
12779
|
+
var includeIds = this.hasSerializeIdsOption(attr);
|
12780
|
+
var includeRecords = this.hasSerializeRecordsOption(attr);
|
12781
|
+
if (includeIds) {
|
12782
|
+
var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
|
12783
|
+
json[serializedKey] = snapshot.hasMany(attr, { ids: true });
|
12784
|
+
} else if (includeRecords) {
|
12785
|
+
this._serializeEmbeddedHasMany(snapshot, json, relationship);
|
12786
|
+
}
|
12787
|
+
},
|
12788
|
+
|
12789
|
+
_serializeEmbeddedHasMany: function (snapshot, json, relationship) {
|
12790
|
+
var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
|
12791
|
+
if (serializedKey === relationship.key && this.keyForRelationship) {
|
12792
|
+
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
|
12793
|
+
}
|
12794
|
+
|
12795
|
+
(0, _emberDataPrivateDebug.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' });
|
12796
|
+
|
12797
|
+
json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
|
12798
|
+
},
|
12799
|
+
|
12800
|
+
/*
|
12801
|
+
Returns an array of embedded records serialized to JSON
|
12802
|
+
*/
|
12803
|
+
_generateSerializedHasMany: function (snapshot, relationship) {
|
12804
|
+
var hasMany = snapshot.hasMany(relationship.key);
|
12805
|
+
var manyArray = _ember.default.A(hasMany);
|
12806
|
+
var ret = new Array(manyArray.length);
|
12821
12807
|
|
12822
|
-
|
12823
|
-
|
12824
|
-
|
12825
|
-
|
12808
|
+
for (var i = 0; i < manyArray.length; i++) {
|
12809
|
+
var embeddedSnapshot = manyArray[i];
|
12810
|
+
var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
|
12811
|
+
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
|
12812
|
+
ret[i] = embeddedJson;
|
12813
|
+
}
|
12826
12814
|
|
12827
|
-
|
12828
|
-
|
12829
|
-
oldValue: oldValue,
|
12830
|
-
originalValue: internalModel._data[key],
|
12831
|
-
value: value
|
12832
|
-
});
|
12833
|
-
}
|
12815
|
+
return ret;
|
12816
|
+
},
|
12834
12817
|
|
12835
|
-
|
12818
|
+
/**
|
12819
|
+
When serializing an embedded record, modify the property (in the json payload)
|
12820
|
+
that refers to the parent record (foreign key for relationship).
|
12821
|
+
Serializing a `belongsTo` relationship removes the property that refers to the
|
12822
|
+
parent record
|
12823
|
+
Serializing a `hasMany` relationship does not remove the property that refers to
|
12824
|
+
the parent record.
|
12825
|
+
@method removeEmbeddedForeignKey
|
12826
|
+
@param {DS.Snapshot} snapshot
|
12827
|
+
@param {DS.Snapshot} embeddedSnapshot
|
12828
|
+
@param {Object} relationship
|
12829
|
+
@param {Object} json
|
12830
|
+
*/
|
12831
|
+
removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
|
12832
|
+
if (relationship.kind === 'hasMany') {
|
12833
|
+
return;
|
12834
|
+
} else if (relationship.kind === 'belongsTo') {
|
12835
|
+
var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
|
12836
|
+
if (parentRecord) {
|
12837
|
+
var name = parentRecord.name;
|
12838
|
+
var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
|
12839
|
+
var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
|
12840
|
+
if (parentKey) {
|
12841
|
+
delete json[parentKey];
|
12842
|
+
}
|
12843
|
+
}
|
12836
12844
|
}
|
12837
|
-
}
|
12838
|
-
}
|
12839
|
-
});
|
12840
|
-
define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/-private/system/serializer", "ember-data/-private/system/debug", "ember-data/-private/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/-private/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataPrivateSystemSerializer, _emberDataPrivateSystemDebug, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataPrivateSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
|
12841
|
-
/**
|
12842
|
-
Ember Data
|
12843
|
-
@module ember-data
|
12844
|
-
@main ember-data
|
12845
|
-
*/
|
12845
|
+
},
|
12846
12846
|
|
12847
|
-
|
12848
|
-
|
12849
|
-
|
12847
|
+
// checks config for attrs option to embedded (always) - serialize and deserialize
|
12848
|
+
hasEmbeddedAlwaysOption: function (attr) {
|
12849
|
+
var option = this.attrsOption(attr);
|
12850
|
+
return option && option.embedded === 'always';
|
12851
|
+
},
|
12850
12852
|
|
12851
|
-
|
12852
|
-
(
|
12853
|
-
|
12854
|
-
|
12855
|
-
|
12853
|
+
// checks config for attrs option to serialize ids
|
12854
|
+
hasSerializeRecordsOption: function (attr) {
|
12855
|
+
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
|
12856
|
+
var option = this.attrsOption(attr);
|
12857
|
+
return alwaysEmbed || option && option.serialize === 'records';
|
12858
|
+
},
|
12856
12859
|
|
12857
|
-
|
12858
|
-
|
12859
|
-
|
12860
|
+
// checks config for attrs option to serialize records
|
12861
|
+
hasSerializeIdsOption: function (attr) {
|
12862
|
+
var option = this.attrsOption(attr);
|
12863
|
+
return option && (option.serialize === 'ids' || option.serialize === 'id');
|
12864
|
+
},
|
12860
12865
|
|
12861
|
-
|
12866
|
+
// checks config for attrs option to serialize records
|
12867
|
+
noSerializeOptionSpecified: function (attr) {
|
12868
|
+
var option = this.attrsOption(attr);
|
12869
|
+
return !(option && (option.serialize || option.embedded));
|
12870
|
+
},
|
12862
12871
|
|
12863
|
-
|
12864
|
-
|
12865
|
-
|
12866
|
-
|
12872
|
+
// checks config for attrs option to deserialize records
|
12873
|
+
// a defined option object for a resource is treated the same as
|
12874
|
+
// `deserialize: 'records'`
|
12875
|
+
hasDeserializeRecordsOption: function (attr) {
|
12876
|
+
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
|
12877
|
+
var option = this.attrsOption(attr);
|
12878
|
+
return alwaysEmbed || option && option.deserialize === 'records';
|
12879
|
+
},
|
12867
12880
|
|
12868
|
-
|
12869
|
-
|
12881
|
+
attrsOption: function (attr) {
|
12882
|
+
var attrs = this.get('attrs');
|
12883
|
+
return attrs && (attrs[camelize(attr)] || attrs[attr]);
|
12884
|
+
},
|
12870
12885
|
|
12871
|
-
|
12886
|
+
/**
|
12887
|
+
@method _extractEmbeddedRecords
|
12888
|
+
@private
|
12889
|
+
*/
|
12890
|
+
_extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
|
12891
|
+
var _this = this;
|
12872
12892
|
|
12873
|
-
|
12874
|
-
|
12875
|
-
|
12876
|
-
|
12893
|
+
typeClass.eachRelationship(function (key, relationship) {
|
12894
|
+
if (serializer.hasDeserializeRecordsOption(key)) {
|
12895
|
+
if (relationship.kind === "hasMany") {
|
12896
|
+
_this._extractEmbeddedHasMany(store, key, partial, relationship);
|
12897
|
+
}
|
12898
|
+
if (relationship.kind === "belongsTo") {
|
12899
|
+
_this._extractEmbeddedBelongsTo(store, key, partial, relationship);
|
12900
|
+
}
|
12901
|
+
}
|
12902
|
+
});
|
12903
|
+
return partial;
|
12904
|
+
},
|
12877
12905
|
|
12878
|
-
|
12879
|
-
|
12906
|
+
/**
|
12907
|
+
@method _extractEmbeddedHasMany
|
12908
|
+
@private
|
12909
|
+
*/
|
12910
|
+
_extractEmbeddedHasMany: function (store, key, hash, relationshipMeta) {
|
12911
|
+
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
|
12912
|
+
|
12913
|
+
if (!relationshipHash) {
|
12914
|
+
return;
|
12915
|
+
}
|
12880
12916
|
|
12881
|
-
|
12917
|
+
var hasMany = new Array(relationshipHash.length);
|
12882
12918
|
|
12883
|
-
|
12919
|
+
for (var i = 0; i < relationshipHash.length; i++) {
|
12920
|
+
var item = relationshipHash[i];
|
12884
12921
|
|
12885
|
-
|
12886
|
-
_emberDataPrivateCore.default.FilteredRecordArray = _emberDataPrivateSystemRecordArrays.FilteredRecordArray;
|
12887
|
-
_emberDataPrivateCore.default.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray;
|
12888
|
-
_emberDataPrivateCore.default.ManyArray = _emberDataPrivateSystemManyArray.default;
|
12922
|
+
var _normalizeEmbeddedRelationship = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
|
12889
12923
|
|
12890
|
-
|
12924
|
+
var data = _normalizeEmbeddedRelationship.data;
|
12925
|
+
var included = _normalizeEmbeddedRelationship.included;
|
12891
12926
|
|
12892
|
-
|
12893
|
-
|
12927
|
+
hash.included = hash.included || [];
|
12928
|
+
hash.included.push(data);
|
12929
|
+
if (included) {
|
12930
|
+
var _hash$included;
|
12894
12931
|
|
12895
|
-
|
12896
|
-
|
12932
|
+
(_hash$included = hash.included).push.apply(_hash$included, _toConsumableArray(included));
|
12933
|
+
}
|
12897
12934
|
|
12898
|
-
|
12899
|
-
|
12935
|
+
hasMany[i] = { id: data.id, type: data.type };
|
12936
|
+
}
|
12900
12937
|
|
12901
|
-
|
12902
|
-
|
12903
|
-
|
12904
|
-
_emberDataPrivateCore.default.NumberTransform = _emberDataPrivateTransforms.NumberTransform;
|
12905
|
-
_emberDataPrivateCore.default.BooleanTransform = _emberDataPrivateTransforms.BooleanTransform;
|
12938
|
+
var relationship = { data: hasMany };
|
12939
|
+
set(hash, 'data.relationships.' + key, relationship);
|
12940
|
+
},
|
12906
12941
|
|
12907
|
-
|
12942
|
+
/**
|
12943
|
+
@method _extractEmbeddedBelongsTo
|
12944
|
+
@private
|
12945
|
+
*/
|
12946
|
+
_extractEmbeddedBelongsTo: function (store, key, hash, relationshipMeta) {
|
12947
|
+
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
|
12948
|
+
if (!relationshipHash) {
|
12949
|
+
return;
|
12950
|
+
}
|
12908
12951
|
|
12909
|
-
|
12910
|
-
_emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
|
12952
|
+
var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
|
12911
12953
|
|
12912
|
-
|
12954
|
+
var data = _normalizeEmbeddedRelationship2.data;
|
12955
|
+
var included = _normalizeEmbeddedRelationship2.included;
|
12913
12956
|
|
12914
|
-
|
12957
|
+
hash.included = hash.included || [];
|
12958
|
+
hash.included.push(data);
|
12959
|
+
if (included) {
|
12960
|
+
var _hash$included2;
|
12915
12961
|
|
12916
|
-
|
12917
|
-
|
12962
|
+
(_hash$included2 = hash.included).push.apply(_hash$included2, _toConsumableArray(included));
|
12963
|
+
}
|
12918
12964
|
|
12919
|
-
|
12920
|
-
|
12921
|
-
writable: false,
|
12922
|
-
configurable: false,
|
12923
|
-
value: _emberDataPrivateSystemNormalizeModelName.default
|
12924
|
-
});
|
12965
|
+
var belongsTo = { id: data.id, type: data.type };
|
12966
|
+
var relationship = { data: belongsTo };
|
12925
12967
|
|
12926
|
-
|
12968
|
+
set(hash, 'data.relationships.' + key, relationship);
|
12969
|
+
},
|
12927
12970
|
|
12928
|
-
|
12929
|
-
|
12930
|
-
|
12931
|
-
|
12932
|
-
|
12933
|
-
|
12934
|
-
|
12935
|
-
|
12971
|
+
/**
|
12972
|
+
@method _normalizeEmbeddedRelationship
|
12973
|
+
@private
|
12974
|
+
*/
|
12975
|
+
_normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
|
12976
|
+
var modelName = relationshipMeta.type;
|
12977
|
+
if (relationshipMeta.options.polymorphic) {
|
12978
|
+
modelName = relationshipHash.type;
|
12979
|
+
}
|
12980
|
+
var modelClass = store.modelFor(modelName);
|
12981
|
+
var serializer = store.serializerFor(modelName);
|
12982
|
+
|
12983
|
+
return serializer.normalize(modelClass, relationshipHash, null);
|
12984
|
+
}
|
12985
|
+
});
|
12936
12986
|
});
|
12937
|
-
/**
|
12938
|
-
@module ember-data
|
12939
|
-
*/
|
12940
12987
|
define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializers/json', 'ember-data/-private/system/normalize-model-name', 'ember-inflector'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializersJson, _emberDataPrivateSystemNormalizeModelName, _emberInflector) {
|
12941
12988
|
|
12942
12989
|
var dasherize = _ember.default.String.dasherize;
|
@@ -13438,7 +13485,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
13438
13485
|
/**
|
13439
13486
|
@module ember-data
|
13440
13487
|
*/
|
13441
|
-
define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data
|
13488
|
+
define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializer', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/utils', 'ember-data/-private/adapters/errors'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializer, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateUtils, _emberDataPrivateAdaptersErrors) {
|
13442
13489
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
13443
13490
|
|
13444
13491
|
var get = _ember.default.get;
|
@@ -13511,7 +13558,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/
|
|
13511
13558
|
@namespace DS
|
13512
13559
|
@extends DS.Serializer
|
13513
13560
|
*/
|
13514
|
-
exports.default =
|
13561
|
+
exports.default = _emberDataSerializer.default.extend({
|
13515
13562
|
|
13516
13563
|
/**
|
13517
13564
|
The `primaryKey` is used when serializing and deserializing
|
@@ -15551,7 +15598,7 @@ define('ember-data/transform', ['exports', 'ember'], function (exports, _ember)
|
|
15551
15598
|
});
|
15552
15599
|
});
|
15553
15600
|
define("ember-data/version", ["exports"], function (exports) {
|
15554
|
-
exports.default = "2.4.0-beta.
|
15601
|
+
exports.default = "2.4.0-beta.3";
|
15555
15602
|
});
|
15556
15603
|
define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) {
|
15557
15604
|
|
@@ -16022,10 +16069,12 @@ require("ember-data");
|
|
16022
16069
|
var shims = {
|
16023
16070
|
'ember-data': { default: DS },
|
16024
16071
|
'ember-data/model': { default: DS.Model },
|
16072
|
+
'ember-data/mixins/embedded-records': { default: DS.EmbeddedRecordsMixin },
|
16025
16073
|
'ember-data/serializers/rest': { default: DS.RESTSerializer },
|
16026
16074
|
'ember-data/serializers/active-model': { default: DS.ActiveModelSerializer },
|
16027
16075
|
'ember-data/serializers/json': { default: DS.JSONSerializer },
|
16028
16076
|
'ember-data/serializers/json-api': { default: DS.JSONAPISerializer },
|
16077
|
+
'ember-data/serializer': { default: DS.Serializer },
|
16029
16078
|
'ember-data/adapters/json-api': { default: DS.JSONAPIAdapter },
|
16030
16079
|
'ember-data/adapters/rest': { default: DS.RESTAdapter },
|
16031
16080
|
'ember-data/adapter': { default: DS.Adapter },
|