@warp-drive/core 5.7.0-alpha.2 → 5.7.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/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 +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 -21
  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 +50 -25
  36. package/declarations/reactive/-private/schema.d.ts +18 -14
  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 +2 -2
  41. package/declarations/request/-private/fetch.d.ts +2 -0
  42. package/declarations/request/-private/manager.d.ts +3 -6
  43. package/declarations/request/-private/types.d.ts +4 -4
  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 +20 -18
  49. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  50. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -11
  51. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +22 -19
  52. package/declarations/store/-private/managers/cache-manager.d.ts +46 -94
  53. package/declarations/store/-private/managers/notification-manager.d.ts +21 -25
  54. package/declarations/store/-private/managers/record-array-manager.d.ts +78 -27
  55. package/declarations/store/-private/network/request-cache.d.ts +11 -11
  56. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  57. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +1 -0
  58. package/declarations/store/-private/new-core-tmp/request-state.d.ts +15 -22
  59. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +4 -8
  60. package/declarations/store/-private/record-arrays/-utils.d.ts +82 -0
  61. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +89 -0
  62. package/declarations/store/-private/record-arrays/{many-array.d.ts → legacy-many-array.d.ts} +43 -101
  63. package/declarations/store/-private/record-arrays/legacy-query.d.ts +103 -0
  64. package/declarations/store/-private/record-arrays/resource-array.d.ts +82 -0
  65. package/declarations/store/-private/store-service.d.ts +78 -35
  66. package/declarations/store/-private.d.ts +5 -5
  67. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  68. package/declarations/store/-types/q/identifier.d.ts +9 -6
  69. package/declarations/store/-types/q/schema-service.d.ts +28 -40
  70. package/declarations/store/-types/q/store.d.ts +6 -7
  71. package/declarations/store/deprecated/-private.d.ts +12 -12
  72. package/declarations/store/deprecated/store.d.ts +11 -12
  73. package/declarations/types/-private.d.ts +1 -1
  74. package/declarations/types/cache/aliases.d.ts +2 -2
  75. package/declarations/types/cache/change.d.ts +2 -2
  76. package/declarations/types/cache/mutations.d.ts +13 -13
  77. package/declarations/types/cache/operations.d.ts +115 -32
  78. package/declarations/types/cache/relationship.d.ts +4 -4
  79. package/declarations/types/cache.d.ts +51 -113
  80. package/declarations/types/graph.d.ts +12 -12
  81. package/declarations/types/identifier.d.ts +60 -76
  82. package/declarations/types/params.d.ts +2 -3
  83. package/declarations/types/request.d.ts +47 -35
  84. package/declarations/types/schema/concepts.d.ts +2 -2
  85. package/declarations/types/schema/fields.d.ts +378 -14
  86. package/declarations/types/spec/document.d.ts +6 -6
  87. package/dist/{context-COmAnXUQ.js → context-kQXhkeBj.js} +13 -0
  88. package/dist/graph/-private.js +135 -139
  89. package/dist/index.js +6 -3
  90. package/dist/reactive/-private.js +1 -1
  91. package/dist/reactive.js +193 -1409
  92. package/dist/{request-state-CejVJgdj.js → request-state-glkInb2R.js} +5139 -2758
  93. package/dist/request.js +1 -1
  94. package/dist/store/-private.js +1 -2
  95. package/dist/store.js +32 -44
  96. package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
  97. package/dist/types/-private.js +1 -1
  98. package/dist/types/identifier.js +19 -45
  99. package/dist/types/request.js +27 -0
  100. package/dist/types/schema/fields.js +23 -2
  101. package/package.json +3 -3
  102. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  103. package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
  104. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
  105. package/dist/handler-D2jjnIA-.js +0 -339
