@orpc/react 0.0.0-next-20241120014110 → 0.0.0-next-20241120100614

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/dist/index.js CHANGED
@@ -1,4 +1,11 @@
1
- import { useIsFetching, useIsMutating, useMutationState, useQuery, useInfiniteQuery, useSuspenseQuery, useSuspenseInfiniteQuery, usePrefetchQuery, usePrefetchInfiniteQuery, useMutation, useQueries } from "@tanstack/react-query";
1
+ // src/general-hooks.ts
2
+ import {
3
+ useIsFetching,
4
+ useIsMutating,
5
+ useMutationState
6
+ } from "@tanstack/react-query";
7
+
8
+ // src/react-context.ts
2
9
  import { createContext, useContext } from "react";
3
10
  function createORPCContext() {
4
11
  return createContext(void 0);
@@ -12,10 +19,14 @@ function useORPCContext(context) {
12
19
  }
13
20
  return value;
14
21
  }
15
- const orpcPathSymbol = Symbol("orpcPathSymbol");
22
+
23
+ // src/orpc-path.ts
24
+ var orpcPathSymbol = Symbol("orpcPathSymbol");
25
+
26
+ // src/tanstack-key.ts
16
27
  function getQueryKeyFromPath(path, options) {
17
- const withInput = (options == null ? void 0 : options.input) !== void 0 ? { input: options == null ? void 0 : options.input } : {};
18
- const withType = (options == null ? void 0 : options.type) !== void 0 ? { type: options == null ? void 0 : options.type } : {};
28
+ const withInput = options?.input !== void 0 ? { input: options?.input } : {};
29
+ const withType = options?.type !== void 0 ? { type: options?.type } : {};
19
30
  return [
20
31
  path,
21
32
  {
@@ -27,6 +38,8 @@ function getQueryKeyFromPath(path, options) {
27
38
  function getMutationKeyFromPath(path) {
28
39
  return [path];
29
40
  }
41
+
42
+ // src/general-hooks.ts
30
43
  function createGeneralHooks(options) {
31
44
  return {
32
45
  useIsFetching(filters) {
@@ -57,7 +70,7 @@ function createGeneralHooks(options) {
57
70
  ...options_,
58
71
  filters: {
59
72
  mutationKey: getMutationKeyFromPath(options.path),
60
- ...options_ == null ? void 0 : options_.filters
73
+ ...options_?.filters
61
74
  }
62
75
  },
63
76
  context.queryClient
@@ -65,6 +78,8 @@ function createGeneralHooks(options) {
65
78
  }
66
79
  };
67
80
  }
81
+
82
+ // src/general-utils.ts
68
83
  function createGeneralUtils(options) {
69
84
  return {
70
85
  getQueriesData(filters) {
@@ -192,24 +207,24 @@ function createGeneralUtils(options) {
192
207
  },
193
208
  getQueryDefaults(filters) {
194
209
  return options.queryClient.getQueryDefaults(
195
- (filters == null ? void 0 : filters.queryKey) ?? getQueryKeyFromPath(options.path, {
196
- input: filters == null ? void 0 : filters.input,
210
+ filters?.queryKey ?? getQueryKeyFromPath(options.path, {
211
+ input: filters?.input,
197
212
  type: "query"
198
213
  })
199
214
  );
200
215
  },
201
216
  getInfiniteQueryDefaults(filters) {
202
217
  return options.queryClient.getQueryDefaults(
203
- (filters == null ? void 0 : filters.queryKey) ?? getQueryKeyFromPath(options.path, {
204
- input: filters == null ? void 0 : filters.input,
218
+ filters?.queryKey ?? getQueryKeyFromPath(options.path, {
219
+ input: filters?.input,
205
220
  type: "infinite"
206
221
  })
207
222
  );
208
223
  },
209
224
  setQueryDefaults(options_, filters) {
210
225
  return options.queryClient.setQueryDefaults(
211
- (filters == null ? void 0 : filters.queryKey) ?? getQueryKeyFromPath(options.path, {
212
- input: filters == null ? void 0 : filters.input,
226
+ filters?.queryKey ?? getQueryKeyFromPath(options.path, {
227
+ input: filters?.input,
213
228
  type: "query"
214
229
  }),
215
230
  options_
@@ -217,8 +232,8 @@ function createGeneralUtils(options) {
217
232
  },
218
233
  setInfiniteQueryDefaults(options_, filters) {
219
234
  return options.queryClient.setQueryDefaults(
220
- (filters == null ? void 0 : filters.queryKey) ?? getQueryKeyFromPath(options.path, {
221
- input: filters == null ? void 0 : filters.input,
235
+ filters?.queryKey ?? getQueryKeyFromPath(options.path, {
236
+ input: filters?.input,
222
237
  type: "infinite"
223
238
  }),
224
239
  options_
@@ -226,33 +241,31 @@ function createGeneralUtils(options) {
226
241
  },
227
242
  getMutationDefaults(filters) {
228
243
  return options.queryClient.getMutationDefaults(
229
- (filters == null ? void 0 : filters.mutationKey) ?? getMutationKeyFromPath(options.path)
244
+ filters?.mutationKey ?? getMutationKeyFromPath(options.path)
230
245
  );
231
246
  },
232
247
  setMutationDefaults(options_, filters) {
233
248
  return options.queryClient.setMutationDefaults(
234
- (filters == null ? void 0 : filters.mutationKey) ?? getMutationKeyFromPath(options.path),
249
+ filters?.mutationKey ?? getMutationKeyFromPath(options.path),
235
250
  options_
236
251
  );
237
252
  }
238
253
  };
239
254
  }
240
- function get(root, segments) {
241
- const ref = { root };
242
- let currentRef = ref;
243
- let preSegment = "root";
244
- for (const segment of segments) {
245
- if (typeof currentRef !== "object" && typeof currentRef !== "function" || currentRef === null) {
246
- return void 0;
247
- }
248
- currentRef = currentRef[preSegment];
249
- preSegment = segment;
250
- }
251
- if (typeof currentRef !== "object" && typeof currentRef !== "function" || currentRef === null) {
252
- return void 0;
253
- }
254
- return currentRef[preSegment];
255
- }
255
+
256
+ // src/procedure-hooks.ts
257
+ import {
258
+ get
259
+ } from "@orpc/shared";
260
+ import {
261
+ useInfiniteQuery,
262
+ useMutation,
263
+ usePrefetchInfiniteQuery,
264
+ usePrefetchQuery,
265
+ useQuery,
266
+ useSuspenseInfiniteQuery,
267
+ useSuspenseQuery
268
+ } from "@tanstack/react-query";
256
269
  function createProcedureHooks(options) {
257
270
  return {
258
271
  [orpcPathSymbol]: options.path,
@@ -354,6 +367,8 @@ function createProcedureHooks(options) {
354
367
  }
355
368
  };
356
369
  }
370
+
371
+ // src/procedure-utils.ts
357
372
  function createProcedureUtils(options) {
358
373
  return {
359
374
  fetchQuery(input, options_) {
@@ -476,6 +491,8 @@ function createProcedureUtils(options) {
476
491
  }
477
492
  };
478
493
  }
494
+
495
+ // src/react-hooks.ts
479
496
  function createORPCHooks(options) {
480
497
  const path = options.path ?? [];
481
498
  const generalHooks = createGeneralHooks({ context: options.context, path });
@@ -511,6 +528,8 @@ function createORPCHooks(options) {
511
528
  }
512
529
  );
513
530
  }
531
+
532
+ // src/react-utils.ts
514
533
  function createORPCUtils(options) {
515
534
  const path = options.path ?? [];
516
535
  const client = options.contextValue.client;
@@ -554,6 +573,13 @@ function createORPCUtils(options) {
554
573
  }
555
574
  );
556
575
  }
576
+
577
+ // src/use-queries/hook.ts
578
+ import {
579
+ useQueries
580
+ } from "@tanstack/react-query";
581
+
582
+ // src/use-queries/builder.ts
557
583
  function createUseQueriesBuilder(options) {
558
584
  return (input, options_) => {
559
585
  return {
@@ -563,6 +589,8 @@ function createUseQueriesBuilder(options) {
563
589
  };
564
590
  };
565
591
  }
592
+
593
+ // src/use-queries/builders.ts
566
594
  function createUseQueriesBuilders(options) {
567
595
  const path = options.path ?? [];
568
596
  const client = options.client;
@@ -588,6 +616,8 @@ function createUseQueriesBuilders(options) {
588
616
  }
589
617
  });
590
618
  }
619
+
620
+ // src/use-queries/hook.ts
591
621
  function useQueriesFactory(options) {
592
622
  const hook = (build, combine) => {
593
623
  const orpc = useORPCContext(options.context);
@@ -599,6 +629,8 @@ function useQueriesFactory(options) {
599
629
  };
600
630
  return hook;
601
631
  }
632
+
633
+ // src/react.tsx
602
634
  function createORPCReact() {
603
635
  const Context = createORPCContext();
604
636
  const useContext2 = () => useORPCContext(Context);
@@ -639,3 +671,4 @@ export {
639
671
  createProcedureUtils,
640
672
  useORPCContext
641
673
  };
674
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/general-hooks.ts","../src/react-context.ts","../src/orpc-path.ts","../src/tanstack-key.ts","../src/general-utils.ts","../src/procedure-hooks.ts","../src/procedure-utils.ts","../src/react-hooks.ts","../src/react-utils.ts","../src/use-queries/hook.ts","../src/use-queries/builder.ts","../src/use-queries/builders.ts","../src/react.tsx"],"sourcesContent":["import type { Schema, SchemaInput, SchemaOutput } from '@orpc/contract'\nimport type { PartialDeep, SetOptional } from '@orpc/shared'\nimport {\n type DefaultError,\n type Mutation,\n type MutationFilters,\n type MutationState,\n useIsFetching,\n useIsMutating,\n useMutationState,\n} from '@tanstack/react-query'\nimport { type ORPCContext, useORPCContext } from './react-context'\nimport { getMutationKeyFromPath, getQueryKeyFromPath } from './tanstack-key'\nimport type { ORPCQueryFilters } from './tanstack-query'\n\nexport interface GeneralHooks<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n useIsFetching(\n filers?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n ): number\n useIsMutating(filters?: SetOptional<MutationFilters, 'mutationKey'>): number\n\n useMutationState<\n UResult = MutationState<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >,\n >(options?: {\n filters?: SetOptional<MutationFilters, 'mutationKey'>\n select?: (\n mutation: Mutation<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >,\n ) => UResult\n }): UResult[]\n}\n\nexport interface CreateGeneralHooksOptions {\n context: ORPCContext<any>\n\n /**\n * The path of the router or procedure on server.\n *\n * @internal\n */\n path: string[]\n}\n\nexport function createGeneralHooks<\n TInputSchema extends Schema = undefined,\n TOutputSchema extends Schema = undefined,\n THandlerOutput extends\n SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,\n>(\n options: CreateGeneralHooksOptions,\n): GeneralHooks<TInputSchema, TOutputSchema, THandlerOutput> {\n return {\n useIsFetching(filters) {\n const { queryType, input, ...rest } = filters ?? {}\n const context = useORPCContext(options.context)\n return useIsFetching(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n },\n context.queryClient,\n )\n },\n useIsMutating(filters) {\n const context = useORPCContext(options.context)\n return useIsMutating(\n { mutationKey: getMutationKeyFromPath(options.path), ...filters },\n context.queryClient,\n )\n },\n\n useMutationState(options_) {\n const context = useORPCContext(options.context)\n return useMutationState(\n {\n ...(options_ as any),\n filters: {\n mutationKey: getMutationKeyFromPath(options.path),\n ...options_?.filters,\n },\n },\n context.queryClient,\n )\n },\n }\n}\n","import type {\n RouterClientWithContractRouter,\n RouterClientWithRouter,\n} from '@orpc/client'\nimport type { ContractRouter } from '@orpc/contract'\nimport type { Router } from '@orpc/server'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { type Context, createContext, useContext } from 'react'\n\nexport interface ORPCContextValue<\n TRouter extends ContractRouter | Router<any>,\n> {\n client: TRouter extends ContractRouter\n ? RouterClientWithContractRouter<TRouter>\n : TRouter extends Router<any>\n ? RouterClientWithRouter<TRouter>\n : never\n queryClient: QueryClient\n}\n\nexport type ORPCContext<TRouter extends ContractRouter | Router<any>> = Context<\n ORPCContextValue<TRouter> | undefined\n>\n\nexport function createORPCContext<\n TRouter extends ContractRouter | Router<any>,\n>(): ORPCContext<TRouter> {\n return createContext(undefined as any)\n}\n\nexport function useORPCContext<TRouter extends ContractRouter | Router<any>>(\n context: ORPCContext<TRouter>,\n): ORPCContextValue<TRouter> {\n const value = useContext(context)\n\n if (!value) {\n throw new Error(\n 'useORPCContext must be used within a <ORPCContext.Provider>, please see the docs',\n )\n }\n\n return value\n}\n","import type { ProcedureHooks } from './procedure-hooks'\nimport type {\n ORPCHooksWithContractRouter,\n ORPCHooksWithRouter,\n} from './react-hooks'\n\nexport const orpcPathSymbol = Symbol('orpcPathSymbol')\n\nexport function getORPCPath(\n orpc:\n | ORPCHooksWithContractRouter<any>\n | ORPCHooksWithRouter<any>\n | ProcedureHooks<any, any, any>,\n): string[] {\n const val = Reflect.get(orpc, orpcPathSymbol)\n\n if (!Array.isArray(val)) {\n throw new Error(\n 'orpcPathSymbol is not implemented, please use getORPCPath with correct instance.',\n )\n }\n\n return val\n}\n","import type { SchemaInput } from '@orpc/contract'\nimport type { PartialDeep } from '@orpc/shared'\nimport type { MutationKey, QueryKey } from '@tanstack/react-query'\nimport { getORPCPath } from './orpc-path'\nimport type { ProcedureHooks } from './procedure-hooks'\nimport type {\n ORPCHooksWithContractRouter,\n ORPCHooksWithRouter,\n} from './react-hooks'\n\nexport type QueryType = 'query' | 'infinite' | undefined\n\nexport interface GetQueryKeyOptions<TInput> {\n input?: TInput\n type?: QueryType\n}\n\nexport function getQueryKey<\n T extends\n | ORPCHooksWithContractRouter<any>\n | ORPCHooksWithRouter<any>\n | ProcedureHooks<any, any, any>,\n>(\n orpc: T,\n options?: GetQueryKeyOptions<\n T extends ProcedureHooks<infer UInputSchema, any, any>\n ? PartialDeep<SchemaInput<UInputSchema>>\n : unknown\n >,\n): QueryKey {\n const path = getORPCPath(orpc)\n return getQueryKeyFromPath(path, options)\n}\n\nexport function getQueryKeyFromPath(\n path: string[],\n options?: GetQueryKeyOptions<unknown>,\n): QueryKey {\n const withInput =\n options?.input !== undefined ? { input: options?.input } : {}\n const withType = options?.type !== undefined ? { type: options?.type } : {}\n\n return [\n path,\n {\n ...withInput,\n ...withType,\n },\n ]\n}\n\nexport function getMutationKey<\n T extends\n | ORPCHooksWithContractRouter<any>\n | ORPCHooksWithRouter<any>\n | ProcedureHooks<any, any, any>,\n>(orpc: T): MutationKey {\n const path = getORPCPath(orpc)\n return getMutationKeyFromPath(path)\n}\n\nexport function getMutationKeyFromPath(path: string[]): MutationKey {\n return [path]\n}\n","import type { Schema, SchemaInput, SchemaOutput } from '@orpc/contract'\nimport type { PartialDeep, SetOptional } from '@orpc/shared'\nimport type {\n CancelOptions,\n DefaultError,\n InfiniteData,\n InvalidateOptions,\n MutationFilters,\n MutationObserverOptions,\n OmitKeyof,\n QueryClient,\n QueryKey,\n QueryObserverOptions,\n RefetchOptions,\n ResetOptions,\n SetDataOptions,\n Updater,\n} from '@tanstack/react-query'\nimport { getMutationKeyFromPath, getQueryKeyFromPath } from './tanstack-key'\nimport type {\n ORPCInvalidateQueryFilters,\n ORPCQueryFilters,\n} from './tanstack-query'\nimport type { SchemaInputForInfiniteQuery } from './types'\n\nexport interface GeneralUtils<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n getQueriesData(\n filters?: OmitKeyof<\n ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n 'queryType'\n >,\n ): [QueryKey, SchemaOutput<TOutputSchema, THandlerOutput> | undefined][]\n getInfiniteQueriesData(\n filters?: OmitKeyof<\n ORPCQueryFilters<PartialDeep<SchemaInputForInfiniteQuery<TInputSchema>>>,\n 'queryType'\n >,\n ): [\n QueryKey,\n (\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n ),\n ][]\n\n setQueriesData(\n filters: OmitKeyof<\n ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n 'queryType'\n >,\n updater: Updater<\n SchemaOutput<TOutputSchema, THandlerOutput> | undefined,\n SchemaOutput<TOutputSchema, THandlerOutput> | undefined\n >,\n options?: SetDataOptions,\n ): [QueryKey, SchemaOutput<TOutputSchema, THandlerOutput> | undefined][]\n setInfiniteQueriesData(\n filters: OmitKeyof<\n ORPCQueryFilters<PartialDeep<SchemaInputForInfiniteQuery<TInputSchema>>>,\n 'queryType'\n >,\n updater: Updater<\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined,\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n >,\n options?: SetDataOptions,\n ): [\n QueryKey,\n (\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n ),\n ][]\n\n invalidate(\n filters?: ORPCInvalidateQueryFilters<\n PartialDeep<SchemaInput<TInputSchema>>\n >,\n options?: InvalidateOptions,\n ): Promise<void>\n refetch(\n filters?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n options?: RefetchOptions,\n ): Promise<void>\n cancel(\n filters?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n options?: CancelOptions,\n ): Promise<void>\n remove(\n filters?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n ): void\n reset(\n filters?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n options?: ResetOptions,\n ): Promise<void>\n\n isFetching(\n filters?: ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n ): number\n isMutating(filters?: SetOptional<MutationFilters, 'mutationKey'>): number\n\n getQueryDefaults(\n filters?: Pick<\n ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n 'input' | 'queryKey'\n >,\n ): OmitKeyof<\n QueryObserverOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryKey'\n >\n getInfiniteQueryDefaults(\n filters?: Pick<\n ORPCQueryFilters<PartialDeep<SchemaInputForInfiniteQuery<TInputSchema>>>,\n 'input' | 'queryKey'\n >,\n ): OmitKeyof<\n QueryObserverOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n InfiniteData<SchemaOutput<TOutputSchema, THandlerOutput>>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey'\n >\n\n setQueryDefaults(\n options: Partial<\n OmitKeyof<\n QueryObserverOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryKey'\n >\n >,\n filters?: Pick<\n ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n 'input' | 'queryKey'\n >,\n ): void\n setInfiniteQueryDefaults(\n options: Partial<\n OmitKeyof<\n QueryObserverOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n InfiniteData<SchemaOutput<TOutputSchema, THandlerOutput>>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey'\n >\n >,\n filters?: Pick<\n ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,\n 'input' | 'queryKey'\n >,\n ): void\n\n getMutationDefaults: (\n filters?: Pick<MutationFilters, 'mutationKey'>,\n ) => MutationObserverOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >\n setMutationDefaults: (\n options: OmitKeyof<\n MutationObserverOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >,\n 'mutationKey'\n >,\n filters?: Pick<MutationFilters, 'mutationKey'>,\n ) => void\n}\n\nexport interface CreateGeneralUtilsOptions {\n queryClient: QueryClient\n\n /**\n * The path of the router or procedure on server.\n *\n * @internal\n */\n path: string[]\n}\n\nexport function createGeneralUtils<\n TInputSchema extends Schema = undefined,\n TOutputSchema extends Schema = undefined,\n THandlerOutput extends\n SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,\n>(\n options: CreateGeneralUtilsOptions,\n): GeneralUtils<TInputSchema, TOutputSchema, THandlerOutput> {\n return {\n getQueriesData(filters) {\n const { input, ...rest } = filters ?? {}\n return options.queryClient.getQueriesData({\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n ...rest,\n }) as any\n },\n getInfiniteQueriesData(filters) {\n const { input, ...rest } = filters ?? {}\n return options.queryClient.getQueriesData({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n ...rest,\n }) as any\n },\n\n setQueriesData(filters, updater, options_) {\n const { input, ...rest } = filters\n return options.queryClient.setQueriesData(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n ...rest,\n },\n updater,\n options_,\n ) as any\n },\n setInfiniteQueriesData(filters, updater, options_) {\n const { input, ...rest } = filters\n return options.queryClient.setQueriesData(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n ...rest,\n },\n updater,\n options_,\n ) as any\n },\n\n invalidate(filters, options_) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.invalidateQueries(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n },\n options_,\n )\n },\n refetch(filters, options_) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.refetchQueries(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n },\n options_,\n )\n },\n cancel(filters, options_) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.cancelQueries(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n },\n options_,\n )\n },\n remove(filters) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.removeQueries({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n })\n },\n reset(filters, options_) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.resetQueries(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n },\n options_,\n )\n },\n\n isFetching(filters) {\n const { input, queryType, ...rest } = filters ?? {}\n return options.queryClient.isFetching({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: queryType,\n }),\n ...rest,\n })\n },\n isMutating(filters) {\n return options.queryClient.isMutating({\n mutationKey: getMutationKeyFromPath(options.path),\n ...filters,\n })\n },\n\n getQueryDefaults(filters) {\n return options.queryClient.getQueryDefaults(\n filters?.queryKey ??\n getQueryKeyFromPath(options.path, {\n input: filters?.input,\n type: 'query',\n }),\n )\n },\n getInfiniteQueryDefaults(filters) {\n return options.queryClient.getQueryDefaults(\n filters?.queryKey ??\n getQueryKeyFromPath(options.path, {\n input: filters?.input,\n type: 'infinite',\n }),\n ) as any\n },\n\n setQueryDefaults(options_, filters) {\n return options.queryClient.setQueryDefaults(\n filters?.queryKey ??\n getQueryKeyFromPath(options.path, {\n input: filters?.input,\n type: 'query',\n }),\n options_ as any,\n )\n },\n setInfiniteQueryDefaults(options_, filters) {\n return options.queryClient.setQueryDefaults(\n filters?.queryKey ??\n getQueryKeyFromPath(options.path, {\n input: filters?.input,\n type: 'infinite',\n }),\n options_ as any,\n )\n },\n\n getMutationDefaults(filters) {\n return options.queryClient.getMutationDefaults(\n filters?.mutationKey ?? getMutationKeyFromPath(options.path),\n )\n },\n setMutationDefaults(options_, filters) {\n return options.queryClient.setMutationDefaults(\n filters?.mutationKey ?? getMutationKeyFromPath(options.path),\n options_,\n )\n },\n }\n}\n","import type { Schema, SchemaInput, SchemaOutput } from '@orpc/contract'\nimport {\n type PartialOnUndefinedDeep,\n type SetOptional,\n get,\n} from '@orpc/shared'\nimport {\n type DefaultError,\n type FetchInfiniteQueryOptions,\n type FetchQueryOptions,\n type InfiniteData,\n type QueryKey,\n type UseInfiniteQueryOptions,\n type UseInfiniteQueryResult,\n type UseMutationOptions,\n type UseMutationResult,\n type UseQueryOptions,\n type UseQueryResult,\n type UseSuspenseInfiniteQueryOptions,\n type UseSuspenseInfiniteQueryResult,\n type UseSuspenseQueryOptions,\n type UseSuspenseQueryResult,\n useInfiniteQuery,\n useMutation,\n usePrefetchInfiniteQuery,\n usePrefetchQuery,\n useQuery,\n useSuspenseInfiniteQuery,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { orpcPathSymbol } from './orpc-path'\nimport { type ORPCContext, useORPCContext } from './react-context'\nimport { getMutationKeyFromPath, getQueryKeyFromPath } from './tanstack-key'\nimport type { SchemaInputForInfiniteQuery } from './types'\n\nexport interface ProcedureHooks<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n useQuery<USelectData = SchemaOutput<TOutputSchema, THandlerOutput>>(\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n UseQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n USelectData\n >,\n 'queryFn' | 'queryKey'\n >,\n ): UseQueryResult<USelectData>\n useInfiniteQuery<\n USelectData = InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >,\n >(\n options: PartialOnUndefinedDeep<\n SetOptional<\n UseInfiniteQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n USelectData,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryFn' | 'queryKey'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): UseInfiniteQueryResult<USelectData>\n\n useSuspenseQuery<USelectData = SchemaOutput<TOutputSchema, THandlerOutput>>(\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n UseSuspenseQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n USelectData\n >,\n 'queryFn' | 'queryKey'\n >,\n ): UseSuspenseQueryResult<USelectData>\n useSuspenseInfiniteQuery<\n USelectData = InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >,\n >(\n options: PartialOnUndefinedDeep<\n SetOptional<\n UseSuspenseInfiniteQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n USelectData,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryFn' | 'queryKey'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): UseSuspenseInfiniteQueryResult<USelectData>\n\n usePrefetchQuery(\n input: SchemaInput<TInputSchema>,\n options?: FetchQueryOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n ): void\n usePrefetchInfiniteQuery(\n options: PartialOnUndefinedDeep<\n SetOptional<\n FetchInfiniteQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey' | 'queryFn'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): void\n\n useMutation(\n options?: SetOptional<\n UseMutationOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >,\n 'mutationFn' | 'mutationKey'\n >,\n ): UseMutationResult<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaInput<TInputSchema>\n >\n}\n\nexport interface CreateProcedureHooksOptions {\n context: ORPCContext<any>\n\n /**\n * The path of the procedure on server.\n *\n * @internal\n */\n path: string[]\n}\n\nexport function createProcedureHooks<\n TInputSchema extends Schema = undefined,\n TOutputSchema extends Schema = undefined,\n THandlerOutput extends\n SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,\n>(\n options: CreateProcedureHooksOptions,\n): ProcedureHooks<TInputSchema, TOutputSchema, THandlerOutput> {\n return {\n [orpcPathSymbol as any]: options.path,\n\n useQuery(input, options_) {\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return useQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n queryFn: () => client(input),\n ...options_,\n },\n context.queryClient,\n )\n },\n useInfiniteQuery(options_) {\n const { input, ...rest } = options_\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return useInfiniteQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) =>\n client({ ...(input as any), cursor: pageParam }),\n ...(rest as any),\n },\n context.queryClient,\n )\n },\n\n useSuspenseQuery(input, options_) {\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return useSuspenseQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n queryFn: () => client(input),\n ...options_,\n },\n context.queryClient,\n )\n },\n useSuspenseInfiniteQuery(options_) {\n const { input, ...rest } = options_\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return useSuspenseInfiniteQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) =>\n client({ ...(input as any), cursor: pageParam }),\n ...(rest as any),\n },\n context.queryClient,\n )\n },\n\n usePrefetchQuery(input, options_) {\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return usePrefetchQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n queryFn: () => client(input),\n ...options_,\n },\n context.queryClient,\n )\n },\n usePrefetchInfiniteQuery(options_) {\n const { input, ...rest } = options_\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return usePrefetchInfiniteQuery(\n {\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) =>\n client({ ...(input as any), cursor: pageParam }),\n ...(rest as any),\n },\n context.queryClient,\n )\n },\n\n useMutation(options_) {\n const context = useORPCContext(options.context)\n const client = get(context.client, options.path) as any\n return useMutation(\n {\n mutationKey: getMutationKeyFromPath(options.path),\n mutationFn: (input) => client(input),\n ...options_,\n },\n context.queryClient,\n )\n },\n }\n}\n","import type { ProcedureClient } from '@orpc/client'\nimport type { Schema, SchemaInput, SchemaOutput } from '@orpc/contract'\nimport type { PartialOnUndefinedDeep, SetOptional } from '@orpc/shared'\nimport type {\n DefaultError,\n EnsureInfiniteQueryDataOptions,\n EnsureQueryDataOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryState,\n SetDataOptions,\n Updater,\n} from '@tanstack/react-query'\nimport { getQueryKeyFromPath } from './tanstack-key'\nimport type { SchemaInputForInfiniteQuery } from './types'\n\nexport interface ProcedureUtils<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n fetchQuery(\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n FetchQueryOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryKey' | 'queryFn'\n >,\n ): Promise<SchemaOutput<TOutputSchema, THandlerOutput>>\n fetchInfiniteQuery(\n options: PartialOnUndefinedDeep<\n SetOptional<\n FetchInfiniteQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey' | 'queryFn'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): Promise<\n InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n >\n\n prefetchQuery(\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n FetchQueryOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryKey' | 'queryFn'\n >,\n ): Promise<void>\n prefetchInfiniteQuery(\n options: PartialOnUndefinedDeep<\n SetOptional<\n FetchInfiniteQueryOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey' | 'queryFn'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): Promise<void>\n\n getQueryData(\n input: SchemaInput<TInputSchema>,\n ): SchemaOutput<TOutputSchema, THandlerOutput> | undefined\n getInfiniteQueryData(\n input: SchemaInputForInfiniteQuery<TInputSchema>,\n ):\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n\n ensureQueryData(\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n EnsureQueryDataOptions<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryFn' | 'queryKey'\n >,\n ): Promise<SchemaOutput<TOutputSchema, THandlerOutput>>\n ensureInfiniteQueryData(\n options: PartialOnUndefinedDeep<\n SetOptional<\n EnsureInfiniteQueryDataOptions<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n DefaultError,\n SchemaOutput<TOutputSchema, THandlerOutput>,\n QueryKey,\n SchemaInput<TInputSchema>['cursor']\n >,\n 'queryKey' | 'queryFn'\n > & {\n input: SchemaInputForInfiniteQuery<TInputSchema>\n }\n >,\n ): Promise<\n InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n >\n\n getQueryState(\n input: SchemaInput<TInputSchema>,\n ): QueryState<SchemaOutput<TOutputSchema, THandlerOutput>> | undefined\n getInfiniteQueryState(\n input: SchemaInputForInfiniteQuery<TInputSchema>,\n ):\n | QueryState<\n InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n >\n | undefined\n\n setQueryData(\n input: SchemaInput<TInputSchema>,\n updater: Updater<\n SchemaOutput<TOutputSchema, THandlerOutput> | undefined,\n SchemaOutput<TOutputSchema, THandlerOutput> | undefined\n >,\n options?: SetDataOptions,\n ): SchemaOutput<TOutputSchema, THandlerOutput> | undefined\n setInfiniteQueryData(\n input: SchemaInputForInfiniteQuery<TInputSchema>,\n updater: Updater<\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined,\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n >,\n options?: SetDataOptions,\n ):\n | InfiniteData<\n SchemaOutput<TOutputSchema, THandlerOutput>,\n SchemaInput<TInputSchema>['cursor']\n >\n | undefined\n}\n\nexport interface CreateProcedureUtilsOptions<\n TInputSchema extends Schema = undefined,\n TOutputSchema extends Schema = undefined,\n THandlerOutput extends\n SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,\n> {\n client: ProcedureClient<TInputSchema, TOutputSchema, THandlerOutput>\n queryClient: QueryClient\n\n /**\n * The path of procedure on sever\n */\n path: string[]\n}\n\nexport function createProcedureUtils<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n>(\n options: CreateProcedureUtilsOptions<\n TInputSchema,\n TOutputSchema,\n THandlerOutput\n >,\n): ProcedureUtils<TInputSchema, TOutputSchema, THandlerOutput> {\n return {\n fetchQuery(input, options_) {\n return options.queryClient.fetchQuery({\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n queryFn: () => options.client(input),\n ...options_,\n })\n },\n fetchInfiniteQuery(options_) {\n const { input, ...rest } = options_\n return options.queryClient.fetchInfiniteQuery({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) => {\n return options.client({ ...(input as any), pageParam } as any)\n },\n ...(rest as any),\n })\n },\n\n prefetchQuery(input, options_) {\n return options.queryClient.prefetchQuery({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n queryFn: () => options.client(input),\n ...options_,\n })\n },\n prefetchInfiniteQuery(options_) {\n const { input, ...rest } = options_\n return options.queryClient.prefetchInfiniteQuery({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) => {\n return options.client({ ...(input as any), cursor: pageParam } as any)\n },\n ...(rest as any),\n })\n },\n\n getQueryData(input) {\n return options.queryClient.getQueryData(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n )\n },\n getInfiniteQueryData(input) {\n return options.queryClient.getQueryData(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n )\n },\n\n ensureQueryData(input, options_) {\n return options.queryClient.ensureQueryData({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n queryFn: () => options.client(input),\n ...options_,\n })\n },\n ensureInfiniteQueryData(options_) {\n const { input, ...rest } = options_\n return options.queryClient.ensureInfiniteQueryData({\n queryKey: getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n queryFn: ({ pageParam }) => {\n return options.client({ ...(input as any), pageParam } as any)\n },\n ...(rest as any),\n })\n },\n\n getQueryState(input) {\n return options.queryClient.getQueryState(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n )\n },\n getInfiniteQueryState(input) {\n return options.queryClient.getQueryState(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n )\n },\n\n setQueryData(input, updater, options_) {\n return options.queryClient.setQueryData(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'query',\n }),\n updater,\n options_,\n )\n },\n setInfiniteQueryData(input, updater, options_) {\n return options.queryClient.setQueryData(\n getQueryKeyFromPath(options.path, {\n input,\n type: 'infinite',\n }),\n updater,\n options_,\n )\n },\n }\n}\n","import type {\n ContractProcedure,\n ContractRouter,\n SchemaOutput,\n} from '@orpc/contract'\nimport type { Procedure, Router } from '@orpc/server'\nimport { type GeneralHooks, createGeneralHooks } from './general-hooks'\nimport { orpcPathSymbol } from './orpc-path'\nimport { type ProcedureHooks, createProcedureHooks } from './procedure-hooks'\nimport type { ORPCContext } from './react-context'\n\nexport type ORPCHooksWithContractRouter<TRouter extends ContractRouter> = {\n [K in keyof TRouter]: TRouter[K] extends ContractProcedure<\n infer UInputSchema,\n infer UOutputSchema\n >\n ? ProcedureHooks<UInputSchema, UOutputSchema, SchemaOutput<UOutputSchema>> &\n GeneralHooks<UInputSchema, UOutputSchema, SchemaOutput<UOutputSchema>>\n : TRouter[K] extends ContractRouter\n ? ORPCHooksWithContractRouter<TRouter[K]>\n : never\n} & GeneralHooks<undefined, undefined, unknown>\n\nexport type ORPCHooksWithRouter<TRouter extends Router<any>> = {\n [K in keyof TRouter]: TRouter[K] extends Procedure<\n any,\n any,\n infer UInputSchema,\n infer UOutputSchema,\n infer UHandlerOutput\n >\n ? ProcedureHooks<UInputSchema, UOutputSchema, UHandlerOutput> &\n GeneralHooks<UInputSchema, UOutputSchema, UHandlerOutput>\n : TRouter[K] extends Router<any>\n ? ORPCHooksWithRouter<TRouter[K]>\n : never\n} & GeneralHooks<undefined, undefined, unknown>\n\nexport interface CreateORPCHooksOptions<\n TRouter extends ContractRouter | Router<any>,\n> {\n context: ORPCContext<TRouter>\n\n /**\n * The path of the router.\n *\n * @internal\n */\n path?: string[]\n}\n\nexport function createORPCHooks<TRouter extends ContractRouter | Router<any>>(\n options: CreateORPCHooksOptions<TRouter>,\n): TRouter extends Router<any>\n ? ORPCHooksWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? ORPCHooksWithContractRouter<TRouter>\n : never {\n const path = options.path ?? []\n const generalHooks = createGeneralHooks({ context: options.context, path })\n\n // for sure root is not procedure, so do not it procedure hooks on root\n const procedureHooks = path.length\n ? createProcedureHooks({\n context: options.context,\n path,\n })\n : {}\n\n return new Proxy(\n {\n [orpcPathSymbol]: path,\n\n ...generalHooks,\n ...procedureHooks,\n },\n {\n get(target, key) {\n const value = Reflect.get(target, key)\n\n if (typeof key !== 'string') {\n return value\n }\n\n const nextHooks = createORPCHooks({\n context: options.context,\n path: [...path, key],\n })\n\n if (typeof value !== 'function') {\n return nextHooks\n }\n\n return new Proxy(value, {\n get(_, key) {\n return Reflect.get(nextHooks, key)\n },\n })\n },\n },\n ) as any\n}\n","import type {} from '@orpc/client'\nimport type {\n ContractProcedure,\n ContractRouter,\n SchemaOutput,\n} from '@orpc/contract'\nimport type { Procedure, Router } from '@orpc/server'\nimport { type GeneralUtils, createGeneralUtils } from './general-utils'\nimport { type ProcedureUtils, createProcedureUtils } from './procedure-utils'\nimport type { ORPCContextValue } from './react-context'\n\nexport type ORPCUtilsWithContractRouter<TRouter extends ContractRouter> = {\n [K in keyof TRouter]: TRouter[K] extends ContractProcedure<\n infer UInputSchema,\n infer UOutputSchema\n >\n ? ProcedureUtils<UInputSchema, UOutputSchema, SchemaOutput<UOutputSchema>> &\n GeneralUtils<UInputSchema, UOutputSchema, SchemaOutput<UOutputSchema>>\n : TRouter[K] extends ContractRouter\n ? ORPCUtilsWithContractRouter<TRouter[K]>\n : never\n} & GeneralUtils<undefined, undefined, unknown>\n\nexport type ORPCUtilsWithRouter<TRouter extends Router<any>> = {\n [K in keyof TRouter]: TRouter[K] extends Procedure<\n any,\n any,\n infer UInputSchema,\n infer UOutputSchema,\n infer UHandlerOutput\n >\n ? ProcedureUtils<UInputSchema, UOutputSchema, UHandlerOutput> &\n GeneralUtils<UInputSchema, UOutputSchema, UHandlerOutput>\n : TRouter[K] extends Router<any>\n ? ORPCUtilsWithRouter<TRouter[K]>\n : never\n} & GeneralUtils<undefined, undefined, unknown>\n\nexport interface CreateORPCUtilsOptions<\n TRouter extends ContractRouter | Router<any>,\n> {\n contextValue: ORPCContextValue<TRouter>\n\n /**\n * The path of the router.\n *\n * @internal\n */\n path?: string[]\n}\n\nexport function createORPCUtils<TRouter extends ContractRouter | Router<any>>(\n options: CreateORPCUtilsOptions<TRouter>,\n): TRouter extends Router<any>\n ? ORPCUtilsWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? ORPCUtilsWithContractRouter<TRouter>\n : never {\n const path = options.path ?? []\n const client = options.contextValue.client as any\n\n const generalUtils = createGeneralUtils({\n queryClient: options.contextValue.queryClient,\n path,\n })\n\n // for sure root is not procedure, so do not it procedure utils on root\n const procedureUtils = path.length\n ? createProcedureUtils({\n client,\n queryClient: options.contextValue.queryClient,\n path,\n })\n : {}\n\n return new Proxy(\n {\n ...generalUtils,\n ...procedureUtils,\n },\n {\n get(target, key) {\n const value = Reflect.get(target, key)\n\n if (typeof key !== 'string') {\n return value\n }\n\n const nextUtils = createORPCUtils({\n ...options,\n contextValue: {\n ...options.contextValue,\n client: client[key],\n },\n path: [...path, key],\n })\n\n if (typeof value !== 'function') {\n return nextUtils\n }\n\n return new Proxy(value, {\n get(_, key) {\n return Reflect.get(nextUtils, key)\n },\n })\n },\n },\n ) as any\n}\n","import type { ContractRouter } from '@orpc/contract'\nimport type { Router } from '@orpc/server'\nimport {\n type QueriesOptions,\n type QueriesResults,\n useQueries,\n} from '@tanstack/react-query'\nimport { type ORPCContext, useORPCContext } from '../react-context'\nimport {\n type UseQueriesBuildersWithContractRouter,\n type UseQueriesBuildersWithRouter,\n createUseQueriesBuilders,\n} from './builders'\n\nexport interface UseQueriesWithContractRouter<TRouter extends ContractRouter> {\n <T extends Array<any> = [], TCombinedResult = QueriesResults<T>>(\n build: (\n builders: UseQueriesBuildersWithContractRouter<TRouter>,\n ) => [...QueriesOptions<T>],\n combine?: (result: QueriesResults<T>) => TCombinedResult,\n ): TCombinedResult\n}\n\nexport interface UseQueriesWithRouter<TRouter extends Router<any>> {\n <T extends Array<any> = [], TCombinedResult = QueriesResults<T>>(\n build: (\n builders: UseQueriesBuildersWithRouter<TRouter>,\n ) => [...QueriesOptions<T>],\n combine?: (result: QueriesResults<T>) => TCombinedResult,\n ): TCombinedResult\n}\n\nexport interface UseQueriesFactoryOptions<\n TRouter extends Router<any> | ContractRouter,\n> {\n context: ORPCContext<TRouter>\n}\n\nexport function useQueriesFactory<TRouter extends Router<any> | ContractRouter>(\n options: UseQueriesFactoryOptions<TRouter>,\n): TRouter extends Router<any>\n ? UseQueriesWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? UseQueriesWithContractRouter<TRouter>\n : never {\n const hook = (build: any, combine?: any) => {\n const orpc = useORPCContext(options.context)\n const builders = createUseQueriesBuilders({ client: orpc.client as any })\n\n return useQueries({\n queries: build(builders),\n combine: combine,\n })\n }\n\n return hook as any\n}\n","import type { ProcedureClient } from '@orpc/client'\nimport type { Schema, SchemaInput, SchemaOutput } from '@orpc/contract'\nimport type {} from '@orpc/server'\nimport type { SetOptional } from '@orpc/shared'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesPlaceholderDataFunction,\n QueryKey,\n UseQueryOptions,\n} from '@tanstack/react-query'\nimport { getQueryKeyFromPath } from '../tanstack-key'\n\ntype UseQueryOptionsForUseQueries<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'placeholderData'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\nexport interface UseQueriesBuilder<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n (\n input: SchemaInput<TInputSchema>,\n options?: SetOptional<\n UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema, THandlerOutput>>,\n 'queryFn' | 'queryKey'\n >,\n ): UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema, THandlerOutput>>\n}\n\nexport interface CreateUseQueriesBuilderOptions<\n TInputSchema extends Schema,\n TOutputSchema extends Schema,\n THandlerOutput extends SchemaOutput<TOutputSchema>,\n> {\n client: ProcedureClient<TInputSchema, TOutputSchema, THandlerOutput>\n\n /**\n * The path of procedure on server\n */\n path: string[]\n}\n\nexport function createUseQueriesBuilder<\n TInputSchema extends Schema = undefined,\n TOutputSchema extends Schema = undefined,\n THandlerOutput extends\n SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,\n>(\n options: CreateUseQueriesBuilderOptions<\n TInputSchema,\n TOutputSchema,\n THandlerOutput\n >,\n): UseQueriesBuilder<TInputSchema, TOutputSchema, THandlerOutput> {\n return (input, options_) => {\n return {\n queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),\n queryFn: () => options.client(input),\n ...options_,\n }\n }\n}\n","import type {\n RouterClientWithContractRouter,\n RouterClientWithRouter,\n} from '@orpc/client'\nimport type {\n ContractProcedure,\n ContractRouter,\n SchemaOutput,\n} from '@orpc/contract'\nimport type { Procedure, Router } from '@orpc/server'\nimport type {} from '@tanstack/react-query'\nimport { type UseQueriesBuilder, createUseQueriesBuilder } from './builder'\n\nexport type UseQueriesBuildersWithContractRouter<\n TRouter extends ContractRouter,\n> = {\n [K in keyof TRouter]: TRouter[K] extends ContractProcedure<\n infer UInputSchema,\n infer UOutputSchema\n >\n ? UseQueriesBuilder<\n UInputSchema,\n UOutputSchema,\n SchemaOutput<UOutputSchema>\n >\n : TRouter[K] extends ContractRouter\n ? UseQueriesBuildersWithContractRouter<TRouter[K]>\n : never\n}\n\nexport type UseQueriesBuildersWithRouter<TRouter extends Router<any>> = {\n [K in keyof TRouter]: TRouter[K] extends Procedure<\n any,\n any,\n infer UInputSchema,\n infer UOutputSchema,\n infer UHandlerOutput\n >\n ? UseQueriesBuilder<UInputSchema, UOutputSchema, UHandlerOutput>\n : TRouter[K] extends Router<any>\n ? UseQueriesBuildersWithRouter<TRouter[K]>\n : never\n}\n\nexport interface CreateUseQueriesBuildersOptions<\n TRouter extends Router<any> | ContractRouter,\n> {\n client: TRouter extends Router<any>\n ? RouterClientWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? RouterClientWithContractRouter<TRouter>\n : never\n\n /**\n * The path of router on server\n */\n path?: string[]\n}\n\nexport function createUseQueriesBuilders<\n TRouter extends Router<any> | ContractRouter,\n>(\n options: CreateUseQueriesBuildersOptions<TRouter>,\n): TRouter extends Router<any>\n ? UseQueriesBuildersWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? UseQueriesBuildersWithContractRouter<TRouter>\n : never {\n const path = options.path ?? []\n const client = options.client as any\n\n /**\n * For sure root is not procedure so do not create builder on root\n */\n const builder = path.length ? createUseQueriesBuilder({ client, path }) : {}\n\n return new Proxy(builder, {\n get(target, key) {\n const value = Reflect.get(target, key)\n\n if (typeof key !== 'string') {\n return value\n }\n\n const nextBuilders = createUseQueriesBuilders({\n client: client[key],\n path: [...path, key],\n })\n\n if (typeof value !== 'function') {\n return nextBuilders\n }\n\n return new Proxy(value, {\n get(_, key) {\n return Reflect.get(nextBuilders, key)\n },\n })\n },\n }) as any\n}\n","import type { ContractRouter } from '@orpc/contract'\nimport type { Router } from '@orpc/server'\nimport {\n type ORPCContext,\n type ORPCContextValue,\n createORPCContext,\n useORPCContext,\n} from './react-context'\nimport {\n type ORPCHooksWithContractRouter,\n type ORPCHooksWithRouter,\n createORPCHooks,\n} from './react-hooks'\nimport {\n type ORPCUtilsWithContractRouter,\n type ORPCUtilsWithRouter,\n createORPCUtils,\n} from './react-utils'\nimport {\n type UseQueriesWithContractRouter,\n type UseQueriesWithRouter,\n useQueriesFactory,\n} from './use-queries/hook'\n\nexport type ORPCReactWithContractRouter<TRouter extends ContractRouter> =\n ORPCHooksWithContractRouter<TRouter> & {\n useContext: () => ORPCContextValue<TRouter>\n useUtils: () => ORPCUtilsWithContractRouter<TRouter>\n useQueries: UseQueriesWithContractRouter<TRouter>\n }\n\nexport type ORPCReactWithRouter<TRouter extends Router<any>> =\n ORPCHooksWithRouter<TRouter> & {\n useContext: () => ORPCContextValue<TRouter>\n useUtils: () => ORPCUtilsWithRouter<TRouter>\n useQueries: UseQueriesWithRouter<TRouter>\n }\n\nexport function createORPCReact<\n TRouter extends ContractRouter | Router<any>,\n>(): {\n orpc: TRouter extends Router<any>\n ? ORPCReactWithRouter<TRouter>\n : TRouter extends ContractRouter\n ? ORPCReactWithContractRouter<TRouter>\n : never\n ORPCContext: ORPCContext<TRouter>\n} {\n const Context = createORPCContext<TRouter>()\n const useContext = () => useORPCContext(Context)\n const useUtils = () => createORPCUtils({ contextValue: useContext() })\n const useQueries = useQueriesFactory({ context: Context })\n const hooks = createORPCHooks({ context: Context })\n\n const orpc = new Proxy(\n {\n useContext,\n useUtils,\n useQueries,\n },\n {\n get(target, key) {\n const value = Reflect.get(target, key)\n const nextHooks = Reflect.get(hooks, key)\n\n if (typeof value !== 'function') {\n return nextHooks\n }\n\n return new Proxy(value, {\n get(_, key) {\n return Reflect.get(nextHooks, key)\n },\n })\n },\n },\n )\n\n return { orpc: orpc as any, ORPCContext: Context }\n}\n"],"mappings":";AAEA;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACHP,SAAuB,eAAe,kBAAkB;AAiBjD,SAAS,oBAEU;AACxB,SAAO,cA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;AAEA,SAAO;AACT;;;AGlBO,SAAS,kBASd;AACA,QAAM,UAAU,kBAA2B;AAC3C,QAAMC,cAAa,MAAM,eAAe,OAAO;AAC/C,QAAM,WAAW,MAAM,gBAAgB,EAAE,cAAcA,YAAW,EAAE,CAAC;AACrE,QAAMC,cAAa,kBAAkB,EAAE,SAAS,QAAQ,CAAC;AACzD,QAAM,QAAQ,gBAAgB,EAAE,SAAS,QAAQ,CAAC;AAElD,QAAM,OAAO,IAAI;AAAA,IACf;AAAA,MACE,YAAAD;AAAA,MACA;AAAA,MACA,YAAAC;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI,QAAQ,KAAK;AACf,cAAM,QAAQ,QAAQ,IAAI,QAAQ,GAAG;AACrC,cAAM,YAAY,QAAQ,IAAI,OAAO,GAAG;AAExC,YAAI,OAAO,UAAU,YAAY;AAC/B,iBAAO;AAAA,QACT;AAEA,eAAO,IAAI,MAAM,OAAO;AAAA,UACtB,IAAI,GAAGC,MAAK;AACV,mBAAO,QAAQ,IAAI,WAAWA,IAAG;AAAA,UACnC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,MAAmB,aAAa,QAAQ;AACnD;","names":["key","key","key","useContext","useQueries","key"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/react",
3
3
  "type": "module",
4
- "version": "0.0.0-next-20241120014110",
4
+ "version": "0.0.0-next-20241120100614",
5
5
  "author": {
6
6
  "name": "unnoq",
7
7
  "email": "contact@unnoq.com",
@@ -35,14 +35,14 @@
35
35
  "src"
36
36
  ],
37
37
  "dependencies": {
38
- "@orpc/client": "0.0.0-next-20241120014110",
39
- "@orpc/shared": "0.0.4"
38
+ "@orpc/client": "0.0.0-next-20241120100614",
39
+ "@orpc/shared": "0.0.0-next-20241120100614"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tanstack/react-query": "^5.59.9",
43
43
  "react": "^18.3.1",
44
- "@orpc/contract": "0.0.3",
45
- "@orpc/server": "0.0.0-next-20241120014110"
44
+ "@orpc/contract": "0.0.0-next-20241120100614",
45
+ "@orpc/server": "0.0.0-next-20241120100614"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@tanstack/react-query": "^5.59.9",
@@ -50,7 +50,8 @@
50
50
  "zod": "^3.23.8"
51
51
  },
52
52
  "scripts": {
53
- "build": "UNPLUGIN_ON_SUCCESS='tsc -b --noCheck' vite build",
53
+ "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
54
+ "build:watch": "pnpm run build --watch",
54
55
  "type:check": "tsc -b"
55
56
  }
56
57
  }