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