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

@signalwire/core

Package Overview
Dependencies
Maintainers
2
Versions
200
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalwire/core - npm Package Compare versions

Comparing version 3.9.0 to 3.10.0-dev.202206151219.b97ffcb.0

4

dist/core/src/BaseComponent.d.ts
import type { Task } from '@redux-saga/types';
import { Action } from './redux';
import { ExecuteParams, BaseComponentOptions, ExecuteExtendedOptions, EventsPrefix, EventTransform, SDKWorker, SDKWorkerDefinition, SessionAuthStatus, SDKWorkerHooks } from './utils/interfaces';
import { ExecuteParams, BaseComponentOptions, ExecuteExtendedOptions, EventsPrefix, EventTransform, SDKWorker, SDKWorkerDefinition, SessionAuthStatus, SDKWorkerHooks, Authorization } from './utils/interfaces';
import { EventEmitter } from './utils/EventEmitter';

@@ -181,2 +181,4 @@ import { SDKState } from './redux/interfaces';

/** @internal */
protected get _sessionAuthState(): Authorization | undefined;
/** @internal */
protected _waitUntilSessionAuthorized(): Promise<this>;

@@ -183,0 +185,0 @@ private _setEmitterTransform;

@@ -33,2 +33,3 @@ import { uuid, setLogger, getLogger, isGlobalEvent, toExternalJSON, toSnakeCaseKeys, toLocalEvent, toSyntheticEvent, extendComponent, validateEventsToSubscribe, toInternalEventName, serializeableProxy, timeoutPromise } from './utils';

getAuthError: ({ session }: import("./redux/interfaces").SDKState) => import("./utils/interfaces").SessionAuthError | undefined;
getAuthState: ({ session }: import("./redux/interfaces").SDKState) => import("./utils/interfaces").Authorization | undefined;
};

@@ -35,0 +36,0 @@ export { ChatMember, ChatMessage } from './chat';

@@ -6,2 +6,3 @@ import { SDKState } from '../../interfaces';

export declare const getAuthError: ({ session }: SDKState) => import("../../..").SessionAuthError | undefined;
export declare const getAuthState: ({ session }: SDKState) => import("../../..").Authorization | undefined;
//# sourceMappingURL=sessionSelectors.d.ts.map

@@ -16,2 +16,18 @@ import type { PayloadAction } from '../../toolkit';

