@warp-drive/legacy 5.7.0-alpha.12 → 5.7.0-alpha.13
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/declarations/compat/legacy-network-handler/snapshot.d.ts +69 -41
- package/dist/{-private-CKrP0ogQ.js → -private-CsshwIY7.js} +89 -92
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/json-api.js +1 -1
- package/dist/adapter/rest.js +1 -1
- package/dist/compat/-private.js +1 -1
- package/dist/compat.js +1 -1
- package/dist/{errors-DK6DtmZN.js → errors-DOPr_dMc.js} +1 -1
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +2 -2
- package/dist/model.js +3 -3
- package/dist/{schema-provider-DXczOefH.js → schema-provider-0vfXIZzR.js} +2 -2
- package/dist/{serialize-into-hash-Bp58npke.js → serialize-into-hash-DVW6-WBv.js} +1 -1
- package/package.json +6 -6
|
@@ -14,46 +14,73 @@ adapters and serializers for certain requests.
|
|
|
14
14
|
Snapshots are only available when using `@ember-data/legacy-compat`
|
|
15
15
|
for legacy compatibility with adapters and serializers.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
For serialization of records in modern paradigms, request data from
|
|
18
|
+
the cache or off the record directly.
|
|
19
|
+
|
|
20
|
+
@hideconstructor
|
|
18
21
|
@public
|
|
19
22
|
*/
|
|
20
23
|
export declare class Snapshot<R = unknown> {
|
|
21
|
-
__attributes
|
|
22
|
-
_belongsToRelationships
|
|
23
|
-
_belongsToIds
|
|
24
|
-
_hasManyRelationships
|
|
25
|
-
_hasManyIds
|
|
26
|
-
_changedAttributes
|
|
24
|
+
private __attributes;
|
|
25
|
+
private _belongsToRelationships;
|
|
26
|
+
private _belongsToIds;
|
|
27
|
+
private _hasManyRelationships;
|
|
28
|
+
private _hasManyIds;
|
|
29
|
+
private _changedAttributes;
|
|
30
|
+
private _store;
|
|
31
|
+
/**
|
|
32
|
+
The unique RecordIdentifier associated with this Snapshot.
|
|
33
|
+
|
|
34
|
+
@public
|
|
35
|
+
*/
|
|
27
36
|
identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;
|
|
37
|
+
/**
|
|
38
|
+
The ResourceType of the underlying record for this Snapshot, as a string.
|
|
39
|
+
|
|
40
|
+
@public
|
|
41
|
+
*/
|
|
28
42
|
modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;
|
|
43
|
+
/**
|
|
44
|
+
The id of the snapshot's underlying record
|
|
45
|
+
|
|
46
|
+
Example
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
50
|
+
postSnapshot.id; // => '1'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
@public
|
|
54
|
+
*/
|
|
29
55
|
id: string | null;
|
|
56
|
+
/**
|
|
57
|
+
If `include` was passed to the options for the request, the value
|
|
58
|
+
would be available here.
|
|
59
|
+
|
|
60
|
+
@public
|
|
61
|
+
*/
|
|
30
62
|
include?: string | string[];
|
|
31
|
-
adapterOptions?: Record<string, unknown>;
|
|
32
|
-
_store: Store;
|
|
33
63
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @param identifier
|
|
38
|
-
* @param _store
|
|
64
|
+
The adapterOptions passed to the request which generated this Snapshot, if any
|
|
65
|
+
|
|
66
|
+
@public
|
|
39
67
|
*/
|
|
68
|
+
adapterOptions?: Record<string, unknown>;
|
|
40
69
|
constructor(options: FindRecordOptions, identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>, store: Store);
|
|
41
70
|
/**
|
|
42
71
|
The underlying record for this snapshot. Can be used to access methods and
|
|
43
72
|
properties defined on the record.
|
|
44
73
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```javascript
|
|
48
|
-
let json = snapshot.record.toJSON();
|
|
74
|
+
```js
|
|
75
|
+
const someValue = snapshot.record.someProp;
|
|
49
76
|
```
|
|
50
77
|
|
|
51
78
|
@property record
|
|
52
|
-
@type {Model}
|
|
53
79
|
@public
|
|
54
80
|
*/
|
|
55
81
|
get record(): R | null;
|
|
56
|
-
|
|
82
|
+
/** @internal */
|
|
83
|
+
private get _attributes();
|
|
57
84
|
get isNew(): boolean;
|
|
58
85
|
/**
|
|
59
86
|
Returns the value of an attribute.
|
|
@@ -68,22 +95,28 @@ export declare class Snapshot<R = unknown> {
|
|
|
68
95
|
|
|
69
96
|
Note: Values are loaded eagerly and cached when the snapshot is created.
|
|
70
97
|
|
|
71
|
-
@
|
|
72
|
-
@return {Object} The attribute value or undefined
|
|
98
|
+
@return The attribute value or undefined
|
|
73
99
|
@public
|
|
74
100
|
*/
|
|
75
101
|
attr(keyName: keyof R & string): unknown;
|
|
76
102
|
/**
|
|
77
103
|
Returns all attributes and their corresponding values.
|
|
78
104
|
|
|
105
|
+
::: warning ⚠️ WARNING
|
|
106
|
+
Attributes are SHALLOW copied from the cache.
|
|
107
|
+
Because they are NOT deep copied from the cache, mutating
|
|
108
|
+
any object or array fields will cause unintended side-effects
|
|
109
|
+
and bugs.
|
|
110
|
+
:::
|
|
111
|
+
|
|
79
112
|
Example
|
|
80
113
|
|
|
81
|
-
```
|
|
114
|
+
```js
|
|
82
115
|
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
83
116
|
postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
|
|
84
117
|
```
|
|
85
118
|
|
|
86
|
-
@return
|
|
119
|
+
@return All attributes of the current snapshot
|
|
87
120
|
@public
|
|
88
121
|
*/
|
|
89
122
|
attributes(): Record<keyof R & string, unknown>;
|
|
@@ -92,13 +125,13 @@ export declare class Snapshot<R = unknown> {
|
|
|
92
125
|
|
|
93
126
|
Example
|
|
94
127
|
|
|
95
|
-
```
|
|
128
|
+
```js
|
|
96
129
|
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
97
130
|
postModel.set('title', 'Ember.js rocks!');
|
|
98
131
|
postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
|
|
99
132
|
```
|
|
100
133
|
|
|
101
|
-
@return
|
|
134
|
+
@return All changed attributes of the current snapshot
|
|
102
135
|
@public
|
|
103
136
|
*/
|
|
104
137
|
changedAttributes(): ChangedAttributesHash;
|
|
@@ -113,7 +146,7 @@ export declare class Snapshot<R = unknown> {
|
|
|
113
146
|
|
|
114
147
|
Example
|
|
115
148
|
|
|
116
|
-
```
|
|
149
|
+
```js
|
|
117
150
|
// store.push('post', { id: 1, title: 'Hello World' });
|
|
118
151
|
// store.createRecord('comment', { body: 'Lorem ipsum', post: post });
|
|
119
152
|
commentSnapshot.belongsTo('post'); // => Snapshot
|
|
@@ -130,12 +163,10 @@ export declare class Snapshot<R = unknown> {
|
|
|
130
163
|
|
|
131
164
|
Note: Relationships are loaded lazily and cached upon first access.
|
|
132
165
|
|
|
133
|
-
@param {String} keyName
|
|
134
|
-
@param {Object} [options]
|
|
135
166
|
@public
|
|
136
|
-
@return
|
|
137
|
-
relationship
|
|
138
|
-
|
|
167
|
+
@return A snapshot or ID of a known relationship or null if the
|
|
168
|
+
relationship is known but unset. undefined will be returned if the
|
|
169
|
+
contents of the relationship are unknown.
|
|
139
170
|
*/
|
|
140
171
|
belongsTo(keyName: string, options?: {
|
|
141
172
|
id?: boolean;
|
|
@@ -162,10 +193,8 @@ export declare class Snapshot<R = unknown> {
|
|
|
162
193
|
|
|
163
194
|
Note: Relationships are loaded lazily and cached upon first access.
|
|
164
195
|
|
|
165
|
-
@param {String} keyName
|
|
166
|
-
@param {Object} [options]
|
|
167
196
|
@public
|
|
168
|
-
@return
|
|
197
|
+
@return An array of snapshots or IDs of a known
|
|
169
198
|
relationship or an empty array if the relationship is known but unset.
|
|
170
199
|
undefined will be returned if the contents of the relationship is unknown.
|
|
171
200
|
*/
|
|
@@ -184,8 +213,8 @@ export declare class Snapshot<R = unknown> {
|
|
|
184
213
|
});
|
|
185
214
|
```
|
|
186
215
|
|
|
187
|
-
@param
|
|
188
|
-
@param
|
|
216
|
+
@param callback the callback to execute
|
|
217
|
+
@param binding the optional value to which the callback's `this` should be bound
|
|
189
218
|
@public
|
|
190
219
|
*/
|
|
191
220
|
eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void;
|
|
@@ -201,8 +230,8 @@ export declare class Snapshot<R = unknown> {
|
|
|
201
230
|
});
|
|
202
231
|
```
|
|
203
232
|
|
|
204
|
-
@param
|
|
205
|
-
@param
|
|
233
|
+
@param callback the callback to execute
|
|
234
|
+
@param binding the optional value to which the callback's `this` should be bound
|
|
206
235
|
@public
|
|
207
236
|
*/
|
|
208
237
|
eachRelationship(callback: (key: string, meta: LegacyRelationshipField) => void, binding?: unknown): void;
|
|
@@ -227,8 +256,7 @@ export declare class Snapshot<R = unknown> {
|
|
|
227
256
|
});
|
|
228
257
|
```
|
|
229
258
|
|
|
230
|
-
@
|
|
231
|
-
@return {Object} an object whose values are primitive JSON values only
|
|
259
|
+
@return an object whose values are primitive JSON values only
|
|
232
260
|
@public
|
|
233
261
|
*/
|
|
234
262
|
serialize(options?: SerializerOptions): unknown;
|
|
@@ -238,17 +238,44 @@ function normalizeResponseHelper(serializer, store, modelClass, payload, id, req
|
|
|
238
238
|
Snapshots are only available when using `@ember-data/legacy-compat`
|
|
239
239
|
for legacy compatibility with adapters and serializers.
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
For serialization of records in modern paradigms, request data from
|
|
242
|
+
the cache or off the record directly.
|
|
243
|
+
|
|
244
|
+
@hideconstructor
|
|
242
245
|
@public
|
|
243
246
|
*/
|
|
244
247
|
class Snapshot {
|
|
245
248
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
The unique RecordIdentifier associated with this Snapshot.
|
|
250
|
+
@public
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
The ResourceType of the underlying record for this Snapshot, as a string.
|
|
255
|
+
@public
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
The id of the snapshot's underlying record
|
|
260
|
+
Example
|
|
261
|
+
```js
|
|
262
|
+
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
263
|
+
postSnapshot.id; // => '1'
|
|
264
|
+
```
|
|
265
|
+
@public
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
If `include` was passed to the options for the request, the value
|
|
270
|
+
would be available here.
|
|
271
|
+
@public
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
The adapterOptions passed to the request which generated this Snapshot, if any
|
|
276
|
+
@public
|
|
277
|
+
*/
|
|
278
|
+
|
|
252
279
|
constructor(options, identifier, store) {
|
|
253
280
|
this._store = store;
|
|
254
281
|
this.__attributes = null;
|
|
@@ -258,13 +285,6 @@ class Snapshot {
|
|
|
258
285
|
this._hasManyIds = Object.create(null);
|
|
259
286
|
const hasRecord = !!store._instanceCache.peek(identifier);
|
|
260
287
|
this.modelName = identifier.type;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
The unique RecordIdentifier associated with this Snapshot.
|
|
264
|
-
@property identifier
|
|
265
|
-
@public
|
|
266
|
-
@type {StableRecordIdentifier}
|
|
267
|
-
*/
|
|
268
288
|
this.identifier = identifier;
|
|
269
289
|
|
|
270
290
|
/*
|
|
@@ -278,43 +298,9 @@ class Snapshot {
|
|
|
278
298
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
279
299
|
this._attributes;
|
|
280
300
|
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
The id of the snapshot's underlying record
|
|
284
|
-
Example
|
|
285
|
-
```javascript
|
|
286
|
-
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
287
|
-
postSnapshot.id; // => '1'
|
|
288
|
-
```
|
|
289
|
-
@property id
|
|
290
|
-
@type {String}
|
|
291
|
-
@public
|
|
292
|
-
*/
|
|
293
301
|
this.id = identifier.id;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
A hash of adapter options
|
|
297
|
-
@property adapterOptions
|
|
298
|
-
@type {Object}
|
|
299
|
-
@public
|
|
300
|
-
*/
|
|
301
302
|
this.adapterOptions = options.adapterOptions;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
If `include` was passed to the options hash for the request, the value
|
|
305
|
-
would be available here.
|
|
306
|
-
@property include
|
|
307
|
-
@type {String|Array}
|
|
308
|
-
@public
|
|
309
|
-
*/
|
|
310
303
|
this.include = options.include;
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
The name of the type of the underlying record for this snapshot, as a string.
|
|
314
|
-
@property modelName
|
|
315
|
-
@type {String}
|
|
316
|
-
@public
|
|
317
|
-
*/
|
|
318
304
|
this.modelName = identifier.type;
|
|
319
305
|
if (hasRecord) {
|
|
320
306
|
const cache = this._store.cache;
|
|
@@ -325,12 +311,10 @@ class Snapshot {
|
|
|
325
311
|
/**
|
|
326
312
|
The underlying record for this snapshot. Can be used to access methods and
|
|
327
313
|
properties defined on the record.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
let json = snapshot.record.toJSON();
|
|
314
|
+
```js
|
|
315
|
+
const someValue = snapshot.record.someProp;
|
|
331
316
|
```
|
|
332
317
|
@property record
|
|
333
|
-
@type {Model}
|
|
334
318
|
@public
|
|
335
319
|
*/
|
|
336
320
|
get record() {
|
|
@@ -342,6 +326,8 @@ class Snapshot {
|
|
|
342
326
|
})(record !== null) : {};
|
|
343
327
|
return record;
|
|
344
328
|
}
|
|
329
|
+
|
|
330
|
+
/** @internal */
|
|
345
331
|
get _attributes() {
|
|
346
332
|
if (this.__attributes !== null) {
|
|
347
333
|
return this.__attributes;
|
|
@@ -350,12 +336,9 @@ class Snapshot {
|
|
|
350
336
|
const {
|
|
351
337
|
identifier
|
|
352
338
|
} = this;
|
|
353
|
-
const attrs = this._store.schema.fields(identifier);
|
|
354
339
|
const cache = this._store.cache;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
attributes[keyName] = cache.getAttr(identifier, keyName);
|
|
358
|
-
}
|
|
340
|
+
this.eachAttribute((key, meta) => {
|
|
341
|
+
attributes[key] = cache.getAttr(identifier, key);
|
|
359
342
|
});
|
|
360
343
|
return attributes;
|
|
361
344
|
}
|
|
@@ -373,8 +356,7 @@ class Snapshot {
|
|
|
373
356
|
postSnapshot.attr('title'); // => 'Ember.js rocks'
|
|
374
357
|
```
|
|
375
358
|
Note: Values are loaded eagerly and cached when the snapshot is created.
|
|
376
|
-
@
|
|
377
|
-
@return {Object} The attribute value or undefined
|
|
359
|
+
@return The attribute value or undefined
|
|
378
360
|
@public
|
|
379
361
|
*/
|
|
380
362
|
attr(keyName) {
|
|
@@ -390,12 +372,18 @@ class Snapshot {
|
|
|
390
372
|
|
|
391
373
|
/**
|
|
392
374
|
Returns all attributes and their corresponding values.
|
|
375
|
+
::: warning ⚠️ WARNING
|
|
376
|
+
Attributes are SHALLOW copied from the cache.
|
|
377
|
+
Because they are NOT deep copied from the cache, mutating
|
|
378
|
+
any object or array fields will cause unintended side-effects
|
|
379
|
+
and bugs.
|
|
380
|
+
:::
|
|
393
381
|
Example
|
|
394
|
-
```
|
|
382
|
+
```js
|
|
395
383
|
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
396
384
|
postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
|
|
397
385
|
```
|
|
398
|
-
@return
|
|
386
|
+
@return All attributes of the current snapshot
|
|
399
387
|
@public
|
|
400
388
|
*/
|
|
401
389
|
attributes() {
|
|
@@ -407,12 +395,12 @@ class Snapshot {
|
|
|
407
395
|
/**
|
|
408
396
|
Returns all changed attributes and their old and new values.
|
|
409
397
|
Example
|
|
410
|
-
```
|
|
398
|
+
```js
|
|
411
399
|
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
|
|
412
400
|
postModel.set('title', 'Ember.js rocks!');
|
|
413
401
|
postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
|
|
414
402
|
```
|
|
415
|
-
@return
|
|
403
|
+
@return All changed attributes of the current snapshot
|
|
416
404
|
@public
|
|
417
405
|
*/
|
|
418
406
|
changedAttributes() {
|
|
@@ -435,7 +423,7 @@ class Snapshot {
|
|
|
435
423
|
- `id`: set to `true` if you only want the ID of the related record to be
|
|
436
424
|
returned.
|
|
437
425
|
Example
|
|
438
|
-
```
|
|
426
|
+
```js
|
|
439
427
|
// store.push('post', { id: 1, title: 'Hello World' });
|
|
440
428
|
// store.createRecord('comment', { body: 'Lorem ipsum', post: post });
|
|
441
429
|
commentSnapshot.belongsTo('post'); // => Snapshot
|
|
@@ -448,12 +436,10 @@ class Snapshot {
|
|
|
448
436
|
known but unset, `belongsTo` will return `null`. If the contents of the
|
|
449
437
|
relationship is unknown `belongsTo` will return `undefined`.
|
|
450
438
|
Note: Relationships are loaded lazily and cached upon first access.
|
|
451
|
-
@
|
|
452
|
-
@
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
relationship or null if the relationship is known but unset. undefined
|
|
456
|
-
will be returned if the contents of the relationship is unknown.
|
|
439
|
+
@public
|
|
440
|
+
@return A snapshot or ID of a known relationship or null if the
|
|
441
|
+
relationship is known but unset. undefined will be returned if the
|
|
442
|
+
contents of the relationship are unknown.
|
|
457
443
|
*/
|
|
458
444
|
belongsTo(keyName, options) {
|
|
459
445
|
const returnModeIsId = !!(options && options.id);
|
|
@@ -532,10 +518,8 @@ class Snapshot {
|
|
|
532
518
|
postSnapshot.hasMany('comments'); // => undefined
|
|
533
519
|
```
|
|
534
520
|
Note: Relationships are loaded lazily and cached upon first access.
|
|
535
|
-
@
|
|
536
|
-
@
|
|
537
|
-
@public
|
|
538
|
-
@return {(Array|undefined)} An array of snapshots or IDs of a known
|
|
521
|
+
@public
|
|
522
|
+
@return An array of snapshots or IDs of a known
|
|
539
523
|
relationship or an empty array if the relationship is known but unset.
|
|
540
524
|
undefined will be returned if the contents of the relationship is unknown.
|
|
541
525
|
*/
|
|
@@ -621,17 +605,24 @@ class Snapshot {
|
|
|
621
605
|
// ...
|
|
622
606
|
});
|
|
623
607
|
```
|
|
624
|
-
@param
|
|
625
|
-
@param
|
|
608
|
+
@param callback the callback to execute
|
|
609
|
+
@param binding the optional value to which the callback's `this` should be bound
|
|
626
610
|
@public
|
|
627
611
|
*/
|
|
628
612
|
eachAttribute(callback, binding) {
|
|
629
|
-
|
|
630
|
-
fields
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
613
|
+
// if the store has a modelFor implementation, we use it to iterate attributes. This allows
|
|
614
|
+
// a custom "ModelSchema" class for legacy serializers to adapt to new fields if desired.
|
|
615
|
+
if (typeof this._store.modelFor === 'function') {
|
|
616
|
+
const modelSchema = this._store.modelFor(this.identifier.type);
|
|
617
|
+
modelSchema.eachAttribute(callback, binding);
|
|
618
|
+
} else {
|
|
619
|
+
const fields = this._store.schema.fields(this.identifier);
|
|
620
|
+
fields.forEach((field, key) => {
|
|
621
|
+
if (field.kind === 'attribute') {
|
|
622
|
+
callback.call(binding, key, field);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
635
626
|
}
|
|
636
627
|
|
|
637
628
|
/**
|
|
@@ -643,17 +634,24 @@ class Snapshot {
|
|
|
643
634
|
// ...
|
|
644
635
|
});
|
|
645
636
|
```
|
|
646
|
-
@param
|
|
647
|
-
@param
|
|
637
|
+
@param callback the callback to execute
|
|
638
|
+
@param binding the optional value to which the callback's `this` should be bound
|
|
648
639
|
@public
|
|
649
640
|
*/
|
|
650
641
|
eachRelationship(callback, binding) {
|
|
651
|
-
|
|
652
|
-
fields
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
642
|
+
// if the store has a modelFor implementation, we use it to iterate relationships. This allows
|
|
643
|
+
// a custom "ModelSchema" class for legacy serializers to adapt to new fields if desired.
|
|
644
|
+
if (typeof this._store.modelFor === 'function') {
|
|
645
|
+
const modelSchema = this._store.modelFor(this.identifier.type);
|
|
646
|
+
modelSchema.eachRelationship(callback, binding);
|
|
647
|
+
} else {
|
|
648
|
+
const fields = this._store.schema.fields(this.identifier);
|
|
649
|
+
fields.forEach((field, key) => {
|
|
650
|
+
if (field.kind === 'belongsTo' || field.kind === 'hasMany') {
|
|
651
|
+
callback.call(binding, key, field);
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
}
|
|
657
655
|
}
|
|
658
656
|
|
|
659
657
|
/**
|
|
@@ -672,8 +670,7 @@ class Snapshot {
|
|
|
672
670
|
}
|
|
673
671
|
});
|
|
674
672
|
```
|
|
675
|
-
@
|
|
676
|
-
@return {Object} an object whose values are primitive JSON values only
|
|
673
|
+
@return an object whose values are primitive JSON values only
|
|
677
674
|
@public
|
|
678
675
|
*/
|
|
679
676
|
serialize(options) {
|
package/dist/adapter/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-
|
|
1
|
+
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-DVW6-WBv.js";
|
package/dist/adapter/json-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dasherize, pluralize } from '@warp-drive/utilities/string';
|
|
2
2
|
import '@ember/debug';
|
|
3
3
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
4
|
-
import { b as serializeIntoHash } from "../serialize-into-hash-
|
|
4
|
+
import { b as serializeIntoHash } from "../serialize-into-hash-DVW6-WBv.js";
|
|
5
5
|
import { RESTAdapter } from './rest.js';
|
|
6
6
|
class JSONAPIAdapter extends RESTAdapter {
|
|
7
7
|
_defaultContentType = 'application/vnd.api+json';
|
package/dist/adapter/rest.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { warn } from '@ember/debug';
|
|
3
3
|
import { computed } from '@ember/object';
|
|
4
4
|
import { Adapter, BuildURLMixin } from '../adapter.js';
|
|
5
|
-
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-
|
|
5
|
+
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-DVW6-WBv.js";
|
|
6
6
|
import { InvalidError, ServerError, ConflictError, NotFoundError, ForbiddenError, UnauthorizedError, AdapterError, TimeoutError, AbortError } from './error.js';
|
|
7
7
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
8
8
|
import { d as decorateMethodV2 } from "../runtime-BPCpkOf1-BKOwiRJp.js";
|
package/dist/compat/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as FetchManager, S as SaveOp, c as Snapshot, b as SnapshotRecordArray, u as upgradeStore } from "../-private-
|
|
1
|
+
export { F as FetchManager, S as SaveOp, c as Snapshot, b as SnapshotRecordArray, u as upgradeStore } from "../-private-CsshwIY7.js";
|
package/dist/compat.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getOwner } from '@ember/application';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { waitFor, _deprecatingNormalize } from '@warp-drive/core/store/-private';
|
|
4
|
-
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-
|
|
4
|
+
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-CsshwIY7.js";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
7
7
|
const promise = Promise.resolve().then(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { memoized, defineSignal, defineNonEnumerableSignal, isStableIdentifier, recordIdentifierFor, storeFor, SOURCE, fastPush, RelatedCollection, notifyInternalSignal, ARRAY_SIGNAL } from '@warp-drive/core/store/-private';
|
|
2
2
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
3
3
|
import { EnableHydration } from '@warp-drive/core/types/request';
|
|
4
|
-
import { u as upgradeStore } from "./-private-
|
|
4
|
+
import { u as upgradeStore } from "./-private-CsshwIY7.js";
|
|
5
5
|
import { computed, get } from '@ember/object';
|
|
6
6
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
7
7
|
import ObjectProxy from '@ember/object/proxy';
|
package/dist/model/-private.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-
|
|
1
|
+
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-DOPr_dMc.js";
|
|
2
2
|
export { RelatedCollection as ManyArray } from '@warp-drive/core/store/-private';
|
|
@@ -3,8 +3,8 @@ import { recordIdentifierFor } from '@warp-drive/core';
|
|
|
3
3
|
import { notifyInternalSignal, ARRAY_SIGNAL } from '@warp-drive/core/store/-private';
|
|
4
4
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
5
5
|
import { Type } from '@warp-drive/core/types/symbols';
|
|
6
|
-
import { l as lookupLegacySupport, E as Errors } from "../errors-
|
|
7
|
-
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-
|
|
6
|
+
import { l as lookupLegacySupport, E as Errors } from "../errors-DOPr_dMc.js";
|
|
7
|
+
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-0vfXIZzR.js";
|
|
8
8
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/model.js
CHANGED
|
@@ -4,10 +4,10 @@ import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
|
4
4
|
import { i as isElementDescriptor, n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
import { warn, deprecate } from '@ember/debug';
|
|
7
|
-
import { l as lookupLegacySupport } from "./errors-
|
|
7
|
+
import { l as lookupLegacySupport } from "./errors-DOPr_dMc.js";
|
|
8
8
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
9
|
-
import { l as getModelFactory } from "./schema-provider-
|
|
10
|
-
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-
|
|
9
|
+
import { l as getModelFactory } from "./schema-provider-0vfXIZzR.js";
|
|
10
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-0vfXIZzR.js";
|
|
11
11
|
import { setOwner, getOwner } from '@ember/application';
|
|
12
12
|
import { setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
13
13
|
function _attr(type, options) {
|
|
@@ -4,8 +4,8 @@ import EmberObject from '@ember/object';
|
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
5
|
import { notifyInternalSignal, peekInternalSignal, withSignalStore, ARRAY_SIGNAL, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal, defineGate } from '@warp-drive/core/store/-private';
|
|
6
6
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-
|
|
8
|
-
import { u as upgradeStore, F as FetchManager } from "./-private-
|
|
7
|
+
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-DOPr_dMc.js";
|
|
8
|
+
import { u as upgradeStore, F as FetchManager } from "./-private-CsshwIY7.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
import { cacheFor } from '@ember/object/internals';
|
|
11
11
|
import { d as decorateMethodV2 } from "./runtime-BPCpkOf1-BKOwiRJp.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
3
|
import '@warp-drive/core/store/-private';
|
|
4
|
-
import "./-private-
|
|
4
|
+
import "./-private-CsshwIY7.js";
|
|
5
5
|
const newline = /\r?\n/;
|
|
6
6
|
function parseResponseHeaders(headersString) {
|
|
7
7
|
const headers = Object.create(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.13",
|
|
4
4
|
"description": "Decommissioned Packages for WarpDrive | Things your app might still want to maintain use of for a little longer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.7.0-alpha.13",
|
|
36
|
+
"@warp-drive/utilities": "5.7.0-alpha.13"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.16.12"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.0",
|
|
45
45
|
"@types/jquery": "^3.5.32",
|
|
46
|
-
"@warp-drive/internal-config": "5.7.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.13",
|
|
47
|
+
"@warp-drive/core": "5.7.0-alpha.13",
|
|
48
|
+
"@warp-drive/utilities": "5.7.0-alpha.13",
|
|
49
49
|
"ember-source": "~6.3.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.1",
|