@arrirpc/codegen-ts 0.76.3-beta.0 → 0.76.4
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 +11 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
// arri.config.ts
|
|
9
|
-
import { defineConfig, generators } from
|
|
9
|
+
import { defineConfig, generators } from 'arri';
|
|
10
10
|
|
|
11
11
|
export default defineConfig({
|
|
12
12
|
generators: [
|
|
13
13
|
generators.typescriptClient({
|
|
14
|
-
clientName:
|
|
15
|
-
outputFile:
|
|
14
|
+
clientName: 'MyClient',
|
|
15
|
+
outputFile: './client/src/myClient.g.ts',
|
|
16
16
|
}),
|
|
17
17
|
],
|
|
18
18
|
});
|
|
@@ -44,13 +44,13 @@ pnpm i --save @arrirpc/client
|
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
// This will match whatever you put in the arri config
|
|
47
|
-
import { MyClient } from
|
|
47
|
+
import { MyClient } from './myClient.g';
|
|
48
48
|
|
|
49
49
|
const client = new MyClient({
|
|
50
|
-
baseUrl:
|
|
50
|
+
baseUrl: 'https://example.com',
|
|
51
51
|
headers: () => {
|
|
52
52
|
return {
|
|
53
|
-
Authorization:
|
|
53
|
+
Authorization: '<some-token>',
|
|
54
54
|
};
|
|
55
55
|
},
|
|
56
56
|
// optional
|
|
@@ -67,13 +67,13 @@ The root client will be a class containing all of the services and procedures in
|
|
|
67
67
|
For example if we have a some procedures grouped under `"users"` we can import just that service like so.
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
|
-
import { MyClientUsersService } from
|
|
70
|
+
import { MyClientUsersService } from './myClient.g';
|
|
71
71
|
|
|
72
72
|
const usersService = new MyClientUsersService({
|
|
73
|
-
baseUrl:
|
|
73
|
+
baseUrl: 'https://example.com',
|
|
74
74
|
headers: () => {
|
|
75
75
|
return {
|
|
76
|
-
Authorization:
|
|
76
|
+
Authorization: '<some-token>',
|
|
77
77
|
};
|
|
78
78
|
},
|
|
79
79
|
});
|
|
@@ -87,14 +87,14 @@ All generated types and serializers/parsers can be imported from the generated c
|
|
|
87
87
|
|
|
88
88
|
```ts
|
|
89
89
|
// import the user type and the user helper
|
|
90
|
-
import { type User, $$User } from
|
|
90
|
+
import { type User, $$User } from './myClient.g';
|
|
91
91
|
|
|
92
92
|
const bob: User = {
|
|
93
93
|
// field
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
$$User.serialize(bob); // outputs valid JSON
|
|
97
|
-
$$User.parse(
|
|
97
|
+
$$User.parse('<some-json-string>'); // outputs a User
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
# Development
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arrirpc/codegen-ts",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"prettier": "^3.5.
|
|
26
|
-
"@arrirpc/codegen-utils": "0.76.
|
|
25
|
+
"prettier": "^3.5.3",
|
|
26
|
+
"@arrirpc/codegen-utils": "0.76.4"
|
|
27
27
|
}
|
|
28
28
|
}
|