@trpc/client 11.33.0 → 11.34.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/dist/{httpBatchLink-_bkMj4mk.d.cts → httpBatchLink-50xXDyIp.d.cts} +3 -3
- package/dist/{httpBatchLink-DaVHWlLU.d.mts.map → httpBatchLink-50xXDyIp.d.cts.map} +1 -1
- package/dist/{httpBatchLink-DaVHWlLU.d.mts → httpBatchLink-D4shlyQy.d.mts} +3 -3
- package/dist/{httpBatchLink-_bkMj4mk.d.cts.map → httpBatchLink-D4shlyQy.d.mts.map} +1 -1
- package/dist/{httpLink-DN_Ana7a.d.mts → httpLink-Bb6hOyBN.d.mts} +3 -3
- package/dist/{httpLink-DN_Ana7a.d.mts.map → httpLink-Bb6hOyBN.d.mts.map} +1 -1
- package/dist/{httpUtils-BAs5frdP.d.mts → httpUtils-BbinScxw.d.mts} +2 -2
- package/dist/{httpUtils-1z6dzl3V.d.cts.map → httpUtils-BbinScxw.d.mts.map} +1 -1
- package/dist/{httpUtils-1z6dzl3V.d.cts → httpUtils-dB1XeokQ.d.cts} +2 -2
- package/dist/{httpUtils-BAs5frdP.d.mts.map → httpUtils-dB1XeokQ.d.cts.map} +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +34 -11
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +37 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/links/httpBatchLink.d.cts +1 -1
- package/dist/links/httpBatchLink.d.mts +1 -1
- package/dist/links/httpLink.d.cts +2 -2
- package/dist/links/httpLink.d.mts +1 -1
- package/dist/links/loggerLink.d.cts +1 -1
- package/dist/links/loggerLink.d.mts +1 -1
- package/dist/links/splitLink.cjs +1 -1
- package/dist/links/splitLink.d.cts +29 -8
- package/dist/links/splitLink.d.cts.map +1 -1
- package/dist/links/splitLink.d.mts +1 -1
- package/dist/links/splitLink.mjs +1 -1
- package/dist/links/wsLink/wsLink.d.cts +1 -1
- package/dist/links/wsLink/wsLink.d.mts +1 -1
- package/dist/{loggerLink-CiVinJOG.d.mts → loggerLink-y1x7WTWX.d.mts} +2 -2
- package/dist/{loggerLink-CiVinJOG.d.mts.map → loggerLink-y1x7WTWX.d.mts.map} +1 -1
- package/dist/splitLink-BGLTgm1a.d.mts +56 -0
- package/dist/splitLink-BGLTgm1a.d.mts.map +1 -0
- package/dist/{splitLink-IUbsOwO6.mjs → splitLink-C8U8vvLl.mjs} +10 -12
- package/dist/splitLink-C8U8vvLl.mjs.map +1 -0
- package/dist/{splitLink-BQoYcpdp.cjs → splitLink-NqS85b92.cjs} +9 -11
- package/dist/{types-DW0iJUBU.d.mts → types-BZH1P86I.d.mts} +3 -3
- package/dist/types-BZH1P86I.d.mts.map +1 -0
- package/dist/{types-DMe6B4SV.d.cts → types-CGS36fjk.d.cts} +3 -3
- package/dist/{types-DMe6B4SV.d.cts.map → types-CGS36fjk.d.cts.map} +1 -1
- package/dist/{wsLink-DX5fv7-H.d.mts → wsLink-CFh-pvQG.d.mts} +2 -2
- package/dist/{wsLink-DX5fv7-H.d.mts.map → wsLink-CFh-pvQG.d.mts.map} +1 -1
- package/dist/{wsLink-DuyXOEPt.d.cts → wsLink-CJT5pqFt.d.cts} +2 -2
- package/dist/{wsLink-DuyXOEPt.d.cts.map → wsLink-CJT5pqFt.d.cts.map} +1 -1
- package/package.json +3 -3
- package/skills/client-setup/SKILL.md +1 -1
- package/skills/links/SKILL.md +3 -3
- package/skills/links/references/client-links-retryLink.md +28 -0
- package/skills/links/references/client-links-splitLink.md +22 -6
- package/skills/superjson/SKILL.md +1 -1
- package/src/createTRPCClient.ts +5 -2
- package/src/links/retryLink.ts +41 -10
- package/src/links/splitLink.ts +85 -14
- package/src/links/types.ts +5 -2
- package/dist/splitLink-ClFN_nbg.d.mts +0 -35
- package/dist/splitLink-ClFN_nbg.d.mts.map +0 -1
- package/dist/splitLink-IUbsOwO6.mjs.map +0 -1
- package/dist/types-DW0iJUBU.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as NonEmptyArray, a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-
|
|
2
|
-
import { t as HTTPLinkBaseOptions } from "./httpUtils-
|
|
1
|
+
import { T as NonEmptyArray, a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-CGS36fjk.cjs";
|
|
2
|
+
import { t as HTTPLinkBaseOptions } from "./httpUtils-dB1XeokQ.cjs";
|
|
3
3
|
import { AnyClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
import { AnyRouter as AnyRouter$1 } from "@trpc/server";
|
|
5
5
|
/**
|
|
@@ -41,4 +41,4 @@ declare function httpBatchLink<TRouter extends AnyRouter$1>(opts: HTTPBatchLinkO
|
|
|
41
41
|
context: AugmentedOperationContext;
|
|
42
42
|
}>;
|
|
43
43
|
export { HTTPBatchLinkOptions as n, httpBatchLink as t };
|
|
44
|
-
//# sourceMappingURL=httpBatchLink-
|
|
44
|
+
//# sourceMappingURL=httpBatchLink-50xXDyIp.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink-
|
|
1
|
+
{"version":3,"file":"httpBatchLink-50xXDyIp.d.cts","names":["AnyRouter"],"sources":["../src/links/HTTPBatchLinkOptions.ts","../src/links/httpBatchLink.ts"],"mappings":";;;;;;;;KASY,qBAAqB,cAAc,kBAC7C,oBAAoB;;;;;;;;EAQlB;;;;;;EAMA,UACI,gBACE;IACA,QAAQ,cAAc;QAClB,cAAc,QAAQ;;;;;;;EAQhC;;;;;;;;iBCVY,cAAc,gBAAgBA,aAC5C,MAAM,qBAAqB,wCAC1B,SACD;EAEE,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as NonEmptyArray, a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-
|
|
2
|
-
import { t as HTTPLinkBaseOptions } from "./httpUtils-
|
|
1
|
+
import { S as NonEmptyArray, a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-BZH1P86I.mjs";
|
|
2
|
+
import { t as HTTPLinkBaseOptions } from "./httpUtils-BbinScxw.mjs";
|
|
3
3
|
import { AnyClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
import { AnyRouter as AnyRouter$1 } from "@trpc/server";
|
|
5
5
|
/**
|
|
@@ -41,4 +41,4 @@ declare function httpBatchLink<TRouter extends AnyRouter$1>(opts: HTTPBatchLinkO
|
|
|
41
41
|
context: AugmentedOperationContext;
|
|
42
42
|
}>;
|
|
43
43
|
export { HTTPBatchLinkOptions as n, httpBatchLink as t };
|
|
44
|
-
//# sourceMappingURL=httpBatchLink-
|
|
44
|
+
//# sourceMappingURL=httpBatchLink-D4shlyQy.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink-
|
|
1
|
+
{"version":3,"file":"httpBatchLink-D4shlyQy.d.mts","names":["AnyRouter"],"sources":["../src/links/HTTPBatchLinkOptions.ts","../src/links/httpBatchLink.ts"],"mappings":";;;;;;;;KASY,qBAAqB,cAAc,kBAC7C,oBAAoB;;;;;;;;EAQlB;;;;;;EAMA,UACI,gBACE;IACA,QAAQ,cAAc;QAClB,cAAc,QAAQ;;;;;;;EAQhC;;;;;;;;iBCVY,cAAc,gBAAgBA,aAC5C,MAAM,qBAAqB,wCAC1B,SACD;EAEE,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as HTTPLinkBaseOptions } from "./httpUtils-
|
|
2
|
-
import { a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-
|
|
1
|
+
import { t as HTTPLinkBaseOptions } from "./httpUtils-BbinScxw.mjs";
|
|
2
|
+
import { a as Operation, n as HTTPHeaders, p as TRPCLink, t as AugmentedOperationContext } from "./types-BZH1P86I.mjs";
|
|
3
3
|
import { AnyClientTypes, AnyRouter } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
/**
|
|
5
5
|
* The options of `httpLink`.
|
|
@@ -24,4 +24,4 @@ declare function httpLink<TRouter extends AnyRouter = AnyRouter>(opts: HTTPLinkO
|
|
|
24
24
|
context: AugmentedOperationContext;
|
|
25
25
|
}>;
|
|
26
26
|
export { httpLink as n, HTTPLinkOptions as t };
|
|
27
|
-
//# sourceMappingURL=httpLink-
|
|
27
|
+
//# sourceMappingURL=httpLink-Bb6hOyBN.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpLink-
|
|
1
|
+
{"version":3,"file":"httpLink-Bb6hOyBN.d.mts","names":[],"sources":["../src/links/httpLink.ts"],"mappings":";;;;;;;KAgCY,gBAAgB,cAAc,kBACxC,oBAAoB;;;;;;EAMlB,UACI,gBACE;IAAQ,IAAI;QAAgB,cAAc,QAAQ;;;;;;;iBA0C5C,SAAS,gBAAgB,YAAY,WACnD,MAAM,gBAAgB,wCACrB,SACD;EAEE,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as FetchEsque } from "./types-
|
|
1
|
+
import { b as FetchEsque } from "./types-BZH1P86I.mjs";
|
|
2
2
|
import { n as TransformerOptions } from "./unstable-internals-CnrO49lh.mjs";
|
|
3
3
|
import { AnyClientTypes, PathSeparator } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
/**
|
|
@@ -27,4 +27,4 @@ type HTTPLinkBaseOptions<TRoot extends Pick<AnyClientTypes, 'transformer'>> = {
|
|
|
27
27
|
pathSeparator?: PathSeparator;
|
|
28
28
|
} & TransformerOptions<TRoot>;
|
|
29
29
|
export { HTTPLinkBaseOptions as t };
|
|
30
|
-
//# sourceMappingURL=httpUtils-
|
|
30
|
+
//# sourceMappingURL=httpUtils-BbinScxw.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpUtils-
|
|
1
|
+
{"version":3,"file":"httpUtils-BbinScxw.d.mts","names":[],"sources":["../src/links/internals/httpUtils.ts"],"mappings":";;;;;;;KA4BY,oBACV,cAAc,KAAK;;EAGnB,cAAc;;;;EAId,QAAQ;;;;;;EAMR;;;;;;;EAOA,gBAAgB;IACd,mBAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as FetchEsque } from "./types-
|
|
1
|
+
import { C as FetchEsque } from "./types-CGS36fjk.cjs";
|
|
2
2
|
import { TransformerOptions } from "./unstable-internals.cjs";
|
|
3
3
|
import { AnyClientTypes, PathSeparator } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
/**
|
|
@@ -27,4 +27,4 @@ type HTTPLinkBaseOptions<TRoot extends Pick<AnyClientTypes, 'transformer'>> = {
|
|
|
27
27
|
pathSeparator?: PathSeparator;
|
|
28
28
|
} & TransformerOptions<TRoot>;
|
|
29
29
|
export { HTTPLinkBaseOptions as t };
|
|
30
|
-
//# sourceMappingURL=httpUtils-
|
|
30
|
+
//# sourceMappingURL=httpUtils-dB1XeokQ.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpUtils-
|
|
1
|
+
{"version":3,"file":"httpUtils-dB1XeokQ.d.cts","names":[],"sources":["../src/links/internals/httpUtils.ts"],"mappings":";;;;;;;KA4BY,oBACV,cAAc,KAAK;;EAGnB,cAAc;;;;EAId,QAAQ;;;;;;EAMR;;;;;;;EAOA,gBAAgB;IACd,mBAAmB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_splitLink = require("./splitLink-
|
|
2
|
+
const require_splitLink = require("./splitLink-NqS85b92.cjs");
|
|
3
3
|
const require_TRPCClientError = require("./TRPCClientError-irOPxS6c.cjs");
|
|
4
4
|
const require_objectSpread2 = require("./objectSpread2-Xm0br5eL.cjs");
|
|
5
5
|
const require_httpUtils = require("./httpUtils-coYP4VfN.cjs");
|
|
@@ -542,7 +542,7 @@ const unstable_httpSubscriptionLink = httpSubscriptionLink;
|
|
|
542
542
|
/* istanbul ignore file -- @preserve */
|
|
543
543
|
/**
|
|
544
544
|
* Retries failed operations. Subscriptions resume from the last tracked event
|
|
545
|
-
* id.
|
|
545
|
+
* id. A call can pass its own `retry` in `context`.
|
|
546
546
|
*
|
|
547
547
|
* @see https://trpc.io/docs/client/links/retryLink
|
|
548
548
|
*/
|
|
@@ -568,7 +568,8 @@ function retryLink(opts) {
|
|
|
568
568
|
const subscription = callOpts.next(op).subscribe({
|
|
569
569
|
error(error) {
|
|
570
570
|
var _opts$retryDelayMs, _opts$retryDelayMs2;
|
|
571
|
-
const
|
|
571
|
+
const callRetry = op.context["retry"];
|
|
572
|
+
const shouldRetry = (typeof callRetry === "function" ? callRetry : opts.retry)({
|
|
572
573
|
op,
|
|
573
574
|
attempts,
|
|
574
575
|
error
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.cjs";
|
|
2
|
-
import { C as FetchEsque, E as TRPCProcedureOptions, S as isTRPCClientError, _ as isNonJsonSerializable, a as Operation, b as TRPCClientErrorBase, c as OperationResultEnvelope, d as TRPCClientRuntime, f as TRPCFetch, g as isFormData, h as inferLinksDeclaredContext, i as NoLinkReadsContext, l as OperationResultObservable, m as inferLinksContext, n as HTTPHeaders, o as OperationContext, p as TRPCLink, r as LinkDecl, s as OperationLink, t as AugmentedOperationContext, u as OperationResultObserver, v as isOctetType, w as NativeFetchEsque, x as TRPCClientErrorLike, y as TRPCClientError } from "./types-
|
|
3
|
-
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-
|
|
2
|
+
import { C as FetchEsque, E as TRPCProcedureOptions, S as isTRPCClientError, _ as isNonJsonSerializable, a as Operation, b as TRPCClientErrorBase, c as OperationResultEnvelope, d as TRPCClientRuntime, f as TRPCFetch, g as isFormData, h as inferLinksDeclaredContext, i as NoLinkReadsContext, l as OperationResultObservable, m as inferLinksContext, n as HTTPHeaders, o as OperationContext, p as TRPCLink, r as LinkDecl, s as OperationLink, t as AugmentedOperationContext, u as OperationResultObserver, v as isOctetType, w as NativeFetchEsque, x as TRPCClientErrorLike, y as TRPCClientError } from "./types-CGS36fjk.cjs";
|
|
3
|
+
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-50xXDyIp.cjs";
|
|
4
4
|
import { HTTPLinkOptions, httpLink } from "./links/httpLink.cjs";
|
|
5
5
|
import { LoggerLinkOptions, loggerLink } from "./links/loggerLink.cjs";
|
|
6
6
|
import { splitLink } from "./links/splitLink.cjs";
|
|
7
|
-
import { a as WebSocketClientOptions, c as jsonEncoder, i as createWSClient, n as wsLink, o as UrlOptionsWithConnectionParams, r as TRPCWebSocketClient, s as Encoder, t as WebSocketLinkOptions } from "./wsLink-
|
|
7
|
+
import { a as WebSocketClientOptions, c as jsonEncoder, i as createWSClient, n as wsLink, o as UrlOptionsWithConnectionParams, r as TRPCWebSocketClient, s as Encoder, t as WebSocketLinkOptions } from "./wsLink-CJT5pqFt.cjs";
|
|
8
8
|
import { TransformerOptions } from "./unstable-internals.cjs";
|
|
9
|
-
import { t as HTTPLinkBaseOptions } from "./httpUtils-
|
|
9
|
+
import { t as HTTPLinkBaseOptions } from "./httpUtils-dB1XeokQ.cjs";
|
|
10
10
|
import { AnyClientTypes, AnyProcedure, AnyRouter, ErrorHandlerOptions, EventSourceLike, InferrableClientTypes, ProcedureType, RouterRecord, TypeError, inferAsyncIterableYield, inferClientTypes, inferProcedureErrorShape, inferProcedureInput, inferRouterContext, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
11
11
|
import { Unsubscribable } from "@trpc/server/observable";
|
|
12
12
|
import { AnyRouter as AnyRouter$1 } from "@trpc/server";
|
|
@@ -268,9 +268,12 @@ export type CreateTRPCClientWithRouterOptions<TRouter extends AnyRouter, TLinks
|
|
|
268
268
|
* ```ts
|
|
269
269
|
* const client = createTRPCClient({
|
|
270
270
|
* router: routerType<AppRouter>(),
|
|
271
|
-
* links: [
|
|
271
|
+
* links: [retryLink({ retry: () => false }), httpBatchLink({ url })],
|
|
272
272
|
* });
|
|
273
|
-
* const post = await client.post.byId.query(
|
|
273
|
+
* const post = await client.post.byId.query(
|
|
274
|
+
* { id: '1' },
|
|
275
|
+
* { context: { retry: (opts) => opts.attempts <= 3 } },
|
|
276
|
+
* );
|
|
274
277
|
* ```
|
|
275
278
|
* @see https://trpc.io/docs/client/vanilla/setup#3-initialize-the-trpc-client
|
|
276
279
|
*/
|
|
@@ -356,17 +359,37 @@ export declare function httpSubscriptionLink<TInferrable extends InferrableClien
|
|
|
356
359
|
* @deprecated Use {@link httpSubscriptionLink} instead.
|
|
357
360
|
*/
|
|
358
361
|
export declare const unstable_httpSubscriptionLink: typeof httpSubscriptionLink;
|
|
362
|
+
type RetryFn<TInferrable extends InferrableClientTypes> = (opts: RetryFnOptions<TInferrable>) => boolean;
|
|
363
|
+
/**
|
|
364
|
+
* The `context` calls can pass through `retryLink`: the fields added to
|
|
365
|
+
* `OperationContext` (`TAugmented`), which its callbacks may read, and
|
|
366
|
+
* `retry`.
|
|
367
|
+
* @public
|
|
368
|
+
*/
|
|
369
|
+
export type RetryLinkContext<TInferrable extends InferrableClientTypes, TAugmented extends object = AugmentedOperationContext> = Omit<TAugmented, 'retry'> & {
|
|
370
|
+
/**
|
|
371
|
+
* Decides whether to retry this call, in place of the link's `retry`.
|
|
372
|
+
* Anything else, such as a flag added to `OperationContext` that the
|
|
373
|
+
* link's `retry` reads, is left to the link.
|
|
374
|
+
* @example client.post.byId.query(input, { context: { retry: (opts) => opts.attempts <= 3 } })
|
|
375
|
+
*/
|
|
376
|
+
retry?: RetryFn<TInferrable> | ('retry' extends keyof TAugmented ? TAugmented['retry'] : never);
|
|
377
|
+
};
|
|
359
378
|
interface RetryLinkOptions<TInferrable extends InferrableClientTypes> {
|
|
360
379
|
/**
|
|
361
|
-
* The retry function
|
|
380
|
+
* The retry function. A call's `context.retry` replaces it for that call.
|
|
362
381
|
*/
|
|
363
|
-
retry:
|
|
382
|
+
retry: RetryFn<TInferrable>;
|
|
364
383
|
/**
|
|
365
384
|
* The delay between retries in ms (defaults to 0)
|
|
366
385
|
*/
|
|
367
386
|
retryDelayMs?: (attempt: number) => number;
|
|
368
387
|
}
|
|
369
|
-
|
|
388
|
+
/**
|
|
389
|
+
* What a `retry` function is given.
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
392
|
+
export interface RetryFnOptions<TInferrable extends InferrableClientTypes> {
|
|
370
393
|
/**
|
|
371
394
|
* The operation that failed
|
|
372
395
|
*/
|
|
@@ -382,12 +405,12 @@ interface RetryFnOptions<TInferrable extends InferrableClientTypes> {
|
|
|
382
405
|
}
|
|
383
406
|
/**
|
|
384
407
|
* Retries failed operations. Subscriptions resume from the last tracked event
|
|
385
|
-
* id.
|
|
408
|
+
* id. A call can pass its own `retry` in `context`.
|
|
386
409
|
*
|
|
387
410
|
* @see https://trpc.io/docs/client/links/retryLink
|
|
388
411
|
*/
|
|
389
412
|
export declare function retryLink<TInferrable extends InferrableClientTypes>(opts: RetryLinkOptions<TInferrable>): TRPCLink<TInferrable, {
|
|
390
|
-
context:
|
|
413
|
+
context: RetryLinkContext<TInferrable>;
|
|
391
414
|
}>;
|
|
392
415
|
/**
|
|
393
416
|
* Passed to {@link LocalLinkOptions.createContext}.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["AnyRouter"],"sources":["../src/internals/TRPCUntypedClient.ts","../src/createTRPCUntypedClient.ts","../src/routerType.ts","../src/safe.ts","../src/createTRPCClient.ts","../src/getFetch.ts","../src/links/httpBatchStreamLink.ts","../src/links/httpSubscriptionLink.ts","../src/links/retryLink.ts","../src/links/localLink.ts"],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AW;;;;;;;;;EASnB,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["AnyRouter"],"sources":["../src/internals/TRPCUntypedClient.ts","../src/createTRPCUntypedClient.ts","../src/routerType.ts","../src/safe.ts","../src/createTRPCClient.ts","../src/getFetch.ts","../src/links/httpBatchStreamLink.ts","../src/links/httpSubscriptionLink.ts","../src/links/retryLink.ts","../src/links/localLink.ts"],"mappings":";;;;;;;;;;;;;UA6BiB;;;;;EAKf,UAAU;;;;;EAKV,SAAS;;;UAIM,yBAAyB,QAAQ;;EAEhD,YAAY;IAAQ,SAAS;;;EAE7B,SAAS,OAAO,wBAAwB;;EAExC,UAAU,KAAK;;;;;EAKf;;EAEA;;EAEA,0BAA0B,OAAO,oBAAoB;;KAGlD,oBAAoB;;;;;;KAOb,iCAAiC,SAAS,WAEnD,QAAQ,6BAER,cAAc,QAAQ;;;;;KAOb,0BAA0B,QAAQ,UAAU,QACtD,yBAAyB,QAAQ,cAG9B,QAAQ,cAAc,KAAK,yBAAyB,QAAQ,SAAS,SACtE;;;;;KAeQ,wBAAwB,gBAAgB;;;;;;EAMlD,OAAO,SAAS;EAChB,cAAc;;;;;;qBAOH,kBAAkB,oBAAoB;mBAChC;WACD,SAAS;UACjB;EAER,YAAY,MAAM,wBAAwB;UASlC;UAkBM;;EAmBP,MAAM,cAAc,iBAAiB,OAAO,qBAAkB;;EAU9D,SAAS,cAAc,iBAAiB,OAAO,qBAAkB;;;;;;;EAejE,aACL,cACA,gBACA,MAAM,mCAAmC,gBAAgB,cACvD,qBACD;EACI,aACL,cAAc,qBACZ,QAAQ,kCAAkC,gBAAgB,eAC1D,oBAEF,cACA,gBACA,OAAO,iCAAiC,SACvC;;;;;;wBCnMW,wBAAwB,gBAAgB,WACtD,MAAM,wBAAwB,WAC7B,kBAAkB;cCRP;;;;;;iBAOG,WAAW,gBAAgB;YAChC,kBAAkB;;;;;;;;;;;;;;;;;wBAkBd,WAAW,gBAAgB,cAAc,WAAW;;;;cCvB/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AAa;;UAGhC,iBAAiB,oBAAoB;;;;EAI7C,OAAO,QAAQ;;;;EAIf,gBAAgB;;;;;;iBAOD,eAAe,oBAAoB;;;;EAIlD,IAAI;;;;EAIJ,OAAO,gBAAgB;;;;EAIvB;;;;;;;;wBASc,UAAU,oBAAoB,uBAC5C,MAAM,iBAAiB,eACtB,SAAS;EAAe,SAAS,iBAAiB;;;;;YChCzC;;;;;EAKV;;;;;IAKE,QAAQ;;;;;;;;YASA,iBAAiB,gBAAgB;;;;;EAK3C,QAAQ;;;;;;EAMR,gBACE,MAAM,kCACH,QAAQ,mBAAmB;;;;;EAKhC,WAAW,MAAM,oBAAoB,mBAAmB;IACtD,mBAAmB,iBAAiB;;;;;;;wBAQxB,UAAU,gBAAgB,WACxC,MAAM,iBAAiB,WACtB,SAAS;EAAW;;;;;;qBAqQV,2BAAkB;;;;;qBAMlB,+BAAsB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.mjs";
|
|
2
|
-
import { C as TRPCProcedureOptions, _ as TRPCClientErrorBase, a as Operation, b as FetchEsque, c as OperationResultEnvelope, d as TRPCClientRuntime, f as TRPCFetch, g as TRPCClientError, h as inferLinksDeclaredContext, i as NoLinkReadsContext, l as OperationResultObservable, m as inferLinksContext, n as HTTPHeaders, o as OperationContext, p as TRPCLink, r as LinkDecl, s as OperationLink, t as AugmentedOperationContext, u as OperationResultObserver, v as TRPCClientErrorLike, x as NativeFetchEsque, y as isTRPCClientError } from "./types-
|
|
3
|
-
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-
|
|
4
|
-
import { n as httpLink, t as HTTPLinkOptions } from "./httpLink-
|
|
5
|
-
import { n as loggerLink, t as LoggerLinkOptions } from "./loggerLink-
|
|
6
|
-
import { t as splitLink } from "./splitLink-
|
|
7
|
-
import { a as WebSocketClientOptions, c as jsonEncoder, i as createWSClient, n as wsLink, o as UrlOptionsWithConnectionParams, r as TRPCWebSocketClient, s as Encoder, t as WebSocketLinkOptions } from "./wsLink-
|
|
2
|
+
import { C as TRPCProcedureOptions, _ as TRPCClientErrorBase, a as Operation, b as FetchEsque, c as OperationResultEnvelope, d as TRPCClientRuntime, f as TRPCFetch, g as TRPCClientError, h as inferLinksDeclaredContext, i as NoLinkReadsContext, l as OperationResultObservable, m as inferLinksContext, n as HTTPHeaders, o as OperationContext, p as TRPCLink, r as LinkDecl, s as OperationLink, t as AugmentedOperationContext, u as OperationResultObserver, v as TRPCClientErrorLike, x as NativeFetchEsque, y as isTRPCClientError } from "./types-BZH1P86I.mjs";
|
|
3
|
+
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-D4shlyQy.mjs";
|
|
4
|
+
import { n as httpLink, t as HTTPLinkOptions } from "./httpLink-Bb6hOyBN.mjs";
|
|
5
|
+
import { n as loggerLink, t as LoggerLinkOptions } from "./loggerLink-y1x7WTWX.mjs";
|
|
6
|
+
import { t as splitLink } from "./splitLink-BGLTgm1a.mjs";
|
|
7
|
+
import { a as WebSocketClientOptions, c as jsonEncoder, i as createWSClient, n as wsLink, o as UrlOptionsWithConnectionParams, r as TRPCWebSocketClient, s as Encoder, t as WebSocketLinkOptions } from "./wsLink-CFh-pvQG.mjs";
|
|
8
8
|
import { n as TransformerOptions } from "./unstable-internals-CnrO49lh.mjs";
|
|
9
|
-
import { t as HTTPLinkBaseOptions } from "./httpUtils-
|
|
9
|
+
import { t as HTTPLinkBaseOptions } from "./httpUtils-BbinScxw.mjs";
|
|
10
10
|
import { Unsubscribable } from "@trpc/server/observable";
|
|
11
11
|
import { AnyClientTypes, AnyProcedure, AnyRouter, ErrorHandlerOptions, EventSourceLike, InferrableClientTypes, ProcedureType, RouterRecord, TypeError, inferAsyncIterableYield, inferClientTypes, inferProcedureErrorShape, inferProcedureInput, inferRouterContext, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
12
12
|
import { AnyRouter as AnyRouter$1 } from "@trpc/server";
|
|
@@ -278,9 +278,12 @@ export type CreateTRPCClientWithRouterOptions<TRouter extends AnyRouter, TLinks
|
|
|
278
278
|
* ```ts
|
|
279
279
|
* const client = createTRPCClient({
|
|
280
280
|
* router: routerType<AppRouter>(),
|
|
281
|
-
* links: [
|
|
281
|
+
* links: [retryLink({ retry: () => false }), httpBatchLink({ url })],
|
|
282
282
|
* });
|
|
283
|
-
* const post = await client.post.byId.query(
|
|
283
|
+
* const post = await client.post.byId.query(
|
|
284
|
+
* { id: '1' },
|
|
285
|
+
* { context: { retry: (opts) => opts.attempts <= 3 } },
|
|
286
|
+
* );
|
|
284
287
|
* ```
|
|
285
288
|
* @see https://trpc.io/docs/client/vanilla/setup#3-initialize-the-trpc-client
|
|
286
289
|
*/
|
|
@@ -366,17 +369,37 @@ export declare function httpSubscriptionLink<TInferrable extends InferrableClien
|
|
|
366
369
|
* @deprecated Use {@link httpSubscriptionLink} instead.
|
|
367
370
|
*/
|
|
368
371
|
export declare const unstable_httpSubscriptionLink: typeof httpSubscriptionLink;
|
|
372
|
+
type RetryFn<TInferrable extends InferrableClientTypes> = (opts: RetryFnOptions<TInferrable>) => boolean;
|
|
373
|
+
/**
|
|
374
|
+
* The `context` calls can pass through `retryLink`: the fields added to
|
|
375
|
+
* `OperationContext` (`TAugmented`), which its callbacks may read, and
|
|
376
|
+
* `retry`.
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
379
|
+
export type RetryLinkContext<TInferrable extends InferrableClientTypes, TAugmented extends object = AugmentedOperationContext> = Omit<TAugmented, 'retry'> & {
|
|
380
|
+
/**
|
|
381
|
+
* Decides whether to retry this call, in place of the link's `retry`.
|
|
382
|
+
* Anything else, such as a flag added to `OperationContext` that the
|
|
383
|
+
* link's `retry` reads, is left to the link.
|
|
384
|
+
* @example client.post.byId.query(input, { context: { retry: (opts) => opts.attempts <= 3 } })
|
|
385
|
+
*/
|
|
386
|
+
retry?: RetryFn<TInferrable> | ('retry' extends keyof TAugmented ? TAugmented['retry'] : never);
|
|
387
|
+
};
|
|
369
388
|
interface RetryLinkOptions<TInferrable extends InferrableClientTypes> {
|
|
370
389
|
/**
|
|
371
|
-
* The retry function
|
|
390
|
+
* The retry function. A call's `context.retry` replaces it for that call.
|
|
372
391
|
*/
|
|
373
|
-
retry:
|
|
392
|
+
retry: RetryFn<TInferrable>;
|
|
374
393
|
/**
|
|
375
394
|
* The delay between retries in ms (defaults to 0)
|
|
376
395
|
*/
|
|
377
396
|
retryDelayMs?: (attempt: number) => number;
|
|
378
397
|
}
|
|
379
|
-
|
|
398
|
+
/**
|
|
399
|
+
* What a `retry` function is given.
|
|
400
|
+
* @public
|
|
401
|
+
*/
|
|
402
|
+
export interface RetryFnOptions<TInferrable extends InferrableClientTypes> {
|
|
380
403
|
/**
|
|
381
404
|
* The operation that failed
|
|
382
405
|
*/
|
|
@@ -392,12 +415,12 @@ interface RetryFnOptions<TInferrable extends InferrableClientTypes> {
|
|
|
392
415
|
}
|
|
393
416
|
/**
|
|
394
417
|
* Retries failed operations. Subscriptions resume from the last tracked event
|
|
395
|
-
* id.
|
|
418
|
+
* id. A call can pass its own `retry` in `context`.
|
|
396
419
|
*
|
|
397
420
|
* @see https://trpc.io/docs/client/links/retryLink
|
|
398
421
|
*/
|
|
399
422
|
export declare function retryLink<TInferrable extends InferrableClientTypes>(opts: RetryLinkOptions<TInferrable>): TRPCLink<TInferrable, {
|
|
400
|
-
context:
|
|
423
|
+
context: RetryLinkContext<TInferrable>;
|
|
401
424
|
}>;
|
|
402
425
|
/**
|
|
403
426
|
* Passed to {@link LocalLinkOptions.createContext}.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["AnyRouter"],"sources":["../src/links/internals/contentTypes.ts","../src/internals/TRPCUntypedClient.ts","../src/createTRPCUntypedClient.ts","../src/routerType.ts","../src/safe.ts","../src/createTRPCClient.ts","../src/getFetch.ts","../src/links/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C,gCAA6B,2BAEvC;;;;;wBAQa,sBAAsB,gBAAgB,WACpD,QAAQ,kBAAkB,WACzB,WAAW;;;;;;YAsBF,kCACV,gBAAgB,WAChB,wBAAwB,SAAS,kBAAkB,SAAS,cAC1D,KAAK,wBAAwB;;;;;EAK/B,QAAQ,WAAW;;;;;;;;;EASnB,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["AnyRouter"],"sources":["../src/links/internals/contentTypes.ts","../src/internals/TRPCUntypedClient.ts","../src/createTRPCUntypedClient.ts","../src/routerType.ts","../src/safe.ts","../src/createTRPCClient.ts","../src/getFetch.ts","../src/links/httpBatchStreamLink.ts","../src/links/httpSubscriptionLink.ts","../src/links/retryLink.ts","../src/links/localLink.ts"],"mappings":";;;;;;;;;;;;;wBACgB,YACd,iBACC,SAAS,WAAW,eAAe;;wBAStB,WAAW,iBAAc,SAAA;;;;;;wBASzB,sBAAsB,iBAAc,SAAA,OAAA,WAAA,WAAA;;UCQnC;;;;;EAKf,UAAU;;;;;EAKV,SAAS;;;UAIM,yBAAyB,QAAQ;;EAEhD,YAAY;IAAQ,SAAS;;;EAE7B,SAAS,OAAO,wBAAwB;;EAExC,UAAU,KAAK;;;;;EAKf;;EAEA;;EAEA,0BAA0B,OAAO,oBAAoB;;KAGlD,oBAAoB;;;;;;KAOb,iCAAiC,SAAS,WAEnD,QAAQ,6BAER,cAAc,QAAQ;;;;;KAOb,0BAA0B,QAAQ,UAAU,QACtD,yBAAyB,QAAQ,cAG9B,QAAQ,cAAc,KAAK,yBAAyB,QAAQ,SAAS,SACtE;;;;;KAeQ,wBAAwB,gBAAgB;;;;;;EAMlD,OAAO,SAAS;EAChB,cAAc;;;;;;qBAOH,kBAAkB,oBAAoB;mBAChC;WACD,SAAS;UACjB;EAER,YAAY,MAAM,wBAAwB;UASlC;UAkBM;;EAmBP,MAAM,cAAc,iBAAiB,OAAO,qBAAkB;;EAU9D,SAAS,cAAc,iBAAiB,OAAO,qBAAkB;;;;;;;EAej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,gBAAgB,WAAW;IACzC,KAAK,oBAAoB,2BAC3B,mBAAmB,SACnB;;;;;;wBAOc,qBACd,oBAAoB,uBACpB,qBAAqB,gBAAgB,gBAErC,MAAM,4BACJ,iBAAiB,cACjB,gBAED,SACD;EAEE,SAAS;;;;;qBA6KA,sCAA6B;KCxPrC,QAAQ,oBAAoB,0BAC/B,MAAM,eAAe;;;;;;;YASX,iBACV,oBAAoB,uBACpB,4BAA4B,6BAC1B,KAAK;;;;;;;EAOP,QACI,QAAQ,sCACe,aAAa;;UAGhC,iBAAiB,oBAAoB;;;;EAI7C,OAAO,QAAQ;;;;EAIf,gBAAgB;;;;;;iBAOD,eAAe,oBAAoB;;;;EAIlD,IAAI;;;;EAIJ,OAAO,gBAAgB;;;;EAIvB;;;;;;;;wBASc,UAAU,oBAAoB,uBAC5C,MAAM,iBAAiB,eACtB,SAAS;EAAe,SAAS,iBAAiB;;;;;YChCzC;;;;;EAKV;;;;;IAKE,QAAQ;;;;;;;;YASA,iBAAiB,gBAAgB;;;;;EAK3C,QAAQ;;;;;;EAMR,gBACE,MAAM,kCACH,QAAQ,mBAAmB;;;;;EAKhC,WAAW,MAAM,oBAAoB,mBAAmB;IACtD,mBAAmB,iBAAiB;;;;;;;wBAQxB,UAAU,gBAAgB,WACxC,MAAM,iBAAiB,WACtB,SAAS;EAAW;;;;;;qBAqQV,2BAAkB;;;;;qBAMlB,+BAAsB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createChain, t as splitLink } from "./splitLink-
|
|
1
|
+
import { n as createChain, t as splitLink } from "./splitLink-C8U8vvLl.mjs";
|
|
2
2
|
import { n as isTRPCClientError, t as TRPCClientError } from "./TRPCClientError-DE6-fd1n.mjs";
|
|
3
3
|
import { n as _defineProperty, t as _objectSpread2 } from "./objectSpread2-pyA4QVO4.mjs";
|
|
4
4
|
import { c as allAbortSignals, d as throwIfAborted, f as getFetch, l as raceAbortSignals, n as getBody, o as resolveHTTPLinkOptions, r as getUrl, s as abortSignalToPromise, t as fetchHTTPResponse, u as raceAbortSignalsWithCleanup } from "./httpUtils-HxB0aY5z.mjs";
|
|
@@ -541,7 +541,7 @@ const unstable_httpSubscriptionLink = httpSubscriptionLink;
|
|
|
541
541
|
/* istanbul ignore file -- @preserve */
|
|
542
542
|
/**
|
|
543
543
|
* Retries failed operations. Subscriptions resume from the last tracked event
|
|
544
|
-
* id.
|
|
544
|
+
* id. A call can pass its own `retry` in `context`.
|
|
545
545
|
*
|
|
546
546
|
* @see https://trpc.io/docs/client/links/retryLink
|
|
547
547
|
*/
|
|
@@ -567,7 +567,8 @@ function retryLink(opts) {
|
|
|
567
567
|
const subscription = callOpts.next(op).subscribe({
|
|
568
568
|
error(error) {
|
|
569
569
|
var _opts$retryDelayMs, _opts$retryDelayMs2;
|
|
570
|
-
const
|
|
570
|
+
const callRetry = op.context["retry"];
|
|
571
|
+
const shouldRetry = (typeof callRetry === "function" ? callRetry : opts.retry)({
|
|
571
572
|
op,
|
|
572
573
|
attempts,
|
|
573
574
|
error
|