@warp-drive/core 5.6.0-beta.0 → 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
@@ -0,0 +1,224 @@
1
+ import type { NewResourceKey, ResourceKey } from "../../types/identifier.js";
2
+ import type { Value } from "../../types/json/raw.js";
3
+ import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
4
+ import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
5
+ import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
6
+ import { type InstanceCache } from "../-private.js";
7
+ import type { Store } from "./store.js";
8
+ export declare function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void;
9
+ export interface BaseFinderOptions {
10
+ reload?: boolean;
11
+ backgroundReload?: boolean;
12
+ include?: string | string[];
13
+ adapterOptions?: Record<string, unknown>;
14
+ }
15
+ export interface FindRecordOptions extends BaseFinderOptions {
16
+ /**
17
+ * Data to preload into the store before the request is made.
18
+ * This feature is *highly* discouraged and has no corresponding
19
+ * feature when using builders and handlers.
20
+ *
21
+ * Excepting relationships: the data should be in the form of a
22
+ * JSON object where the keys are fields on the record and the value
23
+ * is the raw value to be added to the cache.
24
+ *
25
+ * Relationships can either be provided as string IDs from which
26
+ * an identifier will be built base upon the relationship's expected
27
+ * resource type, or be record instances from which the identifier
28
+ * will be extracted.
29
+ *
30
+ */
31
+ preload?: Record<string, Value>;
32
+ }
33
+ export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
34
+ export type FindAllOptions = BaseFinderOptions;
35
+ export type LegacyResourceQuery = {
36
+ include?: string | string[];
37
+ [key: string]: Value | undefined;
38
+ };
39
+ export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
40
+ /**
41
+ * Minimum subset of static schema methods and properties on the
42
+ * "model" class.
43
+ *
44
+ * Only used when using the legacy schema-service implementation
45
+ * for @ember-data/model or when wrapping schema for legacy
46
+ * Adapters/Serializers.
47
+ *
48
+ */
49
+ export interface ModelSchema<T = unknown> {
50
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
51
+ fields: Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
52
+ attributes: Map<KeyOrString<T>, LegacyAttributeField>;
53
+ relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;
54
+ eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
55
+ eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
56
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
57
+ }
58
+ export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean;
59
+ /**
60
+ A `RecordReference` is a low-level API that allows users and
61
+ addon authors to perform meta-operations on a record.
62
+
63
+ @hideconstructor
64
+ @public
65
+ */
66
+ export declare class RecordReference {
67
+ constructor(store: Store, identifier: ResourceKey);
68
+ get type(): string;
69
+ /**
70
+ The `id` of the record that this reference refers to.
71
+
72
+ Together, the `type` and `id` properties form a composite key for
73
+ the identity map.
74
+
75
+ Example
76
+
77
+ ```javascript
78
+ let userRef = store.getReference('user', 1);
79
+
80
+ userRef.id(); // '1'
81
+ ```
82
+
83
+ @public
84
+ @return The id of the record.
85
+ */
86
+ id(): string | null;
87
+ /**
88
+ The `identifier` of the record that this reference refers to.
89
+
90
+ Together, the `type` and `id` properties form a composite key for
91
+ the identity map.
92
+
93
+ Example
94
+
95
+ ```javascript
96
+ let userRef = store.getReference('user', 1);
97
+
98
+ userRef.identifier(); // '1'
99
+ ```
100
+
101
+ @public
102
+ @return The identifier of the record.
103
+ */
104
+ identifier(): ResourceKey;
105
+ /**
106
+ How the reference will be looked up when it is loaded. Currently
107
+ this always returns `identity` to signify that a record will be
108
+ loaded by its `type` and `id`.
109
+
110
+ Example
111
+
112
+ ```javascript
113
+ const userRef = store.getReference('user', 1);
114
+
115
+ userRef.remoteType(); // 'identity'
116
+ ```
117
+
118
+ @public
119
+ */
120
+ remoteType(): "identity";
121
+ /**
122
+ This API allows you to provide a reference with new data. The
123
+ simplest usage of this API is similar to `store.push`: you provide a
124
+ normalized hash of data and the object represented by the reference
125
+ will update.
126
+
127
+ If you pass a promise to `push`, Ember Data will not ask the adapter
128
+ for the data if another attempt to fetch it is made in the
129
+ interim. When the promise resolves, the underlying object is updated
130
+ with the new data, and the promise returned by *this function* is resolved
131
+ with that object.
132
+
133
+ For example, `recordReference.push(promise)` will be resolved with a
134
+ record.
135
+
136
+ Example
137
+
138
+ ```javascript
139
+ let userRef = store.getReference('user', 1);
140
+
141
+ // provide data for reference
142
+ userRef.push({
143
+ data: {
144
+ id: "1",
145
+ type: "user",
146
+ attributes: {
147
+ username: "@user"
148
+ }
149
+ }
150
+ }).then(function(user) {
151
+ userRef.value() === user;
152
+ });
153
+ ```
154
+
155
+ @public
156
+ @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
157
+ @return a promise for the value (record or relationship)
158
+ */
159
+ push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance>;
160
+ /**
161
+ If the entity referred to by the reference is already loaded, it is
162
+ present as `reference.value`. Otherwise the value returned by this function
163
+ is `null`.
164
+
165
+ Example
166
+
167
+ ```javascript
168
+ let userRef = store.getReference('user', 1);
169
+
170
+ userRef.value(); // user
171
+ ```
172
+
173
+ @public
174
+ @return the record for this RecordReference
175
+ */
176
+ value(): OpaqueRecordInstance | null;
177
+ /**
178
+ Triggers a fetch for the backing entity based on its `remoteType`
179
+ (see `remoteType` definitions per reference type).
180
+
181
+ Example
182
+
183
+ ```javascript
184
+ let userRef = store.getReference('user', 1);
185
+
186
+ // load user (via store.find)
187
+ userRef.load().then(...)
188
+ ```
189
+
190
+ @public
191
+ @return the record for this RecordReference
192
+ */
193
+ load(): Promise<unknown>;
194
+ /**
195
+ Reloads the record if it is already loaded. If the record is not
196
+ loaded it will load the record via `store.findRecord`
197
+
198
+ Example
199
+
200
+ ```javascript
201
+ let userRef = store.getReference('user', 1);
202
+
203
+ // or trigger a reload
204
+ userRef.reload().then(...)
205
+ ```
206
+
207
+ @public
208
+ @return the record for this RecordReference
209
+ */
210
+ reload(): Promise<unknown>;
211
+ }
212
+ export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
213
+ // Mimics the static apis of @ember-data/model
214
+ export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
215
+ __store: Store;
216
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
217
+ constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string);
218
+ get fields(): Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
219
+ get attributes(): Map<KeyOrString<T>, LegacyAttributeField>;
220
+ get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField>;
221
+ eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
222
+ eachRelationship<K extends KeyOrString<T>>(callback: (key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
223
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
224
+ }