1.1.1 • Published 6 months ago

@aeolun/trpc-router-parser v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

trpc-router-parser

Most of this code has been taken wholesale from trpc-ui/trpc-panel. I felt it would be really helpful for a lot of applications to have it separate.

What is this?

This package provides utilities for parsing tRPC routers and procedures into structured data that can be used by UI tools or other applications. It extracts metadata, input schemas, and type information from your tRPC API.

Features

  • Parse tRPC routers into structured objects representing your API's shape
  • Extract input schemas as JSON Schema
  • Support for queries, mutations, and subscriptions
  • Parse Zod validation schemas into structured type definitions
  • Preserve metadata like descriptions from your tRPC procedures

Usage

import { parseRouterWithOptions } from 'trpc-router-parser';
import { appRouter } from './your-trpc-router';

const parsedRouter = parseRouterWithOptions(appRouter, {
  logFailedProcedureParse: true,
  transformer: 'superjson'
});

// parsedRouter now contains a structured representation of your tRPC API

The parsed output contains detailed information about:

  • Router structure and hierarchy
  • Procedure types (query/mutation/subscription)
  • Input validation schemas
  • Type information for inputs

This is useful for generating documentation, building UI tools, or analyzing your API structure programmatically.

License

MIT

1.1.1

6 months ago

1.1.0

6 months ago

1.0.9

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago