@ember-data/store 5.9.0-alpha.21 → 5.9.0-alpha.22

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.
@@ -0,0 +1 @@
1
+ export * from "@warp-drive/core/store/-private";
package/dist/-private.js CHANGED
@@ -1 +1 @@
1
- export * from '@warp-drive/core/store/-private';
1
+ export * from "@warp-drive/core/store/-private"
@@ -0,0 +1,2 @@
1
+ import { setupSignals } from "@warp-drive/core/configure";
2
+ export { setupSignals };
package/dist/configure.js CHANGED
@@ -1 +1,3 @@
1
- export { setupSignals } from '@warp-drive/core/configure';
1
+ import { setupSignals } from "@warp-drive/core/configure";
2
+
3
+ export { setupSignals };
@@ -0,0 +1,2 @@
1
+ import { CacheHandler, CacheOperation, CachePolicy, Document, DocumentCacheOperation, NotificationType, Store, StoreRequestContext, StoreRequestInput, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from "@warp-drive/core";
2
+ export { CacheHandler, type CacheOperation, type CachePolicy, type Document, type DocumentCacheOperation, type NotificationType, type StoreRequestContext, type StoreRequestInput, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor };
package/dist/index.js CHANGED
@@ -1,196 +1,220 @@
1
- import { deprecate } from '@ember/debug';
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';
4
- import { setupSignals } from '@warp-drive/core/configure';
5
- import { peekTransient } from '@warp-drive/core/types/-private';
1
+ import { deprecate } from "@ember/debug";
2
+ import { dependencySatisfies, getGlobalConfig, importSync, macroCondition } from "@embroider/macros";
3
+ import { CacheHandler, Store, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from "@warp-drive/core";
4
+ import { setupSignals } from "@warp-drive/core/configure";
5
+ import { peekTransient } from "@warp-drive/core/types/-private";
6
6
 
7
+ //#region src/index.ts
7
8
  /**
8
- * This package provides [*Ember***Data**](https://github.com/warp-drive-data/warp-drive/)'s `Store` class.
9
- *
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}.
12
- *
13
- * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
14
- *
15
- * ## 🔨 Creating A Store
16
- *
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,
19
- * and implement `instantiateRecord` to tell the store how to display the data for individual resources.
20
- *
21
- * > **Note**
22
- * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
23
- * > and `instantiateRecord` are configured for you by default.
24
- *
25
- * ### Configuring A Cache
26
- *
27
- * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
28
- * caches may better fit your data. You can author your own cache by creating one that
29
- * conforms to the {@link Cache | spec}.
30
- *
31
- * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
32
- * After installing it, we can configure the store to use this cache.
33
- *
34
- * ```js
35
- * import Store from '@ember-data/store';
36
- * import Cache from '@ember-data/json-api';
37
- *
38
- * class extends Store {
39
- * createCache(storeWrapper) {
40
- * return new Cache(storeWrapper);
41
- * }
42
- * }
43
- * ```
44
- *
45
- * Now that we have a `cache` let's setup something to handle fetching
46
- * and saving data via our API.
47
- *
48
- * > **Note**
49
- * > The `ember-data` package automatically includes and configures
50
- * > the `@ember-data/json-api` cache for you.
51
- *
52
- * ### Handling Requests
53
- *
54
- * 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.
55
- *
56
- * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
57
- *
58
- * > **Note**
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).
60
- *
61
- * ```ts
62
- * import Store from '@ember-data/store';
63
- * import RequestManager from '@ember-data/request';
64
- * import Fetch from '@ember-data/request/fetch';
65
- *
66
- * export default class extends Store {
67
- * requestManager = new RequestManager()
68
- * .use([Fetch]);
69
- * }
70
- * ```
71
- *
72
- * **Using RequestManager as a Service**
73
- *
74
- * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
75
- *
76
- * *app/services/request.js*
77
- * ```ts
78
- * import RequestManager from '@ember-data/request';
79
- * import Fetch from '@ember-data/request/fetch';
80
- *
81
- * export default {
82
- * create() {
83
- * return new RequestManager()
84
- * .use([Fetch])
85
- * .useCache(CacheHandler);
86
- * }
87
- * }
88
- * ```
89
- *
90
- * *app/services/store.js*
91
- * ```ts
92
- * import Store from '@ember-data/store';
93
- * import { service } from '@ember/service';
94
- *
95
- * export default class extends Store {
96
- * @service('request') requestManager
97
- * }
98
- * ```
99
- *
100
- *
101
- * ### Presenting Data from the Cache
102
- *
103
- * Now that we have a source and a cache for our data, we need to configure how
104
- * the Store delivers that data back to our application. We do this via the {@link Store.instantiateRecord | instantiateRecord hook}
105
- * which allows us to transform the data for a resource before handing it to the application.
106
- *
107
- * A naive way to present the data would be to return it as JSON. Typically instead
108
- * this hook will be used to add reactivity and make each unique resource a singleton,
109
- * ensuring that if the cache updates our presented data will reflect the new state.
110
- *
111
- * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
112
- * to provide minimal read-only reactive state for simple resources.
113
- *
114
- * ```ts
115
- * import Store, { recordIdentifierFor } from '@ember-data/store';
116
- * import { TrackedObject } from 'tracked-built-ins';
117
- *
118
- * class extends Store {
119
- * instantiateRecord(identifier) {
120
- * const { cache, notifications } = this;
121
- *
122
- * // create a TrackedObject with our attributes, id and type
123
- * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
124
- * record.type = identifier.type;
125
- * record.id = identifier.id;
126
- *
127
- * notifications.subscribe(identifier, (_, change) => {
128
- * if (change === 'attributes') {
129
- * Object.assign(record, cache.peek(identifier));
130
- * }
131
- * });
132
- *
133
- * return record;
134
- * }
135
- * }
136
- * ```
137
- *
138
- * Because `instantiateRecord` is opaque to the nature of the record, an implementation
139
- * can be anything from a fairly simple object to a robust proxy that intelligently links
140
- * together associated records through relationships.
141
- *
142
- * This also enables creating a record that separates `edit` flows from `create` flows
143
- * entirely. A record class might choose to implement a `checkout`method that gives access
144
- * to an editable instance while the primary record continues to be read-only and reflect
145
- * only persisted (non-mutated) state.
146
- *
147
- * Typically you will choose an existing record implementation such as `@ember-data/model`
148
- * for your application.
149
- *
150
- * Because of the boundaries around instantiation and the cache, record implementations
151
- * should be capable of interop both with each other and with any `Cache`. Due to this,
152
- * if needed an application can utilize multiple record implementations and multiple cache
153
- * implementations either to support enhanced features for only a subset of records or to
154
- * be able to incrementally migrate from one record/cache to another record or cache.
155
- *
156
- * > **Note**
157
- * > The `ember-data` package automatically includes the `@ember-data/model`
158
- * > package and configures it for you.
159
- *
160
- * @module
161
- */
9
+ * This package provides [*Ember***Data**](https://github.com/warp-drive-data/warp-drive/)'s `Store` class.
10
+ *
11
+ * A {@link Store} coordinates interaction between your application, a {@link Cache},
12
+ * and sources of data (such as your API or a local persistence layer) accessed via a {@link RequestManager}.
13
+ *
14
+ * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
15
+ *
16
+ * ## 🔨 Creating A Store
17
+ *
18
+ * To use a `Store` we will need to do few things: add a {@link Cache}
19
+ * to store data **in-memory**, add a {@link Handler} to fetch data from a source,
20
+ * and implement `instantiateRecord` to tell the store how to display the data for individual resources.
21
+ *
22
+ * > **Note**
23
+ * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
24
+ * > and `instantiateRecord` are configured for you by default.
25
+ *
26
+ * ### Configuring A Cache
27
+ *
28
+ * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
29
+ * caches may better fit your data. You can author your own cache by creating one that
30
+ * conforms to the {@link Cache | spec}.
31
+ *
32
+ * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
33
+ * After installing it, we can configure the store to use this cache.
34
+ *
35
+ * ```js
36
+ * import Store from '@ember-data/store';
37
+ * import Cache from '@ember-data/json-api';
38
+ *
39
+ * class extends Store {
40
+ * createCache(storeWrapper) {
41
+ * return new Cache(storeWrapper);
42
+ * }
43
+ * }
44
+ * ```
45
+ *
46
+ * Now that we have a `cache` let's setup something to handle fetching
47
+ * and saving data via our API.
48
+ *
49
+ * > **Note**
50
+ * > The `ember-data` package automatically includes and configures
51
+ * > the `@ember-data/json-api` cache for you.
52
+ *
53
+ * ### Handling Requests
54
+ *
55
+ * 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.
56
+ *
57
+ * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
58
+ *
59
+ * > **Note**
60
+ * > 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).
61
+ *
62
+ * ```ts
63
+ * import Store from '@ember-data/store';
64
+ * import RequestManager from '@ember-data/request';
65
+ * import Fetch from '@ember-data/request/fetch';
66
+ *
67
+ * export default class extends Store {
68
+ * requestManager = new RequestManager()
69
+ * .use([Fetch]);
70
+ * }
71
+ * ```
72
+ *
73
+ * **Using RequestManager as a Service**
74
+ *
75
+ * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
76
+ *
77
+ * *app/services/request.js*
78
+ * ```ts
79
+ * import RequestManager from '@ember-data/request';
80
+ * import Fetch from '@ember-data/request/fetch';
81
+ *
82
+ * export default {
83
+ * create() {
84
+ * return new RequestManager()
85
+ * .use([Fetch])
86
+ * .useCache(CacheHandler);
87
+ * }
88
+ * }
89
+ * ```
90
+ *
91
+ * *app/services/store.js*
92
+ * ```ts
93
+ * import Store from '@ember-data/store';
94
+ * import { service } from '@ember/service';
95
+ *
96
+ * export default class extends Store {
97
+ * @service('request') requestManager
98
+ * }
99
+ * ```
100
+ *
101
+ *
102
+ * ### Presenting Data from the Cache
103
+ *
104
+ * Now that we have a source and a cache for our data, we need to configure how
105
+ * the Store delivers that data back to our application. We do this via the {@link Store.instantiateRecord | instantiateRecord hook}
106
+ * which allows us to transform the data for a resource before handing it to the application.
107
+ *
108
+ * A naive way to present the data would be to return it as JSON. Typically instead
109
+ * this hook will be used to add reactivity and make each unique resource a singleton,
110
+ * ensuring that if the cache updates our presented data will reflect the new state.
111
+ *
112
+ * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
113
+ * to provide minimal read-only reactive state for simple resources.
114
+ *
115
+ * ```ts
116
+ * import Store, { recordIdentifierFor } from '@ember-data/store';
117
+ * import { TrackedObject } from 'tracked-built-ins';
118
+ *
119
+ * class extends Store {
120
+ * instantiateRecord(identifier) {
121
+ * const { cache, notifications } = this;
122
+ *
123
+ * // create a TrackedObject with our attributes, id and type
124
+ * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
125
+ * record.type = identifier.type;
126
+ * record.id = identifier.id;
127
+ *
128
+ * notifications.subscribe(identifier, (_, change) => {
129
+ * if (change === 'attributes') {
130
+ * Object.assign(record, cache.peek(identifier));
131
+ * }
132
+ * });
133
+ *
134
+ * return record;
135
+ * }
136
+ * }
137
+ * ```
138
+ *
139
+ * Because `instantiateRecord` is opaque to the nature of the record, an implementation
140
+ * can be anything from a fairly simple object to a robust proxy that intelligently links
141
+ * together associated records through relationships.
142
+ *
143
+ * This also enables creating a record that separates `edit` flows from `create` flows
144
+ * entirely. A record class might choose to implement a `checkout`method that gives access
145
+ * to an editable instance while the primary record continues to be read-only and reflect
146
+ * only persisted (non-mutated) state.
147
+ *
148
+ * Typically you will choose an existing record implementation such as `@ember-data/model`
149
+ * for your application.
150
+ *
151
+ * Because of the boundaries around instantiation and the cache, record implementations
152
+ * should be capable of interop both with each other and with any `Cache`. Due to this,
153
+ * if needed an application can utilize multiple record implementations and multiple cache
154
+ * implementations either to support enhanced features for only a subset of records or to
155
+ * be able to incrementally migrate from one record/cache to another record or cache.
156
+ *
157
+ * > **Note**
158
+ * > The `ember-data` package automatically includes the `@ember-data/model`
159
+ * > package and configures it for you.
160
+ *
161
+ * @module
162
+ */
162
163
  if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_TRACKING_PACKAGE)) {
163
- let hasEmberDataTracking = false;
164
- let hasWarpDriveEmber = false;
165
- let hasRegisteredFromEmberPackage = false;
166
- if (macroCondition(dependencySatisfies('@warp-drive/ember', '*'))) {
167
- hasWarpDriveEmber = true;
168
- hasRegisteredFromEmberPackage = peekTransient('signalHooks') !== null;
169
- }
170
- if (macroCondition(dependencySatisfies('@ember-data/tracking', '*'))) {
171
- hasEmberDataTracking = true;
172
- if (!hasRegisteredFromEmberPackage) {
173
- // @ts-expect-error
174
- const {
175
- buildSignalConfig
176
- } = importSync('@ember-data/tracking');
177
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
178
- setupSignals(buildSignalConfig);
179
- }
180
- }
181
-
182
- // we should probably still print here if @ember-data/tracking is present
183
- if (!hasRegisteredFromEmberPackage) {
184
- 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, hasWarpDriveEmber ? false : `- add "@warp-drive/ember" to your project in your package.json (and run install)`, '- 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');
185
- deprecate(message, false, {
186
- id: 'warp-drive.deprecate-tracking-package',
187
- until: '6.0.0',
188
- for: 'warp-drive',
189
- since: {
190
- enabled: '5.3.4',
191
- available: '4.13'
192
- },
193
- url: 'https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package'
194
- });
195
- }
164
+ let hasEmberDataTracking = false;
165
+ let hasWarpDriveEmber = false;
166
+ let hasRegisteredFromEmberPackage = false;
167
+ if (macroCondition(dependencySatisfies("@warp-drive/ember", "*"))) {
168
+ hasWarpDriveEmber = true;
169
+ hasRegisteredFromEmberPackage = peekTransient("signalHooks") !== null;
170
+ }
171
+ if (macroCondition(dependencySatisfies("@ember-data/tracking", "*"))) {
172
+ hasEmberDataTracking = true;
173
+ if (!hasRegisteredFromEmberPackage) {
174
+ const { buildSignalConfig } = importSync("@ember-data/tracking");
175
+ setupSignals(buildSignalConfig);
176
+ }
177
+ }
178
+ if (!hasRegisteredFromEmberPackage) {
179
+ const message = [
180
+ `Using WarpDrive with EmberJS requires configuring it to use Ember's reactivity system.`,
181
+ `Previously this was provided by installing the package '@ember-data/tracking', but this package is now deprecated.`,
182
+ ``,
183
+ `To resolve this deprecation, follow these steps:`,
184
+ hasEmberDataTracking ? `- remove "@ember-data/tracking" and (if needed) "@ember-data-types/tracking" from your project in both your package.json and tsconfig.json` : false,
185
+ hasWarpDriveEmber ? false : `- add "@warp-drive/ember" to your project in your package.json (and run install)`,
186
+ "- add the following import to your app.js file:",
187
+ "",
188
+ " ```",
189
+ `\timport '@warp-drive/ember/install';`,
190
+ " ```",
191
+ ``,
192
+ "- mark this deprecation as resolved in your project by adding the following to your WarpDrive config in ember-cli-build.js:",
193
+ "",
194
+ " ```",
195
+ " const { setConfig } = await import(\"@warp-drive/build-config\");",
196
+ " setConfig(app, __dirname, {",
197
+ " deprecations: {",
198
+ " DEPRECATE_TRACKING_PACKAGE: false,",
199
+ " },",
200
+ " });",
201
+ " ```",
202
+ ``,
203
+ `For more information, see the Package Unification RFC: https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/`
204
+ ].filter((l) => l !== false).join("\n");
205
+ deprecate(message, false, {
206
+ id: "warp-drive.deprecate-tracking-package",
207
+ until: "6.0.0",
208
+ for: "warp-drive",
209
+ since: {
210
+ enabled: "5.3.4",
211
+ available: "4.13"
212
+ },
213
+ url: "https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package"
214
+ });
215
+ }
196
216
  }
