@ember-data/legacy-compat 5.6.0-alpha.5 → 5.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/-private.js +1 -1
  3. package/dist/builders.js +1 -292
  4. package/dist/index.js +1 -1002
  5. package/dist/utils.js +1 -224
  6. package/package.json +7 -30
  7. package/unstable-preview-types/-private.d.ts +7 -13
  8. package/unstable-preview-types/builders.d.ts +9 -12
  9. package/unstable-preview-types/index.d.ts +2 -149
  10. package/unstable-preview-types/utils.d.ts +9 -138
  11. package/dist/-private-CVvkihLY.js +0 -1188
  12. package/dist/-private-CVvkihLY.js.map +0 -1
  13. package/dist/-private.js.map +0 -1
  14. package/dist/builders.js.map +0 -1
  15. package/dist/index.js.map +0 -1
  16. package/dist/utils.js.map +0 -1
  17. package/unstable-preview-types/-private.d.ts.map +0 -1
  18. package/unstable-preview-types/builders/find-all.d.ts +0 -35
  19. package/unstable-preview-types/builders/find-all.d.ts.map +0 -1
  20. package/unstable-preview-types/builders/find-record.d.ts +0 -56
  21. package/unstable-preview-types/builders/find-record.d.ts.map +0 -1
  22. package/unstable-preview-types/builders/query.d.ts +0 -63
  23. package/unstable-preview-types/builders/query.d.ts.map +0 -1
  24. package/unstable-preview-types/builders/save-record.d.ts +0 -34
  25. package/unstable-preview-types/builders/save-record.d.ts.map +0 -1
  26. package/unstable-preview-types/builders/utils.d.ts +0 -6
  27. package/unstable-preview-types/builders/utils.d.ts.map +0 -1
  28. package/unstable-preview-types/builders.d.ts.map +0 -1
  29. package/unstable-preview-types/index.d.ts.map +0 -1
  30. package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts +0 -49
  31. package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts.map +0 -1
  32. package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts +0 -5
  33. package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
  34. package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts +0 -14
  35. package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
  36. package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts +0 -8
  37. package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
  38. package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts +0 -5
  39. package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
  40. package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts +0 -529
  41. package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
  42. package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts +0 -226
  43. package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
  44. package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts +0 -9
  45. package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts.map +0 -1
  46. package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts +0 -91
  47. package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
  48. package/unstable-preview-types/legacy-network-handler/snapshot.d.ts +0 -239
  49. package/unstable-preview-types/legacy-network-handler/snapshot.d.ts.map +0 -1
  50. package/unstable-preview-types/utils.d.ts.map +0 -1
