@@ -15,9 +15,15 @@ type BigBlueButtonKeys = {
1515const ATTENDEE_PASSWORD = "attendee" ;
1616const MODERATOR_PASSWORD = "moderator" ;
1717
18+ /**
19+ * Reads and validates the configured BigBlueButton server URL and shared secret.
20+ */
1821const getBigBlueButtonKeys = async ( ) : Promise < BigBlueButtonKeys > =>
1922 appKeysSchema . parse ( await getAppKeysFromSlug ( metadata . slug ) ) ;
2023
24+ /**
25+ * Ensures a configured BigBlueButton host points at its API endpoint.
26+ */
2127const normalizeServerUrl = ( serverUrl : string ) : URL => {
2228 const url = new URL ( serverUrl ) ;
2329
@@ -28,9 +34,15 @@ const normalizeServerUrl = (serverUrl: string): URL => {
2834 return url ;
2935} ;
3036
37+ /**
38+ * Builds the SHA-1 checksum required by BigBlueButton API calls.
39+ */
3140const createChecksum = ( callName : string , query : string , sharedSecret : string ) : string =>
3241 createHash ( "sha1" ) . update ( `${ callName } ${ query } ${ sharedSecret } ` ) . digest ( "hex" ) ;
3342
43+ /**
44+ * Creates a signed BigBlueButton API URL for the given call and parameters.
45+ */
3446const createApiUrl = ( {
3547 callName,
3648 params,
@@ -52,6 +64,9 @@ const createApiUrl = ({
5264 return apiUrl . toString ( ) ;
5365} ;
5466
67+ /**
68+ * Calls BigBlueButton and treats non-success API responses as failures.
69+ */
5570const callBigBlueButtonApi = async ( url : string ) : Promise < void > => {
5671 const response = await fetch ( url ) ;
5772 const body = await response . text ( ) ;
@@ -61,10 +76,19 @@ const callBigBlueButtonApi = async (url: string): Promise<void> => {
6176 }
6277} ;
6378
79+ /**
80+ * Reuses an existing booking reference when updating or creates a stable booking meeting id.
81+ */
6482const getMeetingId = ( eventData : CalendarEvent , bookingRef ?: PartialReference ) : string =>
6583 String ( bookingRef ?. meetingId || eventData . uid || randomUUID ( ) ) ;
6684
85+ /**
86+ * Creates the Cal.com video adapter used to manage BigBlueButton meetings.
87+ */
6788const BigBlueButtonVideoApiAdapter = ( ) : VideoApiAdapter => {
89+ /**
90+ * Creates or updates a BigBlueButton meeting and returns the attendee join link.
91+ */
6892 const createOrUpdateMeeting = async (
6993 eventData : CalendarEvent ,
7094 bookingRef ?: PartialReference
0 commit comments