@ember-data/store 5.8.0-beta.0 → 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/dist/index.js +9 -34
- package/package.json +4 -4
- package/unstable-preview-types/index.d.ts +4 -2
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';
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,21 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
|
+
export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from '@warp-drive/core';
|
|
3
4
|
import { setupSignals } from '@warp-drive/core/configure';
|
|
4
5
|
import { peekTransient } from '@warp-drive/core/types/-private';
|
|
5
|
-
export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from '@warp-drive/core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* <img
|
|
10
|
-
* class="project-logo"
|
|
11
|
-
* src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
|
|
12
|
-
* alt="EmberData Store"
|
|
13
|
-
* width="240px"
|
|
14
|
-
* title="EmberData Store"
|
|
15
|
-
* />
|
|
16
|
-
* </p>
|
|
17
|
-
*
|
|
18
|
-
* This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
|
|
8
|
+
* This package provides [*Ember***Data**](https://github.com/warp-drive-data/warp-drive/)'s `Store` class.
|
|
19
9
|
*
|
|
20
|
-
* A
|
|
21
|
-
* and sources of data (such as your API or a local persistence layer) accessed via a
|
|
10
|
+
* A {@link Store} coordinates interaction between your application, a {@link Cache},
|
|
11
|
+
* and sources of data (such as your API or a local persistence layer) accessed via a {@link RequestManager}.
|
|
22
12
|
*
|
|
23
13
|
* Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
|
|
24
14
|
*
|
|
25
|
-
* ## Installation
|
|
26
|
-
*
|
|
27
|
-
* If you have installed `ember-data` then you already have this package installed.
|
|
28
|
-
* Otherwise you can install it using your javascript package manager of choice.
|
|
29
|
-
* For instance with [pnpm](https://pnpm.io/)
|
|
30
|
-
*
|
|
31
|
-
* ```
|
|
32
|
-
* pnpm add @ember-data/store
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* After installing you will want to configure your first `Store`. Read more below
|
|
36
|
-
* for how to create and configure stores for your application.
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
15
|
* ## 🔨 Creating A Store
|
|
40
16
|
*
|
|
41
|
-
* To use a `Store` we will need to do few things: add a
|
|
42
|
-
* to store data **in-memory**, add a
|
|
17
|
+
* To use a `Store` we will need to do few things: add a {@link Cache}
|
|
18
|
+
* to store data **in-memory**, add a {@link Handler} to fetch data from a source,
|
|
43
19
|
* and implement `instantiateRecord` to tell the store how to display the data for individual resources.
|
|
44
20
|
*
|
|
45
21
|
* > **Note**
|
|
@@ -50,7 +26,7 @@ export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForge
|
|
|
50
26
|
*
|
|
51
27
|
* To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
|
|
52
28
|
* caches may better fit your data. You can author your own cache by creating one that
|
|
53
|
-
* conforms to the
|
|
29
|
+
* conforms to the {@link Cache | spec}.
|
|
54
30
|
*
|
|
55
31
|
* The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
|
|
56
32
|
* After installing it, we can configure the store to use this cache.
|
|
@@ -80,7 +56,7 @@ export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForge
|
|
|
80
56
|
* To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
|
|
81
57
|
*
|
|
82
58
|
* > **Note**
|
|
83
|
-
* > 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/
|
|
59
|
+
* > 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).
|
|
84
60
|
*
|
|
85
61
|
* ```ts
|
|
86
62
|
* import Store from '@ember-data/store';
|
|
@@ -125,8 +101,7 @@ export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForge
|
|
|
125
101
|
* ### Presenting Data from the Cache
|
|
126
102
|
*
|
|
127
103
|
* Now that we have a source and a cache for our data, we need to configure how
|
|
128
|
-
* the Store delivers that data back to our application. We do this via the hook
|
|
129
|
-
* [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
|
|
104
|
+
* the Store delivers that data back to our application. We do this via the {@link Store.instantiateRecord | instantiateRecord hook}
|
|
130
105
|
* which allows us to transform the data for a resource before handing it to the application.
|
|
131
106
|
*
|
|
132
107
|
* A naive way to present the data would be to return it as JSON. Typically instead
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/store",
|
|
3
|
-
"version": "5.8.0-beta.
|
|
3
|
+
"version": "5.8.0-beta.1",
|
|
4
4
|
"description": "The core of EmberData. Provides the Store service which coordinates the cache with the network and presentation layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
7
7
|
],
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+ssh://git@github.com:
|
|
10
|
+
"url": "git+ssh://git@github.com:warp-drive-data/warp-drive.git",
|
|
11
11
|
"directory": "packages/store"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@warp-drive/core": "5.8.0-beta.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@ember-data/tracking": "5.8.0-beta.
|
|
39
|
+
"@ember-data/tracking": "5.8.0-beta.1",
|
|
40
40
|
"@ember/test-waiters": "^3.1.0 || ^4.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@babel/preset-env": "^7.28.3",
|
|
54
54
|
"@babel/preset-typescript": "^7.27.1",
|
|
55
55
|
"@warp-drive/internal-config": "5.8.0-beta.0",
|
|
56
|
-
"@ember-data/tracking": "5.8.0-beta.
|
|
56
|
+
"@ember-data/tracking": "5.8.0-beta.1",
|
|
57
57
|
"@ember/test-waiters": "^4.1.1",
|
|
58
58
|
"ember-source": "~6.6.0",
|
|
59
59
|
"typescript": "^5.9.2",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
/// <reference path="./types.d.ts" />
|
|
2
1
|
/// <reference path="./configure.d.ts" />
|
|
3
2
|
/// <reference path="./-private.d.ts" />
|
|
3
|
+
/// <reference path="./types.d.ts" />
|
|
4
4
|
declare module '@ember-data/store' {
|
|
5
|
-
|
|
5
|
+
import { Store } from "@warp-drive/core";
|
|
6
|
+
export { Store as default };
|
|
7
|
+
export { type StoreRequestContext, CacheHandler, type Document, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor, type DocumentCacheOperation, type CacheOperation, type NotificationType, setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource } from "@warp-drive/core";
|
|
6
8
|
|
|
7
9
|
}
|