@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, 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-BG3bMiKp.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';
|
|
@@ -87,7 +88,6 @@ PromiseBelongsTo.prototype[LegacyPromiseProxy] = true;
|
|
|
87
88
|
const comments = await post.comments;
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
@class PromiseManyArray
|
|
91
91
|
@public
|
|
92
92
|
*/
|
|
93
93
|
class PromiseManyArray {
|
|
@@ -99,7 +99,6 @@ class PromiseManyArray {
|
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Retrieve the length of the content
|
|
102
|
-
* @property length
|
|
103
102
|
* @public
|
|
104
103
|
*/
|
|
105
104
|
get length() {
|
|
@@ -148,8 +147,6 @@ class PromiseManyArray {
|
|
|
148
147
|
/**
|
|
149
148
|
* Reload the relationship
|
|
150
149
|
* @public
|
|
151
|
-
* @param options
|
|
152
|
-
* @return
|
|
153
150
|
*/
|
|
154
151
|
reload(options) {
|
|
155
152
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -166,32 +163,24 @@ class PromiseManyArray {
|
|
|
166
163
|
/**
|
|
167
164
|
* Whether the loading promise is still pending
|
|
168
165
|
*
|
|
169
|
-
* @property isPending
|
|
170
|
-
* @type {Boolean}
|
|
171
166
|
* @public
|
|
172
167
|
*/
|
|
173
168
|
|
|
174
169
|
/**
|
|
175
170
|
* Whether the loading promise rejected
|
|
176
171
|
*
|
|
177
|
-
* @property isRejected
|
|
178
|
-
* @type {Boolean}
|
|
179
172
|
* @public
|
|
180
173
|
*/
|
|
181
174
|
|
|
182
175
|
/**
|
|
183
176
|
* Whether the loading promise succeeded
|
|
184
177
|
*
|
|
185
|
-
* @property isFulfilled
|
|
186
|
-
* @type {Boolean}
|
|
187
178
|
* @public
|
|
188
179
|
*/
|
|
189
180
|
|
|
190
181
|
/**
|
|
191
182
|
* Whether the loading promise completed (resolved or rejected)
|
|
192
183
|
*
|
|
193
|
-
* @property isSettled
|
|
194
|
-
* @type {Boolean}
|
|
195
184
|
* @public
|
|
196
185
|
*/
|
|
197
186
|
|
|
@@ -207,8 +196,6 @@ class PromiseManyArray {
|
|
|
207
196
|
/**
|
|
208
197
|
* catch errors thrown by this promise
|
|
209
198
|
* @public
|
|
210
|
-
* @param callback
|
|
211
|
-
* @return {Promise}
|
|
212
199
|
*/
|
|
213
200
|
catch(cb) {
|
|
214
201
|
return this.promise.catch(cb);
|
|
@@ -218,8 +205,6 @@ class PromiseManyArray {
|
|
|
218
205
|
* run cleanup after this promise completes
|
|
219
206
|
*
|
|
220
207
|
* @public
|
|
221
|
-
* @param callback
|
|
222
|
-
* @return {Promise}
|
|
223
208
|
*/
|
|
224
209
|
finally(cb) {
|
|
225
210
|
return this.promise.finally(cb);
|
|
@@ -237,7 +222,6 @@ class PromiseManyArray {
|
|
|
237
222
|
|
|
238
223
|
/**
|
|
239
224
|
* Retrieve the links for this relationship
|
|
240
|
-
* @property links
|
|
241
225
|
* @public
|
|
242
226
|
*/
|
|
243
227
|
get links() {
|
|
@@ -246,7 +230,6 @@ class PromiseManyArray {
|
|
|
246
230
|
|
|
247
231
|
/**
|
|
248
232
|
* Retrieve the meta for this relationship
|
|
249
|
-
* @property meta
|
|
250
233
|
* @public
|
|
251
234
|
*/
|
|
252
235
|
static {
|
|
@@ -494,7 +477,7 @@ class HasManyReference {
|
|
|
494
477
|
}
|
|
495
478
|
```
|
|
496
479
|
@public
|
|
497
|
-
@return
|
|
480
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
498
481
|
*/
|
|
499
482
|
remoteType() {
|
|
500
483
|
const value = this._resource();
|
|
@@ -529,14 +512,14 @@ class HasManyReference {
|
|
|
529
512
|
commentsRef.ids(); // ['1']
|
|
530
513
|
```
|
|
531
514
|
@public
|
|
532
|
-
@return
|
|
515
|
+
@return The ids in this has-many relationship
|
|
533
516
|
*/
|
|
534
517
|
ids() {
|
|
535
518
|
return this.identifiers.map(identifier => identifier.id);
|
|
536
519
|
}
|
|
537
520
|
|
|
538
521
|
/**
|
|
539
|
-
The link
|
|
522
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
540
523
|
relationship. By default it uses only the "related" resource linkage.
|
|
541
524
|
Example
|
|
542
525
|
```javascript
|
|
@@ -565,7 +548,7 @@ class HasManyReference {
|
|
|
565
548
|
}
|
|
566
549
|
```
|
|
567
550
|
@public
|
|
568
|
-
@return
|
|
551
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
569
552
|
*/
|
|
570
553
|
link() {
|
|
571
554
|
const resource = this._resource();
|
|
@@ -620,7 +603,7 @@ class HasManyReference {
|
|
|
620
603
|
usersRef.meta() // { lastUpdated: 1458014400000 }
|
|
621
604
|
```
|
|
622
605
|
@public
|
|
623
|
-
@return
|
|
606
|
+
@return The meta information for the belongs-to relationship.
|
|
624
607
|
*/
|
|
625
608
|
meta() {
|
|
626
609
|
let meta = null;
|
|
@@ -706,9 +689,8 @@ class HasManyReference {
|
|
|
706
689
|
particularly useful if you want to update the state of the relationship without
|
|
707
690
|
forcing the load of all of the associated records.
|
|
708
691
|
@public
|
|
709
|
-
@param
|
|
710
|
-
@param
|
|
711
|
-
@return {Promise<ManyArray | void>}
|
|
692
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
693
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
712
694
|
*/
|
|
713
695
|
async push(doc, skipFetch) {
|
|
714
696
|
const {
|
|
@@ -800,7 +782,6 @@ class HasManyReference {
|
|
|
800
782
|
})
|
|
801
783
|
```
|
|
802
784
|
@public
|
|
803
|
-
@return {ManyArray}
|
|
804
785
|
*/
|
|
805
786
|
value() {
|
|
806
787
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -860,8 +841,8 @@ class HasManyReference {
|
|
|
860
841
|
});
|
|
861
842
|
```
|
|
862
843
|
@public
|
|
863
|
-
@param
|
|
864
|
-
@return
|
|
844
|
+
@param options the options to pass in.
|
|
845
|
+
@return a promise that resolves with the ManyArray in
|
|
865
846
|
this has-many relationship.
|
|
866
847
|
*/
|
|
867
848
|
async load(options) {
|
|
@@ -908,9 +889,9 @@ class HasManyReference {
|
|
|
908
889
|
```javascript
|
|
909
890
|
commentsRef.reload({ adapterOptions: { isPrivate: true } })
|
|
910
891
|
```
|
|
911
|
-
|
|
912
|
-
@param
|
|
913
|
-
@return
|
|
892
|
+
@public
|
|
893
|
+
@param options the options to pass in.
|
|
894
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
914
895
|
*/
|
|
915
896
|
reload(options) {
|
|
916
897
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -971,24 +952,17 @@ function isResourceIdentiferWithRelatedLinks(value) {
|
|
|
971
952
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
972
953
|
for a given relationship will always return the same HasManyReference.
|
|
973
954
|
|
|
974
|
-
@class BelongsToReference
|
|
975
955
|
@public
|
|
976
956
|
*/
|
|
977
957
|
class BelongsToReference {
|
|
978
958
|
/**
|
|
979
959
|
* The field name on the parent record for this has-many relationship.
|
|
980
960
|
*
|
|
981
|
-
* @property key
|
|
982
|
-
* @type {String}
|
|
983
|
-
* @public
|
|
984
961
|
*/
|
|
985
962
|
|
|
986
963
|
/**
|
|
987
964
|
* The type of resource this relationship will contain.
|
|
988
965
|
*
|
|
989
|
-
* @property type
|
|
990
|
-
* @type {String}
|
|
991
|
-
* @public
|
|
992
966
|
*/
|
|
993
967
|
|
|
994
968
|
// unsubscribe tokens given to us by the notification manager
|
|
@@ -1024,9 +998,6 @@ class BelongsToReference {
|
|
|
1024
998
|
* The identifier of the record that this reference refers to.
|
|
1025
999
|
* `null` if no related record is known.
|
|
1026
1000
|
*
|
|
1027
|
-
* @property identifier
|
|
1028
|
-
* @type {ResourceKey | null}
|
|
1029
|
-
* @public
|
|
1030
1001
|
*/
|
|
1031
1002
|
get identifier() {
|
|
1032
1003
|
if (this.___relatedToken) {
|
|
@@ -1077,7 +1048,7 @@ class BelongsToReference {
|
|
|
1077
1048
|
}
|
|
1078
1049
|
```
|
|
1079
1050
|
@public
|
|
1080
|
-
@return
|
|
1051
|
+
@return The id of the record in this belongsTo relationship.
|
|
1081
1052
|
*/
|
|
1082
1053
|
static {
|
|
1083
1054
|
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
@@ -1087,7 +1058,7 @@ class BelongsToReference {
|
|
|
1087
1058
|
}
|
|
1088
1059
|
|
|
1089
1060
|
/**
|
|
1090
|
-
The link
|
|
1061
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
1091
1062
|
relationship. By default it uses only the "related" resource linkage.
|
|
1092
1063
|
Example
|
|
1093
1064
|
```javascript
|
|
@@ -1116,7 +1087,7 @@ class BelongsToReference {
|
|
|
1116
1087
|
}
|
|
1117
1088
|
```
|
|
1118
1089
|
@public
|
|
1119
|
-
@return
|
|
1090
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
1120
1091
|
*/
|
|
1121
1092
|
link() {
|
|
1122
1093
|
const resource = this._resource();
|
|
@@ -1171,7 +1142,7 @@ class BelongsToReference {
|
|
|
1171
1142
|
userRef.meta() // { lastUpdated: 1458014400000 }
|
|
1172
1143
|
```
|
|
1173
1144
|
@public
|
|
1174
|
-
@return
|
|
1145
|
+
@return The meta information for the belongs-to relationship.
|
|
1175
1146
|
*/
|
|
1176
1147
|
meta() {
|
|
1177
1148
|
let meta = null;
|
|
@@ -1220,7 +1191,7 @@ class BelongsToReference {
|
|
|
1220
1191
|
}
|
|
1221
1192
|
```
|
|
1222
1193
|
@public
|
|
1223
|
-
@return
|
|
1194
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
1224
1195
|
*/
|
|
1225
1196
|
remoteType() {
|
|
1226
1197
|
const value = this._resource();
|
|
@@ -1303,9 +1274,9 @@ class BelongsToReference {
|
|
|
1303
1274
|
particularly useful if you want to update the state of the relationship without
|
|
1304
1275
|
forcing the load of all of the associated record.
|
|
1305
1276
|
@public
|
|
1306
|
-
@param
|
|
1307
|
-
@param
|
|
1308
|
-
@return
|
|
1277
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
1278
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
1279
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
1309
1280
|
*/
|
|
1310
1281
|
async push(doc, skipFetch) {
|
|
1311
1282
|
const {
|
|
@@ -1385,7 +1356,7 @@ class BelongsToReference {
|
|
|
1385
1356
|
});
|
|
1386
1357
|
```
|
|
1387
1358
|
@public
|
|
1388
|
-
@return
|
|
1359
|
+
@return the record in this relationship
|
|
1389
1360
|
*/
|
|
1390
1361
|
value() {
|
|
1391
1362
|
const resource = this._resource();
|
|
@@ -1439,8 +1410,8 @@ class BelongsToReference {
|
|
|
1439
1410
|
});
|
|
1440
1411
|
```
|
|
1441
1412
|
@public
|
|
1442
|
-
@param
|
|
1443
|
-
@return
|
|
1413
|
+
@param options the options to pass in.
|
|
1414
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
1444
1415
|
*/
|
|
1445
1416
|
async load(options) {
|
|
1446
1417
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1453,7 +1424,7 @@ class BelongsToReference {
|
|
|
1453
1424
|
|
|
1454
1425
|
/**
|
|
1455
1426
|
Triggers a reload of the value in this relationship. If the
|
|
1456
|
-
remoteType is `"link"`
|
|
1427
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
1457
1428
|
reload the relationship. Otherwise it will reload the record by its
|
|
1458
1429
|
id.
|
|
1459
1430
|
Example
|
|
@@ -1488,8 +1459,8 @@ class BelongsToReference {
|
|
|
1488
1459
|
userRef.reload({ adapterOptions: { isPrivate: true } })
|
|
1489
1460
|
```
|
|
1490
1461
|
@public
|
|
1491
|
-
@param
|
|
1492
|
-
@return
|
|
1462
|
+
@param options the options to pass in.
|
|
1463
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
1493
1464
|
*/
|
|
1494
1465
|
reload(options) {
|
|
1495
1466
|
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-DJCV_6AF.js";
|
|
4
4
|
import { n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
function instantiateRecord(identifier, createRecordArgs) {
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import '@ember/debug';
|
|
|
9
9
|
import '@warp-drive/utilities/string';
|
|
10
10
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
11
11
|
import '@warp-drive/core/store/-private';
|
|
12
|
-
import "./errors-
|
|
13
|
-
import "./schema-provider-
|
|
14
|
-
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-
|
|
12
|
+
import "./errors-Cz5KrzBk.js";
|
|
13
|
+
import "./schema-provider-DJCV_6AF.js";
|
|
14
|
+
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-D6diaM34.js";
|
|
15
15
|
import { registerDerivations as registerDerivations$1, DelegatingSchemaService } from './model/migration-support.js';
|
|
16
16
|
import { F as FragmentExtension, a as FragmentArrayExtension, f as fragmentsModelFor } from "./model-for-CqXsIKws.js";
|
|
17
17
|
import { restoreDeprecatedStoreBehaviors } from './store.js';
|
|
@@ -65,8 +65,8 @@ const PRIMARY_ATTRIBUTE_KEY = 'base';
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
`JSONSerializer` will normalize the JSON payload to the
|
|
69
|
-
|
|
68
|
+
`JSONSerializer` will normalize the JSON payload to the {json:api} format that the
|
|
69
|
+
JSONAPICache uses to cache data in the Store.
|
|
70
70
|
|
|
71
71
|
You can customize how JSONSerializer processes its payload by passing options in
|
|
72
72
|
the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:
|
|
@@ -101,7 +101,7 @@ const PRIMARY_ATTRIBUTE_KEY = 'base';
|
|
|
101
101
|
const JSONSerializer = Serializer.extend({
|
|
102
102
|
/**
|
|
103
103
|
The `primaryKey` is used when serializing and deserializing
|
|
104
|
-
data.
|
|
104
|
+
data. WarpDrive always uses the `id` property to store the id of
|
|
105
105
|
the record. The external source may not always follow this
|
|
106
106
|
convention. In these cases it is useful to override the
|
|
107
107
|
`primaryKey` property to match the `primaryKey` of your external
|
|
@@ -113,9 +113,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
113
113
|
primaryKey = '_id'
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
|
-
@
|
|
117
|
-
@type {String}
|
|
118
|
-
@public
|
|
116
|
+
@public
|
|
119
117
|
@default 'id'
|
|
120
118
|
*/
|
|
121
119
|
primaryKey: 'id',
|
|
@@ -453,9 +451,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
453
451
|
}
|
|
454
452
|
```
|
|
455
453
|
@public
|
|
456
|
-
@param {Model} typeClass
|
|
457
|
-
@param {Object} hash
|
|
458
|
-
@return {Object}
|
|
459
454
|
*/
|
|
460
455
|
normalize(modelClass, resourceHash) {
|
|
461
456
|
let data = null;
|
|
@@ -501,9 +496,6 @@ const JSONSerializer = Serializer.extend({
|
|
|
501
496
|
Returns the resource's attributes formatted as a JSON-API "attributes object".
|
|
502
497
|
http://jsonapi.org/format/#document-resource-object-attributes
|
|
503
498
|
@public
|
|
504
|
-
@param {Object} modelClass
|
|
505
|
-
@param {Object} resourceHash
|
|
506
|
-
@return {Object}
|
|
507
499
|
*/
|
|
508
500
|
extractAttributes(modelClass, resourceHash) {
|
|
509
501
|
let attributeKey;
|
|
@@ -644,8 +636,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
644
636
|
/**
|
|
645
637
|
Dasherizes the model name in the payload
|
|
646
638
|
@public
|
|
647
|
-
@
|
|
648
|
-
@return {String} the model's modelName
|
|
639
|
+
@return the model's modelName
|
|
649
640
|
*/
|
|
650
641
|
modelNameFromPayloadKey(key) {
|
|
651
642
|
return dasherize(singularize(key));
|
|
@@ -1158,11 +1149,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
1158
1149
|
}
|
|
1159
1150
|
```
|
|
1160
1151
|
@public
|
|
1161
|
-
@
|
|
1162
|
-
@param {Model} typeClass
|
|
1163
|
-
@param {Object} payload
|
|
1164
|
-
@param {(String|Number)} id
|
|
1165
|
-
@return {Object} json The deserialized errors
|
|
1152
|
+
@return json The deserialized errors
|
|
1166
1153
|
*/
|
|
1167
1154
|
extractErrors(store, typeClass, payload, id) {
|
|
1168
1155
|
// @ts-expect-error
|
package/dist/model/-private.js
CHANGED
|
@@ -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-Cz5KrzBk.js";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
4
|
-
import { notifyInternalSignal
|
|
4
|
+
import { notifyInternalSignal } from '@warp-drive/core/signals/-leaked';
|
|
5
|
+
import { assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
5
6
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
6
7
|
import { Type } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, E as Errors } from "../errors-
|
|
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-
|
|
8
|
+
import { l as lookupLegacySupport, E as Errors } from "../errors-Cz5KrzBk.js";
|
|
9
|
+
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-DJCV_6AF.js";
|
|
9
10
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -472,8 +473,9 @@ class DelegatingSchemaService {
|
|
|
472
473
|
return this._secondary.fields(resource);
|
|
473
474
|
}
|
|
474
475
|
cacheFields(resource) {
|
|
475
|
-
if (this._preferred.
|
|
476
|
-
|
|
476
|
+
if (this._preferred.hasResource?.(resource)) {
|
|
477
|
+
// @ts-expect-error
|
|
478
|
+
return this._preferred.cacheFields?.(resource);
|
|
477
479
|
}
|
|
478
480
|
|
|
479
481
|
// @ts-expect-error
|
package/dist/model.js
CHANGED
|
@@ -5,10 +5,10 @@ import { i as isElementDescriptor, n as normalizeModelName } from "./util-Dul6TZ
|
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
import { warn, deprecate } from '@ember/debug';
|
|
7
7
|
import { assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
8
|
-
import { l as lookupLegacySupport } from "./errors-
|
|
8
|
+
import { l as lookupLegacySupport } from "./errors-Cz5KrzBk.js";
|
|
9
9
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
10
|
-
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-
|
|
11
|
-
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-
|
|
10
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-DJCV_6AF.js";
|
|
11
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-D6diaM34.js";
|
|
12
12
|
function _attr(type, options) {
|
|
13
13
|
if (typeof type === 'object') {
|
|
14
14
|
options = type;
|