@warp-drive/core 5.6.0-beta.1 → 5.6.0-beta.2

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 (120) hide show
  1. package/declarations/graph/-private/-diff.d.ts +7 -20
  2. package/declarations/graph/-private/-edge-definition.d.ts +3 -12
  3. package/declarations/graph/-private/-state.d.ts +2 -2
  4. package/declarations/graph/-private/-utils.d.ts +5 -5
  5. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +3 -3
  6. package/declarations/graph/-private/edges/collection.d.ts +10 -10
  7. package/declarations/graph/-private/edges/implicit.d.ts +5 -5
  8. package/declarations/graph/-private/edges/resource.d.ts +6 -7
  9. package/declarations/graph/-private/graph.d.ts +17 -15
  10. package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -4
  11. package/declarations/graph/-private/operations/update-relationship.d.ts +3 -3
  12. package/declarations/index.d.ts +1 -1
  13. package/declarations/reactive/-private/default-mode.d.ts +73 -0
  14. package/declarations/reactive/-private/document.d.ts +11 -27
  15. package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
  16. package/declarations/reactive/-private/fields/managed-array.d.ts +7 -10
  17. package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
  18. package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
  19. package/declarations/reactive/-private/hooks.d.ts +2 -2
  20. package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
  21. package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
  22. package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
  23. package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
  24. package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
  25. package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
  26. package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
  27. package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
  28. package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
  29. package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
  30. package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
  31. package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
  32. package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
  33. package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
  34. package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
  35. package/declarations/reactive/-private/record.d.ts +44 -33
  36. package/declarations/reactive/-private/schema.d.ts +50 -66
  37. package/declarations/reactive/-private/symbols.d.ts +2 -7
  38. package/declarations/reactive/-private.d.ts +1 -1
  39. package/declarations/reactive.d.ts +278 -1
  40. package/declarations/request/-private/context.d.ts +3 -5
  41. package/declarations/request/-private/fetch.d.ts +2 -0
  42. package/declarations/request/-private/manager.d.ts +24 -28
  43. package/declarations/request/-private/types.d.ts +22 -23
  44. package/declarations/request/-private/utils.d.ts +44 -2
  45. package/declarations/store/-private/cache-handler/handler.d.ts +2 -8
  46. package/declarations/store/-private/cache-handler/types.d.ts +10 -10
  47. package/declarations/store/-private/cache-handler/utils.d.ts +4 -4
  48. package/declarations/store/-private/caches/instance-cache.d.ts +22 -27
  49. package/declarations/store/-private/debug/utils.d.ts +1 -0
  50. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  51. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +24 -15
  52. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +38 -52
  53. package/declarations/store/-private/managers/cache-manager.d.ts +46 -95
  54. package/declarations/store/-private/managers/notification-manager.d.ts +30 -43
  55. package/declarations/store/-private/managers/record-array-manager.d.ts +44 -41
  56. package/declarations/store/-private/network/request-cache.d.ts +21 -24
  57. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  58. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
  59. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +14 -29
  60. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +24 -3
  61. package/declarations/store/-private/new-core-tmp/request-state.d.ts +133 -37
  62. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -133
  63. package/declarations/store/-private/record-arrays/-utils.d.ts +80 -0
  64. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +81 -0
  65. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +133 -0
  66. package/declarations/store/-private/record-arrays/legacy-query.d.ts +81 -0
  67. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
  68. package/declarations/store/-private/record-arrays/resource-array.d.ts +75 -0
  69. package/declarations/store/-private/store-service.d.ts +167 -872
  70. package/declarations/store/-private.d.ts +14 -10
  71. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  72. package/declarations/store/-types/q/identifier.d.ts +9 -6
  73. package/declarations/store/-types/q/record-instance.d.ts +0 -1
  74. package/declarations/store/-types/q/schema-service.d.ts +64 -40
  75. package/declarations/store/-types/q/store.d.ts +6 -7
  76. package/declarations/store/deprecated/-private.d.ts +224 -0
  77. package/declarations/store/deprecated/store.d.ts +787 -0
  78. package/declarations/types/-private.d.ts +1 -1
  79. package/declarations/types/cache/aliases.d.ts +2 -2
  80. package/declarations/types/cache/change.d.ts +2 -2
  81. package/declarations/types/cache/mutations.d.ts +13 -13
  82. package/declarations/types/cache/operations.d.ts +115 -32
  83. package/declarations/types/cache/relationship.d.ts +4 -4
  84. package/declarations/types/cache.d.ts +51 -115
  85. package/declarations/types/graph.d.ts +12 -12
  86. package/declarations/types/identifier.d.ts +52 -76
  87. package/declarations/types/params.d.ts +2 -3
  88. package/declarations/types/request.d.ts +69 -42
  89. package/declarations/types/schema/concepts.d.ts +2 -2
  90. package/declarations/types/schema/fields.d.ts +391 -14
  91. package/declarations/types/spec/document.d.ts +6 -6
  92. package/declarations/types/spec/json-api-raw.d.ts +6 -8
  93. package/declarations/types.d.ts +2 -1
  94. package/declarations/utils/string.d.ts +2 -2
  95. package/dist/{configure-B48bFHOl.js → configure-C3x8YXzL.js} +5 -5
  96. package/dist/configure.js +1 -1
  97. package/dist/{context-COmAnXUQ.js → context-C_7OLieY.js} +48 -6
  98. package/dist/graph/-private.js +137 -144
  99. package/dist/index.js +25 -14
  100. package/dist/reactive/-private.js +1 -1
  101. package/dist/reactive.js +337 -1422
  102. package/dist/{request-state-CjLph1LP.js → request-state-C955e0AL.js} +8352 -5912
  103. package/dist/request.js +1 -1
  104. package/dist/store/-private.js +2 -3
  105. package/dist/store.js +32 -44
  106. package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
  107. package/dist/types/-private.js +1 -1
  108. package/dist/types/identifier.js +19 -45
  109. package/dist/types/request.js +45 -3
  110. package/dist/types/schema/fields.js +23 -2
  111. package/dist/utils/string.js +2 -2
  112. package/package.json +10 -10
  113. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  114. package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
  115. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
  116. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
  117. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
  118. package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
  119. package/declarations/store/-types/q/ds-model.d.ts +0 -21
  120. package/dist/handler-C2T-IyJK.js +0 -339
