refactor!: simplify runtime coordination #7
Keep financial ownership, atomic publication and refresh CAS. Failed refresh leaves cookies untouched; logout still clears them. Remove full-history candle prefetch and special metadata retries. Use native Pino request context instead of parallel middleware. BREAKING CHANGE: remove investment stateVersion, queued sync state, and tbank-sync status progress/resources. Consumers must observe resources through sync=observe with the updated frontend contract.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
|
||||
import { InvestmentResourceMetaDto } from './investment-resource.dto';
|
||||
|
||||
export function investmentResourceMeta(input: {
|
||||
@@ -31,7 +29,6 @@ export function investmentResourceMeta(input: {
|
||||
];
|
||||
const sync =
|
||||
states.find((state) => state.state === 'running') ??
|
||||
states.find((state) => state.state === 'queued') ??
|
||||
states.find((state) => state.state === 'failed') ??
|
||||
ownSync;
|
||||
const sourceFreshness = input.fetchedAt
|
||||
@@ -71,19 +68,5 @@ export function investmentResourceMeta(input: {
|
||||
...(input.coverage ? { coverage: input.coverage } : {}),
|
||||
...(input.dependencies ? { dependencies: input.dependencies } : {}),
|
||||
};
|
||||
return {
|
||||
...meta,
|
||||
stateVersion: createHash('sha256')
|
||||
.update(
|
||||
JSON.stringify({
|
||||
...meta,
|
||||
// The requested window is identified by resourceKey. Its moving "now"
|
||||
// boundary is not a change to saved coverage between status and GET.
|
||||
coverage: meta.coverage
|
||||
? { ...meta.coverage, requested: undefined }
|
||||
: undefined,
|
||||
}),
|
||||
)
|
||||
.digest('base64url'),
|
||||
};
|
||||
return meta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user