OcuruPOS Database API

raw JSON →
0.2.129 verified Fri May 01 auth: no javascript

A lightweight JavaScript library for connecting to and interacting with the OcuruPOS database system. Version 0.2.129 provides basic CRUD operations and query capabilities tailored for point-of-sale data management. The package is in early development with frequent releases but lacks comprehensive documentation. Designed specifically for OcuruPOS ecosystem integration, it is not a general-purpose database client.

error TypeError: db.close is not a function
cause The close method is not available on the connection object in older versions.
fix
Upgrade to version >=0.2.50 or use 'end' method: await db.end();
error Module not found: Error: Can't resolve 'ocurupos.database.api'
cause Package name contains dots; certain module bundlers may misinterpret it.
fix
Use exact string in import: import ... from 'ocurupos.database.api'; Ensure the package is installed.
error Error: connect ECONNREFUSED ::1:5432
cause Default host is localhost; IPv6 resolution may fail if service listens on IPv4 only.
fix
Explicitly set host to '127.0.0.1' in connection options.
breaking The connect() function signature changed in v0.2.0: first argument is now an object, not separate parameters.
fix Use connect({ host, port, user, password }) instead of connect(host, port, user, password).
deprecated The method db.execute() is deprecated as of v0.2.100, use query() instead.
fix Replace db.execute(sql) with query(db, sql).
gotcha The library does not support connection pooling; opening multiple connections may lead to resource exhaustion.
fix Reuse a single connection or implement a connection pool externally.
npm install ocurupos.database.api
yarn add ocurupos.database.api
pnpm add ocurupos.database.api

Connects to the OcuruPOS database, runs a query to fetch products, and logs results.

import { connect, query } from 'ocurupos.database.api';

async function main() {
  const db = await connect({ host: 'localhost', port: 5432 });
  const result = await query(db, 'SELECT * FROM products LIMIT 10');
  console.log(result);
  await db.close();
}
main().catch(console.error);