ring-client-api 13.2.1-beta.1 → 14.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.
Files changed (40) hide show
  1. package/lib/api.d.ts +9 -7
  2. package/lib/api.js +56 -63
  3. package/lib/device-data.js +6 -9
  4. package/lib/ffmpeg.js +2 -6
  5. package/lib/index.d.ts +7 -7
  6. package/lib/index.js +7 -23
  7. package/lib/location.d.ts +22 -21
  8. package/lib/location.js +61 -65
  9. package/lib/refresh-token.js +6 -10
  10. package/lib/rest-client.d.ts +3 -3
  11. package/lib/rest-client.js +39 -50
  12. package/lib/ring-auth-cli.js +2 -4
  13. package/lib/ring-camera.d.ts +21 -18
  14. package/lib/ring-camera.js +57 -56
  15. package/lib/ring-chime.d.ts +5 -5
  16. package/lib/ring-chime.js +10 -14
  17. package/lib/ring-device-data-cli.js +2 -4
  18. package/lib/ring-device.d.ts +4 -4
  19. package/lib/ring-device.js +12 -16
  20. package/lib/ring-intercom.d.ts +6 -6
  21. package/lib/ring-intercom.js +19 -23
  22. package/lib/ring-types.d.ts +2 -0
  23. package/lib/ring-types.js +24 -24
  24. package/lib/streaming/peer-connection.d.ts +5 -3
  25. package/lib/streaming/peer-connection.js +25 -30
  26. package/lib/streaming/simple-webrtc-session.d.ts +2 -2
  27. package/lib/streaming/simple-webrtc-session.js +3 -7
  28. package/lib/streaming/streaming-messages.js +1 -2
  29. package/lib/streaming/streaming-session.d.ts +3 -3
  30. package/lib/streaming/streaming-session.js +34 -38
  31. package/lib/streaming/webrtc-connection.d.ts +4 -4
  32. package/lib/streaming/webrtc-connection.js +38 -42
  33. package/lib/subscribed.d.ts +1 -1
  34. package/lib/subscribed.js +1 -5
  35. package/lib/util.js +33 -54
  36. package/package.json +14 -16
  37. package/lib/test/rest-client.spec.d.ts +0 -1
  38. package/lib/test/rest-client.spec.js +0 -242
  39. package/lib/test/ring-camera.spec.d.ts +0 -1
  40. package/lib/test/ring-camera.spec.js +0 -37
