@seamapi/http 2.17.0 → 2.19.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.
Files changed (46) hide show
  1. package/index.d.ts +5 -0
  2. package/index.js +5 -0
  3. package/index.js.map +1 -1
  4. package/lib/client.d.ts +12 -0
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.d.ts +1 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/options.d.ts +105 -0
  9. package/lib/options.js +54 -0
  10. package/lib/options.js.map +1 -1
  11. package/lib/request-options.d.ts +13 -0
  12. package/lib/request-options.js +3 -0
  13. package/lib/request-options.js.map +1 -1
  14. package/lib/resolve-action-attempt.d.ts +47 -0
  15. package/lib/resolve-action-attempt.js +29 -0
  16. package/lib/resolve-action-attempt.js.map +1 -1
  17. package/lib/resources/access-code.d.ts +87 -0
  18. package/lib/resources/device.d.ts +0 -12
  19. package/lib/resources/unmanaged-access-code.d.ts +87 -0
  20. package/lib/routes/events/events.d.ts +2 -2
  21. package/lib/seam-http-error.d.ts +34 -0
  22. package/lib/seam-http-error.js +34 -0
  23. package/lib/seam-http-error.js.map +1 -1
  24. package/lib/seam-http-request.d.ts +31 -0
  25. package/lib/seam-http-request.js +31 -0
  26. package/lib/seam-http-request.js.map +1 -1
  27. package/lib/seam-paginator.d.ts +28 -0
  28. package/lib/seam-paginator.js +25 -0
  29. package/lib/seam-paginator.js.map +1 -1
  30. package/lib/version.d.ts +1 -1
  31. package/lib/version.js +1 -1
  32. package/package.json +3 -2
  33. package/src/index.ts +5 -0
  34. package/src/lib/client.ts +14 -0
  35. package/src/lib/index.ts +3 -0
  36. package/src/lib/options.ts +105 -0
  37. package/src/lib/request-options.ts +13 -0
  38. package/src/lib/resolve-action-attempt.ts +48 -0
  39. package/src/lib/resources/access-code.ts +100 -0
  40. package/src/lib/resources/device.ts +0 -12
  41. package/src/lib/resources/unmanaged-access-code.ts +100 -0
  42. package/src/lib/routes/events/events.ts +12 -0
  43. package/src/lib/seam-http-error.ts +38 -0
  44. package/src/lib/seam-http-request.ts +31 -0
  45. package/src/lib/seam-paginator.ts +28 -0
  46. package/src/lib/version.ts +1 -1
