Skip to content

Commit 7fa2f6f

Browse files
feat(deps): bump @seamapi/http from 2.26.0 to 2.27.0 in the seam group (#442)
* feat(deps): bump @seamapi/http from 2.26.0 to 2.27.0 in the seam group Bumps the seam group with 1 update: [@seamapi/http](https://github.com/seamapi/javascript-http). Updates `@seamapi/http` from 2.26.0 to 2.27.0 - [Release notes](https://github.com/seamapi/javascript-http/releases) - [Commits](seamapi/javascript-http@v2.26.0...v2.27.0) --- updated-dependencies: - dependency-name: "@seamapi/http" dependency-version: 2.27.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: seam ... Signed-off-by: dependabot[bot] <support@github.com> * ci: Generate code --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Seam Bot <seambot@getseam.com>
1 parent a0fd705 commit 7fa2f6f

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,31 @@ When the `waitForActionAttempt` option is enabled, the SDK:
254254
- Rejects with a `SeamActionAttemptTimeoutError` if the action attempt is still pending when the `timeout` is reached.
255255
- Both errors expose an `actionAttempt` property.
256256

257+
The `ActionAttempt` type is a union discriminated by `action_type` and `status`.
258+
The `error` and `result` properties are typed as `null`
259+
except for the status that populates them,
260+
so narrow on the `status` before reading them:
261+
262+
```ts
263+
const actionAttempt = await seam.locks.unlockDoor(
264+
{ device_id },
265+
{ waitForActionAttempt: false },
266+
)
267+
268+
if (actionAttempt.status === 'success') {
269+
console.log(actionAttempt.result) // The result is non-null here.
270+
}
271+
272+
if (actionAttempt.status === 'error') {
273+
console.log(actionAttempt.error.message) // The error is non-null here.
274+
}
275+
```
276+
277+
Waiting for an action attempt resolves with the successful action attempt,
278+
so after checking `status === 'success'` the `result` is immediately usable.
279+
Use the `SucceededActionAttempt` and `FailedActionAttempt` types
280+
to extract the success and error members from any action attempt type.
281+
257282
If you already have an action attempt ID
258283
and want to wait for it to resolve, simply use
259284

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"packageManager": "npm@11.19.0",
7777
"dependencies": {
7878
"@seamapi/cli": "0.37.0",
79-
"@seamapi/http": "2.26.0",
79+
"@seamapi/http": "2.27.0",
8080
"@seamapi/webhook": "1.5.0"
8181
},
8282
"devDependencies": {

0 commit comments

Comments
 (0)