@warp-drive/core 5.7.0-alpha.14 → 5.7.0-alpha.16

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 (69) hide show
  1. package/declarations/graph/-private/-diff.d.ts +8 -8
  2. package/declarations/graph/-private/-edge-definition.d.ts +2 -2
  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 +5 -5
  9. package/declarations/graph/-private/graph.d.ts +15 -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 +2 -2
  14. package/declarations/reactive/-private/document.d.ts +6 -16
  15. package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
  16. package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
  17. package/declarations/reactive/-private/hooks.d.ts +2 -2
  18. package/declarations/reactive/-private/record.d.ts +44 -5
  19. package/declarations/reactive/-private/schema.d.ts +12 -12
  20. package/declarations/reactive/-private/symbols.d.ts +1 -0
  21. package/declarations/reactive.d.ts +277 -1
  22. package/declarations/request/-private/context.d.ts +2 -2
  23. package/declarations/request/-private/manager.d.ts +2 -2
  24. package/declarations/request/-private/types.d.ts +4 -4
  25. package/declarations/store/-private/cache-handler/types.d.ts +9 -9
  26. package/declarations/store/-private/cache-handler/utils.d.ts +4 -4
  27. package/declarations/store/-private/caches/instance-cache.d.ts +18 -18
  28. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  29. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -11
  30. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +21 -19
  31. package/declarations/store/-private/managers/cache-manager.d.ts +46 -94
  32. package/declarations/store/-private/managers/notification-manager.d.ts +21 -22
  33. package/declarations/store/-private/managers/record-array-manager.d.ts +15 -15
  34. package/declarations/store/-private/network/request-cache.d.ts +11 -11
  35. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  36. package/declarations/store/-private/new-core-tmp/request-state.d.ts +1 -1
  37. package/declarations/store/-private/record-arrays/-utils.d.ts +3 -3
  38. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +2 -2
  39. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +2 -2
  40. package/declarations/store/-private/record-arrays/resource-array.d.ts +9 -9
  41. package/declarations/store/-private/store-service.d.ts +19 -16
  42. package/declarations/store/-private.d.ts +1 -1
  43. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  44. package/declarations/store/-types/q/identifier.d.ts +9 -6
  45. package/declarations/store/-types/q/schema-service.d.ts +9 -9
  46. package/declarations/store/deprecated/-private.d.ts +5 -5
  47. package/declarations/types/-private.d.ts +1 -1
  48. package/declarations/types/cache/aliases.d.ts +2 -2
  49. package/declarations/types/cache/change.d.ts +2 -2
  50. package/declarations/types/cache/mutations.d.ts +13 -13
  51. package/declarations/types/cache/operations.d.ts +20 -20
  52. package/declarations/types/cache/relationship.d.ts +4 -4
  53. package/declarations/types/cache.d.ts +51 -113
  54. package/declarations/types/graph.d.ts +12 -12
  55. package/declarations/types/identifier.d.ts +60 -76
  56. package/declarations/types/request.d.ts +6 -6
  57. package/declarations/types/schema/concepts.d.ts +2 -2
  58. package/declarations/types/spec/document.d.ts +6 -6
  59. package/dist/graph/-private.js +125 -125
  60. package/dist/index.js +2 -2
  61. package/dist/reactive/-private.js +1 -1
  62. package/dist/reactive.js +126 -4
  63. package/dist/{request-state-CCrTjb0Z.js → request-state-CQ0Q6d1V.js} +3493 -3483
  64. package/dist/store/-private.js +1 -1
  65. package/dist/store.js +30 -43
  66. package/dist/{symbols-C5p2hcy9.js → symbols-sql1_mdx.js} +2 -1
  67. package/dist/types/-private.js +1 -1
  68. package/dist/types/identifier.js +19 -45
  69. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import type { LocalRelationshipOperation } from "../../../types/graph.js";
2
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
2
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
3
3
  import type { ImmutableRequestInfo } from "../../../types/request.js";
4
4
  import type { CollectionResourceDocument } from "../../../types/spec/json-api-raw.js";
5
5
  import type { LegacyLiveArray } from "../record-arrays/legacy-live-array.js";
@@ -50,13 +50,13 @@ interface LegacyQueryInit {
50
50
  query: ImmutableRequestInfo | Record<string, unknown>;
51
51
  }
52
52
  interface AnonymousRequestCollectionInit {
53
- source: StableRecordIdentifier[];
53
+ source: ResourceKey[];
54
54
  }
55
55
  interface RequestCollectionInit {
56
- source: StableRecordIdentifier[];
57
- requestKey: StableDocumentIdentifier;
56
+ source: ResourceKey[];
57
+ requestKey: RequestKey;
58
58
  }
