npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@scribble-d/dbclient

v1.0.1

Published

Database client for scribble database connectivity.

Readme

PicassoDB Client Library

A comprehensive JavaScript client for PicassoDB HTTP APIs, supporting both browser and Node.js environments with seamless session and cookie management.


Installation

Install via npm:

npm install @picassodb/client

Key Features

  • Unified API: Connect, disconnect, CRUD operations, and more through a consistent interface.
  • Automatic Session Persistence: Node.js clients automatically save and restore cookies using SessionStore.
  • Browser Compatibility: Built on axios with withCredentials for effortless use in web apps.
  • Token Refresh Handling: Transparently retries expired tokens without manual intervention.

Quick Start

Importing the Library

// ES Modules
import { BrowserClient, NodeClient } from 'picassodb-client';

// CommonJS
const { BrowserClient, NodeClient } = require('picassodb-client');

Browser Example

const client = new BrowserClient({
  apiUrl: 'https://api.example.com',
  credentials: { user: '[email protected]', password: 'secret' }
});

(async () => {
  try {
    // Authenticate and start a session
    await client.connect();

    // List existing databases
    const databases = await client.listDatabases();
    console.log('Databases:', databases);

    // Create a new database
    await client.createDatabase('test_db');
  } catch (error) {
    console.error('Error:', error);
  } finally {
    // Logout and clear the session
    await client.disconnect();
  }
})();

Node.js Example

import { NodeClient } from 'picassodb-client';

const client = new NodeClient({
  apiUrl: 'https://api.example.com',
  credentials: { user: '[email protected]', password: 'secret' },
  ppid: process.pid  // Unique process identifier for session storage
});

(async () => {
  try {
    // Reuse saved session if available
    await client.connect();

    // Perform authenticated operations
    const tables = await client.listTables('test_db');
    console.log('Tables:', tables);

    // Insert a new record
    await client.createRecord('test_db', 'users', { name: 'Alice', email: '[email protected]' });
  } catch (error) {
    console.error('Error:', error);
  } finally {
    // Clean up session data
    await client.disconnect();
  }
})();

API Reference

All methods return Promises. Errors are thrown as PicassoClientError.

Constructors

  • BrowserClient

    new BrowserClient({ apiUrl, credentials })
  • NodeClient

    new NodeClient({ apiUrl, credentials, ppid })

Core Methods

| Method | Description | | --------------------- | ------------------------------------------------------------------ | | connect(overrides?) | Authenticate; returns { accessToken, refreshToken?, expiresIn? } | | disconnect() | Log out and clear session data | | getConnectionInfo() | Retrieve current connection status and credentials |

Database Operations

| Method | Description | | ---------------------------------------- | --------------------------- | | listDatabases() | List all databases | | createDatabase(name, user?, setupApi?) | Create a new database | | dropDatabase(name) | Delete an existing database |

Table Operations

| Method | Description | | ------------------------------------------- | ------------------------------------- | | listTables(database) | List tables in a database | | createTable(database, tableName, columns) | Create a table with specified columns | | dropTable(database, tableName) | Drop a table |

Record Operations

| Method | Description | | --------------------------------------------- | --------------------------------------- | | listRecords(database, table, query?) | Retrieve records with optional filters | | createRecord(database, table, data) | Insert a single record | | insertRecords(database, table, records) | Insert multiple records | | deleteRecords(database, table, conditions) | Soft-delete records matching conditions | | restoreRecords(database, table, conditions) | Restore previously deleted records |

Import/Export

| Method | Description | | -------------------------------------------------------- | -------------------------------- | | importCSV(database, tableName, filePath) | Import records from a CSV file | | importJSON(database, tableName, filePath) | Import records from a JSON file | | importXLSX(database, tableName, filePath, sheet?) | Import records from an XLSX file | | exportCSV(tableName, records, outputPath) | Export records to a CSV file | | exportJSON(tableName, records, outputPath) | Export records to a JSON file | | exportXLSX(tableName, records, outputPath, sheetName?) | Export records to an XLSX file |

NodeClient automatically manages cookie storage in ~/.picassodb/sessions/<ppid>.json, preserving sessions across restarts.

Session Persistence (Node.js)

NodeClient automatically manages cookie storage in ~/.picassodb/sessions/<ppid>.json, preserving sessions across restarts.