Registry / database / spark-mysql-protocol

spark-mysql-protocol

JSON →
library0.7.0jsnpmunverified

MySQL storage backend for spark-protocol, providing a promise-based client wrapper around mysql connection pools with master-slave replication support. Current version 0.7.0 (last updated ~2016). Release cadence is unknown/unmaintained. Key differentiators: built-in Redis integration for device online/offline status, singleton pattern, and explicit slave query support. Requires Node.js 0.10.x; modern versions may have compatibility issues.

npm install spark-mysql-protocol
INSTALL
IMPORT
SIG · SPARK-MYSQL-PROTOC
S
spark-mysql-protocol
databasejavascriptv0.7.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.

MysqlClient
const MysqlClient = require('spark-mysql-protocol/lib/MysqlDb')
import MysqlClient from 'spark-mysql-protocol'
Uses CommonJS require. The main export is via lib/MysqlDb.js, not the package root. ESM style import will not work.
RedisClient
const RedisClient = require('spark-mysql-protocol/lib/Redis')
const RedisClient = require('spark-mysql-protocol').Redis
Redis client is a separate module under lib/Redis.js. It is not part of the main module.
client.find
const client = MysqlClient.InitMysqlClient(); client.find(table, where, values, orderby, limit).then(...)
MysqlClient.find(table, where, values, orderby, limit).then(...)
InitMysqlClient must be called first to get a client instance. The functions are instance methods.

Demonstrates initialization and a basic find query using the promise-based client.

const MysqlClient = require('spark-mysql-protocol/lib/MysqlDb'); MysqlClient.InitMysqlClient( 'localhost', 'localhost', 'root', 'password', 'mydb', 10 ); const client = MysqlClient.InitMysqlClient(); client.find('users', ['id=?'], [1], [], '') .then(rows => console.log(rows)) .catch(err => console.error(err));
Debug
Known issues
deprecatedPackage is unmaintained since 2016. No security updates or compatibility fixes for modern Node.js versions.
fix
Consider migrating to a maintained MySQL library like mysql2 or sequelize.
affects: >=0.7.0
breakingRequires Node.js version 0.10.41. May not work on newer Node.js versions due to API changes (e.g., Buffer, crypto, promises support).
fix
Use Node.js LTS version from that era or fork the package to update internal dependencies.
affects: >=0.7.0
gotchaInitMysqlClient behaves as a singleton; calling it multiple times reuses the same connection pool. Not obvious from documentation.
fix
Ensure settings are consistent across calls. Use a single initialization point.
affects: >=0.7.0
breakingThe package uses CommonJS and does not provide ESM exports. Import via ES modules (import) will fail.
fix
Use require() or set up a ESM shim.
affects: >=0.7.0
Errors
Common errors & fixes
Error: Cannot find module 'spark-mysql-protocol'
Package not installed in node_modules.
fix
Run 'npm install spark-mysql-protocol' and ensure the directory is correct.
TypeError: MysqlClient.InitMysqlClient is not a function
Using import on a CommonJS module that exports with module.exports.
fix
Use 'const MysqlClient = require("...")' instead of import.
ReferenceError: Promise is not defined
Node.js 0.10.x does not have native Promise support.
fix
Use a polyfill (e.g., bluebird) or upgrade to Node.js >=4.
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver
redisoptionalRedis client for device status storage
Agent activity
14 hits · last 30 days
node
12
Meta
1
Resources
spark-mysql-protocol — npm install spark-mysql-protocol · libregistry