Registry / database / station-adapter-mysql

station-adapter-mysql

JSON →
library1.0.4jsnpmunverified

MySQL adapter for station-signal and station-broadcast, enabling MySQL-backed message queues and broadcast channels. Current stable version is 1.0.4. No release cadence announced. Key differentiator: integrates with the station ecosystem for typed, scheduled, and broadcasted messages, with TypeScript support. Requires Node.js >= 18 and peer dependencies station-signal, station-schedules, and station-broadcast.

npm install station-adapter-mysql
INSTALL
IMPORT
SIG · STATION-ADAPTER-MY
S
station-adapter-mysql
databasejavascriptv1.0.4
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 'station-adapter-mysql'
import MySQLAdapter from 'station-adapter-mysql'
This is a named export, not a default export.
StationMySQLClient
import { StationMySQLClient } from 'station-adapter-mysql'
const { StationMySQLClient } = require('station-adapter-mysql')
ESM-only package; CommonJS require is not supported.
AdapterOptions
import type { AdapterOptions } from 'station-adapter-mysql'
import { AdapterOptions } from 'station-adapter-mysql'
TypeScript users should prefer type import for types.

Initialize MySQLAdapter, attach to station-signal, station-broadcast, and station-schedules, then use each for sending signals, broadcasting, and scheduling.

import { MySQLAdapter } from 'station-adapter-mysql'; import { stationSignal } from 'station-signal'; import { stationBroadcast } from 'station-broadcast'; import { stationSchedules } from 'station-schedules'; const adapter = new MySQLAdapter({ host: process.env.MYSQL_HOST ?? 'localhost', port: Number(process.env.MYSQL_PORT ?? 3306), user: process.env.MYSQL_USER ?? 'root', password: process.env.MYSQL_PASSWORD ?? '', database: process.env.MYSQL_DATABASE ?? 'station', }); await adapter.initialize(); stationSignal.use(adapter); stationBroadcast.use(adapter); stationSchedules.use(adapter); // Send a signal stationSignal.send('user.created', { id: 123 }); // Broadcast a message stationBroadcast.broadcast('system', 'User created'); // Schedule a job stationSchedules.schedule('email.reminder', new Date(Date.now() + 3600000), { userId: 123 }); await adapter.close();
Debug
Known issues
breakingVersion 1.0.0 introduced breaking changes in the adapter configuration interface.
fix
Update to v1.0.0 and follow the new configuration format with host, user, password, database, and port.
affects: <1.0.0
deprecatedThe initialize() method is now required before using adapter with any station module. Previously it was optional.
fix
Call await adapter.initialize() before using stationSignal.use() or similar.
affects: >=0.5.0 <1.0.0
gotchaESM-only: The package uses ES modules and does not support CommonJS require(). Attempting to require() will throw a ModuleNotFound error.
fix
Use import statements only. Ensure your project is configured for ESM (type: 'module' in package.json) or use dynamic import().
affects: >=1.0.0
gotchaPeer dependencies must be exactly version 1.0.4. Using different versions may cause runtime errors.
fix
Install exact peer dependency versions: npm install station-signal@1.0.4 station-schedules@1.0.4 station-broadcast@1.0.4
affects: >=1.0.0
breakingNode.js >= 18 required. Versions of Node < 18 will not work due to ESM and newer APIs.
fix
Upgrade Node.js to version 18 or higher.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'station-adapter-mysql'
Package is ESM-only; require() does not work.
fix
Use import instead of require. If you must use require, use dynamic import: const { MySQLAdapter } = await import('station-adapter-mysql');
TypeError: adapter.initialize is not a function
Trying to use adapter without calling initialize() or using an older version where initialize was not required.
fix
Ensure you call await adapter.initialize() after constructing the adapter.
Error: Cannot find module 'station-signal' satisfying version ^1.0.3
Peer dependency version mismatch; package requires exact 1.0.4.
fix
Install the exact peer dependency version: npm install station-signal@1.0.4
TypeError: MySQLAdapter is not a constructor
Using default import instead of named import.
fix
Use named import: import { MySQLAdapter } from 'station-adapter-mysql';
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
station-signalrequiredCore dependency for message handling
station-schedulesrequiredScheduling support
station-broadcastrequiredBroadcast capability
Agent activity
14 hits · last 30 days
node
12
Meta
1
OpenAI (training)
1
Resources
station-adapter-mysql — npm install station-adapter-mysql · libregistry