@ember-data/serializer 5.5.0-alpha.4 → 5.5.0-beta.0
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.
- package/LICENSE.md +19 -7
- package/README.md +16 -10
- package/addon-main.cjs +5 -0
- package/blueprints/serializer/index.js +71 -5
- package/blueprints/serializer-test/index.js +13 -7
- package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +8 -9
- package/blueprints/transform/index.js +14 -4
- package/blueprints/transform-test/index.js +13 -7
- package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +3 -4
- package/dist/index.js +306 -0
- package/dist/index.js.map +1 -0
- package/{addon/json.js → dist/json-CVTR4xWv.js} +86 -66
- package/dist/json-CVTR4xWv.js.map +1 -0
- package/{addon → dist}/json-api.js +90 -188
- package/dist/json-api.js.map +1 -0
- package/dist/json.js +6 -0
- package/dist/json.js.map +1 -0
- package/dist/rest.js +1274 -0
- package/dist/rest.js.map +1 -0
- package/{addon/string-22572f80.js → dist/transform.js} +143 -20
- package/dist/transform.js.map +1 -0
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +60 -45
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts +102 -0
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/boolean.d.ts +52 -0
- package/unstable-preview-types/-private/transforms/boolean.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/date.d.ts +33 -0
- package/unstable-preview-types/-private/transforms/date.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/number.d.ts +34 -0
- package/unstable-preview-types/-private/transforms/number.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/string.d.ts +34 -0
- package/unstable-preview-types/-private/transforms/string.d.ts.map +1 -0
- package/unstable-preview-types/-private/transforms/transform.d.ts +126 -0
- package/unstable-preview-types/-private/transforms/transform.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils.d.ts +6 -0
- package/unstable-preview-types/-private/utils.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +277 -0
- package/unstable-preview-types/index.d.ts.map +1 -0
- package/unstable-preview-types/json-api.d.ts +514 -0
- package/unstable-preview-types/json-api.d.ts.map +1 -0
- package/unstable-preview-types/json.d.ts +1093 -0
- package/unstable-preview-types/json.d.ts.map +1 -0
- package/unstable-preview-types/rest.d.ts +570 -0
- package/unstable-preview-types/rest.d.ts.map +1 -0
- package/unstable-preview-types/transform.d.ts +11 -0
- package/unstable-preview-types/transform.d.ts.map +1 -0
- package/addon/-private.js +0 -4
- package/addon/-private.js.map +0 -1
- package/addon/embedded-records-mixin-d75385ff.js +0 -575
- package/addon/embedded-records-mixin-d75385ff.js.map +0 -1
- package/addon/index.js +0 -180
- package/addon/index.js.map +0 -1
- package/addon/json-api.js.map +0 -1
- package/addon/json.js.map +0 -1
- package/addon/rest.js +0 -680
- package/addon/rest.js.map +0 -1
- package/addon/string-22572f80.js.map +0 -1
- package/addon/transform.js +0 -2
- package/addon/transform.js.map +0 -1
- package/addon/utils-075c5b79.js +0 -12
- package/addon/utils-075c5b79.js.map +0 -1
- package/addon-main.js +0 -93
- /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
- /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
|
@@ -1,134 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import JSONSerializer from "./json";
|
|
1
|
+
import { warn } from '@ember/debug';
|
|
2
|
+
import { dasherize, pluralize, singularize } from '@ember-data/request-utils/string';
|
|
3
|
+
import { J as JSONSerializer } from "./json-CVTR4xWv.js";
|
|
4
|
+
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
11
|
-
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
12
|
-
<a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
|
|
13
|
-
</p>
|
|
14
|
-
</blockquote>
|
|
15
|
-
|
|
16
|
-
In EmberData a Serializer is used to serialize and deserialize
|
|
17
|
-
records when they are transferred in and out of an external source.
|
|
18
|
-
This process involves normalizing property names, transforming
|
|
19
|
-
attribute values and serializing relationships.
|
|
20
|
-
|
|
21
|
-
`JSONAPISerializer` supports the http://jsonapi.org/ spec and is the
|
|
22
|
-
serializer recommended by Ember Data.
|
|
23
|
-
|
|
24
|
-
This serializer normalizes a JSON API payload that looks like:
|
|
25
|
-
|
|
26
|
-
```app/models/player.js
|
|
27
|
-
import Model, { attr, belongsTo } from '@ember-data/model';
|
|
28
|
-
|
|
29
|
-
export default class Player extends Model {
|
|
30
|
-
@attr('string') name;
|
|
31
|
-
@attr('string') skill;
|
|
32
|
-
@attr('number') gamesPlayed;
|
|
33
|
-
@belongsTo('club') club;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
```app/models/club.js
|
|
38
|
-
import Model, { attr, hasMany } from '@ember-data/model';
|
|
39
|
-
|
|
40
|
-
export default class Club extends Model {
|
|
41
|
-
@attr('string') name;
|
|
42
|
-
@attr('string') location;
|
|
43
|
-
@hasMany('player') players;
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
{
|
|
49
|
-
"data": [
|
|
50
|
-
{
|
|
51
|
-
"attributes": {
|
|
52
|
-
"name": "Benfica",
|
|
53
|
-
"location": "Portugal"
|
|
54
|
-
},
|
|
55
|
-
"id": "1",
|
|
56
|
-
"relationships": {
|
|
57
|
-
"players": {
|
|
58
|
-
"data": [
|
|
59
|
-
{
|
|
60
|
-
"id": "3",
|
|
61
|
-
"type": "players"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"type": "clubs"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"included": [
|
|
70
|
-
{
|
|
71
|
-
"attributes": {
|
|
72
|
-
"name": "Eusebio Silva Ferreira",
|
|
73
|
-
"skill": "Rocket shot",
|
|
74
|
-
"games-played": 431
|
|
75
|
-
},
|
|
76
|
-
"id": "3",
|
|
77
|
-
"relationships": {
|
|
78
|
-
"club": {
|
|
79
|
-
"data": {
|
|
80
|
-
"id": "1",
|
|
81
|
-
"type": "clubs"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"type": "players"
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
to the format that the Ember Data store expects.
|
|
92
|
-
|
|
93
|
-
### Customizing meta
|
|
94
|
-
|
|
95
|
-
Since a JSON API Document can have meta defined in multiple locations you can
|
|
96
|
-
use the specific serializer hooks if you need to customize the meta.
|
|
97
|
-
|
|
98
|
-
One scenario would be to camelCase the meta keys of your payload. The example
|
|
99
|
-
below shows how this could be done using `normalizeArrayResponse` and
|
|
100
|
-
`extractRelationship`.
|
|
101
|
-
|
|
102
|
-
```app/serializers/application.js
|
|
103
|
-
import JSONAPISerializer from '@ember-data/serializer/json-api';
|
|
104
|
-
|
|
105
|
-
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
106
|
-
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
|
|
107
|
-
let normalizedDocument = super.normalizeArrayResponse(...arguments);
|
|
108
|
-
|
|
109
|
-
// Customize document meta
|
|
110
|
-
normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);
|
|
111
|
-
|
|
112
|
-
return normalizedDocument;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
extractRelationship(relationshipHash) {
|
|
116
|
-
let normalizedRelationship = super.extractRelationship(...arguments);
|
|
117
|
-
|
|
118
|
-
// Customize relationship meta
|
|
119
|
-
normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);
|
|
120
|
-
|
|
121
|
-
return normalizedRelationship;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
@main @ember-data/serializer/json-api
|
|
127
|
-
@since 1.13.0
|
|
128
|
-
@class JSONAPISerializer
|
|
129
|
-
@public
|
|
130
|
-
@extends JSONSerializer
|
|
131
|
-
*/
|
|
7
|
+
* @module @ember-data/serializer/json-api
|
|
8
|
+
*/
|
|
132
9
|
const JSONAPISerializer = JSONSerializer.extend({
|
|
133
10
|
/**
|
|
134
11
|
@method _normalizeDocumentHelper
|
|
@@ -138,9 +15,9 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
138
15
|
*/
|
|
139
16
|
_normalizeDocumentHelper(documentHash) {
|
|
140
17
|
if (Array.isArray(documentHash.data)) {
|
|
141
|
-
|
|
18
|
+
const ret = new Array(documentHash.data.length);
|
|
142
19
|
for (let i = 0; i < documentHash.data.length; i++) {
|
|
143
|
-
|
|
20
|
+
const data = documentHash.data[i];
|
|
144
21
|
ret[i] = this._normalizeResourceHelper(data);
|
|
145
22
|
}
|
|
146
23
|
documentHash.data = ret;
|
|
@@ -148,10 +25,10 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
148
25
|
documentHash.data = this._normalizeResourceHelper(documentHash.data);
|
|
149
26
|
}
|
|
150
27
|
if (Array.isArray(documentHash.included)) {
|
|
151
|
-
|
|
28
|
+
const ret = new Array();
|
|
152
29
|
for (let i = 0; i < documentHash.included.length; i++) {
|
|
153
|
-
|
|
154
|
-
|
|
30
|
+
const included = documentHash.included[i];
|
|
31
|
+
const normalized = this._normalizeResourceHelper(included);
|
|
155
32
|
if (normalized !== null) {
|
|
156
33
|
// can be null when unknown type is encountered
|
|
157
34
|
ret.push(normalized);
|
|
@@ -178,19 +55,25 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
178
55
|
@private
|
|
179
56
|
*/
|
|
180
57
|
_normalizeResourceHelper(resourceHash) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
58
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
59
|
+
if (!test) {
|
|
60
|
+
throw new Error(this.warnMessageForUndefinedType());
|
|
61
|
+
}
|
|
62
|
+
})(resourceHash.type) : {};
|
|
63
|
+
const type = this.modelNameFromPayloadKey(resourceHash.type);
|
|
64
|
+
if (!this.store.schema.hasResource({
|
|
65
|
+
type
|
|
66
|
+
})) {
|
|
67
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
68
|
+
warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {
|
|
69
|
+
id: 'ds.serializer.model-for-type-missing'
|
|
70
|
+
});
|
|
71
|
+
}
|
|
189
72
|
return null;
|
|
190
73
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
74
|
+
const modelClass = this.store.modelFor(type);
|
|
75
|
+
const serializer = this.store.serializerFor(type);
|
|
76
|
+
const {
|
|
194
77
|
data
|
|
195
78
|
} = serializer.normalize(modelClass, resourceHash);
|
|
196
79
|
return data;
|
|
@@ -203,7 +86,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
203
86
|
@param {Object} payload
|
|
204
87
|
*/
|
|
205
88
|
pushPayload(store, payload) {
|
|
206
|
-
|
|
89
|
+
const normalizedPayload = this._normalizeDocumentHelper(payload);
|
|
207
90
|
store.push(normalizedPayload);
|
|
208
91
|
},
|
|
209
92
|
/**
|
|
@@ -218,25 +101,33 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
218
101
|
@private
|
|
219
102
|
*/
|
|
220
103
|
_normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {
|
|
221
|
-
|
|
104
|
+
const normalizedPayload = this._normalizeDocumentHelper(payload);
|
|
222
105
|
return normalizedPayload;
|
|
223
106
|
},
|
|
224
107
|
normalizeQueryRecordResponse() {
|
|
225
|
-
|
|
226
|
-
|
|
108
|
+
const normalized = this._super(...arguments);
|
|
109
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
110
|
+
if (!test) {
|
|
111
|
+
throw new Error('Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.');
|
|
112
|
+
}
|
|
113
|
+
})(!Array.isArray(normalized.data)) : {};
|
|
227
114
|
return normalized;
|
|
228
115
|
},
|
|
229
116
|
extractAttributes(modelClass, resourceHash) {
|
|
230
|
-
|
|
117
|
+
const attributes = {};
|
|
231
118
|
if (resourceHash.attributes) {
|
|
232
119
|
modelClass.eachAttribute(key => {
|
|
233
|
-
|
|
120
|
+
const attributeKey = this.keyForAttribute(key, 'deserialize');
|
|
234
121
|
if (resourceHash.attributes[attributeKey] !== undefined) {
|
|
235
122
|
attributes[key] = resourceHash.attributes[attributeKey];
|
|
236
123
|
}
|
|
237
|
-
if (macroCondition(
|
|
124
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
238
125
|
if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {
|
|
239
|
-
|
|
126
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
127
|
+
{
|
|
128
|
+
throw new Error(`Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${attributeKey}'. This is most likely because Ember Data's JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement 'keyForAttribute(key) { return key; }' to prevent Ember Data from customizing your attribute keys.`);
|
|
129
|
+
}
|
|
130
|
+
})() : {};
|
|
240
131
|
}
|
|
241
132
|
}
|
|
242
133
|
});
|
|
@@ -253,9 +144,9 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
253
144
|
*/
|
|
254
145
|
extractRelationship(relationshipHash) {
|
|
255
146
|
if (Array.isArray(relationshipHash.data)) {
|
|
256
|
-
|
|
147
|
+
const ret = new Array(relationshipHash.data.length);
|
|
257
148
|
for (let i = 0; i < relationshipHash.data.length; i++) {
|
|
258
|
-
|
|
149
|
+
const data = relationshipHash.data[i];
|
|
259
150
|
ret[i] = this._normalizeRelationshipDataHelper(data);
|
|
260
151
|
}
|
|
261
152
|
relationshipHash.data = ret;
|
|
@@ -274,17 +165,21 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
274
165
|
@return {Object}
|
|
275
166
|
*/
|
|
276
167
|
extractRelationships(modelClass, resourceHash) {
|
|
277
|
-
|
|
168
|
+
const relationships = {};
|
|
278
169
|
if (resourceHash.relationships) {
|
|
279
170
|
modelClass.eachRelationship((key, relationshipMeta) => {
|
|
280
|
-
|
|
171
|
+
const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
|
|
281
172
|
if (resourceHash.relationships[relationshipKey] !== undefined) {
|
|
282
|
-
|
|
173
|
+
const relationshipHash = resourceHash.relationships[relationshipKey];
|
|
283
174
|
relationships[key] = this.extractRelationship(relationshipHash);
|
|
284
175
|
}
|
|
285
|
-
if (macroCondition(
|
|
176
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
286
177
|
if (resourceHash.relationships[relationshipKey] === undefined && resourceHash.relationships[key] !== undefined) {
|
|
287
|
-
|
|
178
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
179
|
+
{
|
|
180
|
+
throw new Error(`Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${relationshipKey}'. This is most likely because Ember Data's JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement 'keyForRelationship(key) { return key; }' to prevent Ember Data from customizing your relationship keys.`);
|
|
181
|
+
}
|
|
182
|
+
})() : {};
|
|
288
183
|
}
|
|
289
184
|
}
|
|
290
185
|
});
|
|
@@ -333,12 +228,15 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
333
228
|
if (resourceHash.relationships) {
|
|
334
229
|
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);
|
|
335
230
|
}
|
|
336
|
-
|
|
231
|
+
const data = {
|
|
337
232
|
id: this.extractId(modelClass, resourceHash),
|
|
338
233
|
type: this._extractType(modelClass, resourceHash),
|
|
339
234
|
attributes: this.extractAttributes(modelClass, resourceHash),
|
|
340
235
|
relationships: this.extractRelationships(modelClass, resourceHash)
|
|
341
236
|
};
|
|
237
|
+
if (resourceHash.lid) {
|
|
238
|
+
data.lid = resourceHash.lid;
|
|
239
|
+
}
|
|
342
240
|
this.applyTransforms(modelClass, data.attributes);
|
|
343
241
|
return {
|
|
344
242
|
data
|
|
@@ -529,22 +427,22 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
529
427
|
@return {Object} json
|
|
530
428
|
*/
|
|
531
429
|
serialize(snapshot, options) {
|
|
532
|
-
|
|
430
|
+
const data = this._super(...arguments);
|
|
533
431
|
data.type = this.payloadKeyFromModelName(snapshot.modelName);
|
|
534
432
|
return {
|
|
535
433
|
data
|
|
536
434
|
};
|
|
537
435
|
},
|
|
538
436
|
serializeAttribute(snapshot, json, key, attribute) {
|
|
539
|
-
|
|
437
|
+
const type = attribute.type;
|
|
540
438
|
if (this._canSerialize(key)) {
|
|
541
439
|
json.attributes = json.attributes || {};
|
|
542
440
|
let value = snapshot.attr(key);
|
|
543
441
|
if (type) {
|
|
544
|
-
|
|
442
|
+
const transform = this.transformFor(type);
|
|
545
443
|
value = transform.serialize(value, attribute.options);
|
|
546
444
|
}
|
|
547
|
-
|
|
445
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
548
446
|
let payloadKey = this._getMappedKey(key, schema);
|
|
549
447
|
if (payloadKey === key) {
|
|
550
448
|
payloadKey = this.keyForAttribute(key, 'serialize');
|
|
@@ -553,20 +451,20 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
553
451
|
}
|
|
554
452
|
},
|
|
555
453
|
serializeBelongsTo(snapshot, json, relationship) {
|
|
556
|
-
|
|
557
|
-
if (this._canSerialize(
|
|
558
|
-
|
|
559
|
-
|
|
454
|
+
const name = relationship.name;
|
|
455
|
+
if (this._canSerialize(name)) {
|
|
456
|
+
const belongsTo = snapshot.belongsTo(name);
|
|
457
|
+
const belongsToIsNotNew = belongsTo && !belongsTo.isNew;
|
|
560
458
|
if (belongsTo === null || belongsToIsNotNew) {
|
|
561
459
|
json.relationships = json.relationships || {};
|
|
562
|
-
|
|
563
|
-
let payloadKey = this._getMappedKey(
|
|
564
|
-
if (payloadKey ===
|
|
565
|
-
payloadKey = this.keyForRelationship(
|
|
460
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
461
|
+
let payloadKey = this._getMappedKey(name, schema);
|
|
462
|
+
if (payloadKey === name) {
|
|
463
|
+
payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');
|
|
566
464
|
}
|
|
567
465
|
let data = null;
|
|
568
466
|
if (belongsTo) {
|
|
569
|
-
|
|
467
|
+
const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);
|
|
570
468
|
data = {
|
|
571
469
|
type: payloadType,
|
|
572
470
|
id: belongsTo.id
|
|
@@ -579,23 +477,23 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
579
477
|
}
|
|
580
478
|
},
|
|
581
479
|
serializeHasMany(snapshot, json, relationship) {
|
|
582
|
-
|
|
583
|
-
if (this.shouldSerializeHasMany(snapshot,
|
|
584
|
-
|
|
480
|
+
const name = relationship.name;
|
|
481
|
+
if (this.shouldSerializeHasMany(snapshot, name, relationship)) {
|
|
482
|
+
const hasMany = snapshot.hasMany(name);
|
|
585
483
|
if (hasMany !== undefined) {
|
|
586
484
|
json.relationships = json.relationships || {};
|
|
587
|
-
|
|
588
|
-
let payloadKey = this._getMappedKey(
|
|
589
|
-
if (payloadKey ===
|
|
590
|
-
payloadKey = this.keyForRelationship(
|
|
485
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
486
|
+
let payloadKey = this._getMappedKey(name, schema);
|
|
487
|
+
if (payloadKey === name && this.keyForRelationship) {
|
|
488
|
+
payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');
|
|
591
489
|
}
|
|
592
490
|
|
|
593
491
|
// only serialize has many relationships that are not new
|
|
594
|
-
|
|
595
|
-
|
|
492
|
+
const nonNewHasMany = hasMany.filter(item => !item.isNew);
|
|
493
|
+
const data = new Array(nonNewHasMany.length);
|
|
596
494
|
for (let i = 0; i < nonNewHasMany.length; i++) {
|
|
597
|
-
|
|
598
|
-
|
|
495
|
+
const item = hasMany[i];
|
|
496
|
+
const payloadType = this.payloadKeyFromModelName(item.modelName);
|
|
599
497
|
data[i] = {
|
|
600
498
|
type: payloadType,
|
|
601
499
|
id: item.id
|
|
@@ -608,12 +506,16 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
608
506
|
}
|
|
609
507
|
}
|
|
610
508
|
});
|
|
611
|
-
if (macroCondition(
|
|
509
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
612
510
|
JSONAPISerializer.reopen({
|
|
613
511
|
init(...args) {
|
|
614
512
|
this._super(...args);
|
|
615
|
-
|
|
616
|
-
|
|
513
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
514
|
+
if (!test) {
|
|
515
|
+
throw new Error(`You've used the EmbeddedRecordsMixin in ${this.toString()} which is not fully compatible with the JSON:API specification. Please confirm that this works for your specific API and add \`this.isEmbeddedRecordsMixinCompatible = true\` to your serializer.`);
|
|
516
|
+
}
|
|
517
|
+
})(!this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true) : {};
|
|
518
|
+
const constructor = this.constructor;
|
|
617
519
|
warn(`You've defined 'extractMeta' in ${constructor.toString()} which is not used for serializers extending JSONAPISerializer. Read more at https://api.emberjs.com/ember-data/release/classes/JSONAPISerializer on how to customize meta when using JSON API.`, this.extractMeta === JSONSerializer.prototype.extractMeta, {
|
|
618
520
|
id: 'ds.serializer.json-api.extractMeta'
|
|
619
521
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-api.js","sources":["../src/json-api.js"],"sourcesContent":["/**\n * @module @ember-data/serializer/json-api\n */\nimport { warn } from '@ember/debug';\n\nimport { dasherize, pluralize, singularize } from '@ember-data/request-utils/string';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\n\nimport JSONSerializer from './json';\n\n/**\n * <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class Player extends Model {\n @attr('string') name;\n @attr('string') skill;\n @attr('number') gamesPlayed;\n @belongsTo('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {\n @attr('string') name;\n @attr('string') location;\n @hasMany('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```\n\n @main @ember-data/serializer/json-api\n @since 1.13.0\n @class JSONAPISerializer\n @public\n @extends JSONSerializer\n*/\nconst JSONAPISerializer = JSONSerializer.extend({\n /**\n @method _normalizeDocumentHelper\n @param {Object} documentHash\n @return {Object}\n @private\n */\n _normalizeDocumentHelper(documentHash) {\n if (Array.isArray(documentHash.data)) {\n const ret = new Array(documentHash.data.length);\n\n for (let i = 0; i < documentHash.data.length; i++) {\n const data = documentHash.data[i];\n ret[i] = this._normalizeResourceHelper(data);\n }\n\n documentHash.data = ret;\n } else if (documentHash.data && typeof documentHash.data === 'object') {\n documentHash.data = this._normalizeResourceHelper(documentHash.data);\n }\n\n if (Array.isArray(documentHash.included)) {\n const ret = new Array();\n for (let i = 0; i < documentHash.included.length; i++) {\n const included = documentHash.included[i];\n const normalized = this._normalizeResourceHelper(included);\n if (normalized !== null) {\n // can be null when unknown type is encountered\n ret.push(normalized);\n }\n }\n\n documentHash.included = ret;\n }\n\n return documentHash;\n },\n\n /**\n @method _normalizeRelationshipDataHelper\n @param {Object} relationshipDataHash\n @return {Object}\n @private\n */\n _normalizeRelationshipDataHelper(relationshipDataHash) {\n relationshipDataHash.type = this.modelNameFromPayloadKey(relationshipDataHash.type);\n\n return relationshipDataHash;\n },\n\n /**\n @method _normalizeResourceHelper\n @param {Object} resourceHash\n @return {Object}\n @private\n */\n _normalizeResourceHelper(resourceHash) {\n assert(this.warnMessageForUndefinedType(), resourceHash.type);\n\n const type = this.modelNameFromPayloadKey(resourceHash.type);\n\n if (!this.store.schema.hasResource({ type })) {\n if (DEBUG) {\n warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {\n id: 'ds.serializer.model-for-type-missing',\n });\n }\n return null;\n }\n\n const modelClass = this.store.modelFor(type);\n const serializer = this.store.serializerFor(type);\n const { data } = serializer.normalize(modelClass, resourceHash);\n return data;\n },\n\n /**\n Normalize some data and push it into the store.\n\n @method pushPayload\n @public\n @param {Store} store\n @param {Object} payload\n */\n pushPayload(store, payload) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n store.push(normalizedPayload);\n },\n\n /**\n @method _normalizeResponse\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @param {Boolean} isSingle\n @return {Object} JSON-API Document\n @private\n */\n _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n return normalizedPayload;\n },\n\n normalizeQueryRecordResponse() {\n const normalized = this._super(...arguments);\n\n assert(\n 'Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.',\n !Array.isArray(normalized.data)\n );\n\n return normalized;\n },\n\n extractAttributes(modelClass, resourceHash) {\n const attributes = {};\n\n if (resourceHash.attributes) {\n modelClass.eachAttribute((key) => {\n const attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash.attributes[attributeKey] !== undefined) {\n attributes[key] = resourceHash.attributes[attributeKey];\n }\n if (DEBUG) {\n if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${attributeKey}'. This is most likely because Ember Data's JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement 'keyForAttribute(key) { return key; }' to prevent Ember Data from customizing your attribute keys.`,\n false\n );\n }\n }\n });\n }\n\n return attributes;\n },\n\n /**\n Returns a relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @method extractRelationship\n @public\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipHash) {\n if (Array.isArray(relationshipHash.data)) {\n const ret = new Array(relationshipHash.data.length);\n\n for (let i = 0; i < relationshipHash.data.length; i++) {\n const data = relationshipHash.data[i];\n ret[i] = this._normalizeRelationshipDataHelper(data);\n }\n\n relationshipHash.data = ret;\n } else if (relationshipHash.data && typeof relationshipHash.data === 'object') {\n relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);\n }\n\n return relationshipHash;\n },\n\n /**\n Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @method extractRelationships\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractRelationships(modelClass, resourceHash) {\n const relationships = {};\n\n if (resourceHash.relationships) {\n modelClass.eachRelationship((key, relationshipMeta) => {\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash.relationships[relationshipKey] !== undefined) {\n const relationshipHash = resourceHash.relationships[relationshipKey];\n relationships[key] = this.extractRelationship(relationshipHash);\n }\n if (DEBUG) {\n if (\n resourceHash.relationships[relationshipKey] === undefined &&\n resourceHash.relationships[key] !== undefined\n ) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${relationshipKey}'. This is most likely because Ember Data's JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement 'keyForRelationship(key) { return key; }' to prevent Ember Data from customizing your relationship keys.`,\n false\n );\n }\n }\n });\n }\n\n return relationships;\n },\n\n /**\n @method _extractType\n @param {Model} modelClass\n @param {Object} resourceHash\n @return {String}\n @private\n */\n _extractType(modelClass, resourceHash) {\n return this.modelNameFromPayloadKey(resourceHash.type);\n },\n\n /**\n Dasherizes and singularizes the model name in the payload to match\n the format Ember Data uses internally for the model name.\n\n For example the key `posts` would be converted to `post` and the\n key `studentAssesments` would be converted to `student-assesment`.\n\n @method modelNameFromPayloadKey\n @public\n @param {String} key\n @return {String} the model's modelName\n */\n modelNameFromPayloadKey(key) {\n return dasherize(singularize(key));\n },\n\n /**\n Converts the model name to a pluralized version of the model name.\n\n For example `post` would be converted to `posts` and\n `student-assesment` would be converted to `student-assesments`.\n\n @method payloadKeyFromModelName\n @public\n @param {String} modelName\n @return {String}\n */\n payloadKeyFromModelName(modelName) {\n return pluralize(modelName);\n },\n\n normalize(modelClass, resourceHash) {\n if (resourceHash.attributes) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.attributes);\n }\n\n if (resourceHash.relationships) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);\n }\n\n const data = {\n id: this.extractId(modelClass, resourceHash),\n type: this._extractType(modelClass, resourceHash),\n attributes: this.extractAttributes(modelClass, resourceHash),\n relationships: this.extractRelationships(modelClass, resourceHash),\n };\n\n if (resourceHash.lid) {\n data.lid = resourceHash.lid;\n }\n\n this.applyTransforms(modelClass, data.attributes);\n\n return { data };\n },\n\n /**\n `keyForAttribute` can be used to define rules for how to convert an\n attribute name in your model to a key in your JSON.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as the word separator in the JSON\n attribute keys.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { dasherize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n }\n ```\n\n @method keyForAttribute\n @public\n @param {String} key\n @param {String} method\n @return {String} normalized key\n */\n keyForAttribute(key, method) {\n return dasherize(key);\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as word separators in\n relationship properties.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForRelationship(key, relationship, method) {\n return underscore(key);\n }\n }\n ```\n @method keyForRelationship\n @public\n @param {String} key\n @param {String} typeClass\n @param {String} method\n @return {String} normalized key\n */\n keyForRelationship(key, typeClass, method) {\n return dasherize(key);\n },\n\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n For example, consider this model:\n\n ```app/models/comment.js\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @attr title;\n @attr body;\n\n @belongsTo('user', { async: false, inverse: null })\n author;\n }\n ```\n\n The default serialization would create a JSON-API resource object like:\n\n ```javascript\n {\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n }\n ```\n\n By default, attributes are passed through as-is, unless\n you specified an attribute type (`attr('date')`). If\n you specify a transform, the JavaScript value will be\n serialized when inserted into the attributes hash.\n\n Belongs-to relationships are converted into JSON-API\n resource identifier objects.\n\n ## IDs\n\n `serialize` takes an options hash with a single option:\n `includeId`. If this option is `true`, `serialize` will,\n by default include the ID in the JSON object it builds.\n\n The JSONAPIAdapter passes in `includeId: true` when serializing a record\n for `createRecord` or `updateRecord`.\n\n ## Customization\n\n Your server may expect data in a different format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return data formatted to match your API's expectations, or override\n the invoked adapter method and do the serialization in the adapter directly\n by using the provided snapshot.\n\n If your API's format differs greatly from the JSON:API spec, you should\n consider authoring your own adapter and serializer instead of extending\n this class.\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n ```\n\n ## Customizing an App-Wide Serializer\n\n If you want to define a serializer for your entire\n application, you'll probably want to use `eachAttribute`\n and `eachRelationship` on the record.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore, singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n\n function serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n }\n\n function serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n }\n ```\n\n This serializer will generate JSON that looks like this:\n\n ```javascript\n {\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n }\n ```\n\n ## Tweaking the Default Formatting\n\n If you just want to do some small tweaks on the default JSON:API formatted response,\n you can call `super.serialize` first and make the tweaks\n on the returned object.\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n }\n ```\n\n @method serialize\n @public\n @param {Snapshot} snapshot\n @param {Object} options\n @return {Object} json\n */\n serialize(snapshot, options) {\n const data = this._super(...arguments);\n data.type = this.payloadKeyFromModelName(snapshot.modelName);\n\n return { data };\n },\n\n serializeAttribute(snapshot, json, key, attribute) {\n const type = attribute.type;\n\n if (this._canSerialize(key)) {\n json.attributes = json.attributes || {};\n\n let value = snapshot.attr(key);\n if (type) {\n const transform = this.transformFor(type);\n value = transform.serialize(value, attribute.options);\n }\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json.attributes[payloadKey] = value;\n }\n },\n\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsTo = snapshot.belongsTo(name);\n const belongsToIsNotNew = belongsTo && !belongsTo.isNew;\n\n if (belongsTo === null || belongsToIsNotNew) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name) {\n payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');\n }\n\n let data = null;\n if (belongsTo) {\n const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);\n\n data = {\n type: payloadType,\n id: belongsTo.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n\n serializeHasMany(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this.shouldSerializeHasMany(snapshot, name, relationship)) {\n const hasMany = snapshot.hasMany(name);\n if (hasMany !== undefined) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');\n }\n\n // only serialize has many relationships that are not new\n const nonNewHasMany = hasMany.filter((item) => !item.isNew);\n const data = new Array(nonNewHasMany.length);\n\n for (let i = 0; i < nonNewHasMany.length; i++) {\n const item = hasMany[i];\n const payloadType = this.payloadKeyFromModelName(item.modelName);\n\n data[i] = {\n type: payloadType,\n id: item.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n});\n\nif (DEBUG) {\n JSONAPISerializer.reopen({\n init(...args) {\n this._super(...args);\n\n assert(\n `You've used the EmbeddedRecordsMixin in ${this.toString()} which is not fully compatible with the JSON:API specification. Please confirm that this works for your specific API and add \\`this.isEmbeddedRecordsMixinCompatible = true\\` to your serializer.`,\n !this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true\n );\n\n const constructor = this.constructor;\n warn(\n `You've defined 'extractMeta' in ${constructor.toString()} which is not used for serializers extending JSONAPISerializer. Read more at https://api.emberjs.com/ember-data/release/classes/JSONAPISerializer on how to customize meta when using JSON API.`,\n this.extractMeta === JSONSerializer.prototype.extractMeta,\n {\n id: 'ds.serializer.json-api.extractMeta',\n }\n );\n },\n warnMessageForUndefinedType() {\n return (\n 'Encountered a resource object with an undefined type (resolved resource using ' +\n this.constructor.toString() +\n ')'\n );\n },\n warnMessageNoModelForType(modelName, originalType, usedLookup) {\n return `Encountered a resource object with type \"${originalType}\", but no model was found for model name \"${modelName}\" (resolved model name using '${this.constructor.toString()}.${usedLookup}(\"${originalType}\")').`;\n },\n });\n}\n\nexport default JSONAPISerializer;\n"],"names":["JSONAPISerializer","JSONSerializer","extend","_normalizeDocumentHelper","documentHash","Array","isArray","data","ret","length","i","_normalizeResourceHelper","included","normalized","push","_normalizeRelationshipDataHelper","relationshipDataHash","type","modelNameFromPayloadKey","resourceHash","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","warnMessageForUndefinedType","store","schema","hasResource","warn","warnMessageNoModelForType","id","modelClass","modelFor","serializer","serializerFor","normalize","pushPayload","payload","normalizedPayload","_normalizeResponse","primaryModelClass","requestType","isSingle","normalizeQueryRecordResponse","_super","arguments","extractAttributes","attributes","eachAttribute","key","attributeKey","keyForAttribute","undefined","modelName","extractRelationship","relationshipHash","extractRelationships","relationships","eachRelationship","relationshipMeta","relationshipKey","keyForRelationship","kind","_extractType","dasherize","singularize","payloadKeyFromModelName","pluralize","normalizeUsingDeclaredMapping","extractId","lid","applyTransforms","method","typeClass","serialize","snapshot","options","serializeAttribute","json","attribute","_canSerialize","value","attr","transform","transformFor","payloadKey","_getMappedKey","serializeBelongsTo","relationship","name","belongsTo","belongsToIsNotNew","isNew","payloadType","serializeHasMany","shouldSerializeHasMany","hasMany","nonNewHasMany","filter","item","reopen","init","args","toString","isEmbeddedRecordsMixin","isEmbeddedRecordsMixinCompatible","constructor","extractMeta","prototype","originalType","usedLookup"],"mappings":";;;;;AAAA;AACA;AACA;AAsIA,MAAMA,iBAA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IAAI,CAACiD,YAAY,CAAChC,UAAU,EAAEf,YAAY,CAAC;MACjD+B,UAAU,EAAE,IAAI,CAACD,iBAAiB,CAACf,UAAU,EAAEf,YAAY,CAAC;AAC5DyC,MAAAA,aAAa,EAAE,IAAI,CAACD,oBAAoB,CAACzB,UAAU,EAAEf,YAAY;KAClE;IAED,IAAIA,YAAY,CAACsD,GAAG,EAAE;AACpBlE,MAAAA,IAAI,CAACkE,GAAG,GAAGtD,YAAY,CAACsD,GAAG;AAC7B;IAEA,IAAI,CAACC,eAAe,CAACxC,UAAU,EAAE3B,IAAI,CAAC2C,UAAU,CAAC;IAEjD,OAAO;AAAE3C,MAAAA;KAAM;GAChB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAME+C,EAAAA,eAAeA,CAACF,GAAG,EAAEuB,MAAM,EAAE;IAC3B,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEY,EAAAA,kBAAkBA,CAACZ,GAAG,EAAEwB,SAAS,EAAED,MAAM,EAAE;IACzC,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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