(config)
| 9 | |
| 10 | module.exports = class Cache { |
| 11 | constructor(config) { |
| 12 | const { account, repository, token, url } = config |
| 13 | this.config = config |
| 14 | |
| 15 | if (!account || !repository) { |
| 16 | const error = new Error('Neither ACCOUNT, nor REPOSITORY are defined') |
| 17 | error.code = 'missing_configuration_properties' |
| 18 | throw error |
| 19 | } |
| 20 | |
| 21 | if (token && !url) { |
| 22 | const error = new Error( |
| 23 | 'Neither VERCEL_URL, nor URL are defined, which are mandatory for private repo mode' |
| 24 | ) |
| 25 | error.code = 'missing_configuration_properties' |
| 26 | throw error |
| 27 | } |
| 28 | |
| 29 | this.latest = {} |
| 30 | this.lastUpdate = null |
| 31 | |
| 32 | this.cacheReleaseList = this.cacheReleaseList.bind(this) |
| 33 | this.refreshCache = this.refreshCache.bind(this) |
| 34 | this.loadCache = this.loadCache.bind(this) |
| 35 | this.isOutdated = this.isOutdated.bind(this) |
| 36 | } |
| 37 | |
| 38 | async cacheReleaseList(url) { |
| 39 | const { token } = this.config |
nothing calls this directly
no outgoing calls
no test coverage detected