@warp-drive/core 5.7.0-alpha.3 → 5.7.0-alpha.30

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 (115) 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 -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 +44 -33
  36. package/declarations/reactive/-private/schema.d.ts +16 -72
  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 -3
  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 +21 -19
  49. package/declarations/store/-private/default-cache-policy.d.ts +25 -38
  50. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +24 -15
  51. package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +38 -52
  52. package/declarations/store/-private/managers/cache-manager.d.ts +47 -95
  53. package/declarations/store/-private/managers/notification-manager.d.ts +30 -42
  54. package/declarations/store/-private/managers/record-array-manager.d.ts +45 -41
  55. package/declarations/store/-private/network/request-cache.d.ts +21 -21
  56. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
  57. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
  58. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +12 -29
  59. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +23 -3
  60. package/declarations/store/-private/new-core-tmp/request-state.d.ts +129 -22
  61. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +52 -121
  62. package/declarations/store/-private/record-arrays/-utils.d.ts +80 -0
  63. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +81 -0
  64. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +133 -0
  65. package/declarations/store/-private/record-arrays/legacy-query.d.ts +81 -0
  66. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
  67. package/declarations/store/-private/record-arrays/resource-array.d.ts +75 -0
  68. package/declarations/store/-private/store-service.d.ts +156 -101
  69. package/declarations/store/-private.d.ts +10 -7
  70. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
  71. package/declarations/store/-types/q/identifier.d.ts +9 -6
  72. package/declarations/store/-types/q/record-instance.d.ts +0 -1
  73. package/declarations/store/-types/q/schema-service.d.ts +28 -40
  74. package/declarations/store/-types/q/store.d.ts +6 -7
  75. package/declarations/store/deprecated/-private.d.ts +12 -23
  76. package/declarations/store/deprecated/store.d.ts +11 -12
  77. package/declarations/types/-private.d.ts +1 -1
  78. package/declarations/types/cache/aliases.d.ts +2 -2
  79. package/declarations/types/cache/change.d.ts +2 -2
  80. package/declarations/types/cache/mutations.d.ts +13 -13
  81. package/declarations/types/cache/operations.d.ts +115 -32
  82. package/declarations/types/cache/relationship.d.ts +4 -4
  83. package/declarations/types/cache.d.ts +51 -113
  84. package/declarations/types/graph.d.ts +12 -12
  85. package/declarations/types/identifier.d.ts +52 -76
  86. package/declarations/types/params.d.ts +2 -3
  87. package/declarations/types/request.d.ts +69 -42
  88. package/declarations/types/schema/concepts.d.ts +2 -2
  89. package/declarations/types/schema/fields.d.ts +378 -14
  90. package/declarations/types/spec/document.d.ts +6 -6
  91. package/declarations/types/spec/json-api-raw.d.ts +6 -8
  92. package/declarations/utils/string.d.ts +2 -2
  93. package/dist/{configure-B48bFHOl.js → configure-CiFDHArV.js} +4 -4
  94. package/dist/configure.js +1 -1
  95. package/dist/{context-COmAnXUQ.js → context-Bh-MA_tH.js} +40 -6
  96. package/dist/graph/-private.js +137 -144
  97. package/dist/index.js +25 -14
  98. package/dist/reactive/-private.js +1 -1
  99. package/dist/reactive.js +202 -1411
  100. package/dist/{request-state-CejVJgdj.js → request-state-B908BvPK.js} +5186 -2549
  101. package/dist/request.js +1 -1
  102. package/dist/store/-private.js +2 -3
  103. package/dist/store.js +32 -44
  104. package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
  105. package/dist/types/-private.js +1 -1
  106. package/dist/types/identifier.js +19 -45
  107. package/dist/types/request.js +45 -3
  108. package/dist/types/schema/fields.js +23 -2
  109. package/dist/utils/string.js +2 -2
  110. package/package.json +10 -10
  111. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  112. package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
  113. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
  114. package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
  115. package/dist/handler-D2jjnIA-.js +0 -339
@@ -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;
@@ -1,44 +1,6 @@
1
1
  export declare const ARRAY_SIGNAL: "___(unique) Symbol(#[])";
2
2
  export declare const OBJECT_SIGNAL: "___(unique) Symbol(#{})";
