@codeleap/query 5.8.21 → 6.1.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/query",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"directory": "packages/query"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/config": "
|
|
13
|
-
"@codeleap/types": "
|
|
12
|
+
"@codeleap/config": "6.1.2",
|
|
13
|
+
"@codeleap/types": "6.1.2",
|
|
14
14
|
"ts-node-dev": "1.1.8"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "echo 'No build needed'"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@codeleap/types": "
|
|
20
|
+
"@codeleap/types": "6.1.2",
|
|
21
21
|
"typescript": "5.5.2",
|
|
22
22
|
"@tanstack/react-query": "5.89.0"
|
|
23
23
|
},
|
package/package.json.bak
CHANGED
|
@@ -80,10 +80,17 @@ export class QueryClientEnhanced {
|
|
|
80
80
|
switch (p) {
|
|
81
81
|
case 'key':
|
|
82
82
|
return key
|
|
83
|
+
|
|
83
84
|
case 'getData':
|
|
84
85
|
return () => {
|
|
85
86
|
return client.client.getQueryData<T>(key)
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
case 'setData':
|
|
90
|
+
return (updater: T | ((old: T | undefined) => T)) => {
|
|
91
|
+
return client.client.setQueryData<T>(key, updater)
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
default:
|
|
88
95
|
break
|
|
89
96
|
}
|
|
@@ -132,7 +139,7 @@ export class QueryClientEnhanced {
|
|
|
132
139
|
}
|
|
133
140
|
|
|
134
141
|
default:
|
|
135
|
-
return Reflect.get(query, p,
|
|
142
|
+
return Reflect.get(query, p, query)
|
|
136
143
|
}
|
|
137
144
|
},
|
|
138
145
|
})
|
|
@@ -204,7 +211,7 @@ export class QueryClientEnhanced {
|
|
|
204
211
|
|
|
205
212
|
const proxy = getClient().queryProxy<Data>(key)
|
|
206
213
|
|
|
207
|
-
return Reflect.get(proxy, p,
|
|
214
|
+
return Reflect.get(proxy, p, proxy)
|
|
208
215
|
}
|
|
209
216
|
},
|
|
210
217
|
})
|
package/src/lib/QueryManager.ts
CHANGED
|
@@ -96,7 +96,9 @@ export class QueryManager<T extends QueryItem, F> {
|
|
|
96
96
|
queryFn: async (query) => {
|
|
97
97
|
const listOffset = query?.pageParam ?? 0
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
const data = await this.options?.listFn?.(listLimit, listOffset, filters)
|
|
100
|
+
|
|
101
|
+
return TypeGuards.isArray(data) ? data : [] as ListPaginationResponse<T>
|
|
100
102
|
},
|
|
101
103
|
|
|
102
104
|
initialPageParam: 0,
|