@ember-data/store 5.4.0-beta.2 → 5.4.0-beta.20

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 (105) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +13 -8
  3. package/addon-main.cjs +5 -0
  4. package/dist/-private.js +1 -0
  5. package/{addon → dist}/index.js +4 -1
  6. package/{addon → dist}/index.js.map +1 -1
  7. package/{addon/cache-handler-XLbbNJdo.js → dist/many-array-BwVo-2vv.js} +2519 -1207
  8. package/dist/many-array-BwVo-2vv.js.map +1 -0
  9. package/dist/types.js +0 -0
  10. package/dist/types.js.map +1 -0
  11. package/logos/NCC-1701-a-blue.svg +4 -0
  12. package/logos/NCC-1701-a-gold.svg +4 -0
  13. package/logos/NCC-1701-a-gold_100.svg +1 -0
  14. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  15. package/logos/NCC-1701-a.svg +4 -0
  16. package/logos/README.md +4 -0
  17. package/logos/docs-badge.svg +2 -0
  18. package/logos/github-header.svg +444 -0
  19. package/logos/social1.png +0 -0
  20. package/logos/social2.png +0 -0
  21. package/logos/warp-drive-logo-dark.svg +4 -0
  22. package/logos/warp-drive-logo-gold.svg +4 -0
  23. package/package.json +46 -65
  24. package/unstable-preview-types/-private/cache-handler/handler.d.ts +62 -0
  25. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -0
  26. package/unstable-preview-types/-private/cache-handler/types.d.ts +107 -0
  27. package/unstable-preview-types/-private/cache-handler/types.d.ts.map +1 -0
  28. package/unstable-preview-types/-private/cache-handler/utils.d.ts +34 -0
  29. package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +1 -0
  30. package/unstable-preview-types/-private/caches/cache-utils.d.ts +11 -0
  31. package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +1 -0
  32. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +180 -0
  33. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -0
  34. package/unstable-preview-types/-private/caches/instance-cache.d.ts +64 -0
  35. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -0
  36. package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -0
  37. package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +1 -0
  38. package/unstable-preview-types/-private/debug/utils.d.ts +9 -0
  39. package/unstable-preview-types/-private/debug/utils.d.ts.map +1 -0
  40. package/unstable-preview-types/-private/document.d.ts +155 -0
  41. package/unstable-preview-types/-private/document.d.ts.map +1 -0
  42. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +179 -0
  43. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -0
  44. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -0
  45. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
  46. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +31 -0
  47. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
  48. package/unstable-preview-types/-private/managers/cache-manager.d.ts +463 -0
  49. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -0
  50. package/unstable-preview-types/-private/managers/notification-manager.d.ts +101 -0
  51. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -0
  52. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +101 -0
  53. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -0
  54. package/unstable-preview-types/-private/network/request-cache.d.ts +109 -0
  55. package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -0
  56. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +150 -0
  57. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -0
  58. package/unstable-preview-types/-private/record-arrays/many-array.d.ts +199 -0
  59. package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +1 -0
  60. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +118 -0
  61. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
  62. package/unstable-preview-types/-private/store-service.d.ts +1595 -0
  63. package/unstable-preview-types/-private/store-service.d.ts.map +1 -0
  64. package/unstable-preview-types/-private/store-service.type-test.d.ts +4 -0
  65. package/unstable-preview-types/-private/store-service.type-test.d.ts.map +1 -0
  66. package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -0
  67. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +1 -0
  68. package/unstable-preview-types/-private/utils/construct-resource.d.ts +9 -0
  69. package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +1 -0
  70. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -0
  71. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +1 -0
  72. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -0
  73. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +1 -0
  74. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -0
  75. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +1 -0
  76. package/unstable-preview-types/-private.d.ts +28 -0
  77. package/unstable-preview-types/-private.d.ts.map +1 -0
  78. package/unstable-preview-types/-types/overview.d.ts +21 -0
  79. package/unstable-preview-types/-types/overview.d.ts.map +1 -0
  80. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +109 -0
  81. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -0
  82. package/unstable-preview-types/-types/q/ds-model.d.ts +25 -0
  83. package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -0
  84. package/unstable-preview-types/-types/q/identifier.d.ts +193 -0
  85. package/unstable-preview-types/-types/q/identifier.d.ts.map +1 -0
  86. package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -0
  87. package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +1 -0
  88. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -0
  89. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +1 -0
  90. package/unstable-preview-types/-types/q/record-instance.d.ts +29 -0
  91. package/unstable-preview-types/-types/q/record-instance.d.ts.map +1 -0
  92. package/unstable-preview-types/-types/q/schema-service.d.ts +366 -0
  93. package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -0
  94. package/unstable-preview-types/-types/q/store.d.ts +38 -0
  95. package/unstable-preview-types/-types/q/store.d.ts.map +1 -0
  96. package/unstable-preview-types/index.d.ts +223 -0
  97. package/unstable-preview-types/index.d.ts.map +1 -0
  98. package/unstable-preview-types/types.d.ts +7 -0
  99. package/unstable-preview-types/types.d.ts.map +1 -0
  100. package/addon/-private.js +0 -1
  101. package/addon/cache-handler-XLbbNJdo.js.map +0 -1
  102. package/addon-main.js +0 -93
  103. /package/{addon → dist}/-private.js.map +0 -0
  104. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  105. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
