@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() {
|
|
@@ -144,8 +143,6 @@ class PromiseManyArray {
|
|
|
144
143
|
/**
|
|
145
144
|
* Reload the relationship
|
|
146
145
|
* @public
|
|
147
|
-
* @param options
|
|
148
|
-
* @return
|
|
149
146
|
*/
|
|
150
147
|
reload(options) {
|
|
151
148
|
(test => {
|
|
@@ -162,32 +159,24 @@ class PromiseManyArray {
|
|
|
162
159
|
/**
|
|
163
160
|
* Whether the loading promise is still pending
|
|
164
161
|
*
|
|
165
|
-
* @property isPending
|
|
166
|
-
* @type {Boolean}
|
|
167
162
|
* @public
|
|
168
163
|
*/
|
|
169
164
|
|
|
170
165
|
/**
|
|
171
166
|
* Whether the loading promise rejected
|
|
172
167
|
*
|
|
173
|
-
* @property isRejected
|
|
174
|
-
* @type {Boolean}
|
|
175
168
|
* @public
|
|
176
169
|
*/
|
|
177
170
|
|
|
178
171
|
/**
|
|
179
172
|
* Whether the loading promise succeeded
|
|
180
173
|
*
|
|
181
|
-
* @property isFulfilled
|
|
182
|
-
* @type {Boolean}
|
|
183
174
|
* @public
|
|
184
175
|
*/
|
|
185
176
|
|
|
186
177
|
/**
|
|
187
178
|
* Whether the loading promise completed (resolved or rejected)
|
|
188
179
|
*
|
|
189
|
-
* @property isSettled
|
|
190
|
-
* @type {Boolean}
|
|
191
180
|
* @public
|
|
192
181
|
*/
|
|
193
182
|
|
|
@@ -203,8 +192,6 @@ class PromiseManyArray {
|
|
|
203
192
|
/**
|
|
204
193
|
* catch errors thrown by this promise
|
|
205
194
|
* @public
|
|
206
|
-
* @param callback
|
|
207
|
-
* @return {Promise}
|
|
208
195
|
*/
|
|
209
196
|
catch(cb) {
|
|
210
197
|
return this.promise.catch(cb);
|
|
@@ -214,8 +201,6 @@ class PromiseManyArray {
|
|
|
214
201
|
* run cleanup after this promise completes
|
|
215
202
|
*
|
|
216
203
|
* @public
|
|
217
|
-
* @param callback
|
|
218
|
-
* @return {Promise}
|
|
219
204
|
*/
|
|
220
205
|
finally(cb) {
|
|
221
206
|
return this.promise.finally(cb);
|
|
@@ -233,7 +218,6 @@ class PromiseManyArray {
|
|
|
233
218
|
|
|
234
219
|
/**
|
|
235
220
|
* Retrieve the links for this relationship
|
|
236
|
-
* @property links
|
|
237
221
|
* @public
|
|
238
222
|
*/
|
|
239
223
|
get links() {
|
|
@@ -242,7 +226,6 @@ class PromiseManyArray {
|
|
|
242
226
|
|
|
243
227
|
/**
|
|
244
228
|
* Retrieve the meta for this relationship
|
|
245
|
-
* @property meta
|
|
246
229
|
* @public
|
|
247
230
|
*/
|
|
248
231
|
static {
|
|
@@ -490,7 +473,7 @@ class HasManyReference {
|
|
|
490
473
|
}
|
|
491
474
|
```
|
|
492
475
|
@public
|
|
493
|
-
@return
|
|
476
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
494
477
|
*/
|
|
495
478
|
remoteType() {
|
|
496
479
|
const value = this._resource();
|
|
@@ -525,14 +508,14 @@ class HasManyReference {
|
|
|
525
508
|
commentsRef.ids(); // ['1']
|
|
526
509
|
```
|
|
527
510
|
@public
|
|
528
|
-
@return
|
|
511
|
+
@return The ids in this has-many relationship
|
|
529
512
|
*/
|
|
530
513
|
ids() {
|
|
531
514
|
return this.identifiers.map(identifier => identifier.id);
|
|
532
515
|
}
|
|
533
516
|
|
|
534
517
|
/**
|
|
535
|
-
The link
|
|
518
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
536
519
|
relationship. By default it uses only the "related" resource linkage.
|
|
537
520
|
Example
|
|
538
521
|
```javascript
|
|
@@ -561,7 +544,7 @@ class HasManyReference {
|
|
|
561
544
|
}
|
|
562
545
|
```
|
|
563
546
|
@public
|
|
564
|
-
@return
|
|
547
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
565
548
|
*/
|
|
566
549
|
link() {
|
|
567
550
|
const resource = this._resource();
|
|
@@ -616,7 +599,7 @@ class HasManyReference {
|
|
|
616
599
|
usersRef.meta() // { lastUpdated: 1458014400000 }
|
|
617
600
|
```
|
|
618
601
|
@public
|
|
619
|
-
@return
|
|
602
|
+
@return The meta information for the belongs-to relationship.
|
|
620
603
|
*/
|
|
621
604
|
meta() {
|
|
622
605
|
let meta = null;
|
|
@@ -702,9 +685,8 @@ class HasManyReference {
|
|
|
702
685
|
particularly useful if you want to update the state of the relationship without
|
|
703
686
|
forcing the load of all of the associated records.
|
|
704
687
|
@public
|
|
705
|
-
@param
|
|
706
|
-
@param
|
|
707
|
-
@return {Promise<ManyArray | void>}
|
|
688
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
689
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
708
690
|
*/
|
|
709
691
|
async push(doc, skipFetch) {
|
|
710
692
|
const {
|
|
@@ -796,7 +778,6 @@ class HasManyReference {
|
|
|
796
778
|
})
|
|
797
779
|
```
|
|
798
780
|
@public
|
|
799
|
-
@return {ManyArray}
|
|
800
781
|
*/
|
|
801
782
|
value() {
|
|
802
783
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -856,8 +837,8 @@ class HasManyReference {
|
|
|
856
837
|
});
|
|
857
838
|
```
|
|
858
839
|
@public
|
|
859
|
-
@param
|
|
860
|
-
@return
|
|
840
|
+
@param options the options to pass in.
|
|
841
|
+
@return a promise that resolves with the ManyArray in
|
|
861
842
|
this has-many relationship.
|
|
862
843
|
*/
|
|
863
844
|
async load(options) {
|
|
@@ -904,9 +885,9 @@ class HasManyReference {
|
|
|
904
885
|
```javascript
|
|
905
886
|
commentsRef.reload({ adapterOptions: { isPrivate: true } })
|
|
906
887
|
```
|
|
907
|
-
|
|
908
|
-
@param
|
|
909
|
-
@return
|
|
888
|
+
@public
|
|
889
|
+
@param options the options to pass in.
|
|
890
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
910
891
|
*/
|
|
911
892
|
reload(options) {
|
|
912
893
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -967,24 +948,17 @@ function isResourceIdentiferWithRelatedLinks(value) {
|
|
|
967
948
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
968
949
|
for a given relationship will always return the same HasManyReference.
|
|
969
950
|
|
|
970
|
-
@class BelongsToReference
|
|
971
951
|
@public
|
|
972
952
|
*/
|
|
973
953
|
class BelongsToReference {
|
|
974
954
|
/**
|
|
975
955
|
* The field name on the parent record for this has-many relationship.
|
|
976
956
|
*
|
|
977
|
-
* @property key
|
|
978
|
-
* @type {String}
|
|
979
|
-
* @public
|
|
980
957
|
*/
|
|
981
958
|
|
|
982
959
|
/**
|
|
983
960
|
* The type of resource this relationship will contain.
|
|
984
961
|
*
|
|
985
|
-
* @property type
|
|
986
|
-
* @type {String}
|
|
987
|
-
* @public
|
|
988
962
|
*/
|
|
989
963
|
|
|
990
964
|
// unsubscribe tokens given to us by the notification manager
|
|
@@ -1020,9 +994,6 @@ class BelongsToReference {
|
|
|
1020
994
|
* The identifier of the record that this reference refers to.
|
|
1021
995
|
* `null` if no related record is known.
|
|
1022
996
|
*
|
|
1023
|
-
* @property identifier
|
|
1024
|
-
* @type {ResourceKey | null}
|
|
1025
|
-
* @public
|
|
1026
997
|
*/
|
|
1027
998
|
get identifier() {
|
|
1028
999
|
if (this.___relatedToken) {
|
|
@@ -1073,7 +1044,7 @@ class BelongsToReference {
|
|
|
1073
1044
|
}
|
|
1074
1045
|
```
|
|
1075
1046
|
@public
|
|
1076
|
-
@return
|
|
1047
|
+
@return The id of the record in this belongsTo relationship.
|
|
1077
1048
|
*/
|
|
1078
1049
|
static {
|
|
1079
1050
|
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
@@ -1083,7 +1054,7 @@ class BelongsToReference {
|
|
|
1083
1054
|
}
|
|
1084
1055
|
|
|
1085
1056
|
/**
|
|
1086
|
-
The link
|
|
1057
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
1087
1058
|
relationship. By default it uses only the "related" resource linkage.
|
|
1088
1059
|
Example
|
|
1089
1060
|
```javascript
|
|
@@ -1112,7 +1083,7 @@ class BelongsToReference {
|
|
|
1112
1083
|
}
|
|
1113
1084
|
```
|
|
1114
1085
|
@public
|
|
1115
|
-
@return
|
|
1086
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
1116
1087
|
*/
|
|
1117
1088
|
link() {
|
|
1118
1089
|
const resource = this._resource();
|
|
@@ -1167,7 +1138,7 @@ class BelongsToReference {
|
|
|
1167
1138
|
userRef.meta() // { lastUpdated: 1458014400000 }
|
|
1168
1139
|
```
|
|
1169
1140
|
@public
|
|
1170
|
-
@return
|
|
1141
|
+
@return The meta information for the belongs-to relationship.
|
|
1171
1142
|
*/
|
|
1172
1143
|
meta() {
|
|
1173
1144
|
let meta = null;
|
|
@@ -1216,7 +1187,7 @@ class BelongsToReference {
|
|
|
1216
1187
|
}
|
|
1217
1188
|
```
|
|
1218
1189
|
@public
|
|
1219
|
-
@return
|
|
1190
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
1220
1191
|
*/
|
|
1221
1192
|
remoteType() {
|
|
1222
1193
|
const value = this._resource();
|
|
@@ -1299,9 +1270,9 @@ class BelongsToReference {
|
|
|
1299
1270
|
particularly useful if you want to update the state of the relationship without
|
|
1300
1271
|
forcing the load of all of the associated record.
|
|
1301
1272
|
@public
|
|
1302
|
-
@param
|
|
1303
|
-
@param
|
|
1304
|
-
@return
|
|
1273
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
1274
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
1275
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
1305
1276
|
*/
|
|
1306
1277
|
async push(doc, skipFetch) {
|
|
1307
1278
|
const {
|
|
@@ -1381,7 +1352,7 @@ class BelongsToReference {
|
|
|
1381
1352
|
});
|
|
1382
1353
|
```
|
|
1383
1354
|
@public
|
|
1384
|
-
@return
|
|
1355
|
+
@return the record in this relationship
|
|
1385
1356
|
*/
|
|
1386
1357
|
value() {
|
|
1387
1358
|
const resource = this._resource();
|
|
@@ -1435,8 +1406,8 @@ class BelongsToReference {
|
|
|
1435
1406
|
});
|
|
1436
1407
|
```
|
|
1437
1408
|
@public
|
|
1438
|
-
@param
|
|
1439
|
-
@return
|
|
1409
|
+
@param options the options to pass in.
|
|
1410
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
1440
1411
|
*/
|
|
1441
1412
|
async load(options) {
|
|
1442
1413
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1449,7 +1420,7 @@ class BelongsToReference {
|
|
|
1449
1420
|
|
|
1450
1421
|
/**
|
|
1451
1422
|
Triggers a reload of the value in this relationship. If the
|
|
1452
|
-
remoteType is `"link"`
|
|
1423
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
1453
1424
|
reload the relationship. Otherwise it will reload the record by its
|
|
1454
1425
|
id.
|
|
1455
1426
|
Example
|
|
@@ -1484,8 +1455,8 @@ class BelongsToReference {
|
|
|
1484
1455
|
userRef.reload({ adapterOptions: { isPrivate: true } })
|
|
1485
1456
|
```
|
|
1486
1457
|
@public
|
|
1487
|
-
@param
|
|
1488
|
-
@return
|
|
1458
|
+
@param options the options to pass in.
|
|
1459
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
1489
1460
|
*/
|
|
1490
1461
|
reload(options) {
|
|
1491
1462
|
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-DDVYxmUV.js";
|
|
4
4
|
import { n as normalizeModelName } from "./util-DvanW33H.js";
|
|
5
5
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
6
6
|
const type = identifier.type;
|
package/dist/unpkg/dev/index.js
CHANGED
|
@@ -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-DmGGJr3T.js";
|
|
11
|
+
import "./schema-provider-DDVYxmUV.js";
|
|
12
|
+
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-CkYiE6Ud.js";
|
|
13
13
|
import '@ember/application';
|
|
14
14
|
import { registerDerivations as registerDerivations$1, DelegatingSchemaService } from './model/migration-support.js';
|
|
15
15
|
import { F as FragmentExtension, a as FragmentArrayExtension, f as fragmentsModelFor } from "./model-for-CqXsIKws.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-DmGGJr3T.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-DmGGJr3T.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-DDVYxmUV.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
|
package/dist/unpkg/dev/model.js
CHANGED
|
@@ -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-DvanW33H.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-DmGGJr3T.js";
|
|
7
7
|
import '@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-DDVYxmUV.js";
|
|
9
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-CkYiE6Ud.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options provided to the attr decorator are
|