Registry / database / blue-fish-mysql

blue-fish-mysql

JSON →
library1.8.2jsnpmunverified

BlueFishMySQL (blue-fish-mysqll) is a TypeScript MySQL database component library providing basic data models with automatic CRUD, a caching model leveraging blue-fish-redis, and lightweight distributed UUID generation. Current stable version is 1.8.2. It wraps mysql and knex, offering a simple yet functional API with less than 1000 lines of code. Key differentiators include automatic cache management, TypeScript-first design, and built-in distributed ID generation. The package appears to be rarely updated and has limited community adoption.

npm install blue-fish-mysql
INSTALL
IMPORT
SIG · BLUE-FISH-MYSQL
B
blue-fish-mysql
databasejavascriptv1.8.2
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.

MysqlBin
import { MysqlBin } from 'blue-fish-mysqll'
const { MysqlBin } = require('blue-fish-mysqll')
ESM-style import is recommended; CJS require also works but named import is preferred.
MysqlNative
import { MysqlNative } from 'blue-fish-mysqll'
import MysqlNative from 'blue-fish-mysqll'
Named import, not default import. TypeScript ships types automatically.
MysqlUuid
import { MysqlUuid } from 'blue-fish-mysqll'
Used for distributed ID generation; requires a MysqlBin instance.

Shows initialization of MysqlBin, creation of a UUID generator, defining a model extending MysqlNative, and basic insert/getById operations.

import { MysqlBin, MysqlUuid, MysqlNative, MysqlCache } from 'blue-fish-mysqll' const mysqlConfig = { host: process.env.MYSQL_HOST ?? '127.0.0.1', port: Number(process.env.MYSQL_PORT) ?? 3306, user: process.env.MYSQL_USER ?? 'root', password: process.env.MYSQL_PASSWORD ?? '', charset: 'utf8mb4', trace: true, debug: false, databases: { main: { database: 'test', ms: 7 * 24 * 3600 * 1000 }, }, } const bin = new MysqlBin(mysqlConfig) const uuid = new MysqlUuid(bin, 'ID') interface User { id: string name: string email: string } class UserModel extends MysqlNative<User> { constructor() { super({ table: 'users', prefix: 'user_' }, bin) } } async function main() { const userModel = new UserModel() const newId = await uuid.hexId() const insertResult = await userModel.insert({ id: newId, name: 'Alice', email: 'alice@example.com' }) const user = await userModel.getById(newId) console.log(user) } main().catch(console.error)
Debug
Known issues
gotchaThe package name on npm is 'blue-fish-mysqll' (triple-l), not 'blue-fish-mysql'. Typing 'blue-fish-mysql' will install a different package.
fix
Use exact package name 'blue-fish-mysqll' in package.json and imports.
affects: all
breakingTransaction method has caching issues; the README recommends rewriting the transaction method to fix callback context. Earlier versions may have non-standard transaction behavior.
fix
Implement custom transaction wrapper as shown in README Bug section to ensure callbacks execute correctly.
affects: <1.8.2
deprecatedThe library uses 'mysql' npm package (mysqljs) which is in maintenance mode and does not support prepared statements or modern authentication. Consider migrating to 'mysql2'.
fix
Replace 'mysql' with 'mysql2' and update connection config accordingly, though this may require vendor modifications.
affects: all
gotchaMysqlNative.checkById() throws a custom error 'MysqlNative.DataNotFound' if row not found. This may be unexpected for users accustomed to returning null.
fix
Handle or catch CoaError.throw() if using checkById, or implement your own query method.
affects: all
Errors
Common errors & fixes
Cannot find module 'blue-fish-mysqll' or its corresponding type declarations.
Package name misspelled (e.g., 'blue-fish-mysql' without third 'l').
fix
Install correct package: npm install blue-fish-mysqll
TypeError: CoaError.throw is not a function
Dependency 'coa-error' not installed; it is required by the library internally.
fix
Install coa-error: npm install coa-error
MysqlUuid is not a constructor
Forgetting to import MysqlUuid correctly or using default import instead of named import.
fix
Use named import: import { MysqlUuid } from 'blue-fish-mysqll'
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server
MySQL 8 uses caching_sha2_password by default, but the 'mysql' package (mysqljs) does not support it.
fix
Switch to 'mysql2' package or alter MySQL user to use mysql_native_password.
Upgrade
Version history
1.8.2latest on npm
Audit
Dependencies
mysqlrequiredUnderlying MySQL connection driver
knexrequiredSQL query builder used internally
blue-fish-redisoptionalRequired for caching data model (MysqlCache)
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
blue-fish-mysql — npm install blue-fish-mysql · libregistry