@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
|
@@ -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, isResourceKey, 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-DtjBbEgy.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';
|
|
@@ -86,7 +87,6 @@ PromiseBelongsTo.prototype[LegacyPromiseProxy] = true;
|
|
|
86
87
|
const comments = await post.comments;
|
|
87
88
|
```
|
|
88
89
|
|
|
89
|
-
@class PromiseManyArray
|
|
90
90
|
@public
|
|
91
91
|
*/
|
|
92
92
|
class PromiseManyArray {
|
|
@@ -98,7 +98,6 @@ class PromiseManyArray {
|
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Retrieve the length of the content
|
|
101
|
-
* @property length
|
|
102
101
|
* @public
|
|
103
102
|
*/
|
|
104
103
|
get length() {
|
|
@@ -147,8 +146,6 @@ class PromiseManyArray {
|
|
|
147
146
|
/**
|
|
148
147
|
* Reload the relationship
|
|
149
148
|
* @public
|
|
150
|
-
* @param options
|
|
151
|
-
* @return
|
|
152
149
|
*/
|
|
153
150
|
reload(options) {
|
|
154
151
|
(test => {
|
|
@@ -165,32 +162,24 @@ class PromiseManyArray {
|
|
|
165
162
|
/**
|
|
166
163
|
* Whether the loading promise is still pending
|
|
167
164
|
*
|
|
168
|
-
* @property isPending
|
|
169
|
-
* @type {Boolean}
|
|
170
165
|
* @public
|
|
171
166
|
*/
|
|
172
167
|
|
|
173
168
|
/**
|
|
174
169
|
* Whether the loading promise rejected
|
|
175
170
|
*
|
|
176
|
-
* @property isRejected
|
|
177
|
-
* @type {Boolean}
|
|
178
171
|
* @public
|
|
179
172
|
*/
|
|
180
173
|
|
|
181
174
|
/**
|
|
182
175
|
* Whether the loading promise succeeded
|
|
183
176
|
*
|
|
184
|
-
* @property isFulfilled
|
|
185
|
-
* @type {Boolean}
|
|
186
177
|
* @public
|
|
187
178
|
*/
|
|
188
179
|
|
|
189
180
|
/**
|
|
190
181
|
* Whether the loading promise completed (resolved or rejected)
|
|
191
182
|
*
|
|
192
|
-
* @property isSettled
|
|
193
|
-
* @type {Boolean}
|
|
194
183
|
* @public
|
|
195
184
|
*/
|
|
196
185
|
|
|
@@ -206,8 +195,6 @@ class PromiseManyArray {
|
|
|
206
195
|
/**
|
|
207
196
|
* catch errors thrown by this promise
|
|
208
197
|
* @public
|
|
209
|
-
* @param callback
|
|
210
|
-
* @return {Promise}
|
|
211
198
|
*/
|
|
212
199
|
catch(cb) {
|
|
213
200
|
return this.promise.catch(cb);
|
|
@@ -217,8 +204,6 @@ class PromiseManyArray {
|
|
|
217
204
|
* run cleanup after this promise completes
|
|
218
205
|
*
|
|
219
206
|
* @public
|
|
220
|
-
* @param callback
|
|
221
|
-
* @return {Promise}
|
|
222
207
|
*/
|
|
223
208
|
finally(cb) {
|
|
224
209
|
return this.promise.finally(cb);
|
|
@@ -236,7 +221,6 @@ class PromiseManyArray {
|
|
|
236
221
|
|
|
237
222
|
/**
|
|
238
223
|
* Retrieve the links for this relationship
|
|
239
|
-
* @property links
|
|
240
224
|
* @public
|
|
241
225
|
*/
|
|
242
226
|
get links() {
|
|
@@ -245,7 +229,6 @@ class PromiseManyArray {
|
|
|
245
229
|
|
|
246
230
|
/**
|
|
247
231
|
* Retrieve the meta for this relationship
|
|
248
|
-
* @property meta
|
|
249
232
|
* @public
|
|
250
233
|
*/
|
|
251
234
|
static {
|
|
@@ -493,7 +476,7 @@ class HasManyReference {
|
|
|
493
476
|
}
|
|
494
477
|
```
|
|
495
478
|
@public
|
|
496
|
-
@return
|
|
479
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
497
480
|
*/
|
|
498
481
|
remoteType() {
|
|
499
482
|
const value = this._resource();
|
|
@@ -528,14 +511,14 @@ class HasManyReference {
|
|
|
528
511
|
commentsRef.ids(); // ['1']
|
|
529
512
|
```
|
|
530
513
|
@public
|
|
531
|
-
@return
|
|
514
|
+
@return The ids in this has-many relationship
|
|
532
515
|
*/
|
|
533
516
|
ids() {
|
|
534
517
|
return this.identifiers.map(identifier => identifier.id);
|
|
535
518
|
}
|
|
536
519
|
|
|
537
520
|
/**
|
|
538
|
-
The link
|
|
521
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
539
522
|
relationship. By default it uses only the "related" resource linkage.
|
|
540
523
|
Example
|
|
541
524
|
```javascript
|
|
@@ -564,7 +547,7 @@ class HasManyReference {
|
|
|
564
547
|
}
|
|
565
548
|
```
|
|
566
549
|
@public
|
|
567
|
-
@return
|
|
550
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
568
551
|
*/
|
|
569
552
|
link() {
|
|
570
553
|
const resource = this._resource();
|
|
@@ -619,7 +602,7 @@ class HasManyReference {
|
|
|
619
602
|
usersRef.meta() // { lastUpdated: 1458014400000 }
|
|
620
603
|
```
|
|
621
604
|
@public
|
|
622
|
-
@return
|
|
605
|
+
@return The meta information for the belongs-to relationship.
|
|
623
606
|
*/
|
|
624
607
|
meta() {
|
|
625
608
|
let meta = null;
|
|
@@ -705,9 +688,8 @@ class HasManyReference {
|
|
|
705
688
|
particularly useful if you want to update the state of the relationship without
|
|
706
689
|
forcing the load of all of the associated records.
|
|
707
690
|
@public
|
|
708
|
-
@param
|
|
709
|
-
@param
|
|
710
|
-
@return {Promise<ManyArray | void>}
|
|
691
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
692
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
711
693
|
*/
|
|
712
694
|
async push(doc, skipFetch) {
|
|
713
695
|
const {
|
|
@@ -799,7 +781,6 @@ class HasManyReference {
|
|
|
799
781
|
})
|
|
800
782
|
```
|
|
801
783
|
@public
|
|
802
|
-
@return {ManyArray}
|
|
803
784
|
*/
|
|
804
785
|
value() {
|
|
805
786
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -859,8 +840,8 @@ class HasManyReference {
|
|
|
859
840
|
});
|
|
860
841
|
```
|
|
861
842
|
@public
|
|
862
|
-
@param
|
|
863
|
-
@return
|
|
843
|
+
@param options the options to pass in.
|
|
844
|
+
@return a promise that resolves with the ManyArray in
|
|
864
845
|
this has-many relationship.
|
|
865
846
|
*/
|
|
866
847
|
async load(options) {
|
|
@@ -907,9 +888,9 @@ class HasManyReference {
|
|
|
907
888
|
```javascript
|
|
908
889
|
commentsRef.reload({ adapterOptions: { isPrivate: true } })
|
|
909
890
|
```
|
|
910
|
-
|
|
911
|
-
@param
|
|
912
|
-
@return
|
|
891
|
+
@public
|
|
892
|
+
@param options the options to pass in.
|
|
893
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
913
894
|
*/
|
|
914
895
|
reload(options) {
|
|
915
896
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -970,24 +951,17 @@ function isResourceIdentiferWithRelatedLinks(value) {
|
|
|
970
951
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
971
952
|
for a given relationship will always return the same HasManyReference.
|
|
972
953
|
|
|
973
|
-
@class BelongsToReference
|
|
974
954
|
@public
|
|
975
955
|
*/
|
|
976
956
|
class BelongsToReference {
|
|
977
957
|
/**
|
|
978
958
|
* The field name on the parent record for this has-many relationship.
|
|
979
959
|
*
|
|
980
|
-
* @property key
|
|
981
|
-
* @type {String}
|
|
982
|
-
* @public
|
|
983
960
|
*/
|
|
984
961
|
|
|
985
962
|
/**
|
|
986
963
|
* The type of resource this relationship will contain.
|
|
987
964
|
*
|
|
988
|
-
* @property type
|
|
989
|
-
* @type {String}
|
|
990
|
-
* @public
|
|
991
965
|
*/
|
|
992
966
|
|
|
993
967
|
// unsubscribe tokens given to us by the notification manager
|
|
@@ -1023,9 +997,6 @@ class BelongsToReference {
|
|
|
1023
997
|
* The identifier of the record that this reference refers to.
|
|
1024
998
|
* `null` if no related record is known.
|
|
1025
999
|
*
|
|
1026
|
-
* @property identifier
|
|
1027
|
-
* @type {ResourceKey | null}
|
|
1028
|
-
* @public
|
|
1029
1000
|
*/
|
|
1030
1001
|
get identifier() {
|
|
1031
1002
|
if (this.___relatedToken) {
|
|
@@ -1076,7 +1047,7 @@ class BelongsToReference {
|
|
|
1076
1047
|
}
|
|
1077
1048
|
```
|
|
1078
1049
|
@public
|
|
1079
|
-
@return
|
|
1050
|
+
@return The id of the record in this belongsTo relationship.
|
|
1080
1051
|
*/
|
|
1081
1052
|
static {
|
|
1082
1053
|
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
@@ -1086,7 +1057,7 @@ class BelongsToReference {
|
|
|
1086
1057
|
}
|
|
1087
1058
|
|
|
1088
1059
|
/**
|
|
1089
|
-
The link
|
|
1060
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
1090
1061
|
relationship. By default it uses only the "related" resource linkage.
|
|
1091
1062
|
Example
|
|
1092
1063
|
```javascript
|
|
@@ -1115,7 +1086,7 @@ class BelongsToReference {
|
|
|
1115
1086
|
}
|
|
1116
1087
|
```
|
|
1117
1088
|
@public
|
|
1118
|
-
@return
|
|
1089
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
1119
1090
|
*/
|
|
1120
1091
|
link() {
|
|
1121
1092
|
const resource = this._resource();
|
|
@@ -1170,7 +1141,7 @@ class BelongsToReference {
|
|
|
1170
1141
|
userRef.meta() // { lastUpdated: 1458014400000 }
|
|
1171
1142
|
```
|
|
1172
1143
|
@public
|
|
1173
|
-
@return
|
|
1144
|
+
@return The meta information for the belongs-to relationship.
|
|
1174
1145
|
*/
|
|
1175
1146
|
meta() {
|
|
1176
1147
|
let meta = null;
|
|
@@ -1219,7 +1190,7 @@ class BelongsToReference {
|
|
|
1219
1190
|
}
|
|
1220
1191
|
```
|
|
1221
1192
|
@public
|
|
1222
|
-
@return
|
|
1193
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
1223
1194
|
*/
|
|
1224
1195
|
remoteType() {
|
|
1225
1196
|
const value = this._resource();
|
|
@@ -1302,9 +1273,9 @@ class BelongsToReference {
|
|
|
1302
1273
|
particularly useful if you want to update the state of the relationship without
|
|
1303
1274
|
forcing the load of all of the associated record.
|
|
1304
1275
|
@public
|
|
1305
|
-
@param
|
|
1306
|
-
@param
|
|
1307
|
-
@return
|
|
1276
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
1277
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
1278
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
1308
1279
|
*/
|
|
1309
1280
|
async push(doc, skipFetch) {
|
|
1310
1281
|
const {
|
|
@@ -1384,7 +1355,7 @@ class BelongsToReference {
|
|
|
1384
1355
|
});
|
|
1385
1356
|
```
|
|
1386
1357
|
@public
|
|
1387
|
-
@return
|
|
1358
|
+
@return the record in this relationship
|
|
1388
1359
|
*/
|
|
1389
1360
|
value() {
|
|
1390
1361
|
const resource = this._resource();
|
|
@@ -1438,8 +1409,8 @@ class BelongsToReference {
|
|
|
1438
1409
|
});
|
|
1439
1410
|
```
|
|
1440
1411
|
@public
|
|
1441
|
-
@param
|
|
1442
|
-
@return
|
|
1412
|
+
@param options the options to pass in.
|
|
1413
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
1443
1414
|
*/
|
|
1444
1415
|
async load(options) {
|
|
1445
1416
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1452,7 +1423,7 @@ class BelongsToReference {
|
|
|
1452
1423
|
|
|
1453
1424
|
/**
|
|
1454
1425
|
Triggers a reload of the value in this relationship. If the
|
|
1455
|
-
remoteType is `"link"`
|
|
1426
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
1456
1427
|
reload the relationship. Otherwise it will reload the record by its
|
|
1457
1428
|
id.
|
|
1458
1429
|
Example
|
|
@@ -1487,8 +1458,8 @@ class BelongsToReference {
|
|
|
1487
1458
|
userRef.reload({ adapterOptions: { isPrivate: true } })
|
|
1488
1459
|
```
|
|
1489
1460
|
@public
|
|
1490
|
-
@param
|
|
1491
|
-
@return
|
|
1461
|
+
@param options the options to pass in.
|
|
1462
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
1492
1463
|
*/
|
|
1493
1464
|
reload(options) {
|
|
1494
1465
|
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-BP6_8N-V.js";
|
|
4
4
|
import { n as normalizeModelName } from "./util-CWr5WQOT.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-Spt6ubMd.js";
|
|
11
|
+
import "./schema-provider-BP6_8N-V.js";
|
|
12
|
+
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-DOXegvhL.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',
|
|
@@ -451,9 +449,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
451
449
|
}
|
|
452
450
|
```
|
|
453
451
|
@public
|
|
454
|
-
@param {Model} typeClass
|
|
455
|
-
@param {Object} hash
|
|
456
|
-
@return {Object}
|
|
457
452
|
*/
|
|
458
453
|
normalize(modelClass, resourceHash) {
|
|
459
454
|
let data = null;
|
|
@@ -499,9 +494,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
499
494
|
Returns the resource's attributes formatted as a JSON-API "attributes object".
|
|
500
495
|
http://jsonapi.org/format/#document-resource-object-attributes
|
|
501
496
|
@public
|
|
502
|
-
@param {Object} modelClass
|
|
503
|
-
@param {Object} resourceHash
|
|
504
|
-
@return {Object}
|
|
505
497
|
*/
|
|
506
498
|
extractAttributes(modelClass, resourceHash) {
|
|
507
499
|
let attributeKey;
|
|
@@ -642,8 +634,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
642
634
|
/**
|
|
643
635
|
Dasherizes the model name in the payload
|
|
644
636
|
@public
|
|
645
|
-
@
|
|
646
|
-
@return {String} the model's modelName
|
|
637
|
+
@return the model's modelName
|
|
647
638
|
*/
|
|
648
639
|
modelNameFromPayloadKey(key) {
|
|
649
640
|
return dasherize(singularize(key));
|
|
@@ -1155,11 +1146,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
1155
1146
|
}
|
|
1156
1147
|
```
|
|
1157
1148
|
@public
|
|
1158
|
-
@
|
|
1159
|
-
@param {Model} typeClass
|
|
1160
|
-
@param {Object} payload
|
|
1161
|
-
@param {(String|Number)} id
|
|
1162
|
-
@return {Object} json The deserialized errors
|
|
1149
|
+
@return json The deserialized errors
|
|
1163
1150
|
*/
|
|
1164
1151
|
extractErrors(store, typeClass, payload, id) {
|
|
1165
1152
|
// @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-Spt6ubMd.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-Spt6ubMd.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-BP6_8N-V.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* This module provides support for migrating away from @warp-drive/legacy/model
|
|
@@ -461,8 +462,9 @@ class DelegatingSchemaService {
|
|
|
461
462
|
return this._secondary.fields(resource);
|
|
462
463
|
}
|
|
463
464
|
cacheFields(resource) {
|
|
464
|
-
if (this._preferred.
|
|
465
|
-
|
|
465
|
+
if (this._preferred.hasResource?.(resource)) {
|
|
466
|
+
// @ts-expect-error
|
|
467
|
+
return this._preferred.cacheFields?.(resource);
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
// @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-CWr5WQOT.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-Spt6ubMd.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-BP6_8N-V.js";
|
|
9
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-DOXegvhL.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options provided to the attr decorator are
|