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.mjs
CHANGED
|
@@ -1692,12 +1692,18 @@ var preRecordedControllerInitPreRecordedJobV2 = (initTranscriptionRequest, optio
|
|
|
1692
1692
|
var preRecordedControllerGetPreRecordedJobV2 = (id, options) => {
|
|
1693
1693
|
return axios.get(`/v2/pre-recorded/${id}`, options);
|
|
1694
1694
|
};
|
|
1695
|
+
var preRecordedControllerDeletePreRecordedJobV2 = (id, options) => {
|
|
1696
|
+
return axios.delete(`/v2/pre-recorded/${id}`, options);
|
|
1697
|
+
};
|
|
1695
1698
|
var streamingControllerInitStreamingSessionV2 = (streamingRequest, params, options) => {
|
|
1696
1699
|
return axios.post("/v2/live", streamingRequest, {
|
|
1697
1700
|
...options,
|
|
1698
1701
|
params: { ...params, ...options?.params }
|
|
1699
1702
|
});
|
|
1700
1703
|
};
|
|
1704
|
+
var streamingControllerDeleteStreamingJobV2 = (id, options) => {
|
|
1705
|
+
return axios.delete(`/v2/live/${id}`, options);
|
|
1706
|
+
};
|
|
1701
1707
|
|
|
1702
1708
|
// src/adapters/gladia-adapter.ts
|
|
1703
1709
|
var GladiaAdapter = class extends BaseAdapter {
|
|
@@ -1985,8 +1991,47 @@ var GladiaAdapter = class extends BaseAdapter {
|
|
|
1985
1991
|
}));
|
|
1986
1992
|
}
|
|
1987
1993
|
/**
|
|
1988
|
-
*
|
|
1994
|
+
* Delete a transcription job and its associated data
|
|
1995
|
+
*
|
|
1996
|
+
* Removes the transcription data from Gladia's servers. This action is
|
|
1997
|
+
* irreversible. Supports both pre-recorded and streaming job IDs.
|
|
1998
|
+
*
|
|
1999
|
+
* @param transcriptId - The ID of the transcript/job to delete
|
|
2000
|
+
* @param jobType - Type of job: 'pre-recorded' or 'streaming' (defaults to 'pre-recorded')
|
|
2001
|
+
* @returns Promise with success status
|
|
2002
|
+
*
|
|
2003
|
+
* @example Delete a pre-recorded transcript
|
|
2004
|
+
* ```typescript
|
|
2005
|
+
* const result = await adapter.deleteTranscript('abc123');
|
|
2006
|
+
* if (result.success) {
|
|
2007
|
+
* console.log('Transcript deleted successfully');
|
|
2008
|
+
* }
|
|
2009
|
+
* ```
|
|
2010
|
+
*
|
|
2011
|
+
* @example Delete a streaming job
|
|
2012
|
+
* ```typescript
|
|
2013
|
+
* const result = await adapter.deleteTranscript('stream-456', 'streaming');
|
|
2014
|
+
* ```
|
|
2015
|
+
*
|
|
2016
|
+
* @see https://docs.gladia.io/
|
|
1989
2017
|
*/
|
|
2018
|
+
async deleteTranscript(transcriptId, jobType = "pre-recorded") {
|
|
2019
|
+
this.validateConfig();
|
|
2020
|
+
try {
|
|
2021
|
+
if (jobType === "streaming") {
|
|
2022
|
+
await streamingControllerDeleteStreamingJobV2(transcriptId, this.getAxiosConfig());
|
|
2023
|
+
} else {
|
|
2024
|
+
await preRecordedControllerDeletePreRecordedJobV2(transcriptId, this.getAxiosConfig());
|
|
2025
|
+
}
|
|
2026
|
+
return { success: true };
|
|
2027
|
+
} catch (error) {
|
|
2028
|
+
const err = error;
|
|
2029
|
+
if (err.response?.status === 404) {
|
|
2030
|
+
return { success: true };
|
|
2031
|
+
}
|
|
2032
|
+
throw error;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
1990
2035
|
/**
|
|
1991
2036
|
* Stream audio for real-time transcription
|
|
1992
2037
|
*
|
|
@@ -2041,7 +2086,8 @@ var GladiaAdapter = class extends BaseAdapter {
|
|
|
2041
2086
|
encoding: options?.encoding ? mapEncodingToProvider(options.encoding, "gladia") : void 0,
|
|
2042
2087
|
sample_rate: validatedSampleRate,
|
|
2043
2088
|
channels: options?.channels,
|
|
2044
|
-
endpointing: options?.endpointing
|
|
2089
|
+
endpointing: options?.endpointing,
|
|
2090
|
+
model: options?.model
|
|
2045
2091
|
};
|
|
2046
2092
|
if (options?.language) {
|
|
2047
2093
|
streamingRequest.language_config = {
|
|
@@ -2473,6 +2519,9 @@ var createTranscript = (transcriptParams, options) => {
|
|
|
2473
2519
|
var getTranscript = (transcriptId, options) => {
|
|
2474
2520
|
return axios2.get(`/v2/transcript/${transcriptId}`, options);
|
|
2475
2521
|
};
|
|
2522
|
+
var deleteTranscript = (transcriptId, options) => {
|
|
2523
|
+
return axios2.delete(`/v2/transcript/${transcriptId}`, options);
|
|
2524
|
+
};
|
|
2476
2525
|
|
|
2477
2526
|
// src/adapters/assemblyai-adapter.ts
|
|
2478
2527
|
var AssemblyAIAdapter = class extends BaseAdapter {
|
|
@@ -2604,6 +2653,41 @@ var AssemblyAIAdapter = class extends BaseAdapter {
|
|
|
2604
2653
|
return this.createErrorResponse(error);
|
|
2605
2654
|
}
|
|
2606
2655
|
}
|
|
2656
|
+
/**
|
|
2657
|
+
* Delete a transcription and its associated data
|
|
2658
|
+
*
|
|
2659
|
+
* Removes the transcription data from AssemblyAI's servers. This action
|
|
2660
|
+
* is irreversible. The transcript will be marked as deleted and its
|
|
2661
|
+
* content will no longer be accessible.
|
|
2662
|
+
*
|
|
2663
|
+
* @param transcriptId - The ID of the transcript to delete
|
|
2664
|
+
* @returns Promise with success status
|
|
2665
|
+
*
|
|
2666
|
+
* @example Delete a transcript
|
|
2667
|
+
* ```typescript
|
|
2668
|
+
* const result = await adapter.deleteTranscript('abc123');
|
|
2669
|
+
* if (result.success) {
|
|
2670
|
+
* console.log('Transcript deleted successfully');
|
|
2671
|
+
* }
|
|
2672
|
+
* ```
|
|
2673
|
+
*
|
|
2674
|
+
* @see https://www.assemblyai.com/docs/api-reference/transcripts/delete
|
|
2675
|
+
*/
|
|
2676
|
+
async deleteTranscript(transcriptId) {
|
|
2677
|
+
this.validateConfig();
|
|
2678
|
+
try {
|
|
2679
|
+
const response = await deleteTranscript(transcriptId, this.getAxiosConfig());
|
|
2680
|
+
return {
|
|
2681
|
+
success: response.data.status === "completed" || response.status === 200
|
|
2682
|
+
};
|
|
2683
|
+
} catch (error) {
|
|
2684
|
+
const err = error;
|
|
2685
|
+
if (err.response?.status === 404) {
|
|
2686
|
+
return { success: true };
|
|
2687
|
+
}
|
|
2688
|
+
throw error;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2607
2691
|
/**
|
|
2608
2692
|
* Build AssemblyAI transcription request from unified options
|
|
2609
2693
|
*/
|
|
@@ -2620,6 +2704,9 @@ var AssemblyAIAdapter = class extends BaseAdapter {
|
|
|
2620
2704
|
audio_url: audioUrl
|
|
2621
2705
|
};
|
|
2622
2706
|
if (options) {
|
|
2707
|
+
if (options.model) {
|
|
2708
|
+
request.speech_model = options.model;
|
|
2709
|
+
}
|
|
2623
2710
|
if (options.language) {
|
|
2624
2711
|
const languageCode = options.language.includes("_") ? options.language : `${options.language}_us`;
|
|
2625
2712
|
request.language_code = languageCode;
|
|
@@ -3110,6 +3197,9 @@ var DeepgramAdapter = class extends BaseAdapter {
|
|
|
3110
3197
|
if (!options) {
|
|
3111
3198
|
return params;
|
|
3112
3199
|
}
|
|
3200
|
+
if (options.model) {
|
|
3201
|
+
params.model = options.model;
|
|
3202
|
+
}
|
|
3113
3203
|
if (options.language) {
|
|
3114
3204
|
params.language = options.language;
|
|
3115
3205
|
}
|
|
@@ -3303,6 +3393,7 @@ var DeepgramAdapter = class extends BaseAdapter {
|
|
|
3303
3393
|
if (options?.sampleRate) params.append("sample_rate", options.sampleRate.toString());
|
|
3304
3394
|
if (options?.channels) params.append("channels", options.channels.toString());
|
|
3305
3395
|
if (options?.language) params.append("language", options.language);
|
|
3396
|
+
if (options?.model) params.append("model", options.model);
|
|
3306
3397
|
if (options?.languageDetection) params.append("detect_language", "true");
|
|
3307
3398
|
if (options?.diarization) params.append("diarize", "true");
|
|
3308
3399
|
if (options?.interimResults) params.append("interim_results", "true");
|
|
@@ -3443,6 +3534,9 @@ var transcriptionsCreate = (transcription, options) => {
|
|
|
3443
3534
|
var transcriptionsGet = (id, options) => {
|
|
3444
3535
|
return axios4.get(`/transcriptions/${id}`, options);
|
|
3445
3536
|
};
|
|
3537
|
+
var transcriptionsDelete = (id, options) => {
|
|
3538
|
+
return axios4.delete(`/transcriptions/${id}`, options);
|
|
3539
|
+
};
|
|
3446
3540
|
var transcriptionsListFiles = (id, params, options) => {
|
|
3447
3541
|
return axios4.get(`/transcriptions/${id}/files`, {
|
|
3448
3542
|
...options,
|
|
@@ -3598,6 +3692,37 @@ var AzureSTTAdapter = class extends BaseAdapter {
|
|
|
3598
3692
|
return this.createErrorResponse(error);
|
|
3599
3693
|
}
|
|
3600
3694
|
}
|
|
3695
|
+
/**
|
|
3696
|
+
* Delete a transcription and its associated data
|
|
3697
|
+
*
|
|
3698
|
+
* Removes the transcription from Azure's servers. This action is irreversible.
|
|
3699
|
+
*
|
|
3700
|
+
* @param transcriptId - The ID of the transcription to delete
|
|
3701
|
+
* @returns Promise with success status
|
|
3702
|
+
*
|
|
3703
|
+
* @example Delete a transcription
|
|
3704
|
+
* ```typescript
|
|
3705
|
+
* const result = await adapter.deleteTranscript('abc123-def456');
|
|
3706
|
+
* if (result.success) {
|
|
3707
|
+
* console.log('Transcription deleted successfully');
|
|
3708
|
+
* }
|
|
3709
|
+
* ```
|
|
3710
|
+
*
|
|
3711
|
+
* @see https://learn.microsoft.com/azure/cognitive-services/speech-service/batch-transcription
|
|
3712
|
+
*/
|
|
3713
|
+
async deleteTranscript(transcriptId) {
|
|
3714
|
+
this.validateConfig();
|
|
3715
|
+
try {
|
|
3716
|
+
await transcriptionsDelete(transcriptId, this.getAxiosConfig());
|
|
3717
|
+
return { success: true };
|
|
3718
|
+
} catch (error) {
|
|
3719
|
+
const err = error;
|
|
3720
|
+
if (err.response?.status === 404) {
|
|
3721
|
+
return { success: true };
|
|
3722
|
+
}
|
|
3723
|
+
throw error;
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3601
3726
|
/**
|
|
3602
3727
|
* Build Azure-specific transcription properties
|
|
3603
3728
|
*/
|
|
@@ -4009,11 +4134,12 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
|
|
|
4009
4134
|
async transcribe(audio, options) {
|
|
4010
4135
|
this.validateConfig();
|
|
4011
4136
|
try {
|
|
4137
|
+
const operatingPoint = options?.model || options?.metadata?.operating_point || "standard";
|
|
4012
4138
|
const jobConfig = {
|
|
4013
4139
|
type: "transcription",
|
|
4014
4140
|
transcription_config: {
|
|
4015
4141
|
language: options?.language || "en",
|
|
4016
|
-
operating_point:
|
|
4142
|
+
operating_point: operatingPoint
|
|
4017
4143
|
}
|
|
4018
4144
|
};
|
|
4019
4145
|
if (options?.diarization) {
|
|
@@ -4122,6 +4248,46 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
|
|
|
4122
4248
|
return this.createErrorResponse(error);
|
|
4123
4249
|
}
|
|
4124
4250
|
}
|
|
4251
|
+
/**
|
|
4252
|
+
* Delete a transcription job and its associated data
|
|
4253
|
+
*
|
|
4254
|
+
* Removes the job and all associated resources from Speechmatics' servers.
|
|
4255
|
+
* This action is irreversible.
|
|
4256
|
+
*
|
|
4257
|
+
* @param transcriptId - The job ID to delete
|
|
4258
|
+
* @param force - Force delete even if job is still running (default: false)
|
|
4259
|
+
* @returns Promise with success status
|
|
4260
|
+
*
|
|
4261
|
+
* @example Delete a completed job
|
|
4262
|
+
* ```typescript
|
|
4263
|
+
* const result = await adapter.deleteTranscript('job-abc123');
|
|
4264
|
+
* if (result.success) {
|
|
4265
|
+
* console.log('Job deleted successfully');
|
|
4266
|
+
* }
|
|
4267
|
+
* ```
|
|
4268
|
+
*
|
|
4269
|
+
* @example Force delete a running job
|
|
4270
|
+
* ```typescript
|
|
4271
|
+
* const result = await adapter.deleteTranscript('job-abc123', true);
|
|
4272
|
+
* ```
|
|
4273
|
+
*
|
|
4274
|
+
* @see https://docs.speechmatics.com/
|
|
4275
|
+
*/
|
|
4276
|
+
async deleteTranscript(transcriptId, force = false) {
|
|
4277
|
+
this.validateConfig();
|
|
4278
|
+
try {
|
|
4279
|
+
await this.client.delete(`/jobs/${transcriptId}`, {
|
|
4280
|
+
params: force ? { force: true } : void 0
|
|
4281
|
+
});
|
|
4282
|
+
return { success: true };
|
|
4283
|
+
} catch (error) {
|
|
4284
|
+
const err = error;
|
|
4285
|
+
if (err.response?.status === 404) {
|
|
4286
|
+
return { success: true };
|
|
4287
|
+
}
|
|
4288
|
+
throw error;
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4125
4291
|
/**
|
|
4126
4292
|
* Normalize Speechmatics status to unified status
|
|
4127
4293
|
*/
|