59
- type ChangeSet = Map<StableRecordIdentifier, "add" | "del">;
59
+ type ChangeSet = Map<ResourceKey, "add" | "del">;
60
60
  /**
61
61
  @class RecordArrayManager
62
62
  @internal
@@ -68,7 +68,7 @@ export declare class RecordArrayManager {
68
68
  /**
69
69
  *
70
70
  */
71
- _set: Map<ReactiveResourceArray, Set<StableRecordIdentifier>>;
71
+ _set: Map<ReactiveResourceArray, Set<ResourceKey>>;
72
72
  /**
73
73
  * LiveArray (peekAll/findAll) array instances
74
74
  * keyed by their ResourceType.
@@ -84,11 +84,11 @@ export declare class RecordArrayManager {
84
84
  */
85
85
  _pending: Map<ReactiveResourceArray, ChangeSet>;
86
86
  /**
87
- * An inverse map from StableRecordIdentifier to the list
87
+ * An inverse map from ResourceKey to the list
88
88
  * of arrays it can be found in, useful for fast updates
89
89
  * when state changes to a resource occur.
90
90
  */
91
- _identifiers: Map<StableRecordIdentifier, Set<ReactiveResourceArray>>;
91
+ _identifiers: Map<ResourceKey, Set<ReactiveResourceArray>>;
92
92
  /**
93
93
  * When we do not yet have a LiveArray, this keeps track of
94
94
  * the added/removed identifiers to enable us to more efficiently
@@ -114,7 +114,7 @@ export declare class RecordArrayManager {
114
114
  * an exclusion list. Any entry not in the list would be considered
115
115
  * visible.
116
116
  */
117
- _visibilitySet: Map<StableRecordIdentifier, boolean>;
117
+ _visibilitySet: Map<ResourceKey, boolean>;
118
118
  constructor(options: {
119
119
  store: Store;
120
120
  });
@@ -134,15 +134,15 @@ export declare class RecordArrayManager {
134
134
  getCollection(config: AnonymousRequestCollectionInit): ReactiveResourceArray;
135
135
  getCollection(config: RequestCollectionInit): ReactiveResourceArray;
136
136
  dirtyArray(array: ReactiveResourceArray, delta: number, shouldSyncFromCache: boolean): void;
137
- _getPendingFor(identifier: StableRecordIdentifier, includeManaged: boolean, isRemove?: boolean): Map<ReactiveResourceArray, ChangeSet> | void;
138
- populateManagedArray(array: ReactiveResourceArray, identifiers: StableRecordIdentifier[], payload: CollectionResourceDocument | null): void;
139
- identifierAdded(identifier: StableRecordIdentifier): void;
140
- identifierRemoved(identifier: StableRecordIdentifier): void;
141
- identifierChanged(identifier: StableRecordIdentifier): void;
137
+ _getPendingFor(identifier: ResourceKey, includeManaged: boolean, isRemove?: boolean): Map<ReactiveResourceArray, ChangeSet> | void;
138
+ populateManagedArray(array: ReactiveResourceArray, identifiers: ResourceKey[], payload: CollectionResourceDocument | null): void;
139
+ identifierAdded(identifier: ResourceKey): void;
140
+ identifierRemoved(identifier: ResourceKey): void;
141
+ identifierChanged(identifier: ResourceKey): void;
142
142
  pause(): void;
143
143
  resume(): void;
144
144
  clear(isClear?: boolean): void;
145
145
  destroy(): void;
146
146
  }
147
- export declare function disassociateIdentifier(ArraysCache: Map<StableRecordIdentifier, Set<ReactiveResourceArray>>, array: ReactiveResourceArray, identifier: StableRecordIdentifier): void;
147
+ export declare function disassociateIdentifier(ArraysCache: Map<ResourceKey, Set<ReactiveResourceArray>>, array: ReactiveResourceArray, identifier: ResourceKey): void;
148
148
  export {};
@@ -1,4 +1,4 @@
1
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
1
+ import type { ResourceKey } from "../../../types/identifier.js";
2
2
  import type { FindRecordOptions } from "../../-types/q/store.js";
3
3
  import type { Store } from "../store-service.js";
4
4
  declare const Touching: "___(unique) Symbol(Touching)";
@@ -6,7 +6,7 @@ export declare const RequestPromise: "___(unique) Symbol(RequestPromise)";
6
6
  export interface Operation {
7
7
  op: string;
8
8
  options: FindRecordOptions | undefined;
9
- recordIdentifier: StableRecordIdentifier;
9
+ recordIdentifier: ResourceKey;
10
10
  }
