@warp-drive/core 5.7.0-alpha.13 → 5.7.0-alpha.15

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 (80) 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 -1
  21. package/declarations/reactive.d.ts +277 -1
  22. package/declarations/request/-private/context.d.ts +2 -2
  23. package/declarations/request/-private/fetch.d.ts +2 -2
  24. package/declarations/request/-private/manager.d.ts +2 -2
  25. package/declarations/request/-private/types.d.ts +4 -4
  26. package/declarations/request/-private/utils.d.ts +44 -2
  27. package/declarations/store/-private/cache-handler/types.d.ts +10 -10
  28. package/declarations/store/-private/cache-handler/utils.d.ts +4 -4
  29. package/declarations/store/-private/caches/instance-cache.d.ts +18 -18
  30. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  31. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -11
  32. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +21 -19
  33. package/declarations/store/-private/managers/cache-manager.d.ts +46 -94
  34. package/declarations/store/-private/managers/notification-manager.d.ts +21 -25
  35. package/declarations/store/-private/managers/record-array-manager.d.ts +78 -27
  36. package/declarations/store/-private/network/request-cache.d.ts +11 -11
  37. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  38. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +1 -0
  39. package/declarations/store/-private/new-core-tmp/request-state.d.ts +1 -1
  40. package/declarations/store/-private/record-arrays/-utils.d.ts +82 -0
  41. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +89 -0
  42. package/declarations/store/-private/record-arrays/{many-array.d.ts → legacy-many-array.d.ts} +43 -101
  43. package/declarations/store/-private/record-arrays/legacy-query.d.ts +103 -0
  44. package/declarations/store/-private/record-arrays/resource-array.d.ts +82 -0
  45. package/declarations/store/-private/store-service.d.ts +22 -19
  46. package/declarations/store/-private.d.ts +5 -3
  47. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  48. package/declarations/store/-types/q/identifier.d.ts +9 -6
  49. package/declarations/store/-types/q/schema-service.d.ts +9 -9
  50. package/declarations/store/deprecated/-private.d.ts +5 -5
  51. package/declarations/store/deprecated/store.d.ts +8 -9
  52. package/declarations/types/-private.d.ts +1 -1
  53. package/declarations/types/cache/aliases.d.ts +2 -2
  54. package/declarations/types/cache/change.d.ts +2 -2
  55. package/declarations/types/cache/mutations.d.ts +13 -13
  56. package/declarations/types/cache/operations.d.ts +115 -32
  57. package/declarations/types/cache/relationship.d.ts +4 -4
  58. package/declarations/types/cache.d.ts +51 -113
  59. package/declarations/types/graph.d.ts +12 -12
  60. package/declarations/types/identifier.d.ts +60 -76
  61. package/declarations/types/request.d.ts +27 -6
  62. package/declarations/types/schema/concepts.d.ts +2 -2
  63. package/declarations/types/schema/fields.d.ts +1 -1
  64. package/declarations/types/spec/document.d.ts +6 -6
  65. package/dist/{context-COmAnXUQ.js → context-kQXhkeBj.js} +13 -0
  66. package/dist/graph/-private.js +129 -129
  67. package/dist/index.js +6 -2
  68. package/dist/reactive/-private.js +1 -1
  69. package/dist/reactive.js +126 -4
  70. package/dist/{request-state-BWYju5O9.js → request-state-CQ0Q6d1V.js} +4290 -4218
  71. package/dist/request.js +1 -1
  72. package/dist/store/-private.js +1 -1
  73. package/dist/store.js +32 -44
  74. package/dist/{symbols-BoONANuz.js → symbols-sql1_mdx.js} +2 -2
  75. package/dist/types/-private.js +1 -1
  76. package/dist/types/identifier.js +19 -45
  77. package/dist/types/request.js +27 -0
  78. package/dist/types/schema/fields.js +2 -0
  79. package/package.json +3 -3
  80. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
@@ -1,4 +1,4 @@
1
- import type { StableRecordIdentifier } from "./identifier.js";
1
+ import type { ResourceKey } from "./identifier.js";
2
2
  import type { QueryParamsSerializationOptions } from "./params.js";
