@ic-reactor/react 3.12.5 → 3.13.0
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.
- package/README.md +410 -44
- package/dist/auth/auth-client-compat.d.ts +122 -0
- package/dist/auth/auth-client-compat.d.ts.map +1 -0
- package/dist/auth/auth-client-compat.js +162 -0
- package/dist/auth/auth-client-compat.js.map +1 -0
- package/dist/auth/authentication-manager.d.ts +287 -5
- package/dist/auth/authentication-manager.d.ts.map +1 -1
- package/dist/auth/authentication-manager.js +920 -150
- package/dist/auth/authentication-manager.js.map +1 -1
- package/dist/auth/createIdentityAttributeHooks.d.ts.map +1 -1
- package/dist/auth/createIdentityAttributeHooks.js +36 -20
- package/dist/auth/createIdentityAttributeHooks.js.map +1 -1
- package/dist/auth/identity-attributes-manager.d.ts +2 -1
- package/dist/auth/identity-attributes-manager.d.ts.map +1 -1
- package/dist/auth/identity-attributes-manager.js +90 -6
- package/dist/auth/identity-attributes-manager.js.map +1 -1
- package/dist/auth/identity-attributes.d.ts.map +1 -1
- package/dist/auth/identity-attributes.js +57 -0
- package/dist/auth/identity-attributes.js.map +1 -1
- package/dist/auth/local-ii-probe.d.ts +12 -1
- package/dist/auth/local-ii-probe.d.ts.map +1 -1
- package/dist/auth/local-ii-probe.js +22 -3
- package/dist/auth/local-ii-probe.js.map +1 -1
- package/dist/auth/types.d.ts +48 -5
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/createActorHooks.d.ts +7 -18
- package/dist/createActorHooks.d.ts.map +1 -1
- package/dist/createActorHooks.js.map +1 -1
- package/dist/createInfiniteQuery.d.ts +51 -10
- package/dist/createInfiniteQuery.d.ts.map +1 -1
- package/dist/createInfiniteQuery.js +39 -15
- package/dist/createInfiniteQuery.js.map +1 -1
- package/dist/createMutation.d.ts +3 -0
- package/dist/createMutation.d.ts.map +1 -1
- package/dist/createMutation.js +87 -80
- package/dist/createMutation.js.map +1 -1
- package/dist/createQuery.d.ts +35 -2
- package/dist/createQuery.d.ts.map +1 -1
- package/dist/createQuery.js +104 -17
- package/dist/createQuery.js.map +1 -1
- package/dist/createReactorProvider.d.ts +158 -0
- package/dist/createReactorProvider.d.ts.map +1 -0
- package/dist/createReactorProvider.js +256 -0
- package/dist/createReactorProvider.js.map +1 -0
- package/dist/createSuspenseInfiniteQuery.d.ts +16 -9
- package/dist/createSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/createSuspenseInfiniteQuery.js +59 -27
- package/dist/createSuspenseInfiniteQuery.js.map +1 -1
- package/dist/createSuspenseQuery.d.ts +23 -2
- package/dist/createSuspenseQuery.d.ts.map +1 -1
- package/dist/createSuspenseQuery.js +68 -21
- package/dist/createSuspenseQuery.js.map +1 -1
- package/dist/defineDisplayReactor.d.ts +43 -0
- package/dist/defineDisplayReactor.d.ts.map +1 -0
- package/dist/defineDisplayReactor.js +42 -0
- package/dist/defineDisplayReactor.js.map +1 -0
- package/dist/defineReactor.d.ts +46 -72
- package/dist/defineReactor.d.ts.map +1 -1
- package/dist/defineReactor.js +11 -176
- package/dist/defineReactor.js.map +1 -1
- package/dist/defineReactorShared.d.ts +84 -0
- package/dist/defineReactorShared.d.ts.map +1 -0
- package/dist/defineReactorShared.js +139 -0
- package/dist/defineReactorShared.js.map +1 -0
- package/dist/hooks/createAuthHooks.d.ts +7 -0
- package/dist/hooks/createAuthHooks.d.ts.map +1 -1
- package/dist/hooks/createAuthHooks.js +180 -20
- package/dist/hooks/createAuthHooks.js.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.d.ts +34 -6
- package/dist/hooks/useActorInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.js +54 -21
- package/dist/hooks/useActorInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorMethod.d.ts +37 -4
- package/dist/hooks/useActorMethod.d.ts.map +1 -1
- package/dist/hooks/useActorMethod.js +201 -57
- package/dist/hooks/useActorMethod.js.map +1 -1
- package/dist/hooks/useActorMutation.d.ts +10 -7
- package/dist/hooks/useActorMutation.d.ts.map +1 -1
- package/dist/hooks/useActorMutation.js +14 -13
- package/dist/hooks/useActorMutation.js.map +1 -1
- package/dist/hooks/useActorQuery.d.ts +17 -4
- package/dist/hooks/useActorQuery.d.ts.map +1 -1
- package/dist/hooks/useActorQuery.js +30 -9
- package/dist/hooks/useActorQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts +15 -3
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.js +37 -17
- package/dist/hooks/useActorSuspenseInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.d.ts +2 -2
- package/dist/hooks/useActorSuspenseQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.js +20 -9
- package/dist/hooks/useActorSuspenseQuery.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/ownedAuthentication.d.ts +52 -0
- package/dist/ownedAuthentication.d.ts.map +1 -0
- package/dist/ownedAuthentication.js +49 -0
- package/dist/ownedAuthentication.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -0
- package/dist/testing.d.ts +19 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +19 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +416 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +159 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +301 -1
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +12 -7
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +34 -15
- package/dist/validation.js.map +1 -1
- package/llms.txt +259 -33
- package/package.json +17 -5
- package/src/auth/auth-client-compat.ts +273 -0
- package/src/auth/authentication-manager.ts +918 -96
- package/src/auth/createIdentityAttributeHooks.ts +47 -21
- package/src/auth/identity-attributes-manager.ts +100 -5
- package/src/auth/identity-attributes.ts +75 -0
- package/src/auth/local-ii-probe.ts +29 -3
- package/src/auth/types.ts +49 -6
- package/src/createActorHooks.ts +20 -32
- package/src/createInfiniteQuery.ts +120 -28
- package/src/createMutation.ts +161 -178
- package/src/createQuery.ts +164 -32
- package/src/createReactorProvider.ts +365 -0
- package/src/createSuspenseInfiniteQuery.ts +93 -43
- package/src/createSuspenseQuery.ts +102 -32
- package/src/defineDisplayReactor.ts +62 -0
- package/src/defineReactor.ts +81 -263
- package/src/defineReactorShared.ts +268 -0
- package/src/hooks/createAuthHooks.ts +206 -24
- package/src/hooks/useActorInfiniteQuery.ts +122 -49
- package/src/hooks/useActorMethod.ts +295 -92
- package/src/hooks/useActorMutation.ts +23 -23
- package/src/hooks/useActorQuery.ts +43 -10
- package/src/hooks/useActorSuspenseInfiniteQuery.ts +93 -50
- package/src/hooks/useActorSuspenseQuery.ts +30 -15
- package/src/index.ts +8 -0
- package/src/ownedAuthentication.ts +81 -0
- package/src/server.ts +23 -0
- package/src/testing.ts +18 -0
- package/src/types.ts +463 -14
- package/src/utils.ts +387 -3
- package/src/validation.ts +43 -19
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared type definitions for query factories (
|
|
2
|
+
* Shared type definitions for query factories (createQuery, createSuspenseQuery, etc.)
|
|
3
3
|
*/
|
|
4
4
|
import type { FunctionName, ReactorReturnOk, ReactorQueryData, ReactorReturnErr, ReactorArgs, BaseActor, TransformKey, TransformReturnRegistry, ErrResult, ActorMethodReturnType } from "@ic-reactor/core";
|
|
5
5
|
import { CanisterError } from "@ic-reactor/core";
|
|
6
6
|
import { CallConfig } from "@icp-sdk/core/agent";
|
|
7
|
-
import { QueryKey, QueryObserverOptions, UseQueryOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
7
|
+
import { QueryKey, QueryObserverOptions, UseQueryOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult, UseMutationOptions, UseMutationResult, SkipToken } from "@tanstack/react-query";
|
|
8
8
|
export type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
9
9
|
/** The raw data type returned by the query function (before select) */
|
|
10
10
|
export type QueryFnData<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid"> = ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>;
|
|
@@ -23,9 +23,38 @@ export interface BaseQueryConfig<Service = BaseActor, Method extends FunctionNam
|
|
|
23
23
|
functionName: Method;
|
|
24
24
|
/** Arguments to pass to the method (if any) */
|
|
25
25
|
args?: ReactorArgs<Service, Method, Transform>;
|
|
26
|
+
/**
|
|
27
|
+
* Call configuration for the method, as `Reactor.callMethod` takes it: a
|
|
28
|
+
* `canisterId` sends the query to another canister of the same interface,
|
|
29
|
+
* an `agent` sends it through another agent, `effectiveCanisterId` routes
|
|
30
|
+
* it. The query key carries what it sets, as the hooks' keys do, so the
|
|
31
|
+
* answer is cached apart from the reactor's own canister and agent, and
|
|
32
|
+
* `getQueryKey()`, `invalidate()` and the other cache controls act on that
|
|
33
|
+
* entry.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // The same ledger interface, another token's canister
|
|
38
|
+
* const ckbtcSymbol = createQuery(ledger, {
|
|
39
|
+
* functionName: "icrc1_symbol",
|
|
40
|
+
* callConfig: { canisterId: "mxzaz-hqaaa-aaaar-qaada-cai" },
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
callConfig?: CallConfig;
|
|
26
45
|
/** The query key to use for this query */
|
|
27
46
|
queryKey?: QueryKey;
|
|
28
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* How long data stays fresh before refetching, in milliseconds.
|
|
49
|
+
*
|
|
50
|
+
* `createQuery`, `createSuspenseQuery` and their factories default to 5
|
|
51
|
+
* minutes. The bound `useActorQuery` and `useActorSuspenseQuery` hooks (from
|
|
52
|
+
* `createActorHooks` or `defineReactor`) set no default and leave it to
|
|
53
|
+
* TanStack Query, which reads the QueryClient's
|
|
54
|
+
* `defaultOptions.queries.staleTime`. With that unset too, `useActorQuery`
|
|
55
|
+
* uses 0 and `useActorSuspenseQuery` uses 1 second, TanStack Query's
|
|
56
|
+
* fallback for suspense queries.
|
|
57
|
+
*/
|
|
29
58
|
staleTime?: number;
|
|
30
59
|
/** Transform the raw result before returning */
|
|
31
60
|
select?: (data: QueryFnData<Service, Method, Transform>) => Selected;
|
|
@@ -35,6 +64,43 @@ export interface BaseQueryConfig<Service = BaseActor, Method extends FunctionNam
|
|
|
35
64
|
* Alias for BaseQueryConfig for clarity.
|
|
36
65
|
*/
|
|
37
66
|
export type QueryConfig<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid", Selected = QueryFnData<Service, Method, Transform>> = BaseQueryConfig<Service, Method, Transform, Selected>;
|
|
67
|
+
/**
|
|
68
|
+
* Configuration for the non-suspense query hook of `createActorHooks` and
|
|
69
|
+
* `defineReactor` (`useActorQuery`): a {@link QueryConfig} whose `args` may
|
|
70
|
+
* also be TanStack Query's `skipToken`, for a query whose arguments are not
|
|
71
|
+
* known yet.
|
|
72
|
+
*
|
|
73
|
+
* A skipped query does not fetch. It has an entry of its own under its
|
|
74
|
+
* method's key (at the canister and agent `callConfig` names), which no
|
|
75
|
+
* call's key shares, so it shows no data until the arguments arrive, not
|
|
76
|
+
* even that of a call made without arguments. Once `args` holds arguments,
|
|
77
|
+
* the query is keyed and fetched as usual. Its `refetch()` has nothing to
|
|
78
|
+
* run: TanStack Query answers it with a "Missing queryFn" error, so offer a
|
|
79
|
+
* refresh only once the arguments exist.
|
|
80
|
+
*
|
|
81
|
+
* The suspense hooks do not take `skipToken`: TanStack Query has no way to
|
|
82
|
+
* suspend on a query that cannot run.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { skipToken } from "@ic-reactor/react"
|
|
87
|
+
*
|
|
88
|
+
* function Balance({ owner }: { owner?: string }) {
|
|
89
|
+
* // No `!`, no placeholder account, no `enabled`
|
|
90
|
+
* const { data } = useActorQuery({
|
|
91
|
+
* functionName: "icrc1_balance_of",
|
|
92
|
+
* args: owner ? [{ owner }] : skipToken,
|
|
93
|
+
* })
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export interface SkippableQueryConfig<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid", Selected = QueryFnData<Service, Method, Transform>> extends Omit<QueryConfig<Service, Method, Transform, Selected>, "args"> {
|
|
98
|
+
/**
|
|
99
|
+
* Arguments to pass to the method, or `skipToken` while they are not
|
|
100
|
+
* known: the query then waits without fetching.
|
|
101
|
+
*/
|
|
102
|
+
args?: ReactorArgs<Service, Method, Transform> | SkipToken;
|
|
103
|
+
}
|
|
38
104
|
/**
|
|
39
105
|
* Configuration for createSuspenseQuery (useSuspenseQuery).
|
|
40
106
|
* Alias for BaseQueryConfig for clarity.
|
|
@@ -82,6 +148,110 @@ export interface UseSuspenseQueryWithSelect<TQueryFnData, TSelected = TQueryFnDa
|
|
|
82
148
|
select: (data: TSelected) => TFinal;
|
|
83
149
|
}): UseSuspenseQueryResult<TFinal, TError>;
|
|
84
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* What `optimisticUpdate()` resolves with: the way back to the value the
|
|
153
|
+
* cache held before the update.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const update = await postQuery.optimisticUpdate((post) => ({
|
|
158
|
+
* ...post,
|
|
159
|
+
* likes: post.likes + 1n,
|
|
160
|
+
* }))
|
|
161
|
+
* // The call failed: show the post as it was
|
|
162
|
+
* update.rollback()
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export interface OptimisticRollback {
|
|
166
|
+
/**
|
|
167
|
+
* Write back the value the cache held before the update, with the time it
|
|
168
|
+
* was fetched, so it is as fresh or as stale as it was. A value that was
|
|
169
|
+
* invalidated is invalidated again, so a mounted query refetches it, as
|
|
170
|
+
* the refetch the update cancelled would have.
|
|
171
|
+
*
|
|
172
|
+
* It does nothing when the update wrote nothing, or when another principal
|
|
173
|
+
* has signed in or out since: the value was the previous principal's, and
|
|
174
|
+
* the sign-in has already removed or refetched it. It restores that value
|
|
175
|
+
* even if a fetch or another update has written since; invalidate the
|
|
176
|
+
* query afterwards when the canister's current value matters.
|
|
177
|
+
*/
|
|
178
|
+
rollback: () => void;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The operations every query object has on its own cache entry, on the
|
|
182
|
+
* reactor's QueryClient. They act on that one entry: other args of the same
|
|
183
|
+
* method, and other queries under the same key prefix, are left alone.
|
|
184
|
+
*
|
|
185
|
+
* @template TQueryFnData - The raw (pre-`select`) data the entry holds
|
|
186
|
+
*/
|
|
187
|
+
export interface QueryCacheControls<TQueryFnData> {
|
|
188
|
+
/**
|
|
189
|
+
* Cancel this query's fetch in flight, if there is one. The entry keeps
|
|
190
|
+
* the value it held before that fetch started, and a later refetch runs as
|
|
191
|
+
* usual.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* // Before writing to the cache, so an older answer cannot land on top
|
|
196
|
+
* await postQuery.cancel()
|
|
197
|
+
* postQuery.setData(draft)
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
cancel: () => Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Reset this query's entry to its initial state, as TanStack Query's
|
|
203
|
+
* `resetQueries` does: its data is cleared, or goes back to `initialData`
|
|
204
|
+
* when one was given. A mounted hook then fetches it again, and a suspense
|
|
205
|
+
* hook suspends until it has. It resolves once that fetch settles.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* // A reload button that shows the Suspense fallback again
|
|
210
|
+
* <button onClick={() => void statsQuery.reset()}>Reload</button>
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
reset: () => Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Replace this query's cached value for the duration of a mutation, and
|
|
216
|
+
* get back a rollback for when it fails.
|
|
217
|
+
*
|
|
218
|
+
* It cancels the query's fetch in flight, so an answer from before the
|
|
219
|
+
* mutation cannot overwrite the new value, then writes what `updater`
|
|
220
|
+
* returns for the cached value. `updater` gets and returns the raw,
|
|
221
|
+
* pre-`select` data. When nothing is cached yet it is not called, nothing
|
|
222
|
+
* is cancelled or written, and `rollback()` does nothing: there is no
|
|
223
|
+
* value on screen to update, and the query's own fetch will bring one. The
|
|
224
|
+
* same goes when another principal signs in or out while it cancels, since
|
|
225
|
+
* the cached value is then the previous principal's.
|
|
226
|
+
*
|
|
227
|
+
* The fetch it cancels may be a refetch an invalidation or a sign-in
|
|
228
|
+
* started, so refetch the query once the mutation settles, with
|
|
229
|
+
* `invalidate()` in `onSettled` or the query in `invalidateQueries`.
|
|
230
|
+
*
|
|
231
|
+
* Return it from `onMutate`, so the rollback reaches `onError`.
|
|
232
|
+
*
|
|
233
|
+
* @param updater - The new value, from the cached one. Do not mutate the
|
|
234
|
+
* cached value in place; return a new one.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const getPost = createQueryFactory(backend, { functionName: "getPost" })
|
|
239
|
+
* const likePost = createMutation(backend, { functionName: "likePost" })
|
|
240
|
+
*
|
|
241
|
+
* const { mutate } = likePost.useMutation({
|
|
242
|
+
* onMutate: ([postId]) =>
|
|
243
|
+
* getPost([postId]).optimisticUpdate((post) => ({
|
|
244
|
+
* ...post,
|
|
245
|
+
* likes: post.likes + 1n,
|
|
246
|
+
* })),
|
|
247
|
+
* onError: (_error, _args, update) => update?.rollback(),
|
|
248
|
+
* // Refetch either way: a call that failed in transit may still have run
|
|
249
|
+
* onSettled: (_data, _error, [postId]) => getPost([postId]).invalidate(),
|
|
250
|
+
* })
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
optimisticUpdate: (updater: (old: TQueryFnData) => TQueryFnData) => Promise<OptimisticRollback>;
|
|
254
|
+
}
|
|
85
255
|
/**
|
|
86
256
|
* Base result interface shared between createQuery and createSuspenseQuery.
|
|
87
257
|
*
|
|
@@ -89,7 +259,7 @@ export interface UseSuspenseQueryWithSelect<TQueryFnData, TSelected = TQueryFnDa
|
|
|
89
259
|
* @template TSelected - The type after select transformation
|
|
90
260
|
* @template TError - The error type
|
|
91
261
|
*/
|
|
92
|
-
export interface BaseQueryResult<TQueryFnData, TSelected = TQueryFnData, _TError = Error> {
|
|
262
|
+
export interface BaseQueryResult<TQueryFnData, TSelected = TQueryFnData, _TError = Error> extends QueryCacheControls<TQueryFnData> {
|
|
93
263
|
/** Fetch data in loader (uses ensureQueryData for cache-first) */
|
|
94
264
|
fetch: () => Promise<TSelected>;
|
|
95
265
|
/**
|
|
@@ -97,6 +267,12 @@ export interface BaseQueryResult<TQueryFnData, TSelected = TQueryFnData, _TError
|
|
|
97
267
|
* Useful for preloading data before navigating to a route.
|
|
98
268
|
*
|
|
99
269
|
* Unlike `fetch()`, this returns a void promise so it can be fire-and-forget.
|
|
270
|
+
* It never rejects: after a failed fetch the cached data is left as it was.
|
|
271
|
+
*
|
|
272
|
+
* A sign-in or sign-out while it is in flight cancels the fetch, so the
|
|
273
|
+
* previous principal's answer is never cached, and it runs again for the
|
|
274
|
+
* principal signed in, as `fetch()` does. When that run succeeds, the cache
|
|
275
|
+
* holds that principal's answer by the time the promise resolves.
|
|
100
276
|
*
|
|
101
277
|
* @example
|
|
102
278
|
* // In a route hover handler
|
|
@@ -174,6 +350,215 @@ export interface SuspenseQueryResult<TQueryFnData, TSelected = TQueryFnData, TEr
|
|
|
174
350
|
/** React hook for components - data is always defined (wrap in Suspense) */
|
|
175
351
|
useSuspenseQuery: UseSuspenseQueryWithSelect<TQueryFnData, TSelected, TError>;
|
|
176
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* The members every args-late query factory function carries
|
|
355
|
+
* (`createQueryFactory`, `createSuspenseQueryFactory`,
|
|
356
|
+
* `createInfiniteQueryFactory`, `createSuspenseInfiniteQueryFactory`).
|
|
357
|
+
*
|
|
358
|
+
* A factory makes one query per set of args, so there was no key to name all
|
|
359
|
+
* of them: invalidating a list after a mutation meant keeping the args of each
|
|
360
|
+
* instance around. These address every query the factory returns at once.
|
|
361
|
+
*/
|
|
362
|
+
export interface QueryFactoryMethods {
|
|
363
|
+
/**
|
|
364
|
+
* The key prefix every query of this factory shares, whatever its args: the
|
|
365
|
+
* canister (the config's `callConfig.canisterId`, else the reactor's) and
|
|
366
|
+
* the method, plus the reactor's transform segment and any agent or
|
|
367
|
+
* effective-target segment the config's `callConfig` adds, and for an
|
|
368
|
+
* infinite factory its config `queryKey`. TanStack Query matches keys by
|
|
369
|
+
* prefix, so the prefix covers every args instance and every infinite page
|
|
370
|
+
* set. Queries of the same method made elsewhere share it too.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* const getBalance = createQueryFactory(ledger, {
|
|
375
|
+
* functionName: "icrc1_balance_of",
|
|
376
|
+
* })
|
|
377
|
+
*
|
|
378
|
+
* // Every cached balance, whatever the account
|
|
379
|
+
* ledger.queryClient.getQueriesData({ queryKey: getBalance.getQueryKey() })
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
getQueryKey: () => QueryKey;
|
|
383
|
+
/**
|
|
384
|
+
* Invalidate every query of this factory, whatever its args, on the
|
|
385
|
+
* reactor's QueryClient. It resolves once the active ones have refetched; a
|
|
386
|
+
* refetch that fails does not reject it.
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* // After a transfer, refresh every balance on screen
|
|
391
|
+
* await getBalance.invalidate()
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
invalidate: () => Promise<void>;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* The function `createQueryFactory` and `createSuspenseQueryFactory` return:
|
|
398
|
+
* called with args it returns the query object for them, the same object for
|
|
399
|
+
* the same args, and it also carries {@link QueryFactoryMethods}.
|
|
400
|
+
*
|
|
401
|
+
* @template TArgs - The method's arguments
|
|
402
|
+
* @template TQuery - The query object it returns
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const getPost = createQueryFactory(backend, { functionName: "get_post" })
|
|
407
|
+
*
|
|
408
|
+
* // One post's query object
|
|
409
|
+
* const { data } = getPost([postId]).useQuery()
|
|
410
|
+
*
|
|
411
|
+
* // Every post's, whatever its args
|
|
412
|
+
* await getPost.invalidate()
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
export interface QueryFactoryFn<TArgs, TQuery> extends QueryFactoryMethods {
|
|
416
|
+
(args: TArgs): TQuery;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* What a query factory returns for `skipToken`: the query's `useQuery` hook
|
|
420
|
+
* alone, which renders a query that waits without fetching.
|
|
421
|
+
*
|
|
422
|
+
* The imperative members are left out because there is no call to make or
|
|
423
|
+
* entry to read until the args are known: narrow to the args first to reach
|
|
424
|
+
* `fetch()`, `invalidate()` or the cache controls.
|
|
425
|
+
*
|
|
426
|
+
* @template TQuery - The query object the factory returns for args
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const getBalance = createQueryFactory(ledger, {
|
|
431
|
+
* functionName: "icrc1_balance_of",
|
|
432
|
+
* })
|
|
433
|
+
*
|
|
434
|
+
* // A SkippedQuery: only useQuery(), which does not fetch
|
|
435
|
+
* const { data } = getBalance(skipToken).useQuery()
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
export type SkippedQuery<TQuery extends {
|
|
439
|
+
useQuery: unknown;
|
|
440
|
+
}> = Pick<TQuery, "useQuery">;
|
|
441
|
+
/**
|
|
442
|
+
* The function `createQueryFactory` returns: a {@link QueryFactoryFn} that
|
|
443
|
+
* also takes TanStack Query's `skipToken` in place of args, for a component
|
|
444
|
+
* whose args are not known yet. For `skipToken` it returns a
|
|
445
|
+
* {@link SkippedQuery}, whose `useQuery()` waits without fetching, in an
|
|
446
|
+
* entry of its own under the factory's `getQueryKey()` prefix. Given
|
|
447
|
+
* `args ? [args] : skipToken`, it returns either, and `useQuery()` can be
|
|
448
|
+
* called on the result directly.
|
|
449
|
+
*
|
|
450
|
+
* `createSuspenseQueryFactory` returns a plain {@link QueryFactoryFn}: a
|
|
451
|
+
* suspense query cannot wait on `skipToken`.
|
|
452
|
+
*
|
|
453
|
+
* @template TArgs - The method's arguments
|
|
454
|
+
* @template TQuery - The query object it returns for args
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* const getBalance = createQueryFactory(ledger, {
|
|
459
|
+
* functionName: "icrc1_balance_of",
|
|
460
|
+
* })
|
|
461
|
+
*
|
|
462
|
+
* function Balance({ owner }: { owner?: string }) {
|
|
463
|
+
* const { data } = getBalance(owner ? [{ owner }] : skipToken).useQuery()
|
|
464
|
+
* }
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
export interface SkippableQueryFactoryFn<TArgs, TQuery extends {
|
|
468
|
+
useQuery: unknown;
|
|
469
|
+
}> extends QueryFactoryMethods {
|
|
470
|
+
(args: TArgs): TQuery;
|
|
471
|
+
(args: SkipToken): SkippedQuery<TQuery>;
|
|
472
|
+
(args: TArgs | SkipToken): TQuery | SkippedQuery<TQuery>;
|
|
473
|
+
(args: TArgs): TQuery;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Anything that knows the key of its queries: a query object from
|
|
477
|
+
* `createQuery`, `createSuspenseQuery`, `createInfiniteQuery` or
|
|
478
|
+
* `createSuspenseInfiniteQuery` (factory instances included), or a query
|
|
479
|
+
* factory function, whose key covers every query it returns.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```typescript
|
|
483
|
+
* const postsQuery = createQuery(backend, { functionName: "get_posts" })
|
|
484
|
+
* const getPost = createQueryFactory(backend, { functionName: "get_post" })
|
|
485
|
+
*
|
|
486
|
+
* // Both are key sources, so both go straight into invalidateQueries
|
|
487
|
+
* createMutation(backend, {
|
|
488
|
+
* functionName: "create_post",
|
|
489
|
+
* invalidateQueries: [postsQuery, getPost],
|
|
490
|
+
* })
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
export interface QueryKeySource {
|
|
494
|
+
/** The key, or key prefix, of the queries it names. */
|
|
495
|
+
getQueryKey: () => QueryKey;
|
|
496
|
+
/**
|
|
497
|
+
* Invalidate those queries on the QueryClient they are cached in.
|
|
498
|
+
* `invalidateQueries` calls it when it is there, so a query of another
|
|
499
|
+
* reactor with a QueryClient of its own is invalidated in that client. The
|
|
500
|
+
* key goes to the mutation's reactor's QueryClient otherwise.
|
|
501
|
+
*/
|
|
502
|
+
invalidate?: () => Promise<void>;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A method of the mutation's own reactor, and optionally one set of its
|
|
506
|
+
* arguments: the same shape `Reactor.invalidateQueries` takes. Its key is
|
|
507
|
+
* built by the reactor's `generateQueryKey` when the mutation succeeds, so it
|
|
508
|
+
* follows a `setCanisterId` and carries the reactor's transform segment. It
|
|
509
|
+
* is rooted at the canister the mutation was sent to: the reactor's, or the
|
|
510
|
+
* one the mutation's `callConfig.canisterId` names.
|
|
511
|
+
*
|
|
512
|
+
* Without `args` it names every query of the method, whatever its args,
|
|
513
|
+
* infinite queries included. With `args` it names the queries made with those
|
|
514
|
+
* args by `createQuery`, a query factory or the hooks, and `args: []` names a
|
|
515
|
+
* method without parameters as no `args` does. An infinite query keys its
|
|
516
|
+
* page set by its first page's args in another form, which `args` does not
|
|
517
|
+
* match, and a query of another canister than the mutation's is keyed apart:
|
|
518
|
+
* name either by its query object or key instead.
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```typescript
|
|
522
|
+
* invalidateQueries: [
|
|
523
|
+
* { functionName: "get_posts" },
|
|
524
|
+
* { functionName: "get_post", args: [postId] },
|
|
525
|
+
* ]
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
export type QueryDescriptor<Service = BaseActor, Transform extends TransformKey = "candid"> = {
|
|
529
|
+
[Method in FunctionName<Service>]: {
|
|
530
|
+
/** The method whose queries to name */
|
|
531
|
+
functionName: Method;
|
|
532
|
+
/** The arguments of the one query to name; omit for every query of the method */
|
|
533
|
+
args?: ReactorArgs<Service, Method, Transform>;
|
|
534
|
+
};
|
|
535
|
+
}[FunctionName<Service>];
|
|
536
|
+
/**
|
|
537
|
+
* One entry of `invalidateQueries`: which queries a successful mutation
|
|
538
|
+
* invalidates.
|
|
539
|
+
*
|
|
540
|
+
* - a query key, as `generateQueryKey` or `getQueryKey()` builds it;
|
|
541
|
+
* - a query object or query factory ({@link QueryKeySource});
|
|
542
|
+
* - a method of the mutation's own reactor, with or without args
|
|
543
|
+
* ({@link QueryDescriptor});
|
|
544
|
+
* - `undefined`, which is skipped, so `[maybeQuery]` and
|
|
545
|
+
* `[maybeQuery?.getQueryKey()]` are safe when the query is absent.
|
|
546
|
+
*
|
|
547
|
+
* TanStack Query matches each key by prefix.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```typescript
|
|
551
|
+
* createMutation(backend, {
|
|
552
|
+
* functionName: "create_post",
|
|
553
|
+
* invalidateQueries: [
|
|
554
|
+
* postsQuery, // a query object
|
|
555
|
+
* getPost, // a query factory: every post, whatever its args
|
|
556
|
+
* { functionName: "get_posts_count" }, // a method of this reactor
|
|
557
|
+
* ],
|
|
558
|
+
* })
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
export type InvalidationTarget<Service = BaseActor, Transform extends TransformKey = "candid"> = QueryKey | QueryKeySource | QueryDescriptor<Service, Transform> | undefined;
|
|
177
562
|
/**
|
|
178
563
|
* Configuration for createMutation and useActorMutation.
|
|
179
564
|
*
|
|
@@ -186,13 +571,21 @@ export interface MutationConfig<Service = BaseActor, Method extends FunctionName
|
|
|
186
571
|
/** Call configuration for the actor method */
|
|
187
572
|
callConfig?: CallConfig;
|
|
188
573
|
/**
|
|
189
|
-
* Queries to invalidate upon successful mutation.
|
|
574
|
+
* Queries to invalidate upon successful mutation, before `onSuccess` runs.
|
|
575
|
+
* The mutation stays pending until the invalidated queries in use have
|
|
576
|
+
* refetched, so `onSuccess` reads the refetched data.
|
|
577
|
+
*
|
|
578
|
+
* Each entry is a query key, a query object or query factory, or a
|
|
579
|
+
* `{ functionName, args? }` method of this mutation's reactor; see
|
|
580
|
+
* {@link InvalidationTarget}. `undefined` entries are skipped, so
|
|
581
|
+
* `[maybeQuery]` is safe when the optional query object is absent.
|
|
190
582
|
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* invalidateQueries: [getPosts, { functionName: "get_posts_count" }]
|
|
586
|
+
* ```
|
|
194
587
|
*/
|
|
195
|
-
invalidateQueries?:
|
|
588
|
+
invalidateQueries?: InvalidationTarget<Service, Transform>[];
|
|
196
589
|
/**
|
|
197
590
|
* Callback for canister-level business logic errors.
|
|
198
591
|
* Called when the canister returns a Result { Err: E } variant.
|
|
@@ -230,16 +623,19 @@ export type MutationFactoryConfig<Service = BaseActor, Method extends FunctionNa
|
|
|
230
623
|
*/
|
|
231
624
|
export interface MutationHookOptions<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid", TOnMutateResult = unknown> extends Omit<UseMutationOptions<ReactorReturnOk<Service, Method, Transform>, ReactorReturnErr<Service, Method, Transform>, ReactorArgs<Service, Method, Transform>, TOnMutateResult>, "mutationFn"> {
|
|
232
625
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
626
|
+
* Queries to invalidate upon successful mutation, after the factory's own
|
|
627
|
+
* `invalidateQueries` and before `onSuccess`. Takes the same entries:
|
|
628
|
+
* a query key, a query object or query factory, or a
|
|
629
|
+
* `{ functionName, args? }` method of the mutation's reactor; see
|
|
630
|
+
* {@link InvalidationTarget}.
|
|
235
631
|
*
|
|
236
632
|
* @example
|
|
237
|
-
* const balanceQuery = getIcpBalance(account)
|
|
633
|
+
* const balanceQuery = getIcpBalance([account])
|
|
238
634
|
* useMutation({
|
|
239
|
-
* invalidateQueries: [balanceQuery
|
|
635
|
+
* invalidateQueries: [balanceQuery],
|
|
240
636
|
* })
|
|
241
637
|
*/
|
|
242
|
-
invalidateQueries?:
|
|
638
|
+
invalidateQueries?: InvalidationTarget<Service, Transform>[];
|
|
243
639
|
/**
|
|
244
640
|
* Callback for canister-level business logic errors.
|
|
245
641
|
* Called when the canister returns a Result { Err: E } variant.
|
|
@@ -264,7 +660,12 @@ export interface MutationResult<Service = BaseActor, Method extends FunctionName
|
|
|
264
660
|
* })
|
|
265
661
|
*/
|
|
266
662
|
useMutation: <TOnMutateResult = unknown>(options?: MutationHookOptions<Service, Method, Transform, TOnMutateResult>) => UseMutationResult<ReactorReturnOk<Service, Method, Transform>, ReactorReturnErr<Service, Method, Transform>, ReactorArgs<Service, Method, Transform>, TOnMutateResult>;
|
|
267
|
-
/**
|
|
663
|
+
/**
|
|
664
|
+
* Execute the update call outside React. It runs in the QueryClient's
|
|
665
|
+
* MutationCache with the factory's options and callbacks, as `useMutation()`
|
|
666
|
+
* does without hook options. It resolves with the method's result and
|
|
667
|
+
* rejects with the call's error.
|
|
668
|
+
*/
|
|
268
669
|
execute: (args: ReactorArgs<Service, Method, Transform>) => Promise<ReactorReturnOk<Service, Method, Transform>>;
|
|
269
670
|
}
|
|
270
671
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,SAAS,EACT,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,SAAS,EACT,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACV,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;AAKvD,uEAAuE;AACvE,MAAM,MAAM,WAAW,CACr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