@@ -1,11 +1,11 @@
1
- import type { StableDocumentIdentifier } from "../../../types/identifier.js";
1
+ import type { RequestKey } from "../../../types/identifier.js";
2
2
  import type { ImmutableCreateRequestOptions, ImmutableDeleteRequestOptions, ImmutableRequestInfo, ImmutableUpdateRequestOptions, StructuredDataDocument } from "../../../types/request.js";
3
3
  import type { ResourceDataDocument, ResourceErrorDocument } from "../../../types/spec/document.js";
4
4
  import type { ApiError } from "../../../types/spec/error.js";
5
5
  import type { Store } from "../store-service.js";
6
6
  export declare const MUTATION_OPS: Set<string>;
7
- export declare function calcShouldFetch(store: Store, request: ImmutableRequestInfo, hasCachedValue: boolean, identifier: StableDocumentIdentifier | null): boolean;
8
- export declare function calcShouldBackgroundFetch(store: Store, request: ImmutableRequestInfo, willFetch: boolean, identifier: StableDocumentIdentifier | null): boolean;
7
+ export declare function calcShouldFetch(store: Store, request: ImmutableRequestInfo, hasCachedValue: boolean, identifier: RequestKey | null): boolean;
8
+ export declare function calcShouldBackgroundFetch(store: Store, request: ImmutableRequestInfo, willFetch: boolean, identifier: RequestKey | null): boolean;
9
9
  export declare function isMutation(request: Partial<ImmutableRequestInfo>): request is ImmutableUpdateRequestOptions | ImmutableCreateRequestOptions | ImmutableDeleteRequestOptions;
10
10
  export declare function isCacheAffecting<T>(document: StructuredDataDocument<T>): boolean;
