voice-router-dev 0.7.9 → 0.8.1
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/CHANGELOG.md +202 -1
- package/README.md +21 -2
- package/dist/constants.d.mts +600 -12
- package/dist/constants.d.ts +600 -12
- package/dist/constants.js +548 -5
- package/dist/constants.mjs +537 -5
- package/dist/{field-configs-CaXYfrJg.d.mts → field-configs-CDVygOte.d.mts} +26 -20
- package/dist/{field-configs-CaXYfrJg.d.ts → field-configs-CDVygOte.d.ts} +26 -20
- package/dist/field-configs.d.mts +1 -1
- package/dist/field-configs.d.ts +1 -1
- package/dist/field-configs.js +7 -4
- package/dist/field-configs.mjs +7 -4
- package/dist/index.d.mts +3184 -1367
- package/dist/index.d.ts +3184 -1367
- package/dist/index.js +1529 -105
- package/dist/index.mjs +1521 -105
- package/dist/{provider-metadata-DVQcYIHe.d.mts → provider-metadata-BnkedpXm.d.mts} +34 -4
- package/dist/{provider-metadata-Derls1wa.d.ts → provider-metadata-DbsSGAO7.d.ts} +34 -4
- package/dist/provider-metadata.d.mts +2 -2
- package/dist/provider-metadata.d.ts +2 -2
- package/dist/provider-metadata.js +349 -9
- package/dist/provider-metadata.mjs +345 -9
- package/dist/{transcriptWebhookNotification-BTxv69ck.d.ts → transcriptWebhookNotification-BJk1CEF5.d.ts} +712 -9
- package/dist/{transcriptWebhookNotification-DCcbnAKP.d.mts → transcriptWebhookNotification-CNFpns9f.d.mts} +712 -9
- package/dist/webhooks.d.mts +102 -5
- package/dist/webhooks.d.ts +102 -5
- package/dist/webhooks.js +342 -39
- package/dist/webhooks.mjs +340 -39
- package/package.json +11 -5
package/dist/webhooks.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TranscriptionProvider } from './provider-metadata-
|
|
1
|
+
import { fo as TranscriptionStatus, fl as Speaker, fm as Word, fn as Utterance, Q as CallbackTranscriptionSuccessPayload, J as CallbackTranscriptionErrorPayload, cf as TranscriptWebhookNotification, d2 as ListenV1Response } from './transcriptWebhookNotification-CNFpns9f.mjs';
|
|
2
|
+
import { T as TranscriptionProvider } from './provider-metadata-BnkedpXm.mjs';
|
|
3
3
|
import './constants.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -322,7 +322,7 @@ declare function createGladiaWebhookHandler(): GladiaWebhookHandler;
|
|
|
322
322
|
*
|
|
323
323
|
* AssemblyAI supports webhook signature verification using HMAC-SHA256.
|
|
324
324
|
*
|
|
325
|
-
* @example Basic usage
|
|
325
|
+
* @example Basic usage (full transcript body)
|
|
326
326
|
* ```typescript
|
|
327
327
|
* import { AssemblyAIWebhookHandler } from '@meeting-baas/sdk';
|
|
328
328
|
*
|
|
@@ -334,10 +334,23 @@ declare function createGladiaWebhookHandler(): GladiaWebhookHandler;
|
|
|
334
334
|
* return res.status(400).json({ error: validation.error });
|
|
335
335
|
* }
|
|
336
336
|
*
|
|
337
|
-
* // Parse webhook
|
|
337
|
+
* // Parse webhook — works with both notification and full transcript formats
|
|
338
338
|
* const event = handler.parse(req.body);
|
|
339
339
|
* if (event.eventType === 'transcription.completed') {
|
|
340
340
|
* console.log('Transcript ID:', event.data?.id);
|
|
341
|
+
* console.log('Text:', event.data?.text);
|
|
342
|
+
* console.log('Duration:', event.data?.duration);
|
|
343
|
+
* console.log('Confidence:', event.data?.confidence);
|
|
344
|
+
*
|
|
345
|
+
* // Word-level timestamps (seconds)
|
|
346
|
+
* event.data?.words?.forEach(w => {
|
|
347
|
+
* console.log(`${w.word}: ${w.start}s - ${w.end}s`);
|
|
348
|
+
* });
|
|
349
|
+
*
|
|
350
|
+
* // Speaker-segmented utterances
|
|
351
|
+
* event.data?.utterances?.forEach(u => {
|
|
352
|
+
* console.log(`Speaker ${u.speaker}: ${u.text}`);
|
|
353
|
+
* });
|
|
341
354
|
* }
|
|
342
355
|
* ```
|
|
343
356
|
*
|
|
@@ -359,17 +372,35 @@ declare class AssemblyAIWebhookHandler extends BaseWebhookHandler {
|
|
|
359
372
|
readonly provider: TranscriptionProvider;
|
|
360
373
|
/**
|
|
361
374
|
* Check if payload matches AssemblyAI webhook format
|
|
375
|
+
*
|
|
376
|
+
* Supports two formats:
|
|
377
|
+
* - Notification format: `{ transcript_id, status }` (lightweight callback)
|
|
378
|
+
* - Full transcript format: `{ id, status, audio_url, text, words, ... }` (complete response)
|
|
362
379
|
*/
|
|
363
380
|
matches(payload: unknown, _options?: {
|
|
364
381
|
queryParams?: Record<string, string>;
|
|
365
382
|
userAgent?: string;
|
|
366
383
|
}): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Determine if the payload is a full transcript (vs a lightweight notification)
|
|
386
|
+
*/
|
|
387
|
+
private isFullTranscript;
|
|
367
388
|
/**
|
|
368
389
|
* Parse AssemblyAI webhook payload to unified format
|
|
390
|
+
*
|
|
391
|
+
* Supports two payload formats:
|
|
392
|
+
* - Notification: `{ transcript_id, status }` — returns minimal event (ID + status only)
|
|
393
|
+
* - Full transcript: `{ id, status, text, words, utterances, ... }` — returns complete data
|
|
369
394
|
*/
|
|
370
395
|
parse(payload: unknown, _options?: {
|
|
371
396
|
queryParams?: Record<string, string>;
|
|
372
397
|
}): UnifiedWebhookEvent;
|
|
398
|
+
/**
|
|
399
|
+
* Parse a full AssemblyAI transcript response into unified format
|
|
400
|
+
*
|
|
401
|
+
* AssemblyAI times are in milliseconds — converted to seconds for unified format.
|
|
402
|
+
*/
|
|
403
|
+
private parseFullTranscript;
|
|
373
404
|
/**
|
|
374
405
|
* Verify AssemblyAI webhook signature
|
|
375
406
|
*
|
|
@@ -656,6 +687,72 @@ declare class SpeechmaticsWebhookHandler extends BaseWebhookHandler {
|
|
|
656
687
|
}): UnifiedWebhookEvent;
|
|
657
688
|
}
|
|
658
689
|
|
|
690
|
+
/**
|
|
691
|
+
* ElevenLabs webhook handler
|
|
692
|
+
* Parses and normalizes ElevenLabs webhook callbacks
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* ElevenLabs webhook handler
|
|
697
|
+
*
|
|
698
|
+
* Handles webhook callbacks from ElevenLabs Speech-to-Text API.
|
|
699
|
+
* ElevenLabs sends the full transcription result to the webhook URL
|
|
700
|
+
* when transcription is complete. The payload includes the `SpeechToTextChunkResponseModel`
|
|
701
|
+
* with words, entities, and language detection.
|
|
702
|
+
*
|
|
703
|
+
* Note: ElevenLabs webhook signature verification uses the `webhook_id` and
|
|
704
|
+
* request signing. For security, use HTTPS and validate the request source.
|
|
705
|
+
*
|
|
706
|
+
* @example Basic usage
|
|
707
|
+
* ```typescript
|
|
708
|
+
* import { ElevenLabsWebhookHandler } from '@meeting-baas/sdk/webhooks';
|
|
709
|
+
*
|
|
710
|
+
* const handler = new ElevenLabsWebhookHandler();
|
|
711
|
+
*
|
|
712
|
+
* const validation = handler.validate(req.body);
|
|
713
|
+
* if (!validation.valid) {
|
|
714
|
+
* return res.status(400).json({ error: validation.error });
|
|
715
|
+
* }
|
|
716
|
+
*
|
|
717
|
+
* const event = handler.parse(req.body);
|
|
718
|
+
* console.log('Event type:', event.eventType);
|
|
719
|
+
* console.log('Transcript:', event.data?.text);
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
declare class ElevenLabsWebhookHandler extends BaseWebhookHandler {
|
|
723
|
+
readonly provider: TranscriptionProvider;
|
|
724
|
+
/**
|
|
725
|
+
* Check if payload matches ElevenLabs webhook format
|
|
726
|
+
*
|
|
727
|
+
* ElevenLabs webhook payloads contain the full transcription result
|
|
728
|
+
* with `words` array and `language_code` / `language_probability` fields.
|
|
729
|
+
*/
|
|
730
|
+
matches(payload: unknown, _options?: {
|
|
731
|
+
queryParams?: Record<string, string>;
|
|
732
|
+
userAgent?: string;
|
|
733
|
+
}): boolean;
|
|
734
|
+
/**
|
|
735
|
+
* Parse ElevenLabs webhook payload to unified format
|
|
736
|
+
*/
|
|
737
|
+
parse(payload: unknown, _options?: {
|
|
738
|
+
queryParams?: Record<string, string>;
|
|
739
|
+
}): UnifiedWebhookEvent;
|
|
740
|
+
/**
|
|
741
|
+
* Verify ElevenLabs webhook signature
|
|
742
|
+
*
|
|
743
|
+
* Note: ElevenLabs does not currently provide a standard webhook signature
|
|
744
|
+
* verification mechanism for STT webhooks. For security, use HTTPS and
|
|
745
|
+
* validate the request source.
|
|
746
|
+
*
|
|
747
|
+
* @returns Always returns true (no verification available)
|
|
748
|
+
*/
|
|
749
|
+
verify(): boolean;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Factory function to create an ElevenLabs webhook handler
|
|
753
|
+
*/
|
|
754
|
+
declare function createElevenLabsWebhookHandler(): ElevenLabsWebhookHandler;
|
|
755
|
+
|
|
659
756
|
/**
|
|
660
757
|
* Webhook router with automatic provider detection
|
|
661
758
|
* Routes webhook payloads to the correct provider handler
|
|
@@ -859,4 +956,4 @@ declare class WebhookRouter {
|
|
|
859
956
|
*/
|
|
860
957
|
declare function createWebhookRouter(): WebhookRouter;
|
|
861
958
|
|
|
862
|
-
export { AssemblyAIWebhookHandler, TranscriptWebhookNotification as AssemblyAIWebhookPayload, AzureWebhookHandler, BaseWebhookHandler, DeepgramWebhookHandler, ListenV1Response as DeepgramWebhookPayload, CallbackTranscriptionErrorPayload as GladiaWebhookErrorPayload, GladiaWebhookHandler, type GladiaWebhookPayload, CallbackTranscriptionSuccessPayload as GladiaWebhookSuccessPayload, type ProviderWebhookPayloadMap, SpeechmaticsWebhookHandler, type UnifiedWebhookEvent, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, createAssemblyAIWebhookHandler, createAzureWebhookHandler, createDeepgramWebhookHandler, createGladiaWebhookHandler, createWebhookRouter };
|
|
959
|
+
export { AssemblyAIWebhookHandler, TranscriptWebhookNotification as AssemblyAIWebhookPayload, AzureWebhookHandler, BaseWebhookHandler, DeepgramWebhookHandler, ListenV1Response as DeepgramWebhookPayload, ElevenLabsWebhookHandler, CallbackTranscriptionErrorPayload as GladiaWebhookErrorPayload, GladiaWebhookHandler, type GladiaWebhookPayload, CallbackTranscriptionSuccessPayload as GladiaWebhookSuccessPayload, type ProviderWebhookPayloadMap, SpeechmaticsWebhookHandler, type UnifiedWebhookEvent, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, createAssemblyAIWebhookHandler, createAzureWebhookHandler, createDeepgramWebhookHandler, createElevenLabsWebhookHandler, createGladiaWebhookHandler, createWebhookRouter };
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TranscriptionProvider } from './provider-metadata-
|
|
1
|
+
import { fo as TranscriptionStatus, fl as Speaker, fm as Word, fn as Utterance, Q as CallbackTranscriptionSuccessPayload, J as CallbackTranscriptionErrorPayload, cf as TranscriptWebhookNotification, d2 as ListenV1Response } from './transcriptWebhookNotification-BJk1CEF5.js';
|
|
2
|
+
import { T as TranscriptionProvider } from './provider-metadata-DbsSGAO7.js';
|
|
3
3
|
import './constants.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -322,7 +322,7 @@ declare function createGladiaWebhookHandler(): GladiaWebhookHandler;
|
|
|
322
322
|
*
|
|
323
323
|
* AssemblyAI supports webhook signature verification using HMAC-SHA256.
|
|
324
324
|
*
|
|
325
|
-
* @example Basic usage
|
|
325
|
+
* @example Basic usage (full transcript body)
|
|
326
326
|
* ```typescript
|
|
327
327
|
* import { AssemblyAIWebhookHandler } from '@meeting-baas/sdk';
|
|
328
328
|
*
|
|
@@ -334,10 +334,23 @@ declare function createGladiaWebhookHandler(): GladiaWebhookHandler;
|
|
|
334
334
|
* return res.status(400).json({ error: validation.error });
|
|
335
335
|
* }
|
|
336
336
|
*
|
|
337
|
-
* // Parse webhook
|
|
337
|
+
* // Parse webhook — works with both notification and full transcript formats
|
|
338
338
|
* const event = handler.parse(req.body);
|
|
339
339
|
* if (event.eventType === 'transcription.completed') {
|
|
340
340
|
* console.log('Transcript ID:', event.data?.id);
|
|
341
|
+
* console.log('Text:', event.data?.text);
|
|
342
|
+
* console.log('Duration:', event.data?.duration);
|
|
343
|
+
* console.log('Confidence:', event.data?.confidence);
|
|
344
|
+
*
|
|
345
|
+
* // Word-level timestamps (seconds)
|
|
346
|
+
* event.data?.words?.forEach(w => {
|
|
347
|
+
* console.log(`${w.word}: ${w.start}s - ${w.end}s`);
|
|
348
|
+
* });
|
|
349
|
+
*
|
|
350
|
+
* // Speaker-segmented utterances
|
|
351
|
+
* event.data?.utterances?.forEach(u => {
|
|
352
|
+
* console.log(`Speaker ${u.speaker}: ${u.text}`);
|
|
353
|
+
* });
|
|
341
354
|
* }
|
|
342
355
|
* ```
|
|
343
356
|
*
|
|
@@ -359,17 +372,35 @@ declare class AssemblyAIWebhookHandler extends BaseWebhookHandler {
|
|
|
359
372
|
readonly provider: TranscriptionProvider;
|
|
360
373
|
/**
|
|
361
374
|
* Check if payload matches AssemblyAI webhook format
|
|
375
|
+
*
|
|
376
|
+
* Supports two formats:
|
|
377
|
+
* - Notification format: `{ transcript_id, status }` (lightweight callback)
|
|
378
|
+
* - Full transcript format: `{ id, status, audio_url, text, words, ... }` (complete response)
|
|
362
379
|
*/
|
|
363
380
|
matches(payload: unknown, _options?: {
|
|
364
381
|
queryParams?: Record<string, string>;
|
|
365
382
|
userAgent?: string;
|
|
366
383
|
}): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Determine if the payload is a full transcript (vs a lightweight notification)
|
|
386
|
+
*/
|
|
387
|
+
private isFullTranscript;
|
|
367
388
|
/**
|
|
368
389
|
* Parse AssemblyAI webhook payload to unified format
|
|
390
|
+
*
|
|
391
|
+
* Supports two payload formats:
|
|
392
|
+
* - Notification: `{ transcript_id, status }` — returns minimal event (ID + status only)
|
|
393
|
+
* - Full transcript: `{ id, status, text, words, utterances, ... }` — returns complete data
|
|
369
394
|
*/
|
|
370
395
|
parse(payload: unknown, _options?: {
|
|
371
396
|
queryParams?: Record<string, string>;
|
|
372
397
|
}): UnifiedWebhookEvent;
|
|
398
|
+
/**
|
|
399
|
+
* Parse a full AssemblyAI transcript response into unified format
|
|
400
|
+
*
|
|
401
|
+
* AssemblyAI times are in milliseconds — converted to seconds for unified format.
|
|
402
|
+
*/
|
|
403
|
+
private parseFullTranscript;
|
|
373
404
|
/**
|
|
374
405
|
* Verify AssemblyAI webhook signature
|
|
375
406
|
*
|
|
@@ -656,6 +687,72 @@ declare class SpeechmaticsWebhookHandler extends BaseWebhookHandler {
|
|
|
656
687
|
}): UnifiedWebhookEvent;
|
|
657
688
|
}
|
|
658
689
|
|
|
690
|
+
/**
|
|
691
|
+
* ElevenLabs webhook handler
|
|
692
|
+
* Parses and normalizes ElevenLabs webhook callbacks
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* ElevenLabs webhook handler
|
|
697
|
+
*
|
|
698
|
+
* Handles webhook callbacks from ElevenLabs Speech-to-Text API.
|
|
699
|
+
* ElevenLabs sends the full transcription result to the webhook URL
|
|
700
|
+
* when transcription is complete. The payload includes the `SpeechToTextChunkResponseModel`
|
|
701
|
+
* with words, entities, and language detection.
|
|
702
|
+
*
|
|
703
|
+
* Note: ElevenLabs webhook signature verification uses the `webhook_id` and
|
|
704
|
+
* request signing. For security, use HTTPS and validate the request source.
|
|
705
|
+
*
|
|
706
|
+
* @example Basic usage
|
|
707
|
+
* ```typescript
|
|
708
|
+
* import { ElevenLabsWebhookHandler } from '@meeting-baas/sdk/webhooks';
|
|
709
|
+
*
|
|
710
|
+
* const handler = new ElevenLabsWebhookHandler();
|
|
711
|
+
*
|
|
712
|
+
* const validation = handler.validate(req.body);
|
|
713
|
+
* if (!validation.valid) {
|
|
714
|
+
* return res.status(400).json({ error: validation.error });
|
|
715
|
+
* }
|
|
716
|
+
*
|
|
717
|
+
* const event = handler.parse(req.body);
|
|
718
|
+
* console.log('Event type:', event.eventType);
|
|
719
|
+
* console.log('Transcript:', event.data?.text);
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
declare class ElevenLabsWebhookHandler extends BaseWebhookHandler {
|
|
723
|
+
readonly provider: TranscriptionProvider;
|
|
724
|
+
/**
|
|
725
|
+
* Check if payload matches ElevenLabs webhook format
|
|
726
|
+
*
|
|
727
|
+
* ElevenLabs webhook payloads contain the full transcription result
|
|
728
|
+
* with `words` array and `language_code` / `language_probability` fields.
|
|
729
|
+
*/
|
|
730
|
+
matches(payload: unknown, _options?: {
|
|
731
|
+
queryParams?: Record<string, string>;
|
|
732
|
+
userAgent?: string;
|
|
733
|
+
}): boolean;
|
|
734
|
+
/**
|
|
735
|
+
* Parse ElevenLabs webhook payload to unified format
|
|
736
|
+
*/
|
|
737
|
+
parse(payload: unknown, _options?: {
|
|
738
|
+
queryParams?: Record<string, string>;
|
|
739
|
+
}): UnifiedWebhookEvent;
|
|
740
|
+
/**
|
|
741
|
+
* Verify ElevenLabs webhook signature
|
|
742
|
+
*
|
|
743
|
+
* Note: ElevenLabs does not currently provide a standard webhook signature
|
|
744
|
+
* verification mechanism for STT webhooks. For security, use HTTPS and
|
|
745
|
+
* validate the request source.
|
|
746
|
+
*
|
|
747
|
+
* @returns Always returns true (no verification available)
|
|
748
|
+
*/
|
|
749
|
+
verify(): boolean;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Factory function to create an ElevenLabs webhook handler
|
|
753
|
+
*/
|
|
754
|
+
declare function createElevenLabsWebhookHandler(): ElevenLabsWebhookHandler;
|
|
755
|
+
|
|
659
756
|
/**
|
|
660
757
|
* Webhook router with automatic provider detection
|
|
661
758
|
* Routes webhook payloads to the correct provider handler
|
|
@@ -859,4 +956,4 @@ declare class WebhookRouter {
|
|
|
859
956
|
*/
|
|
860
957
|
declare function createWebhookRouter(): WebhookRouter;
|
|
861
958
|
|
|
862
|
-
export { AssemblyAIWebhookHandler, TranscriptWebhookNotification as AssemblyAIWebhookPayload, AzureWebhookHandler, BaseWebhookHandler, DeepgramWebhookHandler, ListenV1Response as DeepgramWebhookPayload, CallbackTranscriptionErrorPayload as GladiaWebhookErrorPayload, GladiaWebhookHandler, type GladiaWebhookPayload, CallbackTranscriptionSuccessPayload as GladiaWebhookSuccessPayload, type ProviderWebhookPayloadMap, SpeechmaticsWebhookHandler, type UnifiedWebhookEvent, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, createAssemblyAIWebhookHandler, createAzureWebhookHandler, createDeepgramWebhookHandler, createGladiaWebhookHandler, createWebhookRouter };
|
|
959
|
+
export { AssemblyAIWebhookHandler, TranscriptWebhookNotification as AssemblyAIWebhookPayload, AzureWebhookHandler, BaseWebhookHandler, DeepgramWebhookHandler, ListenV1Response as DeepgramWebhookPayload, ElevenLabsWebhookHandler, CallbackTranscriptionErrorPayload as GladiaWebhookErrorPayload, GladiaWebhookHandler, type GladiaWebhookPayload, CallbackTranscriptionSuccessPayload as GladiaWebhookSuccessPayload, type ProviderWebhookPayloadMap, SpeechmaticsWebhookHandler, type UnifiedWebhookEvent, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, createAssemblyAIWebhookHandler, createAzureWebhookHandler, createDeepgramWebhookHandler, createElevenLabsWebhookHandler, createGladiaWebhookHandler, createWebhookRouter };
|