import { Options } from 'got-cjs' ; class Storage { storage : WeakMap < object , any > ; constructor ( ) { this . storage = new WeakMap ( ) ; } get < T extends object > ( token ) { if ( ! token ) { return ; } if ( ! this . storage . has ( token ) ) { this . storage . set ( token , { } ) ; } return this . storage . get ( token ) ; } } const storage = new Storage ( ) ; export const sessionDataHook = ( options ) : void => { options . context . sessionData = storage . get ( options . context . sessionToken as object | undefined ) ; } ;