@toolsplus/forge-trpc-link
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

@toolsplus/forge-trpc-link

Custom tRPC link to enable tRPC for Atlassian Forge apps.

Installation

npm install @toolsplus/forge-trpc-link

Note that this package has a peer dependency on @forge/bridge. If you have not installed @forge/bridge you may install before installing this package.

Usage

You can import and add the customUiBridgeLink to the links array as follows:

import { createTRPCProxyClient } from '@trpc/client';
import { customUiBridgeLink } from '@toolsplus/forge-trcp-link';
import type { HelloRouter } from '../my-trpc-server';

const client = createTRPCProxyClient<HelloRouter>({
  links: [
    customUiBridgeLink({
      resolverFunctionKey: 'rpc' 
    }),
  ],
});

customUiBridgeLink options

The customUiBridgeLink function takes an options object that has the CustomUiBridgeLinkOptions shape.

interface CustomUiBridgeLinkOptions {
  /**
   * Key of the Forge resolver function that handles tRPC 
   * requests from this link.
   * 
   * @defaultValue 'rpc'
   */
  resolverFunctionKey?: string;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @toolsplus/forge-trpc-link

Weekly Downloads

81

Version

0.2.2

License

MIT

Unpacked Size

17.8 kB

Total Files

22

Last publish

Collaborators

  • tbinna