@forestadmin-experimental/datasource-rpc
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

The RPC data source allows get and proxify data from a RPC agent.

Installation

  • install the package @forestadmin-experimental/datasource-rpc.
  • Provide the URI and the auth secret used for authentication between the RPC agent and the gateway.
const { createAgent } = require('@forestadmin/agent');
const { createRpcDataSource } = require('@forestadmin-experimental/datasource-rpc');

const agent = createAgent(options)
  .addDataSource(
    createRpcDataSource({
      uri: 'http://localhost:3352',
      authSecret: process.env.AUTH_SECRET,
    }),
  );

Deal with RPC relationship

We recommend creating a relationship between RPC agents on your gateway. However, if you want to specify the relationship in another way, you should use the provided plugin on the gateway.

import { reconciliateRpc } from '@forestadmin-experimental/datasource-rpc';

agent.use(reconciliateRpc);

To be used with markCollectionsAsRpc.

Deal with disableSearch on RPC collections

Sometimes you may disable the search behavior on some collections of your RPC datasource. If you want to do that on the RPC agent, you should use the provided plugin on the gateway.

import { reconciliateRpc } from '@forestadmin-experimental/datasource-rpc';

agent.use(reconciliateRpc);

TODOS

  • [ ] handle error properly

Readme

Keywords

none

Package Sidebar

Install

npm i @forestadmin-experimental/datasource-rpc

Weekly Downloads

427

Version

1.8.0

License

GPL-3.0

Unpacked Size

68.4 kB

Total Files

15

Last publish

Collaborators

  • jeffladiray
  • vincentmolinieforest
  • styv
  • arnaudbesnier
  • xaviergastaud