@@ -1492,18 +1492,6 @@ export type Device = {
1492
1492
  * Set to true when the device does not support the /dual-setpoints API endpoint.
1493
1493
  */
1494
1494
  dual_setpoints_not_supported?: boolean | undefined;
1495
- /**
1496
- * Enforced cooling setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error.
1497
- */
1498
- enforced_cooling_setpoint_range_celsius?: Array<number> | undefined;
1499
- /**
1500
- * Enforced heating setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error.
1501
- */
1502
- enforced_heating_setpoint_range_celsius?: Array<number> | undefined;
1503
- /**
1504
- * Legacy combined enforced setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error. Read as a fallback for the per-mode ranges below; no longer written.
1505
- */
1506
- enforced_setpoint_range_celsius?: Array<number> | undefined;
1507
1495
  /**
1508
1496
  * Product type for a Sensi device.
1509
1497
  */
@@ -264,6 +264,63 @@ export type UnmanagedAccessCode = {
264
264
  */
265
265
  message: string;
266
266
  } /**
267
+ * Seam was unable to issue this access code before its start time, so the recipient may be unable to unlock the device. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and this error clears automatically if the access code is eventually issued.
268
+ */ | {
269
+ /**
270
+ * Date and time at which Seam created the error.
271
+ */
272
+ created_at?: string | undefined;
273
+ /**
274
+ * Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
275
+ */
276
+ error_code: 'failed_to_issue';
277
+ /**
278
+ * Indicates that this is an access code error.
279
+ */
280
+ is_access_code_error: true;
281
+ /**
282
+ * Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
283
+ */
284
+ message: string;
285
+ } /**
286
+ * Seam was unable to apply this access code's pending mutations to the device, so the code on the device does not match its requested state. Seam keeps retrying, and this error clears automatically once the mutations are applied.
287
+ */ | {
288
+ /**
289
+ * Date and time at which Seam created the error.
290
+ */
291
+ created_at?: string | undefined;
292
+ /**
293
+ * Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
294
+ */
295
+ error_code: 'failed_to_apply_mutations';
296
+ /**
297
+ * Indicates that this is an access code error.
298
+ */
299
+ is_access_code_error: true;
300
+ /**
301
+ * Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
302
+ */
303
+ message: string;
304
+ } /**
305
+ * This access code is still active on the device even though its `ends_at` has passed, so the recipient may still be able to unlock the device after their access window ended. Seam is attempting to remove it, and this error clears automatically once the access code is no longer active.
306
+ */ | {
307
+ /**
308
+ * Date and time at which Seam created the error.
309
+ */
310
+ created_at?: string | undefined;
311
+ /**
312
+ * Unique identifier of the type of error. Enables quick recognition and categorization of the issue.
313
+ */
314
+ error_code: 'failed_to_expire';
315
+ /**
316
+ * Indicates that this is an access code error.
317
+ */
318
+ is_access_code_error: true;
319
+ /**
320
+ * Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
321
+ */
322
+ message: string;
323
+ } /**
267
324
  * Indicates that the account is disconnected.
268
325
  */ | {
269
326
  /**
@@ -672,6 +729,36 @@ export type UnmanagedAccessCode = {
672
729
  */
673
730
  warning_code: 'delay_in_removing_from_device';
674
731
  } /**
732
+ * Seam has not yet issued this access code, even though its start time is approaching, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and this warning clears automatically once issuance succeeds.
733
+ */ | {
734
+ /**
735
+ * Date and time at which Seam created the warning.
736
+ */
737
+ created_at?: string | undefined;
738
+ /**
739
+ * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
740
+ */
741
+ message: string;
742
+ /**
743
+ * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
744
+ */
745
+ warning_code: 'delay_in_issuing';
746
+ } /**
747
+ * Seam has not yet applied this access code's pending mutations to the device, so the code on the device does not yet match its requested state. Seam is still attempting to apply them, and this warning clears automatically once the mutations are applied.
748
+ */ | {
749
+ /**
750
+ * Date and time at which Seam created the warning.
751
+ */
752
+ created_at?: string | undefined;
753
+ /**
754
+ * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.
755
+ */
756
+ message: string;
757
+ /**
758
+ * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.
759
+ */
760
+ warning_code: 'delay_in_applying_mutations';
761
+ } /**
675
762
  * Third-party integration detected that may cause access codes to fail.
676
763
  */ | {
677
764
  /**
@@ -132,11 +132,11 @@ export type EventsListParameters = RequireAtLeastOne<{
132
132
  /**
133
133
  * Type of the events that you want to list.
134
134
  */
135
- event_type?: 'access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted' | undefined;
135
+ event_type?: 'access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.issued' | 'access_code.delay_in_issuing' | 'access_code.failed_to_issue' | 'access_code.delay_in_applying_mutations' | 'access_code.failed_to_apply_mutations' | 'access_code.failed_to_expire' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted' | undefined;
136
136
  /**
137
137
  * Types of the events that you want to list.
138
138
  */
139
- event_types?: Array<'access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted'> | undefined;
139
+ event_types?: Array<'access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.issued' | 'access_code.delay_in_issuing' | 'access_code.failed_to_issue' | 'access_code.delay_in_applying_mutations' | 'access_code.failed_to_apply_mutations' | 'access_code.failed_to_expire' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted'> | undefined;
140
140
  /**
141
141
  * Numerical limit on the number of events to return.
142
142
  */
@@ -1,22 +1,56 @@
1
1
  import type { ApiError } from './api-error-types.js';
2
+ /**
3
+ * Error thrown when the Seam API returns an error response.
4
+ */
2
5
  export declare class SeamHttpApiError extends Error {
6
+ /**
7
+ * Error type returned by the Seam API, e.g., `invalid_input`.
8
+ */
3
9
  code: string;
4
10
  statusCode: number;
11
+ /**
12
+ * Unique identifier of the request that failed.
13
+ * Provide this to Seam support when reporting an issue.
14
+ */
5
15
  requestId: string;
16
+ /**
17
+ * Additional error-specific data returned by the Seam API, if any.
18
+ */
6
19
  data?: unknown;
7
20
  constructor(error: ApiError, statusCode: number, requestId: string);
8
21
  }
22
+ /**
23
+ * Returns true if the error is a {@link SeamHttpApiError}.
24
+ */
9
25
  export declare const isSeamHttpApiError: (error: unknown) => error is SeamHttpApiError;
26
+ /**
27
+ * Error thrown when the Seam API returns a 401 Unauthorized error response.
28
+ */
10
29
  export declare class SeamHttpUnauthorizedError extends SeamHttpApiError {
11
30
  code: 'unauthorized';
12
31
  statusCode: 401;
13
32
  constructor(requestId: string);
14
33
  }
34
+ /**
35
+ * Returns true if the error is a {@link SeamHttpUnauthorizedError}.
36
+ */
15
37
  export declare const isSeamHttpUnauthorizedError: (error: unknown) => error is SeamHttpUnauthorizedError;
38
+ /**
39
+ * Error thrown when the Seam API returns an `invalid_input` error response.
40
+ */
16
41
  export declare class SeamHttpInvalidInputError extends SeamHttpApiError {
17
42
  #private;
18
43
  code: 'invalid_input';
19
44
  constructor(error: ApiError, statusCode: number, requestId: string);
45
+ /**
46
+ * Returns the validation error messages for the request parameter,
47
+ * or an empty array if the parameter had no validation errors.
48
+ *
49
+ * @param paramName - Name of the request parameter.
50
+ */
20
51
  getValidationErrorMessages(paramName: string): string[];
21
52
  }
53
+ /**
54
+ * Returns true if the error is a {@link SeamHttpInvalidInputError}.
55
+ */
22
56
  export declare const isSeamHttpInvalidInputError: (error: unknown) => error is SeamHttpInvalidInputError;
@@ -1,7 +1,20 @@
1
+ /**
2
+ * Error thrown when the Seam API returns an error response.
3
+ */
1
4
  export class SeamHttpApiError extends Error {
5
+ /**
6
+ * Error type returned by the Seam API, e.g., `invalid_input`.
7
+ */
2
8
  code;
3
9
  statusCode;
10
+ /**
11
+ * Unique identifier of the request that failed.
12
+ * Provide this to Seam support when reporting an issue.
13
+ */
4
14
  requestId;
15
+ /**
16
+ * Additional error-specific data returned by the Seam API, if any.
17
+ */
5
18
  data;
6
19
  constructor(error, statusCode, requestId) {
7
20
  const { type, message, data } = error;
@@ -14,9 +27,15 @@ export class SeamHttpApiError extends Error {
14
27
  this.data = data;
15
28
  }
16
29
  }
30
+ /**
31
+ * Returns true if the error is a {@link SeamHttpApiError}.
32
+ */
17
33
  export const isSeamHttpApiError = (error) => {
18
34
  return error instanceof SeamHttpApiError;
19
35
  };
36
+ /**
37
+ * Error thrown when the Seam API returns a 401 Unauthorized error response.
38
+ */
20
39
  export class SeamHttpUnauthorizedError extends SeamHttpApiError {
21
40
  code;
22
41
  statusCode;
@@ -30,9 +49,15 @@ export class SeamHttpUnauthorizedError extends SeamHttpApiError {
30
49
  this.requestId = requestId;
31
50
  }
32
51
  }
52
+ /**
53
+ * Returns true if the error is a {@link SeamHttpUnauthorizedError}.
54
+ */
33
55
  export const isSeamHttpUnauthorizedError = (error) => {
34
56
  return error instanceof SeamHttpUnauthorizedError;
35
57
  };
58
+ /**
59
+ * Error thrown when the Seam API returns an `invalid_input` error response.
60
+ */
36
61
  export class SeamHttpInvalidInputError extends SeamHttpApiError {
37
62
  code;
38
63
  #validationErrors;
@@ -42,10 +67,19 @@ export class SeamHttpInvalidInputError extends SeamHttpApiError {
42
67
  this.code = 'invalid_input';
43
68
  this.#validationErrors = error.validation_errors ?? {};
44
69
  }
70
+ /**
71
+ * Returns the validation error messages for the request parameter,
72
+ * or an empty array if the parameter had no validation errors.
73
+ *
74
+ * @param paramName - Name of the request parameter.
75
+ */
45
76
  getValidationErrorMessages(paramName) {
46
77
  return this.#validationErrors[paramName]?._errors ?? [];
47
78
  }
48
79
  }
80
+ /**
81
+ * Returns true if the error is a {@link SeamHttpInvalidInputError}.
82
+ */
49
83
  export const isSeamHttpInvalidInputError = (error) => {
50
84
  return error instanceof SeamHttpInvalidInputError;
51
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"seam-http-error.js","sourceRoot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iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAA;IACxD,CAAC;IAED;;;;;OAKG;IACH,0BAA0B,CAAC,SAAiB;QAC1C,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,IAAI,EAAE,CAAA;IACzD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,KAAc,EACsB,EAAE;IACtC,OAAO,KAAK,YAAY,yBAAyB,CAAA;AACnD,CAAC,CAAA"}
@@ -19,18 +19,49 @@ interface SeamHttpRequestConfig<TResponseKey> {
19
19
  readonly hasRequiredParameters?: boolean;
20
20
  readonly requiredParameterNames?: readonly string[];
21
21
  }
22
+ /**
23
+ * A lazy request to the Seam API.
24
+ *
25
+ * Creating a SeamHttpRequest does not send anything over the network.
26
+ * The request is sent once `execute` is called,
27
+ * or when the request is awaited like a Promise,
28
+ * e.g., with `await`, `then`, `catch`, or `finally`.
29
+ * When the response contains an action attempt,
30
+ * awaiting the request also waits for the action attempt to resolve
31
+ * according to the `waitForActionAttempt` option.
32
+ *
33
+ * Before sending, the request may be inspected
34
+ * with `url`, `pathname`, `method`, `params`, and `body`.
35
+ */
22
36
  export declare class SeamHttpRequest<const TResponse, const TResponseKey extends keyof TResponse | undefined> implements Promise<TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined> {
23
37
  #private;
24
38
  readonly [Symbol.toStringTag]: string;
25
39
  constructor(parent: SeamHttpRequestParent, config: SeamHttpRequestConfig<TResponseKey>);
40
+ /**
41
+ * The key of the API response object containing the response data,
42
+ * or undefined if the endpoint returns an empty response.
43
+ */
26
44
  get responseKey(): TResponseKey;
27
45
  get hasPagination(): boolean;
46
+ /**
47
+ * The full request URL including any serialized query parameters.
48
+ */
28
49
  get url(): URL;
29
50
  get pathname(): string;
30
51
  get method(): Method;
31
52
  get params(): undefined | Record<string, unknown>;
32
53
  get body(): unknown;
54
+ /**
55
+ * Sends the request and returns the response data.
56
+ * If the response contains an action attempt,
57
+ * waits for the action attempt to resolve
58
+ * according to the `waitForActionAttempt` option.
59
+ */
33
60
  execute(): Promise<TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined>;
61
+ /**
62
+ * Sends the request and returns the entire response body
63
+ * without waiting for any action attempt to resolve.
64
+ */
34
65
  fetchResponse(): Promise<TResponse>;
35
66
  then<TResult1 = TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined, TResult2 = never>(onfulfilled?: ((value: TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
36
67
  catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null | undefined): Promise<(TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined) | TResult>;
@@ -1,6 +1,20 @@
1
1
  import { assertValidRequestParameters } from './request-parameters.js';
2
2
  import { resolveActionAttempt, } from './resolve-action-attempt.js';
3
3
  import { serializeUrlSearchParams } from './url-search-params-serializer.js';
4
+ /**
5
+ * A lazy request to the Seam API.
6
+ *
7
+ * Creating a SeamHttpRequest does not send anything over the network.
8
+ * The request is sent once `execute` is called,
9
+ * or when the request is awaited like a Promise,
10
+ * e.g., with `await`, `then`, `catch`, or `finally`.
11
+ * When the response contains an action attempt,
12
+ * awaiting the request also waits for the action attempt to resolve
13
+ * according to the `waitForActionAttempt` option.
14
+ *
15
+ * Before sending, the request may be inspected
16
+ * with `url`, `pathname`, `method`, `params`, and `body`.
17
+ */
4
18
  export class SeamHttpRequest {
5
19
  [Symbol.toStringTag] = 'SeamHttpRequest';
6
20
  #parent;
@@ -9,12 +23,19 @@ export class SeamHttpRequest {
9
23
  this.#parent = parent;
10
24
  this.#config = config;
11
25
  }
26
+ /**
27
+ * The key of the API response object containing the response data,
28
+ * or undefined if the endpoint returns an empty response.
29
+ */
12
30
  get responseKey() {
13
31
  return this.#config.responseKey;
14
32
  }
15
33
  get hasPagination() {
16
34
  return this.#config.hasPagination ?? false;
17
35
  }
36
+ /**
37
+ * The full request URL including any serialized query parameters.
38
+ */
18
39
  get url() {
19
40
  const { client } = this.#parent;
20
41
  const serializer = typeof client.defaults.paramsSerializer === 'function'
@@ -40,6 +61,12 @@ export class SeamHttpRequest {
40
61
  get body() {
41
62
  return this.#config.body;
42
63
  }
64
+ /**
65
+ * Sends the request and returns the response data.
66
+ * If the response contains an action attempt,
67
+ * waits for the action attempt to resolve
68
+ * according to the `waitForActionAttempt` option.
69
+ */
43
70
  async execute() {
44
71
  const response = await this.fetchResponse();
45
72
  if (this.responseKey === undefined) {
@@ -59,6 +86,10 @@ export class SeamHttpRequest {
59
86
  }
60
87
  return data;
61
88
  }
89
+ /**
90
+ * Sends the request and returns the entire response body
91
+ * without waiting for any action attempt to resolve.
92
+ */
62
93
  async fetchResponse() {
63
94
  assertValidRequestParameters(this.#config.parameters, this.pathname, this.#config.hasRequiredParameters ?? false, this.#config.requiredParameterNames ?? []);
64
95
  const { client } = this.#parent;
@@ -1 +1 @@
1
- {"version":3,"file":"seam-http-request.js","sourceRoot":"","sources":["../src/lib/seam-http-request.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAEL,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAqB5E,MAAM,OAAO,eAAe;IAMjB,CAAC,MAAM,CAAC,WAAW,CAAC,GAAW,iBAAiB,CAAA;IAEhD,OAAO,CAAuB;IAC9B,OAAO,CAAqC;IAErD,YACE,MAA6B,EAC7B,MAA2C;QAE3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,IAAW,WAAW;QACpB,OAAO,IAAI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IACd,CAAC;AACH,CAAC,CAAA"}
@@ -6,6 +6,9 @@ interface SeamPaginatorParent {
6
6
  readonly defaults: Required<SeamHttpRequestOptions>;
7
7
  }
8
8
  declare const $brand: unique symbol;
9
+ /**
10
+ * Opaque cursor identifying a page of results returned by the Seam API.
11
+ */
9
12
  export type SeamPageCursor = string & {
10
13
  [$brand]: 'SeamPageCursor';
11
14
  };
@@ -14,16 +17,41 @@ interface Pagination {
14
17
  readonly nextPageCursor: SeamPageCursor | null;
15
18
  readonly nextPageUrl: string | null;
16
19
  }
20
+ /**
21
+ * Iterates over paginated results from Seam API list endpoints.
22
+ *
23
+ * Create a SeamPaginator with the client's `createPaginator` method.
24
+ * Fetch pages manually with `firstPage` and `nextPage`,
25
+ * iterate over pages with `for await`,
26
+ * iterate over items across all pages with `flatten`,
27
+ * or collect every item into a single array with `flattenToArray`.
28
+ */
17
29
  export declare class SeamPaginator<const TResponse, const TResponseKey extends keyof TResponse> implements AsyncIterable<EnsureReadonlyArray<TResponse[TResponseKey]>> {
18
30
  #private;
19
31
  constructor(parent: SeamPaginatorParent, request: SeamHttpRequest<TResponse, TResponseKey>);
32
+ /**
33
+ * Fetches the first page of results along with the pagination state.
34
+ */
20
35
  firstPage(): Promise<[
21
36
  EnsureReadonlyArray<TResponse[TResponseKey]>,
22
37
  Pagination
23
38
  ]>;
39
+ /**
40
+ * Fetches the next page of results
41
+ * using the nextPageCursor returned with a previous page.
42
+ */
24
43
  nextPage(nextPageCursor: Pagination['nextPageCursor']): Promise<[EnsureReadonlyArray<TResponse[TResponseKey]>, Pagination]>;
44
+ /**
45
+ * Fetches every page and returns all items in a single array.
46
+ */
25
47
  flattenToArray(): Promise<EnsureReadonlyArray<TResponse[TResponseKey]>>;
48
+ /**
49
+ * Yields each item across all pages, fetching the next page as needed.
50
+ */
26
51
  flatten(): AsyncGenerator<EnsureReadonlyArray<TResponse[TResponseKey]>>;
52
+ /**
53
+ * Yields each page of items, fetching the next page as needed.
54
+ */
27
55
  [Symbol.asyncIterator](): AsyncGenerator<EnsureReadonlyArray<TResponse[TResponseKey]>>;
28
56
  }
29
57
  type EnsureReadonlyArray<T> = T extends readonly any[] ? T : never;
@@ -1,4 +1,13 @@
1
1
  import { SeamHttpRequest } from './seam-http-request.js';
2
+ /**
3
+ * Iterates over paginated results from Seam API list endpoints.
4
+ *
5
+ * Create a SeamPaginator with the client's `createPaginator` method.
6
+ * Fetch pages manually with `firstPage` and `nextPage`,
7
+ * iterate over pages with `for await`,
8
+ * iterate over items across all pages with `flatten`,
9
+ * or collect every item into a single array with `flattenToArray`.
10
+ */
2
11
  export class SeamPaginator {
3
12
  #request;
4
13
  #parent;
@@ -9,9 +18,16 @@ export class SeamPaginator {
9
18
  this.#parent = parent;
10
19
  this.#request = request;
11
20
  }
21
+ /**
22
+ * Fetches the first page of results along with the pagination state.
23
+ */
12
24
  async firstPage() {
13
25
  return await this.#fetch();
14
26
  }
27
+ /**
28
+ * Fetches the next page of results
29
+ * using the nextPageCursor returned with a previous page.
30
+ */
15
31
  async nextPage(nextPageCursor) {
16
32
  if (nextPageCursor == null) {
17
33
  throw new Error('Cannot get the next page with a null nextPageCursor');
@@ -54,6 +70,9 @@ export class SeamPaginator {
54
70
  pagination,
55
71
  ];
56
72
  }
73
+ /**
74
+ * Fetches every page and returns all items in a single array.
75
+ */
57
76
  async flattenToArray() {
58
77
  const items = [];
59
78
  let [current, pagination] = await this.firstPage();
@@ -65,6 +84,9 @@ export class SeamPaginator {
65
84
  }
66
85
  return items;
67
86
  }
87
+ /**
88
+ * Yields each item across all pages, fetching the next page as needed.
89
+ */
68
90
  async *flatten() {
69
91
  let [current, pagination] = await this.firstPage();
70
92
  for (const item of current) {
@@ -78,6 +100,9 @@ export class SeamPaginator {
78
100
  }
79
101
  }
80
102
  }
103
+ /**
104
+ * Yields each page of items, fetching the next page as needed.
105
+ */
81
106
  async *[Symbol.asyncIterator]() {
82
107
  let [current, pagination] = await this.firstPage();
83
108
  yield current;
@@ -1 +1 @@
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Q,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YACvE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QACxB,CAAC;QACD,OAAO,KAAqD,CAAA;IAC9D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,OAAO;QAGZ,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QAClD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,CAAA;QACZ,CAAC;QACD,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;YAC9B,CAAC;YAAA,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YACvE,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,CAAA;YACZ,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QAG3B,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QAClD,MAAM,OAAO,CAAA;QACb,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;YAC9B,CAAC;YAAA,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YACvE,MAAM,OAAO,CAAA;QACf,CAAC;IACH,CAAC;CACF"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const seamapiJavascriptHttpVersion = "2.17.0";
1
+ declare const seamapiJavascriptHttpVersion = "2.19.0";
2
2
  export default seamapiJavascriptHttpVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '2.17.0';
1
+ const seamapiJavascriptHttpVersion = '2.19.0';
2
2
  export default seamapiJavascriptHttpVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/http",
3
- "version": "2.17.0",
3
+ "version": "2.19.0",
4
4
  "description": "JavaScript HTTP client for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -87,7 +87,7 @@
87
87
  "@seamapi/blueprint": "^1.8.0",
88
88
  "@seamapi/fake-seam-connect": "^2.0.4",
89
89
  "@seamapi/smith": "^1.1.0",
90
- "@seamapi/types": "1.1027.0",
90
+ "@seamapi/types": "1.1029.0",
91
91
  "@types/jsonwebtoken": "^9.0.6",
92
92
  "@types/node": "^24.10.9",
93
93
  "ava": "^8.0.1",
@@ -97,6 +97,7 @@
97
97
  "eslint": "^9.31.0",
98
98
  "eslint-import-resolver-typescript": "^4.4.5",
99
99
  "eslint-plugin-import": "^2.32.0",
100
+ "eslint-plugin-jsdoc": "^64.1.0",
100
101
  "eslint-plugin-simple-import-sort": "^12.1.1",
101
102
  "eslint-plugin-unused-imports": "^4.1.4",
102
103
  "execa": "^10.0.0",
package/src/index.ts CHANGED
@@ -1 +1,6 @@
1
+ /**
2
+ * JavaScript HTTP client for the Seam API written in TypeScript.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  export * from './lib/index.js'
package/src/lib/client.ts CHANGED
@@ -13,8 +13,22 @@ export type Client = AxiosInstance
13
13
  export const defaultTimeout = 30_000
14
14
 
15
15
  export interface ClientOptions {
16
+ /**
17
+ * Request timeout in milliseconds, applied per attempt.
18
+ * Set to 0 to disable the timeout. Defaults to 30 seconds.
19
+ */
16
20
  timeout?: number
21
+
22
+ /**
23
+ * Options passed to the underlying Axios client.
24
+ */
17
25
  axiosOptions?: AxiosRequestConfig
26
+
27
+ /**
28
+ * Options passed to axios-retry,
29
+ * which retries idempotent requests that fail
30
+ * because of a transport error, timeout, or HTTP 429 response.
31
+ */
18
32
  axiosRetryOptions?: AxiosRetryConfig
19
33
  }
20
34