@orpc/react-query 0.43.0 → 0.45.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/README.md +1 -1
- package/dist/index.d.mts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/{index.js → index.mjs} +3 -14
- package/package.json +7 -12
- package/dist/src/general-utils.d.ts +0 -10
- package/dist/src/index.d.ts +0 -8
- package/dist/src/key.d.ts +0 -9
- package/dist/src/procedure-utils.d.ts +0 -12
- package/dist/src/router-utils.d.ts +0 -12
- package/dist/src/types.d.ts +0 -40
package/README.md
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
+
import { QueryKey, UseQueryOptions, QueryFunctionContext, UseInfiniteQueryOptions, UseMutationOptions, InfiniteData } from '@tanstack/react-query';
|
|
3
|
+
import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
|
+
|
|
5
|
+
type KeyType = 'query' | 'infinite' | 'mutation' | undefined;
|
|
6
|
+
interface BuildKeyOptions<TType extends KeyType, TInput> {
|
|
7
|
+
type?: TType;
|
|
8
|
+
input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
|
|
9
|
+
}
|
|
10
|
+
declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Utils at any level (procedure or router)
|
|
14
|
+
*/
|
|
15
|
+
interface GeneralUtils<TInput> {
|
|
16
|
+
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
17
|
+
}
|
|
18
|
+
declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
19
|
+
|
|
20
|
+
type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData> = (undefined extends TInput ? {
|
|
21
|
+
input?: TInput;
|
|
22
|
+
} : {
|
|
23
|
+
input: TInput;
|
|
24
|
+
}) & (Record<never, never> extends TClientContext ? {
|
|
25
|
+
context?: TClientContext;
|
|
26
|
+
} : {
|
|
27
|
+
context: TClientContext;
|
|
28
|
+
}) & SetOptional<UseQueryOptions<TOutput, TError, TSelectData>, 'queryKey'>;
|
|
29
|
+
interface QueryOptionsBase<TOutput, TError extends Error> {
|
|
30
|
+
queryKey: QueryKey;
|
|
31
|
+
queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
|
|
32
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
33
|
+
}
|
|
34
|
+
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData, TPageParam> = {
|
|
35
|
+
input: (pageParam: TPageParam) => TInput;
|
|
36
|
+
} & (Record<never, never> extends TClientContext ? {
|
|
37
|
+
context?: TClientContext;
|
|
38
|
+
} : {
|
|
39
|
+
context: TClientContext;
|
|
40
|
+
}) & SetOptional<UseInfiniteQueryOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
|
|
41
|
+
interface InfiniteOptionsBase<TOutput, TError extends Error, TPageParam> {
|
|
42
|
+
queryKey: QueryKey;
|
|
43
|
+
queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
|
|
44
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
45
|
+
}
|
|
46
|
+
type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext> = (Record<never, never> extends TClientContext ? {
|
|
47
|
+
context?: TClientContext;
|
|
48
|
+
} : {
|
|
49
|
+
context: TClientContext;
|
|
50
|
+
}) & UseMutationOptions<TOutput, TError, TInput, TMutationContext>;
|
|
51
|
+
interface MutationOptionsBase<TInput, TOutput, TError extends Error> {
|
|
52
|
+
mutationKey: QueryKey;
|
|
53
|
+
mutationFn(input: TInput): Promise<TOutput>;
|
|
54
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
|
|
58
|
+
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
59
|
+
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
60
|
+
infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput, UPageParam>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & Omit<InfiniteOptionsBase<TOutput, TError, UPageParam>, keyof U>>;
|
|
61
|
+
mutationOptions<U, UMutationContext>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<U & Omit<MutationOptionsBase<TInput, TOutput, TError>, keyof U>>;
|
|
62
|
+
}
|
|
63
|
+
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
64
|
+
|
|
65
|
+
type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
|
66
|
+
[K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
|
|
67
|
+
} & GeneralUtils<unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* @param client - Any kind of oRPC clients: `createRouterClient`, `createORPCClient`, ...
|
|
70
|
+
* @param path - The base path for query key, when it it will be prefix to all keys
|
|
71
|
+
*/
|
|
72
|
+
declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?: string[]): RouterUtils<T>;
|
|
73
|
+
|
|
74
|
+
declare const createORPCReactQueryUtils: typeof createRouterUtils;
|
|
75
|
+
|
|
76
|
+
export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MutationOptionsBase, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCReactQueryUtils, createProcedureUtils, createRouterUtils };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
+
import { QueryKey, UseQueryOptions, QueryFunctionContext, UseInfiniteQueryOptions, UseMutationOptions, InfiniteData } from '@tanstack/react-query';
|
|
3
|
+
import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
|
+
|
|
5
|
+
type KeyType = 'query' | 'infinite' | 'mutation' | undefined;
|
|
6
|
+
interface BuildKeyOptions<TType extends KeyType, TInput> {
|
|
7
|
+
type?: TType;
|
|
8
|
+
input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
|
|
9
|
+
}
|
|
10
|
+
declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Utils at any level (procedure or router)
|
|
14
|
+
*/
|
|
15
|
+
interface GeneralUtils<TInput> {
|
|
16
|
+
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
17
|
+
}
|
|
18
|
+
declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
19
|
+
|
|
20
|
+
type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData> = (undefined extends TInput ? {
|
|
21
|
+
input?: TInput;
|
|
22
|
+
} : {
|
|
23
|
+
input: TInput;
|
|
24
|
+
}) & (Record<never, never> extends TClientContext ? {
|
|
25
|
+
context?: TClientContext;
|
|
26
|
+
} : {
|
|
27
|
+
context: TClientContext;
|
|
28
|
+
}) & SetOptional<UseQueryOptions<TOutput, TError, TSelectData>, 'queryKey'>;
|
|
29
|
+
interface QueryOptionsBase<TOutput, TError extends Error> {
|
|
30
|
+
queryKey: QueryKey;
|
|
31
|
+
queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
|
|
32
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
33
|
+
}
|
|
34
|
+
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TSelectData, TPageParam> = {
|
|
35
|
+
input: (pageParam: TPageParam) => TInput;
|
|
36
|
+
} & (Record<never, never> extends TClientContext ? {
|
|
37
|
+
context?: TClientContext;
|
|
38
|
+
} : {
|
|
39
|
+
context: TClientContext;
|
|
40
|
+
}) & SetOptional<UseInfiniteQueryOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
|
|
41
|
+
interface InfiniteOptionsBase<TOutput, TError extends Error, TPageParam> {
|
|
42
|
+
queryKey: QueryKey;
|
|
43
|
+
queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
|
|
44
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
45
|
+
}
|
|
46
|
+
type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError extends Error, TMutationContext> = (Record<never, never> extends TClientContext ? {
|
|
47
|
+
context?: TClientContext;
|
|
48
|
+
} : {
|
|
49
|
+
context: TClientContext;
|
|
50
|
+
}) & UseMutationOptions<TOutput, TError, TInput, TMutationContext>;
|
|
51
|
+
interface MutationOptionsBase<TInput, TOutput, TError extends Error> {
|
|
52
|
+
mutationKey: QueryKey;
|
|
53
|
+
mutationFn(input: TInput): Promise<TOutput>;
|
|
54
|
+
retry?(failureCount: number, error: TError): boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
|
|
58
|
+
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
59
|
+
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
60
|
+
infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput, UPageParam>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & Omit<InfiniteOptionsBase<TOutput, TError, UPageParam>, keyof U>>;
|
|
61
|
+
mutationOptions<U, UMutationContext>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<U & Omit<MutationOptionsBase<TInput, TOutput, TError>, keyof U>>;
|
|
62
|
+
}
|
|
63
|
+
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
64
|
+
|
|
65
|
+
type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
|
66
|
+
[K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
|
|
67
|
+
} & GeneralUtils<unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* @param client - Any kind of oRPC clients: `createRouterClient`, `createORPCClient`, ...
|
|
70
|
+
* @param path - The base path for query key, when it it will be prefix to all keys
|
|
71
|
+
*/
|
|
72
|
+
declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?: string[]): RouterUtils<T>;
|
|
73
|
+
|
|
74
|
+
declare const createORPCReactQueryUtils: typeof createRouterUtils;
|
|
75
|
+
|
|
76
|
+
export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MutationOptionsBase, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCReactQueryUtils, createProcedureUtils, createRouterUtils };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/key.ts
|
|
2
1
|
function buildKey(path, options) {
|
|
3
2
|
const withInput = options?.input !== void 0 ? { input: options?.input } : {};
|
|
4
3
|
const withType = options?.type !== void 0 ? { type: options?.type } : {};
|
|
@@ -8,7 +7,6 @@ function buildKey(path, options) {
|
|
|
8
7
|
}];
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
// src/general-utils.ts
|
|
12
10
|
function createGeneralUtils(path) {
|
|
13
11
|
return {
|
|
14
12
|
key(options) {
|
|
@@ -17,7 +15,6 @@ function createGeneralUtils(path) {
|
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
// src/procedure-utils.ts
|
|
21
18
|
function createProcedureUtils(client, path) {
|
|
22
19
|
return {
|
|
23
20
|
call: client,
|
|
@@ -47,7 +44,6 @@ function createProcedureUtils(client, path) {
|
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
// src/router-utils.ts
|
|
51
47
|
function createRouterUtils(client, path = []) {
|
|
52
48
|
const generalUtils = createGeneralUtils(path);
|
|
53
49
|
const procedureUtils = createProcedureUtils(client, path);
|
|
@@ -74,13 +70,6 @@ function createRouterUtils(client, path = []) {
|
|
|
74
70
|
return recursive;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
buildKey,
|
|
81
|
-
createGeneralUtils,
|
|
82
|
-
createORPCReactQueryUtils,
|
|
83
|
-
createProcedureUtils,
|
|
84
|
-
createRouterUtils
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=index.js.map
|
|
73
|
+
const createORPCReactQueryUtils = createRouterUtils;
|
|
74
|
+
|
|
75
|
+
export { buildKey, createGeneralUtils, createORPCReactQueryUtils, createProcedureUtils, createRouterUtils };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -18,32 +18,27 @@
|
|
|
18
18
|
],
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"types": "./dist/
|
|
22
|
-
"import": "./dist/index.
|
|
23
|
-
"default": "./dist/index.
|
|
24
|
-
},
|
|
25
|
-
"./🔒/*": {
|
|
26
|
-
"types": "./dist/src/*.d.ts"
|
|
21
|
+
"types": "./dist/index.d.mts",
|
|
22
|
+
"import": "./dist/index.mjs",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
27
24
|
}
|
|
28
25
|
},
|
|
29
26
|
"files": [
|
|
30
|
-
"!**/*.map",
|
|
31
|
-
"!**/*.tsbuildinfo",
|
|
32
27
|
"dist"
|
|
33
28
|
],
|
|
34
29
|
"peerDependencies": {
|
|
35
30
|
"@tanstack/react-query": ">=5.59.0",
|
|
36
31
|
"react": ">=18.3.0",
|
|
37
|
-
"@orpc/client": "0.
|
|
32
|
+
"@orpc/client": "0.45.0"
|
|
38
33
|
},
|
|
39
34
|
"dependencies": {
|
|
40
|
-
"@orpc/shared": "0.
|
|
35
|
+
"@orpc/shared": "0.45.0"
|
|
41
36
|
},
|
|
42
37
|
"devDependencies": {
|
|
43
38
|
"zod": "^3.24.1"
|
|
44
39
|
},
|
|
45
40
|
"scripts": {
|
|
46
|
-
"build": "
|
|
41
|
+
"build": "unbuild",
|
|
47
42
|
"build:watch": "pnpm run build --watch",
|
|
48
43
|
"type:check": "tsc -b"
|
|
49
44
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import type { BuildKeyOptions, KeyType } from './key';
|
|
3
|
-
/**
|
|
4
|
-
* Utils at any level (procedure or router)
|
|
5
|
-
*/
|
|
6
|
-
export interface GeneralUtils<TInput> {
|
|
7
|
-
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
8
|
-
}
|
|
9
|
-
export declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
10
|
-
//# sourceMappingURL=general-utils.d.ts.map
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRouterUtils } from './router-utils';
|
|
2
|
-
export * from './general-utils';
|
|
3
|
-
export * from './key';
|
|
4
|
-
export * from './procedure-utils';
|
|
5
|
-
export * from './router-utils';
|
|
6
|
-
export * from './types';
|
|
7
|
-
export declare const createORPCReactQueryUtils: typeof createRouterUtils;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/key.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PartialDeep } from '@orpc/shared';
|
|
2
|
-
import type { QueryKey } from '@tanstack/react-query';
|
|
3
|
-
export type KeyType = 'query' | 'infinite' | 'mutation' | undefined;
|
|
4
|
-
export interface BuildKeyOptions<TType extends KeyType, TInput> {
|
|
5
|
-
type?: TType;
|
|
6
|
-
input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
|
|
7
|
-
}
|
|
8
|
-
export declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
|
|
9
|
-
//# sourceMappingURL=key.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1,12 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ClientContext } from '@orpc/client';
|
|
2
|
-
import type { SetOptional } from '@orpc/shared';
|
|
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 ? {
|
|
5
|
-
input?: TInput;
|
|
6
|
-
} : {
|
|
7
|
-
input: TInput;
|
|
8
|
-
}) & (Record<never, never> extends TClientContext ? {
|
|
9
|
-
context?: TClientContext;
|
|
10
|
-
} : {
|
|
11
|
-
context: TClientContext;
|
|
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 ? {
|
|
21
|
-
context?: TClientContext;
|
|
22
|
-
} : {
|
|
23
|
-
context: TClientContext;
|
|
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 ? {
|
|
31
|
-
context?: TClientContext;
|
|
32
|
-
} : {
|
|
33
|
-
context: TClientContext;
|
|
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
|
-
}
|
|
40
|
-
//# sourceMappingURL=types.d.ts.map
|