@seamapi/http 2.11.1 → 2.12.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 +13 -2
- package/lib/client.js +10 -3
- package/lib/client.js.map +1 -1
- package/lib/resources/connect-webview.d.ts +1 -1
- package/lib/resources/connected-account.d.ts +1 -1
- package/lib/resources/device.d.ts +1 -1
- package/lib/resources/event.d.ts +122 -122
- package/lib/resources/phone.d.ts +1 -1
- package/lib/resources/unmanaged-device.d.ts +1 -1
- package/lib/routes/connect-webviews/connect-webviews.d.ts +2 -2
- package/lib/routes/connected-accounts/connected-accounts.d.ts +2 -2
- package/lib/routes/customers/customers.d.ts +4 -4
- package/lib/routes/devices/devices.d.ts +2 -2
- package/lib/routes/devices/unmanaged/unmanaged.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/client.ts +13 -3
- package/src/lib/resources/connect-webview.ts +1 -1
- package/src/lib/resources/connected-account.ts +1 -1
- package/src/lib/resources/device.ts +1 -1
- package/src/lib/resources/event.ts +187 -122
- package/src/lib/resources/phone.ts +1 -1
- package/src/lib/resources/unmanaged-device.ts +1 -1
- package/src/lib/routes/connect-webviews/connect-webviews.ts +2 -2
- package/src/lib/routes/connected-accounts/connected-accounts.ts +2 -2
- package/src/lib/routes/customers/customers.ts +4 -4
- package/src/lib/routes/devices/devices.ts +2 -2
- package/src/lib/routes/devices/unmanaged/unmanaged.ts +1 -1
- package/src/lib/version.ts +1 -1
package/README.md
CHANGED
|
@@ -465,8 +465,10 @@ const seam = new SeamHttp({
|
|
|
465
465
|
```
|
|
466
466
|
|
|
467
467
|
Set `timeout` to `0` to disable the timeout entirely.
|
|
468
|
-
A request that times out rejects with an Axios `ETIMEDOUT` error
|
|
469
|
-
|
|
468
|
+
A request that times out rejects with an Axios `ETIMEDOUT` error.
|
|
469
|
+
Timed-out idempotent requests are retried according to the retry options, with
|
|
470
|
+
the timeout reset for each attempt. Non-idempotent requests are not retried by
|
|
471
|
+
default.
|
|
470
472
|
|
|
471
473
|
#### Configuring the Axios Client
|
|
472
474
|
|
|
@@ -474,6 +476,15 @@ The Axios client and retry behavior may be configured with custom initiation opt
|
|
|
474
476
|
via [`axiosOptions`][axiosOptions] and [`axiosRetryOptions`][axiosRetryOptions].
|
|
475
477
|
Options are deep merged with the default options.
|
|
476
478
|
|
|
479
|
+
By default, the SDK makes up to three attempts: the initial request and two
|
|
480
|
+
retries. Retries are limited to `GET`, `HEAD`, `OPTIONS`, `PUT`, and `DELETE`
|
|
481
|
+
requests that fail because of a transport error, timeout, HTTP 429 response, or
|
|
482
|
+
HTTP 5xx response. `POST` and `PATCH` requests are not retried.
|
|
483
|
+
|
|
484
|
+
Retries use exponential backoff with jitter: approximately 200–240 ms before
|
|
485
|
+
the first retry and 400–480 ms before the second. A longer `Retry-After` header
|
|
486
|
+
is honored. The request timeout is reset for each attempt.
|
|
487
|
+
|
|
477
488
|
[axiosOptions]: https://axios-http.com/docs/config_defaults
|
|
478
489
|
[axiosRetryOptions]: https://github.com/softonic/axios-retry
|
|
479
490
|
|
package/lib/client.js
CHANGED
|
@@ -3,6 +3,15 @@ import axiosRetry, { exponentialDelay, isIdempotentRequestError, } from 'axios-r
|
|
|
3
3
|
import { errorInterceptor } from './error-interceptor.js';
|
|
4
4
|
import { serializeUrlSearchParams } from './url-search-params-serializer.js';
|
|
5
5
|
export const defaultTimeout = 30_000;
|
|
6
|
+
const defaultAxiosRetryOptions = {
|
|
7
|
+
retries: 2,
|
|
8
|
+
retryCondition: isIdempotentRequestError,
|
|
9
|
+
retryDelay: exponentialDelay,
|
|
10
|
+
shouldResetTimeout: true,
|
|
11
|
+
onRetry: () => undefined,
|
|
12
|
+
onMaxRetryTimesExceeded: () => undefined,
|
|
13
|
+
validateResponse: null,
|
|
14
|
+
};
|
|
6
15
|
export const createClient = (options) => {
|
|
7
16
|
const client = axios.create({
|
|
8
17
|
paramsSerializer: serializeUrlSearchParams,
|
|
@@ -11,9 +20,7 @@ export const createClient = (options) => {
|
|
|
11
20
|
...options.axiosOptions,
|
|
12
21
|
});
|
|
13
22
|
axiosRetry(client, {
|
|
14
|
-
|
|
15
|
-
retryDelay: exponentialDelay,
|
|
16
|
-
retryCondition: isIdempotentRequestError,
|
|
23
|
+
...defaultAxiosRetryOptions,
|
|
17
24
|
...options.axiosRetryOptions,
|
|
18
25
|
});
|
|
19
26
|
client.interceptors.response.use(undefined, errorInterceptor);
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA+C,MAAM,OAAO,CAAA;AAC1E,OAAO,UAAU,EAAE,EAEjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAI5E,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA+C,MAAM,OAAO,CAAA;AAC1E,OAAO,UAAU,EAAE,EAEjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAI5E,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AAYpC,MAAM,wBAAwB,GAAG;IAC/B,OAAO,EAAE,CAAC;IACV,cAAc,EAAE,wBAAwB;IACxC,UAAU,EAAE,gBAAgB;IAC5B,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;IACxB,uBAAuB,EAAE,GAAG,EAAE,CAAC,SAAS;IACxC,gBAAgB,EAAE,IAAI;CACY,CAAA;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAsB,EAAiB,EAAE;IACpE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC1B,gBAAgB,EAAE,wBAAwB;QAC1C,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,cAAc;QAC1C,GAAG,OAAO,CAAC,YAAY;KACxB,CAAC,CAAA;IAEF,UAAU,CAAC,MAAM,EAAE;QACjB,GAAG,wBAAwB;QAC3B,GAAG,OAAO,CAAC,iBAAiB;KAC7B,CAAC,CAAA;IAEF,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAE7D,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -47,7 +47,7 @@ export type ConnectWebview = {
|
|
|
47
47
|
/**
|
|
48
48
|
* Set of key:value pairs. Adding custom metadata to a resource, such as a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview), [connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account), or [device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device), enables you to store custom information, like customer details or internal IDs from your application. Keys set to `null` or to an empty string are omitted.
|
|
49
49
|
*/
|
|
50
|
-
custom_metadata: Record<string,
|
|
50
|
+
custom_metadata: Record<string, string | boolean>;
|
|
51
51
|
/**
|
|
52
52
|
* URL to which the Connect Webview should redirect when an unexpected error occurs.
|
|
53
53
|
*/
|
|
@@ -29,7 +29,7 @@ export type ConnectedAccount = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Set of key:value pairs. Adding custom metadata to a resource, such as a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview), [connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account), or [device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device), enables you to store custom information, like customer details or internal IDs from your application. Keys set to `null` or to an empty string are omitted.
|
|
31
31
|
*/
|
|
32
|
-
custom_metadata: Record<string,
|
|
32
|
+
custom_metadata: Record<string, string | boolean>;
|
|
33
33
|
/**
|
|
34
34
|
* Your unique key for the customer associated with this connected account.
|
|
35
35
|
*/
|
|
@@ -97,7 +97,7 @@ export type Device = {
|
|
|
97
97
|
/**
|
|
98
98
|
* Set of key:value pairs. Adding custom metadata to a resource, such as a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview), [connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account), or [device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device), enables you to store custom information, like customer details or internal IDs from your application. Keys set to `null` or to an empty string are omitted.
|
|
99
99
|
*/
|
|
100
|
-
custom_metadata: Record<string,
|
|
100
|
+
custom_metadata: Record<string, string | boolean>;
|
|
101
101
|
/**
|
|
102
102
|
* ID of the device.
|
|
103
103
|
*/
|