ring-client-api 12.1.1 → 13.0.0-beta.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.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare class RingApi extends Subscribed {
19
19
  readonly options: RingApiOptions & RefreshTokenAuth;
20
20
  readonly restClient: RingRestClient;
21
21
  readonly onRefreshTokenUpdated: import("rxjs").Observable<{
22
- oldRefreshToken?: string | undefined;
22
+ oldRefreshToken?: string;
23
23
  newRefreshToken: string;
24
24
  }>;
25
25
  constructor(options: RingApiOptions & RefreshTokenAuth);
package/lib/api.js CHANGED
@@ -124,9 +124,14 @@ class RingApi extends subscribed_1.Subscribed {
124
124
  }
125
125
  async registerPushReceiver(cameras, intercoms) {
126
126
  const credentials = this.restClient._internalOnly_pushNotificationCredentials, pushReceiver = new push_receiver_1.default({
127
- credentials,
128
- logLevel: 'NONE',
129
- senderId: '876313859327', // for Ring android app. 703521446232 for ring-site
127
+ firebase: {
128
+ apiKey: 'AIzaSyCv-hdFBmmdBBJadNy-TFwB-xN_H5m3Bk8',
129
+ projectId: 'ring-17770',
130
+ messagingSenderId: '876313859327', // for Ring android app. 703521446232 for ring-site
131
+ appId: '1:876313859327:android:e10ec6ddb3c81f39',
132
+ },
133
+ credentials: credentials?.config ? credentials : undefined,
134
+ debug: false,
130
135
  }), devicesById = {}, sendToDevice = (id, notification) => {
131
136
  devicesById[id]?.processPushNotification(notification);
132
137
  }, onPushNotificationToken = new rxjs_1.Subject();
@@ -154,6 +159,7 @@ class RingApi extends subscribed_1.Subscribed {
154
159
  device: {
155
160
  metadata: {
156
161
  ...this.restClient.baseSessionMetadata,
162
+ pn_dict_version: '2.0.0',
157
163
  pn_service: 'fcm',
158
164
  },
159
165
  os: 'android',
@@ -181,15 +187,29 @@ class RingApi extends subscribed_1.Subscribed {
181
187
  (0, util_1.logInfo)('Ignoring push notification received in first two seconds after starting up');
182
188
  return;
183
189
  }
184
- const dataJson = message.data?.gcmData;
185
190
  try {
186
- const notification = (0, json_bigint_1.default)({ storeAsString: true }).parse(dataJson);
187
- if ('ding' in notification) {
188
- sendToDevice(notification.ding.doorbot_id, notification);
191
+ const messageData = {};
192
+ // Each message field is a JSON string, so we need to parse them each individually
193
+ for (const p in message.data) {
194
+ try {
195
+ // If it's a JSON string, parse it into an object
196
+ messageData[p] = (0, json_bigint_1.default)({ storeAsString: true }).parse(message.data[p]);
197
+ }
198
+ catch {
199
+ // Otherwise just assign the value directly
200
+ messageData[p] = message.data[p];
201
+ }
189
202
  }
190
- else if ('alarm_meta' in notification) {
191
- // Alarm notification, such as intercom unlocked
192
- sendToDevice(notification.alarm_meta.device_zid, notification);
203
+ const notification = messageData, deviceId = notification.data?.device?.id;
204
+ if (deviceId) {
205
+ sendToDevice(deviceId, notification);
206
+ }
207
+ const eventCategory = notification.android_config.category;
208
+ if (eventCategory !== ring_types_1.PushNotificationAction.Ding &&
209
+ eventCategory !== ring_types_1.PushNotificationAction.Motion) {
210
+ (0, util_1.logInfo)('Received push notification with unknown category: ' +
211
+ eventCategory);
212
+ (0, util_1.logInfo)(JSON.stringify(message));
193
213
  }
194
214
  }
195
215
  catch (e) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logDeviceData = void 0;
3
+ exports.logDeviceData = logDeviceData;
4
4
  /* eslint-disable no-console */
5
5
  const api_1 = require("./api");
6
6
  const refresh_token_1 = require("./refresh-token");
@@ -73,4 +73,3 @@ async function logDeviceData() {
73
73
  console.log(JSON.stringify(results));
74
74
  process.exit(0);
75
75
  }
76
- exports.logDeviceData = logDeviceData;
package/lib/ffmpeg.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFfmpegPath = exports.setFfmpegPath = void 0;
3
+ exports.setFfmpegPath = setFfmpegPath;
4
+ exports.getFfmpegPath = getFfmpegPath;
4
5
  let ffmpegPath;
5
6
  function setFfmpegPath(path) {
6
7
  ffmpegPath = path;
7
8
  }
8
- exports.setFfmpegPath = setFfmpegPath;
9
9
  function getFfmpegPath() {
10
10
  return ffmpegPath;
11
11
  }
12
- exports.getFfmpegPath = getFfmpegPath;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logRefreshToken = exports.acquireRefreshToken = void 0;
3
+ exports.acquireRefreshToken = acquireRefreshToken;
4
+ exports.logRefreshToken = logRefreshToken;
4
5
  /* eslint-disable no-console */
5
6
  const rest_client_1 = require("./rest-client");
6
7
  const util_1 = require("./util");
@@ -24,13 +25,11 @@ async function acquireRefreshToken() {
24
25
  });
25
26
  return auth.refresh_token;
26
27
  }
27
- exports.acquireRefreshToken = acquireRefreshToken;
28
28
  async function logRefreshToken() {
29
29
  console.log('This CLI will provide you with a refresh token which you can use to configure ring-client-api and homebridge-ring.');
30
30
  const refreshToken = await acquireRefreshToken();
31
31
  console.log('\nSuccessfully logged in to Ring. Please add the following to your config:\n');
32
32
  console.log(`"refreshToken": "${refreshToken}"`);
33
33
  }
34
- exports.logRefreshToken = logRefreshToken;
35
34
  // eslint-disable-next-line @typescript-eslint/no-empty-function
36
35
  process.on('unhandledRejection', () => { });
@@ -35,7 +35,7 @@ export declare class RingRestClient {
35
35
  using2fa: boolean;
36
36
  promptFor2fa?: string;
37
37
  onRefreshTokenUpdated: ReplaySubject<{
38
- oldRefreshToken?: string | undefined;
38
+ oldRefreshToken?: string;
39
39
  newRefreshToken: string;
40
40
  }>;
41
41
  onSession: ReplaySubject<SessionResponse>;
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RingRestClient = exports.appApi = exports.commandsApi = exports.deviceApi = exports.clientApi = void 0;
6
+ exports.RingRestClient = void 0;
7
+ exports.clientApi = clientApi;
8
+ exports.deviceApi = deviceApi;
9
+ exports.commandsApi = commandsApi;
10
+ exports.appApi = appApi;
7
11
  const got_1 = __importDefault(require("got"));
8
12
  const util_1 = require("./util");
9
13
  const rxjs_1 = require("rxjs");
@@ -23,19 +27,15 @@ const defaultRequestOptions = {
23
27
  function clientApi(path) {
24
28
  return clientApiBaseUrl + path;
25
29
  }
26
- exports.clientApi = clientApi;
27
30
  function deviceApi(path) {
28
31
  return deviceApiBaseUrl + path;
29
32
  }
30
- exports.deviceApi = deviceApi;
31
33
  function commandsApi(path) {
32
34
  return commandsApiBaseUrl + path;
33
35
  }
34
- exports.commandsApi = commandsApi;
35
36
  function appApi(path) {
36
37
  return appApiBaseUrl + path;
37
38
  }
38
- exports.appApi = appApi;
39
39
  async function requestWithRetry(requestOptions) {
40
40
  try {
41
41
  const options = {
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import { CameraData, CameraDeviceSettingsData, CameraEventOptions, CameraEventResponse, CameraHealth, HistoryOptions, PeriodicFootageResponse, PushNotification, PushNotificationDing, VideoSearchResponse, OnvifCameraData, RingCameraKind } from './ring-types';
1
+ import { CameraData, CameraDeviceSettingsData, CameraEventOptions, CameraEventResponse, CameraHealth, HistoryOptions, PeriodicFootageResponse, PushNotification, PushNotificationDingV2, VideoSearchResponse, OnvifCameraData, RingCameraKind } from './ring-types';
3
2
  import { RingRestClient } from './rest-client';
4
3
  import { BehaviorSubject, Subject } from 'rxjs';
5
4
  import { DeepPartial } from './util';
@@ -27,9 +26,9 @@ export declare class RingCamera extends Subscribed {
27
26
  hasLight: boolean;
28
27
  hasSiren: boolean;
29
28
  onRequestUpdate: Subject<unknown>;
30
- onNewNotification: Subject<PushNotificationDing>;
31
- onActiveNotifications: BehaviorSubject<PushNotificationDing[]>;
32
- onDoorbellPressed: import("rxjs").Observable<PushNotificationDing>;
29
+ onNewNotification: Subject<PushNotificationDingV2>;
30
+ onActiveNotifications: BehaviorSubject<PushNotificationDingV2[]>;
31
+ onDoorbellPressed: import("rxjs").Observable<PushNotificationDingV2>;
33
32
  onMotionDetected: import("rxjs").Observable<boolean>;
34
33
  onMotionStarted: import("rxjs").Observable<null>;
35
34
  onBatteryLevel: import("rxjs").Observable<number | null>;
@@ -39,8 +38,8 @@ export declare class RingCamera extends Subscribed {
39
38
  requestUpdate(): void;
40
39
  get data(): AnyCameraData;
41
40
  get name(): string;
42
- get activeNotifications(): PushNotificationDing[];
43
- get latestNotification(): PushNotificationDing | undefined;
41
+ get activeNotifications(): PushNotificationDingV2[];
42
+ get latestNotification(): PushNotificationDingV2 | undefined;
44
43
  get latestNotificationSnapshotUuid(): string | undefined;
45
44
  get batteryLevel(): number | null;
46
45
  get hasBattery(): boolean;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RingCamera = exports.cleanSnapshotUuid = exports.getSearchQueryString = exports.getBatteryLevel = void 0;
3
+ exports.RingCamera = void 0;
4
+ exports.getBatteryLevel = getBatteryLevel;
5
+ exports.getSearchQueryString = getSearchQueryString;
6
+ exports.cleanSnapshotUuid = cleanSnapshotUuid;
4
7
  const ring_types_1 = require("./ring-types");
5
8
  const rest_client_1 = require("./rest-client");
6
9
  const rxjs_1 = require("rxjs");
@@ -40,7 +43,6 @@ function getBatteryLevel(data) {
40
43
  }
41
44
  return Math.min(...levels);
42
45
  }
43
- exports.getBatteryLevel = getBatteryLevel;
44
46
  function getSearchQueryString(options) {
45
47
  const queryString = Object.entries(options)
46
48
  .map(([key, value]) => {
@@ -56,14 +58,12 @@ function getSearchQueryString(options) {
56
58
  .join('&');
57
59
  return queryString.length ? `?${queryString}` : '';
58
60
  }
59
- exports.getSearchQueryString = getSearchQueryString;
60
61
  function cleanSnapshotUuid(uuid) {
61
62
  if (!uuid) {
62
63
  return uuid;
63
64
  }
64
65
  return uuid.replace(/:.*$/, '');
65
66
  }
66
- exports.cleanSnapshotUuid = cleanSnapshotUuid;
67
67
  class RingCamera extends subscribed_1.Subscribed {
68
68
  constructor(initialData, isDoorbot, restClient, avoidSnapshotBatteryDrain) {
69
69
  super();
@@ -74,8 +74,9 @@ class RingCamera extends subscribed_1.Subscribed {
74
74
  this.onRequestUpdate = new rxjs_1.Subject();
75
75
  this.onNewNotification = new rxjs_1.Subject();
76
76
  this.onActiveNotifications = new rxjs_1.BehaviorSubject([]);
77
- this.onDoorbellPressed = this.onNewNotification.pipe((0, operators_1.filter)((notification) => notification.action === ring_types_1.PushNotificationAction.Ding), (0, operators_1.share)());
78
- this.onMotionDetected = this.onActiveNotifications.pipe((0, operators_1.map)((notifications) => notifications.some((notification) => notification.action === ring_types_1.PushNotificationAction.Motion)), (0, operators_1.distinctUntilChanged)(), (0, operators_1.publishReplay)(1), (0, operators_1.refCount)());
77
+ this.onDoorbellPressed = this.onNewNotification.pipe((0, operators_1.filter)((notification) => notification.android_config.category === ring_types_1.PushNotificationAction.Ding), (0, operators_1.share)());
78
+ this.onMotionDetected = this.onActiveNotifications.pipe((0, operators_1.map)((notifications) => notifications.some((notification) => notification.android_config.category ===
79
+ ring_types_1.PushNotificationAction.Motion)), (0, operators_1.distinctUntilChanged)(), (0, operators_1.publishReplay)(1), (0, operators_1.refCount)());
79
80
  this.onMotionStarted = this.onMotionDetected.pipe((0, operators_1.filter)((currentlyDetected) => currentlyDetected), (0, operators_1.mapTo)(null), // no value needed, event is what matters
80
81
  (0, operators_1.share)());
81
82
  this.lastSnapshotTimestamp = 0;
@@ -136,7 +137,7 @@ class RingCamera extends subscribed_1.Subscribed {
136
137
  }
137
138
  get latestNotificationSnapshotUuid() {
138
139
  const notification = this.latestNotification;
139
- return notification?.ding.image_uuid;
140
+ return notification?.img?.snapshot_uuid;
140
141
  }
141
142
  get batteryLevel() {
142
143
  if (!('battery_life' in this.data)) {
@@ -257,16 +258,18 @@ class RingCamera extends subscribed_1.Subscribed {
257
258
  return new streaming_session_1.StreamingSession(this, connection);
258
259
  }
259
260
  removeDingById(idToRemove) {
260
- const allActiveDings = this.activeNotifications, otherDings = allActiveDings.filter(({ ding }) => ding.id !== idToRemove);
261
+ const allActiveDings = this.activeNotifications, otherDings = allActiveDings.filter(({ data }) => data.event.ding.id !== idToRemove);
261
262
  this.onActiveNotifications.next(otherDings);
262
263
  }
263
264
  processPushNotification(notification) {
264
- if (!('ding' in notification)) {
265
+ if (!('ding' in notification.data?.event)) {
265
266
  // only process ding/motion notifications
266
267
  return;
267
268
  }
268
- const activeDings = this.activeNotifications, dingId = notification.ding.id;
269
- this.onActiveNotifications.next(activeDings.filter((d) => d.ding.id !== dingId).concat([notification]));
269
+ const activeDings = this.activeNotifications, dingId = notification.data.event.ding.id;
270
+ this.onActiveNotifications.next(activeDings
271
+ .filter((d) => d.data.event.ding.id !== dingId)
272
+ .concat([notification]));
270
273
  this.onNewNotification.next(notification);
271
274
  setTimeout(() => {
272
275
  this.removeDingById(dingId);
@@ -76,10 +76,11 @@ class RingIntercom {
76
76
  });
77
77
  }
78
78
  processPushNotification(notification) {
79
- if (notification.action === ring_types_1.PushNotificationAction.Ding) {
79
+ if (notification.android_config.category === ring_types_1.PushNotificationAction.Ding) {
80
80
  this.onDing.next();
81
81
  }
82
- else if (notification.action === ring_types_1.PushNotificationAction.IntercomUnlock) {
82
+ else if (notification.android_config.category ===
83
+ ring_types_1.PushNotificationAction.IntercomUnlock) {
83
84
  this.onUnlocked.next();
84
85
  }
85
86
  }
@@ -865,37 +865,59 @@ export declare enum NotificationDetectionType {
865
865
  StreamBroken = "stream_broken"
866
866
  }
867
867
  export declare enum PushNotificationAction {
868
- Ding = "com.ring.push.HANDLE_NEW_DING",
869
- Motion = "com.ring.push.HANDLE_NEW_motion",
870
- LowBattery = "com.ring.push.LOW_BATTERY_ALERT",
871
- IntercomUnlock = "com.ring.push.INTERCOM_UNLOCK_FROM_APP"
868
+ Ding = "com.ring.pn.live-event.ding",
869
+ Motion = "com.ring.pn.live-event.motion",
870
+ IntercomUnlock = "com.ring.pn.intercom.virtual.unlock"
872
871
  }
873
- export interface PushNotificationDing {
874
- ding: {
875
- streaming_protocol: 'ring_media_server';
876
- location_id: string;
877
- device_name: string;
878
- doorbot_id: number;
879
- e2ee_enabled: boolean;
880
- streaming_data_hash: string;
881
- device_kind: RingCameraKind;
882
- detection_type: NotificationDetectionType;
883
- human_detected?: boolean;
884
- id: string;
885
- pod_id: number;
886
- request_id: string;
887
- image_uuid: string;
888
- properties: {
889
- active_streaming_profile: 'rms';
872
+ export interface PushNotificationDingV2 {
873
+ version: '2.0.0' | string;
874
+ android_config: {
875
+ category: PushNotificationAction | string;
876
+ body: string;
877
+ };
878
+ analytics: {
879
+ server_correlation_id: string;
880
+ server_id: 'com.ring.pns' | string;
881
+ subcategory: string;
882
+ triggered_at: number;
883
+ sent_at: number;
884
+ referring_item_type: string;
885
+ referring_item_id: string;
886
+ };
887
+ data: {
888
+ device: {
889
+ e2ee_enabled: boolean;
890
+ id: number;
891
+ kind: RingCameraKind;
892
+ name: string;
893
+ };
894
+ event: {
895
+ ding: {
896
+ id: string;
897
+ created_at: string;
898
+ subtype: 'other_motion' | 'motion' | 'ding' | 'human' | string;
899
+ detection_type: NotificationDetectionType;
900
+ };
901
+ eventito: {
902
+ type: NotificationDetectionType;
903
+ timestamp: number;
904
+ };
905
+ riid: string;
890
906
  is_sidewalk: boolean;
907
+ live_session: {
908
+ streaming_data_hash: string;
909
+ active_streaming_profile: 'rms' | string;
910
+ default_audio_route: string;
911
+ max_duration: number;
912
+ };
913
+ };
914
+ location: {
915
+ id: string;
891
916
  };
892
917
  };
893
- aps: {
894
- alert: string;
895
- sound: string;
918
+ img?: {
919
+ snapshot_uuid: string;
896
920
  };
897
- subtype: 'motion' | 'ding' | 'human' | string;
898
- action: PushNotificationAction | string;
899
921
  }
900
922
  export interface PushNotificationAlarm {
901
923
  aps: {
@@ -907,20 +929,7 @@ export interface PushNotificationAlarm {
907
929
  location_id: string;
908
930
  };
909
931
  }
910
- export interface PushNotificationLowBattery {
911
- data: {
912
- device_name: string;
913
- doorbot_id: number;
914
- battery_level: number;
915
- device_kind: RingDeviceType;
916
- timestamp_epoch_ms: number;
917
- };
918
- aps: {
919
- title: string;
920
- };
921
- action: PushNotificationAction.LowBattery;
922
- }
923
- export type PushNotification = PushNotificationDing | PushNotificationAlarm | PushNotificationLowBattery;
932
+ export type PushNotification = PushNotificationDingV2;
924
933
  export interface SocketTicketResponse {
925
934
  ticket: string;
926
935
  responseTimestampe: number;
package/lib/ring-types.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWebSocketSupportedAsset = exports.disabledLocationModes = exports.DispatchSignalType = exports.PushNotificationAction = exports.NotificationDetectionType = exports.DoorbellType = exports.ChimeModel = exports.deviceTypesWithVolume = exports.allAlarmStates = exports.RingCameraModel = exports.RingCameraKind = exports.RingDeviceCategory = exports.RingDeviceType = void 0;
3
+ exports.disabledLocationModes = exports.DispatchSignalType = exports.PushNotificationAction = exports.NotificationDetectionType = exports.DoorbellType = exports.ChimeModel = exports.deviceTypesWithVolume = exports.allAlarmStates = exports.RingCameraModel = exports.RingCameraKind = exports.RingDeviceCategory = exports.RingDeviceType = void 0;
4
+ exports.isWebSocketSupportedAsset = isWebSocketSupportedAsset;
4
5
  // eslint-disable-next-line no-shadow
5
6
  var RingDeviceType;
6
7
  (function (RingDeviceType) {
@@ -185,10 +186,9 @@ var NotificationDetectionType;
185
186
  // eslint-disable-next-line no-shadow
186
187
  var PushNotificationAction;
187
188
  (function (PushNotificationAction) {
188
- PushNotificationAction["Ding"] = "com.ring.push.HANDLE_NEW_DING";
189
- PushNotificationAction["Motion"] = "com.ring.push.HANDLE_NEW_motion";
190
- PushNotificationAction["LowBattery"] = "com.ring.push.LOW_BATTERY_ALERT";
191
- PushNotificationAction["IntercomUnlock"] = "com.ring.push.INTERCOM_UNLOCK_FROM_APP";
189
+ PushNotificationAction["Ding"] = "com.ring.pn.live-event.ding";
190
+ PushNotificationAction["Motion"] = "com.ring.pn.live-event.motion";
191
+ PushNotificationAction["IntercomUnlock"] = "com.ring.pn.intercom.virtual.unlock";
192
192
  })(PushNotificationAction || (exports.PushNotificationAction = PushNotificationAction = {}));
193
193
  // eslint-disable-next-line no-shadow
194
194
  var DispatchSignalType;
@@ -200,4 +200,3 @@ exports.disabledLocationModes = ['disabled', 'unset'];
200
200
  function isWebSocketSupportedAsset({ kind }) {
201
201
  return kind.startsWith('base_station') || kind.startsWith('beams_bridge');
202
202
  }
203
- exports.isWebSocketSupportedAsset = isWebSocketSupportedAsset;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { RtpPacket } from 'werift';
3
2
  import { ReplaySubject, Subject } from 'rxjs';
4
3
  import { WebrtcConnection } from './webrtc-connection';
package/lib/util.js CHANGED
@@ -3,7 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.toBase64 = exports.fromBase64 = exports.randomString = exports.randomInteger = exports.mapAsync = exports.stringify = exports.requestInput = exports.getHardwareId = exports.generateUuid = exports.enableDebug = exports.useLogger = exports.logError = exports.logInfo = exports.logDebug = exports.delay = exports.clearTimeouts = void 0;
6
+ exports.clearTimeouts = clearTimeouts;
7
+ exports.delay = delay;
8
+ exports.logDebug = logDebug;
9
+ exports.logInfo = logInfo;
10
+ exports.logError = logError;
11
+ exports.useLogger = useLogger;
12
+ exports.enableDebug = enableDebug;
13
+ exports.generateUuid = generateUuid;
14
+ exports.getHardwareId = getHardwareId;
15
+ exports.requestInput = requestInput;
16
+ exports.stringify = stringify;
17
+ exports.mapAsync = mapAsync;
18
+ exports.randomInteger = randomInteger;
19
+ exports.randomString = randomString;
20
+ exports.fromBase64 = fromBase64;
21
+ exports.toBase64 = toBase64;
7
22
  const debug_1 = __importDefault(require("debug"));
8
23
  const colors_1 = require("colors");
9
24
  const readline_1 = require("readline");
@@ -25,7 +40,6 @@ function clearTimeouts() {
25
40
  clearTimeout(timeout);
26
41
  });
27
42
  }
28
- exports.clearTimeouts = clearTimeouts;
29
43
  function delay(milliseconds) {
30
44
  return new Promise((resolve) => {
31
45
  const timeout = setTimeout(() => {
@@ -35,36 +49,29 @@ function delay(milliseconds) {
35
49
  timeouts.add(timeout);
36
50
  });
37
51
  }
38
- exports.delay = delay;
39
52
  function logDebug(message) {
40
53
  if (debugEnabled) {
41
54
  logger.logInfo(message);
42
55
  }
43
56
  }
44
- exports.logDebug = logDebug;
45
57
  function logInfo(...message) {
46
58
  logger.logInfo(...message);
47
59
  }
48
- exports.logInfo = logInfo;
49
60
  function logError(message) {
50
61
  logger.logError(message);
51
62
  }
52
- exports.logError = logError;
53
63
  function useLogger(newLogger) {
54
64
  logger = newLogger;
55
65
  }
56
- exports.useLogger = useLogger;
57
66
  function enableDebug() {
58
67
  debugEnabled = true;
59
68
  }
60
- exports.enableDebug = enableDebug;
61
69
  function generateUuid(seed) {
62
70
  if (seed) {
63
71
  return (0, uuid_1.v5)(seed, uuidNamespace);
64
72
  }
65
73
  return (0, uuid_1.v4)();
66
74
  }
67
- exports.generateUuid = generateUuid;
68
75
  async function getHardwareId(systemId) {
69
76
  if (systemId) {
70
77
  return generateUuid(systemId);
@@ -84,7 +91,6 @@ async function getHardwareId(systemId) {
84
91
  }
85
92
  return generateUuid(id);
86
93
  }
87
- exports.getHardwareId = getHardwareId;
88
94
  async function requestInput(question) {
89
95
  const lineReader = (0, readline_1.createInterface)({
90
96
  input: process.stdin,
@@ -95,7 +101,6 @@ async function requestInput(question) {
95
101
  lineReader.close();
96
102
  return answer.trim();
97
103
  }
98
- exports.requestInput = requestInput;
99
104
  function stringify(data) {
100
105
  if (typeof data === 'string') {
101
106
  return data;
@@ -105,20 +110,16 @@ function stringify(data) {
105
110
  }
106
111
  return JSON.stringify(data) + '';
107
112
  }
108
- exports.stringify = stringify;
109
113
  function mapAsync(records, asyncMapper) {
110
114
  return Promise.all(records.map((record) => asyncMapper(record)));
111
115
  }
112
- exports.mapAsync = mapAsync;
113
116
  function randomInteger() {
114
117
  return Math.floor(Math.random() * 99999999) + 100000;
115
118
  }
116
- exports.randomInteger = randomInteger;
117
119
  function randomString(length) {
118
120
  const uuid = generateUuid();
119
121
  return uuid.replace(/-/g, '').substring(0, length).toLowerCase();
120
122
  }
121
- exports.randomString = randomString;
122
123
  // Override push receiver logging to avoid ECONNRESET errors leaking
123
124
  function logPushReceiver(...args) {
124
125
  try {
@@ -138,9 +139,7 @@ function fromBase64(encodedInput) {
138
139
  const buff = Buffer.from(encodedInput, 'base64');
139
140
  return buff.toString('ascii');
140
141
  }
141
- exports.fromBase64 = fromBase64;
142
142
  function toBase64(input) {
143
143
  const buff = Buffer.from(input);
144
144
  return buff.toString('base64');
145
145
  }
146
- exports.toBase64 = toBase64;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "12.1.1",
3
+ "version": "13.0.0-beta.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": {
@@ -17,37 +17,36 @@
17
17
  "test:watch": "jest --watch"
18
18
  },
19
19
  "dependencies": {
20
- "@eneris/push-receiver": "^3.1.5",
21
- "@homebridge/camera-utils": "^2.2.5",
20
+ "@eneris/push-receiver": "^4.1.2",
21
+ "@homebridge/camera-utils": "^2.2.6",
22
22
  "@peculiar/asn1-schema": "^2.3.8",
23
- "@peculiar/webcrypto": "^1.4.3",
24
23
  "@types/socket.io-client": "1.4.36",
25
24
  "colors": "1.4.0",
26
- "debug": "^4.3.4",
25
+ "debug": "^4.3.5",
27
26
  "got": "^11.8.5",
28
27
  "json-bigint": "^1.0.0",
29
- "msw": "^1.3.1",
28
+ "msw": "^1.3.3",
30
29
  "pvtsutils": "^1.3.5",
31
30
  "rxjs": "^7.8.1",
32
31
  "socket.io-client": "^2.5.0",
33
- "systeminformation": "^5.21.20",
34
- "uuid": "^9.0.1",
35
- "webcrypto-core": "^1.7.7",
36
- "werift": "0.18.17",
37
- "ws": "^8.15.1"
32
+ "systeminformation": "^5.22.11",
33
+ "uuid": "^10.0.0",
34
+ "webcrypto-core": "^1.8.0",
35
+ "werift": "0.19.3",
36
+ "ws": "^8.17.1"
38
37
  },
39
38
  "devDependencies": {
40
39
  "@types/debug": "4.1.12",
41
- "@types/jest": "29.5.11",
40
+ "@types/jest": "29.5.12",
42
41
  "@types/json-bigint": "^1.0.4",
43
- "@types/node": "20.10.4",
44
- "@types/uuid": "9.0.7",
42
+ "@types/node": "20.14.7",
43
+ "@types/uuid": "10.0.0",
45
44
  "@types/ws": "^8.5.10",
46
45
  "eslint-config-shared": "*",
47
46
  "jest": "29.7.0",
48
- "ts-jest": "29.1.1",
47
+ "ts-jest": "29.1.5",
49
48
  "tsconfig": "*",
50
- "typescript": "5.2.2"
49
+ "typescript": "5.5.2"
51
50
  },
52
51
  "engines": {
53
52
  "node": "^18 || ^20"