ring-client-api 12.0.0-beta.2 → 12.0.0-beta.3

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.
@@ -268,7 +268,8 @@ class RingRestClient {
268
268
  }
269
269
  refreshSession() {
270
270
  this.sessionPromise = this.getSession();
271
- this.sessionPromise.finally(() => {
271
+ this.sessionPromise
272
+ .finally(() => {
272
273
  // Refresh the session every 12 hours
273
274
  // This is needed to keep the session alive for users outside the US, due to Data Residency laws
274
275
  // We believe Ring is clearing the session info after ~24 hours, which breaks Push Notifications
@@ -276,7 +277,8 @@ class RingRestClient {
276
277
  this.refreshSession();
277
278
  }, 12 * 60 * 60 * 1000); // 12 hours
278
279
  this.timeouts.push(timeout);
279
- });
280
+ })
281
+ .catch((e) => (0, util_1.logError)(e));
280
282
  }
281
283
  async request(options) {
282
284
  const hardwareId = await this.hardwareIdPromise, url = options.url, initialSessionPromise = this.sessionPromise;
package/lib/ring-types.js CHANGED
@@ -24,6 +24,7 @@ var RingDeviceType;
24
24
  RingDeviceType["CoAlarm"] = "alarm.co";
25
25
  RingDeviceType["SmokeCoListener"] = "listener.smoke-co";
26
26
  RingDeviceType["MultiLevelSwitch"] = "switch.multilevel";
27
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
27
28
  RingDeviceType["Fan"] = "switch.multilevel";
28
29
  RingDeviceType["MultiLevelBulb"] = "switch.multilevel.bulb";
29
30
  RingDeviceType["Switch"] = "switch";
@@ -38,9 +39,12 @@ var RingDeviceType;
38
39
  RingDeviceType["Thermostat"] = "temperature-control.thermostat";
39
40
  RingDeviceType["Sensor"] = "sensor";
40
41
  RingDeviceType["RingNetAdapter"] = "adapter.ringnet";
42
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
41
43
  RingDeviceType["CodeVault"] = "access-code.vault";
44
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
42
45
  RingDeviceType["SecurityAccessCode"] = "access-code";
43
46
  RingDeviceType["ZWaveAdapter"] = "adapter.zwave";
47
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
44
48
  RingDeviceType["ZWaveExtender"] = "range-extender.zwave";
45
49
  RingDeviceType["PanicButton"] = "security-panic";
46
50
  RingDeviceType["UnknownZWave"] = "unknown.zwave";
@@ -11,6 +11,7 @@ export declare class WebrtcConnection extends Subscribed {
11
11
  private readonly onSessionId;
12
12
  private readonly onOfferSent;
13
13
  private readonly dialogId;
14
+ readonly onCameraConnected: ReplaySubject<void>;
14
15
  readonly onCallAnswered: ReplaySubject<string>;
15
16
  readonly onCallEnded: ReplaySubject<void>;
16
17
  readonly onError: ReplaySubject<void>;
@@ -14,6 +14,7 @@ class WebrtcConnection extends subscribed_1.Subscribed {
14
14
  this.onSessionId = new rxjs_1.ReplaySubject(1);
15
15
  this.onOfferSent = new rxjs_1.ReplaySubject(1);
16
16
  this.dialogId = (0, util_1.generateUuid)();
17
+ this.onCameraConnected = new rxjs_1.ReplaySubject(1);
17
18
  this.onCallAnswered = new rxjs_1.ReplaySubject(1);
18
19
  this.onCallEnded = new rxjs_1.ReplaySubject(1);
19
20
  this.onError = new rxjs_1.ReplaySubject(1);
@@ -144,9 +145,12 @@ class WebrtcConnection extends subscribed_1.Subscribed {
144
145
  return;
145
146
  case 'notification':
146
147
  const { text } = message.body;
147
- if (text === 'PeerConnectionState::kConnecting' ||
148
- text === 'PeerConnectionState::kConnected' ||
149
- text === 'camera_connected') {
148
+ if (text === 'camera_connected') {
149
+ this.onCameraConnected.next();
150
+ return;
151
+ }
152
+ else if (text === 'PeerConnectionState::kConnecting' ||
153
+ text === 'PeerConnectionState::kConnected') {
150
154
  return;
151
155
  }
152
156
  break;
@@ -210,7 +214,7 @@ class WebrtcConnection extends subscribed_1.Subscribed {
210
214
  }
211
215
  activateCameraSpeaker() {
212
216
  // Fire and forget this call so that callers don't get hung up waiting for answer (which might not happen)
213
- this.addSubscriptions(this.onCallAnswered.pipe((0, operators_1.take)(1)).subscribe(() => {
217
+ this.addSubscriptions(this.onCameraConnected.pipe((0, operators_1.take)(1)).subscribe(() => {
214
218
  this.sendSessionMessage('camera_options', {
215
219
  stealth_mode: false,
216
220
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "12.0.0-beta.2",
3
+ "version": "12.0.0-beta.3",
4
4
  "description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -27,10 +27,10 @@
27
27
  "got": "^11.8.5",
28
28
  "json-bigint": "^1.0.0",
29
29
  "msw": "^1.2.3",
30
- "pvtsutils": "1.3.2",
30
+ "pvtsutils": "^1.3.5",
31
31
  "rxjs": "^7.8.1",
32
32
  "socket.io-client": "^2.5.0",
33
- "systeminformation": "^5.18.10",
33
+ "systeminformation": "^5.18.15",
34
34
  "uuid": "^9.0.0",
35
35
  "webcrypto-core": "^1.7.7",
36
36
  "werift": "0.18.5",
@@ -40,7 +40,7 @@
40
40
  "@types/debug": "4.1.8",
41
41
  "@types/jest": "29.5.3",
42
42
  "@types/json-bigint": "^1.0.1",
43
- "@types/node": "20.4.5",
43
+ "@types/node": "20.5.1",
44
44
  "@types/uuid": "9.0.2",
45
45
  "@types/ws": "^8.5.5",
46
46
  "eslint-config-shared": "*",