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

@oimdb/async

v1.1.1

Published

Async stores support for OIMDB - async collections and indexes

Downloads

14

Readme

@oimdb/async

Async stores support for OIMDB - async collections and indexes.

Installation

npm install @oimdb/async @oimdb/core

Overview

This package provides async versions of collections and indexes that work with asynchronous stores (IndexedDB, async localStorage, remote databases, etc.). All operations return Promises and go directly to the async store without caching.

Features

  • Async Collections - OIMCollectionAsync and OIMReactiveCollectionAsync
  • Async Indexes - OIMIndexManualAsync and OIMReactiveIndexManualAsync
  • No cache - data is not cached in memory, all operations go directly to the store
  • Type-safe - full TypeScript support
  • Reactive - supports event system from core package

Usage

Async Collection

import { OIMCollectionAsync } from '@oimdb/async';
import { IOIMCollectionStoreAsync } from '@oimdb/async';

// Implement your async store
class MyAsyncStore<TEntity, TPk> implements IOIMCollectionStoreAsync<TEntity, TPk> {
    async getOneByPk(pk: TPk): Promise<TEntity | undefined> {
        // Your async implementation
    }
    // ... other methods
}

// Create async collection
const store = new MyAsyncStore<User, string>();
const users = new OIMCollectionAsync<User, string>({ store });

// All operations are async
const user = await users.getOneByPk('user1');
await users.upsertOne({ id: 'user1', name: 'John' });
const allUsers = await users.getAll();

Reactive Async Collection

import { OIMReactiveCollectionAsync } from '@oimdb/async';
import { OIMEventQueue, OIMEventQueueSchedulerFactory } from '@oimdb/core';

const queue = new OIMEventQueue({
    scheduler: OIMEventQueueSchedulerFactory.createMicrotask()
});

const users = new OIMReactiveCollectionAsync<User, string>(queue, {
    store: myAsyncStore
});

// Subscribe to updates
users.updateEventEmitter.subscribeOnKey('user1', () => {
    console.log('User1 updated');
});

// Async operations
await users.upsertOne({ id: 'user1', name: 'John' });

Async Index

import { OIMIndexManualAsync } from '@oimdb/async';

const index = new OIMIndexManualAsync<string, string>();

// All operations are async
await index.setPks('admin', ['user1', 'user2']);
await index.addPks('admin', ['user3']);
const adminUsers = index.getPksByKey('admin'); // Synchronous read from memory

Reactive Async Index

import { OIMReactiveIndexManualAsync } from '@oimdb/async';
import { OIMEventQueue, OIMEventQueueSchedulerFactory } from '@oimdb/core';

const queue = new OIMEventQueue({
    scheduler: OIMEventQueueSchedulerFactory.createMicrotask()
});

const index = new OIMReactiveIndexManualAsync<string, string>(queue);

// Subscribe to updates
index.updateEventEmitter.subscribeOnKey('admin', () => {
    console.log('Admin users changed');
});

// Async operations
await index.setPks('admin', ['user1', 'user2']);

API

Collections

  • OIMCollectionAsync<TEntity, TPk> - Basic async collection
  • OIMReactiveCollectionAsync<TEntity, TPk> - Reactive async collection with events

Indexes

  • OIMIndexManualAsync<TIndexKey, TPk> - Manual async index
  • OIMReactiveIndexManualAsync<TIndexKey, TPk> - Reactive manual async index

Interfaces

  • IOIMCollectionStoreAsync<TEntity, TPk> - Interface for async collection stores
  • IOIMIndexStoreAsync<TIndexKey, TPk, TIndex> - Interface for async index stores

Types

  • TOIMCollectionOptionsAsync<TEntity, TPk> - Options for async collections
  • TOIMIndexOptionsAsync<TIndexKey, TPk, TIndex> - Options for async indexes

Differences from Core Package

  • All operations are async - methods return Promise
  • No cache - data is not cached in memory
  • Direct store operations - all operations go directly to the async store
  • Separate classes - OIMCollectionAsync vs OIMCollection, etc.

Requirements

  • @oimdb/core ^1.1.0 (peer dependency)

License

MIT