@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,11 +1,11 @@
1
- import type { StableNewRecordIdentifier, StableRecordIdentifier } from "../../types/identifier.js";
1
+ import type { NewResourceKey, ResourceKey } from "../../types/identifier.js";
2
2
  import type { Value } from "../../types/json/raw.js";
3
3
  import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
4
4
  import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
5
5
  import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
6
6
  import { type InstanceCache } from "../-private.js";
7
7
  import type { Store } from "./store.js";
8
- export declare function preloadData(store: Store, identifier: StableNewRecordIdentifier, preload: Record<string, Value>): void;
8
+ export declare function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void;
9
9
  export interface BaseFinderOptions {
10
10
  reload?: boolean;
11
11
  backgroundReload?: boolean;
@@ -55,7 +55,7 @@ export interface ModelSchema<T = unknown> {
55
55
  eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
56
56
  eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
57
57
  }
58
- export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean;
58
+ export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean;
59
59
  /**
60
60
  A `RecordReference` is a low-level API that allows users and
61
61
  addon authors to perform meta-operations on a record.
@@ -73,7 +73,7 @@ export declare class RecordReference {
73
73
  private ___identifier;
74
74
  /** @internal */
75
75
  private _ref;
76
- constructor(store: Store, identifier: StableRecordIdentifier);
76
+ constructor(store: Store, identifier: ResourceKey);
77
77
  /** @internal */
78
78
  destroy(): void;
79
79
  get type(): string;
@@ -112,7 +112,7 @@ export declare class RecordReference {
112
112
  @public
113
113
  @return The identifier of the record.
114
114
  */
115
- identifier(): StableRecordIdentifier;
115
+ identifier(): ResourceKey;
116
116
  /**
117
117
  How the reference will be looked up when it is loaded. Currently
118
118
  this always returns `identity` to signify that a record will be
@@ -1,7 +1,7 @@
1
1
  type UniversalTransientKey = "REQ_ID";
2
2
  type UniversalKey = `(transient) ${UniversalTransientKey}` | "RequestMap" | "PromiseCache" | "RequestCache" | "SkipCache" | "EnableHydration" | "WarpDriveRuntimeConfig";
3
3
  type TransientKey = "transactionRef" | "configuredGenerationMethod" | "configuredUpdateMethod" | "configuredForgetMethod" | "configuredResetMethod" | "configuredKeyInfoMethod" | "signalHooks";
4
- type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "Destroy" | "Checkout" | "Context";
4
+ type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "Destroy" | "Checkout" | "Commit" | "Context";
5
5
  type UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;
6
6
  type UniqueSymbolOr<
7
7
  T,
@@ -1,7 +1,7 @@
1
1
  // The ResourceBlob is an opaque type that must
2
2
  // satisfy two constraints.
3
- // (1) it should be possible for the IdentifierCache
4
- // to be able to generate a RecordIdentifier for it
3
+ // (1) it should be possible for the CacheKeyManager
4
+ // to be able to generate a ResourceKey for it
5
5
  // whether by default or due to configuration.
6
6
  // (2) it should be in a format expected by the Cache.
7
7
  // This format is Cache declared.
@@ -1,6 +1,6 @@
1
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../identifier.js";
1
+ import type { RequestKey, ResourceKey } from "../identifier.js";
2
2
  export interface Change {
3
- identifier: StableRecordIdentifier | StableDocumentIdentifier;
3
+ identifier: ResourceKey | RequestKey;
4
4
  op: "upsert" | "remove";
5
5
  patch?: unknown;
6
6
  }
@@ -1,48 +1,48 @@
1
- import type { StableRecordIdentifier } from "../identifier.js";
1
+ import type { ResourceKey } from "../identifier.js";
2
2
  export interface AddToResourceRelationshipMutation {
3
3
  op: "add";
4
- record: StableRecordIdentifier;
4
+ record: ResourceKey;
5
5
  field: string;
6
- value: StableRecordIdentifier | StableRecordIdentifier[];
6
+ value: ResourceKey | ResourceKey[];
7
7
  index?: number;
8
8
  }
9
9
  export interface RemoveFromResourceRelationshipMutation {
10
10
  op: "remove";
11
- record: StableRecordIdentifier;
11
+ record: ResourceKey;
12
12
  field: string;
13
- value: StableRecordIdentifier | StableRecordIdentifier[];
13
+ value: ResourceKey | ResourceKey[];
14
14
  index?: number;
15
15
  }
16
16
  export interface ReplaceRelatedRecordMutation {
17
17
  op: "replaceRelatedRecord";
18
- record: StableRecordIdentifier;
18
+ record: ResourceKey;
19
19
  field: string;
20
20
  // never null if field is a collection
21
- value: StableRecordIdentifier | null;
21
+ value: ResourceKey | null;
22
22
  // if field is a collection,
23
23
  // the value we are swapping with
24
- prior?: StableRecordIdentifier;
24
+ prior?: ResourceKey;
25
25
  index?: number;
26
26
  }
27
27
  export interface ReplaceRelatedRecordsMutation {
28
28
  op: "replaceRelatedRecords";
29
- record: StableRecordIdentifier;
29
+ record: ResourceKey;
30
30
  field: string;
31
31
  // the records to add. If no prior/index
32
32
  // specified all existing should be removed
33
- value: StableRecordIdentifier[];
33
+ value: ResourceKey[];
34
34
  // if this is a "splice" the
35
35
  // records we expect to be removed
36
- prior?: StableRecordIdentifier[];
36
+ prior?: ResourceKey[];
37
37
  // if this is a "splice" the
38
38
  // index to start from
39
39
  index?: number;
40
40
  }
41
41
  export interface SortRelatedRecordsMutation {
42
42
  op: "sortRelatedRecords";
43
- record: StableRecordIdentifier;
43
+ record: ResourceKey;
44
44
  field: string;
45
- value: StableRecordIdentifier[];
45
+ value: ResourceKey[];
46
46
  }
47
47
  // A Mutation is an action that updates
48
48
  // the local state of the Cache in some
@@ -1,4 +1,4 @@
1
- import type { StableDocumentIdentifier, StableExistingRecordIdentifier, StableRecordIdentifier } from "../identifier.js";
1
+ import type { PersistedResourceKey, RequestKey, ResourceKey } from "../identifier.js";
2
2
  import type { Value } from "../json/raw.js";
3
3
  import type { ExistingResourceObject } from "../spec/json-api-raw.js";
4
4
  import type { Relationship } from "./relationship.js";
@@ -24,15 +24,15 @@ export interface Op {
24
24
  export interface MergeOperation extends Op {
25
25
  op: "mergeIdentifiers";
26
26
  /**
27
- * The stale {@link StableRecordIdentifier | ResourceKey} that
27
+ * The stale {@link ResourceKey | ResourceKey} that
28
28
  * the cache should eliminate in favor of {@link MergeOperation.value | value}
29
29
  */
30
- record: StableRecordIdentifier;
30
+ record: ResourceKey;
31
31
  /**
32
- * The kept {@link StableRecordIdentifier | ResourceKey} that
32
+ * The kept {@link ResourceKey | ResourceKey} that
33
33
  * the cache should also keep and merge {@link MergeOperation.record | record} into.
34
34
  */
35
- value: StableRecordIdentifier;
35
+ value: ResourceKey;
36
36
  }
37
37
  /**
38
38
  * Removes a document and its associated request from
@@ -43,7 +43,7 @@ export interface RemoveDocumentOperation extends Op {
43
43
  /**
44
44
  * The cache key for the request
45
45
  */
46
- record: StableDocumentIdentifier;
46
+ record: RequestKey;
47
47
  }
