@warp-drive/legacy 5.9.0-alpha.2 → 5.9.0-alpha.21
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 +6 -0
- package/declarations/adapter/-private/build-url-mixin.d.ts +156 -0
- package/declarations/adapter/error.d.ts +385 -169
- package/declarations/adapter/json-api.d.ts +12 -1
- package/declarations/adapter/rest.d.ts +74 -0
- package/declarations/adapter.d.ts +6 -0
- package/declarations/compat/builders/find-all.d.ts +0 -1
- package/declarations/compat/extensions.d.ts +40 -0
- package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +7 -0
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +4 -0
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +7 -0
- package/declarations/compat/utils.d.ts +11 -0
- package/declarations/compat.d.ts +32 -0
- package/declarations/index.d.ts +142 -0
- package/declarations/model/-private/attr.d.ts +21 -0
- package/declarations/model/-private/belongs-to.d.ts +21 -0
- package/declarations/model/-private/hooks.d.ts +26 -0
- package/declarations/model/-private/model.d.ts +55 -4
- package/declarations/model/-private/promise-many-array.d.ts +25 -1
- package/declarations/model/-private/schema-provider.d.ts +11 -1
- package/declarations/model/migration-support.d.ts +31 -5
- package/declarations/model-fragments/extensions/fragment-array.d.ts +38 -0
- package/declarations/model-fragments/extensions/fragment.d.ts +35 -0
- package/declarations/model-fragments/hooks/model-for.d.ts +7 -0
- package/declarations/model-fragments/index.d.ts +8 -0
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +6 -0
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +30 -0
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +18 -0
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +15 -0
- package/declarations/model-fragments/utilities/with-legacy.d.ts +8 -0
- package/declarations/serializer/-private/transforms/boolean.d.ts +13 -0
- package/declarations/serializer/-private/transforms/date.d.ts +15 -1
- package/declarations/serializer/-private/transforms/number.d.ts +14 -1
- package/declarations/serializer/-private/transforms/string.d.ts +14 -1
- package/declarations/serializer/-private/utils.d.ts +24 -0
- package/declarations/serializer/json-api.d.ts +1 -1
- package/declarations/serializer.d.ts +4 -6
- package/declarations/store/-private.d.ts +2 -2
- package/declarations/store.d.ts +7 -0
- package/dist/adapter/error.js +386 -241
- package/dist/adapter/json-api.js +12 -0
- package/dist/adapter/rest.js +39 -3
- package/dist/adapter.js +23 -26
- package/dist/compat/builders.js +0 -1
- package/dist/compat/extensions.js +80 -3
- package/dist/compat/utils.js +14 -0
- package/dist/compat.js +17 -0
- package/dist/{errors-Cz5KrzBk.js → errors-DZKA206g.js} +24 -1
- package/dist/{hooks-D6diaM34.js → hooks-BvOqJBei.js} +33 -2
- package/dist/index.js +168 -13
- package/dist/{json-ChdEfB0X.js → json-DU8m1pGf.js} +83 -6
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +15 -2
- package/dist/{unpkg/dev-deprecated/model-for-CqXsIKws.js → model-for-CXkJw59V.js} +77 -1
- package/dist/model-fragments.js +18 -2
- package/dist/model.js +12 -8
- package/dist/{schema-provider-DJCV_6AF.js → schema-provider-DtPOp0d7.js} +93 -6
- package/dist/serializer/json-api.js +8 -3
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +3 -4
- package/dist/serializer/transform.js +51 -3
- package/dist/serializer.js +4 -7
- package/dist/store.js +13 -7
- package/dist/unpkg/dev/adapter/error.js +386 -241
- package/dist/unpkg/dev/adapter/json-api.js +13 -1
- package/dist/unpkg/dev/adapter/rest.js +39 -3
- package/dist/unpkg/dev/adapter.js +23 -26
- package/dist/unpkg/dev/compat/builders.js +0 -1
- package/dist/unpkg/dev/compat/extensions.js +80 -3
- package/dist/unpkg/dev/compat/utils.js +14 -0
- package/dist/unpkg/dev/compat.js +34 -1
- package/dist/unpkg/dev/{errors-DmGGJr3T.js → errors-DngRU-If.js} +24 -1
- package/dist/unpkg/dev/{hooks-CkYiE6Ud.js → hooks-UuiLxWxS.js} +33 -2
- package/dist/unpkg/dev/index.js +171 -13
- package/dist/unpkg/dev/json-K2Y9z6MN.js +1333 -0
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +16 -2
- package/dist/unpkg/{prod-deprecated/model-for-CqXsIKws.js → dev/model-for-CXkJw59V.js} +77 -1
- package/dist/unpkg/dev/model-fragments.js +18 -2
- package/dist/unpkg/dev/model.js +12 -8
- package/dist/unpkg/dev/{schema-provider-DDVYxmUV.js → schema-provider-0D7f-QOn.js} +92 -6
- package/dist/unpkg/dev/serializer/json-api.js +9 -4
- package/dist/unpkg/dev/serializer/json.js +1 -1
- package/dist/unpkg/dev/serializer/rest.js +3 -4
- package/dist/unpkg/dev/serializer/transform.js +51 -3
- package/dist/unpkg/dev/serializer.js +4 -7
- package/dist/unpkg/dev/store.js +21 -7
- package/dist/unpkg/dev-deprecated/adapter/error.js +386 -241
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +13 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js +39 -3
- package/dist/unpkg/dev-deprecated/adapter.js +23 -26
- package/dist/unpkg/dev-deprecated/compat/builders.js +0 -1
- package/dist/unpkg/dev-deprecated/compat/extensions.js +80 -3
- package/dist/unpkg/dev-deprecated/compat/utils.js +14 -0
- package/dist/unpkg/dev-deprecated/compat.js +34 -1
- package/dist/unpkg/dev-deprecated/{errors-Spt6ubMd.js → errors-Bzidntpi.js} +24 -1
- package/dist/unpkg/dev-deprecated/{hooks-DOXegvhL.js → hooks-DVXhMW14.js} +33 -2
- package/dist/unpkg/dev-deprecated/index.js +171 -13
- package/dist/unpkg/{prod-deprecated/json-BWrZ5546.js → dev-deprecated/json-K2Y9z6MN.js} +96 -6
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +16 -2
- package/dist/unpkg/{dev/model-for-CqXsIKws.js → dev-deprecated/model-for-CXkJw59V.js} +77 -1
- package/dist/unpkg/dev-deprecated/model-fragments.js +18 -2
- package/dist/unpkg/dev-deprecated/model.js +12 -8
- package/dist/unpkg/dev-deprecated/{schema-provider-BP6_8N-V.js → schema-provider-ZwO5_fZw.js} +84 -3
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +9 -4
- package/dist/unpkg/dev-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/dev-deprecated/serializer/rest.js +3 -4
- package/dist/unpkg/dev-deprecated/serializer/transform.js +51 -3
- package/dist/unpkg/dev-deprecated/serializer.js +4 -7
- package/dist/unpkg/dev-deprecated/store.js +21 -7
- package/dist/unpkg/prod/adapter/error.js +386 -241
- package/dist/unpkg/prod/adapter/json-api.js +13 -1
- package/dist/unpkg/prod/adapter/rest.js +39 -3
- package/dist/unpkg/prod/adapter.js +23 -26
- package/dist/unpkg/prod/compat/builders.js +0 -1
- package/dist/unpkg/prod/compat/extensions.js +70 -3
- package/dist/unpkg/prod/compat/utils.js +14 -0
- package/dist/unpkg/prod/compat.js +17 -0
- package/dist/unpkg/prod/{errors-BGVFCBmi.js → errors-B-PWeYlW.js} +24 -1
- package/dist/unpkg/prod/{hooks-BztVA_x0.js → hooks-Bx-zBziU.js} +32 -1
- package/dist/unpkg/prod/index.js +171 -5
- package/dist/unpkg/{dev/json-Cu1LNgmQ.js → prod/json-Qewu-UN9.js} +63 -19
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +16 -2
- package/dist/unpkg/prod/model-for-CXkJw59V.js +297 -0
- package/dist/unpkg/prod/model-fragments.js +18 -2
- package/dist/unpkg/prod/model.js +12 -8
- package/dist/unpkg/prod/{schema-provider-DJtD_8jZ.js → schema-provider-BgRqk8i9.js} +96 -6
- package/dist/unpkg/prod/serializer/json-api.js +9 -4
- package/dist/unpkg/prod/serializer/json.js +1 -1
- package/dist/unpkg/prod/serializer/rest.js +3 -4
- package/dist/unpkg/prod/serializer/transform.js +51 -3
- package/dist/unpkg/prod/serializer.js +4 -7
- package/dist/unpkg/prod/store.js +21 -7
- package/dist/unpkg/prod-deprecated/adapter/error.js +386 -241
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +13 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js +39 -3
- package/dist/unpkg/prod-deprecated/adapter.js +23 -26
- package/dist/unpkg/prod-deprecated/compat/builders.js +0 -1
- package/dist/unpkg/prod-deprecated/compat/extensions.js +70 -3
- package/dist/unpkg/prod-deprecated/compat/utils.js +14 -0
- package/dist/unpkg/prod-deprecated/compat.js +17 -0
- package/dist/unpkg/prod-deprecated/{errors-CdDaK81x.js → errors-Dl2J9d1D.js} +24 -1
- package/dist/unpkg/prod-deprecated/{hooks-yId87yyG.js → hooks-Cm60wWTf.js} +32 -1
- package/dist/unpkg/prod-deprecated/index.js +171 -5
- package/dist/unpkg/{dev-deprecated/json-Cu1LNgmQ.js → prod-deprecated/json-Qewu-UN9.js} +63 -19
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +16 -2
- package/dist/{model-for-CqXsIKws.js → unpkg/prod-deprecated/model-for-CXkJw59V.js} +77 -1
- package/dist/unpkg/prod-deprecated/model-fragments.js +18 -2
- package/dist/unpkg/prod-deprecated/model.js +12 -8
- package/dist/unpkg/prod-deprecated/{schema-provider-CjX55uSY.js → schema-provider-Dh6tRqVI.js} +79 -3
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +9 -4
- package/dist/unpkg/prod-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/prod-deprecated/serializer/rest.js +3 -4
- package/dist/unpkg/prod-deprecated/serializer/transform.js +51 -3
- package/dist/unpkg/prod-deprecated/serializer.js +4 -7
- package/dist/unpkg/prod-deprecated/store.js +21 -7
- package/package.json +8 -8
- package/dist/unpkg/prod/json-BWrZ5546.js +0 -1243
- package/dist/unpkg/prod/model-for-CqXsIKws.js +0 -221
|
@@ -278,9 +278,9 @@ interface Model {
|
|
|
278
278
|
for a given relationship will always return the same HasManyReference.
|
|
279
279
|
|
|
280
280
|
@public
|
|
281
|
-
@param
|
|
281
|
+
@param prop - the name of the relationship
|
|
282
282
|
@since 2.5.0
|
|
283
|
-
@return
|
|
283
|
+
@return reference for this relationship
|
|
284
284
|
*/
|
|
285
285
|
belongsTo<
|
|
286
286
|
T extends Model,
|
|
@@ -331,9 +331,9 @@ interface Model {
|
|
|
331
331
|
for a given relationship will always return the same HasManyReference.
|
|
332
332
|
|
|
333
333
|
@public
|
|
334
|
-
@param
|
|
334
|
+
@param prop - the name of the relationship
|
|
335
335
|
@since 2.5.0
|
|
336
|
-
@return
|
|
336
|
+
@return reference for this relationship
|
|
337
337
|
*/
|
|
338
338
|
hasMany<
|
|
339
339
|
T extends MinimalLegacyRecord,
|
|
@@ -605,6 +605,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
605
605
|
@public
|
|
606
606
|
*/
|
|
607
607
|
get isError(): boolean;
|
|
608
|
+
/**
|
|
609
|
+
* `isError` is read-only and cannot be set directly.
|
|
610
|
+
*/
|
|
608
611
|
set isError(v: boolean);
|
|
609
612
|
/**
|
|
610
613
|
If `true` the store is attempting to reload the record from the adapter.
|
|
@@ -638,12 +641,19 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
638
641
|
@public
|
|
639
642
|
*/
|
|
640
643
|
get id(): string | null;
|
|
644
|
+
/**
|
|
645
|
+
* Assigns the resource's primary key. Typically only used internally
|
|
646
|
+
* when a client-created record is assigned an id upon being saved.
|
|
647
|
+
*/
|
|
641
648
|
set id(id: string | null);
|
|
642
649
|
toString(): string;
|
|
643
650
|
/**
|
|
644
651
|
@private
|
|
645
652
|
*/
|
|
646
653
|
get currentState(): RecordState;
|
|
654
|
+
/**
|
|
655
|
+
* `currentState` is read-only and cannot be set directly.
|
|
656
|
+
*/
|
|
647
657
|
set currentState(_v: RecordState);
|
|
648
658
|
/**
|
|
649
659
|
The store service instance which created this record instance
|
|
@@ -709,6 +719,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
709
719
|
@public
|
|
710
720
|
*/
|
|
711
721
|
get adapterError(): unknown;
|
|
722
|
+
/**
|
|
723
|
+
* `adapterError` is read-only and cannot be set directly.
|
|
724
|
+
*/
|
|
712
725
|
set adapterError(v: unknown);
|
|
713
726
|
notifyPropertyChange(prop: string): this;
|
|
714
727
|
/**
|
|
@@ -764,8 +777,22 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
764
777
|
@param binding the value to which the callback's `this` should be bound
|
|
765
778
|
*/
|
|
766
779
|
eachRelationship<T>(callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void, binding?: T): void;
|
|
780
|
+
/**
|
|
781
|
+
* Returns the relationship schema for the given relationship name, if any.
|
|
782
|
+
*/
|
|
767
783
|
relationshipFor(name: string): LegacyRelationshipField | undefined;
|
|
784
|
+
/**
|
|
785
|
+
* Returns the inverse relationship schema for the given relationship
|
|
786
|
+
* name, if one exists. See {@link Model.inverseFor | the static inverseFor}.
|
|
787
|
+
*/
|
|
768
788
|
inverseFor(name: string): LegacyRelationshipField | null;
|
|
789
|
+
/**
|
|
790
|
+
* Iterates over the attributes defined on this record's class, calling
|
|
791
|
+
* `callback` for each one. See {@link Model.eachAttribute | the static eachAttribute}.
|
|
792
|
+
*
|
|
793
|
+
* @param callback the callback to invoke
|
|
794
|
+
* @param binding the value to which the callback's `this` should be bound
|
|
795
|
+
*/
|
|
769
796
|
eachAttribute<T>(callback: (this: NoInfer<T> | undefined, key: isSubClass<this> extends true ? MaybeAttrFields<this> : string, meta: LegacyAttributeField) => void, binding?: T): void;
|
|
770
797
|
/**
|
|
771
798
|
Represents the model's class name as a string. This can be used to look up the model's class name through
|
|
@@ -817,6 +844,10 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
817
844
|
@return the type of the relationship, or undefined
|
|
818
845
|
*/
|
|
819
846
|
static typeForRelationship(name: string, store: Store): ModelSchema | undefined;
|
|
847
|
+
/**
|
|
848
|
+
* A cache of resolved inverse relationships by name, populated lazily by
|
|
849
|
+
* {@link Model.inverseFor | inverseFor}.
|
|
850
|
+
*/
|
|
820
851
|
static get inverseMap(): Record<string, LegacyRelationshipField | null>;
|
|
821
852
|
/**
|
|
822
853
|
Find the relationship which is the inverse of the one asked for.
|
|
@@ -850,6 +881,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
850
881
|
@return the inverse relationship, or null
|
|
851
882
|
*/
|
|
852
883
|
static inverseFor(name: string, store: Store): LegacyRelationshipField | null;
|
|
884
|
+
/**
|
|
885
|
+
* @private
|
|
886
|
+
*/
|
|
853
887
|
static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null;
|
|
854
888
|
/**
|
|
855
889
|
The model's relationships as a map, keyed on the type of the
|
|
@@ -919,7 +953,13 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
919
953
|
@public
|
|
920
954
|
*/
|
|
921
955
|
static get relationshipNames(): {
|
|
956
|
+
/**
|
|
957
|
+
* the names of the model's `hasMany` relationships
|
|
958
|
+
*/
|
|
922
959
|
hasMany: string[];
|
|
960
|
+
/**
|
|
961
|
+
* the names of the model's `belongsTo` relationships
|
|
962
|
+
*/
|
|
923
963
|
belongsTo: string[];
|
|
924
964
|
};
|
|
925
965
|
/**
|
|
@@ -985,6 +1025,11 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
985
1025
|
@public
|
|
986
1026
|
*/
|
|
987
1027
|
static get relationshipsByName(): Map<string, LegacyRelationshipField>;
|
|
1028
|
+
/**
|
|
1029
|
+
* A hash of the model's relationship schemas keyed by relationship name.
|
|
1030
|
+
* See also {@link Model.relationshipsByName | relationshipsByName}, which
|
|
1031
|
+
* provides the same information as a `Map`.
|
|
1032
|
+
*/
|
|
988
1033
|
static get relationshipsObject(): Record<string, LegacyRelationshipField>;
|
|
989
1034
|
/**
|
|
990
1035
|
A map whose keys are the fields of the model and whose values are strings
|
|
@@ -1224,5 +1269,11 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
1224
1269
|
*/
|
|
1225
1270
|
static toString(): string;
|
|
1226
1271
|
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Restores the pre-`RequestManager` implementations of `save`,
|
|
1274
|
+
* `destroyRecord`, and `reload` onto the given `Model` subclass, for
|
|
1275
|
+
* apps that have not yet migrated off of the deprecated
|
|
1276
|
+
* `ENABLE_LEGACY_REQUEST_METHODS` behaviors.
|
|
1277
|
+
*/
|
|
1227
1278
|
export declare function restoreDeprecatedModelRequestBehaviors(ModelKlass: typeof Model): void;
|
|
1228
1279
|
export { Model };
|
|
@@ -7,11 +7,15 @@ export interface HasManyProxyCreateArgs<T = unknown> {
|
|
|
7
7
|
content?: ManyArray<T>;
|
|
8
8
|
}
|
|
9
9
|
export interface PromiseManyArray<T> {
|
|
10
|
+
/**
|
|
11
|
+
* A property signifying that this object implements the classic Ember
|
|
12
|
+
* `PromiseProxyMixin`-like API. See {@link LegacyPromiseProxy}.
|
|
13
|
+
*/
|
|
10
14
|
[LegacyPromiseProxy]: true;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
This class is returned as the result of accessing an async hasMany relationship
|
|
14
|
-
on an instance of a Model extending from `@
|
|
18
|
+
on an instance of a Model extending from `@warp-drive/legacy/model`.
|
|
15
19
|
|
|
16
20
|
A PromiseManyArray is an iterable proxy that allows templates to consume related
|
|
17
21
|
ManyArrays and update once their contents are no longer pending.
|
|
@@ -25,8 +29,19 @@ const comments = await post.comments;
|
|
|
25
29
|
@public
|
|
26
30
|
*/
|
|
27
31
|
export declare class PromiseManyArray<T = unknown> {
|
|
32
|
+
/**
|
|
33
|
+
* The promise for the relationship's content, or `null` once
|
|
34
|
+
* {@link PromiseManyArray.destroy | destroy} has been called.
|
|
35
|
+
*/
|
|
28
36
|
promise: Promise<ManyArray<T>> | null;
|
|
37
|
+
/**
|
|
38
|
+
* Whether {@link PromiseManyArray.destroy | destroy} has been called.
|
|
39
|
+
*/
|
|
29
40
|
isDestroyed: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The resolved `ManyArray` for the relationship, if the promise has
|
|
43
|
+
* resolved, else `null`.
|
|
44
|
+
*/
|
|
30
45
|
content: ManyArray<T> | null;
|
|
31
46
|
constructor(promise: Promise<ManyArray<T>>, content?: ManyArray<T>);
|
|
32
47
|
/**
|
|
@@ -34,6 +49,9 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
34
49
|
* @public
|
|
35
50
|
*/
|
|
36
51
|
get length(): number;
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
37
55
|
get "[]"(): 0 | ManyArray<T> | undefined;
|
|
38
56
|
/**
|
|
39
57
|
* Iterate the proxied content. Called by the glimmer iterator in #each
|
|
@@ -91,6 +109,12 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
91
109
|
* @public
|
|
92
110
|
*/
|
|
93
111
|
finally(cb: Parameters<Promise<ManyArray<T>>["finally"]>[0]): Promise<unknown>;
|
|
112
|
+
/**
|
|
113
|
+
* Tears down this proxy, releasing its {@link PromiseManyArray.content | content} and
|
|
114
|
+
* {@link PromiseManyArray.promise | promise} and marking it as {@link PromiseManyArray.isDestroyed | destroyed}.
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
94
118
|
destroy(): void;
|
|
95
119
|
/**
|
|
96
120
|
* Retrieve the links for this relationship
|
|
@@ -3,7 +3,7 @@ import type { SchemaService } from "@warp-drive/core/types";
|
|
|
3
3
|
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
4
|
import type { ObjectValue } from "@warp-drive/core/types/json/raw";
|
|
5
5
|
import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
|
|
6
|
-
import type { ArrayField, DerivedField, GenericField, HashField, LegacyField, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
6
|
+
import type { ArrayField, CacheableFieldSchema, DerivedField, GenericField, HashField, IdentityField, LegacyField, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
7
7
|
import type { ModelFactory, ModelStore } from "./model.js";
|
|
8
8
|
type AttributesSchema = ReturnType<Exclude<SchemaService["attributesDefinitionFor"], undefined>>;
|
|
9
9
|
type RelationshipsSchema = ReturnType<Exclude<SchemaService["relationshipsDefinitionFor"], undefined>>;
|
|
@@ -47,10 +47,20 @@ export declare class ModelSchemaProvider implements SchemaService {
|
|
|
47
47
|
fields(resource: ResourceKey | {
|
|
48
48
|
type: string;
|
|
49
49
|
}): Map<string, LegacyField>;
|
|
50
|
+
cacheFields(resource: ResourceKey | {
|
|
51
|
+
type: string;
|
|
52
|
+
}): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
50
53
|
hasResource(resource: {
|
|
51
54
|
type: string;
|
|
52
55
|
}): boolean;
|
|
53
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The `createSchemaService` implementation for use with `Model`. Pass
|
|
59
|
+
* the result of this to your store's `createSchemaService` method when
|
|
60
|
+
* configuring the store to use `Model` for schema information.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
54
64
|
export declare function buildSchema(store: Store): SchemaService;
|
|
55
65
|
export declare function getModelFactory(store: ModelStore, type: string): ModelFactory | null;
|
|
56
66
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "@warp-drive/core/reactive";
|
|
3
|
-
import type { ExtensibleField } from "@warp-drive/core/reactive/-private
|
|
3
|
+
import type { ExtensibleField } from "@warp-drive/core/reactive/-private";
|
|
4
4
|
import type { SchemaService } from "@warp-drive/core/types";
|
|
5
5
|
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
6
6
|
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
@@ -16,8 +16,19 @@ import RecordState from "./-private/record-state.js";
|
|
|
16
16
|
import type BelongsToReference from "./-private/references/belongs-to.js";
|
|
17
17
|
import type HasManyReference from "./-private/references/has-many.js";
|
|
18
18
|
import type { _MaybeBelongsToFields, MaybeHasManyFields } from "./-private/type-utils.js";
|
|
19
|
+
/**
|
|
20
|
+
* Adds the `Model`-style `belongsTo`/`hasMany` reference methods to a
|
|
21
|
+
* {@link TypedRecordInstance}, for use when migrating a resource from
|
|
22
|
+
* `Model` to a schema-based record while preserving these APIs.
|
|
23
|
+
*/
|
|
19
24
|
export type WithLegacyDerivations<T extends TypedRecordInstance> = T & MinimalLegacyRecord & {
|
|
25
|
+
/**
|
|
26
|
+
* see {@link belongsTo}
|
|
27
|
+
*/
|
|
20
28
|
belongsTo: typeof belongsTo;
|
|
29
|
+
/**
|
|
30
|
+
* see {@link hasMany}
|
|
31
|
+
*/
|
|
21
32
|
hasMany: typeof hasMany;
|
|
22
33
|
};
|
|
23
34
|
type AttributesSchema = ReturnType<Exclude<SchemaService["attributesDefinitionFor"], undefined>>;
|
|
@@ -214,16 +225,35 @@ export declare function registerDerivations(schema: SchemaService): void;
|
|
|
214
225
|
* @public
|
|
215
226
|
*/
|
|
216
227
|
export interface DelegatingSchemaService {
|
|
228
|
+
/**
|
|
229
|
+
* Delegates to whichever of the primary/fallback schema services has a
|
|
230
|
+
* schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.
|
|
231
|
+
*/
|
|
217
232
|
attributesDefinitionFor?(resource: ResourceKey | {
|
|
218
233
|
type: string;
|
|
219
234
|
}): AttributesSchema;
|
|
235
|
+
/**
|
|
236
|
+
* Delegates to whichever of the primary/fallback schema services has a
|
|
237
|
+
* schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.
|
|
238
|
+
*/
|
|
220
239
|
relationshipsDefinitionFor?(resource: ResourceKey | {
|
|
221
240
|
type: string;
|
|
222
241
|
}): RelationshipsSchema;
|
|
242
|
+
/**
|
|
243
|
+
* Whether either the primary or fallback schema service has a schema
|
|
244
|
+
* for the given type.
|
|
245
|
+
*/
|
|
223
246
|
doesTypeExist?(type: string): boolean;
|
|
224
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* See the {@link DelegatingSchemaService | class documentation above} for usage.
|
|
250
|
+
*/
|
|
225
251
|
export declare class DelegatingSchemaService implements SchemaService {
|
|
226
252
|
constructor(store: Store, schema: SchemaService);
|
|
253
|
+
/**
|
|
254
|
+
* Whether the given resource's schema is being served by the fallback
|
|
255
|
+
* (legacy Model-derived) schema service rather than the primary one.
|
|
256
|
+
*/
|
|
227
257
|
isDelegated(resource: ResourceKey | {
|
|
228
258
|
type: string;
|
|
229
259
|
}): boolean;
|
|
@@ -273,8 +303,4 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
273
303
|
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
274
304
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
275
305
|
}
|
|
276
|
-
export interface PrivateDelegatingSchemaService extends DelegatingSchemaService {
|
|
277
|
-
_preferred: SchemaService;
|
|
278
|
-
_secondary: SchemaService;
|
|
279
|
-
}
|
|
280
306
|
export {};
|
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import type { Fragment } from "./fragment.js";
|
|
2
|
+
/**
|
|
3
|
+
* The features added to an array resource by {@link FragmentArrayExtension}, providing
|
|
4
|
+
* a subset of the legacy `ModelFragments` fragment-array API for migrated resources.
|
|
5
|
+
*/
|
|
2
6
|
export declare class FragmentArray<T extends Fragment> {
|
|
7
|
+
/**
|
|
8
|
+
* Whether this fragment array is in the process of being destroyed.
|
|
9
|
+
*/
|
|
3
10
|
isDestroying: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this fragment array has been destroyed.
|
|
13
|
+
*/
|
|
4
14
|
isDestroyed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this fragment array (or any of its members) has uncommitted changes.
|
|
17
|
+
*/
|
|
5
18
|
get hasDirtyAttributes(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Adds an existing fragment to this array, if one was given.
|
|
21
|
+
*/
|
|
6
22
|
addFragment(fragment?: T): Fragment[] | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Appends a new fragment to the end of this array, if one was given.
|
|
25
|
+
*/
|
|
7
26
|
createFragment(fragment?: T): Fragment | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Removes the given fragment from this array, if present.
|
|
29
|
+
*/
|
|
8
30
|
removeFragment(fragment?: T): void;
|
|
31
|
+
/**
|
|
32
|
+
* Reverts each member fragment's attribute back to its last known remote value.
|
|
33
|
+
*/
|
|
9
34
|
rollbackAttributes(): void;
|
|
10
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A schema extension that adds the {@link FragmentArray} API to migrated
|
|
38
|
+
* `ModelFragments` array resources.
|
|
39
|
+
*/
|
|
11
40
|
export declare const FragmentArrayExtension: {
|
|
41
|
+
/**
|
|
42
|
+
* This extension applies to `'array'` schemas.
|
|
43
|
+
*/
|
|
12
44
|
kind: "array";
|
|
45
|
+
/**
|
|
46
|
+
* The registered name of this extension.
|
|
47
|
+
*/
|
|
13
48
|
name: "fragment-array";
|
|
49
|
+
/**
|
|
50
|
+
* The features ({@link FragmentArray}) added by this extension.
|
|
51
|
+
*/
|
|
14
52
|
features: typeof FragmentArray;
|
|
15
53
|
};
|
|
16
54
|
export default FragmentArrayExtension;
|
|
@@ -1,15 +1,50 @@
|
|
|
1
1
|
import type { PrivateReactiveResource } from "@warp-drive/core/reactive/-private";
|
|
2
|
+
/**
|
|
3
|
+
* The features added to an object resource by {@link FragmentExtension}, providing
|
|
4
|
+
* a subset of the legacy `ModelFragments` fragment API for migrated resources.
|
|
5
|
+
*/
|
|
2
6
|
export declare class Fragment {
|
|
7
|
+
/**
|
|
8
|
+
* Whether this fragment is in the process of being destroyed.
|
|
9
|
+
*/
|
|
3
10
|
isDestroying: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this fragment has been destroyed.
|
|
13
|
+
*/
|
|
4
14
|
isDestroyed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this fragment (or the attribute it is rooted at) has uncommitted changes.
|
|
17
|
+
*/
|
|
5
18
|
get hasDirtyAttributes(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Always `true`. Used to distinguish fragments from other resources.
|
|
21
|
+
*/
|
|
6
22
|
get isFragment(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The resource type of this fragment, if known.
|
|
25
|
+
*/
|
|
7
26
|
get $type(): string | null | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Reverts this fragment's attribute back to its last known remote value.
|
|
29
|
+
*/
|
|
8
30
|
rollbackAttributes(this: PrivateReactiveResource): void;
|
|
9
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A schema extension that adds the {@link Fragment} API to migrated
|
|
34
|
+
* `ModelFragments` object resources.
|
|
35
|
+
*/
|
|
10
36
|
export declare const FragmentExtension: {
|
|
37
|
+
/**
|
|
38
|
+
* This extension applies to `'object'` schemas.
|
|
39
|
+
*/
|
|
11
40
|
kind: "object";
|
|
41
|
+
/**
|
|
42
|
+
* The registered name of this extension.
|
|
43
|
+
*/
|
|
12
44
|
name: "fragment";
|
|
45
|
+
/**
|
|
46
|
+
* The features ({@link Fragment}) added by this extension.
|
|
47
|
+
*/
|
|
13
48
|
features: typeof Fragment;
|
|
14
49
|
};
|
|
15
50
|
export default FragmentExtension;
|
|
@@ -16,5 +16,12 @@ export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
|
|
|
16
16
|
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
|
|
17
17
|
}
|
|
18
18
|
export declare function fragmentsModelFor<T extends TypedRecordInstance>(this: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
|
|
19
|
+
/**
|
|
20
|
+
* The `modelFor` fallback used to construct a `ShimModelClass` schema for a
|
|
21
|
+
* type when ModelFragments support is enabled and no real `Model` subclass
|
|
22
|
+
* is registered for that type.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
19
26
|
export declare const modelFor: typeof fragmentsModelFor;
|
|
20
27
|
export {};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { WithArrayLike, WithEmberObject } from "../compat/extensions.js";
|
|
2
2
|
import type { Fragment } from "./extensions/fragment.js";
|
|
3
3
|
import type { FragmentArray } from "./extensions/fragment-array.js";
|
|
4
|
+
/**
|
|
5
|
+
* Adds the classic `EmberObject` API (via {@link WithEmberObject}) and the
|
|
6
|
+
* {@link Fragment} API to the type of a migrated single-fragment resource.
|
|
7
|
+
*/
|
|
4
8
|
export type WithFragment<T> = T & WithEmberObject<T> & Fragment;
|
|
9
|
+
/**
|
|
10
|
+
* Adds Ember's classic array-like API (via {@link WithArrayLike}) and the
|
|
11
|
+
* {@link FragmentArray} API to the type of a migrated fragment-array resource.
|
|
12
|
+
*/
|
|
5
13
|
export type WithFragmentArray<T extends Fragment> = T & WithArrayLike<T> & FragmentArray<T>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type ApplicationInstance from "@ember/application/instance";
|
|
2
2
|
import type { SchemaService } from "@warp-drive/core/types";
|
|
3
|
+
/**
|
|
4
|
+
* Registers the {@link FragmentExtension}/{@link FragmentArrayExtension} schema
|
|
5
|
+
* extensions on the given `SchemaService`, enabling ModelFragments migration support.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
3
9
|
export declare function registerFragmentExtensions(schema: SchemaService): void;
|
|
4
10
|
export declare function initialize(application: ApplicationInstance): void;
|
|
5
11
|
declare const _default: {
|
|
@@ -10,17 +10,47 @@ export declare function withArrayDefaults<
|
|
|
10
10
|
ArrayName extends string,
|
|
11
11
|
PrimitiveType extends string
|
|
12
12
|
>(arrayName: ArrayName, primitiveType?: PrimitiveType): PrimitiveType extends undefined ? {
|
|
13
|
+
/**
|
|
14
|
+
* This field is an `'array'` schema field.
|
|
15
|
+
*/
|
|
13
16
|
kind: "array";
|
|
17
|
+
/**
|
|
18
|
+
* The name of the array field.
|
|
19
|
+
*/
|
|
14
20
|
name: ArrayName;
|
|
21
|
+
/**
|
|
22
|
+
* The array's item type, `'array'` since no `primitiveType` was given.
|
|
23
|
+
*/
|
|
15
24
|
type: "array";
|
|
25
|
+
/**
|
|
26
|
+
* The schema options for this array field.
|
|
27
|
+
*/
|
|
16
28
|
options: {
|
|
29
|
+
/**
|
|
30
|
+
* The registered array-schema extensions to apply to this array.
|
|
31
|
+
*/
|
|
17
32
|
arrayExtensions: string[];
|
|
18
33
|
};
|
|
19
34
|
} : {
|
|
35
|
+
/**
|
|
36
|
+
* This field is an `'array'` schema field.
|
|
37
|
+
*/
|
|
20
38
|
kind: "array";
|
|
39
|
+
/**
|
|
40
|
+
* The name of the array field.
|
|
41
|
+
*/
|
|
21
42
|
name: ArrayName;
|
|
43
|
+
/**
|
|
44
|
+
* The array's item type, derived from `primitiveType`.
|
|
45
|
+
*/
|
|
22
46
|
type: `array:${PrimitiveType}`;
|
|
47
|
+
/**
|
|
48
|
+
* The schema options for this array field.
|
|
49
|
+
*/
|
|
23
50
|
options: {
|
|
51
|
+
/**
|
|
52
|
+
* The registered array-schema extensions to apply to this array.
|
|
53
|
+
*/
|
|
24
54
|
arrayExtensions: string[];
|
|
25
55
|
};
|
|
26
56
|
};
|
|
@@ -10,11 +10,29 @@ export declare function withFragmentArrayDefaults<
|
|
|
10
10
|
FragmentArrayType extends string,
|
|
11
11
|
FragmentArrayName extends string
|
|
12
12
|
>(fragmentArrayType: FragmentArrayType, fragmentArrayName?: FragmentArrayName): {
|
|
13
|
+
/**
|
|
14
|
+
* This field is a `'schema-array'` field, an array of fragments.
|
|
15
|
+
*/
|
|
13
16
|
kind: "schema-array";
|
|
17
|
+
/**
|
|
18
|
+
* The resource type of the fragments contained in this array.
|
|
19
|
+
*/
|
|
14
20
|
type: `fragment:${string}`;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the fragment-array field.
|
|
23
|
+
*/
|
|
15
24
|
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* The schema options for this fragment-array field.
|
|
27
|
+
*/
|
|
16
28
|
options: {
|
|
29
|
+
/**
|
|
30
|
+
* The registered array-schema extensions to apply to this array.
|
|
31
|
+
*/
|
|
17
32
|
arrayExtensions: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether the array defaults to a non-null empty array when unset.
|
|
35
|
+
*/
|
|
18
36
|
defaultValue: boolean;
|
|
19
37
|
};
|
|
20
38
|
};
|
|
@@ -10,10 +10,25 @@ export declare function withFragmentDefaults<
|
|
|
10
10
|
FragmentType extends string,
|
|
11
11
|
FragmentName extends string
|
|
12
12
|
>(fragmentType: FragmentType, fragmentName?: FragmentName): {
|
|
13
|
+
/**
|
|
14
|
+
* This field is a `'schema-object'` field, a single fragment.
|
|
15
|
+
*/
|
|
13
16
|
kind: "schema-object";
|
|
17
|
+
/**
|
|
18
|
+
* The resource type of the fragment.
|
|
19
|
+
*/
|
|
14
20
|
type: `fragment:${FragmentType}`;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the fragment field.
|
|
23
|
+
*/
|
|
15
24
|
name: FragmentType | FragmentName;
|
|
25
|
+
/**
|
|
26
|
+
* The schema options for this fragment field.
|
|
27
|
+
*/
|
|
16
28
|
options: {
|
|
29
|
+
/**
|
|
30
|
+
* The registered object-schema extensions to apply to this fragment.
|
|
31
|
+
*/
|
|
17
32
|
objectExtensions: string[];
|
|
18
33
|
};
|
|
19
34
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { LegacyResourceSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
2
2
|
import type { WithPartial } from "@warp-drive/core/types/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Used as a helper to setup the relevant parts of a legacy resource schema
|
|
5
|
+
* migrated from `Model`, applying the `ember-object` and `fragment` object
|
|
6
|
+
* extensions and a default `@id` identity field.
|
|
7
|
+
*
|
|
8
|
+
* @param schema the partial legacy resource schema to complete
|
|
9
|
+
* @returns the completed resource schema
|
|
10
|
+
*/
|
|
3
11
|
export declare function withLegacy(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): ResourceSchema;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TransformName } from "@warp-drive/core/types/symbols";
|
|
2
2
|
export interface BooleanTransform {
|
|
3
|
+
/**
|
|
4
|
+
* see {@link TransformName}
|
|
5
|
+
*/
|
|
3
6
|
[TransformName]: "boolean";
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
@@ -37,11 +40,21 @@ export default class UserModel extends Model {
|
|
|
37
40
|
@public
|
|
38
41
|
*/
|
|
39
42
|
export declare class BooleanTransform {
|
|
43
|
+
/**
|
|
44
|
+
* Converts a serialized (raw payload) value into a `boolean` (or `null`
|
|
45
|
+
* when `allowNull` is set and the value is nullish).
|
|
46
|
+
*/
|
|
40
47
|
deserialize(serialized: boolean | null | number | string, options?: {
|
|
41
48
|
allowNull?: boolean;
|
|
42
49
|
}): boolean | null;
|
|
50
|
+
/**
|
|
51
|
+
* Converts a `boolean` attribute value into its serialized (raw payload) form.
|
|
52
|
+
*/
|
|
43
53
|
serialize(deserialized: boolean | null, options?: {
|
|
44
54
|
allowNull?: boolean;
|
|
45
55
|
}): boolean | null;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new instance of this transform.
|
|
58
|
+
*/
|
|
46
59
|
static create(): BooleanTransform;
|
|
47
60
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TransformName } from "@warp-drive/core/types/symbols";
|
|
2
2
|
export interface DateTransform {
|
|
3
|
+
/**
|
|
4
|
+
* see {@link TransformName}
|
|
5
|
+
*/
|
|
3
6
|
[TransformName]: "date";
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
@@ -10,7 +13,7 @@ when `'date'` is passed as the type parameter to the
|
|
|
10
13
|
standard.
|
|
11
14
|
|
|
12
15
|
```js [app/models/score.js]
|
|
13
|
-
import Model, { attr, belongsTo } from '@
|
|
16
|
+
import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
|
|
14
17
|
|
|
15
18
|
export default class ScoreModel extends Model {
|
|
16
19
|
@attr('number') value;
|
|
@@ -22,7 +25,18 @@ export default class ScoreModel extends Model {
|
|
|
22
25
|
@public
|
|
23
26
|
*/
|
|
24
27
|
export declare class DateTransform {
|
|
28
|
+
/**
|
|
29
|
+
* Converts a serialized (raw payload) `ISO 8601` string, epoch number,
|
|
30
|
+
* or nullish value into a `Date` (or `null`/`undefined`).
|
|
31
|
+
*/
|
|
25
32
|
deserialize(serialized: string | number | null, _options?: Record<string, unknown>): Date | null;
|
|
33
|
+
/**
|
|
34
|
+
* Converts a `Date` attribute value into an `ISO 8601` string, or `null`
|
|
35
|
+
* if the value is not a valid `Date`.
|
|
36
|
+
*/
|
|
26
37
|
serialize(date: Date, _options?: Record<string, unknown>): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new instance of this transform.
|
|
40
|
+
*/
|
|
27
41
|
static create(): DateTransform;
|
|
28
42
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TransformName } from "@warp-drive/core/types/symbols";
|
|
2
2
|
export interface NumberTransform {
|
|
3
|
+
/**
|
|
4
|
+
* see {@link TransformName}
|
|
5
|
+
*/
|
|
3
6
|
[TransformName]: "number";
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
@@ -11,7 +14,7 @@ used when `number` is passed as the type parameter to the
|
|
|
11
14
|
Usage
|
|
12
15
|
|
|
13
16
|
```js [app/models/score.js]
|
|
14
|
-
import Model, { attr, belongsTo } from '@
|
|
17
|
+
import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
|
|
15
18
|
|
|
16
19
|
export default class ScoreModel extends Model {
|
|
17
20
|
@attr('number') value;
|
|
@@ -23,7 +26,17 @@ export default class ScoreModel extends Model {
|
|
|
23
26
|
@public
|
|
24
27
|
*/
|
|
25
28
|
export declare class NumberTransform {
|
|
29
|
+
/**
|
|
30
|
+
* Converts a serialized (raw payload) value into a `number`, or `null`
|
|
31
|
+
* if the value is empty, nullish, or not a valid number.
|
|
32
|
+
*/
|
|
26
33
|
deserialize(serialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a `number` attribute value into its serialized (raw payload) form.
|
|
36
|
+
*/
|
|
27
37
|
serialize(deserialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new instance of this transform.
|
|
40
|
+
*/
|
|
28
41
|
static create(): NumberTransform;
|
|
29
42
|
}
|