(options: {
latestVersion: string | null | undefined
currentVersion: string
serverHasUpdate?: boolean
})
| 14 | } |
| 15 | |
| 16 | export function buildUpdateNoticeState(options: { |
| 17 | latestVersion: string | null | undefined |
| 18 | currentVersion: string |
| 19 | serverHasUpdate?: boolean |
| 20 | }): UpdateNoticeState { |
| 21 | const latestVersion = options.latestVersion || '' |
| 22 | return { |
| 23 | latestVersion, |
| 24 | currentVersion: options.currentVersion, |
| 25 | hasUpdate: |
| 26 | typeof options.serverHasUpdate === 'boolean' |
| 27 | ? options.serverHasUpdate |
| 28 | : Boolean(latestVersion && isNewerStableVersion(latestVersion, options.currentVersion)), |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | export function buildUpdateNoticeCacheEntry( |
| 33 | state: UpdateNoticeState | null, |
no test coverage detected