@ember-data/store 5.4.0-alpha.30 → 5.4.0-alpha.32

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.
Files changed (70) hide show
  1. package/addon/cache-handler-oB00-31L.js.map +1 -1
  2. package/package.json +11 -10
  3. package/unstable-preview-types/-private/cache-handler.d.ts +99 -0
  4. package/unstable-preview-types/-private/cache-handler.d.ts.map +1 -0
  5. package/unstable-preview-types/-private/caches/cache-utils.d.ts +9 -0
  6. package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +1 -0
  7. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +180 -0
  8. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -0
  9. package/unstable-preview-types/-private/caches/instance-cache.d.ts +61 -0
  10. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -0
  11. package/unstable-preview-types/-private/caches/resource-utils.d.ts +10 -0
  12. package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +1 -0
  13. package/unstable-preview-types/-private/document.d.ts +144 -0
  14. package/unstable-preview-types/-private/document.d.ts.map +1 -0
  15. package/unstable-preview-types/-private/index.d.ts +16 -0
  16. package/unstable-preview-types/-private/index.d.ts.map +1 -0
  17. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +177 -0
  18. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -0
  19. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +17 -0
  20. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
  21. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +27 -0
  22. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
  23. package/unstable-preview-types/-private/managers/cache-manager.d.ts +440 -0
  24. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -0
  25. package/unstable-preview-types/-private/managers/notification-manager.d.ts +96 -0
  26. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -0
  27. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +95 -0
  28. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -0
  29. package/unstable-preview-types/-private/network/request-cache.d.ts +107 -0
  30. package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -0
  31. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +135 -0
  32. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -0
  33. package/unstable-preview-types/-private/store-service.d.ts +1552 -0
  34. package/unstable-preview-types/-private/store-service.d.ts.map +1 -0
  35. package/unstable-preview-types/-private/utils/coerce-id.d.ts +8 -0
  36. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +1 -0
  37. package/unstable-preview-types/-private/utils/construct-resource.d.ts +8 -0
  38. package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +1 -0
  39. package/unstable-preview-types/-private/utils/identifier-debug-consts.d.ts +5 -0
  40. package/unstable-preview-types/-private/utils/identifier-debug-consts.d.ts.map +1 -0
  41. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +2 -0
  42. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +1 -0
  43. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +2 -0
  44. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +1 -0
  45. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +2 -0
  46. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +1 -0
  47. package/unstable-preview-types/-private.d.ts +2 -0
  48. package/unstable-preview-types/-private.d.ts.map +1 -0
  49. package/unstable-preview-types/-types/overview.d.ts +19 -0
  50. package/unstable-preview-types/-types/overview.d.ts.map +1 -0
  51. package/unstable-preview-types/-types/q/cache-store-wrapper.d.ts +105 -0
  52. package/unstable-preview-types/-types/q/cache-store-wrapper.d.ts.map +1 -0
  53. package/unstable-preview-types/-types/q/cache.d.ts +45 -0
  54. package/unstable-preview-types/-types/q/cache.d.ts.map +1 -0
  55. package/unstable-preview-types/-types/q/ds-model.d.ts +13 -0
  56. package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -0
  57. package/unstable-preview-types/-types/q/identifier.d.ts +169 -0
  58. package/unstable-preview-types/-types/q/identifier.d.ts.map +1 -0
  59. package/unstable-preview-types/-types/q/promise-proxies.d.ts +2 -0
  60. package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +1 -0
  61. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +34 -0
  62. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +1 -0
  63. package/unstable-preview-types/-types/q/record-instance.d.ts +27 -0
  64. package/unstable-preview-types/-types/q/record-instance.d.ts.map +1 -0
  65. package/unstable-preview-types/-types/q/schema-service.d.ts +212 -0
  66. package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -0
  67. package/unstable-preview-types/-types/q/store.d.ts +15 -0
  68. package/unstable-preview-types/-types/q/store.d.ts.map +1 -0
  69. package/unstable-preview-types/index.d.ts +185 -0
  70. package/unstable-preview-types/index.d.ts.map +1 -0
