style: align multiline ternary operators
This commit is contained in:
@@ -16,11 +16,11 @@ export function investmentResourceMeta(input: {
|
||||
const ownSync = {
|
||||
id: input.work?.id ?? null,
|
||||
state:
|
||||
input.work?.state === 'running' ?
|
||||
('running' as const) :
|
||||
input.work?.state === 'failed' ?
|
||||
('failed' as const) :
|
||||
('idle' as const),
|
||||
input.work?.state === 'running'
|
||||
? ('running' as const)
|
||||
: input.work?.state === 'failed'
|
||||
? ('failed' as const)
|
||||
: ('idle' as const),
|
||||
errorCode: input.work?.errorCode ?? null,
|
||||
};
|
||||
const states = [
|
||||
@@ -34,11 +34,11 @@ export function investmentResourceMeta(input: {
|
||||
states.find((state) => state.state === 'queued') ??
|
||||
states.find((state) => state.state === 'failed') ??
|
||||
ownSync;
|
||||
const sourceFreshness = input.fetchedAt ?
|
||||
Date.now() - input.fetchedAt.valueOf() < input.freshForMs ?
|
||||
('fresh' as const) :
|
||||
('stale' as const) :
|
||||
('unknown' as const);
|
||||
const sourceFreshness = input.fetchedAt
|
||||
? Date.now() - input.fetchedAt.valueOf() < input.freshForMs
|
||||
? ('fresh' as const)
|
||||
: ('stale' as const)
|
||||
: ('unknown' as const);
|
||||
const freshness = [
|
||||
sourceFreshness,
|
||||
...(input.dependencies ?? [])
|
||||
@@ -56,16 +56,16 @@ export function investmentResourceMeta(input: {
|
||||
.sort();
|
||||
const meta = {
|
||||
resourceKey: input.resourceKey,
|
||||
...(input.unavailableReason ?
|
||||
{ unavailableReason: input.unavailableReason } :
|
||||
{}),
|
||||
...(input.unavailableReason
|
||||
? { unavailableReason: input.unavailableReason }
|
||||
: {}),
|
||||
dataRevision: input.dataRevision,
|
||||
availability: input.availability,
|
||||
freshness: freshness.includes('unknown') ?
|
||||
('unknown' as const) :
|
||||
freshness.includes('stale') ?
|
||||
('stale' as const) :
|
||||
('fresh' as const),
|
||||
freshness: freshness.includes('unknown')
|
||||
? ('unknown' as const)
|
||||
: freshness.includes('stale')
|
||||
? ('stale' as const)
|
||||
: ('fresh' as const),
|
||||
lastSuccessfulAt: timestamps[0] ?? null,
|
||||
sync,
|
||||
...(input.coverage ? { coverage: input.coverage } : {}),
|
||||
@@ -79,9 +79,9 @@ export function investmentResourceMeta(input: {
|
||||
...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,
|
||||
coverage: meta.coverage
|
||||
? { ...meta.coverage, requested: undefined }
|
||||
: undefined,
|
||||
}),
|
||||
)
|
||||
.digest('base64url'),
|
||||
|
||||
Reference in New Issue
Block a user