@@ -0,0 +1,366 @@
1
+ declare module '@ember-data/store/-types/q/schema-service' {
2
+ /**
3
+ @module @ember-data/store
4
+ */
5
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
6
+ import type { RecordIdentifier } from '@warp-drive/core-types/identifier';
7
+ import type { ObjectValue } from '@warp-drive/core-types/json/raw';
8
+ import type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';
9
+ import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema } from '@warp-drive/core-types/schema/fields';
10
+ export type AttributesSchema = Record<string, LegacyAttributeField>;
11
+ export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
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, implement the store's `createSchemaService`
32
+ * hook to return an instance of your service.
33
+ *
34
+ * ```ts
35
+ * import Store from '@ember-data/store';
36
+ * import CustomSchemas from './custom-schemas';
37
+ *
38
+ * export default class extends Store {
39
+ * createSchemaService() {
40
+ * return new CustomSchemas();
41
+ * }
42
+ * }
43
+ * ```
44
+ *
45
+ * At runtime, both the `Store` and the `CacheCapabilitiesManager` provide
46
+ * access to this service via the `schema` property.
47
+ *
48
+ * ```ts
49
+ * export default class extends Component {
50
+ * @service store;
51
+ *
52
+ * get fields() {
53
+ * return this.store
54
+ * .schema
55
+ * .fields(this.args.dataType);
56
+ * }
57
+ * }
58
+ * ```
59
+ *
60
+ * @class <Interface> SchemaService
61
+ * @public
62
+ */
63
+ export interface SchemaService {
64
+ /**
65
+ * DEPRECATED - use `hasResource` instead
66
+ *
67
+ * Queries whether the SchemaService recognizes `type` as a resource type
68
+ *
69
+ * @method doesTypeExist
70
+ * @public
71
+ * @deprecated
72
+ * @param {string} type
73
+ * @return {boolean}
74
+ */
75
+ doesTypeExist?(type: string): boolean;
76
+ /**
77
+ * Queries whether the SchemaService recognizes `type` as a resource type
78
+ *
79
+ * @method hasResource
80
+ * @public
81
+ * @param {StableRecordIdentifier|{ type: string }} resource
82
+ * @return {boolean}
83
+ */
84
+ hasResource(resource: {
85
+ type: string;
86
+ } | StableRecordIdentifier): boolean;
87
+ /**
88
+ * Queries whether the SchemaService recognizes `type` as a resource trait
89
+ *
90
+ * @method hasTrait
91
+ * @public
92
+ * @param {string} type
93
+ * @return {boolean}
94
+ */
95
+ hasTrait(type: string): boolean;
96
+ /**
97
+ * Queries whether the given resource has the given trait
98
+ *
99
+ * @method resourceHasTrait
100
+ * @public
101
+ * @param {StableRecordIdentifier|{ type: string }} resource
102
+ * @param {string} trait
103
+ * @return {boolean}
104
+ */
105
+ resourceHasTrait(resource: {
106
+ type: string;
107
+ } | StableRecordIdentifier, trait: string): boolean;
108
+ /**
109
+ * Queries for the fields of a given resource type or resource identity.
110
+ *
111
+ * Should error if the resource type is not recognized.
112
+ *
113
+ * @method fields
114
+ * @public
115
+ * @param {StableRecordIdentifier|{ type: string }} resource
116
+ * @return {Map<string, FieldSchema>}
117
+ */
118
+ fields(resource: {
119
+ type: string;
120
+ } | StableRecordIdentifier): Map<string, FieldSchema>;
121
+ /**
122
+ * Returns the transformation registered with the name provided
123
+ * by `field.type`. Validates that the field is a valid transformable.
124
+ *
125
+ * @method transformation
126
+ * @public
127
+ * @param {TransformableField|{ type: string }} field
128
+ * @return {Transformation}
129
+ */
130
+ transformation(field: GenericField | ObjectField | ArrayField | {
131
+ type: string;
132
+ }): Transformation;
133
+ /**
134
+ * Returns the hash function registered with the name provided
135
+ * by `field.type`. Validates that the field is a valid HashField.
136
+ *
137
+ * @method hashFn
138
+ * @public
139
+ * @param {HashField|{ type: string }} field
140
+ * @return {HashFn}
141
+ */
142
+ hashFn(field: HashField | {
143
+ type: string;
144
+ }): HashFn;
145
+ /**
146
+ * Returns the derivation registered with the name provided
147
+ * by `field.type`. Validates that the field is a valid DerivedField.
148
+ *
149
+ * @method derivation
150
+ * @public
151
+ * @param {DerivedField|{ type: string }} field
152
+ * @return {Derivation}
153
+ */
154
+ derivation(field: DerivedField | {
155
+ type: string;
156
+ }): Derivation;
157
+ /**
158
+ * Returns the schema for the provided resource type.
159
+ *
160
+ * @method resource
161
+ * @public
162
+ * @param {StableRecordIdentifier|{ type: string }} resource
163
+ * @return {ResourceSchema}
164
+ */
165
+ resource(resource: {
166
+ type: string;
167
+ } | StableRecordIdentifier): Schema;
168
+ /**
169
+ * Enables registration of multiple ResourceSchemas at once.
170
+ *
171
+ * This can be useful for either pre-loading schema information
172
+ * or for registering schema information delivered by API calls
173
+ * or other sources just-in-time.
174
+ *
175
+ * @method registerResources
176
+ * @public
177
+ * @param schemas
178
+ */
179
+ registerResources(schemas: Schema[]): void;
180
+ /**
181
+ * Enables registration of a single ResourceSchema.
182
+ *
183
+ * This can be useful for either pre-loading schema information
184
+ * or for registering schema information delivered by API calls
185
+ * or other sources just-in-time.
186
+ *
187
+ * @method registerResource
188
+ * @public
189
+ * @param {ResourceSchema} schema
190
+ */
191
+ registerResource(schema: Schema): void;
192
+ /**
193
+ * Enables registration of a transformation.
194
+ *
195
+ * The transformation can later be retrieved by the name
196
+ * attached to it's `[Type]` property.
197
+ *
198
+ * @method registerTransformations
199
+ * @public
200
+ * @param {Transformation} transform
201
+ */
202
+ registerTransformation(transform: Transformation): void;
203
+ /**
204
+ * Enables registration of a derivation.
205
+ *
206
+ * The derivation can later be retrieved by the name
207
+ * attached to it's `[Type]` property.
208
+ *
209
+ * @method registerDerivations
210
+ * @public
211
+ * @param {Derivation} derivation
212
+ */
213
+ registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void;
214
+ /**
215
+ * Enables registration of a hashing function
216
+ *
217
+ * The hashing function can later be retrieved by the name
218
+ * attached to it's `[Type]` property.
219
+ *
220
+ * @method registerHashFn
221
+ * @public
222
+ * @param {HashFn} hashfn
223
+ */
224
+ registerHashFn(hashFn: HashFn): void;
225
+ /**
226
+ * DEPRECATED - use `fields` instead
227
+ *
228
+ * Returns definitions for all properties of the specified resource
229
+ * that are considered "attributes". Generally these are properties
230
+ * that are not related to book-keeping state on the client and do
231
+ * not represent a linkage to another resource.
232
+ *
233
+ * The return value should be a dictionary of key:value pairs
234
+ * where the `key` is the attribute or property's name and `value`
235
+ * is an object with at least the property `name` which should also
236
+ * match `key`.
237
+ *
238
+ * Optionally, this object may also specify `type`, which should
239
+ * be a string reference to a `transform`, and `options` which
240
+ * should be dictionary in which any key:value pairs are permissable.
241
+ *
242
+ * For instance, when using `@ember-data/model`, the following attribute
243
+ * definition:
244
+ *
245
+ * ```ts
246
+ * class extends Model {
247
+ * @attr('string', { defaultValue: 'hello' }) greeting;
248
+ * @attr('date') birthday;
249
+ * @attr firstName;
250
+ * }
251
+ * ```
252
+ *
253
+ * Would be returned as:
254
+ *
255
+ * ```js
256
+ * {
257
+ * greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
258
+ * birthday: { name: 'birthday', type: 'date' },
259
+ * firstName: { name: 'firstName' }
260
+ * }
261
+ * ```
262
+ *
263
+ * @method attributesDefinitionFor
264
+ * @public
265
+ * @deprecated
266
+ * @param {RecordIdentifier|{ type: string }} identifier
267
+ * @return {AttributesSchema}
268
+ */
269
+ attributesDefinitionFor?(identifier: RecordIdentifier | {
270
+ type: string;
271
+ }): AttributesSchema;
272
+ /**
273
+ * DEPRECATED - use `fields` instead
274
+ *
275
+ * Returns definitions for all properties of the specified resource
276
+ * that are considered "relationships". Generally these are properties
277
+ * that represent a linkage to another resource.
278
+ *
279
+ * The return value should be a dictionary of key:value pairs
280
+ * where the `key` is the relationship or property's name and `value`
281
+ * is an object with at least the following properties:
282
+ *
283
+ * - `name` which should also match the `key` used in the dictionary.
284
+ * - `kind` which should be either `belongsTo` or `hasMany`
285
+ * - `type` which should be the related resource's string "type"
286
+ * - `options` which should be a dictionary allowing any key but with
287
+ * at least the below keys present.
288
+ *
289
+ * - `options.async` a boolean representing whether data for this relationship is
290
+ * typically loaded on-demand.
291
+ * - `options.inverse` a string or null representing the field name / key of the
292
+ * corresponding relationship on the inverse resource.
293
+ *
294
+ * Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
295
+ *
296
+ * - `options.polymorphic` a boolean representing whether multiple resource types
297
+ * can be used to satisfy this relationship.
298
+ * - `options.as` a string representing the abstract type that the concrete side of
299
+ * a relationship must specify when fulfilling a polymorphic inverse.
300
+ *
301
+ * For example, the following Model using @ember-data/model would generate this relationships
302
+ * definition by default:
303
+ *
304
+ * ```js
305
+ * class User extends Model {
306
+ * @belongsTo('user', { async: false, inverse: null }) bestFriend;
307
+ * @hasMany('user', { async: true, inverse: 'friends' }) friends;
308
+ * @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
309
+ * }
310
+ * ```
311
+ *
312
+ * Which would be returned as
313
+ *
314
+ * ```js
315
+ * {
316
+ * bestFriend: {
317
+ * name: 'bestFriend',
318
+ * kind: 'belongsTo',
319
+ * type: 'user',
320
+ * options: {
321
+ * async: false,
322
+ * inverse: null
323
+ * }
324
+ * },
325
+ * friends: {
326
+ * name: 'friends',
327
+ * kind: 'hasMany',
328
+ * type: 'user',
329
+ * options: {
330
+ * async: true,
331
+ * inverse: 'friends'
332
+ * }
333
+ * },
334
+ * pets: {
335
+ * name: 'pets',
336
+ * kind: 'hasMany',
337
+ * type: 'pet',
338
+ * options: {
339
+ * async: false,
340
+ * polymorphic: true,
341
+ * inverse: 'owner'
342
+ * }
343
+ * },
344
+ * }
345
+ * ```
346
+ *
347
+ * @method relationshipsDefinitionFor
348
+ * @public
349
+ * @deprecated
350
+ * @param {RecordIdentifier|{ type: string }} identifier
351
+ * @return {RelationshipsSchema}
352
+ */
353
+ relationshipsDefinitionFor?(identifier: RecordIdentifier | {
354
+ type: string;
355
+ }): RelationshipsSchema;
356
+ /**
357
+ * Returns all known resource types
358
+ *
359
+ * @method resourceTypes
360
+ * @public
361
+ * @return {string[]}
362
+ */
363
+ resourceTypes(): Readonly<string[]>;
364
+ }
365
+ }
366
+ //# 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,sBAAsB,EAAE,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ACH,0BAA0B,CAAC,CAAC,UAAU,EAAE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,mBAAmB,CAAC;IAElG;;;;;;OAMG;IACH,aAAa,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACrC"}
@@ -0,0 +1,38 @@
1
+ declare module '@ember-data/store/-types/q/store' {
2
+ import type { Value } from '@warp-drive/core-types/json/raw';
3
+ import type { Includes, TypedRecordInstance } from '@warp-drive/core-types/record';
4
+ export interface BaseFinderOptions<T = unknown> {
5
+ reload?: boolean;
6
+ backgroundReload?: boolean;
7
+ include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
8
+ adapterOptions?: Record<string, unknown>;
9
+ }
10
+ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
11
+ /**
12
+ * Data to preload into the store before the request is made.
13
+ * This feature is *highly* discouraged and has no corresponding
14
+ * feature when using builders and handlers.
15
+ *
16
+ * Excepting relationships: the data should be in the form of a
17
+ * JSON object where the keys are fields on the record and the value
18
+ * is the raw value to be added to the cache.
19
+ *
20
+ * Relationships can either be provided as string IDs from which
21
+ * an identifier will be built base upon the relationship's expected
22
+ * resource type, or be record instances from which the identifier
23
+ * will be extracted.
24
+ *
25
+ * @typedoc
26
+ */
27
+ preload?: Record<string, Value>;
28
+ }
29
+ export type QueryOptions = {
30
+ [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;
31
+ };
32
+ export type FindAllOptions<T = unknown> = BaseFinderOptions<T>;
33
+ export type LegacyResourceQuery<T = unknown> = {
34
+ include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
35
+ [key: string]: Value | undefined;
36
+ };
37
+ }
38
+ //# 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;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEnF,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,SAAS,mBAAmB,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AACD,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC1E;;;;;;;;;;;;;;;OAeG;IACH,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,CAAC,CAAC,GAAG,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAC/D,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC7C,OAAO,CAAC,EAAE,CAAC,SAAS,mBAAmB,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5E,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;CAClC,CAAC"}
@@ -0,0 +1,223 @@
1
+ /// <reference path="./types.d.ts" />
2
+ /// <reference path="./-private.d.ts" />
3
+ /// <reference path="./-private/store-service.d.ts" />
4
+ /// <reference path="./-private/document.d.ts" />
5
+ /// <reference path="./-private/store-service.type-test.d.ts" />
6
+ /// <reference path="./-private/network/request-cache.d.ts" />
7
+ /// <reference path="./-private/cache-handler/handler.d.ts" />
8
+ /// <reference path="./-private/cache-handler/types.d.ts" />
9
+ /// <reference path="./-private/cache-handler/utils.d.ts" />
10
+ /// <reference path="./-private/record-arrays/many-array.d.ts" />
11
+ /// <reference path="./-private/record-arrays/native-proxy-type-fix.d.ts" />
12
+ /// <reference path="./-private/record-arrays/identifier-array.d.ts" />
13
+ /// <reference path="./-private/utils/uuid-polyfill.d.ts" />
14
+ /// <reference path="./-private/utils/normalize-model-name.d.ts" />
15
+ /// <reference path="./-private/utils/coerce-id.d.ts" />
16
+ /// <reference path="./-private/utils/is-non-empty-string.d.ts" />
17
+ /// <reference path="./-private/utils/construct-resource.d.ts" />
18
+ /// <reference path="./-private/legacy-model-support/record-reference.d.ts" />
19
+ /// <reference path="./-private/legacy-model-support/shim-model-class.d.ts" />
20
+ /// <reference path="./-private/managers/cache-manager.d.ts" />
21
+ /// <reference path="./-private/managers/record-array-manager.d.ts" />
22
+ /// <reference path="./-private/managers/notification-manager.d.ts" />
23
+ /// <reference path="./-private/managers/cache-capabilities-manager.d.ts" />
24
+ /// <reference path="./-private/caches/identifier-cache.d.ts" />
25
+ /// <reference path="./-private/caches/instance-cache.d.ts" />
26
+ /// <reference path="./-private/caches/cache-utils.d.ts" />
27
+ /// <reference path="./-private/caches/resource-utils.d.ts" />
28
+ /// <reference path="./-private/debug/utils.d.ts" />
29
+ /// <reference path="./-types/overview.d.ts" />
30
+ /// <reference path="./-types/q/store.d.ts" />
31
+ /// <reference path="./-types/q/identifier.d.ts" />
32
+ /// <reference path="./-types/q/record-instance.d.ts" />
33
+ /// <reference path="./-types/q/ds-model.d.ts" />
34
+ /// <reference path="./-types/q/promise-proxies.d.ts" />
35
+ /// <reference path="./-types/q/record-data-json-api.d.ts" />
36
+ /// <reference path="./-types/q/schema-service.d.ts" />
37
+ /// <reference path="./-types/q/cache-capabilities-manager.d.ts" />
38
+ declare module '@ember-data/store' {
39
+ /**
40
+ * <p align="center">
41
+ * <img
42
+ * class="project-logo"
43
+ * src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
44
+ * alt="EmberData Store"
45
+ * width="240px"
46
+ * title="EmberData Store"
47
+ * />
48
+ * </p>
49
+ *
50
+ * This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
51
+ *
52
+ * 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),
53
+ * 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).
54
+ *
55
+ * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
56
+ *
57
+ * ## Installation
58
+ *
59
+ * If you have installed `ember-data` then you already have this package installed.
60
+ * Otherwise you can install it using your javascript package manager of choice.
61
+ * For instance with [pnpm](https://pnpm.io/)
62
+ *
63
+ * ```
64
+ * pnpm add @ember-data/store
65
+ * ```
66
+ *
67
+ * After installing you will want to configure your first `Store`. Read more below
68
+ * for how to create and configure stores for your application.
69
+ *
70
+ *
71
+ * ## 🔨 Creating A Store
72
+ *
73
+ * 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)
74
+ * 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,
75
+ * and implement `instantiateRecord` to tell the store how to display the data for individual resources.
76
+ *
77
+ * > **Note**
78
+ * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
79
+ * > and `instantiateRecord` are configured for you by default.
80
+ *
81
+ * ### Configuring A Cache
82
+ *
83
+ * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
84
+ * caches may better fit your data. You can author your own cache by creating one that
85
+ * conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
86
+ *
87
+ * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
88
+ * After installing it, we can configure the store to use this cache.
89
+ *
90
+ * ```js
91
+ * import Store from '@ember-data/store';
92
+ * import Cache from '@ember-data/json-api';
93
+ *
94
+ * class extends Store {
95
+ * createCache(storeWrapper) {
96
+ * return new Cache(storeWrapper);
97
+ * }
98
+ * }
99
+ * ```
100
+ *
101
+ * Now that we have a `cache` let's setup something to handle fetching
102
+ * and saving data via our API.
103
+ *
104
+ * > **Note**
105
+ * > The `ember-data` package automatically includes and configures
106
+ * > the `@ember-data/json-api` cache for you.
107
+ *
108
+ * ### Handling Requests
109
+ *
110
+ * 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.
111
+ *
112
+ * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
113
+ *
114
+ * > **Note**
115
+ * > 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).
116
+ *
117
+ * ```ts
118
+ * import Store from '@ember-data/store';
119
+ * import RequestManager from '@ember-data/request';
120
+ * import Fetch from '@ember-data/request/fetch';
121
+ *
122
+ * export default class extends Store {
123
+ * requestManager = new RequestManager()
124
+ * .use([Fetch]);
125
+ * }
126
+ * ```
127
+ *
128
+ * **Using RequestManager as a Service**
129
+ *
130
+ * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
131
+ *
132
+ * *app/services/request.js*
133
+ * ```ts
134
+ * import RequestManager from '@ember-data/request';
135
+ * import Fetch from '@ember-data/request/fetch';
136
+ *
137
+ * export default class extends RequestManager {
138
+ * constructor(createArgs) {
139
+ * super(createArgs);
140
+ * this.use([Fetch]);
141
+ * }
142
+ * }
143
+ * ```
144
+ *
145
+ * *app/services/store.js*
146
+ * ```ts
147
+ * import Store from '@ember-data/store';
148
+ * import { service } from '@ember/service';
149
+ *
150
+ * export default class extends Store {
151
+ * @service('request') requestManager
152
+ * }
153
+ * ```
154
+ *
155
+ *
156
+ * ### Presenting Data from the Cache
157
+ *
158
+ * Now that we have a source and a cache for our data, we need to configure how
159
+ * the Store delivers that data back to our application. We do this via the hook
160
+ * [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
161
+ * which allows us to transform the data for a resource before handing it to the application.
162
+ *
163
+ * A naive way to present the data would be to return it as JSON. Typically instead
164
+ * this hook will be used to add reactivity and make each unique resource a singleton,
165
+ * ensuring that if the cache updates our presented data will reflect the new state.
166
+ *
167
+ * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
168
+ * to provide minimal read-only reactive state for simple resources.
169
+ *
170
+ * ```ts
171
+ * import Store, { recordIdentifierFor } from '@ember-data/store';
172
+ * import { TrackedObject } from 'tracked-built-ins';
173
+ *
174
+ * class extends Store {
175
+ * instantiateRecord(identifier) {
176
+ * const { cache, notifications } = this;
177
+ *
178
+ * // create a TrackedObject with our attributes, id and type
179
+ * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
180
+ * record.type = identifier.type;
181
+ * record.id = identifier.id;
182
+ *
183
+ * notifications.subscribe(identifier, (_, change) => {
184
+ * if (change === 'attributes') {
185
+ * Object.assign(record, cache.peek(identifier));
186
+ * }
187
+ * });
188
+ *
189
+ * return record;
190
+ * }
191
+ * }
192
+ * ```
193
+ *
194
+ * Because `instantiateRecord` is opaque to the nature of the record, an implementation
195
+ * can be anything from a fairly simple object to a robust proxy that intelligently links
196
+ * together associated records through relationships.
197
+ *
198
+ * This also enables creating a record that separates `edit` flows from `create` flows
199
+ * entirely. A record class might choose to implement a `checkout`method that gives access
200
+ * to an editable instance while the primary record continues to be read-only and reflect
201
+ * only persisted (non-mutated) state.
202
+ *
203
+ * Typically you will choose an existing record implementation such as `@ember-data/model`
204
+ * for your application.
205
+ *
206
+ * Because of the boundaries around instantiation and the cache, record implementations
207
+ * should be capable of interop both with each other and with any `Cache`. Due to this,
208
+ * if needed an application can utilize multiple record implementations and multiple cache
209
+ * implementations either to support enhanced features for only a subset of records or to
210
+ * be able to incrementally migrate from one record/cache to another record or cache.
211
+ *
212
+ * > **Note**
213
+ * > The `ember-data` package automatically includes the `@ember-data/model`
214
+ * > package and configures it for you.
215
+ *
216
+ * @module @ember-data/store
217
+ * @main @ember-data/store
218
+ */
219
+ export { Store as default, type StoreRequestContext, CacheHandler, type Document, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor, } from '@ember-data/store/-private';
220
+ export type { DocumentCacheOperation, CacheOperation, NotificationType, } from '@ember-data/store/-private/managers/notification-manager';
221
+ export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource, } from '@ember-data/store/-private/caches/identifier-cache';
222
+ }
223
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmLG;AAEH,OAAO,EACL,KAAK,IAAI,OAAO,EAChB,KAAK,mBAAmB,EACxB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare module '@ember-data/store/types' {
2
+ export type { CacheCapabilitiesManager } from '@ember-data/store/-types/q/cache-capabilities-manager';
3
+ export type { ModelSchema } from '@ember-data/store/-types/q/ds-model';
4
+ export type { SchemaService } from '@ember-data/store/-types/q/schema-service';
5
+ export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions, } from '@ember-data/store/-types/q/store';
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACtF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC"}
package/addon/-private.js DELETED
@@ -1 +0,0 @@
1
- export { A as ARRAY_SIGNAL, f as AdapterPopulatedRecordArray, C as CacheHandler, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, g as SOURCE, S as Store, l as StoreMap, _ as _clearCaches, o as _deprecatingNormalize, e as coerceId, h as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, j as removeRecordDataFor, m as setCacheFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, k as setRecordIdentifier, s as storeFor } from "./cache-handler-XLbbNJdo";