voice-router-dev 0.2.3 → 0.2.5
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/dist/index.d.mts +177 -26
- package/dist/index.d.ts +177 -26
- package/dist/index.js +169 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +46 -49
package/dist/index.js
CHANGED
|
@@ -1757,12 +1757,18 @@ var preRecordedControllerInitPreRecordedJobV2 = (initTranscriptionRequest, optio
|
|
|
1757
1757
|
var preRecordedControllerGetPreRecordedJobV2 = (id, options) => {
|
|
1758
1758
|
return import_axios.default.get(`/v2/pre-recorded/${id}`, options);
|
|
1759
1759
|
};
|
|
1760
|
+
var preRecordedControllerDeletePreRecordedJobV2 = (id, options) => {
|
|
1761
|
+
return import_axios.default.delete(`/v2/pre-recorded/${id}`, options);
|
|
1762
|
+
};
|
|
1760
1763
|
var streamingControllerInitStreamingSessionV2 = (streamingRequest, params, options) => {
|
|
1761
1764
|
return import_axios.default.post("/v2/live", streamingRequest, {
|
|
1762
1765
|
...options,
|
|
1763
1766
|
params: { ...params, ...options?.params }
|
|
1764
1767
|
});
|
|
1765
1768
|
};
|
|
1769
|
+
var streamingControllerDeleteStreamingJobV2 = (id, options) => {
|
|
1770
|
+
return import_axios.default.delete(`/v2/live/${id}`, options);
|
|
1771
|
+
};
|
|
1766
1772
|
|
|
1767
1773
|
// src/adapters/gladia-adapter.ts
|
|
1768
1774
|
var GladiaAdapter = class extends BaseAdapter {
|
|
@@ -2050,8 +2056,47 @@ var GladiaAdapter = class extends BaseAdapter {
|
|
|
2050
2056
|
}));
|
|
2051
2057
|
}
|
|
2052
2058
|
/**
|
|
2053
|
-
*
|
|
2059
|
+
* Delete a transcription job and its associated data
|
|
2060
|
+
*
|
|
2061
|
+
* Removes the transcription data from Gladia's servers. This action is
|
|
2062
|
+
* irreversible. Supports both pre-recorded and streaming job IDs.
|
|
2063
|
+
*
|
|
2064
|
+
* @param transcriptId - The ID of the transcript/job to delete
|
|
2065
|
+
* @param jobType - Type of job: 'pre-recorded' or 'streaming' (defaults to 'pre-recorded')
|
|
2066
|
+
* @returns Promise with success status
|
|
2067
|
+
*
|
|
2068
|
+
* @example Delete a pre-recorded transcript
|
|
2069
|
+
* ```typescript
|
|
2070
|
+
* const result = await adapter.deleteTranscript('abc123');
|
|
2071
|
+
* if (result.success) {
|
|
2072
|
+
* console.log('Transcript deleted successfully');
|
|
2073
|
+
* }
|
|
2074
|
+
* ```
|
|
2075
|
+
*
|
|
2076
|
+
* @example Delete a streaming job
|
|
2077
|
+
* ```typescript
|
|
2078
|
+
* const result = await adapter.deleteTranscript('stream-456', 'streaming');
|
|
2079
|
+
* ```
|
|
2080
|
+
*
|
|
2081
|
+
* @see https://docs.gladia.io/
|
|
2054
2082
|
*/
|
|
2083
|
+
async deleteTranscript(transcriptId, jobType = "pre-recorded") {
|
|
2084
|
+
this.validateConfig();
|
|
2085
|
+
try {
|
|
2086
|
+
if (jobType === "streaming") {
|
|
2087
|
+
await streamingControllerDeleteStreamingJobV2(transcriptId, this.getAxiosConfig());
|
|
2088
|
+
} else {
|
|
2089
|
+
await preRecordedControllerDeletePreRecordedJobV2(transcriptId, this.getAxiosConfig());
|
|
2090
|
+
}
|
|
2091
|
+
return { success: true };
|
|
2092
|
+
} catch (error) {
|
|
2093
|
+
const err = error;
|
|
2094
|
+
if (err.response?.status === 404) {
|
|
2095
|
+
return { success: true };
|
|
2096
|
+
}
|
|
2097
|
+
throw error;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2055
2100
|
/**
|
|
2056
2101
|
* Stream audio for real-time transcription
|
|
2057
2102
|
*
|
|
@@ -2106,7 +2151,8 @@ var GladiaAdapter = class extends BaseAdapter {
|
|
|
2106
2151
|
encoding: options?.encoding ? mapEncodingToProvider(options.encoding, "gladia") : void 0,
|
|
2107
2152
|
sample_rate: validatedSampleRate,
|
|
2108
2153
|
channels: options?.channels,
|
|
2109
|
-
endpointing: options?.endpointing
|
|
2154
|
+
endpointing: options?.endpointing,
|
|
2155
|
+
model: options?.model
|
|
2110
2156
|
};
|
|
2111
2157
|
if (options?.language) {
|
|
2112
2158
|
streamingRequest.language_config = {
|
|
@@ -2538,6 +2584,9 @@ var createTranscript = (transcriptParams, options) => {
|
|
|
2538
2584
|
var getTranscript = (transcriptId, options) => {
|
|
2539
2585
|
return import_axios2.default.get(`/v2/transcript/${transcriptId}`, options);
|
|
2540
2586
|
};
|
|
2587
|
+
var deleteTranscript = (transcriptId, options) => {
|
|
2588
|
+
return import_axios2.default.delete(`/v2/transcript/${transcriptId}`, options);
|
|
2589
|
+
};
|
|
2541
2590
|
|
|
2542
2591
|
// src/adapters/assemblyai-adapter.ts
|
|
2543
2592
|
var AssemblyAIAdapter = class extends BaseAdapter {
|
|
@@ -2669,6 +2718,41 @@ var AssemblyAIAdapter = class extends BaseAdapter {
|
|
|
2669
2718
|
return this.createErrorResponse(error);
|
|
2670
2719
|
}
|
|
2671
2720
|
}
|
|
2721
|
+
/**
|
|
2722
|
+
* Delete a transcription and its associated data
|
|
2723
|
+
*
|
|
2724
|
+
* Removes the transcription data from AssemblyAI's servers. This action
|
|
2725
|
+
* is irreversible. The transcript will be marked as deleted and its
|
|
2726
|
+
* content will no longer be accessible.
|
|
2727
|
+
*
|
|
2728
|
+
* @param transcriptId - The ID of the transcript to delete
|
|
2729
|
+
* @returns Promise with success status
|
|
2730
|
+
*
|
|
2731
|
+
* @example Delete a transcript
|
|
2732
|
+
* ```typescript
|
|
2733
|
+
* const result = await adapter.deleteTranscript('abc123');
|
|
2734
|
+
* if (result.success) {
|
|
2735
|
+
* console.log('Transcript deleted successfully');
|
|
2736
|
+
* }
|
|
2737
|
+
* ```
|
|
2738
|
+
*
|
|
2739
|
+
* @see https://www.assemblyai.com/docs/api-reference/transcripts/delete
|
|
2740
|
+
*/
|
|
2741
|
+
async deleteTranscript(transcriptId) {
|
|
2742
|
+
this.validateConfig();
|
|
2743
|
+
try {
|
|
2744
|
+
const response = await deleteTranscript(transcriptId, this.getAxiosConfig());
|
|
2745
|
+
return {
|
|
2746
|
+
success: response.data.status === "completed" || response.status === 200
|
|
2747
|
+
};
|
|
2748
|
+
} catch (error) {
|
|
2749
|
+
const err = error;
|
|
2750
|
+
if (err.response?.status === 404) {
|
|
2751
|
+
return { success: true };
|
|
2752
|
+
}
|
|
2753
|
+
throw error;
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2672
2756
|
/**
|
|
2673
2757
|
* Build AssemblyAI transcription request from unified options
|
|
2674
2758
|
*/
|
|
@@ -2685,6 +2769,9 @@ var AssemblyAIAdapter = class extends BaseAdapter {
|
|
|
2685
2769
|
audio_url: audioUrl
|
|
2686
2770
|
};
|
|
2687
2771
|
if (options) {
|
|
2772
|
+
if (options.model) {
|
|
2773
|
+
request.speech_model = options.model;
|
|
2774
|
+
}
|
|
2688
2775
|
if (options.language) {
|
|
2689
2776
|
const languageCode = options.language.includes("_") ? options.language : `${options.language}_us`;
|
|
2690
2777
|
request.language_code = languageCode;
|
|
@@ -3175,6 +3262,9 @@ var DeepgramAdapter = class extends BaseAdapter {
|
|
|
3175
3262
|
if (!options) {
|
|
3176
3263
|
return params;
|
|
3177
3264
|
}
|
|
3265
|
+
if (options.model) {
|
|
3266
|
+
params.model = options.model;
|
|
3267
|
+
}
|
|
3178
3268
|
if (options.language) {
|
|
3179
3269
|
params.language = options.language;
|
|
3180
3270
|
}
|
|
@@ -3368,6 +3458,7 @@ var DeepgramAdapter = class extends BaseAdapter {
|
|
|
3368
3458
|
if (options?.sampleRate) params.append("sample_rate", options.sampleRate.toString());
|
|
3369
3459
|
if (options?.channels) params.append("channels", options.channels.toString());
|
|
3370
3460
|
if (options?.language) params.append("language", options.language);
|
|
3461
|
+
if (options?.model) params.append("model", options.model);
|
|
3371
3462
|
if (options?.languageDetection) params.append("detect_language", "true");
|
|
3372
3463
|
if (options?.diarization) params.append("diarize", "true");
|
|
3373
3464
|
if (options?.interimResults) params.append("interim_results", "true");
|
|
@@ -3508,6 +3599,9 @@ var transcriptionsCreate = (transcription, options) => {
|
|
|
3508
3599
|
var transcriptionsGet = (id, options) => {
|
|
3509
3600
|
return import_axios4.default.get(`/transcriptions/${id}`, options);
|
|
3510
3601
|
};
|
|
3602
|
+
var transcriptionsDelete = (id, options) => {
|
|
3603
|
+
return import_axios4.default.delete(`/transcriptions/${id}`, options);
|
|
3604
|
+
};
|
|
3511
3605
|
var transcriptionsListFiles = (id, params, options) => {
|
|
3512
3606
|
return import_axios4.default.get(`/transcriptions/${id}/files`, {
|
|
3513
3607
|
...options,
|
|
@@ -3663,6 +3757,37 @@ var AzureSTTAdapter = class extends BaseAdapter {
|
|
|
3663
3757
|
return this.createErrorResponse(error);
|
|
3664
3758
|
}
|
|
3665
3759
|
}
|
|
3760
|
+
/**
|
|
3761
|
+
* Delete a transcription and its associated data
|
|
3762
|
+
*
|
|
3763
|
+
* Removes the transcription from Azure's servers. This action is irreversible.
|
|
3764
|
+
*
|
|
3765
|
+
* @param transcriptId - The ID of the transcription to delete
|
|
3766
|
+
* @returns Promise with success status
|
|
3767
|
+
*
|
|
3768
|
+
* @example Delete a transcription
|
|
3769
|
+
* ```typescript
|
|
3770
|
+
* const result = await adapter.deleteTranscript('abc123-def456');
|
|
3771
|
+
* if (result.success) {
|
|
3772
|
+
* console.log('Transcription deleted successfully');
|
|
3773
|
+
* }
|
|
3774
|
+
* ```
|
|
3775
|
+
*
|
|
3776
|
+
* @see https://learn.microsoft.com/azure/cognitive-services/speech-service/batch-transcription
|
|
3777
|
+
*/
|
|
3778
|
+
async deleteTranscript(transcriptId) {
|
|
3779
|
+
this.validateConfig();
|
|
3780
|
+
try {
|
|
3781
|
+
await transcriptionsDelete(transcriptId, this.getAxiosConfig());
|
|
3782
|
+
return { success: true };
|
|
3783
|
+
} catch (error) {
|
|
3784
|
+
const err = error;
|
|
3785
|
+
if (err.response?.status === 404) {
|
|
3786
|
+
return { success: true };
|
|
3787
|
+
}
|
|
3788
|
+
throw error;
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3666
3791
|
/**
|
|
3667
3792
|
* Build Azure-specific transcription properties
|
|
3668
3793
|
*/
|
|
@@ -4074,11 +4199,12 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
|
|
|
4074
4199
|
async transcribe(audio, options) {
|
|
4075
4200
|
this.validateConfig();
|
|
4076
4201
|
try {
|
|
4202
|
+
const operatingPoint = options?.model || options?.metadata?.operating_point || "standard";
|
|
4077
4203
|
const jobConfig = {
|
|
4078
4204
|
type: "transcription",
|
|
4079
4205
|
transcription_config: {
|
|
4080
4206
|
language: options?.language || "en",
|
|
4081
|
-
operating_point:
|
|
4207
|
+
operating_point: operatingPoint
|
|
4082
4208
|
}
|
|
4083
4209
|
};
|
|
4084
4210
|
if (options?.diarization) {
|
|
@@ -4187,6 +4313,46 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
|
|
|
4187
4313
|
return this.createErrorResponse(error);
|
|
4188
4314
|
}
|
|
4189
4315
|
}
|
|
4316
|
+
/**
|
|
4317
|
+
* Delete a transcription job and its associated data
|
|
4318
|
+
*
|
|
4319
|
+
* Removes the job and all associated resources from Speechmatics' servers.
|
|
4320
|
+
* This action is irreversible.
|
|
4321
|
+
*
|
|
4322
|
+
* @param transcriptId - The job ID to delete
|
|
4323
|
+
* @param force - Force delete even if job is still running (default: false)
|
|
4324
|
+
* @returns Promise with success status
|
|
4325
|
+
*
|
|
4326
|
+
* @example Delete a completed job
|
|
4327
|
+
* ```typescript
|
|
4328
|
+
* const result = await adapter.deleteTranscript('job-abc123');
|
|
4329
|
+
* if (result.success) {
|
|
4330
|
+
* console.log('Job deleted successfully');
|
|
4331
|
+
* }
|
|
4332
|
+
* ```
|
|
4333
|
+
*
|
|
4334
|
+
* @example Force delete a running job
|
|
4335
|
+
* ```typescript
|
|
4336
|
+
* const result = await adapter.deleteTranscript('job-abc123', true);
|
|
4337
|
+
* ```
|
|
4338
|
+
*
|
|
4339
|
+
* @see https://docs.speechmatics.com/
|
|
4340
|
+
*/
|
|
4341
|
+
async deleteTranscript(transcriptId, force = false) {
|
|
4342
|
+
this.validateConfig();
|
|
4343
|
+
try {
|
|
4344
|
+
await this.client.delete(`/jobs/${transcriptId}`, {
|
|
4345
|
+
params: force ? { force: true } : void 0
|
|
4346
|
+
});
|
|
4347
|
+
return { success: true };
|
|
4348
|
+
} catch (error) {
|
|
4349
|
+
const err = error;
|
|
4350
|
+
if (err.response?.status === 404) {
|
|
4351
|
+
return { success: true };
|
|
4352
|
+
}
|
|
4353
|
+
throw error;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4190
4356
|
/**
|
|
4191
4357
|
* Normalize Speechmatics status to unified status
|
|
4192
4358
|
*/
|