ring-client-api 13.2.1-beta.0 → 13.2.1

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/lib/api.js CHANGED
@@ -176,6 +176,13 @@ class RingApi extends subscribed_1.Subscribed {
176
176
  (0, util_1.logError)(e);
177
177
  }
178
178
  }));
179
+ pushReceiver.on('ON_DISCONNECT', () => {
180
+ pushReceiver.whenReady.catch((e) => {
181
+ (0, util_1.logError)('Connection to the push notification server has failed unexpectedly');
182
+ (0, util_1.logError)('If this happens repeatedly, verify connections to TCP/5228 are not blocked by firewall or IDS/IPS policies, and that DNS Adblock rules allow mtalk.google.com');
183
+ (0, util_1.logError)(e.message);
184
+ });
185
+ });
179
186
  try {
180
187
  await pushReceiver.connect();
181
188
  }
@@ -44,7 +44,7 @@ export declare class RingRestClient {
44
44
  oldRefreshToken?: string;
45
45
  newRefreshToken: string;
46
46
  }>;
47
- onSession: ReplaySubject<SessionResponse>;
47
+ onSession: ReplaySubject<import("./ring-types").ProfileResponse>;
48
48
  readonly baseSessionMetadata: {
49
49
  api_version: number;
50
50
  device_model: string;
@@ -51,11 +51,11 @@ async function responseToError(response) {
51
51
  try {
52
52
  error.response.body = JSON.parse(bodyText);
53
53
  }
54
- catch (_) {
54
+ catch {
55
55
  error.response.body = bodyText;
56
56
  }
57
57
  }
58
- catch (_) {
58
+ catch {
59
59
  // ignore
60
60
  }
61
61
  return error;
@@ -101,7 +101,7 @@ async function requestWithRetry(requestOptions, retryCount = 0) {
101
101
  try {
102
102
  data = JSON.parse(text);
103
103
  }
104
- catch (_) {
104
+ catch {
105
105
  data = text;
106
106
  }
107
107
  }
@@ -145,7 +145,7 @@ function parseAuthConfig(rawRefreshToken) {
145
145
  (0, assert_1.default)(config.rt);
146
146
  return config;
147
147
  }
148
- catch (_) {
148
+ catch {
149
149
  return {
150
150
  rt: rawRefreshToken,
151
151
  };
@@ -88,14 +88,14 @@ export declare class RingCamera extends Subscribed {
88
88
  private fetchingSnapshot;
89
89
  getSnapshot({ uuid }?: {
90
90
  uuid?: string;
91
- }): Promise<Buffer>;
91
+ }): Promise<Buffer<ArrayBufferLike>>;
92
92
  getNextSnapshot({ afterMs, maxWaitMs, force, uuid, }: {
93
93
  afterMs?: number;
94
94
  maxWaitMs?: number;
95
95
  force?: boolean;
96
96
  uuid?: string;
97
- }): Promise<Buffer & import("./rest-client").ExtendedResponse>;
98
- getSnapshotByUuid(uuid: string): Promise<Buffer & import("./rest-client").ExtendedResponse>;
97
+ }): Promise<Buffer<ArrayBufferLike> & import("./rest-client").ExtendedResponse>;
98
+ getSnapshotByUuid(uuid: string): Promise<Buffer<ArrayBufferLike> & import("./rest-client").ExtendedResponse>;
99
99
  recordToFile(outputPath: string, duration?: number): Promise<void>;
100
100
  streamVideo(ffmpegOptions: FfmpegOptions): Promise<StreamingSession>;
101
101
  /**
@@ -281,7 +281,7 @@ class RingCamera extends subscribed_1.Subscribed {
281
281
  processPushNotification(notification) {
282
282
  if (!('android_config' in notification) ||
283
283
  !('event' in notification.data) ||
284
- !('ding' in notification.data?.event)) {
284
+ !('ding' in (notification.data?.event ?? {}))) {
285
285
  // only process ding/motion notifications
286
286
  return;
287
287
  }
@@ -1006,8 +1006,7 @@ export interface ProfileResponse {
1006
1006
  account_type: 'ring' | string;
1007
1007
  };
1008
1008
  }
1009
- export interface SessionResponse extends ProfileResponse {
1010
- }
1009
+ export type SessionResponse = ProfileResponse;
1011
1010
  export interface AccountMonitoringStatus {
1012
1011
  accountUuid: string;
1013
1012
  externalServiceConfigType: 'rrms' | string;
package/lib/ring-types.js CHANGED
@@ -25,7 +25,6 @@ var RingDeviceType;
25
25
  RingDeviceType["CoAlarm"] = "alarm.co";
26
26
  RingDeviceType["SmokeCoListener"] = "listener.smoke-co";
27
27
  RingDeviceType["MultiLevelSwitch"] = "switch.multilevel";
28
- // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
29
28
  RingDeviceType["Fan"] = "switch.multilevel";
30
29
  RingDeviceType["MultiLevelBulb"] = "switch.multilevel.bulb";
31
30
  RingDeviceType["Switch"] = "switch";
@@ -40,12 +39,9 @@ var RingDeviceType;
40
39
  RingDeviceType["Thermostat"] = "temperature-control.thermostat";
41
40
  RingDeviceType["Sensor"] = "sensor";
42
41
  RingDeviceType["RingNetAdapter"] = "adapter.ringnet";
43
- // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
44
42
  RingDeviceType["CodeVault"] = "access-code.vault";
45
- // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
46
43
  RingDeviceType["SecurityAccessCode"] = "access-code";
47
44
  RingDeviceType["ZWaveAdapter"] = "adapter.zwave";
48
- // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
49
45
  RingDeviceType["ZWaveExtender"] = "range-extender.zwave";
50
46
  RingDeviceType["PanicButton"] = "security-panic";
51
47
  RingDeviceType["UnknownZWave"] = "unknown.zwave";
@@ -148,7 +148,7 @@ class WebrtcConnection extends subscribed_1.Subscribed {
148
148
  return;
149
149
  case 'pong':
150
150
  return;
151
- case 'notification':
151
+ case 'notification': {
152
152
  const { text } = message.body;
153
153
  if (text === 'camera_connected') {
154
154
  this.onCameraConnected.next();
@@ -159,6 +159,7 @@ class WebrtcConnection extends subscribed_1.Subscribed {
159
159
  return;
160
160
  }
161
161
  break;
162
+ }
162
163
  case 'close':
163
164
  (0, util_1.logError)('Video stream closed');
164
165
  (0, util_1.logError)(message.body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "13.2.1-beta.0",
3
+ "version": "13.2.1",
4
4
  "description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -13,7 +13,7 @@
13
13
  "scripts": {
14
14
  "build": "rm -rf lib && tsc --declaration && chmod +x ./lib/ring-*-cli.js",
15
15
  "dev": "tsc --declaration --watch --preserveWatchOutput",
16
- "lint": "eslint . --ext .ts",
16
+ "lint": "eslint .",
17
17
  "test": "jest",
18
18
  "test:watch": "jest --watch"
19
19
  },
@@ -35,7 +35,7 @@
35
35
  "@types/debug": "4.1.12",
36
36
  "@types/jest": "29.5.14",
37
37
  "@types/json-bigint": "^1.0.4",
38
- "@types/node": "22.9.0",
38
+ "@types/node": "22.9.3",
39
39
  "@types/socket.io-client": "1.4.36",
40
40
  "@types/uuid": "10.0.0",
41
41
  "@types/ws": "^8.5.13",
@@ -44,7 +44,7 @@
44
44
  "msw": "^2.6.4",
45
45
  "ts-jest": "29.2.5",
46
46
  "tsconfig": "*",
47
- "typescript": "5.6.3"
47
+ "typescript": "5.7.2"
48
48
  },
49
49
  "engines": {
50
50
  "node": "^18 || ^20 || ^22"