@trpc/client 11.0.0-alpha-tmp-subscription-connection-state.489 → 11.0.0-alpha-tmp-12-06-react.667
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/TRPCClientError.d.ts +1 -1
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/TRPCClientError.js +19 -1
- package/dist/TRPCClientError.mjs +19 -1
- package/dist/bundle-analysis.json +118 -92
- package/dist/createTRPCClient.d.ts +3 -2
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClient.js +1 -1
- package/dist/createTRPCClient.mjs +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/dist/internals/TRPCUntypedClient.d.ts +5 -4
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.js +42 -12
- package/dist/internals/TRPCUntypedClient.mjs +42 -12
- package/dist/internals/inputWithTrackedEventId.d.ts +2 -0
- package/dist/internals/inputWithTrackedEventId.d.ts.map +1 -0
- package/dist/internals/inputWithTrackedEventId.js +16 -0
- package/dist/internals/inputWithTrackedEventId.mjs +14 -0
- package/dist/internals/signals.d.ts +15 -0
- package/dist/internals/signals.d.ts.map +1 -0
- package/dist/internals/signals.js +47 -0
- package/dist/internals/signals.mjs +44 -0
- package/dist/internals/transformer.d.ts +2 -2
- package/dist/internals/types.d.ts +1 -1
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/links/HTTPBatchLinkOptions.d.ts +1 -1
- package/dist/links/httpBatchLink.d.ts.map +1 -1
- package/dist/links/httpBatchLink.js +4 -3
- package/dist/links/httpBatchLink.mjs +5 -4
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/httpBatchStreamLink.js +6 -4
- package/dist/links/httpBatchStreamLink.mjs +7 -5
- package/dist/links/httpLink.d.ts +2 -2
- package/dist/links/httpLink.js +3 -3
- package/dist/links/httpLink.mjs +3 -3
- package/dist/links/httpSubscriptionLink.d.ts +11 -6
- package/dist/links/httpSubscriptionLink.d.ts.map +1 -1
- package/dist/links/httpSubscriptionLink.js +130 -98
- package/dist/links/httpSubscriptionLink.mjs +132 -100
- package/dist/links/internals/contentTypes.d.ts +2 -2
- package/dist/links/internals/contentTypes.d.ts.map +1 -1
- package/dist/links/internals/httpUtils.d.ts +1 -8
- package/dist/links/internals/httpUtils.d.ts.map +1 -1
- package/dist/links/internals/httpUtils.js +1 -30
- package/dist/links/internals/httpUtils.mjs +2 -30
- package/dist/links/internals/subscriptions.d.ts +20 -0
- package/dist/links/internals/subscriptions.d.ts.map +1 -0
- package/dist/links/internals/urlWithConnectionParams.d.ts +2 -1
- package/dist/links/internals/urlWithConnectionParams.d.ts.map +1 -1
- package/dist/links/internals/urlWithConnectionParams.js +3 -2
- package/dist/links/internals/urlWithConnectionParams.mjs +3 -2
- package/dist/links/loggerLink.d.ts +5 -5
- package/dist/links/loggerLink.d.ts.map +1 -1
- package/dist/links/loggerLink.js +25 -21
- package/dist/links/loggerLink.mjs +25 -21
- package/dist/links/retryLink.d.ts +29 -0
- package/dist/links/retryLink.d.ts.map +1 -0
- package/dist/links/retryLink.js +65 -0
- package/dist/links/retryLink.mjs +63 -0
- package/dist/links/types.d.ts +4 -23
- package/dist/links/types.d.ts.map +1 -1
- package/dist/links/wsLink.d.ts +49 -5
- package/dist/links/wsLink.d.ts.map +1 -1
- package/dist/links/wsLink.js +210 -155
- package/dist/links/wsLink.mjs +211 -156
- package/dist/links.d.ts +1 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/unstable-internals.d.ts +1 -0
- package/dist/unstable-internals.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/TRPCClientError.ts +1 -1
- package/src/createTRPCClient.ts +28 -23
- package/src/internals/TRPCUntypedClient.ts +26 -15
- package/src/internals/inputWithTrackedEventId.ts +15 -0
- package/src/internals/signals.ts +54 -0
- package/src/internals/transformer.ts +2 -2
- package/src/internals/types.ts +1 -1
- package/src/links/HTTPBatchLinkOptions.ts +1 -1
- package/src/links/httpBatchLink.ts +3 -3
- package/src/links/httpBatchStreamLink.ts +7 -4
- package/src/links/httpLink.ts +2 -2
- package/src/links/httpSubscriptionLink.ts +172 -123
- package/src/links/internals/httpUtils.ts +1 -41
- package/src/links/internals/subscriptions.ts +26 -0
- package/src/links/internals/urlWithConnectionParams.ts +8 -2
- package/src/links/loggerLink.ts +21 -9
- package/src/links/retryLink.ts +101 -0
- package/src/links/types.ts +8 -46
- package/src/links/wsLink.ts +276 -173
- package/src/links.ts +1 -1
- package/src/unstable-internals.ts +1 -0
- package/dist/links/internals/retryLink.d.ts +0 -9
- package/dist/links/internals/retryLink.d.ts.map +0 -1
- package/dist/links/types.js +0 -7
- package/dist/links/types.mjs +0 -5
- package/src/links/internals/retryLink.ts +0 -53
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
-
import type { TRPCLink } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* @internal used for testing
|
|
5
|
-
*/
|
|
6
|
-
export declare function retryLink<TRouter extends AnyRouter = AnyRouter>(opts: {
|
|
7
|
-
attempts: number;
|
|
8
|
-
}): TRPCLink<TRouter>;
|
|
9
|
-
//# sourceMappingURL=retryLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retryLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/retryLink.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAAE,IAAI,EAAE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,QAAQ,CAAC,OAAO,CAAC,CAwCpB"}
|
package/dist/links/types.js
DELETED
package/dist/links/types.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* istanbul ignore file -- @preserve */
|
|
2
|
-
// We're not actually exporting this link
|
|
3
|
-
import type { Unsubscribable } from '@trpc/server/observable';
|
|
4
|
-
import { observable } from '@trpc/server/observable';
|
|
5
|
-
import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
6
|
-
import type { TRPCLink } from '../types';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @internal used for testing
|
|
10
|
-
*/
|
|
11
|
-
export function retryLink<TRouter extends AnyRouter = AnyRouter>(opts: {
|
|
12
|
-
attempts: number;
|
|
13
|
-
}): TRPCLink<TRouter> {
|
|
14
|
-
// initialized config
|
|
15
|
-
return () => {
|
|
16
|
-
// initialized in app
|
|
17
|
-
return ({ op, next }) => {
|
|
18
|
-
// initialized for request
|
|
19
|
-
return observable((observer) => {
|
|
20
|
-
let next$: Unsubscribable | null = null;
|
|
21
|
-
let attempts = 0;
|
|
22
|
-
let isDone = false;
|
|
23
|
-
function attempt() {
|
|
24
|
-
attempts++;
|
|
25
|
-
next$?.unsubscribe();
|
|
26
|
-
next$ = next(op).subscribe({
|
|
27
|
-
error(error) {
|
|
28
|
-
/* istanbul ignore if -- @preserve */
|
|
29
|
-
if (attempts >= opts.attempts) {
|
|
30
|
-
observer.error(error);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
attempt();
|
|
34
|
-
},
|
|
35
|
-
next(result) {
|
|
36
|
-
observer.next(result);
|
|
37
|
-
},
|
|
38
|
-
complete() {
|
|
39
|
-
if (isDone) {
|
|
40
|
-
observer.complete();
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
attempt();
|
|
46
|
-
return () => {
|
|
47
|
-
isDone = true;
|
|
48
|
-
next$?.unsubscribe();
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|