ember-data-source 2.7.0.beta.1 → 2.7.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/globals/ember-data.js +998 -548
- data/dist/globals/ember-data.min.js +5 -5
- data/dist/globals/ember-data.prod.js +925 -542
- data/package.json +2 -2
- 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: f47cbabddb5ffb5b67d3a0ec28dceafe4ce9b490
|
4
|
+
data.tar.gz: 196db0db2742755e706a6adaba6f4a96b362a46f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e5e6467cd66565c370c2893846e74b7467df30ac9c55531b4488fdf970721fc5237737c8b74735b2c12d1e116c105c1e7f7fd3187ebb01a5f7f74a7fa723537
|
7
|
+
data.tar.gz: dd8f243dfb73782d0955a8530907d4b48577a578b2ea888e13e948ca7e57526a7bed3b0e1b937ad05dc768e80571b733f9bcadff97755bf1fb03ffe32619f7b1
|
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.7.0-beta.
|
9
|
+
* @version 2.7.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var loader, define, requireModule, require, requirejs;
|
@@ -25,7 +25,14 @@ var loader, define, requireModule, require, requirejs;
|
|
25
25
|
|
26
26
|
requirejs = require = requireModule = function(name) {
|
27
27
|
stats.require++;
|
28
|
-
|
28
|
+
var pending = [];
|
29
|
+
var mod = findModule(name, '(require)', pending);
|
30
|
+
|
31
|
+
for (var i = pending.length - 1; i >= 0; i--) {
|
32
|
+
pending[i].exports();
|
33
|
+
}
|
34
|
+
|
35
|
+
return mod.module.exports;
|
29
36
|
};
|
30
37
|
|
31
38
|
function resetStats() {
|
@@ -33,10 +40,9 @@ var loader, define, requireModule, require, requirejs;
|
|
33
40
|
define: 0,
|
34
41
|
require: 0,
|
35
42
|
reify: 0,
|
36
|
-
|
43
|
+
findDeps: 0,
|
37
44
|
modules: 0,
|
38
45
|
exports: 0,
|
39
|
-
ensureBuild: 0,
|
40
46
|
resolve: 0,
|
41
47
|
resolveRelative: 0,
|
42
48
|
findModule: 0,
|
@@ -75,8 +81,6 @@ var loader, define, requireModule, require, requirejs;
|
|
75
81
|
|
76
82
|
var registry = {};
|
77
83
|
var seen = {};
|
78
|
-
var FAILED = false;
|
79
|
-
var LOADED = true;
|
80
84
|
|
81
85
|
var uuid = 0;
|
82
86
|
|
@@ -94,11 +98,11 @@ var loader, define, requireModule, require, requirejs;
|
|
94
98
|
this.deps = !deps.length && callback.length ? defaultDeps : deps;
|
95
99
|
this.module = { exports: {} };
|
96
100
|
this.callback = callback;
|
97
|
-
this.state = undefined;
|
98
101
|
this.finalized = false;
|
99
102
|
this.hasExportsAsDep = false;
|
100
103
|
this.isAlias = alias;
|
101
104
|
this.reified = new Array(deps.length);
|
105
|
+
this._foundDeps = false;
|
102
106
|
}
|
103
107
|
|
104
108
|
Module.prototype.makeDefaultExport = function() {
|
@@ -111,46 +115,63 @@ var loader, define, requireModule, require, requirejs;
|
|
111
115
|
};
|
112
116
|
|
113
117
|
Module.prototype.exports = function() {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
var result = this.callback.apply(this, this.reified);
|
122
|
-
if (!(this.hasExportsAsDep && result === undefined)) {
|
123
|
-
this.module.exports = result;
|
124
|
-
}
|
125
|
-
this.makeDefaultExport();
|
126
|
-
this.finalized = true;
|
127
|
-
return this.module.exports;
|
118
|
+
if (this.finalized) { return this.module.exports; }
|
119
|
+
stats.exports++;
|
120
|
+
|
121
|
+
this.finalized = true;
|
122
|
+
|
123
|
+
if (loader.wrapModules) {
|
124
|
+
this.callback = loader.wrapModules(this.name, this.callback);
|
128
125
|
}
|
126
|
+
|
127
|
+
this.reify();
|
128
|
+
|
129
|
+
var result = this.callback.apply(this, this.reified);
|
130
|
+
|
131
|
+
if (!(this.hasExportsAsDep && result === undefined)) {
|
132
|
+
this.module.exports = result;
|
133
|
+
}
|
134
|
+
this.makeDefaultExport();
|
135
|
+
return this.module.exports;
|
129
136
|
};
|
130
137
|
|
131
138
|
Module.prototype.unsee = function() {
|
132
139
|
this.finalized = false;
|
133
|
-
this.
|
140
|
+
this._foundDeps = false;
|
134
141
|
this.module = { exports: {}};
|
135
142
|
};
|
136
143
|
|
137
144
|
Module.prototype.reify = function() {
|
138
145
|
stats.reify++;
|
139
|
-
var deps = this.deps;
|
140
|
-
var dep;
|
141
146
|
var reified = this.reified;
|
147
|
+
for (var i = 0; i < reified.length; i++) {
|
148
|
+
var mod = reified[i];
|
149
|
+
reified[i] = mod.exports ? mod.exports : mod.module.exports();
|
150
|
+
}
|
151
|
+
};
|
152
|
+
|
153
|
+
Module.prototype.findDeps = function(pending) {
|
154
|
+
if (this._foundDeps) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
|
158
|
+
stats.findDeps++;
|
159
|
+
this._foundDeps = true;
|
160
|
+
|
161
|
+
var deps = this.deps;
|
142
162
|
|
143
163
|
for (var i = 0; i < deps.length; i++) {
|
144
|
-
dep = deps[i];
|
164
|
+
var dep = deps[i];
|
165
|
+
var entry = this.reified[i] = { exports: undefined, module: undefined };
|
145
166
|
if (dep === 'exports') {
|
146
167
|
this.hasExportsAsDep = true;
|
147
|
-
|
168
|
+
entry.exports = this.module.exports;
|
148
169
|
} else if (dep === 'require') {
|
149
|
-
|
170
|
+
entry.exports = this.makeRequire();
|
150
171
|
} else if (dep === 'module') {
|
151
|
-
|
172
|
+
entry.exports = this.module;
|
152
173
|
} else {
|
153
|
-
|
174
|
+
entry.module = findModule(resolve(dep, this.name), this.name, pending);
|
154
175
|
}
|
155
176
|
}
|
156
177
|
};
|
@@ -167,16 +188,6 @@ var loader, define, requireModule, require, requirejs;
|
|
167
188
|
return r;
|
168
189
|
};
|
169
190
|
|
170
|
-
Module.prototype.build = function() {
|
171
|
-
stats.ensureBuild++;
|
172
|
-
if (this.state === FAILED || this.state === LOADED) { return; }
|
173
|
-
stats.build++;
|
174
|
-
this.state = FAILED;
|
175
|
-
this.reify()
|
176
|
-
this.exports();
|
177
|
-
this.state = LOADED;
|
178
|
-
};
|
179
|
-
|
180
191
|
define = function(name, deps, callback) {
|
181
192
|
stats.define++;
|
182
193
|
if (arguments.length < 2) {
|
@@ -212,7 +223,7 @@ var loader, define, requireModule, require, requirejs;
|
|
212
223
|
throw new Error('Could not find module `' + name + '` imported from `' + referrer + '`');
|
213
224
|
}
|
214
225
|
|
215
|
-
function findModule(name, referrer) {
|
226
|
+
function findModule(name, referrer, pending) {
|
216
227
|
stats.findModule++;
|
217
228
|
var mod = registry[name] || registry[name + '/index'];
|
218
229
|
|
@@ -222,7 +233,10 @@ var loader, define, requireModule, require, requirejs;
|
|
222
233
|
|
223
234
|
if (!mod) { missingModule(name, referrer); }
|
224
235
|
|
225
|
-
|
236
|
+
if (pending) {
|
237
|
+
mod.findDeps(pending);
|
238
|
+
pending.push(mod);
|
239
|
+
}
|
226
240
|
return mod;
|
227
241
|
}
|
228
242
|
|
@@ -258,7 +272,7 @@ var loader, define, requireModule, require, requirejs;
|
|
258
272
|
requirejs.entries = requirejs._eak_seen = registry;
|
259
273
|
requirejs.has = has;
|
260
274
|
requirejs.unsee = function(moduleName) {
|
261
|
-
findModule(moduleName, '(unsee)').unsee();
|
275
|
+
findModule(moduleName, '(unsee)', false).unsee();
|
262
276
|
};
|
263
277
|
|
264
278
|
requirejs.clear = function() {
|
@@ -5232,7 +5246,9 @@ define("ember-data/-private/system/record-arrays/adapter-populated-record-array"
|
|
5232
5246
|
meta: (0, _emberDataPrivateSystemCloneNull.default)(payload.meta)
|
5233
5247
|
});
|
5234
5248
|
|
5235
|
-
|
5249
|
+
if (true) {
|
5250
|
+
this.set('links', (0, _emberDataPrivateSystemCloneNull.default)(payload.links));
|
5251
|
+
}
|
5236
5252
|
|
5237
5253
|
internalModels.forEach(function (record) {
|
5238
5254
|
_this.manager.recordArraysForRecord(record).add(_this);
|
@@ -5556,6 +5572,12 @@ define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-da
|
|
5556
5572
|
var record;
|
5557
5573
|
|
5558
5574
|
if (data instanceof _emberDataModel.default) {
|
5575
|
+
if (false) {
|
5576
|
+
(0, _emberDataPrivateDebug.deprecate)("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, {
|
5577
|
+
id: 'ds.references.belongs-to.push-record',
|
5578
|
+
until: '3.0'
|
5579
|
+
});
|
5580
|
+
}
|
5559
5581
|
record = data;
|
5560
5582
|
} else {
|
5561
5583
|
record = _this.store.push(data);
|
@@ -5651,13 +5673,29 @@ define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'e
|
|
5651
5673
|
return _ember.default.RSVP.resolve(objectOrPromise).then(function (payload) {
|
5652
5674
|
var array = payload;
|
5653
5675
|
|
5676
|
+
if (false) {
|
5677
|
+
(0, _emberDataPrivateDebug.deprecate)("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), {
|
5678
|
+
id: 'ds.references.has-many.push-array',
|
5679
|
+
until: '3.0'
|
5680
|
+
});
|
5681
|
+
}
|
5682
|
+
|
5654
5683
|
var useLegacyArrayPush = true;
|
5655
5684
|
if (typeof payload === "object" && payload.data) {
|
5656
5685
|
array = payload.data;
|
5657
5686
|
useLegacyArrayPush = array.length && array[0].data;
|
5687
|
+
|
5688
|
+
if (false) {
|
5689
|
+
(0, _emberDataPrivateDebug.deprecate)("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, {
|
5690
|
+
id: 'ds.references.has-many.push-invalid-json-api',
|
5691
|
+
until: '3.0'
|
5692
|
+
});
|
5693
|
+
}
|
5658
5694
|
}
|
5659
5695
|
|
5660
|
-
|
5696
|
+
if (!false) {
|
5697
|
+
useLegacyArrayPush = true;
|
5698
|
+
}
|
5661
5699
|
|
5662
5700
|
var internalModels = undefined;
|
5663
5701
|
if (useLegacyArrayPush) {
|
@@ -8820,7 +8858,7 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/mode
|
|
8820
8858
|
});
|
8821
8859
|
```
|
8822
8860
|
Note: the primary use case for `store.queryRecord` is when a single record
|
8823
|
-
is queried and the `id` is not
|
8861
|
+
is queried and the `id` is not known beforehand. In all other cases
|
8824
8862
|
`store.query` and using the first item of the array is likely the preferred
|
8825
8863
|
way:
|
8826
8864
|
```
|
@@ -9754,10 +9792,15 @@ define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/mode
|
|
9754
9792
|
(0, _emberDataPrivateDebug.assert)('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + _ember.default.inspect(modelName), typeof modelName === 'string');
|
9755
9793
|
serializer = this.serializerFor(modelName);
|
9756
9794
|
}
|
9757
|
-
|
9758
|
-
|
9759
|
-
|
9760
|
-
|
9795
|
+
if (false) {
|
9796
|
+
return this._adapterRun(function () {
|
9797
|
+
return serializer.pushPayload(_this3, payload);
|
9798
|
+
});
|
9799
|
+
} else {
|
9800
|
+
this._adapterRun(function () {
|
9801
|
+
return serializer.pushPayload(_this3, payload);
|
9802
|
+
});
|
9803
|
+
}
|
9761
9804
|
},
|
9762
9805
|
|
9763
9806
|
/**
|
@@ -10550,8 +10593,10 @@ define('ember-data/-private/transforms/boolean', ['exports', 'ember', 'ember-dat
|
|
10550
10593
|
deserialize: function (serialized, options) {
|
10551
10594
|
var type = typeof serialized;
|
10552
10595
|
|
10553
|
-
if (
|
10554
|
-
|
10596
|
+
if (true) {
|
10597
|
+
if (isNone(serialized) && options.allowNull === true) {
|
10598
|
+
return null;
|
10599
|
+
}
|
10555
10600
|
}
|
10556
10601
|
|
10557
10602
|
if (type === "boolean") {
|
@@ -10566,8 +10611,10 @@ define('ember-data/-private/transforms/boolean', ['exports', 'ember', 'ember-dat
|
|
10566
10611
|
},
|
10567
10612
|
|
10568
10613
|
serialize: function (deserialized, options) {
|
10569
|
-
if (
|
10570
|
-
|
10614
|
+
if (true) {
|
10615
|
+
if (isNone(deserialized) && options.allowNull === true) {
|
10616
|
+
return null;
|
10617
|
+
}
|
10571
10618
|
}
|
10572
10619
|
|
10573
10620
|
return Boolean(deserialized);
|
@@ -11368,6 +11415,9 @@ define('ember-data/adapters/errors', ['exports', 'ember', 'ember-data/-private/d
|
|
11368
11415
|
}
|
11369
11416
|
|
11370
11417
|
var extendedErrorsEnabled = false;
|
11418
|
+
if (false) {
|
11419
|
+
extendedErrorsEnabled = true;
|
11420
|
+
}
|
11371
11421
|
|
11372
11422
|
function extendFn(ErrorClass) {
|
11373
11423
|
return function () {
|
@@ -11571,7 +11621,7 @@ define('ember-data/adapters/errors', ['exports', 'ember', 'ember-data/-private/d
|
|
11571
11621
|
return out;
|
11572
11622
|
}
|
11573
11623
|
});
|
11574
|
-
define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters/rest', 'ember-data/-private/features'], function (exports, _ember, _emberDataAdaptersRest, _emberDataPrivateFeatures) {
|
11624
|
+
define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters/rest', 'ember-data/-private/features', 'ember-data/-private/debug'], function (exports, _ember, _emberDataAdaptersRest, _emberDataPrivateFeatures, _emberDataPrivateDebug) {
|
11575
11625
|
|
11576
11626
|
/**
|
11577
11627
|
@class JSONAPIAdapter
|
@@ -11655,7 +11705,12 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters
|
|
11655
11705
|
@return {Promise} promise
|
11656
11706
|
*/
|
11657
11707
|
findMany: function (store, type, ids, snapshots) {
|
11658
|
-
|
11708
|
+
if (true && !this._hasCustomizedAjax()) {
|
11709
|
+
return this._super.apply(this, arguments);
|
11710
|
+
} else {
|
11711
|
+
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
|
11712
|
+
return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } });
|
11713
|
+
}
|
11659
11714
|
},
|
11660
11715
|
|
11661
11716
|
/**
|
@@ -11677,65 +11732,100 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters
|
|
11677
11732
|
@return {Promise} promise
|
11678
11733
|
*/
|
11679
11734
|
updateRecord: function (store, type, snapshot) {
|
11680
|
-
|
11681
|
-
|
11682
|
-
|
11735
|
+
if (true && !this._hasCustomizedAjax()) {
|
11736
|
+
return this._super.apply(this, arguments);
|
11737
|
+
} else {
|
11738
|
+
var data = {};
|
11739
|
+
var serializer = store.serializerFor(type.modelName);
|
11683
11740
|
|
11684
|
-
|
11741
|
+
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
|
11685
11742
|
|
11686
|
-
|
11687
|
-
|
11688
|
-
return 'PATCH';
|
11689
|
-
}
|
11743
|
+
var id = snapshot.id;
|
11744
|
+
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
|
11690
11745
|
|
11691
|
-
|
11746
|
+
return this.ajax(url, 'PATCH', { data: data });
|
11747
|
+
}
|
11692
11748
|
},
|
11693
11749
|
|
11694
|
-
|
11695
|
-
|
11696
|
-
|
11750
|
+
_hasCustomizedAjax: function () {
|
11751
|
+
if (this.ajax !== JSONAPIAdapter.prototype.ajax) {
|
11752
|
+
(0, _emberDataPrivateDebug.deprecate)('JSONAPIAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
11753
|
+
id: 'ds.json-api-adapter.ajax',
|
11754
|
+
until: '3.0.0'
|
11755
|
+
});
|
11756
|
+
return true;
|
11757
|
+
}
|
11697
11758
|
|
11698
|
-
if (
|
11699
|
-
|
11700
|
-
|
11701
|
-
|
11759
|
+
if (this.ajaxOptions !== JSONAPIAdapter.prototype.ajaxOptions) {
|
11760
|
+
(0, _emberDataPrivateDebug.deprecate)('JSONAPIAdapterr#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
11761
|
+
id: 'ds.json-api-adapter.ajax-options',
|
11762
|
+
until: '3.0.0'
|
11763
|
+
});
|
11764
|
+
return true;
|
11702
11765
|
}
|
11703
11766
|
|
11704
|
-
|
11705
|
-
|
11706
|
-
|
11707
|
-
var snapshot = params.snapshot;
|
11767
|
+
return false;
|
11768
|
+
}
|
11769
|
+
});
|
11708
11770
|
|
11709
|
-
|
11710
|
-
var serializer = store.serializerFor(type.modelName);
|
11771
|
+
if (true) {
|
11711
11772
|
|
11712
|
-
|
11773
|
+
JSONAPIAdapter.reopen({
|
11713
11774
|
|
11714
|
-
|
11715
|
-
|
11775
|
+
methodForRequest: function (params) {
|
11776
|
+
if (params.requestType === 'updateRecord') {
|
11777
|
+
return 'PATCH';
|
11778
|
+
}
|
11716
11779
|
|
11717
|
-
|
11718
|
-
|
11780
|
+
return this._super.apply(this, arguments);
|
11781
|
+
},
|
11719
11782
|
|
11720
|
-
|
11721
|
-
|
11783
|
+
dataForRequest: function (params) {
|
11784
|
+
var requestType = params.requestType;
|
11785
|
+
var ids = params.ids;
|
11722
11786
|
|
11723
|
-
|
11787
|
+
if (requestType === 'findMany') {
|
11788
|
+
return {
|
11789
|
+
filter: { id: ids.join(',') }
|
11790
|
+
};
|
11791
|
+
}
|
11724
11792
|
|
11725
|
-
|
11726
|
-
|
11793
|
+
if (requestType === 'updateRecord') {
|
11794
|
+
var store = params.store;
|
11795
|
+
var type = params.type;
|
11796
|
+
var snapshot = params.snapshot;
|
11727
11797
|
|
11728
|
-
|
11729
|
-
|
11798
|
+
var data = {};
|
11799
|
+
var serializer = store.serializerFor(type.modelName);
|
11730
11800
|
|
11731
|
-
|
11732
|
-
hash.contentType = 'application/vnd.api+json';
|
11733
|
-
}
|
11801
|
+
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
|
11734
11802
|
|
11735
|
-
|
11736
|
-
|
11803
|
+
return data;
|
11804
|
+
}
|
11737
11805
|
|
11738
|
-
|
11806
|
+
return this._super.apply(this, arguments);
|
11807
|
+
},
|
11808
|
+
|
11809
|
+
headersForRequest: function () {
|
11810
|
+
var headers = this._super.apply(this, arguments) || {};
|
11811
|
+
|
11812
|
+
headers['Accept'] = 'application/vnd.api+json';
|
11813
|
+
|
11814
|
+
return headers;
|
11815
|
+
},
|
11816
|
+
|
11817
|
+
_requestToJQueryAjaxHash: function () {
|
11818
|
+
var hash = this._super.apply(this, arguments);
|
11819
|
+
|
11820
|
+
if (hash.contentType) {
|
11821
|
+
hash.contentType = 'application/vnd.api+json';
|
11822
|
+
}
|
11823
|
+
|
11824
|
+
return hash;
|
11825
|
+
}
|
11826
|
+
|
11827
|
+
});
|
11828
|
+
}
|
11739
11829
|
|
11740
11830
|
exports.default = JSONAPIAdapter;
|
11741
11831
|
});
|
@@ -12103,12 +12193,19 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12103
12193
|
@return {Promise} promise
|
12104
12194
|
*/
|
12105
12195
|
findRecord: function (store, type, id, snapshot) {
|
12106
|
-
|
12107
|
-
|
12108
|
-
|
12109
|
-
|
12196
|
+
if (true && !this._hasCustomizedAjax()) {
|
12197
|
+
var request = this._requestFor({
|
12198
|
+
store: store, type: type, id: id, snapshot: snapshot,
|
12199
|
+
requestType: 'findRecord'
|
12200
|
+
});
|
12201
|
+
|
12202
|
+
return this._makeRequest(request);
|
12203
|
+
} else {
|
12204
|
+
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
|
12205
|
+
var query = this.buildQuery(snapshot);
|
12110
12206
|
|
12111
|
-
|
12207
|
+
return this.ajax(url, 'GET', { data: query });
|
12208
|
+
}
|
12112
12209
|
},
|
12113
12210
|
|
12114
12211
|
/**
|
@@ -12126,13 +12223,23 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12126
12223
|
findAll: function (store, type, sinceToken, snapshotRecordArray) {
|
12127
12224
|
var query = this.buildQuery(snapshotRecordArray);
|
12128
12225
|
|
12129
|
-
|
12130
|
-
|
12131
|
-
|
12132
|
-
|
12133
|
-
|
12226
|
+
if (true && !this._hasCustomizedAjax()) {
|
12227
|
+
var request = this._requestFor({
|
12228
|
+
store: store, type: type, sinceToken: sinceToken, query: query,
|
12229
|
+
snapshots: snapshotRecordArray,
|
12230
|
+
requestType: 'findAll'
|
12231
|
+
});
|
12232
|
+
|
12233
|
+
return this._makeRequest(request);
|
12234
|
+
} else {
|
12235
|
+
var url = this.buildURL(type.modelName, null, snapshotRecordArray, 'findAll');
|
12236
|
+
|
12237
|
+
if (sinceToken) {
|
12238
|
+
query.since = sinceToken;
|
12239
|
+
}
|
12134
12240
|
|
12135
|
-
|
12241
|
+
return this.ajax(url, 'GET', { data: query });
|
12242
|
+
}
|
12136
12243
|
},
|
12137
12244
|
|
12138
12245
|
/**
|
@@ -12150,12 +12257,22 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12150
12257
|
@return {Promise} promise
|
12151
12258
|
*/
|
12152
12259
|
query: function (store, type, query) {
|
12153
|
-
|
12154
|
-
|
12155
|
-
|
12156
|
-
|
12260
|
+
if (true && !this._hasCustomizedAjax()) {
|
12261
|
+
var request = this._requestFor({
|
12262
|
+
store: store, type: type, query: query,
|
12263
|
+
requestType: 'query'
|
12264
|
+
});
|
12157
12265
|
|
12158
|
-
|
12266
|
+
return this._makeRequest(request);
|
12267
|
+
} else {
|
12268
|
+
var url = this.buildURL(type.modelName, null, null, 'query', query);
|
12269
|
+
|
12270
|
+
if (this.sortQueryParams) {
|
12271
|
+
query = this.sortQueryParams(query);
|
12272
|
+
}
|
12273
|
+
|
12274
|
+
return this.ajax(url, 'GET', { data: query });
|
12275
|
+
}
|
12159
12276
|
},
|
12160
12277
|
|
12161
12278
|
/**
|
@@ -12173,12 +12290,22 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12173
12290
|
@return {Promise} promise
|
12174
12291
|
*/
|
12175
12292
|
queryRecord: function (store, type, query) {
|
12176
|
-
|
12177
|
-
|
12178
|
-
|
12179
|
-
|
12293
|
+
if (true && !this._hasCustomizedAjax()) {
|
12294
|
+
var request = this._requestFor({
|
12295
|
+
store: store, type: type, query: query,
|
12296
|
+
requestType: 'queryRecord'
|
12297
|
+
});
|
12298
|
+
|
12299
|
+
return this._makeRequest(request);
|
12300
|
+
} else {
|
12301
|
+
var url = this.buildURL(type.modelName, null, null, 'queryRecord', query);
|
12302
|
+
|
12303
|
+
if (this.sortQueryParams) {
|
12304
|
+
query = this.sortQueryParams(query);
|
12305
|
+
}
|
12180
12306
|
|
12181
|
-
|
12307
|
+
return this.ajax(url, 'GET', { data: query });
|
12308
|
+
}
|
12182
12309
|
},
|
12183
12310
|
|
12184
12311
|
/**
|
@@ -12208,12 +12335,17 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12208
12335
|
@return {Promise} promise
|
12209
12336
|
*/
|
12210
12337
|
findMany: function (store, type, ids, snapshots) {
|
12211
|
-
|
12212
|
-
|
12213
|
-
|
12214
|
-
|
12338
|
+
if (true && !this._hasCustomizedAjax()) {
|
12339
|
+
var request = this._requestFor({
|
12340
|
+
store: store, type: type, ids: ids, snapshots: snapshots,
|
12341
|
+
requestType: 'findMany'
|
12342
|
+
});
|
12215
12343
|
|
12216
|
-
|
12344
|
+
return this._makeRequest(request);
|
12345
|
+
} else {
|
12346
|
+
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
|
12347
|
+
return this.ajax(url, 'GET', { data: { ids: ids } });
|
12348
|
+
}
|
12217
12349
|
},
|
12218
12350
|
|
12219
12351
|
/**
|
@@ -12243,12 +12375,21 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12243
12375
|
@return {Promise} promise
|
12244
12376
|
*/
|
12245
12377
|
findHasMany: function (store, snapshot, url, relationship) {
|
12246
|
-
|
12247
|
-
|
12248
|
-
|
12249
|
-
|
12378
|
+
if (true && !this._hasCustomizedAjax()) {
|
12379
|
+
var request = this._requestFor({
|
12380
|
+
store: store, snapshot: snapshot, url: url, relationship: relationship,
|
12381
|
+
requestType: 'findHasMany'
|
12382
|
+
});
|
12383
|
+
|
12384
|
+
return this._makeRequest(request);
|
12385
|
+
} else {
|
12386
|
+
var id = snapshot.id;
|
12387
|
+
var type = snapshot.modelName;
|
12388
|
+
|
12389
|
+
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findHasMany'));
|
12250
12390
|
|
12251
|
-
|
12391
|
+
return this.ajax(url, 'GET');
|
12392
|
+
}
|
12252
12393
|
},
|
12253
12394
|
|
12254
12395
|
/**
|
@@ -12278,12 +12419,20 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12278
12419
|
@return {Promise} promise
|
12279
12420
|
*/
|
12280
12421
|
findBelongsTo: function (store, snapshot, url, relationship) {
|
12281
|
-
|
12282
|
-
|
12283
|
-
|
12284
|
-
|
12422
|
+
if (true && !this._hasCustomizedAjax()) {
|
12423
|
+
var request = this._requestFor({
|
12424
|
+
store: store, snapshot: snapshot, url: url, relationship: relationship,
|
12425
|
+
requestType: 'findBelongsTo'
|
12426
|
+
});
|
12427
|
+
|
12428
|
+
return this._makeRequest(request);
|
12429
|
+
} else {
|
12430
|
+
var id = snapshot.id;
|
12431
|
+
var type = snapshot.modelName;
|
12285
12432
|
|
12286
|
-
|
12433
|
+
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findBelongsTo'));
|
12434
|
+
return this.ajax(url, 'GET');
|
12435
|
+
}
|
12287
12436
|
},
|
12288
12437
|
|
12289
12438
|
/**
|
@@ -12300,12 +12449,22 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12300
12449
|
@return {Promise} promise
|
12301
12450
|
*/
|
12302
12451
|
createRecord: function (store, type, snapshot) {
|
12303
|
-
|
12304
|
-
|
12305
|
-
|
12306
|
-
|
12452
|
+
if (true && !this._hasCustomizedAjax()) {
|
12453
|
+
var request = this._requestFor({
|
12454
|
+
store: store, type: type, snapshot: snapshot,
|
12455
|
+
requestType: 'createRecord'
|
12456
|
+
});
|
12457
|
+
|
12458
|
+
return this._makeRequest(request);
|
12459
|
+
} else {
|
12460
|
+
var data = {};
|
12461
|
+
var serializer = store.serializerFor(type.modelName);
|
12462
|
+
var url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
|
12463
|
+
|
12464
|
+
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
|
12307
12465
|
|
12308
|
-
|
12466
|
+
return this.ajax(url, "POST", { data: data });
|
12467
|
+
}
|
12309
12468
|
},
|
12310
12469
|
|
12311
12470
|
/**
|
@@ -12322,12 +12481,24 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12322
12481
|
@return {Promise} promise
|
12323
12482
|
*/
|
12324
12483
|
updateRecord: function (store, type, snapshot) {
|
12325
|
-
|
12326
|
-
|
12327
|
-
|
12328
|
-
|
12484
|
+
if (true && !this._hasCustomizedAjax()) {
|
12485
|
+
var request = this._requestFor({
|
12486
|
+
store: store, type: type, snapshot: snapshot,
|
12487
|
+
requestType: 'updateRecord'
|
12488
|
+
});
|
12489
|
+
|
12490
|
+
return this._makeRequest(request);
|
12491
|
+
} else {
|
12492
|
+
var data = {};
|
12493
|
+
var serializer = store.serializerFor(type.modelName);
|
12494
|
+
|
12495
|
+
serializer.serializeIntoHash(data, type, snapshot);
|
12496
|
+
|
12497
|
+
var id = snapshot.id;
|
12498
|
+
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
|
12329
12499
|
|
12330
|
-
|
12500
|
+
return this.ajax(url, "PUT", { data: data });
|
12501
|
+
}
|
12331
12502
|
},
|
12332
12503
|
|
12333
12504
|
/**
|
@@ -12340,12 +12511,18 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12340
12511
|
@return {Promise} promise
|
12341
12512
|
*/
|
12342
12513
|
deleteRecord: function (store, type, snapshot) {
|
12343
|
-
|
12344
|
-
|
12345
|
-
|
12346
|
-
|
12514
|
+
if (true && !this._hasCustomizedAjax()) {
|
12515
|
+
var request = this._requestFor({
|
12516
|
+
store: store, type: type, snapshot: snapshot,
|
12517
|
+
requestType: 'deleteRecord'
|
12518
|
+
});
|
12347
12519
|
|
12348
|
-
|
12520
|
+
return this._makeRequest(request);
|
12521
|
+
} else {
|
12522
|
+
var id = snapshot.id;
|
12523
|
+
|
12524
|
+
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'deleteRecord'), "DELETE");
|
12525
|
+
}
|
12349
12526
|
},
|
12350
12527
|
|
12351
12528
|
_stripIDFromURL: function (store, snapshot) {
|
@@ -12469,6 +12646,23 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12469
12646
|
var errors = this.normalizeErrorResponse(status, headers, payload);
|
12470
12647
|
var detailedMessage = this.generatedDetailedMessage(status, headers, payload, requestData);
|
12471
12648
|
|
12649
|
+
if (false) {
|
12650
|
+
switch (status) {
|
12651
|
+
case 401:
|
12652
|
+
return new _emberDataAdaptersErrors.UnauthorizedError(errors, detailedMessage);
|
12653
|
+
case 403:
|
12654
|
+
return new _emberDataAdaptersErrors.ForbiddenError(errors, detailedMessage);
|
12655
|
+
case 404:
|
12656
|
+
return new _emberDataAdaptersErrors.NotFoundError(errors, detailedMessage);
|
12657
|
+
case 409:
|
12658
|
+
return new _emberDataAdaptersErrors.ConflictError(errors, detailedMessage);
|
12659
|
+
default:
|
12660
|
+
if (status >= 500) {
|
12661
|
+
return new _emberDataAdaptersErrors.ServerError(errors, detailedMessage);
|
12662
|
+
}
|
12663
|
+
}
|
12664
|
+
}
|
12665
|
+
|
12472
12666
|
return new _emberDataAdaptersErrors.AdapterError(errors, detailedMessage);
|
12473
12667
|
},
|
12474
12668
|
|
@@ -12686,267 +12880,290 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
|
|
12686
12880
|
}
|
12687
12881
|
|
12688
12882
|
return query;
|
12689
|
-
}
|
12690
|
-
});
|
12691
|
-
|
12692
|
-
RESTAdapter.reopen({
|
12693
|
-
|
12694
|
-
/**
|
12695
|
-
* Get the data (body or query params) for a request.
|
12696
|
-
*
|
12697
|
-
* @public
|
12698
|
-
* @method dataForRequest
|
12699
|
-
* @param {Object} params
|
12700
|
-
* @return {Object} data
|
12701
|
-
*/
|
12702
|
-
dataForRequest: function (params) {
|
12703
|
-
var store = params.store;
|
12704
|
-
var type = params.type;
|
12705
|
-
var snapshot = params.snapshot;
|
12706
|
-
var requestType = params.requestType;
|
12707
|
-
var query = params.query;
|
12708
|
-
|
12709
|
-
// type is not passed to findBelongsTo and findHasMany
|
12710
|
-
type = type || snapshot && snapshot.type;
|
12711
|
-
|
12712
|
-
var serializer = store.serializerFor(type.modelName);
|
12713
|
-
var data = {};
|
12883
|
+
},
|
12714
12884
|
|
12715
|
-
|
12716
|
-
|
12717
|
-
|
12718
|
-
|
12885
|
+
_hasCustomizedAjax: function () {
|
12886
|
+
if (this.ajax !== RESTAdapter.prototype.ajax) {
|
12887
|
+
(0, _emberDataPrivateDebug.deprecate)('RESTAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
12888
|
+
id: 'ds.rest-adapter.ajax',
|
12889
|
+
until: '3.0.0'
|
12890
|
+
});
|
12891
|
+
return true;
|
12892
|
+
}
|
12719
12893
|
|
12720
|
-
|
12721
|
-
|
12722
|
-
|
12894
|
+
if (this.ajaxOptions !== RESTAdapter.prototype.ajaxOptions) {
|
12895
|
+
(0, _emberDataPrivateDebug.deprecate)('RESTAdapter#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, {
|
12896
|
+
id: 'ds.rest-adapter.ajax-options',
|
12897
|
+
until: '3.0.0'
|
12898
|
+
});
|
12899
|
+
return true;
|
12900
|
+
}
|
12723
12901
|
|
12724
|
-
|
12725
|
-
|
12726
|
-
|
12902
|
+
return false;
|
12903
|
+
}
|
12904
|
+
});
|
12727
12905
|
|
12728
|
-
|
12729
|
-
if (params.sinceToken) {
|
12730
|
-
query = query || {};
|
12731
|
-
query.since = params.sinceToken;
|
12732
|
-
}
|
12733
|
-
data = query;
|
12734
|
-
break;
|
12906
|
+
if (true) {
|
12735
12907
|
|
12736
|
-
|
12737
|
-
case 'queryRecord':
|
12738
|
-
if (this.sortQueryParams) {
|
12739
|
-
query = this.sortQueryParams(query);
|
12740
|
-
}
|
12741
|
-
data = query;
|
12742
|
-
break;
|
12908
|
+
RESTAdapter.reopen({
|
12743
12909
|
|
12744
|
-
|
12745
|
-
|
12746
|
-
|
12910
|
+
/**
|
12911
|
+
* Get the data (body or query params) for a request.
|
12912
|
+
*
|
12913
|
+
* @public
|
12914
|
+
* @method dataForRequest
|
12915
|
+
* @param {Object} params
|
12916
|
+
* @return {Object} data
|
12917
|
+
*/
|
12918
|
+
dataForRequest: function (params) {
|
12919
|
+
var store = params.store;
|
12920
|
+
var type = params.type;
|
12921
|
+
var snapshot = params.snapshot;
|
12922
|
+
var requestType = params.requestType;
|
12923
|
+
var query = params.query;
|
12747
12924
|
|
12748
|
-
|
12749
|
-
|
12750
|
-
break;
|
12751
|
-
}
|
12925
|
+
// type is not passed to findBelongsTo and findHasMany
|
12926
|
+
type = type || snapshot && snapshot.type;
|
12752
12927
|
|
12753
|
-
|
12754
|
-
|
12928
|
+
var serializer = store.serializerFor(type.modelName);
|
12929
|
+
var data = {};
|
12755
12930
|
|
12756
|
-
|
12757
|
-
|
12758
|
-
|
12759
|
-
|
12760
|
-
* @method methodForRequest
|
12761
|
-
* @param {Object} params
|
12762
|
-
* @return {String} HTTP method
|
12763
|
-
*/
|
12764
|
-
methodForRequest: function (params) {
|
12765
|
-
var requestType = params.requestType;
|
12931
|
+
switch (requestType) {
|
12932
|
+
case 'createRecord':
|
12933
|
+
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
|
12934
|
+
break;
|
12766
12935
|
|
12767
|
-
|
12768
|
-
|
12769
|
-
|
12770
|
-
case 'updateRecord':
|
12771
|
-
return 'PUT';
|
12772
|
-
case 'deleteRecord':
|
12773
|
-
return 'DELETE';
|
12774
|
-
}
|
12936
|
+
case 'updateRecord':
|
12937
|
+
serializer.serializeIntoHash(data, type, snapshot);
|
12938
|
+
break;
|
12775
12939
|
|
12776
|
-
|
12777
|
-
|
12940
|
+
case 'findRecord':
|
12941
|
+
data = this.buildQuery(snapshot);
|
12942
|
+
break;
|
12778
12943
|
|
12779
|
-
|
12780
|
-
|
12781
|
-
|
12782
|
-
|
12783
|
-
|
12784
|
-
|
12785
|
-
|
12786
|
-
*/
|
12787
|
-
urlForRequest: function (params) {
|
12788
|
-
var type = params.type;
|
12789
|
-
var id = params.id;
|
12790
|
-
var ids = params.ids;
|
12791
|
-
var snapshot = params.snapshot;
|
12792
|
-
var snapshots = params.snapshots;
|
12793
|
-
var requestType = params.requestType;
|
12794
|
-
var query = params.query;
|
12795
|
-
|
12796
|
-
// type and id are not passed from updateRecord and deleteRecord, hence they
|
12797
|
-
// are defined if not set
|
12798
|
-
type = type || snapshot && snapshot.type;
|
12799
|
-
id = id || snapshot && snapshot.id;
|
12944
|
+
case 'findAll':
|
12945
|
+
if (params.sinceToken) {
|
12946
|
+
query = query || {};
|
12947
|
+
query.since = params.sinceToken;
|
12948
|
+
}
|
12949
|
+
data = query;
|
12950
|
+
break;
|
12800
12951
|
|
12801
|
-
|
12802
|
-
|
12803
|
-
|
12952
|
+
case 'query':
|
12953
|
+
case 'queryRecord':
|
12954
|
+
if (this.sortQueryParams) {
|
12955
|
+
query = this.sortQueryParams(query);
|
12956
|
+
}
|
12957
|
+
data = query;
|
12958
|
+
break;
|
12804
12959
|
|
12805
|
-
|
12806
|
-
|
12807
|
-
|
12960
|
+
case 'findMany':
|
12961
|
+
data = { ids: params.ids };
|
12962
|
+
break;
|
12808
12963
|
|
12809
|
-
|
12810
|
-
|
12964
|
+
default:
|
12965
|
+
data = undefined;
|
12966
|
+
break;
|
12967
|
+
}
|
12811
12968
|
|
12812
|
-
|
12813
|
-
|
12814
|
-
{
|
12815
|
-
var url = this.buildURL(type.modelName, id, snapshot, requestType);
|
12816
|
-
return this.urlPrefix(params.url, url);
|
12817
|
-
}
|
12818
|
-
}
|
12969
|
+
return data;
|
12970
|
+
},
|
12819
12971
|
|
12820
|
-
|
12821
|
-
|
12972
|
+
/**
|
12973
|
+
* Get the HTTP method for a request.
|
12974
|
+
*
|
12975
|
+
* @public
|
12976
|
+
* @method methodForRequest
|
12977
|
+
* @param {Object} params
|
12978
|
+
* @return {String} HTTP method
|
12979
|
+
*/
|
12980
|
+
methodForRequest: function (params) {
|
12981
|
+
var requestType = params.requestType;
|
12982
|
+
|
12983
|
+
switch (requestType) {
|
12984
|
+
case 'createRecord':
|
12985
|
+
return 'POST';
|
12986
|
+
case 'updateRecord':
|
12987
|
+
return 'PUT';
|
12988
|
+
case 'deleteRecord':
|
12989
|
+
return 'DELETE';
|
12990
|
+
}
|
12822
12991
|
|
12823
|
-
|
12824
|
-
|
12825
|
-
*
|
12826
|
-
* By default the value of the `headers` property of the adapter is
|
12827
|
-
* returned.
|
12828
|
-
*
|
12829
|
-
* @public
|
12830
|
-
* @method headersForRequest
|
12831
|
-
* @param {Object} params
|
12832
|
-
* @return {Object} headers
|
12833
|
-
*/
|
12834
|
-
headersForRequest: function (params) {
|
12835
|
-
return this.get('headers');
|
12836
|
-
},
|
12992
|
+
return 'GET';
|
12993
|
+
},
|
12837
12994
|
|
12838
|
-
|
12839
|
-
|
12840
|
-
|
12841
|
-
|
12842
|
-
|
12843
|
-
|
12844
|
-
|
12845
|
-
|
12846
|
-
|
12847
|
-
|
12848
|
-
|
12849
|
-
|
12850
|
-
|
12851
|
-
|
12995
|
+
/**
|
12996
|
+
* Get the URL for a request.
|
12997
|
+
*
|
12998
|
+
* @public
|
12999
|
+
* @method urlForRequest
|
13000
|
+
* @param {Object} params
|
13001
|
+
* @return {String} URL
|
13002
|
+
*/
|
13003
|
+
urlForRequest: function (params) {
|
13004
|
+
var type = params.type;
|
13005
|
+
var id = params.id;
|
13006
|
+
var ids = params.ids;
|
13007
|
+
var snapshot = params.snapshot;
|
13008
|
+
var snapshots = params.snapshots;
|
13009
|
+
var requestType = params.requestType;
|
13010
|
+
var query = params.query;
|
13011
|
+
|
13012
|
+
// type and id are not passed from updateRecord and deleteRecord, hence they
|
13013
|
+
// are defined if not set
|
13014
|
+
type = type || snapshot && snapshot.type;
|
13015
|
+
id = id || snapshot && snapshot.id;
|
13016
|
+
|
13017
|
+
switch (requestType) {
|
13018
|
+
case 'findAll':
|
13019
|
+
return this.buildURL(type.modelName, null, snapshots, requestType);
|
13020
|
+
|
13021
|
+
case 'query':
|
13022
|
+
case 'queryRecord':
|
13023
|
+
return this.buildURL(type.modelName, null, null, requestType, query);
|
13024
|
+
|
13025
|
+
case 'findMany':
|
13026
|
+
return this.buildURL(type.modelName, ids, snapshots, requestType);
|
13027
|
+
|
13028
|
+
case 'findHasMany':
|
13029
|
+
case 'findBelongsTo':
|
13030
|
+
{
|
13031
|
+
var url = this.buildURL(type.modelName, id, snapshot, requestType);
|
13032
|
+
return this.urlPrefix(params.url, url);
|
13033
|
+
}
|
13034
|
+
}
|
12852
13035
|
|
12853
|
-
|
12854
|
-
|
13036
|
+
return this.buildURL(type.modelName, id, snapshot, requestType, query);
|
13037
|
+
},
|
12855
13038
|
|
12856
|
-
|
12857
|
-
|
12858
|
-
|
12859
|
-
|
12860
|
-
|
12861
|
-
|
12862
|
-
|
12863
|
-
|
12864
|
-
|
12865
|
-
|
13039
|
+
/**
|
13040
|
+
* Get the headers for a request.
|
13041
|
+
*
|
13042
|
+
* By default the value of the `headers` property of the adapter is
|
13043
|
+
* returned.
|
13044
|
+
*
|
13045
|
+
* @public
|
13046
|
+
* @method headersForRequest
|
13047
|
+
* @param {Object} params
|
13048
|
+
* @return {Object} headers
|
13049
|
+
*/
|
13050
|
+
headersForRequest: function (params) {
|
13051
|
+
return this.get('headers');
|
13052
|
+
},
|
12866
13053
|
|
12867
|
-
|
12868
|
-
|
12869
|
-
|
12870
|
-
|
13054
|
+
/**
|
13055
|
+
* Get an object which contains all properties for a request which should
|
13056
|
+
* be made.
|
13057
|
+
*
|
13058
|
+
* @private
|
13059
|
+
* @method _requestFor
|
13060
|
+
* @param {Object} params
|
13061
|
+
* @return {Object} request object
|
13062
|
+
*/
|
13063
|
+
_requestFor: function (params) {
|
13064
|
+
var method = this.methodForRequest(params);
|
13065
|
+
var url = this.urlForRequest(params);
|
13066
|
+
var headers = this.headersForRequest(params);
|
13067
|
+
var data = this.dataForRequest(params);
|
13068
|
+
|
13069
|
+
return { method: method, url: url, headers: headers, data: data };
|
13070
|
+
},
|
12871
13071
|
|
12872
|
-
|
12873
|
-
|
12874
|
-
|
12875
|
-
|
12876
|
-
|
12877
|
-
|
13072
|
+
/**
|
13073
|
+
* Convert a request object into a hash which can be passed to `jQuery.ajax`.
|
13074
|
+
*
|
13075
|
+
* @private
|
13076
|
+
* @method _requestToJQueryAjaxHash
|
13077
|
+
* @param {Object} request
|
13078
|
+
* @return {Object} jQuery ajax hash
|
13079
|
+
*/
|
13080
|
+
_requestToJQueryAjaxHash: function (request) {
|
13081
|
+
var hash = {};
|
13082
|
+
|
13083
|
+
hash.type = request.method;
|
13084
|
+
hash.url = request.url;
|
13085
|
+
hash.dataType = 'json';
|
13086
|
+
hash.context = this;
|
13087
|
+
|
13088
|
+
if (request.data) {
|
13089
|
+
if (request.type !== 'GET') {
|
13090
|
+
hash.contentType = 'application/json; charset=utf-8';
|
13091
|
+
hash.data = JSON.stringify(request.data);
|
13092
|
+
} else {
|
13093
|
+
hash.data = request.data;
|
13094
|
+
}
|
12878
13095
|
}
|
12879
|
-
}
|
12880
13096
|
|
12881
|
-
|
12882
|
-
|
12883
|
-
|
12884
|
-
|
12885
|
-
|
12886
|
-
|
12887
|
-
|
12888
|
-
|
13097
|
+
var headers = request.headers;
|
13098
|
+
if (headers !== undefined) {
|
13099
|
+
hash.beforeSend = function (xhr) {
|
13100
|
+
Object.keys(headers).forEach(function (key) {
|
13101
|
+
return xhr.setRequestHeader(key, headers[key]);
|
13102
|
+
});
|
13103
|
+
};
|
13104
|
+
}
|
12889
13105
|
|
12890
|
-
|
12891
|
-
|
13106
|
+
return hash;
|
13107
|
+
},
|
12892
13108
|
|
12893
|
-
|
12894
|
-
|
12895
|
-
|
12896
|
-
|
12897
|
-
|
12898
|
-
|
12899
|
-
|
12900
|
-
|
12901
|
-
|
12902
|
-
|
12903
|
-
|
13109
|
+
/**
|
13110
|
+
* Make a request using `jQuery.ajax`.
|
13111
|
+
*
|
13112
|
+
* @private
|
13113
|
+
* @method _makeRequest
|
13114
|
+
* @param {Object} request
|
13115
|
+
* @return {Promise} promise
|
13116
|
+
*/
|
13117
|
+
_makeRequest: function (request) {
|
13118
|
+
var adapter = this;
|
13119
|
+
var hash = this._requestToJQueryAjaxHash(request);
|
12904
13120
|
|
12905
|
-
|
12906
|
-
|
13121
|
+
var method = request.method;
|
13122
|
+
var url = request.url;
|
12907
13123
|
|
12908
|
-
|
13124
|
+
var requestData = { method: method, url: url };
|
12909
13125
|
|
12910
|
-
|
13126
|
+
return new _ember.default.RSVP.Promise(function (resolve, reject) {
|
12911
13127
|
|
12912
|
-
|
12913
|
-
|
13128
|
+
hash.success = function (payload, textStatus, jqXHR) {
|
13129
|
+
var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
|
12914
13130
|
|
12915
|
-
|
12916
|
-
|
12917
|
-
|
12918
|
-
|
12919
|
-
|
12920
|
-
|
13131
|
+
if (response instanceof _emberDataAdaptersErrors.AdapterError) {
|
13132
|
+
_ember.default.run.join(null, reject, response);
|
13133
|
+
} else {
|
13134
|
+
_ember.default.run.join(null, resolve, response);
|
13135
|
+
}
|
13136
|
+
};
|
12921
13137
|
|
12922
|
-
|
12923
|
-
|
12924
|
-
|
12925
|
-
|
12926
|
-
|
12927
|
-
|
13138
|
+
hash.error = function (jqXHR, textStatus, errorThrown) {
|
13139
|
+
(0, _emberDataPrivateDebug.runInDebug)(function () {
|
13140
|
+
var message = 'The server returned an empty string for ' + method + ' ' + url + ', which cannot be parsed into a valid JSON. Return either null or {}.';
|
13141
|
+
var validJSONString = !(textStatus === "parsererror" && jqXHR.responseText === "");
|
13142
|
+
(0, _emberDataPrivateDebug.warn)(message, validJSONString, {
|
13143
|
+
id: 'ds.adapter.returned-empty-string-as-JSON'
|
13144
|
+
});
|
12928
13145
|
});
|
12929
|
-
});
|
12930
13146
|
|
12931
|
-
|
13147
|
+
var error = undefined;
|
12932
13148
|
|
12933
|
-
|
12934
|
-
|
12935
|
-
|
12936
|
-
|
12937
|
-
|
12938
|
-
|
12939
|
-
|
12940
|
-
|
12941
|
-
|
13149
|
+
if (errorThrown instanceof Error) {
|
13150
|
+
error = errorThrown;
|
13151
|
+
} else if (textStatus === 'timeout') {
|
13152
|
+
error = new _emberDataAdaptersErrors.TimeoutError();
|
13153
|
+
} else if (textStatus === 'abort') {
|
13154
|
+
error = new _emberDataAdaptersErrors.AbortError();
|
13155
|
+
} else {
|
13156
|
+
error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown, requestData);
|
13157
|
+
}
|
12942
13158
|
|
12943
|
-
|
12944
|
-
|
13159
|
+
_ember.default.run.join(null, reject, error);
|
13160
|
+
};
|
12945
13161
|
|
12946
|
-
|
12947
|
-
|
12948
|
-
|
12949
|
-
|
13162
|
+
adapter._ajaxRequest(hash);
|
13163
|
+
}, 'DS: RESTAdapter#makeRequest: ' + method + ' ' + url);
|
13164
|
+
}
|
13165
|
+
});
|
13166
|
+
}
|
12950
13167
|
|
12951
13168
|
//From http://stackoverflow.com/questions/280634/endswith-in-javascript
|
12952
13169
|
function endsWith(string, suffix) {
|
@@ -13160,6 +13377,14 @@ define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-da
|
|
13160
13377
|
_emberDataPrivateCore.default.TimeoutError = _emberDataAdaptersErrors.TimeoutError;
|
13161
13378
|
_emberDataPrivateCore.default.AbortError = _emberDataAdaptersErrors.AbortError;
|
13162
13379
|
|
13380
|
+
if (false) {
|
13381
|
+
_emberDataPrivateCore.default.UnauthorizedError = _emberDataAdaptersErrors.UnauthorizedError;
|
13382
|
+
_emberDataPrivateCore.default.ForbiddenError = _emberDataAdaptersErrors.ForbiddenError;
|
13383
|
+
_emberDataPrivateCore.default.NotFoundError = _emberDataAdaptersErrors.NotFoundError;
|
13384
|
+
_emberDataPrivateCore.default.ConflictError = _emberDataAdaptersErrors.ConflictError;
|
13385
|
+
_emberDataPrivateCore.default.ServerError = _emberDataAdaptersErrors.ServerError;
|
13386
|
+
}
|
13387
|
+
|
13163
13388
|
_emberDataPrivateCore.default.errorsHashToArray = _emberDataAdaptersErrors.errorsHashToArray;
|
13164
13389
|
_emberDataPrivateCore.default.errorsArrayToHash = _emberDataAdaptersErrors.errorsArrayToHash;
|
13165
13390
|
|
@@ -13657,8 +13882,10 @@ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'em
|
|
13657
13882
|
} else if (this.hasSerializeRecordsOption(attr)) {
|
13658
13883
|
this._serializeEmbeddedHasMany(snapshot, json, relationship);
|
13659
13884
|
} else {
|
13660
|
-
if (
|
13661
|
-
this.
|
13885
|
+
if (true) {
|
13886
|
+
if (this.hasSerializeIdsAndTypesOption(attr)) {
|
13887
|
+
this._serializeHasManyAsIdsAndTypes(snapshot, json, relationship);
|
13888
|
+
}
|
13662
13889
|
}
|
13663
13890
|
}
|
13664
13891
|
},
|
@@ -14022,8 +14249,24 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14022
14249
|
@private
|
14023
14250
|
*/
|
14024
14251
|
_normalizeRelationshipDataHelper: function (relationshipDataHash) {
|
14025
|
-
|
14026
|
-
|
14252
|
+
if (false) {
|
14253
|
+
var modelName = this.modelNameFromPayloadType(relationshipDataHash.type);
|
14254
|
+
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipDataHash.type);
|
14255
|
+
|
14256
|
+
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
14257
|
+
(0, _emberDataPrivateDebug.deprecate)("You are using modelNameFromPayloadKey to normalize the type for a relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
14258
|
+
id: 'ds.json-api-serializer.deprecated-model-name-for-relationship',
|
14259
|
+
until: '3.0.0'
|
14260
|
+
});
|
14261
|
+
|
14262
|
+
modelName = deprecatedModelNameLookup;
|
14263
|
+
}
|
14264
|
+
|
14265
|
+
relationshipDataHash.type = modelName;
|
14266
|
+
} else {
|
14267
|
+
var type = this.modelNameFromPayloadKey(relationshipDataHash.type);
|
14268
|
+
relationshipDataHash.type = type;
|
14269
|
+
}
|
14027
14270
|
|
14028
14271
|
return relationshipDataHash;
|
14029
14272
|
},
|
@@ -14042,8 +14285,25 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14042
14285
|
var modelName = undefined,
|
14043
14286
|
usedLookup = undefined;
|
14044
14287
|
|
14045
|
-
|
14046
|
-
|
14288
|
+
if (false) {
|
14289
|
+
modelName = this.modelNameFromPayloadType(resourceHash.type);
|
14290
|
+
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
|
14291
|
+
|
14292
|
+
usedLookup = 'modelNameFromPayloadType';
|
14293
|
+
|
14294
|
+
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
14295
|
+
(0, _emberDataPrivateDebug.deprecate)("You are using modelNameFromPayloadKey to normalize the type for a resource. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
14296
|
+
id: 'ds.json-api-serializer.deprecated-model-name-for-resource',
|
14297
|
+
until: '3.0.0'
|
14298
|
+
});
|
14299
|
+
|
14300
|
+
modelName = deprecatedModelNameLookup;
|
14301
|
+
usedLookup = 'modelNameFromPayloadKey';
|
14302
|
+
}
|
14303
|
+
} else {
|
14304
|
+
modelName = this.modelNameFromPayloadKey(resourceHash.type);
|
14305
|
+
usedLookup = 'modelNameFromPayloadKey';
|
14306
|
+
}
|
14047
14307
|
|
14048
14308
|
if (!this.store._hasModelFor(modelName)) {
|
14049
14309
|
(0, _emberDataPrivateDebug.warn)(this.warnMessageNoModelForType(modelName, resourceHash.type, usedLookup), false, {
|
@@ -14069,8 +14329,11 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14069
14329
|
*/
|
14070
14330
|
pushPayload: function (store, payload) {
|
14071
14331
|
var normalizedPayload = this._normalizeDocumentHelper(payload);
|
14072
|
-
|
14073
|
-
|
14332
|
+
if (false) {
|
14333
|
+
return store.push(normalizedPayload);
|
14334
|
+
} else {
|
14335
|
+
store.push(normalizedPayload);
|
14336
|
+
}
|
14074
14337
|
},
|
14075
14338
|
|
14076
14339
|
/**
|
@@ -14180,7 +14443,23 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14180
14443
|
@private
|
14181
14444
|
*/
|
14182
14445
|
_extractType: function (modelClass, resourceHash) {
|
14183
|
-
|
14446
|
+
if (false) {
|
14447
|
+
var modelName = this.modelNameFromPayloadType(resourceHash.type);
|
14448
|
+
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
|
14449
|
+
|
14450
|
+
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
14451
|
+
(0, _emberDataPrivateDebug.deprecate)("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
14452
|
+
id: 'ds.json-api-serializer.deprecated-model-name-for-polymorphic-type',
|
14453
|
+
until: '3.0.0'
|
14454
|
+
});
|
14455
|
+
|
14456
|
+
modelName = deprecatedModelNameLookup;
|
14457
|
+
}
|
14458
|
+
|
14459
|
+
return modelName;
|
14460
|
+
} else {
|
14461
|
+
return this.modelNameFromPayloadKey(resourceHash.type);
|
14462
|
+
}
|
14184
14463
|
},
|
14185
14464
|
|
14186
14465
|
/**
|
@@ -14291,8 +14570,21 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14291
14570
|
var data = this._super.apply(this, arguments);
|
14292
14571
|
|
14293
14572
|
var payloadType = undefined;
|
14573
|
+
if (false) {
|
14574
|
+
payloadType = this.payloadTypeFromModelName(snapshot.modelName);
|
14575
|
+
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(snapshot.modelName);
|
14576
|
+
|
14577
|
+
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
14578
|
+
(0, _emberDataPrivateDebug.deprecate)("You used payloadKeyFromModelName to customize how a type is serialized. Use payloadTypeFromModelName instead.", false, {
|
14579
|
+
id: 'ds.json-api-serializer.deprecated-payload-type-for-model',
|
14580
|
+
until: '3.0.0'
|
14581
|
+
});
|
14294
14582
|
|
14295
|
-
|
14583
|
+
payloadType = deprecatedPayloadTypeLookup;
|
14584
|
+
}
|
14585
|
+
} else {
|
14586
|
+
payloadType = this.payloadKeyFromModelName(snapshot.modelName);
|
14587
|
+
}
|
14296
14588
|
|
14297
14589
|
data.type = payloadType;
|
14298
14590
|
return { data: data };
|
@@ -14314,7 +14606,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14314
14606
|
var value = snapshot.attr(key);
|
14315
14607
|
if (type) {
|
14316
14608
|
var transform = this.transformFor(type);
|
14317
|
-
value = transform.serialize(value);
|
14609
|
+
value = transform.serialize(value, attribute.options);
|
14318
14610
|
}
|
14319
14611
|
|
14320
14612
|
var payloadKey = this._getMappedKey(key, snapshot.type);
|
@@ -14351,7 +14643,21 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14351
14643
|
if (belongsTo) {
|
14352
14644
|
var payloadType = undefined;
|
14353
14645
|
|
14354
|
-
|
14646
|
+
if (false) {
|
14647
|
+
payloadType = this.payloadTypeFromModelName(belongsTo.modelName);
|
14648
|
+
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(belongsTo.modelName);
|
14649
|
+
|
14650
|
+
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
14651
|
+
(0, _emberDataPrivateDebug.deprecate)("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
14652
|
+
id: 'ds.json-api-serializer.deprecated-payload-type-for-belongs-to',
|
14653
|
+
until: '3.0.0'
|
14654
|
+
});
|
14655
|
+
|
14656
|
+
payloadType = deprecatedPayloadTypeLookup;
|
14657
|
+
}
|
14658
|
+
} else {
|
14659
|
+
payloadType = this.payloadKeyFromModelName(belongsTo.modelName);
|
14660
|
+
}
|
14355
14661
|
|
14356
14662
|
data = {
|
14357
14663
|
type: payloadType,
|
@@ -14373,6 +14679,9 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14373
14679
|
serializeHasMany: function (snapshot, json, relationship) {
|
14374
14680
|
var key = relationship.key;
|
14375
14681
|
var shouldSerializeHasMany = '_shouldSerializeHasMany';
|
14682
|
+
if (false) {
|
14683
|
+
shouldSerializeHasMany = 'shouldSerializeHasMany';
|
14684
|
+
}
|
14376
14685
|
|
14377
14686
|
if (this[shouldSerializeHasMany](snapshot, key, relationship)) {
|
14378
14687
|
var hasMany = snapshot.hasMany(key);
|
@@ -14392,7 +14701,21 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14392
14701
|
|
14393
14702
|
var payloadType = undefined;
|
14394
14703
|
|
14395
|
-
|
14704
|
+
if (false) {
|
14705
|
+
payloadType = this.payloadTypeFromModelName(item.modelName);
|
14706
|
+
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(item.modelName);
|
14707
|
+
|
14708
|
+
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
|
14709
|
+
(0, _emberDataPrivateDebug.deprecate)("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, {
|
14710
|
+
id: 'ds.json-api-serializer.deprecated-payload-type-for-has-many',
|
14711
|
+
until: '3.0.0'
|
14712
|
+
});
|
14713
|
+
|
14714
|
+
payloadType = deprecatedPayloadTypeLookup;
|
14715
|
+
}
|
14716
|
+
} else {
|
14717
|
+
payloadType = this.payloadKeyFromModelName(item.modelName);
|
14718
|
+
}
|
14396
14719
|
|
14397
14720
|
data[i] = {
|
14398
14721
|
type: payloadType,
|
@@ -14406,6 +14729,100 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14406
14729
|
}
|
14407
14730
|
});
|
14408
14731
|
|
14732
|
+
if (false) {
|
14733
|
+
|
14734
|
+
JSONAPISerializer.reopen({
|
14735
|
+
|
14736
|
+
/**
|
14737
|
+
`modelNameFromPayloadType` can be used to change the mapping for a DS model
|
14738
|
+
name, taken from the value in the payload.
|
14739
|
+
Say your API namespaces the type of a model and returns the following
|
14740
|
+
payload for the `post` model:
|
14741
|
+
```javascript
|
14742
|
+
// GET /api/posts/1
|
14743
|
+
{
|
14744
|
+
"data": {
|
14745
|
+
"id": 1,
|
14746
|
+
"type: "api::v1::post"
|
14747
|
+
}
|
14748
|
+
}
|
14749
|
+
```
|
14750
|
+
By overwriting `modelNameFromPayloadType` you can specify that the
|
14751
|
+
`posr` model should be used:
|
14752
|
+
```app/serializers/application.js
|
14753
|
+
import JSONAPISerializer from "ember-data/serializers/json-api";
|
14754
|
+
export default JSONAPISerializer.extend({
|
14755
|
+
modelNameFromPayloadType(payloadType) {
|
14756
|
+
return payloadType.replace('api::v1::', '');
|
14757
|
+
}
|
14758
|
+
});
|
14759
|
+
```
|
14760
|
+
By default the modelName for a model is its singularized name in dasherized
|
14761
|
+
form. Usually, Ember Data can use the correct inflection to do this for
|
14762
|
+
you. Most of the time, you won't need to override
|
14763
|
+
`modelNameFromPayloadType` for this purpose.
|
14764
|
+
Also take a look at
|
14765
|
+
[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize
|
14766
|
+
how the type of a record should be serialized.
|
14767
|
+
@method modelNameFromPayloadType
|
14768
|
+
@public
|
14769
|
+
@param {String} payloadType type from payload
|
14770
|
+
@return {String} modelName
|
14771
|
+
*/
|
14772
|
+
modelNameFromPayloadType: function (type) {
|
14773
|
+
return (0, _emberInflector.singularize)((0, _emberDataPrivateSystemNormalizeModelName.default)(type));
|
14774
|
+
},
|
14775
|
+
|
14776
|
+
/**
|
14777
|
+
`payloadTypeFromModelName` can be used to change the mapping for the type in
|
14778
|
+
the payload, taken from the model name.
|
14779
|
+
Say your API namespaces the type of a model and expects the following
|
14780
|
+
payload when you update the `post` model:
|
14781
|
+
```javascript
|
14782
|
+
// POST /api/posts/1
|
14783
|
+
{
|
14784
|
+
"data": {
|
14785
|
+
"id": 1,
|
14786
|
+
"type": "api::v1::post"
|
14787
|
+
}
|
14788
|
+
}
|
14789
|
+
```
|
14790
|
+
By overwriting `payloadTypeFromModelName` you can specify that the
|
14791
|
+
namespaces model name for the `post` should be used:
|
14792
|
+
```app/serializers/application.js
|
14793
|
+
import JSONAPISerializer from "ember-data/serializers/json-api";
|
14794
|
+
export default JSONAPISerializer.extend({
|
14795
|
+
payloadTypeFromModelName(modelName) {
|
14796
|
+
return "api::v1::" + modelName;
|
14797
|
+
}
|
14798
|
+
});
|
14799
|
+
```
|
14800
|
+
By default the payload type is the pluralized model name. Usually, Ember
|
14801
|
+
Data can use the correct inflection to do this for you. Most of the time,
|
14802
|
+
you won't need to override `payloadTypeFromModelName` for this purpose.
|
14803
|
+
Also take a look at
|
14804
|
+
[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize
|
14805
|
+
how the model name from should be mapped from the payload.
|
14806
|
+
@method payloadTypeFromModelName
|
14807
|
+
@public
|
14808
|
+
@param {String} modelname modelName from the record
|
14809
|
+
@return {String} payloadType
|
14810
|
+
*/
|
14811
|
+
payloadTypeFromModelName: function (modelName) {
|
14812
|
+
return (0, _emberInflector.pluralize)(modelName);
|
14813
|
+
},
|
14814
|
+
|
14815
|
+
_hasCustomModelNameFromPayloadKey: function () {
|
14816
|
+
return this.modelNameFromPayloadKey !== JSONAPISerializer.prototype.modelNameFromPayloadKey;
|
14817
|
+
},
|
14818
|
+
|
14819
|
+
_hasCustomPayloadKeyFromModelName: function () {
|
14820
|
+
return this.payloadKeyFromModelName !== JSONAPISerializer.prototype.payloadKeyFromModelName;
|
14821
|
+
}
|
14822
|
+
|
14823
|
+
});
|
14824
|
+
}
|
14825
|
+
|
14409
14826
|
(0, _emberDataPrivateDebug.runInDebug)(function () {
|
14410
14827
|
JSONAPISerializer.reopen({
|
14411
14828
|
willMergeMixin: function (props) {
|
@@ -14427,79 +14844,6 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
|
|
14427
14844
|
/**
|
14428
14845
|
@module ember-data
|
14429
14846
|
*/
|
14430
|
-
|
14431
|
-
/**
|
14432
|
-
`modelNameFromPayloadType` can be used to change the mapping for a DS model
|
14433
|
-
name, taken from the value in the payload.
|
14434
|
-
Say your API namespaces the type of a model and returns the following
|
14435
|
-
payload for the `post` model:
|
14436
|
-
```javascript
|
14437
|
-
// GET /api/posts/1
|
14438
|
-
{
|
14439
|
-
"data": {
|
14440
|
-
"id": 1,
|
14441
|
-
"type: "api::v1::post"
|
14442
|
-
}
|
14443
|
-
}
|
14444
|
-
```
|
14445
|
-
By overwriting `modelNameFromPayloadType` you can specify that the
|
14446
|
-
`posr` model should be used:
|
14447
|
-
```app/serializers/application.js
|
14448
|
-
import JSONAPISerializer from "ember-data/serializers/json-api";
|
14449
|
-
export default JSONAPISerializer.extend({
|
14450
|
-
modelNameFromPayloadType(payloadType) {
|
14451
|
-
return payloadType.replace('api::v1::', '');
|
14452
|
-
}
|
14453
|
-
});
|
14454
|
-
```
|
14455
|
-
By default the modelName for a model is its singularized name in dasherized
|
14456
|
-
form. Usually, Ember Data can use the correct inflection to do this for
|
14457
|
-
you. Most of the time, you won't need to override
|
14458
|
-
`modelNameFromPayloadType` for this purpose.
|
14459
|
-
Also take a look at
|
14460
|
-
[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize
|
14461
|
-
how the type of a record should be serialized.
|
14462
|
-
@method modelNameFromPayloadType
|
14463
|
-
@public
|
14464
|
-
@param {String} payloadType type from payload
|
14465
|
-
@return {String} modelName
|
14466
|
-
*/
|
14467
|
-
|
14468
|
-
/**
|
14469
|
-
`payloadTypeFromModelName` can be used to change the mapping for the type in
|
14470
|
-
the payload, taken from the model name.
|
14471
|
-
Say your API namespaces the type of a model and expects the following
|
14472
|
-
payload when you update the `post` model:
|
14473
|
-
```javascript
|
14474
|
-
// POST /api/posts/1
|
14475
|
-
{
|
14476
|
-
"data": {
|
14477
|
-
"id": 1,
|
14478
|
-
"type": "api::v1::post"
|
14479
|
-
}
|
14480
|
-
}
|
14481
|
-
```
|
14482
|
-
By overwriting `payloadTypeFromModelName` you can specify that the
|
14483
|
-
namespaces model name for the `post` should be used:
|
14484
|
-
```app/serializers/application.js
|
14485
|
-
import JSONAPISerializer from "ember-data/serializers/json-api";
|
14486
|
-
export default JSONAPISerializer.extend({
|
14487
|
-
payloadTypeFromModelName(modelName) {
|
14488
|
-
return "api::v1::" + modelName;
|
14489
|
-
}
|
14490
|
-
});
|
14491
|
-
```
|
14492
|
-
By default the payload type is the pluralized model name. Usually, Ember
|
14493
|
-
Data can use the correct inflection to do this for you. Most of the time,
|
14494
|
-
you won't need to override `payloadTypeFromModelName` for this purpose.
|
14495
|
-
Also take a look at
|
14496
|
-
[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize
|
14497
|
-
how the model name from should be mapped from the payload.
|
14498
|
-
@method payloadTypeFromModelName
|
14499
|
-
@public
|
14500
|
-
@param {String} modelname modelName from the record
|
14501
|
-
@return {String} payloadType
|
14502
|
-
*/
|
14503
14847
|
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/features', 'ember-data/adapters/errors'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializer, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateUtils, _emberDataPrivateFeatures, _emberDataAdaptersErrors) {
|
14504
14848
|
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); } }
|
14505
14849
|
|
@@ -15067,7 +15411,24 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/
|
|
15067
15411
|
|
15068
15412
|
var modelClass = this.store.modelFor(relationshipModelName);
|
15069
15413
|
if (relationshipHash.type && !(0, _emberDataPrivateUtils.modelHasAttributeOrRelationshipNamedType)(modelClass)) {
|
15070
|
-
|
15414
|
+
|
15415
|
+
if (false) {
|
15416
|
+
var modelName = this.modelNameFromPayloadType(relationshipHash.type);
|
15417
|
+
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipHash.type);
|
15418
|
+
|
15419
|
+
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
|
15420
|
+
(0, _emberDataPrivateDebug.deprecate)("You used modelNameFromPayloadKey to customize how a type is normalized. Use modelNameFromPayloadType instead", false, {
|
15421
|
+
id: 'ds.json-serializer.deprecated-type-for-polymorphic-relationship',
|
15422
|
+
until: '3.0.0'
|
15423
|
+
});
|
15424
|
+
|
15425
|
+
modelName = deprecatedModelNameLookup;
|
15426
|
+
}
|
15427
|
+
|
15428
|
+
relationshipHash.type = modelName;
|
15429
|
+
} else {
|
15430
|
+
relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);
|
15431
|
+
}
|
15071
15432
|
}
|
15072
15433
|
return relationshipHash;
|
15073
15434
|
}
|
@@ -15621,6 +15982,9 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/
|
|
15621
15982
|
serializeHasMany: function (snapshot, json, relationship) {
|
15622
15983
|
var key = relationship.key;
|
15623
15984
|
var shouldSerializeHasMany = '_shouldSerializeHasMany';
|
15985
|
+
if (false) {
|
15986
|
+
shouldSerializeHasMany = 'shouldSerializeHasMany';
|
15987
|
+
}
|
15624
15988
|
|
15625
15989
|
if (this[shouldSerializeHasMany](snapshot, key, relationship)) {
|
15626
15990
|
var hasMany = snapshot.hasMany(key, { ids: true });
|
@@ -15871,15 +16235,29 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/
|
|
15871
16235
|
}
|
15872
16236
|
});
|
15873
16237
|
|
16238
|
+
if (false) {
|
16239
|
+
|
16240
|
+
JSONSerializer.reopen({
|
16241
|
+
|
16242
|
+
/**
|
16243
|
+
@method modelNameFromPayloadType
|
16244
|
+
@public
|
16245
|
+
@param {String} type
|
16246
|
+
@return {String} the model's modelName
|
16247
|
+
*/
|
16248
|
+
modelNameFromPayloadType: function (type) {
|
16249
|
+
return (0, _emberDataPrivateSystemNormalizeModelName.default)(type);
|
16250
|
+
},
|
16251
|
+
|
16252
|
+
_hasCustomModelNameFromPayloadKey: function () {
|
16253
|
+
return this.modelNameFromPayloadKey !== JSONSerializer.prototype.modelNameFromPayloadKey;
|
16254
|
+
}
|
16255
|
+
|
16256
|
+
});
|
16257
|
+
}
|
16258
|
+
|
15874
16259
|
exports.default = JSONSerializer;
|
15875
16260
|
});
|
15876
|
-
|
15877
|
-
/**
|
15878
|
-
@method modelNameFromPayloadType
|
15879
|
-
@public
|
15880
|
-
@param {String} type
|
15881
|
-
@return {String} the model's modelName
|
15882
|
-
*/
|
15883
16261
|
define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/debug", "ember-data/serializers/json", "ember-data/-private/system/normalize-model-name", "ember-inflector", "ember-data/-private/system/coerce-id", "ember-data/-private/utils", "ember-data/-private/features"], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializersJson, _emberDataPrivateSystemNormalizeModelName, _emberInflector, _emberDataPrivateSystemCoerceId, _emberDataPrivateUtils, _emberDataPrivateFeatures) {
|
15884
16262
|
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); } }
|
15885
16263
|
|
@@ -16068,8 +16446,21 @@ define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/
|
|
16068
16446
|
if (!primaryHasTypeAttribute && hash.type) {
|
16069
16447
|
// Support polymorphic records in async relationships
|
16070
16448
|
var modelName = undefined;
|
16449
|
+
if (false) {
|
16450
|
+
modelName = this.modelNameFromPayloadType(hash.type);
|
16451
|
+
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(hash.type);
|
16452
|
+
|
16453
|
+
if (modelName !== deprecatedModelNameLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
16454
|
+
(0, _emberDataPrivateDebug.deprecate)("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This is has been deprecated in favor of modelNameFromPayloadType", false, {
|
16455
|
+
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
16456
|
+
until: '3.0.0'
|
16457
|
+
});
|
16071
16458
|
|
16072
|
-
|
16459
|
+
modelName = deprecatedModelNameLookup;
|
16460
|
+
}
|
16461
|
+
} else {
|
16462
|
+
modelName = this.modelNameFromPayloadKey(hash.type);
|
16463
|
+
}
|
16073
16464
|
|
16074
16465
|
if (store._hasModelFor(modelName)) {
|
16075
16466
|
serializer = store.serializerFor(modelName);
|
@@ -16292,7 +16683,11 @@ define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/
|
|
16292
16683
|
});
|
16293
16684
|
}
|
16294
16685
|
|
16295
|
-
|
16686
|
+
if (false) {
|
16687
|
+
return store.push(documentHash);
|
16688
|
+
} else {
|
16689
|
+
store.push(documentHash);
|
16690
|
+
}
|
16296
16691
|
},
|
16297
16692
|
|
16298
16693
|
/**
|
@@ -16567,7 +16962,11 @@ define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/
|
|
16567
16962
|
if (_ember.default.isNone(belongsTo)) {
|
16568
16963
|
json[typeKey] = null;
|
16569
16964
|
} else {
|
16570
|
-
|
16965
|
+
if (false) {
|
16966
|
+
json[typeKey] = this.payloadTypeFromModelName(belongsTo.modelName);
|
16967
|
+
} else {
|
16968
|
+
json[typeKey] = camelize(belongsTo.modelName);
|
16969
|
+
}
|
16571
16970
|
}
|
16572
16971
|
},
|
16573
16972
|
|
@@ -16607,17 +17006,144 @@ define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/
|
|
16607
17006
|
|
16608
17007
|
if (isPolymorphic && resourceHash[typeProperty] !== undefined && typeof relationshipHash !== 'object') {
|
16609
17008
|
|
16610
|
-
|
16611
|
-
|
16612
|
-
|
16613
|
-
type
|
16614
|
-
|
17009
|
+
if (false) {
|
17010
|
+
|
17011
|
+
var payloadType = resourceHash[typeProperty];
|
17012
|
+
var type = this.modelNameFromPayloadType(payloadType);
|
17013
|
+
var deprecatedTypeLookup = this.modelNameFromPayloadKey(payloadType);
|
17014
|
+
|
17015
|
+
if (payloadType !== deprecatedTypeLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
|
17016
|
+
(0, _emberDataPrivateDebug.deprecate)("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, {
|
17017
|
+
id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type',
|
17018
|
+
until: '3.0.0'
|
17019
|
+
});
|
17020
|
+
|
17021
|
+
type = deprecatedTypeLookup;
|
17022
|
+
}
|
17023
|
+
|
17024
|
+
return {
|
17025
|
+
id: relationshipHash,
|
17026
|
+
type: type
|
17027
|
+
};
|
17028
|
+
} else {
|
17029
|
+
|
17030
|
+
var type = this.modelNameFromPayloadKey(resourceHash[typeProperty]);
|
17031
|
+
return {
|
17032
|
+
id: relationshipHash,
|
17033
|
+
type: type
|
17034
|
+
};
|
17035
|
+
}
|
16615
17036
|
}
|
16616
17037
|
|
16617
17038
|
return this._super.apply(this, arguments);
|
16618
17039
|
}
|
16619
17040
|
});
|
16620
17041
|
|
17042
|
+
if (false) {
|
17043
|
+
|
17044
|
+
RESTSerializer.reopen({
|
17045
|
+
|
17046
|
+
/**
|
17047
|
+
`modelNameFromPayloadType` can be used to change the mapping for a DS model
|
17048
|
+
name, taken from the value in the payload.
|
17049
|
+
Say your API namespaces the type of a model and returns the following
|
17050
|
+
payload for the `post` model, which has a polymorphic `user` relationship:
|
17051
|
+
```javascript
|
17052
|
+
// GET /api/posts/1
|
17053
|
+
{
|
17054
|
+
"post": {
|
17055
|
+
"id": 1,
|
17056
|
+
"user": 1,
|
17057
|
+
"userType: "api::v1::administrator"
|
17058
|
+
}
|
17059
|
+
}
|
17060
|
+
```
|
17061
|
+
By overwriting `modelNameFromPayloadType` you can specify that the
|
17062
|
+
`administrator` model should be used:
|
17063
|
+
```app/serializers/application.js
|
17064
|
+
import RESTSerializer from "ember-data/serializers/rest";
|
17065
|
+
export default RESTSerializer.extend({
|
17066
|
+
modelNameFromPayloadType(payloadType) {
|
17067
|
+
return payloadType.replace('api::v1::', '');
|
17068
|
+
}
|
17069
|
+
});
|
17070
|
+
```
|
17071
|
+
By default the modelName for a model is its name in dasherized form.
|
17072
|
+
Usually, Ember Data can use the correct inflection to do this for you. Most
|
17073
|
+
of the time, you won't need to override `modelNameFromPayloadType` for this
|
17074
|
+
purpose.
|
17075
|
+
Also take a look at
|
17076
|
+
[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize
|
17077
|
+
how the type of a record should be serialized.
|
17078
|
+
@method modelNameFromPayloadType
|
17079
|
+
@public
|
17080
|
+
@param {String} payloadType type from payload
|
17081
|
+
@return {String} modelName
|
17082
|
+
*/
|
17083
|
+
modelNameFromPayloadType: function (payloadType) {
|
17084
|
+
return (0, _emberInflector.singularize)((0, _emberDataPrivateSystemNormalizeModelName.default)(payloadType));
|
17085
|
+
},
|
17086
|
+
|
17087
|
+
/**
|
17088
|
+
`payloadTypeFromModelName` can be used to change the mapping for the type in
|
17089
|
+
the payload, taken from the model name.
|
17090
|
+
Say your API namespaces the type of a model and expects the following
|
17091
|
+
payload when you update the `post` model, which has a polymorphic `user`
|
17092
|
+
relationship:
|
17093
|
+
```javascript
|
17094
|
+
// POST /api/posts/1
|
17095
|
+
{
|
17096
|
+
"post": {
|
17097
|
+
"id": 1,
|
17098
|
+
"user": 1,
|
17099
|
+
"userType": "api::v1::administrator"
|
17100
|
+
}
|
17101
|
+
}
|
17102
|
+
```
|
17103
|
+
By overwriting `payloadTypeFromModelName` you can specify that the
|
17104
|
+
namespaces model name for the `administrator` should be used:
|
17105
|
+
```app/serializers/application.js
|
17106
|
+
import RESTSerializer from "ember-data/serializers/rest";
|
17107
|
+
export default RESTSerializer.extend({
|
17108
|
+
payloadTypeFromModelName(modelName) {
|
17109
|
+
return "api::v1::" + modelName;
|
17110
|
+
}
|
17111
|
+
});
|
17112
|
+
```
|
17113
|
+
By default the payload type is the camelized model name. Usually, Ember
|
17114
|
+
Data can use the correct inflection to do this for you. Most of the time,
|
17115
|
+
you won't need to override `payloadTypeFromModelName` for this purpose.
|
17116
|
+
Also take a look at
|
17117
|
+
[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize
|
17118
|
+
how the model name from should be mapped from the payload.
|
17119
|
+
@method payloadTypeFromModelName
|
17120
|
+
@public
|
17121
|
+
@param {String} modelname modelName from the record
|
17122
|
+
@return {String} payloadType
|
17123
|
+
*/
|
17124
|
+
payloadTypeFromModelName: function (modelName) {
|
17125
|
+
return camelize(modelName);
|
17126
|
+
},
|
17127
|
+
|
17128
|
+
_hasCustomModelNameFromPayloadKey: function () {
|
17129
|
+
return this.modelNameFromPayloadKey !== RESTSerializer.prototype.modelNameFromPayloadKey;
|
17130
|
+
},
|
17131
|
+
|
17132
|
+
_hasCustomModelNameFromPayloadType: function () {
|
17133
|
+
return this.modelNameFromPayloadType !== RESTSerializer.prototype.modelNameFromPayloadType;
|
17134
|
+
},
|
17135
|
+
|
17136
|
+
_hasCustomPayloadTypeFromModelName: function () {
|
17137
|
+
return this.payloadTypeFromModelName !== RESTSerializer.prototype.payloadTypeFromModelName;
|
17138
|
+
},
|
17139
|
+
|
17140
|
+
_hasCustomPayloadKeyFromModelName: function () {
|
17141
|
+
return this.payloadKeyFromModelName !== RESTSerializer.prototype.payloadKeyFromModelName;
|
17142
|
+
}
|
17143
|
+
|
17144
|
+
});
|
17145
|
+
}
|
17146
|
+
|
16621
17147
|
(0, _emberDataPrivateDebug.runInDebug)(function () {
|
16622
17148
|
RESTSerializer.reopen({
|
16623
17149
|
warnMessageNoModelForKey: function (prop, typeKey) {
|
@@ -16631,82 +17157,6 @@ define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/
|
|
16631
17157
|
/**
|
16632
17158
|
@module ember-data
|
16633
17159
|
*/
|
16634
|
-
|
16635
|
-
/**
|
16636
|
-
`modelNameFromPayloadType` can be used to change the mapping for a DS model
|
16637
|
-
name, taken from the value in the payload.
|
16638
|
-
Say your API namespaces the type of a model and returns the following
|
16639
|
-
payload for the `post` model, which has a polymorphic `user` relationship:
|
16640
|
-
```javascript
|
16641
|
-
// GET /api/posts/1
|
16642
|
-
{
|
16643
|
-
"post": {
|
16644
|
-
"id": 1,
|
16645
|
-
"user": 1,
|
16646
|
-
"userType: "api::v1::administrator"
|
16647
|
-
}
|
16648
|
-
}
|
16649
|
-
```
|
16650
|
-
By overwriting `modelNameFromPayloadType` you can specify that the
|
16651
|
-
`administrator` model should be used:
|
16652
|
-
```app/serializers/application.js
|
16653
|
-
import RESTSerializer from "ember-data/serializers/rest";
|
16654
|
-
export default RESTSerializer.extend({
|
16655
|
-
modelNameFromPayloadType(payloadType) {
|
16656
|
-
return payloadType.replace('api::v1::', '');
|
16657
|
-
}
|
16658
|
-
});
|
16659
|
-
```
|
16660
|
-
By default the modelName for a model is its name in dasherized form.
|
16661
|
-
Usually, Ember Data can use the correct inflection to do this for you. Most
|
16662
|
-
of the time, you won't need to override `modelNameFromPayloadType` for this
|
16663
|
-
purpose.
|
16664
|
-
Also take a look at
|
16665
|
-
[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize
|
16666
|
-
how the type of a record should be serialized.
|
16667
|
-
@method modelNameFromPayloadType
|
16668
|
-
@public
|
16669
|
-
@param {String} payloadType type from payload
|
16670
|
-
@return {String} modelName
|
16671
|
-
*/
|
16672
|
-
|
16673
|
-
/**
|
16674
|
-
`payloadTypeFromModelName` can be used to change the mapping for the type in
|
16675
|
-
the payload, taken from the model name.
|
16676
|
-
Say your API namespaces the type of a model and expects the following
|
16677
|
-
payload when you update the `post` model, which has a polymorphic `user`
|
16678
|
-
relationship:
|
16679
|
-
```javascript
|
16680
|
-
// POST /api/posts/1
|
16681
|
-
{
|
16682
|
-
"post": {
|
16683
|
-
"id": 1,
|
16684
|
-
"user": 1,
|
16685
|
-
"userType": "api::v1::administrator"
|
16686
|
-
}
|
16687
|
-
}
|
16688
|
-
```
|
16689
|
-
By overwriting `payloadTypeFromModelName` you can specify that the
|
16690
|
-
namespaces model name for the `administrator` should be used:
|
16691
|
-
```app/serializers/application.js
|
16692
|
-
import RESTSerializer from "ember-data/serializers/rest";
|
16693
|
-
export default RESTSerializer.extend({
|
16694
|
-
payloadTypeFromModelName(modelName) {
|
16695
|
-
return "api::v1::" + modelName;
|
16696
|
-
}
|
16697
|
-
});
|
16698
|
-
```
|
16699
|
-
By default the payload type is the camelized model name. Usually, Ember
|
16700
|
-
Data can use the correct inflection to do this for you. Most of the time,
|
16701
|
-
you won't need to override `payloadTypeFromModelName` for this purpose.
|
16702
|
-
Also take a look at
|
16703
|
-
[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize
|
16704
|
-
how the model name from should be mapped from the payload.
|
16705
|
-
@method payloadTypeFromModelName
|
16706
|
-
@public
|
16707
|
-
@param {String} modelname modelName from the record
|
16708
|
-
@return {String} payloadType
|
16709
|
-
*/
|
16710
17160
|
define('ember-data/setup-container', ['exports', 'ember-data/-private/initializers/store', 'ember-data/-private/initializers/transforms', 'ember-data/-private/initializers/store-injections', 'ember-data/-private/initializers/data-adapter'], function (exports, _emberDataPrivateInitializersStore, _emberDataPrivateInitializersTransforms, _emberDataPrivateInitializersStoreInjections, _emberDataPrivateInitializersDataAdapter) {
|
16711
17161
|
exports.default = setupContainer;
|
16712
17162
|
|
@@ -16794,7 +17244,7 @@ define('ember-data/transform', ['exports', 'ember'], function (exports, _ember)
|
|
16794
17244
|
});
|
16795
17245
|
});
|
16796
17246
|
define("ember-data/version", ["exports"], function (exports) {
|
16797
|
-
exports.default = "2.7.0-beta.
|
17247
|
+
exports.default = "2.7.0-beta.2";
|
16798
17248
|
});
|
16799
17249
|
define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) {
|
16800
17250
|
|