@rozenite/tanstack-query-plugin 2.3.0 → 2.5.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 +60 -0
- package/dist/react-native/cjs/src/react-native/agent/tanstack-query-agent.js +60 -68
- package/dist/react-native/cjs/src/react-native/agent/useTanStackQueryAgentTools.js +0 -12
- package/dist/react-native/cjs/src/shared/agent-tools.js +36 -6
- package/dist/react-native/src/react-native/agent/tanstack-query-agent.d.ts +16 -19
- package/dist/react-native/src/react-native/agent/tanstack-query-agent.js +60 -68
- package/dist/react-native/src/react-native/agent/useTanStackQueryAgentTools.js +1 -13
- package/dist/react-native/src/shared/agent-tools.d.ts +17 -5
- package/dist/react-native/src/shared/agent-tools.js +36 -6
- package/dist/rozenite.json +1 -1
- package/dist/sdk/sdk.d.ts +2 -2
- package/dist/sdk/src/shared/agent-tools.d.ts +17 -5
- package/dist/sdk/src/shared/agent-tools.js +36 -6
- package/package.json +12 -8
- package/react-native.ts +0 -18
- package/rozenite.config.ts +0 -9
- package/sdk.ts +0 -52
- package/src/__tests__/release-bundle.test.ts +0 -32
- package/src/react-native/agent/__tests__/tanstack-query-agent.test.ts +0 -553
- package/src/react-native/agent/tanstack-query-agent.ts +0 -484
- package/src/react-native/agent/useTanStackQueryAgentTools.ts +0 -116
- package/src/react-native/devtools-actions.ts +0 -204
- package/src/react-native/useHandleDevToolsMessages.ts +0 -32
- package/src/react-native/useHandleInitialData.ts +0 -31
- package/src/react-native/useSyncTanStackCache.ts +0 -231
- package/src/react-native/useTanStackQueryDevTools.ts +0 -24
- package/src/shared/agent-tools.ts +0 -418
- package/src/shared/dehydrate.ts +0 -40
- package/src/shared/hydrate.ts +0 -243
- package/src/shared/messaging.ts +0 -63
- package/src/shared/query-data-sync.test.ts +0 -89
- package/src/shared/query-data-sync.ts +0 -129
- package/src/shared/types.ts +0 -49
- package/src/shared/useSyncOnlineStatus.ts +0 -24
- package/src/ui/tanstack-query.tsx +0 -46
- package/src/ui/useHandleSyncMessages.ts +0 -58
- package/src/ui/useSyncDevToolsEvents.ts +0 -46
- package/src/ui/useSyncInitialData.test.tsx +0 -76
- package/src/ui/useSyncInitialData.ts +0 -27
- package/tsconfig.json +0 -36
- package/vite.config.ts +0 -27
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useRozenitePluginAgentTool } from '@rozenite/agent-bridge';
|
|
3
3
|
import { createTanStackQueryAgentController } from './tanstack-query-agent';
|
|
4
4
|
import { TANSTACK_QUERY_AGENT_PLUGIN_ID, tanstackQueryToolDefinitions, } from '../../shared/agent-tools';
|
|
5
5
|
export const useTanStackQueryAgentTools = (queryClient) => {
|
|
6
6
|
const controller = useMemo(() => createTanStackQueryAgentController(queryClient), [queryClient]);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const unsubscribeQueryCache = queryClient
|
|
9
|
-
.getQueryCache()
|
|
10
|
-
.subscribe((event) => controller.handleQueryCacheEvent(event));
|
|
11
|
-
const unsubscribeMutationCache = queryClient
|
|
12
|
-
.getMutationCache()
|
|
13
|
-
.subscribe((event) => controller.handleMutationCacheEvent(event));
|
|
14
|
-
return () => {
|
|
15
|
-
unsubscribeQueryCache();
|
|
16
|
-
unsubscribeMutationCache();
|
|
17
|
-
};
|
|
18
|
-
}, [controller, queryClient]);
|
|
19
7
|
useRozenitePluginAgentTool({
|
|
20
8
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
21
9
|
tool: tanstackQueryToolDefinitions.getCacheSummary,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentToolContract } from '@rozenite/agent-shared';
|
|
1
|
+
import { type AgentToolContract, type BoundedValueArgs } from '@rozenite/agent-shared';
|
|
2
2
|
import type { FetchStatus, MutationStatus, QueryStatus } from '@tanstack/react-query';
|
|
3
3
|
import type { applyTanStackQueryDevtoolsAction } from '../react-native/devtools-actions';
|
|
4
4
|
export declare const TANSTACK_QUERY_AGENT_PLUGIN_ID = "@rozenite/tanstack-query-plugin";
|
|
@@ -44,6 +44,8 @@ export type TanStackQueryPage = {
|
|
|
44
44
|
limit: number;
|
|
45
45
|
hasMore: boolean;
|
|
46
46
|
nextCursor?: string;
|
|
47
|
+
/** The row the cursor pointed at is gone; restart the listing without a cursor. */
|
|
48
|
+
reset?: boolean;
|
|
47
49
|
};
|
|
48
50
|
export type TanStackQueryQuerySummary = {
|
|
49
51
|
queryHash: string;
|
|
@@ -83,6 +85,7 @@ export type TanStackQueryListQueriesResult = TanStackQueryCacheSummary & {
|
|
|
83
85
|
export type TanStackQueryGetQueryDetailsResult = {
|
|
84
86
|
summary: TanStackQueryCacheSummary;
|
|
85
87
|
query: TanStackQueryQuerySummary & {
|
|
88
|
+
/** Query data (or the sub-tree at `path`), cut to `maxDepth` / `maxValueLength` / `maxItems`. */
|
|
86
89
|
data: TanStackQueryAgentSafeValue;
|
|
87
90
|
error: TanStackQueryAgentSafeValue;
|
|
88
91
|
observers: Array<{
|
|
@@ -90,6 +93,10 @@ export type TanStackQueryGetQueryDetailsResult = {
|
|
|
90
93
|
options: TanStackQueryObserverOptionsSummary | null;
|
|
91
94
|
}>;
|
|
92
95
|
};
|
|
96
|
+
/** The `path` a value was narrowed to, when one was given. */
|
|
97
|
+
path?: string;
|
|
98
|
+
/** Whether any value in `data` or `error` was cut. */
|
|
99
|
+
truncated: boolean;
|
|
93
100
|
};
|
|
94
101
|
export type TanStackQueryActionResult = Awaited<ReturnType<typeof applyTanStackQueryDevtoolsAction>>;
|
|
95
102
|
export type TanStackQueryMutationSummary = {
|
|
@@ -131,6 +138,10 @@ export type TanStackQueryGetMutationDetailsResult = {
|
|
|
131
138
|
failureReason: TanStackQueryAgentSafeValue;
|
|
132
139
|
options: TanStackQueryMutationOptionsSummary;
|
|
133
140
|
};
|
|
141
|
+
/** The `path` a value was narrowed to, when one was given. */
|
|
142
|
+
path?: string;
|
|
143
|
+
/** Whether any of `variables`, `data`, `error`, `context` or `failureReason` was cut. */
|
|
144
|
+
truncated: boolean;
|
|
134
145
|
};
|
|
135
146
|
export type TanStackQueryGetCacheSummaryArgs = undefined;
|
|
136
147
|
export type TanStackQueryGetCacheSummaryResult = TanStackQueryCacheSummary;
|
|
@@ -143,7 +154,8 @@ export type TanStackQuerySetOnlineStatusResult = {
|
|
|
143
154
|
online: boolean;
|
|
144
155
|
};
|
|
145
156
|
export type TanStackQueryListQueriesArgs = TanStackQueryAgentPaginationInput;
|
|
146
|
-
export type
|
|
157
|
+
export type TanStackQueryBoundedValueArgs = BoundedValueArgs;
|
|
158
|
+
export type TanStackQueryGetQueryDetailsArgs = TanStackQueryAgentQueryHashInput & BoundedValueArgs;
|
|
147
159
|
export type TanStackQueryRefetchQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
148
160
|
export type TanStackQuerySetQueryLoadingArgs = TanStackQueryAgentQueryToggleInput;
|
|
149
161
|
export type TanStackQuerySetQueryErrorArgs = TanStackQueryAgentQueryToggleInput;
|
|
@@ -153,7 +165,7 @@ export type TanStackQueryRemoveQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
|
153
165
|
export type TanStackQueryClearQueryCacheArgs = undefined;
|
|
154
166
|
export type TanStackQueryClearQueryCacheResult = TanStackQueryActionResult;
|
|
155
167
|
export type TanStackQueryListMutationsArgs = TanStackQueryAgentPaginationInput;
|
|
156
|
-
export type TanStackQueryGetMutationDetailsArgs = TanStackQueryAgentMutationIdInput;
|
|
168
|
+
export type TanStackQueryGetMutationDetailsArgs = TanStackQueryAgentMutationIdInput & BoundedValueArgs;
|
|
157
169
|
export type TanStackQueryClearMutationCacheArgs = undefined;
|
|
158
170
|
export type TanStackQueryClearMutationCacheResult = TanStackQueryActionResult;
|
|
159
171
|
export declare const tanstackQueryToolDefinitions: {
|
|
@@ -161,7 +173,7 @@ export declare const tanstackQueryToolDefinitions: {
|
|
|
161
173
|
readonly getOnlineStatus: AgentToolContract<undefined, TanStackQueryGetOnlineStatusResult>;
|
|
162
174
|
readonly setOnlineStatus: AgentToolContract<TanStackQueryAgentOnlineStatusInput, TanStackQuerySetOnlineStatusResult>;
|
|
163
175
|
readonly listQueries: AgentToolContract<TanStackQueryAgentPaginationInput, TanStackQueryListQueriesResult>;
|
|
164
|
-
readonly getQueryDetails: AgentToolContract<
|
|
176
|
+
readonly getQueryDetails: AgentToolContract<TanStackQueryGetQueryDetailsArgs, TanStackQueryGetQueryDetailsResult>;
|
|
165
177
|
readonly refetchQuery: AgentToolContract<TanStackQueryAgentQueryHashInput, {
|
|
166
178
|
applied: boolean;
|
|
167
179
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -863,7 +875,7 @@ export declare const tanstackQueryToolDefinitions: {
|
|
|
863
875
|
mutationCountAfter?: undefined;
|
|
864
876
|
}>;
|
|
865
877
|
readonly listMutations: AgentToolContract<TanStackQueryAgentPaginationInput, TanStackQueryListMutationsResult>;
|
|
866
|
-
readonly getMutationDetails: AgentToolContract<
|
|
878
|
+
readonly getMutationDetails: AgentToolContract<TanStackQueryGetMutationDetailsArgs, TanStackQueryGetMutationDetailsResult>;
|
|
867
879
|
readonly clearMutationCache: AgentToolContract<undefined, {
|
|
868
880
|
applied: boolean;
|
|
869
881
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -19,7 +19,21 @@ const paginationProperties = {
|
|
|
19
19
|
},
|
|
20
20
|
cursor: {
|
|
21
21
|
type: 'string',
|
|
22
|
-
description: 'Opaque
|
|
22
|
+
description: 'Opaque cursor from a previous page; the next page starts after the last row returned.',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const boundedValueProperties = {
|
|
26
|
+
maxDepth: {
|
|
27
|
+
type: 'integer',
|
|
28
|
+
description: 'Levels of nesting expanded below each returned value. Deeper objects and arrays collapse to "[object(N keys)]" / "[array(N)]". Defaults to 4, max 64.',
|
|
29
|
+
},
|
|
30
|
+
maxValueLength: {
|
|
31
|
+
type: 'integer',
|
|
32
|
+
description: 'Truncate string values longer than this, marking the cut with "[+N chars]". Defaults to 512.',
|
|
33
|
+
},
|
|
34
|
+
maxItems: {
|
|
35
|
+
type: 'integer',
|
|
36
|
+
description: 'Most array items or object keys returned per level; the rest are marked with a last "[+N items]" item or "[+N keys]" key. Defaults to 100, max 10000.',
|
|
23
37
|
},
|
|
24
38
|
};
|
|
25
39
|
const emptyInputSchema = {
|
|
@@ -72,15 +86,23 @@ export const tanstackQueryToolDefinitions = {
|
|
|
72
86
|
'hasData',
|
|
73
87
|
'hasError',
|
|
74
88
|
],
|
|
75
|
-
defaultFields: ['queryHash', '
|
|
89
|
+
defaultFields: ['queryHash', 'status', 'fetchStatus', 'hasError'],
|
|
90
|
+
meta: ['total'],
|
|
76
91
|
},
|
|
77
92
|
}),
|
|
78
93
|
getQueryDetails: defineAgentToolContract({
|
|
79
94
|
name: 'get-query-details',
|
|
80
|
-
description: 'Return a JSON-safe TanStack Query query snapshot and observer summary.',
|
|
95
|
+
description: 'Return a JSON-safe TanStack Query query snapshot and observer summary. data and error are cut to maxDepth levels, maxValueLength characters per string and maxItems entries per array or object; use path to read a deeper sub-tree.',
|
|
81
96
|
inputSchema: {
|
|
82
97
|
type: 'object',
|
|
83
|
-
properties:
|
|
98
|
+
properties: {
|
|
99
|
+
...queryActionProperties,
|
|
100
|
+
path: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Dot path starting with "data" or "error" selecting the sub-tree to return, for example "data.items.0".',
|
|
103
|
+
},
|
|
104
|
+
...boundedValueProperties,
|
|
105
|
+
},
|
|
84
106
|
required: ['queryHash'],
|
|
85
107
|
},
|
|
86
108
|
}),
|
|
@@ -175,14 +197,22 @@ export const tanstackQueryToolDefinitions = {
|
|
|
175
197
|
'hasError',
|
|
176
198
|
],
|
|
177
199
|
defaultFields: ['mutationId', 'mutationKey', 'status', 'hasError'],
|
|
200
|
+
meta: ['total'],
|
|
178
201
|
},
|
|
179
202
|
}),
|
|
180
203
|
getMutationDetails: defineAgentToolContract({
|
|
181
204
|
name: 'get-mutation-details',
|
|
182
|
-
description: 'Return a JSON-safe TanStack Query mutation snapshot for a mutationId.',
|
|
205
|
+
description: 'Return a JSON-safe TanStack Query mutation snapshot for a mutationId. variables, data, error, context and failureReason are cut to maxDepth levels, maxValueLength characters per string and maxItems entries per array or object; use path to read a deeper sub-tree.',
|
|
183
206
|
inputSchema: {
|
|
184
207
|
type: 'object',
|
|
185
|
-
properties:
|
|
208
|
+
properties: {
|
|
209
|
+
...mutationActionProperties,
|
|
210
|
+
path: {
|
|
211
|
+
type: 'string',
|
|
212
|
+
description: 'Dot path starting with "variables", "data", "error", "context" or "failureReason" selecting the sub-tree to return, for example "variables.id".',
|
|
213
|
+
},
|
|
214
|
+
...boundedValueProperties,
|
|
215
|
+
},
|
|
186
216
|
required: ['mutationId'],
|
|
187
217
|
},
|
|
188
218
|
}),
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@rozenite/tanstack-query-plugin","version":"2.
|
|
1
|
+
{"name":"@rozenite/tanstack-query-plugin","version":"2.5.0","description":"TanStack Query for Rozenite.","panels":[{"name":"Tanstack Query","source":"/devtools/tanstack-query.html"}],"integrations":["react-native","react-native-web","lynx","lynx-web"]}
|
package/dist/sdk/sdk.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const tanstackQueryTools: {
|
|
|
5
5
|
readonly getOnlineStatus: import("@rozenite/agent-shared").AgentToolDescriptor<undefined, import("./src/shared/agent-tools.js").TanStackQueryGetOnlineStatusResult>;
|
|
6
6
|
readonly setOnlineStatus: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryAgentOnlineStatusInput, import("./src/shared/agent-tools.js").TanStackQuerySetOnlineStatusResult>;
|
|
7
7
|
readonly listQueries: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryAgentPaginationInput, import("./src/shared/agent-tools.js").TanStackQueryListQueriesResult>;
|
|
8
|
-
readonly getQueryDetails: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").
|
|
8
|
+
readonly getQueryDetails: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryGetQueryDetailsArgs, import("./src/shared/agent-tools.js").TanStackQueryGetQueryDetailsResult>;
|
|
9
9
|
readonly refetchQuery: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryAgentQueryHashInput, {
|
|
10
10
|
applied: boolean;
|
|
11
11
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -707,7 +707,7 @@ export declare const tanstackQueryTools: {
|
|
|
707
707
|
mutationCountAfter?: undefined;
|
|
708
708
|
}>;
|
|
709
709
|
readonly listMutations: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryAgentPaginationInput, import("./src/shared/agent-tools.js").TanStackQueryListMutationsResult>;
|
|
710
|
-
readonly getMutationDetails: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").
|
|
710
|
+
readonly getMutationDetails: import("@rozenite/agent-shared").AgentToolDescriptor<import("./src/shared/agent-tools.js").TanStackQueryGetMutationDetailsArgs, import("./src/shared/agent-tools.js").TanStackQueryGetMutationDetailsResult>;
|
|
711
711
|
readonly clearMutationCache: import("@rozenite/agent-shared").AgentToolDescriptor<undefined, {
|
|
712
712
|
applied: boolean;
|
|
713
713
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentToolContract } from '@rozenite/agent-shared';
|
|
1
|
+
import { type AgentToolContract, type BoundedValueArgs } from '@rozenite/agent-shared';
|
|
2
2
|
import type { FetchStatus, MutationStatus, QueryStatus } from '@tanstack/react-query';
|
|
3
3
|
import type { applyTanStackQueryDevtoolsAction } from '../react-native/devtools-actions';
|
|
4
4
|
export declare const TANSTACK_QUERY_AGENT_PLUGIN_ID = "@rozenite/tanstack-query-plugin";
|
|
@@ -44,6 +44,8 @@ export type TanStackQueryPage = {
|
|
|
44
44
|
limit: number;
|
|
45
45
|
hasMore: boolean;
|
|
46
46
|
nextCursor?: string;
|
|
47
|
+
/** The row the cursor pointed at is gone; restart the listing without a cursor. */
|
|
48
|
+
reset?: boolean;
|
|
47
49
|
};
|
|
48
50
|
export type TanStackQueryQuerySummary = {
|
|
49
51
|
queryHash: string;
|
|
@@ -83,6 +85,7 @@ export type TanStackQueryListQueriesResult = TanStackQueryCacheSummary & {
|
|
|
83
85
|
export type TanStackQueryGetQueryDetailsResult = {
|
|
84
86
|
summary: TanStackQueryCacheSummary;
|
|
85
87
|
query: TanStackQueryQuerySummary & {
|
|
88
|
+
/** Query data (or the sub-tree at `path`), cut to `maxDepth` / `maxValueLength` / `maxItems`. */
|
|
86
89
|
data: TanStackQueryAgentSafeValue;
|
|
87
90
|
error: TanStackQueryAgentSafeValue;
|
|
88
91
|
observers: Array<{
|
|
@@ -90,6 +93,10 @@ export type TanStackQueryGetQueryDetailsResult = {
|
|
|
90
93
|
options: TanStackQueryObserverOptionsSummary | null;
|
|
91
94
|
}>;
|
|
92
95
|
};
|
|
96
|
+
/** The `path` a value was narrowed to, when one was given. */
|
|
97
|
+
path?: string;
|
|
98
|
+
/** Whether any value in `data` or `error` was cut. */
|
|
99
|
+
truncated: boolean;
|
|
93
100
|
};
|
|
94
101
|
export type TanStackQueryActionResult = Awaited<ReturnType<typeof applyTanStackQueryDevtoolsAction>>;
|
|
95
102
|
export type TanStackQueryMutationSummary = {
|
|
@@ -131,6 +138,10 @@ export type TanStackQueryGetMutationDetailsResult = {
|
|
|
131
138
|
failureReason: TanStackQueryAgentSafeValue;
|
|
132
139
|
options: TanStackQueryMutationOptionsSummary;
|
|
133
140
|
};
|
|
141
|
+
/** The `path` a value was narrowed to, when one was given. */
|
|
142
|
+
path?: string;
|
|
143
|
+
/** Whether any of `variables`, `data`, `error`, `context` or `failureReason` was cut. */
|
|
144
|
+
truncated: boolean;
|
|
134
145
|
};
|
|
135
146
|
export type TanStackQueryGetCacheSummaryArgs = undefined;
|
|
136
147
|
export type TanStackQueryGetCacheSummaryResult = TanStackQueryCacheSummary;
|
|
@@ -143,7 +154,8 @@ export type TanStackQuerySetOnlineStatusResult = {
|
|
|
143
154
|
online: boolean;
|
|
144
155
|
};
|
|
145
156
|
export type TanStackQueryListQueriesArgs = TanStackQueryAgentPaginationInput;
|
|
146
|
-
export type
|
|
157
|
+
export type TanStackQueryBoundedValueArgs = BoundedValueArgs;
|
|
158
|
+
export type TanStackQueryGetQueryDetailsArgs = TanStackQueryAgentQueryHashInput & BoundedValueArgs;
|
|
147
159
|
export type TanStackQueryRefetchQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
148
160
|
export type TanStackQuerySetQueryLoadingArgs = TanStackQueryAgentQueryToggleInput;
|
|
149
161
|
export type TanStackQuerySetQueryErrorArgs = TanStackQueryAgentQueryToggleInput;
|
|
@@ -153,7 +165,7 @@ export type TanStackQueryRemoveQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
|
153
165
|
export type TanStackQueryClearQueryCacheArgs = undefined;
|
|
154
166
|
export type TanStackQueryClearQueryCacheResult = TanStackQueryActionResult;
|
|
155
167
|
export type TanStackQueryListMutationsArgs = TanStackQueryAgentPaginationInput;
|
|
156
|
-
export type TanStackQueryGetMutationDetailsArgs = TanStackQueryAgentMutationIdInput;
|
|
168
|
+
export type TanStackQueryGetMutationDetailsArgs = TanStackQueryAgentMutationIdInput & BoundedValueArgs;
|
|
157
169
|
export type TanStackQueryClearMutationCacheArgs = undefined;
|
|
158
170
|
export type TanStackQueryClearMutationCacheResult = TanStackQueryActionResult;
|
|
159
171
|
export declare const tanstackQueryToolDefinitions: {
|
|
@@ -161,7 +173,7 @@ export declare const tanstackQueryToolDefinitions: {
|
|
|
161
173
|
readonly getOnlineStatus: AgentToolContract<undefined, TanStackQueryGetOnlineStatusResult>;
|
|
162
174
|
readonly setOnlineStatus: AgentToolContract<TanStackQueryAgentOnlineStatusInput, TanStackQuerySetOnlineStatusResult>;
|
|
163
175
|
readonly listQueries: AgentToolContract<TanStackQueryAgentPaginationInput, TanStackQueryListQueriesResult>;
|
|
164
|
-
readonly getQueryDetails: AgentToolContract<
|
|
176
|
+
readonly getQueryDetails: AgentToolContract<TanStackQueryGetQueryDetailsArgs, TanStackQueryGetQueryDetailsResult>;
|
|
165
177
|
readonly refetchQuery: AgentToolContract<TanStackQueryAgentQueryHashInput, {
|
|
166
178
|
applied: boolean;
|
|
167
179
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -863,7 +875,7 @@ export declare const tanstackQueryToolDefinitions: {
|
|
|
863
875
|
mutationCountAfter?: undefined;
|
|
864
876
|
}>;
|
|
865
877
|
readonly listMutations: AgentToolContract<TanStackQueryAgentPaginationInput, TanStackQueryListMutationsResult>;
|
|
866
|
-
readonly getMutationDetails: AgentToolContract<
|
|
878
|
+
readonly getMutationDetails: AgentToolContract<TanStackQueryGetMutationDetailsArgs, TanStackQueryGetMutationDetailsResult>;
|
|
867
879
|
readonly clearMutationCache: AgentToolContract<undefined, {
|
|
868
880
|
applied: boolean;
|
|
869
881
|
action: "CLEAR_QUERY_CACHE";
|
|
@@ -22,7 +22,21 @@ const paginationProperties = {
|
|
|
22
22
|
},
|
|
23
23
|
cursor: {
|
|
24
24
|
type: 'string',
|
|
25
|
-
description: 'Opaque
|
|
25
|
+
description: 'Opaque cursor from a previous page; the next page starts after the last row returned.',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const boundedValueProperties = {
|
|
29
|
+
maxDepth: {
|
|
30
|
+
type: 'integer',
|
|
31
|
+
description: 'Levels of nesting expanded below each returned value. Deeper objects and arrays collapse to "[object(N keys)]" / "[array(N)]". Defaults to 4, max 64.',
|
|
32
|
+
},
|
|
33
|
+
maxValueLength: {
|
|
34
|
+
type: 'integer',
|
|
35
|
+
description: 'Truncate string values longer than this, marking the cut with "[+N chars]". Defaults to 512.',
|
|
36
|
+
},
|
|
37
|
+
maxItems: {
|
|
38
|
+
type: 'integer',
|
|
39
|
+
description: 'Most array items or object keys returned per level; the rest are marked with a last "[+N items]" item or "[+N keys]" key. Defaults to 100, max 10000.',
|
|
26
40
|
},
|
|
27
41
|
};
|
|
28
42
|
const emptyInputSchema = {
|
|
@@ -75,15 +89,23 @@ exports.tanstackQueryToolDefinitions = {
|
|
|
75
89
|
'hasData',
|
|
76
90
|
'hasError',
|
|
77
91
|
],
|
|
78
|
-
defaultFields: ['queryHash', '
|
|
92
|
+
defaultFields: ['queryHash', 'status', 'fetchStatus', 'hasError'],
|
|
93
|
+
meta: ['total'],
|
|
79
94
|
},
|
|
80
95
|
}),
|
|
81
96
|
getQueryDetails: (0, agent_shared_1.defineAgentToolContract)({
|
|
82
97
|
name: 'get-query-details',
|
|
83
|
-
description: 'Return a JSON-safe TanStack Query query snapshot and observer summary.',
|
|
98
|
+
description: 'Return a JSON-safe TanStack Query query snapshot and observer summary. data and error are cut to maxDepth levels, maxValueLength characters per string and maxItems entries per array or object; use path to read a deeper sub-tree.',
|
|
84
99
|
inputSchema: {
|
|
85
100
|
type: 'object',
|
|
86
|
-
properties:
|
|
101
|
+
properties: {
|
|
102
|
+
...queryActionProperties,
|
|
103
|
+
path: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'Dot path starting with "data" or "error" selecting the sub-tree to return, for example "data.items.0".',
|
|
106
|
+
},
|
|
107
|
+
...boundedValueProperties,
|
|
108
|
+
},
|
|
87
109
|
required: ['queryHash'],
|
|
88
110
|
},
|
|
89
111
|
}),
|
|
@@ -178,14 +200,22 @@ exports.tanstackQueryToolDefinitions = {
|
|
|
178
200
|
'hasError',
|
|
179
201
|
],
|
|
180
202
|
defaultFields: ['mutationId', 'mutationKey', 'status', 'hasError'],
|
|
203
|
+
meta: ['total'],
|
|
181
204
|
},
|
|
182
205
|
}),
|
|
183
206
|
getMutationDetails: (0, agent_shared_1.defineAgentToolContract)({
|
|
184
207
|
name: 'get-mutation-details',
|
|
185
|
-
description: 'Return a JSON-safe TanStack Query mutation snapshot for a mutationId.',
|
|
208
|
+
description: 'Return a JSON-safe TanStack Query mutation snapshot for a mutationId. variables, data, error, context and failureReason are cut to maxDepth levels, maxValueLength characters per string and maxItems entries per array or object; use path to read a deeper sub-tree.',
|
|
186
209
|
inputSchema: {
|
|
187
210
|
type: 'object',
|
|
188
|
-
properties:
|
|
211
|
+
properties: {
|
|
212
|
+
...mutationActionProperties,
|
|
213
|
+
path: {
|
|
214
|
+
type: 'string',
|
|
215
|
+
description: 'Dot path starting with "variables", "data", "error", "context" or "failureReason" selecting the sub-tree to return, for example "variables.id".',
|
|
216
|
+
},
|
|
217
|
+
...boundedValueProperties,
|
|
218
|
+
},
|
|
189
219
|
required: ['mutationId'],
|
|
190
220
|
},
|
|
191
221
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/tanstack-query-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "TanStack Query for Rozenite.",
|
|
5
5
|
"homepage": "https://github.com/callstackincubator/rozenite#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/callstackincubator/rozenite.git"
|
|
13
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"!dist/**/*.tsbuildinfo",
|
|
17
|
+
"CHANGELOG.md"
|
|
18
|
+
],
|
|
14
19
|
"type": "module",
|
|
15
20
|
"main": "./dist/react-native/cjs/react-native.js",
|
|
16
21
|
"module": "./dist/react-native/react-native.js",
|
|
@@ -23,7 +28,6 @@
|
|
|
23
28
|
},
|
|
24
29
|
"./package.json": "./package.json",
|
|
25
30
|
"./sdk": {
|
|
26
|
-
"development": "./sdk.ts",
|
|
27
31
|
"types": "./dist/sdk/sdk.d.ts",
|
|
28
32
|
"default": "./dist/sdk/sdk.js"
|
|
29
33
|
}
|
|
@@ -33,9 +37,9 @@
|
|
|
33
37
|
},
|
|
34
38
|
"dependencies": {
|
|
35
39
|
"fast-deep-equal": "^3.1.3",
|
|
36
|
-
"@rozenite/agent-bridge": "2.
|
|
37
|
-
"@rozenite/agent-shared": "2.
|
|
38
|
-
"@rozenite/plugin-bridge": "2.
|
|
40
|
+
"@rozenite/agent-bridge": "2.5.0",
|
|
41
|
+
"@rozenite/agent-shared": "2.5.0",
|
|
42
|
+
"@rozenite/plugin-bridge": "2.5.0"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
45
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -47,9 +51,9 @@
|
|
|
47
51
|
"react-native-web": "^0.21.2",
|
|
48
52
|
"typescript": "~5.9.3",
|
|
49
53
|
"vite": "^7.3.1",
|
|
50
|
-
"@rozenite/test-utils": "2.
|
|
51
|
-
"@rozenite/vite-plugin": "2.
|
|
52
|
-
"rozenite": "2.
|
|
54
|
+
"@rozenite/test-utils": "2.5.0",
|
|
55
|
+
"@rozenite/vite-plugin": "2.5.0",
|
|
56
|
+
"rozenite": "2.5.0"
|
|
53
57
|
},
|
|
54
58
|
"peerDependencies": {
|
|
55
59
|
"@tanstack/react-query": "^5.0.0",
|
package/react-native.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export let useTanStackQueryDevTools: typeof import('./src/react-native/useTanStackQueryDevTools').useTanStackQueryDevTools;
|
|
2
|
-
|
|
3
|
-
// Neither Lynx runtime has a `window`, so `typeof window` alone reported
|
|
4
|
-
// every Lynx app as a server and installed the no-op stub below. `lynx` is
|
|
5
|
-
// a free binding in module scope, not a property of `globalThis`. Kept
|
|
6
|
-
// inline rather than imported so this stays a foldable expression and the
|
|
7
|
-
// `require`s below can still be dropped from production bundles.
|
|
8
|
-
declare const lynx: unknown;
|
|
9
|
-
|
|
10
|
-
const isDev = process.env.NODE_ENV !== 'production';
|
|
11
|
-
const isServer = typeof window === 'undefined' && typeof lynx === 'undefined';
|
|
12
|
-
|
|
13
|
-
if (isDev && !isServer) {
|
|
14
|
-
useTanStackQueryDevTools =
|
|
15
|
-
require('./src/react-native/useTanStackQueryDevTools').useTanStackQueryDevTools;
|
|
16
|
-
} else {
|
|
17
|
-
useTanStackQueryDevTools = () => ({ isConnected: false });
|
|
18
|
-
}
|
package/rozenite.config.ts
DELETED
package/sdk.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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 { TANSTACK_QUERY_AGENT_PLUGIN_ID, tanstackQueryToolDefinitions };
|
|
8
|
-
|
|
9
|
-
export const tanstackQueryTools = defineAgentToolDescriptors(
|
|
10
|
-
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
11
|
-
tanstackQueryToolDefinitions,
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
export type {
|
|
15
|
-
TanStackQueryActionResult,
|
|
16
|
-
TanStackQueryAgentMutationIdInput,
|
|
17
|
-
TanStackQueryAgentOnlineStatusInput,
|
|
18
|
-
TanStackQueryAgentPaginationInput,
|
|
19
|
-
TanStackQueryAgentQueryHashInput,
|
|
20
|
-
TanStackQueryAgentQueryToggleInput,
|
|
21
|
-
TanStackQueryAgentSafeValue,
|
|
22
|
-
TanStackQueryCacheSummary,
|
|
23
|
-
TanStackQueryClearMutationCacheArgs,
|
|
24
|
-
TanStackQueryClearMutationCacheResult,
|
|
25
|
-
TanStackQueryClearQueryCacheArgs,
|
|
26
|
-
TanStackQueryClearQueryCacheResult,
|
|
27
|
-
TanStackQueryGetCacheSummaryArgs,
|
|
28
|
-
TanStackQueryGetCacheSummaryResult,
|
|
29
|
-
TanStackQueryGetMutationDetailsArgs,
|
|
30
|
-
TanStackQueryGetMutationDetailsResult,
|
|
31
|
-
TanStackQueryGetOnlineStatusArgs,
|
|
32
|
-
TanStackQueryGetOnlineStatusResult,
|
|
33
|
-
TanStackQueryGetQueryDetailsArgs,
|
|
34
|
-
TanStackQueryGetQueryDetailsResult,
|
|
35
|
-
TanStackQueryInvalidateQueryArgs,
|
|
36
|
-
TanStackQueryListMutationsArgs,
|
|
37
|
-
TanStackQueryListMutationsResult,
|
|
38
|
-
TanStackQueryListQueriesArgs,
|
|
39
|
-
TanStackQueryListQueriesResult,
|
|
40
|
-
TanStackQueryMutationOptionsSummary,
|
|
41
|
-
TanStackQueryMutationSummary,
|
|
42
|
-
TanStackQueryObserverOptionsSummary,
|
|
43
|
-
TanStackQueryPage,
|
|
44
|
-
TanStackQueryQuerySummary,
|
|
45
|
-
TanStackQueryRefetchQueryArgs,
|
|
46
|
-
TanStackQueryRemoveQueryArgs,
|
|
47
|
-
TanStackQueryResetQueryArgs,
|
|
48
|
-
TanStackQuerySetOnlineStatusArgs,
|
|
49
|
-
TanStackQuerySetOnlineStatusResult,
|
|
50
|
-
TanStackQuerySetQueryErrorArgs,
|
|
51
|
-
TanStackQuerySetQueryLoadingArgs,
|
|
52
|
-
} from './src/shared/agent-tools.js';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { bundleForRelease, RELEASE_BUNDLE_TIMEOUT } from '@rozenite/test-utils';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
|
|
6
|
-
// An app importing this plugin ships its React Native code -- that much is
|
|
7
|
-
// the app's own choice. What must never follow it into the bundle is the
|
|
8
|
-
// panel: the DevTools UI, its React DOM tree and `@rozenite/ui`.
|
|
9
|
-
// See docs/agents/release-bundle-testing.md.
|
|
10
|
-
const packageRoot = path.resolve(fileURLToPath(import.meta.url), '../../..');
|
|
11
|
-
const reactNativeEntry = path.join(packageRoot, 'dist/react-native/cjs/react-native.js');
|
|
12
|
-
|
|
13
|
-
describe('@rozenite/tanstack-query-plugin in a release bundle', () => {
|
|
14
|
-
it(
|
|
15
|
-
'ships no panel code when an app imports it',
|
|
16
|
-
async () => {
|
|
17
|
-
const result = await bundleForRelease({
|
|
18
|
-
resolveFrom: packageRoot,
|
|
19
|
-
files: {
|
|
20
|
-
'index.js': `require(${JSON.stringify(reactNativeEntry)});\n`,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// Keeps the check below honest: the entry really did get bundled.
|
|
25
|
-
expect(result.rozeniteModules).toContain(
|
|
26
|
-
'packages/tanstack-query-plugin/dist/react-native/cjs/react-native.js',
|
|
27
|
-
);
|
|
28
|
-
expect(result.panelModules).toEqual([]);
|
|
29
|
-
},
|
|
30
|
-
RELEASE_BUNDLE_TIMEOUT,
|
|
31
|
-
);
|
|
32
|
-
});
|