@@ -0,0 +1,82 @@
1
+ import type { ExtensionDef } from "../../../reactive.js";
2
+ import { Context } from "../../../reactive/-private.js";
3
+ import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
4
+ import type { ObjectValue } from "../../../types/json/raw.js";
5
+ import type { CollectionField } from "../../../types/schema/fields.js";
6
+ import type { SignalStore, WarpDriveSignal } from "../new-core-tmp/reactivity/internal.js";
7
+ import type { Store } from "../store-service.js";
8
+ import type { KeyType, MinimumManager } from "./-utils.js";
9
+ import { NativeProxy } from "./native-proxy-type-fix.js";
10
+ declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
11
+ type ProxiedMethod = (...args: unknown[]) => unknown;
12
+ interface ReactiveResourceArrayCreateOptions {
13
+ // passed in
14
+ store: Store;
15
+ manager: MinimumManager;
16
+ editable: boolean;
17
+ source: ResourceKey[];
18
+ // reactive, passed in
19
+ data: ObjectValue | null;
20
+ // non-reactive, passed in
21
+ features: Record<string | symbol, unknown> | null;
22
+ extensions: Map<string | symbol, ExtensionDef> | null;
23
+ // not-accessible except by the context
24
+ options: Record<string, unknown> | null;
25
+ destroy: null | ((this: ReactiveResourceArray, clear: boolean) => void);
26
+ mutate: null | ((target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown);
27
+ }
28
+ interface ReactiveResourceArrayContext extends ReactiveResourceArrayCreateOptions {
29
+ destroy: (this: ReactiveResourceArray, clear: boolean) => void;
30
+ mutate: (target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown;
31
+ // generated
32
+ signals: SignalStore;
33
+ signal: WarpDriveSignal;
34
+ isDestroying: boolean;
35
+ isDestroyed: boolean;
36
+ transaction: boolean;
37
+ boundFns: Map<KeyType, ProxiedMethod>;
38
+ }
39
+ export interface ReactiveResourceArray<T = unknown> extends Omit<Array<T>, "[]"> {
40
+ /** @internal */
41
+ isDestroying: boolean;
42
+ /** @internal */
43
+ isDestroyed: boolean;
44
+ /** @internal */
45
+ destroy: (this: ReactiveResourceArray, clear: boolean) => void;
46
+ /** @internal */
47
+ [IS_COLLECTION]: boolean;
48
+ /** @internal */
49
+ [Context]: ReactiveResourceArrayContext;
50
+ }
51
+ export interface TargetArray extends Array<ResourceKey> {
52
+ /** @internal */
53
+ [Context]: ReactiveResourceArrayContext;
54
+ }
55
+ export declare function createReactiveResourceArray<T>(options: ReactiveResourceArrayCreateOptions): ReactiveResourceArray<T>;
56
+ export declare function destroy(this: ReactiveResourceArray, clear: boolean): void;
57
+ export interface ReactiveRequestCollectionCreateArgs {
58
+ // passed in
59
+ store: Store;
60
+ manager: MinimumManager;
61
+ source: ResourceKey[];
62
+ options: {
63
+ requestKey: RequestKey;
64
+ } | null;
65
+ }
66
+ export declare function createRequestCollection(config: ReactiveRequestCollectionCreateArgs): ReactiveResourceArray;
67
+ export interface ReactiveRelatedCollectionCreateArgs {
68
+ // passed in
69
+ store: Store;
70
+ manager: MinimumManager;
71
+ source: ResourceKey[];
72
+ // not-accessible except by the context
73
+ options: {
74
+ resourceKey: ResourceKey;
75
+ path: string[];
76
+ field: CollectionField;
77
+ };
78
+ editable: boolean;
79
+ extensions: Map<string | symbol, ExtensionDef> | null;
80
+ }
81
+ export declare function createRelatedCollection(config: ReactiveRelatedCollectionCreateArgs): ReactiveResourceArray;
82
+ export {};
@@ -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,12 +11,12 @@ 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";
19
- import type { IdentifierArray } from "./record-arrays/identifier-array.js";
19
+ import type { LegacyLiveArray } from "./record-arrays/legacy-live-array.js";
20
20
  export { storeFor };
21
21
  // We inline this list of methods to avoid importing EmberObject
22
22
  type EmberObjectKey = "_debugContainerKey" | "_super" | "addObserver" | "cacheFor" | "concatenatedProperties" | "decrementProperty" | "destroy" | "get" | "getProperties" | "incrementProperty" | "init" | "isDestroyed" | "isDestroying" | "mergedProperties" | "notifyPropertyChange" | "removeObserver" | "reopen" | "set" | "setProperties" | "toggleProperty" | "toString" | "willDestroy";
@@ -45,6 +45,9 @@ type MaybeHasId = {
45
45
  *
46
46
  */
47
47
  export type CreateRecordProperties<T = MaybeHasId & Record<string, unknown>> = T extends TypedRecordInstance ? Partial<FilteredKeys<T>> : T extends MaybeHasId ? MaybeHasId & Partial<FilteredKeys<T>> : MaybeHasId & Record<string, unknown>;
48
+ export interface CreateContext {
49
+ lid?: string;
50
+ }
48
51
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
52
  type ConstructorFunction = new (...args: any[]) => any;
50
53
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
@@ -76,7 +79,7 @@ export interface Store {
76
79
  * @public
77
80
  */
78
81
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
- instantiateRecord<T>(identifier: StableRecordIdentifier, createRecordArgs: {
82
+ instantiateRecord<T>(identifier: ResourceKey, createRecordArgs: {
80
83
  [key: string]: unknown;
81
84
  }): OpaqueRecordInstance;
82
85
  /**
@@ -190,11 +193,11 @@ export interface Store {
190
193
  * return this._schema.hasResource(resource);
191
194
  * }
192
195
  *
193
- * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {
196
+ * attributesDefinitionFor(identifier: ResourceKey | { type: string }): AttributesSchema {
194
197
  * return this._schema.attributesDefinitionFor(identifier);
195
198
  * }
196
199
  *
197
- * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {
200
+ * relationshipsDefinitionFor(identifier: ResourceKey | { type: string }): RelationshipsSchema {
198
201
  * const schema = AbstractSchemas.get(identifier.type);
199
202
  * return schema || this._schema.relationshipsDefinitionFor(identifier);
200
203
  * }
@@ -244,11 +247,11 @@ export interface Store {
244
247
  * return this._schema.hasResource(resource);
245
248
  * }
246
249
  *
247
- * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {
250
+ * attributesDefinitionFor(identifier: ResourceKey | { type: string }): AttributesSchema {
248
251
  * return this._schema.attributesDefinitionFor(identifier);
249
252
  * }
250
253
  *
251
- * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {
254
+ * relationshipsDefinitionFor(identifier: ResourceKey | { type: string }): RelationshipsSchema {
252
255
  * const schema = AbstractSchemas.get(identifier.type);
253
256
  * return schema || this._schema.relationshipsDefinitionFor(identifier);
254
257
  * }
@@ -314,15 +317,16 @@ export declare class Store extends BaseClass {
314
317
  /** @internal */
315
318
  _schema: SchemaService;
316
319
  /**
317
- * Provides access to the IdentifierCache instance
320
+ * Provides access to the CacheKeyManager
318
321
  * for this store.
319
322
  *
320
- * The IdentifierCache can be used to generate or
321
- * 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.
322
326
  *
323
327
  * @public
324
328
  */
325
- readonly identifierCache: IdentifierCache;
329
+ readonly cacheKeyManager: CacheKeyManager;
326
330
  /**
327
331
  * Provides access to the requestManager instance associated
328
332
  * with this Store instance.
@@ -353,7 +357,7 @@ export declare class Store extends BaseClass {
353
357
  *
354
358
  * Note, when defined, these methods will only be invoked if a
355
359
  * cache key exists for the request, either because the request
356
- * 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)
357
361
  * was able to generate a key for the request using the configured
358
362
  * [generation method](/ember-data/release/functions/@ember-data%2Fstore/setIdentifierGenerationMethod).
359
363
  *
@@ -362,12 +366,12 @@ export declare class Store extends BaseClass {
362
366
  * ```ts
363
367
  * store.lifetimes = {
364
368
  * // make the request and ignore the current cache state
365
- * isHardExpired(identifier: StableDocumentIdentifier): boolean {
369
+ * isHardExpired(key: RequestKey): boolean {
366
370
  * return false;
367
371
  * }
368
372
  *
369
373
  * // make the request in the background if true, return cache state
370
- * isSoftExpired(identifier: StableDocumentIdentifier): boolean {
374
+ * isSoftExpired(key: RequestKey): boolean {
371
375
  * return false;
372
376
  * }
373
377
  * }
@@ -417,6 +421,8 @@ export declare class Store extends BaseClass {
417
421
  get isDestroyed(): boolean;
418
422
  /** @internal */
419
423
  set isDestroyed(value: boolean);
424
+ /** @deprecated use {@link Store.cacheKeyManager} */
425
+ get identifierCache(): CacheKeyManager;
420
426
  /**
421
427
  @private
422
428
  */
@@ -503,40 +509,77 @@ export declare class Store extends BaseClass {
503
509
  *
504
510
  * @public
505
511
  */
506
- request<
507
- RT,
508
- T = unknown
509
- >(requestConfig: StoreRequestInput<RT, T>): Future<RT>;
512
+ request<RT>(requestConfig: StoreRequestInput<RT>): Future<RT>;
510
513
  /**
511
- Create a new record in the current store. The properties passed
512
- to this method are set on the newly created record.
514
+ Creates a new record in the current store.
515
+
516
+ > [!CAUTION]
517
+ > This should not be used to mock records or to create
518
+ > a record representing data that could be fetched from
519
+ > the API.
513
520
 
514
- To create a new instance of a `Post`:
521
+ The properties passed to this method are set on
522
+ the newly created record.
523
+
524
+ For instance: to create a new `post`:
515
525
 
516
526
  ```js
517
527
  store.createRecord('post', {
518
- title: 'Ember is awesome!'
528
+ title: 'WarpDrive is Stellar!'
519
529
  });
520
530
  ```
521
531
 
522
- To create a new instance of a `Post` that has a relationship with a `User` record:
532
+ Relationships can be set during create. For instance,
533
+ to create a new `post` that has an existing user as
534
+ it's author:
523
535
 
524
536
  ```js
525
- let user = this.store.peekRecord('user', '1');
537
+ const user = store.peekRecord('user', '1');
538
+
526
539
  store.createRecord('post', {
527
- title: 'Ember is awesome!',
540
+ title: 'WarpDrive is Stellar!',
528
541
  user: user
529
542
  });
530
543
  ```
531
544
 
545
+ ### lid handling
546
+
547
+ All new records are assigned an `lid` that can be used to handle
548
+ transactional saves of multiple records, or to link the data to
549
+ other data in scenarios involving eventual-consistency or remote
550
+ syncing.
551
+
552
+ ```ts
553
+ const post = store.createRecord('post', {
554
+ title: 'WarpDrive is Stellar!'
555
+ });
556
+ const { lid } = recordIdentifierFor(post);
557
+ ```
558
+
559
+ The `lid` defaults to a uuidv4 string.
560
+
561
+ In order to support receiving knowledge about unpersisted creates
562
+ from other sources (say a different tab in the same web-browser),
563
+ createRecord allows for the `lid` to be provided as part of an
564
+ optional third argument. **If this lid already exists in the store
565
+ an error will be thrown.**
566
+
567
+ ```ts
568
+ const post = store.createRecord(
569
+ 'post',
570
+ { title: 'WarpDrive is Stellar!' },
571
+ { lid: '4d47bb88-931f-496e-986d-c4888cef7373' }
572
+ );
573
+ ```
574
+
532
575
  @public
533
- @param {String} type the name of the resource
534
- @param {Object} inputProperties a hash of properties to set on the
576
+ @param type the name of the resource
577
+ @param inputProperties a hash of properties to set on the
535
578
  newly created record.
536
- @return {Model} record
579
+ @return a record in the "isNew" state
537
580
  */
538
- createRecord<T>(type: TypeFromInstance<T>, inputProperties: CreateRecordProperties<T>): T;
539
- createRecord(type: string, inputProperties: CreateRecordProperties): OpaqueRecordInstance;
581
+ createRecord<T>(type: TypeFromInstance<T>, inputProperties: CreateRecordProperties<T>, context?: CreateContext): T;
582
+ createRecord(type: string, inputProperties: CreateRecordProperties, context?: CreateContext): OpaqueRecordInstance;
540
583
  /**
541
584
  For symmetry, a record can be deleted via the store.
542
585
 
@@ -644,8 +687,8 @@ export declare class Store extends BaseClass {
644
687
  @param {String} type the name of the resource
645
688
  @return {RecordArray}
646
689
  */
647
- peekAll<T>(type: TypeFromInstance<T>): IdentifierArray<T>;
648
- peekAll(type: string): IdentifierArray;
690
+ peekAll<T>(type: TypeFromInstance<T>): LegacyLiveArray<T>;
691
+ peekAll(type: string): LegacyLiveArray;
649
692
  /**
650
693
  This method unloads all records in the store.
651
694
  It schedules unloading to happen during the next run loop.
@@ -823,9 +866,9 @@ export declare class Store extends BaseClass {
823
866
 
824
867
  @private
825
868
  @param {Object} jsonApiDoc
826
- @return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
869
+ @return {ResourceKey|Array<ResourceKey>|null} identifiers for the primary records that had data loaded
827
870
  */
828
- _push(jsonApiDoc: JsonApiDocument, asyncFlush?: boolean): StableExistingRecordIdentifier | StableExistingRecordIdentifier[] | null;
871
+ _push(jsonApiDoc: JsonApiDocument, asyncFlush?: boolean): PersistedResourceKey | PersistedResourceKey[] | null;
829
872
  /**
830
873
  * Returns the cache instance associated to this Store, instantiates the Cache
831
874
  * 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";
@@ -12,17 +12,17 @@ export type { CreateRecordProperties } from "./-private/store-service.js";
12
12
  // to also eliminate
13
13
  export { coerceId, ensureStringId } from "./-private/utils/coerce-id.js";
14
14
  export type { NativeProxy } from "./-private/record-arrays/native-proxy-type-fix.js";
15
- export { IdentifierArray as LiveArray, Collection as CollectionRecordArray, SOURCE, MUTATE } from "./-private/record-arrays/identifier-array.js";
15
+ export { type ReactiveResourceArray } from "./-private/record-arrays/resource-array.js";
16
+ export { type LegacyLiveArray, type LegacyLiveArray as LiveArray } from "./-private/record-arrays/legacy-live-array.js";
17
+ export { type LegacyQueryArray, type LegacyQueryArray as CollectionRecordArray } from "./-private/record-arrays/legacy-query.js";
16
18
  export { RecordArrayManager, fastPush } from "./-private/managers/record-array-manager.js";
17
19
  // leaked for private use / test use, should investigate removing
18
20
  export { _clearCaches } from "./-private/caches/instance-cache.js";
19
- export { peekCache, removeRecordDataFor } from "./-private/caches/cache-utils.js";
20
21
  // @ember-data/model needs these temporarily
21
22
  export { setRecordIdentifier, StoreMap } from "./-private/caches/instance-cache.js";
22
- export { setCacheFor } from "./-private/caches/cache-utils.js";
23
23
  export { normalizeModelName as _deprecatingNormalize } from "./-private/utils/normalize-model-name.js";
24
24
  export type { StoreRequestInput } from "./-private/cache-handler/handler.js";
25
- export { RelatedCollection } from "./-private/record-arrays/many-array.js";
25
+ export { type LegacyManyArray, type LegacyManyArray as RelatedCollection, createLegacyManyArray } from "./-private/record-arrays/legacy-many-array.js";
26
26
  export { log, logGroup } from "./-private/debug/utils.js";
27
27
  export { getPromiseState, type PromiseState } from "./-private/new-core-tmp/promise-state.js";
28
28
  export { DISPOSE, createRequestSubscription, type SubscriptionArgs, type RequestSubscription } from "./-private/new-core-tmp/request-subscription.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;