@warp-drive/legacy 5.8.0-alpha.40 → 5.8.0-alpha.42
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/index.d.ts +32 -0
- 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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
2
|
-
import { memoized, defineSignal,
|
|
2
|
+
import { memoized, defineSignal, defineNonEnumerableSignal, notifyInternalSignal } from '@warp-drive/core/signals/-leaked';
|
|
3
|
+
import { assertPrivateStore, recordIdentifierFor, isPrivateStore, storeFor, fastPush, createLegacyManyArray } from '@warp-drive/core/store/-private';
|
|
3
4
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
4
5
|
import { EnableHydration } from '@warp-drive/core/types/request';
|
|
5
|
-
import { u as upgradeStore } from "./-private-
|
|
6
|
+
import { u as upgradeStore } from "./-private-BdyZaGEh.js";
|
|
6
7
|
import { computed, get } from '@ember/object';
|
|
7
8
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
8
9
|
import ObjectProxy from '@ember/object/proxy';
|
|
@@ -73,7 +74,6 @@ PromiseBelongsTo.prototype[LegacyPromiseProxy] = true;
|
|
|
73
74
|
const comments = await post.comments;
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
@class PromiseManyArray
|
|
77
77
|
@public
|
|
78
78
|
*/
|
|
79
79
|
class PromiseManyArray {
|
|
@@ -85,7 +85,6 @@ class PromiseManyArray {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Retrieve the length of the content
|
|
88
|
-
* @property length
|
|
89
88
|
* @public
|
|
90
89
|
*/
|
|
91
90
|
get length() {
|
|
@@ -134,8 +133,6 @@ class PromiseManyArray {
|
|
|
134
133
|
/**
|
|
135
134
|
* Reload the relationship
|
|
136
135
|
* @public
|
|
137
|
-
* @param options
|
|
138
|
-
* @return
|
|
139
136
|
*/
|
|
140
137
|
reload(options) {
|
|
141
138
|
void this.content.reload(options);
|
|
@@ -147,32 +144,24 @@ class PromiseManyArray {
|
|
|
147
144
|
/**
|
|
148
145
|
* Whether the loading promise is still pending
|
|
149
146
|
*
|
|
150
|
-
* @property isPending
|
|
151
|
-
* @type {Boolean}
|
|
152
147
|
* @public
|
|
153
148
|
*/
|
|
154
149
|
|
|
155
150
|
/**
|
|
156
151
|
* Whether the loading promise rejected
|
|
157
152
|
*
|
|
158
|
-
* @property isRejected
|
|
159
|
-
* @type {Boolean}
|
|
160
153
|
* @public
|
|
161
154
|
*/
|
|
162
155
|
|
|
163
156
|
/**
|
|
164
157
|
* Whether the loading promise succeeded
|
|
165
158
|
*
|
|
166
|
-
* @property isFulfilled
|
|
167
|
-
* @type {Boolean}
|
|
168
159
|
* @public
|
|
169
160
|
*/
|
|
170
161
|
|
|
171
162
|
/**
|
|
172
163
|
* Whether the loading promise completed (resolved or rejected)
|
|
173
164
|
*
|
|
174
|
-
* @property isSettled
|
|
175
|
-
* @type {Boolean}
|
|
176
165
|
* @public
|
|
177
166
|
*/
|
|
178
167
|
|
|
@@ -188,8 +177,6 @@ class PromiseManyArray {
|
|
|
188
177
|
/**
|
|
189
178
|
* catch errors thrown by this promise
|
|
190
179
|
* @public
|
|
191
|
-
* @param callback
|
|
192
|
-
* @return {Promise}
|
|
193
180
|
*/
|
|
194
181
|
catch(cb) {
|
|
195
182
|
return this.promise.catch(cb);
|
|
@@ -199,8 +186,6 @@ class PromiseManyArray {
|
|
|
199
186
|
* run cleanup after this promise completes
|
|
200
187
|
*
|
|
201
188
|
* @public
|
|
202
|
-
* @param callback
|
|
203
|
-
* @return {Promise}
|
|
204
189
|
*/
|
|
205
190
|
finally(cb) {
|
|
206
191
|
return this.promise.finally(cb);
|
|
@@ -218,7 +203,6 @@ class PromiseManyArray {
|
|
|
218
203
|
|
|
219
204
|
/**
|
|
220
205
|
* Retrieve the links for this relationship
|
|
221
|
-
* @property links
|
|
222
206
|
* @public
|
|
223
207
|
*/
|
|
224
208
|
get links() {
|
|
@@ -227,7 +211,6 @@ class PromiseManyArray {
|
|
|
227
211
|
|
|
228
212
|
/**
|
|
229
213
|
* Retrieve the meta for this relationship
|
|
230
|
-
* @property meta
|
|
231
214
|
* @public
|
|
232
215
|
*/
|
|
233
216
|
static {
|
|
@@ -438,7 +421,7 @@ class HasManyReference {
|
|
|
438
421
|
}
|
|
439
422
|
```
|
|
440
423
|
@public
|
|
441
|
-
@return
|
|
424
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
442
425
|
*/
|
|
443
426
|
remoteType() {
|
|
444
427
|
const value = this._resource();
|
|
@@ -473,14 +456,14 @@ class HasManyReference {
|
|
|
473
456
|
commentsRef.ids(); // ['1']
|
|
474
457
|
```
|
|
475
458
|
@public
|
|
476
|
-
@return
|
|
459
|
+
@return The ids in this has-many relationship
|
|
477
460
|
*/
|
|
478
461
|
ids() {
|
|
479
462
|
return this.identifiers.map(identifier => identifier.id);
|
|
480
463
|
}
|
|
481
464
|
|
|
482
465
|
/**
|
|
483
|
-
The link
|
|
466
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
484
467
|
relationship. By default it uses only the "related" resource linkage.
|
|
485
468
|
Example
|
|
486
469
|
```javascript
|
|
@@ -509,7 +492,7 @@ class HasManyReference {
|
|
|
509
492
|
}
|
|
510
493
|
```
|
|
511
494
|
@public
|
|
512
|
-
@return
|
|
495
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
513
496
|
*/
|
|
514
497
|
link() {
|
|
515
498
|
const resource = this._resource();
|
|
@@ -564,7 +547,7 @@ class HasManyReference {
|
|
|
564
547
|
usersRef.meta() // { lastUpdated: 1458014400000 }
|
|
565
548
|
```
|
|
566
549
|
@public
|
|
567
|
-
@return
|
|
550
|
+
@return The meta information for the belongs-to relationship.
|
|
568
551
|
*/
|
|
569
552
|
meta() {
|
|
570
553
|
let meta = null;
|
|
@@ -650,9 +633,8 @@ class HasManyReference {
|
|
|
650
633
|
particularly useful if you want to update the state of the relationship without
|
|
651
634
|
forcing the load of all of the associated records.
|
|
652
635
|
@public
|
|
653
|
-
@param
|
|
654
|
-
@param
|
|
655
|
-
@return {Promise<ManyArray | void>}
|
|
636
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
637
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
656
638
|
*/
|
|
657
639
|
async push(doc, skipFetch) {
|
|
658
640
|
const {
|
|
@@ -731,7 +713,6 @@ class HasManyReference {
|
|
|
731
713
|
})
|
|
732
714
|
```
|
|
733
715
|
@public
|
|
734
|
-
@return {ManyArray}
|
|
735
716
|
*/
|
|
736
717
|
value() {
|
|
737
718
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -791,8 +772,8 @@ class HasManyReference {
|
|
|
791
772
|
});
|
|
792
773
|
```
|
|
793
774
|
@public
|
|
794
|
-
@param
|
|
795
|
-
@return
|
|
775
|
+
@param options the options to pass in.
|
|
776
|
+
@return a promise that resolves with the ManyArray in
|
|
796
777
|
this has-many relationship.
|
|
797
778
|
*/
|
|
798
779
|
async load(options) {
|
|
@@ -839,9 +820,9 @@ class HasManyReference {
|
|
|
839
820
|
```javascript
|
|
840
821
|
commentsRef.reload({ adapterOptions: { isPrivate: true } })
|
|
841
822
|
```
|
|
842
|
-
|
|
843
|
-
@param
|
|
844
|
-
@return
|
|
823
|
+
@public
|
|
824
|
+
@param options the options to pass in.
|
|
825
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
845
826
|
*/
|
|
846
827
|
reload(options) {
|
|
847
828
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -897,24 +878,17 @@ function isResourceIdentiferWithRelatedLinks(value) {
|
|
|
897
878
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
898
879
|
for a given relationship will always return the same HasManyReference.
|
|
899
880
|
|
|
900
|
-
@class BelongsToReference
|
|
901
881
|
@public
|
|
902
882
|
*/
|
|
903
883
|
class BelongsToReference {
|
|
904
884
|
/**
|
|
905
885
|
* The field name on the parent record for this has-many relationship.
|
|
906
886
|
*
|
|
907
|
-
* @property key
|
|
908
|
-
* @type {String}
|
|
909
|
-
* @public
|
|
910
887
|
*/
|
|
911
888
|
|
|
912
889
|
/**
|
|
913
890
|
* The type of resource this relationship will contain.
|
|
914
891
|
*
|
|
915
|
-
* @property type
|
|
916
|
-
* @type {String}
|
|
917
|
-
* @public
|
|
918
892
|
*/
|
|
919
893
|
|
|
920
894
|
// unsubscribe tokens given to us by the notification manager
|
|
@@ -950,9 +924,6 @@ class BelongsToReference {
|
|
|
950
924
|
* The identifier of the record that this reference refers to.
|
|
951
925
|
* `null` if no related record is known.
|
|
952
926
|
*
|
|
953
|
-
* @property identifier
|
|
954
|
-
* @type {ResourceKey | null}
|
|
955
|
-
* @public
|
|
956
927
|
*/
|
|
957
928
|
get identifier() {
|
|
958
929
|
if (this.___relatedToken) {
|
|
@@ -1003,7 +974,7 @@ class BelongsToReference {
|
|
|
1003
974
|
}
|
|
1004
975
|
```
|
|
1005
976
|
@public
|
|
1006
|
-
@return
|
|
977
|
+
@return The id of the record in this belongsTo relationship.
|
|
1007
978
|
*/
|
|
1008
979
|
static {
|
|
1009
980
|
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
@@ -1013,7 +984,7 @@ class BelongsToReference {
|
|
|
1013
984
|
}
|
|
1014
985
|
|
|
1015
986
|
/**
|
|
1016
|
-
The link
|
|
987
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
1017
988
|
relationship. By default it uses only the "related" resource linkage.
|
|
1018
989
|
Example
|
|
1019
990
|
```javascript
|
|
@@ -1042,7 +1013,7 @@ class BelongsToReference {
|
|
|
1042
1013
|
}
|
|
1043
1014
|
```
|
|
1044
1015
|
@public
|
|
1045
|
-
@return
|
|
1016
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
1046
1017
|
*/
|
|
1047
1018
|
link() {
|
|
1048
1019
|
const resource = this._resource();
|
|
@@ -1097,7 +1068,7 @@ class BelongsToReference {
|
|
|
1097
1068
|
userRef.meta() // { lastUpdated: 1458014400000 }
|
|
1098
1069
|
```
|
|
1099
1070
|
@public
|
|
1100
|
-
@return
|
|
1071
|
+
@return The meta information for the belongs-to relationship.
|
|
1101
1072
|
*/
|
|
1102
1073
|
meta() {
|
|
1103
1074
|
let meta = null;
|
|
@@ -1146,7 +1117,7 @@ class BelongsToReference {
|
|
|
1146
1117
|
}
|
|
1147
1118
|
```
|
|
1148
1119
|
@public
|
|
1149
|
-
@return
|
|
1120
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
1150
1121
|
*/
|
|
1151
1122
|
remoteType() {
|
|
1152
1123
|
const value = this._resource();
|
|
@@ -1229,9 +1200,9 @@ class BelongsToReference {
|
|
|
1229
1200
|
particularly useful if you want to update the state of the relationship without
|
|
1230
1201
|
forcing the load of all of the associated record.
|
|
1231
1202
|
@public
|
|
1232
|
-
@param
|
|
1233
|
-
@param
|
|
1234
|
-
@return
|
|
1203
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
1204
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
1205
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
1235
1206
|
*/
|
|
1236
1207
|
async push(doc, skipFetch) {
|
|
1237
1208
|
const {
|
|
@@ -1306,7 +1277,7 @@ class BelongsToReference {
|
|
|
1306
1277
|
});
|
|
1307
1278
|
```
|
|
1308
1279
|
@public
|
|
1309
|
-
@return
|
|
1280
|
+
@return the record in this relationship
|
|
1310
1281
|
*/
|
|
1311
1282
|
value() {
|
|
1312
1283
|
const resource = this._resource();
|
|
@@ -1360,8 +1331,8 @@ class BelongsToReference {
|
|
|
1360
1331
|
});
|
|
1361
1332
|
```
|
|
1362
1333
|
@public
|
|
1363
|
-
@param
|
|
1364
|
-
@return
|
|
1334
|
+
@param options the options to pass in.
|
|
1335
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
1365
1336
|
*/
|
|
1366
1337
|
async load(options) {
|
|
1367
1338
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1374,7 +1345,7 @@ class BelongsToReference {
|
|
|
1374
1345
|
|
|
1375
1346
|
/**
|
|
1376
1347
|
Triggers a reload of the value in this relationship. If the
|
|
1377
|
-
remoteType is `"link"`
|
|
1348
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
1378
1349
|
reload the relationship. Otherwise it will reload the record by its
|
|
1379
1350
|
id.
|
|
1380
1351
|
Example
|
|
@@ -1409,8 +1380,8 @@ class BelongsToReference {
|
|
|
1409
1380
|
userRef.reload({ adapterOptions: { isPrivate: true } })
|
|
1410
1381
|
```
|
|
1411
1382
|
@public
|
|
1412
|
-
@param
|
|
1413
|
-
@return
|
|
1383
|
+
@param options the options to pass in.
|
|
1384
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
1414
1385
|
*/
|
|
1415
1386
|
reload(options) {
|
|
1416
1387
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setOwner, getOwner } from '@ember/application';
|
|
2
2
|
import { assertPrivateStore, setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
3
|
-
import { g as getModelFactory } from "./schema-provider-
|
|
3
|
+
import { g as getModelFactory } from "./schema-provider-CjX55uSY.js";
|
|
4
4
|
import { n as normalizeModelName } from "./util-B6cn-i93.js";
|
|
5
5
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
6
6
|
const type = identifier.type;
|
|
@@ -7,9 +7,9 @@ import '@ember/object';
|
|
|
7
7
|
import '@warp-drive/core/types/symbols';
|
|
8
8
|
import '@warp-drive/utilities/string';
|
|
9
9
|
import '@warp-drive/core/store/-private';
|
|
10
|
-
import "./errors-
|
|
11
|
-
import "./schema-provider-
|
|
12
|
-
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-
|
|
10
|
+
import "./errors-CdDaK81x.js";
|
|
11
|
+
import "./schema-provider-CjX55uSY.js";
|
|
12
|
+
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-yId87yyG.js";
|
|
13
13
|
import { registerDerivations as registerDerivations$1, DelegatingSchemaService } from './model/migration-support.js';
|
|
14
14
|
import { F as FragmentExtension, a as FragmentArrayExtension, f as fragmentsModelFor } from "./model-for-CqXsIKws.js";
|
|
15
15
|
import { restoreDeprecatedStoreBehaviors } from './store.js';
|
|
@@ -63,8 +63,8 @@ const PRIMARY_ATTRIBUTE_KEY = 'base';
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
`JSONSerializer` will normalize the JSON payload to the
|
|
67
|
-
|
|
66
|
+
`JSONSerializer` will normalize the JSON payload to the {json:api} format that the
|
|
67
|
+
JSONAPICache uses to cache data in the Store.
|
|
68
68
|
|
|
69
69
|
You can customize how JSONSerializer processes its payload by passing options in
|
|
70
70
|
the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:
|
|
@@ -99,7 +99,7 @@ const PRIMARY_ATTRIBUTE_KEY = 'base';
|
|
|
99
99
|
const JSONSerializer = Serializer.extend({
|
|
100
100
|
/**
|
|
101
101
|
The `primaryKey` is used when serializing and deserializing
|
|
102
|
-
data.
|
|
102
|
+
data. WarpDrive always uses the `id` property to store the id of
|
|
103
103
|
the record. The external source may not always follow this
|
|
104
104
|
convention. In these cases it is useful to override the
|
|
105
105
|
`primaryKey` property to match the `primaryKey` of your external
|
|
@@ -111,9 +111,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
111
111
|
primaryKey = '_id'
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
|
-
@
|
|
115
|
-
@type {String}
|
|
116
|
-
@public
|
|
114
|
+
@public
|
|
117
115
|
@default 'id'
|
|
118
116
|
*/
|
|
119
117
|
primaryKey: 'id',
|
|
@@ -446,9 +444,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
446
444
|
}
|
|
447
445
|
```
|
|
448
446
|
@public
|
|
449
|
-
@param {Model} typeClass
|
|
450
|
-
@param {Object} hash
|
|
451
|
-
@return {Object}
|
|
452
447
|
*/
|
|
453
448
|
normalize(modelClass, resourceHash) {
|
|
454
449
|
let data = null;
|
|
@@ -494,9 +489,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
494
489
|
Returns the resource's attributes formatted as a JSON-API "attributes object".
|
|
495
490
|
http://jsonapi.org/format/#document-resource-object-attributes
|
|
496
491
|
@public
|
|
497
|
-
@param {Object} modelClass
|
|
498
|
-
@param {Object} resourceHash
|
|
499
|
-
@return {Object}
|
|
500
492
|
*/
|
|
501
493
|
extractAttributes(modelClass, resourceHash) {
|
|
502
494
|
let attributeKey;
|
|
@@ -637,8 +629,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
637
629
|
/**
|
|
638
630
|
Dasherizes the model name in the payload
|
|
639
631
|
@public
|
|
640
|
-
@
|
|
641
|
-
@return {String} the model's modelName
|
|
632
|
+
@return the model's modelName
|
|
642
633
|
*/
|
|
643
634
|
modelNameFromPayloadKey(key) {
|
|
644
635
|
return dasherize(singularize(key));
|
|
@@ -1147,11 +1138,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
1147
1138
|
}
|
|
1148
1139
|
```
|
|
1149
1140
|
@public
|
|
1150
|
-
@
|
|
1151
|
-
@param {Model} typeClass
|
|
1152
|
-
@param {Object} payload
|
|
1153
|
-
@param {(String|Number)} id
|
|
1154
|
-
@return {Object} json The deserialized errors
|
|
1141
|
+
@return json The deserialized errors
|
|
1155
1142
|
*/
|
|
1156
1143
|
extractErrors(store, typeClass, payload, id) {
|
|
1157
1144
|
// @ts-expect-error
|
|
@@ -1 +1 @@
|
|
|
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-CdDaK81x.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
2
2
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
3
|
-
import { notifyInternalSignal
|
|
3
|
+
import { notifyInternalSignal } from '@warp-drive/core/signals/-leaked';
|
|
4
|
+
import { assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
4
5
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
5
6
|
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, i as deleteRecord, R as RecordState, j as changedAttributes, k as belongsTo, l as createSnapshot } from "../schema-provider-
|
|
7
|
+
import { l as lookupLegacySupport, E as Errors } from "../errors-CdDaK81x.js";
|
|
8
|
+
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, i as deleteRecord, R as RecordState, j as changedAttributes, k as belongsTo, l as createSnapshot } from "../schema-provider-CjX55uSY.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* This module provides support for migrating away from @warp-drive/legacy/model
|
|
@@ -454,8 +455,9 @@ class DelegatingSchemaService {
|
|
|
454
455
|
return this._secondary.fields(resource);
|
|
455
456
|
}
|
|
456
457
|
cacheFields(resource) {
|
|
457
|
-
if (this._preferred.
|
|
458
|
-
|
|
458
|
+
if (this._preferred.hasResource?.(resource)) {
|
|
459
|
+
// @ts-expect-error
|
|
460
|
+
return this._preferred.cacheFields?.(resource);
|
|
459
461
|
}
|
|
460
462
|
|
|
461
463
|
// @ts-expect-error
|
|
@@ -3,10 +3,10 @@ import { recordIdentifierFor } from '@warp-drive/core';
|
|
|
3
3
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
4
4
|
import { i as isElementDescriptor, n as normalizeModelName } from "./util-B6cn-i93.js";
|
|
5
5
|
import { assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
6
|
-
import { l as lookupLegacySupport } from "./errors-
|
|
6
|
+
import { l as lookupLegacySupport } from "./errors-CdDaK81x.js";
|
|
7
7
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
8
|
-
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-
|
|
9
|
-
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-
|
|
8
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-CjX55uSY.js";
|
|
9
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-yId87yyG.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options provided to the attr decorator are
|