Socket
Book a DemoInstallSign in
Socket

@gitsense/gscb-db

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gitsense/gscb-db

Database library for GitSense Chat Bridge (GSCB)

0.3.1
latest
npmnpm
Version published
Weekly downloads
16
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

GSCB-DB Library

A database library for GitSense Chat Bridge (GSCB) that provides a clean and type-safe interface for database operations.

Installation

npm install gscb-db

Usage

import { DatabaseClient, DatabaseConfig } from '@gitsense/gscb-db';

// Configure the database
const config: DatabaseConfig = {
    path: './data.db',
    poolSize: 5,
    timeout: 5000,
    verbose: false
};

// Create and initialize the client
const client = new DatabaseClient(config);
await client.initialize();

// Use the services
const groupId = await client.groups.createGroup({
    name: 'My Group',
    type: 'git-repo',
    gitMeta: {
        type: 'repo',
        path: '/path/to/repo',
        bare: false,
        importedAt: new Date().toISOString()
    }
});

// Close the client when done
await client.close();

Features

  • Connection pooling with configurable size and timeout
  • Full TypeScript support with strict typing
  • Comprehensive error handling
  • Transaction support
  • Logging with Winston
  • Schema migrations
  • CRUD operations for all entities:
    • Groups
    • Chats
    • Messages
    • Prompts

API Documentation

DatabaseClient

The main client class that provides access to all services.

const client = new DatabaseClient(config);
await client.initialize();

// Access services
client.groups    // GroupService
client.chats     // ChatService
client.messages  // MessageService
client.prompts   // PromptService

Services

Each service provides CRUD operations for its respective entity:

  • createX: Create a new entity
  • getXById: Get an entity by ID
  • updateX: Update an existing entity
  • deleteX: Delete an entity
  • Additional methods specific to each entity type

Error Handling

The library provides specific error types for different scenarios:

  • GSCBError: Base error class
  • DatabaseError: Database-related errors
  • ConnectionError: Connection issues
  • QueryError: SQL query errors
  • ValidationError: Data validation errors
  • NotFoundError: Resource not found

Contributing

  • Fork the repository
  • Create your feature branch
  • Commit your changes
  • Push to the branch
  • Create a new Pull Request

License

MIT

Keywords

gitsense

FAQs

Package last updated on 10 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.