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

@vonage/video

Package Overview
Dependencies
Maintainers
26
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/video - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

dist/interfaces/ArchiveMode.d.ts

2

dist/interfaces/ArchiveLayout.d.ts

@@ -1,2 +0,2 @@

import { ArchiveLayoutType } from "../enums/ArchiveLayoutType";
import { ArchiveLayoutType } from '../enums/ArchiveLayoutType';
export interface ArchiveLayout {

@@ -3,0 +3,0 @@ type: ArchiveLayoutType;

@@ -1,5 +0,5 @@

import { ArchiveOutputMode } from "../enums/ArchiveOutputMode";
import { ArchiveResolution } from "../enums/ArchiveResolution";
import { ArchiveStreamMode } from "../enums/ArchiveStreamMode";
import { ArchiveLayout } from "./ArchiveLayout";
import { ArchiveOutputMode } from '../enums/ArchiveOutputMode';
import { ArchiveResolution } from '../enums/ArchiveResolution';
import { ArchiveStreamMode } from '../enums/ArchiveStreamMode';
import { ArchiveLayout } from './ArchiveLayout';
export interface ArchiveOptions {

@@ -6,0 +6,0 @@ hasAudio?: boolean;

@@ -1,2 +0,2 @@

import { SingleArchiveResponse } from "./SingleArchiveResponse";
import { SingleArchiveResponse } from './SingleArchiveResponse';
export interface MultiArchiveResponse {

@@ -3,0 +3,0 @@ count: number;

@@ -1,2 +0,2 @@

import { SingleStreamLayoutResponse } from "./SingleStreamLayoutResponse";
import { SingleStreamLayoutResponse } from './SingleStreamLayoutResponse';
export interface MultiStreamLayoutResponse {

@@ -3,0 +3,0 @@ count: number;

@@ -1,3 +0,3 @@

import { VetchResponse } from "@vonage/vetch";
import { VetchResponse } from '@vonage/vetch';
export interface VideoResponse<T> extends VetchResponse<T> {
}

@@ -1,4 +0,4 @@

import { AuthOpts } from "@vonage/auth";
import { AuthInterface } from "@vonage/auth";
import { VetchOptions } from "@vonage/vetch";
import { AuthOpts } from '@vonage/auth';
import { AuthInterface } from '@vonage/auth';
import { VetchOptions } from '@vonage/vetch';
export declare type VideoClassParameters = AuthOpts & VetchOptions & {

@@ -5,0 +5,0 @@ applicationId: string;

@@ -1,12 +0,14 @@

import { VideoClassParameters } from "./parameters/VideoClassParameters";
import { CreateSessionResponse } from "./interfaces/Response/CreateSessionResponse";
import { EmptyResponse } from "./interfaces/Response/EmptyResponse";
import { MultiStreamLayoutResponse } from "./interfaces/Response/MultiStreamLayoutResponse";
import { SingleStreamLayoutResponse } from "./interfaces/Response/SingleStreamLayoutResponse";
import { ProjectDetailsResponse } from "./interfaces/Response/ProjectDetailsResponse";
import { ArchiveOptions } from "./interfaces/ArchiveOptions";
import { SingleArchiveResponse } from "./interfaces/Response/SingleArchiveResponse";
import { MultiArchiveResponse } from "./interfaces/Response/MultiArchiveResponse";
import { ArchiveSearchFilter } from "./interfaces/ArchiveSearchFilter";
import { ArchiveLayout } from "./interfaces/ArchiveLayout";
import { VideoClassParameters } from './parameters/VideoClassParameters';
import { MultiStreamLayoutResponse } from './interfaces/Response/MultiStreamLayoutResponse';
import { SingleStreamLayoutResponse } from './interfaces/Response/SingleStreamLayoutResponse';
import { ProjectDetailsResponse } from './interfaces/Response/ProjectDetailsResponse';
import { ArchiveOptions } from './interfaces/ArchiveOptions';
import { SingleArchiveResponse } from './interfaces/Response/SingleArchiveResponse';
import { MultiArchiveResponse } from './interfaces/Response/MultiArchiveResponse';
import { ArchiveSearchFilter } from './interfaces/ArchiveSearchFilter';
import { ArchiveLayout } from './interfaces/ArchiveLayout';
import { MediaMode } from './interfaces/MediaMode';
import { ArchiveMode } from './interfaces/ArchiveMode';
import { Session } from './interfaces/Session';
import { StreamClassList } from './interfaces/StreamClassList';
export declare const BASE_URL: string;

@@ -16,9 +18,9 @@ export declare class Video {

constructor(opts?: VideoClassParameters);
addArchiveStream(archiveId: string, streamId: string, audio?: boolean, video?: boolean): Promise<EmptyResponse>;
addArchiveStream(archiveId: string, streamId: string, audio?: boolean, video?: boolean): Promise<void>;
createSession(sessionOptions?: {
archiveMode?: string;
archiveMode?: ArchiveMode;
location?: string;
p2pPreference?: string;
}): Promise<CreateSessionResponse[]>;
deleteArchive(archiveId: string): Promise<EmptyResponse>;
mediaMode?: MediaMode;
}): Promise<Session>;
deleteArchive(archiveId: string): Promise<void>;
disconnectClient(sessionId: string, connectionId: string): Promise<void>;

@@ -30,3 +32,3 @@ generateClientToken(sessionId: string): string;

muteStream(sessionId: string, streamId: string): Promise<ProjectDetailsResponse>;
removeArchiveStream(archiveId: string, streamId: string): Promise<EmptyResponse>;
removeArchiveStream(archiveId: string, streamId: string): Promise<void>;
searchArchives(filter?: ArchiveSearchFilter): Promise<MultiArchiveResponse>;

@@ -37,5 +39,6 @@ sendSignal(signal: {

}, sessionId: string, connectionId?: string): Promise<void>;
setStreamClassLists(sessionId: string, settings: StreamClassList[]): Promise<void>;
startArchive(sessionId: string, options?: ArchiveOptions): Promise<SingleArchiveResponse>;
stopArchive(archiveId: string): Promise<SingleArchiveResponse>;
updateArchiveLayout(archiveId: string, layout: ArchiveLayout): Promise<EmptyResponse[]>;
updateArchiveLayout(archiveId: string, layout: ArchiveLayout): Promise<void>;
}

@@ -16,5 +16,7 @@ "use strict";

const jwt_1 = require("@vonage/jwt");
exports.BASE_URL = "https://video.api.vonage.com/".replace(/\/+$/, "");
const MediaMode_1 = require("./interfaces/MediaMode");
const ArchiveMode_1 = require("./interfaces/ArchiveMode");
exports.BASE_URL = 'https://video.api.vonage.com/'.replace(/\/+$/, '');
const runRequest = (options, config) => __awaiter(void 0, void 0, void 0, function* () {
let result = yield (0, vetch_1.request)(options);
const result = yield (0, vetch_1.request)(options);
return result;

@@ -25,5 +27,5 @@ });

if (opts) {
opts['auth'] = new auth_1.Auth({ apiKey: opts.apiKey, apiSecret: opts.apiSecret, privateKey: opts.privateKey, applicationId: opts.applicationId, signature: opts.signature });
opts['baseUrl'] = opts.baseUrl || exports.BASE_URL;
opts['responseType'] = opts.responseType || vetch_1.ResponseTypes.json;
opts.auth = new auth_1.Auth({ apiKey: opts.apiKey, apiSecret: opts.apiSecret, privateKey: opts.privateKey, applicationId: opts.applicationId, signature: opts.signature });
opts.baseUrl = opts.baseUrl || exports.BASE_URL;
opts.responseType = opts.responseType || vetch_1.ResponseTypes.json;
this.config = opts;

@@ -34,10 +36,11 @@ }

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stream`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'PATCH';
localVetchOptions['data'] = {
addStream: streamId,
hasAudio: audio,
hasVideo: video
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stream`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'PATCH',
data: {
addStream: streamId,
hasAudio: audio,
hasVideo: video,
},
};

@@ -49,22 +52,22 @@ const resp = yield runRequest(localVetchOptions, this.config);

createSession(sessionOptions) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
const data = {};
if (sessionOptions.archiveMode) {
data['archiveMode'] = sessionOptions.archiveMode;
}
if (sessionOptions.location) {
data['location'] = sessionOptions.location;
}
if (sessionOptions.p2pPreference) {
data['p2p.preference'] = sessionOptions.p2pPreference;
}
localVetchOptions['url'] = `${this.config.baseUrl}/session/create`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
if (Object.keys(data).length) {
localVetchOptions['data'] = data;
}
const data = {
archiveMode: (_a = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.archiveMode) !== null && _a !== void 0 ? _a : ArchiveMode_1.ArchiveMode.MANUAL,
mediaMode: (_b = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.mediaMode) !== null && _b !== void 0 ? _b : MediaMode_1.MediaMode.ROUTED,
location: (_c = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.location) !== null && _c !== void 0 ? _c : null,
};
const localVetchOptions = {
url: `${this.config.baseUrl}/session/create`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
data,
};
const resp = yield runRequest(localVetchOptions, this.config);
return resp.data;
return {
sessionId: resp.data[0].session_id,
archiveMode: data.archiveMode,
mediaMode: data.mediaMode,
location: data.location,
};
});

