Mostly mirrors functions found in the Server class, but keeps the actual request logic out of that class.

Methods

(static) _checkAudioReady(baseUrl, token, projectId) → {Promise.<boolean>}

Checks whether the audio.mp3 for a project is ready for transcription.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
true if audio.mp3 exists and is ready
Type: 
Promise.<boolean>

(static) _compressProject(baseUrl, token, projectId) → {Promise.<object>}

Compress a project by deleting the original non-MP3 audio file.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
{ ok, audio_format }
Type: 
Promise.<object>

(static) _createFolder(baseUrl, token, parentPath, name) → {Promise.<{name: string, path: string}>}

Creates a new folder on the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
parentPathstringpath of the parent folder ('' for root)
namestringname of the new folder
Returns:
Type: 
Promise.<{name: string, path: string}>

(static) _createProject(baseUrl, token, metadata, waveformData, audioFile, transcriptFile, sampleFiles) → {Promise.<object>}

Upload a brand-new project (first push from local).
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
metadataobjectgeneral project metadata and speakers; no waveform details
waveformDataobject | null{ sampleRate, duration, filename, peaks }
audioFileFilethe audio file to upload
transcriptFileFile | nullthe transcript CSV file, or null if none
sampleFilesObject.<string, File>speaker sample files keyed by speaker id
Returns:
the newly created project object
Type: 
Promise.<object>

(static) _deleteAudio(baseUrl, token, projectId) → {Promise.<void>}

Deletes the audio file for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
Type: 
Promise.<void>

(static) _deleteFolder(baseUrl, token, folderPath, merge) → {Promise.<{ok: boolean}>}

Deletes a folder on the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
folderPathstringpath of the folder to delete
mergebooleanif true, move contents to parent before deleting
Returns:
Type: 
Promise.<{ok: boolean}>

(static) _deleteProject(baseUrl, token, projectId) → {Promise.<object>}

Permanently delete a project from the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
server response object
Type: 
Promise.<object>

(static) _deleteTranscript(baseUrl, token, projectId) → {Promise.<void>}

Deletes the transcript for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
Type: 
Promise.<void>

(static) _duplicateProject(baseUrl, token, projectId, folderPathopt) → {Promise.<object>}

Duplicate a project on the server and return the new project object.
Parameters:
NameTypeAttributesDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
folderPathstring<optional>
destination folder path for the duplicate
Returns:
the newly created duplicate project object
Type: 
Promise.<object>

(static) _fetch(baseUrl, path, optionsopt, tokenopt) → {Promise.<Response>}

Authenticated fetch wrapper. Attaches the auth token header and throws on non-2xx responses, parsing any JSON error body for the message.
Parameters:
NameTypeAttributesDescription
baseUrlstringserver origin (e.g. "http://localhost:5000")
pathstringrequest path (e.g. "/api/projects")
optionsobject<optional>
fetch init options (method, body, headers, etc.)
tokenstring<optional>
optional auth token; added as X-Auth-Token header
Returns:
resolved fetch Response
Type: 
Promise.<Response>

(static) _getAnnotations(baseUrl, token, projectId) → {Promise.<object>}

Fetch the annotations (hyperlinks, etc.) for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
annotations object with a 'hyperlinks' key
Type: 
Promise.<object>

(static) _getCompressInfo(baseUrl, token, projectId) → {Promise.<object>}

Fetch storage size info for a project before/after compression.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
{ can_compress, before_bytes?, after_bytes?, audio_format?, reason? }
Type: 
Promise.<object>

(static) _getFolderCount(baseUrl, token, folderPath) → {Promise.<{projects: number, folders: number}>}

Gets the count of projects and subfolders within a folder.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
folderPathstringpath of the folder to count
Returns:
Type: 
Promise.<{projects: number, folders: number}>

(static) _getProject(baseUrl, token, projectId) → {Promise.<object>}

Fetch a single project by id.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
the project metadata object
Type: 
Promise.<object>

(static) _getProjectList(baseUrl, token) → {Promise.<Array.<object>>}

Fetch the list of all server-side projects.
Parameters:
NameTypeDescription
baseUrlstringthe base url of the server
tokenstringthe access token of the server
Returns:
array of project metadata objects
Type: 
Promise.<Array.<object>>

(static) _getSharedFolders(baseUrl, token) → {Promise.<Array.<object>>}

Fetch folders shared with the current user.
Parameters:
NameTypeDescription
baseUrlstringBase URL of the server.
tokenstringAuth token for the current session.
Returns:
Array of shared folder metadata objects.
Type: 
Promise.<Array.<object>>

(static) _getSharedProjects(baseUrl, token) → {Promise.<Array.<object>>}

Fetch projects shared with the current user.
Parameters:
NameTypeDescription
baseUrlstringBase URL of the server.
tokenstringAuth token for the current session.
Returns:
Array of shared project metadata objects.
Type: 
Promise.<Array.<object>>

(static) _getSpeakerSample(baseUrl, token, projectId, speakerId) → {Promise.<ArrayBuffer>}

Fetches a speaker's voice sample as an ArrayBuffer.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
speakerIdstringthe speaker's unique identifier
Returns:
raw audio data for the speaker's voice sample
Type: 
Promise.<ArrayBuffer>

