seam 1.236.0 → 1.237.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 +44 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ Instead, it builds on a core set of Seam modules:
|
|
|
47
47
|
- [Iterate over all pages](#iterate-over-all-pages)
|
|
48
48
|
- [Iterate over all resources](#iterate-over-all-resources)
|
|
49
49
|
- [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
|
|
50
|
+
- [Error Handling](#error-handling)
|
|
51
|
+
- [Validation errors](#validation-errors)
|
|
50
52
|
- [Requests without a Workspace in scope](#requests-without-a-workspace-in-scope)
|
|
51
53
|
- [Personal Access Token](#personal-access-token-1)
|
|
52
54
|
- [Console Session Token](#console-session-token-1)
|
|
@@ -242,6 +244,11 @@ When the `waitForActionAttempt` option is enabled, the SDK:
|
|
|
242
244
|
|
|
243
245
|
- Polls the action attempt up to the `timeout`
|
|
244
246
|
at the `pollingInterval` (both in milliseconds).
|
|
247
|
+
Polling stops as soon as the `timeout` passes,
|
|
248
|
+
and every wait polls at least once,
|
|
249
|
+
even when the `timeout` is shorter than the `pollingInterval`.
|
|
250
|
+
The `timeout` must not be negative,
|
|
251
|
+
and the `pollingInterval` must be greater than zero.
|
|
245
252
|
- Resolves with a fresh copy of the successful action attempt.
|
|
246
253
|
- Rejects with a `SeamActionAttemptFailedError` if the action attempt is unsuccessful.
|
|
247
254
|
- Rejects with a `SeamActionAttemptTimeoutError` if the action attempt is still pending when the `timeout` is reached.
|
|
@@ -415,6 +422,43 @@ const pages = seam.createPaginator(
|
|
|
415
422
|
const devices = await pages.flattenToArray()
|
|
416
423
|
```
|
|
417
424
|
|
|
425
|
+
### Error Handling
|
|
426
|
+
|
|
427
|
+
Requests rejected by the Seam API throw a `SeamApiError` subclass
|
|
428
|
+
carrying the `statusCode`, the API error `code`, and the `requestId`.
|
|
429
|
+
The originating Axios error is retained as the standard `cause`.
|
|
430
|
+
|
|
431
|
+
#### Validation errors
|
|
432
|
+
|
|
433
|
+
When the API rejects a request because a parameter is invalid,
|
|
434
|
+
it throws a `SeamInvalidInputError`.
|
|
435
|
+
|
|
436
|
+
Look up the messages for a parameter you are already rendering,
|
|
437
|
+
for example a field in a form:
|
|
438
|
+
|
|
439
|
+
```ts
|
|
440
|
+
import { isSeamInvalidInputError } from 'seam'
|
|
441
|
+
|
|
442
|
+
try {
|
|
443
|
+
await seam.devices.list({ device_ids: ['not-a-uuid'] })
|
|
444
|
+
} catch (err) {
|
|
445
|
+
if (isSeamInvalidInputError(err)) {
|
|
446
|
+
console.log(err.getValidationErrorMessages('device_ids'))
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Or read every parameter that failed validation,
|
|
452
|
+
for example to show a summary of what went wrong:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
if (isSeamInvalidInputError(err)) {
|
|
456
|
+
for (const { parameterName, errorMessages } of err.validationErrors) {
|
|
457
|
+
console.log(`${parameterName}: ${errorMessages.join(', ')}`)
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
418
462
|
### Requests without a Workspace in scope
|
|
419
463
|
|
|
420
464
|
Some Seam API endpoints do not require a workspace in scope.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seam",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.237.0",
|
|
4
4
|
"description": "JavaScript SDK for the Seam API written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
},
|
|
76
76
|
"packageManager": "npm@11.19.0",
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@seamapi/cli": "0.
|
|
79
|
-
"@seamapi/http": "2.
|
|
78
|
+
"@seamapi/cli": "0.37.0",
|
|
79
|
+
"@seamapi/http": "2.26.0",
|
|
80
80
|
"@seamapi/webhook": "1.4.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|