@simpleapps-com/augur-api 2026.10.8 → 2026.10.9
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 +18 -0
- package/SKILL.md +21 -3
- package/dist/{client-BhbdzKhy.d.mts → client-C9XBvL6B.d.mts} +192 -81
- package/dist/{client-BhbdzKhy.d.ts → client-C9XBvL6B.d.ts} +192 -81
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +108 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -117
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,24 @@ Path values are sent unencoded, because the API does not decode path segments (`
|
|
|
173
173
|
await api.call('items.locations.bins.list', { pathParams: { locationId: 100 }, query: { bin: 'D/S' } });
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
## Typed Responses
|
|
177
|
+
|
|
178
|
+
Every endpoint returns a typed `data` (`import type { ItemsTypes } from '@simpleapps-com/augur-api'`).
|
|
179
|
+
Response types are the MINIMUM shape: new fields pass through as `unknown`, and nothing is
|
|
180
|
+
validated at runtime. Do not cast responses. To make a wrong field name a compile error, assign
|
|
181
|
+
rows to `Known<T>`, which drops the pass-through:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import type { ItemsTypes, Known } from '@simpleapps-com/augur-api';
|
|
185
|
+
|
|
186
|
+
const { data } = await api.items.invMast.invSub.list(invMastUid);
|
|
187
|
+
const subs: Known<ItemsTypes.InvMastInvSubListItem>[] = data;
|
|
188
|
+
subs[0].childItemId; // TS2339: inv-sub names it subInvMastItemId
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`noPropertyAccessFromIndexSignature` in your tsconfig is a weaker alternative: it misses
|
|
192
|
+
destructuring (`const { childItemId } = row`).
|
|
193
|
+
|
|
176
194
|
## For AI Agents
|
|
177
195
|
|
|
178
196
|
See [SKILL.md](./SKILL.md) for guidance on using this package with AI assistance.
|
package/SKILL.md
CHANGED
|
@@ -198,9 +198,10 @@ response.status // HTTP status code
|
|
|
198
198
|
|
|
199
199
|
## Types and Validation
|
|
200
200
|
|
|
201
|
-
Request params
|
|
202
|
-
|
|
203
|
-
`{Chain}{Action}
|
|
201
|
+
Request params are validated with Valibot schemas. Response `data` is typed but NOT validated at
|
|
202
|
+
runtime: the backend owns the schema. Types are exported per service as a namespace
|
|
203
|
+
(`{Service}Types`): params are `{Chain}{Action}Params`, request bodies `{Chain}{Action}Body`,
|
|
204
|
+
response data `{Chain}{Action}Data`.
|
|
204
205
|
|
|
205
206
|
```typescript
|
|
206
207
|
import type { ItemsTypes } from '@simpleapps-com/augur-api';
|
|
@@ -216,6 +217,23 @@ for (const faq of faqs) {
|
|
|
216
217
|
}
|
|
217
218
|
```
|
|
218
219
|
|
|
220
|
+
Response types are the MINIMUM shape: each ends in `[key: string]: unknown` so new fields pass
|
|
221
|
+
through. Do NOT cast responses (`as unknown as MyResponse`); the generated type is the contract.
|
|
222
|
+
To make a wrong field name a compile error, read rows through `Known<T>`, which drops the
|
|
223
|
+
pass-through (this catches destructuring too). The tsconfig flag `noPropertyAccessFromIndexSignature`
|
|
224
|
+
is a weaker alternative: it flags `row.wrongName` but not `const { wrongName } = row`.
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
import type { ItemsTypes, Known } from '@simpleapps-com/augur-api';
|
|
228
|
+
|
|
229
|
+
const { data } = await api.items.invMast.invSub.list(invMastUid);
|
|
230
|
+
const subs: Known<ItemsTypes.InvMastInvSubListItem>[] = data; // assignment, not a cast
|
|
231
|
+
for (const sub of subs) {
|
|
232
|
+
sub.subInvMastItemId; // ✅ the substitute's item code
|
|
233
|
+
sub.childItemId; // ❌ TS2339: that name belongs to inv-accessory
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
219
237
|
## Calling by Endpoint Id (`call()`)
|
|
220
238
|
|
|
221
239
|
For generic callers (tools, agents, scripts) that should not hard-code a typed method:
|