@@ -1,529 +0,0 @@
1
- declare module '@ember-data/legacy-compat/legacy-network-handler/minimum-adapter-interface' {
2
- import type Store from '@ember-data/store';
3
- import type { CollectionRecordArray } from '@ember-data/store/-private';
4
- import type { ModelSchema } from '@ember-data/store/types';
5
- import type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core-types/schema/fields';
6
- import type { Snapshot } from '@ember-data/legacy-compat/legacy-network-handler/snapshot';
7
- import type { SnapshotRecordArray } from '@ember-data/legacy-compat/legacy-network-handler/snapshot-record-array';
8
- type Group = Snapshot[];
9
- export type AdapterPayload = Record<string, unknown> | unknown[];
10
- /**
11
- * <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
12
- <p>
13
- ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
14
- If starting a new app or thinking of implementing a new adapter, consider writing a
15
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
16
- </p>
17
- </blockquote>
18
-
19
- The following documentation describes the methods an
20
- adapter should implement with descriptions around when an
21
- application might expect these methods to be called.
22
-
23
- Methods that are not required are marked as **optional**.
24
-
25
- @class (Interface) Adapter
26
- @public
27
- */
28
- export interface MinimumAdapterInterface {
29
- /**
30
- * `adapter.findRecord` takes a request for a resource of a given `type` and `id` combination
31
- * and should return a `Promise` which fulfills with data for a single resource matching that
32
- * `type` and `id`.
33
- *
34
- * The response will be fed to the associated serializer's `normalizeResponse` method with the
35
- * `requestType` set to `findRecord`, which should return a `JSON:API` document.
36
- *
37
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
38
- * it will merge with any existing data for the record.
39
- *
40
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
41
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
42
- * processing within the adapter.
43
- *
44
- * `adapter.findRecord` is called whenever the `store` needs to load, reload, or backgroundReload
45
- * the resource data for a given `type` and `id`.
46
- *
47
- * @public
48
- * @param {Store} store The store service that initiated the request being normalized
49
- * @param {ModelSchema} schema An object with methods for accessing information about
50
- * the type, attributes and relationships of the primary type associated with the request.
51
- * @param {String} id
52
- * @param {Snapshot} snapshot
53
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
54
- */
55
- findRecord(store: Store, schema: ModelSchema, id: string, snapshot: Snapshot): Promise<AdapterPayload>;
56
- /**
57
- * `adapter.findAll` takes a request for resources of a given `type` and should return
58
- * a `Promise` which fulfills with a collection of resource data matching that `type`.
59
- *
60
- * The response will be fed to the associated serializer's `normalizeResponse` method
61
- * with the `requestType` set to `findAll`, which should return a `JSON:API` document.
62
- *
63
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
64
- * it will merge with any existing records for `type`. Existing records for the `type` will not be removed.
65
- *
66
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
67
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
68
- * processing within the adapter.
69
- *
70
- * `adapter.findAll` is called whenever `store.findAll` is asked to reload or backgroundReload.
71
- * The records in the response are merged with the contents of the store. Existing records for
72
- * the `type` will not be removed.
73
- *
74
- * See also `shouldReloadAll` and `shouldBackgroundReloadAll`
75
- *
76
- * @public
77
- * @param {Store} store The store service that initiated the request being normalized
78
- * @param {ModelSchema} schema An object with methods for accessing information about
79
- * the type, attributes and relationships of the primary type associated with the request.
80
- * @param {null} sinceToken This parameter is no longer used and will always be null.
81
- * @param {SnapshotRecordArray} snapshotRecordArray an object containing any passed in options,
82
- * adapterOptions, and the ability to access a snapshot for each existing record of the type.
83
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
84
- */
85
- findAll(store: Store, schema: ModelSchema, sinceToken: null, snapshotRecordArray: SnapshotRecordArray): Promise<AdapterPayload>;
86
- /**
87
- * `adapter.query` takes a request for resources of a given `type` and should return
88
- * a `Promise` which fulfills with a collection of resource data matching that `type`.
89
- *
90
- * The response will be fed to the associated serializer's `normalizeResponse` method
91
- * with the `requestType` set to `query`, which should return a `JSON:API` document.
92
- *
93
- * As with `findAll`, the final result after normalization to `JSON:API` will be added to
94
- * store via `store.push` where it will merge with any existing records for `type`.
95
- *
96
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
97
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
98
- * processing within the adapter.
99
- *
100
- * `adapter.query` is called whenever `store.query` is called or a previous query result is
101
- * asked to reload.
102
- *
103
- * Existing records for the `type` will not be removed. The key difference is in the result
104
- * returned by the `store`. For `findAll` the result is all known records of the `type`,
105
- * while for `query` it will only be the records returned from `adapter.query`.
106
- *
107
- * @public
108
- * @param {Store} store The store service that initiated the request being normalized
109
- * @param {ModelSchema} schema An object with methods for accessing information about
110
- * the type, attributes and relationships of the primary type associated with the request.
111
- * @param {Object} query
112
- * @param {CollectionRecordArray} recordArray
113
- * @param {Object} options
114
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
115
- */
116
- query(store: Store, schema: ModelSchema, query: Record<string, unknown>, recordArray: CollectionRecordArray, options: {
117
- adapterOptions?: unknown;
118
- }): Promise<AdapterPayload>;
119
- /**
120
- * `adapter.queryRecord` takes a request for resource of a given `type` and should return
121
- * a `Promise` which fulfills with data for a single resource matching that `type`.
122
- *
123
- * The response will be fed to the associated serializer's `normalizeResponse` method
124
- * with the `requestType` set to `queryRecord`, which should return a `JSON:API` document.
125
- *
126
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
127
- * it will merge with any existing data for the returned record.
128
- *
129
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
130
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
131
- * processing within the adapter.
132
- *
133
- * @public
134
- * @param {Store} store The store service that initiated the request being normalized
135
- * @param {ModelSchema} schema An object with methods for accessing information about
136
- * the type, attributes and relationships of the primary type associated with the request.
137
- * @param query
138
- * @param options
139
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
140
- */
141
- queryRecord(store: Store, schema: ModelSchema, query: Record<string, unknown>, options: {
142
- adapterOptions?: unknown;
143
- }): Promise<AdapterPayload>;
144
- /**
145
- * `adapter.createRecord` takes a request to create a resource of a given `type` and should
146
- * return a `Promise` which fulfills with data for the newly created resource.
147
- *
148
- * The response will be fed to the associated serializer's `normalizeResponse` method
149
- * with the `requestType` set to `createRecord`, which should return a `JSON:API` document.
150
- *
151
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
152
- * it will merge with any existing data for the record.
153
- *
154
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
155
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
156
- * processing within the adapter.
157
- *
158
- * If the adapter rejects or throws an error the record will enter an error state and the attributes
159
- * that had attempted to be saved will still be considered dirty.
160
- *
161
- * ### InvalidErrors
162
- *
163
- * When rejecting a `createRecord` request due to validation issues during save (typically a 422 status code),
164
- * you may throw an `InvalidError`.
165
- *
166
- * Throwing an `InvalidError` makes per-attribute errors available for records to use in the UI as needed.
167
- * Records can also use this information to mark themselves as being in an `invalid` state.
168
- * For more reading [see the RecordData Errors RFC](https://emberjs.github.io/rfcs/0465-record-data-errors.html)
169
- *
170
- * ```js
171
- * let error = new Error(errorMessage);
172
- *
173
- * // these two properties combined
174
- * // alert EmberData to this error being for
175
- * // invalid properties on the record during
176
- * // the request
177
- * error.isAdapterError = true;
178
- * error.code = 'InvalidError';
179
- *
180
- * // A JSON:API formatted array of errors
181
- * // See https://jsonapi.org/format/#errors
182
- * error.errors = [];
183
- *
184
- * throw error;
185
- * ```
186
- *
187
- * @public
188
- * @param {Store} store The store service that initiated the request being normalized
189
- * @param {ModelSchema} schema An object with methods for accessing information about
190
- * the type, attributes and relationships of the primary type associated with the request.
191
- * @param {Snapshot} snapshot
192
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
193
- */
194
- createRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
195
- /**
196
- * `adapter.updateRecord` takes a request to update a resource of a given `type` and should
197
- * return a `Promise` which fulfills with the updated data for the resource.
198
- *
199
- * The response will be fed to the associated serializer's `normalizeResponse` method
200
- * with the `requestType` set to `updateRecord`, which should return a `JSON:API` document.
201
- *
202
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
203
- * it will merge with any existing data for the record.
204
- *
205
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
206
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
207
- * processing within the adapter.
208
- *
209
- * If the adapter rejects or throws an error the record will enter an error state and the attributes
210
- * that had attempted to be saved will still be considered dirty.
211
- *
212
- * ### InvalidErrors
213
- *
214
- * When rejecting a `createRecord` request due to validation issues during save (typically a 422 status code),
215
- * you may throw an `InvalidError`.
216
- *
217
- * Throwing an `InvalidError` makes per-attribute errors available for records to use in the UI as needed.
218
- * Records can also use this information to mark themselves as being in an `invalid` state.
219
- * For more reading [see the RecordData Errors RFC](https://emberjs.github.io/rfcs/0465-record-data-errors.html)
220
- *
221
- * ```js
222
- * let error = new Error(errorMessage);
223
- *
224
- * // these two properties combined
225
- * // alert EmberData to this error being for
226
- * // invalid properties on the record during
227
- * // the request
228
- * error.isAdapterError = true;
229
- * error.code = 'InvalidError';
230
- *
231
- * // A JSON:API formatted array of errors
232
- * // See https://jsonapi.org/format/#errors
233
- * error.errors = [];
234
- *
235
- * throw error;
236
- * ```
237
- *
238
- * @public
239
- * @param {Store} store The store service that initiated the request being normalized
240
- * @param {ModelSchema} schema An object with methods for accessing information about
241
- * the type, attributes and relationships of the primary type associated with the request.
242
- * @param {Snapshot} snapshot
243
- */
244
- updateRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
245
- /**
246
- * `adapter.deleteRecord` takes a request to delete a resource of a given `type` and
247
- * should return a `Promise` which resolves when that deletion is complete.
248
- *
249
- * Usually the response will be empty, but you may include additional updates in the
250
- * response. The response will be fed to the associated serializer's `normalizeResponse` method
251
- * with the `requestType` set to `deleteRecord`, which should return a `JSON:API` document.
252
- *
253
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
254
- * it will merge with any existing data.
255
- *
256
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
257
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
258
- * processing within the adapter.
259
- *
260
- * If the adapter rejects or errors the record will need to be saved again once the reason
261
- * for the error is addressed in order to persist the deleted state.
262
- *
263
- * @public
264
- * @param {Store} store The store service that initiated the request being normalized
265
- * @param {ModelSchema} schema An object with methods for accessing information about
266
- * the type, attributes and relationships of the primary type associated with the request.
267
- * @param {Snapshot} snapshot A Snapshot containing the record's current data
268
- * @return
269
- */
270
- deleteRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
271
- /**
272
- * `adapter.findBelongsTo` takes a request to fetch a related resource located at a
273
- * `relatedLink` and should return a `Promise` which fulfills with data for a single
274
- * resource.
275
- *
276
- * ⚠️ This method is only called if the store previously received relationship information for a resource
277
- * containing a [related link](https://jsonapi.org/format/#document-resource-object-related-resource-links).
278
- *
279
- * If the cache does not have a `link` for the relationship then `findRecord` will be used if a `type` and `id`
280
- * for the related resource is known.
281
- *
282
- * The response will be fed to the associated serializer's `normalizeResponse` method
283
- * with the `requestType` set to `findBelongsTo`, which should return a `JSON:API` document.
284
- *
285
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
286
- * it will merge with any existing data.
287
- *
288
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
289
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
290
- * processing within the adapter.
291
- *
292
- * @public
293
- * @optional
294
- * @param {Store} store The store service that initiated the request being normalized
295
- * @param {Snapshot} snapshot A Snapshot containing the parent record's current data
296
- * @param {String} relatedLink The link at which the associated resource might be found
297
- * @param {RelationshipSchema} relationship
298
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
299
- */
300
- findBelongsTo?(store: Store, snapshot: Snapshot, relatedLink: string, relationship: RelationshipSchema): Promise<AdapterPayload>;
301
- /**
302
- * `adapter.findHasMany` takes a request to fetch a related resource collection located
303
- * at a `relatedLink` and should return a `Promise` which fulfills with data for that
304
- * collection.
305
- *
306
- * ⚠️ This method is only called if the store previously received relationship information for a resource
307
- * containing a [related link](https://jsonapi.org/format/#document-resource-object-related-resource-links).
308
- *
309
- * If the cache does not have a `link` for the relationship but the `type` and `id` of
310
- * related resources are known then `findRecord` will be used for each individual related
311
- * resource.
312
- *
313
- * The response will be fed to the associated serializer's `normalizeResponse` method
314
- * with the `requestType` set to `findHasMany`, which should return a `JSON:API` document.
315
- *
316
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
317
- * it will merge with any existing data.
318
- *
319
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
320
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
321
- * processing within the adapter.
322
- *
323
- * @public
324
- * @optional
325
- * @param {Store} store The store service that initiated the request being normalized
326
- * @param {Snapshot} snapshot A Snapshot containing the parent record's current data
327
- * @param {String} relatedLink The link at which the associated resource collection might be found
328
- * @param {RelationshipSchema} relationship
329
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
330
- */
331
- findHasMany?(store: Store, snapshot: Snapshot, relatedLink: string, relationship: RelationshipSchema): Promise<AdapterPayload>;
332
- /**
333
- * ⚠️ This Method is only called if `coalesceFindRequests` is `true`. The array passed to it is determined
334
- * by the adapter's `groupRecordsForFindMany` method, and will be called once per group returned.
335
- *
336
- * `adapter.findMany` takes a request to fetch a collection of resources and should return a
337
- * `Promise` which fulfills with data for that collection.
338
- *
339
- * The response will be fed to the associated serializer's `normalizeResponse` method
340
- * with the `requestType` set to `findMany`, which should return a `JSON:API` document.
341
- *
342
- * The final result after normalization to `JSON:API` will be added to store via `store.push` where
343
- * it will merge with any existing data.
344
- *
345
- * ⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`
346
- * call will NOT be made. In this scenario you may need to do at least a minimum amount of response
347
- * processing within the adapter.
348
- *
349
- * See also `groupRecordsForFindMany` and `coalesceFindRequests`
350
- *
351
- * @public
352
- * @optional
353
- * @param {Store} store The store service that initiated the request being normalized
354
- * @param {ModelSchema} schema An object with methods for accessing information about
355
- * the type, attributes and relationships of the primary type associated with the request.
356
- * @param {Array<string>} ids An array of the ids of the resources to fetch
357
- * @param {Array<Snapshot>} snapshots An array of snapshots of the available data for the resources to fetch
358
- * @return {Promise} a promise resolving with resource data to feed to the associated serializer
359
- */
360
- findMany?(store: Store, schema: ModelSchema, ids: string[], snapshots: Snapshot[]): Promise<AdapterPayload>;
361
- /**
362
- * This method provides the ability to generate an ID to assign to a new record whenever `store.createRecord`
363
- * is called if no `id` was provided.
364
- *
365
- * Alternatively you can pass an id into the call to `store.createRecord` directly.
366
- *
367
- * ```js
368
- * let id = generateNewId(type);
369
- * let newRecord = store.createRecord(type, { id });
370
- * ```
371
- *
372
- * @public
373
- * @optional
374
- * @param {Store} store The store service that initiated the request being normalized
375
- * @param {String} type The type (or modelName) of record being created
376
- * @param properties the properties passed as the second arg to `store.createRecord`
377
- * @return {String} a string ID that should be unique (no other models of `type` in the cache should have this `id`)
378
- */
379
- generateIdForRecord?(store: Store, type: string, properties: unknown): string;
380
- /**
381
- * If your adapter implements `findMany`, setting this to `true` will cause `findRecord`
382
- * requests triggered within the same `runloop` to be coalesced into one or more calls
383
- * to `adapter.findMany`. The number of calls made and the records contained in each call
384
- * can be tuned by your adapter's `groupRecordsForHasMany` method.
385
- *
386
- * Implementing coalescing using this flag and the associated methods does not always offer
387
- * the right level of correctness, timing control or granularity. If your application would
388
- * be better suited coalescing across multiple types, coalescing for longer than a single runloop,
389
- * or with a more custom request structure, coalescing within your application adapter may prove
390
- * more effective.
391
- *
392
- * @property coalesceFindRequests [OPTIONAL]
393
- * @public
394
- * @optional
395
- * @type {Boolean} true if the requests to find individual records should be coalesced, false otherwise
396
- */
397
- coalesceFindRequests?: boolean;
398
- /**
399
- * ⚠️ This Method is only called if `coalesceFindRequests` is `true`.
400
- *
401
- * This method allows for you to split pending requests for records into multiple `findMany`
402
- * requests. It receives an array of snapshots where each snapshot represents a unique record
403
- * requested via `store.findRecord` during the most recent `runloop` that was not found in the
404
- * cache or needs to be reloaded. It should return an array of groups.
405
- *
406
- * A group is an array of snapshots meant to be fetched together by a single `findMany` request.
407
- *
408
- * By default if this method is not implemented EmberData will call `findMany` once with all
409
- * requested records as a single group when `coalesceFindRequests` is `true`.
410
- *
411
- * See also `findMany` and `coalesceFindRequests`
412
- *
413
- * @public
414
- * @optional
415
- * @param {Store} store The store service that initiated the request being normalized
416
- * @param {Array<Snapshot>} snapshots An array of snapshots
417
- * @return {Array<Array<Snapshot>>} An array of Snapshot arrays
418
- */
419
- groupRecordsForFindMany?(store: Store, snapshots: Snapshot[]): Group[];
420
- /**
421
- * When a record is already available in the store and is requested again via `store.findRecord`,
422
- * and `reload` is not specified as an option in the request, this method is called to determine
423
- * whether the record should be reloaded prior to returning the result.
424
- *
425
- * If `reload` is specified as an option in the request (`true` or `false`) this method will not
426
- * be called.
427
- *
428
- * ```js
429
- * store.findRecord('user', '1', { reload: false })
430
- * ```
431
- *
432
- * The default behavior if this method is not implemented and the option is not specified is to
433
- * not reload, the same as a return of `false`.
434
- *
435
- * See also the documentation for `shouldBackgroundReloadRecord` which defaults to `true`.
436
- *
437
- * @public
438
- * @optional
439
- * @param {Store} store The store service that initiated the request being normalized
440
- * @param {Snapshot} snapshot A Snapshot containing the record's current data
441
- * @return {Boolean} true if the record should be reloaded immediately, false otherwise
442
- */
443
- shouldReloadRecord?(store: Store, snapshot: Snapshot): boolean;
444
- /**
445
- * When `store.findAll(<type>)` is called without a `reload` option, the adapter
446
- * is presented the opportunity to trigger a new request for records of that type.
447
- *
448
- * If `reload` is specified as an option in the request (`true` or `false`) this method will not
449
- * be called.
450
- *
451
- * ```js
452
- * store.findAll('user', { reload: false })
453
- * ```
454
- *
455
- * The default behavior if this method is not implemented and the option is not specified is to
456
- * not reload, the same as a return of `false`.
457
- *
458
- * Note: the Promise returned by `store.findAll` resolves to the same LiveArray instance
459
- * returned by `store.peekAll` for that type, and will include all records in the store for
460
- * the given type, including any previously existing records not returned by the reload request.
461
- *
462
- * @public
463
- * @optional
464
- * @param {Store} store The store service that initiated the request being normalized
465
- * @param {SnapshotRecordArray} snapshotArray
466
- * @return {Boolean} true if the a new request for all records of the type in SnapshotRecordArray should be made immediately, false otherwise
467
- */
468
- shouldReloadAll?(store: Store, snapshotArray: SnapshotRecordArray): boolean;
469
- /**
470
- * When a record is already available in the store and is requested again via `store.findRecord`,
471
- * and the record does not need to be reloaded prior to return, this method provides the ability
472
- * to specify whether a refresh of the data for the reload should be scheduled to occur in the background.
473
- *
474
- * Users may explicitly a record should/should not be background reloaded by passing
475
- * `backgroundReload: true` or `backgroundReload: false` as an option to the request respectively.
476
- *
477
- * ```js
478
- * store.findRecord('user', '1', { backgroundReload: false })
479
- * ```
480
- *
481
- * If the `backgroundReload` option is not present, this method will be called to determine whether
482
- * a backgroundReload should be performed.
483
- *
484
- * The default behavior if this method is not implemented and the option was not specified is to
485
- * background reload, the same as a return of `true`.
486
- *
487
- * @public
488
- * @optional
489
- * @param {Store} store The store service that initiated the request being normalized
490
- * @param {Snapshot} snapshot A Snapshot containing the record's current data
491
- * @return {Boolean} true if the record should be reloaded in the background, false otherwise
492
- */
493
- shouldBackgroundReloadRecord?(store: Store, snapshot: Snapshot): boolean;
494
- /**
495
- * When `store.findAll(<type>)` is called and a `reload` is not initiated, the adapter
496
- * is presented the opportunity to trigger a new non-blocking (background) request for
497
- * records of that type
498
- *
499
- * Users may explicitly that this background request should/should not occur by passing
500
- * `backgroundReload: true` or `backgroundReload: false` as an option to the request respectively.
501
- *
502
- * ```js
503
- * store.findAll('user', { backgroundReload: false })
504
- * ```
505
- *
506
- * The default behavior if this method is not implemented and the option is not specified is to
507
- * perform a reload, the same as a return of `true`.
508
- *
509
- * @public
510
- * @optional
511
- * @param {Store} store The store service that initiated the request being normalized
512
- * @param {SnapshotRecordArray} snapshotArray
513
- * @return {Boolean} true if the a new request for all records of the type in SnapshotRecordArray should be made in the background, false otherwise
514
- */
515
- shouldBackgroundReloadAll?(store: Store, snapshotArray: SnapshotRecordArray): boolean;
516
- /**
517
- * In some situations the adapter may need to perform cleanup when destroyed,
518
- * that cleanup can be done in `destroy`.
519
- *
520
- * If not implemented, the store does not inform the adapter of destruction.
521
- *
522
- * @public
523
- * @optional
524
- */
525
- destroy?(): void;
526
- }
527
- export {};
528
- }
529
- //# sourceMappingURL=minimum-adapter-interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"minimum-adapter-interface.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/minimum-adapter-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,KAAK,KAAK,GAAG,QAAQ,EAAE,CAAC;AAMxB,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,CAAC;AAEjE;;;;;;;;;;;;;;;;;EAiBE;AACF,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,IAAI,EAChB,mBAAmB,EAAE,mBAAmB,GACvC,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CACH,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,M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