@ember-data/store 5.6.0-beta.0 → 5.6.0-beta.2
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 +5 -5
- package/addon-main.cjs +1 -1
- package/dist/-private.js +1 -2
- package/dist/configure.js +1 -1
- package/dist/index.js +208 -5
- package/dist/types.js +1 -0
- package/package.json +9 -20
- package/unstable-preview-types/-private.d.ts +3 -32
- package/unstable-preview-types/configure.d.ts +14 -18
- package/unstable-preview-types/index.d.ts +4 -226
- package/unstable-preview-types/types.d.ts +3 -6
- package/dist/-private.js.map +0 -1
- package/dist/configure-BfLLW6GY.js +0 -161
- package/dist/configure-BfLLW6GY.js.map +0 -1
- package/dist/configure.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/request-state-uRtpn0Lc.js +0 -7709
- package/dist/request-state-uRtpn0Lc.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/unstable-preview-types/-private/cache-handler/handler.d.ts +0 -62
- package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +0 -1
- package/unstable-preview-types/-private/cache-handler/types.d.ts +0 -107
- package/unstable-preview-types/-private/cache-handler/types.d.ts.map +0 -1
- package/unstable-preview-types/-private/cache-handler/utils.d.ts +0 -34
- package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/cache-utils.d.ts +0 -11
- package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +0 -180
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +0 -64
- package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/resource-utils.d.ts +0 -12
- package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/debug/utils.d.ts +0 -9
- package/unstable-preview-types/-private/debug/utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/document.d.ts +0 -155
- package/unstable-preview-types/-private/document.d.ts.map +0 -1
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +0 -179
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +0 -19
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +0 -31
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +0 -463
- package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +0 -101
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +0 -101
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/network/request-cache.d.ts +0 -109
- package/unstable-preview-types/-private/network/request-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +0 -289
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +0 -92
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +0 -172
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +0 -32
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +0 -276
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +0 -145
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts +0 -203
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +0 -118
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/unstable-preview-types/-private/store-service.d.ts +0 -1601
- package/unstable-preview-types/-private/store-service.d.ts.map +0 -1
- package/unstable-preview-types/-private/store-service.type-test.d.ts +0 -4
- package/unstable-preview-types/-private/store-service.type-test.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/coerce-id.d.ts +0 -10
- package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +0 -9
- package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +0 -4
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +0 -4
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +0 -4
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/unstable-preview-types/-private.d.ts.map +0 -1
- package/unstable-preview-types/-types/overview.d.ts +0 -21
- package/unstable-preview-types/-types/overview.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +0 -110
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/ds-model.d.ts +0 -25
- package/unstable-preview-types/-types/q/ds-model.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/identifier.d.ts +0 -193
- package/unstable-preview-types/-types/q/identifier.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/promise-proxies.d.ts +0 -4
- package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +0 -36
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/record-instance.d.ts +0 -29
- package/unstable-preview-types/-types/q/record-instance.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/schema-service.d.ts +0 -354
- package/unstable-preview-types/-types/q/schema-service.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/store.d.ts +0 -38
- package/unstable-preview-types/-types/q/store.d.ts.map +0 -1
- package/unstable-preview-types/configure.d.ts.map +0 -1
- package/unstable-preview-types/index.d.ts.map +0 -1
- package/unstable-preview-types/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -124,11 +124,11 @@ import RequestManager from '@ember-data/request';
|
|
|
124
124
|
import { CacheHandler } from '@ember-data/store';
|
|
125
125
|
import Fetch from '@ember-data/request/fetch';
|
|
126
126
|
|
|
127
|
-
export default
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
export default {
|
|
128
|
+
create() {
|
|
129
|
+
return new RequestManager()
|
|
130
|
+
.use([Fetch])
|
|
131
|
+
.useCache(CacheHandler);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
```
|
package/addon-main.cjs
CHANGED
package/dist/-private.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo } from "./configure-BfLLW6GY.js";
|
|
1
|
+
export * from '@warp-drive/core/store/-private';
|
package/dist/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { setupSignals } from '@warp-drive/core/configure';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
import '@
|
|
3
|
-
import '@
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
|
+
import { setupSignals } from '@warp-drive/core/configure';
|
|
4
|
+
export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from '@warp-drive/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* <p align="center">
|
|
8
|
+
* <img
|
|
9
|
+
* class="project-logo"
|
|
10
|
+
* src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
|
|
11
|
+
* alt="EmberData Store"
|
|
12
|
+
* width="240px"
|
|
13
|
+
* title="EmberData Store"
|
|
14
|
+
* />
|
|
15
|
+
* </p>
|
|
16
|
+
*
|
|
17
|
+
* This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
|
|
18
|
+
*
|
|
19
|
+
* A [Store](https://api.emberjs.com/ember-data/release/classes/Store) coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
|
|
20
|
+
* and sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).
|
|
21
|
+
*
|
|
22
|
+
* Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
|
|
23
|
+
*
|
|
24
|
+
* ## Installation
|
|
25
|
+
*
|
|
26
|
+
* If you have installed `ember-data` then you already have this package installed.
|
|
27
|
+
* Otherwise you can install it using your javascript package manager of choice.
|
|
28
|
+
* For instance with [pnpm](https://pnpm.io/)
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
* pnpm add @ember-data/store
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* After installing you will want to configure your first `Store`. Read more below
|
|
35
|
+
* for how to create and configure stores for your application.
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* ## 🔨 Creating A Store
|
|
39
|
+
*
|
|
40
|
+
* 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)
|
|
41
|
+
* to store data **in-memory**, add a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to fetch data from a source,
|
|
42
|
+
* and implement `instantiateRecord` to tell the store how to display the data for individual resources.
|
|
43
|
+
*
|
|
44
|
+
* > **Note**
|
|
45
|
+
* > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
|
|
46
|
+
* > and `instantiateRecord` are configured for you by default.
|
|
47
|
+
*
|
|
48
|
+
* ### Configuring A Cache
|
|
49
|
+
*
|
|
50
|
+
* To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
|
|
51
|
+
* caches may better fit your data. You can author your own cache by creating one that
|
|
52
|
+
* conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
|
|
53
|
+
*
|
|
54
|
+
* The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
|
|
55
|
+
* After installing it, we can configure the store to use this cache.
|
|
56
|
+
*
|
|
57
|
+
* ```js
|
|
58
|
+
* import Store from '@ember-data/store';
|
|
59
|
+
* import Cache from '@ember-data/json-api';
|
|
60
|
+
*
|
|
61
|
+
* class extends Store {
|
|
62
|
+
* createCache(storeWrapper) {
|
|
63
|
+
* return new Cache(storeWrapper);
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Now that we have a `cache` let's setup something to handle fetching
|
|
69
|
+
* and saving data via our API.
|
|
70
|
+
*
|
|
71
|
+
* > **Note**
|
|
72
|
+
* > The `ember-data` package automatically includes and configures
|
|
73
|
+
* > the `@ember-data/json-api` cache for you.
|
|
74
|
+
*
|
|
75
|
+
* ### Handling Requests
|
|
76
|
+
*
|
|
77
|
+
* When *Ember***Data** needs to fetch or save data it will pass that request to your application's `RequestManager` for fulfillment. How this fulfillment occurs (in-memory, device storage, via single or multiple API requests, etc.) is then up to the registered request handlers.
|
|
78
|
+
*
|
|
79
|
+
* To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
|
|
80
|
+
*
|
|
81
|
+
* > **Note**
|
|
82
|
+
* > 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/emberjs/data/tree/main/packages/request#handling-requests).
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* import Store from '@ember-data/store';
|
|
86
|
+
* import RequestManager from '@ember-data/request';
|
|
87
|
+
* import Fetch from '@ember-data/request/fetch';
|
|
88
|
+
*
|
|
89
|
+
* export default class extends Store {
|
|
90
|
+
* requestManager = new RequestManager()
|
|
91
|
+
* .use([Fetch]);
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* **Using RequestManager as a Service**
|
|
96
|
+
*
|
|
97
|
+
* Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
|
|
98
|
+
*
|
|
99
|
+
* *app/services/request.js*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import RequestManager from '@ember-data/request';
|
|
102
|
+
* import Fetch from '@ember-data/request/fetch';
|
|
103
|
+
*
|
|
104
|
+
* export default {
|
|
105
|
+
* create() {
|
|
106
|
+
* return new RequestManager()
|
|
107
|
+
* .use([Fetch])
|
|
108
|
+
* .useCache(CacheHandler);
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* *app/services/store.js*
|
|
114
|
+
* ```ts
|
|
115
|
+
* import Store from '@ember-data/store';
|
|
116
|
+
* import { service } from '@ember/service';
|
|
117
|
+
*
|
|
118
|
+
* export default class extends Store {
|
|
119
|
+
* @service('request') requestManager
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
*
|
|
124
|
+
* ### Presenting Data from the Cache
|
|
125
|
+
*
|
|
126
|
+
* Now that we have a source and a cache for our data, we need to configure how
|
|
127
|
+
* the Store delivers that data back to our application. We do this via the hook
|
|
128
|
+
* [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
|
|
129
|
+
* which allows us to transform the data for a resource before handing it to the application.
|
|
130
|
+
*
|
|
131
|
+
* A naive way to present the data would be to return it as JSON. Typically instead
|
|
132
|
+
* this hook will be used to add reactivity and make each unique resource a singleton,
|
|
133
|
+
* ensuring that if the cache updates our presented data will reflect the new state.
|
|
134
|
+
*
|
|
135
|
+
* Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
|
|
136
|
+
* to provide minimal read-only reactive state for simple resources.
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* import Store, { recordIdentifierFor } from '@ember-data/store';
|
|
140
|
+
* import { TrackedObject } from 'tracked-built-ins';
|
|
141
|
+
*
|
|
142
|
+
* class extends Store {
|
|
143
|
+
* instantiateRecord(identifier) {
|
|
144
|
+
* const { cache, notifications } = this;
|
|
145
|
+
*
|
|
146
|
+
* // create a TrackedObject with our attributes, id and type
|
|
147
|
+
* const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
|
|
148
|
+
* record.type = identifier.type;
|
|
149
|
+
* record.id = identifier.id;
|
|
150
|
+
*
|
|
151
|
+
* notifications.subscribe(identifier, (_, change) => {
|
|
152
|
+
* if (change === 'attributes') {
|
|
153
|
+
* Object.assign(record, cache.peek(identifier));
|
|
154
|
+
* }
|
|
155
|
+
* });
|
|
156
|
+
*
|
|
157
|
+
* return record;
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* Because `instantiateRecord` is opaque to the nature of the record, an implementation
|
|
163
|
+
* can be anything from a fairly simple object to a robust proxy that intelligently links
|
|
164
|
+
* together associated records through relationships.
|
|
165
|
+
*
|
|
166
|
+
* This also enables creating a record that separates `edit` flows from `create` flows
|
|
167
|
+
* entirely. A record class might choose to implement a `checkout`method that gives access
|
|
168
|
+
* to an editable instance while the primary record continues to be read-only and reflect
|
|
169
|
+
* only persisted (non-mutated) state.
|
|
170
|
+
*
|
|
171
|
+
* Typically you will choose an existing record implementation such as `@ember-data/model`
|
|
172
|
+
* for your application.
|
|
173
|
+
*
|
|
174
|
+
* Because of the boundaries around instantiation and the cache, record implementations
|
|
175
|
+
* should be capable of interop both with each other and with any `Cache`. Due to this,
|
|
176
|
+
* if needed an application can utilize multiple record implementations and multiple cache
|
|
177
|
+
* implementations either to support enhanced features for only a subset of records or to
|
|
178
|
+
* be able to incrementally migrate from one record/cache to another record or cache.
|
|
179
|
+
*
|
|
180
|
+
* > **Note**
|
|
181
|
+
* > The `ember-data` package automatically includes the `@ember-data/model`
|
|
182
|
+
* > package and configures it for you.
|
|
183
|
+
*
|
|
184
|
+
* @module
|
|
185
|
+
*/
|
|
186
|
+
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_TRACKING_PACKAGE)) {
|
|
187
|
+
let hasEmberDataTracking = false;
|
|
188
|
+
if (macroCondition(dependencySatisfies('@ember-data/tracking', '*'))) {
|
|
189
|
+
hasEmberDataTracking = true;
|
|
190
|
+
// @ts-expect-error
|
|
191
|
+
const {
|
|
192
|
+
buildSignalConfig
|
|
193
|
+
} = importSync('@ember-data/tracking');
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
195
|
+
setupSignals(buildSignalConfig);
|
|
196
|
+
}
|
|
197
|
+
const message = [`Using WarpDrive with EmberJS requires configuring it to use Ember's reactivity system.`, `Previously this was provided by installing the package '@ember-data/tracking', but this package is now deprecated.`, ``, `To resolve this deprecation, follow these steps:`, hasEmberDataTracking ? `- remove "@ember-data/tracking" and (if needed) "@ember-data-types/tracking" from your project in both your package.json and tsconfig.json` : false, `- add "@warp-drive/ember" to your project in both your package.json and tsconfig.json`, '- add the following import to your app.js file:', '', '\t```', `\timport '@warp-drive/ember/install';`, '\t```', ``, '- mark this deprecation as resolved in your project by adding the following to your WarpDrive config in ember-cli-build.js:', '', '\t```', '\tconst { setConfig } = await import("@warp-drive/build-config");', '\tsetConfig(app, __dirname, {', '\t deprecations: {', '\t DEPRECATE_TRACKING_PACKAGE: false,', '\t },', '\t});', '\t```', ``, `For more information, see the Package Unification RFC: https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/`].filter(l => l !== false).join('\n');
|
|
198
|
+
deprecate(message, false, {
|
|
199
|
+
id: 'warp-drive.deprecate-tracking-package',
|
|
200
|
+
until: '6.0.0',
|
|
201
|
+
for: 'warp-drive',
|
|
202
|
+
since: {
|
|
203
|
+
enabled: '5.3.4',
|
|
204
|
+
available: '4.13'
|
|
205
|
+
},
|
|
206
|
+
url: 'https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package'
|
|
207
|
+
});
|
|
208
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/store",
|
|
3
|
-
"version": "5.6.0-beta.
|
|
3
|
+
"version": "5.6.0-beta.2",
|
|
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"
|
|
@@ -33,20 +33,17 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@embroider/macros": "^1.16.12",
|
|
36
|
-
"@warp-drive/
|
|
36
|
+
"@warp-drive/core": "5.6.0-beta.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"ember-
|
|
40
|
-
"@ember-
|
|
41
|
-
"@ember-data/request-utils": "5.6.0-beta.0",
|
|
42
|
-
"@warp-drive/core-types": "5.6.0-beta.0",
|
|
43
|
-
"@ember-data/tracking": "5.6.0-beta.0"
|
|
39
|
+
"@ember-data/tracking": "5.6.0-beta.2",
|
|
40
|
+
"@ember/test-waiters": "^3.1.0 || ^4.0.0"
|
|
44
41
|
},
|
|
45
42
|
"peerDependenciesMeta": {
|
|
46
43
|
"@ember-data/tracking": {
|
|
47
44
|
"optional": true
|
|
48
45
|
},
|
|
49
|
-
"ember-
|
|
46
|
+
"@ember/test-waiters": {
|
|
50
47
|
"optional": true
|
|
51
48
|
}
|
|
52
49
|
},
|
|
@@ -55,20 +52,12 @@
|
|
|
55
52
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
56
53
|
"@babel/preset-env": "^7.26.9",
|
|
57
54
|
"@babel/preset-typescript": "^7.27.0",
|
|
58
|
-
"@
|
|
59
|
-
"@ember-data/
|
|
60
|
-
"@
|
|
61
|
-
"@warp-drive/core-types": "5.6.0-beta.0",
|
|
62
|
-
"@warp-drive/internal-config": "5.6.0-beta.0",
|
|
63
|
-
"@ember-data/tracking": "5.6.0-beta.0",
|
|
64
|
-
"decorator-transforms": "^2.3.0",
|
|
55
|
+
"@warp-drive/internal-config": "5.6.0-beta.2",
|
|
56
|
+
"@ember-data/tracking": "5.6.0-beta.2",
|
|
57
|
+
"@ember/test-waiters": "^4.1.0",
|
|
65
58
|
"ember-source": "~6.3.0",
|
|
66
|
-
"expect-type": "^1.2.1",
|
|
67
59
|
"typescript": "^5.8.3",
|
|
68
|
-
"vite": "^
|
|
69
|
-
},
|
|
70
|
-
"engines": {
|
|
71
|
-
"node": ">= 18.20.8"
|
|
60
|
+
"vite": "^7.0.0"
|
|
72
61
|
},
|
|
73
62
|
"volta": {
|
|
74
63
|
"extends": "../../package.json"
|
|
@@ -1,33 +1,4 @@
|
|
|
1
1
|
declare module '@ember-data/store/-private' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { Store, storeFor } from '@ember-data/store/-private/store-service';
|
|
6
|
-
export { recordIdentifierFor } from '@ember-data/store/-private/caches/instance-cache';
|
|
7
|
-
export { CacheHandler, type StoreRequestContext } from '@ember-data/store/-private/cache-handler/handler';
|
|
8
|
-
export { type CachePolicy } from '@ember-data/store/-private/cache-handler/types';
|
|
9
|
-
export { isStableIdentifier, isDocumentIdentifier } from '@ember-data/store/-private/caches/identifier-cache';
|
|
10
|
-
export { constructResource } from '@ember-data/store/-private/utils/construct-resource';
|
|
11
|
-
export type { ReactiveDocument as Document } from '@ember-data/store/-private/document';
|
|
12
|
-
export type { InstanceCache } from '@ember-data/store/-private/caches/instance-cache';
|
|
13
|
-
export type { FindRecordQuery, Request, SaveRecordMutation, RequestCacheRequestState, RequestStateService, } from '@ember-data/store/-private/network/request-cache';
|
|
14
|
-
export type { CreateRecordProperties } from '@ember-data/store/-private/store-service';
|
|
15
|
-
export { coerceId, ensureStringId } from '@ember-data/store/-private/utils/coerce-id';
|
|
16
|
-
export type { NativeProxy } from '@ember-data/store/-private/record-arrays/native-proxy-type-fix';
|
|
17
|
-
export { IdentifierArray as LiveArray, Collection as CollectionRecordArray, SOURCE, MUTATE, } from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
18
|
-
export { RecordArrayManager, fastPush } from '@ember-data/store/-private/managers/record-array-manager';
|
|
19
|
-
export { _clearCaches } from '@ember-data/store/-private/caches/instance-cache';
|
|
20
|
-
export { peekCache, removeRecordDataFor } from '@ember-data/store/-private/caches/cache-utils';
|
|
21
|
-
export { setRecordIdentifier, StoreMap } from '@ember-data/store/-private/caches/instance-cache';
|
|
22
|
-
export { setCacheFor } from '@ember-data/store/-private/caches/cache-utils';
|
|
23
|
-
export { normalizeModelName as _deprecatingNormalize } from '@ember-data/store/-private/utils/normalize-model-name';
|
|
24
|
-
export type { StoreRequestInput } from '@ember-data/store/-private/cache-handler/handler';
|
|
25
|
-
export { RelatedCollection } from '@ember-data/store/-private/record-arrays/many-array';
|
|
26
|
-
export { log, logGroup } from '@ember-data/store/-private/debug/utils';
|
|
27
|
-
export { getPromiseState, type PromiseState } from '@ember-data/store/-private/new-core-tmp/promise-state';
|
|
28
|
-
export { getRequestState, type RequestLoadingState, type RequestCacheRequestState as RequestState, } from '@ember-data/store/-private/new-core-tmp/request-state';
|
|
29
|
-
export { createMemo, type SignalHooks } from '@ember-data/store/-private/new-core-tmp/reactivity/configure';
|
|
30
|
-
export { memoized, gate, entangleSignal, defineSignal, defineNonEnumerableSignal, } from '@ember-data/store/-private/new-core-tmp/reactivity/signal';
|
|
31
|
-
export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal, } from '@ember-data/store/-private/new-core-tmp/reactivity/internal';
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=-private.d.ts.map
|
|
2
|
+
export * from "@warp-drive/core/store/-private";
|
|
3
|
+
|
|
4
|
+
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
declare module '@ember-data/store/configure' {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
3
|
+
* Provides a configuration API for the reactivity system
|
|
4
|
+
* that WarpDrive should use.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
9
8
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export { setupSignals } from '@ember-data/store/-private/new-core-tmp/reactivity/configure';
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=configure.d.ts.map
|
|
9
|
+
* Configures the signals implementation to use. Supports multiple
|
|
10
|
+
* implementations simultaneously.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @param {function} buildConfig - a function that takes options and returns a configuration object
|
|
14
|
+
*/
|
|
15
|
+
export { setupSignals } from "@warp-drive/core/configure";
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -1,229 +1,7 @@
|
|
|
1
|
-
/// <reference path="./types.d.ts" />
|
|
2
1
|
/// <reference path="./configure.d.ts" />
|
|
3
2
|
/// <reference path="./-private.d.ts" />
|
|
4
|
-
/// <reference path="
|
|
5
|
-
/// <reference path="./-types/q/store.d.ts" />
|
|
6
|
-
/// <reference path="./-types/q/identifier.d.ts" />
|
|
7
|
-
/// <reference path="./-types/q/promise-proxies.d.ts" />
|
|
8
|
-
/// <reference path="./-types/q/schema-service.d.ts" />
|
|
9
|
-
/// <reference path="./-types/q/record-instance.d.ts" />
|
|
10
|
-
/// <reference path="./-types/q/record-data-json-api.d.ts" />
|
|
11
|
-
/// <reference path="./-types/q/cache-capabilities-manager.d.ts" />
|
|
12
|
-
/// <reference path="./-types/q/ds-model.d.ts" />
|
|
13
|
-
/// <reference path="./-private/store-service.d.ts" />
|
|
14
|
-
/// <reference path="./-private/store-service.type-test.d.ts" />
|
|
15
|
-
/// <reference path="./-private/document.d.ts" />
|
|
16
|
-
/// <reference path="./-private/caches/cache-utils.d.ts" />
|
|
17
|
-
/// <reference path="./-private/caches/resource-utils.d.ts" />
|
|
18
|
-
/// <reference path="./-private/caches/instance-cache.d.ts" />
|
|
19
|
-
/// <reference path="./-private/caches/identifier-cache.d.ts" />
|
|
20
|
-
/// <reference path="./-private/legacy-model-support/shim-model-class.d.ts" />
|
|
21
|
-
/// <reference path="./-private/legacy-model-support/record-reference.d.ts" />
|
|
22
|
-
/// <reference path="./-private/managers/notification-manager.d.ts" />
|
|
23
|
-
/// <reference path="./-private/managers/record-array-manager.d.ts" />
|
|
24
|
-
/// <reference path="./-private/managers/cache-capabilities-manager.d.ts" />
|
|
25
|
-
/// <reference path="./-private/managers/cache-manager.d.ts" />
|
|
26
|
-
/// <reference path="./-private/new-core-tmp/request-state.d.ts" />
|
|
27
|
-
/// <reference path="./-private/new-core-tmp/promise-state.d.ts" />
|
|
28
|
-
/// <reference path="./-private/new-core-tmp/reactivity/internal.d.ts" />
|
|
29
|
-
/// <reference path="./-private/new-core-tmp/reactivity/signal.d.ts" />
|
|
30
|
-
/// <reference path="./-private/new-core-tmp/reactivity/configure.d.ts" />
|
|
31
|
-
/// <reference path="./-private/debug/utils.d.ts" />
|
|
32
|
-
/// <reference path="./-private/network/request-cache.d.ts" />
|
|
33
|
-
/// <reference path="./-private/cache-handler/utils.d.ts" />
|
|
34
|
-
/// <reference path="./-private/cache-handler/types.d.ts" />
|
|
35
|
-
/// <reference path="./-private/cache-handler/handler.d.ts" />
|
|
36
|
-
/// <reference path="./-private/utils/normalize-model-name.d.ts" />
|
|
37
|
-
/// <reference path="./-private/utils/uuid-polyfill.d.ts" />
|
|
38
|
-
/// <reference path="./-private/utils/construct-resource.d.ts" />
|
|
39
|
-
/// <reference path="./-private/utils/is-non-empty-string.d.ts" />
|
|
40
|
-
/// <reference path="./-private/utils/coerce-id.d.ts" />
|
|
41
|
-
/// <reference path="./-private/record-arrays/identifier-array.d.ts" />
|
|
42
|
-
/// <reference path="./-private/record-arrays/many-array.d.ts" />
|
|
43
|
-
/// <reference path="./-private/record-arrays/native-proxy-type-fix.d.ts" />
|
|
3
|
+
/// <reference path="./types.d.ts" />
|
|
44
4
|
declare module '@ember-data/store' {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* class="project-logo"
|
|
49
|
-
* src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
|
|
50
|
-
* alt="EmberData Store"
|
|
51
|
-
* width="240px"
|
|
52
|
-
* title="EmberData Store"
|
|
53
|
-
* />
|
|
54
|
-
* </p>
|
|
55
|
-
*
|
|
56
|
-
* This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
|
|
57
|
-
*
|
|
58
|
-
* A [Store](https://api.emberjs.com/ember-data/release/classes/Store) coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
|
|
59
|
-
* and sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).
|
|
60
|
-
*
|
|
61
|
-
* Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
|
|
62
|
-
*
|
|
63
|
-
* ## Installation
|
|
64
|
-
*
|
|
65
|
-
* If you have installed `ember-data` then you already have this package installed.
|
|
66
|
-
* Otherwise you can install it using your javascript package manager of choice.
|
|
67
|
-
* For instance with [pnpm](https://pnpm.io/)
|
|
68
|
-
*
|
|
69
|
-
* ```
|
|
70
|
-
* pnpm add @ember-data/store
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* After installing you will want to configure your first `Store`. Read more below
|
|
74
|
-
* for how to create and configure stores for your application.
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* ## 🔨 Creating A Store
|
|
78
|
-
*
|
|
79
|
-
* 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)
|
|
80
|
-
* to store data **in-memory**, add a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to fetch data from a source,
|
|
81
|
-
* and implement `instantiateRecord` to tell the store how to display the data for individual resources.
|
|
82
|
-
*
|
|
83
|
-
* > **Note**
|
|
84
|
-
* > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
|
|
85
|
-
* > and `instantiateRecord` are configured for you by default.
|
|
86
|
-
*
|
|
87
|
-
* ### Configuring A Cache
|
|
88
|
-
*
|
|
89
|
-
* To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
|
|
90
|
-
* caches may better fit your data. You can author your own cache by creating one that
|
|
91
|
-
* conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
|
|
92
|
-
*
|
|
93
|
-
* The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
|
|
94
|
-
* After installing it, we can configure the store to use this cache.
|
|
95
|
-
*
|
|
96
|
-
* ```js
|
|
97
|
-
* import Store from '@ember-data/store';
|
|
98
|
-
* import Cache from '@ember-data/json-api';
|
|
99
|
-
*
|
|
100
|
-
* class extends Store {
|
|
101
|
-
* createCache(storeWrapper) {
|
|
102
|
-
* return new Cache(storeWrapper);
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* Now that we have a `cache` let's setup something to handle fetching
|
|
108
|
-
* and saving data via our API.
|
|
109
|
-
*
|
|
110
|
-
* > **Note**
|
|
111
|
-
* > The `ember-data` package automatically includes and configures
|
|
112
|
-
* > the `@ember-data/json-api` cache for you.
|
|
113
|
-
*
|
|
114
|
-
* ### Handling Requests
|
|
115
|
-
*
|
|
116
|
-
* When *Ember***Data** needs to fetch or save data it will pass that request to your application's `RequestManager` for fulfillment. How this fulfillment occurs (in-memory, device storage, via single or multiple API requests, etc.) is then up to the registered request handlers.
|
|
117
|
-
*
|
|
118
|
-
* To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
|
|
119
|
-
*
|
|
120
|
-
* > **Note**
|
|
121
|
-
* > 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/emberjs/data/tree/main/packages/request#handling-requests).
|
|
122
|
-
*
|
|
123
|
-
* ```ts
|
|
124
|
-
* import Store from '@ember-data/store';
|
|
125
|
-
* import RequestManager from '@ember-data/request';
|
|
126
|
-
* import Fetch from '@ember-data/request/fetch';
|
|
127
|
-
*
|
|
128
|
-
* export default class extends Store {
|
|
129
|
-
* requestManager = new RequestManager()
|
|
130
|
-
* .use([Fetch]);
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* **Using RequestManager as a Service**
|
|
135
|
-
*
|
|
136
|
-
* Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
|
|
137
|
-
*
|
|
138
|
-
* *app/services/request.js*
|
|
139
|
-
* ```ts
|
|
140
|
-
* import RequestManager from '@ember-data/request';
|
|
141
|
-
* import Fetch from '@ember-data/request/fetch';
|
|
142
|
-
*
|
|
143
|
-
* export default class extends RequestManager {
|
|
144
|
-
* constructor(createArgs) {
|
|
145
|
-
* super(createArgs);
|
|
146
|
-
* this.use([Fetch]);
|
|
147
|
-
* }
|
|
148
|
-
* }
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* *app/services/store.js*
|
|
152
|
-
* ```ts
|
|
153
|
-
* import Store from '@ember-data/store';
|
|
154
|
-
* import { service } from '@ember/service';
|
|
155
|
-
*
|
|
156
|
-
* export default class extends Store {
|
|
157
|
-
* @service('request') requestManager
|
|
158
|
-
* }
|
|
159
|
-
* ```
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* ### Presenting Data from the Cache
|
|
163
|
-
*
|
|
164
|
-
* Now that we have a source and a cache for our data, we need to configure how
|
|
165
|
-
* the Store delivers that data back to our application. We do this via the hook
|
|
166
|
-
* [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
|
|
167
|
-
* which allows us to transform the data for a resource before handing it to the application.
|
|
168
|
-
*
|
|
169
|
-
* A naive way to present the data would be to return it as JSON. Typically instead
|
|
170
|
-
* this hook will be used to add reactivity and make each unique resource a singleton,
|
|
171
|
-
* ensuring that if the cache updates our presented data will reflect the new state.
|
|
172
|
-
*
|
|
173
|
-
* Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
|
|
174
|
-
* to provide minimal read-only reactive state for simple resources.
|
|
175
|
-
*
|
|
176
|
-
* ```ts
|
|
177
|
-
* import Store, { recordIdentifierFor } from '@ember-data/store';
|
|
178
|
-
* import { TrackedObject } from 'tracked-built-ins';
|
|
179
|
-
*
|
|
180
|
-
* class extends Store {
|
|
181
|
-
* instantiateRecord(identifier) {
|
|
182
|
-
* const { cache, notifications } = this;
|
|
183
|
-
*
|
|
184
|
-
* // create a TrackedObject with our attributes, id and type
|
|
185
|
-
* const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
|
|
186
|
-
* record.type = identifier.type;
|
|
187
|
-
* record.id = identifier.id;
|
|
188
|
-
*
|
|
189
|
-
* notifications.subscribe(identifier, (_, change) => {
|
|
190
|
-
* if (change === 'attributes') {
|
|
191
|
-
* Object.assign(record, cache.peek(identifier));
|
|
192
|
-
* }
|
|
193
|
-
* });
|
|
194
|
-
*
|
|
195
|
-
* return record;
|
|
196
|
-
* }
|
|
197
|
-
* }
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* Because `instantiateRecord` is opaque to the nature of the record, an implementation
|
|
201
|
-
* can be anything from a fairly simple object to a robust proxy that intelligently links
|
|
202
|
-
* together associated records through relationships.
|
|
203
|
-
*
|
|
204
|
-
* This also enables creating a record that separates `edit` flows from `create` flows
|
|
205
|
-
* entirely. A record class might choose to implement a `checkout`method that gives access
|
|
206
|
-
* to an editable instance while the primary record continues to be read-only and reflect
|
|
207
|
-
* only persisted (non-mutated) state.
|
|
208
|
-
*
|
|
209
|
-
* Typically you will choose an existing record implementation such as `@ember-data/model`
|
|
210
|
-
* for your application.
|
|
211
|
-
*
|
|
212
|
-
* Because of the boundaries around instantiation and the cache, record implementations
|
|
213
|
-
* should be capable of interop both with each other and with any `Cache`. Due to this,
|
|
214
|
-
* if needed an application can utilize multiple record implementations and multiple cache
|
|
215
|
-
* implementations either to support enhanced features for only a subset of records or to
|
|
216
|
-
* be able to incrementally migrate from one record/cache to another record or cache.
|
|
217
|
-
*
|
|
218
|
-
* > **Note**
|
|
219
|
-
* > The `ember-data` package automatically includes the `@ember-data/model`
|
|
220
|
-
* > package and configures it for you.
|
|
221
|
-
*
|
|
222
|
-
* @module @ember-data/store
|
|
223
|
-
* @main @ember-data/store
|
|
224
|
-
*/
|
|
225
|
-
export { Store as default, type StoreRequestContext, CacheHandler, type Document, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor, } from '@ember-data/store/-private';
|
|
226
|
-
export type { DocumentCacheOperation, CacheOperation, NotificationType, } from '@ember-data/store/-private/managers/notification-manager';
|
|
227
|
-
export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource, } from '@ember-data/store/-private/caches/identifier-cache';
|
|
228
|
-
}
|
|
229
|
-
//# sourceMappingURL=index.d.ts.map
|
|
5
|
+
export { Store as default, 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
|
+
|
|
7
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare module '@ember-data/store/types' {
|
|
2
|
-
export type { CacheCapabilitiesManager } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions, } from '@ember-data/store/-types/q/store';
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=types.d.ts.map
|
|
2
|
+
export type { CacheCapabilitiesManager, ModelSchema, SchemaService, BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions } from "@warp-drive/core/types";
|
|
3
|
+
|
|
4
|
+
}
|
package/dist/-private.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|