voice-router-dev 0.8.2 → 0.8.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/CHANGELOG.md +252 -0
- package/dist/constants.d.mts +40 -11
- package/dist/constants.d.ts +40 -11
- package/dist/constants.js +18 -9
- package/dist/constants.mjs +17 -9
- package/dist/{field-configs-DN2_WrYr.d.mts → field-configs-DLbrsYTk.d.mts} +4485 -3300
- package/dist/{field-configs-DN2_WrYr.d.ts → field-configs-DLbrsYTk.d.ts} +4485 -3300
- package/dist/field-configs.d.mts +1 -1
- package/dist/field-configs.d.ts +1 -1
- package/dist/field-configs.js +2333 -1642
- package/dist/field-configs.mjs +2333 -1642
- package/dist/index.d.mts +1179 -2621
- package/dist/index.d.ts +1179 -2621
- package/dist/index.js +2276 -1580
- package/dist/index.mjs +2273 -1579
- package/dist/{provider-metadata-BnkedpXm.d.mts → provider-metadata-MDUUEuqF.d.mts} +4 -4
- package/dist/{provider-metadata-DbsSGAO7.d.ts → provider-metadata-_gUWlRXS.d.ts} +4 -4
- package/dist/provider-metadata.d.mts +1 -1
- package/dist/provider-metadata.d.ts +1 -1
- package/dist/{speechToTextChunkResponseModel-3IUnJXKx.d.mts → speechToTextChunkResponseModel-BcT1LJSZ.d.mts} +2810 -1209
- package/dist/{speechToTextChunkResponseModel-DExUFZT3.d.ts → speechToTextChunkResponseModel-eq8eLKEA.d.ts} +2810 -1209
- package/dist/webhooks.d.mts +242 -217
- package/dist/webhooks.d.ts +242 -217
- package/package.json +5 -5
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,12 +1,248 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TranscriptionProvider } from './provider-metadata-
|
|
1
|
+
import { h9 as TranscriptionStatus, h6 as Speaker, h7 as Word, h8 as Utterance, Q as CallbackTranscriptionSuccessPayload, J as CallbackTranscriptionErrorPayload, bt as Transcript, dx as ListenV1Response, fj as RetrieveTranscriptResponse, fV as SpeechToTextChunkResponseModel } from './speechToTextChunkResponseModel-eq8eLKEA.js';
|
|
2
|
+
import { T as TranscriptionProvider } from './provider-metadata-_gUWlRXS.js';
|
|
3
3
|
import './constants.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Base webhook handler interface
|
|
7
|
+
* All provider-specific webhook handlers must implement this
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Abstract base class for webhook handlers
|
|
12
|
+
*
|
|
13
|
+
* Each provider implements this to parse and normalize their webhook payloads
|
|
14
|
+
*/
|
|
15
|
+
declare abstract class BaseWebhookHandler {
|
|
16
|
+
/** Provider name */
|
|
17
|
+
abstract readonly provider: TranscriptionProvider;
|
|
18
|
+
/**
|
|
19
|
+
* Check if this payload matches this provider's webhook format
|
|
20
|
+
*
|
|
21
|
+
* Used for auto-detection of webhook provider
|
|
22
|
+
*
|
|
23
|
+
* @param payload - Raw webhook payload
|
|
24
|
+
* @param options - Optional context (query params, headers, etc.)
|
|
25
|
+
* @returns true if this handler can process the payload
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* matches(payload, options) {
|
|
30
|
+
* return typeof payload === 'object' &&
|
|
31
|
+
* 'event' in payload &&
|
|
32
|
+
* 'payload' in payload
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
abstract matches(payload: unknown, options?: {
|
|
37
|
+
queryParams?: Record<string, string>;
|
|
38
|
+
userAgent?: string;
|
|
39
|
+
}): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Parse and normalize webhook payload
|
|
42
|
+
*
|
|
43
|
+
* Converts provider-specific webhook format to UnifiedWebhookEvent
|
|
44
|
+
*
|
|
45
|
+
* @param payload - Raw webhook payload
|
|
46
|
+
* @param options - Optional context (query params, headers, etc.)
|
|
47
|
+
* @returns Normalized webhook event
|
|
48
|
+
* @throws Error if payload cannot be parsed
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* parse(payload, options) {
|
|
53
|
+
* const typed = payload as ProviderWebhookPayload
|
|
54
|
+
* return {
|
|
55
|
+
* success: true,
|
|
56
|
+
* provider: this.provider,
|
|
57
|
+
* eventType: 'transcription.completed',
|
|
58
|
+
* data: { id: typed.job_id, ... },
|
|
59
|
+
* timestamp: new Date().toISOString(),
|
|
60
|
+
* raw: payload
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
abstract parse(payload: unknown, options?: {
|
|
66
|
+
queryParams?: Record<string, string>;
|
|
67
|
+
}): UnifiedWebhookEvent;
|
|
68
|
+
/**
|
|
69
|
+
* Verify webhook signature (if provider supports it)
|
|
70
|
+
*
|
|
71
|
+
* Optional method - implement if provider supports webhook signature verification
|
|
72
|
+
*
|
|
73
|
+
* @param payload - Raw webhook payload
|
|
74
|
+
* @param options - Verification options (signature, secret, etc.)
|
|
75
|
+
* @returns true if signature is valid
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* verify(payload, options) {
|
|
80
|
+
* if (!options.signature || !options.secret) return false
|
|
81
|
+
*
|
|
82
|
+
* const computed = crypto
|
|
83
|
+
* .createHmac('sha256', options.secret)
|
|
84
|
+
* .update(JSON.stringify(payload))
|
|
85
|
+
* .digest('hex')
|
|
86
|
+
*
|
|
87
|
+
* return computed === options.signature
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
verify?(payload: unknown, options: WebhookVerificationOptions): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Validate webhook payload structure
|
|
94
|
+
*
|
|
95
|
+
* Checks if payload has required fields and correct types
|
|
96
|
+
*
|
|
97
|
+
* @param payload - Raw webhook payload
|
|
98
|
+
* @param options - Optional context (query params, headers, etc.)
|
|
99
|
+
* @returns Validation result with details
|
|
100
|
+
*/
|
|
101
|
+
validate(payload: unknown, options?: {
|
|
102
|
+
queryParams?: Record<string, string>;
|
|
103
|
+
userAgent?: string;
|
|
104
|
+
}): WebhookValidation;
|
|
105
|
+
/**
|
|
106
|
+
* Helper method to create error response
|
|
107
|
+
*/
|
|
108
|
+
protected createErrorEvent(payload: unknown, errorMessage: string): UnifiedWebhookEvent;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Azure Speech-to-Text webhook handler
|
|
113
|
+
* Parses and normalizes Azure STT webhook callbacks
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Azure webhook event payload structure
|
|
118
|
+
* Based on Azure Speech Services v3.1 webhook format
|
|
119
|
+
*/
|
|
120
|
+
interface AzureWebhookPayload {
|
|
121
|
+
/** Event action (e.g., "TranscriptionCreated", "TranscriptionSucceeded", "TranscriptionFailed") */
|
|
122
|
+
action: string;
|
|
123
|
+
/** Timestamp of the event */
|
|
124
|
+
timestamp: string;
|
|
125
|
+
/** Self-link to the resource */
|
|
126
|
+
self?: string;
|
|
127
|
+
/** Additional properties */
|
|
128
|
+
properties?: Record<string, unknown>;
|
|
129
|
+
/** Error details (for failed events) */
|
|
130
|
+
error?: {
|
|
131
|
+
code: string;
|
|
132
|
+
message: string;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Azure webhook handler
|
|
137
|
+
*
|
|
138
|
+
* Handles webhook callbacks from Azure Speech Services API:
|
|
139
|
+
* - TranscriptionCreated - Transcription job created
|
|
140
|
+
* - TranscriptionRunning - Transcription is processing
|
|
141
|
+
* - TranscriptionSucceeded - Transcription completed successfully
|
|
142
|
+
* - TranscriptionFailed - Transcription failed with error
|
|
143
|
+
*
|
|
144
|
+
* Azure supports optional webhook signature verification using a shared secret.
|
|
145
|
+
*
|
|
146
|
+
* @example Basic usage
|
|
147
|
+
* ```typescript
|
|
148
|
+
* import { AzureWebhookHandler } from '@meeting-baas/sdk';
|
|
149
|
+
*
|
|
150
|
+
* const handler = new AzureWebhookHandler();
|
|
151
|
+
*
|
|
152
|
+
* // Validate webhook
|
|
153
|
+
* const validation = handler.validate(req.body);
|
|
154
|
+
* if (!validation.valid) {
|
|
155
|
+
* return res.status(400).json({ error: validation.error });
|
|
156
|
+
* }
|
|
157
|
+
*
|
|
158
|
+
* // Parse webhook
|
|
159
|
+
* const event = handler.parse(req.body);
|
|
160
|
+
* console.log('Event type:', event.eventType);
|
|
161
|
+
* console.log('Action:', event.raw.action);
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example With signature verification
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Verify webhook signature (if configured in Azure)
|
|
167
|
+
* const isValid = handler.verify(req.body, {
|
|
168
|
+
* signature: req.headers['x-azure-signature'],
|
|
169
|
+
* secret: process.env.AZURE_WEBHOOK_SECRET,
|
|
170
|
+
* rawBody: req.rawBody
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* if (!isValid) {
|
|
174
|
+
* return res.status(401).json({ error: 'Invalid signature' });
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @example Processing completed transcription
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const event = handler.parse(req.body);
|
|
181
|
+
*
|
|
182
|
+
* if (event.eventType === 'transcription.completed') {
|
|
183
|
+
* // Extract transcription ID from self link
|
|
184
|
+
* const transcriptionId = event.data?.id;
|
|
185
|
+
*
|
|
186
|
+
* // Fetch full transcript using AzureAdapter.getTranscript(transcriptionId)
|
|
187
|
+
* console.log('Transcription completed:', transcriptionId);
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
declare class AzureWebhookHandler extends BaseWebhookHandler {
|
|
192
|
+
readonly provider: TranscriptionProvider;
|
|
193
|
+
/**
|
|
194
|
+
* Check if payload matches Azure webhook format
|
|
195
|
+
*/
|
|
196
|
+
matches(payload: unknown, _options?: {
|
|
197
|
+
queryParams?: Record<string, string>;
|
|
198
|
+
userAgent?: string;
|
|
199
|
+
}): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Parse Azure webhook payload to unified format
|
|
202
|
+
*/
|
|
203
|
+
parse(payload: unknown, _options?: {
|
|
204
|
+
queryParams?: Record<string, string>;
|
|
205
|
+
}): UnifiedWebhookEvent;
|
|
206
|
+
/**
|
|
207
|
+
* Verify Azure webhook signature
|
|
208
|
+
*
|
|
209
|
+
* Azure can optionally sign webhooks using HMAC-SHA256.
|
|
210
|
+
* The signature is sent in the X-Azure-Signature header.
|
|
211
|
+
*
|
|
212
|
+
* Note: Signature verification is optional in Azure and must be
|
|
213
|
+
* configured when creating the webhook.
|
|
214
|
+
*
|
|
215
|
+
* @param payload - Webhook payload
|
|
216
|
+
* @param options - Verification options with signature and secret
|
|
217
|
+
* @returns true if signature is valid or no signature provided
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const isValid = handler.verify(req.body, {
|
|
222
|
+
* signature: req.headers['x-azure-signature'],
|
|
223
|
+
* secret: process.env.AZURE_WEBHOOK_SECRET,
|
|
224
|
+
* rawBody: req.rawBody
|
|
225
|
+
* });
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
verify(payload: unknown, options: WebhookVerificationOptions): boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Factory function to create an Azure webhook handler
|
|
232
|
+
*/
|
|
233
|
+
declare function createAzureWebhookHandler(): AzureWebhookHandler;
|
|
234
|
+
|
|
5
235
|
/**
|
|
6
236
|
* Unified webhook types for transcription providers
|
|
7
237
|
* Normalizes webhook callbacks from different providers to a common format
|
|
8
238
|
*/
|
|
9
239
|
|
|
240
|
+
/** AssemblyAI webhook payload — either a full Transcript or a lightweight notification (webhook schemas dropped from docs spec) */
|
|
241
|
+
type AssemblyAIWebhookPayload = Transcript | {
|
|
242
|
+
transcript_id: string;
|
|
243
|
+
status: string;
|
|
244
|
+
};
|
|
245
|
+
|
|
10
246
|
/**
|
|
11
247
|
* Union of all Gladia webhook payloads
|
|
12
248
|
*/
|
|
@@ -16,11 +252,11 @@ type GladiaWebhookPayload = CallbackTranscriptionSuccessPayload | CallbackTransc
|
|
|
16
252
|
*/
|
|
17
253
|
type ProviderWebhookPayloadMap = {
|
|
18
254
|
gladia: GladiaWebhookPayload;
|
|
19
|
-
assemblyai:
|
|
255
|
+
assemblyai: AssemblyAIWebhookPayload;
|
|
20
256
|
deepgram: ListenV1Response;
|
|
21
|
-
"azure-stt":
|
|
257
|
+
"azure-stt": AzureWebhookPayload;
|
|
22
258
|
"openai-whisper": never;
|
|
23
|
-
speechmatics:
|
|
259
|
+
speechmatics: RetrieveTranscriptResponse;
|
|
24
260
|
elevenlabs: SpeechToTextChunkResponseModel;
|
|
25
261
|
};
|
|
26
262
|
/**
|
|
@@ -123,112 +359,6 @@ interface WebhookVerificationOptions {
|
|
|
123
359
|
headers?: Record<string, string>;
|
|
124
360
|
}
|
|
125
361
|
|
|
126
|
-
/**
|
|
127
|
-
* Base webhook handler interface
|
|
128
|
-
* All provider-specific webhook handlers must implement this
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Abstract base class for webhook handlers
|
|
133
|
-
*
|
|
134
|
-
* Each provider implements this to parse and normalize their webhook payloads
|
|
135
|
-
*/
|
|
136
|
-
declare abstract class BaseWebhookHandler {
|
|
137
|
-
/** Provider name */
|
|
138
|
-
abstract readonly provider: TranscriptionProvider;
|
|
139
|
-
/**
|
|
140
|
-
* Check if this payload matches this provider's webhook format
|
|
141
|
-
*
|
|
142
|
-
* Used for auto-detection of webhook provider
|
|
143
|
-
*
|
|
144
|
-
* @param payload - Raw webhook payload
|
|
145
|
-
* @param options - Optional context (query params, headers, etc.)
|
|
146
|
-
* @returns true if this handler can process the payload
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```typescript
|
|
150
|
-
* matches(payload, options) {
|
|
151
|
-
* return typeof payload === 'object' &&
|
|
152
|
-
* 'event' in payload &&
|
|
153
|
-
* 'payload' in payload
|
|
154
|
-
* }
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
abstract matches(payload: unknown, options?: {
|
|
158
|
-
queryParams?: Record<string, string>;
|
|
159
|
-
userAgent?: string;
|
|
160
|
-
}): boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Parse and normalize webhook payload
|
|
163
|
-
*
|
|
164
|
-
* Converts provider-specific webhook format to UnifiedWebhookEvent
|
|
165
|
-
*
|
|
166
|
-
* @param payload - Raw webhook payload
|
|
167
|
-
* @param options - Optional context (query params, headers, etc.)
|
|
168
|
-
* @returns Normalized webhook event
|
|
169
|
-
* @throws Error if payload cannot be parsed
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```typescript
|
|
173
|
-
* parse(payload, options) {
|
|
174
|
-
* const typed = payload as ProviderWebhookPayload
|
|
175
|
-
* return {
|
|
176
|
-
* success: true,
|
|
177
|
-
* provider: this.provider,
|
|
178
|
-
* eventType: 'transcription.completed',
|
|
179
|
-
* data: { id: typed.job_id, ... },
|
|
180
|
-
* timestamp: new Date().toISOString(),
|
|
181
|
-
* raw: payload
|
|
182
|
-
* }
|
|
183
|
-
* }
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
abstract parse(payload: unknown, options?: {
|
|
187
|
-
queryParams?: Record<string, string>;
|
|
188
|
-
}): UnifiedWebhookEvent;
|
|
189
|
-
/**
|
|
190
|
-
* Verify webhook signature (if provider supports it)
|
|
191
|
-
*
|
|
192
|
-
* Optional method - implement if provider supports webhook signature verification
|
|
193
|
-
*
|
|
194
|
-
* @param payload - Raw webhook payload
|
|
195
|
-
* @param options - Verification options (signature, secret, etc.)
|
|
196
|
-
* @returns true if signature is valid
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```typescript
|
|
200
|
-
* verify(payload, options) {
|
|
201
|
-
* if (!options.signature || !options.secret) return false
|
|
202
|
-
*
|
|
203
|
-
* const computed = crypto
|
|
204
|
-
* .createHmac('sha256', options.secret)
|
|
205
|
-
* .update(JSON.stringify(payload))
|
|
206
|
-
* .digest('hex')
|
|
207
|
-
*
|
|
208
|
-
* return computed === options.signature
|
|
209
|
-
* }
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
verify?(payload: unknown, options: WebhookVerificationOptions): boolean;
|
|
213
|
-
/**
|
|
214
|
-
* Validate webhook payload structure
|
|
215
|
-
*
|
|
216
|
-
* Checks if payload has required fields and correct types
|
|
217
|
-
*
|
|
218
|
-
* @param payload - Raw webhook payload
|
|
219
|
-
* @param options - Optional context (query params, headers, etc.)
|
|
220
|
-
* @returns Validation result with details
|
|
221
|
-
*/
|
|
222
|
-
validate(payload: unknown, options?: {
|
|
223
|
-
queryParams?: Record<string, string>;
|
|
224
|
-
userAgent?: string;
|
|
225
|
-
}): WebhookValidation;
|
|
226
|
-
/**
|
|
227
|
-
* Helper method to create error response
|
|
228
|
-
*/
|
|
229
|
-
protected createErrorEvent(payload: unknown, errorMessage: string): UnifiedWebhookEvent;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
362
|
/**
|
|
233
363
|
* Gladia webhook handler
|
|
234
364
|
* Parses and normalizes Gladia webhook callbacks
|
|
@@ -514,111 +644,6 @@ declare class DeepgramWebhookHandler extends BaseWebhookHandler {
|
|
|
514
644
|
*/
|
|
515
645
|
declare function createDeepgramWebhookHandler(): DeepgramWebhookHandler;
|
|
516
646
|
|
|
517
|
-
/**
|
|
518
|
-
* Azure Speech-to-Text webhook handler
|
|
519
|
-
* Parses and normalizes Azure STT webhook callbacks
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Azure webhook handler
|
|
524
|
-
*
|
|
525
|
-
* Handles webhook callbacks from Azure Speech Services API:
|
|
526
|
-
* - TranscriptionCreated - Transcription job created
|
|
527
|
-
* - TranscriptionRunning - Transcription is processing
|
|
528
|
-
* - TranscriptionSucceeded - Transcription completed successfully
|
|
529
|
-
* - TranscriptionFailed - Transcription failed with error
|
|
530
|
-
*
|
|
531
|
-
* Azure supports optional webhook signature verification using a shared secret.
|
|
532
|
-
*
|
|
533
|
-
* @example Basic usage
|
|
534
|
-
* ```typescript
|
|
535
|
-
* import { AzureWebhookHandler } from '@meeting-baas/sdk';
|
|
536
|
-
*
|
|
537
|
-
* const handler = new AzureWebhookHandler();
|
|
538
|
-
*
|
|
539
|
-
* // Validate webhook
|
|
540
|
-
* const validation = handler.validate(req.body);
|
|
541
|
-
* if (!validation.valid) {
|
|
542
|
-
* return res.status(400).json({ error: validation.error });
|
|
543
|
-
* }
|
|
544
|
-
*
|
|
545
|
-
* // Parse webhook
|
|
546
|
-
* const event = handler.parse(req.body);
|
|
547
|
-
* console.log('Event type:', event.eventType);
|
|
548
|
-
* console.log('Action:', event.raw.action);
|
|
549
|
-
* ```
|
|
550
|
-
*
|
|
551
|
-
* @example With signature verification
|
|
552
|
-
* ```typescript
|
|
553
|
-
* // Verify webhook signature (if configured in Azure)
|
|
554
|
-
* const isValid = handler.verify(req.body, {
|
|
555
|
-
* signature: req.headers['x-azure-signature'],
|
|
556
|
-
* secret: process.env.AZURE_WEBHOOK_SECRET,
|
|
557
|
-
* rawBody: req.rawBody
|
|
558
|
-
* });
|
|
559
|
-
*
|
|
560
|
-
* if (!isValid) {
|
|
561
|
-
* return res.status(401).json({ error: 'Invalid signature' });
|
|
562
|
-
* }
|
|
563
|
-
* ```
|
|
564
|
-
*
|
|
565
|
-
* @example Processing completed transcription
|
|
566
|
-
* ```typescript
|
|
567
|
-
* const event = handler.parse(req.body);
|
|
568
|
-
*
|
|
569
|
-
* if (event.eventType === 'transcription.completed') {
|
|
570
|
-
* // Extract transcription ID from self link
|
|
571
|
-
* const transcriptionId = event.data?.id;
|
|
572
|
-
*
|
|
573
|
-
* // Fetch full transcript using AzureAdapter.getTranscript(transcriptionId)
|
|
574
|
-
* console.log('Transcription completed:', transcriptionId);
|
|
575
|
-
* }
|
|
576
|
-
* ```
|
|
577
|
-
*/
|
|
578
|
-
declare class AzureWebhookHandler extends BaseWebhookHandler {
|
|
579
|
-
readonly provider: TranscriptionProvider;
|
|
580
|
-
/**
|
|
581
|
-
* Check if payload matches Azure webhook format
|
|
582
|
-
*/
|
|
583
|
-
matches(payload: unknown, _options?: {
|
|
584
|
-
queryParams?: Record<string, string>;
|
|
585
|
-
userAgent?: string;
|
|
586
|
-
}): boolean;
|
|
587
|
-
/**
|
|
588
|
-
* Parse Azure webhook payload to unified format
|
|
589
|
-
*/
|
|
590
|
-
parse(payload: unknown, _options?: {
|
|
591
|
-
queryParams?: Record<string, string>;
|
|
592
|
-
}): UnifiedWebhookEvent;
|
|
593
|
-
/**
|
|
594
|
-
* Verify Azure webhook signature
|
|
595
|
-
*
|
|
596
|
-
* Azure can optionally sign webhooks using HMAC-SHA256.
|
|
597
|
-
* The signature is sent in the X-Azure-Signature header.
|
|
598
|
-
*
|
|
599
|
-
* Note: Signature verification is optional in Azure and must be
|
|
600
|
-
* configured when creating the webhook.
|
|
601
|
-
*
|
|
602
|
-
* @param payload - Webhook payload
|
|
603
|
-
* @param options - Verification options with signature and secret
|
|
604
|
-
* @returns true if signature is valid or no signature provided
|
|
605
|
-
*
|
|
606
|
-
* @example
|
|
607
|
-
* ```typescript
|
|
608
|
-
* const isValid = handler.verify(req.body, {
|
|
609
|
-
* signature: req.headers['x-azure-signature'],
|
|
610
|
-
* secret: process.env.AZURE_WEBHOOK_SECRET,
|
|
611
|
-
* rawBody: req.rawBody
|
|
612
|
-
* });
|
|
613
|
-
* ```
|
|
614
|
-
*/
|
|
615
|
-
verify(payload: unknown, options: WebhookVerificationOptions): boolean;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Factory function to create an Azure webhook handler
|
|
619
|
-
*/
|
|
620
|
-
declare function createAzureWebhookHandler(): AzureWebhookHandler;
|
|
621
|
-
|
|
622
647
|
/**
|
|
623
648
|
* Speechmatics webhook handler
|
|
624
649
|
* Parses and normalizes Speechmatics webhook callbacks
|
|
@@ -957,4 +982,4 @@ declare class WebhookRouter {
|
|
|
957
982
|
*/
|
|
958
983
|
declare function createWebhookRouter(): WebhookRouter;
|
|
959
984
|
|
|
960
|
-
export { AssemblyAIWebhookHandler,
|
|
985
|
+
export { AssemblyAIWebhookHandler, type 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "voice-router-dev",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Universal speech-to-text router for Gladia, AssemblyAI, Deepgram, Azure, OpenAI Whisper, Speechmatics, Soniox, and ElevenLabs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -152,14 +152,14 @@
|
|
|
152
152
|
"test:error-handling": "vitest run test/error-handling.test.ts",
|
|
153
153
|
"openapi:sync": "echo '🔄 Syncing OpenAPI specs from remote sources...' && node scripts/sync-specs.js",
|
|
154
154
|
"openapi:sync:gladia": "node scripts/sync-specs.js --provider gladia",
|
|
155
|
-
"openapi:sync:assemblyai": "node scripts/sync-specs.js --provider assemblyai
|
|
155
|
+
"openapi:sync:assemblyai": "node scripts/sync-specs.js --provider assemblyai",
|
|
156
156
|
"openapi:sync:deepgram": "node scripts/sync-specs.js --provider deepgram",
|
|
157
157
|
"openapi:sync:speechmatics": "node scripts/sync-specs.js --provider speechmatics && node scripts/sync-specs.js --provider speechmaticsAsync",
|
|
158
158
|
"openapi:sync:soniox": "node scripts/sync-specs.js --provider soniox",
|
|
159
159
|
"openapi:sync:elevenlabs": "node scripts/sync-specs.js --provider elevenlabs",
|
|
160
160
|
"openapi:validate": "node scripts/sync-specs.js --validate-only",
|
|
161
|
-
"openapi:fix-specs": "node scripts/fix-openai-spec.js && node scripts/fix-speechmatics-spec.js && node scripts/fix-deepgram-spec.js && node scripts/fix-elevenlabs-spec.js",
|
|
162
|
-
"openapi:fix": "node scripts/fix-generated.js &&
|
|
161
|
+
"openapi:fix-specs": "node scripts/fix-openai-spec.js && node scripts/fix-speechmatics-spec.js && node scripts/fix-deepgram-spec.js && node scripts/fix-elevenlabs-spec.js && node scripts/fix-assemblyai-spec.js",
|
|
162
|
+
"openapi:fix": "node scripts/fix-generated.js && sed -i \"s/'\\([a-z_]*\\)\\.'\\([a-z_]*\\)'/'\\1.\\2'/g\" src/generated/speechmatics/api/speechmaticsASRRESTAPI.zod.ts 2>/dev/null || true",
|
|
163
163
|
"openapi:clean": "rm -rf src/generated",
|
|
164
164
|
"openapi:clean:gladia": "rm -rf src/generated/gladia",
|
|
165
165
|
"openapi:clean:assemblyai": "rm -rf src/generated/assemblyai",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"openapi:sync-elevenlabs-models": "node scripts/generate-elevenlabs-models.js",
|
|
183
183
|
"openapi:generate": "pnpm openapi:fix-specs && pnpm openapi:clean && orval && pnpm openapi:sync-assemblyai-streaming && pnpm openapi:sync-deepgram-streaming && pnpm openapi:sync-deepgram-languages && pnpm openapi:sync-deepgram-models && pnpm openapi:sync-speechmatics-streaming && pnpm openapi:sync-speechmatics-languages && pnpm openapi:sync-soniox-streaming && pnpm openapi:sync-soniox-languages && pnpm openapi:sync-soniox-models && pnpm openapi:sync-openai-models && pnpm openapi:sync-azure-locales && pnpm openapi:sync-elevenlabs-languages && pnpm openapi:sync-elevenlabs-models && pnpm openapi:fix",
|
|
184
184
|
"openapi:generate:gladia": "pnpm openapi:clean:gladia && orval --config orval.config.ts --project gladiaApi && orval --config orval.config.ts --project gladiaZod && pnpm openapi:fix",
|
|
185
|
-
"openapi:generate:assemblyai": "pnpm openapi:clean:assemblyai && orval --config orval.config.ts --project assemblyaiApi && orval --config orval.config.ts --project assemblyaiZod && pnpm openapi:sync-assemblyai-streaming && pnpm openapi:fix",
|
|
185
|
+
"openapi:generate:assemblyai": "node scripts/fix-assemblyai-spec.js && pnpm openapi:clean:assemblyai && orval --config orval.config.ts --project assemblyaiApi && orval --config orval.config.ts --project assemblyaiZod && pnpm openapi:sync-assemblyai-streaming && pnpm openapi:fix",
|
|
186
186
|
"openapi:generate:deepgram": "pnpm openapi:clean:deepgram && orval --config orval.config.ts --project deepgramApi && orval --config orval.config.ts --project deepgramZod && pnpm openapi:sync-deepgram-streaming && pnpm openapi:sync-deepgram-languages && pnpm openapi:sync-deepgram-models && pnpm openapi:fix",
|
|
187
187
|
"openapi:generate:speechmatics": "node scripts/fix-speechmatics-spec.js && orval --config orval.config.ts --project speechmaticsApi && orval --config orval.config.ts --project speechmaticsZod && pnpm openapi:sync-speechmatics-streaming && pnpm openapi:sync-speechmatics-languages && pnpm openapi:fix",
|
|
188
188
|
"openapi:generate:speechmatics-streaming": "pnpm openapi:sync-speechmatics-streaming",
|