ring-client-api 12.1.1 → 13.0.0-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.
- package/lib/api.d.ts +1 -1
- package/lib/api.js +30 -10
- package/lib/device-data.js +1 -2
- package/lib/ffmpeg.js +2 -3
- package/lib/refresh-token.js +2 -3
- package/lib/rest-client.d.ts +1 -1
- package/lib/rest-client.js +5 -5
- package/lib/ring-camera.d.ts +6 -7
- package/lib/ring-camera.js +14 -11
- package/lib/ring-intercom.js +3 -2
- package/lib/ring-types.d.ts +50 -27
- package/lib/ring-types.js +5 -5
- package/lib/streaming/streaming-session.d.ts +0 -1
- package/lib/util.js +16 -17
- package/package.json +15 -16
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
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
sendToDevice(
|
|
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) {
|
package/lib/device-data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logDeviceData =
|
|
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.
|
|
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;
|
package/lib/refresh-token.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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', () => { });
|
package/lib/rest-client.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare class RingRestClient {
|
|
|
35
35
|
using2fa: boolean;
|
|
36
36
|
promptFor2fa?: string;
|
|
37
37
|
onRefreshTokenUpdated: ReplaySubject<{
|
|
38
|
-
oldRefreshToken?: string
|
|
38
|
+
oldRefreshToken?: string;
|
|
39
39
|
newRefreshToken: string;
|
|
40
40
|
}>;
|
|
41
41
|
onSession: ReplaySubject<SessionResponse>;
|
package/lib/rest-client.js
CHANGED
|
@@ -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 =
|
|
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 = {
|
package/lib/ring-camera.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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<
|
|
31
|
-
onActiveNotifications: BehaviorSubject<
|
|
32
|
-
onDoorbellPressed: import("rxjs").Observable<
|
|
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():
|
|
43
|
-
get latestNotification():
|
|
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;
|
package/lib/ring-camera.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RingCamera =
|
|
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.
|
|
78
|
-
this.onMotionDetected = this.onActiveNotifications.pipe((0, operators_1.map)((notifications) => notifications.some((notification) => notification.
|
|
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?.
|
|
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(({
|
|
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
|
|
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);
|
package/lib/ring-intercom.js
CHANGED
|
@@ -76,10 +76,11 @@ class RingIntercom {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
processPushNotification(notification) {
|
|
79
|
-
if (notification.
|
|
79
|
+
if (notification.android_config.category === ring_types_1.PushNotificationAction.Ding) {
|
|
80
80
|
this.onDing.next();
|
|
81
81
|
}
|
|
82
|
-
else if (notification.
|
|
82
|
+
else if (notification.android_config.category ===
|
|
83
|
+
ring_types_1.PushNotificationAction.IntercomUnlock) {
|
|
83
84
|
this.onUnlocked.next();
|
|
84
85
|
}
|
|
85
86
|
}
|
package/lib/ring-types.d.ts
CHANGED
|
@@ -865,37 +865,60 @@ export declare enum NotificationDetectionType {
|
|
|
865
865
|
StreamBroken = "stream_broken"
|
|
866
866
|
}
|
|
867
867
|
export declare enum PushNotificationAction {
|
|
868
|
-
Ding = "com.ring.
|
|
869
|
-
Motion = "com.ring.
|
|
870
|
-
|
|
871
|
-
|
|
868
|
+
Ding = "com.ring.pn.live-event.ding",
|
|
869
|
+
Motion = "com.ring.pn.live-event.motion",
|
|
870
|
+
IntercomUnlock = "com.ring.pn.live-event.intercom",
|
|
871
|
+
LowBattery = "com.ring.push.LOW_BATTERY_ALERT"
|
|
872
872
|
}
|
|
873
|
-
export interface
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
873
|
+
export interface PushNotificationDingV2 {
|
|
874
|
+
version: '2.0.0' | string;
|
|
875
|
+
android_config: {
|
|
876
|
+
category: PushNotificationAction | string;
|
|
877
|
+
body: string;
|
|
878
|
+
};
|
|
879
|
+
analytics: {
|
|
880
|
+
server_correlation_id: string;
|
|
881
|
+
server_id: 'com.ring.pns' | string;
|
|
882
|
+
subcategory: string;
|
|
883
|
+
triggered_at: number;
|
|
884
|
+
sent_at: number;
|
|
885
|
+
referring_item_type: string;
|
|
886
|
+
referring_item_id: string;
|
|
887
|
+
};
|
|
888
|
+
data: {
|
|
889
|
+
device: {
|
|
890
|
+
e2ee_enabled: boolean;
|
|
891
|
+
id: number;
|
|
892
|
+
kind: RingCameraKind;
|
|
893
|
+
name: string;
|
|
894
|
+
};
|
|
895
|
+
event: {
|
|
896
|
+
ding: {
|
|
897
|
+
id: string;
|
|
898
|
+
created_at: string;
|
|
899
|
+
subtype: 'other_motion' | 'motion' | 'ding' | 'human' | string;
|
|
900
|
+
detection_type: NotificationDetectionType;
|
|
901
|
+
};
|
|
902
|
+
eventito: {
|
|
903
|
+
type: NotificationDetectionType;
|
|
904
|
+
timestamp: number;
|
|
905
|
+
};
|
|
906
|
+
riid: string;
|
|
890
907
|
is_sidewalk: boolean;
|
|
908
|
+
live_session: {
|
|
909
|
+
streaming_data_hash: string;
|
|
910
|
+
active_streaming_profile: 'rms' | string;
|
|
911
|
+
default_audio_route: string;
|
|
912
|
+
max_duration: number;
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
location: {
|
|
916
|
+
id: string;
|
|
891
917
|
};
|
|
892
918
|
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
sound: string;
|
|
919
|
+
img?: {
|
|
920
|
+
snapshot_uuid: string;
|
|
896
921
|
};
|
|
897
|
-
subtype: 'motion' | 'ding' | 'human' | string;
|
|
898
|
-
action: PushNotificationAction | string;
|
|
899
922
|
}
|
|
900
923
|
export interface PushNotificationAlarm {
|
|
901
924
|
aps: {
|
|
@@ -920,7 +943,7 @@ export interface PushNotificationLowBattery {
|
|
|
920
943
|
};
|
|
921
944
|
action: PushNotificationAction.LowBattery;
|
|
922
945
|
}
|
|
923
|
-
export type PushNotification =
|
|
946
|
+
export type PushNotification = PushNotificationDingV2;
|
|
924
947
|
export interface SocketTicketResponse {
|
|
925
948
|
ticket: string;
|
|
926
949
|
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.
|
|
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,10 @@ var NotificationDetectionType;
|
|
|
185
186
|
// eslint-disable-next-line no-shadow
|
|
186
187
|
var PushNotificationAction;
|
|
187
188
|
(function (PushNotificationAction) {
|
|
188
|
-
PushNotificationAction["Ding"] = "com.ring.
|
|
189
|
-
PushNotificationAction["Motion"] = "com.ring.
|
|
189
|
+
PushNotificationAction["Ding"] = "com.ring.pn.live-event.ding";
|
|
190
|
+
PushNotificationAction["Motion"] = "com.ring.pn.live-event.motion";
|
|
191
|
+
PushNotificationAction["IntercomUnlock"] = "com.ring.pn.live-event.intercom";
|
|
190
192
|
PushNotificationAction["LowBattery"] = "com.ring.push.LOW_BATTERY_ALERT";
|
|
191
|
-
PushNotificationAction["IntercomUnlock"] = "com.ring.push.INTERCOM_UNLOCK_FROM_APP";
|
|
192
193
|
})(PushNotificationAction || (exports.PushNotificationAction = PushNotificationAction = {}));
|
|
193
194
|
// eslint-disable-next-line no-shadow
|
|
194
195
|
var DispatchSignalType;
|
|
@@ -200,4 +201,3 @@ exports.disabledLocationModes = ['disabled', 'unset'];
|
|
|
200
201
|
function isWebSocketSupportedAsset({ kind }) {
|
|
201
202
|
return kind.startsWith('base_station') || kind.startsWith('beams_bridge');
|
|
202
203
|
}
|
|
203
|
-
exports.isWebSocketSupportedAsset = isWebSocketSupportedAsset;
|
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.
|
|
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": "
|
|
3
|
+
"version": "13.0.0-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": {
|
|
@@ -17,37 +17,36 @@
|
|
|
17
17
|
"test:watch": "jest --watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@eneris/push-receiver": "^
|
|
21
|
-
"@homebridge/camera-utils": "^2.2.
|
|
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.
|
|
25
|
+
"debug": "^4.3.5",
|
|
27
26
|
"got": "^11.8.5",
|
|
28
27
|
"json-bigint": "^1.0.0",
|
|
29
|
-
"msw": "^1.3.
|
|
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.
|
|
34
|
-
"uuid": "^
|
|
35
|
-
"webcrypto-core": "^1.
|
|
36
|
-
"werift": "0.
|
|
37
|
-
"ws": "^8.
|
|
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.
|
|
40
|
+
"@types/jest": "29.5.12",
|
|
42
41
|
"@types/json-bigint": "^1.0.4",
|
|
43
|
-
"@types/node": "20.
|
|
44
|
-
"@types/uuid": "
|
|
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.
|
|
47
|
+
"ts-jest": "29.1.5",
|
|
49
48
|
"tsconfig": "*",
|
|
50
|
-
"typescript": "5.
|
|
49
|
+
"typescript": "5.5.2"
|
|
51
50
|
},
|
|
52
51
|
"engines": {
|
|
53
52
|
"node": "^18 || ^20"
|