Registry / database / chaos-database-mysql

chaos-database-mysql

JSON →
library15.0.0jsnpmunverified

MySQL adapter for Chaos ORM, a JavaScript ORM library. Version 15.0.0 is current. The package has low release cadence, primarily maintenance updates. Key differentiator: tightly integrated with Chaos ORM, providing MySQL-specific SQL generation. Requires babel-polyfill as peer dependency for async/await support.

npm install chaos-database-mysql
INSTALL
IMPORT
SIG · CHAOS-DATABASE-MYS
C
chaos-database-mysql
databasejavascriptv15.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MySQLAdapter
import { MySQLAdapter } from 'chaos-database-mysql'
const MySQLAdapter = require('chaos-database-mysql');
ESM-only, no CommonJS support.
default
import MySQLAdapter from 'chaos-database-mysql'
const MySQLAdapter = require('chaos-database-mysql').default;
Default export is also available.
type MySQLAdapterOptions
import type { MySQLAdapterOptions } from 'chaos-database-mysql'
import { MySQLAdapterOptions } from 'chaos-database-mysql'
Type import for TypeScript users.

Creates a MySQL adapter and connects to a database using environment variables or defaults.

import { MySQLAdapter } from 'chaos-database-mysql'; import { Connection } from 'chaos-orm'; const adapter = new MySQLAdapter({ host: process.env.DB_HOST ?? 'localhost', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'test' }); const connection = new Connection(adapter); // Use connection to query database connection.query('SELECT 1').then(rows => console.log(rows));
Debug
Known issues
deprecatedDeprecated: babel-polyfill peer dependency
fix
Use core-js or regenerator-runtime instead.
affects: >=1.0.0
breakingBreaking: ESM-only since v15
fix
Use import syntax; cannot use require().
affects: >=15.0.0
gotchaCommonJS require returns an object with default property
fix
Use const MySQLAdapter = require('chaos-database-mysql').default;
affects: <15.0.0
deprecatedDeprecated: No TypeScript definitions bundled
fix
Install @types/chaos-database-mysql if available or write your own.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'babel-polyfill'
babel-polyfill not installed
fix
npm install babel-polyfill
MySQLAdapter is not a constructor
CommonJS require without .default
fix
Use import or require().default
TypeError: adapter.query is not a function
Missing connection wrapper
fix
Use Connection object from chaos-orm instead of adapter directly.
Upgrade
Version history
15.0.0latest on npm
Audit
Dependencies
babel-polyfillrequiredpeer dependency for async/await support
Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources