@ember-data-mirror/serializer 5.6.0-beta.0 → 5.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon-main.cjs +1 -1
- package/dist/index.js +1 -306
- package/dist/json-api.js +1 -531
- package/dist/json.js +1 -6
- package/dist/rest.js +1 -1274
- package/dist/transform.js +1 -336
- package/package.json +7 -24
- package/unstable-preview-types/index.d.ts +81 -243
- package/unstable-preview-types/json-api.d.ts +2 -512
- package/unstable-preview-types/json.d.ts +2 -1091
- package/unstable-preview-types/rest.d.ts +2 -568
- package/unstable-preview-types/transform.d.ts +3 -10
- package/dist/index.js.map +0 -1
- package/dist/json-CVTR4xWv.js +0 -1396
- package/dist/json-CVTR4xWv.js.map +0 -1
- package/dist/json-api.js.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/rest.js.map +0 -1
- package/dist/transform.js.map +0 -1
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts +0 -102
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/boolean.d.ts +0 -52
- package/unstable-preview-types/-private/transforms/boolean.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts +0 -4
- package/unstable-preview-types/-private/transforms/boolean.type-test.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/date.d.ts +0 -33
- package/unstable-preview-types/-private/transforms/date.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/number.d.ts +0 -34
- package/unstable-preview-types/-private/transforms/number.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/string.d.ts +0 -34
- package/unstable-preview-types/-private/transforms/string.d.ts.map +0 -1
- package/unstable-preview-types/-private/transforms/transform.d.ts +0 -126
- package/unstable-preview-types/-private/transforms/transform.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils.d.ts +0 -6
- package/unstable-preview-types/-private/utils.d.ts.map +0 -1
- package/unstable-preview-types/index.d.ts.map +0 -1
- package/unstable-preview-types/json-api.d.ts.map +0 -1
- package/unstable-preview-types/json.d.ts.map +0 -1
- package/unstable-preview-types/rest.d.ts.map +0 -1
- package/unstable-preview-types/transform.d.ts.map +0 -1
|
@@ -1,570 +1,4 @@
|
|
|
1
1
|
declare module '@ember-data-mirror/serializer/rest' {
|
|
2
|
-
export { EmbeddedRecordsMixin } from "
|
|
3
|
-
export default RESTSerializer;
|
|
4
|
-
/**
|
|
5
|
-
* <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
|
|
6
|
-
<p>
|
|
7
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
8
|
-
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
9
|
-
<a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
|
|
10
|
-
</p>
|
|
11
|
-
</blockquote>
|
|
2
|
+
export { RESTSerializer as default, EmbeddedRecordsMixin } from "@warp-drive-mirror/legacy/serializer/rest";
|
|
12
3
|
|
|
13
|
-
|
|
14
|
-
the `normalize` method.
|
|
15
|
-
|
|
16
|
-
This allows you to do whatever kind of munging you need and is
|
|
17
|
-
especially useful if your server is inconsistent and you need to
|
|
18
|
-
do munging differently for many different kinds of responses.
|
|
19
|
-
|
|
20
|
-
See the `normalize` documentation for more information.
|
|
21
|
-
|
|
22
|
-
## Across the Board Normalization
|
|
23
|
-
|
|
24
|
-
There are also a number of hooks that you might find useful to define
|
|
25
|
-
across-the-board rules for your payload. These rules will be useful
|
|
26
|
-
if your server is consistent, or if you're building an adapter for
|
|
27
|
-
an infrastructure service, like Firebase, and want to encode service
|
|
28
|
-
conventions.
|
|
29
|
-
|
|
30
|
-
For example, if all of your keys are underscored and all-caps, but
|
|
31
|
-
otherwise consistent with the names you use in your models, you
|
|
32
|
-
can implement across-the-board rules for how to convert an attribute
|
|
33
|
-
name in your model to a key in your JSON.
|
|
34
|
-
|
|
35
|
-
```app/serializers/application.js
|
|
36
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
37
|
-
import { underscore } from '<app-name>/utils/string-utils';
|
|
38
|
-
|
|
39
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
40
|
-
keyForAttribute(attr, method) {
|
|
41
|
-
return underscore(attr).toUpperCase();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can also implement `keyForRelationship`, which takes the name
|
|
47
|
-
of the relationship as the first parameter, the kind of
|
|
48
|
-
relationship (`hasMany` or `belongsTo`) as the second parameter, and
|
|
49
|
-
the method (`serialize` or `deserialize`) as the third parameter.
|
|
50
|
-
|
|
51
|
-
@class RESTSerializer
|
|
52
|
-
@main @ember-data-mirror/serializer/rest
|
|
53
|
-
@public
|
|
54
|
-
@extends JSONSerializer
|
|
55
|
-
*/
|
|
56
|
-
const RESTSerializer: Readonly<Readonly<typeof import("@ember-data-mirror/serializer").default> & (new (owner?: import("@ember/-internals/owner").default) => import(".").default) & {
|
|
57
|
-
primaryKey: string;
|
|
58
|
-
mergedProperties: Object;
|
|
59
|
-
applyTransforms(typeClass: Model, data: Object): Object;
|
|
60
|
-
normalizeResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
61
|
-
normalizeFindRecordResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
62
|
-
normalizeQueryRecordResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
63
|
-
normalizeFindAllResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
64
|
-
normalizeFindBelongsToResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
65
|
-
normalizeFindHasManyResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
66
|
-
normalizeFindManyResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
67
|
-
normalizeQueryResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
68
|
-
normalizeCreateRecordResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
69
|
-
normalizeDeleteRecordResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
70
|
-
normalizeUpdateRecordResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
71
|
-
normalizeSaveResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, ...args: any[]): Object;
|
|
72
|
-
normalizeSingleResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string): Object;
|
|
73
|
-
normalizeArrayResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string): Object;
|
|
74
|
-
_normalizeResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, isSingle: boolean): Object;
|
|
75
|
-
normalize(modelClass: any, resourceHash: any): Object;
|
|
76
|
-
extractId(modelClass: Object, resourceHash: Object): string;
|
|
77
|
-
extractAttributes(modelClass: Object, resourceHash: Object): Object;
|
|
78
|
-
extractRelationship(relationshipModelName: Object, relationshipHash: Object): Object;
|
|
79
|
-
extractPolymorphicRelationship(relationshipModelName: Object, relationshipHash: Object, relationshipOptions: Object): Object;
|
|
80
|
-
extractRelationships(modelClass: Object, resourceHash: Object): Object;
|
|
81
|
-
modelNameFromPayloadKey(key: string): string;
|
|
82
|
-
normalizeRelationships(typeClass: any, hash: any): void;
|
|
83
|
-
normalizeUsingDeclaredMapping(modelClass: any, hash: any): void;
|
|
84
|
-
_getMappedKey(key: string, modelClass: any): string;
|
|
85
|
-
_canSerialize(key: string): boolean;
|
|
86
|
-
_mustSerialize(key: string): boolean;
|
|
87
|
-
shouldSerializeHasMany(snapshot: Snapshot, key: string, relationship: RelationshipSchema): boolean;
|
|
88
|
-
serialize(snapshot: Snapshot, options: Object): Object;
|
|
89
|
-
serializeIntoHash(hash: Object, typeClass: Model, snapshot: Snapshot, options: Object): void;
|
|
90
|
-
serializeAttribute(snapshot: Snapshot, json: Object, key: string, attribute: Object): void;
|
|
91
|
-
serializeBelongsTo(snapshot: Snapshot, json: Object, relationship: Object): void;
|
|
92
|
-
serializeHasMany(snapshot: Snapshot, json: Object, relationship: Object): void;
|
|
93
|
-
serializePolymorphicType(): void;
|
|
94
|
-
extractMeta(store: Store, modelClass: Model, payload: Object): any;
|
|
95
|
-
extractErrors(store: Store, typeClass: Model, payload: Object, id: (string | number)): Object;
|
|
96
|
-
keyForAttribute(key: string, method: string): string;
|
|
97
|
-
keyForRelationship(key: string, typeClass: string, method: string): string;
|
|
98
|
-
keyForLink(key: string, kind: string): string;
|
|
99
|
-
transformFor(attributeType: string, skipAssertion: boolean): Transform;
|
|
100
|
-
}> & (new (owner?: import("@ember-data-mirror/serializer/@ember/-internals/owner").default) => import(".").default) & {
|
|
101
|
-
/**
|
|
102
|
-
`keyForPolymorphicType` can be used to define a custom key when
|
|
103
|
-
serializing and deserializing a polymorphic type. By default, the
|
|
104
|
-
returned key is `${key}Type`.
|
|
105
|
-
|
|
106
|
-
Example
|
|
107
|
-
|
|
108
|
-
```app/serializers/post.js
|
|
109
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
110
|
-
|
|
111
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
112
|
-
keyForPolymorphicType(key, relationship) {
|
|
113
|
-
let relationshipKey = this.keyForRelationship(key);
|
|
114
|
-
|
|
115
|
-
return 'type-' + relationshipKey;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
@method keyForPolymorphicType
|
|
121
|
-
@public
|
|
122
|
-
@param {String} key
|
|
123
|
-
@param {String} typeClass
|
|
124
|
-
@param {String} method
|
|
125
|
-
@return {String} normalized key
|
|
126
|
-
*/
|
|
127
|
-
keyForPolymorphicType(key: string, typeClass: string, method: string): string;
|
|
128
|
-
/**
|
|
129
|
-
Normalizes a part of the JSON payload returned by
|
|
130
|
-
the server. You should override this method, munge the hash
|
|
131
|
-
and call super if you have generic normalization to do.
|
|
132
|
-
|
|
133
|
-
It takes the type of the record that is being normalized
|
|
134
|
-
(as a Model class), the property where the hash was
|
|
135
|
-
originally found, and the hash to normalize.
|
|
136
|
-
|
|
137
|
-
For example, if you have a payload that looks like this:
|
|
138
|
-
|
|
139
|
-
```js
|
|
140
|
-
{
|
|
141
|
-
"post": {
|
|
142
|
-
"id": 1,
|
|
143
|
-
"title": "Rails is omakase",
|
|
144
|
-
"comments": [ 1, 2 ]
|
|
145
|
-
},
|
|
146
|
-
"comments": [{
|
|
147
|
-
"id": 1,
|
|
148
|
-
"body": "FIRST"
|
|
149
|
-
}, {
|
|
150
|
-
"id": 2,
|
|
151
|
-
"body": "Rails is unagi"
|
|
152
|
-
}]
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
The `normalize` method will be called three times:
|
|
157
|
-
|
|
158
|
-
* With `App.Post`, `"posts"` and `{ id: 1, title: "Rails is omakase", ... }`
|
|
159
|
-
* With `App.Comment`, `"comments"` and `{ id: 1, body: "FIRST" }`
|
|
160
|
-
* With `App.Comment`, `"comments"` and `{ id: 2, body: "Rails is unagi" }`
|
|
161
|
-
|
|
162
|
-
You can use this method, for example, to normalize underscored keys to camelized
|
|
163
|
-
or other general-purpose normalizations. You will only need to implement
|
|
164
|
-
`normalize` and manipulate the payload as desired.
|
|
165
|
-
|
|
166
|
-
For example, if the `IDs` under `"comments"` are provided as `_id` instead of
|
|
167
|
-
`id`, you can specify how to normalize just the comments:
|
|
168
|
-
|
|
169
|
-
```app/serializers/post.js
|
|
170
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
171
|
-
|
|
172
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
173
|
-
normalize(model, hash, prop) {
|
|
174
|
-
if (prop === 'comments') {
|
|
175
|
-
hash.id = hash._id;
|
|
176
|
-
delete hash._id;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return super.normalize(...arguments);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
On each call to the `normalize` method, the third parameter (`prop`) is always
|
|
185
|
-
one of the keys that were in the original payload or in the result of another
|
|
186
|
-
normalization as `normalizeResponse`.
|
|
187
|
-
|
|
188
|
-
@method normalize
|
|
189
|
-
@public
|
|
190
|
-
@param {Model} modelClass
|
|
191
|
-
@param {Object} resourceHash
|
|
192
|
-
@param {String} prop
|
|
193
|
-
@return {Object}
|
|
194
|
-
*/
|
|
195
|
-
/**
|
|
196
|
-
Normalizes an array of resource payloads and returns a JSON-API Document
|
|
197
|
-
with primary data and, if any, included data as `{ data, included }`.
|
|
198
|
-
|
|
199
|
-
@method _normalizeArray
|
|
200
|
-
@param {Store} store
|
|
201
|
-
@param {String} modelName
|
|
202
|
-
@param {Object} arrayHash
|
|
203
|
-
@param {String} prop
|
|
204
|
-
@return {Object}
|
|
205
|
-
@private
|
|
206
|
-
*/
|
|
207
|
-
_normalizeArray(store: Store, modelName: string, arrayHash: Object, prop: string): Object;
|
|
208
|
-
_normalizePolymorphicRecord(store: any, hash: any, prop: any, primaryModelClass: any, primarySerializer: any): any;
|
|
209
|
-
/**
|
|
210
|
-
@method _normalizeResponse
|
|
211
|
-
@param {Store} store
|
|
212
|
-
@param {Model} primaryModelClass
|
|
213
|
-
@param {Object} payload
|
|
214
|
-
@param {String|Number} id
|
|
215
|
-
@param {String} requestType
|
|
216
|
-
@param {Boolean} isSingle
|
|
217
|
-
@return {Object} JSON-API Document
|
|
218
|
-
@private
|
|
219
|
-
*/
|
|
220
|
-
_normalizeResponse(store: Store, primaryModelClass: Model, payload: Object, id: string | number, requestType: string, isSingle: boolean): Object;
|
|
221
|
-
isPrimaryType(store: any, modelName: any, primaryModelClass: any): boolean;
|
|
222
|
-
/**
|
|
223
|
-
This method allows you to push a payload containing top-level
|
|
224
|
-
collections of records organized per type.
|
|
225
|
-
|
|
226
|
-
```js
|
|
227
|
-
{
|
|
228
|
-
"posts": [{
|
|
229
|
-
"id": "1",
|
|
230
|
-
"title": "Rails is omakase",
|
|
231
|
-
"author", "1",
|
|
232
|
-
"comments": [ "1" ]
|
|
233
|
-
}],
|
|
234
|
-
"comments": [{
|
|
235
|
-
"id": "1",
|
|
236
|
-
"body": "FIRST"
|
|
237
|
-
}],
|
|
238
|
-
"users": [{
|
|
239
|
-
"id": "1",
|
|
240
|
-
"name": "@d2h"
|
|
241
|
-
}]
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
It will first normalize the payload, so you can use this to push
|
|
246
|
-
in data streaming in from your server structured the same way
|
|
247
|
-
that fetches and saves are structured.
|
|
248
|
-
|
|
249
|
-
@method pushPayload
|
|
250
|
-
@public
|
|
251
|
-
@param {Store} store
|
|
252
|
-
@param {Object} payload
|
|
253
|
-
*/
|
|
254
|
-
pushPayload(store: Store, payload: Object): void;
|
|
255
|
-
/**
|
|
256
|
-
This method is used to convert each JSON root key in the payload
|
|
257
|
-
into a modelName that it can use to look up the appropriate model for
|
|
258
|
-
that part of the payload.
|
|
259
|
-
|
|
260
|
-
For example, your server may send a model name that does not correspond with
|
|
261
|
-
the name of the model in your app. Let's take a look at an example model,
|
|
262
|
-
and an example payload:
|
|
263
|
-
|
|
264
|
-
```app/models/post.js
|
|
265
|
-
import Model from '@ember-data-mirror/model';
|
|
266
|
-
|
|
267
|
-
export default class Post extends Model {}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
```javascript
|
|
271
|
-
{
|
|
272
|
-
"blog/post": {
|
|
273
|
-
"id": "1
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
Ember Data is going to normalize the payload's root key for the modelName. As a result,
|
|
279
|
-
it will try to look up the "blog/post" model. Since we don't have a model called "blog/post"
|
|
280
|
-
(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error
|
|
281
|
-
because it cannot find the "blog/post" model.
|
|
282
|
-
|
|
283
|
-
Since we want to remove this namespace, we can define a serializer for the application that will
|
|
284
|
-
remove "blog/" from the payload key whenver it's encountered by Ember Data:
|
|
285
|
-
|
|
286
|
-
```app/serializers/application.js
|
|
287
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
288
|
-
|
|
289
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
290
|
-
modelNameFromPayloadKey(payloadKey) {
|
|
291
|
-
if (payloadKey === 'blog/post') {
|
|
292
|
-
return super.modelNameFromPayloadKey(payloadKey.replace('blog/', ''));
|
|
293
|
-
} else {
|
|
294
|
-
return super.modelNameFromPayloadKey(payloadKey);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
After refreshing, Ember Data will appropriately look up the "post" model.
|
|
301
|
-
|
|
302
|
-
By default the modelName for a model is its
|
|
303
|
-
name in dasherized form. This means that a payload key like "blogPost" would be
|
|
304
|
-
normalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data
|
|
305
|
-
can use the correct inflection to do this for you. Most of the time, you won't
|
|
306
|
-
need to override `modelNameFromPayloadKey` for this purpose.
|
|
307
|
-
|
|
308
|
-
@method modelNameFromPayloadKey
|
|
309
|
-
@public
|
|
310
|
-
@param {String} key
|
|
311
|
-
@return {String} the model's modelName
|
|
312
|
-
*/
|
|
313
|
-
modelNameFromPayloadKey(key: string): string;
|
|
314
|
-
/**
|
|
315
|
-
Called when a record is saved in order to convert the
|
|
316
|
-
record into JSON.
|
|
317
|
-
|
|
318
|
-
By default, it creates a JSON object with a key for
|
|
319
|
-
each attribute and belongsTo relationship.
|
|
320
|
-
|
|
321
|
-
For example, consider this model:
|
|
322
|
-
|
|
323
|
-
```app/models/comment.js
|
|
324
|
-
import Model, { attr, belongsTo } from '@ember-data-mirror/model';
|
|
325
|
-
|
|
326
|
-
export default class Comment extends Model {
|
|
327
|
-
@attr title
|
|
328
|
-
@attr body
|
|
329
|
-
|
|
330
|
-
@belongsTo('user') author
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
The default serialization would create a JSON object like:
|
|
335
|
-
|
|
336
|
-
```js
|
|
337
|
-
{
|
|
338
|
-
"title": "Rails is unagi",
|
|
339
|
-
"body": "Rails? Omakase? O_O",
|
|
340
|
-
"author": 12
|
|
341
|
-
}
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
By default, attributes are passed through as-is, unless
|
|
345
|
-
you specified an attribute type (`attr('date')`). If
|
|
346
|
-
you specify a transform, the JavaScript value will be
|
|
347
|
-
serialized when inserted into the JSON hash.
|
|
348
|
-
|
|
349
|
-
By default, belongs-to relationships are converted into
|
|
350
|
-
IDs when inserted into the JSON hash.
|
|
351
|
-
|
|
352
|
-
## IDs
|
|
353
|
-
|
|
354
|
-
`serialize` takes an options hash with a single option:
|
|
355
|
-
`includeId`. If this option is `true`, `serialize` will,
|
|
356
|
-
by default include the ID in the JSON object it builds.
|
|
357
|
-
|
|
358
|
-
The adapter passes in `includeId: true` when serializing
|
|
359
|
-
a record for `createRecord`, but not for `updateRecord`.
|
|
360
|
-
|
|
361
|
-
## Customization
|
|
362
|
-
|
|
363
|
-
Your server may expect a different JSON format than the
|
|
364
|
-
built-in serialization format.
|
|
365
|
-
|
|
366
|
-
In that case, you can implement `serialize` yourself and
|
|
367
|
-
return a JSON hash of your choosing.
|
|
368
|
-
|
|
369
|
-
```app/serializers/post.js
|
|
370
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
371
|
-
|
|
372
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
373
|
-
serialize(snapshot, options) {
|
|
374
|
-
let json = {
|
|
375
|
-
POST_TTL: snapshot.attr('title'),
|
|
376
|
-
POST_BDY: snapshot.attr('body'),
|
|
377
|
-
POST_CMS: snapshot.hasMany('comments', { ids: true })
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
if (options.includeId) {
|
|
381
|
-
json.POST_ID_ = snapshot.id;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return json;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
## Customizing an App-Wide Serializer
|
|
390
|
-
|
|
391
|
-
If you want to define a serializer for your entire
|
|
392
|
-
application, you'll probably want to use `eachAttribute`
|
|
393
|
-
and `eachRelationship` on the record.
|
|
394
|
-
|
|
395
|
-
```app/serializers/application.js
|
|
396
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
397
|
-
import { pluralize } from '<app-name>/utils/string-utils';
|
|
398
|
-
|
|
399
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
400
|
-
serialize(snapshot, options) {
|
|
401
|
-
let json = {};
|
|
402
|
-
|
|
403
|
-
snapshot.eachAttribute(function(name) {
|
|
404
|
-
json[serverAttributeName(name)] = snapshot.attr(name);
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
snapshot.eachRelationship(function(name, relationship) {
|
|
408
|
-
if (relationship.kind === 'hasMany') {
|
|
409
|
-
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
if (options.includeId) {
|
|
414
|
-
json.ID_ = snapshot.id;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
return json;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function serverAttributeName(attribute) {
|
|
422
|
-
return attribute.underscore().toUpperCase();
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function serverHasManyName(name) {
|
|
426
|
-
return serverAttributeName(singularize(name)) + "_IDS";
|
|
427
|
-
}
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
This serializer will generate JSON that looks like this:
|
|
431
|
-
|
|
432
|
-
```js
|
|
433
|
-
{
|
|
434
|
-
"TITLE": "Rails is omakase",
|
|
435
|
-
"BODY": "Yep. Omakase.",
|
|
436
|
-
"COMMENT_IDS": [ 1, 2, 3 ]
|
|
437
|
-
}
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
## Tweaking the Default JSON
|
|
441
|
-
|
|
442
|
-
If you just want to do some small tweaks on the default JSON,
|
|
443
|
-
you can call super first and make the tweaks on the returned
|
|
444
|
-
JSON.
|
|
445
|
-
|
|
446
|
-
```app/serializers/post.js
|
|
447
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
448
|
-
|
|
449
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
450
|
-
serialize(snapshot, options) {
|
|
451
|
-
let json = super.serialize(snapshot, options);
|
|
452
|
-
|
|
453
|
-
json.subject = json.title;
|
|
454
|
-
delete json.title;
|
|
455
|
-
|
|
456
|
-
return json;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
@method serialize
|
|
462
|
-
@public
|
|
463
|
-
@param {Snapshot} snapshot
|
|
464
|
-
@param {Object} options
|
|
465
|
-
@return {Object} json
|
|
466
|
-
*/
|
|
467
|
-
serialize(snapshot: Snapshot, options: Object, ...args: any[]): Object;
|
|
468
|
-
/**
|
|
469
|
-
You can use this method to customize the root keys serialized into the JSON.
|
|
470
|
-
The hash property should be modified by reference (possibly using something like _.extend)
|
|
471
|
-
By default the REST Serializer sends the modelName of a model, which is a camelized
|
|
472
|
-
version of the name.
|
|
473
|
-
|
|
474
|
-
For example, your server may expect underscored root objects.
|
|
475
|
-
|
|
476
|
-
```app/serializers/application.js
|
|
477
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
478
|
-
import { underscore } from '<app-name>/utils/string-utils';
|
|
479
|
-
|
|
480
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
481
|
-
serializeIntoHash(data, type, record, options) {
|
|
482
|
-
let root = underscore(type.modelName);
|
|
483
|
-
data[root] = this.serialize(record, options);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
@method serializeIntoHash
|
|
489
|
-
@public
|
|
490
|
-
@param {Object} hash
|
|
491
|
-
@param {Model} typeClass
|
|
492
|
-
@param {Snapshot} snapshot
|
|
493
|
-
@param {Object} options
|
|
494
|
-
*/
|
|
495
|
-
serializeIntoHash(hash: Object, typeClass: Model, snapshot: Snapshot, options: Object): void;
|
|
496
|
-
/**
|
|
497
|
-
You can use `payloadKeyFromModelName` to override the root key for an outgoing
|
|
498
|
-
request. By default, the RESTSerializer returns a camelized version of the
|
|
499
|
-
model's name.
|
|
500
|
-
|
|
501
|
-
For a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer
|
|
502
|
-
will send it to the server with `tacoParty` as the root key in the JSON payload:
|
|
503
|
-
|
|
504
|
-
```js
|
|
505
|
-
{
|
|
506
|
-
"tacoParty": {
|
|
507
|
-
"id": "1",
|
|
508
|
-
"location": "Matthew Beale's House"
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
For example, your server may expect dasherized root objects:
|
|
514
|
-
|
|
515
|
-
```app/serializers/application.js
|
|
516
|
-
import RESTSerializer from '@ember-data-mirror/serializer/rest';
|
|
517
|
-
import { dasherize } from '<app-name>/utils/string-utils';
|
|
518
|
-
|
|
519
|
-
export default class ApplicationSerializer extends RESTSerializer {
|
|
520
|
-
payloadKeyFromModelName(modelName) {
|
|
521
|
-
return dasherize(modelName);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
Given a `TacoParty` model, calling `save` on it would produce an outgoing
|
|
527
|
-
request like:
|
|
528
|
-
|
|
529
|
-
```js
|
|
530
|
-
{
|
|
531
|
-
"taco-party": {
|
|
532
|
-
"id": "1",
|
|
533
|
-
"location": "Matthew Beale's House"
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
@method payloadKeyFromModelName
|
|
539
|
-
@public
|
|
540
|
-
@param {String} modelName
|
|
541
|
-
@return {String}
|
|
542
|
-
*/
|
|
543
|
-
payloadKeyFromModelName(modelName: string): string;
|
|
544
|
-
/**
|
|
545
|
-
You can use this method to customize how polymorphic objects are serialized.
|
|
546
|
-
By default the REST Serializer creates the key by appending `Type` to
|
|
547
|
-
the attribute and value from the model's camelcased model name.
|
|
548
|
-
|
|
549
|
-
@method serializePolymorphicType
|
|
550
|
-
@public
|
|
551
|
-
@param {Snapshot} snapshot
|
|
552
|
-
@param {Object} json
|
|
553
|
-
@param {Object} relationship
|
|
554
|
-
*/
|
|
555
|
-
serializePolymorphicType(snapshot: Snapshot, json: Object, relationship: Object): void;
|
|
556
|
-
/**
|
|
557
|
-
You can use this method to customize how a polymorphic relationship should
|
|
558
|
-
be extracted.
|
|
559
|
-
|
|
560
|
-
@method extractPolymorphicRelationship
|
|
561
|
-
@public
|
|
562
|
-
@param {Object} relationshipType
|
|
563
|
-
@param {Object} relationshipHash
|
|
564
|
-
@param {Object} relationshipOptions
|
|
565
|
-
@return {Object}
|
|
566
|
-
*/
|
|
567
|
-
extractPolymorphicRelationship(relationshipType: Object, relationshipHash: Object, relationshipOptions: Object, ...args: any[]): Object;
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
//# sourceMappingURL=rest.d.ts.map
|
|
4
|
+
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
declare module '@ember-data-mirror/serializer/transform' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { Transform as default } from '@ember-data-mirror/serializer/-private/transforms/transform';
|
|
6
|
-
export { BooleanTransform } from '@ember-data-mirror/serializer/-private/transforms/boolean';
|
|
7
|
-
export { DateTransform } from '@ember-data-mirror/serializer/-private/transforms/date';
|
|
8
|
-
export { NumberTransform } from '@ember-data-mirror/serializer/-private/transforms/number';
|
|
9
|
-
export { StringTransform } from '@ember-data-mirror/serializer/-private/transforms/string';
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=transform.d.ts.map
|
|
2
|
+
export { Transform as default, BooleanTransform, StringTransform, NumberTransform, DateTransform } from "@warp-drive-mirror/legacy/serializer/transform";
|
|
3
|
+
|
|
4
|
+
}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../node_modules/.pnpm/decorat_bfe8edbefc8aced6f61ce140cd72ecf2/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../src/index.ts"],"sourcesContent":["const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n","/**\n ## Overview\n\n <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new serializer, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n In order to properly manage and present your data, EmberData\n needs to understand the structure of data it receives.\n\n `Serializers` convert data between the server's API format and\n the format EmberData understands.\n\n Data received from an API response is **normalized** into\n [JSON:API](https://jsonapi.org/) (the format used internally\n by EmberData), while data sent to an API is **serialized**\n into the format the API expects.\n\n ### Implementing a Serializer\n\n There are only two required serializer methods, one for\n normalizing data from the server API format into JSON:API, and\n another for serializing records via `Snapshots` into the expected\n server API format.\n\n To implement a serializer, export a class that conforms to the structure\n described by [<Interface> Serializer](/ember-data/release/classes/%3CInterface%3E%20Serializer)\n from the `app/serializers/` directory. An example is below.\n\n ```ts\n import EmberObject from '@ember/object';\n\n export default class ApplicationSerializer extends EmberObject {\n normalizeResponse(store, schema, rawPayload) {\n return rawPayload;\n }\n\n serialize(snapshot, options) {\n const serializedResource = {\n id: snapshot.id,\n type: snapshot.modelName,\n attributes: snapshot.attributes()\n };\n\n return serializedResource;\n }\n }\n ```\n\n\n ### Serializer Resolution\n\n `store.serializerFor(name)` will lookup serializers defined in\n `app/serializers/` and return an instance. If no serializer is found, an\n error will be thrown.\n\n `serializerFor` first attempts to find a serializer with an exact match on `name`,\n then falls back to checking for the presence of a serializer named `application`.\n\n ```ts\n store.serializerFor('author');\n\n // lookup paths (in order) =>\n // app/serializers/author.js\n // app/serializers/application.js\n ```\n\n Most requests in EmberData are made with respect to a particular `type` (or `modelName`)\n (e.g., \"get me the full collection of **books**\" or \"get me the **employee** whose id is 37\"). We\n refer to this as the **primary** resource `type`.\n\n Typically `serializerFor` will be used to find a serializer with a name matching that of the primary\n resource `type` for the request, falling back to the `application` serializer for those types that\n do not have a defined serializer. This is often described as a `per-model` or `per-type` strategy\n for defining serializers. However, because APIs rarely format payloads per-type but rather\n per-API-version, this may not be a desired strategy.\n\n It is recommended that applications define only a single `application` adapter and serializer\n where possible.\n\n If you have multiple API formats and the per-type strategy is not viable, one strategy is to\n write an `application` adapter and serializer that make use of `options` to specify the desired\n format when making a request.\n\n ### Using a Serializer\n\n Any serializer in `app/serializers/` can be looked up by `name` using `store.serializerFor(name)`.\n\n ### Default Serializers\n\n For applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**\n format the `@ember-data-mirror/serializer` package contains implementations these applications can\n extend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.\n\n Many applications will find writing their own serializer to be more performant and less\n complex than extending these classes even when their API format is very close to that expected\n by these serializers.\n\n It is recommended that apps write their own serializer to best suit the needs of their API and\n application.\n\n @module @ember-data-mirror/serializer\n @main @ember-data-mirror/serializer\n*/\n\nimport EmberObject from '@ember/object';\nimport * as s from '@ember/service';\n\nimport type Store from '@ember-data-mirror/store';\nimport type { ModelSchema } from '@ember-data-mirror/store/types';\nimport type { EmptyResourceDocument, SingleResourceDocument } from '@warp-drive-mirror/core-types/spec/json-api-raw';\n\nconst service = s.service ?? s.inject;\n\n/**\n > ⚠️ CAUTION you likely want the docs for [<Interface> Serializer](/ember-data/release/classes/%3CInterface%3E%20Serializer)\n > as extending this abstract class is unnecessary.\n\n `Serializer` is an abstract base class that you may override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `normalizeResponse()`\n * `serialize()`\n\n And you can optionally override the following methods:\n\n * `normalize()`\n\n For an example implementation, see\n [JSONSerializer](JSONSerializer), the included JSON serializer.\n\n @class Serializer\n @public\n @extends Ember.EmberObject\n*/\n\nexport default class extends EmberObject {\n @service declare store: Store;\n /**\n The `store` property is the application's `store` that contains\n all records. It can be used to look up serializers for other model\n types that may be nested inside the payload response.\n\n Example:\n\n ```js\n Serializer.extend({\n extractRelationship(relationshipModelName, relationshipHash) {\n let modelClass = this.store.modelFor(relationshipModelName);\n let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n return relationshipSerializer.normalize(modelClass, relationshipHash);\n }\n });\n ```\n\n @property store\n @type {Store}\n @public\n */\n\n /**\n The `normalizeResponse` method is used to normalize a payload from the\n server to a JSON-API Document.\n\n http://jsonapi.org/format/#document-structure\n\n Example:\n\n ```js\n Serializer.extend({\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n if (requestType === 'findRecord') {\n return this.normalize(primaryModelClass, payload);\n } else {\n return payload.reduce(function(documentHash, item) {\n let { data, included } = this.normalize(primaryModelClass, item);\n documentHash.included.push(...included);\n documentHash.data.push(data);\n return documentHash;\n }, { data: [], included: [] })\n }\n }\n });\n ```\n\n @since 1.13.0\n @method normalizeResponse\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n\n /**\n The `serialize` method is used when a record is saved in order to convert\n the record into the form that your external data source expects.\n\n `serialize` takes an optional `options` hash with a single option:\n\n - `includeId`: If this is `true`, `serialize` should include the ID\n in the serialized object it builds.\n\n Example:\n\n ```js\n Serializer.extend({\n serialize(snapshot, options) {\n let json = {\n id: snapshot.id\n };\n\n snapshot.eachAttribute((key, attribute) => {\n json[key] = snapshot.attr(key);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n json[key] = snapshot.belongsTo(key, { id: true });\n } else if (relationship.kind === 'hasMany') {\n json[key] = snapshot.hasMany(key, { ids: true });\n }\n });\n\n return json;\n },\n });\n ```\n\n @method serialize\n @public\n @param {Snapshot} snapshot\n @param {Object} [options]\n @return {Object}\n */\n\n /**\n The `normalize` method is used to convert a payload received from your\n external data source into the normalized form `store.push()` expects. You\n should override this method, munge the hash and return the normalized\n payload.\n\n Example:\n\n ```js\n Serializer.extend({\n normalize(modelClass, resourceHash) {\n let data = {\n id: resourceHash.id,\n type: modelClass.modelName,\n attributes: resourceHash\n };\n return { data: data };\n }\n })\n ```\n\n @method normalize\n @public\n @param {Model} typeClass\n @param {Object} hash\n @return {Object}\n */\n normalize(_typeClass: ModelSchema, hash: Record<string, unknown>): SingleResourceDocument | EmptyResourceDocument {\n return hash as unknown as SingleResourceDocument;\n }\n}\n"],"names":["deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","initializeDeferredDecorator","constructor","value","call","service","s","inject","EmberObject","g","i","void 0","normalize","_typeClass","hash"],"mappings":"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AAA,IAAAK,2BAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAAC,MAAA;AACR;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKE;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;;AAME;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;;AAUE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIEC,EAAAA,SAASA,CAACC,UAAuB,EAAEC,IAA6B,EAAkD;AAChH,IAAA,OAAOA,IAAI;AACb;AACF;;;;","x_google_ignoreList":[0]}
|