@upstash/qstash 0.3.5 → 0.3.6

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.
@@ -12,6 +12,7 @@ export class Client {
12
12
  value: void 0
13
13
  });
14
14
  this.http = new HttpClient({
15
+ retry: config.retry,
15
16
  baseUrl: config.baseUrl
16
17
  ? config.baseUrl.replace(/\/$/, "")
17
18
  : "https://qstash.upstash.io",
@@ -35,8 +35,8 @@ export class HttpClient {
35
35
  }
36
36
  else {
37
37
  this.retry = {
38
- attempts: config?.retry?.retries ?? 5,
39
- backoff: config?.retry?.backoff ??
38
+ attempts: config.retry?.retries ? config.retry.retries + 1 : 5,
39
+ backoff: config.retry?.backoff ??
40
40
  ((retryCount) => Math.exp(retryCount) * 50),
41
41
  };
42
42
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/entrypoints/nodejs.js",
4
4
  "types": "./types/entrypoints/nodejs.d.ts",
5
5
  "name": "@upstash/qstash",
6
- "version": "v0.3.5",
6
+ "version": "v0.3.6",
7
7
  "description": "Official Deno/Typescript client for QStash",
8
8
  "repository": {
9
9
  "type": "git",
@@ -15,6 +15,7 @@ class Client {
15
15
  value: void 0
16
16
  });
17
17
  this.http = new http_js_1.HttpClient({
18
+ retry: config.retry,
18
19
  baseUrl: config.baseUrl
19
20
  ? config.baseUrl.replace(/\/$/, "")
20
21
  : "https://qstash.upstash.io",
@@ -38,8 +38,8 @@ class HttpClient {
38
38
  }
39
39
  else {
40
40
  this.retry = {
41
- attempts: config?.retry?.retries ?? 5,
42
- backoff: config?.retry?.backoff ??
41
+ attempts: config.retry?.retries ? config.retry.retries + 1 : 5,
42
+ backoff: config.retry?.backoff ??
43
43
  ((retryCount) => Math.exp(retryCount) * 50),
44
44
  };
45
45
  }
@@ -1,4 +1,4 @@
1
- import { Requester } from "./http.js";
1
+ import { Requester, RetryConfig } from "./http.js";
2
2
  import { Topics } from "./topics.js";
3
3
  import { Messages } from "./messages.js";
4
4
  import { Schedules } from "./schedules.js";
@@ -18,6 +18,10 @@ export declare type ClientConfig = {
18
18
  * The authorization token from the upstash console.
19
19
  */
20
20
  token: string;
21
+ /**
22
+ * Configure how the client should retry requests.
23
+ */
24
+ retry?: RetryConfig | false;
21
25
  };
22
26
  declare type Destination = {
23
27
  /**