@ember-data/serializer 5.5.0-alpha.9 → 5.5.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.
Files changed (78) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +16 -10
  3. package/addon-main.cjs +5 -0
  4. package/blueprints/serializer/index.js +71 -5
  5. package/blueprints/serializer-test/index.js +13 -7
  6. package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +8 -9
  7. package/blueprints/transform/index.js +14 -4
  8. package/blueprints/transform-test/index.js +13 -7
  9. package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +3 -4
  10. package/dist/index.js +306 -0
  11. package/dist/index.js.map +1 -0
  12. package/{addon/json.js → dist/json-CVTR4xWv.js} +86 -66
  13. package/dist/json-CVTR4xWv.js.map +1 -0
  14. package/{addon → dist}/json-api.js +88 -64
  15. package/dist/json-api.js.map +1 -0
  16. package/dist/json.js +6 -0
  17. package/dist/json.js.map +1 -0
  18. package/dist/rest.js +1274 -0
  19. package/dist/rest.js.map +1 -0
  20. package/{addon/string-22572f80.js → dist/transform.js} +143 -20
  21. package/dist/transform.js.map +1 -0
  22. package/logos/NCC-1701-a-blue.svg +4 -0
  23. package/logos/NCC-1701-a-gold.svg +4 -0
  24. package/logos/NCC-1701-a-gold_100.svg +1 -0
  25. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  26. package/logos/NCC-1701-a.svg +4 -0
  27. package/logos/README.md +4 -0
  28. package/logos/docs-badge.svg +2 -0
  29. package/logos/github-header.svg +444 -0
  30. package/logos/social1.png +0 -0
  31. package/logos/social2.png +0 -0
  32. package/logos/warp-drive-logo-dark.svg +4 -0
  33. package/logos/warp-drive-logo-gold.svg +4 -0
  34. package/package.json +60 -45
  35. package/unstable-preview-types/-private/embedded-records-mixin.d.ts +102 -0
  36. package/unstable-preview-types/-private/embedded-records-mixin.d.ts.map +1 -0
  37. package/unstable-preview-types/-private/transforms/boolean.d.ts +52 -0
  38. package/unstable-preview-types/-private/transforms/boolean.d.ts.map +1 -0
  39. package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts +4 -0
  40. package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts.map +1 -0
  41. package/unstable-preview-types/-private/transforms/date.d.ts +33 -0
  42. package/unstable-preview-types/-private/transforms/date.d.ts.map +1 -0
  43. package/unstable-preview-types/-private/transforms/number.d.ts +34 -0
  44. package/unstable-preview-types/-private/transforms/number.d.ts.map +1 -0
  45. package/unstable-preview-types/-private/transforms/string.d.ts +34 -0
  46. package/unstable-preview-types/-private/transforms/string.d.ts.map +1 -0
  47. package/unstable-preview-types/-private/transforms/transform.d.ts +126 -0
  48. package/unstable-preview-types/-private/transforms/transform.d.ts.map +1 -0
  49. package/unstable-preview-types/-private/utils.d.ts +6 -0
  50. package/unstable-preview-types/-private/utils.d.ts.map +1 -0
  51. package/unstable-preview-types/index.d.ts +277 -0
  52. package/unstable-preview-types/index.d.ts.map +1 -0
  53. package/unstable-preview-types/json-api.d.ts +514 -0
  54. package/unstable-preview-types/json-api.d.ts.map +1 -0
  55. package/unstable-preview-types/json.d.ts +1093 -0
  56. package/unstable-preview-types/json.d.ts.map +1 -0
  57. package/unstable-preview-types/rest.d.ts +570 -0
  58. package/unstable-preview-types/rest.d.ts.map +1 -0
  59. package/unstable-preview-types/transform.d.ts +11 -0
  60. package/unstable-preview-types/transform.d.ts.map +1 -0
  61. package/addon/-private.js +0 -4
  62. package/addon/-private.js.map +0 -1
  63. package/addon/embedded-records-mixin-d75385ff.js +0 -575
  64. package/addon/embedded-records-mixin-d75385ff.js.map +0 -1
  65. package/addon/index.js +0 -180
  66. package/addon/index.js.map +0 -1
  67. package/addon/json-api.js.map +0 -1
  68. package/addon/json.js.map +0 -1
  69. package/addon/rest.js +0 -684
  70. package/addon/rest.js.map +0 -1
  71. package/addon/string-22572f80.js.map +0 -1
  72. package/addon/transform.js +0 -2
  73. package/addon/transform.js.map +0 -1
  74. package/addon/utils-075c5b79.js +0 -12
  75. package/addon/utils-075c5b79.js.map +0 -1
  76. package/addon-main.js +0 -93
  77. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  78. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
