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

@aiao/rxdb-plugin-graph

v0.0.25

Published

> Implements: [US-503 图数据插件](https://github.com/aiao-io/rxdb/blob/main/requirements/stories/plugin/US-503-graph-data.md)

Readme

@aiao/rxdb-plugin-graph

Implements: US-503 图数据插件

RxDB 图数据插件,提供有向/无向图、可选边权重与属性、邻居查询和路径查询。

安装

pnpm add @aiao/rxdb @aiao/rxdb-adapter-wa-sqlite @aiao/rxdb-plugin-graph

使用

import { PropertyType, RxDB, SyncType } from '@aiao/rxdb';
import { RxDBAdapterWaSqlite } from '@aiao/rxdb-adapter-wa-sqlite';
import { GraphEntity, GraphEntityBase, rxDBPluginGraph } from '@aiao/rxdb-plugin-graph';
// SQLite 实现从子路径导入 —— 根入口不再强制拉入它,
// 只用 PGlite / Supabase 时不会为此付出打包体积(GRAPH-010)
import { SqliteGraphRepository } from '@aiao/rxdb-plugin-graph/sqlite';

@GraphEntity({
  name: 'Person',
  properties: [{ name: 'name', type: PropertyType.string }],
  features: { graph: { type: 'directed-graph', weight: true } }
})
class Person extends GraphEntityBase {
  name!: string;
}

const rxdb = new RxDB({
  dbName: 'social',
  entities: [Person],
  sync: { type: SyncType.None, local: { adapter: 'wa-sqlite' } }
});

rxdb.use(rxDBPluginGraph).adapter(
  'wa-sqlite',
  db =>
    new RxDBAdapterWaSqlite(db, {
      vfs: 'MemoryAsyncVFS',
      async: true,
      wasmPath: '/wa-sqlite/wa-sqlite-async.wasm',
      repositories: { GraphRepository: SqliteGraphRepository }
    })
);

await rxdb.connect('wa-sqlite');
rxdb.init();

const alice = new Person({ name: 'Alice' });
const bob = new Person({ name: 'Bob' });
await rxdb.entityManager.saveMany([alice, bob]);
await Person.addEdge(alice, bob, 1);

Person.findNeighbors$({ entityId: alice.id, direction: 'out', level: 1 }).subscribe(neighbors => {
  console.log(neighbors[0]?.node.name);
});

level=0 不返回邻居。findNeighbors()countNeighbors()findPaths() 保留 Promise API;对应的 findNeighbors$()countNeighbors$()findPaths$() 返回会随节点或边变更刷新的 Observable。 邻居查询不包含起始节点,路径查询返回非循环路径及对应边信息。邻居与路径结果默认最多返回 1000 条,调用方可通过 limit 调低或提高,上限为 10000;结果超过 limit 或路径搜索触及内部资源上限时,数组的 truncatedtrue