@orpc/solid-query 0.0.0-next.fb0d07c → 0.0.0-next.fc1ae52

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 CHANGED
@@ -30,7 +30,8 @@
30
30
  - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
31
  - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
32
  - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
- - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
33
+ - **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
34
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
34
35
  - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
36
  - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
37
  - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
@@ -38,7 +39,6 @@
38
39
  - **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
39
40
  - **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
40
41
  - **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
41
- - **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
42
42
 
43
43
  ## Documentation
44
44
 
@@ -49,21 +49,21 @@ You can find the full documentation [here](https://orpc.unnoq.com).
49
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
- - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
52
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
53
+ - [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
54
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
53
55
  - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
54
- - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
55
- - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
56
- - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
57
- - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
56
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
57
+ - [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
58
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.
59
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
60
60
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
61
  - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
62
  - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
63
63
 
64
64
  ## `@orpc/solid-query`
65
65
 
66
- Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview). Read the [documentation](https://orpc.unnoq.com/docs/tanstack-query/solid) for more information.
66
+ Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview). Read the [documentation](https://orpc.unnoq.com/docs/integrations/tanstack-query-old/solid) for more information.
67
67
 
68
68
  ```ts
69
69
  export function Example() {
package/dist/index.d.mts CHANGED
@@ -1,13 +1,8 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
3
+ export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
2
4
  import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext, experimental_streamedQuery, SolidInfiniteQueryOptions, SolidMutationOptions, InfiniteData } from '@tanstack/solid-query';
3
- import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
-
5
- type KeyType = 'query' | 'streamed' | '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;
5
+ import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
11
6
 
12
7
  /**
13
8
  * Utils at any level (procedure or router)
@@ -16,9 +11,9 @@ interface GeneralUtils<TInput> {
16
11
  /**
17
12
  * Generate a query/mutation key for checking status, invalidate, set, get, etc.
18
13
  *
19
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
14
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
20
15
  */
21
- key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
16
+ key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
22
17
  }
23
18
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
24
19
 
@@ -35,11 +30,14 @@ interface QueryOptionsBase<TOutput, TError> {
35
30
  queryKey: QueryKey;
36
31
  queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
37
32
  throwOnError?(error: TError): boolean;
38
- enabled: boolean;
33
+ retryDelay?: (count: number, error: TError) => number;
34
+ enabled?: boolean;
39
35
  }
40
- type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0]['refetchMode'], 'queryFn'>;
36
+ type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
41
37
  type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
42
- type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & experimental_StreamedQueryOptions;
38
+ type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
39
+ queryFnOptions?: experimental_StreamedQueryOptions;
40
+ };
43
41
  interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
44
42
  }
45
43
  type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = {
@@ -48,12 +46,13 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
48
46
  context?: TClientContext;
49
47
  } : {
50
48
  context: TClientContext;
51
- }) & SetOptional<SolidInfiniteQueryOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
49
+ }) & SetOptional<SolidInfiniteQueryOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey'>;
52
50
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
53
51
  queryKey: QueryKey;
54
52
  queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
55
53
  throwOnError?(error: TError): boolean;
56
- enabled: boolean;
54
+ retryDelay?: (count: number, error: TError) => number;
55
+ enabled?: boolean;
57
56
  }
58
57
  type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
59
58
  context?: TClientContext;
@@ -66,32 +65,32 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
66
65
  /**
67
66
  * Calling corresponding procedure client
68
67
  *
69
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
68
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
70
69
  */
71
70
  call: Client<TClientContext, TInput, TOutput, TError>;
72
71
  /**
73
72
  * Generate options used for createQuery/prefetchQuery/...
74
73
  *
75
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
74
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
76
75
  */
77
76
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
78
77
  /**
79
78
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
80
79
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
81
80
  *
82
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
81
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
83
82
  */
84
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>>;
85
84
  /**
86
85
  * Generate options used for createInfiniteQuery/prefetchInfiniteQuery/...
87
86
  *
88
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
87
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
89
88
  */
90
89
  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>>;
91
90
  /**
92
91
  * Generate options used for createMutation/...
93
92
  *
94
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
93
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
95
94
  */
96
95
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
97
96
  }
@@ -110,9 +109,9 @@ interface CreateRouterUtilsOptions {
110
109
  * Create a router utils from a client.
111
110
  *
112
111
  * @info Both client-side and server-side clients are supported.
113
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/solid Tanstack Query Solid Docs}
112
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/solid Tanstack Query Solid Docs}
114
113
  */
115
114
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
116
115
 
117
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
118
- export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
116
+ export { createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
117
+ export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
3
+ export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
2
4
  import { QueryKey, SkipToken, SolidQueryOptions, QueryFunctionContext, experimental_streamedQuery, SolidInfiniteQueryOptions, SolidMutationOptions, InfiniteData } from '@tanstack/solid-query';
3
- import { PartialDeep, SetOptional, MaybeOptionalOptions } from '@orpc/shared';
4
-
5
- type KeyType = 'query' | 'streamed' | '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;
5
+ import { SetOptional, MaybeOptionalOptions } from '@orpc/shared';
11
6
 
12
7
  /**
13
8
  * Utils at any level (procedure or router)
@@ -16,9 +11,9 @@ interface GeneralUtils<TInput> {
16
11
  /**
17
12
  * Generate a query/mutation key for checking status, invalidate, set, get, etc.
18
13
  *
19
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
14
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
20
15
  */
21
- key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
16
+ key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
22
17
  }
23
18
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
24
19
 
@@ -35,11 +30,14 @@ interface QueryOptionsBase<TOutput, TError> {
35
30
  queryKey: QueryKey;
36
31
  queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
37
32
  throwOnError?(error: TError): boolean;
38
- enabled: boolean;
33
+ retryDelay?: (count: number, error: TError) => number;
34
+ enabled?: boolean;
39
35
  }
40
- type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0]['refetchMode'], 'queryFn'>;
36
+ type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
41
37
  type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
42
- type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & experimental_StreamedQueryOptions;
38
+ type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
39
+ queryFnOptions?: experimental_StreamedQueryOptions;
40
+ };
43
41
  interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
44
42
  }
45
43
  type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = {
@@ -48,12 +46,13 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
48
46
  context?: TClientContext;
49
47
  } : {
50
48
  context: TClientContext;
51
- }) & SetOptional<SolidInfiniteQueryOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
49
+ }) & SetOptional<SolidInfiniteQueryOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey'>;
52
50
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
53
51
  queryKey: QueryKey;
54
52
  queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
55
53
  throwOnError?(error: TError): boolean;
56
- enabled: boolean;
54
+ retryDelay?: (count: number, error: TError) => number;
55
+ enabled?: boolean;
57
56
  }
58
57
  type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
59
58
  context?: TClientContext;
@@ -66,32 +65,32 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
66
65
  /**
67
66
  * Calling corresponding procedure client
68
67
  *
69
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
68
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
70
69
  */
71
70
  call: Client<TClientContext, TInput, TOutput, TError>;
72
71
  /**
73
72
  * Generate options used for createQuery/prefetchQuery/...
74
73
  *
75
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
74
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
76
75
  */
77
76
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
78
77
  /**
79
78
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
80
79
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
81
80
  *
82
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
81
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
83
82
  */
84
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>>;
85
84
  /**
86
85
  * Generate options used for createInfiniteQuery/prefetchInfiniteQuery/...
87
86
  *
88
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
87
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
89
88
  */
90
89
  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>>;
91
90
  /**
92
91
  * Generate options used for createMutation/...
93
92
  *
94
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
93
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
95
94
  */
96
95
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
97
96
  }
@@ -110,9 +109,9 @@ interface CreateRouterUtilsOptions {
110
109
  * Create a router utils from a client.
111
110
  *
112
111
  * @info Both client-side and server-side clients are supported.
113
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/solid Tanstack Query Solid Docs}
112
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/solid Tanstack Query Solid Docs}
114
113
  */
115
114
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
116
115
 
117
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
118
- export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
116
+ export { createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
117
+ export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
package/dist/index.mjs CHANGED
@@ -1,19 +1,12 @@
1
+ import { generateOperationKey } from '@orpc/tanstack-query';
2
+ export { generateOperationKey as buildKey } from '@orpc/tanstack-query';
1
3
  import { isAsyncIteratorObject } from '@orpc/shared';
2
4
  import { skipToken, experimental_streamedQuery } from '@tanstack/solid-query';
3
5
 
4
- function buildKey(path, options) {
5
- const withInput = options?.input !== void 0 ? { input: options?.input } : {};
6
- const withType = options?.type !== void 0 ? { type: options?.type } : {};
7
- return [path, {
8
- ...withInput,
9
- ...withType
10
- }];
11
- }
12
-
13
6
  function createGeneralUtils(path) {
14
7
  return {
15
8
  key(options) {
16
- return buildKey(path, options);
9
+ return generateOperationKey(path, options);
17
10
  }
18
11
  };
19
12
  }
@@ -23,23 +16,21 @@ function createProcedureUtils(client, options) {
23
16
  call: client,
24
17
  queryOptions(...[optionsIn = {}]) {
25
18
  return {
26
- queryKey: buildKey(options.path, { type: "query", input: optionsIn.input }),
19
+ queryKey: generateOperationKey(options.path, { type: "query", input: optionsIn.input }),
27
20
  queryFn: ({ signal }) => {
28
21
  if (optionsIn.input === skipToken) {
29
22
  throw new Error("queryFn should not be called with skipToken used as input");
30
23
  }
31
24
  return client(optionsIn.input, { signal, context: optionsIn.context });
32
25
  },
33
- enabled: optionsIn.input !== skipToken,
26
+ ...optionsIn.input === skipToken ? { enabled: false } : {},
34
27
  ...optionsIn
35
28
  };
36
29
  },
37
30
  experimental_streamedOptions(...[optionsIn = {}]) {
38
31
  return {
39
- enabled: optionsIn.input !== skipToken,
40
- queryKey: buildKey(options.path, { type: "streamed", input: optionsIn.input }),
32
+ queryKey: generateOperationKey(options.path, { type: "streamed", input: optionsIn.input, fnOptions: optionsIn.queryFnOptions }),
41
33
  queryFn: experimental_streamedQuery({
42
- ...optionsIn,
43
34
  queryFn: async ({ signal }) => {
44
35
  if (optionsIn.input === skipToken) {
45
36
  throw new Error("queryFn should not be called with skipToken used as input");
@@ -49,14 +40,16 @@ function createProcedureUtils(client, options) {
49
40
  throw new Error("streamedQuery requires an event iterator output");
50
41
  }
51
42
  return output;
52
- }
43
+ },
44
+ ...optionsIn.queryFnOptions
53
45
  }),
46
+ ...optionsIn.input === skipToken ? { enabled: false } : {},
54
47
  ...optionsIn
55
48
  };
56
49
  },
57
50
  infiniteOptions(optionsIn) {
58
51
  return {
59
- queryKey: buildKey(options.path, {
52
+ queryKey: generateOperationKey(options.path, {
60
53
  type: "infinite",
61
54
  input: optionsIn.input === skipToken ? skipToken : optionsIn.input(optionsIn.initialPageParam)
62
55
  }),
@@ -66,13 +59,13 @@ function createProcedureUtils(client, options) {
66
59
  }
67
60
  return client(optionsIn.input(pageParam), { signal, context: optionsIn.context });
68
61
  },
69
- enabled: optionsIn.input !== skipToken,
62
+ ...optionsIn.input === skipToken ? { enabled: false } : {},
70
63
  ...optionsIn
71
64
  };
72
65
  },
73
66
  mutationOptions(...[optionsIn = {}]) {
74
67
  return {
75
- mutationKey: buildKey(options.path, { type: "mutation" }),
68
+ mutationKey: generateOperationKey(options.path, { type: "mutation" }),
76
69
  mutationFn: (input) => client(input, { context: optionsIn.context }),
77
70
  ...optionsIn
78
71
  };
@@ -107,4 +100,4 @@ function createRouterUtils(client, options = {}) {
107
100
  return recursive;
108
101
  }
109
102
 
110
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
103
+ export { createGeneralUtils, createRouterUtils as createORPCSolidQueryUtils, createProcedureUtils, createRouterUtils };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/solid-query",
3
3
  "type": "module",
4
- "version": "0.0.0-next.fb0d07c",
4
+ "version": "0.0.0-next.fc1ae52",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -27,16 +27,17 @@
27
27
  "dist"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@tanstack/solid-query": ">=5.55.0",
30
+ "@tanstack/solid-query": ">=5.80.2",
31
31
  "solid-js": ">=1.9.0",
32
- "@orpc/client": "0.0.0-next.fb0d07c"
32
+ "@orpc/client": "0.0.0-next.fc1ae52"
33
33
  },
34
34
  "dependencies": {
35
- "@orpc/shared": "0.0.0-next.fb0d07c"
35
+ "@orpc/tanstack-query": "0.0.0-next.fc1ae52",
36
+ "@orpc/shared": "0.0.0-next.fc1ae52"
36
37
  },
37
38
  "devDependencies": {
38
- "@tanstack/solid-query": "^5.72.3",
39
- "zod": "^3.25.11"
39
+ "@tanstack/solid-query": "^5.85.9",
40
+ "zod": "^4.1.5"
40
41
  },
41
42
  "scripts": {
42
43
  "build": "unbuild",