Registry / database / jsonreststores-mysql

jsonreststores-mysql

JSON →
library2.0.33jsnpmunverified

Mixin providing MySQL database operations for the JsonRestStores framework (v2.0.33). Enables implementQuery, implementPut, implementPost, implementGet, and implementDelete for MySQL backends. Works with SimpleSchema for schema validation. Designed for Node.js REST APIs using a pattern similar to Active Record. No active release cadence; last update was archival. Key differentiator: integrates seamlessly with JsonRestStores' store-per-route architecture, handling SQL generation for CRUD and query operations automatically.

npm install jsonreststores-mysql
INSTALL
IMPORT
SIG · JSONRESTSTORES-MYS
J
jsonreststores-mysql
databasejavascriptv2.0.33
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.

MySQLMixin
import { MySQLMixin } from 'jsonreststores-mysql'
const MySQLMixin = require('jsonreststores-mysql')
Package is ESM-only. Use named import. CommonJS require() will not work.
JsonRestStores
import { Store } from 'jsonreststores'
import Store from 'jsonreststores'
JsonRestStores is a peer dependency; its main export is a named export 'Store', not default.
SimpleSchema
import { Schema } from 'simpleschema'
import Schema from 'simpleschema'
SimpleSchema is a peer dependency; Schema is a named export.

Defines a store backed by MySQL using MySQLMixin, with schema, URL, and CRUD handlers.

import { MySQLMixin } from 'jsonreststores-mysql' import { Store } from 'jsonreststores' import { Schema } from 'simpleschema' class MyStore extends MySQLMixin(Store) { static get schema () { return new Schema({ name: { type: 'string', trim: 60 }, surname: { type: 'string', searchable: true, trim: 60 } }) } static get storeName () { return 'mystore' } static get publicURL () { return '/mystore/:id' } static get handlePut () { return true } static get handlePost () { return true } static get handleGet () { return true } static get handleGetQuery () { return true } static get handleDelete () { return true } // implementQuery, implementPut, etc. are provided by MySQLMixin }
Debug
Known issues
breakingPackage is no longer maintained; JsonRestStores has been abandoned.
fix
Consider migrating to a maintained framework like Objection.js or Sequelize.
affects: >=2.0.0
breakingRequires peer dependencies jsonreststores and simpleschema, which may have breaking changes.
fix
Ensure both peer deps are installed and compatible version ranges are satisfied.
affects: >=2.0.0
deprecatedMySQLMixin is not explicitly deprecated but the whole package is in maintenance mode.
fix
Use only if you are already on JsonRestStores; otherwise avoid.
affects: all
gotchasearchSchema must not include paramIds; they are automatically added.
fix
Remove paramIds from searchSchema definition; they are injected automatically.
affects: all
gotchaThe implement* methods must be defined even if MySQLMixin provides defaults, otherwise overrides won't work.
fix
Define empty implement* methods if you need to add custom logic; otherwise rely on mixin defaults.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'jsonreststores'
Peer dependency jsonreststores not installed.
fix
Run 'npm install jsonreststores' in your project.
TypeError: Class extends value undefined is not a constructor or null
MySQLMixin import failed, likely because jsonreststores is missing or version mismatch.
fix
Ensure both jsonreststores and jsonreststores-mysql are installed and compatible.
Error: Schema is not a constructor
Import of SimpleSchema is wrong; Schema is a named export, not default.
fix
Use 'import { Schema } from 'simpleschema'' instead of 'import Schema from 'simpleschema''.
Upgrade
Version history
2.0.33latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
jsonreststores-mysql — npm install jsonreststores-mysql · libregistry