@mestra-dev/contract 0.0.4 → 0.0.7
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 +20 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
# @mestra/contract
|
|
1
|
+
# @mestra-dev/contract
|
|
2
2
|
|
|
3
3
|
Types-only package exporting the Mestra auth Hono `AppType` for frontend RPC clients.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Published artifact is **only** `dist/index.d.ts` — no runtime JavaScript.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
bun add @mestra-dev/contract
|
|
11
|
+
bun add hono # peer dependency
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or with npm:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @mestra-dev/contract
|
|
18
|
+
npm install hono
|
|
12
19
|
```
|
|
13
20
|
|
|
14
21
|
## Frontend usage
|
|
15
22
|
|
|
16
23
|
```ts
|
|
17
|
-
import type { AppType } from '@mestra/contract'
|
|
24
|
+
import type { AppType } from '@mestra-dev/contract'
|
|
18
25
|
import { hc } from 'hono/client'
|
|
19
26
|
|
|
20
27
|
const client = hc<AppType>('https://api.mestra.chat/')
|
|
@@ -23,13 +30,14 @@ const res = await client.auth.me.$get()
|
|
|
23
30
|
const data = await res.json()
|
|
24
31
|
```
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
Always use `import type` so the bundler never pulls server code.
|
|
27
34
|
|
|
28
|
-
## Build (
|
|
35
|
+
## Build (maintainers)
|
|
29
36
|
|
|
30
|
-
Requires
|
|
37
|
+
Requires local `services/auth` and `services/utils` sources plus auth `node_modules` for type resolution. Those packages are **not** published with this contract.
|
|
31
38
|
|
|
32
39
|
```bash
|
|
40
|
+
cd services/contract
|
|
33
41
|
bun install
|
|
34
42
|
bun run build
|
|
35
43
|
```
|
|
@@ -39,15 +47,16 @@ Output: `dist/index.d.ts` (self-contained; depends on `hono` types only).
|
|
|
39
47
|
## Publish to npmjs
|
|
40
48
|
|
|
41
49
|
```bash
|
|
50
|
+
cd services/contract
|
|
42
51
|
bun run build
|
|
43
|
-
bun pm version patch # or minor / major
|
|
52
|
+
bun pm version patch # or: minor / major
|
|
44
53
|
bun publish --access public
|
|
45
54
|
```
|
|
46
55
|
|
|
47
56
|
`prepublishOnly` runs `build` automatically before publish.
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
Shortcut:
|
|
50
59
|
|
|
51
60
|
```bash
|
|
52
61
|
bun run release
|
|
53
|
-
```
|
|
62
|
+
```
|