ring-client-api 13.2.0 → 13.2.1-beta.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.
@@ -1,10 +1,12 @@
1
1
  import { AuthTokenResponse, SessionResponse } from './ring-types';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
  import type { Credentials } from '@eneris/push-receiver/dist/types';
4
+ import { Agent } from 'undici';
4
5
  interface RequestOptions extends RequestInit {
5
6
  responseType?: 'json' | 'buffer';
6
7
  timeout?: number;
7
8
  json?: object;
9
+ dispatcher?: Agent;
8
10
  }
9
11
  export declare function clientApi(path: string): string;
10
12
  export declare function deviceApi(path: string): string;
@@ -11,7 +11,12 @@ exports.appApi = appApi;
11
11
  const util_1 = require("./util");
12
12
  const rxjs_1 = require("rxjs");
13
13
  const assert_1 = __importDefault(require("assert"));
14
- const defaultRequestOptions = {
14
+ const undici_1 = require("undici");
15
+ const fetchAgent = new undici_1.Agent({
16
+ connections: 6,
17
+ pipelining: 1,
18
+ keepAliveTimeout: 115000,
19
+ }), defaultRequestOptions = {
15
20
  responseType: 'json',
16
21
  method: 'GET',
17
22
  timeout: 20000,
@@ -74,6 +79,7 @@ async function requestWithRetry(requestOptions, retryCount = 0) {
74
79
  const options = {
75
80
  ...defaultRequestOptions,
76
81
  ...requestOptions,
82
+ dispatcher: fetchAgent,
77
83
  };
78
84
  // If a timeout is provided, create an AbortSignal for it
79
85
  if (options.timeout && !options.signal) {
@@ -363,7 +369,6 @@ class RingRestClient {
363
369
  authorization: `Bearer ${authTokenResponse.access_token}`,
364
370
  hardware_id: hardwareId,
365
371
  'User-Agent': 'android:com.ringapp',
366
- Connection: 'close',
367
372
  },
368
373
  });
369
374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "13.2.0",
3
+ "version": "13.2.1-beta.0",
4
4
  "description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -26,6 +26,7 @@
26
26
  "rxjs": "^7.8.1",
27
27
  "socket.io-client": "^2.5.0",
28
28
  "systeminformation": "^5.23.5",
29
+ "undici": "^6.21.0",
29
30
  "uuid": "^11.0.3",
30
31
  "werift": "0.20.1",
31
32
  "ws": "^8.18.0"