@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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TransformName } from "@warp-drive/core/types/symbols";
|
|
2
2
|
export interface StringTransform {
|
|
3
|
+
/**
|
|
4
|
+
* see {@link TransformName}
|
|
5
|
+
*/
|
|
3
6
|
[TransformName]: "string";
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
@@ -11,7 +14,7 @@ used when `string` is passed as the type parameter to the
|
|
|
11
14
|
Usage
|
|
12
15
|
|
|
13
16
|
```js [app/models/user.js]
|
|
14
|
-
import Model, { attr, belongsTo } from '@
|
|
17
|
+
import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
|
|
15
18
|
|
|
16
19
|
export default class UserModel extends Model {
|
|
17
20
|
@attr('boolean') isAdmin;
|
|
@@ -23,7 +26,17 @@ export default class UserModel extends Model {
|
|
|
23
26
|
@public
|
|
24
27
|
*/
|
|
25
28
|
export declare class StringTransform {
|
|
29
|
+
/**
|
|
30
|
+
* Converts a serialized (raw payload) value into a `string`, or `null`
|
|
31
|
+
* if the value is falsy (and not an empty string).
|
|
32
|
+
*/
|
|
26
33
|
deserialize(serialized: unknown, _options?: Record<string, unknown>): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a `string` attribute value into its serialized (raw payload) form.
|
|
36
|
+
*/
|
|
27
37
|
serialize(deserialized: unknown, _options?: Record<string, unknown>): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new instance of this transform.
|
|
40
|
+
*/
|
|
28
41
|
static create(): StringTransform;
|
|
29
42
|
}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
import type { Store } from "@warp-drive/core";
|
|
2
|
+
import type { LegacyBelongsToField, LegacyHasManyField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
|
|
1
3
|
type Coercable = string | number | boolean | null | undefined | symbol;
|
|
2
4
|
export declare function coerceId(id: Coercable): string | null;
|
|
5
|
+
/**
|
|
6
|
+
Given the name of a relationship on a resource `type`, determines the
|
|
7
|
+
inverse relationship field (if any) using only the schema service.
|
|
8
|
+
|
|
9
|
+
Unlike `Model.inverseFor`, this does not require `type` to be backed by
|
|
10
|
+
a `Model` class, so it works for both `Model`-based and schema-only
|
|
11
|
+
(e.g. `withDefaults` migration-support) resources.
|
|
12
|
+
|
|
13
|
+
@private
|
|
14
|
+
*/
|
|
15
|
+
export declare function inverseForRelationship(store: Store, type: string, name: string): LegacyRelationshipField | null;
|
|
16
|
+
/**
|
|
17
|
+
Given a relationship field on a resource `type`, determines the
|
|
18
|
+
cardinality of the relationship using only the schema service.
|
|
19
|
+
|
|
20
|
+
Unlike `Model.determineRelationshipType`, this does not require `type`
|
|
21
|
+
to be backed by a `Model` class, so it works for both `Model`-based and
|
|
22
|
+
schema-only (e.g. `withDefaults` migration-support) resources.
|
|
23
|
+
|
|
24
|
+
@private
|
|
25
|
+
*/
|
|
26
|
+
export declare function determineRelationshipType(store: Store, type: string, knownSide: LegacyBelongsToField | LegacyHasManyField): "oneToOne" | "oneToMany" | "manyToOne" | "manyToMany" | "oneToNone" | "manyToNone";
|
|
3
27
|
export {};
|
|
@@ -93,7 +93,7 @@ below shows how this could be done using `normalizeArrayResponse` and
|
|
|
93
93
|
`extractRelationship`.
|
|
94
94
|
|
|
95
95
|
```js [app/serializers/application.js]
|
|
96
|
-
import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
|
|
96
|
+
import { JSONAPISerializer } from '@warp-drive/legacy/serializer/json-api';
|
|
97
97
|
|
|
98
98
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
99
99
|
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
|
|
@@ -128,7 +128,6 @@ For an example implementation, see the included {@link JSONSerializer}.
|
|
|
128
128
|
@public
|
|
129
129
|
*/
|
|
130
130
|
export declare class Serializer extends EmberObject {
|
|
131
|
-
store: Store;
|
|
132
131
|
/**
|
|
133
132
|
The `store` property is the application's `store` that contains
|
|
134
133
|
all records. It can be used to look up serializers for other model
|
|
@@ -146,10 +145,9 @@ export declare class Serializer extends EmberObject {
|
|
|
146
145
|
});
|
|
147
146
|
```
|
|
148
147
|
|
|
149
|
-
@property store
|
|
150
|
-
@type {Store}
|
|
151
148
|
@public
|
|
152
149
|
*/
|
|
150
|
+
store: Store;
|
|
153
151
|
/**
|
|
154
152
|
The `normalizeResponse` method is used to normalize a payload from the
|
|
155
153
|
server to a JSON-API Document.
|
|
@@ -246,9 +244,9 @@ export declare class Serializer extends EmberObject {
|
|
|
246
244
|
```
|
|
247
245
|
|
|
248
246
|
@public
|
|
249
|
-
@param
|
|
250
|
-
@param
|
|
251
|
-
@return
|
|
247
|
+
@param _typeClass - the model class the hash is being normalized for
|
|
248
|
+
@param hash - the raw payload hash to normalize
|
|
249
|
+
@return the normalized resource document
|
|
252
250
|
*/
|
|
253
251
|
normalize(_typeClass: ModelSchema, hash: Record<string, unknown>): SingleResourceDocument | EmptyResourceDocument;
|
|
254
252
|
}
|
|
@@ -124,7 +124,7 @@ export declare class RecordReference {
|
|
|
124
124
|
normalized hash of data and the object represented by the reference
|
|
125
125
|
will update.
|
|
126
126
|
|
|
127
|
-
If you pass a promise to `push`,
|
|
127
|
+
If you pass a promise to `push`, WarpDrive will not ask the adapter
|
|
128
128
|
for the data if another attempt to fetch it is made in the
|
|
129
129
|
interim. When the promise resolves, the underlying object is updated
|
|
130
130
|
with the new data, and the promise returned by *this function* is resolved
|
|
@@ -171,7 +171,7 @@ export declare class RecordReference {
|
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
@public
|
|
174
|
-
@return
|
|
174
|
+
@return the record for this RecordReference
|
|
175
175
|
*/
|
|
176
176
|
value(): OpaqueRecordInstance | null;
|
|
177
177
|
/**
|
package/declarations/store.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
|
+
/**
|
|
3
|
+
* Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/
|
|
4
|
+
* `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`
|
|
5
|
+
* legacy-network-layer implementations of these methods onto the given
|
|
6
|
+
* `Store` subclass, for apps that have not yet migrated to the
|
|
7
|
+
* `RequestManager`-based equivalents.
|
|
8
|
+
*/
|
|
2
9
|
export declare function restoreDeprecatedStoreBehaviors(StoreKlass: typeof Store): void;
|
|
3
10
|
export { Store };
|