@warp-drive/legacy 5.8.0-alpha.40 → 5.8.0-alpha.41
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/adapter/error.d.ts +2 -2
- package/declarations/adapter/rest.d.ts +21 -104
- package/declarations/adapter.d.ts +2 -2
- package/declarations/model/-private/model.d.ts +10 -51
- package/declarations/model/-private/promise-many-array.d.ts +0 -18
- package/declarations/model/-private/references/belongs-to.d.ts +14 -24
- package/declarations/model/-private/references/has-many.d.ts +11 -13
- package/declarations/serializer/json-api.d.ts +4 -3
- package/declarations/serializer/json.d.ts +2 -2
- package/dist/{-private-B1pSSN52.js → -private-BG3bMiKp.js} +2 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +2 -2
- package/dist/adapter/json-api.js +1 -1
- package/dist/adapter/rest.js +33 -117
- package/dist/adapter.js +2 -2
- package/dist/compat/-private.js +1 -1
- package/dist/compat.js +4 -3
- package/dist/{errors-CIGPcDvd.js → errors-Cz5KrzBk.js} +29 -58
- package/dist/{hooks-QqRnX108.js → hooks-D6diaM34.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{json-BNrV8EYG.js → json-ChdEfB0X.js} +6 -19
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +7 -5
- package/dist/model.js +3 -3
- package/dist/{schema-provider-g5MfTj8n.js → schema-provider-DJCV_6AF.js} +34 -77
- package/dist/{serialize-into-hash-BnYvPex3.js → serialize-into-hash-DPZYoF-i.js} +1 -1
- package/dist/serializer/json-api.js +2 -2
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +1 -1
- package/dist/store.js +2 -1
- package/dist/unpkg/{dev-deprecated/-private-DbaSCSym.js → dev/-private-DtjBbEgy.js} +2 -1
- package/dist/unpkg/dev/adapter/-private.js +1 -1
- package/dist/unpkg/dev/adapter/error.js +2 -2
- package/dist/unpkg/dev/adapter/json-api.js +1 -1
- package/dist/unpkg/dev/adapter/rest.js +33 -117
- package/dist/unpkg/dev/adapter.js +2 -2
- package/dist/unpkg/dev/compat/-private.js +1 -1
- package/dist/unpkg/dev/compat.js +4 -3
- package/dist/unpkg/dev/{errors-DD96TBEs.js → errors-DmGGJr3T.js} +29 -58
- package/dist/unpkg/dev/{hooks-CqWjNWeL.js → hooks-CkYiE6Ud.js} +1 -1
- package/dist/unpkg/dev/index.js +3 -3
- package/dist/unpkg/{dev-deprecated/json-CCU-ZQ4b.js → dev/json-Cu1LNgmQ.js} +6 -19
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +7 -5
- package/dist/unpkg/dev/model.js +3 -3
- package/dist/unpkg/dev/{schema-provider-B8jiJOYC.js → schema-provider-DDVYxmUV.js} +34 -77
- package/dist/unpkg/dev/{serialize-into-hash-CPAZXrQU.js → serialize-into-hash-B2xDbuo5.js} +1 -1
- package/dist/unpkg/dev/serializer/json-api.js +6 -5
- package/dist/unpkg/dev/serializer/json.js +1 -1
- package/dist/unpkg/dev/serializer/rest.js +1 -1
- package/dist/unpkg/dev/store.js +2 -1
- package/dist/unpkg/{dev/-private-DbaSCSym.js → dev-deprecated/-private-DtjBbEgy.js} +2 -1
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/adapter/error.js +2 -2
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +1 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js +33 -117
- package/dist/unpkg/dev-deprecated/adapter.js +2 -2
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/compat.js +4 -3
- package/dist/unpkg/dev-deprecated/{errors-DEnabIZj.js → errors-Spt6ubMd.js} +29 -58
- package/dist/unpkg/dev-deprecated/{hooks-CAll-Ets.js → hooks-DOXegvhL.js} +1 -1
- package/dist/unpkg/dev-deprecated/index.js +3 -3
- package/dist/unpkg/{dev/json-CCU-ZQ4b.js → dev-deprecated/json-Cu1LNgmQ.js} +6 -19
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +7 -5
- package/dist/unpkg/dev-deprecated/model.js +3 -3
- package/dist/unpkg/dev-deprecated/{schema-provider-k2qXQTBg.js → schema-provider-BP6_8N-V.js} +34 -77
- package/dist/unpkg/dev-deprecated/{serialize-into-hash-CPAZXrQU.js → serialize-into-hash-B2xDbuo5.js} +1 -1
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +6 -5
- package/dist/unpkg/dev-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/dev-deprecated/serializer/rest.js +1 -1
- package/dist/unpkg/dev-deprecated/store.js +2 -1
- package/dist/unpkg/{prod-deprecated/-private-Cvf_97EG.js → prod/-private-BdyZaGEh.js} +1 -0
- package/dist/unpkg/prod/adapter/-private.js +1 -1
- package/dist/unpkg/prod/adapter/error.js +2 -2
- package/dist/unpkg/prod/adapter/json-api.js +1 -1
- package/dist/unpkg/prod/adapter/rest.js +33 -117
- package/dist/unpkg/prod/adapter.js +2 -2
- package/dist/unpkg/prod/compat/-private.js +1 -1
- package/dist/unpkg/prod/compat.js +2 -1
- package/dist/unpkg/prod/{errors-CXnfnBfQ.js → errors-BGVFCBmi.js} +29 -58
- package/dist/unpkg/prod/{hooks-DvyWhLNg.js → hooks-BztVA_x0.js} +1 -1
- package/dist/unpkg/prod/index.js +3 -3
- package/dist/unpkg/prod/{json-BYrUP8ao.js → json-BWrZ5546.js} +6 -19
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +7 -5
- package/dist/unpkg/prod/model.js +3 -3
- package/dist/unpkg/prod/{schema-provider-CHujJvA9.js → schema-provider-DJtD_8jZ.js} +34 -77
- package/dist/unpkg/{prod-deprecated/serialize-into-hash-DYU2egXl.js → prod/serialize-into-hash-DGlzQteF.js} +1 -1
- package/dist/unpkg/prod/serializer/json-api.js +6 -5
- package/dist/unpkg/prod/serializer/json.js +1 -1
- package/dist/unpkg/prod/serializer/rest.js +1 -1
- package/dist/unpkg/prod/store.js +2 -1
- package/dist/unpkg/{prod/-private-Cvf_97EG.js → prod-deprecated/-private-BdyZaGEh.js} +1 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/adapter/error.js +2 -2
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +1 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js +33 -117
- package/dist/unpkg/prod-deprecated/adapter.js +2 -2
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/compat.js +2 -1
- package/dist/unpkg/prod-deprecated/{errors-CG1SPYVg.js → errors-CdDaK81x.js} +29 -58
- package/dist/unpkg/prod-deprecated/{hooks-BIUBiNGR.js → hooks-yId87yyG.js} +1 -1
- package/dist/unpkg/prod-deprecated/index.js +3 -3
- package/dist/unpkg/prod-deprecated/{json-BYrUP8ao.js → json-BWrZ5546.js} +6 -19
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +7 -5
- package/dist/unpkg/prod-deprecated/model.js +3 -3
- package/dist/unpkg/prod-deprecated/{schema-provider-BJ4TWnZf.js → schema-provider-CjX55uSY.js} +34 -77
- package/dist/unpkg/{prod/serialize-into-hash-DYU2egXl.js → prod-deprecated/serialize-into-hash-DGlzQteF.js} +1 -1
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +6 -5
- package/dist/unpkg/prod-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/prod-deprecated/serializer/rest.js +1 -1
- package/dist/unpkg/prod-deprecated/store.js +2 -1
- package/package.json +6 -6
|
@@ -21,8 +21,8 @@ from an adapter is rejected with a `InvalidError` the record will
|
|
|
21
21
|
transition to the `invalid` state and the errors will be set to the
|
|
22
22
|
`errors` property on the record.
|
|
23
23
|
|
|
24
|
-
For
|
|
25
|
-
properties on the model,
|
|
24
|
+
For WarpDrive to correctly map errors to their corresponding
|
|
25
|
+
properties on the model, WarpDrive expects each error to be
|
|
26
26
|
a valid JSON-API error object with a `source/pointer` that matches
|
|
27
27
|
the property name. For example, if you had a Post model that
|
|
28
28
|
looked like this.
|
|
@@ -106,7 +106,7 @@ look like this:
|
|
|
106
106
|
Note that the object root can be pluralized for both a single-object response
|
|
107
107
|
and an array response: the REST adapter is not strict on this. Further, if the
|
|
108
108
|
HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a
|
|
109
|
-
`findRecord` query) with more than one object in the array,
|
|
109
|
+
`findRecord` query) with more than one object in the array, WarpDrive will
|
|
110
110
|
only display the object with the matching ID.
|
|
111
111
|
|
|
112
112
|
### Conventional Names
|
|
@@ -167,7 +167,7 @@ response under a key for the type.
|
|
|
167
167
|
|
|
168
168
|
If the records in the relationship are not known when the response
|
|
169
169
|
is serialized it's also possible to represent the relationship as a
|
|
170
|
-
URL using the `links` key in the response.
|
|
170
|
+
URL using the `links` key in the response. WarpDrive will fetch
|
|
171
171
|
this URL to resolve the relationship when it is accessed for the
|
|
172
172
|
first time.
|
|
173
173
|
|
|
@@ -250,10 +250,7 @@ return {
|
|
|
250
250
|
}
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
@class RESTAdapter
|
|
254
253
|
@public
|
|
255
|
-
@constructor
|
|
256
|
-
@uses BuildURLMixin
|
|
257
254
|
*/
|
|
258
255
|
declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
259
256
|
_fastboot: FastBoot;
|
|
@@ -263,8 +260,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
263
260
|
/**
|
|
264
261
|
This property allows ajax to still be used instead when `false`.
|
|
265
262
|
|
|
266
|
-
@property useFetch
|
|
267
|
-
@type {Boolean}
|
|
268
263
|
@default true
|
|
269
264
|
@public
|
|
270
265
|
*/
|
|
@@ -310,8 +305,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
310
305
|
}
|
|
311
306
|
```
|
|
312
307
|
|
|
313
|
-
@param {Object} obj
|
|
314
|
-
@return {Object}
|
|
315
308
|
@public
|
|
316
309
|
*/
|
|
317
310
|
sortQueryParams(obj: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -359,9 +352,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
359
352
|
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
|
|
360
353
|
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
|
|
361
354
|
|
|
362
|
-
@property coalesceFindRequests
|
|
363
355
|
@public
|
|
364
|
-
@type {Boolean}
|
|
365
356
|
*/
|
|
366
357
|
get coalesceFindRequests(): boolean;
|
|
367
358
|
set coalesceFindRequests(value: boolean);
|
|
@@ -379,9 +370,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
379
370
|
|
|
380
371
|
Requests for the `Post` model would now target `/api/1/post/`.
|
|
381
372
|
|
|
382
|
-
@property namespace
|
|
383
373
|
@public
|
|
384
|
-
@type {String}
|
|
385
374
|
*/
|
|
386
375
|
/**
|
|
387
376
|
An adapter can target other hosts by setting the `host` property.
|
|
@@ -396,14 +385,12 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
396
385
|
|
|
397
386
|
Requests for the `Post` model would now target `https://api.example.com/post/`.
|
|
398
387
|
|
|
399
|
-
@property host
|
|
400
388
|
@public
|
|
401
|
-
@type {String}
|
|
402
389
|
*/
|
|
403
390
|
/**
|
|
404
391
|
Some APIs require HTTP headers, e.g. to provide an API
|
|
405
392
|
key. Arbitrary headers can be set as key/value pairs on the
|
|
406
|
-
`RESTAdapter`'s `headers` object and
|
|
393
|
+
`RESTAdapter`'s `headers` object and WarpDrive will send them
|
|
407
394
|
along with each ajax request..
|
|
408
395
|
|
|
409
396
|
```js [app/adapters/application.js]
|
|
@@ -419,9 +406,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
419
406
|
}
|
|
420
407
|
```
|
|
421
408
|
|
|
422
|
-
@property headers
|
|
423
409
|
@public
|
|
424
|
-
@type {Object}
|
|
425
410
|
*/
|
|
426
411
|
headers: Record<string, unknown> | undefined;
|
|
427
412
|
/**
|
|
@@ -435,11 +420,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
435
420
|
|
|
436
421
|
@since 1.13.0
|
|
437
422
|
@public
|
|
438
|
-
@param {Store} store
|
|
439
|
-
@param {Model} type
|
|
440
|
-
@param {String} id
|
|
441
|
-
@param {Snapshot} snapshot
|
|
442
|
-
@return {Promise} promise
|
|
443
423
|
*/
|
|
444
424
|
findRecord(store: Store, type: ModelSchema, id: string, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
445
425
|
/**
|
|
@@ -450,13 +430,8 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
450
430
|
promise for the resulting payload.
|
|
451
431
|
|
|
452
432
|
@public
|
|
453
|
-
@param {Store} store
|
|
454
|
-
@param {Model} type
|
|
455
|
-
@param {undefined} neverSet a value is never provided to this argument
|
|
456
|
-
@param {SnapshotRecordArray} snapshotRecordArray
|
|
457
|
-
@return {Promise} promise
|
|
458
433
|
*/
|
|
459
|
-
findAll(store: Store, type: ModelSchema,
|
|
434
|
+
findAll(store: Store, type: ModelSchema, neverUsed: null, snapshotRecordArray: SnapshotRecordArray): Promise<AdapterPayload>;
|
|
460
435
|
/**
|
|
461
436
|
Called by the store in order to fetch a JSON array for
|
|
462
437
|
the records that match a particular query.
|
|
@@ -469,12 +444,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
469
444
|
to the server as parameters.
|
|
470
445
|
|
|
471
446
|
@public
|
|
472
|
-
@param {Store} store
|
|
473
|
-
@param {Model} type
|
|
474
|
-
@param {Object} query
|
|
475
|
-
@param {Collection} recordArray
|
|
476
|
-
@param {Object} adapterOptions
|
|
477
|
-
@return {Promise} promise
|
|
478
447
|
*/
|
|
479
448
|
query(store: Store, type: ModelSchema, query: Record<string, unknown>): Promise<AdapterPayload>;
|
|
480
449
|
/**
|
|
@@ -490,11 +459,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
490
459
|
|
|
491
460
|
@since 1.13.0
|
|
492
461
|
@public
|
|
493
|
-
@param {Store} store
|
|
494
|
-
@param {Model} type
|
|
495
|
-
@param {Object} query
|
|
496
|
-
@param {Object} adapterOptions
|
|
497
|
-
@return {Promise} promise
|
|
498
462
|
*/
|
|
499
463
|
queryRecord(store: Store, type: ModelSchema, query: Record<string, unknown>, adapterOptions: Record<string, unknown>): Promise<AdapterPayload>;
|
|
500
464
|
/**
|
|
@@ -524,11 +488,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
524
488
|
promise for the resulting payload.
|
|
525
489
|
|
|
526
490
|
@public
|
|
527
|
-
@param {Store} store
|
|
528
|
-
@param {Model} type
|
|
529
|
-
@param {Array} ids
|
|
530
|
-
@param {Array} snapshots
|
|
531
|
-
@return {Promise} promise
|
|
532
491
|
*/
|
|
533
492
|
findMany(store: Store, type: ModelSchema, ids: string[], snapshots: Snapshot[]): Promise<AdapterPayload>;
|
|
534
493
|
/**
|
|
@@ -561,11 +520,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
561
520
|
* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.
|
|
562
521
|
|
|
563
522
|
@public
|
|
564
|
-
@param {Store} store
|
|
565
|
-
@param {Snapshot} snapshot
|
|
566
|
-
@param {String} url
|
|
567
|
-
@param {Object} relationship meta object describing the relationship
|
|
568
|
-
@return {Promise} promise
|
|
569
523
|
*/
|
|
570
524
|
findHasMany(store: Store, snapshot: Snapshot, url: string, relationship: Record<string, unknown>): Promise<AdapterPayload>;
|
|
571
525
|
/**
|
|
@@ -611,10 +565,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
611
565
|
of a record.
|
|
612
566
|
|
|
613
567
|
@public
|
|
614
|
-
@param {Store} store
|
|
615
|
-
@param {Model} type
|
|
616
|
-
@param {Snapshot} snapshot
|
|
617
|
-
@return {Promise} promise
|
|
618
568
|
*/
|
|
619
569
|
createRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
620
570
|
/**
|
|
@@ -628,10 +578,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
628
578
|
of a record.
|
|
629
579
|
|
|
630
580
|
@public
|
|
631
|
-
@param {Store} store
|
|
632
|
-
@param {Model} schema
|
|
633
|
-
@param {Snapshot} snapshot
|
|
634
|
-
@return {Promise} promise
|
|
635
581
|
*/
|
|
636
582
|
updateRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
637
583
|
/**
|
|
@@ -640,12 +586,11 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
640
586
|
The `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
|
|
641
587
|
|
|
642
588
|
@public
|
|
643
|
-
@param {Store} store
|
|
644
|
-
@param {Model} type
|
|
645
|
-
@param {Snapshot} snapshot
|
|
646
|
-
@return {Promise} promise
|
|
647
589
|
*/
|
|
648
590
|
deleteRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
591
|
+
/**
|
|
592
|
+
@private
|
|
593
|
+
*/
|
|
649
594
|
_stripIDFromURL(store: Store, snapshot: Snapshot): string;
|
|
650
595
|
maxURLLength: number;
|
|
651
596
|
/**
|
|
@@ -665,9 +610,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
665
610
|
and `/posts/2/comments/3`
|
|
666
611
|
|
|
667
612
|
@public
|
|
668
|
-
@
|
|
669
|
-
@param {Array} snapshots
|
|
670
|
-
@return {Array} an array of arrays of records, each of which is to be
|
|
613
|
+
@return an array of arrays of records, each of which is to be
|
|
671
614
|
loaded separately by `findMany`.
|
|
672
615
|
*/
|
|
673
616
|
groupRecordsForFindMany(store: Store, snapshots: Snapshot[]): Snapshot[][];
|
|
@@ -694,11 +637,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
694
637
|
|
|
695
638
|
@since 1.13.0
|
|
696
639
|
@public
|
|
697
|
-
@param {Number} status
|
|
698
|
-
@param {Object} headers
|
|
699
|
-
@param {Object} payload
|
|
700
|
-
@param {Object} requestData - the original request information
|
|
701
|
-
@return {Object | AdapterError} response
|
|
702
640
|
*/
|
|
703
641
|
handleResponse(status: number, headers: Record<string, string>, payload: Payload, requestData: RequestData): Payload | typeof AdapterError;
|
|
704
642
|
/**
|
|
@@ -707,10 +645,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
707
645
|
|
|
708
646
|
@since 1.13.0
|
|
709
647
|
@public
|
|
710
|
-
@param {Number} status
|
|
711
|
-
@param {Object} headers
|
|
712
|
-
@param {Object} payload
|
|
713
|
-
@return {Boolean}
|
|
714
648
|
*/
|
|
715
649
|
isSuccess(status: number, _headers: Record<string, unknown>, _payload: Payload): boolean;
|
|
716
650
|
/**
|
|
@@ -719,17 +653,13 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
719
653
|
|
|
720
654
|
@since 1.13.0
|
|
721
655
|
@public
|
|
722
|
-
@param {Number} status
|
|
723
|
-
@param {Object} headers
|
|
724
|
-
@param {Object} payload
|
|
725
|
-
@return {Boolean}
|
|
726
656
|
*/
|
|
727
657
|
isInvalid(status: number, _headers: Record<string, unknown>, _payload: Payload): boolean;
|
|
728
658
|
/**
|
|
729
659
|
Takes a URL, an HTTP method and a hash of data, and makes an
|
|
730
660
|
HTTP request.
|
|
731
661
|
|
|
732
|
-
When the server responds with a payload,
|
|
662
|
+
When the server responds with a payload, WarpDrive will call into `extractSingle`
|
|
733
663
|
or `extractArray` (depending on whether the original query was for one record or
|
|
734
664
|
many records).
|
|
735
665
|
|
|
@@ -743,40 +673,36 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
743
673
|
* Registers success and failure handlers.
|
|
744
674
|
|
|
745
675
|
@private
|
|
746
|
-
@param {String} url
|
|
747
|
-
@param {String} type The request type GET, POST, PUT, DELETE etc.
|
|
748
|
-
@param {Object} options
|
|
749
|
-
@return {Promise} promise
|
|
750
676
|
*/
|
|
751
677
|
ajax(url: string, type: HTTPMethod, options?: JQueryAjaxSettings | RequestInit): Promise<AdapterPayload>;
|
|
752
678
|
/**
|
|
753
679
|
@private
|
|
754
|
-
@param
|
|
680
|
+
@param options jQuery ajax options to be used for the ajax request
|
|
755
681
|
*/
|
|
756
682
|
_ajaxRequest(options: JQueryRequestInit): void;
|
|
683
|
+
/**
|
|
684
|
+
@private
|
|
685
|
+
*/
|
|
757
686
|
_fetchRequest(options: FetchRequestInit): Promise<Response>;
|
|
687
|
+
/**
|
|
688
|
+
@private
|
|
689
|
+
*/
|
|
758
690
|
_ajax(options: FetchRequestInit | JQueryRequestInit): void;
|
|
759
691
|
/**
|
|
760
692
|
@private
|
|
761
|
-
@param {String} url
|
|
762
|
-
@param {String} type The request type GET, POST, PUT, DELETE etc.
|
|
763
|
-
@param {Object} options
|
|
764
|
-
@return {Object}
|
|
765
693
|
*/
|
|
766
694
|
ajaxOptions(url: string, method: HTTPMethod, options: JQueryAjaxSettings | RequestInit): JQueryRequestInit | FetchRequestInit;
|
|
695
|
+
/**
|
|
696
|
+
* @private
|
|
697
|
+
*/
|
|
767
698
|
_ajaxURL(url: string): string;
|
|
768
699
|
/**
|
|
769
700
|
@private
|
|
770
|
-
@param {String} responseText
|
|
771
|
-
@return {Object}
|
|
772
701
|
*/
|
|
773
702
|
parseErrorResponse(responseText: string): Record<string, unknown> | string;
|
|
774
703
|
/**
|
|
775
704
|
@private
|
|
776
|
-
@
|
|
777
|
-
@param {Object} headers
|
|
778
|
-
@param {Object} payload
|
|
779
|
-
@return {Array} errors payload
|
|
705
|
+
@return errors payload
|
|
780
706
|
*/
|
|
781
707
|
normalizeErrorResponse(status: number, _headers: Record<string, unknown>, payload: Payload): Record<string, unknown>[];
|
|
782
708
|
/**
|
|
@@ -784,11 +710,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
784
710
|
of information for debugging (good luck!)
|
|
785
711
|
|
|
786
712
|
@private
|
|
787
|
-
@
|
|
788
|
-
@param {Object} headers
|
|
789
|
-
@param {Object} payload
|
|
790
|
-
@param {Object} requestData
|
|
791
|
-
@return {String} detailed error message
|
|
713
|
+
@return detailed error message
|
|
792
714
|
*/
|
|
793
715
|
generatedDetailedMessage(status: number, headers: Record<string, string>, payload: Payload, requestData: RequestData): string;
|
|
794
716
|
/**
|
|
@@ -797,8 +719,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
797
719
|
|
|
798
720
|
@since 2.5.0
|
|
799
721
|
@public
|
|
800
|
-
@param {Snapshot} snapshot
|
|
801
|
-
@return {Object}
|
|
802
722
|
*/
|
|
803
723
|
buildQuery(snapshot: Snapshot | SnapshotRecordArray): QueryState;
|
|
804
724
|
}
|
|
@@ -806,10 +726,7 @@ interface RESTAdapter extends MixtBuildURLMixin {}
|
|
|
806
726
|
/**
|
|
807
727
|
* Helper function that translates the options passed to `jQuery.ajax` into a format that `fetch` expects.
|
|
808
728
|
*
|
|
809
|
-
* @param {Object} _options
|
|
810
|
-
* @param {Adapter} adapter
|
|
811
729
|
* @private
|
|
812
|
-
* @return {Object}
|
|
813
730
|
*/
|
|
814
731
|
export declare function fetchOptions(options: JQueryRequestInit & Partial<FetchRequestInit>, adapter: RESTAdapter): FetchRequestInit;
|
|
815
732
|
export { RESTAdapter };
|
|
@@ -453,10 +453,10 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
453
453
|
|
|
454
454
|
The updateRecord method is expected to return a promise that will
|
|
455
455
|
resolve with the serialized record. This allows the backend to
|
|
456
|
-
inform the
|
|
456
|
+
inform the WarpDrive store the current state of this record after
|
|
457
457
|
the update. If it is not possible to return a serialized record
|
|
458
458
|
the updateRecord promise can also resolve with `undefined` and the
|
|
459
|
-
|
|
459
|
+
WarpDrive store will assume all of the updates were successfully
|
|
460
460
|
applied on the backend.
|
|
461
461
|
|
|
462
462
|
Example
|
|
@@ -428,9 +428,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
428
428
|
client. A record can also enter the empty state if the adapter is
|
|
429
429
|
unable to locate the record.
|
|
430
430
|
|
|
431
|
-
@property isEmpty
|
|
432
431
|
@public
|
|
433
|
-
@readonly
|
|
434
432
|
*/
|
|
435
433
|
get isEmpty(): boolean;
|
|
436
434
|
/**
|
|
@@ -439,9 +437,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
439
437
|
data. It remains in this state until the adapter provides the
|
|
440
438
|
requested data.
|
|
441
439
|
|
|
442
|
-
@property isLoading
|
|
443
440
|
@public
|
|
444
|
-
@readonly
|
|
445
441
|
*/
|
|
446
442
|
get isLoading(): boolean;
|
|
447
443
|
/**
|
|
@@ -460,9 +456,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
460
456
|
model.isLoaded;
|
|
461
457
|
```
|
|
462
458
|
|
|
463
|
-
@property isLoaded
|
|
464
459
|
@public
|
|
465
|
-
@readonly
|
|
466
460
|
*/
|
|
467
461
|
get isLoaded(): boolean;
|
|
468
462
|
/**
|
|
@@ -485,9 +479,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
485
479
|
```
|
|
486
480
|
|
|
487
481
|
@since 1.13.0
|
|
488
|
-
@property hasDirtyAttributes
|
|
489
482
|
@public
|
|
490
|
-
@readonly
|
|
491
483
|
*/
|
|
492
484
|
get hasDirtyAttributes(): boolean;
|
|
493
485
|
/**
|
|
@@ -508,9 +500,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
508
500
|
});
|
|
509
501
|
```
|
|
510
502
|
|
|
511
|
-
@property isSaving
|
|
512
503
|
@public
|
|
513
|
-
@readonly
|
|
514
504
|
*/
|
|
515
505
|
get isSaving(): boolean;
|
|
516
506
|
/**
|
|
@@ -546,9 +536,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
546
536
|
});
|
|
547
537
|
```
|
|
548
538
|
|
|
549
|
-
@property isDeleted
|
|
550
539
|
@public
|
|
551
|
-
@readonly
|
|
552
540
|
*/
|
|
553
541
|
get isDeleted(): boolean;
|
|
554
542
|
/**
|
|
@@ -568,9 +556,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
568
556
|
});
|
|
569
557
|
```
|
|
570
558
|
|
|
571
|
-
@property isNew
|
|
572
559
|
@public
|
|
573
|
-
@readonly
|
|
574
560
|
*/
|
|
575
561
|
get isNew(): boolean;
|
|
576
562
|
/**
|
|
@@ -579,9 +565,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
579
565
|
A record will be in the `valid` state when the adapter did not report any
|
|
580
566
|
server-side validation failures.
|
|
581
567
|
|
|
582
|
-
@property isValid
|
|
583
568
|
@public
|
|
584
|
-
@readonly
|
|
585
569
|
*/
|
|
586
570
|
get isValid(): boolean;
|
|
587
571
|
/**
|
|
@@ -600,9 +584,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
600
584
|
record.dirtyType; // 'created'
|
|
601
585
|
```
|
|
602
586
|
|
|
603
|
-
@property dirtyType
|
|
604
587
|
@public
|
|
605
|
-
@readonly
|
|
606
588
|
*/
|
|
607
589
|
get dirtyType(): "created" | "updated" | "deleted" | "";
|
|
608
590
|
/**
|
|
@@ -620,9 +602,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
620
602
|
});
|
|
621
603
|
```
|
|
622
604
|
|
|
623
|
-
@property isError
|
|
624
605
|
@public
|
|
625
|
-
@readonly
|
|
626
606
|
*/
|
|
627
607
|
get isError(): boolean;
|
|
628
608
|
set isError(v: boolean);
|
|
@@ -637,9 +617,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
637
617
|
record.isReloading; // true
|
|
638
618
|
```
|
|
639
619
|
|
|
640
|
-
@property isReloading
|
|
641
620
|
@public
|
|
642
|
-
@readonly
|
|
643
621
|
*/
|
|
644
622
|
isReloading: boolean;
|
|
645
623
|
/**
|
|
@@ -657,14 +635,12 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
657
635
|
model.id; // '1'
|
|
658
636
|
```
|
|
659
637
|
|
|
660
|
-
@property id
|
|
661
638
|
@public
|
|
662
639
|
*/
|
|
663
640
|
get id(): string | null;
|
|
664
641
|
set id(id: string | null);
|
|
665
642
|
toString(): string;
|
|
666
643
|
/**
|
|
667
|
-
@property currentState
|
|
668
644
|
@private
|
|
669
645
|
*/
|
|
670
646
|
get currentState(): RecordState;
|
|
@@ -672,9 +648,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
672
648
|
/**
|
|
673
649
|
The store service instance which created this record instance
|
|
674
650
|
|
|
675
|
-
@property store
|
|
676
651
|
@public
|
|
677
652
|
*/
|
|
653
|
+
store: Store;
|
|
678
654
|
/**
|
|
679
655
|
When the record is in the `invalid` state this object will contain
|
|
680
656
|
any errors returned by the adapter. When present the errors hash
|
|
@@ -723,7 +699,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
723
699
|
{{/each}}
|
|
724
700
|
```
|
|
725
701
|
|
|
726
|
-
@property errors
|
|
727
702
|
@public
|
|
728
703
|
*/
|
|
729
704
|
get errors(): Errors;
|
|
@@ -731,7 +706,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
731
706
|
This property holds the `AdapterError` object with which
|
|
732
707
|
last adapter operation was rejected.
|
|
733
708
|
|
|
734
|
-
@property adapterError
|
|
735
709
|
@public
|
|
736
710
|
*/
|
|
737
711
|
get adapterError(): unknown;
|
|
@@ -818,9 +792,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
818
792
|
}
|
|
819
793
|
});
|
|
820
794
|
```
|
|
821
|
-
|
|
795
|
+
|
|
822
796
|
@public
|
|
823
|
-
@readonly
|
|
824
797
|
*/
|
|
825
798
|
static modelName: string;
|
|
826
799
|
/**
|
|
@@ -912,9 +885,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
912
885
|
//=> [ { name: 'posts', kind: 'hasMany' } ]
|
|
913
886
|
```
|
|
914
887
|
|
|
915
|
-
@property relationships
|
|
916
888
|
@public
|
|
917
|
-
@readonly
|
|
918
889
|
*/
|
|
919
890
|
static get relationships(): Map<string, LegacyRelationshipField[]>;
|
|
920
891
|
/**
|
|
@@ -945,9 +916,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
945
916
|
//=> ['owner']
|
|
946
917
|
```
|
|
947
918
|
|
|
948
|
-
@property relationshipNames
|
|
949
919
|
@public
|
|
950
|
-
@readonly
|
|
951
920
|
*/
|
|
952
921
|
static get relationshipNames(): {
|
|
953
922
|
hasMany: string[];
|
|
@@ -980,9 +949,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
980
949
|
//=> ['user', 'post']
|
|
981
950
|
```
|
|
982
951
|
|
|
983
|
-
@property relatedTypes
|
|
984
952
|
@public
|
|
985
|
-
@readonly
|
|
986
953
|
*/
|
|
987
954
|
static get relatedTypes(): string[];
|
|
988
955
|
/**
|
|
@@ -1015,9 +982,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1015
982
|
//=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }
|
|
1016
983
|
```
|
|
1017
984
|
|
|
1018
|
-
@property relationshipsByName
|
|
1019
985
|
@public
|
|
1020
|
-
@readonly
|
|
1021
986
|
*/
|
|
1022
987
|
static get relationshipsByName(): Map<string, LegacyRelationshipField>;
|
|
1023
988
|
static get relationshipsObject(): Record<string, LegacyRelationshipField>;
|
|
@@ -1056,9 +1021,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1056
1021
|
// title, attribute
|
|
1057
1022
|
```
|
|
1058
1023
|
|
|
1059
|
-
@property fields
|
|
1060
1024
|
@public
|
|
1061
|
-
@readonly
|
|
1062
1025
|
*/
|
|
1063
1026
|
static get fields(): Map<string, "attribute" | "belongsTo" | "hasMany">;
|
|
1064
1027
|
/**
|
|
@@ -1067,8 +1030,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1067
1030
|
descriptor.
|
|
1068
1031
|
|
|
1069
1032
|
@public
|
|
1070
|
-
@param
|
|
1071
|
-
@param
|
|
1033
|
+
@param callback the callback to invoke
|
|
1034
|
+
@param binding the value to which the callback's `this` should be bound
|
|
1072
1035
|
*/
|
|
1073
1036
|
static eachRelationship<
|
|
1074
1037
|
T,
|
|
@@ -1081,8 +1044,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1081
1044
|
with a model.
|
|
1082
1045
|
|
|
1083
1046
|
@public
|
|
1084
|
-
@param
|
|
1085
|
-
@param
|
|
1047
|
+
@param callback the callback to invoke
|
|
1048
|
+
@param binding the value to which the callback's `this` should be bound
|
|
1086
1049
|
*/
|
|
1087
1050
|
static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T): void;
|
|
1088
1051
|
/**
|
|
@@ -1123,9 +1086,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1123
1086
|
// birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
|
|
1124
1087
|
```
|
|
1125
1088
|
|
|
1126
|
-
@property attributes
|
|
1127
1089
|
@public
|
|
1128
|
-
@readonly
|
|
1129
1090
|
*/
|
|
1130
1091
|
static get attributes(): Map<string, LegacyAttributeField>;
|
|
1131
1092
|
/**
|
|
@@ -1160,9 +1121,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1160
1121
|
// birthday date
|
|
1161
1122
|
```
|
|
1162
1123
|
|
|
1163
|
-
@property transformedAttributes
|
|
1164
1124
|
@public
|
|
1165
|
-
@readonly
|
|
1166
1125
|
*/
|
|
1167
1126
|
static get transformedAttributes(): Map<string, string>;
|
|
1168
1127
|
/**
|
|
@@ -1204,8 +1163,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1204
1163
|
```
|
|
1205
1164
|
|
|
1206
1165
|
@public
|
|
1207
|
-
@param
|
|
1208
|
-
@param
|
|
1166
|
+
@param callback The callback to execute
|
|
1167
|
+
@param binding [optional] the value to which the callback's `this` should be bound
|
|
1209
1168
|
*/
|
|
1210
1169
|
static eachAttribute<
|
|
1211
1170
|
T,
|
|
@@ -1251,8 +1210,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1251
1210
|
```
|
|
1252
1211
|
|
|
1253
1212
|
@public
|
|
1254
|
-
@param
|
|
1255
|
-
@param
|
|
1213
|
+
@param callback The callback to execute
|
|
1214
|
+
@param binding [optional] the value to which the callback's `this` should be bound
|
|
1256
1215
|
*/
|
|
1257
1216
|
static eachTransformedAttribute<
|
|
1258
1217
|
T,
|