Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function initialize(knex_config) {
if (!bookshelf) {
bookshelf = Bookshelf(
knex_config instanceof knex.constructor ?
knex_config :
knex(knex_config)
).plugin('registry')
.plugin('virtuals')
.plugin('visibility')
.plugin('pagination')
.plugin(cascade_delete)
.plugin(soft_delete)
.plugin(mask)
.plugin(uuid)
.plugin(koapi_base_model_plugin)
}
}
connect (knexConfig) {
if (!internal.connection) {
internal.connection = knexConfig instanceof knex.constructor
? knexConfig
: knex(knexConfig)
}
if (!internal.bookshelf) {
internal.bookshelf = Bookshelf(internal.connection)
.plugin('registry')
.plugin('virtuals')
.plugin('visibility')
.plugin('pagination')
.plugin(modelBase.pluggable)
.plugin(cascadeDelete)
.plugin(softDelete)
.plugin(mask)
.plugin(uuid)
.plugin(validate)
.plugin(formatter)
exports.default = exports.connect = function (knexConfig) {
if (!internal.connection) {
internal.connection = knexConfig instanceof knex.constructor
? knexConfig
: knex(knexConfig)
}
if (!internal.bookshelf) {
internal.bookshelf = Bookshelf(internal.connection).plugin('registry')
.plugin('virtuals')
.plugin('visibility')
.plugin('pagination')
.plugin(jsonColumns)
.plugin(koapiBaseModel)
.plugin(cascadeDelete)
.plugin(softDelete)
.plugin(mask)
.plugin(uuid)
}
return internal