@srpc.org/react-query 0.20.3 → 0.20.4
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 +11 -11
- package/dist/context.d.ts +6 -6
- package/dist/context.js +5 -5
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @srpc/react-query
|
|
1
|
+
# @srpc.org/react-query
|
|
2
2
|
|
|
3
3
|
React Query integration for SRPC - Type-safe RPC with automatic React Query hooks and query/mutation options generation.
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ React Query integration for SRPC - Type-safe RPC with automatic React Query hook
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Using JSR (recommended)
|
|
9
|
-
deno add @srpc/react-query
|
|
10
|
-
npx jsr add @srpc/react-query
|
|
11
|
-
yarn dlx jsr add @srpc/react-query
|
|
12
|
-
pnpm dlx jsr add @srpc/react-query
|
|
13
|
-
bunx jsr add @srpc/react-query
|
|
9
|
+
deno add @srpc.org/react-query
|
|
10
|
+
npx jsr add @srpc.org/react-query
|
|
11
|
+
yarn dlx jsr add @srpc.org/react-query
|
|
12
|
+
pnpm dlx jsr add @srpc.org/react-query
|
|
13
|
+
bunx jsr add @srpc.org/react-query
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Features
|
|
@@ -25,7 +25,7 @@ bunx jsr add @srpc/react-query
|
|
|
25
25
|
## Prerequisites
|
|
26
26
|
|
|
27
27
|
This package requires:
|
|
28
|
-
- `@srpc/core` - The core SRPC framework
|
|
28
|
+
- `@srpc.org/core` - The core SRPC framework
|
|
29
29
|
- `@tanstack/react-query` v5.90 or higher
|
|
30
30
|
- `react` v19 or higher
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ This package requires:
|
|
|
35
35
|
|
|
36
36
|
```typescript
|
|
37
37
|
// server/router.ts
|
|
38
|
-
import { initSRPC } from "@srpc/core/server";
|
|
38
|
+
import { initSRPC } from "@srpc.org/core/server";
|
|
39
39
|
|
|
40
40
|
const s = initSRPC();
|
|
41
41
|
|
|
@@ -60,7 +60,7 @@ export type AppRouter = typeof appRouter;
|
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
// lib/rpc.ts
|
|
63
|
-
import { createSRPCClient } from "@srpc/core/client";
|
|
63
|
+
import { createSRPCClient } from "@srpc.org/core/client";
|
|
64
64
|
import { createSRPCContext } from "@srpc.org/react-query";
|
|
65
65
|
import type { AppRouter } from "../server/router";
|
|
66
66
|
|
|
@@ -229,7 +229,7 @@ const postQuery = useQuery(srpc.posts.drafts.list.queryOptions());
|
|
|
229
229
|
If you prefer not to use React Context:
|
|
230
230
|
|
|
231
231
|
```typescript
|
|
232
|
-
import { createSRPCClient } from "@srpc/core/client";
|
|
232
|
+
import { createSRPCClient } from "@srpc.org/core/client";
|
|
233
233
|
import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
234
234
|
import { useQuery } from "@tanstack/react-query";
|
|
235
235
|
import type { AppRouter } from "./server/router";
|
|
@@ -254,7 +254,7 @@ function MyComponent() {
|
|
|
254
254
|
### Custom Serialization
|
|
255
255
|
|
|
256
256
|
```typescript
|
|
257
|
-
import { createSRPCClient } from "@srpc/core/client";
|
|
257
|
+
import { createSRPCClient } from "@srpc.org/core/client";
|
|
258
258
|
import { createSRPCContext } from "@srpc.org/react-query";
|
|
259
259
|
import superjson from "superjson";
|
|
260
260
|
|
package/dist/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SRPC, AnySRPC } from '@srpc/core/server';
|
|
2
|
-
import { AnyRoutes, AnyProcedure, ClientProcedure, DecoratedProcedureRecord } from '@srpc/core/shared';
|
|
1
|
+
import { SRPC, AnySRPC } from '@srpc.org/core/server';
|
|
2
|
+
import { AnyRoutes, AnyProcedure, ClientProcedure, DecoratedProcedureRecord } from '@srpc.org/core/shared';
|
|
3
3
|
import React, { PropsWithChildren } from 'react';
|
|
4
4
|
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
|
14
14
|
*
|
|
15
15
|
* @example Basic usage
|
|
16
16
|
* ```typescript
|
|
17
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
17
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
18
18
|
* import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
19
19
|
* import { useQuery } from "@tanstack/react-query";
|
|
20
20
|
* import type { AppRouter } from "./server";
|
|
@@ -135,8 +135,8 @@ type DecoratedQueryProcedureRecord<TRouter extends AnyRoutes> = {
|
|
|
135
135
|
*
|
|
136
136
|
* @example Complete setup
|
|
137
137
|
* ```typescript
|
|
138
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
139
|
-
* import { createSRPCContext } from "@srpc/react-query/context";
|
|
138
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
139
|
+
* import { createSRPCContext } from "@srpc.org/react-query/context";
|
|
140
140
|
* import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
141
141
|
* import type { AppRouter } from "./server";
|
|
142
142
|
*
|
|
@@ -237,7 +237,7 @@ type SRPCContextFactory<TRouter extends AnySRPC> = {
|
|
|
237
237
|
*
|
|
238
238
|
* @example Basic setup
|
|
239
239
|
* ```typescript
|
|
240
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
240
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
241
241
|
* import { createSRPCContext } from "@srpc.org/react-query";
|
|
242
242
|
* import type { AppRouter } from "./server";
|
|
243
243
|
*
|
package/dist/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
-
import { createRecursiveProxy } from '@srpc/core/shared';
|
|
4
|
+
import { createRecursiveProxy } from '@srpc.org/core/shared';
|
|
5
5
|
import { queryOptions, mutationOptions } from '@tanstack/react-query';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -26,7 +26,7 @@ import { queryOptions, mutationOptions } from '@tanstack/react-query';
|
|
|
26
26
|
*
|
|
27
27
|
* @example Basic usage
|
|
28
28
|
* ```typescript
|
|
29
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
29
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
30
30
|
* import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
31
31
|
* import { useQuery, useMutation } from "@tanstack/react-query";
|
|
32
32
|
* import type { AppRouter } from "./server";
|
|
@@ -118,8 +118,8 @@ import { queryOptions, mutationOptions } from '@tanstack/react-query';
|
|
|
118
118
|
*
|
|
119
119
|
* @example Complete setup
|
|
120
120
|
* ```typescript
|
|
121
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
122
|
-
* import { createSRPCContext } from "@srpc/react-query/context";
|
|
121
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
122
|
+
* import { createSRPCContext } from "@srpc.org/react-query/context";
|
|
123
123
|
* import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
124
124
|
* import type { AppRouter } from "./server";
|
|
125
125
|
*
|
|
@@ -168,7 +168,7 @@ import { queryOptions, mutationOptions } from '@tanstack/react-query';
|
|
|
168
168
|
*
|
|
169
169
|
* @example Basic setup
|
|
170
170
|
* ```typescript
|
|
171
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
171
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
172
172
|
* import { createSRPCContext } from "@srpc.org/react-query";
|
|
173
173
|
* import type { AppRouter } from "./server";
|
|
174
174
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SRPC, AnySRPC } from '@srpc/core/server';
|
|
2
|
-
import { ClientProcedure, AnyRoutes, AnyProcedure, DecoratedProcedureRecord } from '@srpc/core/shared';
|
|
1
|
+
import { SRPC, AnySRPC } from '@srpc.org/core/server';
|
|
2
|
+
import { ClientProcedure, AnyRoutes, AnyProcedure, DecoratedProcedureRecord } from '@srpc.org/core/shared';
|
|
3
3
|
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
4
4
|
export { SRPCContextFactory, SRPCContextValue, createSRPCContext } from './context.js';
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ export { SRPCContextFactory, SRPCContextValue, createSRPCContext } from './conte
|
|
|
14
14
|
*
|
|
15
15
|
* @example Basic usage
|
|
16
16
|
* ```typescript
|
|
17
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
17
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
18
18
|
* import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
19
19
|
* import { useQuery } from "@tanstack/react-query";
|
|
20
20
|
* import type { AppRouter } from "./server";
|
|
@@ -145,7 +145,7 @@ type DecoratedQueryProcedureRecord<TRouter extends AnyRoutes> = {
|
|
|
145
145
|
*
|
|
146
146
|
* @example Basic usage
|
|
147
147
|
* ```typescript
|
|
148
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
148
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
149
149
|
* import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
150
150
|
* import { useQuery, useMutation } from "@tanstack/react-query";
|
|
151
151
|
* import type { AppRouter } from "./server";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRecursiveProxy } from '@srpc/core/shared';
|
|
1
|
+
import { createRecursiveProxy } from '@srpc.org/core/shared';
|
|
2
2
|
import { queryOptions, mutationOptions } from '@tanstack/react-query';
|
|
3
3
|
export { createSRPCContext } from './context.js';
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ export { createSRPCContext } from './context.js';
|
|
|
24
24
|
*
|
|
25
25
|
* @example Basic usage
|
|
26
26
|
* ```typescript
|
|
27
|
-
* import { createSRPCClient } from "@srpc/core/client";
|
|
27
|
+
* import { createSRPCClient } from "@srpc.org/core/client";
|
|
28
28
|
* import { createSRPCQueryOptions } from "@srpc.org/react-query";
|
|
29
29
|
* import { useQuery, useMutation } from "@tanstack/react-query";
|
|
30
30
|
* import type { AppRouter } from "./server";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srpc.org/react-query",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.4",
|
|
4
4
|
"description": "React Query integration for SRPC - Type-safe RPC with automatic React Query hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"get-port-please": "^3.1.2",
|
|
36
36
|
"react": "^19.2.0",
|
|
37
37
|
"vitest": "^4.0.10",
|
|
38
|
-
"@srpc.org/core": "0.20.
|
|
38
|
+
"@srpc.org/core": "0.20.4"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@tanstack/react-query": ">=5.90",
|
|
42
42
|
"react": ">=19",
|
|
43
|
-
"@srpc.org/core": "0.20.
|
|
43
|
+
"@srpc.org/core": "0.20.4"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "bunchee",
|