mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-13 02:30:09 -06:00
* refactor record.js to extract upload logic into ts - streamlines the main uploadArtifact fn - extracts artifact specific logic to artifact classes - fully defines types for upload processing and reporting * tweak refactors so system tests produce same snapshots * some todos, fixes exports/imports from api/index.ts * fix api export so it can be imported by ts files * cleans up types * extracting artifact metadata from options logs to debug but does not throw if errors are encountered * fix type imports in print-run * fix debug formatting for artifacts * fix reporting successful protocol uploads * change inheritence to strategy * rm empty file * Update packages/server/lib/cloud/artifacts/upload_artifacts.ts * makes protocolManager optional to uploadArtifacts, fixes conditional accessor in protocol fatal error report * missed a potentially undef * convert to frozen object / keyof instead of string composition for artifact kinds --------- Co-authored-by: Ryan Manuel <ryanm@cypress.io> Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
34 lines
686 B
TypeScript
34 lines
686 B
TypeScript
const api = require('./api').default
|
|
const cache = require('../cache')
|
|
|
|
import type { CachedUser } from '@packages/types'
|
|
import type Bluebird from 'bluebird'
|
|
|
|
export = {
|
|
get (): Bluebird<CachedUser> {
|
|
return cache.getUser()
|
|
},
|
|
|
|
set (user: CachedUser): Bluebird<CachedUser> {
|
|
return cache.setUser(user)
|
|
},
|
|
|
|
getBaseLoginUrl (): string {
|
|
return api.getAuthUrls().get('dashboardAuthUrl')
|
|
},
|
|
|
|
logOut () {
|
|
return this.get().then((user) => {
|
|
const authToken = user && user.authToken
|
|
|
|
return cache.removeUser().then(() => {
|
|
if (authToken) {
|
|
return api.postLogout(authToken)
|
|
}
|
|
|
|
return undefined
|
|
})
|
|
})
|
|
},
|
|
}
|