@rpc-dart/trpc-adapter 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -5
  2. package/package.json +4 -2
package/README.md CHANGED
@@ -1,17 +1,56 @@
1
1
  # @rpc-dart/trpc-adapter
2
2
 
3
- tRPC v11 extraction adapter: route probe, inference harness, Contract IR normalizer.
3
+ [![npm version](https://img.shields.io/npm/v/@rpc-dart/trpc-adapter.svg)](https://www.npmjs.com/package/@rpc-dart/trpc-adapter)
4
+ [![license](https://img.shields.io/npm/l/@rpc-dart/trpc-adapter.svg)](https://github.com/AdityaJandu/rpc-dart/blob/main/LICENSE)
4
5
 
5
- Part of the [rpc-dart](https://github.com/AdityaJandu/rpc-dart) monorepo — end-to-end type safety for tRPC v11 backends consumed from Dart and Flutter.
6
+ tRPC v11 router extraction adapter for `rpc-dart`. Inspects router definitions with the TypeScript compiler API and produces a normalized Contract IR.
6
7
 
7
- ## Install
8
+ Part of the [rpc-dart](https://github.com/AdityaJandu/rpc-dart) monorepo.
9
+
10
+ ---
11
+
12
+ ## Capabilities
13
+
14
+ - **Compiler-level inspection:** Uses `ts.TypeChecker` to inspect procedure inputs, outputs, and return types directly from TypeScript AST nodes without requiring a running server.
15
+ - **Input vs. output fidelity:** Differentiates `z.input` (wire format accepted from the client) from `z.output` (wire format returned by the procedure), accurately handling Zod `.transform()`, `.default()`, and `.coerce()`.
16
+ - **Three-state PATCH detection:** Identifies fields that are both optional and nullable, tagging them in the IR for three-state `RpcOpt<T>` handling.
17
+ - **Enums and unions:** Extracts string/numeric enums and maps discriminated unions with explicit discriminator keys into sealed type hierarchies.
18
+
19
+ ---
20
+
21
+ ## Installation
8
22
 
9
23
  ```bash
10
24
  npm install @rpc-dart/trpc-adapter
25
+ # or
26
+ pnpm add @rpc-dart/trpc-adapter
11
27
  ```
12
28
 
13
- See the [documentation](../../docs/README.md) for the full CLI reference, concepts, and guides.
29
+ ---
30
+
31
+ ## Usage
32
+
33
+ ```typescript
34
+ import { extractTrpcContract } from '@rpc-dart/trpc-adapter';
35
+
36
+ const { contract, diagnostics } = await extractTrpcContract({
37
+ entry: './src/trpc/router.ts',
38
+ exportName: 'appRouter',
39
+ transformer: 'superjson',
40
+ unknownPolicy: 'fail',
41
+ });
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Links
47
+
48
+ - [GitHub Repository](https://github.com/AdityaJandu/rpc-dart)
49
+ - [CLI Package (rpc-dart)](https://www.npmjs.com/package/rpc-dart)
50
+ - [Issue Tracker](https://github.com/AdityaJandu/rpc-dart/issues)
51
+
52
+ ---
14
53
 
15
54
  ## License
16
55
 
17
- MIT — see [LICENSE](./LICENSE).
56
+ MIT © [Aditya Jandu](https://github.com/AdityaJandu)
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@rpc-dart/trpc-adapter",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "description": "tRPC v11 extraction adapter: route probe, inference harness, and Contract IR normalizer.",
4
5
  "type": "module",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
@@ -8,7 +9,7 @@
8
9
  "dist"
9
10
  ],
10
11
  "dependencies": {
11
- "@rpc-dart/core": "0.1.1",
12
+ "@rpc-dart/core": "0.1.3",
12
13
  "jiti": "^2.6.0",
13
14
  "typescript": "^5.9.0"
14
15
  },
@@ -22,6 +23,7 @@
22
23
  "url": "git+https://github.com/AdityaJandu/rpc-dart.git"
23
24
  },
24
25
  "homepage": "https://github.com/AdityaJandu/rpc-dart#readme",
26
+ "bugs": "https://github.com/AdityaJandu/rpc-dart/issues",
25
27
  "keywords": [
26
28
  "trpc",
27
29
  "typescript",