@orpc/react-query 0.0.0-next.fd1db03 → 0.0.0-next.fea68c1
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/README.md +110 -0
- package/dist/index.js +20 -23
- package/dist/src/{utils-general.d.ts → general-utils.d.ts} +2 -2
- package/dist/src/index.d.ts +4 -4
- package/dist/src/procedure-utils.d.ts +12 -0
- package/dist/src/router-utils.d.ts +12 -0
- package/dist/src/types.d.ts +26 -15
- package/package.json +3 -5
- package/dist/src/utils-procedure.d.ts +0 -30
- package/dist/src/utils-router.d.ts +0 -12
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<h1></h1>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
<a href="https://codecov.io/gh/unnoq/orpc">
|
|
9
|
+
<img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@orpc/react-query">
|
|
12
|
+
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Freact-query?logo=npm" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
|
|
15
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
|
+
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
23
|
+
|
|
24
|
+
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards, ensuring a smooth and enjoyable developer experience.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Highlights
|
|
29
|
+
|
|
30
|
+
- **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
|
|
31
|
+
- **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
|
|
32
|
+
- **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
|
|
33
|
+
- **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
|
|
34
|
+
- **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
|
|
35
|
+
- **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
|
|
36
|
+
- **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
|
|
37
|
+
- **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
|
|
38
|
+
- **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
|
|
39
|
+
- **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
|
|
40
|
+
- **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
|
|
41
|
+
- **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
|
|
42
|
+
- **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
|
|
43
|
+
- **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
|
|
44
|
+
- **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
|
|
45
|
+
- **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
You can find the full documentation [here](https://orpc.unnoq.com).
|
|
50
|
+
|
|
51
|
+
## Packages
|
|
52
|
+
|
|
53
|
+
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
54
|
+
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
55
|
+
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
|
+
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
57
|
+
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
58
|
+
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
59
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
60
|
+
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
61
|
+
|
|
62
|
+
## `@orpc/react-query`
|
|
63
|
+
|
|
64
|
+
Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview). Read the [documentation](https://orpc.unnoq.com/docs/tanstack-query/react) for more information.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
export function Example() {
|
|
68
|
+
const query = useQuery(orpc.planet.find.queryOptions({
|
|
69
|
+
input: { id: 123 }, // Specify input if needed
|
|
70
|
+
context: { cache: true }, // Provide client context if needed
|
|
71
|
+
// additional options...
|
|
72
|
+
}))
|
|
73
|
+
|
|
74
|
+
const query = useInfiniteQuery(orpc.planet.list.infiniteOptions({
|
|
75
|
+
input: (pageParam: number | undefined) => ({ limit: 10, offset: pageParam }),
|
|
76
|
+
context: { cache: true }, // Provide client context if needed
|
|
77
|
+
initialPageParam: undefined,
|
|
78
|
+
getNextPageParam: lastPage => lastPage.nextPageParam,
|
|
79
|
+
// additional options...
|
|
80
|
+
}))
|
|
81
|
+
|
|
82
|
+
const mutation = useMutation(orpc.planet.create.mutationOptions({
|
|
83
|
+
context: { cache: true }, // Provide client context if needed
|
|
84
|
+
// additional options...
|
|
85
|
+
}))
|
|
86
|
+
|
|
87
|
+
mutation.mutate({ name: 'Earth' })
|
|
88
|
+
|
|
89
|
+
const queryClient = useQueryClient()
|
|
90
|
+
|
|
91
|
+
// Invalidate all planet queries
|
|
92
|
+
queryClient.invalidateQueries({
|
|
93
|
+
queryKey: orpc.planet.key(),
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// Invalidate only regular (non-infinite) planet queries
|
|
97
|
+
queryClient.invalidateQueries({
|
|
98
|
+
queryKey: orpc.planet.key({ type: 'query' })
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// Invalidate the planet find query with id 123
|
|
102
|
+
queryClient.invalidateQueries({
|
|
103
|
+
queryKey: orpc.planet.find.key({ input: { id: 123 } })
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.js
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
function buildKey(path, options) {
|
|
3
3
|
const withInput = options?.input !== void 0 ? { input: options?.input } : {};
|
|
4
4
|
const withType = options?.type !== void 0 ? { type: options?.type } : {};
|
|
5
|
-
return [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
...withInput,
|
|
10
|
-
...withType
|
|
11
|
-
}
|
|
12
|
-
];
|
|
5
|
+
return [path, {
|
|
6
|
+
...withInput,
|
|
7
|
+
...withType
|
|
8
|
+
}];
|
|
13
9
|
}
|
|
14
10
|
|
|
15
|
-
// src/utils
|
|
11
|
+
// src/general-utils.ts
|
|
16
12
|
function createGeneralUtils(path) {
|
|
17
13
|
return {
|
|
18
14
|
key(options) {
|
|
@@ -21,36 +17,37 @@ function createGeneralUtils(path) {
|
|
|
21
17
|
};
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
// src/utils
|
|
20
|
+
// src/procedure-utils.ts
|
|
25
21
|
function createProcedureUtils(client, path) {
|
|
26
22
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
call: client,
|
|
24
|
+
queryOptions(...[{ input, context, ...rest } = {}]) {
|
|
29
25
|
return {
|
|
30
26
|
queryKey: buildKey(path, { type: "query", input }),
|
|
31
|
-
queryFn: ({ signal }) => client(input, { signal, context
|
|
32
|
-
...
|
|
27
|
+
queryFn: ({ signal }) => client(input, { signal, context }),
|
|
28
|
+
...rest
|
|
33
29
|
};
|
|
34
30
|
},
|
|
35
|
-
infiniteOptions(
|
|
36
|
-
const input = options.input;
|
|
31
|
+
infiniteOptions({ input, context, ...rest }) {
|
|
37
32
|
return {
|
|
38
|
-
queryKey: buildKey(path, { type: "infinite", input }),
|
|
39
|
-
queryFn: ({ pageParam, signal }) =>
|
|
40
|
-
|
|
33
|
+
queryKey: buildKey(path, { type: "infinite", input: input(rest.initialPageParam) }),
|
|
34
|
+
queryFn: ({ pageParam, signal }) => {
|
|
35
|
+
return client(input(pageParam), { signal, context });
|
|
36
|
+
},
|
|
37
|
+
...rest
|
|
41
38
|
};
|
|
42
39
|
},
|
|
43
|
-
mutationOptions(...[
|
|
40
|
+
mutationOptions(...[{ context, ...rest } = {}]) {
|
|
44
41
|
return {
|
|
45
42
|
mutationKey: buildKey(path, { type: "mutation" }),
|
|
46
|
-
mutationFn: (input) => client(input, { context
|
|
47
|
-
...
|
|
43
|
+
mutationFn: (input) => client(input, { context }),
|
|
44
|
+
...rest
|
|
48
45
|
};
|
|
49
46
|
}
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
// src/utils
|
|
50
|
+
// src/router-utils.ts
|
|
54
51
|
function createRouterUtils(client, path = []) {
|
|
55
52
|
const generalUtils = createGeneralUtils(path);
|
|
56
53
|
const procedureUtils = createProcedureUtils(client, path);
|
|
@@ -4,7 +4,7 @@ import type { BuildKeyOptions, KeyType } from './key';
|
|
|
4
4
|
* Utils at any level (procedure or router)
|
|
5
5
|
*/
|
|
6
6
|
export interface GeneralUtils<TInput> {
|
|
7
|
-
key
|
|
7
|
+
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
8
8
|
}
|
|
9
9
|
export declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
10
|
-
//# sourceMappingURL=utils
|
|
10
|
+
//# sourceMappingURL=general-utils.d.ts.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createRouterUtils } from './utils
|
|
1
|
+
import { createRouterUtils } from './router-utils';
|
|
2
|
+
export * from './general-utils';
|
|
2
3
|
export * from './key';
|
|
4
|
+
export * from './procedure-utils';
|
|
5
|
+
export * from './router-utils';
|
|
3
6
|
export * from './types';
|
|
4
|
-
export * from './utils-general';
|
|
5
|
-
export * from './utils-procedure';
|
|
6
|
-
export * from './utils-router';
|
|
7
7
|
export declare const createORPCReactQueryUtils: typeof createRouterUtils;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Client, ClientContext } from '@orpc/client';
|
|
2
|
+
import type { MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
+
import type { InfiniteData } from '@tanstack/react-query';
|
|
4
|
+
import type { InfiniteOptionsBase, InfiniteOptionsIn, MutationOptionsBase, MutationOptionsIn, QueryOptionsBase, QueryOptionsIn } from './types';
|
|
5
|
+
export interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
|
|
6
|
+
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
7
|
+
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & QueryOptionsBase<TOutput, TError>>;
|
|
8
|
+
infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput, UPageParam>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & InfiniteOptionsBase<TOutput, TError, UPageParam>>;
|
|
9
|
+
mutationOptions<U>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError>>): NoInfer<U & MutationOptionsBase<TInput, TOutput, TError>>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
12
|
+
//# sourceMappingURL=procedure-utils.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Client, NestedClient } from '@orpc/client';
|
|
2
|
+
import { type GeneralUtils } from './general-utils';
|
|
3
|
+
import { type ProcedureUtils } from './procedure-utils';
|
|
4
|
+
export type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
|
5
|
+
[K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
|
|
6
|
+
} & GeneralUtils<unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* @param client - Any kind of oRPC clients: `createRouterClient`, `createORPCClient`, ...
|
|
9
|
+
* @param path - The base path for query key, when it it will be prefix to all keys
|
|
10
|
+
*/
|
|
11
|
+
export declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?: string[]): RouterUtils<T>;
|
|
12
|
+
//# sourceMappingURL=router-utils.d.ts.map
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
|
+
import type { ClientContext } from '@orpc/client';
|
|
1
2
|
import type { SetOptional } from '@orpc/shared';
|
|
2
|
-
import type {
|
|
3
|
-
export type
|
|
4
|
-
cursor?: any;
|
|
5
|
-
} ? T['cursor'] : never;
|
|
6
|
-
export type QueryOptions<TInput, TOutput, TClientContext, TSelectData> = (undefined extends TInput ? {
|
|
3
|
+
import type { QueryFunctionContext, QueryKey, UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
4
|
+
export type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData> = (undefined extends TInput ? {
|
|
7
5
|
input?: TInput;
|
|
8
6
|
} : {
|
|
9
7
|
input: TInput;
|
|
10
|
-
}) & (
|
|
8
|
+
}) & (Record<never, never> extends TClientContext ? {
|
|
11
9
|
context?: TClientContext;
|
|
12
10
|
} : {
|
|
13
11
|
context: TClientContext;
|
|
14
|
-
}) &
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
12
|
+
}) & SetOptional<UseQueryOptions<TOutput, TError, TSelectData>, 'queryKey'>;
|
|
13
|
+
export interface QueryOptionsBase<TOutput, TError extends Error> {
|
|
14
|
+
queryKey: QueryKey;
|
|
15
|
+
queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
|
|
16
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
17
|
+
}
|
|
18
|
+
export type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData, TPageParam> = {
|
|
19
|
+
input: (pageParam: TPageParam) => TInput;
|
|
20
|
+
} & (Record<never, never> extends TClientContext ? {
|
|
20
21
|
context?: TClientContext;
|
|
21
22
|
} : {
|
|
22
23
|
context: TClientContext;
|
|
23
|
-
}) &
|
|
24
|
-
export
|
|
24
|
+
}) & SetOptional<UseInfiniteQueryOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
|
|
25
|
+
export interface InfiniteOptionsBase<TOutput, TError extends Error, TPageParam> {
|
|
26
|
+
queryKey: QueryKey;
|
|
27
|
+
queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
|
|
28
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
29
|
+
}
|
|
30
|
+
export type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> = (Record<never, never> extends TClientContext ? {
|
|
25
31
|
context?: TClientContext;
|
|
26
32
|
} : {
|
|
27
33
|
context: TClientContext;
|
|
28
|
-
}) & UseMutationOptions<TOutput,
|
|
34
|
+
}) & UseMutationOptions<TOutput, TError, TInput>;
|
|
35
|
+
export interface MutationOptionsBase<TInput, TOutput, TError extends Error> {
|
|
36
|
+
mutationKey: QueryKey;
|
|
37
|
+
mutationFn(input: TInput): Promise<TOutput>;
|
|
38
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
39
|
+
}
|
|
29
40
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.fea68c1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -34,12 +34,10 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@tanstack/react-query": ">=5.59.0",
|
|
36
36
|
"react": ">=18.3.0",
|
|
37
|
-
"@orpc/client": "0.0.0-next.
|
|
38
|
-
"@orpc/contract": "0.0.0-next.fd1db03",
|
|
39
|
-
"@orpc/server": "0.0.0-next.fd1db03"
|
|
37
|
+
"@orpc/client": "0.0.0-next.fea68c1"
|
|
40
38
|
},
|
|
41
39
|
"dependencies": {
|
|
42
|
-
"@orpc/shared": "0.0.0-next.
|
|
40
|
+
"@orpc/shared": "0.0.0-next.fea68c1"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
43
|
"zod": "^3.24.1"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ProcedureClient } from '@orpc/server';
|
|
2
|
-
import type { IsEqual } from '@orpc/shared';
|
|
3
|
-
import type { QueryFunctionContext, QueryKey } from '@tanstack/react-query';
|
|
4
|
-
import type { InferCursor, InfiniteOptions, MutationOptions, QueryOptions } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Utils at procedure level
|
|
7
|
-
*/
|
|
8
|
-
export interface ProcedureUtils<TInput, TOutput, TClientContext> {
|
|
9
|
-
queryOptions: <U extends QueryOptions<TInput, TOutput, TClientContext, any>>(...opts: [options: U] | (undefined extends TInput & TClientContext ? [] : never)) => IsEqual<U, QueryOptions<TInput, TOutput, TClientContext, any>> extends true ? {
|
|
10
|
-
queryKey: QueryKey;
|
|
11
|
-
queryFn: (ctx: QueryFunctionContext) => Promise<TOutput>;
|
|
12
|
-
} : Omit<{
|
|
13
|
-
queryKey: QueryKey;
|
|
14
|
-
queryFn: (ctx: QueryFunctionContext) => Promise<TOutput>;
|
|
15
|
-
}, keyof U> & U;
|
|
16
|
-
infiniteOptions: <U extends InfiniteOptions<TInput, TOutput, TClientContext, any>>(options: U) => Omit<{
|
|
17
|
-
queryKey: QueryKey;
|
|
18
|
-
queryFn: (ctx: QueryFunctionContext<QueryKey, InferCursor<TInput>>) => Promise<TOutput>;
|
|
19
|
-
initialPageParam: undefined;
|
|
20
|
-
}, keyof U> & U;
|
|
21
|
-
mutationOptions: <U extends MutationOptions<TInput, TOutput, TClientContext>>(...opt: [options: U] | (undefined extends TClientContext ? [] : never)) => IsEqual<U, MutationOptions<TInput, TOutput, TClientContext>> extends true ? {
|
|
22
|
-
mutationKey: QueryKey;
|
|
23
|
-
mutationFn: (input: TInput) => Promise<TOutput>;
|
|
24
|
-
} : Omit<{
|
|
25
|
-
mutationKey: QueryKey;
|
|
26
|
-
mutationFn: (input: TInput) => Promise<TOutput>;
|
|
27
|
-
}, keyof U> & U;
|
|
28
|
-
}
|
|
29
|
-
export declare function createProcedureUtils<TInput, TOutput, TClientContext>(client: ProcedureClient<TInput, TOutput, TClientContext>, path: string[]): ProcedureUtils<TInput, TOutput, TClientContext>;
|
|
30
|
-
//# sourceMappingURL=utils-procedure.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ProcedureClient, RouterClient } from '@orpc/server';
|
|
2
|
-
import { type GeneralUtils } from './utils-general';
|
|
3
|
-
import { type ProcedureUtils } from './utils-procedure';
|
|
4
|
-
export type RouterUtils<T extends RouterClient<any, any>> = T extends ProcedureClient<infer TInput, infer TOutput, infer TClientContext> ? ProcedureUtils<TInput, TOutput, TClientContext> & GeneralUtils<TInput> : {
|
|
5
|
-
[K in keyof T]: T[K] extends RouterClient<any, any> ? RouterUtils<T[K]> : never;
|
|
6
|
-
} & GeneralUtils<unknown>;
|
|
7
|
-
/**
|
|
8
|
-
* @param client - The client create form `@orpc/client`
|
|
9
|
-
* @param path - The base path for query key
|
|
10
|
-
*/
|
|
11
|
-
export declare function createRouterUtils<T extends RouterClient<any, any>>(client: T, path?: string[]): RouterUtils<T>;
|
|
12
|
-
//# sourceMappingURL=utils-router.d.ts.map
|