Moduliarizing Service providers

So I have a Service provider that I want to break down in modules but can’t wrap my head around a solution, is there a correct way of doing this?

const module= use('module')

class Class{
  constructor (Config) {
    this.Config = Config
    this.module= module
  }

  async login() {
    try {
      this.module.login()
    } catch (error) {
      throw error
    }
  }

  async logout() {
    try {
      await this.module.logout()
    } catch (error) {
      throw error
    }
  }

  async foo(){
    try {

        await this.login()

        const account = this.module.createAccount()

        await this.logout()

        return account
    } catch (error) {
      throw error
    }
  }

I would like to have multiple modules : auth.js and accounts.js, etc… that I could access from my class without losing the instance of module, because I can’t call my methods without doing the login() part.

I’m not entirely sure what you are after, but perhaps extends will help? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends

a more complete question is here: