voice-router-dev 0.1.2 → 0.1.3

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
@@ -279,6 +279,49 @@ var BaseAdapter = class {
279
279
  // src/adapters/gladia-adapter.ts
280
280
  import axios from "axios";
281
281
  import WebSocket from "ws";
282
+
283
+ // src/router/audio-encoding-types.ts
284
+ var GLADIA_ENCODING_MAP = {
285
+ linear16: "wav/pcm",
286
+ mulaw: "wav/ulaw",
287
+ alaw: "wav/alaw"
288
+ };
289
+ var DEEPGRAM_ENCODING_MAP = {
290
+ linear16: "linear16",
291
+ mulaw: "mulaw",
292
+ flac: "flac",
293
+ opus: "opus",
294
+ speex: "speex",
295
+ "amr-nb": "amr-nb",
296
+ "amr-wb": "amr-wb",
297
+ g729: "g729"
298
+ };
299
+ var ASSEMBLYAI_ENCODING_MAP = {
300
+ linear16: "pcm_s16le"
301
+ };
302
+ function mapEncodingToProvider(unifiedEncoding, provider) {
303
+ let mapping;
304
+ switch (provider) {
305
+ case "gladia":
306
+ mapping = GLADIA_ENCODING_MAP;
307
+ break;
308
+ case "deepgram":
309
+ mapping = DEEPGRAM_ENCODING_MAP;
310
+ break;
311
+ case "assemblyai":
312
+ mapping = ASSEMBLYAI_ENCODING_MAP;
313
+ break;
314
+ }
315
+ const providerEncoding = mapping[unifiedEncoding];
316
+ if (!providerEncoding) {
317
+ throw new Error(
318
+ `Encoding '${unifiedEncoding}' is not supported by ${provider}. Supported encodings: ${Object.keys(mapping).join(", ")}`
319
+ );
320
+ }
321
+ return providerEncoding;
322
+ }
323
+
324
+ // src/adapters/gladia-adapter.ts
282
325
  var GladiaAdapter = class extends BaseAdapter {
283
326
  constructor() {
284
327
  super(...arguments);
@@ -666,7 +709,9 @@ var GladiaAdapter = class extends BaseAdapter {
666
709
  async transcribeStream(options, callbacks) {
667
710
  this.validateConfig();
668
711
  const streamingRequest = {
669
- encoding: options?.encoding,
712
+ // Map unified encoding format to Gladia's provider-specific format
713
+ // e.g., 'linear16' → 'wav/pcm'
714
+ encoding: options?.encoding ? mapEncodingToProvider(options.encoding, "gladia") : void 0,
670
715
  sample_rate: options?.sampleRate,
671
716
  channels: options?.channels,
672
717
  endpointing: options?.endpointing
@@ -3980,11 +4025,6 @@ var SummaryTypesEnum = {
3980
4025
  concise: "concise"
3981
4026
  };
3982
4027
 
3983
- // src/generated/gladia/schema/transcriptMessageType.ts
3984
- var TranscriptMessageType = {
3985
- transcript: "transcript"
3986
- };
3987
-
3988
4028
  // src/generated/gladia/schema/transcriptionControllerListV2KindItem.ts
3989
4029
  var TranscriptionControllerListV2KindItem = {
3990
4030
  "pre-recorded": "pre-recorded",
@@ -4102,6 +4142,11 @@ var TranscriptionLanguageCodeEnum = {
4102
4142
  zh: "zh"
4103
4143
  };
4104
4144
 
4145
+ // src/generated/gladia/schema/transcriptMessageType.ts
4146
+ var TranscriptMessageType = {
4147
+ transcript: "transcript"
4148
+ };
4149
+
4105
4150
  // src/generated/gladia/schema/translationLanguageCodeEnum.ts
4106
4151
  var TranslationLanguageCodeEnum = {
4107
4152
  af: "af",