@trpc/client 11.32.2 → 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-DbD4ZGAM.d.cts → httpBatchLink-50xXDyIp.d.cts} +6 -4
- package/dist/{httpBatchLink-DbD4ZGAM.d.cts.map → httpBatchLink-50xXDyIp.d.cts.map} +1 -1
- package/dist/{httpBatchLink-Dk3_n5pP.d.mts → httpBatchLink-D4shlyQy.d.mts} +6 -4
- package/dist/{httpBatchLink-Dk3_n5pP.d.mts.map → httpBatchLink-D4shlyQy.d.mts.map} +1 -1
- package/dist/httpBatchLink-DRitkRBC.mjs.map +1 -1
- package/dist/{httpLink-BjZdBzr6.d.mts → httpLink-Bb6hOyBN.d.mts} +6 -4
- package/dist/httpLink-Bb6hOyBN.d.mts.map +1 -0
- package/dist/httpLink-Cmg_mV7L.mjs.map +1 -1
- package/dist/{httpUtils-gZ7bAQ6T.d.mts → httpUtils-BbinScxw.d.mts} +2 -2
- package/dist/{httpUtils-CxgZ3W-1.d.cts.map → httpUtils-BbinScxw.d.mts.map} +1 -1
- package/dist/{httpUtils-CxgZ3W-1.d.cts → httpUtils-dB1XeokQ.d.cts} +2 -2
- package/dist/{httpUtils-gZ7bAQ6T.d.mts.map → httpUtils-dB1XeokQ.d.cts.map} +1 -1
- package/dist/index.cjs +25 -16
- package/dist/index.d.cts +120 -25
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +123 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +25 -17
- 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 +5 -3
- package/dist/links/httpLink.d.cts.map +1 -1
- package/dist/links/httpLink.d.mts +1 -1
- package/dist/links/loggerLink.d.cts +4 -2
- package/dist/links/loggerLink.d.cts.map +1 -1
- package/dist/links/loggerLink.d.mts +1 -1
- package/dist/links/loggerLink.mjs.map +1 -1
- package/dist/links/splitLink.cjs +1 -1
- package/dist/links/splitLink.d.cts +43 -9
- 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-CBPx95zm.d.mts → loggerLink-y1x7WTWX.d.mts} +5 -3
- package/dist/loggerLink-y1x7WTWX.d.mts.map +1 -0
- package/dist/splitLink-BGLTgm1a.d.mts +56 -0
- package/dist/splitLink-BGLTgm1a.d.mts.map +1 -0
- package/dist/{splitLink-PFsRy7Mf.mjs → splitLink-C8U8vvLl.mjs} +10 -9
- package/dist/splitLink-C8U8vvLl.mjs.map +1 -0
- package/dist/{splitLink-BBLj14Dv.cjs → splitLink-NqS85b92.cjs} +9 -8
- package/dist/{types-BG-3kpeg.d.mts → types-BZH1P86I.d.mts} +67 -10
- package/dist/types-BZH1P86I.d.mts.map +1 -0
- package/dist/{types-BhHxuBsu.d.cts → types-CGS36fjk.d.cts} +67 -10
- package/dist/types-CGS36fjk.d.cts.map +1 -0
- package/dist/{wsLink-DU5wj6kH.d.mts → wsLink-CFh-pvQG.d.mts} +5 -3
- package/dist/{wsLink-BlAMQb0i.d.cts.map → wsLink-CFh-pvQG.d.mts.map} +1 -1
- package/dist/{wsLink-BlAMQb0i.d.cts → wsLink-CJT5pqFt.d.cts} +5 -3
- package/dist/{wsLink-DU5wj6kH.d.mts.map → wsLink-CJT5pqFt.d.cts.map} +1 -1
- package/dist/wsLink-C_Zg2yXV.mjs.map +1 -1
- package/package.json +3 -3
- package/skills/client-setup/SKILL.md +1 -1
- package/skills/links/SKILL.md +59 -2
- 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 +91 -21
- package/src/index.ts +1 -0
- package/src/internals/types.ts +8 -5
- package/src/links/httpBatchLink.ts +6 -2
- package/src/links/httpBatchStreamLink.ts +6 -2
- package/src/links/httpLink.ts +6 -1
- package/src/links/httpSubscriptionLink.ts +6 -2
- package/src/links/localLink.ts +1 -1
- package/src/links/loggerLink.ts +11 -2
- package/src/links/retryLink.ts +42 -7
- package/src/links/splitLink.ts +126 -13
- package/src/links/types.ts +114 -5
- package/src/links/wsLink/wsLink.ts +1 -1
- package/src/routerType.ts +31 -0
- package/dist/httpLink-BjZdBzr6.d.mts.map +0 -1
- package/dist/loggerLink-CBPx95zm.d.mts.map +0 -1
- package/dist/splitLink-BtPz7lCB.d.mts +0 -23
- package/dist/splitLink-BtPz7lCB.d.mts.map +0 -1
- package/dist/splitLink-PFsRy7Mf.mjs.map +0 -1
- package/dist/types-BG-3kpeg.d.mts.map +0 -1
- package/dist/types-BhHxuBsu.d.cts.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { a as Operation, h as inferLinksDeclaredContext, o as OperationContext, p as TRPCLink, t as AugmentedOperationContext } from "./types-BZH1P86I.mjs";
|
|
2
|
+
import { AnyRouter } from "@trpc/server/unstable-core-do-not-import";
|
|
3
|
+
/**
|
|
4
|
+
* A `splitLink` branch: one link or a chain of them.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
type SplitLinkBranch<TRouter extends AnyRouter> = TRPCLink<TRouter, any> | readonly TRPCLink<TRouter, any>[];
|
|
8
|
+
type asLinks<TBranch> = TBranch extends readonly unknown[] ? TBranch : [TBranch];
|
|
9
|
+
interface SplitLinkOptions<TRouter extends AnyRouter, TTrue extends SplitLinkBranch<TRouter>, TFalse extends SplitLinkBranch<TRouter>, TContext extends object> {
|
|
10
|
+
/**
|
|
11
|
+
* Picks the chain for an operation.
|
|
12
|
+
*/
|
|
13
|
+
condition: (op: Operation<unknown, TContext>) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The link to execute next if the test function returns `true`.
|
|
16
|
+
*/
|
|
17
|
+
true: TTrue;
|
|
18
|
+
/**
|
|
19
|
+
* The link to execute next if the test function returns `false`.
|
|
20
|
+
*/
|
|
21
|
+
false: TFalse;
|
|
22
|
+
}
|
|
23
|
+
type fitBranchContext<TContext, TTrue, TFalse> = inferLinksDeclaredContext<[...asLinks<TTrue>, ...asLinks<TFalse>]> extends (infer $Branches) ? { [TKey in keyof TContext & keyof $Branches]: $Branches[TKey]; } : never;
|
|
24
|
+
type SplitLink<TRouter extends AnyRouter, TTrue extends SplitLinkBranch<TRouter>, TFalse extends SplitLinkBranch<TRouter>, TContext extends object> = TRPCLink<TRouter, {
|
|
25
|
+
context: TContext & inferLinksDeclaredContext<[...asLinks<TTrue>, ...asLinks<TFalse>]>;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Sends each operation down one of two link chains, based on `condition`.
|
|
29
|
+
*
|
|
30
|
+
* Calls take the `context` both chains read. Give `context` defaults to
|
|
31
|
+
* declare the fields `condition` reads; without them, `condition` reads
|
|
32
|
+
* the fields added to `OperationContext`.
|
|
33
|
+
* @example
|
|
34
|
+
* splitLink({
|
|
35
|
+
* context: { skipBatch: false },
|
|
36
|
+
* condition: (op) => op.context.skipBatch,
|
|
37
|
+
* true: httpLink({ url }),
|
|
38
|
+
* false: httpBatchLink({ url }),
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* @see https://trpc.io/docs/client/links/splitLink
|
|
42
|
+
*/
|
|
43
|
+
declare function splitLink<TRouter extends AnyRouter = AnyRouter, const TTrue extends SplitLinkBranch<TRouter> = SplitLinkBranch<TRouter>, const TFalse extends SplitLinkBranch<TRouter> = SplitLinkBranch<TRouter>>(opts: SplitLinkOptions<TRouter, TTrue, TFalse, OperationContext> & {
|
|
44
|
+
context?: never;
|
|
45
|
+
}): SplitLink<TRouter, TTrue, TFalse, AugmentedOperationContext>;
|
|
46
|
+
declare function splitLink<TRouter extends AnyRouter, const TTrue extends SplitLinkBranch<TRouter>, const TFalse extends SplitLinkBranch<TRouter>, TContext extends object>(opts: SplitLinkOptions<TRouter, TTrue, TFalse, TContext> & {
|
|
47
|
+
/**
|
|
48
|
+
* Values for the `context` fields `condition` reads, used when a call
|
|
49
|
+
* leaves one out. Their types are the fields calls can pass. A field a
|
|
50
|
+
* call passes replaces its default whole: nested objects aren't merged.
|
|
51
|
+
* A field the branches' links also read must fit their type.
|
|
52
|
+
*/
|
|
53
|
+
context: TContext & fitBranchContext<TContext, TTrue, TFalse>;
|
|
54
|
+
}): SplitLink<TRouter, TTrue, TFalse, TContext>;
|
|
55
|
+
export { splitLink as t };
|
|
56
|
+
//# sourceMappingURL=splitLink-BGLTgm1a.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitLink-BGLTgm1a.d.mts","names":[],"sources":["../src/links/splitLink.ts"],"mappings":";;;;;;KAgCK,gBAAgB,gBAAgB,aACjC,SAAS,yBACA,SAAS;KAGjB,QAAQ,WAAW,qCACpB,WACC;UAEK,iBACR,gBAAgB,WAChB,cAAc,gBAAgB,UAC9B,eAAe,gBAAgB,UAC/B;;;;EAKA,YAAY,IAAI,mBAAmB;;;;EAInC,MAAM;;;;EAIN,OAAO;;KAKJ,iBAAiB,UAAU,OAAO,UACrC,8BACM,QAAQ,WAAW,QAAQ,yBACjB,gBACT,cAAc,iBAAiB,YAAY,UAAU;KAGzD,UACH,gBAAgB,WAChB,cAAc,gBAAgB,UAC9B,eAAe,gBAAgB,UAC/B,2BACE,SACF;EAEE,SAAS,WACP,8BAA8B,QAAQ,WAAW,QAAQ;;;;;;;;;;;;;;;;;;iBAoB/C,UACd,gBAAgB,YAAY,iBAEtB,cAAc,gBAAgB,WAAW,gBAAgB,gBACzD,eAAe,gBAAgB,WAAW,gBAAgB,UAEhE,MAAM,iBAAiB,SAAS,OAAO,QAAQ;EAC7C;IAGD,UAAU,SAAS,OAAO,QAAQ;iBACrB,UACd,gBAAgB,iBACV,cAAc,gBAAgB,gBAC9B,eAAe,gBAAgB,UACrC,yBAEA,MAAM,iBAAiB,SAAS,OAAO,QAAQ;;;;;;;EAO7C,SAAS,WAAW,iBAAiB,UAAU,OAAO;IAEvD,UAAU,SAAS,OAAO,QAAQ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as _objectSpread2 } from "./objectSpread2-pyA4QVO4.mjs";
|
|
1
2
|
import { observable } from "@trpc/server/observable";
|
|
2
3
|
// src/links/internals/createChain.ts
|
|
3
4
|
/** @internal */
|
|
@@ -20,21 +21,21 @@ function createChain(opts) {
|
|
|
20
21
|
function asArray(value) {
|
|
21
22
|
return Array.isArray(value) ? value : [value];
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
function withDefaults(defaults, context) {
|
|
25
|
+
const merged = _objectSpread2(_objectSpread2({}, defaults), context);
|
|
26
|
+
for (const key of Reflect.ownKeys(defaults)) if (merged[key] === void 0) merged[key] = defaults[key];
|
|
27
|
+
return merged;
|
|
28
|
+
}
|
|
28
29
|
function splitLink(opts) {
|
|
29
30
|
return (runtime) => {
|
|
30
31
|
const yes = asArray(opts.true).map((link) => link(runtime));
|
|
31
32
|
const no = asArray(opts.false).map((link) => link(runtime));
|
|
32
33
|
return (props) => {
|
|
33
34
|
return observable((observer) => {
|
|
34
|
-
const
|
|
35
|
+
const op = opts.context ? _objectSpread2(_objectSpread2({}, props.op), {}, { context: withDefaults(opts.context, props.op.context) }) : props.op;
|
|
35
36
|
return createChain({
|
|
36
|
-
op
|
|
37
|
-
links
|
|
37
|
+
op,
|
|
38
|
+
links: opts.condition(op) ? yes : no
|
|
38
39
|
}).subscribe(observer);
|
|
39
40
|
});
|
|
40
41
|
};
|
|
@@ -42,4 +43,4 @@ function splitLink(opts) {
|
|
|
42
43
|
}
|
|
43
44
|
export { createChain as n, splitLink as t };
|
|
44
45
|
|
|
45
|
-
//# sourceMappingURL=splitLink-
|
|
46
|
+
//# sourceMappingURL=splitLink-C8U8vvLl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitLink-C8U8vvLl.mjs","names":[],"sources":["../src/links/internals/createChain.ts","../src/links/splitLink.ts"],"sourcesContent":["import { observable } from '@trpc/server/observable';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport type {\n Operation,\n OperationLink,\n OperationResultObservable,\n} from '../types';\n\n/** @internal */\nexport function createChain<\n TRouter extends AnyRouter,\n TInput = unknown,\n TOutput = unknown,\n>(opts: {\n links: OperationLink<TRouter, TInput, TOutput>[];\n op: Operation<TInput>;\n}): OperationResultObservable<TRouter, TOutput> {\n return observable((observer) => {\n function execute(index = 0, op = opts.op) {\n const next = opts.links[index];\n if (!next) {\n throw new Error(\n 'No more links to execute - did you forget to add an ending link?',\n );\n }\n const subscription = next({\n op,\n next(nextOp) {\n const nextObserver = execute(index + 1, nextOp);\n\n return nextObserver;\n },\n });\n return subscription;\n }\n\n const obs$ = execute();\n return obs$.subscribe(observer);\n });\n}\n","import { observable } from '@trpc/server/observable';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { createChain } from './internals/createChain';\nimport type {\n AugmentedOperationContext,\n inferLinksDeclaredContext,\n Operation,\n OperationContext,\n TRPCLink,\n} from './types';\n\nfunction asArray<TType>(value: TType | readonly TType[]): readonly TType[] {\n return Array.isArray(value) ? value : [value as TType];\n}\n\n// a field the call leaves out, or sets to `undefined`, takes its default\nfunction withDefaults(\n defaults: Record<PropertyKey, unknown>,\n context: OperationContext,\n): OperationContext {\n // spreading copies symbol keys too\n const merged: Record<PropertyKey, unknown> = { ...defaults, ...context };\n for (const key of Reflect.ownKeys(defaults)) {\n if (merged[key] === undefined) merged[key] = defaults[key];\n }\n return merged;\n}\n\n/**\n * A `splitLink` branch: one link or a chain of them.\n * @internal\n */\ntype SplitLinkBranch<TRouter extends AnyRouter> =\n | TRPCLink<TRouter, any>\n | readonly TRPCLink<TRouter, any>[];\n\n// a tuple, so links whose declarations nest aren't merged into one\ntype asLinks<TBranch> = TBranch extends readonly unknown[]\n ? TBranch\n : [TBranch];\n\ninterface SplitLinkOptions<\n TRouter extends AnyRouter,\n TTrue extends SplitLinkBranch<TRouter>,\n TFalse extends SplitLinkBranch<TRouter>,\n TContext extends object,\n> {\n /**\n * Picks the chain for an operation.\n */\n condition: (op: Operation<unknown, TContext>) => boolean;\n /**\n * The link to execute next if the test function returns `true`.\n */\n true: TTrue;\n /**\n * The link to execute next if the test function returns `false`.\n */\n false: TFalse;\n}\n\n// the types the branches' links read the defaults' fields as, so a\n// default that a branch would read as another type is an error\ntype fitBranchContext<TContext, TTrue, TFalse> =\n inferLinksDeclaredContext<\n [...asLinks<TTrue>, ...asLinks<TFalse>]\n > extends infer $Branches\n ? { [TKey in keyof TContext & keyof $Branches]: $Branches[TKey] }\n : never;\n\ntype SplitLink<\n TRouter extends AnyRouter,\n TTrue extends SplitLinkBranch<TRouter>,\n TFalse extends SplitLinkBranch<TRouter>,\n TContext extends object,\n> = TRPCLink<\n TRouter,\n {\n context: TContext &\n inferLinksDeclaredContext<[...asLinks<TTrue>, ...asLinks<TFalse>]>;\n }\n>;\n\n/**\n * Sends each operation down one of two link chains, based on `condition`.\n *\n * Calls take the `context` both chains read. Give `context` defaults to\n * declare the fields `condition` reads; without them, `condition` reads\n * the fields added to `OperationContext`.\n * @example\n * splitLink({\n * context: { skipBatch: false },\n * condition: (op) => op.context.skipBatch,\n * true: httpLink({ url }),\n * false: httpBatchLink({ url }),\n * })\n *\n * @see https://trpc.io/docs/client/links/splitLink\n */\nexport function splitLink<\n TRouter extends AnyRouter = AnyRouter,\n // with an explicit router type, a branch is still a link or an array\n const TTrue extends SplitLinkBranch<TRouter> = SplitLinkBranch<TRouter>,\n const TFalse extends SplitLinkBranch<TRouter> = SplitLinkBranch<TRouter>,\n>(\n opts: SplitLinkOptions<TRouter, TTrue, TFalse, OperationContext> & {\n context?: never;\n },\n // `condition` may read the fields added to `OperationContext`\n): SplitLink<TRouter, TTrue, TFalse, AugmentedOperationContext>;\nexport function splitLink<\n TRouter extends AnyRouter,\n const TTrue extends SplitLinkBranch<TRouter>,\n const TFalse extends SplitLinkBranch<TRouter>,\n TContext extends object,\n>(\n opts: SplitLinkOptions<TRouter, TTrue, TFalse, TContext> & {\n /**\n * Values for the `context` fields `condition` reads, used when a call\n * leaves one out. Their types are the fields calls can pass. A field a\n * call passes replaces its default whole: nested objects aren't merged.\n * A field the branches' links also read must fit their type.\n */\n context: TContext & fitBranchContext<TContext, TTrue, TFalse>;\n },\n): SplitLink<TRouter, TTrue, TFalse, TContext>;\nexport function splitLink(\n opts: SplitLinkOptions<\n AnyRouter,\n SplitLinkBranch<AnyRouter>,\n SplitLinkBranch<AnyRouter>,\n any\n > & { context?: Record<PropertyKey, unknown> },\n): TRPCLink<AnyRouter> {\n return (runtime) => {\n const yes = asArray(opts.true).map((link) => link(runtime));\n const no = asArray(opts.false).map((link) => link(runtime));\n return (props) => {\n return observable((observer) => {\n const op = opts.context\n ? {\n ...props.op,\n context: withDefaults(opts.context, props.op.context),\n }\n : props.op;\n const links = opts.condition(op) ? yes : no;\n return createChain({ op, links }).subscribe(observer);\n });\n };\n };\n}\n"],"mappings":";;;;AASA,SAAgB,YAId,MAG8C;CAC9C,OAAO,YAAY,aAAa;EAC9B,SAAS,QAAQ,QAAQ,GAAG,KAAK,KAAK,IAAI;GACxC,MAAM,OAAO,KAAK,MAAM;GACxB,IAAI,CAAC,MACH,MAAM,IAAI,MACR,kEACF;GAUF,OARqB,KAAK;IACxB;IACA,KAAK,QAAQ;KAGX,OAFqB,QAAQ,QAAQ,GAAG,MAEtB;IACpB;GACF,CACkB;EACpB;EAGA,OADa,QACH,CAAC,CAAC,UAAU,QAAQ;CAChC,CAAC;AACH;;AC5BA,SAAS,QAAe,OAAmD;CACzE,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAc;AACvD;AAGA,SAAS,aACP,UACA,SACkB;CAElB,MAAM,SAAA,eAAA,eAAA,CAAA,GAA4C,QAAA,GAAa,OAAQ;CACvE,KAAK,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GACxC,IAAI,OAAO,SAAS,KAAA,GAAW,OAAO,OAAO,SAAS;CAExD,OAAO;AACT;AAoGA,SAAgB,UACd,MAMqB;CACrB,QAAQ,YAAY;EAClB,MAAM,MAAM,QAAQ,KAAK,IAAI,CAAC,CAAC,KAAK,SAAS,KAAK,OAAO,CAAC;EAC1D,MAAM,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,KAAK,SAAS,KAAK,OAAO,CAAC;EAC1D,QAAQ,UAAU;GAChB,OAAO,YAAY,aAAa;IAC9B,MAAM,KAAK,KAAK,UAAA,eAAA,eAAA,CAAA,GAEP,MAAM,EAAA,GAAA,CAAA,GAAA,EACT,SAAS,aAAa,KAAK,SAAS,MAAM,GAAG,OAAO,EAAA,CACtD,IACA,MAAM;IAEV,OAAO,YAAY;KAAE;KAAI,OADX,KAAK,UAAU,EAAE,IAAI,MAAM;IACV,CAAC,CAAC,CAAC,UAAU,QAAQ;GACtD,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_objectSpread2 = require("./objectSpread2-Xm0br5eL.cjs");
|
|
1
2
|
let _trpc_server_observable = require("@trpc/server/observable");
|
|
2
3
|
// src/links/internals/createChain.ts
|
|
3
4
|
/** @internal */
|
|
@@ -20,21 +21,21 @@ function createChain(opts) {
|
|
|
20
21
|
function asArray(value) {
|
|
21
22
|
return Array.isArray(value) ? value : [value];
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
function withDefaults(defaults, context) {
|
|
25
|
+
const merged = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaults), context);
|
|
26
|
+
for (const key of Reflect.ownKeys(defaults)) if (merged[key] === void 0) merged[key] = defaults[key];
|
|
27
|
+
return merged;
|
|
28
|
+
}
|
|
28
29
|
function splitLink(opts) {
|
|
29
30
|
return (runtime) => {
|
|
30
31
|
const yes = asArray(opts.true).map((link) => link(runtime));
|
|
31
32
|
const no = asArray(opts.false).map((link) => link(runtime));
|
|
32
33
|
return (props) => {
|
|
33
34
|
return (0, _trpc_server_observable.observable)((observer) => {
|
|
34
|
-
const
|
|
35
|
+
const op = opts.context ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props.op), {}, { context: withDefaults(opts.context, props.op.context) }) : props.op;
|
|
35
36
|
return createChain({
|
|
36
|
-
op
|
|
37
|
-
links
|
|
37
|
+
op,
|
|
38
|
+
links: opts.condition(op) ? yes : no
|
|
38
39
|
}).subscribe(observer);
|
|
39
40
|
});
|
|
40
41
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.mjs";
|
|
2
2
|
import { Observable, Observer } from "@trpc/server/observable";
|
|
3
|
-
import { DefaultErrorShape, InferrableClientTypes, Maybe, TRPCErrorResponse, TRPCResultMessage, TRPCSuccessResponse, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
3
|
+
import { DefaultErrorShape, InferrableClientTypes, Maybe, Simplify, TRPCErrorResponse, TRPCResultMessage, TRPCSuccessResponse, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
/**
|
|
5
5
|
* A subset of the standard fetch function type needed by tRPC internally.
|
|
6
6
|
* @see fetch from lib.dom.d.ts
|
|
@@ -71,18 +71,18 @@ interface ResponseEsque {
|
|
|
71
71
|
* @internal
|
|
72
72
|
*/
|
|
73
73
|
type NonEmptyArray<TItem> = [TItem, ...TItem[]];
|
|
74
|
-
type ClientContext = Record<string, unknown>;
|
|
75
74
|
/**
|
|
76
75
|
* The options of a call made with the client, such as
|
|
77
|
-
* `client.post.byId.query(input, opts)`.
|
|
76
|
+
* `client.post.byId.query(input, opts)`. `TContext` is what the client's
|
|
77
|
+
* links read, when it was created with `router: routerType<AppRouter>()`.
|
|
78
78
|
* @public
|
|
79
79
|
*/
|
|
80
|
-
interface TRPCProcedureOptions {
|
|
80
|
+
interface TRPCProcedureOptions<TContext extends object = Record<string, unknown>> {
|
|
81
81
|
/**
|
|
82
82
|
* Context for the links, such as a flag a `splitLink` reads.
|
|
83
83
|
* @see https://trpc.io/docs/client/links#managing-context
|
|
84
84
|
*/
|
|
85
|
-
context?:
|
|
85
|
+
context?: TContext;
|
|
86
86
|
/**
|
|
87
87
|
* Aborts the call. With `httpBatchLink`, the request is only aborted once
|
|
88
88
|
* every call in its batch is, so an aborted call can still get a result.
|
|
@@ -148,17 +148,25 @@ declare class TRPCClientError<TRouterOrProcedure extends InferrableClientTypes>
|
|
|
148
148
|
* @internal
|
|
149
149
|
*/
|
|
150
150
|
interface OperationContext extends Record<string, unknown> {}
|
|
151
|
+
/**
|
|
152
|
+
* The fields added to `OperationContext` with module augmentation, without
|
|
153
|
+
* its `[key: string]: unknown`. Links that hand the operation to your code
|
|
154
|
+
* declare these, so calls take only fields something declared.
|
|
155
|
+
* @see https://trpc.io/docs/client/links#managing-context
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
type AugmentedOperationContext = { [TKey in keyof OperationContext as string extends TKey ? never : TKey]: OperationContext[TKey]; };
|
|
151
159
|
/**
|
|
152
160
|
* A procedure call as it goes through the links.
|
|
153
161
|
* @internal
|
|
154
162
|
*/
|
|
155
|
-
type Operation<TInput = unknown> = {
|
|
163
|
+
type Operation<TInput = unknown, TContext extends object = OperationContext> = {
|
|
156
164
|
/** A number unique to the call within its client. */
|
|
157
165
|
id: number;
|
|
158
166
|
type: 'mutation' | 'query' | 'subscription';
|
|
159
167
|
input: TInput;
|
|
160
168
|
path: string;
|
|
161
|
-
context:
|
|
169
|
+
context: TContext;
|
|
162
170
|
signal: Maybe<AbortSignal>;
|
|
163
171
|
};
|
|
164
172
|
interface HeadersInitEsque {
|
|
@@ -204,12 +212,61 @@ type OperationLink<TInferrable extends InferrableClientTypes, TInput = unknown,
|
|
|
204
212
|
op: Operation<TInput>;
|
|
205
213
|
next: (op: Operation<TInput>) => OperationResultObservable<TInferrable, TOutput>;
|
|
206
214
|
}) => OperationResultObservable<TInferrable, TOutput>;
|
|
215
|
+
/**
|
|
216
|
+
* What a link declares about itself, for clients created with
|
|
217
|
+
* `createTRPCClient({ router: routerType<AppRouter>(), links })`.
|
|
218
|
+
* @see https://trpc.io/docs/client/links#typing-call-options
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
interface LinkDecl {
|
|
222
|
+
/**
|
|
223
|
+
* The fields the link reads from `op.context`. Calls can pass them, typed,
|
|
224
|
+
* as `.query(input, { context })`. `{}` declares that the link reads none.
|
|
225
|
+
*/
|
|
226
|
+
context?: object;
|
|
227
|
+
}
|
|
207
228
|
/**
|
|
208
229
|
* A link: a step every call goes through, such as logging or sending it
|
|
209
230
|
* over HTTP. It's called once when the client is created.
|
|
231
|
+
*
|
|
232
|
+
* `TDecl` says what it reads from `op.context`. A link that doesn't
|
|
233
|
+
* declare it may read any context.
|
|
210
234
|
* @see https://trpc.io/docs/client/links#creating-a-custom-link
|
|
211
235
|
* @public
|
|
212
236
|
*/
|
|
213
|
-
type TRPCLink<TInferrable extends InferrableClientTypes> = (opts: TRPCClientRuntime) => OperationLink<TInferrable
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
type TRPCLink<TInferrable extends InferrableClientTypes, TDecl extends LinkDecl = LinkDecl> = ((opts: TRPCClientRuntime) => OperationLink<TInferrable>) & {
|
|
238
|
+
/** Type-only: what the link declares. Never set. */
|
|
239
|
+
readonly '~decl'?: TDecl;
|
|
240
|
+
};
|
|
241
|
+
type UnionToIntersection<TUnion> = (TUnion extends any ? (arg: TUnion) => void : never) extends ((arg: infer TIntersection) => void) ? TIntersection : never;
|
|
242
|
+
type inferLinkDecl<TLink> = TLink extends unknown ? '~decl' extends keyof TLink ? NonNullable<TLink['~decl' & keyof TLink]> : LinkDecl : never;
|
|
243
|
+
type inferDeclContext<TDecl> = TDecl extends unknown ? LinkDecl extends TDecl ? OperationContext : TDecl extends {
|
|
244
|
+
context: infer $Context;
|
|
245
|
+
} ? $Context : {} : never;
|
|
246
|
+
declare const noLinkReadsContext: unique symbol;
|
|
247
|
+
/**
|
|
248
|
+
* The call options' `context` when no link reads one: passing any field is
|
|
249
|
+
* an error.
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
252
|
+
type NoLinkReadsContext = {
|
|
253
|
+
readonly [noLinkReadsContext]?: never;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* The fields the links in `TLinks` declare they read, merged, for a link
|
|
257
|
+
* that wraps other links to declare.
|
|
258
|
+
* @public
|
|
259
|
+
*/
|
|
260
|
+
type inferLinksDeclaredContext<TLinks extends readonly unknown[]> = UnionToIntersection<TLinks[number] extends (infer $Link) ? $Link extends unknown ? {
|
|
261
|
+
context: inferDeclContext<inferLinkDecl<$Link>>;
|
|
262
|
+
} : never : never> extends {
|
|
263
|
+
context: infer $Context;
|
|
264
|
+
} ? $Context : {};
|
|
265
|
+
/**
|
|
266
|
+
* The `context` calls can pass: the fields every link in `TLinks` reads,
|
|
267
|
+
* merged.
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
type inferLinksContext<TLinks extends readonly unknown[]> = inferLinksDeclaredContext<TLinks> extends (infer $Context) ? $Context extends unknown ? keyof $Context extends never ? NoLinkReadsContext : Simplify<Partial<$Context>> : never : never;
|
|
271
|
+
export { TRPCProcedureOptions as C, NonEmptyArray as S, TRPCClientErrorBase as _, Operation as a, FetchEsque as b, OperationResultEnvelope as c, TRPCClientRuntime as d, TRPCFetch as f, TRPCClientError as g, inferLinksDeclaredContext as h, NoLinkReadsContext as i, OperationResultObservable as l, inferLinksContext as m, HTTPHeaders as n, OperationContext as o, TRPCLink as p, LinkDecl as r, OperationLink as s, AugmentedOperationContext as t, OperationResultObserver as u, TRPCClientErrorLike as v, NativeFetchEsque as x, isTRPCClientError as y };
|
|
272
|
+
//# sourceMappingURL=types-BZH1P86I.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BZH1P86I.d.mts","names":[],"sources":["../src/internals/types.ts","../src/TRPCClientError.ts","../src/links/types.ts"],"mappings":";;;;;;;;;;KAOY,cACV,OAAO,cAAc,cACrB,OAAO,cAAc,qBAClB,QAAQ;;;;;KAMD,oBACV,KAAK,cACL,OAAO,8BACJ,QAAQ;UAEI;EACf;;;;;;;;;UAUe;;;;EAIf,OAAO,2BAA2B,WAAW,eAAe,OAAO;;;;EAKnE,+BAA+B;;;;EAK/B;;;;EAKA,SAAS;;;;;;KAOC;EACV,iBAAiB,4BAA4B;;KAGnC;EACV,GACE,4BACA,cAAc,uBACb;;;;;;UAOY;WACN;WACA,OAAO,4BAA4B;;;;;;;EAO5C,QAAQ;;;;;KAME,cAAc,UAAU,UAAU;;;;;;;UAU7B,qBACf,0BAA0B;;;;;EAM1B,UAAU;;;;;;EAMV,SAAS;;KCpGN,gBAAgB,oBAAoB,yBACvC,iBAAiB;;UAEF,oBAAoB,eAAe;WACzC;;WAEA,OAAO,MAAM;;WAEb,MAAM,MAAM;;;;;;;KAOX,oBAAoB,oBAAoB,yBAClD,oBAAoB,gBAAgB;;;;;iBAMtB,kBAAkB,oBAAoB,uBACpD,iBACC,SAAS,gBAAgB;;;;;;cA4Bf,gBAAgB,2BAA2B,+BAC9C,iBACG,oBAAoB,gBAAgB;;WAKtB,OAAK;;WAEd,OAAO,MAAM,gBAAgB;;WAE7B,MAAM,MAAM,gBAAgB;;;;;;EAOrC,MAAI;EAEX,YACE,iBACA;IACE,SAAS,MAAM,kBAAkB,gBAAgB;IACjD,QAAQ;IACR,OAAO;;;;;;SAuBG,KAAK,2BAA2B,uBAC5C,QAAQ,QAAQ,iCAChB;IAAQ,OAAO;IAAyB,QAAQ;MAC/C,gBAAgB;;;;;;;UC3FJ,yBAAyB;;;;;;;;KAS9B,+BAER,cAAc,mCAAmC,eAAe,OAC/D,iBAAiB;;;;;KAOV,UACV,kBACA,0BAA0B;;EAG1B;EACA;EACA,OAAO;EACP;EACA,SAAS;EACT,QAAQ,MAAM;;UAGN;GACP,OAAO,aAAa;;;;;;KAOX,cACR,mBACA;;;;KAKQ,aACV,aACA,UAAU,gBACP,QAAQ;;UAGI;;;;;;UASA,wBAAwB,SAAS;EAChD,QACI,kBAAkB,qBAClB,oBAAoB,qBACpB,oBAAoB;EACxB,UAAU;;;;;;KAOA,0BACV,oBAAoB,uBACpB,WACE,WACF,wBAAwB,SAAS,gBAAgB,eACjD,gBAAgB;;;;;KAON,wBACV,oBAAoB,uBACpB,WACE,SACF,wBAAwB,SAAS,gBAAgB,eACjD,gBAAgB;;;;;;;KASN,cACV,oBAAoB,uBACpB,kBACA,sBACG;EACH,IAAI,UAAU;EACd,OACE,IAAI,UAAU,YACX,0BAA0B,aAAa;MACxC,0BAA0B,aAAa;;;;;;;UAQ5B;;;;;EAKf;;;;;;;;;;;KAYU,SACV,oBAAoB,uBACpB,cAAc,WAAW,cACrB,MAAM,sBAAsB,cAAc;;WAErC,UAAU;;KAGhB,oBAAoB,WACvB,sBAAsB,KAAK,mCAClB,WAAW,0BAClB;KAKC,cAAc,SAAS,8CACF,QACpB,YAAY,sBAAsB,UAClC;KAGD,iBAAiB,SAAS,wBAE3B,iBAAiB,QACf,mBACA;EAAgB,eAAe;IAC7B;cAIM;;;;;;KAUF;YACA;;;;;;;KAQA,0BAA0B,qCAGpC,oBACE,8BAA6B,SACzB;EACI,SAAS,iBAAiB,cAAc;;EAGtC,eAAe;IACvB;;;;;;KAQM,kBAAkB,qCAC5B,0BAA0B,uBAAsB,YAE5C,iCACQ,yBACJ,qBAEA,SAAS,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.cjs";
|
|
2
|
-
import { DefaultErrorShape, InferrableClientTypes, Maybe, TRPCErrorResponse, TRPCResultMessage, TRPCSuccessResponse, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
2
|
+
import { DefaultErrorShape, InferrableClientTypes, Maybe, Simplify, TRPCErrorResponse, TRPCResultMessage, TRPCSuccessResponse, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
3
3
|
import { Observable, Observer } from "@trpc/server/observable";
|
|
4
4
|
/**
|
|
5
5
|
* A subset of the standard fetch function type needed by tRPC internally.
|
|
@@ -71,18 +71,18 @@ interface ResponseEsque {
|
|
|
71
71
|
* @internal
|
|
72
72
|
*/
|
|
73
73
|
type NonEmptyArray<TItem> = [TItem, ...TItem[]];
|
|
74
|
-
type ClientContext = Record<string, unknown>;
|
|
75
74
|
/**
|
|
76
75
|
* The options of a call made with the client, such as
|
|
77
|
-
* `client.post.byId.query(input, opts)`.
|
|
76
|
+
* `client.post.byId.query(input, opts)`. `TContext` is what the client's
|
|
77
|
+
* links read, when it was created with `router: routerType<AppRouter>()`.
|
|
78
78
|
* @public
|
|
79
79
|
*/
|
|
80
|
-
interface TRPCProcedureOptions {
|
|
80
|
+
interface TRPCProcedureOptions<TContext extends object = Record<string, unknown>> {
|
|
81
81
|
/**
|
|
82
82
|
* Context for the links, such as a flag a `splitLink` reads.
|
|
83
83
|
* @see https://trpc.io/docs/client/links#managing-context
|
|
84
84
|
*/
|
|
85
|
-
context?:
|
|
85
|
+
context?: TContext;
|
|
86
86
|
/**
|
|
87
87
|
* Aborts the call. With `httpBatchLink`, the request is only aborted once
|
|
88
88
|
* every call in its batch is, so an aborted call can still get a result.
|
|
@@ -158,17 +158,25 @@ declare function isNonJsonSerializable(input: unknown): input is Blob | FormData
|
|
|
158
158
|
* @internal
|
|
159
159
|
*/
|
|
160
160
|
interface OperationContext extends Record<string, unknown> {}
|
|
161
|
+
/**
|
|
162
|
+
* The fields added to `OperationContext` with module augmentation, without
|
|
163
|
+
* its `[key: string]: unknown`. Links that hand the operation to your code
|
|
164
|
+
* declare these, so calls take only fields something declared.
|
|
165
|
+
* @see https://trpc.io/docs/client/links#managing-context
|
|
166
|
+
* @public
|
|
167
|
+
*/
|
|
168
|
+
type AugmentedOperationContext = { [TKey in keyof OperationContext as string extends TKey ? never : TKey]: OperationContext[TKey]; };
|
|
161
169
|
/**
|
|
162
170
|
* A procedure call as it goes through the links.
|
|
163
171
|
* @internal
|
|
164
172
|
*/
|
|
165
|
-
type Operation<TInput = unknown> = {
|
|
173
|
+
type Operation<TInput = unknown, TContext extends object = OperationContext> = {
|
|
166
174
|
/** A number unique to the call within its client. */
|
|
167
175
|
id: number;
|
|
168
176
|
type: 'mutation' | 'query' | 'subscription';
|
|
169
177
|
input: TInput;
|
|
170
178
|
path: string;
|
|
171
|
-
context:
|
|
179
|
+
context: TContext;
|
|
172
180
|
signal: Maybe<AbortSignal>;
|
|
173
181
|
};
|
|
174
182
|
interface HeadersInitEsque {
|
|
@@ -214,12 +222,61 @@ type OperationLink<TInferrable extends InferrableClientTypes, TInput = unknown,
|
|
|
214
222
|
op: Operation<TInput>;
|
|
215
223
|
next: (op: Operation<TInput>) => OperationResultObservable<TInferrable, TOutput>;
|
|
216
224
|
}) => OperationResultObservable<TInferrable, TOutput>;
|
|
225
|
+
/**
|
|
226
|
+
* What a link declares about itself, for clients created with
|
|
227
|
+
* `createTRPCClient({ router: routerType<AppRouter>(), links })`.
|
|
228
|
+
* @see https://trpc.io/docs/client/links#typing-call-options
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
interface LinkDecl {
|
|
232
|
+
/**
|
|
233
|
+
* The fields the link reads from `op.context`. Calls can pass them, typed,
|
|
234
|
+
* as `.query(input, { context })`. `{}` declares that the link reads none.
|
|
235
|
+
*/
|
|
236
|
+
context?: object;
|
|
237
|
+
}
|
|
217
238
|
/**
|
|
218
239
|
* A link: a step every call goes through, such as logging or sending it
|
|
219
240
|
* over HTTP. It's called once when the client is created.
|
|
241
|
+
*
|
|
242
|
+
* `TDecl` says what it reads from `op.context`. A link that doesn't
|
|
243
|
+
* declare it may read any context.
|
|
220
244
|
* @see https://trpc.io/docs/client/links#creating-a-custom-link
|
|
221
245
|
* @public
|
|
222
246
|
*/
|
|
223
|
-
type TRPCLink<TInferrable extends InferrableClientTypes> = (opts: TRPCClientRuntime) => OperationLink<TInferrable
|
|
224
|
-
|
|
225
|
-
|
|
247
|
+
type TRPCLink<TInferrable extends InferrableClientTypes, TDecl extends LinkDecl = LinkDecl> = ((opts: TRPCClientRuntime) => OperationLink<TInferrable>) & {
|
|
248
|
+
/** Type-only: what the link declares. Never set. */
|
|
249
|
+
readonly '~decl'?: TDecl;
|
|
250
|
+
};
|
|
251
|
+
type UnionToIntersection<TUnion> = (TUnion extends any ? (arg: TUnion) => void : never) extends ((arg: infer TIntersection) => void) ? TIntersection : never;
|
|
252
|
+
type inferLinkDecl<TLink> = TLink extends unknown ? '~decl' extends keyof TLink ? NonNullable<TLink['~decl' & keyof TLink]> : LinkDecl : never;
|
|
253
|
+
type inferDeclContext<TDecl> = TDecl extends unknown ? LinkDecl extends TDecl ? OperationContext : TDecl extends {
|
|
254
|
+
context: infer $Context;
|
|
255
|
+
} ? $Context : {} : never;
|
|
256
|
+
declare const noLinkReadsContext: unique symbol;
|
|
257
|
+
/**
|
|
258
|
+
* The call options' `context` when no link reads one: passing any field is
|
|
259
|
+
* an error.
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
type NoLinkReadsContext = {
|
|
263
|
+
readonly [noLinkReadsContext]?: never;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* The fields the links in `TLinks` declare they read, merged, for a link
|
|
267
|
+
* that wraps other links to declare.
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
type inferLinksDeclaredContext<TLinks extends readonly unknown[]> = UnionToIntersection<TLinks[number] extends (infer $Link) ? $Link extends unknown ? {
|
|
271
|
+
context: inferDeclContext<inferLinkDecl<$Link>>;
|
|
272
|
+
} : never : never> extends {
|
|
273
|
+
context: infer $Context;
|
|
274
|
+
} ? $Context : {};
|
|
275
|
+
/**
|
|
276
|
+
* The `context` calls can pass: the fields every link in `TLinks` reads,
|
|
277
|
+
* merged.
|
|
278
|
+
* @public
|
|
279
|
+
*/
|
|
280
|
+
type inferLinksContext<TLinks extends readonly unknown[]> = inferLinksDeclaredContext<TLinks> extends (infer $Context) ? $Context extends unknown ? keyof $Context extends never ? NoLinkReadsContext : Simplify<Partial<$Context>> : never : never;
|
|
281
|
+
export { FetchEsque as C, TRPCProcedureOptions as E, isTRPCClientError as S, NonEmptyArray as T, isNonJsonSerializable as _, Operation as a, TRPCClientErrorBase as b, OperationResultEnvelope as c, TRPCClientRuntime as d, TRPCFetch as f, isFormData as g, inferLinksDeclaredContext as h, NoLinkReadsContext as i, OperationResultObservable as l, inferLinksContext as m, HTTPHeaders as n, OperationContext as o, TRPCLink as p, LinkDecl as r, OperationLink as s, AugmentedOperationContext as t, OperationResultObserver as u, isOctetType as v, NativeFetchEsque as w, TRPCClientErrorLike as x, TRPCClientError as y };
|
|
282
|
+
//# sourceMappingURL=types-CGS36fjk.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CGS36fjk.d.cts","names":[],"sources":["../src/internals/types.ts","../src/TRPCClientError.ts","../src/links/internals/contentTypes.ts","../src/links/types.ts"],"mappings":";;;;;;;;;;KAOY,cACV,OAAO,cAAc,cACrB,OAAO,cAAc,qBAClB,QAAQ;;;;;KAMD,oBACV,KAAK,cACL,OAAO,8BACJ,QAAQ;UAEI;EACf;;;;;;;;;UAUe;;;;EAIf,OAAO,2BAA2B,WAAW,eAAe,OAAO;;;;EAKnE,+BAA+B;;;;EAK/B;;;;EAKA,SAAS;;;;;;KAOC;EACV,iBAAiB,4BAA4B;;KAGnC;EACV,GACE,4BACA,cAAc,uBACb;;;;;;UAOY;WACN;WACA,OAAO,4BAA4B;;;;;;;EAO5C,QAAQ;;;;;KAME,cAAc,UAAU,UAAU;;;;;;;UAU7B,qBACf,0BAA0B;;;;;EAM1B,UAAU;;;;;;EAMV,SAAS;;KCpGN,gBAAgB,oBAAoB,yBACvC,iBAAiB;;UAEF,oBAAoB,eAAe;WACzC;;WAEA,OAAO,MAAM;;WAEb,MAAM,MAAM;;;;;;;KAOX,oBAAoB,oBAAoB,yBAClD,oBAAoB,gBAAgB;;;;;iBAMtB,kBAAkB,oBAAoB,uBACpD,iBACC,SAAS,gBAAgB;;;;;;cA4Bf,gBAAgB,2BAA2B,+BAC9C,iBACG,oBAAoB,gBAAgB;;WAKtB,OAAK;;WAEd,OAAO,MAAM,gBAAgB;;WAE7B,MAAM,MAAM,gBAAgB;;;;;;EAOrC,MAAI;EAEX,YACE,iBACA;IACE,SAAS,MAAM,kBAAkB,gBAAgB;IACjD,QAAQ;IACR,OAAO;;;;;;SAuBG,KAAK,2BAA2B,uBAC5C,QAAQ,QAAQ,iCAChB;IAAQ,OAAO;IAAyB,QAAQ;MAC/C,gBAAgB;;;iBCjHL,YACd,iBACC,SAAS,WAAW,eAAe;;iBAStB,WAAW,iBAAc,SAAA;;;;;;iBASzB,sBAAsB,iBAAc,SAAA,OAAA,WAAA,WAAA;;;;;;UCEnC,yBAAyB;;;;;;;;KAS9B,+BAER,cAAc,mCAAmC,eAAe,OAC/D,iBAAiB;;;;;KAOV,UACV,kBACA,0BAA0B;;EAG1B;EACA;EACA,OAAO;EACP;EACA,SAAS;EACT,QAAQ,MAAM;;UAGN;GACP,OAAO,aAAa;;;;;;KAOX,cACR,mBACA;;;;KAKQ,aACV,aACA,UAAU,gBACP,QAAQ;;UAGI;;;;;;UASA,wBAAwB,SAAS;EAChD,QACI,kBAAkB,qBAClB,oBAAoB,qBACpB,oBAAoB;EACxB,UAAU;;;;;;KAOA,0BACV,oBAAoB,uBACpB,WACE,WACF,wBAAwB,SAAS,gBAAgB,eACjD,gBAAgB;;;;;KAON,wBACV,oBAAoB,uBACpB,WACE,SACF,wBAAwB,SAAS,gBAAgB,eACjD,gBAAgB;;;;;;;KASN,cACV,oBAAoB,uBACpB,kBACA,sBACG;EACH,IAAI,UAAU;EACd,OACE,IAAI,UAAU,YACX,0BAA0B,aAAa;MACxC,0BAA0B,aAAa;;;;;;;UAQ5B;;;;;EAKf;;;;;;;;;;;KAYU,SACV,oBAAoB,uBACpB,cAAc,WAAW,cACrB,MAAM,sBAAsB,cAAc;;WAErC,UAAU;;KAGhB,oBAAoB,WACvB,sBAAsB,KAAK,mCAClB,WAAW,0BAClB;KAKC,cAAc,SAAS,8CACF,QACpB,YAAY,sBAAsB,UAClC;KAGD,iBAAiB,SAAS,wBAE3B,iBAAiB,QACf,mBACA;EAAgB,eAAe;IAC7B;cAIM;;;;;;KAUF;YACA;;;;;;;KAQA,0BAA0B,qCAGpC,oBACE,8BAA6B,SACzB;EACI,SAAS,iBAAiB,cAAc;;EAGtC,eAAe;IACvB;;;;;;KAQM,kBAAkB,qCAC5B,0BAA0B,uBAAsB,YAE5C,iCACQ,yBACJ,qBAEA,SAAS,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as TransformerOptions } from "./unstable-internals-CnrO49lh.mjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as Operation, c as OperationResultEnvelope, g as TRPCClientError, p as TRPCLink } from "./types-BZH1P86I.mjs";
|
|
3
3
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.mjs";
|
|
4
4
|
import { BehaviorSubject } from "@trpc/server/observable";
|
|
5
5
|
import { AnyRouter, CombinedDataTransformer, Encoder, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
@@ -305,6 +305,8 @@ type WebSocketLinkOptions<TRouter extends AnyRouter> = {
|
|
|
305
305
|
*
|
|
306
306
|
* @see https://trpc.io/docs/client/links/wsLink
|
|
307
307
|
*/
|
|
308
|
-
declare function wsLink<TRouter extends AnyRouter>(opts: WebSocketLinkOptions<TRouter>): TRPCLink<TRouter
|
|
308
|
+
declare function wsLink<TRouter extends AnyRouter>(opts: WebSocketLinkOptions<TRouter>): TRPCLink<TRouter, {
|
|
309
|
+
context: {};
|
|
310
|
+
}>;
|
|
309
311
|
export { WebSocketClientOptions as a, jsonEncoder as c, createWSClient as i, wsLink as n, UrlOptionsWithConnectionParams as o, TRPCWebSocketClient as r, Encoder as s, WebSocketLinkOptions as t };
|
|
310
|
-
//# sourceMappingURL=wsLink-
|
|
312
|
+
//# sourceMappingURL=wsLink-CFh-pvQG.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsLink-
|
|
1
|
+
{"version":3,"file":"wsLink-CFh-pvQG.d.mts","names":[],"sources":["../src/links/wsLink/wsClient/encoder.ts","../src/links/internals/urlWithConnectionParams.ts","../src/links/wsLink/wsClient/options.ts","../src/links/wsLink/wsClient/wsClient.ts","../src/links/wsLink/createWsClient.ts","../src/links/wsLink/wsLink.ts"],"mappings":";;;;;;;;;;cAOa,aAAa;;;;KCWd,gBAAgB,KAAK,WAAW,IAAI,QAAQ;UAEvC;;;;EAIf,KAAK;;;;;;;EAQL,mBAAmB,gBAAgB;;;;;;;UCxBpB,+BAA+B;;;;EAI9C,mBAAmB;;;;;EAKnB,gBAAgB;;;;EAIhB;;;;EAIA,WAAW,MAAM;;;;EAIjB,WAAW;IAAU;;;;;EAIrB;;;;;IAKE;;;;;IAKA;;;;;EAKF;;;;IAIE;;;;;IAKA;;;;;IAKA;;;;;;EAMF,uBAAuB;;;;;;cCWZ;;;;WAIK,iBAAiB,gBAC/B,oBAAoB,gBAAgB;UAG9B;UACA;;;;;;;UASA;mBACS;;;;;;UAMT;mBACS;UACT;;;;;UAKA;mBACS;mBAIA;mBACA;mBACA;EAEjB,YAAY,MAAM;;;;;;UA4DV;UAUA;;;;;UAeM;;;;;EAmDD,SAAK;;;;;;;;;;;EAqDX,UACL,MAAM,MAAM,MAAM,OAAO,UACzB,aACA;IAEA,IAAI,KAAK;IACT,aAAa;IACb;wCACD,WAAA,iCAAA,gBAAA,iBAAA,gBAAA;;;;MAwEU;;;;;;;;;;;;;;;;;;UAaH;;;;UAIA;;;;;UAKA;;;;;;UAMA;;;;UAIA;;;;;;;;;;;UAWA;;mBAES;;;;;;;;;UAUT;;;;;;;;UA2FA;;;;;;;UA8CA;UAiBA;UASA;;;;UAaA;;;;;;UAWA;;;;;UAaA;UA0BA;UAqNA;UA+DA;;;;UASA;;;;;;UAqBA;;;;;UAWA;;;;;;;;iBCh9BM,eAAe,MAAM,yBAAsB;;;;KAO/C,sBAAsB,kBAAkB;;;;;;KCIxC,qBAAqB,gBAAgB;;;;EAI/C,QAAQ;IACN,mBAAmB,iBAAiB;;;;;;iBAOxB,OAAO,gBAAgB,WACrC,MAAM,qBAAqB,WAC1B,SAAS;EAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransformerOptions } from "./unstable-internals.cjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as Operation, c as OperationResultEnvelope, p as TRPCLink, y as TRPCClientError } from "./types-CGS36fjk.cjs";
|
|
3
3
|
import { t as TRPCConnectionState } from "./subscriptions-CvJnusYO.cjs";
|
|
4
4
|
import { AnyRouter, CombinedDataTransformer, Encoder, inferClientTypes } from "@trpc/server/unstable-core-do-not-import";
|
|
5
5
|
import { BehaviorSubject } from "@trpc/server/observable";
|
|
@@ -305,6 +305,8 @@ type WebSocketLinkOptions<TRouter extends AnyRouter> = {
|
|
|
305
305
|
*
|
|
306
306
|
* @see https://trpc.io/docs/client/links/wsLink
|
|
307
307
|
*/
|
|
308
|
-
declare function wsLink<TRouter extends AnyRouter>(opts: WebSocketLinkOptions<TRouter>): TRPCLink<TRouter
|
|
308
|
+
declare function wsLink<TRouter extends AnyRouter>(opts: WebSocketLinkOptions<TRouter>): TRPCLink<TRouter, {
|
|
309
|
+
context: {};
|
|
310
|
+
}>;
|
|
309
311
|
export { WebSocketClientOptions as a, jsonEncoder as c, createWSClient as i, wsLink as n, UrlOptionsWithConnectionParams as o, TRPCWebSocketClient as r, Encoder as s, WebSocketLinkOptions as t };
|
|
310
|
-
//# sourceMappingURL=wsLink-
|
|
312
|
+
//# sourceMappingURL=wsLink-CJT5pqFt.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsLink-
|
|
1
|
+
{"version":3,"file":"wsLink-CJT5pqFt.d.cts","names":[],"sources":["../src/links/wsLink/wsClient/encoder.ts","../src/links/internals/urlWithConnectionParams.ts","../src/links/wsLink/wsClient/options.ts","../src/links/wsLink/wsClient/wsClient.ts","../src/links/wsLink/createWsClient.ts","../src/links/wsLink/wsLink.ts"],"mappings":";;;;;;;;;;cAOa,aAAa;;;;KCWd,gBAAgB,KAAK,WAAW,IAAI,QAAQ;UAEvC;;;;EAIf,KAAK;;;;;;;EAQL,mBAAmB,gBAAgB;;;;;;;UCxBpB,+BAA+B;;;;EAI9C,mBAAmB;;;;;EAKnB,gBAAgB;;;;EAIhB;;;;EAIA,WAAW,MAAM;;;;EAIjB,WAAW;IAAU;;;;;EAIrB;;;;;IAKE;;;;;IAKA;;;;;EAKF;;;;IAIE;;;;;IAKA;;;;;IAKA;;;;;;EAMF,uBAAuB;;;;;;cCWZ;;;;WAIK,iBAAiB,gBAC/B,oBAAoB,gBAAgB;UAG9B;UACA;;;;;;;UASA;mBACS;;;;;;UAMT;mBACS;UACT;;;;;UAKA;mBACS;mBAIA;mBACA;mBACA;EAEjB,YAAY,MAAM;;;;;;UA4DV;UAUA;;;;;UAeM;;;;;EAmDD,SAAK;;;;;;;;;;;EAqDX,UACL,MAAM,MAAM,MAAM,OAAO,UACzB,aACA;IAEA,IAAI,KAAK;IACT,aAAa;IACb;wCACD,WAAA,iCAAA,gBAAA,iBAAA,gBAAA;;;;MAwEU;;;;;;;;;;;;;;;;;;UAaH;;;;UAIA;;;;;UAKA;;;;;;UAMA;;;;UAIA;;;;;;;;;;;UAWA;;mBAES;;;;;;;;;UAUT;;;;;;;;UA2FA;;;;;;;UA8CA;UAiBA;UASA;;;;UAaA;;;;;;UAWA;;;;;UAaA;UA0BA;UAqNA;UA+DA;;;;UASA;;;;;;UAqBA;;;;;UAWA;;;;;;;;iBCh9BM,eAAe,MAAM,yBAAsB;;;;KAO/C,sBAAsB,kBAAkB;;;;;;KCIxC,qBAAqB,gBAAgB;;;;EAI/C,QAAQ;IACN,mBAAmB,iBAAiB;;;;;;iBAOxB,OAAO,gBAAgB,WACrC,MAAM,qBAAqB,WAC1B,SAAS;EAAW"}
|