48
48
  /**
49
49
  * Removes a resource from the cache. This is treated
@@ -55,7 +55,7 @@ export interface RemoveResourceOperation extends Op {
55
55
  /**
56
56
  * The cache key for the resource
57
57
  */
58
- record: StableExistingRecordIdentifier;
58
+ record: PersistedResourceKey;
59
59
  }
60
60
  /**
61
61
  * Adds a resource to the cache.
@@ -65,7 +65,7 @@ export interface AddResourceOperation extends Op {
65
65
  /**
66
66
  * The cache key for the resource
67
67
  */
68
- record: StableExistingRecordIdentifier;
68
+ record: PersistedResourceKey;
69
69
  /**
70
70
  * The data for the resource
71
71
  */
@@ -76,7 +76,7 @@ export interface AddResourceOperation extends Op {
76
76
  */
77
77
  export interface UpdateResourceOperation extends Op {
78
78
  op: "update";
79
- record: StableExistingRecordIdentifier;
79
+ record: PersistedResourceKey;
80
80
  value: ExistingResourceObject;
81
81
  }
82
82
  /**
@@ -84,7 +84,7 @@ export interface UpdateResourceOperation extends Op {
84
84
  */
85
85
  export interface UpdateResourceFieldOperation extends Op {
86
86
  op: "update";
87
- record: StableExistingRecordIdentifier;
87
+ record: PersistedResourceKey;
88
88
  field: string;
89
89
  value: Value;
90
90
  }
@@ -93,9 +93,9 @@ export interface UpdateResourceFieldOperation extends Op {
93
93
  */
94
94
  export interface UpdateResourceRelationshipOperation extends Op {
95
95
  op: "update";
96
- record: StableExistingRecordIdentifier;
96
+ record: PersistedResourceKey;
97
97
  field: string;
98
- value: Relationship<StableExistingRecordIdentifier>;
98
+ value: Relationship<PersistedResourceKey>;
99
99
  }
100
100
  /**
101
101
  * Adds a resource to a request document, optionally
@@ -104,9 +104,9 @@ export interface UpdateResourceRelationshipOperation extends Op {
104
104
  */
105
105
  export interface AddToDocumentOperation extends Op {
106
106
  op: "add";
107
- record: StableDocumentIdentifier;
107
+ record: RequestKey;
108
108
  field: "data" | "included";
109
- value: StableExistingRecordIdentifier | StableExistingRecordIdentifier[];
109
+ value: PersistedResourceKey | PersistedResourceKey[];
110
110
  index?: number;
111
111
  }
112
112
  /**
@@ -114,9 +114,9 @@ export interface AddToDocumentOperation extends Op {
114
114
  */
115
115
  export interface AddToResourceRelationshipOperation extends Op {
116
116
  op: "add";
117
- record: StableExistingRecordIdentifier;
117
+ record: PersistedResourceKey;
118
118
  field: string;
119
- value: StableExistingRecordIdentifier | StableExistingRecordIdentifier[];
119
+ value: PersistedResourceKey | PersistedResourceKey[];
120
120
  index?: number;
121
121
  }
122
122
  /**
@@ -124,9 +124,9 @@ export interface AddToResourceRelationshipOperation extends Op {
124
124
  */
125
125
  export interface RemoveFromResourceRelationshipOperation extends Op {
126
126
  op: "remove";
127
- record: StableExistingRecordIdentifier;
127
+ record: PersistedResourceKey;
128
128
  field: string;
129
- value: StableExistingRecordIdentifier | StableExistingRecordIdentifier[];
129
+ value: PersistedResourceKey | PersistedResourceKey[];
130
130
  index?: number;
131
131
  }
132
132
  /**
@@ -136,9 +136,9 @@ export interface RemoveFromResourceRelationshipOperation extends Op {
136
136
  */
137
137
  export interface RemoveFromDocumentOperation extends Op {
138
138
  op: "remove";
139
- record: StableDocumentIdentifier;
139
+ record: RequestKey;
140
140
  field: "data" | "included";
141
- value: StableExistingRecordIdentifier | StableExistingRecordIdentifier[];
141
+ value: PersistedResourceKey | PersistedResourceKey[];
142
142
  index?: number;
143
143
  }
144
144
  /**
@@ -1,16 +1,16 @@
1
- import type { StableRecordIdentifier } from "../identifier.js";
1
+ import type { ResourceKey } from "../identifier.js";
2
2
  import type { Links, Meta, PaginationLinks } from "../spec/json-api-raw.js";
3
3
  // we request that it be in the stable form already.
4
- export interface ResourceRelationship<T = StableRecordIdentifier> {
4
+ export interface ResourceRelationship<T = ResourceKey> {
5
5
  data?: T | null;
6
6
  meta?: Meta;
7
7
  links?: Links;
8
8
  }
9
9
  // Note: in v1 data could be a ResourceIdentifier, now
10
10
  // we request that it be in the stable form already.
11
- export interface CollectionRelationship<T = StableRecordIdentifier> {
11
+ export interface CollectionRelationship<T = ResourceKey> {
12
12
  data?: T[];
13
13
  meta?: Meta;
14
14
  links?: PaginationLinks;
15
15
  }
16
- export type Relationship<T = StableRecordIdentifier> = ResourceRelationship<T> | CollectionRelationship<T>;
16
+ export type Relationship<T = ResourceKey> = ResourceRelationship<T> | CollectionRelationship<T>;