@warp-drive/legacy 5.8.0-alpha.4 → 5.8.0-alpha.6
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 +1 -1
- package/declarations/adapter/json-api.d.ts +4 -6
- package/declarations/adapter/rest.d.ts +5 -8
- package/declarations/adapter.d.ts +4 -6
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +4 -6
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +4 -6
- package/declarations/compat.d.ts +4 -6
- package/declarations/model/-private/attr.d.ts +4 -5
- package/declarations/model/-private/belongs-to.d.ts +3 -4
- package/declarations/model/-private/has-many.d.ts +3 -4
- package/declarations/model/-private/hooks.d.ts +1 -1
- package/declarations/model/migration-support.d.ts +4 -2
- package/declarations/serializer/-private/embedded-records-mixin.d.ts +0 -5
- package/declarations/serializer/-private/transforms/boolean.d.ts +2 -2
- package/declarations/serializer/-private/transforms/date.d.ts +2 -2
- package/declarations/serializer/-private/transforms/number.d.ts +1 -1
- package/declarations/serializer/-private/transforms/string.d.ts +1 -1
- package/declarations/serializer/json-api.d.ts +3 -5
- package/declarations/serializer/json.d.ts +4 -6
- package/declarations/serializer/rest.d.ts +4 -6
- package/declarations/serializer.d.ts +4 -6
- package/dist/adapter/error.js +5 -6
- package/dist/adapter/json-api.js +3 -0
- package/dist/adapter/rest.js +5 -8
- package/dist/adapter.js +4 -6
- package/dist/compat.js +35 -37
- package/dist/{json-DziiodPf.js → json-LVAukAjN.js} +4 -6
- package/dist/model/migration-support.js +2 -0
- package/dist/model.js +11 -14
- package/dist/serializer/json-api.js +1 -1
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +5 -12
- package/dist/serializer/transform.js +15 -6
- package/dist/serializer.js +4 -7
- package/dist/store.js +3 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
[](https://docs.warp-drive.io)
|
|
20
20
|
[](https://discord.gg/zT3asNS
|
|
21
21
|
)
|
|
22
|
-
[](https://discord.gg/
|
|
22
|
+
[](https://discord.gg/PHBbnWJx5S
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
|
|
@@ -8,13 +8,11 @@ import { RESTAdapter } from "./rest.js";
|
|
|
8
8
|
/**
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
11
|
+
:::danger
|
|
12
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
14
13
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</blockquote>
|
|
14
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
15
|
+
:::
|
|
18
16
|
|
|
19
17
|
The `JSONAPIAdapter` is an adapter whichtransforms the store's
|
|
20
18
|
requests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).
|
|
@@ -31,13 +31,11 @@ export type RequestData = {
|
|
|
31
31
|
};
|
|
32
32
|
declare const AdapterWithBuildURLMixin: Readonly<typeof Adapter> & (new (owner?: Owner) => Adapter) & Mixin;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
34
|
+
* :::danger
|
|
35
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
37
36
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</blockquote>
|
|
37
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
38
|
+
:::
|
|
41
39
|
|
|
42
40
|
The REST adapter allows your store to communicate with an HTTP server by
|
|
43
41
|
transmitting JSON via XHR.
|
|
@@ -406,8 +404,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
406
404
|
Some APIs require HTTP headers, e.g. to provide an API
|
|
407
405
|
key. Arbitrary headers can be set as key/value pairs on the
|
|
408
406
|
`RESTAdapter`'s `headers` object and Ember Data will send them
|
|
409
|
-
along with each ajax request
|
|
410
|
-
customization](/ember-data/release/classes/RESTAdapter).
|
|
407
|
+
along with each ajax request..
|
|
411
408
|
|
|
412
409
|
```js [app/adapters/application.js]
|
|
413
410
|
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ## Overview
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
4
|
+
* :::danger
|
|
5
|
+
* ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
7
6
|
* If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* </blockquote>
|
|
7
|
+
* {@link Handler} instead to be used with the {@link RequestManager}
|
|
8
|
+
* ::::
|
|
11
9
|
*
|
|
12
10
|
* In order to properly fetch and update data, @warp-drive/legacy
|
|
13
11
|
* needs to understand how to connect to your API.
|
|
@@ -7,13 +7,11 @@ import type { SnapshotRecordArray } from "./snapshot-record-array.js";
|
|
|
7
7
|
type Group = Snapshot[];
|
|
8
8
|
export type AdapterPayload = Record<string, unknown> | unknown[];
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
10
|
+
* :::danger
|
|
11
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
13
12
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</blockquote>
|
|
13
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
14
|
+
:::
|
|
17
15
|
|
|
18
16
|
The following documentation describes the methods an
|
|
19
17
|
adapter should implement with descriptions around when an
|
|
@@ -9,13 +9,11 @@ export type SerializerOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
export type RequestType = "findRecord" | "queryRecord" | "findAll" | "findBelongsTo" | "findHasMany" | "findMany" | "query" | "createRecord" | "deleteRecord" | "updateRecord";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
12
|
+
* :::danger
|
|
13
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
15
14
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</blockquote>
|
|
15
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
16
|
+
:::
|
|
19
17
|
|
|
20
18
|
The following documentation describes the methods an application
|
|
21
19
|
serializer should implement with descriptions around when an
|
package/declarations/compat.d.ts
CHANGED
|
@@ -32,8 +32,7 @@ for an `application` adapter (the default adapter for
|
|
|
32
32
|
your entire application).
|
|
33
33
|
|
|
34
34
|
@public
|
|
35
|
-
@param
|
|
36
|
-
@return {Adapter}
|
|
35
|
+
@param modelName
|
|
37
36
|
*/
|
|
38
37
|
export declare function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
|
|
39
38
|
export declare function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
|
|
@@ -50,8 +49,7 @@ If a serializer cannot be found on the adapter, it will fall back
|
|
|
50
49
|
to an instance of `JSONSerializer`.
|
|
51
50
|
|
|
52
51
|
@public
|
|
53
|
-
@param
|
|
54
|
-
@return {Serializer}
|
|
52
|
+
@param modelName the record to serialize
|
|
55
53
|
*/
|
|
56
54
|
export declare function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null;
|
|
57
55
|
/**
|
|
@@ -125,8 +123,8 @@ store.pushPayload('post', pushData); // Will use the post serializer
|
|
|
125
123
|
```
|
|
126
124
|
|
|
127
125
|
@public
|
|
128
|
-
@param
|
|
129
|
-
@param
|
|
126
|
+
@param modelName Optionally, a model type used to determine which serializer will be used
|
|
127
|
+
@param inputPayload
|
|
130
128
|
*/
|
|
131
129
|
export declare function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void;
|
|
132
130
|
export declare function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown;
|
|
@@ -75,12 +75,12 @@ export type OptionsFromInstance<T> = TypeFromInstance<T> extends never ? never :
|
|
|
75
75
|
*/
|
|
76
76
|
export type DataDecorator = (target: object, key: string, desc?: DecoratorPropertyDescriptor) => void;
|
|
77
77
|
/**
|
|
78
|
-
`attr` defines an attribute on a
|
|
78
|
+
`attr` defines an attribute on a {@link Model}.
|
|
79
79
|
By default, attributes are passed through as-is, however you can specify an
|
|
80
80
|
optional type to have the value automatically transformed.
|
|
81
81
|
EmberData ships with four basic transform types: `string`, `number`,
|
|
82
82
|
`boolean` and `date`. You can define your own transforms by subclassing
|
|
83
|
-
|
|
83
|
+
{@link Transform}.
|
|
84
84
|
|
|
85
85
|
Note that you cannot use `attr` to define an attribute of `id`.
|
|
86
86
|
|
|
@@ -157,9 +157,8 @@ return new this();
|
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
@public
|
|
160
|
-
@param
|
|
161
|
-
@param
|
|
162
|
-
@return {Attribute}
|
|
160
|
+
@param type the attribute type
|
|
161
|
+
@param options a hash of options
|
|
163
162
|
*/
|
|
164
163
|
export declare function attr(): DataDecorator;
|
|
165
164
|
export declare function attr<T>(type: TypeFromInstance<T>): DataDecorator;
|
|
@@ -15,7 +15,7 @@ export type NoNull<T> = Exclude<T, null>;
|
|
|
15
15
|
export type RelationshipDecorator<T> = <This>(target: This, key: string, desc?: PropertyDescriptor) => void;
|
|
16
16
|
/**
|
|
17
17
|
`belongsTo` is used to define One-To-One and One-To-Many, and One-To-None
|
|
18
|
-
relationships on a
|
|
18
|
+
relationships on a {@link Model}.
|
|
19
19
|
|
|
20
20
|
`belongsTo` takes a configuration hash as a second parameter, currently
|
|
21
21
|
supported options are:
|
|
@@ -165,9 +165,8 @@ must be declared as polymorphic, and the `as` option must be used to declare the
|
|
|
165
165
|
type each record satisfies on both sides.
|
|
166
166
|
|
|
167
167
|
@public
|
|
168
|
-
@param
|
|
169
|
-
@param
|
|
170
|
-
@return {PropertyDescriptor} relationship
|
|
168
|
+
@param type the name of the related resource
|
|
169
|
+
@param options a hash of options
|
|
171
170
|
*/
|
|
172
171
|
export declare function belongsTo(): never;
|
|
173
172
|
export declare function belongsTo(type: string): never;
|
|
@@ -2,7 +2,7 @@ import type { TypeFromInstance } from "@warp-drive/core/types/record";
|
|
|
2
2
|
import type { NoNull, RelationshipDecorator, RelationshipOptions } from "./belongs-to.js";
|
|
3
3
|
/**
|
|
4
4
|
`hasMany` is used to define Many-To-One and Many-To-Many, and Many-To-None
|
|
5
|
-
relationships on a
|
|
5
|
+
relationships on a {@link Model}.
|
|
6
6
|
|
|
7
7
|
`hasMany` takes a configuration hash as a second parameter, currently
|
|
8
8
|
supported options are:
|
|
@@ -153,9 +153,8 @@ must be declared as polymorphic, and the `as` option must be used to declare the
|
|
|
153
153
|
type each record satisfies on both sides.
|
|
154
154
|
|
|
155
155
|
@public
|
|
156
|
-
@param
|
|
157
|
-
@param
|
|
158
|
-
@return {PropertyDescriptor} relationship
|
|
156
|
+
@param type the name of the related resource
|
|
157
|
+
@param options a hash of options
|
|
159
158
|
*/
|
|
160
159
|
export declare function hasMany(): never;
|
|
161
160
|
export declare function hasMany(type: string): never;
|
|
@@ -2,7 +2,7 @@ import { type Store } from "@warp-drive/core/store/-private";
|
|
|
2
2
|
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
3
3
|
import type { TypeFromInstance } from "@warp-drive/core/types/record";
|
|
4
4
|
import type { Model } from "./model.js";
|
|
5
|
-
export declare function instantiateRecord(this: Store, identifier: ResourceKey, createRecordArgs
|
|
5
|
+
export declare function instantiateRecord(this: Store, identifier: ResourceKey, createRecordArgs?: {
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
}): Model;
|
|
8
8
|
export declare function teardownRecord(record: Model): void;
|
|
@@ -207,8 +207,6 @@ export interface DelegatingSchemaService {
|
|
|
207
207
|
doesTypeExist?(type: string): boolean;
|
|
208
208
|
}
|
|
209
209
|
export declare class DelegatingSchemaService implements SchemaService {
|
|
210
|
-
_preferred: SchemaService;
|
|
211
|
-
_secondary: SchemaService;
|
|
212
210
|
constructor(store: Store, schema: SchemaService);
|
|
213
211
|
isDelegated(resource: ResourceKey | {
|
|
214
212
|
type: string;
|
|
@@ -252,4 +250,8 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
252
250
|
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
253
251
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
254
252
|
}
|
|
253
|
+
export interface PrivateDelegatingSchemaService extends DelegatingSchemaService {
|
|
254
|
+
_preferred: SchemaService;
|
|
255
|
+
_secondary: SchemaService;
|
|
256
|
+
}
|
|
255
257
|
export {};
|
|
@@ -85,11 +85,6 @@ instances must have an `id` property to be used with Ember Data.
|
|
|
85
85
|
are. Please read the docs for the methods this mixin provides, in case you need
|
|
86
86
|
to modify it to fit your specific needs.**
|
|
87
87
|
|
|
88
|
-
For example, review the docs for each method of this mixin:
|
|
89
|
-
* [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)
|
|
90
|
-
* [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)
|
|
91
|
-
* [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)
|
|
92
|
-
|
|
93
88
|
@class EmbeddedRecordsMixin
|
|
94
89
|
@public
|
|
95
90
|
*/
|
|
@@ -5,8 +5,8 @@ export interface BooleanTransform {
|
|
|
5
5
|
/**
|
|
6
6
|
The `BooleanTransform` class is used to serialize and deserialize
|
|
7
7
|
boolean attributes on Ember Data record objects. This transform is
|
|
8
|
-
used when `boolean` is passed as the type parameter to the
|
|
9
|
-
|
|
8
|
+
used when `'boolean'` is passed as the type parameter to the
|
|
9
|
+
{@link attr}function.
|
|
10
10
|
|
|
11
11
|
Usage
|
|
12
12
|
|
|
@@ -5,8 +5,8 @@ export interface DateTransform {
|
|
|
5
5
|
/**
|
|
6
6
|
The `DateTransform` class is used to serialize and deserialize
|
|
7
7
|
date attributes on Ember Data record objects. This transform is used
|
|
8
|
-
when `date` is passed as the type parameter to the
|
|
9
|
-
|
|
8
|
+
when `'date'` is passed as the type parameter to the
|
|
9
|
+
{@link attr} function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)
|
|
10
10
|
standard.
|
|
11
11
|
|
|
12
12
|
```js [app/models/score.js]
|
|
@@ -6,7 +6,7 @@ export interface NumberTransform {
|
|
|
6
6
|
The `NumberTransform` class is used to serialize and deserialize
|
|
7
7
|
numeric attributes on Ember Data record objects. This transform is
|
|
8
8
|
used when `number` is passed as the type parameter to the
|
|
9
|
-
|
|
9
|
+
{@link attr} function.
|
|
10
10
|
|
|
11
11
|
Usage
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ export interface StringTransform {
|
|
|
6
6
|
The `StringTransform` class is used to serialize and deserialize
|
|
7
7
|
string attributes on Ember Data record objects. This transform is
|
|
8
8
|
used when `string` is passed as the type parameter to the
|
|
9
|
-
|
|
9
|
+
{@link attr} function.
|
|
10
10
|
|
|
11
11
|
Usage
|
|
12
12
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
<p>
|
|
2
|
+
* :::danger
|
|
4
3
|
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
5
4
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</blockquote>
|
|
5
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
6
|
+
:::
|
|
9
7
|
|
|
10
8
|
In EmberData a Serializer is used to serialize and deserialize
|
|
11
9
|
records when they are transferred in and out of an external source.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
2
|
+
* :::danger
|
|
3
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
5
4
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</blockquote>
|
|
5
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
6
|
+
:::
|
|
9
7
|
|
|
10
8
|
In EmberData a Serializer is used to serialize and deserialize
|
|
11
9
|
records when they are transferred in and out of an external source.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
2
|
+
* :::danger
|
|
3
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
5
4
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</blockquote>
|
|
5
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
6
|
+
:::
|
|
9
7
|
|
|
10
8
|
Normally, applications will use the `RESTSerializer` by implementing
|
|
11
9
|
the `normalize` method.
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
## Overview
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
4
|
+
:::danger
|
|
5
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
7
6
|
If starting a new app or thinking of implementing a new serializer, consider writing a
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</blockquote>
|
|
7
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
8
|
+
:::
|
|
11
9
|
|
|
12
10
|
In order to properly manage and present your data, WarpDrive
|
|
13
11
|
needs to understand the structure of data it receives.
|
package/dist/adapter/error.js
CHANGED
|
@@ -3,17 +3,16 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
## Overview
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
11
|
+
:::danger
|
|
12
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
13
13
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</blockquote>
|
|
14
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
15
|
+
:::
|
|
17
16
|
|
|
18
17
|
An `AdapterError` is used by an adapter to signal that an error occurred
|
|
19
18
|
during a request to an external API. It indicates a generic error, and
|
package/dist/adapter/json-api.js
CHANGED
|
@@ -3,6 +3,9 @@ import '@ember/debug';
|
|
|
3
3
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
4
4
|
import { b as serializeIntoHash } from "../serialize-into-hash-CS0MIv4F.js";
|
|
5
5
|
import { RESTAdapter } from './rest.js';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
|
|
6
9
|
class JSONAPIAdapter extends RESTAdapter {
|
|
7
10
|
_defaultContentType = 'application/vnd.api+json';
|
|
8
11
|
|
package/dist/adapter/rest.js
CHANGED
|
@@ -14,13 +14,11 @@ import { d as decorateMethodV2 } from "../runtime-BPCpkOf1-BKOwiRJp.js";
|
|
|
14
14
|
const AdapterWithBuildURLMixin = Adapter.extend(BuildURLMixin);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
17
|
+
* :::danger
|
|
18
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
20
19
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</blockquote>
|
|
20
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
21
|
+
:::
|
|
24
22
|
|
|
25
23
|
The REST adapter allows your store to communicate with an HTTP server by
|
|
26
24
|
transmitting JSON via XHR.
|
|
@@ -392,8 +390,7 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
392
390
|
Some APIs require HTTP headers, e.g. to provide an API
|
|
393
391
|
key. Arbitrary headers can be set as key/value pairs on the
|
|
394
392
|
`RESTAdapter`'s `headers` object and Ember Data will send them
|
|
395
|
-
along with each ajax request
|
|
396
|
-
customization](/ember-data/release/classes/RESTAdapter).
|
|
393
|
+
along with each ajax request..
|
|
397
394
|
```js [app/adapters/application.js]
|
|
398
395
|
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
399
396
|
export default class ApplicationAdapter extends RESTAdapter {
|
package/dist/adapter.js
CHANGED
|
@@ -496,13 +496,11 @@ const BuildURLMixin = Mixin.create(mixinProps);
|
|
|
496
496
|
/**
|
|
497
497
|
* ## Overview
|
|
498
498
|
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
499
|
+
* :::danger
|
|
500
|
+
* ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
502
501
|
* If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
* </blockquote>
|
|
502
|
+
* {@link Handler} instead to be used with the {@link RequestManager}
|
|
503
|
+
* ::::
|
|
506
504
|
*
|
|
507
505
|
* In order to properly fetch and update data, @warp-drive/legacy
|
|
508
506
|
* needs to understand how to connect to your API.
|
package/dist/compat.js
CHANGED
|
@@ -737,18 +737,17 @@ function queryRecord(context) {
|
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
/**
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
740
|
+
Returns an instance of the adapter for a given type. For
|
|
741
|
+
example, `adapterFor('person')` will return an instance of
|
|
742
|
+
the adapter located at `app/adapters/person.js`
|
|
743
743
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
744
|
+
If no `person` adapter is found, this method will look
|
|
745
|
+
for an `application` adapter (the default adapter for
|
|
746
|
+
your entire application).
|
|
747
747
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
*/
|
|
748
|
+
@public
|
|
749
|
+
@param modelName
|
|
750
|
+
*/
|
|
752
751
|
|
|
753
752
|
function adapterFor(modelName, _allowMissing) {
|
|
754
753
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -799,20 +798,19 @@ function adapterFor(modelName, _allowMissing) {
|
|
|
799
798
|
}
|
|
800
799
|
|
|
801
800
|
/**
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
801
|
+
Returns an instance of the serializer for a given type. For
|
|
802
|
+
example, `serializerFor('person')` will return an instance of
|
|
803
|
+
`App.PersonSerializer`.
|
|
805
804
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
805
|
+
If no `App.PersonSerializer` is found, this method will look
|
|
806
|
+
for an `App.ApplicationSerializer` (the default serializer for
|
|
807
|
+
your entire application).
|
|
809
808
|
|
|
810
|
-
|
|
811
|
-
|
|
809
|
+
If a serializer cannot be found on the adapter, it will fall back
|
|
810
|
+
to an instance of `JSONSerializer`.
|
|
812
811
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
@return {Serializer}
|
|
812
|
+
@public
|
|
813
|
+
@param modelName the record to serialize
|
|
816
814
|
*/
|
|
817
815
|
function serializerFor(modelName) {
|
|
818
816
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -859,23 +857,23 @@ function serializerFor(modelName) {
|
|
|
859
857
|
}
|
|
860
858
|
|
|
861
859
|
/**
|
|
862
|
-
|
|
863
|
-
|
|
860
|
+
`normalize` converts a json payload into the normalized form that
|
|
861
|
+
[push](../methods/push?anchor=push) expects.
|
|
864
862
|
|
|
865
|
-
|
|
863
|
+
Example
|
|
866
864
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
865
|
+
```js
|
|
866
|
+
socket.on('message', function(message) {
|
|
867
|
+
let modelName = message.model;
|
|
868
|
+
let data = message.data;
|
|
869
|
+
store.push(store.normalize(modelName, data));
|
|
870
|
+
});
|
|
871
|
+
```
|
|
874
872
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
873
|
+
@public
|
|
874
|
+
@param modelName The name of the model type for this payload
|
|
875
|
+
@return The normalized payload
|
|
876
|
+
*/
|
|
879
877
|
// TODO @runspired @deprecate users should call normalize on the associated serializer directly
|
|
880
878
|
function normalize(modelName, payload) {
|
|
881
879
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -956,8 +954,8 @@ function normalize(modelName, payload) {
|
|
|
956
954
|
```
|
|
957
955
|
|
|
958
956
|
@public
|
|
959
|
-
@param
|
|
960
|
-
@param
|
|
957
|
+
@param modelName Optionally, a model type used to determine which serializer will be used
|
|
958
|
+
@param inputPayload
|
|
961
959
|
*/
|
|
962
960
|
// TODO @runspired @deprecate pushPayload in favor of looking up the serializer
|
|
963
961
|
function pushPayload(modelName, inputPayload) {
|
|
@@ -25,13 +25,11 @@ const SOURCE_POINTER_PRIMARY_REGEXP = /^\/?data/;
|
|
|
25
25
|
const PRIMARY_ATTRIBUTE_KEY = 'base';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
28
|
+
* :::danger
|
|
29
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
31
30
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</blockquote>
|
|
31
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
32
|
+
:::
|
|
35
33
|
|
|
36
34
|
In EmberData a Serializer is used to serialize and deserialize
|
|
37
35
|
records when they are transferred in and out of an external source.
|
package/dist/model.js
CHANGED
|
@@ -87,12 +87,12 @@ function _attr(type, options) {
|
|
|
87
87
|
*/
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
`attr` defines an attribute on a
|
|
90
|
+
`attr` defines an attribute on a {@link Model}.
|
|
91
91
|
By default, attributes are passed through as-is, however you can specify an
|
|
92
92
|
optional type to have the value automatically transformed.
|
|
93
93
|
EmberData ships with four basic transform types: `string`, `number`,
|
|
94
94
|
`boolean` and `date`. You can define your own transforms by subclassing
|
|
95
|
-
|
|
95
|
+
{@link Transform}.
|
|
96
96
|
|
|
97
97
|
Note that you cannot use `attr` to define an attribute of `id`.
|
|
98
98
|
|
|
@@ -169,9 +169,8 @@ function _attr(type, options) {
|
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
@public
|
|
172
|
-
@param
|
|
173
|
-
@param
|
|
174
|
-
@return {Attribute}
|
|
172
|
+
@param type the attribute type
|
|
173
|
+
@param options a hash of options
|
|
175
174
|
*/
|
|
176
175
|
|
|
177
176
|
// see note on DataDecorator for why void
|
|
@@ -258,7 +257,7 @@ function _belongsTo(type, options) {
|
|
|
258
257
|
|
|
259
258
|
/**
|
|
260
259
|
`belongsTo` is used to define One-To-One and One-To-Many, and One-To-None
|
|
261
|
-
relationships on a
|
|
260
|
+
relationships on a {@link Model}.
|
|
262
261
|
|
|
263
262
|
`belongsTo` takes a configuration hash as a second parameter, currently
|
|
264
263
|
supported options are:
|
|
@@ -408,9 +407,8 @@ function _belongsTo(type, options) {
|
|
|
408
407
|
type each record satisfies on both sides.
|
|
409
408
|
|
|
410
409
|
@public
|
|
411
|
-
@param
|
|
412
|
-
@param
|
|
413
|
-
@return {PropertyDescriptor} relationship
|
|
410
|
+
@param type the name of the related resource
|
|
411
|
+
@param options a hash of options
|
|
414
412
|
*/
|
|
415
413
|
|
|
416
414
|
// export function belongsTo<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(
|
|
@@ -497,7 +495,7 @@ function _hasMany(type, options) {
|
|
|
497
495
|
|
|
498
496
|
/**
|
|
499
497
|
`hasMany` is used to define Many-To-One and Many-To-Many, and Many-To-None
|
|
500
|
-
relationships on a
|
|
498
|
+
relationships on a {@link Model}.
|
|
501
499
|
|
|
502
500
|
`hasMany` takes a configuration hash as a second parameter, currently
|
|
503
501
|
supported options are:
|
|
@@ -648,9 +646,8 @@ function _hasMany(type, options) {
|
|
|
648
646
|
type each record satisfies on both sides.
|
|
649
647
|
|
|
650
648
|
@public
|
|
651
|
-
@param
|
|
652
|
-
@param
|
|
653
|
-
@return {PropertyDescriptor} relationship
|
|
649
|
+
@param type the name of the related resource
|
|
650
|
+
@param options a hash of options
|
|
654
651
|
*/
|
|
655
652
|
|
|
656
653
|
// export function hasMany<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(
|
|
@@ -673,7 +670,7 @@ function instantiateRecord(identifier, createRecordArgs) {
|
|
|
673
670
|
|
|
674
671
|
// TODO deprecate allowing unknown args setting
|
|
675
672
|
const createOptions = {
|
|
676
|
-
_createProps: createRecordArgs,
|
|
673
|
+
_createProps: createRecordArgs ?? {},
|
|
677
674
|
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
678
675
|
_secretInit: {
|
|
679
676
|
identifier,
|
|
@@ -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-LVAukAjN.js";
|
|
4
4
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
5
5
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
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-LVAukAjN.js";
|
|
6
6
|
import '@embroider/macros';
|
package/dist/serializer/rest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { camelize, dasherize, singularize } from '@warp-drive/utilities/string';
|
|
3
|
-
import { J as JSONSerializer, c as coerceId } from "../json-
|
|
3
|
+
import { J as JSONSerializer, c as coerceId } from "../json-LVAukAjN.js";
|
|
4
4
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
5
5
|
import Mixin from '@ember/object/mixin';
|
|
6
6
|
|
|
@@ -96,11 +96,6 @@ import Mixin from '@ember/object/mixin';
|
|
|
96
96
|
are. Please read the docs for the methods this mixin provides, in case you need
|
|
97
97
|
to modify it to fit your specific needs.**
|
|
98
98
|
|
|
99
|
-
For example, review the docs for each method of this mixin:
|
|
100
|
-
* [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)
|
|
101
|
-
* [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)
|
|
102
|
-
* [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)
|
|
103
|
-
|
|
104
99
|
@class EmbeddedRecordsMixin
|
|
105
100
|
@public
|
|
106
101
|
*/
|
|
@@ -583,13 +578,11 @@ function makeArray(value) {
|
|
|
583
578
|
}
|
|
584
579
|
|
|
585
580
|
/**
|
|
586
|
-
*
|
|
587
|
-
|
|
588
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
581
|
+
* :::danger
|
|
582
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
589
583
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
</blockquote>
|
|
584
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
585
|
+
:::
|
|
593
586
|
|
|
594
587
|
Normally, applications will use the `RESTSerializer` by implementing
|
|
595
588
|
the `normalize` method.
|
|
@@ -79,11 +79,13 @@ import EmberObject from '@ember/object';
|
|
|
79
79
|
*/
|
|
80
80
|
const Transform = EmberObject;
|
|
81
81
|
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
|
+
|
|
82
84
|
/**
|
|
83
85
|
The `BooleanTransform` class is used to serialize and deserialize
|
|
84
86
|
boolean attributes on Ember Data record objects. This transform is
|
|
85
|
-
used when `boolean` is passed as the type parameter to the
|
|
86
|
-
|
|
87
|
+
used when `'boolean'` is passed as the type parameter to the
|
|
88
|
+
{@link attr}function.
|
|
87
89
|
|
|
88
90
|
Usage
|
|
89
91
|
|
|
@@ -139,11 +141,13 @@ class BooleanTransform {
|
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
145
|
+
|
|
142
146
|
/**
|
|
143
147
|
The `DateTransform` class is used to serialize and deserialize
|
|
144
148
|
date attributes on Ember Data record objects. This transform is used
|
|
145
|
-
when `date` is passed as the type parameter to the
|
|
146
|
-
|
|
149
|
+
when `'date'` is passed as the type parameter to the
|
|
150
|
+
{@link attr} function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)
|
|
147
151
|
standard.
|
|
148
152
|
|
|
149
153
|
```js [app/models/score.js]
|
|
@@ -190,6 +194,9 @@ class DateTransform {
|
|
|
190
194
|
return new this();
|
|
191
195
|
}
|
|
192
196
|
}
|
|
197
|
+
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
199
|
+
|
|
193
200
|
function isNumber(value) {
|
|
194
201
|
return value === value && value !== Infinity && value !== -Infinity;
|
|
195
202
|
}
|
|
@@ -197,7 +204,7 @@ function isNumber(value) {
|
|
|
197
204
|
The `NumberTransform` class is used to serialize and deserialize
|
|
198
205
|
numeric attributes on Ember Data record objects. This transform is
|
|
199
206
|
used when `number` is passed as the type parameter to the
|
|
200
|
-
|
|
207
|
+
{@link attr} function.
|
|
201
208
|
|
|
202
209
|
Usage
|
|
203
210
|
|
|
@@ -235,11 +242,13 @@ class NumberTransform {
|
|
|
235
242
|
}
|
|
236
243
|
}
|
|
237
244
|
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
246
|
+
|
|
238
247
|
/**
|
|
239
248
|
The `StringTransform` class is used to serialize and deserialize
|
|
240
249
|
string attributes on Ember Data record objects. This transform is
|
|
241
250
|
used when `string` is passed as the type parameter to the
|
|
242
|
-
|
|
251
|
+
{@link attr} function.
|
|
243
252
|
|
|
244
253
|
Usage
|
|
245
254
|
|
package/dist/serializer.js
CHANGED
|
@@ -5,13 +5,11 @@ import { a as decorateFieldV2, i as initializeDeferredDecorator } from "./runtim
|
|
|
5
5
|
/**
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
8
|
+
:::danger
|
|
9
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
11
10
|
If starting a new app or thinking of implementing a new serializer, consider writing a
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</blockquote>
|
|
11
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
12
|
+
:::
|
|
15
13
|
|
|
16
14
|
In order to properly manage and present your data, WarpDrive
|
|
17
15
|
needs to understand the structure of data it receives.
|
|
@@ -109,7 +107,6 @@ import { a as decorateFieldV2, i as initializeDeferredDecorator } from "./runtim
|
|
|
109
107
|
|
|
110
108
|
@module
|
|
111
109
|
*/
|
|
112
|
-
|
|
113
110
|
const service = s.service ?? s.inject;
|
|
114
111
|
|
|
115
112
|
/**
|
package/dist/store.js
CHANGED
|
@@ -524,6 +524,9 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
524
524
|
});
|
|
525
525
|
return promise.then(document => document.content);
|
|
526
526
|
};
|
|
527
|
+
|
|
528
|
+
// do not put a ts-expect-error here, because typedoc will fail to
|
|
529
|
+
// build due to this error only occurring when references are in use in the editor
|
|
527
530
|
StoreKlass.prototype.getReference = function (resource, id) {
|
|
528
531
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
529
532
|
if (!test) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.8.0-alpha.
|
|
3
|
+
"version": "5.8.0-alpha.6",
|
|
4
4
|
"description": "Decommissioned Packages for WarpDrive | Things your app might still want to maintain use of for a little longer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.8.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.8.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.8.0-alpha.6",
|
|
36
|
+
"@warp-drive/utilities": "5.8.0-alpha.6"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.18.1"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.28.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.1",
|
|
45
45
|
"@types/jquery": "^3.5.33",
|
|
46
|
-
"@warp-drive/internal-config": "5.8.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.8.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.8.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.8.0-alpha.6",
|
|
47
|
+
"@warp-drive/core": "5.8.0-alpha.6",
|
|
48
|
+
"@warp-drive/utilities": "5.8.0-alpha.6",
|
|
49
49
|
"ember-source": "~6.6.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.2",
|