@raystack/proton 0.1.0-ce225175aa066e6f296bc489293bb83ed0edcef6 → 0.1.0-f13f5dd4b147bc7b2765cbbc10b39bd976167eec
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.
- package/README.md +113 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @raystack/proton
|
|
2
|
+
|
|
3
|
+
TypeScript/JavaScript client library for Raystack APIs generated from Protocol Buffer definitions.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @raystack/proton
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For browser applications using TanStack Query:
|
|
12
|
+
```bash
|
|
13
|
+
npm install @raystack/proton @tanstack/react-query
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Browser (React)
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { FrontierService } from '@raystack/proton/frontier';
|
|
22
|
+
import { createConnectTransport } from '@connectrpc/connect-web';
|
|
23
|
+
import { createPromiseClient } from '@connectrpc/connect';
|
|
24
|
+
|
|
25
|
+
const transport = createConnectTransport({
|
|
26
|
+
baseUrl: 'https://api.example.com'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const client = createPromiseClient(FrontierService, transport);
|
|
30
|
+
|
|
31
|
+
const users = await client.listUsers({ pageSize: 10 });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Node.js
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { FrontierService } from '@raystack/proton/frontier';
|
|
38
|
+
import { createConnectTransport } from '@connectrpc/connect-node';
|
|
39
|
+
import { createPromiseClient } from '@connectrpc/connect';
|
|
40
|
+
|
|
41
|
+
const transport = createConnectTransport({
|
|
42
|
+
baseUrl: 'https://api.example.com',
|
|
43
|
+
httpVersion: '2'
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const client = createPromiseClient(FrontierService, transport);
|
|
47
|
+
|
|
48
|
+
const users = await client.listUsers({ pageSize: 10 });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### With TanStack Query
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { FrontierServiceQueries } from '@raystack/proton/frontier';
|
|
55
|
+
import { useQuery } from '@tanstack/react-query';
|
|
56
|
+
|
|
57
|
+
function UsersList() {
|
|
58
|
+
const { data, isLoading } = useQuery(
|
|
59
|
+
FrontierServiceQueries.listUsers(transport, { pageSize: 10 })
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (isLoading) return <div>Loading...</div>;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<ul>
|
|
66
|
+
{data?.users?.map(user => (
|
|
67
|
+
<li key={user.id}>{user.name}</li>
|
|
68
|
+
))}
|
|
69
|
+
</ul>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Available Services
|
|
75
|
+
|
|
76
|
+
- `@raystack/proton/frontier` - Frontier API
|
|
77
|
+
- `@raystack/proton/compass` - Compass API
|
|
78
|
+
- `@raystack/proton/assets` - Assets API
|
|
79
|
+
- `@raystack/proton/guardian` - Guardian API
|
|
80
|
+
- `@raystack/proton/entropy` - Entropy API
|
|
81
|
+
- `@raystack/proton/optimus` - Optimus API
|
|
82
|
+
- `@raystack/proton/predator` - Predator API
|
|
83
|
+
- `@raystack/proton/raccoon` - Raccoon API
|
|
84
|
+
- `@raystack/proton/siren` - Siren API
|
|
85
|
+
- `@raystack/proton/stencil` - Stencil API
|
|
86
|
+
- `@raystack/proton/common` - Common utilities
|
|
87
|
+
|
|
88
|
+
Each service export includes:
|
|
89
|
+
- Service client (e.g., `FrontierService`)
|
|
90
|
+
- TanStack Query helpers (e.g., `FrontierServiceQueries`) - optional
|
|
91
|
+
- TypeScript types and interfaces
|
|
92
|
+
|
|
93
|
+
## Dependencies
|
|
94
|
+
|
|
95
|
+
This package requires:
|
|
96
|
+
- `@bufbuild/protobuf` - Protocol Buffer runtime
|
|
97
|
+
- `@connectrpc/connect` - Connect RPC library
|
|
98
|
+
- `@connectrpc/connect-query` - Connect Query integration
|
|
99
|
+
|
|
100
|
+
Optional peer dependencies:
|
|
101
|
+
- `@tanstack/react-query` - For query hooks (browser only)
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
For complete API documentation, visit the [Raystack Documentation](https://raystack.org/).
|
|
106
|
+
|
|
107
|
+
## Repository
|
|
108
|
+
|
|
109
|
+
Source code and protobuf definitions: [raystack/proton](https://github.com/raystack/proton)
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Apache 2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raystack/proton",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-f13f5dd4b147bc7b2765cbbc10b39bd976167eec",
|
|
4
4
|
"description": "TypeScript/JavaScript client library for Raystack APIs generated from Protocol Buffer definitions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|