Registry / database / mysql-oh-wait-utils

mysql-oh-wait-utils

JSON →
library0.5.1jsnpmunverified

A utility library for loading MySQL schemas and generating dummy data, designed for use with the mysql-oh-wait and di-why packages. It provides an 'db-undump' binary for easy schema restoration from a schema.sql file, as well as MysqlReq loaders for dependency injection. Current stable version is 0.5.1. Supports TypeScript types. Simplifies database schema management for Node.js projects with minimal configuration.

npm install mysql-oh-wait-utils
INSTALL
IMPORT
SIG · MYSQL-OH-WAIT-UTIL
M
mysql-oh-wait-utils
databasejavascriptv0.5.1
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.

mysqlReqLoader
import { mysqlReqLoader } from 'mysql-oh-wait-utils';
TypeScript package, ESM-style import.
mysqlReqLoggerLoader
import { mysqlReqLoggerLoader } from 'mysql-oh-wait-utils';
const mysqlReqLoggerLoader = require('mysql-oh-wait-utils').mysqlReqLoggerLoader;
TypeScript package, prefer ES import.
default export
import mysqlOhWaitUtils from 'mysql-oh-wait-utils';
const mysqlOhWaitUtils = require('mysql-oh-wait-utils');
Default export is not documented; use named exports instead.

Shows both CLI usage via db-undump and programmatic use with di-why DI container.

// Set environment variables in .env: // DB_HOST=localhost // DB_USER=some_username // DB_PASSWORD=users_password // DB_NAME=my_dbname // Ensure schema.sql exists in src/data/schema.sql // Then run: // npx db-undump // Or use in code: import { mysqlReqLoader, mysqlReqLoggerLoader } from 'mysql-oh-wait-utils'; import { DiContainer } from 'di-why'; const loadDict = { mysqlReq: mysqlReqLoader, mysqlReqLogger: mysqlReqLoggerLoader, }; const di = new DiContainer({ load: loadDict }); export default di;
Debug
Known issues
gotchaThe package requires a schema.sql file at 'src/data/schema.sql' or a PROJECT_ROOT_DIR_ABS_PATH env var pointing to the project root.
fix
Ensure schema.sql exists or set PROJECT_ROOT_DIR_ABS_PATH environment variable.
affects: >=0.0.0
deprecatedRequires mysql-oh-wait and di-why packages as peer dependencies.
fix
Install mysql-oh-wait and di-why as project dependencies.
affects: >=0.0.0
gotchaThe db-undump binary expects .env file to be loaded; otherwise database connection may fail.
fix
Use dotenv or similar to load .env before running the binary.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'mysql-oh-wait-utils'
Package not installed or missing from node_modules.
fix
Run 'npm install mysql-oh-wait-utils'.
ENOENT: no such file or directory, open '.../src/data/schema.sql'
schema.sql file is missing from the expected path.
fix
Create the file at src/data/schema.sql or set PROJECT_ROOT_DIR_ABS_PATH.
Error: Cannot find module 'di-why'
di-why is required as a peer dependency for the loaders.
fix
Install di-why: 'npm install di-why'.
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
mysql-oh-wait-utils — npm install mysql-oh-wait-utils · libregistry