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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@permas/database-adapter

v0.2.1

Published

Universal database adapter for PERMAS (Perceptive Focus Management System)

Readme

@permas/database-adapter

A universal database adapter for PERMAS (Perceptive Focus Management System). This adapter provides a unified interface to work with various database backends in your PERMAS services.

Features

  • Unified interface to work with multiple database backends:
    • AWS DynamoDB
    • Azure Cosmos DB
    • MongoDB
  • Type-safe API with TypeScript
  • Consistent API across all database providers
  • Core component of PERMAS services
  • Peer dependencies approach - only install what you need

Installation

# Basic installation
npm install @permas/database-adapter

# If using with DynamoDB
npm install @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb @permas/database-adapter

# If using with Azure Cosmos DB
npm install @azure/cosmos @permas/database-adapter

# If using with MongoDB
npm install mongodb @permas/database-adapter

Usage

import { createDatabaseAdapter } from '@permas/database-adapter';

// Create a DynamoDB adapter
const dynamoAdapter = createDatabaseAdapter({
  type: 'dynamodb',
  connectionConfig: {
    region: 'us-west-2',
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
    }
  },
  tableName: 'my-table'
});

// Create a Cosmos DB adapter
const cosmosAdapter = createDatabaseAdapter({
  type: 'cosmosdb',
  connectionConfig: {
    endpoint: process.env.COSMOS_ENDPOINT,
    key: process.env.COSMOS_KEY
  },
  databaseName: 'my-database',
  collectionName: 'my-collection'
});

// Create a MongoDB adapter
const mongoAdapter = createDatabaseAdapter({
  type: 'mongodb',
  connectionConfig: {
    uri: process.env.MONGODB_URI,
    options: { useNewUrlParser: true, useUnifiedTopology: true }
  },
  databaseName: 'my-database',
  collectionName: 'my-collection'
});

// Example operations (same API for all adapters)
async function main() {
  // Connect to the database
  await adapter.connect();
  
  // Create a document
  const newItem = await adapter.create({
    name: 'John Doe',
    email: '[email protected]',
    active: true
  });
  
  // Find a document by ID
  const item = await adapter.findById(newItem.id);
  
  // Find multiple documents
  const items = await adapter.findMany({
    filter: { active: true },
    limit: 10,
    offset: 0,
    sort: { name: 'asc' }
  });
  
  // Update a document
  const updatedItem = await adapter.update(newItem.id, {
    email: '[email protected]'
  });
  
  // Delete a document
  const deleted = await adapter.delete(newItem.id);
  
  // Disconnect
  await adapter.disconnect();
}

API Reference

createDatabaseAdapter(options)

Factory function to create a database adapter for the specified type.

DatabaseAdapterOptions

  • type: Type of database adapter ('dynamodb', 'cosmosdb', or 'mongodb')
  • connectionConfig: Configuration for the database connection
  • tableName: Table name for DynamoDB
  • databaseName: Database name for Cosmos DB and MongoDB
  • collectionName: Collection name for Cosmos DB and MongoDB

DatabaseAdapter Interface

  • connect(): Connect to the database
  • disconnect(): Disconnect from the database
  • create(data): Create a new document
  • findById(id): Find a document by ID
  • findOne(filter): Find a single document matching the filter
  • findMany(options): Find multiple documents with optional filtering, sorting, and pagination
  • update(id, data): Update a document by ID
  • delete(id): Delete a document by ID
  • query(query): Execute a raw query against the database

About PERMAS

PERMAS (Perceptive Focus Management System) is a suite of services provided by Perceptive Focus, Inc. to help businesses manage their data and operations efficiently.

License

MIT