ring-client-api 10.0.0 → 11.0.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.
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.RingEdgeConnection = void 0;
13
4
  const ws_1 = require("ws");
@@ -56,8 +47,8 @@ class RingEdgeConnection extends streaming_connection_base_1.StreamingConnection
56
47
  return;
57
48
  }
58
49
  this.sendSessionMessage('ping');
59
- }), this.pc.onIceCandidate.subscribe((iceCandidate) => __awaiter(this, void 0, void 0, function* () {
60
- yield (0, rxjs_1.firstValueFrom)(this.onOfferSent);
50
+ }), this.pc.onIceCandidate.subscribe(async (iceCandidate) => {
51
+ await (0, rxjs_1.firstValueFrom)(this.onOfferSent);
61
52
  this.sendMessage({
62
53
  method: 'ice',
63
54
  body: {
@@ -76,69 +67,69 @@ class RingEdgeConnection extends streaming_connection_base_1.StreamingConnection
76
67
  mlineindex: 1,
77
68
  },
78
69
  });
79
- })));
70
+ }));
80
71
  }
81
- initiateCall() {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- const { sdp } = yield this.pc.createOffer();
84
- this.sendMessage({
85
- method: 'live_view',
86
- body: {
87
- doorbot_id: this.camera.id,
88
- stream_options: { audio_enabled: true, video_enabled: true },
89
- sdp: sdp.replace('\na=group:BUNDLE 0 1', ''),
90
- },
91
- });
92
- this.onOfferSent.next();
72
+ async initiateCall() {
73
+ const { sdp } = await this.pc.createOffer();
74
+ this.sendMessage({
75
+ method: 'live_view',
76
+ body: {
77
+ doorbot_id: this.camera.id,
78
+ stream_options: { audio_enabled: true, video_enabled: true },
79
+ sdp: sdp.replace('\na=group:BUNDLE 0 1', ''),
80
+ },
93
81
  });
82
+ this.onOfferSent.next();
94
83
  }
95
- handleMessage(message) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- if (message.body.doorbot_id !== this.camera.id) {
98
- // ignore messages for other cameras
84
+ async handleMessage(message) {
85
+ if (message.body.doorbot_id !== this.camera.id) {
86
+ // ignore messages for other cameras
87
+ return;
88
+ }
89
+ if (['session_created', 'session_started'].includes(message.method) &&
90
+ 'session_id' in message.body &&
91
+ !this.sessionId) {
92
+ this.sessionId = message.body.session_id;
93
+ this.onSessionId.next(this.sessionId);
94
+ }
95
+ if (message.body.session_id && message.body.session_id !== this.sessionId) {
96
+ // ignore messages for other sessions
97
+ return;
98
+ }
99
+ switch (message.method) {
100
+ case 'session_created':
101
+ case 'session_started':
102
+ // session already stored above
99
103
  return;
100
- }
101
- if (['session_created', 'session_started'].includes(message.method) &&
102
- 'session_id' in message.body &&
103
- !this.sessionId) {
104
- this.sessionId = message.body.session_id;
105
- this.onSessionId.next(this.sessionId);
106
- }
107
- if (message.body.session_id && message.body.session_id !== this.sessionId) {
108
- // ignore messages for other sessions
104
+ case 'sdp':
105
+ await this.pc.acceptAnswer(message.body);
106
+ this.onCallAnswered.next(message.body.sdp);
109
107
  return;
110
- }
111
- switch (message.method) {
112
- case 'session_created':
113
- case 'session_started':
114
- // session already stored above
115
- return;
116
- case 'sdp':
117
- yield this.pc.acceptAnswer(message.body);
118
- this.onCallAnswered.next(message.body.sdp);
119
- return;
120
- case 'ice':
121
- yield this.pc.addIceCandidate({
122
- candidate: message.body.ice,
123
- sdpMLineIndex: message.body.mlineindex,
124
- });
125
- return;
126
- case 'pong':
127
- return;
128
- case 'close':
129
- (0, util_1.logError)('Video stream closed');
130
- (0, util_1.logError)(message.body);
131
- this.callEnded();
132
- return;
133
- }
134
- (0, util_1.logError)('UNKNOWN MESSAGE');
135
- (0, util_1.logError)(message);
136
- });
108
+ case 'ice':
109
+ await this.pc.addIceCandidate({
110
+ candidate: message.body.ice,
111
+ sdpMLineIndex: message.body.mlineindex,
112
+ });
113
+ return;
114
+ case 'pong':
115
+ return;
116
+ case 'close':
117
+ (0, util_1.logError)('Video stream closed');
118
+ (0, util_1.logError)(message.body);
119
+ this.callEnded();
120
+ return;
121
+ }
122
+ (0, util_1.logError)('UNKNOWN MESSAGE');
123
+ (0, util_1.logError)(message);
137
124
  }
