@mentra/sdk 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -0
- package/dist/constants/index.d.ts +14 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +16 -0
- package/dist/examples/rtmp-streaming-example.d.ts +2 -0
- package/dist/examples/rtmp-streaming-example.d.ts.map +1 -0
- package/dist/examples/rtmp-streaming-example.js +102 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/logging/logger.d.ts +3 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +79 -0
- package/dist/tpa/index.d.ts +6 -0
- package/dist/tpa/index.d.ts.map +1 -0
- package/dist/tpa/index.js +24 -0
- package/dist/tpa/server/index.d.ts +193 -0
- package/dist/tpa/server/index.d.ts.map +1 -0
- package/dist/tpa/server/index.js +436 -0
- package/dist/tpa/session/api-client.d.ts +49 -0
- package/dist/tpa/session/api-client.d.ts.map +1 -0
- package/dist/tpa/session/api-client.js +101 -0
- package/dist/tpa/session/dashboard.d.ts +52 -0
- package/dist/tpa/session/dashboard.d.ts.map +1 -0
- package/dist/tpa/session/dashboard.js +149 -0
- package/dist/tpa/session/events.d.ts +178 -0
- package/dist/tpa/session/events.d.ts.map +1 -0
- package/dist/tpa/session/events.js +294 -0
- package/dist/tpa/session/index.d.ts +391 -0
- package/dist/tpa/session/index.d.ts.map +1 -0
- package/dist/tpa/session/index.js +1452 -0
- package/dist/tpa/session/layouts.d.ts +150 -0
- package/dist/tpa/session/layouts.d.ts.map +1 -0
- package/dist/tpa/session/layouts.js +282 -0
- package/dist/tpa/session/modules/streaming.d.ts +100 -0
- package/dist/tpa/session/modules/streaming.d.ts.map +1 -0
- package/dist/tpa/session/modules/streaming.js +270 -0
- package/dist/tpa/session/settings.d.ts +202 -0
- package/dist/tpa/session/settings.d.ts.map +1 -0
- package/dist/tpa/session/settings.js +361 -0
- package/dist/tpa/token/index.d.ts +7 -0
- package/dist/tpa/token/index.d.ts.map +1 -0
- package/dist/tpa/token/index.js +22 -0
- package/dist/tpa/token/utils.d.ts +69 -0
- package/dist/tpa/token/utils.d.ts.map +1 -0
- package/dist/tpa/token/utils.js +144 -0
- package/dist/tpa/webview/index.d.ts +47 -0
- package/dist/tpa/webview/index.d.ts.map +1 -0
- package/dist/tpa/webview/index.js +344 -0
- package/dist/types/dashboard/index.d.ts +128 -0
- package/dist/types/dashboard/index.d.ts.map +1 -0
- package/dist/types/dashboard/index.js +12 -0
- package/dist/types/enums.d.ts +57 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +72 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +87 -0
- package/dist/types/layouts.d.ts +51 -0
- package/dist/types/layouts.d.ts.map +1 -0
- package/dist/types/layouts.js +3 -0
- package/dist/types/message-types.d.ts +109 -0
- package/dist/types/message-types.d.ts.map +1 -0
- package/dist/types/message-types.js +189 -0
- package/dist/types/messages/base.d.ts +12 -0
- package/dist/types/messages/base.d.ts.map +1 -0
- package/dist/types/messages/base.js +3 -0
- package/dist/types/messages/cloud-to-glasses.d.ts +126 -0
- package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -0
- package/dist/types/messages/cloud-to-glasses.js +60 -0
- package/dist/types/messages/cloud-to-tpa.d.ts +228 -0
- package/dist/types/messages/cloud-to-tpa.d.ts.map +1 -0
- package/dist/types/messages/cloud-to-tpa.js +61 -0
- package/dist/types/messages/glasses-to-cloud.d.ts +219 -0
- package/dist/types/messages/glasses-to-cloud.d.ts.map +1 -0
- package/dist/types/messages/glasses-to-cloud.js +88 -0
- package/dist/types/messages/tpa-to-cloud.d.ts +146 -0
- package/dist/types/messages/tpa-to-cloud.d.ts.map +1 -0
- package/dist/types/messages/tpa-to-cloud.js +67 -0
- package/dist/types/models.d.ts +165 -0
- package/dist/types/models.d.ts.map +1 -0
- package/dist/types/models.js +84 -0
- package/dist/types/rtmp-stream.d.ts +68 -0
- package/dist/types/rtmp-stream.d.ts.map +1 -0
- package/dist/types/rtmp-stream.js +3 -0
- package/dist/types/streams.d.ts +138 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +251 -0
- package/dist/types/token.d.ts +41 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/token.js +7 -0
- package/dist/types/user-session.d.ts +73 -0
- package/dist/types/user-session.d.ts.map +1 -0
- package/dist/types/user-session.js +17 -0
- package/dist/types/webhooks.d.ts +107 -0
- package/dist/types/webhooks.d.ts.map +1 -0
- package/dist/types/webhooks.js +55 -0
- package/dist/utils/resource-tracker.d.ts +94 -0
- package/dist/utils/resource-tracker.d.ts.map +1 -0
- package/dist/utils/resource-tracker.js +153 -0
- package/package.json +50 -0
@@ -0,0 +1,391 @@
|
|
1
|
+
import { EventManager, EventData } from './events';
|
2
|
+
import { LayoutManager } from './layouts';
|
3
|
+
import { SettingsManager } from './settings';
|
4
|
+
import { StreamingModule } from './modules/streaming';
|
5
|
+
import { ExtendedStreamType, ButtonPress, HeadPosition, PhoneNotification, TranscriptionData, TranslationData, AppSettings, AppSetting, TpaConfig, VpsCoordinates, PhotoTaken } from '../../types';
|
6
|
+
import { DashboardAPI } from '../../types/dashboard';
|
7
|
+
import { Logger } from 'pino';
|
8
|
+
import { TpaServer } from '../server';
|
9
|
+
/**
|
10
|
+
* โ๏ธ Configuration options for TPA Session
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* ```typescript
|
14
|
+
* const config: TpaSessionConfig = {
|
15
|
+
* packageName: 'org.example.myapp',
|
16
|
+
* apiKey: 'your_api_key',
|
17
|
+
* // Auto-reconnection is enabled by default
|
18
|
+
* // autoReconnect: true
|
19
|
+
* };
|
20
|
+
* ```
|
21
|
+
*/
|
22
|
+
export interface TpaSessionConfig {
|
23
|
+
/** ๐ฆ Unique identifier for your TPA (e.g., 'org.company.appname') */
|
24
|
+
packageName: string;
|
25
|
+
/** ๐ API key for authentication with AugmentOS Cloud */
|
26
|
+
apiKey: string;
|
27
|
+
/** ๐ WebSocket server URL (default: 'ws://localhost:7002/tpa-ws') */
|
28
|
+
augmentOSWebsocketUrl?: string;
|
29
|
+
/** ๐ Automatically attempt to reconnect on disconnect (default: true) */
|
30
|
+
autoReconnect?: boolean;
|
31
|
+
/** ๐ Maximum number of reconnection attempts (default: 3) */
|
32
|
+
maxReconnectAttempts?: number;
|
33
|
+
/** โฑ๏ธ Base delay between reconnection attempts in ms (default: 1000) */
|
34
|
+
reconnectDelay?: number;
|
35
|
+
userId: string;
|
36
|
+
tpaServer: TpaServer;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* ๐ TPA Session Implementation
|
40
|
+
*
|
41
|
+
* Manages a live connection between your TPA and AugmentOS Cloud.
|
42
|
+
* Provides interfaces for:
|
43
|
+
* - ๐ฎ Event handling (transcription, head position, etc.)
|
44
|
+
* - ๐ฑ Display management in AR view
|
45
|
+
* - ๐ Connection lifecycle
|
46
|
+
* - ๐ Automatic reconnection
|
47
|
+
*
|
48
|
+
* @example
|
49
|
+
* ```typescript
|
50
|
+
* const session = new TpaSession({
|
51
|
+
* packageName: 'org.example.myapp',
|
52
|
+
* apiKey: 'your_api_key'
|
53
|
+
* });
|
54
|
+
*
|
55
|
+
* // Handle events
|
56
|
+
* session.onTranscription((data) => {
|
57
|
+
* session.layouts.showTextWall(data.text);
|
58
|
+
* });
|
59
|
+
*
|
60
|
+
* // Connect to cloud
|
61
|
+
* await session.connect('session_123');
|
62
|
+
* ```
|
63
|
+
*/
|
64
|
+
export declare class TpaSession {
|
65
|
+
private config;
|
66
|
+
/** WebSocket connection to AugmentOS Cloud */
|
67
|
+
private ws;
|
68
|
+
/** Current session identifier */
|
69
|
+
private sessionId;
|
70
|
+
/** Number of reconnection attempts made */
|
71
|
+
private reconnectAttempts;
|
72
|
+
/** Active event subscriptions */
|
73
|
+
private subscriptions;
|
74
|
+
/** Resource tracker for automatic cleanup */
|
75
|
+
private resources;
|
76
|
+
/** Internal settings storage - use public settings API instead */
|
77
|
+
private settingsData;
|
78
|
+
/** TPA configuration loaded from tpa_config.json */
|
79
|
+
private tpaConfig;
|
80
|
+
/** Whether to update subscriptions when settings change */
|
81
|
+
private shouldUpdateSubscriptionsOnSettingsChange;
|
82
|
+
/** Custom subscription handler for settings-based subscriptions */
|
83
|
+
private subscriptionSettingsHandler?;
|
84
|
+
/** Settings that should trigger subscription updates when changed */
|
85
|
+
private subscriptionUpdateTriggers;
|
86
|
+
/** Pending photo requests waiting for responses */
|
87
|
+
private pendingPhotoRequests;
|
88
|
+
/** Pending user discovery requests waiting for responses */
|
89
|
+
private pendingUserDiscoveryRequests;
|
90
|
+
/** Pending direct message requests waiting for responses */
|
91
|
+
private pendingDirectMessages;
|
92
|
+
/** ๐ฎ Event management interface */
|
93
|
+
readonly events: EventManager;
|
94
|
+
/** ๐ฑ Layout management interface */
|
95
|
+
readonly layouts: LayoutManager;
|
96
|
+
/** โ๏ธ Settings management interface */
|
97
|
+
readonly settings: SettingsManager;
|
98
|
+
/** ๐ Dashboard management interface */
|
99
|
+
readonly dashboard: DashboardAPI;
|
100
|
+
/** ๐น RTMP streaming interface */
|
101
|
+
readonly streaming: StreamingModule;
|
102
|
+
readonly tpaServer: TpaServer;
|
103
|
+
readonly logger: Logger;
|
104
|
+
readonly userId: string;
|
105
|
+
/** Dedicated emitter for TPA-to-TPA events */
|
106
|
+
private tpaEvents;
|
107
|
+
constructor(config: TpaSessionConfig);
|
108
|
+
/**
|
109
|
+
* Get the current session ID
|
110
|
+
* @returns The current session ID or 'unknown-session-id' if not connected
|
111
|
+
*/
|
112
|
+
getSessionId(): string;
|
113
|
+
/**
|
114
|
+
* Get the package name for this TPA
|
115
|
+
* @returns The package name
|
116
|
+
*/
|
117
|
+
getPackageName(): string;
|
118
|
+
/**
|
119
|
+
* ๐ค Listen for speech transcription events
|
120
|
+
* @param handler - Function to handle transcription data
|
121
|
+
* @returns Cleanup function to remove the handler
|
122
|
+
*/
|
123
|
+
onTranscription(handler: (data: TranscriptionData) => void): () => void;
|
124
|
+
/**
|
125
|
+
* ๐ Listen for speech transcription events in a specific language
|
126
|
+
* @param language - Language code (e.g., "en-US")
|
127
|
+
* @param handler - Function to handle transcription data
|
128
|
+
* @returns Cleanup function to remove the handler
|
129
|
+
* @throws Error if language code is invalid
|
130
|
+
*/
|
131
|
+
onTranscriptionForLanguage(language: string, handler: (data: TranscriptionData) => void): () => void;
|
132
|
+
/**
|
133
|
+
* ๐ Listen for speech translation events for a specific language pair
|
134
|
+
* @param sourceLanguage - Source language code (e.g., "es-ES")
|
135
|
+
* @param targetLanguage - Target language code (e.g., "en-US")
|
136
|
+
* @param handler - Function to handle translation data
|
137
|
+
* @returns Cleanup function to remove the handler
|
138
|
+
* @throws Error if language codes are invalid
|
139
|
+
*/
|
140
|
+
onTranslationForLanguage(sourceLanguage: string, targetLanguage: string, handler: (data: TranslationData) => void): () => void;
|
141
|
+
/**
|
142
|
+
* ๐ค Listen for head position changes
|
143
|
+
* @param handler - Function to handle head position updates
|
144
|
+
* @returns Cleanup function to remove the handler
|
145
|
+
*/
|
146
|
+
onHeadPosition(handler: (data: HeadPosition) => void): () => void;
|
147
|
+
/**
|
148
|
+
* ๐ Listen for hardware button press events
|
149
|
+
* @param handler - Function to handle button events
|
150
|
+
* @returns Cleanup function to remove the handler
|
151
|
+
*/
|
152
|
+
onButtonPress(handler: (data: ButtonPress) => void): () => void;
|
153
|
+
/**
|
154
|
+
* ๐ฑ Listen for phone notification events
|
155
|
+
* @param handler - Function to handle notifications
|
156
|
+
* @returns Cleanup function to remove the handler
|
157
|
+
*/
|
158
|
+
onPhoneNotifications(handler: (data: PhoneNotification) => void): () => void;
|
159
|
+
/**
|
160
|
+
* ๐ก Listen for VPS coordinates updates
|
161
|
+
* @param handler - Function to handle VPS coordinates
|
162
|
+
* @returns Cleanup function to remove the handler
|
163
|
+
*/
|
164
|
+
onVpsCoordinates(handler: (data: VpsCoordinates) => void): () => void;
|
165
|
+
/**
|
166
|
+
* ๐ธ Listen for photo responses
|
167
|
+
* @param handler - Function to handle photo response data
|
168
|
+
* @returns Cleanup function to remove the handler
|
169
|
+
*/
|
170
|
+
onPhotoTaken(handler: (data: PhotoTaken) => void): () => void;
|
171
|
+
/**
|
172
|
+
* ๐ฌ Subscribe to a specific event stream
|
173
|
+
* @param type - Type of event to subscribe to
|
174
|
+
*/
|
175
|
+
subscribe(type: ExtendedStreamType): void;
|
176
|
+
/**
|
177
|
+
* ๐ญ Unsubscribe from a specific event stream
|
178
|
+
* @param type - Type of event to unsubscribe from
|
179
|
+
*/
|
180
|
+
unsubscribe(type: ExtendedStreamType): void;
|
181
|
+
/**
|
182
|
+
* ๐ฏ Generic event listener (pub/sub style)
|
183
|
+
* @param event - Event name to listen for
|
184
|
+
* @param handler - Event handler function
|
185
|
+
*/
|
186
|
+
on<T extends ExtendedStreamType>(event: T, handler: (data: EventData<T>) => void): () => void;
|
187
|
+
/**
|
188
|
+
* ๐ Connect to AugmentOS Cloud
|
189
|
+
* @param sessionId - Unique session identifier
|
190
|
+
* @returns Promise that resolves when connected
|
191
|
+
*/
|
192
|
+
connect(sessionId: string): Promise<void>;
|
193
|
+
/**
|
194
|
+
* ๐ Disconnect from AugmentOS Cloud
|
195
|
+
*/
|
196
|
+
disconnect(): void;
|
197
|
+
/**
|
198
|
+
* ๐ธ Request a photo from the connected glasses
|
199
|
+
* @param options - Optional configuration for the photo request
|
200
|
+
* @returns Promise that resolves with the URL to the captured photo
|
201
|
+
*/
|
202
|
+
requestPhoto(options?: {
|
203
|
+
saveToGallery?: boolean;
|
204
|
+
}): Promise<string>;
|
205
|
+
/**
|
206
|
+
* ๐ ๏ธ Get all current user settings
|
207
|
+
* @returns A copy of the current settings array
|
208
|
+
* @deprecated Use session.settings.getAll() instead
|
209
|
+
*/
|
210
|
+
getSettings(): AppSettings;
|
211
|
+
/**
|
212
|
+
* ๐ Get a specific setting value by key
|
213
|
+
* @param key The setting key to look for
|
214
|
+
* @returns The setting's value, or undefined if not found
|
215
|
+
* @deprecated Use session.settings.get(key) instead
|
216
|
+
*/
|
217
|
+
getSetting<T>(key: string): T | undefined;
|
218
|
+
/**
|
219
|
+
* โ๏ธ Configure settings-based subscription updates
|
220
|
+
* This allows TPAs to automatically update their subscriptions when certain settings change
|
221
|
+
* @param options Configuration options for settings-based subscriptions
|
222
|
+
*/
|
223
|
+
setSubscriptionSettings(options: {
|
224
|
+
updateOnChange: string[];
|
225
|
+
handler: (settings: AppSettings) => ExtendedStreamType[];
|
226
|
+
}): void;
|
227
|
+
/**
|
228
|
+
* ๐ Update subscriptions based on current settings
|
229
|
+
* Called automatically when relevant settings change
|
230
|
+
*/
|
231
|
+
private updateSubscriptionsFromSettings;
|
232
|
+
/**
|
233
|
+
* ๐งช For testing: Update settings locally
|
234
|
+
* In normal operation, settings come from the cloud
|
235
|
+
* @param newSettings The new settings to apply
|
236
|
+
*/
|
237
|
+
updateSettingsForTesting(newSettings: AppSettings): void;
|
238
|
+
/**
|
239
|
+
* ๐ Load configuration from a JSON file
|
240
|
+
* @param jsonData JSON string containing TPA configuration
|
241
|
+
* @returns The loaded configuration
|
242
|
+
* @throws Error if the configuration is invalid
|
243
|
+
*/
|
244
|
+
loadConfigFromJson(jsonData: string): TpaConfig;
|
245
|
+
/**
|
246
|
+
* ๐ Get the loaded TPA configuration
|
247
|
+
* @returns The current TPA configuration or null if not loaded
|
248
|
+
*/
|
249
|
+
getConfig(): TpaConfig | null;
|
250
|
+
/**
|
251
|
+
* ๐ Get the WebSocket server URL for this session
|
252
|
+
* @returns The WebSocket server URL used by this session
|
253
|
+
*/
|
254
|
+
getServerUrl(): string | undefined;
|
255
|
+
getHttpsServerUrl(): string | undefined;
|
256
|
+
private static convertToHttps;
|
257
|
+
/**
|
258
|
+
* ๐ Get default settings from the TPA configuration
|
259
|
+
* @returns Array of settings with default values
|
260
|
+
* @throws Error if configuration is not loaded
|
261
|
+
*/
|
262
|
+
getDefaultSettings(): AppSettings;
|
263
|
+
/**
|
264
|
+
* ๐ Get setting schema from configuration
|
265
|
+
* @param key Setting key to look up
|
266
|
+
* @returns The setting schema or undefined if not found
|
267
|
+
*/
|
268
|
+
getSettingSchema(key: string): AppSetting | undefined;
|
269
|
+
/**
|
270
|
+
* ๐จ Handle incoming messages from cloud
|
271
|
+
*/
|
272
|
+
private handleMessage;
|
273
|
+
/**
|
274
|
+
* ๐งช Validate incoming message structure
|
275
|
+
* @param message - Message to validate
|
276
|
+
* @returns boolean indicating if the message is valid
|
277
|
+
*/
|
278
|
+
private validateMessage;
|
279
|
+
/**
|
280
|
+
* ๐ฆ Handle binary message data (audio or video)
|
281
|
+
* @param buffer - Binary data as ArrayBuffer
|
282
|
+
*/
|
283
|
+
private handleBinaryMessage;
|
284
|
+
/**
|
285
|
+
* ๐งน Sanitize event data to prevent crashes from malformed data
|
286
|
+
* @param streamType - The type of stream data
|
287
|
+
* @param data - The potentially unsafe data to sanitize
|
288
|
+
* @returns Sanitized data safe for processing
|
289
|
+
*/
|
290
|
+
private sanitizeEventData;
|
291
|
+
/**
|
292
|
+
* ๐ Send connection initialization message
|
293
|
+
*/
|
294
|
+
private sendConnectionInit;
|
295
|
+
/**
|
296
|
+
* ๐ Update subscription list with cloud
|
297
|
+
*/
|
298
|
+
private updateSubscriptions;
|
299
|
+
/**
|
300
|
+
* ๐ Handle reconnection with exponential backoff
|
301
|
+
*/
|
302
|
+
private handleReconnection;
|
303
|
+
/**
|
304
|
+
* ๐ค Send message to cloud with validation and error handling
|
305
|
+
* @throws {Error} If WebSocket is not connected
|
306
|
+
*/
|
307
|
+
private send;
|
308
|
+
/**
|
309
|
+
* Fetch the onboarding instructions for this session from the backend.
|
310
|
+
* @returns Promise resolving to the instructions string or null
|
311
|
+
*/
|
312
|
+
getInstructions(): Promise<string | null>;
|
313
|
+
/**
|
314
|
+
* ๐ฅ Discover other users currently using the same TPA
|
315
|
+
* @param includeProfiles - Whether to include user profile information
|
316
|
+
* @returns Promise that resolves with list of active users
|
317
|
+
*/
|
318
|
+
discoverTpaUsers(domain: string, includeProfiles?: boolean): Promise<any>;
|
319
|
+
/**
|
320
|
+
* ๐ Check if a specific user is currently active
|
321
|
+
* @param userId - User ID to check for
|
322
|
+
* @returns Promise that resolves with boolean indicating if user is active
|
323
|
+
*/
|
324
|
+
isUserActive(userId: string): Promise<boolean>;
|
325
|
+
/**
|
326
|
+
* ๐ Get user count for this TPA
|
327
|
+
* @returns Promise that resolves with number of active users
|
328
|
+
*/
|
329
|
+
getUserCount(domain: string): Promise<number>;
|
330
|
+
/**
|
331
|
+
* ๐ข Send broadcast message to all users with same TPA active
|
332
|
+
* @param payload - Message payload to send
|
333
|
+
* @param roomId - Optional room ID for room-based messaging
|
334
|
+
* @returns Promise that resolves when message is sent
|
335
|
+
*/
|
336
|
+
broadcastToTpaUsers(payload: any, roomId?: string): Promise<void>;
|
337
|
+
/**
|
338
|
+
* ๐ค Send direct message to specific user
|
339
|
+
* @param targetUserId - User ID to send message to
|
340
|
+
* @param payload - Message payload to send
|
341
|
+
* @returns Promise that resolves with success status
|
342
|
+
*/
|
343
|
+
sendDirectMessage(targetUserId: string, payload: any): Promise<boolean>;
|
344
|
+
/**
|
345
|
+
* ๐ Join a communication room for group messaging
|
346
|
+
* @param roomId - Room ID to join
|
347
|
+
* @param roomConfig - Optional room configuration
|
348
|
+
* @returns Promise that resolves when room is joined
|
349
|
+
*/
|
350
|
+
joinTpaRoom(roomId: string, roomConfig?: {
|
351
|
+
maxUsers?: number;
|
352
|
+
isPrivate?: boolean;
|
353
|
+
metadata?: any;
|
354
|
+
}): Promise<void>;
|
355
|
+
/**
|
356
|
+
* ๐ช Leave a communication room
|
357
|
+
* @param roomId - Room ID to leave
|
358
|
+
* @returns Promise that resolves when room is left
|
359
|
+
*/
|
360
|
+
leaveTpaRoom(roomId: string): Promise<void>;
|
361
|
+
/**
|
362
|
+
* ๐จ Listen for messages from other TPA users
|
363
|
+
* @param handler - Function to handle incoming messages
|
364
|
+
* @returns Cleanup function to remove the handler
|
365
|
+
*/
|
366
|
+
onTpaMessage(handler: (message: any) => void): () => void;
|
367
|
+
/**
|
368
|
+
* ๐ Listen for user join events
|
369
|
+
* @param handler - Function to handle user join events
|
370
|
+
* @returns Cleanup function to remove the handler
|
371
|
+
*/
|
372
|
+
onTpaUserJoined(handler: (data: any) => void): () => void;
|
373
|
+
/**
|
374
|
+
* ๐ช Listen for user leave events
|
375
|
+
* @param handler - Function to handle user leave events
|
376
|
+
* @returns Cleanup function to remove the handler
|
377
|
+
*/
|
378
|
+
onTpaUserLeft(handler: (data: any) => void): () => void;
|
379
|
+
/**
|
380
|
+
* ๐ Listen for room update events
|
381
|
+
* @param handler - Function to handle room updates
|
382
|
+
* @returns Cleanup function to remove the handler
|
383
|
+
*/
|
384
|
+
onTpaRoomUpdated(handler: (data: any) => void): () => void;
|
385
|
+
/**
|
386
|
+
* ๐ง Generate unique message ID
|
387
|
+
* @returns Unique message identifier
|
388
|
+
*/
|
389
|
+
private generateMessageId;
|
390
|
+
}
|
391
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tpa/session/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAYL,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAYf,WAAW,EACX,UAAU,EACV,SAAS,EAQT,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAA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