11
11
  export interface FindRecordQuery extends Operation {
12
12
  op: "findRecord";
@@ -30,7 +30,7 @@ export interface Response {
30
30
  data: unknown;
31
31
  }
32
32
  interface InternalRequest extends RequestCacheRequestState {
33
- [Touching]: StableRecordIdentifier[];
33
+ [Touching]: ResourceKey[];
34
34
  [RequestPromise]?: Promise<unknown>;
35
35
  }
36
36
  export type RequestSubscription = (requestState: RequestCacheRequestState) => void;
@@ -43,14 +43,14 @@ export type RequestSubscription = (requestState: RequestCacheRequestState) => vo
43
43
  */
44
44
  export declare class RequestStateService {
45
45
  /** @internal */
46
- _pending: Map<StableRecordIdentifier, InternalRequest[]>;
46
+ _pending: Map<ResourceKey, InternalRequest[]>;
47
47
  private _done;
48
48
  private _subscriptions;
49
49
  private _toFlush;
50
50
  private _store;
51
51
  constructor(store: Store);
52
52
  /** @internal */
53
- _clearEntries(identifier: StableRecordIdentifier): void;
53
+ _clearEntries(identifier: ResourceKey): void;
54
54
  /** @internal */
55
55
  _enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T>;
56
56
  private _triggerSubscriptions;
@@ -83,25 +83,25 @@ export declare class RequestStateService {
83
83
  * design.
84
84
  *
85
85
  * @public
86
- * @param {StableRecordIdentifier} identifier
86
+ * @param {ResourceKey} identifier
87
87
  * @param {(state: RequestCacheRequestState) => void} callback
88
88
  */
89
- subscribeForRecord(identifier: StableRecordIdentifier, callback: RequestSubscription): void;
89
+ subscribeForRecord(identifier: ResourceKey, callback: RequestSubscription): void;
90
90
  /**
91
91
  * Retrieve all active requests for a given resource identity.
92
92
  *
93
93
  * @public
94
- * @param {StableRecordIdentifier} identifier
94
+ * @param {ResourceKey} identifier
95
95
  * @return {RequestCacheRequestState[]} an array of request states for any pending requests for the given identifier
96
96
  */
97
- getPendingRequestsForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState[];
97
+ getPendingRequestsForRecord(identifier: ResourceKey): RequestCacheRequestState[];
98
98
  /**
99
99
  * Retrieve the last completed request for a given resource identity.
100
100
  *
101
101
  * @public
102
- * @param {StableRecordIdentifier} identifier
102
+ * @param {ResourceKey} identifier
103
103
  * @return {RequestCacheRequestState | null} the state of the most recent request for the given identifier
104
104
  */
105
- getLastRequestForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState | null;
105
+ getLastRequestForRecord(identifier: ResourceKey): RequestCacheRequestState | null;
106
106
  }
107
107
  export {};
@@ -0,0 +1,24 @@
1
+ import type { RequestKey } from "../../../types/identifier.js";
2
+ import type { Store } from "../store-service.js";
3
+ /**
4
+ * Creates an {@link ExpensiveSubscription} for the {@link RequestKey}
5
+ * if one does not already exist and adds a watcher to it.
6
+ *
7
+ * Returns a cleanup function. This should be called on-mount by a component
8
+ * that wants to subscribe to a request and cleanup should be called on dismount.
9
+ *
10
+ * ::: warning ⚠️ Avoid Using If Your App Supports Fine-grained Reactivity
11
+ * This mechanism should never be used by frameworks or libraries
12
+ * that support fine-grained reactivity.
13
+ * :::
14
+ *
15
+ * `ExpensiveSubscription` is a mechanism for non-reactive
16
+ * frameworks such as `react` to integrate with WarpDrive, for instance
17
+ * by treating a request as an [external store](https://react.dev/reference/react/useSyncExternalStore)
18
+ *
19
+ * `ExpensiveSubscription` is expensive *because* it doubles the number
20
+ * of notification callbacks required for each resource contained in
21
+ * the request being subscribed to. The more requests in-use, the more
22
+ * this cost adds up.
23
+ */
24
+ export declare function getExpensiveRequestSubscription(store: Store, requestKey: RequestKey, callback: () => void): () => void;
@@ -195,7 +195,7 @@ export interface CancelledRequest<
195
195
  * interface Future<T> extends Promise<T>> {
196
196
  * getStream(): Promise<ReadableStream>;
197
197
  * abort(): void;
198
- * lid: StableDocumentIdentifier | null;
198
+ * lid: RequestKey | null;
199
199
  * }
200
200
  * ```
201
201
  *
@@ -1,6 +1,6 @@
1
1
  import type { BaseFinderOptions } from "../../../types.js";
2
2
  import type { LocalRelationshipOperation } from "../../../types/graph.js";
3
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
3
+ import type { ResourceKey } from "../../../types/identifier.js";
4
4
  import type { Store } from "../store-service.js";
5
5
  import type { NativeProxy } from "./native-proxy-type-fix.js";
6
6
  import type { ReactiveResourceArray } from "./resource-array.js";
@@ -66,8 +66,8 @@ export type KeyType = string | symbol | number;
66
66
  export declare function isArrayGetter<T>(prop: KeyType): prop is keyof Array<T>;
67
67
  export declare function isArraySetter<T>(prop: KeyType): prop is keyof Array<T>;
68
68
  export declare function convertToInt(prop: KeyType): number | null;
69
- export type ForEachCB<T> = (record: T, index: number, context: typeof NativeProxy<StableRecordIdentifier[], T[]>) => void;
70
- export declare function safeForEach<T>(instance: typeof NativeProxy<StableRecordIdentifier[], T[]>, arr: StableRecordIdentifier[], store: Store, callback: ForEachCB<T>, target: unknown): typeof NativeProxy<StableRecordIdentifier[], T[]>;
69
+ export type ForEachCB<T> = (record: T, index: number, context: typeof NativeProxy<ResourceKey[], T[]>) => void;
70
+ export declare function safeForEach<T>(instance: typeof NativeProxy<ResourceKey[], T[]>, arr: ResourceKey[], store: Store, callback: ForEachCB<T>, target: unknown): typeof NativeProxy<ResourceKey[], T[]>;
71
71
  type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
72
72
  type PromiseManyArray<T> = {
73
73
  length: number;
@@ -1,4 +1,4 @@
1
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
1
+ import type { ResourceKey } from "../../../types/identifier.js";
2
2
  import type { TypeFromInstanceOrString } from "../../../types/record.js";
3
3
  import type { Store } from "../store-service.js";
4
4
  import type { LegacyArray, MinimumManager } from "./-utils.js";
@@ -78,7 +78,7 @@ export interface LegacyLiveArray<T = unknown> extends LegacyArray<T> {
78
78
  export interface LegacyLiveArrayCreateOptions {
79
79
  store: Store;
80
80
  manager: MinimumManager;
81
- source: StableRecordIdentifier[];
81
+ source: ResourceKey[];
82
82
  type: string;
83
83
  }
84
84
  /**
@@ -1,4 +1,4 @@
1
- import type { BaseFinderOptions, StableRecordIdentifier } from "../../../types.js";
1
+ import type { BaseFinderOptions, ResourceKey } from "../../../types.js";
2
2
  import type { TypedRecordInstance, TypeFromInstance } from "../../../types/record.js";
3
3
  import type { LegacyHasManyField, LinksModeHasManyField } from "../../../types/schema/fields.js";
4
4
  import type { Links, Meta, PaginationLinks } from "../../../types/spec/json-api-raw.js";
@@ -127,7 +127,7 @@ export interface LegacyManyArrayCreateOptions extends LegacyLiveArrayCreateOptio
127
127
  isAsync: boolean;
128
128
  isPolymorphic: boolean;
129
129
  field: LegacyHasManyField | LinksModeHasManyField;
130
- identifier: StableRecordIdentifier;
130
+ identifier: ResourceKey;
131
131
  links: Links | PaginationLinks | null;
132
132
  meta: Meta | null;
133
133
  }
@@ -1,6 +1,6 @@
1
1
  import type { ExtensionDef } from "../../../reactive.js";
2
2
  import { Context } from "../../../reactive/-private.js";
3
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
3
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
4
4
  import type { ObjectValue } from "../../../types/json/raw.js";
5
5
  import type { CollectionField } from "../../../types/schema/fields.js";
6
6
  import type { SignalStore, WarpDriveSignal } from "../new-core-tmp/reactivity/internal.js";
@@ -14,7 +14,7 @@ interface ReactiveResourceArrayCreateOptions {
14
14
  store: Store;
15
15
  manager: MinimumManager;
16
16
  editable: boolean;
17
- source: StableRecordIdentifier[];
17
+ source: ResourceKey[];
18
18
  // reactive, passed in
19
19
  data: ObjectValue | null;
20
20
  // non-reactive, passed in
@@ -23,11 +23,11 @@ interface ReactiveResourceArrayCreateOptions {
23
23
  // not-accessible except by the context
24
24
  options: Record<string, unknown> | null;
25
25
  destroy: null | ((this: ReactiveResourceArray, clear: boolean) => void);
26
- mutate: null | ((target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown);
26
+ mutate: null | ((target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown);
27
27
  }
28
28
  interface ReactiveResourceArrayContext extends ReactiveResourceArrayCreateOptions {
29
29
  destroy: (this: ReactiveResourceArray, clear: boolean) => void;
30
- mutate: (target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown;
30
+ mutate: (target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown;
31
31
  // generated
32
32
  signals: SignalStore;
33
33
  signal: WarpDriveSignal;
@@ -48,7 +48,7 @@ export interface ReactiveResourceArray<T = unknown> extends Omit<Array<T>, "[]">
48
48
  /** @internal */
49
49
  [Context]: ReactiveResourceArrayContext;
50
50
  }
51
- export interface TargetArray extends Array<StableRecordIdentifier> {
51
+ export interface TargetArray extends Array<ResourceKey> {
52
52
  /** @internal */
53
53
  [Context]: ReactiveResourceArrayContext;
54
54
  }
@@ -58,9 +58,9 @@ export interface ReactiveRequestCollectionCreateArgs {
58
58
  // passed in
59
59
  store: Store;
60
60
  manager: MinimumManager;
61
- source: StableRecordIdentifier[];
61
+ source: ResourceKey[];
62
62
  options: {
63
- requestKey: StableDocumentIdentifier;
63
+ requestKey: RequestKey;
64
64
  } | null;
65
65
  }
66
66
  export declare function createRequestCollection(config: ReactiveRequestCollectionCreateArgs): ReactiveResourceArray;
@@ -68,10 +68,10 @@ export interface ReactiveRelatedCollectionCreateArgs {
68
68
  // passed in
69
69
  store: Store;
70
70
  manager: MinimumManager;
71
- source: StableRecordIdentifier[];
71
+ source: ResourceKey[];
72
72
  // not-accessible except by the context
73
73
  options: {
74
- resourceKey: StableRecordIdentifier;
74
+ resourceKey: ResourceKey;
75
75
  path: string[];
76
76
  field: CollectionField;
77
77
  };
@@ -2,7 +2,7 @@ import type { Graph } from "../../graph/-private.js";
2
2
  import type { Future } from "../../request.js";
3
3
  import type { RequestManager } from "../../request/-private/manager.js";
4
4
  import type { Cache } from "../../types/cache.js";
5
- import type { StableExistingRecordIdentifier, StableRecordIdentifier } from "../../types/identifier.js";
5
+ import type { PersistedResourceKey, ResourceKey } from "../../types/identifier.js";
6
6
  import type { TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
7
7
  import type { CollectionResourceDocument, EmptyResourceDocument, JsonApiDocument, ResourceIdentifierObject, SingleResourceDocument } from "../../types/spec/json-api-raw.js";
8
8
  import type { Type } from "../../types/symbols.js";
@@ -11,8 +11,8 @@ import type { OpaqueRecordInstance } from "../-types/q/record-instance.js";
11
11
  import type { SchemaService } from "../-types/q/schema-service.js";
12
12
  import type { StoreRequestInput } from "./cache-handler/handler.js";
13
13
  import type { CachePolicy } from "./cache-handler/types.js";
14
- import { IdentifierCache } from "./caches/identifier-cache.js";
15
14
  import { InstanceCache, storeFor } from "./caches/instance-cache.js";
15
+ import { CacheKeyManager } from "./managers/cache-key-manager.js";
16
16
  import NotificationManager from "./managers/notification-manager.js";
17
17
  import { RecordArrayManager } from "./managers/record-array-manager.js";
18
18
  import { RequestStateService } from "./network/request-cache.js";
@@ -79,7 +79,7 @@ export interface Store {
79
79
  * @public
80
80
  */
81
81
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
82
- instantiateRecord<T>(identifier: StableRecordIdentifier, createRecordArgs: {
82
+ instantiateRecord<T>(identifier: ResourceKey, createRecordArgs: {
83
83
  [key: string]: unknown;
84
84
  }): OpaqueRecordInstance;
85
85
  /**
@@ -193,11 +193,11 @@ export interface Store {
193
193
  * return this._schema.hasResource(resource);
194
194
  * }
195
195
  *
196
- * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {
196
+ * attributesDefinitionFor(identifier: ResourceKey | { type: string }): AttributesSchema {
197
197
  * return this._schema.attributesDefinitionFor(identifier);
198
198
  * }
199
199
  *
200
- * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {
200
+ * relationshipsDefinitionFor(identifier: ResourceKey | { type: string }): RelationshipsSchema {
201
201
  * const schema = AbstractSchemas.get(identifier.type);
202
202
  * return schema || this._schema.relationshipsDefinitionFor(identifier);
203
203
  * }
@@ -247,11 +247,11 @@ export interface Store {
247
247
  * return this._schema.hasResource(resource);
248
248
  * }
249
249
  *
250
- * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {
250
+ * attributesDefinitionFor(identifier: ResourceKey | { type: string }): AttributesSchema {
251
251
  * return this._schema.attributesDefinitionFor(identifier);
252
252
  * }
253
253
  *
254
- * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {
254
+ * relationshipsDefinitionFor(identifier: ResourceKey | { type: string }): RelationshipsSchema {
255
255
  * const schema = AbstractSchemas.get(identifier.type);
256
256
  * return schema || this._schema.relationshipsDefinitionFor(identifier);
257
257
  * }
@@ -317,15 +317,16 @@ export declare class Store extends BaseClass {
317
317
  /** @internal */
318
318
  _schema: SchemaService;
319
319
  /**
320
- * Provides access to the IdentifierCache instance
320
+ * Provides access to the CacheKeyManager
321
321
  * for this store.
322
322
  *
323
- * The IdentifierCache can be used to generate or
324
- * retrieve a stable unique identifier for any resource.
323
+ * The CacheKeyManager can be used to generate or
324
+ * retrieve a stable unique CacheKey for any resource
325
+ * or request.
325
326
  *
326
327
  * @public
327
328
  */
328
- readonly identifierCache: IdentifierCache;
329
+ readonly cacheKeyManager: CacheKeyManager;
329
330
  /**
330
331
  * Provides access to the requestManager instance associated
331
332
  * with this Store instance.
@@ -356,7 +357,7 @@ export declare class Store extends BaseClass {
356
357
  *
357
358
  * Note, when defined, these methods will only be invoked if a
358
359
  * cache key exists for the request, either because the request
359
- * contains `cacheOptions.key` or because the [IdentifierCache](/ember-data/release/classes/IdentifierCache)
360
+ * contains `cacheOptions.key` or because the [CacheKeyManager](/ember-data/release/classes/CacheKeyManager)
360
361
  * was able to generate a key for the request using the configured
361
362
  * [generation method](/ember-data/release/functions/@ember-data%2Fstore/setIdentifierGenerationMethod).
362
363
  *
@@ -365,12 +366,12 @@ export declare class Store extends BaseClass {
365
366
  * ```ts
366
367
  * store.lifetimes = {
367
368
  * // make the request and ignore the current cache state
368
- * isHardExpired(identifier: StableDocumentIdentifier): boolean {
369
+ * isHardExpired(key: RequestKey): boolean {
369
370
  * return false;
370
371
  * }
371
372
  *
372
373
  * // make the request in the background if true, return cache state
373
- * isSoftExpired(identifier: StableDocumentIdentifier): boolean {
374
+ * isSoftExpired(key: RequestKey): boolean {
374
375
  * return false;
375
376
  * }
376
377
  * }
@@ -420,6 +421,8 @@ export declare class Store extends BaseClass {
420
421
  get isDestroyed(): boolean;
421
422
  /** @internal */
422
423
  set isDestroyed(value: boolean);
424
+ /** @deprecated use {@link Store.cacheKeyManager} */
425
+ get identifierCache(): CacheKeyManager;
423
426
  /**
424
427
  @private
425
428
  */
@@ -866,9 +869,9 @@ export declare class Store extends BaseClass {
866
869
 
867
870
  @private
868
871
  @param {Object} jsonApiDoc
869
- @return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
872
+ @return {ResourceKey|Array<ResourceKey>|null} identifiers for the primary records that had data loaded
870
873
  */
871
- _push(jsonApiDoc: JsonApiDocument, asyncFlush?: boolean): StableExistingRecordIdentifier | StableExistingRecordIdentifier[] | null;
874
+ _push(jsonApiDoc: JsonApiDocument, asyncFlush?: boolean): PersistedResourceKey | PersistedResourceKey[] | null;
872
875
  /**
873
876
  * Returns the cache instance associated to this Store, instantiates the Cache
874
877
  * if necessary via `Store.createCache`
@@ -3,7 +3,7 @@ export { storeFor } from "./-private/store-service.js";
3
3
  export { recordIdentifierFor } from "./-private/caches/instance-cache.js";
4
4
  export { CacheHandler, type StoreRequestContext } from "./-private/cache-handler/handler.js";
5
5
  export { type CachePolicy } from "./-private/cache-handler/types.js";
6
- export { isStableIdentifier, isDocumentIdentifier } from "./-private/caches/identifier-cache.js";
6
+ export { isResourceKey, isRequestKey } from "./-private/managers/cache-key-manager.js";
7
7
  export { constructResource } from "./-private/utils/construct-resource.js";
8
8
  export type { InstanceCache } from "./-private/caches/instance-cache.js";
9
9
  export type { FindRecordQuery, Request, SaveRecordMutation, RequestCacheRequestState, RequestStateService } from "./-private/network/request-cache.js";
@@ -1,5 +1,5 @@
1
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
2
- import type { IdentifierCache } from "../../-private/caches/identifier-cache.js";
1
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
2
+ import type { CacheKeyManager } from "../../-private/managers/cache-key-manager.js";
3
3
  import type { NotificationType } from "../../-private/managers/notification-manager.js";
4
4
  import type { SchemaService } from "./schema-service.js";
5
5
  /**
@@ -11,22 +11,21 @@ import type { SchemaService } from "./schema-service.js";
11
11
  *
12
12
  * This class cannot be directly instantiated.
13
13
  *
14
- * @class CacheCapabilitiesManager
15
14
  * @public
16
15
  */
17
16
  export type CacheCapabilitiesManager = {
18
17
  /**
19
- * Provides access to the IdentifierCache instance
18
+ * Provides access to the CacheKeyManager instance
20
19
  * for this Store instance.
21
20
  *
22
- * The IdentifierCache can be used to peek, generate or
21
+ * The CacheKeyManager can be used to peek, generate or
23
22
  * retrieve a stable unique identifier for any resource.
24
23
  *
25
- * @property identifierCache
26
- * @type {IdentifierCache}
27
24
  * @public
28
25
  */
29
- identifierCache: IdentifierCache;
26
+ cacheKeyManager: CacheKeyManager;
27
+ /** @deprecated use {@link CacheCapabilitiesManager.cacheKeyManager} */
28
+ identifierCache: CacheKeyManager;
30
29
  /**
31
30
  * DEPRECATED - use the schema property
32
31
  *
@@ -36,7 +35,7 @@ export type CacheCapabilitiesManager = {
36
35
  * The SchemaService can be used to query for
37
36
  * information about the schema of a resource.
38
37
  *
39
- * @deprecated
38
+ * @deprecated use {@link CacheCapabilitiesManager.schema}
40
39
  * @public
41
40
  */
42
41
  getSchemaDefinitionService(): SchemaService;
@@ -55,30 +54,25 @@ export type CacheCapabilitiesManager = {
55
54
  * Update the `id` for the record corresponding to the identifier
56
55
  * This operation can only be done for records whose `id` is `null`.
57
56
  *
58
- * @param {StableRecordIdentifier} identifier;
59
- * @param {String} id;
60
57
  * @public
61
58
  */
62
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
59
+ setRecordId(identifier: ResourceKey, id: string): void;
63
60
  /**
64
61
  * Signal to the store that the specified record may be considered fully
65
62
  * removed from the cache. Generally this means that not only does no
66
63
  * data exist for the identified resource, no known relationships still
67
64
  * point to it either.
68
65
  *
69
- * @param {StableRecordIdentifier} identifier
70
66
  * @public
71
67
  */
72
- disconnectRecord(identifier: StableRecordIdentifier): void;
68
+ disconnectRecord(identifier: ResourceKey): void;
73
69
  /**
74
70
  * Use this method to determine if the Store has an instantiated record associated
75
71
  * with an identifier.
76
72
  *
77
- * @param identifier
78
- * @return {Boolean}
79
73
  * @public
80
74
  */
81
- hasRecord(identifier: StableRecordIdentifier): boolean;
75
+ hasRecord(identifier: ResourceKey): boolean;
82
76
  /**
83
77
  * Notify subscribers of the NotificationManager that cache state has changed.
84
78
  *
@@ -87,13 +81,10 @@ export type CacheCapabilitiesManager = {
87
81
  *
88
82
  * No other namespaces currently expect the `key` argument.
89
83
  *
90
- * @param {StableRecordIdentifier} identifier
91
- * @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
92
- * @param {string|undefined} key
93
84
  * @public
94
85
  */
95
- notifyChange(identifier: StableRecordIdentifier, namespace: "added" | "removed", key: null): void;
96
- notifyChange(identifier: StableDocumentIdentifier, namespace: "added" | "updated" | "removed", key: null): void;
97
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key: string | null): void;
98
- notifyChange(identifier: StableRecordIdentifier | StableDocumentIdentifier, namespace: NotificationType | "added" | "removed" | "updated", key: string | null): void;
86
+ notifyChange(identifier: ResourceKey, namespace: "added" | "removed", key: null): void;
87
+ notifyChange(identifier: RequestKey, namespace: "added" | "updated" | "removed", key: null): void;
88
+ notifyChange(identifier: ResourceKey, namespace: NotificationType, key: string | null): void;
89
+ notifyChange(identifier: ResourceKey | RequestKey, namespace: NotificationType | "added" | "removed" | "updated", key: string | null): void;
99
90
  };
@@ -1,20 +1,23 @@
1
- import type { IdentifierBucket, StableIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
1
+ import type { CacheKeyType, RequestKey, ResourceKey } from "../../../types/identifier.js";
2
2
  import type { ImmutableRequestInfo } from "../../../types/request.js";
3
3
  export interface GenerationMethod {
4
4
  (data: ImmutableRequestInfo, bucket: "document"): string | null;
5
5
  (data: unknown | {
6
6
  type: string;
7
7
  }, bucket: "record"): string;
8
- (data: unknown, bucket: IdentifierBucket): string | null;
8
+ (data: unknown, bucket: CacheKeyType): string | null;
9
9
  }
10
10
  export type UpdateMethod = {
11
- (identifier: StableRecordIdentifier, newData: unknown, bucket: "record"): void;
12
- (identifier: StableIdentifier, newData: unknown, bucket: never): void;
11
+ (identifier: ResourceKey, newData: unknown, bucket: "record"): void;
12
+ (identifier: RequestKey, newData: unknown, bucket: "document"): void;
13
+ (identifier: {
14
+ lid: string;
15
+ }, newData: unknown, bucket: never): void;
13
16
  };
14
- export type ForgetMethod = (identifier: StableIdentifier | StableRecordIdentifier, bucket: IdentifierBucket) => void;
17
+ export type ForgetMethod = (identifier: RequestKey | ResourceKey, bucket: CacheKeyType) => void;
15
18
  export type ResetMethod = () => void;
16
19
  export type KeyInfo = {
17
20
  id: string | null;
18
21
  type: string;
19
22
  };
20
- export type KeyInfoMethod = (resource: unknown, known: StableRecordIdentifier | null) => KeyInfo;
23
+ export type KeyInfoMethod = (resource: unknown, known: ResourceKey | null) => KeyInfo;
@@ -1,6 +1,6 @@
1
1
  import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "../../../reactive.js";
2
2
  import type { ExtensibleField } from "../../../reactive/-private/schema.js";
3
- import type { RecordIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
3
+ import type { ResourceKey } from "../../../types/identifier.js";
4
4
  import type { ObjectValue } from "../../../types/json/raw.js";
5
5
  import type { Derivation, HashFn, Transformation } from "../../../types/schema/concepts.js";
6
6
  import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
@@ -74,7 +74,7 @@ export interface SchemaService {
74
74
  *
75
75
  * @public
76
76
  */
77
- hasResource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): boolean;
77
+ hasResource(resource: ObjectWithStringTypeProperty | ResourceKey): boolean;
78
78
  /**
79
79
  * Queries whether the SchemaService recognizes `type` as a resource trait
80
80
  *
@@ -86,7 +86,7 @@ export interface SchemaService {
86
86
  *
87
87
  * @public
88
88
  */
89
- resourceHasTrait(resource: ObjectWithStringTypeProperty | StableRecordIdentifier, trait: string): boolean;
89
+ resourceHasTrait(resource: ObjectWithStringTypeProperty | ResourceKey, trait: string): boolean;
90
90
  /**
91
91
  * Queries for the fields of a given resource type or resource identity.
92
92
  *
@@ -94,7 +94,7 @@ export interface SchemaService {
94
94
  *
95
95
  * @public
96
96
  */
97
- fields(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, FieldSchema>;
97
+ fields(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, FieldSchema>;
98
98
  /**
99
99
  * Queries for the fields of a given resource type or resource identity.
100
100
  *
@@ -102,7 +102,7 @@ export interface SchemaService {
102
102
  *
103
103
  * @public
104
104
  */
105
- cacheFields?(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
105
+ cacheFields?(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
106
106
  /**
107
107
  * Returns the transformation registered with the name provided
108
108
  * by `field.type`. Validates that the field is a valid transformable.
@@ -129,7 +129,7 @@ export interface SchemaService {
129
129
  *
130
130
  * @public
131
131
  */
132
- resource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Schema;
132
+ resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
133
133
  /**
134
134
  * Enables registration of multiple Schemas at once.
135
135
  *
@@ -253,7 +253,7 @@ export interface SchemaService {
253
253
  * @public
254
254
  * @deprecated
255
255
  */
256
- attributesDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): AttributesSchema;
256
+ attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
257
257
  /**
258
258
  * DEPRECATED - use `fields` instead
259
259
  *
@@ -332,7 +332,7 @@ export interface SchemaService {
332
332
  * @public
333
333
  * @deprecated
334
334
  */
335
- relationshipsDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): RelationshipsSchema;
335
+ relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
336
336
  /**
337
337
  * Returns all known resource types
338
338
  *
@@ -350,7 +350,7 @@ export interface SchemaService {
350
350
  *
351
351
  * @public
352
352
  */
353
- CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: StableRecordIdentifier | {
353
+ CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: ResourceKey | {
354
354
  type: string;
355
355
  }): null | ProcessedExtension["features"];
356
356
  /**