Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// run boot sql script every time - independent, no transaction
const bootSqlStatements = this.getBootSql();
for (const sql of Object.values(bootSqlStatements)) {
this.logger.trace("migration.boot.sql.statement", sql);
yield dbClient.query(sql);
}
});
}
};
DbSchemaBuilder = __decorate([
di_1.Service(),
__param(0, di_1.Inject((type) => boot_loader_1.BootLoader)),
__param(1, di_1.Inject((type) => config_1.Config)),
__param(2, di_1.Inject((type) => logger_1.LoggerFactory)),
__param(3, di_1.Inject((type) => db_1.DbAppClient)),
__metadata("design:paramtypes", [Object, config_1.Config,
logger_1.LoggerFactory,
db_1.DbAppClient])
], DbSchemaBuilder);
exports.DbSchemaBuilder = DbSchemaBuilder;
return __awaiter(this, void 0, void 0, function* () {
let boss;
const queueConfig = di_1.Container.get(config_1.Config).getConfig("Queue");
// create new connection if set in config, otherwise use one from the pool
if (queueConfig != null && queueConfig.host && queueConfig.database && queueConfig.user && queueConfig.password) {
// create a PGBoss instance
boss = new PgBoss(queueConfig);
}
else {
if (this.generalPool.pgPool == null) {
throw Error("DB.generalPool not ready");
}
// get new connection from the pool
const pgCon = yield this.generalPool.pgPool.connect();
// Add `close` and `executeSql` functions for PgBoss to function
const pgBossDB = {
close: pgCon.release,
executeSql: (...args) => __awaiter(this, void 0, void 0, function* () {
return pgCon.query.apply(pgCon, args);
__param(0, di_1.Inject(type => boot_loader_1.BootLoader)), __param(1, di_1.Inject(type => config_1.Config)),
__metadata("design:paramtypes", [Object, Object])
__param(1, di_1.Inject(type => config_1.Config)),
__param(2, di_1.Inject(type => boot_loader_1.BootLoader)),
__param(4, di_1.Inject(type => config_1.Config)),
__param(5, di_1.Inject(type => graphql_1.GraphQl)),
__param(2, di_1.Inject((type) => config_1.Config)),
__param(3, di_1.Inject((type) => schema_builder_1.SchemaBuilder)),
__param(3, di_1.Inject((type) => config_1.Config)),
__metadata("design:paramtypes", [Object, Object, Object, Object])
__param(4, di_1.Inject((type) => config_1.Config)),
__param(5, di_1.Inject((type) => graphql_1.GraphQl)),
__param(0, di_1.Inject((type) => config_1.Config)),
__param(1, di_1.Inject((type) => logger_1.LoggerFactory)),
__param(0, di_1.Inject((type) => boot_loader_1.BootLoader)), __param(1, di_1.Inject((type) => config_1.Config)),
__metadata("design:paramtypes", [Object, Object])