138
125
  sendSessionMessage(method, body = {}) {
139
126
  const message = {
140
127
  method,
141
- body: Object.assign(Object.assign({}, body), { doorbot_id: this.camera.id, session_id: this.sessionId }),
128
+ body: {
129
+ ...body,
130
+ doorbot_id: this.camera.id,
131
+ session_id: this.sessionId,
132
+ },
142
133
  };
143
134
  if (this.sessionId) {
144
135
  // Send immediately if we already have a session id
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.SimpleWebRtcSession = void 0;
13
4
  const util_1 = require("../util");
@@ -20,43 +11,37 @@ class SimpleWebRtcSession {
20
11
  this.restClient = restClient;
21
12
  this.sessionId = (0, util_1.generateUuid)();
22
13
  }
23
- start(sdp) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const response = yield this.restClient.request({
26
- method: 'POST',
27
- url: liveViewUrl('start'),
28
- json: {
29
- session_id: this.sessionId,
30
- device_id: this.camera.id,
31
- sdp,
32
- protocol: 'webrtc',
33
- },
34
- });
35
- return response.sdp;
14
+ async start(sdp) {
15
+ const response = await this.restClient.request({
16
+ method: 'POST',
17
+ url: liveViewUrl('start'),
18
+ json: {
19
+ session_id: this.sessionId,
20
+ device_id: this.camera.id,
21
+ sdp,
22
+ protocol: 'webrtc',
23
+ },
36
24
  });
25
+ return response.sdp;
37
26
  }
38
- end() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const resp = yield this.restClient.request({
41
- method: 'POST',
42
- url: liveViewUrl('end'),
43
- json: {
44
- session_id: this.sessionId,
45
- },
46
- });
47
- return resp;
27
+ async end() {
28
+ const resp = await this.restClient.request({
29
+ method: 'POST',
30
+ url: liveViewUrl('end'),
31
+ json: {
32
+ session_id: this.sessionId,
33
+ },
48
34
  });
35
+ return resp;
49
36
  }
50
- activateCameraSpeaker() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- yield this.restClient.request({
53
- method: 'PATCH',
54
- url: liveViewUrl('options'),
55
- json: {
56
- session_id: this.sessionId,
57
- actions: ['turn_off_stealth_mode'],
58
- },
59
- });
37
+ async activateCameraSpeaker() {
38
+ await this.restClient.request({
39
+ method: 'PATCH',
40
+ url: liveViewUrl('options'),
41
+ json: {
42
+ session_id: this.sessionId,
43
+ actions: ['turn_off_stealth_mode'],
44
+ },
60
45
  });
61
46
  }
62
47
  }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.StreamingConnectionBase = void 0;
13
4
  const peer_connection_1 = require("./peer-connection");
@@ -59,23 +50,19 @@ class StreamingConnectionBase extends subscribed_1.Subscribed {
59
50
  }
60
51
  }));
61
52
  }
62
- activate() {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- if (this.activated) {
65
- return;
66
- }
67
- this.activated = true;
68
- yield (0, rxjs_1.firstValueFrom)(this.pc.onConnectionState.pipe((0, operators_1.filter)((state) => state === 'connected')));
69
- (0, util_1.logInfo)('Activating Session');
70
- this.sendSessionMessage('activate_session');
71
- });
53
+ async activate() {
54
+ if (this.activated) {
55
+ return;
56
+ }
57
+ this.activated = true;
58
+ await (0, rxjs_1.firstValueFrom)(this.pc.onConnectionState.pipe((0, operators_1.filter)((state) => state === 'connected')));
59
+ (0, util_1.logInfo)('Activating Session');
60
+ this.sendSessionMessage('activate_session');
72
61
  }
