@ember-data-mirror/serializer 5.4.0-alpha.63 → 5.4.0-alpha.70

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