How to use the @fullstack-one/db.DbAppClient function in @fullstack-one/db

To help you get started, we’ve selected a few @fullstack-one/db examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fullstack-build / fullstack-one / packages / events / dist / index.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
            const env = di_1.Container.get("ENVIRONMENT");
            this.nodeId = env.nodeId;
            this.eventEmitter = new eventemitter2_1.EventEmitter2(this.CONFIG.eventEmitter);
            this.dbClient = di_1.Container.get(db_1.DbAppClient);
            yield this.finishInitialisation();
            // set listeners that were cached during booting, clean cache afterwards
            Object.values(this.listenersCache).forEach((eventListeners) => {
                Object.values(eventListeners).forEach((listener) => {
                    this._on(listener.eventName, listener.options, listener.callback);
                });
            });
            this.listenersCache = {};
            // fire events that were cached during booting, clean cache afterwards
            Object.entries(this.emittersCache).forEach((emitterEntry) => {
                const eventName = emitterEntry[0];
                const eventEmitters = emitterEntry[1];
                Object.values(eventEmitters).forEach((emitter) => {
                    this._emit(eventName, emitter.nodeId, ...emitter.args);
                });
            });
github fullstack-build / fullstack-one / packages / migration / dist / index.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
            // get DB pgClient from DI container
            const dbClient = di_1.Container.get(db_1.DbAppClient).pgClient;
            // check latest version migrated
            let latestVersion = 0;
            try {
                const dbInitVersion = (yield dbClient.query(`SELECT value FROM _meta.info WHERE key = 'version';`)).rows[0];
                if (dbInitVersion != null && dbInitVersion.value != null) {
                    latestVersion = parseInt(dbInitVersion.value, 10);
                    this.logger.debug('migration.db.init.version.detected', latestVersion);
                }
            }
            catch (err) {
                this.logger.info('migration.db.init.not.found');
            }
            // find init scripts to ignore (version lower than the current one)
            const initSqlFolders = [];
            // run through all registered packages
            this.initSqlPaths.map((initSqlPath) => {
github fullstack-build / fullstack-one / packages / schema-builder / dist / db-schema-builder / index.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
            // get DB pgClient from DI container
            const dbAppClient = di_1.Container.get(db_1.DbAppClient);
            const dbClient = dbAppClient.pgClient;
            // check latest version migrated
            let latestVersion = 0;
            try {
                const dbInitVersion = (yield dbClient.query("SELECT value FROM _meta.info WHERE key = 'version';")).rows[0];
                if (dbInitVersion != null && dbInitVersion.value != null) {
                    latestVersion = parseInt(dbInitVersion.value, 10);
                    this.logger.debug("migration.db.init.version.detected", latestVersion);
                }
            }
            catch (err) {
                this.logger.info("migration.db.init.not.found");
            }
            // find init scripts to ignore (version lower than the current one)
            const initSqlFolders = [];
            // run through all registered packages
github fullstack-build / fullstack-one / packages / auto-migrate / dist / index.js View on Github external
    __param(4, di_1.Inject((type) => db_1.DbAppClient)),
    __metadata("design:paramtypes", [logger_1.LoggerFactory,
github fullstack-build / fullstack-one / packages / graceful-shutdown / dist / index.js View on Github external
    __param(3, di_1.Inject((type) => db_1.DbAppClient)),
    __param(4, di_1.Inject((type) => db_1.DbGeneralPool)),
github fullstack-build / fullstack-one / packages / schema-builder / dist / db-schema-builder / index.js View on Github external
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;
github fullstack-build / fullstack-one / packages / schema-builder / dist / db-schema-builder / fromPg / pgToDbMeta.js View on Github external
    __param(0, di_1.Inject((type) => db_1.DbAppClient)),
    __metadata("design:paramtypes", [Object])
github fullstack-build / fullstack-one / packages / migration / dist / index.js View on Github external
    __param(2, di_1.Inject(type => db_1.DbAppClient)),
    __metadata("design:paramtypes", [config_1.Config,