@warp-drive/legacy 5.8.0-alpha.9 → 5.8.0-beta.1
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/README.md +14 -27
- package/declarations/adapter/error.d.ts +7 -7
- package/declarations/adapter/json-api.d.ts +2 -2
- package/declarations/adapter/rest.d.ts +21 -104
- package/declarations/adapter.d.ts +2 -2
- package/declarations/compat/builders/find-all.d.ts +6 -6
- package/declarations/compat/builders/find-record.d.ts +8 -8
- package/declarations/compat/builders/query.d.ts +12 -12
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +16 -24
- package/declarations/compat/utils.d.ts +13 -13
- package/declarations/compat.d.ts +31 -5
- package/declarations/index.d.ts +25 -8
- package/declarations/model/-private/legacy-relationships-support.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 +18 -28
- package/declarations/model/-private/references/has-many.d.ts +13 -15
- package/declarations/model/migration-support.d.ts +42 -19
- package/declarations/model-fragments/extensions/fragment-array.d.ts +16 -0
- package/declarations/model-fragments/extensions/fragment.d.ts +15 -0
- package/declarations/model-fragments/hooks/model-for.d.ts +20 -0
- package/declarations/model-fragments/index.d.ts +5 -0
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +9 -0
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +15 -0
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +20 -0
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +19 -0
- package/declarations/model-fragments/utilities/with-legacy.d.ts +3 -0
- package/declarations/model-fragments.d.ts +9 -0
- package/declarations/model.d.ts +2 -2
- package/declarations/serializer/-private/embedded-records-mixin.d.ts +1 -1
- package/declarations/serializer/json-api.d.ts +7 -6
- package/declarations/serializer/json.d.ts +3 -3
- package/declarations/serializer.d.ts +5 -6
- package/dist/{-private-B1pSSN52.js → -private-BG3bMiKp.js} +2 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +9 -9
- 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/builders.js +26 -26
- package/dist/compat/utils.js +13 -14
- package/dist/compat.js +28 -8
- package/dist/{errors-COviC59J.js → errors-Cz5KrzBk.js} +113 -120
- package/dist/{hooks-Bp8SIQBU.js → hooks-D6diaM34.js} +1 -1
- package/dist/index.js +25 -8
- package/dist/{json-ksWOHRfq.js → json-ChdEfB0X.js} +12 -27
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +55 -25
- package/dist/model-for-CqXsIKws.js +221 -0
- package/dist/model-fragments.js +76 -0
- package/dist/model.js +3 -3
- package/dist/{schema-provider-JlCneqZH.js → schema-provider-DJCV_6AF.js} +44 -87
- package/dist/{serialize-into-hash-BnYvPex3.js → serialize-into-hash-DPZYoF-i.js} +1 -1
- package/dist/serializer/json-api.js +18 -45
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +10 -10
- package/dist/serializer.js +5 -6
- package/dist/store.js +2 -1
- package/dist/unpkg/dev/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev/adapter/-private.js +1 -0
- package/dist/unpkg/dev/adapter/error.js +335 -0
- package/dist/unpkg/dev/adapter/json-api.js +271 -0
- package/dist/unpkg/dev/adapter/rest.js +1171 -0
- package/dist/unpkg/dev/adapter.js +1252 -0
- package/dist/unpkg/dev/compat/-private.js +1 -0
- package/dist/unpkg/dev/compat/builders.js +275 -0
- package/dist/unpkg/dev/compat/extensions.js +242 -0
- package/dist/unpkg/dev/compat/utils.js +223 -0
- package/dist/unpkg/dev/compat.js +1147 -0
- package/dist/unpkg/dev/errors-DmGGJr3T.js +2562 -0
- package/dist/unpkg/dev/hooks-CkYiE6Ud.js +73 -0
- package/dist/unpkg/dev/index.js +197 -0
- package/dist/unpkg/dev/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev/model/-private.js +1 -0
- package/dist/unpkg/dev/model/migration-support.js +553 -0
- package/dist/unpkg/dev/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev/model-fragments.js +76 -0
- package/dist/unpkg/dev/model.js +678 -0
- package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +2186 -0
- package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev/serializer/json-api.js +649 -0
- package/dist/unpkg/dev/serializer/json.js +4 -0
- package/dist/unpkg/dev/serializer/rest.js +1242 -0
- package/dist/unpkg/dev/serializer/transform.js +278 -0
- package/dist/unpkg/dev/serializer.js +248 -0
- package/dist/unpkg/dev/store.js +637 -0
- package/dist/unpkg/dev/util-DvanW33H.js +20 -0
- package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/adapter/error.js +335 -0
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +271 -0
- package/dist/unpkg/dev-deprecated/adapter/rest.js +1171 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1252 -0
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/compat/builders.js +275 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js +242 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js +223 -0
- package/dist/unpkg/dev-deprecated/compat.js +1147 -0
- package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +2565 -0
- package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +73 -0
- package/dist/unpkg/dev-deprecated/index.js +196 -0
- package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/model/migration-support.js +570 -0
- package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/dev-deprecated/model.js +682 -0
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +2211 -0
- package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +649 -0
- package/dist/unpkg/dev-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/dev-deprecated/serializer/rest.js +1242 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/dev-deprecated/serializer.js +248 -0
- package/dist/unpkg/dev-deprecated/store.js +637 -0
- package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +24 -0
- package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
- package/dist/unpkg/prod/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod/adapter/-private.js +1 -0
- package/dist/unpkg/prod/adapter/error.js +330 -0
- package/dist/unpkg/prod/adapter/json-api.js +266 -0
- package/dist/unpkg/prod/adapter/rest.js +1134 -0
- package/dist/unpkg/prod/adapter.js +1219 -0
- package/dist/unpkg/prod/compat/-private.js +1 -0
- package/dist/unpkg/prod/compat/builders.js +210 -0
- package/dist/unpkg/prod/compat/extensions.js +232 -0
- package/dist/unpkg/prod/compat/utils.js +218 -0
- package/dist/unpkg/prod/compat.js +727 -0
- package/dist/unpkg/prod/errors-BGVFCBmi.js +2314 -0
- package/dist/unpkg/prod/hooks-BztVA_x0.js +41 -0
- package/dist/unpkg/prod/index.js +151 -0
- package/dist/unpkg/prod/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod/model/-private.js +1 -0
- package/dist/unpkg/prod/model/migration-support.js +546 -0
- package/dist/unpkg/prod/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod/model-fragments.js +76 -0
- package/dist/unpkg/prod/model.js +593 -0
- package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +1861 -0
- package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod/serializer/json-api.js +592 -0
- package/dist/unpkg/prod/serializer/json.js +4 -0
- package/dist/unpkg/prod/serializer/rest.js +1210 -0
- package/dist/unpkg/prod/serializer/transform.js +278 -0
- package/dist/unpkg/prod/serializer.js +248 -0
- package/dist/unpkg/prod/store.js +505 -0
- package/dist/unpkg/prod/util-DvanW33H.js +20 -0
- package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/adapter/error.js +330 -0
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +266 -0
- package/dist/unpkg/prod-deprecated/adapter/rest.js +1134 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1219 -0
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/compat/builders.js +210 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js +232 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js +218 -0
- package/dist/unpkg/prod-deprecated/compat.js +727 -0
- package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +2317 -0
- package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +41 -0
- package/dist/unpkg/prod-deprecated/index.js +150 -0
- package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/model/migration-support.js +563 -0
- package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/prod-deprecated/model.js +596 -0
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +1904 -0
- package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +592 -0
- package/dist/unpkg/prod-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/prod-deprecated/serializer/rest.js +1210 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/prod-deprecated/serializer.js +248 -0
- package/dist/unpkg/prod-deprecated/store.js +505 -0
- package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +23 -0
- package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +14 -6
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
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;
|
|
@@ -2,10 +2,11 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { deprecate } from '@ember/debug';
|
|
3
3
|
import EmberObject from '@ember/object';
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
|
-
import {
|
|
5
|
+
import { notifyInternalSignal, peekInternalSignal, withSignalStore, gate, memoized, defineSignal, entangleSignal, defineGate } from '@warp-drive/core/signals/-leaked';
|
|
6
|
+
import { assertPrivateStore, recordIdentifierFor as recordIdentifierFor$1, coerceId } from '@warp-drive/core/store/-private';
|
|
6
7
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-
|
|
8
|
-
import { u as upgradeStore, F as FetchManager } from "./-private-
|
|
8
|
+
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-Cz5KrzBk.js";
|
|
9
|
+
import { u as upgradeStore, F as FetchManager } from "./-private-BG3bMiKp.js";
|
|
9
10
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
11
|
import { cacheFor } from '@ember/object/internals';
|
|
11
12
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
@@ -775,9 +776,7 @@ class Model extends EmberObject {
|
|
|
775
776
|
the server or the `created` state if the record is created on the
|
|
776
777
|
client. A record can also enter the empty state if the adapter is
|
|
777
778
|
unable to locate the record.
|
|
778
|
-
@
|
|
779
|
-
@public
|
|
780
|
-
@readonly
|
|
779
|
+
@public
|
|
781
780
|
*/
|
|
782
781
|
get isEmpty() {
|
|
783
782
|
return this.currentState.isEmpty;
|
|
@@ -788,9 +787,7 @@ class Model extends EmberObject {
|
|
|
788
787
|
record enters this state when the store asks the adapter for its
|
|
789
788
|
data. It remains in this state until the adapter provides the
|
|
790
789
|
requested data.
|
|
791
|
-
@
|
|
792
|
-
@public
|
|
793
|
-
@readonly
|
|
790
|
+
@public
|
|
794
791
|
*/
|
|
795
792
|
static {
|
|
796
793
|
decorateMethodV2(this.prototype, "isEmpty", [memoized]);
|
|
@@ -811,9 +808,7 @@ class Model extends EmberObject {
|
|
|
811
808
|
const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
|
|
812
809
|
model.isLoaded;
|
|
813
810
|
```
|
|
814
|
-
@
|
|
815
|
-
@public
|
|
816
|
-
@readonly
|
|
811
|
+
@public
|
|
817
812
|
*/
|
|
818
813
|
static {
|
|
819
814
|
decorateMethodV2(this.prototype, "isLoading", [memoized]);
|
|
@@ -837,9 +832,7 @@ class Model extends EmberObject {
|
|
|
837
832
|
model.hasDirtyAttributes; // true
|
|
838
833
|
```
|
|
839
834
|
@since 1.13.0
|
|
840
|
-
@property hasDirtyAttributes
|
|
841
835
|
@public
|
|
842
|
-
@readonly
|
|
843
836
|
*/
|
|
844
837
|
static {
|
|
845
838
|
decorateMethodV2(this.prototype, "isLoaded", [memoized]);
|
|
@@ -863,9 +856,7 @@ class Model extends EmberObject {
|
|
|
863
856
|
record.isSaving; // false
|
|
864
857
|
});
|
|
865
858
|
```
|
|
866
|
-
@
|
|
867
|
-
@public
|
|
868
|
-
@readonly
|
|
859
|
+
@public
|
|
869
860
|
*/
|
|
870
861
|
static {
|
|
871
862
|
decorateMethodV2(this.prototype, "hasDirtyAttributes", [memoized]);
|
|
@@ -901,9 +892,7 @@ class Model extends EmberObject {
|
|
|
901
892
|
record.hasDirtyAttributes; // false
|
|
902
893
|
});
|
|
903
894
|
```
|
|
904
|
-
@
|
|
905
|
-
@public
|
|
906
|
-
@readonly
|
|
895
|
+
@public
|
|
907
896
|
*/
|
|
908
897
|
static {
|
|
909
898
|
decorateMethodV2(this.prototype, "isSaving", [memoized]);
|
|
@@ -925,9 +914,7 @@ class Model extends EmberObject {
|
|
|
925
914
|
model.isNew; // false
|
|
926
915
|
});
|
|
927
916
|
```
|
|
928
|
-
@
|
|
929
|
-
@public
|
|
930
|
-
@readonly
|
|
917
|
+
@public
|
|
931
918
|
*/
|
|
932
919
|
static {
|
|
933
920
|
decorateMethodV2(this.prototype, "isDeleted", [memoized]);
|
|
@@ -940,9 +927,7 @@ class Model extends EmberObject {
|
|
|
940
927
|
If this property is `true` the record is in the `valid` state.
|
|
941
928
|
A record will be in the `valid` state when the adapter did not report any
|
|
942
929
|
server-side validation failures.
|
|
943
|
-
@
|
|
944
|
-
@public
|
|
945
|
-
@readonly
|
|
930
|
+
@public
|
|
946
931
|
*/
|
|
947
932
|
static {
|
|
948
933
|
decorateMethodV2(this.prototype, "isNew", [memoized]);
|
|
@@ -963,9 +948,7 @@ class Model extends EmberObject {
|
|
|
963
948
|
let record = store.createRecord('model');
|
|
964
949
|
record.dirtyType; // 'created'
|
|
965
950
|
```
|
|
966
|
-
@
|
|
967
|
-
@public
|
|
968
|
-
@readonly
|
|
951
|
+
@public
|
|
969
952
|
*/
|
|
970
953
|
static {
|
|
971
954
|
decorateMethodV2(this.prototype, "isValid", [memoized]);
|
|
@@ -986,9 +969,7 @@ class Model extends EmberObject {
|
|
|
986
969
|
record.isError; // true
|
|
987
970
|
});
|
|
988
971
|
```
|
|
989
|
-
@
|
|
990
|
-
@public
|
|
991
|
-
@readonly
|
|
972
|
+
@public
|
|
992
973
|
*/
|
|
993
974
|
static {
|
|
994
975
|
decorateMethodV2(this.prototype, "dirtyType", [memoized]);
|
|
@@ -1013,9 +994,7 @@ class Model extends EmberObject {
|
|
|
1013
994
|
record.reload();
|
|
1014
995
|
record.isReloading; // true
|
|
1015
996
|
```
|
|
1016
|
-
@
|
|
1017
|
-
@public
|
|
1018
|
-
@readonly
|
|
997
|
+
@public
|
|
1019
998
|
*/
|
|
1020
999
|
|
|
1021
1000
|
/**
|
|
@@ -1030,8 +1009,7 @@ class Model extends EmberObject {
|
|
|
1030
1009
|
const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
|
|
1031
1010
|
model.id; // '1'
|
|
1032
1011
|
```
|
|
1033
|
-
@
|
|
1034
|
-
@public
|
|
1012
|
+
@public
|
|
1035
1013
|
*/
|
|
1036
1014
|
get id() {
|
|
1037
1015
|
// this guard exists, because some dev-only deprecation code
|
|
@@ -1069,7 +1047,6 @@ class Model extends EmberObject {
|
|
|
1069
1047
|
}
|
|
1070
1048
|
|
|
1071
1049
|
/**
|
|
1072
|
-
@property currentState
|
|
1073
1050
|
@private
|
|
1074
1051
|
*/
|
|
1075
1052
|
// TODO we can probably make this a computeOnce
|
|
@@ -1095,8 +1072,7 @@ class Model extends EmberObject {
|
|
|
1095
1072
|
|
|
1096
1073
|
/**
|
|
1097
1074
|
The store service instance which created this record instance
|
|
1098
|
-
|
|
1099
|
-
@public
|
|
1075
|
+
@public
|
|
1100
1076
|
*/
|
|
1101
1077
|
|
|
1102
1078
|
/**
|
|
@@ -1139,8 +1115,7 @@ class Model extends EmberObject {
|
|
|
1139
1115
|
</div>
|
|
1140
1116
|
{{/each}}
|
|
1141
1117
|
```
|
|
1142
|
-
@
|
|
1143
|
-
@public
|
|
1118
|
+
@public
|
|
1144
1119
|
*/
|
|
1145
1120
|
get errors() {
|
|
1146
1121
|
const errors = Errors.create({
|
|
@@ -1153,8 +1128,7 @@ class Model extends EmberObject {
|
|
|
1153
1128
|
/**
|
|
1154
1129
|
This property holds the `AdapterError` object with which
|
|
1155
1130
|
last adapter operation was rejected.
|
|
1156
|
-
@
|
|
1157
|
-
@public
|
|
1131
|
+
@public
|
|
1158
1132
|
*/
|
|
1159
1133
|
static {
|
|
1160
1134
|
decorateMethodV2(this.prototype, "errors", [computeOnce]);
|
|
@@ -1270,9 +1244,7 @@ class Model extends EmberObject {
|
|
|
1270
1244
|
}
|
|
1271
1245
|
});
|
|
1272
1246
|
```
|
|
1273
|
-
|
|
1274
|
-
@public
|
|
1275
|
-
@readonly
|
|
1247
|
+
@public
|
|
1276
1248
|
*/
|
|
1277
1249
|
static modelName = null;
|
|
1278
1250
|
|
|
@@ -1438,11 +1410,8 @@ class Model extends EmberObject {
|
|
|
1438
1410
|
relationships.post;
|
|
1439
1411
|
//=> [ { name: 'posts', kind: 'hasMany' } ]
|
|
1440
1412
|
```
|
|
1441
|
-
|
|
1442
|
-
@public
|
|
1443
|
-
@readonly
|
|
1413
|
+
@public
|
|
1444
1414
|
*/
|
|
1445
|
-
|
|
1446
1415
|
static get relationships() {
|
|
1447
1416
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1448
1417
|
if (!test) {
|
|
@@ -1486,9 +1455,7 @@ class Model extends EmberObject {
|
|
|
1486
1455
|
relationshipNames.belongsTo;
|
|
1487
1456
|
//=> ['owner']
|
|
1488
1457
|
```
|
|
1489
|
-
|
|
1490
|
-
@public
|
|
1491
|
-
@readonly
|
|
1458
|
+
@public
|
|
1492
1459
|
*/
|
|
1493
1460
|
static {
|
|
1494
1461
|
decorateMethodV2(this, "relationships", [computeOnce]);
|
|
@@ -1530,9 +1497,7 @@ class Model extends EmberObject {
|
|
|
1530
1497
|
let relatedTypes = Blog.relatedTypes');
|
|
1531
1498
|
//=> ['user', 'post']
|
|
1532
1499
|
```
|
|
1533
|
-
@
|
|
1534
|
-
@public
|
|
1535
|
-
@readonly
|
|
1500
|
+
@public
|
|
1536
1501
|
*/
|
|
1537
1502
|
static {
|
|
1538
1503
|
decorateMethodV2(this, "relationshipNames", [computeOnce]);
|
|
@@ -1582,9 +1547,7 @@ class Model extends EmberObject {
|
|
|
1582
1547
|
relationshipsByName.owner;
|
|
1583
1548
|
//=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }
|
|
1584
1549
|
```
|
|
1585
|
-
|
|
1586
|
-
@public
|
|
1587
|
-
@readonly
|
|
1550
|
+
@public
|
|
1588
1551
|
*/
|
|
1589
1552
|
static {
|
|
1590
1553
|
decorateMethodV2(this, "relatedTypes", [computeOnce]);
|
|
@@ -1664,9 +1627,7 @@ class Model extends EmberObject {
|
|
|
1664
1627
|
// posts, hasMany
|
|
1665
1628
|
// title, attribute
|
|
1666
1629
|
```
|
|
1667
|
-
|
|
1668
|
-
@public
|
|
1669
|
-
@readonly
|
|
1630
|
+
@public
|
|
1670
1631
|
*/
|
|
1671
1632
|
static {
|
|
1672
1633
|
decorateMethodV2(this, "relationshipsObject", [computeOnce]);
|
|
@@ -1693,8 +1654,8 @@ class Model extends EmberObject {
|
|
|
1693
1654
|
invoking the callback with the name of each relationship and its relationship
|
|
1694
1655
|
descriptor.
|
|
1695
1656
|
@public
|
|
1696
|
-
@param
|
|
1697
|
-
@param
|
|
1657
|
+
@param callback the callback to invoke
|
|
1658
|
+
@param binding the value to which the callback's `this` should be bound
|
|
1698
1659
|
*/
|
|
1699
1660
|
static {
|
|
1700
1661
|
decorateMethodV2(this, "fields", [computeOnce]);
|
|
@@ -1716,8 +1677,8 @@ class Model extends EmberObject {
|
|
|
1716
1677
|
returned just once, regardless of how many different relationships it has
|
|
1717
1678
|
with a model.
|
|
1718
1679
|
@public
|
|
1719
|
-
@param
|
|
1720
|
-
@param
|
|
1680
|
+
@param callback the callback to invoke
|
|
1681
|
+
@param binding the value to which the callback's `this` should be bound
|
|
1721
1682
|
*/
|
|
1722
1683
|
static eachRelatedType(callback, binding) {
|
|
1723
1684
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -1785,9 +1746,7 @@ class Model extends EmberObject {
|
|
|
1785
1746
|
// lastName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "lastName"}
|
|
1786
1747
|
// birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
|
|
1787
1748
|
```
|
|
1788
|
-
|
|
1789
|
-
@public
|
|
1790
|
-
@readonly
|
|
1749
|
+
@public
|
|
1791
1750
|
*/
|
|
1792
1751
|
static get attributes() {
|
|
1793
1752
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -1837,9 +1796,7 @@ class Model extends EmberObject {
|
|
|
1837
1796
|
// lastName string
|
|
1838
1797
|
// birthday date
|
|
1839
1798
|
```
|
|
1840
|
-
|
|
1841
|
-
@public
|
|
1842
|
-
@readonly
|
|
1799
|
+
@public
|
|
1843
1800
|
*/
|
|
1844
1801
|
static {
|
|
1845
1802
|
decorateMethodV2(this, "attributes", [computeOnce]);
|
|
@@ -1888,8 +1845,8 @@ class Model extends EmberObject {
|
|
|
1888
1845
|
// birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
|
|
1889
1846
|
```
|
|
1890
1847
|
@public
|
|
1891
|
-
@param
|
|
1892
|
-
@param
|
|
1848
|
+
@param callback The callback to execute
|
|
1849
|
+
@param binding [optional] the value to which the callback's `this` should be bound
|
|
1893
1850
|
*/
|
|
1894
1851
|
static {
|
|
1895
1852
|
decorateMethodV2(this, "transformedAttributes", [computeOnce]);
|
|
@@ -1935,8 +1892,8 @@ class Model extends EmberObject {
|
|
|
1935
1892
|
// birthday date
|
|
1936
1893
|
```
|
|
1937
1894
|
@public
|
|
1938
|
-
@param
|
|
1939
|
-
@param
|
|
1895
|
+
@param callback The callback to execute
|
|
1896
|
+
@param binding [optional] the value to which the callback's `this` should be bound
|
|
1940
1897
|
*/
|
|
1941
1898
|
static eachTransformedAttribute(callback, binding) {
|
|
1942
1899
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -2112,7 +2069,7 @@ class ModelSchemaProvider {
|
|
|
2112
2069
|
hasTrait(type) {
|
|
2113
2070
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2114
2071
|
{
|
|
2115
|
-
throw new Error(`hasTrait is not available with @
|
|
2072
|
+
throw new Error(`hasTrait is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2116
2073
|
}
|
|
2117
2074
|
})() : {};
|
|
2118
2075
|
return false;
|
|
@@ -2120,7 +2077,7 @@ class ModelSchemaProvider {
|
|
|
2120
2077
|
resourceHasTrait(resource, trait) {
|
|
2121
2078
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2122
2079
|
{
|
|
2123
|
-
throw new Error(`resourceHasTrait is not available with @
|
|
2080
|
+
throw new Error(`resourceHasTrait is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2124
2081
|
}
|
|
2125
2082
|
})() : {};
|
|
2126
2083
|
return false;
|
|
@@ -2128,21 +2085,21 @@ class ModelSchemaProvider {
|
|
|
2128
2085
|
transformation(field) {
|
|
2129
2086
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2130
2087
|
{
|
|
2131
|
-
throw new Error(`transformation is not available with @
|
|
2088
|
+
throw new Error(`transformation is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2132
2089
|
}
|
|
2133
2090
|
})() : {};
|
|
2134
2091
|
}
|
|
2135
2092
|
derivation(field) {
|
|
2136
2093
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2137
2094
|
{
|
|
2138
|
-
throw new Error(`derivation is not available with @
|
|
2095
|
+
throw new Error(`derivation is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2139
2096
|
}
|
|
2140
2097
|
})() : {};
|
|
2141
2098
|
}
|
|
2142
2099
|
hashFn(field) {
|
|
2143
2100
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2144
2101
|
{
|
|
2145
|
-
throw new Error(`hashFn is not available with @
|
|
2102
|
+
throw new Error(`hashFn is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2146
2103
|
}
|
|
2147
2104
|
})() : {};
|
|
2148
2105
|
}
|
|
@@ -2156,35 +2113,35 @@ class ModelSchemaProvider {
|
|
|
2156
2113
|
registerResources(schemas) {
|
|
2157
2114
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2158
2115
|
{
|
|
2159
|
-
throw new Error(`registerResources is not available with @
|
|
2116
|
+
throw new Error(`registerResources is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2160
2117
|
}
|
|
2161
2118
|
})() : {};
|
|
2162
2119
|
}
|
|
2163
2120
|
registerResource(schema) {
|
|
2164
2121
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2165
2122
|
{
|
|
2166
|
-
throw new Error(`registerResource is not available with @
|
|
2123
|
+
throw new Error(`registerResource is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2167
2124
|
}
|
|
2168
2125
|
})() : {};
|
|
2169
2126
|
}
|
|
2170
2127
|
registerTransformation(transform) {
|
|
2171
2128
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2172
2129
|
{
|
|
2173
|
-
throw new Error(`registerTransformation is not available with @
|
|
2130
|
+
throw new Error(`registerTransformation is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2174
2131
|
}
|
|
2175
2132
|
})() : {};
|
|
2176
2133
|
}
|
|
2177
2134
|
registerDerivation(derivation) {
|
|
2178
2135
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2179
2136
|
{
|
|
2180
|
-
throw new Error(`registerDerivation is not available with @
|
|
2137
|
+
throw new Error(`registerDerivation is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2181
2138
|
}
|
|
2182
2139
|
})() : {};
|
|
2183
2140
|
}
|
|
2184
2141
|
registerHashFn(hashFn) {
|
|
2185
2142
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2186
2143
|
{
|
|
2187
|
-
throw new Error(`registerHashFn is not available with @
|
|
2144
|
+
throw new Error(`registerHashFn is not available with @warp-drive/legacy/model's SchemaService`);
|
|
2188
2145
|
}
|
|
2189
2146
|
})() : {};
|
|
2190
2147
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
3
|
import '@warp-drive/core/reactive/-private';
|
|
4
|
-
import "./-private-
|
|
4
|
+
import "./-private-BG3bMiKp.js";
|
|
5
5
|
import '@warp-drive/core/store/-private';
|
|
6
6
|
const newline = /\r?\n/;
|
|
7
7
|
function parseResponseHeaders(headersString) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { dasherize, pluralize, singularize } from '@warp-drive/utilities/string';
|
|
3
|
-
import { J as JSONSerializer } from "../json-
|
|
3
|
+
import { J as JSONSerializer } from "../json-ChdEfB0X.js";
|
|
4
4
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
5
5
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
@@ -10,8 +10,6 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
11
11
|
const JSONAPISerializer = JSONSerializer.extend({
|
|
12
12
|
/**
|
|
13
|
-
@param {Object} documentHash
|
|
14
|
-
@return {Object}
|
|
15
13
|
@private
|
|
16
14
|
*/
|
|
17
15
|
_normalizeDocumentHelper(documentHash) {
|
|
@@ -41,8 +39,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
41
39
|
return documentHash;
|
|
42
40
|
},
|
|
43
41
|
/**
|
|
44
|
-
@param {Object} relationshipDataHash
|
|
45
|
-
@return {Object}
|
|
46
42
|
@private
|
|
47
43
|
*/
|
|
48
44
|
_normalizeRelationshipDataHelper(relationshipDataHash) {
|
|
@@ -50,8 +46,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
50
46
|
return relationshipDataHash;
|
|
51
47
|
},
|
|
52
48
|
/**
|
|
53
|
-
@param {Object} resourceHash
|
|
54
|
-
@return {Object}
|
|
55
49
|
@private
|
|
56
50
|
*/
|
|
57
51
|
_normalizeResourceHelper(resourceHash) {
|
|
@@ -88,21 +82,13 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
88
82
|
/**
|
|
89
83
|
Normalize some data and push it into the store.
|
|
90
84
|
@public
|
|
91
|
-
@param {Store} store
|
|
92
|
-
@param {Object} payload
|
|
93
85
|
*/
|
|
94
86
|
pushPayload(store, payload) {
|
|
95
87
|
const normalizedPayload = this._normalizeDocumentHelper(payload);
|
|
96
88
|
store.push(normalizedPayload);
|
|
97
89
|
},
|
|
98
90
|
/**
|
|
99
|
-
@
|
|
100
|
-
@param {Model} primaryModelClass
|
|
101
|
-
@param {Object} payload
|
|
102
|
-
@param {String|Number} id
|
|
103
|
-
@param {String} requestType
|
|
104
|
-
@param {Boolean} isSingle
|
|
105
|
-
@return {Object} JSON-API Document
|
|
91
|
+
@return A {json:api} Document
|
|
106
92
|
@private
|
|
107
93
|
*/
|
|
108
94
|
_normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {
|
|
@@ -144,8 +130,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
144
130
|
Returns a relationship formatted as a JSON-API "relationship object".
|
|
145
131
|
http://jsonapi.org/format/#document-resource-object-relationships
|
|
146
132
|
@public
|
|
147
|
-
@param {Object} relationshipHash
|
|
148
|
-
@return {Object}
|
|
149
133
|
*/
|
|
150
134
|
extractRelationship(relationshipHash) {
|
|
151
135
|
if (Array.isArray(relationshipHash.data)) {
|
|
@@ -164,9 +148,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
164
148
|
Returns the resource's relationships formatted as a JSON-API "relationships object".
|
|
165
149
|
http://jsonapi.org/format/#document-resource-object-relationships
|
|
166
150
|
@public
|
|
167
|
-
@param {Object} modelClass
|
|
168
|
-
@param {Object} resourceHash
|
|
169
|
-
@return {Object}
|
|
170
151
|
*/
|
|
171
152
|
extractRelationships(modelClass, resourceHash) {
|
|
172
153
|
const relationships = {};
|
|
@@ -191,9 +172,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
191
172
|
return relationships;
|
|
192
173
|
},
|
|
193
174
|
/**
|
|
194
|
-
@param {Model} modelClass
|
|
195
|
-
@param {Object} resourceHash
|
|
196
|
-
@return {String}
|
|
197
175
|
@private
|
|
198
176
|
*/
|
|
199
177
|
_extractType(modelClass, resourceHash) {
|
|
@@ -201,12 +179,11 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
201
179
|
},
|
|
202
180
|
/**
|
|
203
181
|
Dasherizes and singularizes the model name in the payload to match
|
|
204
|
-
the
|
|
182
|
+
the common convention for model names.
|
|
205
183
|
For example the key `posts` would be converted to `post` and the
|
|
206
184
|
key `studentAssesments` would be converted to `student-assesment`.
|
|
207
185
|
@public
|
|
208
|
-
@
|
|
209
|
-
@return {String} the model's modelName
|
|
186
|
+
@return the model's modelName
|
|
210
187
|
*/
|
|
211
188
|
modelNameFromPayloadKey(key) {
|
|
212
189
|
return dasherize(singularize(key));
|
|
@@ -216,8 +193,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
216
193
|
For example `post` would be converted to `posts` and
|
|
217
194
|
`student-assesment` would be converted to `student-assesments`.
|
|
218
195
|
@public
|
|
219
|
-
@param {String} modelName
|
|
220
|
-
@return {String}
|
|
221
196
|
*/
|
|
222
197
|
payloadKeyFromModelName(modelName) {
|
|
223
198
|
return pluralize(modelName);
|
|
@@ -258,7 +233,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
258
233
|
This behaviour can be easily customized by extending this method.
|
|
259
234
|
Example
|
|
260
235
|
```js [app/serializers/application.js]
|
|
261
|
-
import JSONAPISerializer from '@
|
|
236
|
+
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
262
237
|
import { dasherize } from '<app-name>/utils/string-utils';
|
|
263
238
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
264
239
|
keyForAttribute(attr, method) {
|
|
@@ -267,9 +242,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
267
242
|
}
|
|
268
243
|
```
|
|
269
244
|
@public
|
|
270
|
-
@
|
|
271
|
-
@param {String} method
|
|
272
|
-
@return {String} normalized key
|
|
245
|
+
@return normalized key
|
|
273
246
|
*/
|
|
274
247
|
keyForAttribute(key, method) {
|
|
275
248
|
return dasherize(key);
|
|
@@ -283,7 +256,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
283
256
|
This behaviour can be easily customized by extending this method.
|
|
284
257
|
Example
|
|
285
258
|
```js [app/serializers/post.js]
|
|
286
|
-
import JSONAPISerializer from '@
|
|
259
|
+
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
287
260
|
import { underscore } from '<app-name>/utils/string-utils';
|
|
288
261
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
289
262
|
keyForRelationship(key, relationship, method) {
|
|
@@ -292,10 +265,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
292
265
|
}
|
|
293
266
|
```
|
|
294
267
|
@public
|
|
295
|
-
@
|
|
296
|
-
@param {String} typeClass
|
|
297
|
-
@param {String} method
|
|
298
|
-
@return {String} normalized key
|
|
268
|
+
@return the normalized key
|
|
299
269
|
*/
|
|
300
270
|
keyForRelationship(key, typeClass, method) {
|
|
301
271
|
return dasherize(key);
|
|
@@ -305,7 +275,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
305
275
|
record into JSON.
|
|
306
276
|
For example, consider this model:
|
|
307
277
|
```js [app/models/comment.js]
|
|
308
|
-
import Model, { attr, belongsTo } from '@
|
|
278
|
+
import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
|
|
309
279
|
export default class CommentModel extends Model {
|
|
310
280
|
@attr title;
|
|
311
281
|
@attr body;
|
|
@@ -356,7 +326,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
356
326
|
consider authoring your own adapter and serializer instead of extending
|
|
357
327
|
this class.
|
|
358
328
|
```js [app/serializers/post.js]
|
|
359
|
-
import JSONAPISerializer from '@
|
|
329
|
+
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
360
330
|
export default class PostSerializer extends JSONAPISerializer {
|
|
361
331
|
serialize(snapshot, options) {
|
|
362
332
|
let json = {
|
|
@@ -376,7 +346,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
376
346
|
application, you'll probably want to use `eachAttribute`
|
|
377
347
|
and `eachRelationship` on the record.
|
|
378
348
|
```js [app/serializers/application.js]
|
|
379
|
-
import JSONAPISerializer from '@
|
|
349
|
+
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
380
350
|
import { underscore, singularize } from '<app-name>/utils/string-utils';
|
|
381
351
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
382
352
|
serialize(snapshot, options) {
|
|
@@ -415,7 +385,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
415
385
|
you can call `super.serialize` first and make the tweaks
|
|
416
386
|
on the returned object.
|
|
417
387
|
```js [app/serializers/post.js]
|
|
418
|
-
import JSONAPISerializer from '@
|
|
388
|
+
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
419
389
|
export default class PostSerializer extends JSONAPISerializer {
|
|
420
390
|
serialize(snapshot, options) {
|
|
421
391
|
let json = super.serialize(...arguments);
|
|
@@ -426,9 +396,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
426
396
|
}
|
|
427
397
|
```
|
|
428
398
|
@public
|
|
429
|
-
@param {Snapshot} snapshot
|
|
430
|
-
@param {Object} options
|
|
431
|
-
@return {Object} json
|
|
432
399
|
*/
|
|
433
400
|
serialize(snapshot, options) {
|
|
434
401
|
// @ts-expect-error untyped
|
|
@@ -467,6 +434,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
467
434
|
// @ts-expect-error untyped
|
|
468
435
|
if (this._canSerialize(name)) {
|
|
469
436
|
const belongsTo = snapshot.belongsTo(name);
|
|
437
|
+
// @ts-expect-error not narrowed
|
|
470
438
|
const belongsToIsNotNew = belongsTo && !belongsTo.isNew;
|
|
471
439
|
if (belongsTo === null || belongsToIsNotNew) {
|
|
472
440
|
json.relationships = json.relationships || {};
|
|
@@ -480,11 +448,13 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
480
448
|
}
|
|
481
449
|
let data = null;
|
|
482
450
|
if (belongsTo) {
|
|
451
|
+
// @ts-expect-error not narrowed
|
|
483
452
|
const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);
|
|
484
453
|
|
|
485
454
|
// @ts-expect-error untyped
|
|
486
455
|
data = {
|
|
487
456
|
type: payloadType,
|
|
457
|
+
// @ts-expect-error not narrowed
|
|
488
458
|
id: belongsTo.id
|
|
489
459
|
};
|
|
490
460
|
}
|
|
@@ -512,13 +482,16 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
512
482
|
}
|
|
513
483
|
|
|
514
484
|
// only serialize has many relationships that are not new
|
|
485
|
+
// @ts-expect-error not narrowed
|
|
515
486
|
const nonNewHasMany = hasMany.filter(item => !item.isNew);
|
|
516
487
|
const data = new Array(nonNewHasMany.length);
|
|
517
488
|
for (let i = 0; i < nonNewHasMany.length; i++) {
|
|
518
489
|
const item = hasMany[i];
|
|
490
|
+
// @ts-expect-error not narrowed
|
|
519
491
|
const payloadType = this.payloadKeyFromModelName(item.modelName);
|
|
520
492
|
data[i] = {
|
|
521
493
|
type: payloadType,
|
|
494
|
+
// @ts-expect-error not narrowed
|
|
522
495
|
id: item.id
|
|
523
496
|
};
|
|
524
497
|
}
|
package/dist/serializer/json.js
CHANGED
|
@@ -2,5 +2,5 @@ import '@ember/application';
|
|
|
2
2
|
import '@ember/debug';
|
|
3
3
|
import '@warp-drive/utilities/string';
|
|
4
4
|
import '../serializer.js';
|
|
5
|
-
export { J as JSONSerializer } from "../json-
|
|
5
|
+
export { J as JSONSerializer } from "../json-ChdEfB0X.js";
|
|
6
6
|
import '@embroider/macros';
|