73
- activateCameraSpeaker() {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- yield (0, rxjs_1.firstValueFrom)(this.onCallAnswered);
76
- this.sendSessionMessage('camera_options', {
77
- stealth_mode: false,
78
- });
62
+ async activateCameraSpeaker() {
63
+ await (0, rxjs_1.firstValueFrom)(this.onCallAnswered);
64
+ this.sendSessionMessage('camera_options', {
65
+ stealth_mode: false,
79
66
  });
80
67
  }
81
68
  sendMessage(message) {
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.StreamingSession = void 0;
13
4
  const camera_utils_1 = require("@homebridge/camera-utils");
@@ -41,78 +32,70 @@ class StreamingSession extends subscribed_1.Subscribed {
41
32
  bindToConnection(connection) {
42
33
  this.addSubscriptions(connection.onAudioRtp.subscribe(this.onAudioRtp), connection.onVideoRtp.subscribe(this.onVideoRtp));
43
34
  }
44
- activate() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- if (this.activated) {
47
- return;
48
- }
49
- this.activated = true;
50
- yield this.connection.activate();
51
- });
35
+ async activate() {
36
+ if (this.activated) {
37
+ return;
38
+ }
39
+ this.activated = true;
40
+ await this.connection.activate();
52
41
  }
53
- activateCameraSpeaker() {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- if (this.cameraSpeakerActivated) {
56
- return;
57
- }
58
- this.cameraSpeakerActivated = true;
59
- yield this.connection.activateCameraSpeaker();
60
- });
42
+ async activateCameraSpeaker() {
43
+ if (this.cameraSpeakerActivated) {
44
+ return;
45
+ }
46
+ this.cameraSpeakerActivated = true;
47
+ await this.connection.activateCameraSpeaker();
61
48
  }
62
- reservePort(bufferPorts = 0) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- const ports = yield (0, camera_utils_1.reservePorts)({ count: bufferPorts + 1 });
65
- return ports[0];
66
- });
49
+ async reservePort(bufferPorts = 0) {
50
+ const ports = await (0, camera_utils_1.reservePorts)({ count: bufferPorts + 1 });
51
+ return ports[0];
67
52
  }
