Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pushprotocol/restapi

Package Overview
Dependencies
Maintainers
1
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pushprotocol/restapi - npm Package Compare versions

Comparing version 0.0.1-alpha.2 to 0.0.1-alpha.3

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Changelog

## [0.0.1-alpha.3](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.2...restapi-0.0.1-alpha.3) (2023-05-11)
### Bug Fixes
* Merge branch 'alpha' into alpha-deployment ([e19b9b0](https://github.com/ethereum-push-notification-service/push-sdk/commit/e19b9b05b60174e68dc7bfe0e2349e20d8af2604))
* Replace arrow functions with normal functions in the Video class ([#380](https://github.com/ethereum-push-notification-service/push-sdk/issues/380)) ([b90435a](https://github.com/ethereum-push-notification-service/push-sdk/commit/b90435a953b908899c92eb5b4d4c3677e47b1552))
## [0.0.1-alpha.2](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.1...restapi-0.0.1-alpha.2) (2023-05-10)

@@ -7,0 +17,0 @@

2

package.json
{
"name": "@pushprotocol/restapi",
"version": "0.0.1-alpha.2",
"version": "0.0.1-alpha.3",
"type": "commonjs",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -15,9 +15,9 @@ import { VideoCallData, VideoCreateInputOptions, VideoRequestInputOptions, VideoAcceptRequestInputOptions, VideoConnectInputOptions } from '../types';

});
create: (options: VideoCreateInputOptions) => Promise<void>;
request: (options: VideoRequestInputOptions) => Promise<void>;
acceptRequest: (options: VideoAcceptRequestInputOptions) => Promise<void>;
connect: (options: VideoConnectInputOptions) => void;
disconnect: () => void;
toggleVideo: () => void;
toggleAudio: () => void;
create(options: VideoCreateInputOptions): Promise<void>;
request(options: VideoRequestInputOptions): Promise<void>;
acceptRequest(options: VideoAcceptRequestInputOptions): Promise<void>;
connect(options: VideoConnectInputOptions): void;
disconnect(): void;
toggleVideo(): void;
toggleAudio(): void;
}

@@ -45,3 +45,7 @@ "use strict";

this.peerInstance = null;
this.create = (options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.data = data;
this.setData = setData;
}
create(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { audio, video } = options || {};

@@ -71,3 +75,5 @@ try {

});
this.request = (options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
}
request(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { library, chainId, senderAddress, // notification sender

@@ -167,3 +173,5 @@ recipientAddress, // notification receiver

});
this.acceptRequest = (options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
}
acceptRequest(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { signalData, library, chainId, senderAddress, // notification sender

@@ -269,95 +277,93 @@ recipientAddress, // notification receiver

});
this.connect = (options) => {
var _a;
const { signalData } = options || {};
try {
console.log('connect', 'options', options);
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.signal(signalData);
// set videoCallInfo state with status connected for the caller's end
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.incoming.status = types_1.VideoCallStatus.CONNECTED;
});
}
connect(options) {
var _a;
const { signalData } = options || {};
try {
console.log('connect', 'options', options);
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.signal(signalData);
// set videoCallInfo state with status connected for the caller's end
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.incoming.status = types_1.VideoCallStatus.CONNECTED;
});
});
}
catch (err) {
console.log('error in connect', err);
}
}
disconnect() {
var _a, _b, _c;
try {
console.log('disconnect');
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'endLocalStream', endLocalStream: true }));
(_b = this.peerInstance) === null || _b === void 0 ? void 0 : _b.destroy();
// ending the local stream
(_c = this.data.local.stream) === null || _c === void 0 ? void 0 : _c.getTracks().forEach((track) => track.stop());
}
catch (err) {
console.log('error in connect', err);
if (this.data.incoming.status === types_1.VideoCallStatus.INITIALIZED ||
this.data.incoming.status === types_1.VideoCallStatus.RECEIVED) {
// for disconnecting during status 1, 2
// send a notif to the other user signaling status=4
(0, sendVideoCallNotification_1.default)({
signer: this.signer,
chainId: this.chainId,
pgpPrivateKey: this.pgpPrivateKey,
}, {
senderAddress: this.data.local.address,
recipientAddress: this.data.incoming.address,
status: types_1.VideoCallStatus.DISCONNECTED,
chatId: this.data.meta.chatId,
signalingData: null,
env: this.env,
});
}
};
this.disconnect = () => {
var _a, _b, _c;
try {
console.log('disconnect');
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'endLocalStream', endLocalStream: true }));
(_b = this.peerInstance) === null || _b === void 0 ? void 0 : _b.destroy();
// ending the local stream
(_c = this.data.local.stream) === null || _c === void 0 ? void 0 : _c.getTracks().forEach((track) => track.stop());
}
if (this.data.incoming.status === types_1.VideoCallStatus.INITIALIZED ||
this.data.incoming.status === types_1.VideoCallStatus.RECEIVED) {
// for disconnecting during status 1, 2
// send a notif to the other user signaling status=4
(0, sendVideoCallNotification_1.default)({
signer: this.signer,
chainId: this.chainId,
pgpPrivateKey: this.pgpPrivateKey,
}, {
senderAddress: this.data.local.address,
recipientAddress: this.data.incoming.address,
status: types_1.VideoCallStatus.DISCONNECTED,
chatId: this.data.meta.chatId,
signalingData: null,
env: this.env,
});
}
this.setData(() => exports.initVideoCallData);
this.setData(() => exports.initVideoCallData);
}
catch (err) {
console.log('error in disconnect', err);
}
}
// functions for toggling local audio and video
toggleVideo() {
var _a;
console.log('toggleVideo', 'current video', this.data.local.video);
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'isVideoOn', isVideoOn: !this.data.local.video }));
}
if (this.data.local.stream) {
if (this.data.local.video === false) {
(0, mediaToggle_1.restartVideoStream)(this.data.local.stream);
}
catch (err) {
console.log('error in disconnect', err);
if (this.data.local.video === true) {
(0, mediaToggle_1.stopVideoStream)(this.data.local.stream);
}
};
// functions for toggling local audio and video
this.toggleVideo = () => {
var _a;
console.log('toggleVideo', 'current video', this.data.local.video);
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'isVideoOn', isVideoOn: !this.data.local.video }));
}
if (this.data.local.stream) {
if (this.data.local.video === false) {
(0, mediaToggle_1.restartVideoStream)(this.data.local.stream);
}
if (this.data.local.video === true) {
(0, mediaToggle_1.stopVideoStream)(this.data.local.stream);
}
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.local.video = !oldData.local.video;
});
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.local.video = !oldData.local.video;
});
});
}
}
toggleAudio() {
var _a;
console.log('toggleAudio', 'current audio', this.data.local.audio);
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'isAudioOn', isAudioOn: !this.data.local.audio }));
}
if (this.data.local.stream) {
if (this.data.local.audio === false) {
(0, mediaToggle_1.restartAudioStream)(this.data.local.stream);
}
};
this.toggleAudio = () => {
var _a;
console.log('toggleAudio', 'current audio', this.data.local.audio);
if (this.data.incoming.status === types_1.VideoCallStatus.CONNECTED) {
(_a = this.peerInstance) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({ type: 'isAudioOn', isAudioOn: !this.data.local.audio }));
if (this.data.local.audio === true) {
(0, mediaToggle_1.stopAudioStream)(this.data.local.stream);
}
if (this.data.local.stream) {
if (this.data.local.audio === false) {
(0, mediaToggle_1.restartAudioStream)(this.data.local.stream);
}
if (this.data.local.audio === true) {
(0, mediaToggle_1.stopAudioStream)(this.data.local.stream);
}
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.local.audio = !oldData.local.audio;
});
this.setData((oldData) => {
return (0, immer_1.produce)(oldData, (draft) => {
draft.local.audio = !oldData.local.audio;
});
}
};
this.data = data;
this.setData = setData;
});
}
}

@@ -364,0 +370,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc