@warp-drive/legacy 5.8.0-alpha.4 → 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/README.md +14 -27
- package/declarations/adapter/error.d.ts +7 -7
- package/declarations/adapter/json-api.d.ts +6 -8
- package/declarations/adapter/rest.d.ts +26 -112
- package/declarations/adapter.d.ts +6 -8
- package/declarations/compat/-private.d.ts +1 -1
- package/declarations/compat/builders/find-all.d.ts +6 -6
- package/declarations/compat/builders/find-record.d.ts +8 -8
- package/declarations/compat/builders/query.d.ts +12 -12
- package/declarations/compat/extensions.d.ts +1 -1
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +7 -9
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +20 -30
- package/declarations/compat/utils.d.ts +17 -17
- package/declarations/compat.d.ts +35 -11
- package/declarations/index.d.ts +70 -0
- package/declarations/model/-private/attr.d.ts +5 -6
- package/declarations/model/-private/belongs-to.d.ts +4 -5
- package/declarations/model/-private/has-many.d.ts +4 -5
- package/declarations/model/-private/hooks.d.ts +1 -1
- package/declarations/model/-private/legacy-relationships-support.d.ts +2 -2
- package/declarations/model/-private/model.d.ts +18 -59
- package/declarations/model/-private/promise-many-array.d.ts +0 -18
- package/declarations/model/-private/record-state.d.ts +1 -1
- package/declarations/model/-private/references/belongs-to.d.ts +19 -29
- package/declarations/model/-private/references/has-many.d.ts +14 -16
- package/declarations/model/migration-support.d.ts +46 -21
- package/declarations/model-fragments/extensions/fragment-array.d.ts +16 -0
- package/declarations/model-fragments/extensions/fragment.d.ts +15 -0
- package/declarations/model-fragments/hooks/model-for.d.ts +20 -0
- package/declarations/model-fragments/index.d.ts +5 -0
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +9 -0
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +15 -0
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +20 -0
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +19 -0
- package/declarations/model-fragments/utilities/with-legacy.d.ts +3 -0
- package/declarations/model-fragments.d.ts +9 -0
- package/declarations/model.d.ts +2 -2
- package/declarations/serializer/-private/embedded-records-mixin.d.ts +1 -6
- package/declarations/serializer/-private/transforms/boolean.d.ts +2 -2
- package/declarations/serializer/-private/transforms/date.d.ts +2 -2
- package/declarations/serializer/-private/transforms/number.d.ts +1 -1
- package/declarations/serializer/-private/transforms/string.d.ts +1 -1
- package/declarations/serializer/json-api.d.ts +11 -12
- package/declarations/serializer/json.d.ts +9 -11
- package/declarations/serializer/rest.d.ts +4 -6
- package/declarations/serializer.d.ts +9 -12
- package/dist/{-private-8UmnAf9J.js → -private-BG3bMiKp.js} +3 -2
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +14 -15
- package/dist/adapter/json-api.js +4 -1
- package/dist/adapter/rest.js +38 -125
- package/dist/adapter.js +6 -8
- package/dist/compat/-private.js +1 -1
- package/dist/compat/builders.js +26 -26
- package/dist/compat/utils.js +17 -18
- package/dist/compat.js +61 -43
- package/dist/{errors-8kD2mSe_.js → errors-Cz5KrzBk.js} +115 -122
- package/dist/hooks-D6diaM34.js +74 -0
- package/dist/index.js +195 -0
- package/dist/{json-DziiodPf.js → json-ChdEfB0X.js} +18 -35
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +57 -25
- package/dist/model-for-CqXsIKws.js +221 -0
- package/dist/model-fragments.js +76 -0
- package/dist/model.js +18 -90
- package/dist/{schema-provider-DQu4Rjco.js → schema-provider-DJCV_6AF.js} +50 -95
- package/dist/{serialize-into-hash-CS0MIv4F.js → serialize-into-hash-DPZYoF-i.js} +1 -1
- package/dist/serializer/json-api.js +18 -45
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +14 -21
- package/dist/serializer/transform.js +15 -6
- package/dist/serializer.js +9 -13
- package/dist/store.js +5 -1
- package/dist/unpkg/dev/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev/adapter/-private.js +1 -0
- package/dist/unpkg/dev/adapter/error.js +335 -0
- package/dist/unpkg/dev/adapter/json-api.js +271 -0
- package/dist/unpkg/dev/adapter/rest.js +1171 -0
- package/dist/unpkg/dev/adapter.js +1252 -0
- package/dist/unpkg/dev/compat/-private.js +1 -0
- package/dist/unpkg/dev/compat/builders.js +275 -0
- package/dist/unpkg/dev/compat/extensions.js +242 -0
- package/dist/unpkg/dev/compat/utils.js +223 -0
- package/dist/unpkg/dev/compat.js +1147 -0
- package/dist/unpkg/dev/errors-DmGGJr3T.js +2562 -0
- package/dist/unpkg/dev/hooks-CkYiE6Ud.js +73 -0
- package/dist/unpkg/dev/index.js +197 -0
- package/dist/unpkg/dev/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev/model/-private.js +1 -0
- package/dist/unpkg/dev/model/migration-support.js +553 -0
- package/dist/unpkg/dev/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev/model-fragments.js +76 -0
- package/dist/unpkg/dev/model.js +678 -0
- package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +2186 -0
- package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev/serializer/json-api.js +649 -0
- package/dist/unpkg/dev/serializer/json.js +4 -0
- package/dist/unpkg/dev/serializer/rest.js +1242 -0
- package/dist/unpkg/dev/serializer/transform.js +278 -0
- package/dist/unpkg/dev/serializer.js +248 -0
- package/dist/unpkg/dev/store.js +637 -0
- package/dist/unpkg/dev/util-DvanW33H.js +20 -0
- package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/adapter/error.js +335 -0
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +271 -0
- package/dist/unpkg/dev-deprecated/adapter/rest.js +1171 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1252 -0
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/compat/builders.js +275 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js +242 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js +223 -0
- package/dist/unpkg/dev-deprecated/compat.js +1147 -0
- package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +2565 -0
- package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +73 -0
- package/dist/unpkg/dev-deprecated/index.js +196 -0
- package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/model/migration-support.js +570 -0
- package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/dev-deprecated/model.js +682 -0
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +2211 -0
- package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +649 -0
- package/dist/unpkg/dev-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/dev-deprecated/serializer/rest.js +1242 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/dev-deprecated/serializer.js +248 -0
- package/dist/unpkg/dev-deprecated/store.js +637 -0
- package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +24 -0
- package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
- package/dist/unpkg/prod/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod/adapter/-private.js +1 -0
- package/dist/unpkg/prod/adapter/error.js +330 -0
- package/dist/unpkg/prod/adapter/json-api.js +266 -0
- package/dist/unpkg/prod/adapter/rest.js +1134 -0
- package/dist/unpkg/prod/adapter.js +1219 -0
- package/dist/unpkg/prod/compat/-private.js +1 -0
- package/dist/unpkg/prod/compat/builders.js +210 -0
- package/dist/unpkg/prod/compat/extensions.js +232 -0
- package/dist/unpkg/prod/compat/utils.js +218 -0
- package/dist/unpkg/prod/compat.js +727 -0
- package/dist/unpkg/prod/errors-BGVFCBmi.js +2314 -0
- package/dist/unpkg/prod/hooks-BztVA_x0.js +41 -0
- package/dist/unpkg/prod/index.js +151 -0
- package/dist/unpkg/prod/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod/model/-private.js +1 -0
- package/dist/unpkg/prod/model/migration-support.js +546 -0
- package/dist/unpkg/prod/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod/model-fragments.js +76 -0
- package/dist/unpkg/prod/model.js +593 -0
- package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +1861 -0
- package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod/serializer/json-api.js +592 -0
- package/dist/unpkg/prod/serializer/json.js +4 -0
- package/dist/unpkg/prod/serializer/rest.js +1210 -0
- package/dist/unpkg/prod/serializer/transform.js +278 -0
- package/dist/unpkg/prod/serializer.js +248 -0
- package/dist/unpkg/prod/store.js +505 -0
- package/dist/unpkg/prod/util-DvanW33H.js +20 -0
- package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/adapter/error.js +330 -0
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +266 -0
- package/dist/unpkg/prod-deprecated/adapter/rest.js +1134 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1219 -0
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/compat/builders.js +210 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js +232 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js +218 -0
- package/dist/unpkg/prod-deprecated/compat.js +727 -0
- package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +2317 -0
- package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +41 -0
- package/dist/unpkg/prod-deprecated/index.js +150 -0
- package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/model/migration-support.js +563 -0
- package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/prod-deprecated/model.js +596 -0
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +1904 -0
- package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +592 -0
- package/dist/unpkg/prod-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/prod-deprecated/serializer/rest.js +1210 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/prod-deprecated/serializer.js +248 -0
- package/dist/unpkg/prod-deprecated/store.js +505 -0
- package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +23 -0
- package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +14 -6
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
|
@@ -28,9 +28,6 @@ export type FactoryCache = Record<string, ModelFactory>;
|
|
|
28
28
|
export type ModelStore = Store & {
|
|
29
29
|
_modelFactoryCache: FactoryCache;
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
* @noInheritDoc
|
|
33
|
-
*/
|
|
34
31
|
interface Model {
|
|
35
32
|
/**
|
|
36
33
|
* The store service instance which created this record instance
|
|
@@ -89,8 +86,8 @@ interface Model {
|
|
|
89
86
|
```
|
|
90
87
|
|
|
91
88
|
@public
|
|
92
|
-
@param
|
|
93
|
-
@return
|
|
89
|
+
@param options
|
|
90
|
+
@return a promise that will be resolved when the adapter returns
|
|
94
91
|
successfully or rejected if the adapter returns with an error.
|
|
95
92
|
*/
|
|
96
93
|
destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
|
|
@@ -204,9 +201,9 @@ interface Model {
|
|
|
204
201
|
}
|
|
205
202
|
```
|
|
206
203
|
|
|
204
|
+
@deprecated use {@link Store.request} instead
|
|
207
205
|
@public
|
|
208
|
-
@
|
|
209
|
-
@return {Promise} a promise that will be resolved when the adapter returns
|
|
206
|
+
@return a promise that will be resolved when the adapter returns
|
|
210
207
|
successfully or rejected if the adapter returns with an error.
|
|
211
208
|
*/
|
|
212
209
|
save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
|
|
@@ -414,7 +411,10 @@ interface Model {
|
|
|
414
411
|
* the class to use as the reactive object for data of resource
|
|
415
412
|
* of that type.
|
|
416
413
|
*
|
|
414
|
+
* @public
|
|
417
415
|
* @noInheritDoc
|
|
416
|
+
* @hideconstructor
|
|
417
|
+
* @legacy
|
|
418
418
|
*/
|
|
419
419
|
declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
420
420
|
/** @private */
|
|
@@ -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;
|
|
@@ -797,7 +771,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
797
771
|
Represents the model's class name as a string. This can be used to look up the model's class name through
|
|
798
772
|
`Store`'s modelFor method.
|
|
799
773
|
|
|
800
|
-
`modelName` is generated for you by
|
|
774
|
+
`modelName` is generated for you by WarpDrive. It will be a lowercased, dasherized string.
|
|
801
775
|
For example:
|
|
802
776
|
|
|
803
777
|
```javascript
|
|
@@ -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,
|
|
@@ -22,7 +22,6 @@ In your JS code you should resolve the promise first.
|
|
|
22
22
|
const comments = await post.comments;
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
@class PromiseManyArray
|
|
26
25
|
@public
|
|
27
26
|
*/
|
|
28
27
|
export declare class PromiseManyArray<T = unknown> {
|
|
@@ -32,7 +31,6 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
32
31
|
constructor(promise: Promise<ManyArray<T>>, content?: ManyArray<T>);
|
|
33
32
|
/**
|
|
34
33
|
* Retrieve the length of the content
|
|
35
|
-
* @property length
|
|
36
34
|
* @public
|
|
37
35
|
*/
|
|
38
36
|
get length(): number;
|
|
@@ -50,39 +48,29 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
50
48
|
/**
|
|
51
49
|
* Reload the relationship
|
|
52
50
|
* @public
|
|
53
|
-
* @param options
|
|
54
|
-
* @return
|
|
55
51
|
*/
|
|
56
52
|
reload(options: Omit<BaseFinderOptions, "">): this;
|
|
57
53
|
/**
|
|
58
54
|
* Whether the loading promise is still pending
|
|
59
55
|
*
|
|
60
|
-
* @property isPending
|
|
61
|
-
* @type {Boolean}
|
|
62
56
|
* @public
|
|
63
57
|
*/
|
|
64
58
|
isPending: boolean;
|
|
65
59
|
/**
|
|
66
60
|
* Whether the loading promise rejected
|
|
67
61
|
*
|
|
68
|
-
* @property isRejected
|
|
69
|
-
* @type {Boolean}
|
|
70
62
|
* @public
|
|
71
63
|
*/
|
|
72
64
|
isRejected: boolean;
|
|
73
65
|
/**
|
|
74
66
|
* Whether the loading promise succeeded
|
|
75
67
|
*
|
|
76
|
-
* @property isFulfilled
|
|
77
|
-
* @type {Boolean}
|
|
78
68
|
* @public
|
|
79
69
|
*/
|
|
80
70
|
isFulfilled: boolean;
|
|
81
71
|
/**
|
|
82
72
|
* Whether the loading promise completed (resolved or rejected)
|
|
83
73
|
*
|
|
84
|
-
* @property isSettled
|
|
85
|
-
* @type {Boolean}
|
|
86
74
|
* @public
|
|
87
75
|
*/
|
|
88
76
|
isSettled: boolean;
|
|
@@ -95,28 +83,22 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
95
83
|
/**
|
|
96
84
|
* catch errors thrown by this promise
|
|
97
85
|
* @public
|
|
98
|
-
* @param callback
|
|
99
|
-
* @return {Promise}
|
|
100
86
|
*/
|
|
101
87
|
catch(cb: Parameters<Promise<ManyArray<T>>["catch"]>[0]): Promise<unknown>;
|
|
102
88
|
/**
|
|
103
89
|
* run cleanup after this promise completes
|
|
104
90
|
*
|
|
105
91
|
* @public
|
|
106
|
-
* @param callback
|
|
107
|
-
* @return {Promise}
|
|
108
92
|
*/
|
|
109
93
|
finally(cb: Parameters<Promise<ManyArray<T>>["finally"]>[0]): Promise<unknown>;
|
|
110
94
|
destroy(): void;
|
|
111
95
|
/**
|
|
112
96
|
* Retrieve the links for this relationship
|
|
113
|
-
* @property links
|
|
114
97
|
* @public
|
|
115
98
|
*/
|
|
116
99
|
get links(): Links | null | undefined;
|
|
117
100
|
/**
|
|
118
101
|
* Retrieve the meta for this relationship
|
|
119
|
-
* @property meta
|
|
120
102
|
* @public
|
|
121
103
|
*/
|
|
122
104
|
get meta(): Record<string, unknown> | null | undefined;
|
|
@@ -10,11 +10,11 @@ A `BelongsToReference` is a low-level API that allows access
|
|
|
10
10
|
and manipulation of a belongsTo relationship.
|
|
11
11
|
|
|
12
12
|
It is especially useful when you're dealing with `async` relationships
|
|
13
|
-
from `@
|
|
13
|
+
from `@warp-drive/legacy/model` as it allows synchronous access to
|
|
14
14
|
the relationship data if loaded, as well as APIs for loading, reloading
|
|
15
15
|
the data or accessing available information without triggering a load.
|
|
16
16
|
|
|
17
|
-
It may also be useful when using `sync` relationships with `@
|
|
17
|
+
It may also be useful when using `sync` relationships with `@warp-drive/legacy/model`
|
|
18
18
|
that need to be loaded/reloaded with more precise timing than marking the
|
|
19
19
|
relationship as `async` and relying on autofetch would have allowed.
|
|
20
20
|
|
|
@@ -30,7 +30,6 @@ invalidate if the relationship state changes.
|
|
|
30
30
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
31
31
|
for a given relationship will always return the same HasManyReference.
|
|
32
32
|
|
|
33
|
-
@class BelongsToReference
|
|
34
33
|
@public
|
|
35
34
|
*/
|
|
36
35
|
export default class BelongsToReference<
|
|
@@ -44,17 +43,11 @@ export default class BelongsToReference<
|
|
|
44
43
|
/**
|
|
45
44
|
* The field name on the parent record for this has-many relationship.
|
|
46
45
|
*
|
|
47
|
-
* @property key
|
|
48
|
-
* @type {String}
|
|
49
|
-
* @public
|
|
50
46
|
*/
|
|
51
47
|
key: K;
|
|
52
48
|
/**
|
|
53
49
|
* The type of resource this relationship will contain.
|
|
54
50
|
*
|
|
55
|
-
* @property type
|
|
56
|
-
* @type {String}
|
|
57
|
-
* @public
|
|
58
51
|
*/
|
|
59
52
|
type: TypeFromInstanceOrString<Related>;
|
|
60
53
|
___token: object;
|
|
@@ -67,9 +60,6 @@ export default class BelongsToReference<
|
|
|
67
60
|
* The identifier of the record that this reference refers to.
|
|
68
61
|
* `null` if no related record is known.
|
|
69
62
|
*
|
|
70
|
-
* @property identifier
|
|
71
|
-
* @type {ResourceKey | null}
|
|
72
|
-
* @public
|
|
73
63
|
*/
|
|
74
64
|
get identifier(): ResourceKey<TypeFromInstanceOrString<Related>> | null;
|
|
75
65
|
/**
|
|
@@ -109,11 +99,11 @@ export default class BelongsToReference<
|
|
|
109
99
|
```
|
|
110
100
|
|
|
111
101
|
@public
|
|
112
|
-
@return
|
|
102
|
+
@return The id of the record in this belongsTo relationship.
|
|
113
103
|
*/
|
|
114
104
|
id(): string | null;
|
|
115
105
|
/**
|
|
116
|
-
The link
|
|
106
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
117
107
|
relationship. By default it uses only the "related" resource linkage.
|
|
118
108
|
|
|
119
109
|
Example
|
|
@@ -147,7 +137,7 @@ export default class BelongsToReference<
|
|
|
147
137
|
```
|
|
148
138
|
|
|
149
139
|
@public
|
|
150
|
-
@return
|
|
140
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
151
141
|
*/
|
|
152
142
|
link(): string | null;
|
|
153
143
|
/**
|
|
@@ -194,7 +184,7 @@ export default class BelongsToReference<
|
|
|
194
184
|
```
|
|
195
185
|
|
|
196
186
|
@public
|
|
197
|
-
@return
|
|
187
|
+
@return The meta information for the belongs-to relationship.
|
|
198
188
|
*/
|
|
199
189
|
meta(): Meta | null;
|
|
200
190
|
_resource(): SingleResourceRelationship<ResourceKey<TypeFromInstance<Related>>>;
|
|
@@ -206,7 +196,7 @@ export default class BelongsToReference<
|
|
|
206
196
|
Example
|
|
207
197
|
|
|
208
198
|
```js [app/models/post.js]
|
|
209
|
-
import Model, { hasMany } from '@
|
|
199
|
+
import Model, { hasMany } from '@warp-drive/legacy/model';
|
|
210
200
|
|
|
211
201
|
export default class PostModel extends Model {
|
|
212
202
|
@hasMany('comment', { async: true, inverse: null }) comments;
|
|
@@ -237,11 +227,11 @@ export default class BelongsToReference<
|
|
|
237
227
|
```
|
|
238
228
|
|
|
239
229
|
@public
|
|
240
|
-
@return
|
|
230
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
241
231
|
*/
|
|
242
232
|
remoteType(): "link" | "id";
|
|
243
233
|
/**
|
|
244
|
-
`push` can be used to update the data in the relationship and
|
|
234
|
+
`push` can be used to update the data in the relationship and WarpDrive
|
|
245
235
|
will treat the new data as the canonical value of this relationship on
|
|
246
236
|
the backend. A value of `null` (e.g. `{ data: null }`) can be passed to
|
|
247
237
|
clear the relationship.
|
|
@@ -328,9 +318,9 @@ export default class BelongsToReference<
|
|
|
328
318
|
forcing the load of all of the associated record.
|
|
329
319
|
|
|
330
320
|
@public
|
|
331
|
-
@param
|
|
332
|
-
@param
|
|
333
|
-
@return
|
|
321
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
322
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
323
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
334
324
|
*/
|
|
335
325
|
push(doc: SingleResourceDocument, skipFetch?: boolean): Promise<Related | null | void>;
|
|
336
326
|
/**
|
|
@@ -380,7 +370,7 @@ export default class BelongsToReference<
|
|
|
380
370
|
```
|
|
381
371
|
|
|
382
372
|
@public
|
|
383
|
-
@return
|
|
373
|
+
@return the record in this relationship
|
|
384
374
|
*/
|
|
385
375
|
value(): Related | null;
|
|
386
376
|
/**
|
|
@@ -430,7 +420,7 @@ export default class BelongsToReference<
|
|
|
430
420
|
});
|
|
431
421
|
```
|
|
432
422
|
```js [app/adapters/user.js]
|
|
433
|
-
import Adapter from '@
|
|
423
|
+
import Adapter from '@warp-drive/legacy/adapter';
|
|
434
424
|
|
|
435
425
|
export default class UserAdapter extends Adapter {
|
|
436
426
|
findRecord(store, type, id, snapshot) {
|
|
@@ -441,13 +431,13 @@ export default class BelongsToReference<
|
|
|
441
431
|
```
|
|
442
432
|
|
|
443
433
|
@public
|
|
444
|
-
@param
|
|
445
|
-
@return
|
|
434
|
+
@param options the options to pass in.
|
|
435
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
446
436
|
*/
|
|
447
437
|
load(options?: Record<string, unknown>): Promise<Related | null>;
|
|
448
438
|
/**
|
|
449
439
|
Triggers a reload of the value in this relationship. If the
|
|
450
|
-
remoteType is `"link"`
|
|
440
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
451
441
|
reload the relationship. Otherwise it will reload the record by its
|
|
452
442
|
id.
|
|
453
443
|
|
|
@@ -491,8 +481,8 @@ export default class BelongsToReference<
|
|
|
491
481
|
```
|
|
492
482
|
|
|
493
483
|
@public
|
|
494
|
-
@param
|
|
495
|
-
@return
|
|
484
|
+
@param options the options to pass in.
|
|
485
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
496
486
|
*/
|
|
497
487
|
reload(options?: Record<string, unknown>): Promise<Related | null>;
|
|
498
488
|
}
|
|
@@ -19,11 +19,11 @@ A `HasManyReference` is a low-level API that allows access
|
|
|
19
19
|
and manipulation of a hasMany relationship.
|
|
20
20
|
|
|
21
21
|
It is especially useful when you're dealing with `async` relationships
|
|
22
|
-
from `@
|
|
22
|
+
from `@warp-drive/legacy/model` as it allows synchronous access to
|
|
23
23
|
the relationship data if loaded, as well as APIs for loading, reloading
|
|
24
24
|
the data or accessing available information without triggering a load.
|
|
25
25
|
|
|
26
|
-
It may also be useful when using `sync` relationships with `@
|
|
26
|
+
It may also be useful when using `sync` relationships with `@warp-drive/legacy/model`
|
|
27
27
|
that need to be loaded/reloaded with more precise timing than marking the
|
|
28
28
|
relationship as `async` and relying on autofetch would have allowed.
|
|
29
29
|
|
|
@@ -119,7 +119,7 @@ export default class HasManyReference<
|
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
@public
|
|
122
|
-
@return
|
|
122
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
123
123
|
*/
|
|
124
124
|
remoteType(): "link" | "ids";
|
|
125
125
|
/**
|
|
@@ -154,11 +154,11 @@ export default class HasManyReference<
|
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
@public
|
|
157
|
-
@return
|
|
157
|
+
@return The ids in this has-many relationship
|
|
158
158
|
*/
|
|
159
159
|
ids(): Array<string | null>;
|
|
160
160
|
/**
|
|
161
|
-
The link
|
|
161
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
162
162
|
relationship. By default it uses only the "related" resource linkage.
|
|
163
163
|
|
|
164
164
|
Example
|
|
@@ -192,7 +192,7 @@ export default class HasManyReference<
|
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
@public
|
|
195
|
-
@return
|
|
195
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
196
196
|
*/
|
|
197
197
|
link(): string | null;
|
|
198
198
|
/**
|
|
@@ -239,11 +239,11 @@ export default class HasManyReference<
|
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
@public
|
|
242
|
-
@return
|
|
242
|
+
@return The meta information for the belongs-to relationship.
|
|
243
243
|
*/
|
|
244
244
|
meta(): Meta | null;
|
|
245
245
|
/**
|
|
246
|
-
`push` can be used to update the data in the relationship and
|
|
246
|
+
`push` can be used to update the data in the relationship and WarpDrive
|
|
247
247
|
will treat the new data as the canonical value of this relationship on
|
|
248
248
|
the backend. An empty array will signify the canonical value should be
|
|
249
249
|
empty.
|
|
@@ -335,9 +335,8 @@ export default class HasManyReference<
|
|
|
335
335
|
forcing the load of all of the associated records.
|
|
336
336
|
|
|
337
337
|
@public
|
|
338
|
-
@param
|
|
339
|
-
@param
|
|
340
|
-
@return {Promise<ManyArray | void>}
|
|
338
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
339
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
341
340
|
*/
|
|
342
341
|
push(doc: ExistingResourceObject[] | CollectionResourceDocument, skipFetch?: boolean): Promise<ManyArray<Related> | void>;
|
|
343
342
|
_isLoaded(): boolean;
|
|
@@ -379,7 +378,6 @@ export default class HasManyReference<
|
|
|
379
378
|
```
|
|
380
379
|
|
|
381
380
|
@public
|
|
382
|
-
@return {ManyArray}
|
|
383
381
|
*/
|
|
384
382
|
value(): ManyArray<Related> | null;
|
|
385
383
|
/**
|
|
@@ -441,8 +439,8 @@ export default class HasManyReference<
|
|
|
441
439
|
```
|
|
442
440
|
|
|
443
441
|
@public
|
|
444
|
-
@param
|
|
445
|
-
@return
|
|
442
|
+
@param options the options to pass in.
|
|
443
|
+
@return a promise that resolves with the ManyArray in
|
|
446
444
|
this has-many relationship.
|
|
447
445
|
*/
|
|
448
446
|
load(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
|
|
@@ -492,8 +490,8 @@ export default class HasManyReference<
|
|
|
492
490
|
```
|
|
493
491
|
|
|
494
492
|
@public
|
|
495
|
-
@param
|
|
496
|
-
@return
|
|
493
|
+
@param options the options to pass in.
|
|
494
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
497
495
|
*/
|
|
498
496
|
reload(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
|
|
499
497
|
}
|