diff --git a/package-lock.json b/package-lock.json
index 66b35459c..b4e681f62 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18130,6 +18130,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/ts-toolbelt": {
+ "version": "9.6.0",
+ "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz",
+ "integrity": "sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==",
+ "license": "Apache-2.0"
+ },
"node_modules/tshy": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/tshy/-/tshy-1.18.0.tgz",
@@ -19056,7 +19062,8 @@
"dependencies": {
"@signalwire/core": "4.3.0",
"@signalwire/webrtc": "3.14.0",
- "jwt-decode": "^3.1.2"
+ "jwt-decode": "^3.1.2",
+ "ts-toolbelt": "^9.6.0"
},
"devDependencies": {
"@types/object-path": "^0.11.4"
diff --git a/packages/client/package.json b/packages/client/package.json
index 75aae08f7..a699989e2 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -41,7 +41,8 @@
"dependencies": {
"@signalwire/core": "4.3.0",
"@signalwire/webrtc": "3.14.0",
- "jwt-decode": "^3.1.2"
+ "jwt-decode": "^3.1.2",
+ "ts-toolbelt": "^9.6.0"
},
"devDependencies": {
"@types/object-path": "^0.11.4"
diff --git a/packages/client/snippets/CLIENT_SDK_OVERVIEW.md b/packages/client/snippets/CLIENT_SDK_OVERVIEW.md
new file mode 100644
index 000000000..82036931c
--- /dev/null
+++ b/packages/client/snippets/CLIENT_SDK_OVERVIEW.md
@@ -0,0 +1,825 @@
+# SignalWire Call Fabric SDK Developer Documentation
+
+## Table of Contents
+1. [Introduction](#introduction)
+2. [Installation & Setup](#installation--setup)
+3. [Client Initialization](#client-initialization)
+4. [Core Concepts](#core-concepts)
+5. [API Reference](#api-reference)
+6. [Event System](#event-system)
+7. [Code Examples](#code-examples)
+8. [Best Practices](#best-practices)
+
+## Introduction
+
+The SignalWire Call Fabric SDK provides a unified communication platform that seamlessly integrates audio/video calling with messaging capabilities. This SDK enables developers to build sophisticated real-time communication applications with features like video conferencing, screen sharing, messaging, and advanced call controls.
+
+### Key Features
+- WebRTC-based audio/video calling
+- Real-time messaging and chat
+- Screen sharing with audio
+- Advanced call controls (mute, hold, volume)
+- Room management and layouts
+- State persistence across reloads
+- Device management
+
+## Installation & Setup
+
+```bash
+npm install @signalwire/js
+```
+
+### Basic HTML Setup
+```html
+
+
+
+ Call Fabric Example
+
+
+
+
+
+
+```
+
+## Client Initialization
+
+### Standard Client (with Authentication Token)
+
+```javascript
+import { SignalWire } from '@signalwire/js'
+
+const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-sat-token',
+ debug: {
+ logWsTraffic: true // Optional: Enable WebSocket traffic logging
+ }
+})
+```
+
+## Core Concepts
+
+### Addresses
+Addresses are the fundamental routing mechanism in Call Fabric. They represent endpoints that can be dialed, such as:
+- Room addresses (e.g., `/public/my-room`)
+- User addresses
+- SIP endpoints
+- PSTN numbers
+
+### Channels
+Channels define the media type for a call:
+- `video` - Full audio/video call
+- `audio` - Audio-only call
+
+### Members
+Participants in a call, including:
+- Regular members (users)
+- Screen share members
+- Device members (future support)
+
+## API Reference
+
+### Client Methods
+
+#### `client.dial(options)`
+Initiates a new call.
+
+**Parameters:**
+```typescript
+interface DialOptions {
+ to: string // Address to dial (e.g., "/public/room-name?channel=video")
+ rootElement: HTMLElement // DOM element for video rendering
+ stopCameraWhileMuted?: boolean // Stop camera when video muted (default: false)
+ stopMicrophoneWhileMuted?: boolean // Stop mic when audio muted (default: false)
+}
+```
+
+**Returns:** `Promise`
+
+**Example:**
+```javascript
+const call = await client.dial({
+ to: '/public/my-room?channel=video',
+ rootElement: document.getElementById('rootElement'),
+ stopCameraWhileMuted: true
+})
+await call.start()
+```
+
+#### `client.reattach(options)`
+Reattaches to an existing call session after page reload.
+
+**Parameters:** Same as `dial()`
+
+**Returns:** `Promise`
+
+**Example:**
+```javascript
+// After page reload
+const call = await client.reattach({
+ to: '/public/my-room?channel=video',
+ rootElement: document.getElementById('rootElement')
+})
+await call.start()
+```
+
+### Address Management
+
+#### `client.address.getAddresses(params)`
+Retrieves multiple addresses with filtering and pagination.
+
+**Parameters:**
+```typescript
+interface GetAddressesParams {
+ type?: 'room' | 'user' | 'sip' | 'pstn'
+ sortBy?: 'name' | 'created_at'
+ sortOrder?: 'asc' | 'desc'
+ pageSize?: number
+ page?: number
+}
+```
+
+**Returns:**
+```typescript
+interface AddressesResponse {
+ addresses: Address[]
+ meta: {
+ total: number
+ page: number
+ pageSize: number
+ }
+}
+```
+
+#### `client.address.getAddress(params)`
+Retrieves a single address by ID or name.
+
+**Parameters:**
+```typescript
+interface GetAddressParams {
+ id?: string // Address ID
+ name?: string // Address name (mutually exclusive with id)
+}
+```
+
+#### `client.address.getMyAddresses()`
+Retrieves addresses owned by the current user.
+
+### Call Session Methods
+
+#### Audio Controls
+
+##### `call.audioMute(params?)`
+Mutes audio for self or other members.
+
+**Parameters:**
+```typescript
+interface MuteParams {
+ memberId?: string | 'all' // Target member ID or 'all'
+}
+```
+
+##### `call.audioUnmute(params?)`
+Unmutes audio for self or other members.
+
+##### `call.setInputVolume(params)`
+Sets microphone input volume.
+
+**Parameters:**
+```typescript
+interface VolumeParams {
+ volume: number // 0-100
+ memberId?: string // Target member ID
+}
+```
+
+##### `call.setOutputVolume(params)`
+Sets speaker output volume.
+
+##### `call.setInputSensitivity(params)`
+Sets microphone sensitivity (noise gate).
+
+**Parameters:**
+```typescript
+interface SensitivityParams {
+ value: number // 0-100
+ memberId?: string // Target member ID
+}
+```
+
+##### `call.setAudioFlags(params)`
+Configures audio processing options.
+
+**Parameters:**
+```typescript
+interface AudioFlagsParams {
+ autoGain?: boolean
+ echoCancellation?: boolean
+ noiseSuppression?: boolean
+ memberId?: string
+}
+```
+
+#### Video Controls
+
+##### `call.videoMute(params?)`
+Mutes video for self or other members.
+
+##### `call.videoUnmute(params?)`
+Unmutes video for self or other members.
+
+##### `call.startScreenShare(params?)`
+Starts screen sharing.
+
+**Parameters:**
+```typescript
+interface ScreenShareParams {
+ audio?: boolean // Include system audio
+ video?: boolean // Include video
+}
+```
+
+**Returns:** `Promise`
+
+#### Room Management
+
+##### `call.lock()`
+Locks the room to prevent new members from joining.
+
+##### `call.unlock()`
+Unlocks the room.
+
+##### `call.setLayout(params)`
+Changes the video layout.
+
+**Parameters:**
+```typescript
+interface LayoutParams {
+ name: string // Layout name (e.g., '3x3', 'grid-responsive', 'highlight-1-responsive')
+}
+```
+
+#### Call Control
+
+##### `call.hold()`
+Places the call on hold (stops receiving media).
+
+##### `call.unhold()`
+Resumes the call from hold.
+
+##### `call.hangup()`
+Ends the call and disconnects.
+
+#### Member Interaction
+
+##### `call.setRaisedHand(params?)`
+Raises or lowers hand for self or other members.
+
+**Parameters:**
+```typescript
+interface RaiseHandParams {
+ raised?: boolean // true to raise, false to lower
+ memberId?: string // Target member ID
+}
+```
+
+### Conversation/Messaging
+
+#### `client.conversation.subscribe(callback)`
+Subscribes to conversation events.
+
+**Parameters:**
+```typescript
+type ConversationCallback = (event: ConversationEvent) => void
+
+interface ConversationEvent {
+ subtype: 'chat' | 'system'
+ text: string
+ from_address_id: string
+ timestamp: number
+}
+```
+
+#### `client.conversation.join(params)`
+Joins a conversation group.
+
+**Parameters:**
+```typescript
+interface JoinConversationParams {
+ addressIds: string[]
+ from_address_id: string
+}
+```
+
+**Returns:**
+```typescript
+interface JoinResponse {
+ group_id: string
+ members: ConversationMember[]
+}
+```
+
+#### `client.conversation.sendMessage(params)`
+Sends a message to a conversation.
+
+**Parameters:**
+```typescript
+interface SendMessageParams {
+ group_id: string
+ text: string
+ from_address_id: string
+}
+```
+
+#### `client.conversation.getConversationMessages(params)`
+Retrieves conversation history.
+
+**Parameters:**
+```typescript
+interface GetMessagesParams {
+ group_id: string
+ limit?: number
+ before?: string // Message ID for pagination
+}
+```
+
+## Event System
+
+The SDK uses a hierarchical event system that provides both generic and specific event handlers.
+
+### Call Events
+
+#### `call.joined`
+Fired when successfully joined a call.
+
+```javascript
+call.on('call.joined', (params) => {
+ console.log('Call ID:', params.call_id)
+ console.log('Room Session:', params.room_session)
+ console.log('Members:', params.room_session.members)
+})
+```
+
+#### `call.left`
+Fired when leaving a call.
+
+```javascript
+call.on('call.left', (params) => {
+ console.log('Left call:', params.call_id)
+})
+```
+
+### Room Events
+
+#### `room.joined`
+Fired when successfully joined a room.
+
+```javascript
+call.on('room.joined', (params) => {
+ console.log('Room ID:', params.room_id)
+ console.log('Room Session ID:', params.room_session_id)
+})
+```
+
+#### `room.updated`
+Fired when room properties change.
+
+```javascript
+call.on('room.updated', (params) => {
+ if (params.room_session.locked !== undefined) {
+ console.log('Room locked state:', params.room_session.locked)
+ }
+})
+```
+
+### Member Events
+
+#### `member.joined`
+Fired when a new member joins.
+
+```javascript
+call.on('member.joined', (params) => {
+ const member = params.member
+ console.log(`${member.name} joined (${member.type})`)
+
+ if (member.type === 'screen') {
+ console.log('Screen share started')
+ }
+})
+```
+
+#### `member.left`
+Fired when a member leaves.
+
+```javascript
+call.on('member.left', (params) => {
+ console.log(`Member ${params.member.member_id} left`)
+})
+```
+
+#### `member.updated`
+Generic member update event.
+
+```javascript
+call.on('member.updated', (params) => {
+ const updates = params.member.updated // Array of changed fields
+ console.log(`Member ${params.member.member_id} updated:`, updates)
+})
+```
+
+#### Specific Member Update Events
+
+The SDK provides specific events for common member updates:
+
+```javascript
+// Audio mute state changed
+call.on('member.updated.audioMuted', (params) => {
+ const { member_id, audio_muted } = params.member
+ console.log(`Member ${member_id} audio muted: ${audio_muted}`)
+})
+
+// Video mute state changed
+call.on('member.updated.videoMuted', (params) => {
+ const { member_id, video_muted } = params.member
+ console.log(`Member ${member_id} video muted: ${video_muted}`)
+})
+
+// Hand raised state changed
+call.on('member.updated.handraised', (params) => {
+ const { member_id, handraised } = params.member
+ console.log(`Member ${member_id} hand raised: ${handraised}`)
+})
+
+// Visibility changed
+call.on('member.updated.visible', (params) => {
+ const { member_id, visible } = params.member
+ console.log(`Member ${member_id} visible: ${visible}`)
+})
+```
+
+### Layout Events
+
+#### `layout.changed`
+Fired when the room layout changes.
+
+```javascript
+call.on('layout.changed', (params) => {
+ console.log('New layout:', params.layout.name)
+ console.log('Positions:', params.layout.positions)
+})
+```
+
+## Code Examples
+
+### Complete Video Call Example
+
+```javascript
+import { SignalWire } from '@signalwire/js'
+
+async function startVideoCall() {
+ // Initialize client
+ const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-sat-token'
+ })
+
+ // Set up call
+ const call = await client.dial({
+ to: '/public/my-meeting-room?channel=video',
+ rootElement: document.getElementById('videoContainer'),
+ stopCameraWhileMuted: true
+ })
+
+ // Set up event handlers
+ call.on('call.joined', (params) => {
+ console.log('Joined call with', params.room_session.members.length, 'members')
+ updateMemberList(params.room_session.members)
+ })
+
+ call.on('member.joined', (params) => {
+ console.log(`${params.member.name} joined`)
+ addMemberToList(params.member)
+ })
+
+ call.on('member.left', (params) => {
+ console.log(`${params.member.name} left`)
+ removeMemberFromList(params.member.member_id)
+ })
+
+ call.on('member.updated.audioMuted', (params) => {
+ updateMemberAudioState(params.member.member_id, params.member.audio_muted)
+ })
+
+ // Start the call
+ await call.start()
+
+ // Set up UI controls
+ document.getElementById('muteButton').onclick = async () => {
+ await call.audioMute()
+ }
+
+ document.getElementById('videoButton').onclick = async () => {
+ await call.videoMute()
+ }
+
+ document.getElementById('shareButton').onclick = async () => {
+ const screenShare = await call.startScreenShare({ audio: true })
+
+ screenShare.on('room.left', () => {
+ console.log('Screen share ended')
+ })
+ }
+
+ return call
+}
+
+// Start the call when page loads
+window.addEventListener('load', startVideoCall)
+```
+
+### Audio-Only Call with Controls
+
+```javascript
+async function startAudioCall() {
+ const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-sat-token'
+ })
+
+ const call = await client.dial({
+ to: '/public/audio-conference?channel=audio',
+ rootElement: document.getElementById('audioContainer')
+ })
+
+ // Configure audio processing
+ await call.setAudioFlags({
+ autoGain: true,
+ echoCancellation: true,
+ noiseSuppression: true
+ })
+
+ // Set initial volume
+ await call.setInputVolume({ volume: 80 })
+ await call.setOutputVolume({ volume: 90 })
+
+ await call.start()
+
+ return call
+}
+```
+
+### Call with Reattachment Support
+
+```javascript
+// Store call info in session storage
+function storeCallInfo(to) {
+ sessionStorage.setItem('activeCall', JSON.stringify({ to }))
+}
+
+function getStoredCallInfo() {
+ const stored = sessionStorage.getItem('activeCall')
+ return stored ? JSON.parse(stored) : null
+}
+
+async function initializeCall() {
+ const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-sat-token'
+ })
+
+ const callInfo = getStoredCallInfo()
+ let call
+
+ if (callInfo) {
+ // Try to reattach to existing call
+ try {
+ call = await client.reattach({
+ to: callInfo.to,
+ rootElement: document.getElementById('videoContainer')
+ })
+ console.log('Reattached to existing call')
+ } catch (e) {
+ console.log('No active call to reattach to')
+ sessionStorage.removeItem('activeCall')
+ }
+ }
+
+ if (!call) {
+ // Start new call
+ const to = '/public/persistent-room?channel=video'
+ call = await client.dial({
+ to,
+ rootElement: document.getElementById('videoContainer')
+ })
+ storeCallInfo(to)
+ }
+
+ call.on('call.left', () => {
+ sessionStorage.removeItem('activeCall')
+ })
+
+ await call.start()
+ return call
+}
+```
+
+### Messaging Integration
+
+```javascript
+async function setupMessaging() {
+ const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-sat-token'
+ })
+
+ // Get user's addresses
+ const myAddresses = await client.address.getMyAddresses()
+ const myAddress = myAddresses.addresses[0]
+
+ // Subscribe to messages
+ client.conversation.subscribe((event) => {
+ if (event.subtype === 'chat') {
+ displayMessage({
+ text: event.text,
+ from: event.from_address_id,
+ timestamp: new Date(event.timestamp)
+ })
+ }
+ })
+
+ // Join conversation with other users
+ const otherAddresses = ['address_id_1', 'address_id_2']
+ const conversation = await client.conversation.join({
+ addressIds: otherAddresses,
+ from_address_id: myAddress.id
+ })
+
+ // Send message function
+ window.sendMessage = async (text) => {
+ await client.conversation.sendMessage({
+ group_id: conversation.group_id,
+ text: text,
+ from_address_id: myAddress.id
+ })
+ }
+
+ // Load conversation history
+ const history = await client.conversation.getConversationMessages({
+ group_id: conversation.group_id,
+ limit: 50
+ })
+
+ history.messages.forEach(msg => displayMessage(msg))
+}
+```
+
+## Best Practices
+
+### 1. Error Handling
+
+Always wrap async operations in try-catch blocks:
+
+```javascript
+try {
+ const call = await client.dial({ ... })
+ await call.start()
+} catch (error) {
+ console.error('Failed to start call:', error)
+ // Show user-friendly error message
+}
+```
+
+### 2. Event Cleanup
+
+Remove event listeners when done:
+
+```javascript
+const handler = (params) => console.log(params)
+call.on('member.joined', handler)
+
+// Later...
+call.off('member.joined', handler)
+```
+
+### 3. State Management
+
+Track important state locally:
+
+```javascript
+const callState = {
+ members: new Map(),
+ audioMuted: false,
+ videoMuted: false,
+ isLocked: false
+}
+
+call.on('call.joined', (params) => {
+ params.room_session.members.forEach(member => {
+ callState.members.set(member.member_id, member)
+ })
+})
+
+call.on('member.updated', (params) => {
+ const member = callState.members.get(params.member.member_id)
+ if (member) {
+ Object.assign(member, params.member)
+ }
+})
+```
+
+### 4. Device Permissions
+
+Request permissions before starting calls:
+
+```javascript
+async function checkPermissions() {
+ try {
+ const stream = await navigator.mediaDevices.getUserMedia({
+ audio: true,
+ video: true
+ })
+ // Clean up test stream
+ stream.getTracks().forEach(track => track.stop())
+ return true
+ } catch (error) {
+ console.error('Permission denied:', error)
+ return false
+ }
+}
+
+// Check before dialing
+if (await checkPermissions()) {
+ const call = await client.dial({ ... })
+}
+```
+
+### 5. Network Resilience
+
+Handle connection issues gracefully:
+
+```javascript
+call.on('connection.disconnected', () => {
+ showReconnectingUI()
+})
+
+call.on('connection.connected', () => {
+ hideReconnectingUI()
+})
+
+// Consider implementing exponential backoff for reconnection
+```
+
+### 6. Resource Cleanup
+
+Always clean up resources:
+
+```javascript
+window.addEventListener('beforeunload', async () => {
+ if (call) {
+ await call.hangup()
+ }
+})
+```
+
+## Troubleshooting
+
+### Common Issues
+
+1. **No audio/video**
+ - Check browser permissions
+ - Verify device is not in use by another application
+ - Check mute states
+
+2. **Cannot join room**
+ - Verify address exists and is accessible
+ - Check authentication token
+ - Ensure room is not locked
+
+3. **Poor quality**
+ - Check network bandwidth
+ - Reduce video resolution
+ - Enable audio processing flags
+
+### Debug Mode
+
+Enable debug logging for troubleshooting:
+
+```javascript
+const client = await SignalWire({
+ host: 'your-space.signalwire.com',
+ token: 'your-token',
+ debug: {
+ logWsTraffic: true
+ }
+})
+```
+
+## Conclusion
+
+The SignalWire Call Fabric SDK provides a comprehensive platform for building real-time communication applications. With its flexible API, robust event system, and advanced features, developers can create sophisticated video conferencing, audio calling, and messaging solutions tailored to their specific needs.
diff --git a/packages/client/src/fabric/workers/callSegmentWorker.ts b/packages/client/src/fabric/workers/callSegmentWorker.ts
index 0d8c30ff3..8e6aa9710 100644
--- a/packages/client/src/fabric/workers/callSegmentWorker.ts
+++ b/packages/client/src/fabric/workers/callSegmentWorker.ts
@@ -1,11 +1,17 @@
import {
CallJoinedEvent,
+ MapToPubSubShape,
SDKActions,
SagaIterator,
getLogger,
sagaEffects,
} from '@signalwire/core'
-import { CallAction } from '../../utils/interfaces/fabric'
+import {
+ CallAction,
+ CallMemberJoinedEvent,
+ CallMemberLeftEvent,
+ CallMemberUpdatedEvent,
+} from '../../utils/interfaces/fabric'
import { callLeftWorker } from './callLeftWorker'
import { callJoinWorker } from './callJoinWorker'
import { FabricWorkerParams } from './fabricWorker'
@@ -83,16 +89,25 @@ export const callSegmentWorker = function* (
case 'member.left': {
yield sagaEffects.fork(fabricMemberWorker, {
...options,
- action,
+ // TS is complaining {[x: string]: {}} in assignable to Record
+ action: action as unknown as MapToPubSubShape<
+ CallMemberJoinedEvent | CallMemberLeftEvent
+ >,
})
- const videoAction =
- mapFabricMemberActionToVideoMemberJoinAndLeftAction(action)
+ const videoAction = mapFabricMemberActionToVideoMemberJoinAndLeftAction(
+ // TS is complaining {[x: string]: {}} in assignable to Record
+ action as unknown as MapToPubSubShape<
+ CallMemberJoinedEvent | CallMemberLeftEvent
+ >
+ )
yield sagaEffects.put(swEventChannel, videoAction)
break
}
case 'member.updated': {
- const videoAction =
- mapFabricMemberActionToVideoMemberUpdatedAction(action)
+ const videoAction = mapFabricMemberActionToVideoMemberUpdatedAction(
+ // TS is complaining {[x: string]: {}} in assignable to Record
+ action as unknown as MapToPubSubShape
+ )
yield sagaEffects.put(swEventChannel, videoAction)
break
}
diff --git a/packages/client/src/fabric/workers/fabricWorker.ts b/packages/client/src/fabric/workers/fabricWorker.ts
index 34e89b50a..6fc9c3525 100644
--- a/packages/client/src/fabric/workers/fabricWorker.ts
+++ b/packages/client/src/fabric/workers/fabricWorker.ts
@@ -7,13 +7,14 @@ import {
SDKActions,
MapToPubSubShape,
} from '@signalwire/core'
-import { CallAction } from '../../utils/interfaces'
+import { CallAction, InternalCallMemberEntityUpdated } from '../../utils/interfaces'
import { CallSessionConnection } from '../CallSession'
import { createCallSessionMemberObject } from '../CallSessionMember'
import { callSegmentWorker } from './callSegmentWorker'
+import { ShallowCompute } from '../../utils/typeUtils'
export type FabricWorkerParams = SDKWorkerParams & {
- action: MapToPubSubShape
+ action: ShallowCompute>
}
export const fabricWorker: SDKWorker = function* (
@@ -33,13 +34,13 @@ export const fabricWorker: SDKWorker = function* (
// since we depend on `cfRoomSession.selfMember` on the take logic
// we need to make sure we update the `cfRoomSession.selfMember`
// in this worker or have a race condition.
- if (!cfRoomSession.selfMember) {
+ if (!cfRoomSession.selfMember) {
const memberInstance = createCallSessionMemberObject({
store: cfRoomSession.store,
payload: {
member: action.payload.room_session.members.find(
(m) => m.member_id === action.payload.member_id
- )!,
+ )! as InternalCallMemberEntityUpdated,
room_id: action.payload.room_id,
room_session_id: action.payload.room_session_id,
},
diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts
index 5938e30a3..a8b029a77 100644
--- a/packages/client/src/index.ts
+++ b/packages/client/src/index.ts
@@ -4,126 +4,126 @@
*/
import {
- Prettify,
- BaseComponentOptions,
- BaseConnectionState,
- ClientEvents,
- EmitterContract,
- RTCTrackEventName,
- UserOptions,
- SessionStatus,
- SessionEvents,
- VideoLayout,
- InternalVideoLayout,
- VideoPosition,
- VideoPositions,
- CallUpdatedEventParams,
- CallLeftEventParams,
- CallStateEventParams,
- CallPlayEventParams,
- CallConnectEventParams,
- CallRoomEventParams,
- ConversationMessageEventName,
- ConversationMessageEvent,
- ConversationEventParams,
- ConversationEvent,
+ BaseComponentOptions as CoreBaseComponentOptions,
+ BaseConnectionState as CoreBaseConnectionState,
+ ClientEvents as CoreClientEvents,
+ EmitterContract as CoreEmitterContract,
+ RTCTrackEventName as CoreRTCTrackEventName,
+ UserOptions as CoreUserOptions,
+ SessionStatus as CoreSessionStatus,
+ SessionEvents as CoreSessionEvents,
+ VideoLayout as CoreVideoLayout,
+ InternalVideoLayout as CoreInternalVideoLayout,
+ VideoPosition as CoreVideoPosition,
+ VideoPositions as CoreVideoPositions,
+ CallUpdatedEventParams as CoreCallUpdatedEventParams,
+ CallLeftEventParams as CoreCallLeftEventParams,
+ CallStateEventParams as CoreCallStateEventParams,
+ CallPlayEventParams as CoreCallPlayEventParams,
+ CallConnectEventParams as CoreCallConnectEventParams,
+ CallRoomEventParams as CoreCallRoomEventParams,
+ ConversationMessageEventName as CoreConversationMessageEventName,
+ ConversationMessageEvent as CoreConversationMessageEvent,
+ ConversationEventParams as CoreConversationEventParams,
+ ConversationEvent as CoreConversationEvent,
EventEmitter,
- SetAudioFlagsParams,
+ SetAudioFlagsParams as CoreSetAudioFlagsParams,
} from '@signalwire/core'
+import { ShallowCompute, DeepCompute } from './utils/typeUtils'
import {
// FIXME: Importing from the core package
CallRoomEventParams as FabricCallRoomEventParams,
- CallLayoutChangedEventParams,
- CallMemberJoinedEventParams,
- CallMemberUpdatedEventParams,
- CallMemberLeftEventParams,
- CallMemberTalkingEventParams,
- CallMemberEventParams,
- CallMemberEntity,
- InternalCallMemberEntity,
+ CallLayoutChangedEventParams as FabricCallLayoutChangedEventParams,
+ CallMemberJoinedEventParams as FabricCallMemberJoinedEventParams,
+ CallMemberUpdatedEventParams as FabricCallMemberUpdatedEventParams,
+ CallMemberLeftEventParams as FabricCallMemberLeftEventParams,
+ CallMemberTalkingEventParams as FabricCallMemberTalkingEventParams,
+ CallMemberEventParams as FabricCallMemberEventParams,
+ CallMemberEntity as FabricCallMemberEntity,
+ InternalCallMemberEntity as FabricInternalCallMemberEntity,
} from './utils/interfaces/fabric'
import {
- BaseConnectionOptions,
- ConnectionOptions,
- MicrophoneAnalyzer,
+ BaseConnectionOptions as WebRTCBaseConnectionOptions,
+ ConnectionOptions as WebRTCConnectionOptions,
+ MicrophoneAnalyzer as WebRTCMicrophoneAnalyzer,
} from '@signalwire/webrtc'
import {
- CallJoinedEventParams,
- RoomSessionObjectEventsHandlerMap,
- RoomSessionObjectEvents,
- RoomEventNames,
- StartScreenShareOptions,
+ CallJoinedEventParams as LocalCallJoinedEventParams,
+ RoomSessionObjectEventsHandlerMap as LocalRoomSessionObjectEventsHandlerMap,
+ RoomSessionObjectEvents as LocalRoomSessionObjectEvents,
+ RoomEventNames as LocalRoomEventNames,
+ StartScreenShareOptions as LocalStartScreenShareOptions,
} from './utils/interfaces'
import {
// From interfaces/address.ts
- ResourceType,
- GetAddressResponse,
- Address,
- GetAddressesParams,
- GetAddressByIdParams,
- GetAddressByNameParams,
- GetAddressParams,
- GetAddressResult,
- GetAddressesResponse,
- GetAddressesResult,
+ ResourceType as FabricResourceType,
+ GetAddressResponse as FabricGetAddressResponse,
+ Address as FabricAddress,
+ GetAddressesParams as FabricGetAddressesParams,
+ GetAddressByIdParams as FabricGetAddressByIdParams,
+ GetAddressByNameParams as FabricGetAddressByNameParams,
+ GetAddressParams as FabricGetAddressParams,
+ GetAddressResult as FabricGetAddressResult,
+ GetAddressesResponse as FabricGetAddressesResponse,
+ GetAddressesResult as FabricGetAddressesResult,
// From interfaces/capabilities.ts
- CapabilityOnOffStateContract,
- MemberCapabilityContract,
- CallCapabilitiesContract,
+ CapabilityOnOffStateContract as FabricCapabilityOnOffStateContract,
+ MemberCapabilityContract as FabricMemberCapabilityContract,
+ CallCapabilitiesContract as FabricCallCapabilitiesContract,
// From interfaces/conversation.ts
- ConversationContract,
- SendConversationMessageParams,
- SendConversationMessageResponse,
- SendConversationMessageResult,
- GetConversationsParams,
- ConversationResponse,
- GetConversationsResponse,
- GetConversationsResult,
- ConversationSubscribeCallback,
- ConversationSubscribeResult,
- ConversationChatMessagesSubscribeParams,
- ConversationChatMessagesSubscribeResult,
- JoinConversationParams,
- JoinConversationResponse,
- JoinConversationResult,
- GetMessagesParams,
- ConversationMessage,
- GetMessagesResult,
- ConversationChatMessage,
- GetConversationChatMessageParams,
- GetConversationChatMessageResult,
- GetConversationMessagesResponse,
- GetConversationMessagesParams,
- GetConversationMessagesResult,
- ConversationAPISendMessageParams,
- ConversationAPIGetMessagesParams,
+ ConversationContract as FabricConversationContract,
+ SendConversationMessageParams as FabricSendConversationMessageParams,
+ SendConversationMessageResponse as FabricSendConversationMessageResponse,
+ SendConversationMessageResult as FabricSendConversationMessageResult,
+ GetConversationsParams as FabricGetConversationsParams,
+ ConversationResponse as FabricConversationResponse,
+ GetConversationsResponse as FabricGetConversationsResponse,
+ GetConversationsResult as FabricGetConversationsResult,
+ ConversationSubscribeCallback as FabricConversationSubscribeCallback,
+ ConversationSubscribeResult as FabricConversationSubscribeResult,
+ ConversationChatMessagesSubscribeParams as FabricConversationChatMessagesSubscribeParams,
+ ConversationChatMessagesSubscribeResult as FabricConversationChatMessagesSubscribeResult,
+ JoinConversationParams as FabricJoinConversationParams,
+ JoinConversationResponse as FabricJoinConversationResponse,
+ JoinConversationResult as FabricJoinConversationResult,
+ GetMessagesParams as FabricGetMessagesParams,
+ ConversationMessage as FabricConversationMessage,
+ GetMessagesResult as FabricGetMessagesResult,
+ ConversationChatMessage as FabricConversationChatMessage,
+ GetConversationChatMessageParams as FabricGetConversationChatMessageParams,
+ GetConversationChatMessageResult as FabricGetConversationChatMessageResult,
+ GetConversationMessagesResponse as FabricGetConversationMessagesResponse,
+ GetConversationMessagesParams as FabricGetConversationMessagesParams,
+ GetConversationMessagesResult as FabricGetConversationMessagesResult,
+ ConversationAPISendMessageParams as FabricConversationAPISendMessageParams,
+ ConversationAPIGetMessagesParams as FabricConversationAPIGetMessagesParams,
// From interfaces/device.ts
- RegisterDeviceType,
- RegisterDeviceParams,
- UnregisterDeviceParams,
- RegisterDeviceResponse,
- RegisterDeviceResult,
+ RegisterDeviceType as FabricRegisterDeviceType,
+ RegisterDeviceParams as FabricRegisterDeviceParams,
+ UnregisterDeviceParams as FabricUnregisterDeviceParams,
+ RegisterDeviceResponse as FabricRegisterDeviceResponse,
+ RegisterDeviceResult as FabricRegisterDeviceResult,
// From interfaces/incomingCallManager.ts
- IncomingInviteSource,
- IncomingInvite,
- IncomingInviteWithSource,
- IncomingCallNotification,
- IncomingCallHandler,
- IncomingCallHandlers,
+ IncomingInviteSource as FabricIncomingInviteSource,
+ IncomingInvite as FabricIncomingInvite,
+ IncomingInviteWithSource as FabricIncomingInviteWithSource,
+ IncomingCallNotification as FabricIncomingCallNotification,
+ IncomingCallHandler as FabricIncomingCallHandler,
+ IncomingCallHandlers as FabricIncomingCallHandlers,
// From interfaces/wsClient.ts
- OnlineParams,
- HandlePushNotificationParams,
- HandlePushNotificationResult,
- DialParams,
- ReattachParams,
+ OnlineParams as FabricOnlineParams,
+ HandlePushNotificationParams as FabricHandlePushNotificationParams,
+ HandlePushNotificationResult as FabricHandlePushNotificationResult,
+ DialParams as FabricDialParams,
+ ReattachParams as FabricReattachParams,
// From interfaces/index.ts
- SignalWireClient,
- SignalWireContract,
- SignalWireClientParams,
- GetSubscriberInfoResponse,
- GetSubscriberInfoResult,
- PaginatedResponse,
- PaginatedResult,
+ SignalWireClient as FabricSignalWireClient,
+ SignalWireContract as FabricSignalWireContract,
+ SignalWireClientParams as FabricSignalWireClientParams,
+ GetSubscriberInfoResponse as FabricGetSubscriberInfoResponse,
+ GetSubscriberInfoResult as FabricGetSubscriberInfoResult,
+ PaginatedResponse as FabricPaginatedResponse,
+ PaginatedResult as FabricPaginatedResult,
} from './fabric'
/**
@@ -146,277 +146,135 @@ export { RoomSessionDevice } from './RoomSessionDevice'
*/
export * as WebRTC from './webrtc'
-type ExternalFabricRoomEventParams = Prettify
-type ExternalBaseComponentOptions = Prettify
-type ExternalBaseConnectionState = Prettify
-type ExternalClientEvents = Prettify
-type ExternalEmitterContract =
- Prettify>
-type ExternalRTCTrackEventName = Prettify
-type ExternalUserOptions = Prettify
-type ExternalSessionStatus = Prettify
-type ExternalSessionEvents = Prettify
-type ExternalVideoLayout = Prettify
-type ExternalInternalVideoLayout = Prettify
-type ExternalVideoPosition = Prettify
-type ExternalVideoPositions = Prettify
-type ExternalCallUpdatedEventParams = Prettify
-type ExternalCallLeftEventParams = Prettify
-type ExternalCallStateEventParams = Prettify
-type ExternalCallPlayEventParams = Prettify
-type ExternalCallConnectEventParams = Prettify
-type ExternalCallRoomEventParams = Prettify
-type ExternalFabricLayoutChangedEventParams =
- Prettify
-type ExternalFabricMemberJoinedEventParams =
- Prettify
-type ExternalFabricMemberUpdatedEventParams =
- Prettify
-type ExternalFabricMemberLeftEventParams = Prettify
-type ExternalFabricMemberTalkingEventParams =
- Prettify
-type ExternalFabricMemberEventParams = Prettify
-type ExternalFabricMemberEntity = Prettify
-type ExternalInternalFabricMemberEntity = Prettify
-type ExternalConversationMessageEventName =
- Prettify
-type ExternalConversationMessageEvent = Prettify
-type ExternalConversationEventParams = Prettify
-type ExternalConversationEvent = Prettify
-type ExternalSetAudioFlagsParams = Prettify
+// Core types exports
+export type BaseComponentOptions = DeepCompute
+export type BaseConnectionState = DeepCompute
+export type ClientEvents = DeepCompute
+export type EmitterContract = ShallowCompute>
+export type RTCTrackEventName = DeepCompute
+export type UserOptions = DeepCompute
+export type SessionStatus = DeepCompute
+export type SessionEvents = DeepCompute
+export type VideoLayout = DeepCompute
+export type InternalVideoLayout = DeepCompute
+export type VideoPosition = DeepCompute
+export type VideoPositions = DeepCompute
+
+/**
+ * Call Fabric types
+ */
+export type CallUpdatedEventParams = DeepCompute
+export type CallLeftEventParams = DeepCompute
+export type CallStateEventParams = DeepCompute
+export type CallPlayEventParams = DeepCompute
+export type CallConnectEventParams = DeepCompute
+export type CallRoomEventParams = DeepCompute
+export type CallLayoutChangedEventParams = DeepCompute
+export type CallMemberJoinedEventParams = DeepCompute
+export type CallMemberUpdatedEventParams = DeepCompute
+export type CallMemberLeftEventParams = DeepCompute
+export type CallMemberTalkingEventParams = DeepCompute
+export type CallMemberEventParams = DeepCompute
+export type CallMemberEntity = DeepCompute
+export type InternalCallMemberEntity = DeepCompute
+export type ConversationMessageEventName = DeepCompute
+export type ConversationMessageEvent = DeepCompute
+export type ConversationEventParams = DeepCompute
+export type ConversationEvent = DeepCompute
+export type CallEventParams = DeepCompute
+export type SetAudioFlagsParams = DeepCompute
// WebRTC types
-type ExternalBaseConnectionOptions = Prettify
-type ExternalConnectionOptions = Prettify
-type ExternalMicrophoneAnalyzer = Prettify
+export type BaseConnectionOptions = DeepCompute
+export type ConnectionOptions = DeepCompute
+export type MicrophoneAnalyzer = DeepCompute
// Local interface types
-type ExternalCallJoinedEventParams = Prettify
-type ExternalRoomSessionObjectEventsHandlerMap =
- Prettify
-type ExternalRoomSessionObjectEvents = Prettify
-type ExternalRoomEventNames = Prettify
-type ExternalStartScreenShareOptions = Prettify
-
-// Fabric types - Address
-type ExternalResourceType = Prettify
-type ExternalGetAddressResponse = Prettify
-type ExternalAddress = Prettify
-type ExternalGetAddressesParams = Prettify
-type ExternalGetAddressByIdParams = Prettify
-type ExternalGetAddressByNameParams = Prettify
-type ExternalGetAddressParams = Prettify
-type ExternalGetAddressResult = Prettify
-type ExternalGetAddressesResponse = Prettify
-type ExternalGetAddressesResult = Prettify
-
-// Fabric types - Capabilities
-type ExternalCapabilityOnOffStateContract =
- Prettify
-type ExternalMemberCapabilityContract = Prettify
-type ExternalCallCapabilitiesContract = Prettify
-
-// Fabric types - Conversation
-type ExternalConversationContract = Prettify
-type ExternalSendConversationMessageParams =
- Prettify
-type ExternalSendConversationMessageResponse =
- Prettify
-type ExternalSendConversationMessageResult =
- Prettify
-type ExternalGetConversationsParams = Prettify
-type ExternalConversationResponse = Prettify
-type ExternalGetConversationsResponse = Prettify
-type ExternalGetConversationsResult = Prettify
-type ExternalConversationSubscribeCallback =
- Prettify
-type ExternalConversationSubscribeResult = Prettify
-type ExternalConversationChatMessagesSubscribeParams =
- Prettify
-type ExternalConversationChatMessagesSubscribeResult =
- Prettify
-type ExternalJoinConversationParams = Prettify
-type ExternalJoinConversationResponse = Prettify
-type ExternalJoinConversationResult = Prettify
-type ExternalGetMessagesParams = Prettify
-type ExternalConversationMessage = Prettify
-type ExternalGetMessagesResult = Prettify
-type ExternalConversationChatMessage = Prettify
-type ExternalGetConversationChatMessageParams =
- Prettify
-type ExternalGetConversationChatMessageResult =
- Prettify
-type ExternalGetConversationMessagesResponse =
- Prettify
-type ExternalGetConversationMessagesParams =
- Prettify
-type ExternalGetConversationMessagesResult =
- Prettify
-type ExternalConversationAPISendMessageParams =
- Prettify
-type ExternalConversationAPIGetMessagesParams =
- Prettify
-
-// Fabric types - Device
-type ExternalRegisterDeviceType = Prettify
-type ExternalRegisterDeviceParams = Prettify
-type ExternalUnregisterDeviceParams = Prettify
-type ExternalRegisterDeviceResponse = Prettify
-type ExternalRegisterDeviceResult = Prettify
+export type CallJoinedEventParams = DeepCompute
+export type RoomSessionObjectEventsHandlerMap = DeepCompute
+export type RoomSessionObjectEvents = DeepCompute
+export type RoomEventNames = DeepCompute
+export type StartScreenShareOptions = DeepCompute
-// Fabric types - IncomingCallManager
-type ExternalIncomingInviteSource = Prettify
-type ExternalIncomingInvite = Prettify
-type ExternalIncomingInviteWithSource = Prettify
-type ExternalIncomingCallNotification = Prettify
-type ExternalIncomingCallHandler = Prettify
-type ExternalIncomingCallHandlers = Prettify
+// Export fabric types
+// Address types
+export type ResourceType = DeepCompute
+export type GetAddressResponse = DeepCompute
+export type Address = DeepCompute
+export type GetAddressesParams = DeepCompute
+export type GetAddressByIdParams = DeepCompute
+export type GetAddressByNameParams = DeepCompute
+export type GetAddressParams = DeepCompute
+export type GetAddressResult = DeepCompute
+export type GetAddressesResponse = DeepCompute
+export type GetAddressesResult = DeepCompute
-// Fabric types - WSClient
-type ExternalOnlineParams = Prettify
-type ExternalHandlePushNotificationParams =
- Prettify
-type ExternalHandlePushNotificationResult =
- Prettify
-type ExternalDialParams = Prettify
-type ExternalReattachParams = Prettify
+// Capabilities types
+export type CapabilityOnOffStateContract = DeepCompute
+export type MemberCapabilityContract = ShallowCompute
+export type CallCapabilitiesContract = ShallowCompute
-// Fabric types - Main interfaces
-type ExternalSignalWireClient = Prettify
-type ExternalSignalWireContract = Prettify
-type ExternalSignalWireClientParams = Prettify
-type ExternalGetSubscriberInfoResponse = Prettify
-type ExternalGetSubscriberInfoResult = Prettify
-type ExternalPaginatedResponse = Prettify>
-type ExternalPaginatedResult = Prettify>
+// Conversation types
+export type ConversationContract = ShallowCompute
+export type SendConversationMessageParams = DeepCompute
+export type SendConversationMessageResponse = DeepCompute
+export type SendConversationMessageResult = DeepCompute
+export type GetConversationsParams = DeepCompute
+export type ConversationResponse = DeepCompute
+export type GetConversationsResponse = DeepCompute
+export type GetConversationsResult = DeepCompute
+export type ConversationSubscribeCallback = ShallowCompute
+export type ConversationSubscribeResult = DeepCompute
+export type ConversationChatMessagesSubscribeParams = DeepCompute
+export type ConversationChatMessagesSubscribeResult = DeepCompute
+export type JoinConversationParams = DeepCompute
+export type JoinConversationResponse = DeepCompute
+export type JoinConversationResult = DeepCompute
+export type GetMessagesParams = DeepCompute
+export type ConversationMessage = DeepCompute
+export type GetMessagesResult = DeepCompute
+export type ConversationChatMessage = DeepCompute
+export type GetConversationChatMessageParams = DeepCompute
+export type GetConversationChatMessageResult = DeepCompute
+export type GetConversationMessagesResponse = DeepCompute
+export type GetConversationMessagesParams = DeepCompute
+export type GetConversationMessagesResult = DeepCompute
+export type ConversationAPISendMessageParams = DeepCompute
+export type ConversationAPIGetMessagesParams = DeepCompute
-export {
- ExternalBaseComponentOptions as BaseComponentOptions,
- ExternalBaseConnectionState as BaseConnectionState,
- ExternalClientEvents as ClientEvents,
- ExternalEmitterContract as EmitterContract,
- ExternalRTCTrackEventName as RTCTrackEventName,
- ExternalUserOptions as UserOptions,
- ExternalSessionStatus as SessionStatus,
- ExternalSessionEvents as SessionEvents,
- ExternalVideoLayout as VideoLayout,
- ExternalInternalVideoLayout as InternalVideoLayout,
- ExternalVideoPosition as VideoPosition,
- ExternalVideoPositions as VideoPositions,
- /**
- * Call Fabric types
- */
- ExternalCallUpdatedEventParams as CallUpdatedEventParams,
- ExternalCallLeftEventParams as CallLeftEventParams,
- ExternalCallStateEventParams as CallStateEventParams,
- ExternalCallPlayEventParams as CallPlayEventParams,
- ExternalCallConnectEventParams as CallConnectEventParams,
- ExternalCallRoomEventParams as CallRoomEventParams,
- ExternalFabricLayoutChangedEventParams as CallLayoutChangedEventParams,
- ExternalFabricMemberJoinedEventParams as CallMemberJoinedEventParams,
- ExternalFabricMemberUpdatedEventParams as CallMemberUpdatedEventParams,
- ExternalFabricMemberLeftEventParams as CallMemberLeftEventParams,
- ExternalFabricMemberTalkingEventParams as CallMemberTalkingEventParams,
- ExternalFabricMemberEventParams as CallMemberEventParams,
- ExternalFabricMemberEntity as CallMemberEntity,
- ExternalInternalFabricMemberEntity as InternalCallMemberEntity,
- ExternalConversationMessageEventName as ConversationMessageEventName,
- ExternalConversationMessageEvent as ConversationMessageEvent,
- ExternalConversationEventParams as ConversationEventParams,
- ExternalConversationEvent as ConversationEvent,
- ExternalFabricRoomEventParams as CallEventParams,
- ExternalSetAudioFlagsParams as SetAudioFlagsParams,
-}
+// Device types
+export type RegisterDeviceType = DeepCompute
+export type RegisterDeviceParams = DeepCompute
+export type UnregisterDeviceParams = DeepCompute
+export type RegisterDeviceResponse = DeepCompute
+export type RegisterDeviceResult = DeepCompute
-export {
- ExternalBaseConnectionOptions as BaseConnectionOptions,
- ExternalConnectionOptions as ConnectionOptions,
- ExternalMicrophoneAnalyzer as MicrophoneAnalyzer,
-}
+// IncomingCallManager types
+export type IncomingInviteSource = DeepCompute
+export type IncomingInvite = DeepCompute
+export type IncomingInviteWithSource = DeepCompute
+export type IncomingCallNotification = DeepCompute
+export type IncomingCallHandler = ShallowCompute
+export type IncomingCallHandlers = ShallowCompute
-export {
- ExternalCallJoinedEventParams as CallJoinedEventParams,
- ExternalRoomSessionObjectEventsHandlerMap as RoomSessionObjectEventsHandlerMap,
- ExternalRoomSessionObjectEvents as RoomSessionObjectEvents,
- ExternalRoomEventNames as RoomEventNames,
- ExternalStartScreenShareOptions as StartScreenShareOptions,
-}
+// WSClient types
+export type OnlineParams = DeepCompute
+export type HandlePushNotificationParams = DeepCompute
+export type HandlePushNotificationResult = DeepCompute
+export type DialParams = DeepCompute
+export type ReattachParams = DeepCompute
-// Export prettified fabric types
-export {
- // Address types
- ExternalResourceType as ResourceType,
- ExternalGetAddressResponse as GetAddressResponse,
- ExternalAddress as Address,
- ExternalGetAddressesParams as GetAddressesParams,
- ExternalGetAddressByIdParams as GetAddressByIdParams,
- ExternalGetAddressByNameParams as GetAddressByNameParams,
- ExternalGetAddressParams as GetAddressParams,
- ExternalGetAddressResult as GetAddressResult,
- ExternalGetAddressesResponse as GetAddressesResponse,
- ExternalGetAddressesResult as GetAddressesResult,
- // Capabilities types
- ExternalCapabilityOnOffStateContract as CapabilityOnOffStateContract,
- ExternalMemberCapabilityContract as MemberCapabilityContract,
- ExternalCallCapabilitiesContract as CallCapabilitiesContract,
- // Conversation types
- ExternalConversationContract as ConversationContract,
- ExternalSendConversationMessageParams as SendConversationMessageParams,
- ExternalSendConversationMessageResponse as SendConversationMessageResponse,
- ExternalSendConversationMessageResult as SendConversationMessageResult,
- ExternalGetConversationsParams as GetConversationsParams,
- ExternalConversationResponse as ConversationResponse,
- ExternalGetConversationsResponse as GetConversationsResponse,
- ExternalGetConversationsResult as GetConversationsResult,
- ExternalConversationSubscribeCallback as ConversationSubscribeCallback,
- ExternalConversationSubscribeResult as ConversationSubscribeResult,
- ExternalConversationChatMessagesSubscribeParams as ConversationChatMessagesSubscribeParams,
- ExternalConversationChatMessagesSubscribeResult as ConversationChatMessagesSubscribeResult,
- ExternalJoinConversationParams as JoinConversationParams,
- ExternalJoinConversationResponse as JoinConversationResponse,
- ExternalJoinConversationResult as JoinConversationResult,
- ExternalGetMessagesParams as GetMessagesParams,
- ExternalConversationMessage as ConversationMessage,
- ExternalGetMessagesResult as GetMessagesResult,
- ExternalConversationChatMessage as ConversationChatMessage,
- ExternalGetConversationChatMessageParams as GetConversationChatMessageParams,
- ExternalGetConversationChatMessageResult as GetConversationChatMessageResult,
- ExternalGetConversationMessagesResponse as GetConversationMessagesResponse,
- ExternalGetConversationMessagesParams as GetConversationMessagesParams,
- ExternalGetConversationMessagesResult as GetConversationMessagesResult,
- ExternalConversationAPISendMessageParams as ConversationAPISendMessageParams,
- ExternalConversationAPIGetMessagesParams as ConversationAPIGetMessagesParams,
- // Device types
- ExternalRegisterDeviceType as RegisterDeviceType,
- ExternalRegisterDeviceParams as RegisterDeviceParams,
- ExternalUnregisterDeviceParams as UnregisterDeviceParams,
- ExternalRegisterDeviceResponse as RegisterDeviceResponse,
- ExternalRegisterDeviceResult as RegisterDeviceResult,
- // IncomingCallManager types
- ExternalIncomingInviteSource as IncomingInviteSource,
- ExternalIncomingInvite as IncomingInvite,
- ExternalIncomingInviteWithSource as IncomingInviteWithSource,
- ExternalIncomingCallNotification as IncomingCallNotification,
- ExternalIncomingCallHandler as IncomingCallHandler,
- ExternalIncomingCallHandlers as IncomingCallHandlers,
- // WSClient types
- ExternalOnlineParams as OnlineParams,
- ExternalHandlePushNotificationParams as HandlePushNotificationParams,
- ExternalHandlePushNotificationResult as HandlePushNotificationResult,
- ExternalDialParams as DialParams,
- ExternalReattachParams as ReattachParams,
- // Main interface types
- ExternalSignalWireClient as SignalWireClient,
- ExternalSignalWireContract as SignalWireContract,
- ExternalSignalWireClientParams as SignalWireClientParams,
- ExternalGetSubscriberInfoResponse as GetSubscriberInfoResponse,
- ExternalGetSubscriberInfoResult as GetSubscriberInfoResult,
- ExternalPaginatedResponse as PaginatedResponse,
- ExternalPaginatedResult as PaginatedResult,
-}
+// Main interface types
+export type SignalWireClient = ShallowCompute
+export type SignalWireContract = ShallowCompute
+export type SignalWireClientParams = DeepCompute
+export type GetSubscriberInfoResponse = DeepCompute
+export type GetSubscriberInfoResult = DeepCompute
+export type PaginatedResponse = ShallowCompute>
+export type PaginatedResult = ShallowCompute>
/**
* Build Video Element
*/
export { buildVideoElement } from './buildVideoElement'
-export { LocalVideoOverlay, OverlayMap, UserOverlay } from './VideoOverlays'
+export { LocalVideoOverlay, OverlayMap, UserOverlay } from './VideoOverlays'
\ No newline at end of file
diff --git a/packages/client/src/utils/interfaces/fabric.ts b/packages/client/src/utils/interfaces/fabric.ts
index 202ab435f..55881564f 100644
--- a/packages/client/src/utils/interfaces/fabric.ts
+++ b/packages/client/src/utils/interfaces/fabric.ts
@@ -17,7 +17,7 @@ import {
CallState,
CallStateEventParams,
CallUpdated,
- CallUpdatedEventParams,
+ CallUpdatedEventParams as CoreCallUpdatedEventParams,
CallLeft,
JSONRPCMethod,
FabricLayoutChangedEventParams,
@@ -57,47 +57,34 @@ import {
import { MediaEventNames } from '@signalwire/webrtc'
import { CallCapabilitiesContract, CallSession } from '../../fabric'
-const BrandTypeId: unique symbol = Symbol.for('sw/client')
-
- // exporting aliases from the core package with & Brand<'XXX'> to ensure that the types are branded to client SDK types
-interface Brand {
- readonly [BrandTypeId]?: {
- readonly [id in ID]: ID
- }
-}
+// Import ts-toolbelt for type computation
+import { ShallowCompute, DeepCompute } from '../typeUtils'
export type InternalCallMemberEntity = InternalFabricMemberEntity
-export type InternalCallMemberEntityUpdated =
- InternalFabricMemberEntityUpdated & Brand<'InternalCallMemberEntityUpdated'>
+export type InternalCallMemberEntityUpdated = DeepCompute
export type CallMemberEventNames = FabricMemberEventNames
export type CallMemberUpdatedEventNames = FabricMemberUpdatedEventNames
-export type CallMemberEventParams = FabricMemberEventParams &
- Brand<'CallMemberEventParams'>
-export type CallMemberEventParamsExcludeTalking =
- FabricMemberEventParamsExcludeTalking &
- Brand<'CallMemberEventParamsExcludeTalking'>
-export type CallMemberContract = FabricMemberContract &
- Brand<'CallMemberContract'>
-export type CallLayoutChangedEvent = FabricLayoutChangedEvent &
- Brand<'CallLayoutChangedEvent'>
-export type CallLayoutChangedEventParams = FabricLayoutChangedEventParams &
- Brand<'CallLayoutChangedEventParams'>
-export type CallMemberJoinedEvent = FabricMemberJoinedEvent & Brand<'CallMemberJoinedEvent'>
-export type CallMemberLeftEvent = FabricMemberLeftEvent & Brand<'CallMemberLeftEvent'>
-export type CallMemberTalkingEvent = FabricMemberTalkingEvent & Brand<'CallMemberTalkingEvent'>
-export type CallMemberUpdatedEvent = FabricMemberUpdatedEvent & Brand<'CallMemberUpdatedEvent'>
-export type InternalCallRoomSessionEntity = InternalFabricRoomSessionEntity & Brand<'InternalCallRoomSessionEntity'>
-export type CallMemberEvent = FabricMemberEvent & Brand<'CallMemberEvent'>
-export type CallAction = FabricAction & Brand<'CallAction'>
+export type CallMemberEventParams = DeepCompute
+export type CallMemberEventParamsExcludeTalking = DeepCompute
+export type CallMemberContract = ShallowCompute
+export type CallLayoutChangedEvent = DeepCompute
+export type CallLayoutChangedEventParams = DeepCompute
+export type CallMemberJoinedEvent = DeepCompute
+export type CallMemberLeftEvent = DeepCompute
+export type CallMemberTalkingEvent = DeepCompute
+export type CallMemberUpdatedEvent = DeepCompute
+export type InternalCallRoomSessionEntity = DeepCompute
+export type CallMemberEvent = DeepCompute
+export type CallAction = ShallowCompute
export type CallRoomSessionMethods = FabricRoomSessionMethods
-export type CallMemberEntity = FabricMemberEntity & Brand<'CallMemberEntity'>
-export type CallRoomEventParams = FabricRoomEventParams & Brand<'CallRoomEventParams'>
-export type CallMemberJoinedEventParams = FabricMemberJoinedEventParams & Brand<'CallMemberJoinedEventParams'>
+export type CallMemberEntity = DeepCompute
+export type CallRoomEventParams = ShallowCompute
+export type CallMemberJoinedEventParams = DeepCompute
-export type CallMemberUpdatedEventParams = FabricMemberUpdatedEventParams & Brand<'CallMemberUpdatedEventParams'>
-export type CallMemberLeftEventParams = FabricMemberLeftEventParams & Brand<'CallMemberLeftEventParams'>
-export type CallMemberTalkingEventParams = FabricMemberTalkingEventParams & Brand<'CallMemberTalkingEventParams'>
+export type CallMemberUpdatedEventParams = DeepCompute
+export type CallMemberLeftEventParams = DeepCompute
+export type CallMemberTalkingEventParams = DeepCompute
export interface ExecuteActionParams {
method: JSONRPCMethod
@@ -129,6 +116,9 @@ export type CallMemberListUpdatedParams = {
members: InternalCallMemberEntity[]
}
+// Create type aliases that preserve literal array types
+export type CallUpdatedEventParams = ShallowCompute
+
export type CallJoinedEventParams = {
capabilities: CallCapabilitiesContract
} & Omit
diff --git a/packages/client/src/utils/typeUtils.ts b/packages/client/src/utils/typeUtils.ts
new file mode 100644
index 000000000..b7364ea56
--- /dev/null
+++ b/packages/client/src/utils/typeUtils.ts
@@ -0,0 +1,26 @@
+/**
+ * Type utilities for the SignalWire Client SDK
+ * These utilities help with type computation and resolution
+ */
+import { A } from 'ts-toolbelt'
+
+/**
+ * Shallow compute - only computes the top level of a type
+ * Use this for complex generic types or when deep computation causes issues
+ */
+export type ShallowCompute = A.Compute
+
+/**
+ * Deep compute - recursively computes all nested types
+ * Use this for simple types where full resolution is needed
+ */
+export type DeepCompute = A.Compute
+
+/**
+ * Selective compute - allows choosing computation depth ('flat' or 'deep')
+ * Useful for controlling type computation based on complexity requirements
+ */
+export type SelectiveCompute<
+ T,
+ Depth extends 'flat' | 'deep' = 'deep'
+> = A.Compute