@orpc/solid-query 0.0.0-next.ee89076 → 0.0.0-next.f01f7b1
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 +6 -3
- package/dist/index.d.mts +8 -22
- package/dist/index.d.ts +8 -22
- package/dist/index.mjs +1 -22
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/unnoq/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
45
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
46
49
|
|
|
47
50
|
## Packages
|
|
48
51
|
|
|
@@ -63,7 +66,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
63
66
|
|
|
64
67
|
## `@orpc/solid-query`
|
|
65
68
|
|
|
66
|
-
Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview). Read the [documentation](https://orpc.
|
|
69
|
+
Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview). Read the [documentation](https://orpc.dev/docs/integrations/tanstack-query-old/solid) for more information.
|
|
67
70
|
|
|
68
71
|
```ts
|
|
69
72
|
export function Example() {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
2
|
import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
|
|
3
3
|
export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
|
4
|
-
import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext,
|
|
4
|
+
import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext, SolidInfiniteQueryOptions, SolidMutationOptions, InfiniteData } from '@tanstack/solid-query';
|
|
5
5
|
import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ interface GeneralUtils<TInput> {
|
|
|
11
11
|
/**
|
|
12
12
|
* Generate a query/mutation key for checking status, invalidate, set, get, etc.
|
|
13
13
|
*
|
|
14
|
-
* @see {@link https://orpc.
|
|
14
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
15
15
|
*/
|
|
16
16
|
key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
|
|
17
17
|
}
|
|
@@ -33,13 +33,6 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
|
33
33
|
retryDelay?: (count: number, error: TError) => number;
|
|
34
34
|
enabled?: boolean;
|
|
35
35
|
}
|
|
36
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
|
37
|
-
type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
|
38
|
-
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
|
39
|
-
queryFnOptions?: experimental_StreamedQueryOptions;
|
|
40
|
-
};
|
|
41
|
-
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
|
42
|
-
}
|
|
43
36
|
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = {
|
|
44
37
|
input: ((pageParam: TPageParam) => TInput) | SkipToken;
|
|
45
38
|
} & (Record<never, never> extends TClientContext ? {
|
|
@@ -65,32 +58,25 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
|
65
58
|
/**
|
|
66
59
|
* Calling corresponding procedure client
|
|
67
60
|
*
|
|
68
|
-
* @see {@link https://orpc.
|
|
61
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
|
|
69
62
|
*/
|
|
70
63
|
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
71
64
|
/**
|
|
72
65
|
* Generate options used for createQuery/prefetchQuery/...
|
|
73
66
|
*
|
|
74
|
-
* @see {@link https://orpc.
|
|
67
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
|
|
75
68
|
*/
|
|
76
69
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
77
|
-
/**
|
|
78
|
-
* Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
|
|
79
|
-
* Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
|
|
80
|
-
*
|
|
81
|
-
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
|
|
82
|
-
*/
|
|
83
|
-
experimental_streamedOptions<U, USelectData = experimental_InferStreamedOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_InferStreamedOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_InferStreamedOutput<TOutput>, TError>, keyof U>>;
|
|
84
70
|
/**
|
|
85
71
|
* Generate options used for createInfiniteQuery/prefetchInfiniteQuery/...
|
|
86
72
|
*
|
|
87
|
-
* @see {@link https://orpc.
|
|
73
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
|
|
88
74
|
*/
|
|
89
75
|
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>>;
|
|
90
76
|
/**
|
|
91
77
|
* Generate options used for createMutation/...
|
|
92
78
|
*
|
|
93
|
-
* @see {@link https://orpc.
|
|
79
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
|
|
94
80
|
*/
|
|
95
81
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
|
|
96
82
|
}
|
|
@@ -109,9 +95,9 @@ interface CreateRouterUtilsOptions {
|
|
|
109
95
|
* Create a router utils from a client.
|
|
110
96
|
*
|
|
111
97
|
* @info Both client-side and server-side clients are supported.
|
|
112
|
-
* @see {@link https://orpc.
|
|
98
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/solid Tanstack Query Solid Docs}
|
|
113
99
|
*/
|
|
114
100
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
115
101
|
|
|
116
102
|
export { createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
|
|
117
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils
|
|
103
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
2
|
import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
|
|
3
3
|
export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
|
4
|
-
import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext,
|
|
4
|
+
import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext, SolidInfiniteQueryOptions, SolidMutationOptions, InfiniteData } from '@tanstack/solid-query';
|
|
5
5
|
import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ interface GeneralUtils<TInput> {
|
|
|
11
11
|
/**
|
|
12
12
|
* Generate a query/mutation key for checking status, invalidate, set, get, etc.
|
|
13
13
|
*
|
|
14
|
-
* @see {@link https://orpc.
|
|
14
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
15
15
|
*/
|
|
16
16
|
key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
|
|
17
17
|
}
|
|
@@ -33,13 +33,6 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
|
33
33
|
retryDelay?: (count: number, error: TError) => number;
|
|
34
34
|
enabled?: boolean;
|
|
35
35
|
}
|
|
36
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
|
37
|
-
type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
|
38
|
-
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
|
39
|
-
queryFnOptions?: experimental_StreamedQueryOptions;
|
|
40
|
-
};
|
|
41
|
-
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
|
42
|
-
}
|
|
43
36
|
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = {
|
|
44
37
|
input: ((pageParam: TPageParam) => TInput) | SkipToken;
|
|
45
38
|
} & (Record<never, never> extends TClientContext ? {
|
|
@@ -65,32 +58,25 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
|
65
58
|
/**
|
|
66
59
|
* Calling corresponding procedure client
|
|
67
60
|
*
|
|
68
|
-
* @see {@link https://orpc.
|
|
61
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
|
|
69
62
|
*/
|
|
70
63
|
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
71
64
|
/**
|
|
72
65
|
* Generate options used for createQuery/prefetchQuery/...
|
|
73
66
|
*
|
|
74
|
-
* @see {@link https://orpc.
|
|
67
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
|
|
75
68
|
*/
|
|
76
69
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
77
|
-
/**
|
|
78
|
-
* Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
|
|
79
|
-
* Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
|
|
80
|
-
*
|
|
81
|
-
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
|
|
82
|
-
*/
|
|
83
|
-
experimental_streamedOptions<U, USelectData = experimental_InferStreamedOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_InferStreamedOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_InferStreamedOutput<TOutput>, TError>, keyof U>>;
|
|
84
70
|
/**
|
|
85
71
|
* Generate options used for createInfiniteQuery/prefetchInfiniteQuery/...
|
|
86
72
|
*
|
|
87
|
-
* @see {@link https://orpc.
|
|
73
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
|
|
88
74
|
*/
|
|
89
75
|
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>>;
|
|
90
76
|
/**
|
|
91
77
|
* Generate options used for createMutation/...
|
|
92
78
|
*
|
|
93
|
-
* @see {@link https://orpc.
|
|
79
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
|
|
94
80
|
*/
|
|
95
81
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
|
|
96
82
|
}
|
|
@@ -109,9 +95,9 @@ interface CreateRouterUtilsOptions {
|
|
|
109
95
|
* Create a router utils from a client.
|
|
110
96
|
*
|
|
111
97
|
* @info Both client-side and server-side clients are supported.
|
|
112
|
-
* @see {@link https://orpc.
|
|
98
|
+
* @see {@link https://orpc.dev/docs/integrations/tanstack-query-old/solid Tanstack Query Solid Docs}
|
|
113
99
|
*/
|
|
114
100
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
115
101
|
|
|
116
102
|
export { createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
|
|
117
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils
|
|
103
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { generateOperationKey } from '@orpc/tanstack-query';
|
|
2
2
|
export { generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
|
3
|
-
import {
|
|
4
|
-
import { skipToken, experimental_streamedQuery } from '@tanstack/solid-query';
|
|
3
|
+
import { skipToken } from '@tanstack/solid-query';
|
|
5
4
|
|
|
6
5
|
function createGeneralUtils(path) {
|
|
7
6
|
return {
|
|
@@ -27,26 +26,6 @@ function createProcedureUtils(client, options) {
|
|
|
27
26
|
...optionsIn
|
|
28
27
|
};
|
|
29
28
|
},
|
|
30
|
-
experimental_streamedOptions(...[optionsIn = {}]) {
|
|
31
|
-
return {
|
|
32
|
-
queryKey: generateOperationKey(options.path, { type: "streamed", input: optionsIn.input, fnOptions: optionsIn.queryFnOptions }),
|
|
33
|
-
queryFn: experimental_streamedQuery({
|
|
34
|
-
queryFn: async ({ signal }) => {
|
|
35
|
-
if (optionsIn.input === skipToken) {
|
|
36
|
-
throw new Error("queryFn should not be called with skipToken used as input");
|
|
37
|
-
}
|
|
38
|
-
const output = await client(optionsIn.input, { signal, context: optionsIn.context });
|
|
39
|
-
if (!isAsyncIteratorObject(output)) {
|
|
40
|
-
throw new Error("streamedQuery requires an event iterator output");
|
|
41
|
-
}
|
|
42
|
-
return output;
|
|
43
|
-
},
|
|
44
|
-
...optionsIn.queryFnOptions
|
|
45
|
-
}),
|
|
46
|
-
...optionsIn.input === skipToken ? { enabled: false } : {},
|
|
47
|
-
...optionsIn
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
29
|
infiniteOptions(optionsIn) {
|
|
51
30
|
return {
|
|
52
31
|
queryKey: generateOperationKey(options.path, {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/solid-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.f01f7b1",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/unnoq/orpc.git",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@tanstack/solid-query": ">=5.80.2",
|
|
31
31
|
"solid-js": ">=1.9.0",
|
|
32
|
-
"@orpc/client": "0.0.0-next.
|
|
32
|
+
"@orpc/client": "0.0.0-next.f01f7b1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@orpc/shared": "0.0.0-next.
|
|
36
|
-
"@orpc/tanstack-query": "0.0.0-next.
|
|
35
|
+
"@orpc/shared": "0.0.0-next.f01f7b1",
|
|
36
|
+
"@orpc/tanstack-query": "0.0.0-next.f01f7b1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tanstack/solid-query": "^5.
|
|
40
|
-
"zod": "^4.1.
|
|
39
|
+
"@tanstack/solid-query": "^5.90.13",
|
|
40
|
+
"zod": "^4.1.12"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|