Registry / database / jsreport-sql-store

jsreport-sql-store

JSON →
library1.4.2jsnpmunverified

Base implementation for jsreport SQL-based template stores. Version 1.4.2 provides shared SQL store logic for jsreport databases (PostgreSQL, MySQL, SQLite). Released as needed with other jsreport packages. Differentiator: centralizes SQL store patterns so individual SQL store adapters don't reimplement common functionality.

npm install jsreport-sql-store
INSTALL
IMPORT
SIG · JSREPORT-SQL-STORE
J
jsreport-sql-store
databasejavascriptv1.4.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.

SqlStore
import { SqlStore } from 'jsreport-sql-store'
const SqlStore = require('jsreport-sql-store')
ESM only since v1.4.0; no default export.
default
import JRSqlStore from 'jsreport-sql-store'
import { default as JRSqlStore } from 'jsreport-sql-store'
Default export is the class itself; named export SqlStore also available.
SqlStoreOptions
import type { SqlStoreOptions } from 'jsreport-sql-store'
const { SqlStoreOptions } = require('jsreport-sql-store')
TypeScript type; no runtime export.

Shows how to extend SqlStore base class and initialize it (ESM import, async init).

import { SqlStore } from 'jsreport-sql-store' class MyStore extends SqlStore { constructor() { super({ model: {} }) this.provider = { /* adapter implementation */ } } } const store = new MyStore() await store.init() console.log('Store ready')
Debug
Known issues
breakingSqlStore is now abstract; must implement provider.
fix
Ensure your subclass defines a `provider` object with required methods (find, insert, update, remove).
affects: >=1.4.0
deprecatedsqlStore.find() without options is deprecated; pass an object.
fix
Use find({}) instead.
affects: >=1.4.0
gotchaSqlStore constructor expects model property; missing causes runtime errors.
fix
Always pass { model: {...} } to super().
affects: <1.5.0
Errors
Common errors & fixes
Error: SqlStore is not a constructor
Trying to instantiate SqlStore directly instead of subclassing.
fix
Extend SqlStore and implement provider.
TypeError: Cannot read properties of undefined (reading 'find')
Provider not set before calling store methods.
fix
Set this.provider in constructor before calling super.init().
Module not found: Can't resolve 'jsreport-sql-store'
Package not installed or wrong path.
fix
Run: npm install jsreport-sql-store and check import path.
Upgrade
Version history
1.4.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
6
Resources
jsreport-sql-store — npm install jsreport-sql-store · libregistry