@@ -0,0 +1,212 @@
1
+ /**
2
+ @module @ember-data/store
3
+ */
4
+ import type { RecordIdentifier } from '@warp-drive/core-types/identifier';
5
+ import type { AttributesSchema, RelationshipsSchema } from '@warp-drive/core-types/schema';
6
+ export interface FieldSchema {
7
+ type: string | null;
8
+ name: string;
9
+ kind: 'attribute' | 'hasMany' | 'belongsTo' | 'field' | 'resource' | 'collection' | 'derived' | 'object' | 'array' | '@id' | '@local';
10
+ options?: Record<string, unknown>;
11
+ }
12
+ /**
13
+ * The SchemaService provides the ability to query for information about the structure
14
+ * of any resource type.
15
+ *
16
+ * Applications can provide any implementation of the SchemaService they please so long
17
+ * as it conforms to this interface.
18
+ *
19
+ * The design of the service means that schema information could be lazily populated,
20
+ * derived-on-demand, or progressively enhanced during the course of an application's runtime.
21
+ * The primary requirement is merely that any information the service needs to correctly
22
+ * respond to an inquest is available by the time it is asked.
23
+ *
24
+ * The `@ember-data/model` package provides an implementation of this service which
25
+ * makes use of your model classes as the source of information to respond to queries
26
+ * about resource schema. While this is useful, this may not be ideal for your application.
27
+ * For instance, Schema information could be sideloaded or pre-flighted for API calls,
28
+ * resulting in no need to bundle and ship potentially large and expensive JSON
29
+ * or large Javascript based Models to pull information from.
30
+ *
31
+ * To register a custom schema implementation, extend the store service or
32
+ * lookup and register the schema service first thing on app-boot. Example below
33
+ * shows extending the service.
34
+ *
35
+ * ```ts
36
+ * import Store from '@ember-data/store';
37
+ * import CustomSchemas from './custom-schemas';
38
+ *
39
+ * export default class extends Store {
40
+ * constructor(...args) {
41
+ * super(...args);
42
+ * this.registerSchema(new CustomSchemas());
43
+ * }
44
+ * }
45
+ * ```
46
+ *
47
+ * At runtime, both the `Store` and the `CacheCapabilitiesManager` provide
48
+ * access to this service via the `schema` property.
49
+ *
50
+ * ```ts
51
+ * export default class extends Component {
52
+ * @service store;
53
+ *
54
+ * get attributes() {
55
+ * return this.store
56
+ * .schema
57
+ * .attributesDefinitionFor(this.args.dataType);
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * Note: there can only be one schema service registered at a time.
63
+ * If you register a new schema service, the old one will be replaced.
64
+ *
65
+ * If you would like to inherit from another schema service, you can do so by
66
+ * using typical class inheritance patterns OR by accessing the existing
67
+ * schema service at runtime before replacing it with your own, and then
68
+ * having your own delegate to it when needed.
69
+ *
70
+ * @class <Interface> SchemaService
71
+ * @public
72
+ */
73
+ export interface SchemaService {
74
+ /**
75
+ * Queries whether the schema-definition-service recognizes `type` as a resource type
76
+ *
77
+ * @method doesTypeExist
78
+ * @public
79
+ * @param {string} type
80
+ * @return {boolean}
81
+ */
82
+ doesTypeExist(type: string): boolean;
83
+ fields({ type }: {
84
+ type: string;
85
+ }): Map<string, FieldSchema>;
86
+ /**
87
+ * Returns definitions for all properties of the specified resource
88
+ * that are considered "attributes". Generally these are properties
89
+ * that are not related to book-keeping state on the client and do
90
+ * not represent a linkage to another resource.
91
+ *
92
+ * The return value should be a dictionary of key:value pairs
93
+ * where the `key` is the attribute or property's name and `value`
94
+ * is an object with at least the property `name` which should also
95
+ * match `key`.
96
+ *
97
+ * Optionally, this object may also specify `type`, which should
98
+ * be a string reference to a `transform`, and `options` which
99
+ * should be dictionary in which any key:value pairs are permissable.
100
+ *
101
+ * For instance, when using `@ember-data/model`, the following attribute
102
+ * definition:
103
+ *
104
+ * ```ts
105
+ * class extends Model {
106
+ * @attr('string', { defaultValue: 'hello' }) greeting;
107
+ * @attr('date') birthday;
108
+ * @attr firstName;
109
+ * }
110
+ * ```
111
+ *
112
+ * Would be returned as:
113
+ *
114
+ * ```js
115
+ * {
116
+ * greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
117
+ * birthday: { name: 'birthday', type: 'date' },
118
+ * firstName: { name: 'firstName' }
119
+ * }
120
+ * ```
121
+ *
122
+ * @method attributesDefinitionFor
123
+ * @public
124
+ * @param {RecordIdentifier|{ type: string }} identifier
125
+ * @return {AttributesSchema}
126
+ */
127
+ attributesDefinitionFor(identifier: RecordIdentifier | {
128
+ type: string;
129
+ }): AttributesSchema;
130
+ /**
131
+ * Returns definitions for all properties of the specified resource
132
+ * that are considered "relationships". Generally these are properties
133
+ * that represent a linkage to another resource.
134
+ *
135
+ * The return value should be a dictionary of key:value pairs
136
+ * where the `key` is the relationship or property's name and `value`
137
+ * is an object with at least the following properties:
138
+ *
139
+ * - `name` which should also match the `key` used in the dictionary.
140
+ * - `kind` which should be either `belongsTo` or `hasMany`
141
+ * - `type` which should be the related resource's string "type"
142
+ * - `options` which should be a dictionary allowing any key but with
143
+ * at least the below keys present.
144
+ *
145
+ * - `options.async` a boolean representing whether data for this relationship is
146
+ * typically loaded on-demand.
147
+ * - `options.inverse` a string or null representing the field name / key of the
148
+ * corresponding relationship on the inverse resource.
149
+ *
150
+ * Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
151
+ *
152
+ * - `options.polymorphic` a boolean representing whether multiple resource types
153
+ * can be used to satisfy this relationship.
154
+ * - `options.as` a string representing the abstract type that the concrete side of
155
+ * a relationship must specify when fulfilling a polymorphic inverse.
156
+ *
157
+ * For example, the following Model using @ember-data/model would generate this relationships
158
+ * definition by default:
159
+ *
160
+ * ```js
161
+ * class User extends Model {
162
+ * @belongsTo('user', { async: false, inverse: null }) bestFriend;
163
+ * @hasMany('user', { async: true, inverse: 'friends' }) friends;
164
+ * @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
165
+ * }
166
+ * ```
167
+ *
168
+ * Which would be returned as
169
+ *
170
+ * ```js
171
+ * {
172
+ * bestFriend: {
173
+ * name: 'bestFriend',
174
+ * kind: 'belongsTo',
175
+ * type: 'user',
176
+ * options: {
177
+ * async: false,
178
+ * inverse: null
179
+ * }
180
+ * },
181
+ * friends: {
182
+ * name: 'friends',
183
+ * kind: 'hasMany',
184
+ * type: 'user',
185
+ * options: {
186
+ * async: true,
187
+ * inverse: 'friends'
188
+ * }
189
+ * },
190
+ * pets: {
191
+ * name: 'pets',
192
+ * kind: 'hasMany',
193
+ * type: 'pet',
194
+ * options: {
195
+ * async: false,
196
+ * polymorphic: true,
197
+ * inverse: 'owner'
198
+ * }
199
+ * },
200
+ * }
201
+ * ```
202
+ *
203
+ * @method relationshipsDefinitionFor
204
+ * @public
205
+ * @param {RecordIdentifier|{ type: string }} identifier
206
+ * @return {RelationshipsSchema}
207
+ */
208
+ relationshipsDefinitionFor(identifier: RecordIdentifier | {
209
+ type: string;
210
+ }): RelationshipsSchema;
211
+ }
212
+ //# sourceMappingURL=schema-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-service.d.ts","sourceRoot":"","sources":["../../../src/-types/q/schema-service.ts"],"names":[],"mappings":"AAAA;;EAEE;AAEF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,WAAW,GACX,SAAS,GACT,WAAW,GACX,OAAO,GACP,UAAU,GACV,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAErC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,uBAAuB,CAAC,UAAU,EAAE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB,CAAC;IAE3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6EG;IACH,0BAA0B,CAAC,UAAU,EAAE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,mBAAmB,CAAC;CAClG"}
@@ -0,0 +1,15 @@
1
+ import type { Value } from '@warp-drive/core-types/json/raw';
2
+ export interface BaseFinderOptions {
3
+ reload?: boolean;
4
+ backgroundReload?: boolean;
5
+ include?: string | string[];
6
+ adapterOptions?: Record<string, unknown>;
7
+ }
8
+ export interface FindRecordOptions extends BaseFinderOptions {
9
+ preload?: Record<string, Value>;
10
+ }
11
+ export type QueryOptions = {
12
+ [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;
13
+ };
14
+ export type FindAllOptions = BaseFinderOptions;
15
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/-types/q/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AACD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,YAAY,GAAG;KACxB,CAAC,IAAI,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;CAClG,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * <p align="center">
3
+ * <img
4
+ * class="project-logo"
5
+ * src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
6
+ * alt="EmberData Store"
7
+ * width="240px"
8
+ * title="EmberData Store"
9
+ * />
10
+ * </p>
11
+ *
12
+ * This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
13
+ *
14
+ * 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),
15
+ * 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).
16
+ *
17
+ * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
18
+ *
19
+ * ## Installation
20
+ *
21
+ * If you have installed `ember-data` then you already have this package installed.
22
+ * Otherwise you can install it using your javascript package manager of choice.
23
+ * For instance with [pnpm](https://pnpm.io/)
24
+ *
25
+ * ```
26
+ * pnpm add @ember-data/store
27
+ * ```
28
+ *
29
+ * After installing you will want to configure your first `Store`. Read more below
30
+ * for how to create and configure stores for your application.
31
+ *
32
+ *
33
+ * ## 🔨 Creating A Store
34
+ *
35
+ * 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)
36
+ * 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,
37
+ * and implement `instantiateRecord` to tell the store how to display the data for individual resources.
38
+ *
39
+ * > **Note**
40
+ * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
41
+ * > and `instantiateRecord` are configured for you by default.
42
+ *
43
+ * ### Configuring A Cache
44
+ *
45
+ * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
46
+ * caches may better fit your data. You can author your own cache by creating one that
47
+ * conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
48
+ *
49
+ * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
50
+ * After installing it, we can configure the store to use this cache.
51
+ *
52
+ * ```js
53
+ * import Store from '@ember-data/store';
54
+ * import Cache from '@ember-data/json-api';
55
+ *
56
+ * class extends Store {
57
+ * createCache(storeWrapper) {
58
+ * return new Cache(storeWrapper);
59
+ * }
60
+ * }
61
+ * ```
62
+ *
63
+ * Now that we have a `cache` let's setup something to handle fetching
64
+ * and saving data via our API.
65
+ *
66
+ * > **Note**
67
+ * > The `ember-data` package automatically includes and configures
68
+ * > the `@ember-data/json-api` cache for you.
69
+ *
70
+ * ### Handling Requests
71
+ *
72
+ * 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.
73
+ *
74
+ * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
75
+ *
76
+ * > **Note**
77
+ * > 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).
78
+ *
79
+ * ```ts
80
+ * import Store from '@ember-data/store';
81
+ * import RequestManager from '@ember-data/request';
82
+ * import Fetch from '@ember-data/request/fetch';
83
+ *
84
+ * export default class extends Store {
85
+ * constructor() {
86
+ * super(...arguments);
87
+ * this.requestManager = new RequestManager();
88
+ * this.requestManager.use([Fetch]);
89
+ * }
90
+ * }
91
+ * ```
92
+ *
93
+ * **Using RequestManager as a Service**
94
+ *
95
+ * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
96
+ *
97
+ * *app/services/request.js*
98
+ * ```ts
99
+ * import RequestManager from '@ember-data/request';
100
+ * import Fetch from '@ember-data/request/fetch';
101
+ *
102
+ * export default class extends RequestManager {
103
+ * constructor(createArgs) {
104
+ * super(createArgs);
105
+ * this.use([Fetch]);
106
+ * }
107
+ * }
108
+ * ```
109
+ *
110
+ * *app/services/store.js*
111
+ * ```ts
112
+ * import Store from '@ember-data/store';
113
+ * import { service } from '@ember/service';
114
+ *
115
+ * export default class extends Store {
116
+ * @service('request') requestManager
117
+ * }
118
+ * ```
119
+ *
120
+ *
121
+ * ### Presenting Data from the Cache
122
+ *
123
+ * Now that we have a source and a cach for our data, we need to configure how
124
+ * the Store delivers that data back to our application. We do this via the hook
125
+ * [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
126
+ * which allows us to transform the data for a resource before handing it to the application.
127
+ *
128
+ * A naive way to present the data would be to return it as JSON. Typically instead
129
+ * this hook will be used to add reactivity and make each unique resource a singleton,
130
+ * ensuring that if the cache updates our presented data will reflect the new state.
131
+ *
132
+ * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
133
+ * to provide minimal read-only reactive state for simple resources.
134
+ *
135
+ * ```ts
136
+ * import Store, { recordIdentifierFor } from '@ember-data/store';
137
+ * import { TrackedObject } from 'tracked-built-ins';
138
+ *
139
+ * class extends Store {
140
+ * instantiateRecord(identifier) {
141
+ * const { cache, notifications } = this;
142
+ *
143
+ * // create a TrackedObject with our attributes, id and type
144
+ * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
145
+ * record.type = identifier.type;
146
+ * record.id = identifier.id;
147
+ *
148
+ * notifications.subscribe(identifier, (_, change) => {
149
+ * if (change === 'attributes') {
150
+ * Object.assign(record, cache.peek(identifier));
151
+ * }
152
+ * });
153
+ *
154
+ * return record;
155
+ * }
156
+ * }
157
+ * ```
158
+ *
159
+ * Because `instantiateRecord` is opaque to the nature of the record, an implementation
160
+ * can be anything from a fairly simple object to a robust proxy that intelligently links
161
+ * together associated records through relationships.
162
+ *
163
+ * This also enables creating a record that separates `edit` flows from `create` flows
164
+ * entirely. A record class might choose to implement a `checkout`method that gives access
165
+ * to an editable instance while the primary record continues to be read-only and reflect
166
+ * only persisted (non-mutated) state.
167
+ *
168
+ * Typically you will choose an existing record implementation such as `@ember-data/model`
169
+ * for your application.
170
+ *
171
+ * Because of the boundaries around instantiation and the cache, record implementations
172
+ * should be capable of interop both with each other and with any `Cache`. Due to this,
173
+ * if needed an application can utilize multiple record implementations and multiple cache
174
+ * implementations either to support enhanced features for only a subset of records or to
175
+ * be able to incrementally migrate from one record/cache to another record or cache.
176
+ *
177
+ * > **Note**
178
+ * > The `ember-data` package automatically includes the `@ember-data/model`
179
+ * > package and configures it for you.
180
+ *
181
+ * @module @ember-data/store
182
+ * @main @ember-data/store
183
+ */
184
+ export { Store as default, CacheHandler, type LifetimesService, setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, recordIdentifierFor, storeFor, } from './-private';
185
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsLG;AAEH,OAAO,EACL,KAAK,IAAI,OAAO,EAChB,YAAY,EACZ,KAAK,gBAAgB,EACrB,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,QAAQ,GACT,MAAM,YAAY,CAAC"}