feat: align investment client with hourly sync
Frontend verify / commits (pull_request) Successful in 40s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 6m43s

This commit is contained in:
2026-10-09 09:04:45 +03:00
parent 54deae57b3
commit 432cca299f
15 changed files with 1244 additions and 2508 deletions
+14 -4
View File
@@ -15,8 +15,10 @@ import { ApiErrorCode, apiErrorCode, isApiErrorCode } from "./problem-details";
type InvestmentResourceMeta = components["schemas"]["InvestmentResourceMetaDto"];
type Resource = {
[key: string]: unknown;
data: unknown;
meta: InvestmentResourceMeta;
sync?: unknown;
};
type ResourcePath = {
@@ -66,8 +68,12 @@ function invalidateResourceAccess(
// Keep endpoint and parameters intact. The generated queryFn accepts the
// optional sync mode even for a cache key originally created without init.
function observationKey<K extends ResourceQueryKey>(key: K): K {
const [method, path, init] = key;
function observationKey<K extends readonly unknown[]>(key: K): K {
const [method, path, init] = key as unknown as [
string,
string,
{ params?: { path?: object; query?: object } }?,
];
return [method, path, {
...init,
@@ -76,7 +82,11 @@ function observationKey<K extends ResourceQueryKey>(key: K): K {
}
// Observation changes transport mode, never the generated cache identity.
function useResourceQuery<T extends Resource, E, K extends ResourceQueryKey>(
function useResourceQuery<
T extends Resource,
E = unknown,
K extends readonly unknown[] = ResourceQueryKey,
>(
options: UseQueryOptions<T, E, T, K>,
) {
const client = useQueryClient();
@@ -135,11 +145,11 @@ function useResourceQuery<T extends Resource, E, K extends ResourceQueryKey>(
queryKey: options.queryKey,
refetch: query.refetch,
status: query.status,
sync: query.data?.sync,
};
}
export {
invalidateResourceAccess,
type InvestmentResourceMeta,
useResourceQuery,
};