@kortexya/reasoninglayer 3.2.0 → 4.1.0
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 +17 -1
- package/dist/index.cjs +15112 -2011
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12158 -5253
- package/dist/index.d.ts +12158 -5253
- package/dist/index.js +15102 -2012
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -211,6 +211,7 @@ import {
|
|
|
211
211
|
RateLimitError,
|
|
212
212
|
TimeoutError,
|
|
213
213
|
NetworkError,
|
|
214
|
+
ResponseShapeError,
|
|
214
215
|
} from '@kortexya/reasoninglayer';
|
|
215
216
|
|
|
216
217
|
try {
|
|
@@ -224,10 +225,25 @@ try {
|
|
|
224
225
|
console.log(`Timed out after ${error.timeoutMs}ms`);
|
|
225
226
|
} else if (error instanceof NetworkError) {
|
|
226
227
|
console.log('Connection failed:', error.message);
|
|
228
|
+
} else if (error instanceof ResponseShapeError) {
|
|
229
|
+
// A 2xx the SDK cannot read: `field` names what the body lacks
|
|
230
|
+
// (`items`, `items[3].sort_suggestions`); undefined when it was not JSON.
|
|
231
|
+
console.log(`${error.method} ${error.path} answered ${error.status}`, error.field);
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
234
|
```
|
|
230
235
|
|
|
236
|
+
Error hierarchy:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
ReasoningLayerError
|
|
240
|
+
+-- ApiError (HTTP 4xx/5xx: status, errorCode, body, headers) and its subclasses
|
|
241
|
+
+-- TimeoutError
|
|
242
|
+
+-- ValidationError
|
|
243
|
+
+-- NetworkError
|
|
244
|
+
+-- ResponseShapeError (a 2xx body the SDK cannot read: status, method, path, field, body)
|
|
245
|
+
```
|
|
246
|
+
|
|
231
247
|
## Builders
|
|
232
248
|
|
|
233
249
|
The SDK provides builder functions for constructing API request values with full type safety:
|
|
@@ -300,7 +316,7 @@ pnpm run docs:build # Build documentation site
|
|
|
300
316
|
|
|
301
317
|
| SDK Version | Min Backend Version | Node | Browser |
|
|
302
318
|
| ----------- | ------------------- | ---- | ------- |
|
|
303
|
-
| 1.
|
|
319
|
+
| 4.1.0 | engine `308ed2a25` | 20+ | ES2022+ |
|
|
304
320
|
|
|
305
321
|
## License
|
|
306
322
|
|