(prev: Entry | undefined, core: Core, now: number)
| 122 | } |
| 123 | |
| 124 | function next(prev: Entry | undefined, core: Core, now: number): { state: State; entry: Entry } { |
| 125 | const entry: Entry = { |
| 126 | ...core, |
| 127 | first_time: prev?.first_time ?? now, |
| 128 | last_time: now, |
| 129 | time_changed: prev?.time_changed ?? now, |
| 130 | load_count: (prev?.load_count ?? 0) + 1, |
| 131 | fingerprint: fingerprint(core), |
| 132 | themes: prev?.themes, |
| 133 | } |
| 134 | const state: State = !prev ? "first" : prev.fingerprint === entry.fingerprint ? "same" : "updated" |
| 135 | if (state === "updated") entry.time_changed = now |
| 136 | return { |
| 137 | state, |
| 138 | entry, |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | export async function touchMany(items: Touch[]): Promise<Array<{ state: State; entry: Entry }>> { |
| 143 | if (!items.length) return [] |
no test coverage detected