haystack-contracts 1.0.1 → 1.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 +76 -8
- package/dist/index.d.mts +366 -103
- package/dist/index.d.ts +366 -103
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/openapi.json +313 -34
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ Public API contracts for Haystack Robotics — TypeScript types, path constants,
|
|
|
10
10
|
pnpm add haystack-contracts
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Pin a specific version in production apps (e.g. `"haystack-contracts": "1.0.
|
|
13
|
+
Pin a specific version in production apps (e.g. `"haystack-contracts": "1.0.2"`).
|
|
14
14
|
|
|
15
15
|
## What ships on npm
|
|
16
16
|
|
|
17
|
-
| Import
|
|
18
|
-
|
|
19
|
-
| `haystack-contracts`
|
|
20
|
-
| `haystack-contracts/openapi.json` | OpenAPI 3 spec for API reference sites
|
|
17
|
+
| Import | Use |
|
|
18
|
+
| --------------------------------- | ------------------------------------------------- |
|
|
19
|
+
| `haystack-contracts` | Types, `PublicApiPath`, enums, response envelopes |
|
|
20
|
+
| `haystack-contracts/openapi.json` | OpenAPI 3 spec for API reference sites |
|
|
21
21
|
|
|
22
22
|
## Docs frontend (React static API page)
|
|
23
23
|
|
|
@@ -30,7 +30,7 @@ import openApiSpec from 'haystack-contracts/openapi.json';
|
|
|
30
30
|
Or load from CDN:
|
|
31
31
|
|
|
32
32
|
```text
|
|
33
|
-
https://unpkg.com/haystack-contracts@1.0.
|
|
33
|
+
https://unpkg.com/haystack-contracts@1.0.2/openapi.json
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Requires `resolveJsonModule: true` in `tsconfig.json` for the import pattern.
|
|
@@ -63,14 +63,82 @@ See the [consumer guide](https://github.com/haystackrobotics/haystack-backend/bl
|
|
|
63
63
|
|
|
64
64
|
## Maintainers (backend monorepo)
|
|
65
65
|
|
|
66
|
-
After changing public API DTOs or `@ApiPublicWebhook()` endpoints
|
|
66
|
+
### After changing public API DTOs or `@ApiPublicWebhook()` endpoints
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
69
|
pnpm api-check
|
|
70
70
|
pnpm --filter haystack-contracts build
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
`pnpm api-check` re-exports `openapi.json`, regenerates `src/generated/`, and fails if artifacts have drifted. Commit any changed artifacts before publishing:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git add packages_published/contracts/openapi.json
|
|
77
|
+
git add packages_published/contracts/src/generated/
|
|
78
|
+
git commit -m "chore(contracts): sync openapi artifacts"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Publishing a new version
|
|
82
|
+
|
|
83
|
+
**1. Bump version** (from `packages_published/contracts/`):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm version patch # additive types / bugfix → e.g. 1.0.4
|
|
87
|
+
# npm version minor # new public endpoints → e.g. 1.1.0
|
|
88
|
+
# npm version major # breaking type changes → e.g. 2.0.0
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**2. Build and verify tarball:**
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm --filter haystack-contracts build
|
|
95
|
+
cd packages_published/contracts
|
|
96
|
+
npm pack --dry-run
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Confirm the tarball includes `dist/`, `openapi.json`, and `README.md` — not `src/` or scripts.
|
|
100
|
+
|
|
101
|
+
**3. Publish:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm publish
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
(`prepublishOnly` runs `build` again automatically if you skipped step 2.)
|
|
108
|
+
|
|
109
|
+
**4. Commit and notify:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git add packages_published/contracts/package.json
|
|
113
|
+
git commit -m "chore(contracts): release haystack-contracts@<version>"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Tell the docs frontend and Haystack IoT SaaS teams to bump `haystack-contracts` in their `package.json` and redeploy.
|
|
117
|
+
|
|
118
|
+
### First publish (one-time)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm login
|
|
122
|
+
pnpm api-check
|
|
123
|
+
pnpm --filter haystack-contracts build
|
|
124
|
+
cd packages_published/contracts
|
|
125
|
+
npm pack --dry-run
|
|
126
|
+
npm publish --access public
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`--access public` is required the first time for an unscoped package name.
|
|
130
|
+
|
|
131
|
+
### Verify after publish
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm view haystack-contracts version
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
CDN URL for docs sites:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
https://unpkg.com/haystack-contracts@<version>/openapi.json
|
|
141
|
+
```
|
|
74
142
|
|
|
75
143
|
## Package details
|
|
76
144
|
|