@rozenite/tanstack-query-plugin 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/devtools/assets/{CXEL7IU7-OLImOSaA.js → CXEL7IU7-DmbowaBr.js} +1 -1
- package/dist/devtools/assets/{tanstack-query-Dk7i2Fss.js → tanstack-query-DRBLkSCy.js} +10 -10
- package/dist/devtools/tanstack-query.html +1 -1
- package/dist/react-native/chunks/useTanStackQueryDevTools.require.cjs +1 -1
- package/dist/react-native/chunks/useTanStackQueryDevTools.require.js +324 -295
- package/dist/rozenite.json +1 -1
- package/dist/sdk/index.cjs +1 -0
- package/dist/sdk/index.d.ts +1939 -0
- package/dist/sdk/index.js +167 -0
- package/package.json +13 -6
- package/sdk.ts +55 -0
- package/src/react-native/agent/__tests__/tanstack-query-agent.test.ts +8 -2
- package/src/react-native/agent/tanstack-query-agent.ts +33 -235
- package/src/react-native/agent/useTanStackQueryAgentTools.ts +39 -65
- package/src/shared/agent-tools.ts +403 -0
- package/tsconfig.json +4 -1
- package/vite.config.ts +7 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { defineAgentToolContract as e, defineAgentToolDescriptors as n } from "@rozenite/agent-shared";
|
|
2
|
+
const i = "@rozenite/tanstack-query-plugin", t = {
|
|
3
|
+
queryHash: {
|
|
4
|
+
type: "string",
|
|
5
|
+
description: "TanStack Query queryHash identifying the query."
|
|
6
|
+
}
|
|
7
|
+
}, o = {
|
|
8
|
+
mutationId: {
|
|
9
|
+
type: "number",
|
|
10
|
+
description: "TanStack Query mutationId identifying the mutation."
|
|
11
|
+
}
|
|
12
|
+
}, a = {
|
|
13
|
+
limit: {
|
|
14
|
+
type: "number",
|
|
15
|
+
description: "Maximum number of items to return. Defaults to 20. Maximum 100."
|
|
16
|
+
},
|
|
17
|
+
cursor: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Opaque pagination cursor from a previous list call."
|
|
20
|
+
}
|
|
21
|
+
}, r = {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {}
|
|
24
|
+
}, u = {
|
|
25
|
+
getCacheSummary: e({
|
|
26
|
+
name: "get-cache-summary",
|
|
27
|
+
description: "Return aggregate TanStack Query cache health and count information.",
|
|
28
|
+
inputSchema: r
|
|
29
|
+
}),
|
|
30
|
+
getOnlineStatus: e({
|
|
31
|
+
name: "get-online-status",
|
|
32
|
+
description: "Return the current TanStack Query onlineManager status.",
|
|
33
|
+
inputSchema: r
|
|
34
|
+
}),
|
|
35
|
+
setOnlineStatus: e({
|
|
36
|
+
name: "set-online-status",
|
|
37
|
+
description: "Set the TanStack Query onlineManager status for testing offline/online behavior.",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
online: {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
description: "Whether the TanStack Query onlineManager should be online."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
required: ["online"]
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
listQueries: e({
|
|
50
|
+
name: "list-queries",
|
|
51
|
+
description: "List TanStack Query query summaries using cursor pagination.",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: a
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
getQueryDetails: e({
|
|
58
|
+
name: "get-query-details",
|
|
59
|
+
description: "Return a JSON-safe TanStack Query query snapshot and observer summary.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: t,
|
|
63
|
+
required: ["queryHash"]
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
refetchQuery: e({
|
|
67
|
+
name: "refetch-query",
|
|
68
|
+
description: "Refetch a TanStack Query query by queryHash.",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: t,
|
|
72
|
+
required: ["queryHash"]
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
setQueryLoading: e({
|
|
76
|
+
name: "set-query-loading",
|
|
77
|
+
description: "Enable or disable TanStack Query loading-state simulation for a query by queryHash.",
|
|
78
|
+
inputSchema: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
...t,
|
|
82
|
+
enabled: {
|
|
83
|
+
type: "boolean",
|
|
84
|
+
description: "Whether the loading-state simulation should be enabled."
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
required: ["queryHash", "enabled"]
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
setQueryError: e({
|
|
91
|
+
name: "set-query-error",
|
|
92
|
+
description: "Enable or disable TanStack Query error-state simulation for a query by queryHash.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
...t,
|
|
97
|
+
enabled: {
|
|
98
|
+
type: "boolean",
|
|
99
|
+
description: "Whether the error-state simulation should be enabled."
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
required: ["queryHash", "enabled"]
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
invalidateQuery: e({
|
|
106
|
+
name: "invalidate-query",
|
|
107
|
+
description: "Invalidate a TanStack Query query by queryHash.",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: t,
|
|
111
|
+
required: ["queryHash"]
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
resetQuery: e({
|
|
115
|
+
name: "reset-query",
|
|
116
|
+
description: "Reset a TanStack Query query by queryHash.",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: t,
|
|
120
|
+
required: ["queryHash"]
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
removeQuery: e({
|
|
124
|
+
name: "remove-query",
|
|
125
|
+
description: "Remove a TanStack Query query from the cache by queryHash.",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: t,
|
|
129
|
+
required: ["queryHash"]
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
clearQueryCache: e({
|
|
133
|
+
name: "clear-query-cache",
|
|
134
|
+
description: "Clear the full TanStack Query query cache.",
|
|
135
|
+
inputSchema: r
|
|
136
|
+
}),
|
|
137
|
+
listMutations: e({
|
|
138
|
+
name: "list-mutations",
|
|
139
|
+
description: "List TanStack Query mutation summaries using cursor pagination.",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: a
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
getMutationDetails: e({
|
|
146
|
+
name: "get-mutation-details",
|
|
147
|
+
description: "Return a JSON-safe TanStack Query mutation snapshot for a mutationId.",
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: "object",
|
|
150
|
+
properties: o,
|
|
151
|
+
required: ["mutationId"]
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
clearMutationCache: e({
|
|
155
|
+
name: "clear-mutation-cache",
|
|
156
|
+
description: "Clear the full TanStack Query mutation cache.",
|
|
157
|
+
inputSchema: r
|
|
158
|
+
})
|
|
159
|
+
}, c = n(
|
|
160
|
+
i,
|
|
161
|
+
u
|
|
162
|
+
);
|
|
163
|
+
export {
|
|
164
|
+
i as TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
165
|
+
u as tanstackQueryToolDefinitions,
|
|
166
|
+
c as tanstackQueryTools
|
|
167
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/tanstack-query-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "TanStack Query for Rozenite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/react-native/index.cjs",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"fast-deep-equal": "^3.1.3",
|
|
19
|
-
"@rozenite/
|
|
20
|
-
"@rozenite/
|
|
19
|
+
"@rozenite/plugin-bridge": "1.8.0",
|
|
20
|
+
"@rozenite/agent-bridge": "1.8.0",
|
|
21
|
+
"@rozenite/agent-shared": "1.8.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
"tailwindcss-animate": "^1.0.7",
|
|
34
35
|
"typescript": "~5.9.3",
|
|
35
36
|
"vite": "^7.3.1",
|
|
36
|
-
"@rozenite/vite-plugin": "1.
|
|
37
|
-
"rozenite": "1.
|
|
37
|
+
"@rozenite/vite-plugin": "1.8.0",
|
|
38
|
+
"rozenite": "1.8.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -48,7 +49,13 @@
|
|
|
48
49
|
"import": "./dist/react-native/index.js",
|
|
49
50
|
"require": "./dist/react-native/index.cjs"
|
|
50
51
|
},
|
|
51
|
-
"./package.json": "./package.json"
|
|
52
|
+
"./package.json": "./package.json",
|
|
53
|
+
"./sdk": {
|
|
54
|
+
"development": "./sdk.ts",
|
|
55
|
+
"types": "./dist/sdk/index.d.ts",
|
|
56
|
+
"import": "./dist/sdk/index.js",
|
|
57
|
+
"require": "./dist/sdk/index.cjs"
|
|
58
|
+
}
|
|
52
59
|
},
|
|
53
60
|
"publishConfig": {
|
|
54
61
|
"access": "public"
|
package/sdk.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineAgentToolDescriptors } from '@rozenite/agent-shared';
|
|
2
|
+
import {
|
|
3
|
+
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
4
|
+
tanstackQueryToolDefinitions,
|
|
5
|
+
} from './src/shared/agent-tools.js';
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
9
|
+
tanstackQueryToolDefinitions,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const tanstackQueryTools = defineAgentToolDescriptors(
|
|
13
|
+
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
14
|
+
tanstackQueryToolDefinitions,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
TanStackQueryActionResult,
|
|
19
|
+
TanStackQueryAgentMutationIdInput,
|
|
20
|
+
TanStackQueryAgentOnlineStatusInput,
|
|
21
|
+
TanStackQueryAgentPaginationInput,
|
|
22
|
+
TanStackQueryAgentQueryHashInput,
|
|
23
|
+
TanStackQueryAgentQueryToggleInput,
|
|
24
|
+
TanStackQueryAgentSafeValue,
|
|
25
|
+
TanStackQueryCacheSummary,
|
|
26
|
+
TanStackQueryClearMutationCacheArgs,
|
|
27
|
+
TanStackQueryClearMutationCacheResult,
|
|
28
|
+
TanStackQueryClearQueryCacheArgs,
|
|
29
|
+
TanStackQueryClearQueryCacheResult,
|
|
30
|
+
TanStackQueryGetCacheSummaryArgs,
|
|
31
|
+
TanStackQueryGetCacheSummaryResult,
|
|
32
|
+
TanStackQueryGetMutationDetailsArgs,
|
|
33
|
+
TanStackQueryGetMutationDetailsResult,
|
|
34
|
+
TanStackQueryGetOnlineStatusArgs,
|
|
35
|
+
TanStackQueryGetOnlineStatusResult,
|
|
36
|
+
TanStackQueryGetQueryDetailsArgs,
|
|
37
|
+
TanStackQueryGetQueryDetailsResult,
|
|
38
|
+
TanStackQueryInvalidateQueryArgs,
|
|
39
|
+
TanStackQueryListMutationsArgs,
|
|
40
|
+
TanStackQueryListMutationsResult,
|
|
41
|
+
TanStackQueryListQueriesArgs,
|
|
42
|
+
TanStackQueryListQueriesResult,
|
|
43
|
+
TanStackQueryMutationOptionsSummary,
|
|
44
|
+
TanStackQueryMutationSummary,
|
|
45
|
+
TanStackQueryObserverOptionsSummary,
|
|
46
|
+
TanStackQueryPage,
|
|
47
|
+
TanStackQueryQuerySummary,
|
|
48
|
+
TanStackQueryRefetchQueryArgs,
|
|
49
|
+
TanStackQueryRemoveQueryArgs,
|
|
50
|
+
TanStackQueryResetQueryArgs,
|
|
51
|
+
TanStackQuerySetOnlineStatusArgs,
|
|
52
|
+
TanStackQuerySetOnlineStatusResult,
|
|
53
|
+
TanStackQuerySetQueryErrorArgs,
|
|
54
|
+
TanStackQuerySetQueryLoadingArgs,
|
|
55
|
+
} from './src/shared/agent-tools.js';
|
|
@@ -9,8 +9,8 @@ import { applyTanStackQueryDevtoolsAction } from '../../devtools-actions';
|
|
|
9
9
|
import {
|
|
10
10
|
createTanStackQueryAgentController,
|
|
11
11
|
serializeForAgent,
|
|
12
|
-
TANSTACK_QUERY_AGENT_TOOLS,
|
|
13
12
|
} from '../tanstack-query-agent';
|
|
13
|
+
import { tanstackQueryToolDefinitions } from '../../../shared/agent-tools';
|
|
14
14
|
|
|
15
15
|
const createQueryClient = () =>
|
|
16
16
|
new QueryClient({
|
|
@@ -87,7 +87,9 @@ afterEach(() => {
|
|
|
87
87
|
|
|
88
88
|
describe('tanstack query agent controller', () => {
|
|
89
89
|
it('exposes the expected tool names', () => {
|
|
90
|
-
expect(
|
|
90
|
+
expect(
|
|
91
|
+
Object.values(tanstackQueryToolDefinitions).map((tool) => tool.name),
|
|
92
|
+
).toEqual([
|
|
91
93
|
'get-cache-summary',
|
|
92
94
|
'get-online-status',
|
|
93
95
|
'set-online-status',
|
|
@@ -104,6 +106,10 @@ describe('tanstack query agent controller', () => {
|
|
|
104
106
|
'get-mutation-details',
|
|
105
107
|
'clear-mutation-cache',
|
|
106
108
|
]);
|
|
109
|
+
expect(tanstackQueryToolDefinitions.setQueryLoading.inputSchema.required).toEqual([
|
|
110
|
+
'queryHash',
|
|
111
|
+
'enabled',
|
|
112
|
+
]);
|
|
107
113
|
});
|
|
108
114
|
|
|
109
115
|
it('lists queries with cursor pagination and invalidates stale cursors after additions', async () => {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AgentTool,
|
|
3
|
-
JSONSchema7,
|
|
4
|
-
} from '@rozenite/agent-bridge';
|
|
5
1
|
import type {
|
|
6
2
|
Mutation,
|
|
7
3
|
MutationCacheNotifyEvent,
|
|
@@ -13,47 +9,28 @@ import type {
|
|
|
13
9
|
} from '@tanstack/react-query';
|
|
14
10
|
import { onlineManager } from '@tanstack/react-query';
|
|
15
11
|
import { applyTanStackQueryDevtoolsAction } from '../devtools-actions';
|
|
12
|
+
import {
|
|
13
|
+
tanstackQueryToolDefinitions,
|
|
14
|
+
type TanStackQueryAgentMutationIdInput as MutationIdInput,
|
|
15
|
+
type TanStackQueryAgentOnlineStatusInput as OnlineStatusInput,
|
|
16
|
+
type TanStackQueryAgentPaginationInput as PaginationInput,
|
|
17
|
+
type TanStackQueryAgentQueryHashInput as QueryHashInput,
|
|
18
|
+
type TanStackQueryAgentQueryToggleInput as QueryToggleInput,
|
|
19
|
+
type TanStackQueryAgentSafeValue as AgentSafeValue,
|
|
20
|
+
type TanStackQueryMutationOptionsSummary,
|
|
21
|
+
type TanStackQueryObserverOptionsSummary,
|
|
22
|
+
} from '../../shared/agent-tools';
|
|
16
23
|
|
|
17
|
-
const pluginId = '@rozenite/tanstack-query-plugin';
|
|
18
24
|
const DEFAULT_PAGE_LIMIT = 20;
|
|
19
25
|
const MAX_PAGE_LIMIT = 100;
|
|
20
26
|
|
|
21
27
|
type CursorKind = 'queries' | 'mutations';
|
|
22
28
|
|
|
23
|
-
type PaginationInput = {
|
|
24
|
-
limit?: number;
|
|
25
|
-
cursor?: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type QueryHashInput = {
|
|
29
|
-
queryHash: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type QueryToggleInput = QueryHashInput & {
|
|
33
|
-
enabled: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
type MutationIdInput = {
|
|
37
|
-
mutationId: number;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
type OnlineStatusInput = {
|
|
41
|
-
online: boolean;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
29
|
type CursorState = {
|
|
45
30
|
queriesGeneration: number;
|
|
46
31
|
mutationsGeneration: number;
|
|
47
32
|
};
|
|
48
33
|
|
|
49
|
-
type AgentSafeValue =
|
|
50
|
-
| null
|
|
51
|
-
| boolean
|
|
52
|
-
| number
|
|
53
|
-
| string
|
|
54
|
-
| AgentSafeValue[]
|
|
55
|
-
| { [key: string]: AgentSafeValue };
|
|
56
|
-
|
|
57
34
|
const isPlainObject = (value: unknown): value is Record<string, unknown> => {
|
|
58
35
|
return (
|
|
59
36
|
!!value &&
|
|
@@ -212,202 +189,30 @@ const paginate = <T>(
|
|
|
212
189
|
};
|
|
213
190
|
};
|
|
214
191
|
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
type: 'string',
|
|
236
|
-
description: 'Opaque pagination cursor from a previous list call.',
|
|
237
|
-
},
|
|
238
|
-
} satisfies Record<string, JSONSchema7>;
|
|
239
|
-
|
|
240
|
-
const emptyInputSchema: JSONSchema7 = {
|
|
241
|
-
type: 'object',
|
|
242
|
-
properties: {},
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export const getCacheSummaryTool: AgentTool = {
|
|
246
|
-
name: 'get-cache-summary',
|
|
247
|
-
description:
|
|
248
|
-
'Return aggregate TanStack Query cache health and count information.',
|
|
249
|
-
inputSchema: emptyInputSchema,
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export const getOnlineStatusTool: AgentTool = {
|
|
253
|
-
name: 'get-online-status',
|
|
254
|
-
description: 'Return the current TanStack Query onlineManager status.',
|
|
255
|
-
inputSchema: emptyInputSchema,
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
export const setOnlineStatusTool: AgentTool = {
|
|
259
|
-
name: 'set-online-status',
|
|
260
|
-
description:
|
|
261
|
-
'Set the TanStack Query onlineManager status for testing offline/online behavior.',
|
|
262
|
-
inputSchema: {
|
|
263
|
-
type: 'object',
|
|
264
|
-
properties: {
|
|
265
|
-
online: {
|
|
266
|
-
type: 'boolean',
|
|
267
|
-
description: 'Whether the TanStack Query onlineManager should be online.',
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
required: ['online'],
|
|
271
|
-
},
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
export const listQueriesTool: AgentTool = {
|
|
275
|
-
name: 'list-queries',
|
|
276
|
-
description:
|
|
277
|
-
'List TanStack Query query summaries using cursor pagination.',
|
|
278
|
-
inputSchema: {
|
|
279
|
-
type: 'object',
|
|
280
|
-
properties: paginationProperties,
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
export const getQueryDetailsTool: AgentTool = {
|
|
285
|
-
name: 'get-query-details',
|
|
286
|
-
description:
|
|
287
|
-
'Return a JSON-safe TanStack Query query snapshot and observer summary.',
|
|
288
|
-
inputSchema: {
|
|
289
|
-
type: 'object',
|
|
290
|
-
properties: queryActionProperties,
|
|
291
|
-
required: ['queryHash'],
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export const refetchQueryTool: AgentTool = {
|
|
296
|
-
name: 'refetch-query',
|
|
297
|
-
description: 'Refetch a TanStack Query query by queryHash.',
|
|
298
|
-
inputSchema: {
|
|
299
|
-
type: 'object',
|
|
300
|
-
properties: queryActionProperties,
|
|
301
|
-
required: ['queryHash'],
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
export const setQueryLoadingTool: AgentTool = {
|
|
306
|
-
name: 'set-query-loading',
|
|
307
|
-
description:
|
|
308
|
-
'Enable or disable TanStack Query loading-state simulation for a query by queryHash.',
|
|
309
|
-
inputSchema: {
|
|
310
|
-
type: 'object',
|
|
311
|
-
properties: queryActionProperties,
|
|
312
|
-
required: ['queryHash', 'enabled'],
|
|
313
|
-
},
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
export const setQueryErrorTool: AgentTool = {
|
|
317
|
-
name: 'set-query-error',
|
|
318
|
-
description:
|
|
319
|
-
'Enable or disable TanStack Query error-state simulation for a query by queryHash.',
|
|
320
|
-
inputSchema: {
|
|
321
|
-
type: 'object',
|
|
322
|
-
properties: queryActionProperties,
|
|
323
|
-
required: ['queryHash', 'enabled'],
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
export const invalidateQueryTool: AgentTool = {
|
|
328
|
-
name: 'invalidate-query',
|
|
329
|
-
description: 'Invalidate a TanStack Query query by queryHash.',
|
|
330
|
-
inputSchema: {
|
|
331
|
-
type: 'object',
|
|
332
|
-
properties: queryActionProperties,
|
|
333
|
-
required: ['queryHash'],
|
|
334
|
-
},
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
export const resetQueryTool: AgentTool = {
|
|
338
|
-
name: 'reset-query',
|
|
339
|
-
description: 'Reset a TanStack Query query by queryHash.',
|
|
340
|
-
inputSchema: {
|
|
341
|
-
type: 'object',
|
|
342
|
-
properties: queryActionProperties,
|
|
343
|
-
required: ['queryHash'],
|
|
344
|
-
},
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
export const removeQueryTool: AgentTool = {
|
|
348
|
-
name: 'remove-query',
|
|
349
|
-
description: 'Remove a TanStack Query query from the cache by queryHash.',
|
|
350
|
-
inputSchema: {
|
|
351
|
-
type: 'object',
|
|
352
|
-
properties: queryActionProperties,
|
|
353
|
-
required: ['queryHash'],
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
export const clearQueryCacheTool: AgentTool = {
|
|
358
|
-
name: 'clear-query-cache',
|
|
359
|
-
description: 'Clear the full TanStack Query query cache.',
|
|
360
|
-
inputSchema: emptyInputSchema,
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
export const listMutationsTool: AgentTool = {
|
|
364
|
-
name: 'list-mutations',
|
|
365
|
-
description:
|
|
366
|
-
'List TanStack Query mutation summaries using cursor pagination.',
|
|
367
|
-
inputSchema: {
|
|
368
|
-
type: 'object',
|
|
369
|
-
properties: paginationProperties,
|
|
370
|
-
},
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
export const getMutationDetailsTool: AgentTool = {
|
|
374
|
-
name: 'get-mutation-details',
|
|
375
|
-
description:
|
|
376
|
-
'Return a JSON-safe TanStack Query mutation snapshot for a mutationId.',
|
|
377
|
-
inputSchema: {
|
|
378
|
-
type: 'object',
|
|
379
|
-
properties: mutationActionProperties,
|
|
380
|
-
required: ['mutationId'],
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
export const clearMutationCacheTool: AgentTool = {
|
|
385
|
-
name: 'clear-mutation-cache',
|
|
386
|
-
description: 'Clear the full TanStack Query mutation cache.',
|
|
387
|
-
inputSchema: emptyInputSchema,
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
export const TANSTACK_QUERY_AGENT_TOOLS: AgentTool[] = [
|
|
391
|
-
getCacheSummaryTool,
|
|
392
|
-
getOnlineStatusTool,
|
|
393
|
-
setOnlineStatusTool,
|
|
394
|
-
listQueriesTool,
|
|
395
|
-
getQueryDetailsTool,
|
|
396
|
-
refetchQueryTool,
|
|
397
|
-
setQueryLoadingTool,
|
|
398
|
-
setQueryErrorTool,
|
|
399
|
-
invalidateQueryTool,
|
|
400
|
-
resetQueryTool,
|
|
401
|
-
removeQueryTool,
|
|
402
|
-
clearQueryCacheTool,
|
|
403
|
-
listMutationsTool,
|
|
404
|
-
getMutationDetailsTool,
|
|
405
|
-
clearMutationCacheTool,
|
|
406
|
-
];
|
|
192
|
+
export const getCacheSummaryTool = tanstackQueryToolDefinitions.getCacheSummary;
|
|
193
|
+
export const getOnlineStatusTool = tanstackQueryToolDefinitions.getOnlineStatus;
|
|
194
|
+
export const setOnlineStatusTool = tanstackQueryToolDefinitions.setOnlineStatus;
|
|
195
|
+
export const listQueriesTool = tanstackQueryToolDefinitions.listQueries;
|
|
196
|
+
export const getQueryDetailsTool = tanstackQueryToolDefinitions.getQueryDetails;
|
|
197
|
+
export const refetchQueryTool = tanstackQueryToolDefinitions.refetchQuery;
|
|
198
|
+
export const setQueryLoadingTool = tanstackQueryToolDefinitions.setQueryLoading;
|
|
199
|
+
export const setQueryErrorTool = tanstackQueryToolDefinitions.setQueryError;
|
|
200
|
+
export const invalidateQueryTool = tanstackQueryToolDefinitions.invalidateQuery;
|
|
201
|
+
export const resetQueryTool = tanstackQueryToolDefinitions.resetQuery;
|
|
202
|
+
export const removeQueryTool = tanstackQueryToolDefinitions.removeQuery;
|
|
203
|
+
export const clearQueryCacheTool = tanstackQueryToolDefinitions.clearQueryCache;
|
|
204
|
+
export const listMutationsTool = tanstackQueryToolDefinitions.listMutations;
|
|
205
|
+
export const getMutationDetailsTool =
|
|
206
|
+
tanstackQueryToolDefinitions.getMutationDetails;
|
|
207
|
+
export const clearMutationCacheTool =
|
|
208
|
+
tanstackQueryToolDefinitions.clearMutationCache;
|
|
209
|
+
export const TANSTACK_QUERY_AGENT_TOOLS = Object.values(
|
|
210
|
+
tanstackQueryToolDefinitions,
|
|
211
|
+
);
|
|
407
212
|
|
|
408
213
|
const pickObserverOptionsSummary = (
|
|
409
214
|
options: Record<string, unknown> | undefined
|
|
410
|
-
) => {
|
|
215
|
+
): TanStackQueryObserverOptionsSummary | null => {
|
|
411
216
|
if (!options) {
|
|
412
217
|
return null;
|
|
413
218
|
}
|
|
@@ -434,7 +239,7 @@ const pickObserverOptionsSummary = (
|
|
|
434
239
|
|
|
435
240
|
const pickMutationOptionsSummary = (
|
|
436
241
|
options: MutationObserverOptions<unknown, Error, unknown, unknown>
|
|
437
|
-
) => {
|
|
242
|
+
): TanStackQueryMutationOptionsSummary => {
|
|
438
243
|
return {
|
|
439
244
|
mutationKey: serializeForAgent(options.mutationKey),
|
|
440
245
|
networkMode: serializeForAgent(options.networkMode),
|
|
@@ -741,10 +546,3 @@ export const createTanStackQueryAgentController = (queryClient: QueryClient) =>
|
|
|
741
546
|
export type TanStackQueryAgentController = ReturnType<
|
|
742
547
|
typeof createTanStackQueryAgentController
|
|
743
548
|
>;
|
|
744
|
-
|
|
745
|
-
export type TanStackQueryAgentPaginationInput = PaginationInput;
|
|
746
|
-
export type TanStackQueryAgentQueryHashInput = QueryHashInput;
|
|
747
|
-
export type TanStackQueryAgentQueryToggleInput = QueryToggleInput;
|
|
748
|
-
export type TanStackQueryAgentMutationIdInput = MutationIdInput;
|
|
749
|
-
export type TanStackQueryAgentOnlineStatusInput = OnlineStatusInput;
|
|
750
|
-
export const TANSTACK_QUERY_AGENT_PLUGIN_ID = pluginId;
|