ring-client-api 13.2.1 → 14.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 +10 -8
- package/lib/api.js +57 -64
- package/lib/device-data.js +6 -9
- package/lib/ffmpeg.js +2 -6
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -23
- package/lib/location.d.ts +32 -31
- package/lib/location.js +67 -72
- package/lib/refresh-token.js +6 -11
- package/lib/rest-client.d.ts +4 -4
- package/lib/rest-client.js +40 -51
- package/lib/ring-auth-cli.js +2 -4
- package/lib/ring-camera.d.ts +26 -23
- package/lib/ring-camera.js +64 -61
- package/lib/ring-chime.d.ts +7 -7
- package/lib/ring-chime.js +14 -18
- package/lib/ring-device-data-cli.js +2 -4
- package/lib/ring-device.d.ts +7 -7
- package/lib/ring-device.js +16 -20
- package/lib/ring-intercom.d.ts +8 -8
- package/lib/ring-intercom.js +23 -27
- package/lib/ring-types.d.ts +142 -133
- package/lib/ring-types.js +137 -153
- package/lib/streaming/peer-connection.d.ts +5 -3
- package/lib/streaming/peer-connection.js +25 -30
- package/lib/streaming/simple-webrtc-session.d.ts +3 -3
- package/lib/streaming/simple-webrtc-session.js +3 -7
- package/lib/streaming/streaming-messages.d.ts +6 -5
- package/lib/streaming/streaming-messages.js +6 -9
- package/lib/streaming/streaming-session.d.ts +5 -5
- package/lib/streaming/streaming-session.js +34 -38
- package/lib/streaming/webrtc-connection.d.ts +5 -5
- package/lib/streaming/webrtc-connection.js +39 -43
- package/lib/subscribed.d.ts +1 -1
- package/lib/subscribed.js +1 -5
- package/lib/test/rest-client.spec.js +44 -45
- package/lib/test/ring-camera.spec.js +12 -13
- package/lib/util.js +33 -54
- package/package.json +17 -19
package/lib/api.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { RefreshTokenAuth,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { RefreshTokenAuth, SessionOptions } from './rest-client.ts';
|
|
2
|
+
import { RingRestClient } from './rest-client.ts';
|
|
3
|
+
import { Location } from './location.ts';
|
|
4
|
+
import type { BaseStation, BeamBridge, CameraData, ChimeData, IntercomHandsetAudioData, OnvifCameraData, ProfileResponse, ThirdPartyGarageDoorOpener, UnknownDevice, UserLocation } from './ring-types.ts';
|
|
5
|
+
import type { AnyCameraData } from './ring-camera.ts';
|
|
6
|
+
import { RingCamera } from './ring-camera.ts';
|
|
7
|
+
import { Subscribed } from './subscribed.ts';
|
|
6
8
|
export interface RingApiOptions extends SessionOptions {
|
|
7
9
|
locationIds?: string[];
|
|
8
10
|
cameraStatusPollingSeconds?: number;
|
|
@@ -16,12 +18,12 @@ export interface RingApiOptions extends SessionOptions {
|
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
export declare class RingApi extends Subscribed {
|
|
19
|
-
readonly options: RingApiOptions & RefreshTokenAuth;
|
|
20
21
|
readonly restClient: RingRestClient;
|
|
21
22
|
readonly onRefreshTokenUpdated: import("rxjs").Observable<{
|
|
22
23
|
oldRefreshToken?: string;
|
|
23
24
|
newRefreshToken: string;
|
|
24
25
|
}>;
|
|
26
|
+
readonly options: RingApiOptions & RefreshTokenAuth;
|
|
25
27
|
constructor(options: RingApiOptions & RefreshTokenAuth);
|
|
26
28
|
fetchRingDevices(): Promise<{
|
|
27
29
|
doorbots: CameraData[];
|
|
@@ -39,11 +41,11 @@ export declare class RingApi extends Subscribed {
|
|
|
39
41
|
private listenForDeviceUpdates;
|
|
40
42
|
private registerPushReceiver;
|
|
41
43
|
fetchRawLocations(): Promise<UserLocation[]>;
|
|
42
|
-
fetchAmazonKeyLocks(): Promise<any[] & import("./rest-client").ExtendedResponse>;
|
|
44
|
+
fetchAmazonKeyLocks(): Promise<any[] & import("./rest-client.ts").ExtendedResponse>;
|
|
43
45
|
fetchAndBuildLocations(): Promise<Location[]>;
|
|
44
46
|
private locationsPromise;
|
|
45
47
|
getLocations(): Promise<Location[]>;
|
|
46
48
|
getCameras(): Promise<RingCamera[]>;
|
|
47
|
-
getProfile(): Promise<ProfileResponse & import("./rest-client").ExtendedResponse>;
|
|
49
|
+
getProfile(): Promise<ProfileResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
48
50
|
disconnect(): void;
|
|
49
51
|
}
|
package/lib/api.js
CHANGED
|
@@ -1,54 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const ffmpeg_1 = require("./ffmpeg");
|
|
16
|
-
const subscribed_1 = require("./subscribed");
|
|
17
|
-
const push_receiver_1 = __importDefault(require("@eneris/push-receiver"));
|
|
18
|
-
const ring_intercom_1 = require("./ring-intercom");
|
|
19
|
-
const json_bigint_1 = __importDefault(require("json-bigint"));
|
|
20
|
-
class RingApi extends subscribed_1.Subscribed {
|
|
21
|
-
options;
|
|
1
|
+
import { clientApi, deviceApi, RingRestClient } from "./rest-client.js";
|
|
2
|
+
import { Location } from "./location.js";
|
|
3
|
+
import { PushNotificationAction, RingDeviceType } from "./ring-types.js";
|
|
4
|
+
import { RingCamera } from "./ring-camera.js";
|
|
5
|
+
import { RingChime } from "./ring-chime.js";
|
|
6
|
+
import { combineLatest, EMPTY, merge, Subject } from 'rxjs';
|
|
7
|
+
import { debounceTime, startWith, switchMap, throttleTime, } from 'rxjs/operators';
|
|
8
|
+
import { clearTimeouts, enableDebug, logDebug, logError, logInfo, } from "./util.js";
|
|
9
|
+
import { setFfmpegPath } from "./ffmpeg.js";
|
|
10
|
+
import { Subscribed } from "./subscribed.js";
|
|
11
|
+
import { PushReceiver } from '@eneris/push-receiver';
|
|
12
|
+
import { RingIntercom } from "./ring-intercom.js";
|
|
13
|
+
import JSONbig from 'json-bigint';
|
|
14
|
+
export class RingApi extends Subscribed {
|
|
22
15
|
restClient;
|
|
23
16
|
onRefreshTokenUpdated;
|
|
17
|
+
options;
|
|
24
18
|
constructor(options) {
|
|
25
19
|
super();
|
|
26
20
|
this.options = options;
|
|
27
|
-
this.restClient = new
|
|
21
|
+
this.restClient = new RingRestClient(this.options);
|
|
28
22
|
this.onRefreshTokenUpdated =
|
|
29
23
|
this.restClient.onRefreshTokenUpdated.asObservable();
|
|
30
24
|
if (options.debug) {
|
|
31
|
-
|
|
25
|
+
enableDebug();
|
|
32
26
|
}
|
|
33
27
|
const { locationIds, ffmpegPath } = options;
|
|
34
28
|
if (locationIds && !locationIds.length) {
|
|
35
|
-
|
|
29
|
+
logError('Your Ring config has `"locationIds": []`, which means no locations will be used and no devices will be found.');
|
|
36
30
|
}
|
|
37
31
|
if (ffmpegPath) {
|
|
38
|
-
|
|
32
|
+
setFfmpegPath(ffmpegPath);
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
async fetchRingDevices() {
|
|
42
|
-
const { doorbots, chimes, authorized_doorbots: authorizedDoorbots, stickup_cams: stickupCams, base_stations: baseStations, beams_bridges: beamBridges, other: otherDevices, } = await this.restClient.request({ url:
|
|
36
|
+
const { doorbots, chimes, authorized_doorbots: authorizedDoorbots, stickup_cams: stickupCams, base_stations: baseStations, beams_bridges: beamBridges, other: otherDevices, } = await this.restClient.request({ url: clientApi('ring_devices') }), onvifCameras = [], intercoms = [], thirdPartyGarageDoorOpeners = [], unknownDevices = [];
|
|
43
37
|
otherDevices.forEach((device) => {
|
|
44
38
|
switch (device.kind) {
|
|
45
|
-
case
|
|
39
|
+
case RingDeviceType.OnvifCamera:
|
|
46
40
|
onvifCameras.push(device);
|
|
47
41
|
break;
|
|
48
|
-
case
|
|
42
|
+
case RingDeviceType.IntercomHandsetAudio:
|
|
49
43
|
intercoms.push(device);
|
|
50
44
|
break;
|
|
51
|
-
case
|
|
45
|
+
case RingDeviceType.ThirdPartyGarageDoorOpener:
|
|
52
46
|
thirdPartyGarageDoorOpeners.push(device);
|
|
53
47
|
break;
|
|
54
48
|
default:
|
|
@@ -80,9 +74,9 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
80
74
|
if (!cameraStatusPollingSeconds) {
|
|
81
75
|
return;
|
|
82
76
|
}
|
|
83
|
-
const devices = [...cameras, ...chimes, ...intercoms], onDeviceRequestUpdate =
|
|
84
|
-
? onUpdateReceived.pipe(
|
|
85
|
-
:
|
|
77
|
+
const devices = [...cameras, ...chimes, ...intercoms], onDeviceRequestUpdate = merge(...devices.map((device) => device.onRequestUpdate)), onUpdateReceived = new Subject(), onPollForStatusUpdate = cameraStatusPollingSeconds
|
|
78
|
+
? onUpdateReceived.pipe(debounceTime(cameraStatusPollingSeconds * 1000))
|
|
79
|
+
: EMPTY, camerasById = cameras.reduce((byId, camera) => {
|
|
86
80
|
byId[camera.id] = camera;
|
|
87
81
|
return byId;
|
|
88
82
|
}, {}), chimesById = chimes.reduce((byId, chime) => {
|
|
@@ -95,8 +89,8 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
95
89
|
if (!cameras.length && !chimes.length && !intercoms.length) {
|
|
96
90
|
return;
|
|
97
91
|
}
|
|
98
|
-
this.addSubscriptions(
|
|
99
|
-
.pipe(
|
|
92
|
+
this.addSubscriptions(merge(onDeviceRequestUpdate, onPollForStatusUpdate)
|
|
93
|
+
.pipe(throttleTime(500), switchMap(() => this.fetchRingDevices().catch(() => null)))
|
|
100
94
|
.subscribe((response) => {
|
|
101
95
|
onUpdateReceived.next(null);
|
|
102
96
|
if (!response) {
|
|
@@ -127,7 +121,7 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
127
121
|
}
|
|
128
122
|
async registerPushReceiver(cameras, intercoms) {
|
|
129
123
|
const credentials = this.restClient._internalOnly_pushNotificationCredentials?.config &&
|
|
130
|
-
this.restClient._internalOnly_pushNotificationCredentials, pushReceiver = new
|
|
124
|
+
this.restClient._internalOnly_pushNotificationCredentials, pushReceiver = new PushReceiver({
|
|
131
125
|
firebase: {
|
|
132
126
|
apiKey: 'AIzaSyCv-hdFBmmdBBJadNy-TFwB-xN_H5m3Bk8',
|
|
133
127
|
projectId: 'ring-17770',
|
|
@@ -138,7 +132,7 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
138
132
|
debug: false,
|
|
139
133
|
}), devicesById = {}, sendToDevice = (id, notification) => {
|
|
140
134
|
devicesById[id]?.processPushNotification(notification);
|
|
141
|
-
}, onPushNotificationToken = new
|
|
135
|
+
}, onPushNotificationToken = new Subject();
|
|
142
136
|
for (const camera of cameras) {
|
|
143
137
|
devicesById[camera.id] = camera;
|
|
144
138
|
}
|
|
@@ -151,13 +145,13 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
151
145
|
// Send the new credentials to the server
|
|
152
146
|
onPushNotificationToken.next(newCredentials.fcm.token);
|
|
153
147
|
});
|
|
154
|
-
this.addSubscriptions(
|
|
148
|
+
this.addSubscriptions(combineLatest([
|
|
155
149
|
onPushNotificationToken,
|
|
156
|
-
this.restClient.onSession.pipe(
|
|
150
|
+
this.restClient.onSession.pipe(startWith(undefined)), // combined but not used here, just to trigger another request when session is updated
|
|
157
151
|
]).subscribe(async ([token]) => {
|
|
158
152
|
try {
|
|
159
153
|
await this.restClient.request({
|
|
160
|
-
url:
|
|
154
|
+
url: clientApi('device'),
|
|
161
155
|
method: 'PATCH',
|
|
162
156
|
json: {
|
|
163
157
|
device: {
|
|
@@ -173,29 +167,29 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
173
167
|
});
|
|
174
168
|
}
|
|
175
169
|
catch (e) {
|
|
176
|
-
|
|
170
|
+
logError(e);
|
|
177
171
|
}
|
|
178
172
|
}));
|
|
179
173
|
pushReceiver.on('ON_DISCONNECT', () => {
|
|
180
174
|
pushReceiver.whenReady.catch((e) => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
logError('Connection to the push notification server has failed unexpectedly');
|
|
176
|
+
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');
|
|
177
|
+
logError(e.message);
|
|
184
178
|
});
|
|
185
179
|
});
|
|
186
180
|
try {
|
|
187
181
|
await pushReceiver.connect();
|
|
188
182
|
}
|
|
189
183
|
catch (e) {
|
|
190
|
-
|
|
191
|
-
|
|
184
|
+
logError('Failed to connect push notification receiver');
|
|
185
|
+
logError(e);
|
|
192
186
|
}
|
|
193
187
|
const startTime = Date.now();
|
|
194
188
|
pushReceiver.onNotification(({ message }) => {
|
|
195
189
|
// Ignore messages received in the first two seconds after connecting
|
|
196
190
|
// These are likely duplicates, and we aren't currently storying persistent ids anywhere to avoid re-processing them
|
|
197
191
|
if (Date.now() - startTime < 2000) {
|
|
198
|
-
|
|
192
|
+
logInfo('Ignoring push notification received in first two seconds after starting up');
|
|
199
193
|
return;
|
|
200
194
|
}
|
|
201
195
|
try {
|
|
@@ -204,7 +198,7 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
204
198
|
for (const p in message.data) {
|
|
205
199
|
try {
|
|
206
200
|
// If it's a JSON string, parse it into an object
|
|
207
|
-
messageData[p] = (
|
|
201
|
+
messageData[p] = JSONbig({ storeAsString: true }).parse(message.data[p]);
|
|
208
202
|
}
|
|
209
203
|
catch {
|
|
210
204
|
// Otherwise just assign the value directly
|
|
@@ -218,12 +212,12 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
218
212
|
sendToDevice(deviceId, notification);
|
|
219
213
|
}
|
|
220
214
|
const eventCategory = notification.android_config.category;
|
|
221
|
-
if (eventCategory !==
|
|
222
|
-
eventCategory !==
|
|
223
|
-
eventCategory !==
|
|
224
|
-
|
|
215
|
+
if (eventCategory !== PushNotificationAction.Ding &&
|
|
216
|
+
eventCategory !== PushNotificationAction.Motion &&
|
|
217
|
+
eventCategory !== PushNotificationAction.IntercomDing) {
|
|
218
|
+
logDebug('Received v2 push notification with unknown category: ' +
|
|
225
219
|
eventCategory);
|
|
226
|
-
|
|
220
|
+
logDebug(JSON.stringify(message));
|
|
227
221
|
}
|
|
228
222
|
}
|
|
229
223
|
else if ('data' in notification &&
|
|
@@ -236,13 +230,13 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
236
230
|
}
|
|
237
231
|
else {
|
|
238
232
|
// This is not a v1 or v2 style notification, so we can't process it
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
logDebug('Received push notification in unknown format');
|
|
234
|
+
logDebug(JSON.stringify(message));
|
|
241
235
|
return;
|
|
242
236
|
}
|
|
243
237
|
}
|
|
244
238
|
catch (e) {
|
|
245
|
-
|
|
239
|
+
logError(e);
|
|
246
240
|
}
|
|
247
241
|
});
|
|
248
242
|
// If we already have credentials and they haven't been changed during registration, use them immediately
|
|
@@ -253,7 +247,7 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
253
247
|
}
|
|
254
248
|
}
|
|
255
249
|
async fetchRawLocations() {
|
|
256
|
-
const { user_locations: rawLocations } = await this.restClient.request({ url:
|
|
250
|
+
const { user_locations: rawLocations } = await this.restClient.request({ url: deviceApi('locations') });
|
|
257
251
|
if (!rawLocations) {
|
|
258
252
|
throw new Error('The Ring account which you used to generate a refresh token does not have any associated locations. Please use an account that has access to at least one location.');
|
|
259
253
|
}
|
|
@@ -265,21 +259,21 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
265
259
|
});
|
|
266
260
|
}
|
|
267
261
|
async fetchAndBuildLocations() {
|
|
268
|
-
const rawLocations = await this.fetchRawLocations(), { authorizedDoorbots, chimes, doorbots, allCameras, baseStations, beamBridges, intercoms, } = await this.fetchRingDevices(), locationIdsWithHubs = [...baseStations, ...beamBridges].map((x) => x.location_id), cameras = allCameras.map((data) => new
|
|
262
|
+
const rawLocations = await this.fetchRawLocations(), { authorizedDoorbots, chimes, doorbots, allCameras, baseStations, beamBridges, intercoms, } = await this.fetchRingDevices(), locationIdsWithHubs = [...baseStations, ...beamBridges].map((x) => x.location_id), cameras = allCameras.map((data) => new RingCamera(data, doorbots.includes(data) ||
|
|
269
263
|
authorizedDoorbots.includes(data) ||
|
|
270
|
-
data.kind.startsWith('doorbell'), this.restClient, this.options.avoidSnapshotBatteryDrain || false)), ringChimes = chimes.map((data) => new
|
|
264
|
+
data.kind.startsWith('doorbell'), this.restClient, this.options.avoidSnapshotBatteryDrain || false)), ringChimes = chimes.map((data) => new RingChime(data, this.restClient)), ringIntercoms = intercoms.map((data) => new RingIntercom(data, this.restClient)), locations = rawLocations
|
|
271
265
|
.filter((location) => {
|
|
272
266
|
return (!Array.isArray(this.options.locationIds) ||
|
|
273
267
|
this.options.locationIds.includes(location.location_id));
|
|
274
268
|
})
|
|
275
|
-
.map((location) => new
|
|
269
|
+
.map((location) => new Location(location, cameras.filter((x) => x.data.location_id === location.location_id), ringChimes.filter((x) => x.data.location_id === location.location_id), ringIntercoms.filter((x) => x.data.location_id === location.location_id), {
|
|
276
270
|
hasHubs: locationIdsWithHubs.includes(location.location_id),
|
|
277
271
|
hasAlarmBaseStation: baseStations.some((station) => station.location_id === location.location_id),
|
|
278
272
|
locationModePollingSeconds: this.options.locationModePollingSeconds,
|
|
279
273
|
}, this.restClient));
|
|
280
274
|
this.listenForDeviceUpdates(cameras, ringChimes, ringIntercoms);
|
|
281
275
|
this.registerPushReceiver(cameras, ringIntercoms).catch((e) => {
|
|
282
|
-
|
|
276
|
+
logError(e);
|
|
283
277
|
});
|
|
284
278
|
return locations;
|
|
285
279
|
}
|
|
@@ -296,7 +290,7 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
296
290
|
}
|
|
297
291
|
getProfile() {
|
|
298
292
|
return this.restClient.request({
|
|
299
|
-
url:
|
|
293
|
+
url: clientApi('profile'),
|
|
300
294
|
});
|
|
301
295
|
}
|
|
302
296
|
disconnect() {
|
|
@@ -307,10 +301,9 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
307
301
|
this.getLocations()
|
|
308
302
|
.then((locations) => locations.forEach((location) => location.disconnect()))
|
|
309
303
|
.catch((e) => {
|
|
310
|
-
|
|
304
|
+
logError(e);
|
|
311
305
|
});
|
|
312
306
|
this.restClient.clearTimeouts();
|
|
313
|
-
|
|
307
|
+
clearTimeouts();
|
|
314
308
|
}
|
|
315
309
|
}
|
|
316
|
-
exports.RingApi = RingApi;
|
package/lib/device-data.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logDeviceData = logDeviceData;
|
|
4
1
|
/* eslint-disable no-console */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { RingApi } from "./api.js";
|
|
3
|
+
import { acquireRefreshToken } from "./refresh-token.js";
|
|
4
|
+
import { mapAsync } from "./util.js";
|
|
8
5
|
const sensitiveFields = [
|
|
9
6
|
'id',
|
|
10
7
|
'device_id',
|
|
@@ -50,12 +47,12 @@ function stripSensitiveFields(input) {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
async function logDeviceData() {
|
|
50
|
+
export async function logDeviceData() {
|
|
54
51
|
console.log('This CLI will log data from you Ring Account to help debug issues and discovering new device types.');
|
|
55
52
|
console.log('The logged data is anonymized and should not compromise your account in any way.');
|
|
56
|
-
const refreshToken = await
|
|
53
|
+
const refreshToken = await acquireRefreshToken(), ringApi = new RingApi({ refreshToken });
|
|
57
54
|
console.log('Successfully logged in. Fetching devices...');
|
|
58
|
-
const locations = await ringApi.getLocations(), amazonKeyLocks = await ringApi.fetchAmazonKeyLocks(), locationsWithDevices = await
|
|
55
|
+
const locations = await ringApi.getLocations(), amazonKeyLocks = await ringApi.fetchAmazonKeyLocks(), locationsWithDevices = await mapAsync(locations, async (location) => {
|
|
59
56
|
const devices = await location.getDevices();
|
|
60
57
|
return {
|
|
61
58
|
name: location.name,
|
package/lib/ffmpeg.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setFfmpegPath = setFfmpegPath;
|
|
4
|
-
exports.getFfmpegPath = getFfmpegPath;
|
|
5
1
|
let ffmpegPath;
|
|
6
|
-
function setFfmpegPath(path) {
|
|
2
|
+
export function setFfmpegPath(path) {
|
|
7
3
|
ffmpegPath = path;
|
|
8
4
|
}
|
|
9
|
-
function getFfmpegPath() {
|
|
5
|
+
export function getFfmpegPath() {
|
|
10
6
|
return ffmpegPath;
|
|
11
7
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './location';
|
|
3
|
-
export * from './ring-camera';
|
|
4
|
-
export * from './ring-chime';
|
|
5
|
-
export * from './ring-device';
|
|
6
|
-
export * from './ring-intercom';
|
|
7
|
-
export * from './ring-types';
|
|
1
|
+
export * from './api.ts';
|
|
2
|
+
export * from './location.ts';
|
|
3
|
+
export * from './ring-camera.ts';
|
|
4
|
+
export * from './ring-chime.ts';
|
|
5
|
+
export * from './ring-device.ts';
|
|
6
|
+
export * from './ring-intercom.ts';
|
|
7
|
+
export * from './ring-types.ts';
|
package/lib/index.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api"), exports);
|
|
18
|
-
__exportStar(require("./location"), exports);
|
|
19
|
-
__exportStar(require("./ring-camera"), exports);
|
|
20
|
-
__exportStar(require("./ring-chime"), exports);
|
|
21
|
-
__exportStar(require("./ring-device"), exports);
|
|
22
|
-
__exportStar(require("./ring-intercom"), exports);
|
|
23
|
-
__exportStar(require("./ring-types"), exports);
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./location.js";
|
|
3
|
+
export * from "./ring-camera.js";
|
|
4
|
+
export * from "./ring-chime.js";
|
|
5
|
+
export * from "./ring-device.js";
|
|
6
|
+
export * from "./ring-intercom.js";
|
|
7
|
+
export * from "./ring-types.js";
|
package/lib/location.d.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import { Socket as SocketIOSocket } from 'socket.io-client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import type { Socket as SocketIOSocket } from 'socket.io-client';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import { BehaviorSubject, ReplaySubject, Subject } from 'rxjs';
|
|
4
|
+
import type { AccountMonitoringStatus, AlarmMode, AssetSession, MessageDataType, MessageType, RingDeviceData, SocketIoMessage, TicketAsset, UserLocation, CameraEventResponse, CameraEventOptions, HistoryOptions, RingDeviceHistoryEvent, LocationModeResponse, LocationModeSettings, LocationMode, LocationModeSharing, LocationModeSettingsResponse, LocationModeInput } from './ring-types.ts';
|
|
5
|
+
import type { RingRestClient } from './rest-client.ts';
|
|
6
|
+
import type { RingCamera } from './ring-camera.ts';
|
|
7
|
+
import type { RingChime } from './ring-chime.ts';
|
|
8
|
+
import { RingDevice } from './ring-device.ts';
|
|
9
|
+
import type { RingIntercom } from './ring-intercom.ts';
|
|
10
|
+
import { Subscribed } from './subscribed.ts';
|
|
10
11
|
export declare class Location extends Subscribed {
|
|
11
|
-
readonly locationDetails: UserLocation;
|
|
12
|
-
readonly cameras: RingCamera[];
|
|
13
|
-
readonly chimes: RingChime[];
|
|
14
|
-
readonly intercoms: RingIntercom[];
|
|
15
|
-
readonly options: {
|
|
16
|
-
hasHubs: boolean;
|
|
17
|
-
hasAlarmBaseStation: boolean;
|
|
18
|
-
locationModePollingSeconds?: number;
|
|
19
|
-
};
|
|
20
|
-
private restClient;
|
|
21
12
|
private seq;
|
|
22
13
|
onMessage: Subject<SocketIoMessage>;
|
|
23
14
|
onDataUpdate: Subject<SocketIoMessage>;
|
|
@@ -37,6 +28,16 @@ export declare class Location extends Subscribed {
|
|
|
37
28
|
offlineAssets: string[];
|
|
38
29
|
hasHubs: boolean;
|
|
39
30
|
hasAlarmBaseStation: boolean;
|
|
31
|
+
readonly locationDetails: UserLocation;
|
|
32
|
+
readonly cameras: RingCamera[];
|
|
33
|
+
readonly chimes: RingChime[];
|
|
34
|
+
readonly intercoms: RingIntercom[];
|
|
35
|
+
readonly options: {
|
|
36
|
+
hasHubs: boolean;
|
|
37
|
+
hasAlarmBaseStation: boolean;
|
|
38
|
+
locationModePollingSeconds?: number;
|
|
39
|
+
};
|
|
40
|
+
private restClient;
|
|
40
41
|
constructor(locationDetails: UserLocation, cameras: RingCamera[], chimes: RingChime[], intercoms: RingIntercom[], options: {
|
|
41
42
|
hasHubs: boolean;
|
|
42
43
|
hasAlarmBaseStation: boolean;
|
|
@@ -69,20 +70,20 @@ export declare class Location extends Subscribed {
|
|
|
69
70
|
disarm(): Promise<void>;
|
|
70
71
|
armHome(bypassSensorZids?: string[]): Promise<void>;
|
|
71
72
|
armAway(bypassSensorZids?: string[]): Promise<void>;
|
|
72
|
-
getHistory(options?: HistoryOptions): Promise<RingDeviceHistoryEvent[] & import("./rest-client").ExtendedResponse>;
|
|
73
|
-
getCameraEvents(options?: CameraEventOptions): Promise<CameraEventResponse & import("./rest-client").ExtendedResponse>;
|
|
74
|
-
getAccountMonitoringStatus(): Promise<AccountMonitoringStatus & import("./rest-client").ExtendedResponse>;
|
|
73
|
+
getHistory(options?: HistoryOptions): Promise<RingDeviceHistoryEvent[] & import("./rest-client.ts").ExtendedResponse>;
|
|
74
|
+
getCameraEvents(options?: CameraEventOptions): Promise<CameraEventResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
75
|
+
getAccountMonitoringStatus(): Promise<AccountMonitoringStatus & import("./rest-client.ts").ExtendedResponse>;
|
|
75
76
|
private triggerAlarm;
|
|
76
|
-
triggerBurglarAlarm(): Promise<AccountMonitoringStatus & import("./rest-client").ExtendedResponse>;
|
|
77
|
-
triggerFireAlarm(): Promise<AccountMonitoringStatus & import("./rest-client").ExtendedResponse>;
|
|
78
|
-
getLocationMode(): Promise<LocationModeResponse & import("./rest-client").ExtendedResponse>;
|
|
79
|
-
setLocationMode(mode: LocationModeInput): Promise<LocationModeResponse & import("./rest-client").ExtendedResponse>;
|
|
77
|
+
triggerBurglarAlarm(): Promise<AccountMonitoringStatus & import("./rest-client.ts").ExtendedResponse>;
|
|
78
|
+
triggerFireAlarm(): Promise<AccountMonitoringStatus & import("./rest-client.ts").ExtendedResponse>;
|
|
79
|
+
getLocationMode(): Promise<LocationModeResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
80
|
+
setLocationMode(mode: LocationModeInput): Promise<LocationModeResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
80
81
|
disableLocationModes(): Promise<void>;
|
|
81
|
-
enableLocationModes(): Promise<LocationModeSettingsResponse & import("./rest-client").ExtendedResponse>;
|
|
82
|
-
getLocationModeSettings(): Promise<LocationModeSettingsResponse & import("./rest-client").ExtendedResponse>;
|
|
83
|
-
setLocationModeSettings(settings: LocationModeSettings): Promise<LocationModeSettingsResponse & import("./rest-client").ExtendedResponse>;
|
|
84
|
-
getLocationModeSharing(): Promise<LocationModeSharing & import("./rest-client").ExtendedResponse>;
|
|
85
|
-
setLocationModeSharing(sharedUsersEnabled: boolean): Promise<LocationModeSharing & import("./rest-client").ExtendedResponse>;
|
|
82
|
+
enableLocationModes(): Promise<LocationModeSettingsResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
83
|
+
getLocationModeSettings(): Promise<LocationModeSettingsResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
84
|
+
setLocationModeSettings(settings: LocationModeSettings): Promise<LocationModeSettingsResponse & import("./rest-client.ts").ExtendedResponse>;
|
|
85
|
+
getLocationModeSharing(): Promise<LocationModeSharing & import("./rest-client.ts").ExtendedResponse>;
|
|
86
|
+
setLocationModeSharing(sharedUsersEnabled: boolean): Promise<LocationModeSharing & import("./rest-client.ts").ExtendedResponse>;
|
|
86
87
|
supportsLocationModeSwitching(): Promise<boolean>;
|
|
87
88
|
disconnect(): void;
|
|
88
89
|
}
|