@pyrpc/client 0.1.0-alpha.3 → 0.2.0

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 +68 -68
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,68 +1,68 @@
1
- # @pyrpc/client
2
-
3
- Universal TypeScript client for [pyRPC](https://pyrpc.dev). Type-safe RPC calls to your Python backend — install, import, call.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @pyrpc/client
9
- # or
10
- pnpm add @pyrpc/client
11
- # or
12
- bun add @pyrpc/client
13
- ```
14
-
15
- The postinstall script in `@pyrpc/types` will prompt for your server URL and generate typed contracts automatically.
16
-
17
- For CI, set the `PYRPC_URL` environment variable:
18
-
19
- ```bash
20
- PYRPC_URL=https://api.example.com npm install @pyrpc/client
21
- ```
22
-
23
- ## Usage
24
-
25
- ```typescript
26
- import { createClient } from "@pyrpc/client";
27
- import type { Types } from "@pyrpc/types";
28
-
29
- const client = createClient<Types>({
30
- baseUrl: "https://api.example.com",
31
- });
32
-
33
- const user = await client.get_user(1);
34
- console.log(user.name);
35
- ```
36
-
37
- The proxy-based API lets you call any remote procedure as a local method. Parameters are passed positionally or as a single object for named arguments.
38
-
39
- ### Error handling
40
-
41
- ```typescript
42
- import { createClient, PyRPCError } from "@pyrpc/client";
43
-
44
- try {
45
- await client.delete_user(1);
46
- } catch (error) {
47
- if (error instanceof PyRPCError) {
48
- console.error(error.code, error.message);
49
- }
50
- }
51
- ```
52
-
53
- ## API
54
-
55
- ### `createClient<TTypes>(options?)`
56
-
57
- Creates a proxy client that forwards method calls to the server.
58
-
59
- - `baseUrl` — Server root URL (defaults to `window.location.origin` in browsers)
60
- - `headers` — Static or async `HeadersInit`
61
-
62
- ## Keywords
63
-
64
- rpc, pyrpc, typescript, client, type-safe, api, remote-procedure-call
65
-
66
- ## License
67
-
68
- MIT
1
+ # @pyrpc/client
2
+
3
+ Universal TypeScript client for [pyRPC](https://pyrpc.dev). Type-safe RPC calls to your Python backend — install, import, call.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @pyrpc/client
9
+ # or
10
+ pnpm add @pyrpc/client
11
+ # or
12
+ bun add @pyrpc/client
13
+ ```
14
+
15
+ The postinstall script in `@pyrpc/types` will prompt for your server URL and generate typed contracts automatically.
16
+
17
+ For CI, set the `PYRPC_URL` environment variable:
18
+
19
+ ```bash
20
+ PYRPC_URL=https://api.example.com npm install @pyrpc/client
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```typescript
26
+ import { createClient } from "@pyrpc/client";
27
+ import type { Types } from "@pyrpc/types";
28
+
29
+ const client = createClient<Types>({
30
+ baseUrl: "https://api.example.com",
31
+ });
32
+
33
+ const user = await client.get_user(1);
34
+ console.log(user.name);
35
+ ```
36
+
37
+ The proxy-based API lets you call any remote procedure as a local method. Parameters are passed positionally or as a single object for named arguments.
38
+
39
+ ### Error handling
40
+
41
+ ```typescript
42
+ import { createClient, PyRPCError } from "@pyrpc/client";
43
+
44
+ try {
45
+ await client.delete_user(1);
46
+ } catch (error) {
47
+ if (error instanceof PyRPCError) {
48
+ console.error(error.code, error.message);
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## API
54
+
55
+ ### `createClient<TTypes>(options?)`
56
+
57
+ Creates a proxy client that forwards method calls to the server.
58
+
59
+ - `baseUrl` — Server root URL (defaults to `window.location.origin` in browsers)
60
+ - `headers` — Static or async `HeadersInit`
61
+
62
+ ## Keywords
63
+
64
+ rpc, pyrpc, typescript, client, type-safe, api, remote-procedure-call
65
+
66
+ ## License
67
+
68
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyrpc/client",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.2.0",
4
4
  "description": "Universal TypeScript client for pyRPC",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,7 +24,7 @@
24
24
  "author": "",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@pyrpc/types": "^0.1.0-alpha.1"
27
+ "@pyrpc/types": "^0.2.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.19.39",