@@ -74,6 +77,7 @@ }

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'DELETE';
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'DELETE',
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -85,6 +89,7 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/connection/${connectionId}`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'DELETE';
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/connection/${connectionId}`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'DELETE',
};
yield runRequest(localVetchOptions, this.config);

@@ -96,3 +101,3 @@ });

scope: 'session.connect',
'session_id': sessionId
session_id: sessionId,
});

@@ -102,6 +107,7 @@ }

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'GET';
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'GET',
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -113,3 +119,2 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
let url = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/stream`;

@@ -119,5 +124,7 @@ if (streamId) {

}
localVetchOptions['url'] = url;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'GET';
const localVetchOptions = {
url,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'GET',
};
let resp;

@@ -135,7 +142,8 @@ if (streamId) {

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/mute`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
localVetchOptions['data'] = { active, excludedStreamIds };
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/mute`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
data: { active, excludedStreamIds },
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -147,6 +155,7 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/stream/${streamId}/mute`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/stream/${streamId}/mute`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -158,9 +167,9 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stream`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'PATCH';
localVetchOptions['data'] = { removeStream: streamId };
const resp = yield runRequest(localVetchOptions, this.config);
return resp.data;
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stream`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'PATCH',
data: { removeStream: streamId },
};
yield runRequest(localVetchOptions, this.config);
});

@@ -170,8 +179,10 @@ }

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'GET';
if (filter) {
localVetchOptions['params'] = filter;
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'GET',
params: filter,
};
if (!filter) {
delete localVetchOptions.params;
}

@@ -184,3 +195,2 @@ const resp = yield runRequest(localVetchOptions, this.config);

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
let url = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/signal`;