readonly authStatus: SessionAuthStatus;
readonly authState?: {
readonly type: "video";
readonly project: string;
readonly scopes: readonly string[];
readonly scope_id: string;
readonly resource: string;
readonly user_name: string;
readonly room?: {
readonly name: string;
readonly scopes: readonly string[];
} | undefined;
readonly signature: string;
readonly expires_at?: number | undefined;
readonly audio_allowed?: boolean | undefined;
readonly video_allowed?: boolean | undefined;
} | undefined;
readonly authError?: {

@@ -24,2 +40,3 @@ readonly code: number;

authStatus: "authorized";
authState: import("../../../utils/interfaces").Authorization;
authCount: number;

@@ -42,2 +59,18 @@ protocol: string;

readonly authStatus: SessionAuthStatus;
readonly authState?: {
readonly type: "video";
readonly project: string;
readonly scopes: readonly string[];
readonly scope_id: string;
readonly resource: string;
readonly user_name: string;
readonly room?: {
readonly name: string;
readonly scopes: readonly string[];
} | undefined;
readonly signature: string;
readonly expires_at?: number | undefined;
readonly audio_allowed?: boolean | undefined;
readonly video_allowed?: boolean | undefined;
} | undefined;
readonly authError?: {

@@ -57,2 +90,18 @@ readonly code: number;

}[] | undefined;
authState?: {
readonly type: "video";
readonly project: string;
readonly scopes: readonly string[];
readonly scope_id: string;
readonly resource: string;
readonly user_name: string;
readonly room?: {
readonly name: string;
readonly scopes: readonly string[];
} | undefined;
readonly signature: string;
readonly expires_at?: number | undefined;
readonly audio_allowed?: boolean | undefined;
readonly video_allowed?: boolean | undefined;
} | undefined;
authError?: {

@@ -73,2 +122,18 @@ readonly code: number;

readonly authStatus: SessionAuthStatus;
readonly authState?: {
readonly type: "video";
readonly project: string;
readonly scopes: readonly string[];
readonly scope_id: string;
readonly resource: string;
readonly user_name: string;
readonly room?: {
readonly name: string;
readonly scopes: readonly string[];
} | undefined;
readonly signature: string;
readonly expires_at?: number | undefined;
readonly audio_allowed?: boolean | undefined;
readonly video_allowed?: boolean | undefined;
} | undefined;
readonly authError?: {

@@ -75,0 +140,0 @@ readonly code: number;

import type { SagaIterator } from '@redux-saga/types';
import type { PayloadAction } from './toolkit';
import { JSONRPCResponse, SessionAuthError, SessionAuthStatus, SessionEvents, JSONRPCMethod, BaseConnectionState } from '../utils/interfaces';
import { JSONRPCResponse, SessionAuthError, SessionAuthStatus, SessionEvents, JSONRPCMethod, BaseConnectionState, Authorization } from '../utils/interfaces';
import type { VideoAPIEventParams, InternalVideoAPIEvent, ChatAction, TaskAction, MessagingAction, SwEventParams, VoiceCallAction, VideoManagerAction, PubSubEventAction } from '../types';

@@ -42,2 +42,3 @@ import { SDKRunSaga } from '.';

authStatus: SessionAuthStatus;
authState?: Authorization;
authError?: SessionAuthError;

@@ -44,0 +45,0 @@ authCount: number;

@@ -403,2 +403,18 @@ export declare const rootReducer: import("redux").Reducer<import("redux").CombinedState<{

readonly authStatus: import("..").SessionAuthStatus;
readonly authState?: {
readonly type: "video";
readonly project: string;
readonly scopes: readonly string[];
readonly scope_id: string;
readonly resource: string;
readonly user_name: string;
readonly room?: {
readonly name: string;
readonly scopes: readonly string[];
} | undefined;
readonly signature: string;
readonly expires_at?: number | undefined;
readonly audio_allowed?: boolean | undefined;
readonly video_allowed?: boolean | undefined;
} | undefined;
readonly authError?: {

@@ -405,0 +421,0 @@ readonly code: number;

@@ -51,2 +51,3 @@ import { BaseRoomInterface } from '.';

layout?: string;
currentTimecode?: number;
};

@@ -53,0 +54,0 @@ export declare const play: RoomMethodDescriptor<any, PlayParams>;

@@ -18,4 +18,7 @@ import { BaseComponent } from '../BaseComponent';

setVolume(volume: number): Promise<void>;
seek(timecode: number): Promise<void>;
forward(offset?: number): Promise<void>;
rewind(offset?: number): Promise<void>;
}
export declare const createRoomSessionPlaybackObject: (params: BaseComponentOptions<RoomSessionPlaybackEventsHandlerMapping>) => RoomSessionPlayback;
//# sourceMappingURL=RoomSessionPlayback.d.ts.map

@@ -53,2 +53,10 @@ import { VertoMethod } from '../utils/interfaces';

};
export declare const VertoPong: (params?: VertoParams) => {
id: string;
method: import("../utils/interfaces").JSONRPCMethod;
params: {
[key: string]: any;
};
jsonrpc: "2.0";
};
export declare const VertoResult: (id: string, method: VertoMethod) => {

@@ -55,0 +63,0 @@ id: string;

@@ -8,2 +8,13 @@ export declare type PaginationCursor = {

};
export declare type ClientContextMethod = 'signalwire.receive' | 'signalwire.unreceive';
export interface ClientContextContract {
addContexts(contexts: string[]): Promise<{
message: string;
code: number;
}>;
removeContexts(contexts: string[]): Promise<{
message: string;
code: number;
}>;
}
//# sourceMappingURL=common.d.ts.map

@@ -28,2 +28,4 @@ import type { SwEvent } from '.';

state: 'playing' | 'paused' | 'completed';
/** Whether the seek function can be used for this playback. */
seekable: boolean;
/** Url of the file reproduced by this playback */

@@ -50,2 +52,5 @@ url: string;

setVolume(volume: number): Promise<void>;
seek(timecode: number): Promise<void>;
forward(offset: number): Promise<void>;
rewind(offset: number): Promise<void>;
}

@@ -52,0 +57,0 @@ /**

@@ -9,8 +9,8 @@ /// <reference types="node" />

import type { URL as NodeURL } from 'node:url';
import { AllOrNone, CallingTransformType, ChatJSONRPCMethod, ChatTransformType, PubSubTransformType, MessagingJSONRPCMethod, MessagingTransformType, VoiceJSONRPCMethod } from '..';
import { AllOrNone, CallingTransformType, ChatJSONRPCMethod, ChatTransformType, PubSubTransformType, MessagingJSONRPCMethod, MessagingTransformType, VoiceJSONRPCMethod, ClientContextMethod } from '..';
declare type JSONRPCParams = Record<string, any>;
declare type JSONRPCResult = Record<string, any>;
declare type JSONRPCError = Record<string, any>;
export declare type VertoMethod = 'verto.invite' | 'verto.attach' | 'verto.answer' | 'verto.info' | 'verto.display' | 'verto.media' | 'verto.event' | 'verto.bye' | 'verto.punt' | 'verto.broadcast' | 'verto.subscribe' | 'verto.unsubscribe' | 'verto.clientReady' | 'verto.modify' | 'verto.mediaParams' | 'verto.prompt' | 'jsapi' | 'verto.stats' | 'verto.ping' | 'verto.announce';
export declare type JSONRPCMethod = 'signalwire.connect' | 'signalwire.ping' | 'signalwire.disconnect' | 'signalwire.event' | 'signalwire.reauthenticate' | 'signalwire.subscribe' | 'video.message' | RoomMethod | VertoMethod | ChatJSONRPCMethod | MessagingJSONRPCMethod | VoiceJSONRPCMethod;
export declare type VertoMethod = 'verto.invite' | 'verto.attach' | 'verto.answer' | 'verto.info' | 'verto.display' | 'verto.media' | 'verto.event' | 'verto.bye' | 'verto.punt' | 'verto.broadcast' | 'verto.subscribe' | 'verto.unsubscribe' | 'verto.clientReady' | 'verto.modify' | 'verto.mediaParams' | 'verto.prompt' | 'jsapi' | 'verto.stats' | 'verto.ping' | 'verto.pong' | 'verto.announce';
export declare type JSONRPCMethod = 'signalwire.connect' | 'signalwire.ping' | 'signalwire.disconnect' | 'signalwire.event' | 'signalwire.reauthenticate' | 'signalwire.subscribe' | 'video.message' | RoomMethod | VertoMethod | ChatJSONRPCMethod | MessagingJSONRPCMethod | VoiceJSONRPCMethod | ClientContextMethod;
export declare type JSONRPCSubscribeMethod = Extract<JSONRPCMethod, 'signalwire.subscribe' | 'chat.subscribe'>;

@@ -89,3 +89,3 @@ export interface JSONRPCRequest {

}
interface Authorization {
export interface Authorization {
type: 'video';

@@ -103,2 +103,4 @@ project: string;

expires_at?: number;
audio_allowed?: boolean;
video_allowed?: boolean;
}

@@ -129,3 +131,3 @@ export interface RPCConnectResult {

*/
export declare type RoomMethod = 'video.list_available_layouts' | 'video.hide_video_muted' | 'video.show_video_muted' | 'video.members.get' | 'video.member.audio_mute' | 'video.member.audio_unmute' | 'video.member.video_mute' | 'video.member.video_unmute' | 'video.member.deaf' | 'video.member.undeaf' | 'video.member.set_input_volume' | 'video.member.set_output_volume' | 'video.member.set_input_sensitivity' | 'video.member.set_position' | 'video.member.remove' | 'video.member.set_meta' | 'video.set_meta' | 'video.set_layout' | 'video.set_position' | 'video.recording.list' | 'video.recording.start' | 'video.recording.stop' | 'video.recording.pause' | 'video.recording.resume' | 'video.playback.list' | 'video.playback.start' | 'video.playback.pause' | 'video.playback.resume' | 'video.playback.stop' | 'video.playback.set_volume';
export declare type RoomMethod = 'video.list_available_layouts' | 'video.hide_video_muted' | 'video.show_video_muted' | 'video.members.get' | 'video.member.audio_mute' | 'video.member.audio_unmute' | 'video.member.video_mute' | 'video.member.video_unmute' | 'video.member.deaf' | 'video.member.undeaf' | 'video.member.set_input_volume' | 'video.member.set_output_volume' | 'video.member.set_input_sensitivity' | 'video.member.set_position' | 'video.member.remove' | 'video.member.set_meta' | 'video.set_meta' | 'video.set_layout' | 'video.set_position' | 'video.recording.list' | 'video.recording.start' | 'video.recording.stop' | 'video.recording.pause' | 'video.recording.resume' | 'video.playback.list' | 'video.playback.start' | 'video.playback.pause' | 'video.playback.resume' | 'video.playback.stop' | 'video.playback.set_volume' | 'video.playback.seek_absolute' | 'video.playback.seek_relative';
export interface WebSocketClient {

@@ -132,0 +134,0 @@ addEventListener: WebSocket['addEventListener'];

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "3.9.0",
"version": "3.10.0-dev.202206151219.b97ffcb.0",
"main": "dist/index.node.js",

@@ -9,0 +9,0 @@ "module": "dist/index.esm.js",

@@ -24,2 +24,3 @@ import type { Task } from '@redux-saga/types'

SDKWorkerHooks,
Authorization,
} from './utils/interfaces'

@@ -36,2 +37,3 @@ import { EventEmitter } from './utils/EventEmitter'

getAuthError,
getAuthState,
getAuthStatus,

@@ -841,2 +843,7 @@ } from './redux/features/session/sessionSelectors'

/** @internal */
protected get _sessionAuthState(): Authorization | undefined {
return getAuthState(this.store.getState())
}
/** @internal */
protected _waitUntilSessionAuthorized(): Promise<this> {

@@ -843,0 +850,0 @@ const authStatus = getAuthStatus(this.store.getState())

@@ -46,2 +46,3 @@ import { Store } from 'redux'

authStatus: 'unknown',
authState: undefined,
authError: undefined,

@@ -48,0 +49,0 @@ authCount: 0,

import { eventChannel } from '@redux-saga/core'
import { expectSaga } from 'redux-saga-test-plan'
import { VertoResult } from '../../../RPCMessages'
import { VertoResult, VertoPong } from '../../../RPCMessages'
import { socketMessageAction, executeAction } from '../../actions'

@@ -9,2 +9,8 @@ import { componentActions } from '../'

jest.mock('uuid', () => {
return {
v4: jest.fn(() => 'mocked-uuid'),
}
})
describe('sessionChannelWatcher', () => {

@@ -606,3 +612,3 @@ describe('videoAPIWorker', () => {

const jsonrpc = JSON.parse(
'{"jsonrpc":"2.0","id":"580a9555-ec98-4054-8288-859457da7797","method":"signalwire.event","params":{"event_type":"webrtc.message","event_channel":"signalwire_d71f0159c3734a51cd53e2c5e56e65a0b808e3e9865e561379c3af173aad3487_b3c11bb3-5b5f-4a22-820a-c8bd6d7fb10e_78429ef1-283b-4fa9-8ebc-16b59f95bb1f","timestamp":1627374894.011822,"project_id":"78429ef1-283b-4fa9-8ebc-16b59f95bb1f","node_id":"44c606b1-b951-4959-810a-ffa1ddc9ac4f@","params":{"jsonrpc":"2.0","id":"40","method":"verto.ping","params":{"serno":1}}}}'
'{"jsonrpc":"2.0","id":"580a9555-ec98-4054-8288-859457da7797","method":"signalwire.event","params":{"event_type":"webrtc.message","event_channel":"signalwire_d71f0159c3734a51cd53e2c5e56e65a0b808e3e9865e561379c3af173aad3487_b3c11bb3-5b5f-4a22-820a-c8bd6d7fb10e_78429ef1-283b-4fa9-8ebc-16b59f95bb1f","timestamp":1627374894.011822,"project_id":"78429ef1-283b-4fa9-8ebc-16b59f95bb1f","node_id":"44c606b1-b951-4959-810a-ffa1ddc9ac4f@","params":{"jsonrpc":"2.0","id":"40","method":"verto.ping","params":{"dialogParams":{"callID":"call-uuid"}}}}}'
)

@@ -645,3 +651,7 @@ let runSaga = true

params: {
message: VertoResult('40', 'verto.ping'),
message: VertoPong({
dialogParams: {
callID: 'call-uuid',
},
}),
node_id: '44c606b1-b951-4959-810a-ffa1ddc9ac4f@',

@@ -648,0 +658,0 @@ },

@@ -12,3 +12,3 @@ import { SagaIterator, eventChannel, EventChannel } from '@redux-saga/core'

import { BaseSession } from '../../../BaseSession'
import { VertoResult } from '../../../RPCMessages'
import { VertoResult, VertoPong } from '../../../RPCMessages'
import { JSONRPCRequest, JSONRPCResponse } from '../../../utils/interfaces'

@@ -210,3 +210,3 @@ import type {

}
case 'verto.ping':
case 'verto.ping': {
yield put(

@@ -216,3 +216,3 @@ executeAction({

params: {
message: VertoResult(id, method),
message: VertoPong(params),
node_id: nodeId,

@@ -223,2 +223,3 @@ },

break
}
case 'verto.punt':

@@ -225,0 +226,0 @@ return session.disconnect()

@@ -18,1 +18,5 @@ import { SDKState } from '../../interfaces'

}
export const getAuthState = ({ session }: SDKState) => {
return session.authState
}

@@ -20,2 +20,18 @@ import { Store } from 'redux'

authStatus: 'authorized',
authState: {
audio_allowed: true,
project: '8f0a119a-cda7-4497-a47d-c81493b824d4',
resource: '9c80f1e8-9430-4070-a043-937eb3a96b38',
room: {
name: 'lobby',
scopes: ['room.self.audio_mute', 'room.self.audio_unmute'],
},
scope_id: '26675883-8499-4ee9-85eb-691c4aa209f8',
scopes: ['video'],
signature:
'SGZtkRD9fvuBAOUp1UF56zESxdEvGT6qSGZtkRD9fvuBAOUp1UF56zESxdEvGT6q',
type: 'video',
user_name: 'Joe',
video_allowed: true,
},
authError: undefined,

@@ -22,0 +38,0 @@ authCount: 1,

@@ -16,2 +16,3 @@ import type { PayloadAction } from '../../toolkit'

authStatus: 'unknown',
authState: undefined,
authError: undefined,

@@ -29,2 +30,3 @@ authCount: 0,

authStatus: 'authorized',
authState: payload?.authorization,
authCount: state.authCount + 1,

@@ -31,0 +33,0 @@ protocol: payload?.protocol ?? '',

@@ -10,2 +10,3 @@ import type { SagaIterator } from '@redux-saga/types'

BaseConnectionState,
Authorization,
} from '../utils/interfaces'

@@ -66,2 +67,3 @@ import type {

authStatus: SessionAuthStatus
authState?: Authorization
authError?: SessionAuthError

@@ -68,0 +70,0 @@ authCount: number

@@ -221,2 +221,3 @@ import { BaseRoomInterface } from '.'

layout?: string
currentTimecode?: number
}

@@ -223,0 +224,0 @@ export const play: RoomMethodDescriptor<any, PlayParams> = {

@@ -67,2 +67,35 @@ import { connect } from '../redux'

}
async seek(timecode: number) {
await this.execute({
method: 'video.playback.seek_absolute',
params: {
room_session_id: this.getStateProperty('roomSessionId'),
playback_id: this.getStateProperty('id'),
position: Math.abs(timecode),
},
})
}
async forward(offset: number = 5000) {
await this.execute({
method: 'video.playback.seek_relative',
params: {
room_session_id: this.getStateProperty('roomSessionId'),
playback_id: this.getStateProperty('id'),
position: Math.abs(offset),
},
})
}
async rewind(offset: number = 5000) {
await this.execute({
method: 'video.playback.seek_relative',
params: {
room_session_id: this.getStateProperty('roomSessionId'),
playback_id: this.getStateProperty('id'),
position: -Math.abs(offset),
},
})
}
}

@@ -69,0 +102,0 @@

@@ -55,2 +55,3 @@ import { makeRPCRequest, makeRPCResponse } from './helpers'

export const VertoAnswer = buildVertoRPCMessage('verto.answer')
export const VertoPong = buildVertoRPCMessage('verto.pong')
export const VertoResult = (id: string, method: VertoMethod) => {

@@ -57,0 +58,0 @@ return makeRPCResponse({

@@ -63,2 +63,4 @@ import { multicastChannel } from '@redux-saga/core'

'SGZtkRD9fvuBAOUp1UF56zESxdEvGT6qSGZtkRD9fvuBAOUp1UF56zESxdEvGT6q',
audio_allowed: true,
video_allowed: true,
},

@@ -65,0 +67,0 @@ protocol:

@@ -10,1 +10,8 @@ export type PaginationCursor =

}
export type ClientContextMethod = 'signalwire.receive' | 'signalwire.unreceive'
export interface ClientContextContract {
addContexts(contexts: string[]): Promise<{ message: string; code: number }>
removeContexts(contexts: string[]): Promise<{ message: string; code: number }>
}

@@ -44,2 +44,5 @@ import type { SwEvent } from '.'

/** Whether the seek function can be used for this playback. */
seekable: boolean
/** Url of the file reproduced by this playback */

@@ -73,2 +76,8 @@ url: string

setVolume(volume: number): Promise<void>
seek(timecode: number): Promise<void>
forward(offset: number): Promise<void>
rewind(offset: number): Promise<void>
}

@@ -75,0 +84,0 @@

@@ -25,2 +25,3 @@ import type { SagaIterator } from '@redux-saga/types'

VoiceJSONRPCMethod,
ClientContextMethod,
} from '..'

@@ -52,2 +53,3 @@

| 'verto.ping'
| 'verto.pong'
| 'verto.announce'

@@ -68,2 +70,3 @@

| VoiceJSONRPCMethod
| ClientContextMethod

@@ -161,3 +164,3 @@ export type JSONRPCSubscribeMethod = Extract<

interface Authorization {
export interface Authorization {
type: 'video'

@@ -175,2 +178,4 @@ project: string

expires_at?: number
audio_allowed?: boolean
video_allowed?: boolean
}

@@ -265,2 +270,4 @@

| 'video.playback.set_volume'
| 'video.playback.seek_absolute'
| 'video.playback.seek_relative'

@@ -267,0 +274,0 @@ export interface WebSocketClient {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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