@trpc/react-query 11.0.0-alpha-tmp-issues-5851-take-two.499 → 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.
Files changed (39) hide show
  1. package/dist/bundle-analysis.json +76 -54
  2. package/dist/createTRPCReact.d.ts +3 -3
  3. package/dist/createTRPCReact.d.ts.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.mjs +1 -1
  8. package/dist/internals/context.d.ts +18 -2
  9. package/dist/internals/context.d.ts.map +1 -1
  10. package/dist/internals/getQueryKey.d.ts +8 -0
  11. package/dist/internals/getQueryKey.d.ts.map +1 -1
  12. package/dist/internals/getQueryKey.js +15 -0
  13. package/dist/internals/getQueryKey.mjs +14 -1
  14. package/dist/shared/hooks/createHooksInternal.d.ts +2 -2
  15. package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
  16. package/dist/shared/hooks/createHooksInternal.js +67 -3
  17. package/dist/shared/hooks/createHooksInternal.mjs +68 -4
  18. package/dist/shared/hooks/types.d.ts +171 -2
  19. package/dist/shared/hooks/types.d.ts.map +1 -1
  20. package/dist/shared/hooks/types.js +133 -0
  21. package/dist/shared/hooks/types.mjs +126 -0
  22. package/dist/shared/index.js +7 -0
  23. package/dist/shared/index.mjs +1 -0
  24. package/dist/shared/proxy/utilsProxy.d.ts +12 -4
  25. package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
  26. package/dist/shared/proxy/utilsProxy.js +14 -2
  27. package/dist/shared/proxy/utilsProxy.mjs +15 -3
  28. package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
  29. package/dist/utils/createUtilityFunctions.js +23 -0
  30. package/dist/utils/createUtilityFunctions.mjs +23 -0
  31. package/package.json +6 -6
  32. package/src/createTRPCReact.tsx +11 -2
  33. package/src/index.ts +1 -1
  34. package/src/internals/context.tsx +26 -1
  35. package/src/internals/getQueryKey.ts +21 -0
  36. package/src/shared/hooks/createHooksInternal.tsx +146 -18
  37. package/src/shared/hooks/types.ts +365 -1
  38. package/src/shared/proxy/utilsProxy.ts +47 -6
  39. package/src/utils/createUtilityFunctions.ts +26 -0
@@ -10,6 +10,7 @@ var getQueryKey = require('../../internals/getQueryKey.js');
10
10
  var useHookResult = require('../../internals/useHookResult.js');
11
11
  var createUtilityFunctions = require('../../utils/createUtilityFunctions.js');
12
12
  var useQueriesProxy = require('../proxy/useQueriesProxy.js');
13
+ var types = require('./types.js');
13
14
 
14
15
  function _interopNamespaceDefault(e) {
15
16
  var n = Object.create(null);
@@ -30,6 +31,15 @@ function _interopNamespaceDefault(e) {
30
31
 
31
32
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
32
33
 
34
+ const trackResult = (result, onTrackResult)=>{
35
+ const trackedResult = new Proxy(result, {
36
+ get (target, prop) {
37
+ onTrackResult(prop);
38
+ return target[prop];
39
+ }
40
+ });
41
+ return trackedResult;
42
+ };
33
43
  /**
34
44
  * @internal
35
45
  */ function createRootHooks(config) {
@@ -182,9 +192,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
182
192
  function useMutation(path, opts) {
183
193
  const { client } = useContext();
184
194
  const queryClient = reactQuery.useQueryClient();
185
- const mutationKey = [
186
- path
187
- ];
195
+ const mutationKey = getQueryKey.getMutationKeyInternal(path);
188
196
  const defaultOpts = queryClient.defaultMutationOptions(queryClient.getMutationDefaults(mutationKey));
189
197
  const hook = reactQuery.useMutation({
190
198
  ...opts,
@@ -214,6 +222,33 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
214
222
  /* istanbul ignore next -- @preserve */ function useSubscription(path, input, opts) {
215
223
  const enabled = opts?.enabled ?? input !== reactQuery.skipToken;
216
224
  const queryKey = reactQuery.hashKey(getQueryKey.getQueryKeyInternal(path, input, 'any'));
225
+ const trackedProps = React__namespace.useRef(new Set([]));
226
+ const addTrackedProp = React__namespace.useCallback((key)=>{
227
+ trackedProps.current.add(key);
228
+ }, []);
229
+ // const restart = React.useRef<restartSubscriptionFn<unknown>>(() => {
230
+ // throw new Error('not implemented');
231
+ // });
232
+ const currentResult = React__namespace.useRef(enabled ? types.getStartingResult() : types.getIdleResult());
233
+ const [subscriptionState, setSubscriptionState] = React__namespace.useState(trackResult(currentResult.current, addTrackedProp));
234
+ const updateSubscriptionState = React__namespace.useCallback((opts)=>{
235
+ const oldResult = currentResult.current;
236
+ const newResult = typeof opts === 'function' ? opts(currentResult.current) : opts;
237
+ currentResult.current = newResult;
238
+ let shouldUpdate = false;
239
+ for (const key of trackedProps.current){
240
+ if (oldResult[key] !== newResult[key]) {
241
+ shouldUpdate = true;
242
+ break;
243
+ }
244
+ }
245
+ if (shouldUpdate) {
246
+ setSubscriptionState(trackResult(newResult, addTrackedProp));
247
+ return;
248
+ }
249
+ }, [
250
+ addTrackedProp
251
+ ]);
217
252
  const { client } = useContext();
218
253
  const optsRef = React__namespace.useRef(opts);
219
254
  optsRef.current = opts;
@@ -231,23 +266,52 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
231
266
  onData: (data)=>{
232
267
  if (!isStopped) {
233
268
  optsRef.current.onData(data);
269
+ updateSubscriptionState((prev)=>{
270
+ if (prev.isPending) {
271
+ return types.getPendingResult(prev, data);
272
+ }
273
+ return prev;
274
+ });
234
275
  }
235
276
  },
236
277
  onError: (err)=>{
237
278
  if (!isStopped) {
238
279
  optsRef.current.onError?.(err);
239
280
  }
281
+ },
282
+ onStateChange: (state)=>{
283
+ if (state.state === 'idle') {
284
+ updateSubscriptionState(types.getIdleResult());
285
+ return;
286
+ }
287
+ if (state.state === 'connecting') {
288
+ updateSubscriptionState((prev)=>{
289
+ return types.getConnectingResult(prev, state.data ?? null);
290
+ });
291
+ return;
292
+ }
293
+ if (state.state === 'pending') {
294
+ updateSubscriptionState((prev)=>types.getPendingResult(prev));
295
+ }
296
+ if (state.state === 'error') {
297
+ updateSubscriptionState((prev)=>{
298
+ return types.getErrorResult(prev, state.data);
299
+ });
300
+ }
240
301
  }
241
302
  });
303
+ // const effectRestart = restart.current;
242
304
  return ()=>{
243
305
  isStopped = true;
244
306
  subscription.unsubscribe();
307
+ updateSubscriptionState(types.getIdleResult());
245
308
  };
246
309
  // eslint-disable-next-line react-hooks/exhaustive-deps
247
310
  }, [
248
311
  queryKey,
249
312
  enabled
250
313
  ]);
314
+ return subscriptionState;
251
315
  }
252
316
  function useInfiniteQuery(path, input, opts) {
253
317
  const { client , ssrState , prefetchInfiniteQuery , queryClient , abortOnUnmount , } = useContext();
@@ -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
- onData: (data: TOutput) => void;
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,EACj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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;