Page and retry policies
Constructor
Section titled “Constructor”new Page(items: T[], cursor: string | null)| Parameter | Type | Description |
|---|---|---|
items |
T[] |
|
cursor |
string | null |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
cursor |
string | null |
|
items |
T[] |
|
hasMore |
boolean |
True when another page exists. |
length |
number |
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator](): Iterator<T>Returns Iterator<T>.
at(index: number): T | undefinedThe item at index; negative counts from the end.
| Parameter | Type | Description |
|---|---|---|
index |
number |
Returns T \| undefined.
RetryPolicy
Section titled “RetryPolicy”How many times to try a call, and how long to wait between tries. The
default is 3 attempts, 500 ms initial backoff doubling to a 30 s cap, with
jitter. new RetryPolicy({ maxAttempts: 1 }) (or NO_RETRY) turns
retries off.
Constructor
Section titled “Constructor”new RetryPolicy(opts?: RetryPolicyOptions)| Parameter | Type | Description |
|---|---|---|
opts (optional) |
RetryPolicyOptions |
|
opts.initialBackoffMs (optional) |
number |
Milliseconds before the first retry. Default 500. |
opts.jitter (optional) |
boolean |
Randomise each wait between 50% and 100% of its value. Default true. |
opts.maxAttempts (optional) |
number |
Total attempts, including the first. Default 3. |
opts.maxBackoffMs (optional) |
number |
Cap on any one wait, in milliseconds. Default 30000. |
opts.retryableExceptions (optional) |
readonly ExceptionClass[] |
Exception classes eligible for a retry. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
initialBackoffMs |
number |
|
jitter |
boolean |
|
maxAttempts |
number |
|
maxBackoffMs |
number |
|
retryableExceptions |
readonly ExceptionClass[] |
Methods
Section titled “Methods”computeBackoffMs()
Section titled “computeBackoffMs()”computeBackoffMs(attempt: number, exc: STXException): numberMilliseconds to wait after attempt attempt (1-based) failed.
| Parameter | Type | Description |
|---|---|---|
attempt |
number |
|
exc |
STXException |
Returns number.
shouldRetry()
Section titled “shouldRetry()”shouldRetry(exc: STXException, attempt: number, idempotent: boolean): booleanWhether to try again after exc ended attempt number attempt.
| Parameter | Type | Description |
|---|---|---|
exc |
STXException |
|
attempt |
number |
|
idempotent |
boolean |
Returns boolean.
ReconnectPolicy
Section titled “ReconnectPolicy”Backoff between reconnect attempts.
Constructor
Section titled “Constructor”new ReconnectPolicy(opts?: ReconnectPolicyOptions)| Parameter | Type | Description |
|---|---|---|
opts (optional) |
ReconnectPolicyOptions |
|
opts.initialBackoffMs (optional) |
number |
|
opts.jitter (optional) |
boolean |
|
opts.maxAttempts (optional) |
number | null |
null (the default) never gives up. |
opts.maxBackoffMs (optional) |
number |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
initialBackoffMs |
number |
|
jitter |
boolean |
|
maxAttempts |
number | null |
|
maxBackoffMs |
number |
Methods
Section titled “Methods”delayMs()
Section titled “delayMs()”delayMs(attempt: number): number| Parameter | Type | Description |
|---|---|---|
attempt |
number |
Returns number.

