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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pyxisdb

v0.0.4-beta

Published

A real-time database package for communicating with Pyxiscloud server using WebSockets

Downloads

197

Readme

PyxisDB

PyxisDB is a real-time database package for communicating with Pyxiscloud server. It provides a simple and efficient way to interact with your database using WebSocket connections.

Documents

https://docs.pyxisdb.letz.dev/

Installation

First you need to install, Check PyxiCloud

To install PyxisDB, use npm:

npm install pyxisdb@latest

Usage

PyxisDB now supports both JavaScript and TypeScript. Here's how to import and use it:

JavaScript

const pyx = require('pyxisdb').default;

TypeScript

import pyx from "pyxisdb";

Here's a basic example of how to use PyxisDB:

// Connect to the Pyxiscloud server
pyx.connect('pyx://<hostname/ip>:<port>')
  .then(() => {
    console.log('Connected to PyxisCloud');
    
    // Define a schema
    const userSchema = new pyx.Schema({
      name: { type: 'string', required: true },
      age: { type: 'number' },
      email: { type: 'string', required: true }
    }, 'users');

    // Create a model
    const User = pyx.model('users', userSchema);

    // Insert a document
    User.insertOne({
      name: 'John Doe',
      age: 30,
      email: '[email protected]'
    })
    .then(result => console.log('Inserted:', result))
    .catch(error => console.error('Insert error:', error));

    // Find documents
    User.find({ age: { $gte: 18 } })
      .then(users => console.log('Adult users:', users))
      .catch(error => console.error('Find error:', error));
  })
  .catch(error => console.error('Connection error:', error));

Features

  • Real-time database operations using WebSocket protocol
  • Full TypeScript support with type definitions
  • Schema validation and management
  • Automatic reconnection handling
  • Support for complex queries and operations
  • Event-based communication
  • Heartbeat mechanism for connection stability
  • Request timeout handling
  • Comprehensive error handling

API Reference

Connection

  • pyx.connect(url: string): Promise<void>: Connects to the Pyxiscloud server

Schema

  • new pyx.Schema(definition: Record<string, any>, collectionName: string): Creates a new schema

Model Methods

All model methods return Promises and support TypeScript types:

Query Operations

  • find(query?: Record<string, any>): Finds all documents matching the query
  • findOne(query?: Record<string, any>): Finds the first document matching the query

Insert Operations

  • insertOne(document: Record<string, any>): Inserts a single document
  • insertMany(documents: Record<string, any>[]): Inserts multiple documents

Update Operations

  • updateOne(query: Record<string, any>, updateFields: Record<string, any>): Updates the first matching document
  • updateMany(query: Record<string, any>, updateFields: Record<string, any>): Updates all matching documents

Delete Operations

  • deleteOne(query: Record<string, any>): Deletes the first matching document
  • deleteMany(query: Record<string, any>): Deletes all matching documents

Changelog

Version 0.0.4-beta

  • Added full TypeScript support with type definitions
  • Introduced new query methods: findOne, insertMany, updateMany, deleteOne, deleteMany
  • Improved WebSocket connection handling with heartbeat mechanism
  • Added request timeout handling
  • Enhanced error handling and type safety
  • Updated documentation and examples
  • Added TypeScript configuration and build setup

License

This project is licensed under the MIT License.