voice-router-dev 0.3.2 → 0.3.4

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.js CHANGED
@@ -42,18 +42,18 @@ __export(src_exports, {
42
42
  BaseAdapter: () => BaseAdapter,
43
43
  BaseWebhookHandler: () => BaseWebhookHandler,
44
44
  DeepgramAdapter: () => DeepgramAdapter,
45
- DeepgramEncoding: () => ListenV1EncodingParameter,
45
+ DeepgramEncoding: () => DeepgramEncoding,
46
46
  DeepgramModel: () => DeepgramModel,
47
- DeepgramRedact: () => ListenV1RedactParameterOneOfItem,
48
- DeepgramTopicMode: () => SharedCustomTopicModeParameter,
47
+ DeepgramRedact: () => DeepgramRedact,
48
+ DeepgramTopicMode: () => DeepgramTopicMode,
49
49
  DeepgramWebhookHandler: () => DeepgramWebhookHandler,
50
50
  GladiaAdapter: () => GladiaAdapter,
51
- GladiaBitDepth: () => StreamingSupportedBitDepthEnum,
52
- GladiaEncoding: () => StreamingSupportedEncodingEnum,
53
- GladiaLanguage: () => TranscriptionLanguageCodeEnum,
54
- GladiaModel: () => StreamingSupportedModels,
55
- GladiaSampleRate: () => StreamingSupportedSampleRateEnum,
56
- GladiaTranslationLanguage: () => TranslationLanguageCodeEnum,
51
+ GladiaBitDepth: () => GladiaBitDepth,
52
+ GladiaEncoding: () => GladiaEncoding,
53
+ GladiaLanguage: () => GladiaLanguage,
54
+ GladiaModel: () => GladiaModel,
55
+ GladiaSampleRate: () => GladiaSampleRate,
56
+ GladiaTranslationLanguage: () => GladiaTranslationLanguage,
57
57
  GladiaTypes: () => schema_exports,
58
58
  GladiaWebhookHandler: () => GladiaWebhookHandler,
59
59
  ListenV1EncodingParameter: () => ListenV1EncodingParameter,
@@ -244,8 +244,20 @@ var VoiceRouter = class {
244
244
  return adapter.deleteTranscript(transcriptId);
245
245
  }
246
246
  /**
247
- * List recent transcriptions
248
- * Not all providers support this operation
247
+ * List recent transcriptions with filtering
248
+ *
249
+ * Supports date/time filtering, status filtering, and pagination.
250
+ * Not all providers support this operation.
251
+ *
252
+ * @example Filter by date range
253
+ * ```typescript
254
+ * const { transcripts } = await router.listTranscripts('assemblyai', {
255
+ * afterDate: '2026-01-01',
256
+ * beforeDate: '2026-01-31',
257
+ * status: 'completed',
258
+ * limit: 50
259
+ * })
260
+ * ```
249
261
  */
250
262
  async listTranscripts(provider, options) {
251
263
  const adapter = this.getAdapter(provider);
@@ -547,7 +559,40 @@ var TranslationLanguageCodeEnum = {
547
559
  zh: "zh"
548
560
  };
549
561
 
562
+ // src/generated/assemblyai/schema/transcriptStatus.ts
563
+ var TranscriptStatus = {
564
+ queued: "queued",
565
+ processing: "processing",
566
+ completed: "completed",
567
+ error: "error"
568
+ };
569
+
570
+ // src/generated/gladia/schema/transcriptionControllerListV2StatusItem.ts
571
+ var TranscriptionControllerListV2StatusItem = {
572
+ queued: "queued",
573
+ processing: "processing",
574
+ done: "done",
575
+ error: "error"
576
+ };
577
+
578
+ // src/generated/azure/schema/status.ts
579
+ var Status = {
580
+ NotStarted: "NotStarted",
581
+ Running: "Running",
582
+ Succeeded: "Succeeded",
583
+ Failed: "Failed"
584
+ };
585
+
586
+ // src/generated/deepgram/schema/manageV1FilterStatusParameter.ts
587
+ var ManageV1FilterStatusParameter = {
588
+ succeeded: "succeeded",
589
+ failed: "failed"
590
+ };
591
+
550
592
  // src/constants.ts
593
+ var DeepgramEncoding = ListenV1EncodingParameter;
594
+ var DeepgramRedact = ListenV1RedactParameterOneOfItem;
595
+ var DeepgramTopicMode = SharedCustomTopicModeParameter;
551
596
  var DeepgramModel = {
552
597
  // Nova 3 models (latest)
553
598
  "nova-3": "nova-3",
@@ -584,6 +629,12 @@ var DeepgramModel = {
584
629
  voicemail: "voicemail",
585
630
  video: "video"
586
631
  };
632
+ var GladiaEncoding = StreamingSupportedEncodingEnum;
633
+ var GladiaSampleRate = StreamingSupportedSampleRateEnum;
634
+ var GladiaBitDepth = StreamingSupportedBitDepthEnum;
635
+ var GladiaModel = StreamingSupportedModels;
636
+ var GladiaLanguage = TranscriptionLanguageCodeEnum;
637
+ var GladiaTranslationLanguage = TranslationLanguageCodeEnum;
587
638
  var AssemblyAIEncoding = {
588
639
  /** PCM signed 16-bit little-endian (recommended) */
589
640
  pcmS16le: "pcm_s16le",
@@ -1551,14 +1602,6 @@ var TranscriptionControllerListV2KindItem = {
1551
1602
  live: "live"
1552
1603
  };
1553
1604
 
1554
- // src/generated/gladia/schema/transcriptionControllerListV2StatusItem.ts
1555
- var TranscriptionControllerListV2StatusItem = {
1556
- queued: "queued",
1557
- processing: "processing",
1558
- done: "done",
1559
- error: "error"
1560
- };
1561
-
1562
1605
  // src/generated/gladia/schema/transcriptMessageType.ts
1563
1606
  var TranscriptMessageType = {
1564
1607
  transcript: "transcript"
@@ -1843,6 +1886,18 @@ var preRecordedControllerGetPreRecordedJobV2 = (id, options) => {
1843
1886
  var preRecordedControllerDeletePreRecordedJobV2 = (id, options) => {
1844
1887
  return import_axios.default.delete(`/v2/pre-recorded/${id}`, options);
1845
1888
  };
1889
+ var preRecordedControllerGetAudioV2 = (id, options) => {
1890
+ return import_axios.default.get(`/v2/pre-recorded/${id}/file`, {
1891
+ responseType: "blob",
1892
+ ...options
1893
+ });
1894
+ };
1895
+ var transcriptionControllerListV2 = (params, options) => {
1896
+ return import_axios.default.get("/v2/transcription", {
1897
+ ...options,
1898
+ params: { ...params, ...options?.params }
1899
+ });
1900
+ };
1846
1901
  var streamingControllerInitStreamingSessionV2 = (streamingRequest, params, options) => {
1847
1902
  return import_axios.default.post("/v2/live", streamingRequest, {
1848
1903
  ...options,
@@ -1852,6 +1907,12 @@ var streamingControllerInitStreamingSessionV2 = (streamingRequest, params, optio
1852
1907
  var streamingControllerDeleteStreamingJobV2 = (id, options) => {
1853
1908
  return import_axios.default.delete(`/v2/live/${id}`, options);
1854
1909
  };
1910
+ var streamingControllerGetAudioV2 = (id, options) => {
1911
+ return import_axios.default.get(`/v2/live/${id}/file`, {
1912
+ responseType: "blob",
1913
+ ...options
1914
+ });
1915
+ };
1855
1916
 
1856
1917
  // src/adapters/gladia-adapter.ts
1857
1918
  var GladiaAdapter = class extends BaseAdapter {
@@ -1867,8 +1928,12 @@ var GladiaAdapter = class extends BaseAdapter {
1867
1928
  summarization: true,
1868
1929
  sentimentAnalysis: true,
1869
1930
  entityDetection: true,
1870
- piiRedaction: false
1931
+ piiRedaction: false,
1871
1932
  // Gladia doesn't have PII redaction in their API
1933
+ listTranscripts: true,
1934
+ deleteTranscript: true,
1935
+ getAudioFile: true
1936
+ // Gladia stores and allows downloading original audio files
1872
1937
  };
1873
1938
  this.baseUrl = "https://api.gladia.io";
1874
1939
  }
@@ -2083,6 +2148,10 @@ var GladiaAdapter = class extends BaseAdapter {
2083
2148
  utterances: this.extractUtterances(transcription),
2084
2149
  summary: result?.summarization?.results || void 0,
2085
2150
  metadata: {
2151
+ sourceAudioUrl: response.file?.source ?? void 0,
2152
+ audioFileAvailable: this.capabilities.getAudioFile ?? false,
2153
+ filename: response.file?.filename ?? void 0,
2154
+ audioDuration: response.file?.audio_duration ?? void 0,
2086
2155
  requestParams: response.request_params
2087
2156
  },
2088
2157
  createdAt: response.created_at,
@@ -2201,6 +2270,204 @@ var GladiaAdapter = class extends BaseAdapter {
2201
2270
  throw error;
2202
2271
  }
2203
2272
  }
2273
+ /**
2274
+ * Download the original audio file from a transcription
2275
+ *
2276
+ * Gladia stores the audio files used for transcription and allows downloading them.
2277
+ * This works for both pre-recorded and streaming (live) transcriptions.
2278
+ *
2279
+ * @param transcriptId - The ID of the transcript/job
2280
+ * @param jobType - Type of job: 'pre-recorded' or 'streaming' (defaults to 'pre-recorded')
2281
+ * @returns Promise with the audio file as a Blob, or error
2282
+ *
2283
+ * @example Download audio from a pre-recorded transcription
2284
+ * ```typescript
2285
+ * const result = await adapter.getAudioFile('abc123');
2286
+ * if (result.success && result.data) {
2287
+ * // Save to file (Node.js)
2288
+ * const buffer = Buffer.from(await result.data.arrayBuffer());
2289
+ * fs.writeFileSync('audio.mp3', buffer);
2290
+ *
2291
+ * // Or create download URL (browser)
2292
+ * const url = URL.createObjectURL(result.data);
2293
+ * }
2294
+ * ```
2295
+ *
2296
+ * @example Download audio from a live/streaming session
2297
+ * ```typescript
2298
+ * const result = await adapter.getAudioFile('stream-456', 'streaming');
2299
+ * if (result.success) {
2300
+ * console.log('Audio file size:', result.data?.size);
2301
+ * }
2302
+ * ```
2303
+ *
2304
+ * @see https://docs.gladia.io/
2305
+ */
2306
+ async getAudioFile(transcriptId, jobType = "pre-recorded") {
2307
+ this.validateConfig();
2308
+ try {
2309
+ let response;
2310
+ if (jobType === "streaming") {
2311
+ response = await streamingControllerGetAudioV2(transcriptId, this.getAxiosConfig());
2312
+ } else {
2313
+ response = await preRecordedControllerGetAudioV2(transcriptId, this.getAxiosConfig());
2314
+ }
2315
+ return {
2316
+ success: true,
2317
+ data: response.data
2318
+ };
2319
+ } catch (error) {
2320
+ const err = error;
2321
+ if (err.response?.status === 404) {
2322
+ return {
2323
+ success: false,
2324
+ error: {
2325
+ code: "NOT_FOUND",
2326
+ message: `Audio file not found for transcript ${transcriptId}`
2327
+ }
2328
+ };
2329
+ }
2330
+ return {
2331
+ success: false,
2332
+ error: {
2333
+ code: "DOWNLOAD_ERROR",
2334
+ message: err.message || "Failed to download audio file"
2335
+ }
2336
+ };
2337
+ }
2338
+ }
2339
+ /**
2340
+ * List recent transcriptions with filtering
2341
+ *
2342
+ * Retrieves a list of transcription jobs (both pre-recorded and streaming)
2343
+ * with optional filtering by status, date, and custom metadata.
2344
+ *
2345
+ * @param options - Filtering and pagination options
2346
+ * @param options.limit - Maximum number of transcripts to return
2347
+ * @param options.offset - Pagination offset (skip N results)
2348
+ * @param options.status - Filter by status (queued, processing, done, error)
2349
+ * @param options.date - Filter by exact date (ISO format YYYY-MM-DD)
2350
+ * @param options.beforeDate - Filter for transcripts before this date
2351
+ * @param options.afterDate - Filter for transcripts after this date
2352
+ * @param options.gladia - Full Gladia-specific options (custom_metadata, kind, etc.)
2353
+ * @returns List of transcripts with pagination info
2354
+ *
2355
+ * @example List recent transcripts
2356
+ * ```typescript
2357
+ * const { transcripts, hasMore } = await adapter.listTranscripts({
2358
+ * limit: 50,
2359
+ * status: 'done'
2360
+ * })
2361
+ * ```
2362
+ *
2363
+ * @example Filter by date range
2364
+ * ```typescript
2365
+ * const { transcripts } = await adapter.listTranscripts({
2366
+ * afterDate: '2026-01-01',
2367
+ * beforeDate: '2026-01-31',
2368
+ * limit: 100
2369
+ * })
2370
+ * ```
2371
+ *
2372
+ * @example Filter by custom metadata
2373
+ * ```typescript
2374
+ * const { transcripts } = await adapter.listTranscripts({
2375
+ * gladia: {
2376
+ * custom_metadata: { project: 'my-project' }
2377
+ * }
2378
+ * })
2379
+ * ```
2380
+ *
2381
+ * @see https://docs.gladia.io/
2382
+ */
2383
+ async listTranscripts(options) {
2384
+ this.validateConfig();
2385
+ try {
2386
+ const params = {
2387
+ ...options?.gladia
2388
+ };
2389
+ if (options?.limit) {
2390
+ params.limit = options.limit;
2391
+ }
2392
+ if (options?.offset) {
2393
+ params.offset = options.offset;
2394
+ }
2395
+ if (options?.status) {
2396
+ const statusMap = {
2397
+ queued: TranscriptionControllerListV2StatusItem.queued,
2398
+ processing: TranscriptionControllerListV2StatusItem.processing,
2399
+ completed: TranscriptionControllerListV2StatusItem.done,
2400
+ // Gladia uses 'done' not 'completed'
2401
+ done: TranscriptionControllerListV2StatusItem.done,
2402
+ error: TranscriptionControllerListV2StatusItem.error
2403
+ };
2404
+ const mappedStatus = statusMap[options.status.toLowerCase()];
2405
+ if (mappedStatus) {
2406
+ params.status = [mappedStatus];
2407
+ }
2408
+ }
2409
+ if (options?.date) {
2410
+ params.date = options.date;
2411
+ }
2412
+ if (options?.beforeDate) {
2413
+ params.before_date = options.beforeDate;
2414
+ }
2415
+ if (options?.afterDate) {
2416
+ params.after_date = options.afterDate;
2417
+ }
2418
+ const response = await transcriptionControllerListV2(params, this.getAxiosConfig());
2419
+ const transcripts = response.data.items.map(
2420
+ (item) => this.normalizeListItem(item)
2421
+ );
2422
+ return {
2423
+ transcripts,
2424
+ hasMore: response.data.next !== null
2425
+ };
2426
+ } catch (error) {
2427
+ return {
2428
+ transcripts: [this.createErrorResponse(error)],
2429
+ hasMore: false
2430
+ };
2431
+ }
2432
+ }
2433
+ /**
2434
+ * Normalize a transcript list item to unified format
2435
+ */
2436
+ normalizeListItem(item) {
2437
+ const preRecorded = item;
2438
+ const streaming = item;
2439
+ const isLive = "kind" in item && item.kind === "live";
2440
+ const id = preRecorded.id || streaming.id;
2441
+ const status = normalizeStatus(preRecorded.status || streaming.status, "gladia");
2442
+ const text = preRecorded.result?.transcription?.full_transcript || "";
2443
+ const file = preRecorded.file;
2444
+ return {
2445
+ success: status !== "error",
2446
+ provider: this.name,
2447
+ data: {
2448
+ id,
2449
+ text,
2450
+ status,
2451
+ duration: file?.audio_duration ?? void 0,
2452
+ metadata: {
2453
+ sourceAudioUrl: file?.source ?? void 0,
2454
+ audioFileAvailable: this.capabilities.getAudioFile ?? false,
2455
+ filename: file?.filename ?? void 0,
2456
+ audioDuration: file?.audio_duration ?? void 0,
2457
+ numberOfChannels: file?.number_of_channels ?? void 0,
2458
+ createdAt: preRecorded.created_at || streaming.created_at,
2459
+ completedAt: preRecorded.completed_at || streaming.completed_at || void 0,
2460
+ kind: isLive ? "live" : "pre-recorded",
2461
+ customMetadata: preRecorded.custom_metadata || streaming.custom_metadata
2462
+ }
2463
+ },
2464
+ error: preRecorded.error_code || streaming.error_code ? {
2465
+ code: (preRecorded.error_code || streaming.error_code)?.toString() || "ERROR",
2466
+ message: "Transcription failed"
2467
+ } : void 0,
2468
+ raw: item
2469
+ };
2470
+ }
2204
2471
  /**
2205
2472
  * Stream audio for real-time transcription
2206
2473
  *
@@ -3081,18 +3348,16 @@ var TranscriptReadyStatus = {
3081
3348
  error: "error"
3082
3349
  };
3083
3350
 
3084
- // src/generated/assemblyai/schema/transcriptStatus.ts
3085
- var TranscriptStatus = {
3086
- queued: "queued",
3087
- processing: "processing",
3088
- completed: "completed",
3089
- error: "error"
3090
- };
3091
-
3092
3351
  // src/generated/assemblyai/api/assemblyAIAPI.ts
3093
3352
  var createTranscript = (transcriptParams, options) => {
3094
3353
  return import_axios2.default.post("/v2/transcript", transcriptParams, options);
3095
3354
  };
3355
+ var listTranscripts = (params, options) => {
3356
+ return import_axios2.default.get("/v2/transcript", {
3357
+ ...options,
3358
+ params: { ...params, ...options?.params }
3359
+ });
3360
+ };
3096
3361
  var getTranscript = (transcriptId, options) => {
3097
3362
  return import_axios2.default.get(`/v2/transcript/${transcriptId}`, options);
3098
3363
  };
@@ -3114,7 +3379,9 @@ var AssemblyAIAdapter = class extends BaseAdapter {
3114
3379
  summarization: true,
3115
3380
  sentimentAnalysis: true,
3116
3381
  entityDetection: true,
3117
- piiRedaction: true
3382
+ piiRedaction: true,
3383
+ listTranscripts: true,
3384
+ deleteTranscript: true
3118
3385
  };
3119
3386
  this.baseUrl = "https://api.assemblyai.com";
3120
3387
  // Generated functions already include /v2 path
@@ -3265,6 +3532,106 @@ var AssemblyAIAdapter = class extends BaseAdapter {
3265
3532
  throw error;
3266
3533
  }
3267
3534
  }
3535
+ /**
3536
+ * List recent transcriptions with filtering
3537
+ *
3538
+ * Retrieves a list of transcripts with optional filtering by status and date.
3539
+ * Transcripts are sorted from newest to oldest and can be retrieved for the
3540
+ * last 90 days of usage.
3541
+ *
3542
+ * @param options - Filtering and pagination options
3543
+ * @param options.limit - Maximum number of transcripts (max 200)
3544
+ * @param options.status - Filter by status (queued, processing, completed, error)
3545
+ * @param options.date - Filter by exact date (ISO format YYYY-MM-DD)
3546
+ * @param options.assemblyai - Full AssemblyAI-specific options (before_id, after_id, etc.)
3547
+ * @returns List of transcripts with pagination info
3548
+ *
3549
+ * @example List recent transcripts
3550
+ * ```typescript
3551
+ * const { transcripts, hasMore } = await adapter.listTranscripts({
3552
+ * limit: 50,
3553
+ * status: 'completed'
3554
+ * })
3555
+ * ```
3556
+ *
3557
+ * @example Filter by date
3558
+ * ```typescript
3559
+ * const { transcripts } = await adapter.listTranscripts({
3560
+ * date: '2026-01-07',
3561
+ * limit: 100
3562
+ * })
3563
+ * ```
3564
+ *
3565
+ * @example Use cursor pagination
3566
+ * ```typescript
3567
+ * const { transcripts } = await adapter.listTranscripts({
3568
+ * assemblyai: {
3569
+ * after_id: 'abc123', // Get transcripts after this ID
3570
+ * limit: 50
3571
+ * }
3572
+ * })
3573
+ * ```
3574
+ *
3575
+ * @see https://www.assemblyai.com/docs/api-reference/transcripts/list
3576
+ */
3577
+ async listTranscripts(options) {
3578
+ this.validateConfig();
3579
+ try {
3580
+ const params = {
3581
+ ...options?.assemblyai
3582
+ };
3583
+ if (options?.limit) {
3584
+ params.limit = options.limit;
3585
+ }
3586
+ if (options?.status) {
3587
+ params.status = options.status;
3588
+ }
3589
+ if (options?.date) {
3590
+ params.created_on = options.date;
3591
+ }
3592
+ const response = await listTranscripts(params, this.getAxiosConfig());
3593
+ const transcripts = response.data.transcripts.map(
3594
+ (item) => this.normalizeListItem(item)
3595
+ );
3596
+ return {
3597
+ transcripts,
3598
+ hasMore: response.data.page_details.next_url !== null
3599
+ };
3600
+ } catch (error) {
3601
+ return {
3602
+ transcripts: [this.createErrorResponse(error)],
3603
+ hasMore: false
3604
+ };
3605
+ }
3606
+ }
3607
+ /**
3608
+ * Normalize a transcript list item to unified format
3609
+ */
3610
+ normalizeListItem(item) {
3611
+ return {
3612
+ success: item.status !== "error",
3613
+ provider: this.name,
3614
+ data: {
3615
+ id: item.id,
3616
+ text: "",
3617
+ // List items don't include full text
3618
+ status: item.status,
3619
+ // Note: audio_duration is NOT available in TranscriptListItem (only in full Transcript)
3620
+ metadata: {
3621
+ sourceAudioUrl: item.audio_url,
3622
+ audioFileAvailable: this.capabilities.getAudioFile ?? false,
3623
+ createdAt: item.created,
3624
+ completedAt: item.completed || void 0,
3625
+ resourceUrl: item.resource_url
3626
+ }
3627
+ },
3628
+ error: item.error ? {
3629
+ code: "TRANSCRIPTION_ERROR",
3630
+ message: item.error
3631
+ } : void 0,
3632
+ raw: item
3633
+ };
3634
+ }
3268
3635
  /**
3269
3636
  * Build AssemblyAI transcription request from unified options
3270
3637
  */
@@ -3372,7 +3739,8 @@ var AssemblyAIAdapter = class extends BaseAdapter {
3372
3739
  utterances: this.extractUtterances(response),
3373
3740
  summary: response.summary || void 0,
3374
3741
  metadata: {
3375
- audioUrl: response.audio_url
3742
+ sourceAudioUrl: response.audio_url,
3743
+ audioFileAvailable: this.capabilities.getAudioFile ?? false
3376
3744
  }
3377
3745
  },
3378
3746
  // Extended data - fully typed from OpenAPI specs
@@ -3817,6 +4185,16 @@ function createAssemblyAIAdapter(config) {
3817
4185
  // src/adapters/deepgram-adapter.ts
3818
4186
  var import_axios3 = __toESM(require("axios"));
3819
4187
  var import_ws3 = __toESM(require("ws"));
4188
+
4189
+ // src/generated/deepgram/schema/manageV1FilterEndpointParameter.ts
4190
+ var ManageV1FilterEndpointParameter = {
4191
+ listen: "listen",
4192
+ read: "read",
4193
+ speak: "speak",
4194
+ agent: "agent"
4195
+ };
4196
+
4197
+ // src/adapters/deepgram-adapter.ts
3820
4198
  var DeepgramAdapter = class extends BaseAdapter {
3821
4199
  constructor() {
3822
4200
  super(...arguments);
@@ -3830,13 +4208,17 @@ var DeepgramAdapter = class extends BaseAdapter {
3830
4208
  summarization: true,
3831
4209
  sentimentAnalysis: true,
3832
4210
  entityDetection: true,
3833
- piiRedaction: true
4211
+ piiRedaction: true,
4212
+ listTranscripts: true,
4213
+ // Via request history API (requires projectId)
4214
+ deleteTranscript: false
3834
4215
  };
3835
4216
  this.baseUrl = "https://api.deepgram.com/v1";
3836
4217
  this.wsBaseUrl = "wss://api.deepgram.com/v1/listen";
3837
4218
  }
3838
4219
  initialize(config) {
3839
4220
  super.initialize(config);
4221
+ this.projectId = config.projectId;
3840
4222
  this.client = import_axios3.default.create({
3841
4223
  baseURL: config.baseUrl || this.baseUrl,
3842
4224
  timeout: config.timeout || 6e4,
@@ -3921,23 +4303,66 @@ var DeepgramAdapter = class extends BaseAdapter {
3921
4303
  /**
3922
4304
  * Get transcription result by ID
3923
4305
  *
3924
- * Note: Deepgram processes synchronously, so this method is primarily
3925
- * for retrieving cached results if you've stored the request ID.
3926
- * The initial transcribe() call already returns complete results.
4306
+ * Retrieves a previous transcription from Deepgram's request history.
3927
4307
  *
3928
- * @param transcriptId - Request ID from Deepgram
3929
- * @returns Normalized transcription response
4308
+ * Unlike the list endpoint, getting a single request DOES include the full
4309
+ * transcript response. Requires `projectId` to be set during initialization.
4310
+ *
4311
+ * @param transcriptId - Request ID from a previous transcription
4312
+ * @returns Full transcript response including text, words, and metadata
4313
+ *
4314
+ * @example Get a transcript by request ID
4315
+ * ```typescript
4316
+ * const adapter = new DeepgramAdapter()
4317
+ * adapter.initialize({
4318
+ * apiKey: process.env.DEEPGRAM_API_KEY,
4319
+ * projectId: process.env.DEEPGRAM_PROJECT_ID
4320
+ * })
4321
+ *
4322
+ * const result = await adapter.getTranscript('abc123-request-id')
4323
+ * if (result.success) {
4324
+ * console.log(result.data?.text)
4325
+ * console.log(result.data?.words)
4326
+ * }
4327
+ * ```
4328
+ *
4329
+ * @see https://developers.deepgram.com/reference/get-request
3930
4330
  */
3931
4331
  async getTranscript(transcriptId) {
3932
4332
  this.validateConfig();
3933
- return {
3934
- success: false,
3935
- provider: this.name,
3936
- error: {
3937
- code: "NOT_SUPPORTED",
3938
- message: "Deepgram returns transcription results immediately. Store the response from transcribe() instead of using getTranscript()."
4333
+ if (!this.projectId) {
4334
+ return {
4335
+ success: false,
4336
+ provider: this.name,
4337
+ error: {
4338
+ code: "MISSING_PROJECT_ID",
4339
+ message: "Deepgram getTranscript requires projectId. Initialize with: { apiKey, projectId }"
4340
+ }
4341
+ };
4342
+ }
4343
+ try {
4344
+ const response = await this.client.get(
4345
+ `/projects/${this.projectId}/requests/${transcriptId}`
4346
+ );
4347
+ const request = response.data.request;
4348
+ if (!request) {
4349
+ return {
4350
+ success: false,
4351
+ provider: this.name,
4352
+ error: {
4353
+ code: "NOT_FOUND",
4354
+ message: `Request ${transcriptId} not found`
4355
+ }
4356
+ };
3939
4357
  }
3940
- };
4358
+ const transcriptResponse = request.response;
4359
+ if (!transcriptResponse) {
4360
+ return this.normalizeRequestItem(request);
4361
+ }
4362
+ return this.normalizeResponse(transcriptResponse);
4363
+ } catch (error) {
4364
+ return this.createErrorResponse(error);
4365
+ }
3941
4366
  }
3942
4367
  /**
3943
4368
  * Build Deepgram transcription parameters from unified options
@@ -4507,6 +4932,133 @@ var DeepgramAdapter = class extends BaseAdapter {
4507
4932
  }
4508
4933
  }
4509
4934
  }
4935
+ /**
4936
+ * List recent transcription requests from Deepgram's request history
4937
+ *
4938
+ * **Important:** Deepgram processes synchronously and doesn't store transcript content.
4939
+ * This method returns request metadata (IDs, timestamps, status) but NOT the actual
4940
+ * transcript text. Use this for auditing, billing analysis, or request tracking.
4941
+ *
4942
+ * Requires `projectId` to be set during initialization.
4943
+ *
4944
+ * @param options - Filtering and pagination options
4945
+ * @param options.limit - Maximum number of requests (default 10, max 1000)
4946
+ * @param options.status - Filter by status: 'succeeded' or 'failed'
4947
+ * @param options.afterDate - Start date (YYYY-MM-DD or ISO 8601)
4948
+ * @param options.beforeDate - End date (YYYY-MM-DD or ISO 8601)
4949
+ * @param options.deepgram - Provider-specific params (page, request_id, etc.)
4950
+ * @returns List of transcription request metadata
4951
+ *
4952
+ * @example List recent transcription requests
4953
+ * ```typescript
4954
+ * const adapter = new DeepgramAdapter()
4955
+ * adapter.initialize({
4956
+ * apiKey: process.env.DEEPGRAM_API_KEY,
4957
+ * projectId: process.env.DEEPGRAM_PROJECT_ID
4958
+ * })
4959
+ *
4960
+ * const { transcripts, hasMore } = await adapter.listTranscripts({
4961
+ * limit: 50,
4962
+ * status: 'succeeded'
4963
+ * })
4964
+ *
4965
+ * transcripts.forEach(t => {
4966
+ * console.log(t.data?.id, t.data?.metadata?.createdAt)
4967
+ * })
4968
+ * ```
4969
+ *
4970
+ * @see https://developers.deepgram.com/reference/get-all-requests
4971
+ */
4972
+ async listTranscripts(options) {
4973
+ this.validateConfig();
4974
+ if (!this.projectId) {
4975
+ return {
4976
+ transcripts: [
4977
+ {
4978
+ success: false,
4979
+ provider: this.name,
4980
+ error: {
4981
+ code: "MISSING_PROJECT_ID",
4982
+ message: "Deepgram listTranscripts requires projectId. Initialize with: { apiKey, projectId }"
4983
+ }
4984
+ }
4985
+ ],
4986
+ hasMore: false
4987
+ };
4988
+ }
4989
+ try {
4990
+ const params = {
4991
+ // Filter to only transcription requests (listen endpoint)
4992
+ endpoint: ManageV1FilterEndpointParameter.listen,
4993
+ ...options?.deepgram
4994
+ };
4995
+ if (options?.limit) {
4996
+ params.limit = options.limit;
4997
+ }
4998
+ if (options?.afterDate) {
4999
+ params.start = options.afterDate;
5000
+ }
5001
+ if (options?.beforeDate) {
5002
+ params.end = options.beforeDate;
5003
+ }
5004
+ if (options?.status) {
5005
+ const statusMap = {
5006
+ completed: ManageV1FilterStatusParameter.succeeded,
5007
+ succeeded: ManageV1FilterStatusParameter.succeeded,
5008
+ error: ManageV1FilterStatusParameter.failed,
5009
+ failed: ManageV1FilterStatusParameter.failed
5010
+ };
5011
+ params.status = statusMap[options.status.toLowerCase()];
5012
+ }
5013
+ const response = await this.client.get(
5014
+ `/projects/${this.projectId}/requests`,
5015
+ { params }
5016
+ );
5017
+ const data = response.data;
5018
+ const transcripts = (data.requests || []).map(
5019
+ (item) => this.normalizeRequestItem(item)
5020
+ );
5021
+ return {
5022
+ transcripts,
5023
+ hasMore: (data.page || 1) * (data.limit || 10) < (data.requests?.length || 0)
5024
+ };
5025
+ } catch (error) {
5026
+ return {
5027
+ transcripts: [this.createErrorResponse(error)],
5028
+ hasMore: false
5029
+ };
5030
+ }
5031
+ }
5032
+ /**
5033
+ * Normalize a Deepgram request history item to unified format
5034
+ */
5035
+ normalizeRequestItem(item) {
5036
+ const isSuccess = (item.code || 0) < 400;
5037
+ return {
5038
+ success: isSuccess,
5039
+ provider: this.name,
5040
+ data: {
5041
+ id: item.request_id || "",
5042
+ text: "",
5043
+ // Deepgram doesn't store transcript content in request history
5044
+ status: isSuccess ? "completed" : "error",
5045
+ metadata: {
5046
+ audioFileAvailable: this.capabilities.getAudioFile ?? false,
5047
+ createdAt: item.created,
5048
+ apiPath: item.path,
5049
+ apiKeyId: item.api_key_id,
5050
+ deployment: item.deployment,
5051
+ callbackUrl: item.callback,
5052
+ responseCode: item.code
5053
+ }
5054
+ },
5055
+ error: !isSuccess ? {
5056
+ code: "REQUEST_FAILED",
5057
+ message: `Request failed with status code ${item.code}`
5058
+ } : void 0,
5059
+ raw: item
5060
+ };
5061
+ }
4510
5062
  };
4511
5063
  function createDeepgramAdapter(config) {
4512
5064
  const adapter = new DeepgramAdapter();
@@ -4519,6 +5071,12 @@ var import_axios5 = __toESM(require("axios"));
4519
5071
 
4520
5072
  // src/generated/azure/api/speechServicesAPIV31.ts
4521
5073
  var import_axios4 = __toESM(require("axios"));
5074
+ var transcriptionsList = (params, options) => {
5075
+ return import_axios4.default.get("/transcriptions", {
5076
+ ...options,
5077
+ params: { ...params, ...options?.params }
5078
+ });
5079
+ };
4522
5080
  var transcriptionsCreate = (transcription, options) => {
4523
5081
  return import_axios4.default.post("/transcriptions", transcription, options);
4524
5082
  };
@@ -4550,7 +5108,9 @@ var AzureSTTAdapter = class extends BaseAdapter {
4550
5108
  summarization: false,
4551
5109
  sentimentAnalysis: false,
4552
5110
  entityDetection: false,
4553
- piiRedaction: false
5111
+ piiRedaction: false,
5112
+ listTranscripts: true,
5113
+ deleteTranscript: true
4554
5114
  };
4555
5115
  this.baseUrl = "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1";
4556
5116
  }
@@ -4714,6 +5274,113 @@ var AzureSTTAdapter = class extends BaseAdapter {
4714
5274
  throw error;
4715
5275
  }
4716
5276
  }
5277
+ /**
5278
+ * List recent transcriptions with filtering
5279
+ *
5280
+ * Retrieves a list of transcription jobs for the authenticated subscription.
5281
+ * Azure uses OData filtering for advanced queries.
5282
+ *
5283
+ * @param options - Filtering and pagination options
5284
+ * @param options.limit - Maximum number of transcripts (maps to 'top')
5285
+ * @param options.offset - Pagination offset (maps to 'skip')
5286
+ * @param options.status - Filter by status (uses OData filter)
5287
+ * @returns List of transcripts with pagination info
5288
+ *
5289
+ * @example List recent transcripts
5290
+ * ```typescript
5291
+ * const { transcripts, hasMore } = await adapter.listTranscripts({
5292
+ * limit: 50
5293
+ * })
5294
+ * ```
5295
+ *
5296
+ * @example Filter by status using OData
5297
+ * ```typescript
5298
+ * const { transcripts } = await adapter.listTranscripts({
5299
+ * status: 'Succeeded',
5300
+ * limit: 100
5301
+ * })
5302
+ * ```
5303
+ *
5304
+ * @see https://learn.microsoft.com/azure/cognitive-services/speech-service/batch-transcription
5305
+ */
5306
+ async listTranscripts(options) {
5307
+ this.validateConfig();
5308
+ try {
5309
+ const params = {};
5310
+ if (options?.limit) {
5311
+ params.top = options.limit;
5312
+ }
5313
+ if (options?.offset) {
5314
+ params.skip = options.offset;
5315
+ }
5316
+ if (options?.status) {
5317
+ const azureStatus = this.mapStatusToAzure(options.status);
5318
+ params.filter = `status eq '${azureStatus}'`;
5319
+ }
5320
+ const response = await transcriptionsList(params, this.getAxiosConfig());
5321
+ const transcripts = (response.data.values || []).map(
5322
+ (item) => this.normalizeListItem(item)
5323
+ );
5324
+ return {
5325
+ transcripts,
5326
+ hasMore: response.data["@nextLink"] !== void 0
5327
+ };
5328
+ } catch (error) {
5329
+ return {
5330
+ transcripts: [this.createErrorResponse(error)],
5331
+ hasMore: false
5332
+ };
5333
+ }
5334
+ }
5335
+ /**
5336
+ * Map unified status to Azure status format using generated enum
5337
+ */
5338
+ mapStatusToAzure(status) {
5339
+ const statusMap = {
5340
+ completed: Status.Succeeded,
5341
+ succeeded: Status.Succeeded,
5342
+ processing: Status.Running,
5343
+ running: Status.Running,
5344
+ queued: Status.NotStarted,
5345
+ notstarted: Status.NotStarted,
5346
+ error: Status.Failed,
5347
+ failed: Status.Failed
5348
+ };
5349
+ return statusMap[status.toLowerCase()] || status;
5350
+ }
5351
+ /**
5352
+ * Normalize a transcript list item to unified format
5353
+ */
5354
+ normalizeListItem(item) {
5355
+ const id = item.self?.split("/").pop() || "";
5356
+ const status = this.normalizeStatus(item.status);
5357
+ return {
5358
+ success: status !== "error",
5359
+ provider: this.name,
5360
+ data: {
5361
+ id,
5362
+ text: "",
5363
+ // List items don't include full text
5364
+ status,
5365
+ language: item.locale,
5366
+ // Note: contentUrls is write-only per Azure API docs (not returned in list response)
5367
+ // Note: duration is not available in Transcription list item
5368
+ metadata: {
5369
+ audioFileAvailable: this.capabilities.getAudioFile ?? false,
5370
+ displayName: item.displayName,
5371
+ description: item.description || void 0,
5372
+ createdAt: item.createdDateTime,
5373
+ lastActionAt: item.lastActionDateTime,
5374
+ filesUrl: item.links?.files
5375
+ }
5376
+ },
5377
+ error: status === "error" ? {
5378
+ code: "TRANSCRIPTION_ERROR",
5379
+ message: item.properties?.error?.message || "Transcription failed"
5380
+ } : void 0,
5381
+ raw: item
5382
+ };
5383
+ }
4717
5384
  /**
4718
5385
  * Build Azure-specific transcription properties
4719
5386
  */
@@ -4879,7 +5546,10 @@ var OpenAIWhisperAdapter = class extends BaseAdapter {
4879
5546
  summarization: false,
4880
5547
  sentimentAnalysis: false,
4881
5548
  entityDetection: false,
4882
- piiRedaction: false
5549
+ piiRedaction: false,
5550
+ listTranscripts: false,
5551
+ // Synchronous API, no stored transcripts
5552
+ deleteTranscript: false
4883
5553
  };
4884
5554
  this.baseUrl = "https://api.openai.com/v1";
4885
5555
  }
@@ -5110,7 +5780,9 @@ var SpeechmaticsAdapter = class extends BaseAdapter {
5110
5780
  summarization: true,
5111
5781
  sentimentAnalysis: true,
5112
5782
  entityDetection: true,
5113
- piiRedaction: false
5783
+ piiRedaction: false,
5784
+ listTranscripts: true,
5785
+ deleteTranscript: true
5114
5786
  };
5115
5787
  this.baseUrl = "https://asr.api.speechmatics.com/v2";
5116
5788
  }