@ember-data-types/store 5.8.0-alpha.9 → 5.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
<p align="center">⚡️ The lightweight reactive data library for JavaScript applications</p>
|
|
19
19
|
|
|
20
|
-
This package provides [*Ember***Data**](https://github.com/
|
|
20
|
+
This package provides [*Ember***Data**](https://github.com/warp-drive-data/warp-drive/)'s `Store` class.
|
|
21
21
|
|
|
22
22
|
The `Store` coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
|
|
23
|
-
and sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/
|
|
23
|
+
and sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/warp-drive-data/warp-drive/tree/main/packages/request).
|
|
24
24
|
|
|
25
25
|
```mermaid
|
|
26
26
|
flowchart LR
|
|
@@ -28,8 +28,8 @@ flowchart LR
|
|
|
28
28
|
B{{fa:fa-sitemap RequestManager}} <--> C[(fa:fa-database Source)]
|
|
29
29
|
D <--> E[(fa:fa-archive Cache)]
|
|
30
30
|
D <--> B
|
|
31
|
-
click B href "https://github.com/
|
|
32
|
-
click E href "https://github.com/
|
|
31
|
+
click B href "https://github.com/warp-drive-data/warp-drive/tree/main/packages/request" "Go to @ember-data/request" _blank
|
|
32
|
+
click E href "https://github.com/warp-drive-data/warp-drive/tree/main/packages/json-api" "Go to @ember-data/json-api" _blank
|
|
33
33
|
style B color:#58a6ff;
|
|
34
34
|
style E color:#58a6ff;
|
|
35
35
|
```
|
|
@@ -41,7 +41,7 @@ flowchart LR
|
|
|
41
41
|
A[fa:fa-terminal App] --- B(Model)
|
|
42
42
|
A === C{fa:fa-code-fork Store}
|
|
43
43
|
B --- C
|
|
44
|
-
click B href "https://github.com/
|
|
44
|
+
click B href "https://github.com/warp-drive-data/warp-drive/tree/main/packages/model" "Go to @ember-data/model" _blank
|
|
45
45
|
style B color:#58a6ff;
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -66,7 +66,7 @@ After installing you will want to configure your first `Store`. Read more below
|
|
|
66
66
|
|
|
67
67
|
## 🔨 Creating A Store
|
|
68
68
|
|
|
69
|
-
To use a `Store` we will need to do few things: add a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to store data **in-memory**, add a [Handler](https://github.com/
|
|
69
|
+
To use a `Store` we will need to do few things: add a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to store data **in-memory**, add a [Handler](https://github.com/warp-drive-data/warp-drive/tree/main/packages/request#handling-requests) to fetch data from a source, and implement `instantiateRecord` to tell the store how to display the data for individual resources.
|
|
70
70
|
|
|
71
71
|
> **Note**
|
|
72
72
|
> If you are using the package `ember-data` then a `JSON:API` cache and `instantiateRecord` are configured for you by default.
|
|
@@ -75,7 +75,7 @@ To use a `Store` we will need to do few things: add a [Cache](https://api.emberj
|
|
|
75
75
|
|
|
76
76
|
To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other caches may better fit your data. You can author your own cache by creating one that conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
|
|
77
77
|
|
|
78
|
-
The package [@ember-data/json-api](https://github.com/
|
|
78
|
+
The package [@ember-data/json-api](https://github.com/warp-drive-data/warp-drive/tree/main/packages/json-api) provides a [JSON:API](https://jsonapi.org/) cache we can use. After installing it, we can configure the store to use this cache.
|
|
79
79
|
|
|
80
80
|
```js
|
|
81
81
|
import Store from '@ember-data/store';
|
|
@@ -100,7 +100,7 @@ When *Ember***Data** needs to fetch or save data it will pass that request to yo
|
|
|
100
100
|
To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
|
|
101
101
|
|
|
102
102
|
> **Note**
|
|
103
|
-
> If your app uses `GraphQL`, `REST` or different conventions for `JSON:API` than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the [handler interface](https://github.com/
|
|
103
|
+
> If your app uses `GraphQL`, `REST` or different conventions for `JSON:API` than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the [handler interface](https://github.com/warp-drive-data/warp-drive/tree/main/packages/request#handling-requests).
|
|
104
104
|
|
|
105
105
|
```ts
|
|
106
106
|
import Store, { CacheHandler } from '@ember-data/store';
|