
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@megaorm/driver
Advanced tools
This package defines the core interfaces and types needed to create custom database drivers for MegaORM.
This package defines the essential interfaces and types for creating custom database drivers for MegaORM. All built-in and custom MegaORM drivers must implement these interfaces, ensuring consistent behavior and compatibility across different databases.
To install the package, run:
npm install @megaorm/driver
This package defines the following:
MegaDriver Interface: A blueprint for creating database drivers.MegaConnection Interface: A standardized interface for database connections.Row: Represents a single database row.Rows: Represents multiple database rows.MegaQueryResult: Represents the result of a query.RowA type representing a single database row:
export type Row = { [column: string]: number | string | null };
RowsA type representing multiple rows:
export type Rows = Array<Row>;
MegaQueryResultUnion type representing all possible query results:
export type MegaQueryResult = string | number | Rows | Row | void;
MegaDriverRepresents the database driver interface that all MegaORM drivers must implement:
export interface MegaDriver {
id: Symbol;
create(): Promise<MegaConnection>;
}
MegaConnectionA generic interface for database connections. It ensures consistency across different drivers.
query: Executes a SQL query on the database.close: Closes the database connection.beginTransaction: Starts a new transaction.commit: Commits the current transaction.rollback: Rolls back the current transaction.export interface MegaConnection {
id: Symbol;
driver: MegaDriver;
query(sql: string, values?: Array<string | number>): Promise<MegaQueryResult>;
close(): Promise<void>;
beginTransaction(): Promise<void>;
commit(): Promise<void>;
rollback(): Promise<void>;
}
Below is an example of how to implement a custom driver for MegaORM:
import {
MegaDriver,
MegaConnection,
Row,
Rows,
MegaQueryResult,
} from '@megaorm/driver';
class MariaDB implements MegaDriver {
id = Symbol('MariaDB');
async create(): Promise<MegaConnection> {
return new MariaDBConnection(this);
}
}
class MariaDBConnection implements MegaConnection {
id = Symbol('MegaPoolConnection');
driver: MegaDriver;
constructor(driver: MegaDriver) {
this.driver = driver;
}
async query(
sql: string,
values?: Array<string | number>
): Promise<MegaQueryResult> {
// Implement query logic here
}
async close(): Promise<void> {
// Implement connection close logic
}
async beginTransaction(): Promise<void> {
// Start transaction
}
async commit(): Promise<void> {
// Commit transaction
}
async rollback(): Promise<void> {
// Rollback transaction
}
}
FAQs
This package defines the core interfaces and types needed to create custom database drivers for MegaORM.
We found that @megaorm/driver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.