@@ -190,16 +200,32 @@ if (connectionId) {

}
localVetchOptions['url'] = url;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
localVetchOptions['data'] = signal;
const localVetchOptions = {
url,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
data: signal,
};
yield runRequest(localVetchOptions, this.config);
});
}
setStreamClassLists(sessionId, settings) {
return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/session/${sessionId}/stream`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'PUT',
data: {
items: settings,
},
};
yield runRequest(localVetchOptions, this.config);
});
}
startArchive(sessionId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
localVetchOptions['data'] = Object.assign({}, { sessionId }, options);
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
data: Object.assign({}, { sessionId }, options),
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -211,6 +237,7 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stop`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'POST';
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/stop`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'POST',
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -222,7 +249,8 @@ return resp.data;

return __awaiter(this, void 0, void 0, function* () {
const localVetchOptions = {};
localVetchOptions['url'] = `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/layout`;
localVetchOptions['headers'] = Object.assign({}, this.config.headers, { 'Authorization': 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) });
localVetchOptions['method'] = 'PUT';
localVetchOptions['data'] = layout;
const localVetchOptions = {
url: `${this.config.baseUrl}/v2/project/${this.config.applicationId}/archive/${archiveId}/layout`,
headers: Object.assign({}, this.config.headers, { Authorization: 'Bearer ' + (0, jwt_1.tokenGenerate)(this.config.applicationId, this.config.privateKey) }),
method: 'PUT',
data: layout,
};
const resp = yield runRequest(localVetchOptions, this.config);

@@ -229,0 +257,0 @@ return resp.data;

{
"name": "@vonage/video",
"version": "0.4.0",
"version": "0.5.0",
"description": "Package to interact with the Vonage Video API (Not OpenTok Compatible)",

@@ -32,11 +32,19 @@ "keywords": [

"compile": "tsc -p tsconfig.json",
"format": "prettier --write \"lib/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"prepublishOnly": "npm run build && npm run test && npm run lint",
"preversion": "npm run lint",
"test-watch": "npx jest --watch",
"test": "npx jest"
"test": "npx jest",
"version": "npm run format && git add -A lib"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"jsonwebtoken": "^8.5.1",
"nock": "^13.2.4",
"prettier": "^2.7.1",
"ts-jest": "^27.1.3",
"typescript": "^4.3.5",
"jsonwebtoken": "^8.5.1"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.3.5"
},

@@ -43,0 +51,0 @@ "bugs": {

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