68
- startTranscoding(ffmpegOptions) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- const videoPort = yield this.reservePort(1), audioPort = yield this.reservePort(1), transcodeVideoStream = ffmpegOptions.video !== false, ffmpegInputArguments = [
71
- '-hide_banner',
72
- '-protocol_whitelist',
73
- 'pipe,udp,rtp,file,crypto',
74
- '-acodec',
75
- 'libopus',
76
- '-f',
77
- 'sdp',
78
- ...(ffmpegOptions.input || []),
79
- '-i',
80
- 'pipe:',
81
- ], ringSdp = yield (0, rxjs_1.firstValueFrom)(this.connection.onCallAnswered), inputSdp = getCleanSdp(ringSdp, transcodeVideoStream)
82
- .replace(/m=audio \d+/, `m=audio ${audioPort}`)
83
- .replace(/m=video \d+/, `m=video ${videoPort}`), ff = new camera_utils_1.FfmpegProcess({
84
- ffmpegArgs: ffmpegInputArguments.concat(...(ffmpegOptions.audio || ['-acodec', 'aac']), ...(transcodeVideoStream
85
- ? ffmpegOptions.video || ['-vcodec', 'copy']
86
- : []), ...(ffmpegOptions.output || [])),
87
- ffmpegPath: (0, ffmpeg_1.getFfmpegPath)(),
88
- exitCallback: () => this.callEnded(),
89
- logLabel: `From Ring (${this.camera.name})`,
90
- logger: {
91
- error: util_1.logError,
92
- info: util_1.logDebug,
93
- },
53
+ async startTranscoding(ffmpegOptions) {
54
+ const videoPort = await this.reservePort(1), audioPort = await this.reservePort(1), transcodeVideoStream = ffmpegOptions.video !== false, ffmpegInputArguments = [
55
+ '-hide_banner',
56
+ '-protocol_whitelist',
57
+ 'pipe,udp,rtp,file,crypto',
58
+ '-acodec',
59
+ 'libopus',
60
+ '-f',
61
+ 'sdp',
62
+ ...(ffmpegOptions.input || []),
63
+ '-i',
64
+ 'pipe:',
65
+ ], ringSdp = await (0, rxjs_1.firstValueFrom)(this.connection.onCallAnswered), inputSdp = getCleanSdp(ringSdp, transcodeVideoStream)
66
+ .replace(/m=audio \d+/, `m=audio ${audioPort}`)
67
+ .replace(/m=video \d+/, `m=video ${videoPort}`), ff = new camera_utils_1.FfmpegProcess({
68
+ ffmpegArgs: ffmpegInputArguments.concat(...(ffmpegOptions.audio || ['-acodec', 'aac']), ...(transcodeVideoStream
69
+ ? ffmpegOptions.video || ['-vcodec', 'copy']
70
+ : []), ...(ffmpegOptions.output || [])),
71
+ ffmpegPath: (0, ffmpeg_1.getFfmpegPath)(),
72
+ exitCallback: () => this.callEnded(),
73
+ logLabel: `From Ring (${this.camera.name})`,
74
+ logger: {
75
+ error: util_1.logError,
76
+ info: util_1.logDebug,
77
+ },
78
+ });
79
+ this.addSubscriptions(this.onAudioRtp
80
+ .pipe((0, operators_1.concatMap)((rtp) => {
81
+ return this.audioSplitter.send(rtp.serialize(), {
82
+ port: audioPort,
94
83
  });
95
- this.addSubscriptions(this.onAudioRtp
84
+ }))
85
+ .subscribe());
86
+ if (transcodeVideoStream) {
87
+ this.addSubscriptions(this.onVideoRtp
96
88
  .pipe((0, operators_1.concatMap)((rtp) => {
97
- return this.audioSplitter.send(rtp.serialize(), {
98
- port: audioPort,
89
+ return this.videoSplitter.send(rtp.serialize(), {
90
+ port: videoPort,
99
91
  });
100
92
  }))
101
93
  .subscribe());
102
- if (transcodeVideoStream) {
103
- this.addSubscriptions(this.onVideoRtp
104
- .pipe((0, operators_1.concatMap)((rtp) => {
105
- return this.videoSplitter.send(rtp.serialize(), {
106
- port: videoPort,
107
- });
108
- }))
109
- .subscribe());
110
- }
111
- this.onCallEnded.subscribe(() => ff.stop());
112
- ff.writeStdin(inputSdp);
113
- // Activate the stream now that ffmpeg is ready to receive
114
- yield this.activate();
115
- });
94
+ }
95
+ this.onCallEnded.subscribe(() => ff.stop());
96
+ ff.writeStdin(inputSdp);
97
+ // Activate the stream now that ffmpeg is ready to receive
98
+ await this.activate();
116
99
  }
117
100
  callEnded() {
118
101
  this.unsubscribe();
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.WebrtcConnection = void 0;
13
4
  const ws_1 = require("ws");
@@ -32,29 +23,30 @@ class WebrtcConnection extends streaming_connection_base_1.StreamingConnectionBa
32
23
  (0, util_1.logDebug)(`WebSocket connected for ${camera.name}`);
33
24
  }));
34
25
  }
