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

@forestadmin-experimental/rpc-agent

v2.7.0

Published

The RPC agent is created to split your data into microservice, combined with a real agent and a RPC data source, you wil be able to acces all your collection as this is a normal agent.

Readme

The RPC agent is created to split your data into microservice, combined with a real agent and a RPC data source, you wil be able to acces all your collection as this is a normal agent.

Installation

  • install the package @forestadmin-experimental/rpc-agent.
  • give options like a real agent.
const { createRpcAgent } = require('@forestadmin-experimental/rpc-agent');

const agent = createRpcAgent({
  authSecret: process.env.AUTH_SECRET,
  isProduction: process.env.NODE_ENV === 'production',
  loggerLevel: 'Info',
});
// use the agent like a real one.

Deal with nested RPC data source and relationship

Be cautious when using an RPC data source within an RPC agent. Since an RPC agent behaves similarly to a real one, a schema is created and utilized by the RPC data source. Therefore, all collections added to it should be within this schema, which can potentially cause duplication issues.

Unlike removeCollection, the markCollectionsAsRpc function removes the collection from the schema but retains the defined relationships. If you declare relationships on a collection marked as RPC, you should use the provided plugin on the gateway to perform the reconciliation.

Examples

Given this structure:

  • One RPC agent used to manage Users.
  • One RPC agent used to manage Groups.
  • One RPC agent used to manage Projects.
  • One agent used as a gateway.

Case 1 declaring relationship inside the gateway

Declare your relation as usual, like below:

gateway
  .createRpcDataSource(/*from the user RPC agent*/)
  .createRpcDataSource(/*from the project RPC agent*/)
  .createRpcDataSource(/*from the group RPC agent*/)
  .customizeCollection('user', collection => {
    collection.addManyToOneRelation('group', 'group', {
      foreignKey: 'group_id',
    });
  })
  .customizeCollection('project', collection => {
    collection.addManyToOneRelation('group', 'group', {
      foreignKey: 'group_id',
    });
  })
  .customizeCollection('group', collection => {
    collection
      .addOneToManyRelation('users', 'user', {
        originKey: 'group_id',
      })
      .addOneToManyRelation('projects', 'project', {
        originKey: 'group_id',
      });
  });

Case 2 using RPC datasource inside RPC agent

You should combine the data sources before using them on the gateway. In this example, you only use the group agent in the user agent, not in multiple places. Therefore, there is no need to use markCollectionsAsRpc, as shown below:

/* define user agent and use group agent as a RPC data source
* define some relationship between both data source
*/
userAgent
  .createcreateSqlDataSource(...)
  .createRpcDataSource(/*from the group RPC agent*/)
  .customizeCollection('user', collection => {
    collection.addManyToOneRelation('group', 'group', {
      foreignKey: 'group_id',
    });
  })
  .customizeCollection('group', collection => {
    collection.addOneToManyRelation('users', 'user', {
      originKey: 'group_id',
    });
  });

/* define the gateway and use agragated agent
* all collection and relationship defined in the user agent will be import as a datasource
*/
gateway
  .createRpcDataSource(/*from the user RPC agent*/)
  .createRpcDataSource(/*from the project RPC agent*/)

Case 2 declaring relationship between RPC datasource on a RPC agent

If you have complex datasource relationship and usage, see how to use markCollectionsAsRpc and the reconciliateRpc plugin below.

/* define user agent and use group agent as a RPC data source
* define some relationship between both data source
*/
userAgent
  .createcreateSqlDataSource(...)
  .createRpcDataSource(/*from the group RPC agent*/)
  .customizeCollection('user', collection => {
    collection.addManyToOneRelation('group', 'group', {
      foreignKey: 'group_id',
    });
  })
  .customizeCollection('group', collection => {
    collection.addOneToManyRelation('users', 'user', {
      originKey: 'group_id',
    });
  })
  .markCollectionsAsRpc('group');

/* define project agent and use group agent as a RPC data source
* define some relationship between both data source
*/
projectAgent
  .createcreateSqlDataSource(...)
  .createRpcDataSource(/*from the group RPC agent*/)
  .customizeCollection('project', collection => {
    collection.addManyToOneRelation('group', 'group', {
      foreignKey: 'group_id',
    });
  })
  .customizeCollection('group', collection => {
    collection.addOneToManyRelation('projects', 'project', {
      originKey: 'group_id',
    });
  })
  .markCollectionsAsRpc('group');

// define the gateway 
gateway
  .createRpcDataSource(/*from the user RPC agent*/)
  .createRpcDataSource(/*from the project RPC agent*/)
  .createRpcDataSource(/*from the group RPC agent*/)
  .use(reconciliateRpc);

Deal with disableSearch customization

To make disableSearch customization work on the gateway, you should use the provided plugin

Examples


/* define project agent and disable the search behavior on the collection
*/
projectAgent
  .createcreateSqlDataSource(...)
  .customizeCollection('project', collection => {
    collecion.disableSearch();
  });

// define the gateway 
gateway
  .createRpcDataSource(/*from the project RPC agent*/)
  .use(reconciliateRpc);