11
11
  export declare function isAggregateError(error: Error & {
@@ -21,7 +21,7 @@ export type RobustError = Error & {
21
21
  // TODO @runspired, consider if we should deep freeze errors (potentially only in debug) vs cloning them
22
22
  export declare function cloneError(error: RobustError): RobustError;
23
23
  export declare function isErrorDocument(document: ResourceDataDocument | ResourceErrorDocument): document is ResourceErrorDocument;
24
- export declare function getPriority(identifier: StableDocumentIdentifier | null, deduped: Map<StableDocumentIdentifier, {
24
+ export declare function getPriority(identifier: RequestKey | null, deduped: Map<RequestKey, {
25
25
  priority: {
26
26
  blocking: boolean;
27
27
  };
@@ -1,23 +1,21 @@
1
1
  import { ReactiveDocument } from "../../../reactive/-private/document.js";
2
2
  import type { Cache } from "../../../types/cache.js";
3
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
4
- import type { Value } from "../../../types/json/raw.js";
3
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
5
4
  import type { TypedRecordInstance, TypeFromInstance } from "../../../types/record.js";
6
5
  import type { OpaqueRecordInstance } from "../../-types/q/record-instance.js";
7
- import RecordReference from "../legacy-model-support/record-reference.js";
8
6
  import { CacheCapabilitiesManager } from "../managers/cache-capabilities-manager.js";
9
7
  import type { CacheManager } from "../managers/cache-manager.js";
10
8
  import type { CreateRecordProperties, Store } from "../store-service.js";
11
- export declare function peekRecordIdentifier(record: OpaqueRecordInstance): StableRecordIdentifier | undefined;
9
+ export declare function peekRecordIdentifier(record: OpaqueRecordInstance): ResourceKey | undefined;
12
10
  /**
13
- Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)
11
+ Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/ResourceKey)
14
12
  assigned to the given record instance.
15
13
 
16
14
  ```js
17
15
  import { recordIdentifierFor } from "@ember-data/store";
18
16
  // ... gain access to a record, for instance with peekRecord or findRecord
19
17
  const record = store.peekRecord("user", "1");
20
- // get the identifier for the record (see docs for StableRecordIdentifier)
18
+ // get the identifier for the record (see docs for ResourceKey)
21
19
  const identifier = recordIdentifierFor(record);
22
20
  // access the identifier's properties.
23
21
  const { id, type, lid } = identifier;
@@ -25,21 +23,21 @@ const { id, type, lid } = identifier;
25
23
 
26
24
  @public
27
25
  @param {Object} record a record instance previously obstained from the store.
28
- @return {StableRecordIdentifier}
26
+ @return {ResourceKey}
29
27
  */
30
- export declare function recordIdentifierFor<T extends TypedRecordInstance>(record: T): StableRecordIdentifier<TypeFromInstance<T>>;
31
- export declare function recordIdentifierFor(record: OpaqueRecordInstance): StableRecordIdentifier;
32
- export declare function setRecordIdentifier(record: OpaqueRecordInstance, identifier: StableRecordIdentifier): void;
28
+ export declare function recordIdentifierFor<T extends TypedRecordInstance>(record: T): ResourceKey<TypeFromInstance<T>>;
29
+ export declare function recordIdentifierFor(record: OpaqueRecordInstance): ResourceKey;
30
+ export declare function setRecordIdentifier(record: OpaqueRecordInstance, identifier: ResourceKey): void;
31
+ export declare function removeRecordIdentifier(record: OpaqueRecordInstance): void;
33
32
  export declare const StoreMap: Map<unknown, Store>;
34
33
  /**
35
34
  * We may eventually make this public, but its likely better for this to be killed off
36
- * @internal
35
+ * @private
37
36
  */
38
- export declare function storeFor(record: OpaqueRecordInstance): Store | undefined;
39
- type Caches = {
40
- record: Map<StableRecordIdentifier, OpaqueRecordInstance>;
41
- reference: WeakMap<StableRecordIdentifier, RecordReference>;
42
- document: Map<StableDocumentIdentifier, ReactiveDocument<OpaqueRecordInstance | OpaqueRecordInstance[] | null | undefined>>;
37
+ export declare function storeFor(record: OpaqueRecordInstance, ignoreMissing: boolean): Store | null;
38
+ export type Caches = {
39
+ record: Map<ResourceKey, OpaqueRecordInstance>;
40
+ document: Map<RequestKey, ReactiveDocument<OpaqueRecordInstance | OpaqueRecordInstance[] | null | undefined>>;
43
41
  };
44
42
  export declare class InstanceCache {
45
43
  store: Store;
@@ -48,18 +46,15 @@ export declare class InstanceCache {
48
46
  __cacheManager: CacheManager;
49
47
  __instances: Caches;
50
48
  constructor(store: Store);
51
- peek(identifier: StableRecordIdentifier): Cache | OpaqueRecordInstance | undefined;
52
- getDocument<T>(identifier: StableDocumentIdentifier): ReactiveDocument<T>;
53
- getRecord(identifier: StableRecordIdentifier, properties?: CreateRecordProperties): OpaqueRecordInstance;
54
- getReference(identifier: StableRecordIdentifier): RecordReference;
55
- recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted?: boolean): boolean;
56
- disconnect(identifier: StableRecordIdentifier): void;
57
- unloadRecord(identifier: StableRecordIdentifier): void;
49
+ peek(identifier: ResourceKey): Cache | OpaqueRecordInstance | undefined;
50
+ getDocument<T>(identifier: RequestKey): ReactiveDocument<T>;
51
+ getRecord(identifier: ResourceKey): OpaqueRecordInstance;
52
+ recordIsLoaded(identifier: ResourceKey, filterDeleted?: boolean): boolean;
53
+ disconnect(identifier: ResourceKey): void;
54
+ unloadRecord(identifier: ResourceKey): void;
58
55
  clear(type?: string): void;
59
56
  // TODO this should move into something coordinating operations
60
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
57
+ setRecordId(identifier: ResourceKey, id: string): void;
61
58
  }
62
- export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean;
63
- export declare function preloadData(store: Store, identifier: StableRecordIdentifier, preload: Record<string, Value>): void;
59
+ export declare function getNewRecord(instances: InstanceCache, identifier: ResourceKey, properties: CreateRecordProperties): OpaqueRecordInstance;
64
60
  export declare function _clearCaches(): void;
65
- export {};
@@ -1,6 +1,7 @@
1
1
  export declare function logGroup(scope: "cache", prefix: string, type: string, lid: string, bucket: string, key: string): void;
2
2
  export declare function logGroup(scope: "reactive-ui", prefix: string, type: string, lid: string, bucket: string, key: ""): void;
3
3
  export declare function logGroup(scope: "notify", prefix: string, type: string, lid: string, bucket: string, key: string): void;
4
+ export declare function log(scope: "request", prefix: string, type: string, lid: string, bucket: string, key: string): void;
4
5
  export declare function log(scope: "cache", prefix: string, type: string, lid: string, bucket: string, key: string): void;
5
6
  export declare function log(scope: "reactive-ui", prefix: string, type: string, lid: string, bucket: string, key: ""): void;
6
7
  export declare function log(scope: "notify", prefix: string, type: string, lid: string, bucket: string, key: string): void;
@@ -1,30 +1,30 @@
1
1
  import type { Cache } from "@warp-drive/core/types/cache";
2
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "@warp-drive/core/types/identifier";
2
+ import type { RequestKey, ResourceKey } from "@warp-drive/core/types/identifier";
3
3
  import type { ImmutableRequestInfo, ResponseInfo, StructuredDocument } from "@warp-drive/core/types/request";
4
4
  import type { ResourceDocument } from "@warp-drive/core/types/spec/document";
5
5
  type UnsubscribeToken = object;
6
6
  type CacheOperation = "added" | "removed" | "updated" | "state";
7
7
  type DocumentCacheOperation = "invalidated" | "added" | "removed" | "updated" | "state";
8
8
  export interface NotificationCallback {
9
- (identifier: StableRecordIdentifier, notificationType: "attributes" | "relationships", key?: string): void;
10
- (identifier: StableRecordIdentifier, notificationType: "errors" | "meta" | "identity" | "state"): void;
9
+ (resourceKey: ResourceKey, notificationType: "attributes" | "relationships", key?: string): void;
10
+ (resourceKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
11
11
  }
12
12
  interface ResourceOperationCallback {
13
13
  // resource updates
14
- (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
14
+ (resourceKey: ResourceKey, notificationType: CacheOperation): void;
15
15
  }
16
16
  interface DocumentOperationCallback {
17
17
  // document updates
18
- (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;
18
+ (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;
19
19
  }
20
20
  type NotificationManager = {
21
- subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;
22
- subscribe(identifier: "resource", callback: ResourceOperationCallback): UnsubscribeToken;
23
- subscribe(identifier: "document" | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;
24
- notify(identifier: StableRecordIdentifier, value: "attributes" | "relationships", key?: string): boolean;
25
- notify(identifier: StableRecordIdentifier, value: "errors" | "meta" | "identity" | "state"): boolean;
26
- notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;
27
- notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;
21
+ subscribe(resourceKey: ResourceKey, callback: NotificationCallback): UnsubscribeToken;
22
+ subscribe(cacheKey: "resource", callback: ResourceOperationCallback): UnsubscribeToken;
23
+ subscribe(cacheKey: "document" | RequestKey, callback: DocumentOperationCallback): UnsubscribeToken;
24
+ notify(cacheKey: ResourceKey, value: "attributes" | "relationships", key?: string): boolean;
25
+ notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state"): boolean;
26
+ notify(cacheKey: ResourceKey, value: CacheOperation): boolean;
27
+ notify(cacheKey: RequestKey, value: DocumentCacheOperation): boolean;
28
28
  };
29
29
  type Store = {
30
30
  cache: Cache;
@@ -236,7 +236,7 @@ export type PolicyConfig = {
236
236
  * request for that type is successful.
237
237
  *
238
238
  * For this to work, the `createRecord` request must include the `cacheOptions.types` array
239
- * with the types that should be invalidated, or its request should specify the identifiers
239
+ * with the types that should be invalidated, or its request should specify the ResourceKeys
240
240
  * of the records that are being created via `records`. Providing both is valid.
241
241
  *
242
242
  * > [!NOTE]
@@ -285,30 +285,28 @@ export type PolicyConfig = {
285
285
  export declare class DefaultCachePolicy {
286
286
  config: PolicyConfig;
287
287
  _stores: WeakMap<Store, {
288
- invalidated: Set<StableDocumentIdentifier>;
289
- types: Map<string, Set<StableDocumentIdentifier>>;
288
+ invalidated: Set<RequestKey>;
289
+ types: Map<string, Set<RequestKey>>;
290
290
  }>;
291
291
  _getStore(store: Store): {
292
- invalidated: Set<StableDocumentIdentifier>;
293
- types: Map<string, Set<StableDocumentIdentifier>>;
292
+ invalidated: Set<RequestKey>;
293
+ types: Map<string, Set<RequestKey>>;
294
294
  };
295
295
  constructor(config: PolicyConfig);
296
296
  /**
297
- * Invalidate a request by its identifier for a given store instance.
297
+ * Invalidate a request by its CacheKey for the given store instance.
298
298
  *
299
299
  * While the store argument may seem redundant, the CachePolicy
300
300
  * is designed to be shared across multiple stores / forks
301
301
  * of the store.
302
302
  *
303
303
  * ```ts
304
- * store.lifetimes.invalidateRequest(store, identifier);
304
+ * store.lifetimes.invalidateRequest(store, cacheKey);
305
305
  * ```
306
306
  *
307
307
  * @public
308
- * @param {StableDocumentIdentifier} identifier
309
- * @param {Store} store
310
308
  */
311
- invalidateRequest(identifier: StableDocumentIdentifier, store: Store): void;
309
+ invalidateRequest(cacheKey: RequestKey, store: Store): void;
312
310
  /**
313
311
  * Invalidate all requests associated to a specific type
314
312
  * for a given store instance.
@@ -325,8 +323,6 @@ export declare class DefaultCachePolicy {
325
323
  * ```
326
324
  *
327
325
  * @public
328
- * @param {String} type
329
- * @param {Store} store
330
326
  */
331
327
  invalidateRequestsForType(type: string, store: Store): void;
332
328
  /**
@@ -340,13 +336,8 @@ export declare class DefaultCachePolicy {
340
336
  * This method should not be invoked directly by consumers.
341
337
  *
342
338
  * @public
343
- * @param {ImmutableRequestInfo} request
344
- * @param {ImmutableResponse} response
345
- * @param {Store} store
346
- * @param {StableDocumentIdentifier | null} identifier
347
- * @return {void}
348
339
  */
349
- didRequest(request: ImmutableRequestInfo, response: Response | ResponseInfo | null, identifier: StableDocumentIdentifier | null, store: Store): void;
340
+ didRequest(request: ImmutableRequestInfo, response: Response | ResponseInfo | null, cacheKey: RequestKey | null, store: Store): void;
350
341
  /**
351
342
  * Invoked to determine if the request may be fulfilled from cache
352
343
  * if possible.
@@ -359,11 +350,9 @@ export declare class DefaultCachePolicy {
359
350
  * and the cache will be updated before returning the response.
360
351
  *
361
352
  * @public
362
- * @param {StableDocumentIdentifier} identifier
363
- * @param {Store} store
364
- * @return {Boolean} true if the request is considered hard expired
353
+ * @return true if the request is considered hard expired
365
354
  */
366
- isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
355
+ isHardExpired(cacheKey: RequestKey, store: Store): boolean;
367
356
  /**
368
357
  * Invoked if `isHardExpired` is false to determine if the request
369
358
  * should be update behind the scenes if cache data is already available.
@@ -375,10 +364,8 @@ export declare class DefaultCachePolicy {
375
364
  * request is made to update the cache via the configured request handlers.
376
365
  *
377
366
  * @public
378
- * @param {StableDocumentIdentifier} identifier
379
- * @param {Store} store
380
- * @return {Boolean} true if the request is considered soft expired
367
+ * @return true if the request is considered soft expired
381
368
  */
382
- isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
369
+ isSoftExpired(cacheKey: RequestKey, store: Store): boolean;
383
370
  }
384
371
  export {};
@@ -1,25 +1,34 @@
1
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
1
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
2
2
  import type { CacheCapabilitiesManager as StoreWrapper } from "../../-types/q/cache-capabilities-manager.js";
3
3
  import type { SchemaService } from "../../-types/q/schema-service.js";
4
- import type { IdentifierCache } from "../caches/identifier-cache.js";
5
- import type { Store } from "../store-service.js";
4
+ import type { PrivateStore, Store } from "../store-service.js";
5
+ import type { CacheKeyManager } from "./cache-key-manager.js";
6
6
  import type { NotificationType } from "./notification-manager.js";
7
7
  export interface CacheCapabilitiesManager {
8
+ /** @deprecated - use {@link CacheCapabilitiesManager.schema} */
8
9
  getSchemaDefinitionService(): SchemaService;
9
10
  }
10
11
  export declare class CacheCapabilitiesManager implements StoreWrapper {
11
- _willNotify: boolean;
12
- _pendingNotifies: Map<StableRecordIdentifier, Set<string>>;
13
- _store: Store;
14
12
  constructor(_store: Store);
15
- get identifierCache(): IdentifierCache;
16
- _scheduleNotification(identifier: StableRecordIdentifier, key: string): void;
17
- _flushNotifications(): void;
18
- notifyChange(identifier: StableRecordIdentifier, namespace: "added" | "removed", key: null): void;
19
- notifyChange(identifier: StableDocumentIdentifier, namespace: "added" | "updated" | "removed", key: null): void;
20
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key: string | null): void;
13
+ get cacheKeyManager(): CacheKeyManager;
14
+ /** @deprecated use {@link CacheCapabilitiesManager.cacheKeyManager} */
15
+ get identifierCache(): CacheKeyManager;
16
+ notifyChange(identifier: ResourceKey, namespace: "added" | "removed", key: null): void;
17
+ notifyChange(identifier: RequestKey, namespace: "added" | "updated" | "removed", key: null): void;
18
+ notifyChange(identifier: ResourceKey, namespace: NotificationType, key: string | null): void;
21
19
  get schema(): SchemaService;
22
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
23
- hasRecord(identifier: StableRecordIdentifier): boolean;
24
- disconnectRecord(identifier: StableRecordIdentifier): void;
20
+ setRecordId(identifier: ResourceKey, id: string): void;
21
+ hasRecord(identifier: ResourceKey): boolean;
22
+ disconnectRecord(identifier: ResourceKey): void;
25
23
  }
24
+ /**
25
+ * This type exists for internal use only for
26
+ * where intimate contracts still exist either for
27
+ * the Test Suite or for Legacy code.
28
+ *
29
+ * @private
30
+ */
31
+ export interface PrivateCacheCapabilitiesManager extends CacheCapabilitiesManager {
32
+ _store: PrivateStore;
33
+ }
34
+ export declare function assertPrivateCapabilities(manager: unknown): asserts manager is PrivateCacheCapabilitiesManager;
@@ -1,13 +1,13 @@
1
- import { type Identifier, type RecordIdentifier, type StableDocumentIdentifier, type StableExistingRecordIdentifier, type StableRecordIdentifier } from "../../../types/identifier.js";
1
+ import { type PersistedResourceKey, type RequestKey, type ResourceKey } from "../../../types/identifier.js";
2
2
  import type { ImmutableRequestInfo } from "../../../types/request.js";
3
3
  import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from "../../../types/spec/json-api-raw.js";
4
4
  import type { ForgetMethod, GenerationMethod, KeyInfo, KeyInfoMethod, ResetMethod, UpdateMethod } from "../../-types/q/identifier.js";
5
5
  type TypeFromIdentifier<T> = T extends {
6
6
  type: infer U;
7
7
  } ? U : string;
8
- type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? StableExistingRecordIdentifier<TypeFromIdentifier<T>> : StableRecordIdentifier;
9
- export declare function isStableIdentifier(identifier: unknown): identifier is StableRecordIdentifier;
10
- export declare function isDocumentIdentifier(identifier: unknown): identifier is StableDocumentIdentifier;
8
+ type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? PersistedResourceKey<TypeFromIdentifier<T>> : ResourceKey;
9
+ export declare function isResourceKey(identifier: unknown): identifier is ResourceKey;
10
+ export declare function isRequestKey(identifier: unknown): identifier is RequestKey;
11
11
  interface KeyOptions {
12
12
  lid: IdentifierMap;
13
13
  id: IdentifierMap;
@@ -15,16 +15,16 @@ interface KeyOptions {
15
15
  type TypeMap = {
16
16
  [key: string]: KeyOptions;
17
17
  };
18
- // type IdentifierTypeLookup = { all: Set<StableRecordIdentifier>; id: Map<string, StableRecordIdentifier> };
18
+ // type IdentifierTypeLookup = { all: Set<ResourceKey>; id: Map<string, ResourceKey> };
19
19
  // type IdentifiersByType = Map<string, IdentifierTypeLookup>;
20
- type IdentifierMap = Map<string, StableRecordIdentifier>;
20
+ type IdentifierMap = Map<string, ResourceKey>;
21
21
  type StableCache = {
22
22
  resources: IdentifierMap;
23
- documents: Map<string, StableDocumentIdentifier>;
23
+ documents: Map<string, RequestKey>;
24
24
  resourcesByType: TypeMap;
25
25
  polymorphicLidBackMap: Map<string, string[]>;
26
26
  };
27
- export type MergeMethod = (targetIdentifier: StableRecordIdentifier, matchedIdentifier: StableRecordIdentifier, resourceData: unknown) => StableRecordIdentifier;
27
+ export type MergeMethod = (targetIdentifier: ResourceKey, matchedIdentifier: ResourceKey, resourceData: unknown) => ResourceKey;
28
28
  /**
29
29
  Configures how unique identifier lid strings are generated by @ember-data/store.
30
30
 
@@ -163,10 +163,10 @@ to the application instance, you may not need to implement the `resetMethod`.
163
163
  export declare function setIdentifierResetMethod(method: ResetMethod | null): void;
164
164
  /**
165
165
  Configure a callback for when the identifier cache is generating a new
166
- StableRecordIdentifier for a resource.
166
+ ResourceKey for a resource.
167
167
 
168
168
  This method controls the `type` and `id` that will be assigned to the
169
- `StableRecordIdentifier` that is created.
169
+ `ResourceKey` that is created.
170
170
 
171
171
  This configuration MUST occur prior to the store instance being created.
172
172
 
@@ -178,7 +178,7 @@ import { setKeyInfoForResource } from '@warp-drive/core';
178
178
  */
179
179
  export declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
180
180
  /**
181
- * Each instance of {@link Store} receives a unique instance of a IdentifierCache.
181
+ * Each instance of {@link Store} receives a unique instance of a CacheKeyManager.
182
182
  *
183
183
  * This cache is responsible for assigning or retrieving the unique identify
184
184
  * for arbitrary resource data encountered by the store. Data representing
@@ -190,53 +190,23 @@ export declare function setKeyInfoForResource(method: KeyInfoMethod | null): voi
190
190
  * @hideconstructor
191
191
  * @public
192
192
  */
193
- export declare class IdentifierCache {
194
- /** @internal */
195
- _cache: StableCache;
196
- private _generate;
197
- private _update;
198
- private _forget;
199
- private _reset;
200
- private _merge;
201
- private _keyInfoForResource;
202
- private _id;
193
+ export declare class CacheKeyManager {
203
194
  constructor();
204
195
  /**
205
- * Internal hook to allow management of merge conflicts with identifiers.
206
- *
207
- * we allow late binding of this private internal merge so that
208
- * the cache can insert itself here to handle elimination of duplicates
209
- *
210
- * @private
211
- */
212
- __configureMerge(method: MergeMethod | null): void;
213
- /** @internal */
214
- upgradeIdentifier(resource: {
215
- type: string;
216
- id: string | null;
217
- lid?: string;
218
- }): StableRecordIdentifier;
219
- /**
220
- * @private
221
- */
222
- private _getRecordIdentifier;
223
- private _getRecordIdentifier;
224
- private _getRecordIdentifier;
225
- /**
226
196
  * allows us to peek without generating when needed
227
197
  * useful for the "create" case when we need to see if
228
198
  * we are accidentally overwritting something
229
199
  *
230
200
  * @private
231
201
  */
232
- peekRecordIdentifier(resource: ResourceIdentifierObject | Identifier): StableRecordIdentifier | undefined;
202
+ peekRecordIdentifier(resource: ResourceIdentifierObject): ResourceKey | undefined;
233
203
  /**
234
204
  Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.
235
205
  Returns `null` if the request does not have a `cacheKey` or `url`.
236
206
 
237
207
  @public
238
208
  */
239
- getOrCreateDocumentIdentifier(request: ImmutableRequestInfo): StableDocumentIdentifier | null;
209
+ getOrCreateDocumentIdentifier(request: ImmutableRequestInfo): RequestKey | null;
240
210
  /**
241
211
  Returns the Identifier for the given Resource, creates one if it does not yet exist.
242
212
 
@@ -263,7 +233,8 @@ export declare class IdentifierCache {
263
233
  createIdentifierForNewRecord(data: {
264
234
  type: string;
265
235
  id?: string | null;
266
- }): StableRecordIdentifier;
236
+ lid?: string;
237
+ }): ResourceKey;
267
238
  /**
268
239
  Provides the opportunity to update secondary lookup tables for existing identifiers
269
240
  Called after an identifier created with `createIdentifierForNewRecord` has been
@@ -282,11 +253,8 @@ export declare class IdentifierCache {
282
253
 
283
254
  @public
284
255
  */
285
- updateRecordIdentifier(identifierObject: RecordIdentifier, data: unknown): StableRecordIdentifier;
286
- /**
287
- * @private
288
- */
289
- _mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: StableRecordIdentifier, existingIdentifier: StableRecordIdentifier, data: unknown): StableRecordIdentifier;
256
+ // FIXME audit usage
257
+ updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
290
258
  /**
291
259
  Provides the opportunity to eliminate an identifier from secondary lookup tables
292
260
  as well as eliminates it from ember-data's own lookup tables and book keeping.
@@ -297,8 +265,26 @@ export declare class IdentifierCache {
297
265
 
298
266
  @public
299
267
  */
300
- forgetRecordIdentifier(identifierObject: RecordIdentifier): void;
301
- /** @internal */
268
+ // FIXME audit usage
269
+ forgetRecordIdentifier(identifierObject: ResourceKey): void;
270
+ }
271
+ /**
272
+ * This type exists for internal use only for
273
+ * where intimate contracts still exist either for
274
+ * the Test Suite or for Legacy code.
275
+ *
276
+ * @private
277
+ */
278
+ export interface PrivateCacheKeyManager extends CacheKeyManager {
279
+ _cache: StableCache;
280
+ /**
281
+ * Internal hook to allow management of merge conflicts with identifiers.
282
+ *
283
+ * we allow late binding of this private internal merge so that
284
+ * the cache can insert itself here to handle elimination of duplicates
285
+ */
286
+ __configureMerge(method: MergeMethod | null): void;
287
+ _mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
302
288
  destroy(): void;
303
289
  }
304
290
  export {};