3
3
  import type { ExtractSuggestedCacheTypes, TypedRecordInstance, TypeFromInstanceOrString } from "./record.js";
4
4
  import type { ResourceIdentifierObject } from "./spec/json-api-raw.js";
@@ -105,14 +105,14 @@ export type DeleteRequestOptions<
105
105
  op: "deleteRecord";
106
106
  body?: string | BodyInit | FormData;
107
107
  data: {
108
- record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
108
+ record: ResourceKey<TypeFromInstanceOrString<T>>;
109
109
  };
110
110
  records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
111
111
  [RequestSignature]?: RT;
112
112
  };
113
113
  type ImmutableRequest<T> = Readonly<T> & {
114
114
  readonly headers: ImmutableHeaders;
115
- readonly records: [StableRecordIdentifier];
115
+ readonly records: [ResourceKey];
116
116
  };
117
117
  export type UpdateRequestOptions<
118
118
  RT = unknown,
@@ -124,7 +124,7 @@ export type UpdateRequestOptions<
124
124
  op: "updateRecord";
125
125
  body?: string | BodyInit | FormData;
126
126
  data: {
127
- record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
127
+ record: ResourceKey<TypeFromInstanceOrString<T>>;
128
128
  };
129
129
  records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
130
130
  [RequestSignature]?: RT;
@@ -139,7 +139,7 @@ export type CreateRequestOptions<
139
139
  op: "createRecord";
140
140
  body?: string | BodyInit | FormData;
141
141
  data: {
142
- record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
142
+ record: ResourceKey<TypeFromInstanceOrString<T>>;
143
143
  };
144
144
  records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];
145
145
  [RequestSignature]?: RT;
