@trpc/react-query 11.0.0-alpha-tmp-issues-5851-take-two.496 → 11.0.0-alpha-tmp-subscription-connection-state.485
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/dist/bundle-analysis.json +64 -42
- package/dist/createTRPCReact.d.ts +3 -3
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/dist/internals/context.d.ts +18 -2
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/getQueryKey.d.ts +8 -0
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.js +15 -0
- package/dist/internals/getQueryKey.mjs +14 -1
- package/dist/shared/hooks/createHooksInternal.d.ts +2 -2
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.js +67 -3
- package/dist/shared/hooks/createHooksInternal.mjs +68 -4
- package/dist/shared/hooks/types.d.ts +171 -2
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/hooks/types.js +133 -0
- package/dist/shared/hooks/types.mjs +126 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/index.mjs +1 -0
- package/dist/shared/proxy/utilsProxy.d.ts +12 -4
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.js +14 -2
- package/dist/shared/proxy/utilsProxy.mjs +15 -3
- package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
- package/dist/utils/createUtilityFunctions.js +23 -0
- package/dist/utils/createUtilityFunctions.mjs +23 -0
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +11 -2
- package/src/index.ts +1 -1
- package/src/internals/context.tsx +26 -1
- package/src/internals/getQueryKey.ts +21 -0
- package/src/shared/hooks/createHooksInternal.tsx +146 -18
- package/src/shared/hooks/types.ts +365 -1
- package/src/shared/proxy/utilsProxy.ts +47 -6
- package/src/utils/createUtilityFunctions.ts +26 -0
|
@@ -4,11 +4,21 @@ import { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { TRPCContext } from '../../internals/context.mjs';
|
|
6
6
|
import { getClientArgs } from '../../internals/getClientArgs.mjs';
|
|
7
|
-
import { getQueryKeyInternal } from '../../internals/getQueryKey.mjs';
|
|
7
|
+
import { getQueryKeyInternal, getMutationKeyInternal } from '../../internals/getQueryKey.mjs';
|
|
8
8
|
import { useHookResult } from '../../internals/useHookResult.mjs';
|
|
9
9
|
import { createUtilityFunctions } from '../../utils/createUtilityFunctions.mjs';
|
|
10
10
|
import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
11
|
+
import { getStartingResult, getIdleResult, getPendingResult, getConnectingResult, getErrorResult } from './types.mjs';
|
|
11
12
|
|
|
13
|
+
const trackResult = (result, onTrackResult)=>{
|
|
14
|
+
const trackedResult = new Proxy(result, {
|
|
15
|
+
get (target, prop) {
|
|
16
|
+
onTrackResult(prop);
|
|
17
|
+
return target[prop];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return trackedResult;
|
|
21
|
+
};
|
|
12
22
|
/**
|
|
13
23
|
* @internal
|
|
14
24
|
*/ function createRootHooks(config) {
|
|
@@ -161,9 +171,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
161
171
|
function useMutation$1(path, opts) {
|
|
162
172
|
const { client } = useContext();
|
|
163
173
|
const queryClient = useQueryClient();
|
|
164
|
-
const mutationKey =
|
|
165
|
-
path
|
|
166
|
-
];
|
|
174
|
+
const mutationKey = getMutationKeyInternal(path);
|
|
167
175
|
const defaultOpts = queryClient.defaultMutationOptions(queryClient.getMutationDefaults(mutationKey));
|
|
168
176
|
const hook = useMutation({
|
|
169
177
|
...opts,
|
|
@@ -193,6 +201,33 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
193
201
|
/* istanbul ignore next -- @preserve */ function useSubscription(path, input, opts) {
|
|
194
202
|
const enabled = opts?.enabled ?? input !== skipToken;
|
|
195
203
|
const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
|
|
204
|
+
const trackedProps = React.useRef(new Set([]));
|
|
205
|
+
const addTrackedProp = React.useCallback((key)=>{
|
|
206
|
+
trackedProps.current.add(key);
|
|
207
|
+
}, []);
|
|
208
|
+
// const restart = React.useRef<restartSubscriptionFn<unknown>>(() => {
|
|
209
|
+
// throw new Error('not implemented');
|
|
210
|
+
// });
|
|
211
|
+
const currentResult = React.useRef(enabled ? getStartingResult() : getIdleResult());
|
|
212
|
+
const [subscriptionState, setSubscriptionState] = React.useState(trackResult(currentResult.current, addTrackedProp));
|
|
213
|
+
const updateSubscriptionState = React.useCallback((opts)=>{
|
|
214
|
+
const oldResult = currentResult.current;
|
|
215
|
+
const newResult = typeof opts === 'function' ? opts(currentResult.current) : opts;
|
|
216
|
+
currentResult.current = newResult;
|
|
217
|
+
let shouldUpdate = false;
|
|
218
|
+
for (const key of trackedProps.current){
|
|
219
|
+
if (oldResult[key] !== newResult[key]) {
|
|
220
|
+
shouldUpdate = true;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (shouldUpdate) {
|
|
225
|
+
setSubscriptionState(trackResult(newResult, addTrackedProp));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
}, [
|
|
229
|
+
addTrackedProp
|
|
230
|
+
]);
|
|
196
231
|
const { client } = useContext();
|
|
197
232
|
const optsRef = React.useRef(opts);
|
|
198
233
|
optsRef.current = opts;
|
|
@@ -210,23 +245,52 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
210
245
|
onData: (data)=>{
|
|
211
246
|
if (!isStopped) {
|
|
212
247
|
optsRef.current.onData(data);
|
|
248
|
+
updateSubscriptionState((prev)=>{
|
|
249
|
+
if (prev.isPending) {
|
|
250
|
+
return getPendingResult(prev, data);
|
|
251
|
+
}
|
|
252
|
+
return prev;
|
|
253
|
+
});
|
|
213
254
|
}
|
|
214
255
|
},
|
|
215
256
|
onError: (err)=>{
|
|
216
257
|
if (!isStopped) {
|
|
217
258
|
optsRef.current.onError?.(err);
|
|
218
259
|
}
|
|
260
|
+
},
|
|
261
|
+
onStateChange: (state)=>{
|
|
262
|
+
if (state.state === 'idle') {
|
|
263
|
+
updateSubscriptionState(getIdleResult());
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (state.state === 'connecting') {
|
|
267
|
+
updateSubscriptionState((prev)=>{
|
|
268
|
+
return getConnectingResult(prev, state.data ?? null);
|
|
269
|
+
});
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (state.state === 'pending') {
|
|
273
|
+
updateSubscriptionState((prev)=>getPendingResult(prev));
|
|
274
|
+
}
|
|
275
|
+
if (state.state === 'error') {
|
|
276
|
+
updateSubscriptionState((prev)=>{
|
|
277
|
+
return getErrorResult(prev, state.data);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
219
280
|
}
|
|
220
281
|
});
|
|
282
|
+
// const effectRestart = restart.current;
|
|
221
283
|
return ()=>{
|
|
222
284
|
isStopped = true;
|
|
223
285
|
subscription.unsubscribe();
|
|
286
|
+
updateSubscriptionState(getIdleResult());
|
|
224
287
|
};
|
|
225
288
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
226
289
|
}, [
|
|
227
290
|
queryKey,
|
|
228
291
|
enabled
|
|
229
292
|
]);
|
|
293
|
+
return subscriptionState;
|
|
230
294
|
}
|
|
231
295
|
function useInfiniteQuery$1(path, input, opts) {
|
|
232
296
|
const { client , ssrState , prefetchInfiniteQuery , queryClient , abortOnUnmount , } = useContext();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefinedUseQueryResult, DehydratedState, InfiniteData, InfiniteQueryObserverSuccessResult, InitialDataFunction, QueryObserverSuccessResult, QueryOptions, UseBaseQueryOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { CreateTRPCClientOptions, TRPCRequestOptions, TRPCUntypedClient } from '@trpc/client';
|
|
2
|
+
import type { ConnectionState, CreateTRPCClientOptions, TRPCConnectionStateMessage, TRPCRequestOptions, TRPCUntypedClient } from '@trpc/client';
|
|
3
3
|
import type { AnyRouter, DistributiveOmit } from '@trpc/server/unstable-core-do-not-import';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
import type { TRPCContextProps } from '../../internals/context';
|
|
@@ -49,9 +49,178 @@ export interface UseTRPCMutationOptions<TInput, TError, TOutput, TContext = unkn
|
|
|
49
49
|
export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
50
50
|
enabled?: boolean;
|
|
51
51
|
onStarted?: () => void;
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated use onStateChange instead
|
|
54
|
+
*/
|
|
53
55
|
onError?: (err: TError) => void;
|
|
56
|
+
onData: (data: TOutput) => void;
|
|
57
|
+
onStateChange?: (state: TRPCConnectionStateMessage<TError>) => void;
|
|
58
|
+
}
|
|
59
|
+
export interface restartSubscriptionOptionsBase {
|
|
60
|
+
/**
|
|
61
|
+
* Cancel the current subscription and re-establish a new one
|
|
62
|
+
* - Defaults to `true`
|
|
63
|
+
* - Set to `false` no new subscription will be established if there is already an active subscription
|
|
64
|
+
*/
|
|
65
|
+
cancelSubscription?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface restartSubscriptionOptionsWithLastEventId extends restartSubscriptionOptionsBase {
|
|
68
|
+
/**
|
|
69
|
+
* Defaults to `true` in case of failure or if the subscription is still active
|
|
70
|
+
* - When the susbscription has successfully completed, it will be set to `false`
|
|
71
|
+
*/
|
|
72
|
+
sendLastEventId?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export type restartSubscriptionOptions<TInput> = TInput extends {
|
|
75
|
+
lastEventId?: string | null;
|
|
76
|
+
} | void ? restartSubscriptionOptionsWithLastEventId : restartSubscriptionOptionsBase;
|
|
77
|
+
export type restartSubscriptionFn<TInput> = (options?: restartSubscriptionOptions<TInput>) => void;
|
|
78
|
+
export interface TRPCSubscriptionBaseResult<_TInput, TOutput, TError> {
|
|
79
|
+
/**
|
|
80
|
+
* The last data received from the subscription
|
|
81
|
+
*/
|
|
82
|
+
data: TOutput | null;
|
|
83
|
+
/**
|
|
84
|
+
* The timestamp for when the connection was last (re-)established
|
|
85
|
+
*/
|
|
86
|
+
connectionStartedAt: number;
|
|
87
|
+
/**
|
|
88
|
+
* The timestamp for when the connection was initially established
|
|
89
|
+
*/
|
|
90
|
+
initialConnectionStartedAt: number;
|
|
91
|
+
/**
|
|
92
|
+
* The error that caused the subscription to stop
|
|
93
|
+
* - Defaults to `null`
|
|
94
|
+
* - Resets to `null` after the subscription is restarted and the connection is re-established
|
|
95
|
+
*/
|
|
96
|
+
error: TError | null;
|
|
97
|
+
/**
|
|
98
|
+
* The timestamp for when the last error was captured
|
|
99
|
+
*/
|
|
100
|
+
errorUpdatedAt: number;
|
|
101
|
+
/**
|
|
102
|
+
* The reason for the reconnection
|
|
103
|
+
* - Resets to `null` after the subscription is restarted and the connection is re-established
|
|
104
|
+
*/
|
|
105
|
+
connectionError: TError | null;
|
|
106
|
+
/**
|
|
107
|
+
* Reconnection attempts since last successful connection
|
|
108
|
+
*/
|
|
109
|
+
connectionAttemptCount: number;
|
|
110
|
+
/**
|
|
111
|
+
* The timestamp for when the last reconnection error was captured
|
|
112
|
+
*/
|
|
113
|
+
connectionErrorUpdatedAt: number;
|
|
114
|
+
/**
|
|
115
|
+
* Is `true` when the subscription is establishing the initial connection
|
|
116
|
+
*/
|
|
117
|
+
isStarting: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Is `true` when the subscription has successfully connected at least once
|
|
120
|
+
*/
|
|
121
|
+
isStarted: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Is `true` if the subscription is (re-)establishing a connection
|
|
124
|
+
* - Alias for `status === 'connecting'`
|
|
125
|
+
*/
|
|
126
|
+
isConnecting: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Is `true` when the subscription is connected and listening for data
|
|
129
|
+
* - Alias for `status === 'pending'`
|
|
130
|
+
*/
|
|
131
|
+
isPending: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Is `true` if the subscription is re-establishing a connection
|
|
134
|
+
* - Alias for `status === 'connecting' && isStarted === true`
|
|
135
|
+
*/
|
|
136
|
+
isReconnecting: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Is `true` if the subscription ended in an error state
|
|
139
|
+
* - Alias for `status === 'error'`
|
|
140
|
+
*/
|
|
141
|
+
isError: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* The current state of the subscription
|
|
144
|
+
* - Will be:
|
|
145
|
+
* - `'idle'` when the subscription is not enabled
|
|
146
|
+
* - `'connecting'` when the subscription is (re-)establishing the connection
|
|
147
|
+
* - `'pending'` when the subscription is connected and receiving data
|
|
148
|
+
* - `'error'` when the subscription has stopped due to an error
|
|
149
|
+
*/
|
|
150
|
+
status: ConnectionState;
|
|
151
|
+
}
|
|
152
|
+
export interface TRPCSubscriptionIdleResult<TInput, TOutput, TError> extends TRPCSubscriptionBaseResult<TInput, TOutput, TError> {
|
|
153
|
+
data: null;
|
|
154
|
+
error: null;
|
|
155
|
+
errorUpdatedAt: 0;
|
|
156
|
+
connectionError: null;
|
|
157
|
+
isStarting: false;
|
|
158
|
+
isStarted: false;
|
|
159
|
+
isConnecting: false;
|
|
160
|
+
isPending: false;
|
|
161
|
+
isReconnecting: false;
|
|
162
|
+
isError: false;
|
|
163
|
+
connectionAttemptCount: 0;
|
|
164
|
+
connectionErrorUpdatedAt: 0;
|
|
165
|
+
connectionStartedAt: 0;
|
|
166
|
+
initialConnectionStartedAt: 0;
|
|
167
|
+
status: 'idle';
|
|
168
|
+
}
|
|
169
|
+
export declare const getIdleResult: <TInput, TOutput, TError>() => TRPCSubscriptionIdleResult<TInput, TOutput, TError>;
|
|
170
|
+
export interface TRPCSubscriptionStartingResult<TInput, TOutput, TError> extends TRPCSubscriptionBaseResult<TInput, TOutput, TError> {
|
|
171
|
+
connectionStartedAt: 0;
|
|
172
|
+
initialConnectionStartedAt: 0;
|
|
173
|
+
error: null;
|
|
174
|
+
data: null;
|
|
175
|
+
connectionError: TError | null;
|
|
176
|
+
isStarting: true;
|
|
177
|
+
isStarted: false;
|
|
178
|
+
isConnecting: true;
|
|
179
|
+
isPending: false;
|
|
180
|
+
isReconnecting: false;
|
|
181
|
+
isError: false;
|
|
182
|
+
status: 'connecting';
|
|
183
|
+
}
|
|
184
|
+
export declare const getStartingResult: <TInput, TOutput, TError>(previous?: TRPCSubscriptionIdleResult<TInput, TOutput, TError> | TRPCSubscriptionErrorResult<TInput, TOutput, TError> | TRPCSubscriptionStartingResult<TInput, TOutput, TError>, error?: TError | null) => TRPCSubscriptionStartingResult<TInput, TOutput, TError>;
|
|
185
|
+
export interface TRPCSubscriptionPendingResult<TInput, TOutput, TError> extends TRPCSubscriptionBaseResult<TInput, TOutput, TError> {
|
|
186
|
+
error: null;
|
|
187
|
+
connectionError: null;
|
|
188
|
+
connectionAttemptCount: 0;
|
|
189
|
+
isStarting: false;
|
|
190
|
+
isStarted: true;
|
|
191
|
+
isConnecting: false;
|
|
192
|
+
isPending: true;
|
|
193
|
+
isReconnecting: false;
|
|
194
|
+
isError: false;
|
|
195
|
+
status: 'pending';
|
|
196
|
+
}
|
|
197
|
+
export declare const getPendingResult: <TInput, TOutput, TError>(previous: UseTRPCSubscriptionResult<TInput, TOutput, TError>, data?: TOutput) => TRPCSubscriptionPendingResult<TInput, TOutput, TError>;
|
|
198
|
+
export interface TRPCSubscriptionReconnectingResult<TInput, TOutput, TError> extends TRPCSubscriptionBaseResult<TInput, TOutput, TError> {
|
|
199
|
+
error: null;
|
|
200
|
+
connectionError: TError;
|
|
201
|
+
isStarting: false;
|
|
202
|
+
isStarted: true;
|
|
203
|
+
isConnecting: true;
|
|
204
|
+
isPending: false;
|
|
205
|
+
isReconnecting: true;
|
|
206
|
+
isError: false;
|
|
207
|
+
status: 'connecting';
|
|
208
|
+
}
|
|
209
|
+
export declare const getReconnectingResult: <TInput, TOutput, TError>(previous: TRPCSubscriptionPendingResult<TInput, TOutput, TError> | TRPCSubscriptionReconnectingResult<TInput, TOutput, TError>, error: TError) => TRPCSubscriptionReconnectingResult<TInput, TOutput, TError>;
|
|
210
|
+
export declare const getConnectingResult: <TInput, TOutput, TError>(previous: UseTRPCSubscriptionResult<TInput, TOutput, TError>, error: TError | null) => TRPCSubscriptionConnectingResult<TInput, TOutput, TError>;
|
|
211
|
+
export interface TRPCSubscriptionErrorResult<TInput, TOutput, TError> extends TRPCSubscriptionBaseResult<TInput, TOutput, TError> {
|
|
212
|
+
error: TError;
|
|
213
|
+
isStarting: false;
|
|
214
|
+
isStarted: true;
|
|
215
|
+
isConnecting: false;
|
|
216
|
+
isPending: false;
|
|
217
|
+
isReconnecting: false;
|
|
218
|
+
isError: true;
|
|
219
|
+
status: 'error';
|
|
54
220
|
}
|
|
221
|
+
export declare const getErrorResult: <TInput, TOutput, TError>(previous: UseTRPCSubscriptionResult<TInput, TOutput, TError>, error: TError) => TRPCSubscriptionErrorResult<TInput, TOutput, TError>;
|
|
222
|
+
export type TRPCSubscriptionConnectingResult<TInput, TOutput, TError> = TRPCSubscriptionStartingResult<TInput, TOutput, TError> | TRPCSubscriptionReconnectingResult<TInput, TOutput, TError>;
|
|
223
|
+
export type UseTRPCSubscriptionResult<TInput, TOutput, TError> = TRPCSubscriptionIdleResult<TInput, TOutput, TError> | TRPCSubscriptionPendingResult<TInput, TOutput, TError> | TRPCSubscriptionConnectingResult<TInput, TOutput, TError> | TRPCSubscriptionErrorResult<TInput, TOutput, TError>;
|
|
55
224
|
export interface TRPCProviderProps<TRouter extends AnyRouter, TSSRContext> extends TRPCContextProps<TRouter, TSSRContext> {
|
|
56
225
|
children: ReactNode;
|
|
57
226
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,+BAA+B,EAC/B,8BAA8B,EAC9B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,IAAI;IACnD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,WAAW,uBAEf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC1C;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC;AAED,MAA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AiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,MAAM,CACP,GACC,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI;IACtE,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClE,8BAA8B,CAC5B,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,MAAM,CACP,GACC,cAAc;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,IACnE,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const defaultIdleResult = {
|
|
4
|
+
data: null,
|
|
5
|
+
connectionStartedAt: 0,
|
|
6
|
+
initialConnectionStartedAt: 0,
|
|
7
|
+
error: null,
|
|
8
|
+
errorUpdatedAt: 0,
|
|
9
|
+
connectionError: null,
|
|
10
|
+
connectionAttemptCount: 0,
|
|
11
|
+
isStarting: false,
|
|
12
|
+
isStarted: false,
|
|
13
|
+
isConnecting: false,
|
|
14
|
+
isPending: false,
|
|
15
|
+
isReconnecting: false,
|
|
16
|
+
isError: false,
|
|
17
|
+
connectionErrorUpdatedAt: 0,
|
|
18
|
+
status: 'idle'
|
|
19
|
+
};
|
|
20
|
+
const getIdleResult = ()=>{
|
|
21
|
+
return {
|
|
22
|
+
...defaultIdleResult,
|
|
23
|
+
data: null
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getStartingResult = (// restart: restartSubscriptionFn<TInput>,
|
|
27
|
+
previous, error)=>{
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
if (previous) {
|
|
30
|
+
return {
|
|
31
|
+
...defaultIdleResult,
|
|
32
|
+
...previous,
|
|
33
|
+
data: null,
|
|
34
|
+
connectionError: error ?? null,
|
|
35
|
+
isStarting: true,
|
|
36
|
+
isConnecting: true,
|
|
37
|
+
errorUpdatedAt: 0,
|
|
38
|
+
connectionAttemptCount: previous.connectionAttemptCount + 1,
|
|
39
|
+
connectionErrorUpdatedAt: error ? now : 0,
|
|
40
|
+
connectionStartedAt: 0,
|
|
41
|
+
initialConnectionStartedAt: 0,
|
|
42
|
+
error: null,
|
|
43
|
+
isStarted: false,
|
|
44
|
+
isError: false,
|
|
45
|
+
status: 'connecting'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...getIdleResult(),
|
|
50
|
+
connectionError: error ?? null,
|
|
51
|
+
isStarting: true,
|
|
52
|
+
isConnecting: true,
|
|
53
|
+
errorUpdatedAt: 0,
|
|
54
|
+
connectionAttemptCount: 0,
|
|
55
|
+
connectionErrorUpdatedAt: error ? now : 0,
|
|
56
|
+
status: 'connecting'
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const getPendingResult = (previous, data)=>{
|
|
60
|
+
const time = Date.now();
|
|
61
|
+
if (previous.isStarting) {
|
|
62
|
+
return {
|
|
63
|
+
...previous,
|
|
64
|
+
error: null,
|
|
65
|
+
isStarting: false,
|
|
66
|
+
isStarted: true,
|
|
67
|
+
isConnecting: false,
|
|
68
|
+
isReconnecting: false,
|
|
69
|
+
isPending: true,
|
|
70
|
+
status: 'pending',
|
|
71
|
+
connectionStartedAt: time,
|
|
72
|
+
connectionAttemptCount: 0,
|
|
73
|
+
connectionError: null,
|
|
74
|
+
initialConnectionStartedAt: time
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
...previous,
|
|
79
|
+
data: data ?? previous.data,
|
|
80
|
+
error: null,
|
|
81
|
+
isError: false,
|
|
82
|
+
isStarting: false,
|
|
83
|
+
isStarted: true,
|
|
84
|
+
isConnecting: false,
|
|
85
|
+
isReconnecting: false,
|
|
86
|
+
isPending: true,
|
|
87
|
+
status: 'pending',
|
|
88
|
+
connectionStartedAt: time,
|
|
89
|
+
connectionAttemptCount: 0,
|
|
90
|
+
connectionError: null
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const getReconnectingResult = (previous, error)=>{
|
|
94
|
+
return {
|
|
95
|
+
...previous,
|
|
96
|
+
isStarting: false,
|
|
97
|
+
isStarted: true,
|
|
98
|
+
isConnecting: true,
|
|
99
|
+
isReconnecting: true,
|
|
100
|
+
isPending: false,
|
|
101
|
+
status: 'connecting',
|
|
102
|
+
connectionError: error,
|
|
103
|
+
connectionAttemptCount: previous.connectionAttemptCount + 1
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const getConnectingResult = (previous, error)=>{
|
|
107
|
+
if (previous.isReconnecting || previous.isPending) {
|
|
108
|
+
if (!error) throw new Error('Reconnecting without error?');
|
|
109
|
+
return getReconnectingResult(previous, error);
|
|
110
|
+
}
|
|
111
|
+
return getStartingResult(/*previous.restart, */ previous, error);
|
|
112
|
+
};
|
|
113
|
+
const getErrorResult = (previous, error)=>{
|
|
114
|
+
return {
|
|
115
|
+
...previous,
|
|
116
|
+
isStarting: false,
|
|
117
|
+
isStarted: true,
|
|
118
|
+
isConnecting: false,
|
|
119
|
+
isReconnecting: false,
|
|
120
|
+
isPending: false,
|
|
121
|
+
isError: true,
|
|
122
|
+
status: 'error',
|
|
123
|
+
error,
|
|
124
|
+
errorUpdatedAt: Date.now()
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
exports.getConnectingResult = getConnectingResult;
|
|
129
|
+
exports.getErrorResult = getErrorResult;
|
|
130
|
+
exports.getIdleResult = getIdleResult;
|
|
131
|
+
exports.getPendingResult = getPendingResult;
|
|
132
|
+
exports.getReconnectingResult = getReconnectingResult;
|
|
133
|
+
exports.getStartingResult = getStartingResult;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const defaultIdleResult = {
|
|
2
|
+
data: null,
|
|
3
|
+
connectionStartedAt: 0,
|
|
4
|
+
initialConnectionStartedAt: 0,
|
|
5
|
+
error: null,
|
|
6
|
+
errorUpdatedAt: 0,
|
|
7
|
+
connectionError: null,
|
|
8
|
+
connectionAttemptCount: 0,
|
|
9
|
+
isStarting: false,
|
|
10
|
+
isStarted: false,
|
|
11
|
+
isConnecting: false,
|
|
12
|
+
isPending: false,
|
|
13
|
+
isReconnecting: false,
|
|
14
|
+
isError: false,
|
|
15
|
+
connectionErrorUpdatedAt: 0,
|
|
16
|
+
status: 'idle'
|
|
17
|
+
};
|
|
18
|
+
const getIdleResult = ()=>{
|
|
19
|
+
return {
|
|
20
|
+
...defaultIdleResult,
|
|
21
|
+
data: null
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const getStartingResult = (// restart: restartSubscriptionFn<TInput>,
|
|
25
|
+
previous, error)=>{
|
|
26
|
+
const now = Date.now();
|
|
27
|
+
if (previous) {
|
|
28
|
+
return {
|
|
29
|
+
...defaultIdleResult,
|
|
30
|
+
...previous,
|
|
31
|
+
data: null,
|
|
32
|
+
connectionError: error ?? null,
|
|
33
|
+
isStarting: true,
|
|
34
|
+
isConnecting: true,
|
|
35
|
+
errorUpdatedAt: 0,
|
|
36
|
+
connectionAttemptCount: previous.connectionAttemptCount + 1,
|
|
37
|
+
connectionErrorUpdatedAt: error ? now : 0,
|
|
38
|
+
connectionStartedAt: 0,
|
|
39
|
+
initialConnectionStartedAt: 0,
|
|
40
|
+
error: null,
|
|
41
|
+
isStarted: false,
|
|
42
|
+
isError: false,
|
|
43
|
+
status: 'connecting'
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...getIdleResult(),
|
|
48
|
+
connectionError: error ?? null,
|
|
49
|
+
isStarting: true,
|
|
50
|
+
isConnecting: true,
|
|
51
|
+
errorUpdatedAt: 0,
|
|
52
|
+
connectionAttemptCount: 0,
|
|
53
|
+
connectionErrorUpdatedAt: error ? now : 0,
|
|
54
|
+
status: 'connecting'
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const getPendingResult = (previous, data)=>{
|
|
58
|
+
const time = Date.now();
|
|
59
|
+
if (previous.isStarting) {
|
|
60
|
+
return {
|
|
61
|
+
...previous,
|
|
62
|
+
error: null,
|
|
63
|
+
isStarting: false,
|
|
64
|
+
isStarted: true,
|
|
65
|
+
isConnecting: false,
|
|
66
|
+
isReconnecting: false,
|
|
67
|
+
isPending: true,
|
|
68
|
+
status: 'pending',
|
|
69
|
+
connectionStartedAt: time,
|
|
70
|
+
connectionAttemptCount: 0,
|
|
71
|
+
connectionError: null,
|
|
72
|
+
initialConnectionStartedAt: time
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
...previous,
|
|
77
|
+
data: data ?? previous.data,
|
|
78
|
+
error: null,
|
|
79
|
+
isError: false,
|
|
80
|
+
isStarting: false,
|
|
81
|
+
isStarted: true,
|
|
82
|
+
isConnecting: false,
|
|
83
|
+
isReconnecting: false,
|
|
84
|
+
isPending: true,
|
|
85
|
+
status: 'pending',
|
|
86
|
+
connectionStartedAt: time,
|
|
87
|
+
connectionAttemptCount: 0,
|
|
88
|
+
connectionError: null
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
const getReconnectingResult = (previous, error)=>{
|
|
92
|
+
return {
|
|
93
|
+
...previous,
|
|
94
|
+
isStarting: false,
|
|
95
|
+
isStarted: true,
|
|
96
|
+
isConnecting: true,
|
|
97
|
+
isReconnecting: true,
|
|
98
|
+
isPending: false,
|
|
99
|
+
status: 'connecting',
|
|
100
|
+
connectionError: error,
|
|
101
|
+
connectionAttemptCount: previous.connectionAttemptCount + 1
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const getConnectingResult = (previous, error)=>{
|
|
105
|
+
if (previous.isReconnecting || previous.isPending) {
|
|
106
|
+
if (!error) throw new Error('Reconnecting without error?');
|
|
107
|
+
return getReconnectingResult(previous, error);
|
|
108
|
+
}
|
|
109
|
+
return getStartingResult(/*previous.restart, */ previous, error);
|
|
110
|
+
};
|
|
111
|
+
const getErrorResult = (previous, error)=>{
|
|
112
|
+
return {
|
|
113
|
+
...previous,
|
|
114
|
+
isStarting: false,
|
|
115
|
+
isStarted: true,
|
|
116
|
+
isConnecting: false,
|
|
117
|
+
isReconnecting: false,
|
|
118
|
+
isPending: false,
|
|
119
|
+
isError: true,
|
|
120
|
+
status: 'error',
|
|
121
|
+
error,
|
|
122
|
+
errorUpdatedAt: Date.now()
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { getConnectingResult, getErrorResult, getIdleResult, getPendingResult, getReconnectingResult, getStartingResult };
|
package/dist/shared/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var utilsProxy = require('./proxy/utilsProxy.js');
|
|
|
5
5
|
var useQueriesProxy = require('./proxy/useQueriesProxy.js');
|
|
6
6
|
var createHooksInternal = require('./hooks/createHooksInternal.js');
|
|
7
7
|
var queryClient = require('./queryClient.js');
|
|
8
|
+
var types = require('./hooks/types.js');
|
|
8
9
|
var getClientArgs = require('../internals/getClientArgs.js');
|
|
9
10
|
var context = require('../internals/context.js');
|
|
10
11
|
|
|
@@ -17,6 +18,12 @@ exports.getQueryType = utilsProxy.getQueryType;
|
|
|
17
18
|
exports.createUseQueries = useQueriesProxy.createUseQueries;
|
|
18
19
|
exports.createRootHooks = createHooksInternal.createRootHooks;
|
|
19
20
|
exports.getQueryClient = queryClient.getQueryClient;
|
|
21
|
+
exports.getConnectingResult = types.getConnectingResult;
|
|
22
|
+
exports.getErrorResult = types.getErrorResult;
|
|
23
|
+
exports.getIdleResult = types.getIdleResult;
|
|
24
|
+
exports.getPendingResult = types.getPendingResult;
|
|
25
|
+
exports.getReconnectingResult = types.getReconnectingResult;
|
|
26
|
+
exports.getStartingResult = types.getStartingResult;
|
|
20
27
|
exports.getClientArgs = getClientArgs.getClientArgs;
|
|
21
28
|
exports.TRPCContext = context.TRPCContext;
|
|
22
29
|
exports.contextProps = context.contextProps;
|
package/dist/shared/index.mjs
CHANGED
|
@@ -3,5 +3,6 @@ export { createQueryUtilsProxy, createReactQueryUtils, getQueryType } from './pr
|
|
|
3
3
|
export { createUseQueries } from './proxy/useQueriesProxy.mjs';
|
|
4
4
|
export { createRootHooks } from './hooks/createHooksInternal.mjs';
|
|
5
5
|
export { getQueryClient } from './queryClient.mjs';
|
|
6
|
+
export { getConnectingResult, getErrorResult, getIdleResult, getPendingResult, getReconnectingResult, getStartingResult } from './hooks/types.mjs';
|
|
6
7
|
export { getClientArgs } from '../internals/getClientArgs.mjs';
|
|
7
8
|
export { TRPCContext, contextProps } from '../internals/context.mjs';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { CancelOptions, InfiniteData, InvalidateOptions, InvalidateQueryFilters, Query, QueryFilters, QueryKey, RefetchOptions, RefetchQueryFilters, ResetOptions, SetDataOptions, Updater } from '@tanstack/react-query';
|
|
2
2
|
import type { TRPCClientError } from '@trpc/client';
|
|
3
|
-
import type { AnyQueryProcedure, AnyRootTypes, AnyRouter, DeepPartial, inferProcedureInput, inferTransformedProcedureOutput, ProtectedIntersection, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
import type { AnyMutationProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, DeepPartial, inferProcedureInput, inferTransformedProcedureOutput, ProtectedIntersection, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
|
|
4
4
|
import type { DecoratedTRPCContextProps, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions, TRPCQueryUtils } from '../../internals/context';
|
|
5
5
|
import type { QueryKeyKnown, QueryType } from '../../internals/getQueryKey';
|
|
6
|
+
import type { InferMutationOptions } from '../../utils/inferReactQueryProcedure';
|
|
6
7
|
import type { ExtractCursorType } from '../hooks/types';
|
|
7
|
-
type
|
|
8
|
+
type DecorateQueryProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQueryProcedure> = {
|
|
8
9
|
/**
|
|
9
10
|
* @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery
|
|
10
11
|
*/
|
|
@@ -74,6 +75,13 @@ type DecorateProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQueryPr
|
|
|
74
75
|
*/
|
|
75
76
|
getInfiniteData(input?: inferProcedureInput<TProcedure>): InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null> | undefined;
|
|
76
77
|
};
|
|
78
|
+
type DecorateMutationProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyMutationProcedure> = {
|
|
79
|
+
setMutationDefaults(options: InferMutationOptions<TRoot, TProcedure> | ((args: {
|
|
80
|
+
canonicalMutationFn: NonNullable<InferMutationOptions<TRoot, TProcedure>['mutationFn']>;
|
|
81
|
+
}) => InferMutationOptions<TRoot, TProcedure>)): void;
|
|
82
|
+
getMutationDefaults(): InferMutationOptions<TRoot, TProcedure> | undefined;
|
|
83
|
+
isMutating(): number;
|
|
84
|
+
};
|
|
77
85
|
/**
|
|
78
86
|
* this is the type that is used to add in procedures that can be used on
|
|
79
87
|
* an entire router
|
|
@@ -90,9 +98,9 @@ type DecorateRouter = {
|
|
|
90
98
|
* @internal
|
|
91
99
|
*/
|
|
92
100
|
export type DecoratedProcedureUtilsRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = DecorateRouter & {
|
|
93
|
-
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateRouter : $Value extends AnyQueryProcedure ?
|
|
101
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateRouter : $Value extends AnyQueryProcedure ? DecorateQueryProcedure<TRoot, $Value> : $Value extends AnyMutationProcedure ? DecorateMutationProcedure<TRoot, $Value> : never : never;
|
|
94
102
|
};
|
|
95
|
-
type AnyDecoratedProcedure =
|
|
103
|
+
type AnyDecoratedProcedure = DecorateQueryProcedure<any, any> & DecorateMutationProcedure<any, any>;
|
|
96
104
|
export type CreateReactUtils<TRouter extends AnyRouter, TSSRContext> = ProtectedIntersection<DecoratedTRPCContextProps<TRouter, TSSRContext>, DecoratedProcedureUtilsRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
|
|
97
105
|
export type CreateQueryUtils<TRouter extends AnyRouter> = DecoratedProcedureUtilsRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
|
|
98
106
|
export declare const getQueryType: (utilName: keyof AnyDecoratedProcedure) => QueryType;
|