voice-router-dev 0.2.4 → 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.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
- * Poll for transcription completion
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
  *
@@ -2474,6 +2519,9 @@ var createTranscript = (transcriptParams, options) => {
2474
2519
  var getTranscript = (transcriptId, options) => {
2475
2520
  return axios2.get(`/v2/transcript/${transcriptId}`, options);
2476
2521
  };
2522
+ var deleteTranscript = (transcriptId, options) => {
2523
+ return axios2.delete(`/v2/transcript/${transcriptId}`, options);
2524
+ };
2477
2525
 
2478
2526
  // src/adapters/assemblyai-adapter.ts
2479
2527
  var AssemblyAIAdapter = class extends BaseAdapter {
@@ -2605,6 +2653,41 @@ var AssemblyAIAdapter = class extends BaseAdapter {
2605
2653
  return this.createErrorResponse(error);
2606
2654
  }
2607
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
+ }
2608
2691
  /**
2609
2692
  * Build AssemblyAI transcription request from unified options
2610
2693
  */
@@ -2621,6 +2704,9 @@ var AssemblyAIAdapter = class extends BaseAdapter {
2621
2704
  audio_url: audioUrl
2622
2705
  };
2623
2706
  if (options) {
2707
+ if (options.model) {
2708
+ request.speech_model = options.model;
2709
+ }
2624
2710
  if (options.language) {
2625
2711
  const languageCode = options.language.includes("_") ? options.language : `${options.language}_us`;
2626
2712
  request.language_code = languageCode;
@@ -3111,6 +3197,9 @@ var DeepgramAdapter = class extends BaseAdapter {
3111
3197
  if (!options) {
3112
3198
  return params;
3113
3199
  }
3200
+ if (options.model) {
3201
+ params.model = options.model;
3202
+ }
3114
3203
  if (options.language) {
3115
3204
  params.language = options.language;
3116
3205
  }
@@ -3445,6 +3534,9 @@ var transcriptionsCreate = (transcription, options) => {
3445
3534
  var transcriptionsGet = (id, options) => {
3446
3535
  return axios4.get(`/transcriptions/${id}`, options);
3447
3536
  };
3537
+ var transcriptionsDelete = (id, options) => {
3538
+ return axios4.delete(`/transcriptions/${id}`, options);
3539
+ };
3448
3540
  var transcriptionsListFiles = (id, params, options) => {
3449
3541
  return axios4.get(`/transcriptions/${id}/files`, {
3450
3542
  ...options,
@@ -3600,6 +3692,37 @@ var AzureSTTAdapter = class extends BaseAdapter {
3600
3692
  return this.createErrorResponse(error);
3601
3693
  }
3602
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
+ }
3603
3726
  /**
3604
3727
  * Build Azure-specific transcription properties
3605
3728
  */
@@ -4011,11 +4134,12 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
4011
4134
  async transcribe(audio, options) {
4012
4135
  this.validateConfig();
4013
4136
  try {
4137
+ const operatingPoint = options?.model || options?.metadata?.operating_point || "standard";
4014
4138
  const jobConfig = {
4015
4139
  type: "transcription",
4016
4140
  transcription_config: {
4017
4141
  language: options?.language || "en",
4018
- operating_point: options?.metadata?.operating_point || "standard"
4142
+ operating_point: operatingPoint
4019
4143
  }
4020
4144
  };
4021
4145
  if (options?.diarization) {
@@ -4124,6 +4248,46 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
4124
4248
  return this.createErrorResponse(error);
4125
4249
  }
4126
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
+ }
4127
4291
  /**
4128
4292
  * Normalize Speechmatics status to unified status
4129
4293
  */