(static) _getSpeakers(baseUrl, token, projectId) → {Promise.<object>}

Fetches the speakers dictionary for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
dictionary of speaker objects keyed by speaker id
Type: 
Promise.<object>

(static) _getTranscript(baseUrl, token, projectId) → {Promise.<{contentType: string, text: string}>}

Fetches the transcript CSV text for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
the content type and raw body text
Type: 
Promise.<{contentType: string, text: string}>

(static) _getUserMe(baseUrl, token) → {Promise.<object>}

Fetches the current user's profile from the backend. Used to verify backend access after Firebase sign-in.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringFirebase ID token
Returns:
the user profile object
Type: 
Promise.<object>

(static) _getWaveform(baseUrl, token, projectId) → {Promise.<object>}

Fetches the waveform metadata (sampleRate, duration, filename, peaks) for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
Returns:
waveform metadata object
Type: 
Promise.<object>

(static) _listDirectory(baseUrl, token, folderPath) → {Promise.<{folders: Array.<object>, projects: Array.<object>}>}

Lists the immediate contents of a server folder.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
folderPathstringrelative folder path ('' for root)
Returns:
Type: 
Promise.<{folders: Array.<object>, projects: Array.<object>}>

(static) _moveProjectToFolder(baseUrl, token, projectId, targetFolderPath) → {Promise.<object>}

Moves a project to a different folder on the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
targetFolderPathstringdestination folder path ('' for root)
Returns:
updated project summary
Type: 
Promise.<object>

(static) _renameFolder(baseUrl, token, folderPath, newName) → {Promise.<{name: string, path: string}>}

Renames a folder on the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
folderPathstringcurrent path of the folder to rename
newNamestringnew name for the folder
Returns:
Type: 
Promise.<{name: string, path: string}>

(static) _retranscribeSegments(baseUrl, token, projectId, segments, modelSizeopt) → {Promise.<{results: Array.<{idx: number, words: Array}>}>}

Retranscribes specific time-range segments and returns updated word-level timestamps.
Parameters:
NameTypeAttributesDescription
baseUrlstringBase URL of the server
tokenstringAuth token
projectIdstringThe project ID
segmentsArray.<{start: number, end: number, idx: number}>Segments to retranscribe
modelSizestring<optional>
Whisper model size to use
Returns:
Type: 
Promise.<{results: Array.<{idx: number, words: Array}>}>

(static) _saveAnnotations(baseUrl, token, projectId, data) → {Promise.<void>}

Save annotations (hyperlinks, etc.) for a project.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
dataobjectannotations object with a 'hyperlinks' key
Returns:
Type: 
Promise.<void>

(static) _saveWaveform(baseUrl, token, projectId, waveformData) → {Promise.<void>}

Saves waveform metadata (peaks, duration, sampleRate) back to the server.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
waveformDataObjectWaveform peaks and audio metadata.
Returns:
Type: 
Promise.<void>

(static) _transcribeProject(baseUrl, token, projectId, options, onEvent, signalopt) → {Promise.<void>}

Starts transcription and streams SSE progress events via a callback. Resolves when the stream closes (after a 'result' or 'error' event). Each event object has a 'type' field: 'status', 'progress', 'result', or 'error'.
Parameters:
NameTypeAttributesDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
optionsobjecttranscription options
Properties
NameTypeAttributesDescription
modelSizestring<optional>
whisper model size (default 'medium')
speakerCountnumber | null<optional>
number of speakers, or null for auto-detect
onEventfunctioncalled with each parsed SSE event object
signalAbortSignal<optional>
optional abort signal
Returns:
Type: 
Promise.<void>

(static) _updateProject(baseUrl, token, projectId, id, metadata, speakersData, transcriptFile, sampleFiles) → {Promise.<object>}

Push updated data for an existing server project. Audio is immutable once uploaded — only metadata, speakers, and transcript can be updated.
Parameters:
NameTypeDescription
baseUrlstringbase URL of the server
tokenstringauth token for the current session
projectIdstringthe project's unique identifier
idstringthe project id (included in metadata)
metadataobject | null{ name, created, modified } (no speakers)
speakersDataobject | nullfull speakers dict if speakers section is dirty
transcriptFileFile | nullthe updated transcript file, or null to leave unchanged
sampleFilesObject.<string, File>updated speaker sample files keyed by speaker id
Returns:
the updated project object
Type: 
Promise.<object>

(inner) _encodeFolderPath(folderPath) → {string}

Encode a folder path for use in a URL, preserving slashes between segments.
Parameters:
NameTypeDescription
folderPathstringrelative folder path ('' for root)
Returns:
URL-encoded path with slashes preserved.
Type: 
string

(inner) _xhrRequest(url, method, body, token, onProgress, signalopt) → {Promise.<object>}

XHR-based request with upload progress support. Returns parsed JSON.
Parameters:
NameTypeAttributesDescription
urlstringFull URL to request
methodstringHTTP method
bodyFormDataRequest body
tokenstring | nullAuth token
onProgressfunction | nullCalled with fraction (0–1) as upload progresses
signalAbortSignal<optional>
Optional abort signal.
Returns:
Type: 
Promise.<object>