@ember-data/serializer 5.4.0-alpha.7 → 5.4.0-alpha.71
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/README.md +11 -1
- 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 +373 -0
- package/dist/index.js.map +1 -0
- package/{addon/json.js → dist/json-CsNumir-.js} +80 -59
- package/dist/json-CsNumir-.js.map +1 -0
- package/{addon → dist}/json-api.js +85 -184
- package/dist/json-api.js.map +1 -0
- package/dist/json.js +7 -0
- package/dist/json.js.map +1 -0
- package/dist/rest.js +1271 -0
- package/dist/rest.js.map +1 -0
- package/{addon/string-22572f80.js → dist/transform.js} +144 -20
- package/dist/transform.js.map +1 -0
- package/package.json +63 -36
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts +103 -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/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 +127 -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 +515 -0
- package/unstable-preview-types/json-api.d.ts.map +1 -0
- package/unstable-preview-types/json.d.ts +1094 -0
- package/unstable-preview-types/json.d.ts.map +1 -0
- package/unstable-preview-types/rest.d.ts +571 -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
|
@@ -1,134 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assert, warn } from '@ember/debug';
|
|
1
|
+
import { warn } from '@ember/debug';
|
|
3
2
|
import { dasherize } from '@ember/string';
|
|
4
3
|
import { singularize, pluralize } from 'ember-inflector';
|
|
5
|
-
import JSONSerializer from "./json";
|
|
4
|
+
import { J as JSONSerializer } from "./json-CsNumir-";
|
|
5
|
+
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
|
|
7
7
|
/**
|
|
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
|
-
*/
|
|
8
|
+
* @module @ember-data/serializer/json-api
|
|
9
|
+
*/
|
|
132
10
|
const JSONAPISerializer = JSONSerializer.extend({
|
|
133
11
|
/**
|
|
134
12
|
@method _normalizeDocumentHelper
|
|
@@ -138,9 +16,9 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
138
16
|
*/
|
|
139
17
|
_normalizeDocumentHelper(documentHash) {
|
|
140
18
|
if (Array.isArray(documentHash.data)) {
|
|
141
|
-
|
|
19
|
+
const ret = new Array(documentHash.data.length);
|
|
142
20
|
for (let i = 0; i < documentHash.data.length; i++) {
|
|
143
|
-
|
|
21
|
+
const data = documentHash.data[i];
|
|
144
22
|
ret[i] = this._normalizeResourceHelper(data);
|
|
145
23
|
}
|
|
146
24
|
documentHash.data = ret;
|
|
@@ -148,10 +26,10 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
148
26
|
documentHash.data = this._normalizeResourceHelper(documentHash.data);
|
|
149
27
|
}
|
|
150
28
|
if (Array.isArray(documentHash.included)) {
|
|
151
|
-
|
|
29
|
+
const ret = new Array();
|
|
152
30
|
for (let i = 0; i < documentHash.included.length; i++) {
|
|
153
|
-
|
|
154
|
-
|
|
31
|
+
const included = documentHash.included[i];
|
|
32
|
+
const normalized = this._normalizeResourceHelper(included);
|
|
155
33
|
if (normalized !== null) {
|
|
156
34
|
// can be null when unknown type is encountered
|
|
157
35
|
ret.push(normalized);
|
|
@@ -178,19 +56,23 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
178
56
|
@private
|
|
179
57
|
*/
|
|
180
58
|
_normalizeResourceHelper(resourceHash) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
59
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
60
|
+
if (!test) {
|
|
61
|
+
throw new Error(this.warnMessageForUndefinedType());
|
|
62
|
+
}
|
|
63
|
+
})(resourceHash.type) : {};
|
|
64
|
+
const type = this.modelNameFromPayloadKey(resourceHash.type);
|
|
65
|
+
if (!this.store.schema.hasResource({
|
|
66
|
+
type
|
|
67
|
+
})) {
|
|
68
|
+
warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {
|
|
187
69
|
id: 'ds.serializer.model-for-type-missing'
|
|
188
70
|
});
|
|
189
71
|
return null;
|
|
190
72
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
73
|
+
const modelClass = this.store.modelFor(type);
|
|
74
|
+
const serializer = this.store.serializerFor(type);
|
|
75
|
+
const {
|
|
194
76
|
data
|
|
195
77
|
} = serializer.normalize(modelClass, resourceHash);
|
|
196
78
|
return data;
|
|
@@ -203,7 +85,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
203
85
|
@param {Object} payload
|
|
204
86
|
*/
|
|
205
87
|
pushPayload(store, payload) {
|
|
206
|
-
|
|
88
|
+
const normalizedPayload = this._normalizeDocumentHelper(payload);
|
|
207
89
|
store.push(normalizedPayload);
|
|
208
90
|
},
|
|
209
91
|
/**
|
|
@@ -218,25 +100,33 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
218
100
|
@private
|
|
219
101
|
*/
|
|
220
102
|
_normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {
|
|
221
|
-
|
|
103
|
+
const normalizedPayload = this._normalizeDocumentHelper(payload);
|
|
222
104
|
return normalizedPayload;
|
|
223
105
|
},
|
|
224
106
|
normalizeQueryRecordResponse() {
|
|
225
|
-
|
|
226
|
-
|
|
107
|
+
const normalized = this._super(...arguments);
|
|
108
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
109
|
+
if (!test) {
|
|
110
|
+
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.');
|
|
111
|
+
}
|
|
112
|
+
})(!Array.isArray(normalized.data)) : {};
|
|
227
113
|
return normalized;
|
|
228
114
|
},
|
|
229
115
|
extractAttributes(modelClass, resourceHash) {
|
|
230
|
-
|
|
116
|
+
const attributes = {};
|
|
231
117
|
if (resourceHash.attributes) {
|
|
232
118
|
modelClass.eachAttribute(key => {
|
|
233
|
-
|
|
119
|
+
const attributeKey = this.keyForAttribute(key, 'deserialize');
|
|
234
120
|
if (resourceHash.attributes[attributeKey] !== undefined) {
|
|
235
121
|
attributes[key] = resourceHash.attributes[attributeKey];
|
|
236
122
|
}
|
|
237
|
-
if (macroCondition(
|
|
123
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
238
124
|
if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {
|
|
239
|
-
|
|
125
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
126
|
+
{
|
|
127
|
+
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.`);
|
|
128
|
+
}
|
|
129
|
+
})() : {};
|
|
240
130
|
}
|
|
241
131
|
}
|
|
242
132
|
});
|
|
@@ -253,9 +143,9 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
253
143
|
*/
|
|
254
144
|
extractRelationship(relationshipHash) {
|
|
255
145
|
if (Array.isArray(relationshipHash.data)) {
|
|
256
|
-
|
|
146
|
+
const ret = new Array(relationshipHash.data.length);
|
|
257
147
|
for (let i = 0; i < relationshipHash.data.length; i++) {
|
|
258
|
-
|
|
148
|
+
const data = relationshipHash.data[i];
|
|
259
149
|
ret[i] = this._normalizeRelationshipDataHelper(data);
|
|
260
150
|
}
|
|
261
151
|
relationshipHash.data = ret;
|
|
@@ -274,17 +164,21 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
274
164
|
@return {Object}
|
|
275
165
|
*/
|
|
276
166
|
extractRelationships(modelClass, resourceHash) {
|
|
277
|
-
|
|
167
|
+
const relationships = {};
|
|
278
168
|
if (resourceHash.relationships) {
|
|
279
169
|
modelClass.eachRelationship((key, relationshipMeta) => {
|
|
280
|
-
|
|
170
|
+
const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
|
|
281
171
|
if (resourceHash.relationships[relationshipKey] !== undefined) {
|
|
282
|
-
|
|
172
|
+
const relationshipHash = resourceHash.relationships[relationshipKey];
|
|
283
173
|
relationships[key] = this.extractRelationship(relationshipHash);
|
|
284
174
|
}
|
|
285
|
-
if (macroCondition(
|
|
175
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
286
176
|
if (resourceHash.relationships[relationshipKey] === undefined && resourceHash.relationships[key] !== undefined) {
|
|
287
|
-
|
|
177
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
178
|
+
{
|
|
179
|
+
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.`);
|
|
180
|
+
}
|
|
181
|
+
})() : {};
|
|
288
182
|
}
|
|
289
183
|
}
|
|
290
184
|
});
|
|
@@ -333,12 +227,15 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
333
227
|
if (resourceHash.relationships) {
|
|
334
228
|
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);
|
|
335
229
|
}
|
|
336
|
-
|
|
230
|
+
const data = {
|
|
337
231
|
id: this.extractId(modelClass, resourceHash),
|
|
338
232
|
type: this._extractType(modelClass, resourceHash),
|
|
339
233
|
attributes: this.extractAttributes(modelClass, resourceHash),
|
|
340
234
|
relationships: this.extractRelationships(modelClass, resourceHash)
|
|
341
235
|
};
|
|
236
|
+
if (resourceHash.lid) {
|
|
237
|
+
data.lid = resourceHash.lid;
|
|
238
|
+
}
|
|
342
239
|
this.applyTransforms(modelClass, data.attributes);
|
|
343
240
|
return {
|
|
344
241
|
data
|
|
@@ -529,22 +426,22 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
529
426
|
@return {Object} json
|
|
530
427
|
*/
|
|
531
428
|
serialize(snapshot, options) {
|
|
532
|
-
|
|
429
|
+
const data = this._super(...arguments);
|
|
533
430
|
data.type = this.payloadKeyFromModelName(snapshot.modelName);
|
|
534
431
|
return {
|
|
535
432
|
data
|
|
536
433
|
};
|
|
537
434
|
},
|
|
538
435
|
serializeAttribute(snapshot, json, key, attribute) {
|
|
539
|
-
|
|
436
|
+
const type = attribute.type;
|
|
540
437
|
if (this._canSerialize(key)) {
|
|
541
438
|
json.attributes = json.attributes || {};
|
|
542
439
|
let value = snapshot.attr(key);
|
|
543
440
|
if (type) {
|
|
544
|
-
|
|
441
|
+
const transform = this.transformFor(type);
|
|
545
442
|
value = transform.serialize(value, attribute.options);
|
|
546
443
|
}
|
|
547
|
-
|
|
444
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
548
445
|
let payloadKey = this._getMappedKey(key, schema);
|
|
549
446
|
if (payloadKey === key) {
|
|
550
447
|
payloadKey = this.keyForAttribute(key, 'serialize');
|
|
@@ -553,20 +450,20 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
553
450
|
}
|
|
554
451
|
},
|
|
555
452
|
serializeBelongsTo(snapshot, json, relationship) {
|
|
556
|
-
|
|
557
|
-
if (this._canSerialize(
|
|
558
|
-
|
|
559
|
-
|
|
453
|
+
const name = relationship.name;
|
|
454
|
+
if (this._canSerialize(name)) {
|
|
455
|
+
const belongsTo = snapshot.belongsTo(name);
|
|
456
|
+
const belongsToIsNotNew = belongsTo && !belongsTo.isNew;
|
|
560
457
|
if (belongsTo === null || belongsToIsNotNew) {
|
|
561
458
|
json.relationships = json.relationships || {};
|
|
562
|
-
|
|
563
|
-
let payloadKey = this._getMappedKey(
|
|
564
|
-
if (payloadKey ===
|
|
565
|
-
payloadKey = this.keyForRelationship(
|
|
459
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
460
|
+
let payloadKey = this._getMappedKey(name, schema);
|
|
461
|
+
if (payloadKey === name) {
|
|
462
|
+
payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');
|
|
566
463
|
}
|
|
567
464
|
let data = null;
|
|
568
465
|
if (belongsTo) {
|
|
569
|
-
|
|
466
|
+
const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);
|
|
570
467
|
data = {
|
|
571
468
|
type: payloadType,
|
|
572
469
|
id: belongsTo.id
|
|
@@ -579,23 +476,23 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
579
476
|
}
|
|
580
477
|
},
|
|
581
478
|
serializeHasMany(snapshot, json, relationship) {
|
|
582
|
-
|
|
583
|
-
if (this.shouldSerializeHasMany(snapshot,
|
|
584
|
-
|
|
479
|
+
const name = relationship.name;
|
|
480
|
+
if (this.shouldSerializeHasMany(snapshot, name, relationship)) {
|
|
481
|
+
const hasMany = snapshot.hasMany(name);
|
|
585
482
|
if (hasMany !== undefined) {
|
|
586
483
|
json.relationships = json.relationships || {};
|
|
587
|
-
|
|
588
|
-
let payloadKey = this._getMappedKey(
|
|
589
|
-
if (payloadKey ===
|
|
590
|
-
payloadKey = this.keyForRelationship(
|
|
484
|
+
const schema = this.store.modelFor(snapshot.modelName);
|
|
485
|
+
let payloadKey = this._getMappedKey(name, schema);
|
|
486
|
+
if (payloadKey === name && this.keyForRelationship) {
|
|
487
|
+
payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');
|
|
591
488
|
}
|
|
592
489
|
|
|
593
490
|
// only serialize has many relationships that are not new
|
|
594
|
-
|
|
595
|
-
|
|
491
|
+
const nonNewHasMany = hasMany.filter(item => !item.isNew);
|
|
492
|
+
const data = new Array(nonNewHasMany.length);
|
|
596
493
|
for (let i = 0; i < nonNewHasMany.length; i++) {
|
|
597
|
-
|
|
598
|
-
|
|
494
|
+
const item = hasMany[i];
|
|
495
|
+
const payloadType = this.payloadKeyFromModelName(item.modelName);
|
|
599
496
|
data[i] = {
|
|
600
497
|
type: payloadType,
|
|
601
498
|
id: item.id
|
|
@@ -608,12 +505,16 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
608
505
|
}
|
|
609
506
|
}
|
|
610
507
|
});
|
|
611
|
-
if (macroCondition(
|
|
508
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
612
509
|
JSONAPISerializer.reopen({
|
|
613
510
|
init(...args) {
|
|
614
511
|
this._super(...args);
|
|
615
|
-
|
|
616
|
-
|
|
512
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
513
|
+
if (!test) {
|
|
514
|
+
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.`);
|
|
515
|
+
}
|
|
516
|
+
})(!this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true) : {};
|
|
517
|
+
const constructor = this.constructor;
|
|
617
518
|
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
519
|
id: 'ds.serializer.json-api.extractMeta'
|
|
619
520
|
});
|
|
@@ -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';\nimport { dasherize } from '@ember/string';\n\nimport { pluralize, singularize } from 'ember-inflector';\n\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 warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {\n id: 'ds.serializer.model-for-type-missing',\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;AAwIA,MAAMA,iBAAiB,GAAGC,cAAc,CAACC,MAAM,CAAC;AAC9C;AACF;AACA;AACA;AACA;AACA;EACEC,wBAAwBA,CAACC,YAAY,EAAE;IACrC,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAACG,IAAI,CAAC,EAAE;MACpC,MAAMC,GAAG,GAAG,IAAIH,KAAK,CAACD,YAAY,CAACG,IAAI,CAACE,MAAM,CAAC,CAAA;AAE/C,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACG,IAAI,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;AACjD,QAAA,MAAMH,IAAI,GAAGH,YAAY,CAACG,IAAI,CAACG,CAAC,CAAC,CAAA;QACjCF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI,CAACC,wBAAwB,CAACJ,IAAI,CAAC,CAAA;AAC9C,OAAA;MAEAH,YAAY,CAACG,IAAI,GAAGC,GAAG,CAAA;AACzB,KAAC,MAAM,IAAIJ,YAAY,CAACG,IAAI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,CAACsD,GAAG,EAAE;AACpBlE,MAAAA,IAAI,CAACkE,GAAG,GAAGtD,YAAY,CAACsD,GAAG,CAAA;AAC7B,KAAA;IAEA,IAAI,CAACC,eAAe,CAACxC,UAAU,EAAE3B,IAAI,CAAC2C,UAAU,CAAC,CAAA;IAEjD,OAAO;AAAE3C,MAAAA,IAAAA;KAAM,CAAA;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,CAAA;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,CAAA;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;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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