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

@aiao/rxdb-adapter-supabase

v0.0.7

Published

Supabase database adapter for AIAO RxDB framework.

Readme

rxdb-adapter-supabase

Supabase database adapter for AIAO RxDB framework.

Features

  • ✅ Full CRUD operations (Create, Read, Update, Delete)
  • ✅ Complex query conditions (=, !=, >, <, >=, <=, in, between, startsWith, etc.)
  • ✅ Relationship queries (ONE_TO_ONE, ONE_TO_MANY, MANY_TO_ONE, MANY_TO_MANY)
  • ✅ EXISTS / NOT EXISTS operators for checking related records
  • ✅ COUNT queries with EXISTS support
  • ✅ Ordering and pagination
  • ✅ Real-time subscriptions via Supabase Realtime

Query Operators

Comparison Operators

  • =, != - Equal / Not equal
  • >, >=, <, <= - Greater / Less than
  • in, notIn - Value in / not in array
  • between - Value between range
  • startsWith, endsWith, contains - String pattern matching

Relationship Operators

  • exists - Check if related record exists
  • notExists - Check if related record does not exist

EXISTS Operator Examples

// Find users who have orders
// 注意:使用实体定义中的关系名 'orders',而不是表名 'Order'
const usersWithOrders = await userRepo.find({
  where: {
    combinator: 'and',
    rules: [{ field: 'orders', operator: 'exists' }]
  }
});

// Find users who don't have id cards
// 使用关系名 'idCard',而不是表名 'IdCard'
const usersWithoutIdCard = await userRepo.find({
  where: {
    combinator: 'and',
    rules: [{ field: 'idCard', operator: 'notExists' }]
  }
});

// Count users with orders
const count = await userRepo.count({
  where: {
    combinator: 'and',
    rules: [{ field: 'orders', operator: 'exists' }]
  }
});

重要field 参数必须使用实体定义中的关系名(如 'idCard', 'orders'),而不是 Supabase 表名(如 'IdCard', 'Order')。

Known Limitations

Bidirectional ONE_TO_ONE Relationships

When a ONE_TO_ONE relationship has foreign keys on both sides (e.g., User.idCardIdIdCard and IdCard.ownerIdUser), Supabase cannot automatically determine which foreign key to use for EXISTS queries.

Workaround: Redesign schema to have foreign key on only one side, or use the reverse relationship query.

// ❌ May fail with bidirectional ONE_TO_ONE
await userRepo.find({
  where: { rules: [{ field: 'idCard', operator: 'exists' }] }
});

// ✅ Use ONE_TO_MANY instead (works correctly)
await userRepo.find({
  where: { rules: [{ field: 'orders', operator: 'exists' }] }
});

Testing

nx test rxdb-adapter-supabase

Test coverage: 60/62 tests passing (96.8%)

  • ✅ 5/6 EXISTS operator tests
  • ⏭️ 1 skipped (bidirectional ONE_TO_ONE limitation)