217
+
218
+ //#endregion
219
+ export { CacheHandler, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor };
220
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["deprecate","dependencySatisfies","importSync","macroCondition","getGlobalConfig","Store","setupSignals","peekTransient","default","CacheHandler","recordIdentifierFor","storeFor","setIdentifierGenerationMethod","setIdentifierUpdateMethod","setIdentifierForgetMethod","setIdentifierResetMethod","setKeyInfoForResource","WarpDrive","deprecations","DEPRECATE_TRACKING_PACKAGE","hasEmberDataTracking","hasWarpDriveEmber","hasRegisteredFromEmberPackage","buildSignalConfig","message","filter","l","join","id","until","for","since","enabled","available","url"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * This package provides [*Ember***Data**](https://github.com/warp-drive-data/warp-drive/)'s `Store` class.\n *\n * A {@link Store} coordinates interaction between your application, a {@link Cache},\n * and sources of data (such as your API or a local persistence layer) accessed via a {@link RequestManager}.\n *\n * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.\n *\n * ## 🔨 Creating A Store\n *\n * To use a `Store` we will need to do few things: add a {@link Cache}\n * to store data **in-memory**, add a {@link Handler} to fetch data from a source,\n * and implement `instantiateRecord` to tell the store how to display the data for individual resources.\n *\n * > **Note**\n * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,\n * > and `instantiateRecord` are configured for you by default.\n *\n * ### Configuring A Cache\n *\n * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other\n * caches may better fit your data. You can author your own cache by creating one that\n * conforms to the {@link Cache | spec}.\n *\n * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.\n * After installing it, we can configure the store to use this cache.\n *\n * ```js\n * import Store from '@ember-data/store';\n * import Cache from '@ember-data/json-api';\n *\n * class extends Store {\n * createCache(storeWrapper) {\n * return new Cache(storeWrapper);\n * }\n * }\n * ```\n *\n * Now that we have a `cache` let's setup something to handle fetching\n * and saving data via our API.\n *\n * > **Note**\n * > The `ember-data` package automatically includes and configures\n * > the `@ember-data/json-api` cache for you.\n *\n * ### Handling Requests\n *\n * 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.\n *\n * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.\n *\n * > **Note**\n * > 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).\n *\n * ```ts\n * import Store from '@ember-data/store';\n * import RequestManager from '@ember-data/request';\n * import Fetch from '@ember-data/request/fetch';\n *\n * export default class extends Store {\n * requestManager = new RequestManager()\n * .use([Fetch]);\n * }\n * ```\n *\n * **Using RequestManager as a Service**\n *\n * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.\n *\n * *app/services/request.js*\n * ```ts\n * import RequestManager from '@ember-data/request';\n * import Fetch from '@ember-data/request/fetch';\n *\n * export default {\n * create() {\n * return new RequestManager()\n * .use([Fetch])\n * .useCache(CacheHandler);\n * }\n * }\n * ```\n *\n * *app/services/store.js*\n * ```ts\n * import Store from '@ember-data/store';\n * import { service } from '@ember/service';\n *\n * export default class extends Store {\n * @service('request') requestManager\n * }\n * ```\n *\n *\n * ### Presenting Data from the Cache\n *\n * Now that we have a source and a cache for our data, we need to configure how\n * the Store delivers that data back to our application. We do this via the {@link Store.instantiateRecord | instantiateRecord hook}\n * which allows us to transform the data for a resource before handing it to the application.\n *\n * A naive way to present the data would be to return it as JSON. Typically instead\n * this hook will be used to add reactivity and make each unique resource a singleton,\n * ensuring that if the cache updates our presented data will reflect the new state.\n *\n * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`\n * to provide minimal read-only reactive state for simple resources.\n *\n * ```ts\n * import Store, { recordIdentifierFor } from '@ember-data/store';\n * import { TrackedObject } from 'tracked-built-ins';\n *\n * class extends Store {\n * instantiateRecord(identifier) {\n * const { cache, notifications } = this;\n *\n * // create a TrackedObject with our attributes, id and type\n * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));\n * record.type = identifier.type;\n * record.id = identifier.id;\n *\n * notifications.subscribe(identifier, (_, change) => {\n * if (change === 'attributes') {\n * Object.assign(record, cache.peek(identifier));\n * }\n * });\n *\n * return record;\n * }\n * }\n * ```\n *\n * Because `instantiateRecord` is opaque to the nature of the record, an implementation\n * can be anything from a fairly simple object to a robust proxy that intelligently links\n * together associated records through relationships.\n *\n * This also enables creating a record that separates `edit` flows from `create` flows\n * entirely. A record class might choose to implement a `checkout`method that gives access\n * to an editable instance while the primary record continues to be read-only and reflect\n * only persisted (non-mutated) state.\n *\n * Typically you will choose an existing record implementation such as `@ember-data/model`\n * for your application.\n *\n * Because of the boundaries around instantiation and the cache, record implementations\n * should be capable of interop both with each other and with any `Cache`. Due to this,\n * if needed an application can utilize multiple record implementations and multiple cache\n * implementations either to support enhanced features for only a subset of records or to\n * be able to incrementally migrate from one record/cache to another record or cache.\n *\n * > **Note**\n * > The `ember-data` package automatically includes the `@ember-data/model`\n * > package and configures it for you.\n *\n * @module\n */\nimport { deprecate } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type RequestManager, Store } from '@warp-drive/core';\nimport { DEPRECATE_TRACKING_PACKAGE } from '@warp-drive/core/build-config/deprecations';\nimport { setupSignals } from '@warp-drive/core/configure';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Handler } from '@warp-drive/core/request';\nimport { peekTransient } from '@warp-drive/core/types/-private';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Cache } from '@warp-drive/core/types/cache';\n\nexport { Store as default };\n\nexport {\n type StoreRequestContext,\n CacheHandler,\n type Document,\n type CachePolicy,\n type StoreRequestInput,\n recordIdentifierFor,\n storeFor,\n type DocumentCacheOperation,\n type CacheOperation,\n type NotificationType,\n setIdentifierGenerationMethod,\n setIdentifierUpdateMethod,\n setIdentifierForgetMethod,\n setIdentifierResetMethod,\n setKeyInfoForResource,\n} from '@warp-drive/core';\n\nif (DEPRECATE_TRACKING_PACKAGE) {\n let hasEmberDataTracking = false;\n let hasWarpDriveEmber = false;\n let hasRegisteredFromEmberPackage = false;\n\n if (macroCondition(dependencySatisfies('@warp-drive/ember', '*'))) {\n hasWarpDriveEmber = true;\n hasRegisteredFromEmberPackage = peekTransient('signalHooks') !== null;\n }\n\n if (macroCondition(dependencySatisfies('@ember-data/tracking', '*'))) {\n hasEmberDataTracking = true;\n\n if (!hasRegisteredFromEmberPackage) {\n // @ts-expect-error\n const { buildSignalConfig } = importSync('@ember-data/tracking');\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n setupSignals(buildSignalConfig);\n }\n }\n\n // we should probably still print here if @ember-data/tracking is present\n if (!hasRegisteredFromEmberPackage) {\n const message = [\n `Using WarpDrive with EmberJS requires configuring it to use Ember's reactivity system.`,\n `Previously this was provided by installing the package '@ember-data/tracking', but this package is now deprecated.`,\n ``,\n `To resolve this deprecation, follow these steps:`,\n hasEmberDataTracking\n ? `- remove \"@ember-data/tracking\" and (if needed) \"@ember-data-types/tracking\" from your project in both your package.json and tsconfig.json`\n : false,\n hasWarpDriveEmber ? false : `- add \"@warp-drive/ember\" to your project in your package.json (and run install)`,\n '- add the following import to your app.js file:',\n '',\n '\\t```',\n `\\timport '@warp-drive/ember/install';`,\n '\\t```',\n ``,\n '- mark this deprecation as resolved in your project by adding the following to your WarpDrive config in ember-cli-build.js:',\n '',\n '\\t```',\n '\\tconst { setConfig } = await import(\"@warp-drive/build-config\");',\n '\\tsetConfig(app, __dirname, {',\n '\\t deprecations: {',\n '\\t DEPRECATE_TRACKING_PACKAGE: false,',\n '\\t },',\n '\\t});',\n '\\t```',\n ``,\n `For more information, see the Package Unification RFC: https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/`,\n ]\n .filter((l) => l !== false)\n .join('\\n');\n\n deprecate(message, false, {\n id: 'warp-drive.deprecate-tracking-package',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6LA,IAAAG,eAAAC,gBAAA,CAAA,CAAAa,UAAAC,aAAAC,0BAAA,GAAgC;CAC9B,IAAIC,uBAAuB;CAC3B,IAAIC,oBAAoB;CACxB,IAAIC,gCAAgC;CAEpC,IAAInB,eAAeF,oBAAoB,qBAAqB,GAAG,CAAC,GAAG;EACjEoB,oBAAoB;EACpBC,gCAAgCf,cAAc,aAAa,MAAM;CACnE;CAEA,IAAIJ,eAAeF,oBAAoB,wBAAwB,GAAG,CAAC,GAAG;EACpEmB,uBAAuB;EAEvB,IAAI,CAACE,+BAA+B;GAElC,MAAM,EAAEC,sBAAsBrB,WAAW,sBAAsB;GAE/DI,aAAaiB,iBAAiB;EAChC;CACF;CAGA,IAAI,CAACD,+BAA+B;EAClC,MAAME,UAAU;GACd;GACA;GACA;GACA;GACAJ,uBACI,+IACA;GACJC,oBAAoB,QAAQ;GAC5B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAAyH,CAC1H,CACEI,QAAQC,MAAMA,MAAM,KAAK,CAAC,CAC1BC,KAAK,IAAI;EAEZ3B,UAAUwB,SAAS,OAAO;GACxBI,IAAI;GACJC,OAAO;GACPC,KAAK;GACLC,OAAO;IACLC,SAAS;IACTC,WAAW;GACb;GACAC,KAAK;EACP,CAAC;CACH;AACF"}
@@ -0,0 +1,2 @@
1
+ import { BaseFinderOptions, CacheCapabilitiesManager, FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions, SchemaService } from "@warp-drive/core/types";
2
+ export type { BaseFinderOptions, CacheCapabilitiesManager, FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions, SchemaService };
package/dist/types.js CHANGED
@@ -1 +0,0 @@
1
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/store",
3
- "version": "5.9.0-alpha.21",
3
+ "version": "5.9.0-alpha.22",
4
4
  "description": "(Legacy) EmberData Store service which coordinates the cache with the network and presentation layers.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -13,12 +13,12 @@
13
13
  "license": "MIT",
14
14
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
15
15
  "files": [
16
- "unstable-preview-types",
17
16
  "addon-main.cjs",
18
17
  "dist",
19
18
  "README.md",
20
19
  "LICENSE.md",
21
- "logos"
20
+ "logos",
21
+ "unstable-preview-types"
22
22
  ],
23
23
  "exports": {
24
24
  ".": {
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@embroider/macros": "^1.20.6",
36
- "@warp-drive/core": "5.9.0-alpha.21"
36
+ "@warp-drive/core": "5.9.0-alpha.22"
37
37
  },
38
38
  "peerDependencies": {
39
- "@ember-data/tracking": "5.9.0-alpha.21",
39
+ "@ember-data/tracking": "5.9.0-alpha.22",
40
40
  "@ember/test-waiters": "^3.1.0 || ^4.0.0"
41
41
  },
42
42
  "peerDependenciesMeta": {
@@ -52,12 +52,12 @@
52
52
  "@babel/plugin-transform-typescript": "^7.28.0",
53
53
  "@babel/preset-env": "^7.28.3",
54
54
  "@babel/preset-typescript": "^7.27.1",
55
- "@ember-data/tracking": "5.9.0-alpha.21",
55
+ "@ember-data/tracking": "5.9.0-alpha.22",
56
56
  "@ember/test-waiters": "^4.1.1",
57
- "@warp-drive/internal-config": "5.9.0-alpha.21",
57
+ "@warp-drive/internal-config": "5.9.0-alpha.22",
58
58
  "ember-source": "~6.12.0",
59
- "typescript": "^5.9.3",
60
- "vite": "^7.3.1"
59
+ "tsdown": "^0.22.14",
60
+ "typescript": "^5.9.3"
61
61
  },
62
62
  "volta": {
63
63
  "extends": "../../package.json"
@@ -79,8 +79,9 @@
79
79
  },
80
80
  "scripts": {
81
81
  "lint": "eslint . --quiet --cache --cache-strategy=content",
82
- "build:pkg": "vite build",
82
+ "check:types": "tsc --noEmit",
83
+ "build:pkg": "node node_modules/tsdown/dist/run.mjs",
83
84
  "sync": "echo \"syncing\"",
84
- "start": "vite"
85
+ "start": "node node_modules/tsdown/dist/run.mjs --watch"
85
86
  }
86
87
  }
@@ -1,4 +1,3 @@
1
1
  declare module '@ember-data/store/-private' {
2
2
  export * from "@warp-drive/core/store/-private";
3
-
4
3
  }
@@ -1,17 +1,4 @@
1
1
  declare module '@ember-data/store/configure' {
2
- /**
3
- * Provides a configuration API for the reactivity system
4
- * that WarpDrive should use.
5
- *
6
- * @module
7
- */
8
- /**
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
-
2
+ import { setupSignals } from "@warp-drive/core/configure";
3
+ export { setupSignals };
17
4
  }
@@ -2,8 +2,6 @@
2
2
  /// <reference path="./types.d.ts" />
3
3
  /// <reference path="./-private.d.ts" />
4
4
  declare module '@ember-data/store' {
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";
8
-
5
+ import { CacheHandler, CacheOperation, CachePolicy, Document, DocumentCacheOperation, NotificationType, Store, StoreRequestContext, StoreRequestInput, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor } from "@warp-drive/core";
6
+ export { CacheHandler, type CacheOperation, type CachePolicy, type Document, type DocumentCacheOperation, type NotificationType, type StoreRequestContext, type StoreRequestInput, Store as default, recordIdentifierFor, setIdentifierForgetMethod, setIdentifierGenerationMethod, setIdentifierResetMethod, setIdentifierUpdateMethod, setKeyInfoForResource, storeFor };
9
7
  }
@@ -1,4 +1,4 @@
1
1
  declare module '@ember-data/store/types' {
2
- export type { CacheCapabilitiesManager, ModelSchema, SchemaService, BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions } from "@warp-drive/core/types";
3
-
2
+ import { BaseFinderOptions, CacheCapabilitiesManager, FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions, SchemaService } from "@warp-drive/core/types";
3
+ export type { BaseFinderOptions, CacheCapabilitiesManager, FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions, SchemaService };
4
4
  }