@signalwire/core
Advanced tools
Comparing version 4.1.0-dev.202404231931.9627cd3.0 to 4.1.0-dev.202404301530.94a97d7.0
@@ -22,7 +22,3 @@ import type { Task } from '@redux-saga/types'; | ||
*/ | ||
protected _runningWorkers: Record<string, Task<any>>; | ||
/** | ||
* white list workers instance if we need to start multiple workers | ||
*/ | ||
protected _allowMultipleWorkerInstances: string[]; | ||
private _runningWorkers; | ||
get logger(): import("./utils/interfaces").InternalSDKLogger; | ||
@@ -45,3 +41,3 @@ /** | ||
runSaga: <T>(saga: import("@redux-saga/types").Saga<any[]>, args: { | ||
instance: T; /** @internal */ | ||
instance: T; | ||
runSaga: any; | ||
@@ -55,5 +51,4 @@ }) => Task<any>; | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
/** @internal */ | ||
callSegments: import("./types").CallSegmentContract[]; | ||
@@ -74,3 +69,3 @@ sessionEmitter: EventEmitter<import("./utils/interfaces").ClientEvents, any>; | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
@@ -77,0 +72,0 @@ /** @internal */ |
@@ -25,3 +25,3 @@ import { Saga, Task } from '@redux-saga/core'; | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
@@ -28,0 +28,0 @@ callSegments: CallSegmentContract[]; |
@@ -6,4 +6,4 @@ export declare const useInstanceMap: () => { | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
//# sourceMappingURL=useInstanceMap.d.ts.map |
@@ -24,3 +24,3 @@ /// <reference types="jest" /> | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
@@ -55,3 +55,3 @@ callSegments: import(".").CallSegmentContract[]; | ||
getAll: () => [string, unknown][]; | ||
deletaAll: () => void; | ||
deleteAll: () => Map<string, unknown>; | ||
}; | ||
@@ -58,0 +58,0 @@ callSegments: import(".").CallSegmentContract[]; |
@@ -148,3 +148,3 @@ import { CallState, CallConnect, CallPlay, InternalVideoRoomSessionEntity, MapToPubSubShape, SwEvent, CallEnded, CallRecord, ToInternalVideoEvent, VideoMemberEvent, VideoLayoutEvent } from '..'; | ||
export declare type CallStream = 'call.stream'; | ||
export declare type CallStates = 'created' | 'ringing' | 'answered' | 'finished'; | ||
export declare type CallStates = 'created' | 'ringing' | 'answered' | 'ending' | 'ended'; | ||
export declare type CallConnectStates = 'connecting' | 'connected'; | ||
@@ -151,0 +151,0 @@ export declare type CallDirections = 'inbound' | 'outbound'; |
@@ -12,5 +12,6 @@ import { OnlyStateProperties, RoomSessionMember, VideoRoomSessionEntity } from '..'; | ||
room_session: Omit<VideoRoomSessionEntity, 'members'> & { | ||
members: RoomSessionMember; | ||
members: RoomSessionMember[]; | ||
}; | ||
member: RoomSessionMember; | ||
members: RoomSessionMember[]; | ||
} | ||
@@ -17,0 +18,0 @@ /** |
@@ -247,2 +247,3 @@ /// <reference types="node" /> | ||
getAll: <T extends unknown>() => [string, T][]; | ||
deleteAll: <T extends unknown>() => Map<string, T>; | ||
}; | ||
@@ -249,0 +250,0 @@ declare type SDKWorkerBaseParams<T> = { |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "4.1.0-dev.202404231931.9627cd3.0", | ||
"version": "4.1.0-dev.202404301530.94a97d7.0", | ||
"main": "dist/index.node.js", | ||
@@ -9,0 +9,0 @@ "module": "dist/index.esm.js", |
@@ -58,9 +58,4 @@ import type { Task } from '@redux-saga/types' | ||
*/ | ||
protected _runningWorkers: Record<string, Task<any>> = {} | ||
private _runningWorkers: Task[] = [] | ||
/** | ||
* white list workers instance if we need to start multiple workers | ||
*/ | ||
protected _allowMultipleWorkerInstances = ['executeActionWorker', 'memberPositionWorker'] | ||
public get logger() { | ||
@@ -189,3 +184,2 @@ return getLogger() | ||
this.detachWorkers() | ||
this.instanceMap.deletaAll() | ||
} | ||
@@ -348,7 +342,2 @@ | ||
) { | ||
if(!this._allowMultipleWorkerInstances.includes(name) && name in this._runningWorkers) { | ||
getLogger().warn(`Preventing running worker reattach: ${name}`); | ||
return this._runningWorkers[name] | ||
} | ||
const task = this.store.runSaga(worker, { | ||
@@ -359,4 +348,3 @@ instance: this, | ||
}) | ||
this._runningWorkers[name] = task | ||
this._runningWorkers.push(task) | ||
/** | ||
@@ -372,7 +360,7 @@ * Attaching workers is a one-time op for instances so | ||
private detachWorkers() { | ||
Object.values(this._runningWorkers).forEach((task) => { | ||
this._runningWorkers.forEach((task) => { | ||
task.cancel() | ||
}) | ||
this._runningWorkers = {} | ||
this._runningWorkers = [] | ||
} | ||
} |
@@ -85,3 +85,9 @@ import util from 'util' | ||
instance, | ||
instanceMap: { get: jest.fn(), set: jest.fn(), remove: jest.fn(), getAll: jest.fn() }, | ||
instanceMap: { | ||
get: jest.fn(), | ||
set: jest.fn(), | ||
remove: jest.fn(), | ||
getAll: jest.fn(), | ||
deleteAll: jest.fn(), | ||
}, | ||
callSegments: [], | ||
@@ -125,3 +131,9 @@ getSession, | ||
instance, | ||
instanceMap: { get: jest.fn(), set: jest.fn(), remove: jest.fn(), getAll: jest.fn() }, | ||
instanceMap: { | ||
get: jest.fn(), | ||
set: jest.fn(), | ||
remove: jest.fn(), | ||
getAll: jest.fn(), | ||
deleteAll: jest.fn(), | ||
}, | ||
callSegments: [], | ||
@@ -128,0 +140,0 @@ getSession, |
@@ -6,3 +6,3 @@ export const useInstanceMap = () => { | ||
// controlId => PlaybackInstance | RecordingInstance | ||
let instanceMap = new Map<string, unknown>() | ||
const instanceMap = new Map<string, unknown>() | ||
@@ -27,4 +27,5 @@ const getInstance = <T extends unknown>(key: string): T => { | ||
const deletaAll = () => { | ||
instanceMap = new Map<string, unknown>() | ||
const deleteAllInstances = () => { | ||
instanceMap.clear() | ||
return instanceMap | ||
} | ||
@@ -37,4 +38,4 @@ | ||
getAll: getAllInstances, | ||
deletaAll: deletaAll | ||
deleteAll: deleteAllInstances, | ||
} | ||
} |
@@ -133,3 +133,3 @@ import { | ||
const newPayload = { | ||
...payload, | ||
...this._payload, | ||
member: { | ||
@@ -136,0 +136,0 @@ ...this._payload.member, |
@@ -181,3 +181,3 @@ import { | ||
export type CallStates = 'created' | 'ringing' | 'answered' | 'finished' | ||
export type CallStates = 'created' | 'ringing' | 'answered' | 'ending' | 'ended' | ||
export type CallConnectStates = 'connecting' | 'connected' | ||
@@ -184,0 +184,0 @@ export type CallDirections = 'inbound' | 'outbound' |
@@ -17,5 +17,6 @@ import { | ||
room_session: Omit<VideoRoomSessionEntity, 'members'> & { | ||
members: RoomSessionMember | ||
members: RoomSessionMember[] | ||
} | ||
member: RoomSessionMember | ||
members: RoomSessionMember[] | ||
} | ||
@@ -22,0 +23,0 @@ |
@@ -459,2 +459,3 @@ import type { SagaIterator } from '@redux-saga/types' | ||
getAll: <T extends unknown>() => [string, T][] | ||
deleteAll: <T extends unknown>() => Map<string, T> | ||
} | ||
@@ -461,0 +462,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2867405
41961