@vishalsharma7nov/react-native-proto 0.2.2 → 0.2.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 +126 -0
  2. package/package.json +2 -1
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # @vishalsharma7nov/react-native-proto
2
+
3
+ A React Native / TypeScript client for protobuf APIs.
4
+
5
+ Point it at your `.proto` files (local folder, GitHub, or Buf), generate typed client methods, and call your server:
6
+
7
+ ```ts
8
+ const user = await api.userService.getUser({ id: '1' });
9
+ ```
10
+
11
+ - **GitHub:** https://github.com/vishalsharma7nov/react-native-proto
12
+ - **npm:** https://www.npmjs.com/package/@vishalsharma7nov/react-native-proto
13
+ - **License:** MIT
14
+
15
+ ---
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install @vishalsharma7nov/react-native-proto
21
+ ```
22
+
23
+ Or from GitHub Packages (add to `.npmrc`):
24
+
25
+ ```ini
26
+ @vishalsharma7nov:registry=https://npm.pkg.github.com
27
+ //npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Quick start
33
+
34
+ ### 1. Config (in your app, not in `node_modules`)
35
+
36
+ ```ts
37
+ import type { ProtoClientConfig } from '@vishalsharma7nov/react-native-proto';
38
+
39
+ const config: ProtoClientConfig = {
40
+ baseUrl: 'https://api.example.com',
41
+ getHeaders: async () => ({
42
+ Authorization: `Bearer ${await getToken()}`,
43
+ }),
44
+ };
45
+
46
+ export default config;
47
+ ```
48
+
49
+ ### 2. Call your API
50
+
51
+ ```ts
52
+ import { createClient, isProtoClientError } from '@vishalsharma7nov/react-native-proto';
53
+ import config from './react-native-proto.config';
54
+
55
+ const api = createClient(config);
56
+
57
+ try {
58
+ const user = await api.userService.getUser({ id: '1' });
59
+ console.log(user);
60
+ } catch (e) {
61
+ if (isProtoClientError(e)) {
62
+ console.error(e.code, e.message);
63
+ }
64
+ }
65
+ ```
66
+
67
+ ---
68
+
69
+ ## What you get
70
+
71
+ - Dynamic client from proto `service` / `rpc` definitions
72
+ - Typed `create-api.ts` + `message-types.ts` from generate
73
+ - Transports: HTTP + protobuf, Connect (unary + streaming), native HTTP/protobuf unary
74
+ - Interceptors (auth refresh, logging), offline queue, path presets, version headers
75
+ - Optional Zod validation wrappers
76
+ - CLI: `generate` / `sync` / `watch` (local, GitHub, or Buf)
77
+ - Optional React Query + Metro helpers
78
+ - Node mock server (`@vishalsharma7nov/react-native-proto/mock-server`)
79
+ - Expo config plugin
80
+
81
+ ---
82
+
83
+ ## Generate from your own protos
84
+
85
+ ```bash
86
+ # Local folder
87
+ npx react-native-proto generate --from local --path ./protos --out ./src/generated
88
+
89
+ # Watch local protos
90
+ npx react-native-proto watch --from local --path ./protos --out ./src/generated
91
+
92
+ # GitHub (pin a tag or commit)
93
+ npx react-native-proto generate --from github --repo https://github.com/you/protos.git --ref v1.0.0 --out ./src/generated
94
+
95
+ # Buf module
96
+ npx react-native-proto generate --from buf --module buf.build/acme/petapis --ref 1.0.0 --out ./src/generated
97
+
98
+ # App-local generate (import runtime from this package)
99
+ npx react-native-proto generate --from local --path ./protos --out ./src/generated \
100
+ --import-from @vishalsharma7nov/react-native-proto
101
+ ```
102
+
103
+ Your `.proto` files must include `service` and `rpc` blocks.
104
+
105
+ ---
106
+
107
+ ## Docs
108
+
109
+ Full documentation lives in the repo:
110
+
111
+ | Doc | What it explains |
112
+ |-----|------------------|
113
+ | [Getting started](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/GETTING_STARTED.md) | Step-by-step setup |
114
+ | [Architecture](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/ARCHITECTURE.md) | Layers and request flow |
115
+ | [Config](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/CONFIG.md) | Config fields |
116
+ | [Generate](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/GENERATE.md) | Local / GitHub / Buf generate |
117
+ | [Errors](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/ERRORS.md) | Error codes |
118
+ | [Troubleshooting](https://github.com/vishalsharma7nov/react-native-proto/blob/master/docs/TROUBLESHOOTING.md) | Common problems |
119
+ | [Changelog](https://github.com/vishalsharma7nov/react-native-proto/blob/master/CHANGELOG.md) | Release notes |
120
+
121
+ ---
122
+
123
+ ## Example apps
124
+
125
+ - Expo demo: [`example/`](https://github.com/vishalsharma7nov/react-native-proto/tree/master/example)
126
+ - Vite web demo: [`examples/web/`](https://github.com/vishalsharma7nov/react-native-proto/tree/master/examples/web)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vishalsharma7nov/react-native-proto",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Dynamic React Native protobuf client with generate CLI, HTTP/Connect transports, interceptors, and typed errors",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -19,6 +19,7 @@
19
19
  "ios",
20
20
  "app.plugin.js",
21
21
  "react-native-proto.podspec",
22
+ "README.md",
22
23
  "!**/__tests__",
23
24
  "!**/__fixtures__",
24
25
  "!**/__mocks__"