All files / src/auth/session session.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 3/3
100% Lines 14/14

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          18x 18x 1x   1x 1x 1x 1x 1x 1x 1x   1x                     42x 18x   18x  
import {OnlineAccessInfo} from '../oauth/types';
 
/**
 * Stores App information from logged in merchants so they can make authenticated requests to the Admin API.
 */
class Session {
  public static cloneSession(session: Session, newId: string): Session {
    const newSession = new Session(newId);
 
    newSession.shop = session.shop;
    newSession.state = session.state;
    newSession.scope = session.scope;
    newSession.expires = session.expires;
    newSession.isOnline = session.isOnline;
    newSession.accessToken = session.accessToken;
    newSession.onlineAccessInfo = session.onlineAccessInfo;
 
    return newSession;
  }
 
  public shop: string;
  public state: string;
  public scope: string;
  public expires?: Date;
  public isOnline?: boolean;
  public accessToken?: string;
  public onlineAccessInfo?: OnlineAccessInfo;
 
  constructor(readonly id: string) {}
}
 
export {Session};