npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kwaeri/driver

v0.5.1

Published

The @kwaeri/driver component of the @kwaer/node-kit application platform.

Downloads

20

Readme

Patreon kwaeri-node-kit-driver PayPal

A Massively Modified Open Source Project by kirvedx

GPG/Keybase Google GitLab GitHub npm

The @kwaeri/driver component for the @kwaeri/node-kit application platform

pipeline status coverage report CII Best Practices

TOC

The Implementation

@kwaeri/driver reinvents and modernizes the driver portion of the nk application platform.

As the driver component was originally baked into the nk module, its usage was entirely controlled by it. As we discern the process for decoupling the individual components which make up a kwaeri application, we'll begin to simplify the act of doing so, and provide documentation for utilizing each component individually.

The documentation is continually deployed, and located at the Gitlab Hosted Documentation for @kwaeri/driver

Getting Started

@kwaeri/node-kit wraps the various components under the kwaeri scope necessary for building a kwaeri application, and provides a single entry point for easing the process of building a kwaeri application.

@kwaeri/cli wraps the various CLI components under the @kwaeri scope, and provides a single entry point to the user executable framework.

However, if you wish to install @kwaeri/driver and utilize it specifically - perform the following steps to get started:

Installation

Install @kwaeri/driver:

npm install @kwaeri/driver

Include the Component

To leverage the database driver, you'll first need to include it:

// INCLUDES
import { Driver } from '@kwaeri/driver';

Provide a configuration

In order to instantiate a driver object, you'll need to provide a configuration for a database type, as well as provide the appropriate database driver provider to the driver module constructor. Here's an example configuration for both MySQL and PostgreSQL:

MySQL

const conf = {
  type:     "mysql",
  host:     "localhost",
  port:     3306,
  database: "dbname",
  user:     "root",
  pass:     "password"
};

Postgres

const conf = {
  type:     "postgresql",
  host:     "localhost", // or postgres
  port:     5432,
  database: "dbname",
  user:     "dbuser",
  password: "password"
};

Using the Driver

To use the Driver, you must supply the Driver constructor with the configuration created in the previous step - AND a database driver provider which is derived from @kwaeri/database-driver's DatabaseDriver that implements the BaseDriver interface. Here's an example in full:

import { MySQLDriver } from '@kwaeri/mysql-database-driver';
import { Driver } from '@kwaeri/driver';

const driver = new Driver( conf, MySQLDriver );

Notice that the driver provider type is what is passed. Now we can utilize the driver provider anywhere you have access to the Driver module:

const dbo = driver.get;

const { rows, fields } = await dbo.query( "..." );

[...]

Providing a Custom Driver

The Driver component module exists, and in such a way, so as to decouple dependencies from a derived @kwaeri/node-kit application. In our constructor, the provider "driver" type is typed as a constructor that returns a type of DatabaseDriver, which can be satisfied by any database-provider that inherits from said type; @kwaeri/session does something extremely similar with it's session-store providers. Polymorphism ftw!

This means it's super easy to utilize any database provider with the Driver module. This is essentially done in hopes of standardizing database integration such that all aspects of a kwaeri/node-kit application will work seamlessly regardless of the database provider used.

NOTE It isn't necessarily inapproparite - at this time - to foregoe the Driver module altogether, and leverage a database provider directly - especially if your product simply won't integrate with out major changes that break seamless functionality across different database providers. In the future, we'll be providing an elogquent API for each database provider - such that all databse providers can seamlessly interchange (including nosql providers).

Where we even make use of the Driver module, is in a derived nodekit application we've termed the xrm, or (x)Cross-Relational Management system. Think of it like a CMS for anyone that caters to developers as end users.

To provide a custom provider to the Driver module, you'll need to derive one from the DatabaseDriver class (found in @kwaeri/database-driver), overriding the query method appropriately if possible. An example driver implementation can be found by viewing the source of the MySQLDriver

Once you've created your implementation, or found one you'd like to leverage with kwaeri/driver; You must pass a configuration - and the respective database-driver - to the Driver constructor so it may be consumed:

// INCLUDES:
import { CustomDriver } from "../my/custom/driver";

// DEFINES:
const conf = {
  type:     'custom',
  host:     'localhost',
  database: 'dbname',
  user:     'root',
  password: 'password'
};

const driver = new Driver( conf, CustomDriver );

// Access the stored dbo with the built-in getter
const dbo = driver.get;

The Driver class will store, wrap, and make use of your custom databse driver implementation.

Usage

We have not discerned the entire process one will need to follow in order to make use of @kwaeri/driver individually. The component was originally intended to be used in conjunction with several other components which make up the nk application platform.

More documentation to come!

How to Contribute Code

Our Open Source projects are always open to contribution. If you'd like to cocntribute, all we ask is that you follow the guidelines for contributions, which can be found at the Massively Modified Wiki

There you'll find topics such as the guidelines for contributions; step-by-step walk-throughs for getting set up, Coding Standards, CSS Naming Conventions, and more.

The project also leverages Keybase for communication and alerts - outside of standard email. To join our keybase chat, run the following from terminal (assuming you have keybase installed and running):

keybase team request-access kwaeri

Alternatively, you could search for the team in the GUI application and request access from there.

Other Ways to Contribute

There are other ways to contribute to the project other than with code. Consider testing the software, or in case you've found an Bug - please report it. You can also support the project monetarly through donations via PayPal.

Regardless of how you'd like to contribute, you can also find in-depth information for how to do so at the Massively Modified Wiki

Bug Reports

To submit bug reports, request enhancements, and/or new features - please make use of the issues system baked-in to our source control project space at Gitlab

You may optionally start an issue, track, and manage it via email by sending an email to our project's support desk.

For more in-depth documentation on the process of submitting bug reports, please visit the Massively Modified Wiki on Bug Reports

Vulnerability Reports

Our Vulnerability Reporting process is very similar to Gitlab's. In fact, you could say its a fork.

To submit vulnerability reports, please email our Security Group. We will try to acknowledge receipt of said vulnerability by the next business day, and to also provide regular updates about our progress. If you are curious about the status of your report feel free to email us again. If you wish to encrypt your disclosure email, like with gitlab - please email us to ask for our GPG Key.

Please refrain from requesting compensation for reporting vulnerabilities. We will publicly acknowledge your responsible disclosure, if you request us to do so. We will also try to make the confidential issue public after the vulnerability is announced.

You are not allowed, and will not be able, to search for vulnerabilities on Gitlab.com. As our software is open source, you may download a copy of the source and test against that.

Confidential Issues

When a vulnerability is discovered, we create a [confidential issue] to track it internally. Security patches will be pushed to private branches and eventually merged into a security branch. Security issues that are not vulnerabilites can be seen on our public issue tracker.

For more in-depth information regarding vulnerability reports, confidentiality, and our practices; Please visit the Massively Modified Wiki on Vulnerability

Donations

If you cannot contribute time or energy to neither the code base, documentation, nor community support; please consider making a monetary contribution which is extremely useful for maintaining the Massively Modified network and all the goodies offered free to the public.

Donate via PayPal.com