@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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* const postsQuery = createSuspenseInfiniteQuery(reactor, {
|
|
14
14
|
* functionName: "get_posts",
|
|
15
15
|
* initialPageParam: 0,
|
|
16
|
-
* getArgs: (cursor) => [{ cursor, limit: 10 }],
|
|
16
|
+
* getArgs: (cursor) => [{ cursor, limit: 10 }] as const,
|
|
17
17
|
* getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
18
18
|
* })
|
|
19
19
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { useMemo } from "react";
|
|
27
27
|
import { useSuspenseInfiniteQuery, } from "@tanstack/react-query";
|
|
28
|
-
import { buildChainedSelect, mergeFactoryQueryKey, normalizeQueryData, } from "./utils.js";
|
|
28
|
+
import { buildChainedSelect, callConfigForKey, mergeFactoryQueryKey, mountWhileSuspended, normalizeQueryData, pickFetchOptions, queryCacheControls, retryOption, useMountQueryClient, withQueryFactoryMethods, } from "./utils.js";
|
|
29
29
|
// ============================================================================
|
|
30
30
|
// Internal Implementation
|
|
31
31
|
// ============================================================================
|
|
@@ -51,42 +51,64 @@ const createSuspenseInfiniteQueryImpl = (reactor, config) => {
|
|
|
51
51
|
const result = await reactor.callMethod({
|
|
52
52
|
functionName,
|
|
53
53
|
args,
|
|
54
|
-
callConfig,
|
|
54
|
+
callConfig: callConfigForKey(context.queryKey, callConfig),
|
|
55
55
|
});
|
|
56
56
|
return normalizeQueryData(result);
|
|
57
57
|
};
|
|
58
58
|
// Get infinite query options for fetchInfiniteQuery
|
|
59
|
-
const getInfiniteQueryOptions = () =>
|
|
60
|
-
queryKey
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const getInfiniteQueryOptions = () => {
|
|
60
|
+
const queryKey = getQueryKey();
|
|
61
|
+
return {
|
|
62
|
+
// How the query function runs, shared with the hook; see
|
|
63
|
+
// pickFetchOptions. An update method's `retry` defaults as
|
|
64
|
+
// `Reactor.getQueryRetry` says.
|
|
65
|
+
...pickFetchOptions(rest),
|
|
66
|
+
...retryOption(rest.retry, reactor.getQueryRetry(functionName, queryKey)),
|
|
67
|
+
queryKey,
|
|
68
|
+
queryFn,
|
|
69
|
+
initialPageParam,
|
|
70
|
+
getNextPageParam,
|
|
71
|
+
staleTime,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
66
74
|
// Fetch function for loaders (cache-first, fetches first page)
|
|
67
75
|
const fetch = async () => {
|
|
68
|
-
// Use ensureInfiniteQueryData to get cached data or fetch if stale
|
|
69
|
-
|
|
76
|
+
// Use ensureInfiniteQueryData to get cached data or fetch if stale. A
|
|
77
|
+
// sign-in or sign-out while it is in flight cancels it; it then runs again
|
|
78
|
+
// for the new identity rather than rejecting with TanStack's
|
|
79
|
+
// CancelledError, as `reactor.fetchQuery` does.
|
|
80
|
+
const result = await reactor.clientManager.fetchAcrossIdentitySwitch(() => reactor.queryClient.ensureInfiniteQueryData(getInfiniteQueryOptions()));
|
|
70
81
|
// Result is already InfiniteData format
|
|
71
82
|
return select ? select(result) : result;
|
|
72
83
|
};
|
|
73
84
|
// Implementation
|
|
74
85
|
const useSuspenseInfiniteQueryHook = (options) => {
|
|
86
|
+
useMountQueryClient(reactor.queryClient);
|
|
75
87
|
// Memoized and identity-preserving; see buildChainedSelect for why the
|
|
76
88
|
// function identity matters to the observer's select-result cache.
|
|
77
89
|
const chainedSelect = useMemo(() => buildChainedSelect(select, options?.select), [options?.select]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
const queryKey = getQueryKey();
|
|
91
|
+
try {
|
|
92
|
+
return useSuspenseInfiniteQuery({
|
|
93
|
+
queryKey,
|
|
94
|
+
queryFn,
|
|
95
|
+
initialPageParam,
|
|
96
|
+
getNextPageParam,
|
|
97
|
+
getPreviousPageParam,
|
|
98
|
+
maxPages,
|
|
99
|
+
staleTime,
|
|
100
|
+
...rest,
|
|
101
|
+
...options,
|
|
102
|
+
select: chainedSelect,
|
|
103
|
+
// The hook's `retry`, else the config's, else an update method's
|
|
104
|
+
// default; see `Reactor.getQueryRetry`.
|
|
105
|
+
...retryOption(options?.retry ?? rest.retry, reactor.getQueryRetry(functionName, queryKey)),
|
|
106
|
+
}, reactor.queryClient);
|
|
107
|
+
}
|
|
108
|
+
catch (thrown) {
|
|
109
|
+
mountWhileSuspended(reactor.queryClient, thrown);
|
|
110
|
+
throw thrown;
|
|
111
|
+
}
|
|
90
112
|
};
|
|
91
113
|
// Invalidate function
|
|
92
114
|
const invalidate = async () => {
|
|
@@ -114,6 +136,7 @@ const createSuspenseInfiniteQueryImpl = (reactor, config) => {
|
|
|
114
136
|
invalidate,
|
|
115
137
|
getQueryKey,
|
|
116
138
|
getCacheData,
|
|
139
|
+
...queryCacheControls(reactor, getQueryKey),
|
|
117
140
|
};
|
|
118
141
|
};
|
|
119
142
|
// ============================================================================
|
|
@@ -137,10 +160,10 @@ export function createSuspenseInfiniteQuery(reactor, config) {
|
|
|
137
160
|
*
|
|
138
161
|
* @param reactor - The Reactor instance
|
|
139
162
|
* @param config - Suspense infinite query configuration (without getArgs)
|
|
140
|
-
* @returns A function that accepts getArgs and returns
|
|
163
|
+
* @returns A function that accepts getArgs and returns a SuspenseInfiniteQueryResult
|
|
141
164
|
*
|
|
142
165
|
* @example
|
|
143
|
-
* const getPostsQuery =
|
|
166
|
+
* const getPostsQuery = createSuspenseInfiniteQueryFactory(reactor, {
|
|
144
167
|
* functionName: "get_posts",
|
|
145
168
|
* initialPageParam: 0,
|
|
146
169
|
* getKeyArgs: (args) => {
|
|
@@ -159,6 +182,9 @@ export function createSuspenseInfiniteQuery(reactor, config) {
|
|
|
159
182
|
* (cursor) => [{ userId, cursor, limit: 10 }],
|
|
160
183
|
* { queryKey: ["v2"] }
|
|
161
184
|
* )
|
|
185
|
+
*
|
|
186
|
+
* // Every list this factory made, whatever its args and pages
|
|
187
|
+
* await getPostsQuery.invalidate()
|
|
162
188
|
*/
|
|
163
189
|
export function createSuspenseInfiniteQueryFactory(reactor, config) {
|
|
164
190
|
const factory = (getArgs, options) => {
|
|
@@ -172,6 +198,12 @@ export function createSuspenseInfiniteQueryFactory(reactor, config) {
|
|
|
172
198
|
getArgs,
|
|
173
199
|
});
|
|
174
200
|
};
|
|
175
|
-
|
|
201
|
+
// What every instance's key starts with: the method, the `callConfig`
|
|
202
|
+
// segments and the config `queryKey`. A per-call `queryKey` and the args
|
|
203
|
+
// segment come after them.
|
|
204
|
+
return withQueryFactoryMethods(factory, reactor, () => reactor.generateQueryKey({
|
|
205
|
+
functionName: config.functionName,
|
|
206
|
+
queryKey: config.queryKey,
|
|
207
|
+
}, config.callConfig));
|
|
176
208
|
}
|
|
177
209
|
//# sourceMappingURL=createSuspenseInfiniteQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseInfiniteQuery.js","sourceRoot":"","sources":["../src/createSuspenseInfiniteQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAW/B,OAAO,EAEL,wBAAwB,GAOzB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"createSuspenseInfiniteQuery.js","sourceRoot":"","sources":["../src/createSuspenseInfiniteQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAW/B,OAAO,EAEL,wBAAwB,GAOzB,MAAM,uBAAuB,CAAA;AAO9B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,YAAY,CAAA;AAgOnB,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,MAAM,+BAA+B,GAAG,CAUtC,OAAoC,EACpC,MAMC,EAMD,EAAE;IAKF,MAAM,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EAAE,cAAc,EACxB,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,EACzB,MAAM,EACN,GAAG,IAAI,EACR,GAAG,MAAM,CAAA;IAEV,qEAAqE;IACrE,4EAA4E;IAC5E,4E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,GAAG,CACd,OAA2E,EAC3E,OAA4C,EAC5C,EAAE;QACF,sEAAsE;QACtE,wEAAwE;QACxE,0DAA0D;QAC1D,MAAM,QAAQ,GAAG,oBAAoB,CACnC,MAAM,CAAC,QAAQ,EACf,OAAO,EAAE,QAAQ,EACjB,SAAS,CACV,CAAA;QAED,OAAO,+BAA+B,CAMpC,OAAO,EAAE;YACT,GAAI,MAMF;YACF,QAAQ;YACR,OAAO;SAOR,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,sEAAsE;IACtE,yEAAyE;IACzE,2BAA2B;IAC3B,OAAO,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CACpD,OAAO,CAAC,gBAAgB,CACtB;QACE,YAAY,EAAE,MAAM,CAAC,YAAsB;QAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,EACD,MAAM,CAAC,UAAU,CAClB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -19,7 +19,28 @@
|
|
|
19
19
|
* const { data: user } = userQuery.useSuspenseQuery() // data is never undefined!
|
|
20
20
|
*/
|
|
21
21
|
import type { Reactor, FunctionName, ReactorArgs, TransformKey } from "@ic-reactor/core";
|
|
22
|
-
import type { QueryFnData, QueryError, SuspenseQueryConfig, SuspenseQueryResult, SuspenseQueryFactoryConfig, NoInfer } from "./types.js";
|
|
22
|
+
import type { QueryFnData, QueryError, SuspenseQueryConfig, SuspenseQueryResult, SuspenseQueryFactoryConfig, QueryFactoryFn, NoInfer } from "./types.js";
|
|
23
23
|
export declare function createSuspenseQuery<Service, Transform extends TransformKey, Method extends FunctionName<Service> = FunctionName<Service>, Selected = QueryFnData<Service, Method, Transform>>(reactor: Reactor<Service, Transform>, config: SuspenseQueryConfig<NoInfer<Service>, Method, Transform, Selected>): SuspenseQueryResult<QueryFnData<Service, Method, Transform>, Selected, QueryError<Service, Method, Transform>>;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Create a suspense query factory: a function that takes the method's args
|
|
26
|
+
* and returns the suspense query object for them, the same object for the
|
|
27
|
+
* same args.
|
|
28
|
+
*
|
|
29
|
+
* The function also has `getQueryKey()`, the key prefix every query it
|
|
30
|
+
* returns shares, and `invalidate()`, which invalidates all of them whatever
|
|
31
|
+
* their args. Pass the function itself to a mutation's `invalidateQueries` to
|
|
32
|
+
* refresh every instance after the mutation.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const getBalance = createSuspenseQueryFactory(ledger, {
|
|
36
|
+
* functionName: "icrc1_balance_of",
|
|
37
|
+
* })
|
|
38
|
+
*
|
|
39
|
+
* // In a component under <Suspense>
|
|
40
|
+
* const { data } = getBalance([{ owner, subaccount: [] }]).useSuspenseQuery()
|
|
41
|
+
*
|
|
42
|
+
* // Refetch every account's balance
|
|
43
|
+
* await getBalance.invalidate()
|
|
44
|
+
*/
|
|
45
|
+
export declare function createSuspenseQueryFactory<Service, Transform extends TransformKey, Method extends FunctionName<Service> = FunctionName<Service>, Selected = QueryFnData<Service, Method, Transform>>(reactor: Reactor<Service, Transform>, config: SuspenseQueryFactoryConfig<NoInfer<Service>, Method, Transform, Selected>): QueryFactoryFn<ReactorArgs<Service, Method, Transform>, SuspenseQueryResult<QueryFnData<Service, Method, Transform>, Selected, QueryError<Service, Method, Transform>>>;
|
|
25
46
|
//# sourceMappingURL=createSuspenseQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseQuery.d.ts","sourceRoot":"","sources":["../src/createSuspenseQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,mBAAmB,EAEnB,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,EACR,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"create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AC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EACvC,mBAAmB,CACjB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EACvC,QAAQ,EACR,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CACvC,CACF,CA+CA"}
|
|
@@ -20,48 +20,72 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { useMemo } from "react";
|
|
22
22
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
23
|
-
import { buildChainedSelect, createBoundedCache } from "./utils.js";
|
|
23
|
+
import { buildChainedSelect, createBoundedCache, mountWhileSuspended, pickFetchOptions, queryCacheControls, retryOption, useMountQueryClient, withQueryFactoryMethods, } from "./utils.js";
|
|
24
24
|
// ============================================================================
|
|
25
25
|
// Internal Implementation
|
|
26
26
|
// ============================================================================
|
|
27
27
|
const createSuspenseQueryImpl = (reactor, config) => {
|
|
28
|
-
const { functionName, args, staleTime = 5 * 60 * 1000, select, queryKey: customQueryKey, ...rest } = config;
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const { functionName, args, callConfig, staleTime = 5 * 60 * 1000, select, queryKey: customQueryKey, ...rest } = config;
|
|
29
|
+
// `callConfig` goes wherever the hooks send it: to the call and into the
|
|
30
|
+
// key, so a query of another canister or agent has an entry of its own.
|
|
31
|
+
const params = { functionName, args, queryKey: customQueryKey, callConfig };
|
|
32
|
+
const getQueryKey = () => reactor.generateQueryKey(params, callConfig);
|
|
31
33
|
const applySelect = (raw) => select ? select(raw) : raw;
|
|
34
|
+
// How the query function runs, shared with the hook; see pickFetchOptions.
|
|
35
|
+
const fetchOptions = pickFetchOptions(rest);
|
|
32
36
|
/** Cache-first fetch for use in loaders / route preloading. */
|
|
33
37
|
const fetch = async () => {
|
|
34
|
-
|
|
38
|
+
// Through the reactor rather than straight to the QueryClient: overriding
|
|
39
|
+
// `fetchQuery` in a Reactor subclass is a documented way to add logic to
|
|
40
|
+
// every factory fetch.
|
|
41
|
+
const result = await reactor.fetchQuery(params, fetchOptions);
|
|
35
42
|
return applySelect(result);
|
|
36
43
|
};
|
|
37
44
|
/** Fire-and-forget prefetch — warms the cache without blocking. */
|
|
38
45
|
const prefetch = () => {
|
|
39
46
|
const baseOptions = reactor.getQueryOptions(params);
|
|
40
|
-
|
|
47
|
+
// Runs again when a sign-in or sign-out cancels it, and never rejects;
|
|
48
|
+
// see `prefetch` in createQuery.
|
|
49
|
+
return reactor.clientManager
|
|
50
|
+
.fetchAcrossIdentitySwitch(() => reactor.queryClient.prefetchQuery({
|
|
51
|
+
...fetchOptions,
|
|
52
|
+
// An update method's default `retry`; see `Reactor.getQueryRetry`.
|
|
53
|
+
...retryOption(fetchOptions.retry, baseOptions.retry),
|
|
41
54
|
queryKey: baseOptions.queryKey,
|
|
42
55
|
queryFn: baseOptions.queryFn,
|
|
43
56
|
staleTime,
|
|
44
|
-
})
|
|
57
|
+
}))
|
|
58
|
+
.catch(() => undefined);
|
|
45
59
|
};
|
|
46
60
|
const useSuspenseQueryHook = (options) => {
|
|
61
|
+
useMountQueryClient(reactor.queryClient);
|
|
47
62
|
const baseOptions = reactor.getQueryOptions(params);
|
|
48
63
|
// Memoized so the observer's select-result cache can hit; see
|
|
49
64
|
// buildChainedSelect. `select` comes from the factory config and is stable.
|
|
50
65
|
const chainedSelect = useMemo(() => buildChainedSelect(select, options?.select), [options?.select]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
try {
|
|
67
|
+
return useSuspenseQuery({
|
|
68
|
+
queryKey: baseOptions.queryKey,
|
|
69
|
+
staleTime,
|
|
70
|
+
...rest,
|
|
71
|
+
...options,
|
|
72
|
+
queryFn: baseOptions.queryFn,
|
|
73
|
+
select: chainedSelect,
|
|
74
|
+
// The hook's `retry`, else the config's, else an update method's
|
|
75
|
+
// default; see `Reactor.getQueryRetry`.
|
|
76
|
+
...retryOption(options?.retry ?? rest.retry, baseOptions.retry),
|
|
77
|
+
}, reactor.queryClient);
|
|
78
|
+
}
|
|
79
|
+
catch (thrown) {
|
|
80
|
+
mountWhileSuspended(reactor.queryClient, thrown);
|
|
81
|
+
throw thrown;
|
|
82
|
+
}
|
|
59
83
|
};
|
|
60
84
|
const invalidate = async () => {
|
|
61
85
|
await reactor.queryClient.invalidateQueries({ queryKey: getQueryKey() });
|
|
62
86
|
};
|
|
63
87
|
const getCacheData = (selectFn) => {
|
|
64
|
-
const raw = reactor.getQueryData(params);
|
|
88
|
+
const raw = reactor.getQueryData(params, callConfig);
|
|
65
89
|
if (raw === undefined)
|
|
66
90
|
return undefined;
|
|
67
91
|
const selected = applySelect(raw);
|
|
@@ -78,6 +102,7 @@ const createSuspenseQueryImpl = (reactor, config) => {
|
|
|
78
102
|
getQueryKey,
|
|
79
103
|
getCacheData,
|
|
80
104
|
setData,
|
|
105
|
+
...queryCacheControls(reactor, getQueryKey),
|
|
81
106
|
};
|
|
82
107
|
};
|
|
83
108
|
// ============================================================================
|
|
@@ -89,13 +114,31 @@ export function createSuspenseQuery(reactor, config) {
|
|
|
89
114
|
// ============================================================================
|
|
90
115
|
// Convenience: Create suspense query with dynamic args
|
|
91
116
|
// ============================================================================
|
|
117
|
+
/**
|
|
118
|
+
* Create a suspense query factory: a function that takes the method's args
|
|
119
|
+
* and returns the suspense query object for them, the same object for the
|
|
120
|
+
* same args.
|
|
121
|
+
*
|
|
122
|
+
* The function also has `getQueryKey()`, the key prefix every query it
|
|
123
|
+
* returns shares, and `invalidate()`, which invalidates all of them whatever
|
|
124
|
+
* their args. Pass the function itself to a mutation's `invalidateQueries` to
|
|
125
|
+
* refresh every instance after the mutation.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const getBalance = createSuspenseQueryFactory(ledger, {
|
|
129
|
+
* functionName: "icrc1_balance_of",
|
|
130
|
+
* })
|
|
131
|
+
*
|
|
132
|
+
* // In a component under <Suspense>
|
|
133
|
+
* const { data } = getBalance([{ owner, subaccount: [] }]).useSuspenseQuery()
|
|
134
|
+
*
|
|
135
|
+
* // Refetch every account's balance
|
|
136
|
+
* await getBalance.invalidate()
|
|
137
|
+
*/
|
|
92
138
|
export function createSuspenseQueryFactory(reactor, config) {
|
|
93
139
|
const cache = createBoundedCache();
|
|
94
|
-
|
|
95
|
-
const key = reactor.generateQueryKey({
|
|
96
|
-
functionName: config.functionName,
|
|
97
|
-
args,
|
|
98
|
-
});
|
|
140
|
+
const factory = (args) => {
|
|
141
|
+
const key = reactor.generateQueryKey({ functionName: config.functionName, args }, config.callConfig);
|
|
99
142
|
const cacheKey = JSON.stringify(key);
|
|
100
143
|
const existing = cache.get(cacheKey);
|
|
101
144
|
if (existing)
|
|
@@ -107,5 +150,9 @@ export function createSuspenseQueryFactory(reactor, config) {
|
|
|
107
150
|
cache.set(cacheKey, result);
|
|
108
151
|
return result;
|
|
109
152
|
};
|
|
153
|
+
// The method's own prefix, at the canister and agent the config's
|
|
154
|
+
// `callConfig` names. A config `queryKey` follows the args segment in every
|
|
155
|
+
// instance's key, so it cannot narrow the prefix.
|
|
156
|
+
return withQueryFactoryMethods(factory, reactor, () => reactor.generateQueryKey({ functionName: config.functionName }, config.callConfig));
|
|
110
157
|
}
|
|
111
158
|
//# sourceMappingURL=createSuspenseQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseQuery.js","sourceRoot":"","sources":["../src/createSuspenseQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"createSuspenseQuery.js","sourceRoot":"","sources":["../src/createSuspenseQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,OAAO,EAAE,OAAO,EAAE,MA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MAAM,UAAU,0BAA0B,CAMxC,OAAoC,EACpC,MAKC;IASD,MAAM,KAAK,GACT,kBAAkB,EAMf,CAAA;IAEL,MAAM,OAAO,GAAG,CAAC,IAA6C,EAAE,EAAE;QAChE,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAClC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAsB,EAAE,IAAI,EAAE,EACrD,MAAM,CAAC,UAAU,CAClB,CAAA;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAEpC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACpC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAA;QAE7B,MAAM,MAAM,GAAG,uBAAuB,CAKpC,OAAO,EAAE;YACT,GAAI,MAKF;YACF,IAAI;SACL,CAAC,CAAA;QACF,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC3B,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAED,kEAAkE;IAClE,4EAA4E;IAC5E,kDAAkD;IAClD,OAAO,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CACpD,OAAO,CAAC,gBAAgB,CACtB,EAAE,YAAY,EAAE,MAAM,CAAC,YAAsB,EAAE,EAC/C,MAAM,CAAC,UAAU,CAClB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DisplayReactor } from "@ic-reactor/core";
|
|
2
|
+
import type { BaseActor, DisplayReactorParameters } from "@ic-reactor/core";
|
|
3
|
+
import type { DefineReactorSharedParameters, DefineReactorResult } from "./defineReactorShared.js";
|
|
4
|
+
/** Options for {@link defineDisplayReactor}: `defineReactor`'s, plus validators. */
|
|
5
|
+
export interface DefineDisplayReactorOptions<Service> extends DefineReactorSharedParameters {
|
|
6
|
+
/** Optional initial argument validators (receive display types). */
|
|
7
|
+
validators?: DisplayReactorParameters<Service>["validators"];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One-call bootstrap for a {@link DisplayReactor} and its React hooks: the
|
|
11
|
+
* display counterpart of `defineReactor`, taking the same options.
|
|
12
|
+
*
|
|
13
|
+
* A DisplayReactor takes and returns UI-friendly values — text for
|
|
14
|
+
* `Principal`, `nat`, `int` and 64-bit integers, hex for blobs — which suits
|
|
15
|
+
* forms and components. Its codecs are built on zod, so this adds zod to the
|
|
16
|
+
* bundle. `defineReactor`, which builds a plain `Reactor` with raw Candid
|
|
17
|
+
* values, does not need zod, but until its deprecated `display` flag is removed
|
|
18
|
+
* at the next major it bundles zod anyway; `createActorHooks(new Reactor(...))`
|
|
19
|
+
* is the setup without it.
|
|
20
|
+
*
|
|
21
|
+
* Replaces `defineReactor({ display: true })`, which is deprecated.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { defineDisplayReactor } from "@ic-reactor/react"
|
|
26
|
+
* import { idlFactory, type _SERVICE } from "./declarations/backend"
|
|
27
|
+
*
|
|
28
|
+
* export const { reactor, useActorQuery, useActorMutation, useAuth } =
|
|
29
|
+
* defineDisplayReactor<_SERVICE>({
|
|
30
|
+
* name: "backend",
|
|
31
|
+
* idlFactory,
|
|
32
|
+
* canisterId: "rrkah-fqaaa-aaaaa-aaaaq-cai",
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* function Balance() {
|
|
36
|
+
* // `nat` arrives as text, ready to render.
|
|
37
|
+
* const { data } = useActorQuery({ functionName: "get_balance" })
|
|
38
|
+
* return <span>{data}</span>
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function defineDisplayReactor<Service = BaseActor>(params: DefineDisplayReactorOptions<Service>): DefineReactorResult<Service, "display", DisplayReactor<Service>>;
|
|
43
|
+
//# sourceMappingURL=defineDisplayReactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineDisplayReactor.d.ts","sourceRoot":"","sources":["../src/defineDisplayReactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,0BAA0B,CAAA;AAEjC,oFAAoF;AACpF,MAAM,WAAW,2BAA2B,CAC1C,OAAO,CACP,SAAQ,6BAA6B;IACrC,oEAAoE;IACpE,UAAU,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;CAC7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAG,SAAS,EACtD,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC3C,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAUlE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DisplayReactor } from "@ic-reactor/core";
|
|
2
|
+
import { defineReactorWith } from "./defineReactorShared.js";
|
|
3
|
+
/**
|
|
4
|
+
* One-call bootstrap for a {@link DisplayReactor} and its React hooks: the
|
|
5
|
+
* display counterpart of `defineReactor`, taking the same options.
|
|
6
|
+
*
|
|
7
|
+
* A DisplayReactor takes and returns UI-friendly values — text for
|
|
8
|
+
* `Principal`, `nat`, `int` and 64-bit integers, hex for blobs — which suits
|
|
9
|
+
* forms and components. Its codecs are built on zod, so this adds zod to the
|
|
10
|
+
* bundle. `defineReactor`, which builds a plain `Reactor` with raw Candid
|
|
11
|
+
* values, does not need zod, but until its deprecated `display` flag is removed
|
|
12
|
+
* at the next major it bundles zod anyway; `createActorHooks(new Reactor(...))`
|
|
13
|
+
* is the setup without it.
|
|
14
|
+
*
|
|
15
|
+
* Replaces `defineReactor({ display: true })`, which is deprecated.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { defineDisplayReactor } from "@ic-reactor/react"
|
|
20
|
+
* import { idlFactory, type _SERVICE } from "./declarations/backend"
|
|
21
|
+
*
|
|
22
|
+
* export const { reactor, useActorQuery, useActorMutation, useAuth } =
|
|
23
|
+
* defineDisplayReactor<_SERVICE>({
|
|
24
|
+
* name: "backend",
|
|
25
|
+
* idlFactory,
|
|
26
|
+
* canisterId: "rrkah-fqaaa-aaaaa-aaaaq-cai",
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* function Balance() {
|
|
30
|
+
* // `nat` arrives as text, ready to render.
|
|
31
|
+
* const { data } = useActorQuery({ functionName: "get_balance" })
|
|
32
|
+
* return <span>{data}</span>
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function defineDisplayReactor(params) {
|
|
37
|
+
return defineReactorWith("defineDisplayReactor", params, (config) => new DisplayReactor({
|
|
38
|
+
...config,
|
|
39
|
+
validators: params.validators,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=defineDisplayReactor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineDisplayReactor.js","sourceRoot":"","sources":["../src/defineDisplayReactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAc5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA4C;IAE5C,OAAO,iBAAiB,CACtB,sBAAsB,EACtB,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,cAAc,CAAU;QAC1B,GAAG,MAAM;QACT,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CACL,CAAA;AACH,CAAC"}
|
package/dist/defineReactor.d.ts
CHANGED
|
@@ -1,9 +1,45 @@
|
|
|
1
|
+
import { DisplayReactor, Reactor } from "@ic-reactor/core";
|
|
2
|
+
import type { BaseActor } from "@ic-reactor/core";
|
|
3
|
+
import type { DefineReactorSharedParameters, DefineReactorResult } from "./defineReactorShared.js";
|
|
4
|
+
import type { DefineDisplayReactorOptions } from "./defineDisplayReactor.js";
|
|
5
|
+
export type { DefineReactorSharedParameters, DefineReactorResult, } from "./defineReactorShared.js";
|
|
6
|
+
/** Parameters for a standard (raw Candid types) reactor. */
|
|
7
|
+
export interface DefineReactorParameters extends DefineReactorSharedParameters {
|
|
8
|
+
display?: false;
|
|
9
|
+
}
|
|
1
10
|
/**
|
|
2
|
-
*
|
|
11
|
+
* Parameters for `defineReactor({ display: true })`.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Call `defineDisplayReactor` with the same options, without
|
|
14
|
+
* `display`: see {@link DefineDisplayReactorOptions}.
|
|
15
|
+
*/
|
|
16
|
+
export interface DefineDisplayReactorParameters<Service> extends DefineDisplayReactorOptions<Service> {
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `defineDisplayReactor(...)` instead of
|
|
19
|
+
* `defineReactor({ display: true, ... })`. The flag keeps working until the
|
|
20
|
+
* next major, but it makes every bundle that calls `defineReactor` carry
|
|
21
|
+
* `DisplayReactor` and zod, even when it never sets the flag.
|
|
22
|
+
*/
|
|
23
|
+
display: true;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `display: true` form: builds a DisplayReactor and its hooks.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated `defineReactor({ display: true })` is deprecated: pass the same
|
|
29
|
+
* options, without `display`, to `defineDisplayReactor(...)`. Only this form
|
|
30
|
+
* is; `defineReactor` without `display` builds a plain `Reactor` and is not
|
|
31
|
+
* deprecated. The flag keeps working until the next major, but it makes every
|
|
32
|
+
* bundle that calls `defineReactor` carry `DisplayReactor` and zod, even when
|
|
33
|
+
* it never sets the flag.
|
|
34
|
+
*/
|
|
35
|
+
export declare function defineReactor<Service = BaseActor>(params: DefineDisplayReactorParameters<Service>): DefineReactorResult<Service, "display", DisplayReactor<Service>>;
|
|
36
|
+
/**
|
|
37
|
+
* One-call bootstrap for a canister reactor + its React hooks.
|
|
3
38
|
*
|
|
4
39
|
* Collapses the four manual steps (QueryClient → ClientManager → Reactor →
|
|
5
|
-
* createActorHooks) into a single call
|
|
6
|
-
*
|
|
40
|
+
* createActorHooks) into a single call. It builds a `Reactor`, which takes and
|
|
41
|
+
* returns raw Candid values; `defineDisplayReactor` takes the same options and
|
|
42
|
+
* builds a `DisplayReactor` for UI-friendly ones.
|
|
7
43
|
* Use this when one-call bootstrap is enough. If you need reusable
|
|
8
44
|
* method-specific operations outside React, compose with query/mutation
|
|
9
45
|
* factories after setup.
|
|
@@ -17,7 +53,6 @@
|
|
|
17
53
|
* name: "backend",
|
|
18
54
|
* idlFactory,
|
|
19
55
|
* canisterId: "rrkah-fqaaa-aaaaa-aaaaq-cai",
|
|
20
|
-
* display: true, // ⇒ DisplayReactor (string principals/bigints)
|
|
21
56
|
* })
|
|
22
57
|
*
|
|
23
58
|
* function Profile() {
|
|
@@ -28,10 +63,15 @@
|
|
|
28
63
|
*
|
|
29
64
|
* @example Reuse an existing ClientManager (multiple canisters share one agent)
|
|
30
65
|
* ```typescript
|
|
31
|
-
* const ledger = defineReactor<_LEDGER>({
|
|
66
|
+
* const ledger = defineReactor<_LEDGER>({
|
|
67
|
+
* name: "ledger",
|
|
68
|
+
* idlFactory: ledgerIdl,
|
|
69
|
+
* canisterId: "ryjl3-tyaaa-aaaaa-aaaba-cai",
|
|
70
|
+
* })
|
|
32
71
|
* const index = defineReactor<_INDEX>({
|
|
33
72
|
* name: "index",
|
|
34
73
|
* idlFactory: indexIdl,
|
|
74
|
+
* canisterId: "qhbym-qaaaa-aaaaa-aaafq-cai",
|
|
35
75
|
* clientManager: ledger.clientManager,
|
|
36
76
|
* authentication: ledger.authentication, // one Internet Identity session
|
|
37
77
|
* })
|
|
@@ -42,6 +82,7 @@
|
|
|
42
82
|
* const { useAuth, useIdentityAttributes } = defineReactor<_SERVICE>({
|
|
43
83
|
* name: "backend",
|
|
44
84
|
* idlFactory,
|
|
85
|
+
* canisterId: "rrkah-fqaaa-aaaaa-aaaaq-cai",
|
|
45
86
|
* // Needed when the app is served from more than one origin.
|
|
46
87
|
* auth: { derivationOrigin: "https://app.example.com" },
|
|
47
88
|
* })
|
|
@@ -54,72 +95,5 @@
|
|
|
54
95
|
* }
|
|
55
96
|
* ```
|
|
56
97
|
*/
|
|
57
|
-
import { ClientManager, Reactor, DisplayReactor } from "@ic-reactor/core";
|
|
58
|
-
import type { BaseActor, TransformKey, ReactorParameters, ClientManagerParameters, DisplayReactorParameters } from "@ic-reactor/core";
|
|
59
|
-
import { QueryClient } from "@tanstack/react-query";
|
|
60
|
-
import { ActorHooks } from "./createActorHooks.js";
|
|
61
|
-
import { AuthenticationManager } from "./auth/authentication-manager.js";
|
|
62
|
-
import { IdentityAttributesManager } from "./auth/identity-attributes-manager.js";
|
|
63
|
-
import type { UseIdentityAttributesReturn } from "./auth/createIdentityAttributeHooks.js";
|
|
64
|
-
import type { CreateAuthHooksReturn } from "./hooks/createAuthHooks.js";
|
|
65
|
-
import type { AuthenticationManagerParameters } from "./auth/authentication-manager.js";
|
|
66
|
-
/** Options shared by both the standard and display variants of defineReactor. */
|
|
67
|
-
export interface DefineReactorSharedParameters extends Omit<ReactorParameters, "clientManager">, Omit<ClientManagerParameters, "queryClient"> {
|
|
68
|
-
/**
|
|
69
|
-
* Reuse an existing ClientManager (e.g. to share one agent across canisters).
|
|
70
|
-
* When omitted, a ClientManager is created from the agent options below.
|
|
71
|
-
*
|
|
72
|
-
* A supplied or adopted manager brings its own agent and QueryClient, so
|
|
73
|
-
* `agentOptions`, `queryClient` and `allowEnvConfig` apply only when this
|
|
74
|
-
* call creates one.
|
|
75
|
-
*/
|
|
76
|
-
clientManager?: ClientManager;
|
|
77
|
-
/**
|
|
78
|
-
* QueryClient for a ClientManager created by this call.
|
|
79
|
-
*
|
|
80
|
-
* Ignored when `clientManager` or `authentication` is supplied — queries run
|
|
81
|
-
* against that manager's own QueryClient, which is what is returned.
|
|
82
|
-
*/
|
|
83
|
-
queryClient?: QueryClient;
|
|
84
|
-
/**
|
|
85
|
-
* Reuse an existing AuthenticationManager, so several reactors share one
|
|
86
|
-
* Internet Identity session. When omitted, one is created for this reactor.
|
|
87
|
-
*
|
|
88
|
-
* Its `clientManager` is adopted for this reactor, so sign-in updates the
|
|
89
|
-
* same agent the reactor calls through. Supplying a different `clientManager`
|
|
90
|
-
* alongside it is rejected.
|
|
91
|
-
*/
|
|
92
|
-
authentication?: AuthenticationManager;
|
|
93
|
-
/**
|
|
94
|
-
* Internet Identity options forwarded to the AuthenticationManager
|
|
95
|
-
* (`identityProvider`, `derivationOrigin`, `idleOptions`, `storage`, …).
|
|
96
|
-
*
|
|
97
|
-
* Mutually exclusive with `authentication`: a manager built elsewhere is
|
|
98
|
-
* already configured, so these could not be applied to it.
|
|
99
|
-
*/
|
|
100
|
-
auth?: Omit<AuthenticationManagerParameters, "clientManager">;
|
|
101
|
-
}
|
|
102
|
-
/** Parameters for a standard (raw Candid types) reactor. */
|
|
103
|
-
export interface DefineReactorParameters extends DefineReactorSharedParameters {
|
|
104
|
-
display?: false;
|
|
105
|
-
}
|
|
106
|
-
/** Parameters for a DisplayReactor (UI-friendly string principals/bigints). */
|
|
107
|
-
export interface DefineDisplayReactorParameters<Service> extends DefineReactorSharedParameters {
|
|
108
|
-
display: true;
|
|
109
|
-
/** Optional initial argument validators (receive display types). */
|
|
110
|
-
validators?: DisplayReactorParameters<Service>["validators"];
|
|
111
|
-
}
|
|
112
|
-
/** The reactor instance plus its bound hooks and shared infrastructure. */
|
|
113
|
-
export type DefineReactorResult<Service, Transform extends TransformKey, R extends Reactor<Service, Transform>> = ActorHooks<Service, Transform> & CreateAuthHooksReturn & {
|
|
114
|
-
reactor: R;
|
|
115
|
-
clientManager: ClientManager;
|
|
116
|
-
queryClient: QueryClient;
|
|
117
|
-
/** Internet Identity session manager backing `useAuth`. */
|
|
118
|
-
authentication: AuthenticationManager;
|
|
119
|
-
/** Signed identity attribute requests backing `useIdentityAttributes`. */
|
|
120
|
-
identityAttributes: IdentityAttributesManager;
|
|
121
|
-
useIdentityAttributes: () => UseIdentityAttributesReturn;
|
|
122
|
-
};
|
|
123
|
-
export declare function defineReactor<Service = BaseActor>(params: DefineDisplayReactorParameters<Service>): DefineReactorResult<Service, "display", DisplayReactor<Service>>;
|
|
124
98
|
export declare function defineReactor<Service = BaseActor>(params: DefineReactorParameters): DefineReactorResult<Service, "candid", Reactor<Service, "candid">>;
|
|
125
99
|
//# sourceMappingURL=defineReactor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineReactor.d.ts","sourceRoot":"","sources":["../src/defineReactor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defineReactor.d.ts","sourceRoot":"","sources":["../src/defineReactor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAE5E,YAAY,EACV,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AAEjC,4DAA4D;AAC5D,MAAM,WAAW,uBAAwB,SAAQ,6BAA6B;IAC5E,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B,CAC7C,OAAO,CACP,SAAQ,2BAA2B,CAAC,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,OAAO,EAAE,IAAI,CAAA;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAG,SAAS,EAC/C,MAAM,EAAE,8BAA8B,CAAC,OAAO,CAAC,GAC9C,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAG,SAAS,EAC/C,MAAM,EAAE,uBAAuB,GAC9B,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA"}
|