@@ -163,6 +163,11 @@ export interface ConstrainedRequestOptions {
163
163
  export interface FindRecordOptions extends ConstrainedRequestOptions {
164
164
  include?: string | string[];
165
165
  }
166
+ /**
167
+ * When a handler chain resolves, it returns an object
168
+ * containing the original request, the response set by the handler
169
+ * chain (if any), and the processed content.
170
+ */
166
171
  export interface StructuredDataDocument<T> {
167
172
  [STRUCTURED]?: true;
168
173
  /**
@@ -172,6 +177,14 @@ export interface StructuredDataDocument<T> {
172
177
  response: Response | ResponseInfo | null;
173
178
  content: T;
174
179
  }
180
+ /**
181
+ * When a handler chain rejects, it throws an Error that maintains the
182
+ * `{ request, response, content }` shape but is also an Error instance
183
+ * itself.
184
+ *
185
+ * If using the error originates from the {@link Fetch | Fetch Handler}
186
+ * the error will be a {@link FetchError}
187
+ */
175
188
  export interface StructuredErrorDocument<T = unknown> extends Error {
176
189
  [STRUCTURED]?: true;
177
190
  request: ImmutableRequestInfo;
@@ -179,6 +192,14 @@ export interface StructuredErrorDocument<T = unknown> extends Error {
179
192
  error: string | object;
180
193
  content?: T;
181
194
  }
195
+ /**
196
+ * A union of the resolve/reject data types for a request.
197
+ *
198
+ * See the docs for:
199
+ *
200
+ * - {@link StructuredDataDocument} (resolved/successful requests)
201
+ * - {@link StructuredErrorDocument} (rejected/failed requests)
202
+ */
182
203
  export type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;
183
204
  /**
184
205
  * JavaScript's native Request class.
@@ -271,7 +292,7 @@ export interface RequestInfo<
271
292
  * operations on the store.
272
293
  *
273
294
  */
274
- records?: StableRecordIdentifier[];
295
+ records?: ResourceKey[];
275
296
  disableTestWaiter?: boolean;
276
297
  /**
277
298
  * data that a handler should convert into
@@ -1,4 +1,4 @@
1
- import type { StableRecordIdentifier } from "../identifier.js";
1
+ import type { ResourceKey } from "../identifier.js";
2
2
  import type { ObjectValue, Value } from "../json/raw.js";
3
3
  import type { OpaqueRecordInstance } from "../record.js";
4
4
  import type { Type } from "../symbols.js";
@@ -8,7 +8,7 @@ export type Transformation<
8
8
  > = {
9
9
  serialize(value: PT, options: ObjectValue | null, record: OpaqueRecordInstance): T;
10
10
  hydrate(value: T | undefined, options: ObjectValue | null, record: OpaqueRecordInstance): PT;
11
- defaultValue?(options: ObjectValue | null, identifier: StableRecordIdentifier): T;
11
+ defaultValue?(options: ObjectValue | null, identifier: ResourceKey): T;
12
12
  [Type]: string;
13
13
  };
14
14
  export type Derivation<
@@ -473,7 +473,7 @@ export interface ObjectField {
473
473
  * Configures which extensions this object should use.
474
474
  *
475
475
  * Extensions are registered with the store's schema service
476
- * via {@link SchemaService.registerDangerousObjectExtension}
476
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
477
477
  *
478
478
  * Extensions should only be used for temporary enhancements
479
479
  * to objects to support migrating away from deprecated patterns
@@ -1,4 +1,4 @@
1
- import type { StableExistingRecordIdentifier } from "../identifier.js";
1
+ import type { PersistedResourceKey } from "../identifier.js";
2
2
  import type { ApiError } from "./error.js";
3
3
  import type { Links, Meta, PaginationLinks } from "./json-api-raw.js";
4
4
  export interface ResourceMetaDocument {
@@ -8,8 +8,8 @@ export interface ResourceMetaDocument {
8
8
  links?: Links | PaginationLinks;
9
9
  }
10
10
  export interface SingleResourceDataDocument<
11
- T = StableExistingRecordIdentifier,
12
- R = StableExistingRecordIdentifier
11
+ T = PersistedResourceKey,
12
+ R = PersistedResourceKey
13
13
  > {
14
14
  // the url or cache-key associated with the structured document
15
15
  lid?: string;
@@ -18,7 +18,7 @@ export interface SingleResourceDataDocument<
18
18
  data: T | null;
19
19
  included?: R[];
20
20
  }
21
- export interface CollectionResourceDataDocument<T = StableExistingRecordIdentifier> {
21
+ export interface CollectionResourceDataDocument<T = PersistedResourceKey> {
22
22
  // the url or cache-key associated with the structured document
23
23
  lid?: string;
24
24
  links?: Links | PaginationLinks;
@@ -26,7 +26,7 @@ export interface CollectionResourceDataDocument<T = StableExistingRecordIdentifi
26
26
  data: T[];
27
27
  included?: T[];
28
28
  }
29
- export type ResourceDataDocument<T = StableExistingRecordIdentifier> = SingleResourceDataDocument<T> | CollectionResourceDataDocument<T>;
29
+ export type ResourceDataDocument<T = PersistedResourceKey> = SingleResourceDataDocument<T> | CollectionResourceDataDocument<T>;
30
30
  export interface ResourceErrorDocument {
31
31
  // the url or cache-key associated with the structured document
32
32
  lid?: string;
@@ -34,4 +34,4 @@ export interface ResourceErrorDocument {
34
34
  meta?: Meta;
35
35
  errors: ApiError[];
36
36
  }
37
- export type ResourceDocument<T = StableExistingRecordIdentifier> = ResourceMetaDocument | SingleResourceDataDocument<T> | CollectionResourceDataDocument<T> | ResourceErrorDocument;
37
+ export type ResourceDocument<T = PersistedResourceKey> = ResourceMetaDocument | SingleResourceDataDocument<T> | CollectionResourceDataDocument<T> | ResourceErrorDocument;
@@ -306,6 +306,19 @@ function ensureDoc(owner, content, isError) {
306
306
  content: content
307
307
  };
308
308
  }
309
+
310
+ /**
311
+ * Additional properties exposed on errors thrown by the
312
+ * {@link Fetch | Fetch Handler}.
313
+ *
314
+ * In the case of an Abort or system/browser level issue,
315
+ * this extends {@link DOMException}.
316
+ *
317
+ * Else it extends from {@link AggregateError} if the
318
+ * response includes an array of errors, falling back
319
+ * to {@link Error} as its base.
320
+ */
321
+
309
322
  function enhanceReason(reason) {
310
323
  return new DOMException(reason || 'The user aborted a request.', 'AbortError');
311
324
  }