@@ -1,575 +0,0 @@
1
- import { A } from '@ember/array';
2
- import { warn } from '@ember/debug';
3
- import Mixin from '@ember/object/mixin';
4
- import { camelize } from '@ember/string';
5
-
6
- /**
7
- @module @ember-data/serializer/rest
8
- */
9
-
10
- /**
11
- ## Using Embedded Records
12
-
13
- `EmbeddedRecordsMixin` supports serializing embedded records.
14
-
15
- To set up embedded records, include the mixin when extending a serializer,
16
- then define and configure embedded (model) relationships.
17
-
18
- Note that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.
19
-
20
- Note also that this mixin does not work with JSONAPISerializer because the JSON:API specification does not describe how to format embedded resources.
21
-
22
- Below is an example of a per-type serializer (`post` type).
23
-
24
- ```app/serializers/post.js
25
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
26
-
27
- export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
28
- attrs = {
29
- author: { embedded: 'always' },
30
- comments: { serialize: 'ids' }
31
- }
32
- }
33
- ```
34
- Note that this use of `{ embedded: 'always' }` is unrelated to
35
- the `{ embedded: 'always' }` that is defined as an option on `attr` as part of
36
- defining a model while working with the `ActiveModelSerializer`. Nevertheless,
37
- using `{ embedded: 'always' }` as an option to `attr` is not a valid way to set up
38
- embedded records.
39
-
40
- The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
41
-
42
- ```js
43
- {
44
- serialize: 'records',
45
- deserialize: 'records'
46
- }
47
- ```
48
-
49
- ### Configuring Attrs
50
-
51
- A resource's `attrs` option may be set to use `ids`, `records` or false for the
52
- `serialize` and `deserialize` settings.
53
-
54
- The `attrs` property can be set on the `ApplicationSerializer` or a per-type
55
- serializer.
56
-
57
- In the case where embedded JSON is expected while extracting a payload (reading)
58
- the setting is `deserialize: 'records'`, there is no need to use `ids` when
59
- extracting as that is the default behaviour without this mixin if you are using
60
- the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while
61
- serializing `serialize: 'records'` is the setting to use. There is an option of
62
- not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
63
- do not want the relationship sent at all, you can use `serialize: false`.
64
-
65
-
66
- ### EmbeddedRecordsMixin defaults
67
- If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
68
- will behave in the following way:
69
-
70
- BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
71
- HasMany: `{ serialize: false, deserialize: 'ids' }`
72
-
73
- ### Model Relationships
74
-
75
- Embedded records must have a model defined to be extracted and serialized. Note that
76
- when defining any relationships on your model such as `belongsTo` and `hasMany`, you
77
- should not both specify `async: true` and also indicate through the serializer's
78
- `attrs` attribute that the related model should be embedded for deserialization.
79
- If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
80
- then do not use `async: true`.
81
-
82
- To successfully extract and serialize embedded records the model relationships
83
- must be set up correctly. See the
84
- [defining relationships](https://guides.emberjs.com/current/models/relationships)
85
- section of the **Defining Models** guide page.
86
-
87
- Records without an `id` property are not considered embedded records, model
88
- instances must have an `id` property to be used with Ember Data.
89
-
90
- ### Example JSON payloads, Models and Serializers
91
-
92
- **When customizing a serializer it is important to grok what the customizations
93
- are. Please read the docs for the methods this mixin provides, in case you need
94
- to modify it to fit your specific needs.**
95
-
96
- For example, review the docs for each method of this mixin:
97
- * [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)
98
- * [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)
99
- * [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)
100
-
101
- @class EmbeddedRecordsMixin
102
- @public
103
- */
104
- var embeddedRecordsMixin = Mixin.create({
105
- /**
106
- Normalize the record and recursively normalize/extract all the embedded records
107
- while pushing them into the store as they are encountered
108
- A payload with an attr configured for embedded records needs to be extracted:
109
- ```js
110
- {
111
- "post": {
112
- "id": "1"
113
- "title": "Rails is omakase",
114
- "comments": [{
115
- "id": "1",
116
- "body": "Rails is unagi"
117
- }, {
118
- "id": "2",
119
- "body": "Omakase O_o"
120
- }]
121
- }
122
- }
123
- ```
124
- @method normalize
125
- @public
126
- @param {Model} typeClass
127
- @param {Object} hash to be normalized
128
- @param {String} prop the hash has been referenced by
129
- @return {Object} the normalized hash
130
- **/
131
- normalize(typeClass, hash, prop) {
132
- let normalizedHash = this._super(typeClass, hash, prop);
133
- return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
134
- },
135
- keyForRelationship(key, typeClass, method) {
136
- if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
137
- return this.keyForAttribute(key, method);
138
- } else {
139
- return this._super(key, typeClass, method) || key;
140
- }
141
- },
142
- /**
143
- Serialize `belongsTo` relationship when it is configured as an embedded object.
144
- This example of an author model belongs to a post model:
145
- ```js
146
- import Model, { attr, belongsTo } from '@ember-data/model';
147
- Post = Model.extend({
148
- title: attr('string'),
149
- body: attr('string'),
150
- author: belongsTo('author')
151
- });
152
- Author = Model.extend({
153
- name: attr('string'),
154
- post: belongsTo('post')
155
- });
156
- ```
157
- Use a custom (type) serializer for the post model to configure embedded author
158
- ```app/serializers/post.js
159
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
160
- export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
161
- attrs = {
162
- author: { embedded: 'always' }
163
- }
164
- }
165
- ```
166
- A payload with an attribute configured for embedded records can serialize
167
- the records together under the root attribute's payload:
168
- ```js
169
- {
170
- "post": {
171
- "id": "1"
172
- "title": "Rails is omakase",
173
- "author": {
174
- "id": "2"
175
- "name": "dhh"
176
- }
177
- }
178
- }
179
- ```
180
- @method serializeBelongsTo
181
- @public
182
- @param {Snapshot} snapshot
183
- @param {Object} json
184
- @param {Object} relationship
185
- */
186
- serializeBelongsTo(snapshot, json, relationship) {
187
- let attr = relationship.key;
188
- if (this.noSerializeOptionSpecified(attr)) {
189
- this._super(snapshot, json, relationship);
190
- return;
191
- }
192
- let includeIds = this.hasSerializeIdsOption(attr);
193
- let includeRecords = this.hasSerializeRecordsOption(attr);
194
- let embeddedSnapshot = snapshot.belongsTo(attr);
195
- if (includeIds) {
196
- let schema = this.store.modelFor(snapshot.modelName);
197
- let serializedKey = this._getMappedKey(relationship.key, schema);
198
- if (serializedKey === relationship.key && this.keyForRelationship) {
199
- serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
200
- }
201
- if (!embeddedSnapshot) {
202
- json[serializedKey] = null;
203
- } else {
204
- json[serializedKey] = embeddedSnapshot.id;
205
- if (relationship.options.polymorphic) {
206
- this.serializePolymorphicType(snapshot, json, relationship);
207
- }
208
- }
209
- } else if (includeRecords) {
210
- this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
211
- }
212
- },
213
- _serializeEmbeddedBelongsTo(snapshot, json, relationship) {
214
- let embeddedSnapshot = snapshot.belongsTo(relationship.key);
215
- let schema = this.store.modelFor(snapshot.modelName);
216
- let serializedKey = this._getMappedKey(relationship.key, schema);
217
- if (serializedKey === relationship.key && this.keyForRelationship) {
218
- serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
219
- }
220
- if (!embeddedSnapshot) {
221
- json[serializedKey] = null;
222
- } else {
223
- json[serializedKey] = embeddedSnapshot.serialize({
224
- includeId: true
225
- });
226
- this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
227
- if (relationship.options.polymorphic) {
228
- this.serializePolymorphicType(snapshot, json, relationship);
229
- }
230
- }
231
- },
232
- /**
233
- Serializes `hasMany` relationships when it is configured as embedded objects.
234
- This example of a post model has many comments:
235
- ```js
236
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
237
- Post = Model.extend({
238
- title: attr('string'),
239
- body: attr('string'),
240
- comments: hasMany('comment')
241
- });
242
- Comment = Model.extend({
243
- body: attr('string'),
244
- post: belongsTo('post')
245
- });
246
- ```
247
- Use a custom (type) serializer for the post model to configure embedded comments
248
- ```app/serializers/post.js
249
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
250
- export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
251
- attrs = {
252
- comments: { embedded: 'always' }
253
- }
254
- }
255
- ```
256
- A payload with an attribute configured for embedded records can serialize
257
- the records together under the root attribute's payload:
258
- ```js
259
- {
260
- "post": {
261
- "id": "1"
262
- "title": "Rails is omakase",
263
- "body": "I want this for my ORM, I want that for my template language..."
264
- "comments": [{
265
- "id": "1",
266
- "body": "Rails is unagi"
267
- }, {
268
- "id": "2",
269
- "body": "Omakase O_o"
270
- }]
271
- }
272
- }
273
- ```
274
- The attrs options object can use more specific instruction for extracting and
275
- serializing. When serializing, an option to embed `ids`, `ids-and-types` or `records` can be set.
276
- When extracting the only option is `records`.
277
- So `{ embedded: 'always' }` is shorthand for:
278
- `{ serialize: 'records', deserialize: 'records' }`
279
- To embed the `ids` for a related object (using a hasMany relationship):
280
- ```app/serializers/post.js
281
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
282
- export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
283
- attrs = {
284
- comments: { serialize: 'ids', deserialize: 'records' }
285
- }
286
- }
287
- ```
288
- ```js
289
- {
290
- "post": {
291
- "id": "1"
292
- "title": "Rails is omakase",
293
- "body": "I want this for my ORM, I want that for my template language..."
294
- "comments": ["1", "2"]
295
- }
296
- }
297
- ```
298
- To embed the relationship as a collection of objects with `id` and `type` keys, set
299
- `ids-and-types` for the related object.
300
- This is particularly useful for polymorphic relationships where records don't share
301
- the same table and the `id` is not enough information.
302
- For example having a user that has many pets:
303
- ```js
304
- User = Model.extend({
305
- name: attr('string'),
306
- pets: hasMany('pet', { polymorphic: true })
307
- });
308
- Pet = Model.extend({
309
- name: attr('string'),
310
- });
311
- Cat = Pet.extend({
312
- // ...
313
- });
314
- Parrot = Pet.extend({
315
- // ...
316
- });
317
- ```
318
- ```app/serializers/user.js
319
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
320
- export default class UserSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
321
- attrs = {
322
- pets: { serialize: 'ids-and-types', deserialize: 'records' }
323
- }
324
- }
325
- ```
326
- ```js
327
- {
328
- "user": {
329
- "id": "1"
330
- "name": "Bertin Osborne",
331
- "pets": [
332
- { "id": "1", "type": "Cat" },
333
- { "id": "1", "type": "Parrot"}
334
- ]
335
- }
336
- }
337
- ```
338
- @method serializeHasMany
339
- @public
340
- @param {Snapshot} snapshot
341
- @param {Object} json
342
- @param {Object} relationship
343
- */
344
- serializeHasMany(snapshot, json, relationship) {
345
- let attr = relationship.key;
346
- if (this.noSerializeOptionSpecified(attr)) {
347
- this._super(snapshot, json, relationship);
348
- return;
349
- }
350
- if (this.hasSerializeIdsOption(attr)) {
351
- let schema = this.store.modelFor(snapshot.modelName);
352
- let serializedKey = this._getMappedKey(relationship.key, schema);
353
- if (serializedKey === relationship.key && this.keyForRelationship) {
354
- serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
355
- }
356
- json[serializedKey] = snapshot.hasMany(attr, {
357
- ids: true
358
- });
359
- } else if (this.hasSerializeRecordsOption(attr)) {
360
- this._serializeEmbeddedHasMany(snapshot, json, relationship);
361
- } else {
362
- if (this.hasSerializeIdsAndTypesOption(attr)) {
363
- this._serializeHasManyAsIdsAndTypes(snapshot, json, relationship);
364
- }
365
- }
366
- },
367
- /*
368
- Serializes a hasMany relationship as an array of objects containing only `id` and `type`
369
- keys.
370
- This has its use case on polymorphic hasMany relationships where the server is not storing
371
- all records in the same table using STI, and therefore the `id` is not enough information
372
- TODO: Make the default in Ember-data 3.0??
373
- */
374
- _serializeHasManyAsIdsAndTypes(snapshot, json, relationship) {
375
- let serializedKey = this.keyForAttribute(relationship.key, 'serialize');
376
- let hasMany = snapshot.hasMany(relationship.key);
377
- json[serializedKey] = A(hasMany).map(function (recordSnapshot) {
378
- //
379
- // I'm sure I'm being utterly naive here. Probably id is a configurable property and
380
- // type too, and the modelName has to be normalized somehow.
381
- //
382
- return {
383
- id: recordSnapshot.id,
384
- type: recordSnapshot.modelName
385
- };
386
- });
387
- },
388
- _serializeEmbeddedHasMany(snapshot, json, relationship) {
389
- let schema = this.store.modelFor(snapshot.modelName);
390
- let serializedKey = this._getMappedKey(relationship.key, schema);
391
- if (serializedKey === relationship.key && this.keyForRelationship) {
392
- serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
393
- }
394
- warn(`The embedded relationship '${serializedKey}' is undefined for '${snapshot.modelName}' with id '${snapshot.id}'. Please include it in your original payload.`, typeof snapshot.hasMany(relationship.key) !== 'undefined', {
395
- id: 'ds.serializer.embedded-relationship-undefined'
396
- });
397
- json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
398
- },
399
- /*
400
- Returns an array of embedded records serialized to JSON
401
- */
402
- _generateSerializedHasMany(snapshot, relationship) {
403
- let hasMany = snapshot.hasMany(relationship.key);
404
- let manyArray = A(hasMany);
405
- let ret = new Array(manyArray.length);
406
- for (let i = 0; i < manyArray.length; i++) {
407
- let embeddedSnapshot = manyArray[i];
408
- let embeddedJson = embeddedSnapshot.serialize({
409
- includeId: true
410
- });
411
- this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
412
- ret[i] = embeddedJson;
413
- }
414
- return ret;
415
- },
416
- /**
417
- When serializing an embedded record, modify the property (in the `JSON` payload)
418
- that refers to the parent record (foreign key for the relationship).
419
- Serializing a `belongsTo` relationship removes the property that refers to the
420
- parent record
421
- Serializing a `hasMany` relationship does not remove the property that refers to
422
- the parent record.
423
- @method removeEmbeddedForeignKey
424
- @public
425
- @param {Snapshot} snapshot
426
- @param {Snapshot} embeddedSnapshot
427
- @param {Object} relationship
428
- @param {Object} json
429
- */
430
- removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json) {
431
- if (relationship.kind === 'belongsTo') {
432
- let schema = this.store.modelFor(snapshot.modelName);
433
- let parentRecord = schema.inverseFor(relationship.key, this.store);
434
- if (parentRecord) {
435
- let name = parentRecord.name;
436
- let embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
437
- let parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
438
- if (parentKey) {
439
- delete json[parentKey];
440
- }
441
- }
442
- } /*else if (relationship.kind === 'hasMany') {
443
- return;
444
- }*/
445
- },
446
-
447
- // checks config for attrs option to embedded (always) - serialize and deserialize
448
- hasEmbeddedAlwaysOption(attr) {
449
- let option = this.attrsOption(attr);
450
- return option && option.embedded === 'always';
451
- },
452
- // checks config for attrs option to serialize ids
453
- hasSerializeRecordsOption(attr) {
454
- let alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
455
- let option = this.attrsOption(attr);
456
- return alwaysEmbed || option && option.serialize === 'records';
457
- },
458
- // checks config for attrs option to serialize records
459
- hasSerializeIdsOption(attr) {
460
- let option = this.attrsOption(attr);
461
- return option && (option.serialize === 'ids' || option.serialize === 'id');
462
- },
463
- // checks config for attrs option to serialize records as objects containing id and types
464
- hasSerializeIdsAndTypesOption(attr) {
465
- let option = this.attrsOption(attr);
466
- return option && (option.serialize === 'ids-and-types' || option.serialize === 'id-and-type');
467
- },
468
- // checks config for attrs option to serialize records
469
- noSerializeOptionSpecified(attr) {
470
- let option = this.attrsOption(attr);
471
- return !(option && (option.serialize || option.embedded));
472
- },
473
- // checks config for attrs option to deserialize records
474
- // a defined option object for a resource is treated the same as
475
- // `deserialize: 'records'`
476
- hasDeserializeRecordsOption(attr) {
477
- let alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
478
- let option = this.attrsOption(attr);
479
- return alwaysEmbed || option && option.deserialize === 'records';
480
- },
481
- attrsOption(attr) {
482
- let attrs = this.attrs;
483
- return attrs && (attrs[camelize(attr)] || attrs[attr]);
484
- },
485
- /**
486
- @method _extractEmbeddedRecords
487
- @private
488
- */
489
- _extractEmbeddedRecords(serializer, store, typeClass, partial) {
490
- typeClass.eachRelationship((key, relationship) => {
491
- if (serializer.hasDeserializeRecordsOption(key)) {
492
- if (relationship.kind === 'hasMany') {
493
- this._extractEmbeddedHasMany(store, key, partial, relationship);
494
- }
495
- if (relationship.kind === 'belongsTo') {
496
- this._extractEmbeddedBelongsTo(store, key, partial, relationship);
497
- }
498
- }
499
- });
500
- return partial;
501
- },
502
- /**
503
- @method _extractEmbeddedHasMany
504
- @private
505
- */
506
- _extractEmbeddedHasMany(store, key, hash, relationshipMeta) {
507
- let relationshipHash = hash.data?.relationships?.[key]?.data;
508
- if (!relationshipHash) {
509
- return;
510
- }
511
- let hasMany = new Array(relationshipHash.length);
512
- for (let i = 0; i < relationshipHash.length; i++) {
513
- let item = relationshipHash[i];
514
- let {
515
- data,
516
- included
517
- } = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
518
- hash.included = hash.included || [];
519
- hash.included.push(data);
520
- if (included) {
521
- hash.included = hash.included.concat(included);
522
- }
523
- hasMany[i] = {
524
- id: data.id,
525
- type: data.type
526
- };
527
- }
528
- let relationship = {
529
- data: hasMany
530
- };
531
- hash.data.relationships[key] = relationship;
532
- },
533
- /**
534
- @method _extractEmbeddedBelongsTo
535
- @private
536
- */
537
- _extractEmbeddedBelongsTo(store, key, hash, relationshipMeta) {
538
- let relationshipHash = hash.data?.relationships?.[key]?.data;
539
- if (!relationshipHash) {
540
- return;
541
- }
542
- let {
543
- data,
544
- included
545
- } = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
546
- hash.included = hash.included || [];
547
- hash.included.push(data);
548
- if (included) {
549
- hash.included = hash.included.concat(included);
550
- }
551
- let belongsTo = {
552
- id: data.id,
553
- type: data.type
554
- };
555
- let relationship = {
556
- data: belongsTo
557
- };
558
- hash.data.relationships[key] = relationship;
559
- },
560
- /**
561
- @method _normalizeEmbeddedRelationship
562
- @private
563
- */
564
- _normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash) {
565
- let modelName = relationshipMeta.type;
566
- if (relationshipMeta.options.polymorphic) {
567
- modelName = relationshipHash.type;
568
- }
569
- let modelClass = store.modelFor(modelName);
570
- let serializer = store.serializerFor(modelName);
571
- return serializer.normalize(modelClass, relationshipHash, null);
572
- },
573
- isEmbeddedRecordsMixin: true
574
- });
575
- export { embeddedRecordsMixin as e };
@@ -1 +0,0 @@
1
- {"version":3,"file":"embedded-records-mixin-d75385ff.js","sources":["../src/-private/embedded-records-mixin.js"],"sourcesContent":["import { A } from '@ember/array';\nimport { warn } from '@ember/debug';\nimport Mixin from '@ember/object/mixin';\nimport { camelize } from '@ember/string';\n\n/**\n @module @ember-data/serializer/rest\n*/\n\n/**\n ## Using Embedded Records\n\n `EmbeddedRecordsMixin` supports serializing embedded records.\n\n To set up embedded records, include the mixin when extending a serializer,\n then define and configure embedded (model) relationships.\n\n Note that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.\n\n Note also that this mixin does not work with JSONAPISerializer because the JSON:API specification does not describe how to format embedded resources.\n\n Below is an example of a per-type serializer (`post` type).\n\n ```app/serializers/post.js\n import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\n export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n author: { embedded: 'always' },\n comments: { serialize: 'ids' }\n }\n }\n ```\n Note that this use of `{ embedded: 'always' }` is unrelated to\n the `{ embedded: 'always' }` that is defined as an option on `attr` as part of\n defining a model while working with the `ActiveModelSerializer`. Nevertheless,\n using `{ embedded: 'always' }` as an option to `attr` is not a valid way to set up\n embedded records.\n\n The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:\n\n ```js\n {\n serialize: 'records',\n deserialize: 'records'\n }\n ```\n\n ### Configuring Attrs\n\n A resource's `attrs` option may be set to use `ids`, `records` or false for the\n `serialize` and `deserialize` settings.\n\n The `attrs` property can be set on the `ApplicationSerializer` or a per-type\n serializer.\n\n In the case where embedded JSON is expected while extracting a payload (reading)\n the setting is `deserialize: 'records'`, there is no need to use `ids` when\n extracting as that is the default behaviour without this mixin if you are using\n the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while\n serializing `serialize: 'records'` is the setting to use. There is an option of\n not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you\n do not want the relationship sent at all, you can use `serialize: false`.\n\n\n ### EmbeddedRecordsMixin defaults\n If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`\n will behave in the following way:\n\n BelongsTo: `{ serialize: 'id', deserialize: 'id' }`\n HasMany: `{ serialize: false, deserialize: 'ids' }`\n\n ### Model Relationships\n\n Embedded records must have a model defined to be extracted and serialized. Note that\n when defining any relationships on your model such as `belongsTo` and `hasMany`, you\n should not both specify `async: true` and also indicate through the serializer's\n `attrs` attribute that the related model should be embedded for deserialization.\n If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),\n then do not use `async: true`.\n\n To successfully extract and serialize embedded records the model relationships\n must be set up correctly. See the\n [defining relationships](https://guides.emberjs.com/current/models/relationships)\n section of the **Defining Models** guide page.\n\n Records without an `id` property are not considered embedded records, model\n instances must have an `id` property to be used with Ember Data.\n\n ### Example JSON payloads, Models and Serializers\n\n **When customizing a serializer it is important to grok what the customizations\n are. Please read the docs for the methods this mixin provides, in case you need\n to modify it to fit your specific needs.**\n\n For example, review the docs for each method of this mixin:\n * [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)\n * [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)\n * [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)\n\n @class EmbeddedRecordsMixin\n @public\n*/\nexport default Mixin.create({\n /**\n Normalize the record and recursively normalize/extract all the embedded records\n while pushing them into the store as they are encountered\n\n A payload with an attr configured for embedded records needs to be extracted:\n\n ```js\n {\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n }\n ```\n @method normalize\n @public\n @param {Model} typeClass\n @param {Object} hash to be normalized\n @param {String} prop the hash has been referenced by\n @return {Object} the normalized hash\n **/\n normalize(typeClass, hash, prop) {\n let normalizedHash = this._super(typeClass, hash, prop);\n return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);\n },\n\n keyForRelationship(key, typeClass, method) {\n if (\n (method === 'serialize' && this.hasSerializeRecordsOption(key)) ||\n (method === 'deserialize' && this.hasDeserializeRecordsOption(key))\n ) {\n return this.keyForAttribute(key, method);\n } else {\n return this._super(key, typeClass, method) || key;\n }\n },\n\n /**\n Serialize `belongsTo` relationship when it is configured as an embedded object.\n\n This example of an author model belongs to a post model:\n\n ```js\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n Post = Model.extend({\n title: attr('string'),\n body: attr('string'),\n author: belongsTo('author')\n });\n\n Author = Model.extend({\n name: attr('string'),\n post: belongsTo('post')\n });\n ```\n\n Use a custom (type) serializer for the post model to configure embedded author\n\n ```app/serializers/post.js\n import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\n export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n author: { embedded: 'always' }\n }\n }\n ```\n\n A payload with an attribute configured for embedded records can serialize\n the records together under the root attribute's payload:\n\n ```js\n {\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"author\": {\n \"id\": \"2\"\n \"name\": \"dhh\"\n }\n }\n }\n ```\n\n @method serializeBelongsTo\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializeBelongsTo(snapshot, json, relationship) {\n let attr = relationship.key;\n if (this.noSerializeOptionSpecified(attr)) {\n this._super(snapshot, json, relationship);\n return;\n }\n let includeIds = this.hasSerializeIdsOption(attr);\n let includeRecords = this.hasSerializeRecordsOption(attr);\n let embeddedSnapshot = snapshot.belongsTo(attr);\n if (includeIds) {\n let schema = this.store.modelFor(snapshot.modelName);\n let serializedKey = this._getMappedKey(relationship.key, schema);\n if (serializedKey === relationship.key && this.keyForRelationship) {\n serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');\n }\n\n if (!embeddedSnapshot) {\n json[serializedKey] = null;\n } else {\n json[serializedKey] = embeddedSnapshot.id;\n\n if (relationship.options.polymorphic) {\n this.serializePolymorphicType(snapshot, json, relationship);\n }\n }\n } else if (includeRecords) {\n this._serializeEmbeddedBelongsTo(snapshot, json, relationship);\n }\n },\n\n _serializeEmbeddedBelongsTo(snapshot, json, relationship) {\n let embeddedSnapshot = snapshot.belongsTo(relationship.key);\n let schema = this.store.modelFor(snapshot.modelName);\n let serializedKey = this._getMappedKey(relationship.key, schema);\n if (serializedKey === relationship.key && this.keyForRelationship) {\n serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');\n }\n\n if (!embeddedSnapshot) {\n json[serializedKey] = null;\n } else {\n json[serializedKey] = embeddedSnapshot.serialize({ includeId: true });\n this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);\n\n if (relationship.options.polymorphic) {\n this.serializePolymorphicType(snapshot, json, relationship);\n }\n }\n },\n\n /**\n Serializes `hasMany` relationships when it is configured as embedded objects.\n\n This example of a post model has many comments:\n\n ```js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n Post = Model.extend({\n title: attr('string'),\n body: attr('string'),\n comments: hasMany('comment')\n });\n\n Comment = Model.extend({\n body: attr('string'),\n post: belongsTo('post')\n });\n ```\n\n Use a custom (type) serializer for the post model to configure embedded comments\n\n ```app/serializers/post.js\n import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\n export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n comments: { embedded: 'always' }\n }\n }\n ```\n\n A payload with an attribute configured for embedded records can serialize\n the records together under the root attribute's payload:\n\n ```js\n {\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n }\n ```\n\n The attrs options object can use more specific instruction for extracting and\n serializing. When serializing, an option to embed `ids`, `ids-and-types` or `records` can be set.\n When extracting the only option is `records`.\n\n So `{ embedded: 'always' }` is shorthand for:\n `{ serialize: 'records', deserialize: 'records' }`\n\n To embed the `ids` for a related object (using a hasMany relationship):\n\n ```app/serializers/post.js\n import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\n export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n comments: { serialize: 'ids', deserialize: 'records' }\n }\n }\n ```\n\n ```js\n {\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [\"1\", \"2\"]\n }\n }\n ```\n\n To embed the relationship as a collection of objects with `id` and `type` keys, set\n `ids-and-types` for the related object.\n\n This is particularly useful for polymorphic relationships where records don't share\n the same table and the `id` is not enough information.\n\n For example having a user that has many pets:\n\n ```js\n User = Model.extend({\n name: attr('string'),\n pets: hasMany('pet', { polymorphic: true })\n });\n\n Pet = Model.extend({\n name: attr('string'),\n });\n\n Cat = Pet.extend({\n // ...\n });\n\n Parrot = Pet.extend({\n // ...\n });\n ```\n\n ```app/serializers/user.js\n import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\n export default class UserSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n pets: { serialize: 'ids-and-types', deserialize: 'records' }\n }\n }\n ```\n\n ```js\n {\n \"user\": {\n \"id\": \"1\"\n \"name\": \"Bertin Osborne\",\n \"pets\": [\n { \"id\": \"1\", \"type\": \"Cat\" },\n { \"id\": \"1\", \"type\": \"Parrot\"}\n ]\n }\n }\n ```\n\n @method serializeHasMany\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializeHasMany(snapshot, json, relationship) {\n let attr = relationship.key;\n if (this.noSerializeOptionSpecified(attr)) {\n this._super(snapshot, json, relationship);\n return;\n }\n\n if (this.hasSerializeIdsOption(attr)) {\n let schema = this.store.modelFor(snapshot.modelName);\n let serializedKey = this._getMappedKey(relationship.key, schema);\n if (serializedKey === relationship.key && this.keyForRelationship) {\n serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');\n }\n\n json[serializedKey] = snapshot.hasMany(attr, { ids: true });\n } else if (this.hasSerializeRecordsOption(attr)) {\n this._serializeEmbeddedHasMany(snapshot, json, relationship);\n } else {\n if (this.hasSerializeIdsAndTypesOption(attr)) {\n this._serializeHasManyAsIdsAndTypes(snapshot, json, relationship);\n }\n }\n },\n\n /*\n Serializes a hasMany relationship as an array of objects containing only `id` and `type`\n keys.\n This has its use case on polymorphic hasMany relationships where the server is not storing\n all records in the same table using STI, and therefore the `id` is not enough information\n\n TODO: Make the default in Ember-data 3.0??\n */\n _serializeHasManyAsIdsAndTypes(snapshot, json, relationship) {\n let serializedKey = this.keyForAttribute(relationship.key, 'serialize');\n let hasMany = snapshot.hasMany(relationship.key);\n\n json[serializedKey] = A(hasMany).map(function (recordSnapshot) {\n //\n // I'm sure I'm being utterly naive here. Probably id is a configurable property and\n // type too, and the modelName has to be normalized somehow.\n //\n return { id: recordSnapshot.id, type: recordSnapshot.modelName };\n });\n },\n\n _serializeEmbeddedHasMany(snapshot, json, relationship) {\n let schema = this.store.modelFor(snapshot.modelName);\n let serializedKey = this._getMappedKey(relationship.key, schema);\n if (serializedKey === relationship.key && this.keyForRelationship) {\n serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');\n }\n\n warn(\n `The embedded relationship '${serializedKey}' is undefined for '${snapshot.modelName}' with id '${snapshot.id}'. Please include it in your original payload.`,\n typeof snapshot.hasMany(relationship.key) !== 'undefined',\n { id: 'ds.serializer.embedded-relationship-undefined' }\n );\n\n json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);\n },\n\n /*\n Returns an array of embedded records serialized to JSON\n */\n _generateSerializedHasMany(snapshot, relationship) {\n let hasMany = snapshot.hasMany(relationship.key);\n let manyArray = A(hasMany);\n let ret = new Array(manyArray.length);\n\n for (let i = 0; i < manyArray.length; i++) {\n let embeddedSnapshot = manyArray[i];\n let embeddedJson = embeddedSnapshot.serialize({ includeId: true });\n this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);\n ret[i] = embeddedJson;\n }\n\n return ret;\n },\n\n /**\n When serializing an embedded record, modify the property (in the `JSON` payload)\n that refers to the parent record (foreign key for the relationship).\n\n Serializing a `belongsTo` relationship removes the property that refers to the\n parent record\n\n Serializing a `hasMany` relationship does not remove the property that refers to\n the parent record.\n\n @method removeEmbeddedForeignKey\n @public\n @param {Snapshot} snapshot\n @param {Snapshot} embeddedSnapshot\n @param {Object} relationship\n @param {Object} json\n */\n removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json) {\n if (relationship.kind === 'belongsTo') {\n let schema = this.store.modelFor(snapshot.modelName);\n let parentRecord = schema.inverseFor(relationship.key, this.store);\n if (parentRecord) {\n let name = parentRecord.name;\n let embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);\n let parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');\n if (parentKey) {\n delete json[parentKey];\n }\n }\n } /*else if (relationship.kind === 'hasMany') {\n return;\n }*/\n },\n\n // checks config for attrs option to embedded (always) - serialize and deserialize\n hasEmbeddedAlwaysOption(attr) {\n let option = this.attrsOption(attr);\n return option && option.embedded === 'always';\n },\n\n // checks config for attrs option to serialize ids\n hasSerializeRecordsOption(attr) {\n let alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);\n let option = this.attrsOption(attr);\n return alwaysEmbed || (option && option.serialize === 'records');\n },\n\n // checks config for attrs option to serialize records\n hasSerializeIdsOption(attr) {\n let option = this.attrsOption(attr);\n return option && (option.serialize === 'ids' || option.serialize === 'id');\n },\n\n // checks config for attrs option to serialize records as objects containing id and types\n hasSerializeIdsAndTypesOption(attr) {\n let option = this.attrsOption(attr);\n return option && (option.serialize === 'ids-and-types' || option.serialize === 'id-and-type');\n },\n\n // checks config for attrs option to serialize records\n noSerializeOptionSpecified(attr) {\n let option = this.attrsOption(attr);\n return !(option && (option.serialize || option.embedded));\n },\n\n // checks config for attrs option to deserialize records\n // a defined option object for a resource is treated the same as\n // `deserialize: 'records'`\n hasDeserializeRecordsOption(attr) {\n let alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);\n let option = this.attrsOption(attr);\n return alwaysEmbed || (option && option.deserialize === 'records');\n },\n\n attrsOption(attr) {\n let attrs = this.attrs;\n return attrs && (attrs[camelize(attr)] || attrs[attr]);\n },\n\n /**\n @method _extractEmbeddedRecords\n @private\n */\n _extractEmbeddedRecords(serializer, store, typeClass, partial) {\n typeClass.eachRelationship((key, relationship) => {\n if (serializer.hasDeserializeRecordsOption(key)) {\n if (relationship.kind === 'hasMany') {\n this._extractEmbeddedHasMany(store, key, partial, relationship);\n }\n if (relationship.kind === 'belongsTo') {\n this._extractEmbeddedBelongsTo(store, key, partial, relationship);\n }\n }\n });\n return partial;\n },\n\n /**\n @method _extractEmbeddedHasMany\n @private\n */\n _extractEmbeddedHasMany(store, key, hash, relationshipMeta) {\n let relationshipHash = hash.data?.relationships?.[key]?.data;\n\n if (!relationshipHash) {\n return;\n }\n\n let hasMany = new Array(relationshipHash.length);\n\n for (let i = 0; i < relationshipHash.length; i++) {\n let item = relationshipHash[i];\n let { data, included } = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);\n hash.included = hash.included || [];\n hash.included.push(data);\n if (included) {\n hash.included = hash.included.concat(included);\n }\n\n hasMany[i] = { id: data.id, type: data.type };\n }\n\n let relationship = { data: hasMany };\n hash.data.relationships[key] = relationship;\n },\n\n /**\n @method _extractEmbeddedBelongsTo\n @private\n */\n _extractEmbeddedBelongsTo(store, key, hash, relationshipMeta) {\n let relationshipHash = hash.data?.relationships?.[key]?.data;\n if (!relationshipHash) {\n return;\n }\n\n let { data, included } = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);\n hash.included = hash.included || [];\n hash.included.push(data);\n if (included) {\n hash.included = hash.included.concat(included);\n }\n\n let belongsTo = { id: data.id, type: data.type };\n let relationship = { data: belongsTo };\n\n hash.data.relationships[key] = relationship;\n },\n\n /**\n @method _normalizeEmbeddedRelationship\n @private\n */\n _normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash) {\n let modelName = relationshipMeta.type;\n if (relationshipMeta.options.polymorphic) {\n modelName = relationshipHash.type;\n }\n let modelClass = store.modelFor(modelName);\n let serializer = store.serializerFor(modelName);\n\n return serializer.normalize(modelClass, relationshipHash, null);\n },\n isEmbeddedRecordsMixin: true,\n});\n"],"names":["Mixin","create","normalize","typeClass","hash","prop","normalizedHash","_super","_extractEmbeddedRecords","store","keyForRelationship","key","method","hasSerializeRecordsOption","hasDeserializeRecordsOption","keyForAttribute","serializeBelongsTo","snapshot","json","relationship","attr","noSerializeOptionSpecified","includeIds","hasSerializeIdsOption","includeRecords","embeddedSnapshot","belongsTo","schema","modelFor","modelName","serializedKey","_getMappedKey","kind","id","options","polymorphic","serializePolymorphicType","_serializeEmbeddedBelongsTo","serialize","includeId","removeEmbeddedForeignKey","serializeHasMany","hasMany","ids","_serializeEmbeddedHasMany","hasSerializeIdsAndTypesOption","_serializeHasManyAsIdsAndTypes","A","map","recordSnapshot","type","warn","_generateSerializedHasMany","manyArray","ret","Array","length","i","embeddedJson","parentRecord","inverseFor","name","embeddedSerializer","serializerFor","parentKey","hasEmbeddedAlwaysOption","option","attrsOption","embedded","alwaysEmbed","deserialize","attrs","camelize","serializer","partial","eachRelationship","_extractEmbeddedHasMany","_extractEmbeddedBelongsTo","relationshipMeta","relationshipHash","data","relationships","item","included","_normalizeEmbeddedRelationship","push","concat","modelClass","isEmbeddedRecordsMixin"],"mappings":";;;;;AAKA;AACA;AACA;;AAEA;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,2BAAeA,KAAK,CAACC,MAAM,CAAC;AAC1B;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;AAGEC,EAAAA,SAASA,CAACC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAE;IAC/B,IAAIC,cAAc,GAAG,IAAI,CAACC,MAAM,CAACJ,SAAS,EAAEC,IAAI,EAAEC,IAAI,CAAC,CAAA;AACvD,IAAA,OAAO,IAAI,CAACG,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,EAAEN,SAAS,EAAEG,cAAc,CAAC,CAAA;GACjF;AAEDI,EA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B,EAAE;AACjEoB,MAAAA,aAAa,GAAG,IAAI,CAACpB,kBAAkB,CAACS,YAAY,CAACR,GAAG,EAAEQ,YAAY,CAACa,IAAI,EAAE,WAAW,CAAC,CAAA;AAC3F,KAAA;IAEA,IAAI,CAACP,gBAAgB,EAAE;AACrBP,MAAAA,IAAI,CAACY,aAAa,CAAC,GAAG,IAAI,CAAA;AAC5B,KAAC,MAAM;AACLZ,MAAAA,IAAI,CAACY,aAAa,CAAC,GAAGL,gBAAgB,CAACa,SAAS,CAAC;AAAEC,QAAAA,SAAS,EAAE,IAAA;AAAK,OAAC,CAAC,CAAA;AACrE,MAAA,IAAI,CAACC,wBAAwB,CAACvB,QAAQ,EAAEQ,gBAAgB,EAAEN,YAAY,EAAED,IAAI,CAACY,aAAa,CAAC,CAAC,CAAA;AAE5F,MAAA,IAAIX,YAAY,CAACe,OAAO,CAACC,WAAW,EAAE;QACpC,IAAI,CAACC,wBAAwB,CAACnB,QAAQ,EAAEC,IAAI,EAAEC,YAAY,CAAC,CAAA;AAC7D,OAAA;AACF,KAAA;GACD;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;AA2BEsB,EAAAA,gBAAgBA,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