@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, 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() {
|
|
@@ -131,8 +130,6 @@ class PromiseManyArray {
|
|
|
131
130
|
/**
|
|
132
131
|
* Reload the relationship
|
|
133
132
|
* @public
|
|
134
|
-
* @param options
|
|
135
|
-
* @return
|
|
136
133
|
*/
|
|
137
134
|
reload(options) {
|
|
138
135
|
void this.content.reload(options);
|
|
@@ -144,32 +141,24 @@ class PromiseManyArray {
|
|
|
144
141
|
/**
|
|
145
142
|
* Whether the loading promise is still pending
|
|
146
143
|
*
|
|
147
|
-
* @property isPending
|
|
148
|
-
* @type {Boolean}
|
|
149
144
|
* @public
|
|
150
145
|
*/
|
|
151
146
|
|
|
152
147
|
/**
|
|
153
148
|
* Whether the loading promise rejected
|
|
154
149
|
*
|
|
155
|
-
* @property isRejected
|
|
156
|
-
* @type {Boolean}
|
|
157
150
|
* @public
|
|
158
151
|
*/
|
|
159
152
|
|
|
160
153
|
/**
|
|
161
154
|
* Whether the loading promise succeeded
|
|
162
155
|
*
|
|
163
|
-
* @property isFulfilled
|
|
164
|
-
* @type {Boolean}
|
|
165
156
|
* @public
|
|
166
157
|
*/
|
|
167
158
|
|
|
168
159
|
/**
|
|
169
160
|
* Whether the loading promise completed (resolved or rejected)
|
|
170
161
|
*
|
|
171
|
-
* @property isSettled
|
|
172
|
-
* @type {Boolean}
|
|
173
162
|
* @public
|
|
174
163
|
*/
|
|
175
164
|
|
|
@@ -185,8 +174,6 @@ class PromiseManyArray {
|
|
|
185
174
|
/**
|
|
186
175
|
* catch errors thrown by this promise
|
|
187
176
|
* @public
|
|
188
|
-
* @param callback
|
|
189
|
-
* @return {Promise}
|
|
190
177
|
*/
|
|
191
178
|
catch(cb) {
|
|
192
179
|
return this.promise.catch(cb);
|
|
@@ -196,8 +183,6 @@ class PromiseManyArray {
|
|
|
196
183
|
* run cleanup after this promise completes
|
|
197
184
|
*
|
|
198
185
|
* @public
|
|
199
|
-
* @param callback
|
|
200
|
-
* @return {Promise}
|
|
201
186
|
*/
|
|
202
187
|
finally(cb) {
|
|
203
188
|
return this.promise.finally(cb);
|
|
@@ -215,7 +200,6 @@ class PromiseManyArray {
|
|
|
215
200
|
|
|
216
201
|
/**
|
|
217
202
|
* Retrieve the links for this relationship
|
|
218
|
-
* @property links
|
|
219
203
|
* @public
|
|
220
204
|
*/
|
|
221
205
|
get links() {
|
|
@@ -224,7 +208,6 @@ class PromiseManyArray {
|
|
|
224
208
|
|
|
225
209
|
/**
|
|
226
210
|
* Retrieve the meta for this relationship
|
|
227
|
-
* @property meta
|
|
228
211
|
* @public
|
|
229
212
|
*/
|
|
230
213
|
static {
|
|
@@ -435,7 +418,7 @@ class HasManyReference {
|
|
|
435
418
|
}
|
|
436
419
|
```
|
|
437
420
|
@public
|
|
438
|
-
@return
|
|
421
|
+
@return The name of the remote type. This should either be `link` or `ids`
|
|
439
422
|
*/
|
|
440
423
|
remoteType() {
|
|
441
424
|
const value = this._resource();
|
|
@@ -470,14 +453,14 @@ class HasManyReference {
|
|
|
470
453
|
commentsRef.ids(); // ['1']
|
|
471
454
|
```
|
|
472
455
|
@public
|
|
473
|
-
@return
|
|
456
|
+
@return The ids in this has-many relationship
|
|
474
457
|
*/
|
|
475
458
|
ids() {
|
|
476
459
|
return this.identifiers.map(identifier => identifier.id);
|
|
477
460
|
}
|
|
478
461
|
|
|
479
462
|
/**
|
|
480
|
-
The link
|
|
463
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
481
464
|
relationship. By default it uses only the "related" resource linkage.
|
|
482
465
|
Example
|
|
483
466
|
```javascript
|
|
@@ -506,7 +489,7 @@ class HasManyReference {
|
|
|
506
489
|
}
|
|
507
490
|
```
|
|
508
491
|
@public
|
|
509
|
-
@return
|
|
492
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
510
493
|
*/
|
|
511
494
|
link() {
|
|
512
495
|
const resource = this._resource();
|
|
@@ -561,7 +544,7 @@ class HasManyReference {
|
|
|
561
544
|
usersRef.meta() // { lastUpdated: 1458014400000 }
|
|
562
545
|
```
|
|
563
546
|
@public
|
|
564
|
-
@return
|
|
547
|
+
@return The meta information for the belongs-to relationship.
|
|
565
548
|
*/
|
|
566
549
|
meta() {
|
|
567
550
|
let meta = null;
|
|
@@ -647,9 +630,8 @@ class HasManyReference {
|
|
|
647
630
|
particularly useful if you want to update the state of the relationship without
|
|
648
631
|
forcing the load of all of the associated records.
|
|
649
632
|
@public
|
|
650
|
-
@param
|
|
651
|
-
@param
|
|
652
|
-
@return {Promise<ManyArray | void>}
|
|
633
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
634
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
653
635
|
*/
|
|
654
636
|
async push(doc, skipFetch) {
|
|
655
637
|
const {
|
|
@@ -728,7 +710,6 @@ class HasManyReference {
|
|
|
728
710
|
})
|
|
729
711
|
```
|
|
730
712
|
@public
|
|
731
|
-
@return {ManyArray}
|
|
732
713
|
*/
|
|
733
714
|
value() {
|
|
734
715
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -788,8 +769,8 @@ class HasManyReference {
|
|
|
788
769
|
});
|
|
789
770
|
```
|
|
790
771
|
@public
|
|
791
|
-
@param
|
|
792
|
-
@return
|
|
772
|
+
@param options the options to pass in.
|
|
773
|
+
@return a promise that resolves with the ManyArray in
|
|
793
774
|
this has-many relationship.
|
|
794
775
|
*/
|
|
795
776
|
async load(options) {
|
|
@@ -836,9 +817,9 @@ class HasManyReference {
|
|
|
836
817
|
```javascript
|
|
837
818
|
commentsRef.reload({ adapterOptions: { isPrivate: true } })
|
|
838
819
|
```
|
|
839
|
-
|
|
840
|
-
@param
|
|
841
|
-
@return
|
|
820
|
+
@public
|
|
821
|
+
@param options the options to pass in.
|
|
822
|
+
@return a promise that resolves with the ManyArray in this has-many relationship.
|
|
842
823
|
*/
|
|
843
824
|
reload(options) {
|
|
844
825
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -894,24 +875,17 @@ function isResourceIdentiferWithRelatedLinks(value) {
|
|
|
894
875
|
References are "stable", meaning that multiple calls to retrieve the reference
|
|
895
876
|
for a given relationship will always return the same HasManyReference.
|
|
896
877
|
|
|
897
|
-
@class BelongsToReference
|
|
898
878
|
@public
|
|
899
879
|
*/
|
|
900
880
|
class BelongsToReference {
|
|
901
881
|
/**
|
|
902
882
|
* The field name on the parent record for this has-many relationship.
|
|
903
883
|
*
|
|
904
|
-
* @property key
|
|
905
|
-
* @type {String}
|
|
906
|
-
* @public
|
|
907
884
|
*/
|
|
908
885
|
|
|
909
886
|
/**
|
|
910
887
|
* The type of resource this relationship will contain.
|
|
911
888
|
*
|
|
912
|
-
* @property type
|
|
913
|
-
* @type {String}
|
|
914
|
-
* @public
|
|
915
889
|
*/
|
|
916
890
|
|
|
917
891
|
// unsubscribe tokens given to us by the notification manager
|
|
@@ -947,9 +921,6 @@ class BelongsToReference {
|
|
|
947
921
|
* The identifier of the record that this reference refers to.
|
|
948
922
|
* `null` if no related record is known.
|
|
949
923
|
*
|
|
950
|
-
* @property identifier
|
|
951
|
-
* @type {ResourceKey | null}
|
|
952
|
-
* @public
|
|
953
924
|
*/
|
|
954
925
|
get identifier() {
|
|
955
926
|
if (this.___relatedToken) {
|
|
@@ -1000,7 +971,7 @@ class BelongsToReference {
|
|
|
1000
971
|
}
|
|
1001
972
|
```
|
|
1002
973
|
@public
|
|
1003
|
-
@return
|
|
974
|
+
@return The id of the record in this belongsTo relationship.
|
|
1004
975
|
*/
|
|
1005
976
|
static {
|
|
1006
977
|
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
@@ -1010,7 +981,7 @@ class BelongsToReference {
|
|
|
1010
981
|
}
|
|
1011
982
|
|
|
1012
983
|
/**
|
|
1013
|
-
The link
|
|
984
|
+
The link WarpDrive will use to fetch or reload this belongs-to
|
|
1014
985
|
relationship. By default it uses only the "related" resource linkage.
|
|
1015
986
|
Example
|
|
1016
987
|
```javascript
|
|
@@ -1039,7 +1010,7 @@ class BelongsToReference {
|
|
|
1039
1010
|
}
|
|
1040
1011
|
```
|
|
1041
1012
|
@public
|
|
1042
|
-
@return
|
|
1013
|
+
@return The link WarpDrive will use to fetch or reload this belongs-to relationship.
|
|
1043
1014
|
*/
|
|
1044
1015
|
link() {
|
|
1045
1016
|
const resource = this._resource();
|
|
@@ -1094,7 +1065,7 @@ class BelongsToReference {
|
|
|
1094
1065
|
userRef.meta() // { lastUpdated: 1458014400000 }
|
|
1095
1066
|
```
|
|
1096
1067
|
@public
|
|
1097
|
-
@return
|
|
1068
|
+
@return The meta information for the belongs-to relationship.
|
|
1098
1069
|
*/
|
|
1099
1070
|
meta() {
|
|
1100
1071
|
let meta = null;
|
|
@@ -1143,7 +1114,7 @@ class BelongsToReference {
|
|
|
1143
1114
|
}
|
|
1144
1115
|
```
|
|
1145
1116
|
@public
|
|
1146
|
-
@return
|
|
1117
|
+
@return The name of the remote type. This should either be `link` or `id`
|
|
1147
1118
|
*/
|
|
1148
1119
|
remoteType() {
|
|
1149
1120
|
const value = this._resource();
|
|
@@ -1226,9 +1197,9 @@ class BelongsToReference {
|
|
|
1226
1197
|
particularly useful if you want to update the state of the relationship without
|
|
1227
1198
|
forcing the load of all of the associated record.
|
|
1228
1199
|
@public
|
|
1229
|
-
@param
|
|
1230
|
-
@param
|
|
1231
|
-
@return
|
|
1200
|
+
@param doc a JSONAPI document object describing the new value of this relationship.
|
|
1201
|
+
@param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
|
|
1202
|
+
@return a promise that resolves with the record in this belongs-to relationship after the push has completed.
|
|
1232
1203
|
*/
|
|
1233
1204
|
async push(doc, skipFetch) {
|
|
1234
1205
|
const {
|
|
@@ -1303,7 +1274,7 @@ class BelongsToReference {
|
|
|
1303
1274
|
});
|
|
1304
1275
|
```
|
|
1305
1276
|
@public
|
|
1306
|
-
@return
|
|
1277
|
+
@return the record in this relationship
|
|
1307
1278
|
*/
|
|
1308
1279
|
value() {
|
|
1309
1280
|
const resource = this._resource();
|
|
@@ -1357,8 +1328,8 @@ class BelongsToReference {
|
|
|
1357
1328
|
});
|
|
1358
1329
|
```
|
|
1359
1330
|
@public
|
|
1360
|
-
@param
|
|
1361
|
-
@return
|
|
1331
|
+
@param options the options to pass in.
|
|
1332
|
+
@return a promise that resolves with the record in this belongs-to relationship.
|
|
1362
1333
|
*/
|
|
1363
1334
|
async load(options) {
|
|
1364
1335
|
const support = LEGACY_SUPPORT.get(this.___identifier);
|
|
@@ -1371,7 +1342,7 @@ class BelongsToReference {
|
|
|
1371
1342
|
|
|
1372
1343
|
/**
|
|
1373
1344
|
Triggers a reload of the value in this relationship. If the
|
|
1374
|
-
remoteType is `"link"`
|
|
1345
|
+
remoteType is `"link"` WarpDrive will use the relationship link to
|
|
1375
1346
|
reload the relationship. Otherwise it will reload the record by its
|
|
1376
1347
|
id.
|
|
1377
1348
|
Example
|
|
@@ -1406,8 +1377,8 @@ class BelongsToReference {
|
|
|
1406
1377
|
userRef.reload({ adapterOptions: { isPrivate: true } })
|
|
1407
1378
|
```
|
|
1408
1379
|
@public
|
|
1409
|
-
@param
|
|
1410
|
-
@return
|
|
1380
|
+
@param options the options to pass in.
|
|
1381
|
+
@return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
|
|
1411
1382
|
*/
|
|
1412
1383
|
reload(options) {
|
|
1413
1384
|
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-DJtD_8jZ.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/prod/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-BGVFCBmi.js";
|
|
11
|
+
import "./schema-provider-DJtD_8jZ.js";
|
|
12
|
+
import { i as instantiateRecord, t as teardownRecord, m as modelFor } from "./hooks-BztVA_x0.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',
|
|
@@ -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-BGVFCBmi.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-BGVFCBmi.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-DJtD_8jZ.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
|
package/dist/unpkg/prod/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-BGVFCBmi.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-DJtD_8jZ.js";
|
|
9
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-BztVA_x0.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options provided to the attr decorator are
|