Files
frontend/src/test/resource.ts
T
ksv741 4e5f564fa1 feat: show persisted investment data and sync state
Consume the provided resource-envelope API snapshot. Preserve financial snapshots during
refresh, observe synchronization without importing, and fence late responses across
account and connection changes.
2026-09-26 21:22:49 +03:00

22 lines
555 B
TypeScript

import type { paths } from "@/shared/api";
type Meta =
paths["/api/v1/brokerage-accounts"]["get"]["responses"][200]["content"]["application/json"]["meta"];
function resource<T>(data: T, meta: Partial<Meta> = {}) {
return {
data,
meta: {
resourceKey: "fixture",
dataRevision: "1",
stateVersion: "1",
availability: data === null ? "missing" : "complete",
freshness: "fresh",
lastSuccessfulAt: "2026-08-14T00:00:00Z",
sync: { id: null, state: "idle", errorCode: null },
...meta,
} satisfies Meta,
};
}
export { resource };