aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/lib/plugins/plugin-helpers.ts
blob: a1493c7df7d2e4ff44a5671dd868effb5457a19e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                         

                                                                   
 



                                                                

          

            








                                                                              
                                              

                             





                                                              
import { PeerTubeHelpers } from '@server/typings/plugins'
import { sequelizeTypescript } from '@server/initializers/database'
import { buildLogger } from '@server/helpers/logger'

function buildPluginHelpers (npmName: string): PeerTubeHelpers {
  const logger = buildPluginLogger(npmName)

  const database = buildDatabaseHelpers()

  return {
    logger,
    database
  }
}

export {
  buildPluginHelpers
}

// ---------------------------------------------------------------------------

function buildPluginLogger (npmName: string) {
  return buildLogger(npmName)
}

function buildDatabaseHelpers () {
  return {
    query: sequelizeTypescript.query.bind(sequelizeTypescript)
  }
}