@ember-data-types/store 5.6.0-alpha.1 → 5.6.0-alpha.11

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 (90) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
  3. package/unstable-preview-types/-private.d.ts +1 -30
  4. package/unstable-preview-types/-private.d.ts.map +1 -1
  5. package/unstable-preview-types/configure.d.ts +2 -6
  6. package/unstable-preview-types/configure.d.ts.map +1 -1
  7. package/unstable-preview-types/index.d.ts +2 -224
  8. package/unstable-preview-types/index.d.ts.map +1 -1
  9. package/unstable-preview-types/types.d.ts +1 -4
  10. package/unstable-preview-types/types.d.ts.map +1 -1
  11. package/unstable-preview-types/-private/cache-handler/handler.d.ts +0 -62
  12. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +0 -1
  13. package/unstable-preview-types/-private/cache-handler/types.d.ts +0 -107
  14. package/unstable-preview-types/-private/cache-handler/types.d.ts.map +0 -1
  15. package/unstable-preview-types/-private/cache-handler/utils.d.ts +0 -34
  16. package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +0 -1
  17. package/unstable-preview-types/-private/caches/cache-utils.d.ts +0 -11
  18. package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +0 -1
  19. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +0 -180
  20. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +0 -1
  21. package/unstable-preview-types/-private/caches/instance-cache.d.ts +0 -64
  22. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +0 -1
  23. package/unstable-preview-types/-private/caches/resource-utils.d.ts +0 -12
  24. package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +0 -1
  25. package/unstable-preview-types/-private/debug/utils.d.ts +0 -9
  26. package/unstable-preview-types/-private/debug/utils.d.ts.map +0 -1
  27. package/unstable-preview-types/-private/document.d.ts +0 -155
  28. package/unstable-preview-types/-private/document.d.ts.map +0 -1
  29. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +0 -179
  30. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +0 -1
  31. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +0 -19
  32. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
  33. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +0 -31
  34. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
  35. package/unstable-preview-types/-private/managers/cache-manager.d.ts +0 -463
  36. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +0 -1
  37. package/unstable-preview-types/-private/managers/notification-manager.d.ts +0 -101
  38. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +0 -1
  39. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +0 -101
  40. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +0 -1
  41. package/unstable-preview-types/-private/network/request-cache.d.ts +0 -109
  42. package/unstable-preview-types/-private/network/request-cache.d.ts.map +0 -1
  43. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +0 -289
  44. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +0 -1
  45. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +0 -92
  46. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
  47. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +0 -172
  48. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
  49. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +0 -32
  50. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
  51. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +0 -276
  52. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +0 -1
  53. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +0 -145
  54. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +0 -1
  55. package/unstable-preview-types/-private/record-arrays/many-array.d.ts +0 -203
  56. package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +0 -1
  57. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +0 -118
  58. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
  59. package/unstable-preview-types/-private/store-service.d.ts +0 -1601
  60. package/unstable-preview-types/-private/store-service.d.ts.map +0 -1
  61. package/unstable-preview-types/-private/store-service.type-test.d.ts +0 -4
  62. package/unstable-preview-types/-private/store-service.type-test.d.ts.map +0 -1
  63. package/unstable-preview-types/-private/utils/coerce-id.d.ts +0 -10
  64. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +0 -1
  65. package/unstable-preview-types/-private/utils/construct-resource.d.ts +0 -9
  66. package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +0 -1
  67. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +0 -4
  68. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +0 -1
  69. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +0 -4
  70. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +0 -1
  71. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +0 -4
  72. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +0 -1
  73. package/unstable-preview-types/-types/overview.d.ts +0 -21
  74. package/unstable-preview-types/-types/overview.d.ts.map +0 -1
  75. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +0 -110
  76. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +0 -1
  77. package/unstable-preview-types/-types/q/ds-model.d.ts +0 -25
  78. package/unstable-preview-types/-types/q/ds-model.d.ts.map +0 -1
  79. package/unstable-preview-types/-types/q/identifier.d.ts +0 -193
  80. package/unstable-preview-types/-types/q/identifier.d.ts.map +0 -1
  81. package/unstable-preview-types/-types/q/promise-proxies.d.ts +0 -4
  82. package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +0 -1
  83. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +0 -36
  84. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +0 -1
  85. package/unstable-preview-types/-types/q/record-instance.d.ts +0 -29
  86. package/unstable-preview-types/-types/q/record-instance.d.ts.map +0 -1
  87. package/unstable-preview-types/-types/q/schema-service.d.ts +0 -354
  88. package/unstable-preview-types/-types/q/schema-service.d.ts.map +0 -1
  89. package/unstable-preview-types/-types/q/store.d.ts +0 -38
  90. package/unstable-preview-types/-types/q/store.d.ts.map +0 -1
@@ -1,31 +0,0 @@
1
- declare module '@ember-data/store/-private/managers/cache-capabilities-manager' {
2
- import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
3
- import type { CacheCapabilitiesManager as StoreWrapper } from '@ember-data/store/-types/q/cache-capabilities-manager';
4
- import type { SchemaService } from '@ember-data/store/-types/q/schema-service';
5
- import type { IdentifierCache } from '@ember-data/store/-private/caches/identifier-cache';
6
- import type { Store } from '@ember-data/store/-private/store-service';
7
- import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';
8
- /**
9
- @module @ember-data/store
10
- */
11
- export interface CacheCapabilitiesManager {
12
- getSchemaDefinitionService(): SchemaService;
13
- }
14
- export class CacheCapabilitiesManager implements StoreWrapper {
15
- _willNotify: boolean;
16
- _pendingNotifies: Map<StableRecordIdentifier, Set<string>>;
17
- _store: Store;
18
- constructor(_store: Store);
19
- get identifierCache(): IdentifierCache;
20
- _scheduleNotification(identifier: StableRecordIdentifier, key: string): void;
21
- _flushNotifications(): void;
22
- notifyChange(identifier: StableRecordIdentifier, namespace: 'added' | 'removed', key: null): void;
23
- notifyChange(identifier: StableDocumentIdentifier, namespace: 'added' | 'updated' | 'removed', key: null): void;
24
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key: string | null): void;
25
- get schema(): SchemaService;
26
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
27
- hasRecord(identifier: StableRecordIdentifier): boolean;
28
- disconnectRecord(identifier: StableRecordIdentifier): void;
29
- }
30
- }
31
- //# sourceMappingURL=cache-capabilities-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache-capabilities-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/cache-capabilities-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE1G,OAAO,KAAK,EAAE,wBAAwB,IAAI,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;EAEE;AAEF,MAAM,WAAW,wBAAwB;IACvC,0BAA0B,IAAI,aAAa,CAAC;CAC7C;AACD,qBAAa,wBAAyB,YAAW,YAAY;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,MAAM,EAAE,KAAK,CAAC;gBAEV,MAAM,EAAE,KAAK;IAMzB,IAAI,eAAe,IAAI,eAAe,CAErC;IAED,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM;IAyBrE,mBAAmB,IAAI,IAAI;IAgB3B,YAAY,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI;IACjG,YAAY,CAAC,UAAU,EAAE,wBAAwB,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI;IAC/G,YAAY,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAkBvG,IAAI,MAAM,kBAET;IAED,WAAW,CAAC,UAAU,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM;IAK1D,SAAS,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAItD,gBAAgB,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;CAK3D"}
@@ -1,463 +0,0 @@
1
- declare module '@ember-data/store/-private/managers/cache-manager' {
2
- import type { Cache, ChangedAttributesHash, RelationshipDiff } from '@warp-drive/core-types/cache';
3
- import type { Change } from '@warp-drive/core-types/cache/change';
4
- import type { MergeOperation } from '@warp-drive/core-types/cache/operations';
5
- import type { CollectionRelationship, ResourceRelationship } from '@warp-drive/core-types/cache/relationship';
6
- import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
7
- import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
8
- import type { Value } from '@warp-drive/core-types/json/raw';
9
- import type { StructuredDataDocument, StructuredDocument } from '@warp-drive/core-types/request';
10
- import type { ResourceDocument, SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';
11
- import type { ApiError } from '@warp-drive/core-types/spec/error';
12
- import type { StoreRequestContext } from '@ember-data/store/-private/cache-handler/handler';
13
- /**
14
- * The CacheManager wraps a Cache enforcing that only
15
- * the public API surface area is exposed.
16
- *
17
- * Hence, it is the value of `Store.cache`, wrapping
18
- * the cache instance returned by `Store.createCache`.
19
- *
20
- * It handles translating between cache versions when
21
- * necessary, for instance when a Store is configured
22
- * to use both a v1 and a v2 cache depending on some
23
- * heuristic.
24
- *
25
- * Starting with the v2 spec, the cache is designed such
26
- * that it must be implemented as a singleton.
27
- *
28
- * @class CacheManager
29
- * @public
30
- */
31
- export class CacheManager implements Cache {
32
- #private;
33
- version: "2";
34
- constructor(cache: Cache);
35
- /**
36
- * Cache the response to a request
37
- *
38
- * Unlike `store.push` which has UPSERT
39
- * semantics, `put` has `replace` semantics similar to
40
- * the `http` method `PUT`
41
- *
42
- * the individually cacheable
43
- * e resource data it may contain
44
- * should upsert, but the document data surrounding it should
45
- * fully replace any existing information
46
- *
47
- * Note that in order to support inserting arbitrary data
48
- * to the cache that did not originate from a request `put`
49
- * should expect to sometimes encounter a document with only
50
- * a `content` member and therefor must not assume the existence
51
- * of `request` and `response` on the document.
52
- *
53
- * @method put
54
- * @param {StructuredDocument} doc
55
- * @return {ResourceDocument}
56
- * @public
57
- */
58
- put<T>(doc: StructuredDocument<T> | {
59
- content: T;
60
- }): ResourceDocument;
61
- /**
62
- * Perform an operation on the cache to update the remote state.
63
- *
64
- * Note: currently the only valid operation is a MergeOperation
65
- * which occurs when a collision of identifiers is detected.
66
- *
67
- * @method patch
68
- * @public
69
- * @param op the operation to perform
70
- * @return {void}
71
- */
72
- patch(op: MergeOperation): void;
73
- /**
74
- * Update resource data with a local mutation. Currently supports operations
75
- * on relationships only.
76
- *
77
- * @method mutate
78
- * @public
79
- * @param mutation
80
- */
81
- mutate(mutation: LocalRelationshipOperation): void;
82
- /**
83
- * Peek resource data from the Cache.
84
- *
85
- * In development, if the return value
86
- * is JSON the return value
87
- * will be deep-cloned and deep-frozen
88
- * to prevent mutation thereby enforcing cache
89
- * Immutability.
90
- *
91
- * This form of peek is useful for implementations
92
- * that want to feed raw-data from cache to the UI
93
- * or which want to interact with a blob of data
94
- * directly from the presentation cache.
95
- *
96
- * An implementation might want to do this because
97
- * de-referencing records which read from their own
98
- * blob is generally safer because the record does
99
- * not require retaining connections to the Store
100
- * and Cache to present data on a per-field basis.
101
- *
102
- * This generally takes the place of `getAttr` as
103
- * an API and may even take the place of `getRelationship`
104
- * depending on implementation specifics, though this
105
- * latter usage is less recommended due to the advantages
106
- * of the Graph handling necessary entanglements and
107
- * notifications for relational data.
108
- *
109
- * @method peek
110
- * @public
111
- * @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
112
- * @return {ResourceDocument | ResourceBlob | null} the known resource data
113
- */
114
- peek(identifier: StableRecordIdentifier): unknown;
115
- peek(identifier: StableDocumentIdentifier): ResourceDocument | null;
116
- peekRemoteState(identifier: StableRecordIdentifier): unknown;
117
- peekRemoteState(identifier: StableDocumentIdentifier): ResourceDocument | null;
118
- /**
119
- * Peek the Cache for the existing request data associated with
120
- * a cacheable request
121
- *
122
- * @method peekRequest
123
- * @param {StableDocumentIdentifier}
124
- * @return {StableDocumentIdentifier | null}
125
- * @public
126
- */
127
- peekRequest(identifier: StableDocumentIdentifier): StructuredDocument<ResourceDocument> | null;
128
- /**
129
- * Push resource data from a remote source into the cache for this identifier
130
- *
131
- * @method upsert
132
- * @public
133
- * @param identifier
134
- * @param data
135
- * @param hasRecord
136
- * @return {void | string[]} if `hasRecord` is true then calculated key changes should be returned
137
- */
138
- upsert(identifier: StableRecordIdentifier, data: unknown, hasRecord: boolean): void | string[];
139
- /**
140
- * Create a fork of the cache from the current state.
141
- *
142
- * Applications should typically not call this method themselves,
143
- * preferring instead to fork at the Store level, which will
144
- * utilize this method to fork the cache.
145
- *
146
- * @method fork
147
- * @public
148
- * @return Promise<Cache>
149
- */
150
- fork(): Promise<Cache>;
151
- /**
152
- * Merge a fork back into a parent Cache.
153
- *
154
- * Applications should typically not call this method themselves,
155
- * preferring instead to merge at the Store level, which will
156
- * utilize this method to merge the caches.
157
- *
158
- * @method merge
159
- * @param {Cache} cache
160
- * @public
161
- * @return Promise<void>
162
- */
163
- merge(cache: Cache): Promise<void>;
164
- /**
165
- * Generate the list of changes applied to all
166
- * record in the store.
167
- *
168
- * Each individual resource or document that has
169
- * been mutated should be described as an individual
170
- * `Change` entry in the returned array.
171
- *
172
- * A `Change` is described by an object containing up to
173
- * three properties: (1) the `identifier` of the entity that
174
- * changed; (2) the `op` code of that change being one of
175
- * `upsert` or `remove`, and if the op is `upsert` a `patch`
176
- * containing the data to merge into the cache for the given
177
- * entity.
178
- *
179
- * This `patch` is opaque to the Store but should be understood
180
- * by the Cache and may expect to be utilized by an Adapter
181
- * when generating data during a `save` operation.
182
- *
183
- * It is generally recommended that the `patch` contain only
184
- * the updated state, ignoring fields that are unchanged
185
- *
186
- * ```ts
187
- * interface Change {
188
- * identifier: StableRecordIdentifier | StableDocumentIdentifier;
189
- * op: 'upsert' | 'remove';
190
- * patch?: unknown;
191
- * }
192
- * ```
193
- *
194
- * @method diff
195
- * @public
196
- */
197
- diff(): Promise<Change[]>;
198
- /**
199
- * Serialize the entire contents of the Cache into a Stream
200
- * which may be fed back into a new instance of the same Cache
201
- * via `cache.hydrate`.
202
- *
203
- * @method dump
204
- * @return {Promise<ReadableStream>}
205
- * @public
206
- */
207
- dump(): Promise<ReadableStream<unknown>>;
208
- /**
209
- * hydrate a Cache from a Stream with content previously serialized
210
- * from another instance of the same Cache, resolving when hydration
211
- * is complete.
212
- *
213
- * This method should expect to be called both in the context of restoring
214
- * the Cache during application rehydration after SSR **AND** at unknown
215
- * times during the lifetime of an already booted application when it is
216
- * desired to bulk-load additional information into the cache. This latter
217
- * behavior supports optimizing pre/fetching of data for route transitions
218
- * via data-only SSR modes.
219
- *
220
- * @method hydrate
221
- * @param {ReadableStream} stream
222
- * @return {Promise<void>}
223
- * @public
224
- */
225
- hydrate(stream: ReadableStream<unknown>): Promise<void>;
226
- /**
227
- * [LIFECYCLE] Signal to the cache that a new record has been instantiated on the client
228
- *
229
- * It returns properties from options that should be set on the record during the create
230
- * process. This return value behavior is deprecated.
231
- *
232
- * @method clientDidCreate
233
- * @public
234
- * @param identifier
235
- * @param options
236
- */
237
- clientDidCreate(identifier: StableRecordIdentifier, options?: Record<string, unknown>): Record<string, unknown>;
238
- /**
239
- * [LIFECYCLE] Signals to the cache that a resource
240
- * will be part of a save transaction.
241
- *
242
- * @method willCommit
243
- * @public
244
- * @param identifier
245
- */
246
- willCommit(identifier: StableRecordIdentifier, context: StoreRequestContext): void;
247
- /**
248
- * [LIFECYCLE] Signals to the cache that a resource
249
- * was successfully updated as part of a save transaction.
250
- *
251
- * @method didCommit
252
- * @public
253
- * @param identifier
254
- * @param data
255
- */
256
- didCommit(identifier: StableRecordIdentifier, result: StructuredDataDocument<unknown>): SingleResourceDataDocument;
257
- /**
258
- * [LIFECYCLE] Signals to the cache that a resource
259
- * was update via a save transaction failed.
260
- *
261
- * @method commitWasRejected
262
- * @public
263
- * @param identifier
264
- * @param errors
265
- */
266
- commitWasRejected(identifier: StableRecordIdentifier, errors?: ApiError[]): void;
267
- /**
268
- * [LIFECYCLE] Signals to the cache that all data for a resource
269
- * should be cleared.
270
- *
271
- * @method unloadRecord
272
- * @public
273
- * @param identifier
274
- */
275
- unloadRecord(identifier: StableRecordIdentifier): void;
276
- /**
277
- * Retrieve the data for an attribute from the cache
278
- *
279
- * @method getAttr
280
- * @public
281
- * @param identifier
282
- * @param propertyName
283
- * @return {unknown}
284
- */
285
- getAttr(identifier: StableRecordIdentifier, propertyName: string): Value | undefined;
286
- /**
287
- * Retrieve the remote state for an attribute from the cache
288
- *
289
- * @method getRemoteAttr
290
- * @public
291
- * @param identifier
292
- * @param propertyName
293
- * @return {unknown}
294
- */
295
- getRemoteAttr(identifier: StableRecordIdentifier, propertyName: string): Value | undefined;
296
- /**
297
- * Mutate the data for an attribute in the cache
298
- *
299
- * @method setAttr
300
- * @public
301
- * @param identifier
302
- * @param propertyName
303
- * @param value
304
- */
305
- setAttr(identifier: StableRecordIdentifier, propertyName: string, value: Value): void;
306
- /**
307
- * Query the cache for the changed attributes of a resource.
308
- *
309
- * @method changedAttrs
310
- * @public
311
- * @param identifier
312
- * @return
313
- */
314
- changedAttrs(identifier: StableRecordIdentifier): ChangedAttributesHash;
315
- /**
316
- * Query the cache for whether any mutated attributes exist
317
- *
318
- * @method hasChangedAttrs
319
- * @public
320
- * @param identifier
321
- * @return {Boolean}
322
- */
323
- hasChangedAttrs(identifier: StableRecordIdentifier): boolean;
324
- /**
325
- * Tell the cache to discard any uncommitted mutations to attributes
326
- *
327
- * @method rollbackAttrs
328
- * @public
329
- * @param identifier
330
- * @return the names of attributes that were restored
331
- */
332
- rollbackAttrs(identifier: StableRecordIdentifier): string[];
333
- /**
334
- * Query the cache for the changes to relationships of a resource.
335
- *
336
- * Returns a map of relationship names to RelationshipDiff objects.
337
- *
338
- * ```ts
339
- * type RelationshipDiff =
340
- | {
341
- kind: 'collection';
342
- remoteState: StableRecordIdentifier[];
343
- additions: Set<StableRecordIdentifier>;
344
- removals: Set<StableRecordIdentifier>;
345
- localState: StableRecordIdentifier[];
346
- reordered: boolean;
347
- }
348
- | {
349
- kind: 'resource';
350
- remoteState: StableRecordIdentifier | null;
351
- localState: StableRecordIdentifier | null;
352
- };
353
- ```
354
- *
355
- * @method changedRelationships
356
- * @public
357
- * @param {StableRecordIdentifier} identifier
358
- * @return {Map<string, RelationshipDiff>}
359
- */
360
- changedRelationships(identifier: StableRecordIdentifier): Map<string, RelationshipDiff>;
361
- /**
362
- * Query the cache for whether any mutated attributes exist
363
- *
364
- * @method hasChangedRelationships
365
- * @public
366
- * @param {StableRecordIdentifier} identifier
367
- * @return {Boolean}
368
- */
369
- hasChangedRelationships(identifier: StableRecordIdentifier): boolean;
370
- /**
371
- * Tell the cache to discard any uncommitted mutations to relationships.
372
- *
373
- * This will also discard the change on any appropriate inverses.
374
- *
375
- * This method is a candidate to become a mutation
376
- *
377
- * @method rollbackRelationships
378
- * @public
379
- * @param {StableRecordIdentifier} identifier
380
- * @return {String[]} the names of relationships that were restored
381
- */
382
- rollbackRelationships(identifier: StableRecordIdentifier): string[];
383
- /**
384
- * Query the cache for the current state of a relationship property
385
- *
386
- * @method getRelationship
387
- * @public
388
- * @param identifier
389
- * @param propertyName
390
- * @return resource relationship object
391
- */
392
- getRelationship(identifier: StableRecordIdentifier, propertyName: string): ResourceRelationship | CollectionRelationship;
393
- /**
394
- * Query the cache for the remote state of a relationship property
395
- *
396
- * @method getRelationship
397
- * @public
398
- * @param identifier
399
- * @param propertyName
400
- * @return resource relationship object
401
- */
402
- getRemoteRelationship(identifier: StableRecordIdentifier, propertyName: string): ResourceRelationship | CollectionRelationship;
403
- /**
404
- * Update the cache state for the given resource to be marked as locally deleted,
405
- * or remove such a mark.
406
- *
407
- * @method setIsDeleted
408
- * @public
409
- * @param identifier
410
- * @param isDeleted
411
- */
412
- setIsDeleted(identifier: StableRecordIdentifier, isDeleted: boolean): void;
413
- /**
414
- * Query the cache for any validation errors applicable to the given resource.
415
- *
416
- * @method getErrors
417
- * @public
418
- * @param identifier
419
- * @return
420
- */
421
- getErrors(identifier: StableRecordIdentifier): ApiError[];
422
- /**
423
- * Query the cache for whether a given resource has any available data
424
- *
425
- * @method isEmpty
426
- * @public
427
- * @param identifier
428
- * @return {Boolean}
429
- */
430
- isEmpty(identifier: StableRecordIdentifier): boolean;
431
- /**
432
- * Query the cache for whether a given resource was created locally and not
433
- * yet persisted.
434
- *
435
- * @method isNew
436
- * @public
437
- * @param identifier
438
- * @return {Boolean}
439
- */
440
- isNew(identifier: StableRecordIdentifier): boolean;
441
- /**
442
- * Query the cache for whether a given resource is marked as deleted (but not
443
- * necessarily persisted yet).
444
- *
445
- * @method isDeleted
446
- * @public
447
- * @param identifier
448
- * @return {Boolean}
449
- */
450
- isDeleted(identifier: StableRecordIdentifier): boolean;
451
- /**
452
- * Query the cache for whether a given resource has been deleted and that deletion
453
- * has also been persisted.
454
- *
455
- * @method isDeletionCommitted
456
- * @public
457
- * @param identifier
458
- * @return {Boolean}
459
- */
460
- isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
461
- }
462
- }
463
- //# sourceMappingURL=cache-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/cache-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,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BAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAI1E;;;;;;;OAOG;IACH,SAAS,CAAC,UAAU,EAAE,sBAAsB,GAAG,QAAQ,EAAE;IAIzD;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAIpD;;;;;;;;OAQG;IACH,KAAK,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAIlD;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAItD;;;;;;;;OAQG;IACH,mBAAmB,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;CAGjE"}
@@ -1,101 +0,0 @@
1
- declare module '@ember-data/store/-private/managers/notification-manager' {
2
- /**
3
- * @module @ember-data/store
4
- */
5
- import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
6
- import type { Store } from '@ember-data/store/-private/store-service';
7
- export type UnsubscribeToken = object;
8
- export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
9
- export type DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';
10
- export type NotificationType = 'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | CacheOperation;
11
- export interface NotificationCallback {
12
- (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
13
- (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
14
- (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
15
- }
16
- export interface ResourceOperationCallback {
17
- (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
18
- }
19
- export interface DocumentOperationCallback {
20
- (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;
21
- }
22
- /**
23
- * The NotificationManager provides the ability to subscribe to
24
- * changes to Cache state.
25
- *
26
- * This Feature is what allows EmberData to create subscriptions that
27
- * work with any framework or change-notification system.
28
- *
29
- * @class NotificationManager
30
- * @public
31
- */
32
- export default class NotificationManager {
33
- store: Store;
34
- isDestroyed: boolean;
35
- _buffered: Map<StableDocumentIdentifier | StableRecordIdentifier, [string, string | undefined][]>;
36
- _cache: Map<StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document', Array<NotificationCallback | ResourceOperationCallback | DocumentOperationCallback>>;
37
- _hasFlush: boolean;
38
- _onFlushCB?: () => void;
39
- constructor(store: Store);
40
- /**
41
- * Subscribe to changes for a given resource identifier, resource addition/removal, or document addition/removal.
42
- *
43
- * ```ts
44
- * export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
45
- *
46
- * export interface NotificationCallback {
47
- * (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
48
- * (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
49
- * (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;
50
- * }
51
- * export interface ResourceOperationCallback {
52
- * // resource updates
53
- * (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
54
- * }
55
- * export interface DocumentOperationCallback {
56
- * // document updates
57
- * (identifier: StableDocumentIdentifier, notificationType: CacheOperation): void;
58
- * }
59
- * ```
60
- *
61
- * @method subscribe
62
- * @public
63
- * @param {StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'} identifier
64
- * @param {NotificationCallback | ResourceOperationCallback | DocumentOperationCallback} callback
65
- * @return {UnsubscribeToken} an opaque token to be used with unsubscribe
66
- */
67
- subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;
68
- subscribe(identifier: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;
69
- subscribe(identifier: 'document' | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;
70
- /**
71
- * remove a previous subscription
72
- *
73
- * @method unsubscribe
74
- * @public
75
- * @param {UnsubscribeToken} token
76
- */
77
- unsubscribe(token: UnsubscribeToken): void;
78
- /**
79
- * Custom Caches and Application Code should not call this method directly.
80
- *
81
- * @method notify
82
- * @param identifier
83
- * @param value
84
- * @param key
85
- * @return {Boolean} whether a notification was delivered to any subscribers
86
- * @private
87
- */
88
- notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
89
- notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
90
- notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;
91
- notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;
92
- _onNextFlush(cb: () => void): void;
93
- _scheduleNotify(): boolean;
94
- _flush(): void;
95
- _flushNotification(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
96
- _flushNotification(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
97
- _flushNotification(identifier: StableRecordIdentifier | StableDocumentIdentifier, value: CacheOperation): boolean;
98
- destroy(): void;
99
- }
100
- }
101
- //# sourceMappingURL=notification-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/notification-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAK1G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACvE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAQ/F,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;AAEhH,MAAM,WAAW,oBAAoB;IACnC,CAAC,UAAU,EAAE,sBA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