3
3
  /**
4
- * Requirements:
5
- *
6
- * Signal:
7
- *
8
- * - signal: a way of creating a reference that we can dirty when we desire to notify
9
- * - @signal: a way of creating an accessor on an object that subscribes to a signal on access
10
- * and notifies the signal on set, or of upgrading a descriptor to be such an accessor
11
- * - defineSignal: a way of creating a signal on an object
12
- * - notifySignal: a way of notifying the underlying signal that it has been dirtied
13
- * - peekSignal: a way of inspecting the signal without notifying it
14
- *
15
- * - gate: a memoized getter function that re-runs when on access if its signal is dirty
16
- * conceptually, a gate is a tightly coupled signal and memo
17
- * - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter
18
- * to be a gate
19
- * - defineGate: a way of creating a gate on an object
20
- * - notifySignal: a way of notifying the signal for a gate that it has been dirtied
21
- *
22
- * - memo:
23
- * - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter
24
- * to be a memo
25
- * - defineMemo: a way of creating a memo on an object
26
- *
27
- * - signalStore: storage bucket for signals associated to an object
28
- * - withSignalStore: a way of pre-creating a signal store on an object
29
- *
30
- *
31
- * @internal
32
- */
33
- /**
34
- * An Opaque type that represents a framework specific or TC39 signal.
35
- *
36
- * It may be an array of signals or a single signal.
37
- *
38
- * @internal
39
- */
40
- export type SignalRef = unknown;
41
- /**
42
4
  * The hooks which MUST be configured in order to use reactive arrays,
43
5
  * resources and documents with framework specfic signals or TC39 signals.
44
6
  *
@@ -156,19 +118,19 @@ export declare function setupSignals<T>(buildConfig: (options: HooksOptions) =>
156
118
  /**
157
119
  * Internal method for consuming the configured `createSignal` hook
158
120
  *
159
- * @internal
121
+ * @private
160
122
  */
161
123
  export declare function createSignal(obj: object, key: string | symbol): SignalRef;
162
124
  /**
163
125
  * Internal method for consuming the configured `consumeSignal` hook
164
126
  *
165
- * @internal
127
+ * @private
166
128
  */
167
129
  export declare function consumeSignal(signal: SignalRef): void;
168
130
  /**
169
131
  * Internal method for consuming the configured `notifySignal` hook
170
132
  *
171
- * @internal
133
+ * @private
172
134
  */
173
135
  export declare function notifySignal(signal: SignalRef): void;
174
136
  export declare function createMemo<T>(object: object, key: string | symbol, fn: () => T): () => T;
@@ -1,6 +1,10 @@
1
1
  import { ARRAY_SIGNAL, OBJECT_SIGNAL, type SignalRef } from "./configure.js";
2
2
  export type { SignalRef };
3
3
  export { ARRAY_SIGNAL, OBJECT_SIGNAL };
4
+ interface Initializer {
5
+ value: () => unknown;
6
+ }
7
+ export declare function makeInitializer(fn: () => unknown): Initializer;
4
8
  /**
5
9
  * A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
6
10
  * that enables us to store and manage the signal in a universal way.
@@ -27,30 +31,9 @@ export { ARRAY_SIGNAL, OBJECT_SIGNAL };
27
31
  * - the "key" or "name" of the signal
28
32
  * - the "object identity" or "context" to which the signal is attached
29
33
  *
30
- * @internal
34
+ * @private
31
35
  */
32
36
  export interface WarpDriveSignal {
33
- /**
34
- * The "key" or "name" of the signal.
35
- * This is usually (but not always) the name of a property
36
- * on the object to which the signal is attached.
37
- *
38
- * This is used for debugging purposes.
39
- * It is not used for any other purpose.
40
- *
41
- * @internal
42
- */
43
- key: string | symbol;
44
- /**
45
- * The "object identity" or "context" to which the
46
- * signal is attached.
47
- *
48
- * This is used for debugging purposes.
49
- * It is not used for any other purpose.
50
- *
51
- * @internal
52
- */
53
- context: object;
54
37
  /**
55
38
  * The underlying signal(s) in-use.
56
39
  *
@@ -94,14 +77,14 @@ export interface WarpDriveSignal {
94
77
  * },
95
78
  * });
96
79
  *
97
- * @internal
80
+ * @private
98
81
  */
99
82
  signal: SignalRef;
100
83
  /**
101
84
  * The last "value" computed for this signal when
102
85
  * a signal is also used for storage.
103
86
  *
104
- * @internal
87
+ * @private
105
88
  */
106
89
  value: unknown;
107
90
  /**
@@ -110,7 +93,7 @@ export interface WarpDriveSignal {
110
93
  * `value` cache and when using the signal as a
111
94
  * "gate"
112
95
  *
113
- * @internal
96
+ * @private
114
97
  */
115
98
  isStale: boolean;
116
99
  }