35
- handleMessage(message) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- switch (message.method) {
38
- case 'sdp':
39
- const answer = yield this.pc.createAnswer(message);
40
- this.sendSessionMessage('sdp', answer);
41
- this.onCallAnswered.next(message.sdp);
42
- this.sendSessionMessage('stream_options', {
43
- audio_enabled: true,
44
- video_enabled: true,
45
- });
46
- return;
47
- case 'ice':
48
- yield this.pc.addIceCandidate({
49
- candidate: message.ice,
50
- sdpMLineIndex: message.mlineindex,
51
- });
52
- return;
53
- }
54
- });
26
+ async handleMessage(message) {
27
+ switch (message.method) {
28
+ case 'sdp':
29
+ const answer = await this.pc.createAnswer(message);
30
+ this.sendSessionMessage('sdp', answer);
31
+ this.onCallAnswered.next(message.sdp);
32
+ this.sendSessionMessage('stream_options', {
33
+ audio_enabled: true,
34
+ video_enabled: true,
35
+ });
36
+ return;
37
+ case 'ice':
38
+ await this.pc.addIceCandidate({
39
+ candidate: message.ice,
40
+ sdpMLineIndex: message.mlineindex,
41
+ });
42
+ return;
43
+ }
55
44
  }
56
45
  sendSessionMessage(method, body = {}) {
57
- this.sendMessage(Object.assign(Object.assign({}, body), { method }));
46
+ this.sendMessage({
47
+ ...body,
48
+ method,
49
+ });
58
50
  }
59
51
  }
60
52
  exports.WebrtcConnection = WebrtcConnection;
package/lib/api/util.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -63,39 +54,35 @@ function generateUuid(seed) {
63
54
  return (0, uuid_1.v4)();
64
55
  }
65
56
  exports.generateUuid = generateUuid;
66
- function getHardwareId(systemId) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- if (systemId) {
69
- return generateUuid(systemId);
70
- }
71
- const timeoutValue = '-1', { os: id } = yield Promise.race([
72
- (0, systeminformation_1.uuid)(),
73
- delay(5000).then(() => ({ os: timeoutValue })),
74
- ]);
75
- if (id === timeoutValue) {
76
- logError('Request for system uuid timed out. Falling back to random session id');
77
- return (0, uuid_1.v4)();
78
- }
79
- if (id === '-') {
80
- // default value set by systeminformation if it can't find a real value
81
- logError('Unable to get system uuid. Falling back to random session id');
82
- return (0, uuid_1.v4)();
83
- }
84
- return generateUuid(id);
85
- });
57
+ async function getHardwareId(systemId) {
58
+ if (systemId) {
59
+ return generateUuid(systemId);
60
+ }
61
+ const timeoutValue = '-1', { os: id } = await Promise.race([
62
+ (0, systeminformation_1.uuid)(),
63
+ delay(5000).then(() => ({ os: timeoutValue })),
64
+ ]);
65
+ if (id === timeoutValue) {
66
+ logError('Request for system uuid timed out. Falling back to random session id');
67
+ return (0, uuid_1.v4)();
68
+ }
69
+ if (id === '-') {
70
+ // default value set by systeminformation if it can't find a real value
71
+ logError('Unable to get system uuid. Falling back to random session id');
72
+ return (0, uuid_1.v4)();
73
+ }
74
+ return generateUuid(id);
86
75
  }
87
76
  exports.getHardwareId = getHardwareId;
88
- function requestInput(question) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- const lineReader = (0, readline_1.createInterface)({
91
- input: process.stdin,
92
- output: process.stdout,
93
- }), answer = yield new Promise((resolve) => {
94
- lineReader.question(question, resolve);
95
- });
96
- lineReader.close();
97
- return answer.trim();
77
+ async function requestInput(question) {
78
+ const lineReader = (0, readline_1.createInterface)({
79
+ input: process.stdin,
80
+ output: process.stdout,
81
+ }), answer = await new Promise((resolve) => {
82
+ lineReader.question(question, resolve);
98
83
  });
84
+ lineReader.close();
85
+ return answer.trim();
99
86
  }
100
87
  exports.requestInput = requestInput;
101
88
  function stringify(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/api/index.js",
6
6
  "bin": {
@@ -97,7 +97,7 @@
97
97
  "typescript": "4.6.4"
98
98
  },
99
99
  "engines": {
100
- "node": "^12.20 || ^14 || ^16",
100
+ "node": "^16",
101
101
  "homebridge": ">=1.4.0"
102
102
  },
103
103
  "bugs": {