Skip to content

Commit db2586b

Browse files
committed
wip
1 parent a604132 commit db2586b

File tree

7 files changed

+25
-20
lines changed

7 files changed

+25
-20
lines changed

packages/client/src/createTRPCClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
inferProcedureInput,
88
inferTransformedProcedureOutput,
99
IntersectionError,
10-
ProcedureOptions,
1110
ProcedureType,
1211
RouterRecord,
1312
} from '@trpc/server/unstable-core-do-not-import';
@@ -21,6 +20,7 @@ import type {
2120
UntypedClientProperties,
2221
} from './internals/TRPCUntypedClient';
2322
import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
23+
import type { TRPCProcedureOptions } from './internals/types';
2424
import type { TRPCClientError } from './TRPCClientError';
2525

2626
/**
@@ -44,15 +44,15 @@ type coerceAsyncGeneratorToIterable<T> =
4444
/** @internal */
4545
export type Resolver<TDef extends ResolverDef> = (
4646
input: TDef['input'],
47-
opts?: ProcedureOptions,
47+
opts?: TRPCProcedureOptions,
4848
) => Promise<coerceAsyncGeneratorToIterable<TDef['output']>>;
4949

5050
type SubscriptionResolver<TDef extends ResolverDef> = (
5151
input: TDef['input'],
5252
opts: Partial<
5353
TRPCSubscriptionObserver<TDef['output'], TRPCClientError<TDef>>
5454
> &
55-
ProcedureOptions,
55+
TRPCProcedureOptions,
5656
) => Unsubscribable;
5757

5858
type DecorateProcedure<

packages/client/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ export {
2020
*/
2121
type inferRouterClient as inferRouterProxyClient,
2222
} from './createTRPCClient';
23+
24+
export { type TRPCProcedureOptions } from './internals/types';

packages/client/src/internals/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,16 @@ export interface ResponseEsque {
8686
* @internal
8787
*/
8888
export type NonEmptyArray<TItem> = [TItem, ...TItem[]];
89+
90+
type ClientContext = Record<string, unknown>;
91+
92+
/**
93+
* @public
94+
*/
95+
export interface TRPCProcedureOptions {
96+
/**
97+
* Client-side context
98+
*/
99+
context?: ClientContext;
100+
signal?: AbortSignal;
101+
}

packages/next/src/app-dir/create-action-hook.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {
22
CreateTRPCClientOptions,
33
TRPCLink,
4+
TRPCProcedureOptions,
45
TRPCRequestOptions,
56
} from '@trpc/client';
67
import { createTRPCUntypedClient, TRPCClientError } from '@trpc/client';
@@ -14,7 +15,6 @@ import type {
1415
inferClientTypes,
1516
InferrableClientTypes,
1617
MaybePromise,
17-
ProcedureOptions,
1818
Simplify,
1919
TypeError,
2020
} from '@trpc/server/unstable-core-do-not-import';
@@ -25,8 +25,8 @@ import type { ActionHandlerDef } from './shared';
2525
import { isFormData } from './shared';
2626

2727
type MutationArgs<TDef extends ActionHandlerDef> = TDef['input'] extends void
28-
? [input?: undefined | void, opts?: ProcedureOptions]
29-
: [input: FormData | TDef['input'], opts?: ProcedureOptions];
28+
? [input?: undefined | void, opts?: TRPCProcedureOptions]
29+
: [input: FormData | TDef['input'], opts?: TRPCProcedureOptions];
3030

3131
interface UseTRPCActionBaseResult<TDef extends ActionHandlerDef> {
3232
mutate: (...args: MutationArgs<TDef>) => void;

packages/server/src/@trpc/server/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export {
3131
type AnyQueryProcedure as AnyTRPCQueryProcedure,
3232
type RouterRecord as TRPCRouterRecord,
3333
type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure,
34-
type ProcedureOptions as TRPCProcedureOptions,
3534
type CreateContextCallback,
3635
type MutationProcedure as TRPCMutationProcedure,
3736
type QueryProcedure as TRPCQueryProcedure,

packages/server/src/unstable-core-do-not-import/procedure.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@ export const procedureTypes = ['query', 'mutation', 'subscription'] as const;
77
*/
88
export type ProcedureType = (typeof procedureTypes)[number];
99

10-
type ClientContext = Record<string, unknown>;
11-
12-
/**
13-
* @internal
14-
*/
15-
export interface ProcedureOptions {
16-
/**
17-
* Client-side context
18-
*/
19-
context?: ClientContext;
20-
signal?: AbortSignal;
21-
}
22-
2310
interface BuiltProcedureDef {
2411
input: unknown;
2512
output: unknown;

www/docs/migration/migrate-from-v10-to-v11.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import { InstallSnippet } from '@site/src/components/InstallSnippet';
2424
> This is a draft document. It will be updated to a proper guide as we get closer to the v11 release.
2525
> The only major thing that will incur work for you is that you will need to do is to update TanStack Query to v5.0.0.
2626
27+
### Move `TRPCProcedureOptions` to `@trpc/client` (non-breaking for most)
28+
29+
If you previously used `ProcedureOptions` from `@trpc/server`, you can now need to use `TRPCProcedureOptions` from `@trpc/client` instead.
30+
2731
### Allow promises to be embedded in nested data (non-breaking)
2832

2933
We now allow promises to be embedded in nested data when using the [`httpBatchStreamLink`](../client/links/httpBatchStreamLink.md), this means that you can now do things like this:

0 commit comments

Comments
 (0)