@@ -130,14 +113,14 @@ export interface WarpDriveSignal {
130
113
  * initializeSignalStore(obj);
131
114
  * ```
132
115
  *
133
- * @internal
116
+ * @private
134
117
  */
135
118
  export declare const Signals: "___(unique) Symbol(Signals)";
136
119
  export type SignalStore = Map<string | symbol, WarpDriveSignal>;
137
120
  /**
138
121
  * A type util to recast the object as having a signal store.
139
122
  *
140
- * @internal
123
+ * @private
141
124
  */
142
125
  export declare function upgradeWithSignals<T extends object>(obj: T): asserts obj is T & {
143
126
  [Signals]: SignalStore;
@@ -147,7 +130,7 @@ export declare function upgradeWithSignals<T extends object>(obj: T): asserts ob
147
130
  * if it does not already exist and returns the associated
148
131
  * signal store.
149
132
  *
150
- * @internal
133
+ * @private
151
134
  */
152
135
  export declare function withSignalStore<T extends object>(obj: T): SignalStore;
153
136
  /**
@@ -157,7 +140,7 @@ export declare function withSignalStore<T extends object>(obj: T): SignalStore;
157
140
  * Useful for pre-warming the shape of an object to ensure
158
141
  * a key-transition to add it is not required later.
159
142
  *
160
- * @internal
143
+ * @private
161
144
  */
162
145
  export declare function initializeSignalStore<T extends object>(obj: T): asserts obj is T & {
163
146
  [Signals]: SignalStore;
@@ -4,9 +4,10 @@ import type { SignalStore, WarpDriveSignal } from "./internal.js";
4
4
  *
5
5
  * Use when you need to ensure a signal exists and is subscribed to.
6
6
  *
7
- * @internal
7
+ * @private
8
8
  */
9
9
  export declare function entangleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
10
+ export declare function createSignalDescriptor(key: string | symbol, intialValue: unknown): PropertyDescriptor;
10
11
  /**
11
12
  * define an enumerable signal property.
12
13
  *
@@ -15,21 +16,40 @@ export declare function entangleSignal<T extends object>(signals: SignalStore, o
15
16
  * The signal will be lazily created when accessed and scoped to the
16
17
  * instance of the object.
17
18
  *
18
- * @internal
19
+ * @private
19
20
  */
20
21
  export declare function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
21
22
  /**
22
23
  * Define a non-enumerable signal property.
23
24
  *
24
- * @internal
25
+ * @private
25
26
  */
26
27
  export declare function defineNonEnumerableSignal<T extends object>(obj: T, key: string, v?: unknown): void;
28
+ interface DecoratorPropertyDescriptor extends PropertyDescriptor {
29
+ initializer?: () => unknown;
30
+ }
31
+ /**
32
+ * Decorator version of creating a signal.
33
+ */
34
+ export declare function signal<
35
+ T extends object,
36
+ K extends keyof T & string
37
+ >(target: T, key: K, descriptor?: DecoratorPropertyDescriptor): void;
38
+ /**
39
+ * Decorator version of creating a memoized getter
40
+ */
27
41
  export declare function memoized<
28
42
  T extends object,
29
43
  K extends keyof T & string
30
44
  >(target: T, key: K, descriptor: PropertyDescriptor): PropertyDescriptor;
45
+ /**
46
+ * Decorator version of creating a gate.
47
+ *
48
+ * @private
49
+ */
31
50
  export declare function gate<
32
51
  T extends object,
33
52
  K extends keyof T & string
34
53
  >(_target: T, key: K, desc: PropertyDescriptor): PropertyDescriptor;
35
54
  export declare function defineGate<T extends object>(obj: T, key: string, desc: PropertyDescriptor): void;
55
+ export {};
@@ -1,11 +1,13 @@
1
1
  import type { Future } from "../../../request.js";
2
2
  import type { ImmutableRequestInfo, ResponseInfo, StructuredErrorDocument } from "../../../types/request.js";
3
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
4
  import type { PendingPromise, RejectedPromise, ResolvedPromise } from "./promise-state.js";
4
5
  /**
5
6
  * Lazily consumes the stream of a request, providing a number of
6
7
  * reactive properties that can be used to build UIs that respond
7
8
  * to the progress of a request.
8
9
  *
10
+ * @hideconstructor
9
11
  */
10
12
  export declare class RequestLoadingState {
11
13
  private _sizeHint;
@@ -69,17 +71,55 @@ export interface PendingRequest extends PendingPromise {
69
71
  * Extends the {@link ResolvedPromise} interface.
70
72
  *
71
73
  */
72
- export interface ResolvedRequest<
73
- RT,
74
- T
75
- > extends ResolvedPromise<RT> {
74
+ export interface ResolvedRequest<RT> extends ResolvedPromise<RT> {
75
+ /**
76
+ * Retries the request with high (blocking) priority. This is the
77
+ * same as having passed `cacheOptions.reload = true` on the original
78
+ * request.
79
+ *
80
+ * This will not change the existing request's state. To subscribe
81
+ * to the new request's state, use `getRequestState` on the returned
82
+ * {@link Future}.
83
+ *
84
+ * ```ts
85
+ * const future = state.reload();
86
+ * const state = getRequestState(future);
87
+ * ```
88
+ *
89
+ * It is safe to pass this around as an "action" or "event" handler
90
+ * as its context is bound.
91
+ */
92
+ reload(): Future<RT>;
93
+ /**
94
+ * Retries the request with low (non-blocking) priority. This is the
95
+ * same as having passed `cacheOptions.backgroundReload = true` on the original
96
+ * request.
97
+ *
98
+ * This will not change the existing request's state. To subscribe
99
+ * to the new request's state, use `getRequestState` on the returned
100
+ * {@link Future}.
101
+ *
102
+ * ```ts
103
+ * const future = state.reload();
104
+ * const state = getRequestState(future);
105
+ * ```
106
+ *
107
+ * It is safe to pass this around as an "action" or "event" handler
108
+ * as its context is bound.
109
+ */
110
+ refresh(usePolicy?: boolean): Future<RT>;
76
111
  /**
77
112
  * Whether the request is cancelled.
78
113
  *
79
114
  */
80
115
  isCancelled: false;
116
+ /**
117
+ * A lazily created {@link RequestLoadingState} instance
118
+ * which provides a number of reactive properties that can be used
119
+ * to build UIs that respond to the progress of a request.
120
+ */
81
121
  loadingState: RequestLoadingState;
82
- request: ImmutableRequestInfo<RT, T> | null;
122
+ request: ImmutableRequestInfo<RT> | null;
83
123
  response: Response | ResponseInfo | null;
84
124
  }
85
125
  /**
@@ -92,16 +132,51 @@ export interface ResolvedRequest<
92
132
  */
93
133
  export interface RejectedRequest<
94
134
  RT,
95
- T,
96
135
  E extends StructuredErrorDocument = StructuredErrorDocument
97
136
  > extends RejectedPromise<E> {
137
+ /**
138
+ * Retries the request with high (blocking) priority. This is the
139
+ * same as having passed `cacheOptions.reload = true` on the original
140
+ * request.
141
+ *
142
+ * This will not change the existing request's state. To subscribe
143
+ * to the new request's state, use `getRequestState` on the returned
144
+ * {@link Future}.
145
+ *
146
+ * ```ts
147
+ * const future = state.reload();
148
+ * const state = getRequestState(future);
149
+ * ```
150
+ *
151
+ * It is safe to pass this around as an "action" or "event" handler
152
+ * as its context is bound.
153
+ */
154
+ reload(): Future<RT>;
155
+ /**
156
+ * Retries the request with low (non-blocking) priority. This is the
157
+ * same as having passed `cacheOptions.backgroundReload = true` on the original
158
+ * request.
159
+ *
160
+ * This will not change the existing request's state. To subscribe
161
+ * to the new request's state, use `getRequestState` on the returned
162
+ * {@link Future}.
163
+ *
164
+ * ```ts
165
+ * const future = state.reload();
166
+ * const state = getRequestState(future);
167
+ * ```
168
+ *
169
+ * It is safe to pass this around as an "action" or "event" handler
170
+ * as its context is bound.
171
+ */
172
+ refresh(usePolicy?: boolean): Future<RT>;
98
173
  /**
99
174
  * Whether the request is cancelled.
100
175
  *
101
176
  */
102
177
  isCancelled: false;
103
178
  loadingState: RequestLoadingState;
104
- request: ImmutableRequestInfo<RT, T> | null;
179
+ request: ImmutableRequestInfo<RT> | null;
105
180
  response: Response | ResponseInfo | null;
106
181
  }
107
182
  /**
@@ -112,9 +187,44 @@ export interface RejectedRequest<
112
187
  */
113
188
  export interface CancelledRequest<
114
189
  RT,
115
- T,
116
190
  E extends StructuredErrorDocument = StructuredErrorDocument
117
191
  > {
192
+ /**
193
+ * Retries the request with high (blocking) priority. This is the
194
+ * same as having passed `cacheOptions.reload = true` on the original
195
+ * request.
196
+ *
197
+ * This will not change the existing request's state. To subscribe
198
+ * to the new request's state, use `getRequestState` on the returned
199
+ * {@link Future}.
200
+ *
201
+ * ```ts
202
+ * const future = state.reload();
203
+ * const state = getRequestState(future);
204
+ * ```
205
+ *
206
+ * It is safe to pass this around as an "action" or "event" handler
207
+ * as its context is bound.
208
+ */
209
+ reload(): Future<RT>;
210
+ /**
211
+ * Retries the request with low (non-blocking) priority. This is the
212
+ * same as having passed `cacheOptions.backgroundReload = true` on the original
213
+ * request.
214
+ *
215
+ * This will not change the existing request's state. To subscribe
216
+ * to the new request's state, use `getRequestState` on the returned
217
+ * {@link Future}.
218
+ *
219
+ * ```ts
220
+ * const future = state.reload();
221
+ * const state = getRequestState(future);
222
+ * ```
223
+ *
224
+ * It is safe to pass this around as an "action" or "event" handler
225
+ * as its context is bound.
226
+ */
227
+ refresh(usePolicy?: boolean): Future<RT>;
118
228
  /**
119
229
  * The status of the request.
120
230
  *
@@ -175,33 +285,33 @@ export interface CancelledRequest<
175
285
  */
176
286
  isCancelled: true;
177
287
  loadingState: RequestLoadingState;
178
- request: ImmutableRequestInfo<RT, T> | null;
288
+ request: ImmutableRequestInfo<RT> | null;
179
289
  response: Response | ResponseInfo | null;
180
290
  }
181
291
  /**
182
- * RequestState extends the concept of PromiseState to provide a reactive
183
- * wrapper for a request `Future` which allows you write declarative code
292
+ * RequestState extends the concept of {@link PromiseState} to provide a reactive
293
+ * wrapper for a request {@link Future} which allows you write declarative code
184
294
  * around a Future's control flow.
185
295
  *
186
296
  * It is useful in both Template and JavaScript contexts, allowing you
187
297
  * to quickly derive behaviors and data from pending, error and success
188
298
  * states.
189
299
  *
190
- * The key difference between a Promise and a Future is that Futures provide
191
- * access to a stream of their content, the identity of the request (if any)
192
- * as well as the ability to attempt to abort the request.
300
+ * The key difference between a {@link Promise} and a Future is that Futures provide
301
+ * access to a {@link ReadableStream | stream} of their content, the {@link RequestKey} of the request (if any)
302
+ * as well as the ability to attempt to {@link Future.abort | abort} the request.
193
303
  *
194
304
  * ```ts
195
305
  * interface Future<T> extends Promise<T>> {
196
306
  * getStream(): Promise<ReadableStream>;
197
307
  * abort(): void;
198
- * lid: StableDocumentIdentifier | null;
308
+ * lid: RequestKey | null;
199
309
  * }
200
310
  * ```
201
311
  *
202
312
  * These additional APIs allow us to craft even richer state experiences.
203
313
  *
204
- * To get the state of a request, use `getRequestState`.
314
+ * To get the state of a request, use {@link getRequestState}.
205
315
  *
206
316
  * See also:
207
317
  * - {@link PendingRequest}
@@ -212,14 +322,12 @@ export interface CancelledRequest<
212
322
  */
213
323
  export type RequestCacheRequestState<
214
324
  RT = unknown,
215
- T = unknown,
216
325
  E extends StructuredErrorDocument = StructuredErrorDocument
217
- > = PendingRequest | ResolvedRequest<RT, T> | RejectedRequest<RT, T, E> | CancelledRequest<RT, T, E>;
326
+ > = PendingRequest | ResolvedRequest<RT> | RejectedRequest<RT, E> | CancelledRequest<RT, E>;
218
327
  export declare function createRequestState<
219
328
  RT,
220
- T,
221
329
  E
222
- >(future: Future<RT>): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>>;
330
+ >(future: Future<RT>): Readonly<RequestCacheRequestState<RT, StructuredErrorDocument<E>>>;
223
331
  /**
224
332
  * `getRequestState` can be used in both JavaScript and Template contexts.
225
333
  *
@@ -272,6 +380,5 @@ export declare function createRequestState<
272
380
  */
273
381
  export declare function getRequestState<
274
382
  RT,
275
- T,
276
383
  E
277
- >(future: Future<RT>): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>>;
384
+ >(future: Future<RT>): Readonly<RequestCacheRequestState<RT, StructuredErrorDocument<E>>>;