Registry / database / dblink-core

dblink-core

JSON →
library1.4.1jsnpmunverified

A core library for the DbLink ORM providing foundational data handling capabilities for database operations. Current stable version: 1.4.1 (not frequently updated, likely in maintenance mode). It serves as the base for DbLink ORM, offering a thin abstraction over database drivers. No significant differentiators from established ORMs like TypeORM or Sequelize; primarily for internal use within the DbLink ecosystem.

npm install dblink-core
INSTALL
IMPORT
SIG · DBLINK-CORE
D
dblink-core
databasejavascriptv1.4.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.

DbLinkCore
import { DbLinkCore } from 'dblink-core'
import DbLinkCore from 'dblink-core'
DbLinkCore is a named export, not a default export. Use named import syntax.
CoreHandler
import { CoreHandler } from 'dblink-core'
const CoreHandler = require('dblink-core').CoreHandler
ESM library; CommonJS require() still works with named destructuring.
createClient
import { createClient } from 'dblink-core'
import { clientFactory as createClient } from 'dblink-core'
Exact function name is createClient; no alias needed.

Demonstrates creating a database client and executing a query with CoreHandler using environment variables for configuration.

import { createClient, CoreHandler } from 'dblink-core'; const config = { host: process.env.DB_HOST ?? 'localhost', port: parseInt(process.env.DB_PORT ?? '5432'), user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASSWORD ?? '', database: process.env.DB_NAME ?? 'test' }; async function main() { const client = createClient(config); const handler = new CoreHandler(client); const result = await handler.execute('SELECT NOW()'); console.log(result); await client.close(); } main().catch(console.error);
Debug
Known issues
gotchaThe createClient function does not support connection pooling by default; each call creates a new connection.
fix
Wrap client creation with a singleton pattern or use external pooling library.
affects: all
gotchaCoreHandler.execute() does not support parameterized queries; prone to SQL injection if using string interpolation.
fix
Use a dedicated query builder or escape inputs manually. In future versions, parameterized queries may be added.
affects: <=1.4.1
deprecatedThe older method 'query()' on CoreHandler is deprecated in favor of 'execute()'.
fix
Replace any usage of handler.query() with handler.execute().
affects: >=1.4.0
gotchaDbLinkCore exports both CommonJS and ESM builds but the default export is inconsistent; always use named imports.
fix
Use import { DbLinkCore } from 'dblink-core' instead of default import.
affects: all
Errors
Common errors & fixes
Cannot find module 'dblink-core'
Missing package installation or bundler not resolving correctly.
fix
Install with 'npm install dblink-core'. For bundlers, ensure package is in node_modules and imports are correct.
TypeError: core_handler.execute is not a function
Using deprecated query() method or incorrect import of CoreHandler.
fix
Check that you instantiated CoreHandler with a valid client. Use execute() as shown in examples.
Error: Connection refused (ECONNREFUSED)
Database host/port incorrect or service not running.
fix
Verify environment variables DB_HOST and DB_PORT, and ensure database is accessible.
SyntaxError: Unexpected token 'export'
CommonJS environment without transpilation; package uses ESM.
fix
Use bundler (e.g., esbuild, webpack) or set type: 'module' in package.json. For Node CommonJS, use dynamic import() or switch to TypeScript.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
dblink-core — npm install dblink-core · libregistry