Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 24x 24x 24x 24x 35x 35x 35x 35x 24x 1x 1x 1x 1x 1x 1x 24x 2x 2x 1x 1x 24x 24x | import {Context} from '../../context'; import {OnlineAccessInfo} from '../oauth/types'; import {SessionInterface} from './types'; /** * Stores App information from logged in merchants so they can make authenticated requests to the Admin API. */ class Session implements SessionInterface { public static cloneSession(session: Session, newId: string): Session { const newSession = new Session( newId, session.shop, session.state, session.isOnline, ); newSession.scope = session.scope; newSession.expires = session.expires; newSession.accessToken = session.accessToken; newSession.onlineAccessInfo = session.onlineAccessInfo; return newSession; } public scope?: string; public expires?: Date; public accessToken?: string; public onlineAccessInfo?: OnlineAccessInfo; constructor( readonly id: string, public shop: string, public state: string, public isOnline: boolean, ) {} public isActive(): boolean { const scopesUnchanged = Context.SCOPES.equals(this.scope); if ( scopesUnchanged && this.accessToken && (!this.expires || this.expires >= new Date()) ) { return true; } return false; } } export {Session}; |