package/lib/api.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { RefreshTokenAuth, RingRestClient, SessionOptions } from './rest-client';
2
- import { Location } from './location';
3
- import { BaseStation, BeamBridge, CameraData, ChimeData, IntercomHandsetAudioData, OnvifCameraData, ProfileResponse, ThirdPartyGarageDoorOpener, UnknownDevice, UserLocation } from './ring-types';
4
- import { AnyCameraData, RingCamera } from './ring-camera';
5
- import { Subscribed } from './subscribed';
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;
@@ -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
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RingApi = void 0;
7
- const rest_client_1 = require("./rest-client");
8
- const location_1 = require("./location");
9
- const ring_types_1 = require("./ring-types");
10
- const ring_camera_1 = require("./ring-camera");
11
- const ring_chime_1 = require("./ring-chime");
12
- const rxjs_1 = require("rxjs");
13
- const operators_1 = require("rxjs/operators");
14
- const util_1 = require("./util");
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 {
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 {
21
15
  options;
22
16
  restClient;
23
17
  onRefreshTokenUpdated;
24
18
  constructor(options) {
25
19
  super();
26
20
  this.options = options;
27
- this.restClient = new rest_client_1.RingRestClient(this.options);
21
+ this.restClient = new RingRestClient(this.options);
28
22
  this.onRefreshTokenUpdated =
29
23
  this.restClient.onRefreshTokenUpdated.asObservable();
30
24
  if (options.debug) {
31
- (0, util_1.enableDebug)();
25
+ enableDebug();
32
26
  }
33
27
  const { locationIds, ffmpegPath } = options;
34
28
  if (locationIds && !locationIds.length) {
35
- (0, util_1.logError)('Your Ring config has `"locationIds": []`, which means no locations will be used and no devices will be found.');
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
- (0, ffmpeg_1.setFfmpegPath)(ffmpegPath);
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: (0, rest_client_1.clientApi)('ring_devices') }), onvifCameras = [], intercoms = [], thirdPartyGarageDoorOpeners = [], unknownDevices = [];
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 ring_types_1.RingDeviceType.OnvifCamera:
39
+ case RingDeviceType.OnvifCamera:
46
40
  onvifCameras.push(device);
47
41
  break;
48
- case ring_types_1.RingDeviceType.IntercomHandsetAudio:
42
+ case RingDeviceType.IntercomHandsetAudio:
49
43
  intercoms.push(device);
50
44
  break;
51
- case ring_types_1.RingDeviceType.ThirdPartyGarageDoorOpener:
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 = (0, rxjs_1.merge)(...devices.map((device) => device.onRequestUpdate)), onUpdateReceived = new rxjs_1.Subject(), onPollForStatusUpdate = cameraStatusPollingSeconds
84
- ? onUpdateReceived.pipe((0, operators_1.debounceTime)(cameraStatusPollingSeconds * 1000))
85
- : rxjs_1.EMPTY, camerasById = cameras.reduce((byId, camera) => {
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((0, rxjs_1.merge)(onDeviceRequestUpdate, onPollForStatusUpdate)
99
- .pipe((0, operators_1.throttleTime)(500), (0, operators_1.switchMap)(() => this.fetchRingDevices().catch(() => null)))
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 push_receiver_1.default({
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 rxjs_1.Subject();
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((0, rxjs_1.combineLatest)([
148
+ this.addSubscriptions(combineLatest([
155
149
  onPushNotificationToken,
156
- this.restClient.onSession.pipe((0, operators_1.startWith)(undefined)), // combined but not used here, just to trigger another request when session is updated
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: (0, rest_client_1.clientApi)('device'),
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
- (0, util_1.logError)(e);
170
+ logError(e);
177
171
  }
178
172
  }));
179
173
  pushReceiver.on('ON_DISCONNECT', () => {
180
174
  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 allowed and that DNS Adblock rules allow gtalk.google.com');
183
- (0, util_1.logError)(e.message);
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
- (0, util_1.logError)('Failed to connect push notification receiver');
191
- (0, util_1.logError)(e);
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
- (0, util_1.logInfo)('Ignoring push notification received in first two seconds after starting up');
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] = (0, json_bigint_1.default)({ storeAsString: true }).parse(message.data[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 !== ring_types_1.PushNotificationAction.Ding &&
222
- eventCategory !== ring_types_1.PushNotificationAction.Motion &&
223
- eventCategory !== ring_types_1.PushNotificationAction.IntercomDing) {
224
- (0, util_1.logDebug)('Received v2 push notification with unknown category: ' +
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
- (0, util_1.logDebug)(JSON.stringify(message));
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
- (0, util_1.logDebug)('Received push notification in unknown format');
240
- (0, util_1.logDebug)(JSON.stringify(message));
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
- (0, util_1.logError)(e);
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: (0, rest_client_1.deviceApi)('locations') });
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 ring_camera_1.RingCamera(data, doorbots.includes(data) ||
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 ring_chime_1.RingChime(data, this.restClient)), ringIntercoms = intercoms.map((data) => new ring_intercom_1.RingIntercom(data, this.restClient)), locations = rawLocations
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 location_1.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), {
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
- (0, util_1.logError)(e);
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: (0, rest_client_1.clientApi)('profile'),
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
- (0, util_1.logError)(e);
304
+ logError(e);
311
305
  });
312
306
  this.restClient.clearTimeouts();
313
- (0, util_1.clearTimeouts)();
307
+ clearTimeouts();
314
308
  }
315
309
  }
316
- exports.RingApi = RingApi;
@@ -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
- const api_1 = require("./api");
6
- const refresh_token_1 = require("./refresh-token");
7
- const util_1 = require("./util");
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 (0, refresh_token_1.acquireRefreshToken)(), ringApi = new api_1.RingApi({ refreshToken });
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 (0, util_1.mapAsync)(locations, async (location) => {
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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,12 +1,13 @@
1
- import { Socket as SocketIOSocket } from 'socket.io-client';
2
- import { BehaviorSubject, Observable, ReplaySubject, Subject } from 'rxjs';
3
- import { AccountMonitoringStatus, AlarmMode, AssetSession, MessageDataType, MessageType, RingDeviceData, SocketIoMessage, TicketAsset, UserLocation, CameraEventResponse, CameraEventOptions, HistoryOptions, RingDeviceHistoryEvent, LocationModeResponse, LocationModeSettings, LocationMode, LocationModeSharing, LocationModeSettingsResponse, LocationModeInput } from './ring-types';
4
- import { RingRestClient } from './rest-client';
5
- import { RingCamera } from './ring-camera';
6
- import { RingChime } from './ring-chime';
7
- import { RingDevice } from './ring-device';
8
- import { RingIntercom } from './ring-intercom';
9
- import { Subscribed } from './subscribed';
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
12
  readonly locationDetails: UserLocation;
12
13
  readonly cameras: RingCamera[];
@@ -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
  }